diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 1720b579d..d80f6e599 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -1,63 +1,46 @@ -name: Report Bug 🪲 -description: Create a bug report -labels: - - bug +name: Bug report +description: Report a reproducible corebc.js problem +labels: [bug] body: - type: markdown attributes: - value: | - Please, provide as much details as possible to make proper evaluation and in the end resolve the bug report faster. - - - type: markdown - attributes: - value: | - Software specific details. - + value: Never include private keys, seed phrases, wallet passwords, or RPC credentials. - type: input - id: os + id: version attributes: - label: OS and version - description: Name and version of OS used. - placeholder: OS + label: corebc version + placeholder: 1.0.0 or commit hash validations: required: true - - - type: textarea - id: bug + - type: input + id: environment attributes: - label: Bug - description: Describe the Bug. - placeholder: Bug description + label: Runtime and operating system + description: Node.js or browser version, OS, and bundler if applicable. validations: required: true - + - type: dropdown + id: format + attributes: + label: Package format + options: [ESM, CommonJS, Browser bundle] - type: textarea id: reproduce attributes: - label: Reproduce Bug - description: Steps to reproduce the behavior. - placeholder: 1. Step 1 + label: Minimal reproduction + description: Include runnable code, steps, network ID, and CIP number when relevant. Use disposable test keys only. validations: required: true - - type: textarea id: expected attributes: label: Expected behavior - description: Describe the result you are expecting. - placeholder: Result validations: required: true - - - type: input - id: hash - attributes: - label: Commit hash - description: Commit hash if known. - placeholder: baf2aab0128f07262b564214ec70fc07befc6bb3 - - type: textarea - id: additional + id: actual attributes: - label: Additional context - description: Please, place additional content or screenshots. + label: Actual behavior and error output + description: Remove secrets and identifying information from logs. + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml index 1eb2f3440..ae68baba4 100644 --- a/.github/ISSUE_TEMPLATE/feature.yml +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -1,43 +1,31 @@ -name: Feature request 🔮 -description: Suggest an idea for this project -labels: - - feature +name: Feature request +description: Propose an improvement to corebc.js +labels: [enhancement] body: - - type: markdown - attributes: - value: | - Suggest an idea for this project and developers will consider the integration. - - type: textarea id: problem attributes: - label: Problem - description: Is your feature request related to a problem? Please describe. + label: Problem or use case validations: required: true - - type: textarea id: solution attributes: - label: Solution - description: Describe the solution you'd like. + label: Proposed API or behavior + description: Include a TypeScript example if possible. validations: required: true - - type: textarea id: alternatives attributes: - label: Alternatives - description: Describe alternatives you've considered. - - - type: textarea - id: implementation + label: Alternatives considered + - type: input + id: cip attributes: - label: Implementation - description: Describe implementation with example of the code. - + label: Related CIP or implementation + description: Link the specification or a compatible implementation. - type: textarea - id: additional + id: compatibility attributes: - label: Additional context - description: Please, place additional content or screenshots. + label: Compatibility and testing + description: Describe effects on existing callers, Node.js, browsers, and expected tests. diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 46283ae02..551a3e00f 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -1,36 +1,28 @@ -name: Node.js CI - +name: Package checks on: push: - branches: - - master - + branches: [master] + pull_request: + workflow_dispatch: +permissions: + contents: read +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: - - test-build: - + check: runs-on: ubuntu-latest - + timeout-minutes: 20 strategy: fail-fast: false matrix: - node-version: [ 16.x, 18.x, 20.x ] - + node: ["22.12.0", "24", "26"] steps: - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + - uses: actions/checkout@v6 + - uses: actions/setup-node@v6 with: - node-version: ${{ matrix.node-version }} - registry-url: 'https://registry.npmjs.org' - - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install dependencies - run: npm install - - - name: Build CommonJS and ESM (from TypeScript) - run: npm run build-all - - - name: Run written tests - run: npm run test \ No newline at end of file + node-version: ${{ matrix.node }} + package-manager-cache: false + - run: npm install + - run: npm run check + - run: npm audit --audit-level=high diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 8963519dc..7035569a1 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -1,21 +1,46 @@ -name: Publish to NPM +name: Publish to npm on: release: types: [published] +permissions: + contents: read +concurrency: + group: npm-publish + cancel-in-progress: false jobs: - build: + publish: runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read + id-token: write steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Node - uses: actions/setup-node@v3 + - uses: actions/checkout@v6 with: - node-version: latest - registry-url: 'https://registry.npmjs.org' - - name: Install & Build 🔧 - run: npm i && npm run build - - name: Publish package on NPM 📦 - run: npm publish --access public + ref: ${{ github.event.release.tag_name }} + - uses: actions/setup-node@v6 + with: + node-version: "24" + registry-url: https://registry.npmjs.org + package-manager-cache: false + - name: Set up npm trusted publishing + run: npm install --global npm@11.19.0 + - name: Check release version + env: + RELEASE_TAG: ${{ github.event.release.tag_name }} + run: | + node --input-type=module -e 'import fs from "node:fs"; const p = JSON.parse(fs.readFileSync("package.json")); if (process.env.RELEASE_TAG.replace(/^v/, "") !== p.version) throw new Error("Release tag must match package.json version");' + - run: npm install + - run: npm run check + - run: npm audit --audit-level=high + - name: Pack validated artifacts + run: npm pack --ignore-scripts + - name: Publish validated archive env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + PRERELEASE: ${{ github.event.release.prerelease }} + run: | + if [ "$PRERELEASE" = "true" ]; then + npm publish corebc-*.tgz --access public --provenance --tag next + else + npm publish corebc-*.tgz --access public --provenance --tag latest + fi diff --git a/.gitignore b/.gitignore index a0008a1e7..0c8d30946 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,25 @@ -node_modules/** -output/** -misc/** +# Installed dependencies and generated build outputs +node_modules/ +/dist/ +/lib.esm/ +/lib.commonjs/ +/types/ +/output/ +/coverage/ +.nyc_output/ +*.tsbuildinfo + +# Local tooling and temporary files +/misc/ +.cache/ +.history/ +.env +.env.* +!.env.example +!.env.*.example **/*.swp **/*.tgz -dist/*.gz # Logs logs @@ -22,10 +37,13 @@ lerna-debug.log* .yarn/install-state.gz .pnp.* -# lock files (excluding will cause npm ci inaccessible) +# This library does not commit package-manager lockfiles. package-lock.json +npm-shrinkwrap.json yarn.lock pnpm-lock.yaml +bun.lock +bun.lockb # Optional npm cache directory .npm diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 000000000..2903a07a6 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1 @@ +{ "useTabs": true } diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..90068e176 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog + +## 1.0.0 + +- Support the updated Noble hashes, TypeScript 7, Node types, and Rollup dependencies. +- Require Node.js 22.12 or newer; regenerate CommonJS through Rollup for ESM dependencies. +- Correct byte-array signing-key input and use Ed448 for shared secrets and point addition. +- Fix AES 3 keystore integration and browser crypto parity; bound wallet KDF resources and compare all MAC bytes. +- Synchronize the exported runtime version with the npm package version. +- Add typed CIP-150, CIP-151, and CIP-152 helpers, bounded IPFS JSON loading, and exact Core custom-unit balances. +- Add regression tests, package and browser smoke checks, npm dependency checks, issue forms, and validated npm trusted-publishing workflows. +- Update package documentation and contributor instructions. +- Remove committed build artifacts and lockfiles; generate npm distributions from source and use `npm install` in CI and releases. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..cedb5850d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,34 @@ +# Contributing to corebc.js + +Use Node.js 22.12 or newer (Node.js 24 is used for releases) and npm. Install dependencies with `npm install`. This library does not commit lockfiles; npm may create an ignored local lockfile. CI resolves dependencies from `package.json` on each fresh runner. + +```sh +npm install +npm run check +``` + +Edit TypeScript in `src.ts/`. Use tabs for indentation; `npm run format` applies the repository's Prettier configuration. Add regression tests under `src.ts/_tests/test-*.ts` for behavior changes. Keep private keys and RPC credentials out of issues and logs; test vectors must use disposable keys. + +`npm run check` builds ESM, CommonJS, browser bundles, and declarations, checks formatting, runs both Node module test suites, and installs a packed archive into a temporary project to check public exports and TypeScript consumers. It also exercises browser bundles without Node globals. Build outputs are ignored by Git and generated from source for validation and npm publication. Do not commit `dist/`, `lib.esm/`, `lib.commonjs/`, `types/`, or package-manager lockfiles. `npm run clean` removes generated outputs and `npm run build-all` restores them. + +The live fee-data test is optional because it depends on an external node: + +```sh +COREBC_RPC_URL=https://your-node.example npm test +``` + +Use a node with the Core `xcb_*` RPC API. Ordinary tests need no live blockchain. The package smoke check downloads production dependencies into a temporary directory and therefore needs registry access. Run `npm audit` to inspect dependency advisories. + +For CIP changes, link the [proposal](https://cip.coreblockchain.net/), describe supported operations and interoperability vectors, and update the README. Current helpers follow the CIP-150/151/152 and custom-unit work introduced in core_web3dart commit `ec787c8`, with subsequent history reviewed through `e472746`. Custom units are a Core application convention and are not presented as a numbered CIP. Keep token amounts and Unix seconds as `bigint`; use an explicit block reference when related reads need a consistent snapshot. + +Open a pull request explaining the problem, changed behavior, and validation. Bug and feature forms are available under GitHub Issues. + +## Releases + +1. Update `package.json` and `src.ts/_version.ts` to the intended version, install dependencies with `npm install`, and document changes in `CHANGELOG.md`. +2. Run `npm run check` and commit source, configuration, and documentation changes. +3. Create a GitHub release whose tag is the version, optionally prefixed with `v`. + +The release workflow checks the tag against the package version, reruns validation and the dependency audit, and publishes the validated npm archive with provenance. Both workflows use `npm install` with package-manager caching disabled; npm creates an ephemeral runner lockfile for the dependency audit. GitHub prereleases use the `next` dist-tag; normal releases use `latest`. + +Before the first automated release, a package owner must configure an npm trusted publisher for `CorePass/corebc.js`, workflow `publish-npm.yml`. This is an npm account setting, not a repository secret. See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/). Publishing a GitHub release triggers publication; CI on pull requests does not publish. diff --git a/README.md b/README.md index d8119a15b..5d47fc5cd 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,110 @@ # CoreBC -A complete, compact, and simple library for CoreBC, written in [TypeScript](https://www.typescriptlang.org). +TypeScript and JavaScript tools for Core Blockchain: Ed448 wallets, signing, Core addresses, `xcb_*` JSON-RPC providers, ABI encoding, smart contracts, and token metadata. -## Features +## Install -- Keep your private keys in your client -- Import and export **JSON wallets** (Gocore, XCB HODLER, CorePass) -- Use meta-classes to generate JavaScript objects from any contract ABI, including **ABIv2** and **Human-Readable ABI** -- **Tree-shaking** focused; include only what you need during bundling -- **Complete** functionality to fulfill all your CoreBC needs -- Entirely written in **TypeScript** with strict types for enhanced security -- **CORE License** (MIT for ALL dependencies); fully open source +Requires Node.js **22.12 or newer**, or a modern browser with BigInt and Web Crypto support. -## Installation +```sh +npm install corebc +``` -### NodeJS +```ts +import { JsonRpcProvider, formatXCB } from "corebc"; -```bash -npm i corebc +const provider = new JsonRpcProvider("https://your-core-node.example"); +console.log(await provider.getBlockNumber()); +// console.log(formatXCB(await provider.getBalance(coreAddress))); +provider.destroy(); ``` -### Browser (ESM) +Use your own Core RPC endpoint. CommonJS is supported with `const { Wallet } = require("corebc")`. The package includes declarations and subpath exports such as `corebc/abi`, `corebc/crypto`, `corebc/providers`, `corebc/cip`, and `corebc/ipfs`. -The bundled library is available in the `./dist/` folder in this repo. +## Wallets and contracts -```html - +```ts +import { Wallet, networkIdToPrefix } from "corebc"; + +const wallet = Wallet.createRandom(networkIdToPrefix(3)); +console.log(wallet.address); +const signature = await wallet.signMessage("Hello Core"); +``` + +Wallets support mnemonics, seed derivation, and encrypted JSON keystores. Wallet KDF limits match Core Web3Dart: PBKDF2 permits up to 10 million iterations; scrypt permits `N <= 1048576`, `r * p <= 1048576`, and at most 256 MiB of estimated memory. Wallets exceeding these limits are rejected. Private keys stay with the caller. Core uses 57-byte Ed448 private and public keys and network-prefixed addresses; Ethereum secp256k1 keys are not interchangeable. Keep private keys and recovery phrases out of logs and source control. + +`Contract` accepts JSON or human-readable ABIs and a provider for reads or signer for writes. Transaction fields use `energyLimit`, `energyPrice`, and `networkId`. + +For compatibility, the existing `sha256` and `sha512` exports compute **SHA3-256 and SHA3-512** respectively. `keccak256` is a separate algorithm. Do not substitute hashes when porting signing code. + +## CIP metadata + +The typed helpers follow the same feature scope as Core Web3Dart: + +| Standard | Support | +| ---------------------------------------------------------- | -------------------------------------------------------------------------------- | +| [CIP-150](https://cip.coreblockchain.net/cip/cbc/cip-150/) | Read, enumerate, set, and seal on-chain metadata | +| [CIP-151](https://cip.coreblockchain.net/cip/cbc/cip-151/) | Optional expiration and trading-stop timestamps; inclusive boundary checks | +| [CIP-152](https://cip.coreblockchain.net/cip/cbc/cip-152/) | Resolve `lab` references ending in `lab.json` and validate measurement structure | + +```ts +import { Cip150MetadataContract, IpfsGateway } from "corebc"; + +// provider is a JsonRpcProvider; tokenAddress is a Core contract address. +const metadata = new Cip150MetadataContract(tokenAddress, provider); +const block = await provider.getBlockNumber(); +const entries = await metadata.readAll(block); +const lifecycle = await metadata.readLifecycle(block); +const expired = lifecycle.isExpiredAt(BigInt(Math.floor(Date.now() / 1000))); +const lab = await metadata.readLabCertificate(new IpfsGateway(), block); ``` -## Providers +CIP-151 timestamps remain exact `bigint` Unix seconds. Missing lifecycle values impose no limit. These helpers expose metadata; enforcement of transfers or trading belongs to the contract or application. CIP-152 validation checks JSON structure, not issuer authenticity or gateway content integrity. + +## IPFS and custom units -CoreBC collaborates with an ever-growing list of third-party providers, making it quick and easy to get started. CoreBC provides default keys for each service. +`IpfsGateway` accepts `ipfs://CID/path`, `/ipfs/CID/path`, bare CID references, and HTTP(S) URLs. Its default template is `https://ipf.sk/{cid}`; configure another gateway with `new IpfsGateway({ template: "https://gateway.example/ipfs/{cid}" })`. JSON reads default to a 1 MiB limit and 30-second timeout. Treat metadata URLs as untrusted input; server applications should supply a `fetch` implementation that enforces their outbound network policy. -These built-in keys allow you to use `corebc.getDefaultProvider()` and begin developing immediately. +```ts +import { CustomUnitToken } from "corebc/cip"; + +const token = new CustomUnitToken(tokenAddress, provider); +const block = await provider.getBlockNumber(); +const units = await token.discover(block); +if (units) { + const balance = await token.balance( + accountAddress, + units.preferredUnit, + block, + ); + console.log(balance.canonicalAmount, balance.unitAmount, balance.unit); +} +``` -However, note that the API keys provided by CoreBC are shared and intentionally throttled. This approach encourages developers to acquire their own keys, which come with additional benefits like faster responses, increased capacity, analytics, and access to features like archival data. +Custom-unit discovery follows the Tone/Core API convention: `supportsUnit`, `supportedUnits`, `preferredUnit`, and `balanceOfUnit`. Balances and multiplier numerator/denominator stay as `bigint`; a zero canonical balance has no defined multiplier. This convention is separate from the numbered CIPs above. -## Extension Packages +## Browser bundles -The `corebc` package includes the core functionality required to interact with CoreBC. There are several other packages designed to augment its functionality and improve the user experience. +ESM and UMD bundles, including minified versions, are in `dist/` in the npm package. Serve them from your application: + +```html + +``` + +The UMD bundle `dist/corebc.umd.min.js` exposes `globalThis.corebc`. Secure randomness requires a secure browser context. + +## Development + +```sh +npm install +npm run check +``` -- Hardware Wallets (@TODO) +See [CONTRIBUTING.md](CONTRIBUTING.md) for builds, tests, CIP contributions, and release setup. Report problems or request features through the [issue forms](https://github.com/CorePass/corebc.js/issues/new/choose). ## License -CORE License (MIT for ALL dependencies). +[CORE License](LICENSE). Dependencies retain their respective licenses. diff --git a/dist/README.md b/dist/README.md deleted file mode 100644 index 78b13a88d..000000000 --- a/dist/README.md +++ /dev/null @@ -1,22 +0,0 @@ -Distribution Folder -=================== - -The contents of this folder are for using `import` in ESM -browser-base projects. - -The `ethers.js` (and `ethers.min.js`) files only include the -English wordlist to conserve space. - -For additional Wordlist support, the `wordlist-extra.js` (and -`wordlist-extra.min.js`) should be imported too. - - -Notes ------ - -The contents are generated via the `npm build dist` target using -`rollup` and the `/rollup.config.js` configuration. - -Do not modify the files in this folder. They are deleted on `build-clean`. - -To modify this `README.md`, see the `/output/post-build/dist`. diff --git a/dist/corebc.js b/dist/corebc.js deleted file mode 100644 index 544cc6dd5..000000000 --- a/dist/corebc.js +++ /dev/null @@ -1,19799 +0,0 @@ -const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !== 'undefined' ? window: typeof global !== 'undefined' ? global: typeof self !== 'undefined' ? self: {}); -import { Buffer as Buffer$1 } from 'buffer'; -export { Buffer } from 'buffer'; -import ed448 from 'bcrypto/lib/ed448-browser.js'; -import _BN from 'bn.js'; -import pbkdf2$2 from 'bcrypto/lib/pbkdf2-browser.js'; -import SHA3_512 from 'bcrypto/lib/sha3-512.js'; -import utf8 from 'utf8'; -import pkg from 'aes-js'; - -/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ -/** - * The current version of corebc. - */ -const version = "6.4.0"; - -let _permanentCensorErrors = false; -let _censorErrors = false; -const LogLevels = { - debug: 1, - default: 2, - info: 2, - warning: 3, - error: 4, - off: 5, -}; -let _logLevel = LogLevels["default"]; -let _globalLogger = null; -function _checkNormalize() { - try { - const missing = []; - // Make sure all forms of normalization are supported - ["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => { - try { - if ("test".normalize(form) !== "test") { - throw new Error("bad normalize"); - } - } - catch (error) { - missing.push(form); - } - }); - if (missing.length) { - throw new Error("missing " + missing.join(", ")); - } - if (String.fromCharCode(0xe9).normalize("NFD") !== - String.fromCharCode(0x65, 0x0301)) { - throw new Error("broken implementation"); - } - } - catch (error) { - return error.message; - } - return null; -} -const _normalizeError = _checkNormalize(); -var LogLevel; -(function (LogLevel) { - LogLevel["DEBUG"] = "DEBUG"; - LogLevel["INFO"] = "INFO"; - LogLevel["WARNING"] = "WARNING"; - LogLevel["ERROR"] = "ERROR"; - LogLevel["OFF"] = "OFF"; -})(LogLevel || (LogLevel = {})); -var ErrorCode; -(function (ErrorCode) { - /////////////////// - // Generic Errors - // Unknown Error - ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; - // Not Implemented - ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED"; - // Unsupported Operation - // - operation - ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION"; - // Network Error (i.e. Core Network, such as an invalid network ID) - // - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown) - ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR"; - // Some sort of bad response from the server - ErrorCode["SERVER_ERROR"] = "SERVER_ERROR"; - // Timeout - ErrorCode["TIMEOUT"] = "TIMEOUT"; - /////////////////// - // Operational Errors - // Buffer Overrun - ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN"; - // Numeric Fault - // - operation: the operation being executed - // - fault: the reason this faulted - ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT"; - /////////////////// - // Argument Errors - // Missing new operator to an object - // - name: The name of the class - ErrorCode["MISSING_NEW"] = "MISSING_NEW"; - // Invalid argument (e.g. value is incompatible with type) to a function: - // - argument: The argument name that was invalid - // - value: The value of the argument - ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT"; - // Missing argument to a function: - // - count: The number of arguments received - // - expectedCount: The number of arguments expected - ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT"; - // Too many arguments - // - count: The number of arguments received - // - expectedCount: The number of arguments expected - ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT"; - /////////////////// - // Blockchain Errors - // Call exception - // - transaction: the transaction - // - address?: the contract address - // - args?: The arguments passed into the function - // - method?: The Solidity method signature - // - errorSignature?: The EIP848 error signature - // - errorArgs?: The EIP848 error parameters - // - reason: The reason (only for EIP848 "Error(string)") - ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION"; - // Insufficient funds (< value + energyLimit * energyPrice) - // - transaction: the transaction attempted - ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; - // Nonce has already been used - // - transaction: the transaction attempted - ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED"; - // The replacement fee for the transaction is too low - // - transaction: the transaction attempted - ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED"; - // The energy limit could not be estimated - // - transaction: the transaction passed to estimateEnergy - ErrorCode["UNPREDICTABLE_ENERGY_LIMIT"] = "UNPREDICTABLE_ENERGY_LIMIT"; - // The transaction was replaced by one with a higher energy price - // - reason: "cancelled", "replaced" or "repriced" - // - cancelled: true if reason == "cancelled" or reason == "replaced") - // - hash: original transaction hash - // - replacement: the full TransactionsResponse for the replacement - // - receipt: the receipt of the replacement - ErrorCode["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED"; -})(ErrorCode || (ErrorCode = {})); -const HEX = "0123456789abcdef"; -class Logger { - version = "0.0.1"; - static errors = ErrorCode; - static levels = LogLevel; - constructor(version) { - Object.defineProperty(this, "version", { - enumerable: true, - value: version, - writable: false, - }); - } - _log(logLevel, args) { - const level = logLevel.toLowerCase(); - if (LogLevels[level] == null) { - this.throwArgumentError("invalid log level name", "logLevel", logLevel); - } - if (_logLevel > LogLevels[level]) { - return; - } - console.log.apply(console, args); - } - debug(...args) { - this._log(Logger.levels.DEBUG, args); - } - info(...args) { - this._log(Logger.levels.INFO, args); - } - warn(...args) { - this._log(Logger.levels.WARNING, args); - } - makeError(message, code, params) { - // Errors are being censored - if (_censorErrors) { - return this.makeError("censored error", code, {}); - } - if (!code) { - code = Logger.errors.UNKNOWN_ERROR; - } - if (!params) { - params = {}; - } - const messageDetails = []; - Object.keys(params).forEach((key) => { - const value = params[key]; - try { - if (value instanceof Uint8Array) { - let hex = ""; - for (let i = 0; i < value.length; i++) { - hex += HEX[value[i] >> 4]; - hex += HEX[value[i] & 0x0f]; - } - messageDetails.push(key + "=Uint8Array(0x" + hex + ")"); - } - else { - messageDetails.push(key + "=" + JSON.stringify(value)); - } - } - catch (error) { - messageDetails.push(key + "=" + JSON.stringify(params[key].toString())); - } - }); - messageDetails.push(`code=${code}`); - messageDetails.push(`version=${this.version}`); - const reason = message; - if (messageDetails.length) { - message += " (" + messageDetails.join(", ") + ")"; - } - // @TODO: Any?? - const error = new Error(message); - error.reason = reason; - error.code = code; - Object.keys(params).forEach(function (key) { - error[key] = params[key]; - }); - return error; - } - throwError(message, code, params) { - throw this.makeError(message, code, params); - } - throwArgumentError(message, name, value) { - return this.throwError(message, Logger.errors.INVALID_ARGUMENT, { - argument: name, - value: value, - }); - } - assert(condition, message, code, params) { - if (!!condition) { - return; - } - this.throwError(message, code, params); - } - assertArgument(condition, message, name, value) { - if (!!condition) { - return; - } - this.throwArgumentError(message, name, value); - } - checkNormalize(message) { - if (_normalizeError) { - this.throwError("platform missing String.prototype.normalize", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "String.prototype.normalize", - form: _normalizeError, - }); - } - } - checkSafeUint53(value, message) { - if (typeof value !== "number") { - return; - } - if (message == null) { - message = "value not safe"; - } - if (value < 0 || value >= 0x1fffffffffffff) { - this.throwError(message, Logger.errors.NUMERIC_FAULT, { - operation: "checkSafeInteger", - fault: "out-of-safe-range", - value: value, - }); - } - if (value % 1) { - this.throwError(message, Logger.errors.NUMERIC_FAULT, { - operation: "checkSafeInteger", - fault: "non-integer", - value: value, - }); - } - } - checkArgumentCount(count, expectedCount, message) { - if (message) { - message = ": " + message; - } - else { - message = ""; - } - if (count < expectedCount) { - this.throwError("missing argument" + message, Logger.errors.MISSING_ARGUMENT, { - count: count, - expectedCount: expectedCount, - }); - } - if (count > expectedCount) { - this.throwError("too many arguments" + message, Logger.errors.UNEXPECTED_ARGUMENT, { - count: count, - expectedCount: expectedCount, - }); - } - } - checkNew(target, kind) { - if (target === Object || target == null) { - this.throwError("missing new", Logger.errors.MISSING_NEW, { - name: kind.name, - }); - } - } - checkAbstract(target, kind) { - if (target === kind) { - this.throwError("cannot instantiate abstract class " + - JSON.stringify(kind.name) + - " directly; use a sub-class", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" }); - } - else if (target === Object || target == null) { - this.throwError("missing new", Logger.errors.MISSING_NEW, { - name: kind.name, - }); - } - } - static globalLogger() { - if (!_globalLogger) { - _globalLogger = new Logger("logger/0.0.1"); - } - return _globalLogger; - } - static setCensorship(censorship, permanent) { - if (!censorship && permanent) { - this.globalLogger().throwError("cannot permanently disable censorship", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "setCensorship", - }); - } - if (_permanentCensorErrors) { - if (!censorship) { - return; - } - this.globalLogger().throwError("error censorship permanent", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "setCensorship", - }); - } - _censorErrors = !!censorship; - _permanentCensorErrors = !!permanent; - } - static setLogLevel(logLevel) { - const level = LogLevels[logLevel.toLowerCase()]; - if (level == null) { - Logger.globalLogger().warn("invalid log level - " + logLevel); - return; - } - _logLevel = level; - } - static from(version) { - return new Logger(version); - } -} - -/** - * Property helper functions. - * - * @_subsection api/utils:Properties [about-properties] - */ -const logger$7 = new Logger("utils/properties/0.0.1"); -function checkType(value, type, name) { - const types = type.split("|").map((t) => t.trim()); - for (let i = 0; i < types.length; i++) { - switch (type) { - case "any": - return; - case "bigint": - case "boolean": - case "number": - case "string": - if (typeof value === type) { - return; - } - } - } - const error = new Error(`invalid value for type ${type}`); - error.code = "INVALID_ARGUMENT"; - error.argument = `value.${name}`; - error.value = value; - throw error; -} -/** - * Resolves to a new object that is a copy of %%value%%, but with all - * values resolved. - */ -async function resolveProperties(value) { - const keys = Object.keys(value); - const results = await Promise.all(keys.map((k) => Promise.resolve(value[k]))); - return results.reduce((accum, v, index) => { - accum[keys[index]] = v; - return accum; - }, {}); -} -/** - * Assigns the %%values%% to %%target%% as read-only values. - * - * It %%types%% is specified, the values are checked. - */ -function defineProperties(target, values, types) { - for (let key in values) { - let value = values[key]; - const type = types ? types[key] : null; - if (type) { - checkType(value, type, key); - } - Object.defineProperty(target, key, { - enumerable: true, - value, - writable: false, - }); - } -} -function checkProperties(object, properties) { - if (!object || typeof object !== "object") { - logger$7.throwArgumentError("invalid object", "object", object); - } - Object.keys(object).forEach((key) => { - if (!properties[key]) { - logger$7.throwArgumentError("invalid object key - " + key, "transaction:" + key, object); - } - }); -} - -/** - * About Errors. - * - * @_section: api/utils/errors:Errors [about-errors] - */ -function stringify$1(value) { - if (value == null) { - return "null"; - } - if (Array.isArray(value)) { - return "[ " + value.map(stringify$1).join(", ") + " ]"; - } - if (value instanceof Uint8Array) { - const HEX = "0123456789abcdef"; - let result = "0x"; - for (let i = 0; i < value.length; i++) { - result += HEX[value[i] >> 4]; - result += HEX[value[i] & 0xf]; - } - return result; - } - if (typeof value === "object" && typeof value.toJSON === "function") { - return stringify$1(value.toJSON()); - } - switch (typeof value) { - case "boolean": - case "symbol": - return value.toString(); - case "bigint": - return BigInt(value).toString(); - case "number": - return value.toString(); - case "string": - return JSON.stringify(value); - case "object": { - const keys = Object.keys(value); - keys.sort(); - return ("{ " + - keys.map((k) => `${stringify$1(k)}: ${stringify$1(value[k])}`).join(", ") + - " }"); - } - } - return `[ COULD NOT SERIALIZE ]`; -} -/** - * Returns true if the %%error%% matches an error thrown by corebc - * that matches the error %%code%%. - * - * In TypeScript envornoments, this can be used to check that %%error%% - * matches an corebcError type, which means the expected properties will - * be set. - * - * @See [ErrorCodes](api:ErrorCode) - * @example - * try { - * // code.... - * } catch (e) { - * if (isError(e, "CALL_EXCEPTION")) { - * // The Type Guard has validated this object - * console.log(e.data); - * } - * } - */ -function isError(error, code) { - return error && error.code === code; -} -/** - * Returns true if %%error%% is a [[CallExceptionError]. - */ -function isCallException(error) { - return isError(error, "CALL_EXCEPTION"); -} -/** - * Returns a new Error configured to the format corebc emits errors, with - * the %%message%%, [[api:ErrorCode]] %%code%% and additioanl properties - * for the corresponding corebcError. - * - * Each error in corebc includes the version of corebc, a - * machine-readable [[ErrorCode]], and depneding on %%code%%, additional - * required properties. The error message will also include the %%meeage%%, - * corebc version, %%code%% and all aditional properties, serialized. - */ -function makeError(message, code, info) { - { - const details = []; - if (info) { - if ("message" in info || "code" in info || "name" in info) { - throw new Error(`value will overwrite populated values: ${stringify$1(info)}`); - } - for (const key in info) { - const value = info[key]; - // try { - details.push(key + "=" + stringify$1(value)); - // } catch (error: any) { - // console.log("MMM", error.message); - // details.push(key + "=[could not serialize object]"); - // } - } - } - details.push(`code=${code}`); - details.push(`version=${version}`); - if (details.length) { - message += " (" + details.join(", ") + ")"; - } - } - let error; - switch (code) { - case "INVALID_ARGUMENT": - error = new TypeError(message); - break; - case "NUMERIC_FAULT": - case "BUFFER_OVERRUN": - error = new RangeError(message); - break; - default: - error = new Error(message); - } - defineProperties(error, { code }); - if (info) { - Object.assign(error, info); - } - return error; -} -/** - * Throws an corebcError with %%message%%, %%code%% and additional error - * %%info%% when %%check%% is falsish.. - * - * @see [[api:makeError]] - */ -function assert(check, message, code, info) { - if (!check) { - throw makeError(message, code, info); - } -} -/** - * A simple helper to simply ensuring provided arguments match expected - * constraints, throwing if not. - * - * In TypeScript environments, the %%check%% has been asserted true, so - * any further code does not need additional compile-time checks. - */ -function assertArgument(check, message, name, value) { - assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); -} -function assertArgumentCount(count, expectedCount, message) { - if (message == null) { - message = ""; - } - if (message) { - message = ": " + message; - } - assert(count >= expectedCount, "missing arguemnt" + message, "MISSING_ARGUMENT", { - count: count, - expectedCount: expectedCount, - }); - assert(count <= expectedCount, "too many arguemnts" + message, "UNEXPECTED_ARGUMENT", { - count: count, - expectedCount: expectedCount, - }); -} -const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => { - try { - // General test for normalize - /* c8 ignore start */ - if ("test".normalize(form) !== "test") { - throw new Error("bad"); - } - /* c8 ignore stop */ - if (form === "NFD") { - const check = String.fromCharCode(0xe9).normalize("NFD"); - const expected = String.fromCharCode(0x65, 0x0301); - /* c8 ignore start */ - if (check !== expected) { - throw new Error("broken"); - } - /* c8 ignore stop */ - } - accum.push(form); - } - catch (error) { } - return accum; -}, []); -/** - * Throws if the normalization %%form%% is not supported. - */ -function assertNormalize(form) { - assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", { - operation: "String.prototype.normalize", - info: { form }, - }); -} -/** - * Many classes use file-scoped values to guard the constructor, - * making it effectively private. This facilitates that pattern - * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, - * throwing if not, indicating the %%className%% if provided. - */ -function assertPrivate(givenGuard, guard, className) { - if (className == null) { - className = ""; - } - if (givenGuard !== guard) { - let method = className, operation = "new"; - if (className) { - method += "."; - operation += " " + className; - } - assert(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", { - operation, - }); - } -} - -/** - * Some data helpers. - * - * - * @_subsection api/utils:Data Helpers [about-data] - */ -const logger$6 = new Logger("utils/data/0.0.1"); -function isHexable(value) { - return !!value.toHexString; -} -function isInteger(value) { - return typeof value === "number" && value == value && value % 1 === 0; -} -function isBytes(value) { - if (value == null) { - return false; - } - if (value.constructor === Uint8Array) { - return true; - } - if (typeof value === "string") { - return false; - } - if (!isInteger(value.length) || value.length < 0) { - return false; - } - for (let i = 0; i < value.length; i++) { - const v = value[i]; - if (!isInteger(v) || v < 0 || v >= 256) { - return false; - } - } - return true; -} -function _getBytes(value, name, copy) { - if (value instanceof Uint8Array) { - if (copy) { - return new Uint8Array(value); - } - return value; - } - if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) { - const result = new Uint8Array((value.length - 2) / 2); - let offset = 2; - for (let i = 0; i < result.length; i++) { - result[i] = parseInt(value.substring(offset, offset + 2), 16); - offset += 2; - } - return result; - } - assertArgument(false, "invalid BytesLike value", name || "value", value); -} -/** - * Get a typed Uint8Array for %%value%%. If already a Uint8Array - * the original %%value%% is returned; if a copy is required use - * [[getBytesCopy]]. - * - * @see: getBytesCopy - */ -function getBytes(value, name) { - return _getBytes(value, name, false); -} -/** - * Get a typed Uint8Array for %%value%%, creating a copy if necessary - * to prevent any modifications of the returned value from being - * reflected elsewhere. - * - * @see: getBytes - */ -function getBytesCopy(value, name) { - return _getBytes(value, name, true); -} -/** - * Returns true if %%value%% is a valid [[HexString]]. - * - * If %%length%% is ``true`` or a //number//, it also checks that - * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) - * bytes of data (e.g. ``0x1234`` is 2 bytes). - */ -function isHexString(value, length) { - if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { - return false; - } - if (typeof length === "number" && value.length !== 2 + 2 * length) { - return false; - } - if (length === true && value.length % 2 !== 0) { - return false; - } - return true; -} -/** - * Returns true if %%value%% is a valid representation of arbitrary - * data (i.e. a valid [[DataHexString]] or a Uint8Array). - */ -function isBytesLike(value) { - return isHexString(value, true) || value instanceof Uint8Array; -} -const HexCharacters = "0123456789abcdef"; -/** - * Returns a [[DataHexString]] representation of %%data%%. - */ -function hexlify(value, options) { - if (!options) { - options = {}; - } - if (typeof value === "string") { - if (value.includes(",") && value.startsWith("0x")) { - const v = value - .replace("0x", "") - .split(",") - .map((item) => Number(item)); - // @ts-ignore - value = new Uint8Array(v); - } - } - if (typeof value === "number") { - logger$6.checkSafeUint53(value, "invalid hexlify value"); - let hex = ""; - while (value) { - hex = HexCharacters[value & 0xf] + hex; - value = Math.floor(value / 16); - } - if (hex.length) { - if (hex.length % 2) { - hex = "0" + hex; - } - return "0x" + hex; - } - return "0x00"; - } - if (typeof value === "bigint") { - value = value.toString(16); - if (value.length % 2) { - return "0x0" + value; - } - return "0x" + value; - } - if (options.allowMissingPrefix && - typeof value === "string" && - value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - if (isHexable(value)) { - return value.toHexString(); - } - if (isHexString(value)) { - if (value.length % 2) { - if (options.hexPad === "left") { - value = "0x0" + value.substring(2); - } - else if (options.hexPad === "right") { - value += "0"; - } - else { - logger$6.throwArgumentError("hex data is odd-length", "value", value); - } - } - return value.toLowerCase(); - } - if (isBytes(value)) { - let result = "0x"; - for (let i = 0; i < value.length; i++) { - let v = value[i]; - result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; - } - return result; - } - return logger$6.throwArgumentError("invalid hexlify value", "value", value); -} -/** - * Returns a [[DataHexString]] by concatenating all values - * within %%data%%. - */ -function concat(items) { - return "0x" + items.map((d) => hexlify(d).substring(2)).join(""); -} -function hexDataSlice(data, offset, endOffset) { - if (typeof data !== "string") { - data = hexlify(data); - } - else if (!isHexString(data) || data.length % 2) { - logger$6.throwArgumentError("invalid hexData", "value", data); - } - offset = 2 + 2 * offset; - if (endOffset != null) { - return "0x" + data.substring(offset, 2 + 2 * endOffset); - } - return "0x" + data.substring(offset); -} -function hexDataLength(data) { - if (typeof data !== "string") { - data = hexlify(data); - } - else if (!isHexString(data) || data.length % 2) { - return null; - } - return (data.length - 2) / 2; -} -/** - * Returns the length of %%data%%, in bytes. - */ -function dataLength(data) { - if (isHexString(data, true)) { - return (data.length - 2) / 2; - } - return getBytes(data).length; -} -/** - * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% - * offset to the %%end%% offset. - * - * By default %%start%% is 0 and %%end%% is the length of %%data%%. - */ -function dataSlice(data, start, end) { - const bytes = getBytes(data); - if (end != null && end > bytes.length) { - assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { - buffer: bytes, - length: bytes.length, - offset: end, - }); - } - return hexlify(bytes.slice(start == null ? 0 : start, end == null ? bytes.length : end)); -} -/** - * Return the [[DataHexString]] result by stripping all **leading** - ** zero bytes from %%data%%. - */ -function stripZerosLeft(data) { - let bytes = hexlify(data).substring(2); - while (bytes.startsWith("00")) { - bytes = bytes.substring(2); - } - return "0x" + bytes; -} -function zeroPad(data, length, left) { - const bytes = getBytes(data); - assert(length >= bytes.length, "padding exceeds data length", "BUFFER_OVERRUN", { - buffer: new Uint8Array(bytes), - length: length, - offset: length + 1, - }); - const result = new Uint8Array(length); - result.fill(0); - if (left) { - result.set(bytes, length - bytes.length); - } - else { - result.set(bytes, 0); - } - return hexlify(result); -} -/** - * Return the [[DataHexString]] of %%data%% padded on the **left** - * to %%length%% bytes. - * - * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is - * thrown. - * - * This pads data the same as **values** are in Solidity - * (e.g. ``uint128``). - */ -function zeroPadValue(data, length) { - return zeroPad(data, length, true); -} -/** - * Return the [[DataHexString]] of %%data%% padded on the **right** - * to %%length%% bytes. - * - * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is - * thrown. - * - * This pads data the same as **bytes** are in Solidity - * (e.g. ``bytes16``). - */ -function zeroPadBytes(data, length) { - return zeroPad(data, length, false); -} -function stripZeros(value) { - let result = arrayify(value); - if (result.length === 0) { - return result; - } - // Find the first non-zero entry - let start = 0; - while (start < result.length && result[start] === 0) { - start++; - } - // If we started with zeros, strip them - if (start) { - result = result.slice(start); - } - return result; -} -function arrayify(value, options) { - if (!options) { - options = {}; - } - if (typeof value === "number") { - logger$6.checkSafeUint53(value, "invalid arrayify value"); - const result = []; - while (value) { - // @ts-ignore - result.unshift(value & 0xff); - value = parseInt(String(value / 256)); - } - if (result.length === 0) { - result.push(0); - } - return addSlice(new Uint8Array(result)); - } - if (options.allowMissingPrefix && - typeof value === "string" && - value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - if (isHexable(value)) { - value = value.toHexString(); - } - if (isHexString(value)) { - let hex = value.substring(2); - if (hex.length % 2) { - if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); - } - else if (options.hexPad === "right") { - hex += "0"; - } - else { - logger$6.throwArgumentError("hex data is odd-length", "value", value); - } - } - const result = []; - for (let i = 0; i < hex.length; i += 2) { - // @ts-ignore - result.push(parseInt(hex.substring(i, i + 2), 16)); - } - return addSlice(new Uint8Array(result)); - } - if (isBytes(value)) { - return addSlice(new Uint8Array(value)); - } - return logger$6.throwArgumentError("invalid arrayify value", "value", value); -} -function addSlice(array) { - // @ts-ignore - if (array.slice) { - return array; - } - array.slice = function () { - const args = Array.prototype.slice.call(arguments); - return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args))); - }; - return array; -} -function hexConcat(items) { - let result = "0x"; - items.forEach((item) => { - result += hexlify(item).substring(2); - }); - return result; -} - -var BN = _BN.BN; -const logger$5 = new Logger("bigNumber/0.0.1"); -const _constructorGuard = {}; -const MAX_SAFE = 0x1fffffffffffff; -// Only warn about passing 10 into radix once -let _warnedToStringRadix = false; -class BigNumber { - _hex; - _isBigNumber; - constructor(constructorGuard, hex) { - logger$5.checkNew(new.target, BigNumber); - if (constructorGuard !== _constructorGuard) { - logger$5.throwError("cannot call constructor directly; use BigNumber.from", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "new (BigNumber)", - }); - } - this._hex = hex; - this._isBigNumber = true; - Object.freeze(this); - } - fromTwos(value) { - return toBigNumber(toBN(this).fromTwos(value)); - } - toTwos(value) { - return toBigNumber(toBN(this).toTwos(value)); - } - abs() { - if (this._hex[0] === "-") { - return BigNumber.from(this._hex.substring(1)); - } - return this; - } - add(other) { - return toBigNumber(toBN(this).add(toBN(other))); - } - sub(other) { - return toBigNumber(toBN(this).sub(toBN(other))); - } - div(other) { - const o = BigNumber.from(other); - if (o.isZero()) { - throwFault("division by zero", "div"); - } - return toBigNumber(toBN(this).div(toBN(other))); - } - mul(other) { - return toBigNumber(toBN(this).mul(toBN(other))); - } - mod(other) { - const value = toBN(other); - if (value.isNeg()) { - throwFault("cannot modulo negative values", "mod"); - } - return toBigNumber(toBN(this).umod(value)); - } - pow(other) { - const value = toBN(other); - if (value.isNeg()) { - throwFault("cannot raise to negative values", "pow"); - } - return toBigNumber(toBN(this).pow(value)); - } - and(other) { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'and' negative values", "and"); - } - return toBigNumber(toBN(this).and(value)); - } - or(other) { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'or' negative values", "or"); - } - return toBigNumber(toBN(this).or(value)); - } - xor(other) { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'xor' negative values", "xor"); - } - return toBigNumber(toBN(this).xor(value)); - } - mask(value) { - if (this.isNegative() || value < 0) { - throwFault("cannot mask negative values", "mask"); - } - return toBigNumber(toBN(this).maskn(value)); - } - shl(value) { - if (this.isNegative() || value < 0) { - throwFault("cannot shift negative values", "shl"); - } - return toBigNumber(toBN(this).shln(value)); - } - shr(value) { - if (this.isNegative() || value < 0) { - throwFault("cannot shift negative values", "shr"); - } - return toBigNumber(toBN(this).shrn(value)); - } - eq(other) { - return toBN(this).eq(toBN(other)); - } - lt(other) { - return toBN(this).lt(toBN(other)); - } - lte(other) { - return toBN(this).lte(toBN(other)); - } - gt(other) { - return toBN(this).gt(toBN(other)); - } - gte(other) { - return toBN(this).gte(toBN(other)); - } - isNegative() { - return this._hex[0] === "-"; - } - isZero() { - return toBN(this).isZero(); - } - toNumber() { - try { - return toBN(this).toNumber(); - } - catch (error) { - throwFault("overflow", "toNumber", this.toString()); - } - // @ts-ignore - return null; - } - toBigInt() { - try { - return BigInt(this.toString()); - } - catch (e) { } - return logger$5.throwError("this platform does not support BigInt", Logger.errors.UNSUPPORTED_OPERATION, { - value: this.toString(), - }); - } - toString() { - // Lots of people expect this, which we do not support, so check (See: #889) - if (arguments.length > 0) { - if (arguments[0] === 10) { - if (!_warnedToStringRadix) { - _warnedToStringRadix = true; - logger$5.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); - } - } - else if (arguments[0] === 16) { - logger$5.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger.errors.UNEXPECTED_ARGUMENT, {}); - } - else { - logger$5.throwError("BigNumber.toString does not accept parameters", Logger.errors.UNEXPECTED_ARGUMENT, {}); - } - } - return toBN(this).toString(10); - } - toHexString() { - return this._hex; - } - toJSON(key) { - return { type: "BigNumber", hex: this.toHexString() }; - } - static from(value) { - if (value instanceof BigNumber) { - return value; - } - if (typeof value === "string") { - if (value.match(/^-?0x[0-9a-f]+$/i)) { - return new BigNumber(_constructorGuard, toHex(value)); - } - if (value.match(/^-?[0-9]+$/)) { - return new BigNumber(_constructorGuard, toHex(new BN(value))); - } - return logger$5.throwArgumentError("invalid BigNumber string", "value", value); - } - if (typeof value === "number") { - if (value % 1) { - throwFault("underflow", "BigNumber.from", value); - } - if (value >= MAX_SAFE || value <= -MAX_SAFE) { - throwFault("overflow", "BigNumber.from", value); - } - return BigNumber.from(String(value)); - } - const anyValue = value; - if (typeof anyValue === "bigint") { - return BigNumber.from(anyValue.toString()); - } - if (isBytes(anyValue)) { - return BigNumber.from(hexlify(anyValue)); - } - if (anyValue) { - // Hexable interface (takes priority) - if (anyValue.toHexString) { - const hex = anyValue.toHexString(); - if (typeof hex === "string") { - return BigNumber.from(hex); - } - } - else { - // For now, handle legacy JSON-ified values (goes away in v6) - let hex = anyValue._hex; - // New-form JSON - if (hex == null && anyValue.type === "BigNumber") { - hex = anyValue.hex; - } - if (typeof hex === "string") { - if (isHexString(hex) || - (hex[0] === "-" && isHexString(hex.substring(1)))) { - return BigNumber.from(hex); - } - } - } - } - return logger$5.throwArgumentError("invalid BigNumber value", "value", value); - } - static isBigNumber(value) { - return !!(value && value._isBigNumber); - } -} -// Normalize the hex string -// @ts-ignore -function toHex(value) { - // For BN, call on the hex string - if (typeof value !== "string") { - return toHex(value.toString(16)); - } - // If negative, prepend the negative sign to the normalized positive value - if (value[0] === "-") { - // Strip off the negative sign - value = value.substring(1); - // Cannot have multiple negative signs (e.g. "--0x04") - if (value[0] === "-") { - logger$5.throwArgumentError("invalid hex", "value", value); - } - // Call toHex on the positive component - value = toHex(value); - // Do not allow "-0x00" - if (value === "0x00") { - return value; - } - // Negate the value - return "-" + value; - } - // Add a "0x" prefix if missing - if (value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - // Normalize zero - if (value === "0x") { - return "0x00"; - } - // Make the string even length - if (value.length % 2) { - value = "0x0" + value.substring(2); - } - // Trim to smallest even-length string - while (value.length > 4 && value.substring(0, 4) === "0x00") { - value = "0x" + value.substring(4); - } - return value; -} -// @ts-ignore -function toBigNumber(value) { - return BigNumber.from(toHex(value)); -} -// @ts-ignore -function toBN(value) { - const hex = BigNumber.from(value).toHexString(); - if (hex[0] === "-") { - return new BN("-" + hex.substring(3), 16); - } - return new BN(hex.substring(2), 16); -} -function throwFault(fault, operation, value) { - const params = { fault: fault, operation: operation }; - if (value != null) { - params.value = value; - } - return logger$5.throwError(fault, Logger.errors.NUMERIC_FAULT, params); -} - -const logger$4 = new Logger("rlp/0.0.1"); -function arrayifyInteger$1(value) { - const result = []; - while (value) { - // @ts-ignore - result.unshift(value & 0xff); - value >>= 8; - } - return result; -} -function unarrayifyInteger$1(data, offset, length) { - let result = 0; - for (let i = 0; i < length; i++) { - result = result * 256 + data[offset + i]; - } - return result; -} -function _encode$1(object) { - if (Array.isArray(object)) { - let payload = []; - object.forEach(function (child) { - payload = payload.concat(_encode$1(child)); - }); - if (payload.length <= 55) { - payload.unshift(0xc0 + payload.length); - return payload; - } - const length = arrayifyInteger$1(payload.length); - length.unshift(0xf7 + length.length); - return length.concat(payload); - } - if (!isBytesLike(object)) { - logger$4.throwArgumentError("RLP object must be BytesLike", "object", object); - } - const data = Array.prototype.slice.call(arrayify(object)); - if (data.length === 1 && data[0] <= 0x7f) { - return data; - } - else if (data.length <= 55) { - data.unshift(0x80 + data.length); - return data; - } - const length = arrayifyInteger$1(data.length); - length.unshift(0xb7 + length.length); - return length.concat(data); -} -function encode(object) { - return hexlify(_encode$1(object)); -} -function _decodeChildren$1(data, offset, childOffset, length) { - const result = []; - while (childOffset < offset + 1 + length) { - const decoded = _decode$1(data, childOffset); - result.push(decoded.result); - childOffset += decoded.consumed; - if (childOffset > offset + 1 + length) { - logger$4.throwError("child data too short", Logger.errors.BUFFER_OVERRUN, {}); - } - } - return { consumed: 1 + length, result: result }; -} -// returns { consumed: number, result: Object } -function _decode$1(data, offset) { - if (data.length === 0) { - logger$4.throwError("data too short", Logger.errors.BUFFER_OVERRUN, {}); - } - // Array with extra length prefix - if (data[offset] >= 0xf8) { - const lengthLength = data[offset] - 0xf7; - if (offset + 1 + lengthLength > data.length) { - logger$4.throwError("data short segment too short", Logger.errors.BUFFER_OVERRUN, {}); - } - const length = unarrayifyInteger$1(data, offset + 1, lengthLength); - if (offset + 1 + lengthLength + length > data.length) { - logger$4.throwError("data long segment too short", Logger.errors.BUFFER_OVERRUN, {}); - } - return _decodeChildren$1(data, offset, offset + 1 + lengthLength, lengthLength + length); - } - else if (data[offset] >= 0xc0) { - const length = data[offset] - 0xc0; - if (offset + 1 + length > data.length) { - logger$4.throwError("data array too short", Logger.errors.BUFFER_OVERRUN, {}); - } - return _decodeChildren$1(data, offset, offset + 1, length); - } - else if (data[offset] >= 0xb8) { - const lengthLength = data[offset] - 0xb7; - if (offset + 1 + lengthLength > data.length) { - logger$4.throwError("data array too short", Logger.errors.BUFFER_OVERRUN, {}); - } - const length = unarrayifyInteger$1(data, offset + 1, lengthLength); - if (offset + 1 + lengthLength + length > data.length) { - logger$4.throwError("data array too short", Logger.errors.BUFFER_OVERRUN, {}); - } - const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); - return { consumed: 1 + lengthLength + length, result: result }; - } - else if (data[offset] >= 0x80) { - const length = data[offset] - 0x80; - if (offset + 1 + length > data.length) { - logger$4.throwError("data too short", Logger.errors.BUFFER_OVERRUN, {}); - } - const result = hexlify(data.slice(offset + 1, offset + 1 + length)); - return { consumed: 1 + length, result: result }; - } - return { consumed: 1, result: hexlify(data[offset]) }; -} -function decode$1(data) { - const bytes = arrayify(data); - const decoded = _decode$1(bytes, 0); - if (decoded.consumed !== bytes.length) { - logger$4.throwArgumentError("invalid rlp data", "data", data); - } - return decoded.result; -} - -function number(n) { - if (!Number.isSafeInteger(n) || n < 0) - throw new Error(`Wrong positive integer: ${n}`); -} -function bytes(b, ...lengths) { - if (!(b instanceof Uint8Array)) - throw new Error('Expected Uint8Array'); - if (lengths.length > 0 && !lengths.includes(b.length)) - throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); -} -function hash(hash) { - if (typeof hash !== 'function' || typeof hash.create !== 'function') - throw new Error('Hash should be wrapped by utils.wrapConstructor'); - number(hash.outputLen); - number(hash.blockLen); -} -function exists(instance, checkFinished = true) { - if (instance.destroyed) - throw new Error('Hash instance has been destroyed'); - if (checkFinished && instance.finished) - throw new Error('Hash#digest() has already been called'); -} -function output(out, instance) { - bytes(out); - const min = instance.outputLen; - if (out.length < min) { - throw new Error(`digestInto() expects output buffer of length at least ${min}`); - } -} - -/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. -// node.js versions earlier than v19 don't declare it in global scope. -// For node.js, package.json#exports field mapping rewrites import -// from `crypto` to `cryptoNode`, which imports native module. -// Makes the utils un-importable in browsers without a bundler. -// Once node.js 18 is deprecated, we can just drop the import. -const u8a = (a) => a instanceof Uint8Array; -const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); -// Cast array to view -const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); -// The rotate right (circular right shift) operation for uint32 -const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift); -// big-endian hardware is rare. Just in case someone still decides to run hashes: -// early-throw an error because we don't support BE yet. -const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; -if (!isLE) - throw new Error('Non little-endian hardware is not supported'); -// There is no setImmediate in browser and setTimeout is slow. -// call of async fn will return Promise, which will be fullfiled only on -// next scheduler queue processing step and this is exactly what we need. -const nextTick = async () => { }; -// Returns control to thread each 'tick' ms to avoid blocking -async function asyncLoop(iters, tick, cb) { - let ts = Date.now(); - for (let i = 0; i < iters; i++) { - cb(i); - // Date.now() is not monotonic, so in case if clock goes backwards we return return control too - const diff = Date.now() - ts; - if (diff >= 0 && diff < tick) - continue; - await nextTick(); - ts += diff; - } -} -/** - * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) - */ -function utf8ToBytes(str) { - if (typeof str !== 'string') - throw new Error(`utf8ToBytes expected string, got ${typeof str}`); - return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 -} -/** - * Normalizes (non-hex) string or Uint8Array to Uint8Array. - * Warning: when Uint8Array is passed, it would NOT get copied. - * Keep in mind for future mutable operations. - */ -function toBytes(data) { - if (typeof data === 'string') - data = utf8ToBytes(data); - if (!u8a(data)) - throw new Error(`expected Uint8Array, got ${typeof data}`); - return data; -} -// For runtime check if class implements interface -class Hash { - // Safe version that clones internal state - clone() { - return this._cloneInto(); - } -} -const toStr = {}.toString; -function checkOpts(defaults, opts) { - if (opts !== undefined && toStr.call(opts) !== '[object Object]') - throw new Error('Options should be object or undefined'); - const merged = Object.assign(defaults, opts); - return merged; -} -function wrapConstructor(hashCons) { - const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); - const tmp = hashCons(); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = () => hashCons(); - return hashC; -} - -// HMAC (RFC 2104) -class HMAC extends Hash { - constructor(hash$1, _key) { - super(); - this.finished = false; - this.destroyed = false; - hash(hash$1); - const key = toBytes(_key); - this.iHash = hash$1.create(); - if (typeof this.iHash.update !== 'function') - throw new Error('Expected instance of class which extends utils.Hash'); - this.blockLen = this.iHash.blockLen; - this.outputLen = this.iHash.outputLen; - const blockLen = this.blockLen; - const pad = new Uint8Array(blockLen); - // blockLen can be bigger than outputLen - pad.set(key.length > blockLen ? hash$1.create().update(key).digest() : key); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 0x36; - this.iHash.update(pad); - // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone - this.oHash = hash$1.create(); - // Undo internal XOR && apply outer XOR - for (let i = 0; i < pad.length; i++) - pad[i] ^= 0x36 ^ 0x5c; - this.oHash.update(pad); - pad.fill(0); - } - update(buf) { - exists(this); - this.iHash.update(buf); - return this; - } - digestInto(out) { - exists(this); - bytes(out, this.outputLen); - this.finished = true; - this.iHash.digestInto(out); - this.oHash.update(out); - this.oHash.digestInto(out); - this.destroy(); - } - digest() { - const out = new Uint8Array(this.oHash.outputLen); - this.digestInto(out); - return out; - } - _cloneInto(to) { - // Create new instance without calling constructor since key already in state and we don't know it. - to || (to = Object.create(Object.getPrototypeOf(this), {})); - const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; - to = to; - to.finished = finished; - to.destroyed = destroyed; - to.blockLen = blockLen; - to.outputLen = outputLen; - to.oHash = oHash._cloneInto(to.oHash); - to.iHash = iHash._cloneInto(to.iHash); - return to; - } - destroy() { - this.destroyed = true; - this.oHash.destroy(); - this.iHash.destroy(); - } -} -/** - * HMAC: RFC2104 message authentication code. - * @param hash - function that would be used e.g. sha256 - * @param key - message key - * @param message - message data - */ -const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest(); -hmac.create = (hash, key) => new HMAC(hash, key); - -// Common prologue and epilogue for sync/async functions -function pbkdf2Init(hash$1, _password, _salt, _opts) { - hash(hash$1); - const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts); - const { c, dkLen, asyncTick } = opts; - number(c); - number(dkLen); - number(asyncTick); - if (c < 1) - throw new Error('PBKDF2: iterations (c) should be >= 1'); - const password = toBytes(_password); - const salt = toBytes(_salt); - // DK = PBKDF2(PRF, Password, Salt, c, dkLen); - const DK = new Uint8Array(dkLen); - // U1 = PRF(Password, Salt + INT_32_BE(i)) - const PRF = hmac.create(hash$1, password); - const PRFSalt = PRF._cloneInto().update(salt); - return { c, dkLen, asyncTick, DK, PRF, PRFSalt }; -} -function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) { - PRF.destroy(); - PRFSalt.destroy(); - if (prfW) - prfW.destroy(); - u.fill(0); - return DK; -} -/** - * PBKDF2-HMAC: RFC 2898 key derivation function - * @param hash - hash function that would be used e.g. sha256 - * @param password - password from which a derived key is generated - * @param salt - cryptographic salt - * @param opts - {c, dkLen} where c is work factor and dkLen is output message size - */ -function pbkdf2$1(hash, password, salt, opts) { - const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); - let prfW; // Working copy - const arr = new Uint8Array(4); - const view = createView(arr); - const u = new Uint8Array(PRF.outputLen); - // DK = T1 + T2 + ⋯ + Tdklen/hlen - for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { - // Ti = F(Password, Salt, c, i) - const Ti = DK.subarray(pos, pos + PRF.outputLen); - view.setInt32(0, ti, false); - // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc - // U1 = PRF(Password, Salt + INT_32_BE(i)) - (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); - Ti.set(u.subarray(0, Ti.length)); - for (let ui = 1; ui < c; ui++) { - // Uc = PRF(Password, Uc−1) - PRF._cloneInto(prfW).update(u).digestInto(u); - for (let i = 0; i < Ti.length; i++) - Ti[i] ^= u[i]; - } - } - return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); -} - -// Polyfill for Safari 14 -function setBigUint64(view, byteOffset, value, isLE) { - if (typeof view.setBigUint64 === 'function') - return view.setBigUint64(byteOffset, value, isLE); - const _32n = BigInt(32); - const _u32_max = BigInt(0xffffffff); - const wh = Number((value >> _32n) & _u32_max); - const wl = Number(value & _u32_max); - const h = isLE ? 4 : 0; - const l = isLE ? 0 : 4; - view.setUint32(byteOffset + h, wh, isLE); - view.setUint32(byteOffset + l, wl, isLE); -} -// Base SHA2 class (RFC 6234) -class SHA2 extends Hash { - constructor(blockLen, outputLen, padOffset, isLE) { - super(); - this.blockLen = blockLen; - this.outputLen = outputLen; - this.padOffset = padOffset; - this.isLE = isLE; - this.finished = false; - this.length = 0; - this.pos = 0; - this.destroyed = false; - this.buffer = new Uint8Array(blockLen); - this.view = createView(this.buffer); - } - update(data) { - exists(this); - const { view, buffer, blockLen } = this; - data = toBytes(data); - const len = data.length; - for (let pos = 0; pos < len;) { - const take = Math.min(blockLen - this.pos, len - pos); - // Fast path: we have at least one block in input, cast it to view and process - if (take === blockLen) { - const dataView = createView(data); - for (; blockLen <= len - pos; pos += blockLen) - this.process(dataView, pos); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - pos += take; - if (this.pos === blockLen) { - this.process(view, 0); - this.pos = 0; - } - } - this.length += data.length; - this.roundClean(); - return this; - } - digestInto(out) { - exists(this); - output(out, this); - this.finished = true; - // Padding - // We can avoid allocation of buffer for padding completely if it - // was previously not allocated here. But it won't change performance. - const { buffer, view, blockLen, isLE } = this; - let { pos } = this; - // append the bit '1' to the message - buffer[pos++] = 0b10000000; - this.buffer.subarray(pos).fill(0); - // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again - if (this.padOffset > blockLen - pos) { - this.process(view, 0); - pos = 0; - } - // Pad until full block byte with zeros - for (let i = pos; i < blockLen; i++) - buffer[i] = 0; - // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that - // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen. - // So we just write lowest 64 bits of that value. - setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE); - this.process(view, 0); - const oview = createView(out); - const len = this.outputLen; - // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT - if (len % 4) - throw new Error('_sha2: outputLen should be aligned to 32bit'); - const outLen = len / 4; - const state = this.get(); - if (outLen > state.length) - throw new Error('_sha2: outputLen bigger than state'); - for (let i = 0; i < outLen; i++) - oview.setUint32(4 * i, state[i], isLE); - } - digest() { - const { buffer, outputLen } = this; - this.digestInto(buffer); - const res = buffer.slice(0, outputLen); - this.destroy(); - return res; - } - _cloneInto(to) { - to || (to = new this.constructor()); - to.set(...this.get()); - const { blockLen, buffer, length, finished, destroyed, pos } = this; - to.length = length; - to.pos = pos; - to.finished = finished; - to.destroyed = destroyed; - if (length % blockLen) - to.buffer.set(buffer); - return to; - } -} - -// SHA2-256 need to try 2^128 hashes to execute birthday attack. -// BTC network is doing 2^67 hashes/sec as per early 2023. -// Choice: a ? b : c -const Chi = (a, b, c) => (a & b) ^ (~a & c); -// Majority function, true if any two inpust is true -const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c); -// Round constants: -// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311) -// prettier-ignore -const SHA256_K = /* @__PURE__ */ new Uint32Array([ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -]); -// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): -// prettier-ignore -const IV = /* @__PURE__ */ new Uint32Array([ - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 -]); -// Temporary buffer, not used to store anything between runs -// Named this way because it matches specification. -const SHA256_W = /* @__PURE__ */ new Uint32Array(64); -class SHA256 extends SHA2 { - constructor() { - super(64, 32, 8, false); - // We cannot use array here since array allows indexing by variable - // which means optimizer/compiler cannot use registers. - this.A = IV[0] | 0; - this.B = IV[1] | 0; - this.C = IV[2] | 0; - this.D = IV[3] | 0; - this.E = IV[4] | 0; - this.F = IV[5] | 0; - this.G = IV[6] | 0; - this.H = IV[7] | 0; - } - get() { - const { A, B, C, D, E, F, G, H } = this; - return [A, B, C, D, E, F, G, H]; - } - // prettier-ignore - set(A, B, C, D, E, F, G, H) { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - this.F = F | 0; - this.G = G | 0; - this.H = H | 0; - } - process(view, offset) { - // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array - for (let i = 0; i < 16; i++, offset += 4) - SHA256_W[i] = view.getUint32(offset, false); - for (let i = 16; i < 64; i++) { - const W15 = SHA256_W[i - 15]; - const W2 = SHA256_W[i - 2]; - const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3); - const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10); - SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; - } - // Compression function main loop, 64 rounds - let { A, B, C, D, E, F, G, H } = this; - for (let i = 0; i < 64; i++) { - const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); - const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; - const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); - const T2 = (sigma0 + Maj(A, B, C)) | 0; - H = G; - G = F; - F = E; - E = (D + T1) | 0; - D = C; - C = B; - B = A; - A = (T1 + T2) | 0; - } - // Add the compressed chunk to the current hash value - A = (A + this.A) | 0; - B = (B + this.B) | 0; - C = (C + this.C) | 0; - D = (D + this.D) | 0; - E = (E + this.E) | 0; - F = (F + this.F) | 0; - G = (G + this.G) | 0; - H = (H + this.H) | 0; - this.set(A, B, C, D, E, F, G, H); - } - roundClean() { - SHA256_W.fill(0); - } - destroy() { - this.set(0, 0, 0, 0, 0, 0, 0, 0); - this.buffer.fill(0); - } -} -/** - * SHA2-256 hash function - * @param message - data that would be hashed - */ -const sha256$1 = /* @__PURE__ */ wrapConstructor(() => new SHA256()); - -const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); -const _32n = /* @__PURE__ */ BigInt(32); -// We are not using BigUint64Array, because they are extremely slow as per 2022 -function fromBig(n, le = false) { - if (le) - return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) }; - return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; -} -function split(lst, le = false) { - let Ah = new Uint32Array(lst.length); - let Al = new Uint32Array(lst.length); - for (let i = 0; i < lst.length; i++) { - const { h, l } = fromBig(lst[i], le); - [Ah[i], Al[i]] = [h, l]; - } - return [Ah, Al]; -} -const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); -// for Shift in [0, 32) -const shrSH = (h, _l, s) => h >>> s; -const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); -// Right rotate for Shift in [1, 32) -const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s)); -const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); -// Right rotate for Shift in (32, 64), NOTE: 32 is special case. -const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32)); -const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s)); -// Right rotate for shift===32 (just swaps l&h) -const rotr32H = (_h, l) => l; -const rotr32L = (h, _l) => h; -// Left rotate for Shift in [1, 32) -const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s)); -const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s)); -// Left rotate for Shift in (32, 64), NOTE: 32 is special case. -const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s)); -const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s)); -// JS uses 32-bit signed integers for bitwise operations which means we cannot -// simple take carry out of low bit sum by shift, we need to use division. -function add(Ah, Al, Bh, Bl) { - const l = (Al >>> 0) + (Bl >>> 0); - return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; -} -// Addition with more than 2 elements -const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); -const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0; -const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); -const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0; -const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); -const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0; -// prettier-ignore -const u64 = { - fromBig, split, toBig, - shrSH, shrSL, - rotrSH, rotrSL, rotrBH, rotrBL, - rotr32H, rotr32L, - rotlSH, rotlSL, rotlBH, rotlBL, - add, add3L, add3H, add4L, add4H, add5H, add5L, -}; -var u64$1 = u64; - -// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409): -// prettier-ignore -const [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64$1.split([ - '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc', - '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118', - '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2', - '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694', - '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65', - '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5', - '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4', - '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70', - '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df', - '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b', - '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30', - '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8', - '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8', - '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3', - '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec', - '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b', - '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178', - '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b', - '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c', - '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817' -].map(n => BigInt(n))))(); -// Temporary buffer, not used to store anything between runs -const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80); -const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80); -class SHA512 extends SHA2 { - constructor() { - super(128, 64, 16, false); - // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers. - // Also looks cleaner and easier to verify with spec. - // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): - // h -- high 32 bits, l -- low 32 bits - this.Ah = 0x6a09e667 | 0; - this.Al = 0xf3bcc908 | 0; - this.Bh = 0xbb67ae85 | 0; - this.Bl = 0x84caa73b | 0; - this.Ch = 0x3c6ef372 | 0; - this.Cl = 0xfe94f82b | 0; - this.Dh = 0xa54ff53a | 0; - this.Dl = 0x5f1d36f1 | 0; - this.Eh = 0x510e527f | 0; - this.El = 0xade682d1 | 0; - this.Fh = 0x9b05688c | 0; - this.Fl = 0x2b3e6c1f | 0; - this.Gh = 0x1f83d9ab | 0; - this.Gl = 0xfb41bd6b | 0; - this.Hh = 0x5be0cd19 | 0; - this.Hl = 0x137e2179 | 0; - } - // prettier-ignore - get() { - const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; - } - // prettier-ignore - set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { - this.Ah = Ah | 0; - this.Al = Al | 0; - this.Bh = Bh | 0; - this.Bl = Bl | 0; - this.Ch = Ch | 0; - this.Cl = Cl | 0; - this.Dh = Dh | 0; - this.Dl = Dl | 0; - this.Eh = Eh | 0; - this.El = El | 0; - this.Fh = Fh | 0; - this.Fl = Fl | 0; - this.Gh = Gh | 0; - this.Gl = Gl | 0; - this.Hh = Hh | 0; - this.Hl = Hl | 0; - } - process(view, offset) { - // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array - for (let i = 0; i < 16; i++, offset += 4) { - SHA512_W_H[i] = view.getUint32(offset); - SHA512_W_L[i] = view.getUint32((offset += 4)); - } - for (let i = 16; i < 80; i++) { - // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7) - const W15h = SHA512_W_H[i - 15] | 0; - const W15l = SHA512_W_L[i - 15] | 0; - const s0h = u64$1.rotrSH(W15h, W15l, 1) ^ u64$1.rotrSH(W15h, W15l, 8) ^ u64$1.shrSH(W15h, W15l, 7); - const s0l = u64$1.rotrSL(W15h, W15l, 1) ^ u64$1.rotrSL(W15h, W15l, 8) ^ u64$1.shrSL(W15h, W15l, 7); - // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6) - const W2h = SHA512_W_H[i - 2] | 0; - const W2l = SHA512_W_L[i - 2] | 0; - const s1h = u64$1.rotrSH(W2h, W2l, 19) ^ u64$1.rotrBH(W2h, W2l, 61) ^ u64$1.shrSH(W2h, W2l, 6); - const s1l = u64$1.rotrSL(W2h, W2l, 19) ^ u64$1.rotrBL(W2h, W2l, 61) ^ u64$1.shrSL(W2h, W2l, 6); - // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16]; - const SUMl = u64$1.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); - const SUMh = u64$1.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); - SHA512_W_H[i] = SUMh | 0; - SHA512_W_L[i] = SUMl | 0; - } - let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - // Compression function main loop, 80 rounds - for (let i = 0; i < 80; i++) { - // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41) - const sigma1h = u64$1.rotrSH(Eh, El, 14) ^ u64$1.rotrSH(Eh, El, 18) ^ u64$1.rotrBH(Eh, El, 41); - const sigma1l = u64$1.rotrSL(Eh, El, 14) ^ u64$1.rotrSL(Eh, El, 18) ^ u64$1.rotrBL(Eh, El, 41); - //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; - const CHIh = (Eh & Fh) ^ (~Eh & Gh); - const CHIl = (El & Fl) ^ (~El & Gl); - // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i] - // prettier-ignore - const T1ll = u64$1.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); - const T1h = u64$1.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); - const T1l = T1ll | 0; - // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39) - const sigma0h = u64$1.rotrSH(Ah, Al, 28) ^ u64$1.rotrBH(Ah, Al, 34) ^ u64$1.rotrBH(Ah, Al, 39); - const sigma0l = u64$1.rotrSL(Ah, Al, 28) ^ u64$1.rotrBL(Ah, Al, 34) ^ u64$1.rotrBL(Ah, Al, 39); - const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch); - const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl); - Hh = Gh | 0; - Hl = Gl | 0; - Gh = Fh | 0; - Gl = Fl | 0; - Fh = Eh | 0; - Fl = El | 0; - ({ h: Eh, l: El } = u64$1.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); - Dh = Ch | 0; - Dl = Cl | 0; - Ch = Bh | 0; - Cl = Bl | 0; - Bh = Ah | 0; - Bl = Al | 0; - const All = u64$1.add3L(T1l, sigma0l, MAJl); - Ah = u64$1.add3H(All, T1h, sigma0h, MAJh); - Al = All | 0; - } - // Add the compressed chunk to the current hash value - ({ h: Ah, l: Al } = u64$1.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); - ({ h: Bh, l: Bl } = u64$1.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); - ({ h: Ch, l: Cl } = u64$1.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); - ({ h: Dh, l: Dl } = u64$1.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); - ({ h: Eh, l: El } = u64$1.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); - ({ h: Fh, l: Fl } = u64$1.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); - ({ h: Gh, l: Gl } = u64$1.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); - ({ h: Hh, l: Hl } = u64$1.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); - this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); - } - roundClean() { - SHA512_W_H.fill(0); - SHA512_W_L.fill(0); - } - destroy() { - this.buffer.fill(0); - this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } -} -const sha512$1 = /* @__PURE__ */ wrapConstructor(() => new SHA512()); - -// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size. -// It's called a sponge function. -// Various per round constants calculations -const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []]; -const _0n = /* @__PURE__ */ BigInt(0); -const _1n = /* @__PURE__ */ BigInt(1); -const _2n = /* @__PURE__ */ BigInt(2); -const _7n = /* @__PURE__ */ BigInt(7); -const _256n = /* @__PURE__ */ BigInt(256); -const _0x71n = /* @__PURE__ */ BigInt(0x71); -for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { - // Pi - [x, y] = [y, (2 * x + 3 * y) % 5]; - SHA3_PI.push(2 * (5 * y + x)); - // Rotational - SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64); - // Iota - let t = _0n; - for (let j = 0; j < 7; j++) { - R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n; - if (R & _2n) - t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n); - } - _SHA3_IOTA.push(t); -} -const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true); -// Left rotation (without 0, 32, 64) -const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s)); -const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s)); -// Same as keccakf1600, but allows to skip some rounds -function keccakP(s, rounds = 24) { - const B = new Uint32Array(5 * 2); - // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js) - for (let round = 24 - rounds; round < 24; round++) { - // Theta θ - for (let x = 0; x < 10; x++) - B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; - for (let x = 0; x < 10; x += 2) { - const idx1 = (x + 8) % 10; - const idx0 = (x + 2) % 10; - const B0 = B[idx0]; - const B1 = B[idx0 + 1]; - const Th = rotlH(B0, B1, 1) ^ B[idx1]; - const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; - for (let y = 0; y < 50; y += 10) { - s[x + y] ^= Th; - s[x + y + 1] ^= Tl; - } - } - // Rho (ρ) and Pi (π) - let curH = s[2]; - let curL = s[3]; - for (let t = 0; t < 24; t++) { - const shift = SHA3_ROTL[t]; - const Th = rotlH(curH, curL, shift); - const Tl = rotlL(curH, curL, shift); - const PI = SHA3_PI[t]; - curH = s[PI]; - curL = s[PI + 1]; - s[PI] = Th; - s[PI + 1] = Tl; - } - // Chi (χ) - for (let y = 0; y < 50; y += 10) { - for (let x = 0; x < 10; x++) - B[x] = s[y + x]; - for (let x = 0; x < 10; x++) - s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; - } - // Iota (ι) - s[0] ^= SHA3_IOTA_H[round]; - s[1] ^= SHA3_IOTA_L[round]; - } - B.fill(0); -} -class Keccak extends Hash { - // NOTE: we accept arguments in bytes instead of bits here. - constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { - super(); - this.blockLen = blockLen; - this.suffix = suffix; - this.outputLen = outputLen; - this.enableXOF = enableXOF; - this.rounds = rounds; - this.pos = 0; - this.posOut = 0; - this.finished = false; - this.destroyed = false; - // Can be passed from user as dkLen - number(outputLen); - // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes - if (0 >= this.blockLen || this.blockLen >= 200) - throw new Error('Sha3 supports only keccak-f1600 function'); - this.state = new Uint8Array(200); - this.state32 = u32(this.state); - } - keccak() { - keccakP(this.state32, this.rounds); - this.posOut = 0; - this.pos = 0; - } - update(data) { - exists(this); - const { blockLen, state } = this; - data = toBytes(data); - const len = data.length; - for (let pos = 0; pos < len;) { - const take = Math.min(blockLen - this.pos, len - pos); - for (let i = 0; i < take; i++) - state[this.pos++] ^= data[pos++]; - if (this.pos === blockLen) - this.keccak(); - } - return this; - } - finish() { - if (this.finished) - return; - this.finished = true; - const { state, suffix, pos, blockLen } = this; - // Do the padding - state[pos] ^= suffix; - if ((suffix & 0x80) !== 0 && pos === blockLen - 1) - this.keccak(); - state[blockLen - 1] ^= 0x80; - this.keccak(); - } - writeInto(out) { - exists(this, false); - bytes(out); - this.finish(); - const bufferOut = this.state; - const { blockLen } = this; - for (let pos = 0, len = out.length; pos < len;) { - if (this.posOut >= blockLen) - this.keccak(); - const take = Math.min(blockLen - this.posOut, len - pos); - out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); - this.posOut += take; - pos += take; - } - return out; - } - xofInto(out) { - // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF - if (!this.enableXOF) - throw new Error('XOF is not possible for this instance'); - return this.writeInto(out); - } - xof(bytes) { - number(bytes); - return this.xofInto(new Uint8Array(bytes)); - } - digestInto(out) { - output(out, this); - if (this.finished) - throw new Error('digest() was already called'); - this.writeInto(out); - this.destroy(); - return out; - } - digest() { - return this.digestInto(new Uint8Array(this.outputLen)); - } - destroy() { - this.destroyed = true; - this.state.fill(0); - } - _cloneInto(to) { - const { blockLen, suffix, outputLen, rounds, enableXOF } = this; - to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); - to.state32.set(this.state32); - to.pos = this.pos; - to.posOut = this.posOut; - to.finished = this.finished; - to.rounds = rounds; - // Suffix can change in cSHAKE - to.suffix = suffix; - to.outputLen = outputLen; - to.enableXOF = enableXOF; - to.destroyed = this.destroyed; - return to; - } -} -const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)); -/** - * SHA3-256 hash function - * @param message - that would be hashed - */ -const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8); -const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8); -/** - * keccak-256 hash function. Different from SHA3-256. - * @param message - that would be hashed - */ -const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8); - -/** - * Some mathematic operations. - * - * @_subsection: api/utils:Math Helpers [about-maths] - */ -const BN_0$9 = BigInt(0); -const BN_1$5 = BigInt(1); -//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1; -// IEEE 754 support 53-bits of mantissa -const maxValue = 0x1fffffffffffff; -/** - * Convert %%value%% from a twos-compliment representation of %%width%% - * bits to its value. - * - * If the highest bit is ``1``, the result will be negative. - */ -function fromTwos(_value, _width) { - const value = getUint(_value, "value"); - const width = BigInt(getNumber(_width, "width")); - assert(value >> width === BN_0$9, "overflow", "NUMERIC_FAULT", { - operation: "fromTwos", - fault: "overflow", - value: _value, - }); - // Top bit set; treat as a negative value - if (value >> (width - BN_1$5)) { - const mask = (BN_1$5 << width) - BN_1$5; - return -((~value & mask) + BN_1$5); - } - return value; -} -/** - * Convert %%value%% to a twos-compliment representation of - * %%width%% bits. - * - * The result will always be positive. - */ -function toTwos(_value, _width) { - let value = getBigInt(_value, "value"); - const width = BigInt(getNumber(_width, "width")); - const limit = BN_1$5 << (width - BN_1$5); - if (value < BN_0$9) { - value = -value; - assert(value <= limit, "too low", "NUMERIC_FAULT", { - operation: "toTwos", - fault: "overflow", - value: _value, - }); - const mask = (BN_1$5 << width) - BN_1$5; - return (~value & mask) + BN_1$5; - } - else { - assert(value < limit, "too high", "NUMERIC_FAULT", { - operation: "toTwos", - fault: "overflow", - value: _value, - }); - } - return value; -} -/** - * Mask %%value%% with a bitmask of %%bits%% ones. - */ -function mask(_value, _bits) { - const value = getUint(_value, "value"); - const bits = BigInt(getNumber(_bits, "bits")); - return value & ((BN_1$5 << bits) - BN_1$5); -} -/** - * Gets a BigInt from %%value%%. If it is an invalid value for - * a BigInt, then an ArgumentError will be thrown for %%name%%. - */ -function getBigInt(value, name) { - switch (typeof value) { - case "bigint": - return value; - case "number": - assertArgument(Number.isInteger(value), "underflow", name || "value", value); - assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return BigInt(value); - case "string": - try { - if (value === "") { - throw new Error("empty string"); - } - if (value[0] === "-" && value[1] !== "-") { - return -BigInt(value.substring(1)); - } - return BigInt(value); - } - catch (e) { - assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || "value", value); - } - } - assertArgument(false, "invalid BigNumberish value", name || "value", value); -} -function getUint(value, name) { - const result = getBigInt(value, name); - assert(result >= BN_0$9, "unsigned value cannot be negative", "NUMERIC_FAULT", { - fault: "overflow", - operation: "getUint", - value, - }); - return result; -} -const Nibbles = "0123456789abcdef"; -/* - * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it - * is treated as Big Endian data. - */ -function toBigInt(value) { - if (value instanceof Uint8Array) { - let result = "0x0"; - for (const v of value) { - result += Nibbles[v >> 4]; - result += Nibbles[v & 0x0f]; - } - return BigInt(result); - } - return getBigInt(value); -} -/** - * Gets a //number// from %%value%%. If it is an invalid value for - * a //number//, then an ArgumentError will be thrown for %%name%%. - */ -function getNumber(value, name) { - switch (typeof value) { - case "bigint": - assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return Number(value); - case "number": - assertArgument(Number.isInteger(value), "underflow", name || "value", value); - assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return value; - case "string": - try { - if (value === "") { - throw new Error("empty string"); - } - return getNumber(BigInt(value), name); - } - catch (e) { - assertArgument(false, `invalid numeric string: ${e.message}`, name || "value", value); - } - } - assertArgument(false, "invalid numeric value", name || "value", value); -} -/** - * Converts %%value%% to a number. If %%value%% is a Uint8Array, it - * is treated as Big Endian data. Throws if the value is not safe. - */ -function toNumber(value) { - return getNumber(toBigInt(value)); -} -/** - * Converts %%value%% to a Big Endian hexstring, optionally padded to - * %%width%% bytes. - */ -function toBeHex(_value, _width) { - const value = getUint(_value, "value"); - let result = value.toString(16); - if (_width == null) { - // Ensure the value is of even length - if (result.length % 2) { - result = "0" + result; - } - } - else { - const width = getNumber(_width, "width"); - assert(width * 2 >= result.length, `value exceeds width (${width} bits)`, "NUMERIC_FAULT", { - operation: "toBeHex", - fault: "overflow", - value: _value, - }); - // Pad the value to the required width - while (result.length < width * 2) { - result = "0" + result; - } - } - return "0x" + result; -} -/** - * Converts %%value%% to a Big Endian Uint8Array. - */ -function toBeArray(_value) { - const value = getUint(_value, "value"); - if (value === BN_0$9) { - return new Uint8Array([]); - } - let hex = value.toString(16); - if (hex.length % 2) { - hex = "0" + hex; - } - const result = new Uint8Array(hex.length / 2); - for (let i = 0; i < result.length; i++) { - const offset = i * 2; - result[i] = parseInt(hex.substring(offset, offset + 2), 16); - } - return result; -} -/** - * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. - * - * A //Quantity// does not have and leading 0 values unless the value is - * the literal value `0x0`. This is most commonly used for JSSON-RPC - * numeric values. - */ -function toQuantity(value) { - let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring(2); - while (result.startsWith("0")) { - result = result.substring(1); - } - if (result === "") { - result = "0"; - } - return "0x" + result; -} - -/** - * The [Base58 Encoding](link-base58) scheme allows a **numeric** value - * to be encoded as a compact string using a radix of 58 using only - * alpha-numeric characters. Confusingly similar characters are omitted - * (i.e. ``"l0O"``). - * - * Note that Base58 encodes a **numeric** value, not arbitrary bytes, - * since any zero-bytes on the left would get removed. To mitigate this - * issue most schemes that use Base58 choose specific high-order values - * to ensure non-zero prefixes. - * - * @_subsection: api/utils:Base58 Encoding [about-base58] - */ -const Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; -let Lookup = null; -function getAlpha(letter) { - if (Lookup == null) { - Lookup = {}; - for (let i = 0; i < Alphabet.length; i++) { - Lookup[Alphabet[i]] = BigInt(i); - } - } - const result = Lookup[letter]; - assertArgument(result != null, `invalid base58 value`, "letter", letter); - return result; -} -const BN_0$8 = BigInt(0); -const BN_58 = BigInt(58); -/** - * Encode %%value%% as a Base58-encoded string. - */ -function encodeBase58(_value) { - let value = toBigInt(getBytes(_value)); - let result = ""; - while (value) { - result = Alphabet[Number(value % BN_58)] + result; - value /= BN_58; - } - return result; -} -/** - * Decode the Base58-encoded %%value%%. - */ -function decodeBase58(value) { - let result = BN_0$8; - for (let i = 0; i < value.length; i++) { - result *= BN_58; - result += getAlpha(value[i]); - } - return result; -} - -// utils/base64-browser -function decodeBase64(textData) { - textData = atob(textData); - const data = new Uint8Array(textData.length); - for (let i = 0; i < textData.length; i++) { - data[i] = textData.charCodeAt(i); - } - return getBytes(data); -} -function encodeBase64(_data) { - const data = getBytes(_data); - let textData = ""; - for (let i = 0; i < data.length; i++) { - textData += String.fromCharCode(data[i]); - } - return btoa(textData); -} - -/** - * Explain events... - * - * @_section api/utils/events:Events [about-events] - */ -/** - * When an [[EventEmitterable]] triggers a [[Listener]], the - * callback always ahas one additional argument passed, which is - * an **EventPayload**. - */ -class EventPayload { - /** - * The event filter. - */ - filter; - /** - * The **EventEmitterable**. - */ - emitter; - #listener; - /** - * Create a new **EventPayload** for %%emitter%% with - * the %%listener%% and for %%filter%%. - */ - constructor(emitter, listener, filter) { - this.#listener = listener; - defineProperties(this, { emitter, filter }); - } - /** - * Unregister the triggered listener for future events. - */ - async removeListener() { - if (this.#listener == null) { - return; - } - await this.emitter.off(this.filter, this.#listener); - } -} - -/** - * Using strings in Core (or any security-basd system) requires - * additional care. These utilities attempt to mitigate some of the - * safety issues as well as provide the ability to recover and analyse - * strings. - * - * @_subsection api/utils:Strings and UTF-8 [about-strings] - */ -function errorFunc(reason, offset, bytes, output, badCodepoint) { - assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); -} -function ignoreFunc(reason, offset, bytes, output, badCodepoint) { - // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes - if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { - let i = 0; - for (let o = offset + 1; o < bytes.length; o++) { - if (bytes[o] >> 6 !== 0x02) { - break; - } - i++; - } - return i; - } - // This byte runs us past the end of the string, so just jump to the end - // (but the first byte was read already read and therefore skipped) - if (reason === "OVERRUN") { - return bytes.length - offset - 1; - } - // Nothing to skip - return 0; -} -function replaceFunc(reason, offset, bytes, output, badCodepoint) { - // Overlong representations are otherwise "valid" code points; just non-deistingtished - if (reason === "OVERLONG") { - assertArgument(typeof badCodepoint === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint); - output.push(badCodepoint); - return 0; - } - // Put the replacement character into the output - output.push(0xfffd); - // Otherwise, process as if ignoring errors - return ignoreFunc(reason, offset, bytes); -} -/** - * A handful of popular, built-in UTF-8 error handling strategies. - * - * **``"error"``** - throws on ANY illegal UTF-8 sequence or - * non-canonical (overlong) codepoints (this is the default) - * - * **``"ignore"``** - silently drops any illegal UTF-8 sequence - * and accepts non-canonical (overlong) codepoints - * - * **``"replace"``** - replace any illegal UTF-8 sequence with the - * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts - * non-canonical (overlong) codepoints - * - * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> - */ -const Utf8ErrorFuncs = Object.freeze({ - error: errorFunc, - ignore: ignoreFunc, - replace: replaceFunc, -}); -// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 -function getUtf8CodePoints(_bytes, onError) { - if (onError == null) { - onError = Utf8ErrorFuncs.error; - } - const bytes = getBytes(_bytes, "bytes"); - const result = []; - let i = 0; - // Invalid bytes are ignored - while (i < bytes.length) { - const c = bytes[i++]; - // 0xxx xxxx - if (c >> 7 === 0) { - result.push(c); - continue; - } - // Multibyte; how many bytes left for this character? - let extraLength = null; - let overlongMask = null; - // 110x xxxx 10xx xxxx - if ((c & 0xe0) === 0xc0) { - extraLength = 1; - overlongMask = 0x7f; - // 1110 xxxx 10xx xxxx 10xx xxxx - } - else if ((c & 0xf0) === 0xe0) { - extraLength = 2; - overlongMask = 0x7ff; - // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx - } - else if ((c & 0xf8) === 0xf0) { - extraLength = 3; - overlongMask = 0xffff; - } - else { - if ((c & 0xc0) === 0x80) { - i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); - } - else { - i += onError("BAD_PREFIX", i - 1, bytes, result); - } - continue; - } - // Do we have enough bytes in our data? - if (i - 1 + extraLength >= bytes.length) { - i += onError("OVERRUN", i - 1, bytes, result); - continue; - } - // Remove the length prefix from the char - let res = c & ((1 << (8 - extraLength - 1)) - 1); - for (let j = 0; j < extraLength; j++) { - let nextChar = bytes[i]; - // Invalid continuation byte - if ((nextChar & 0xc0) != 0x80) { - i += onError("MISSING_CONTINUE", i, bytes, result); - res = null; - break; - } - res = (res << 6) | (nextChar & 0x3f); - i++; - } - // See above loop for invalid continuation byte - if (res === null) { - continue; - } - // Maximum code point - if (res > 0x10ffff) { - i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); - continue; - } - // Reserved for UTF-16 surrogate halves - if (res >= 0xd800 && res <= 0xdfff) { - i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); - continue; - } - // Check for overlong sequences (more bytes than needed) - if (res <= overlongMask) { - i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); - continue; - } - result.push(res); - } - return result; -} -// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array -/** - * Returns the UTF-8 byte representation of %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ -function toUtf8Bytes(str, form) { - if (form != null) { - assertNormalize(form); - str = str.normalize(form); - } - let result = []; - for (let i = 0; i < str.length; i++) { - const c = str.charCodeAt(i); - if (c < 0x80) { - result.push(c); - } - else if (c < 0x800) { - result.push((c >> 6) | 0xc0); - result.push((c & 0x3f) | 0x80); - } - else if ((c & 0xfc00) == 0xd800) { - i++; - const c2 = str.charCodeAt(i); - assertArgument(i < str.length && (c2 & 0xfc00) === 0xdc00, "invalid surrogate pair", "str", str); - // Surrogate Pair - const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); - result.push((pair >> 18) | 0xf0); - result.push(((pair >> 12) & 0x3f) | 0x80); - result.push(((pair >> 6) & 0x3f) | 0x80); - result.push((pair & 0x3f) | 0x80); - } - else { - result.push((c >> 12) | 0xe0); - result.push(((c >> 6) & 0x3f) | 0x80); - result.push((c & 0x3f) | 0x80); - } - } - return new Uint8Array(result); -} -//export -function _toUtf8String(codePoints) { - return codePoints - .map((codePoint) => { - if (codePoint <= 0xffff) { - return String.fromCharCode(codePoint); - } - codePoint -= 0x10000; - return String.fromCharCode(((codePoint >> 10) & 0x3ff) + 0xd800, (codePoint & 0x3ff) + 0xdc00); - }) - .join(""); -} -/** - * Returns the string represented by the UTF-8 data %%bytes%%. - * - * When %%onError%% function is specified, it is called on UTF-8 - * errors allowing recovery using the [[Utf8ErrorFunc]] API. - * (default: [error](Utf8ErrorFuncs)) - */ -function toUtf8String(bytes, onError) { - return _toUtf8String(getUtf8CodePoints(bytes, onError)); -} -/** - * Returns the UTF-8 code-points for %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ -function toUtf8CodePoints(str, form) { - return getUtf8CodePoints(toUtf8Bytes(str, form)); -} - -// @TODO: timeout is completely ignored; start a Promise.any with a reject? -// @ts-ignore -async function getUrl(req, _signal) { - const protocol = req.url.split(":")[0].toLowerCase(); - assert(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { - info: { protocol }, - operation: "request", - }); - assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { - operation: "request", - }); - let signal = undefined; - if (_signal) { - const controller = new AbortController(); - signal = controller.signal; - _signal.addListener(() => { - controller.abort(); - }); - } - const init = { - method: req.method, - headers: new Headers(Array.from(req)), - body: req.body || undefined, - signal, - }; - try { - const resp = await fetch(req.url, init); - const headers = {}; - resp.headers.forEach((value, key) => { - headers[key.toLowerCase()] = value; - }); - const respBody = await resp.arrayBuffer(); - const body = respBody == null ? null : new Uint8Array(respBody); - return { - statusCode: resp.status, - statusMessage: resp.statusText, - headers, - body, - }; - } - catch (error) { - console.log({ error }); - return undefined; - } -} - -/** - * Explain fetching here... - * - * @_section api/utils/fetching:Fetching Web Content [about-fetch] - */ -const MAX_ATTEMPTS = 12; -const SLOT_INTERVAL = 250; -// The global FetchGetUrlFunc implementation. -let getUrlFunc = getUrl; -const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); -const reIpfs = new RegExp("^ipfs://(ipfs/)?(.*)$", "i"); -// If locked, new Gateways cannot be added -let locked$5 = false; -// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs -async function dataGatewayFunc(url, signal) { - try { - const match = url.match(reData); - if (!match) { - throw new Error("invalid data"); - } - return new FetchResponse(200, "OK", { - "content-type": match[1] || "text/plain", - }, match[2] ? decodeBase64(match[3]) : unpercent(match[3])); - } - catch (error) { - return new FetchResponse(599, "BAD REQUEST (invalid data: URI)", {}, null, new FetchRequest(url)); - } -} -/** - * Returns a [[FetchGatewayFunc]] for fetching content from a standard - * IPFS gateway hosted at %%baseUrl%%. - */ -function getIpfsGatewayFunc(baseUrl) { - async function gatewayIpfs(url, signal) { - try { - const match = url.match(reIpfs); - if (!match) { - throw new Error("invalid link"); - } - return new FetchRequest(`${baseUrl}${match[2]}`); - } - catch (error) { - return new FetchResponse(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new FetchRequest(url)); - } - } - return gatewayIpfs; -} -const Gateways = { - data: dataGatewayFunc, - ipfs: getIpfsGatewayFunc("https://gateway.ipfs.io/ipfs/"), -}; -const fetchSignals = new WeakMap(); -/** - * @_ignore - */ -class FetchCancelSignal { - #listeners; - #cancelled; - constructor(request) { - this.#listeners = []; - this.#cancelled = false; - fetchSignals.set(request, () => { - if (this.#cancelled) { - return; - } - this.#cancelled = true; - for (const listener of this.#listeners) { - setTimeout(() => { - listener(); - }, 0); - } - this.#listeners = []; - }); - } - addListener(listener) { - assert(!this.#cancelled, "singal already cancelled", "UNSUPPORTED_OPERATION", { - operation: "fetchCancelSignal.addCancelListener", - }); - this.#listeners.push(listener); - } - get cancelled() { - return this.#cancelled; - } - checkSignal() { - assert(!this.cancelled, "cancelled", "CANCELLED", {}); - } -} -// Check the signal, throwing if it is cancelled -function checkSignal(signal) { - if (signal == null) { - throw new Error("missing signal; should not happen"); - } - signal.checkSignal(); - return signal; -} -/** - * Represents a request for a resource using a URI. - * - * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, - * and ``IPFS:``. - * - * Additional schemes can be added globally using [[registerGateway]]. - * - * @example: - * req = new FetchRequest("https://www.ricmoo.com") - * resp = await req.send() - * resp.body.length - * //_result: - */ -class FetchRequest { - #allowInsecure; - #gzip; - #headers; - #method; - #timeout; - #url; - #body; - #bodyType; - #creds; - // Hooks - #preflight; - #process; - #retry; - #signal; - #throttle; - /** - * The fetch URI to requrest. - */ - get url() { - return this.#url; - } - set url(url) { - this.#url = String(url); - } - /** - * The fetch body, if any, to send as the request body. //(default: null)// - * - * When setting a body, the intrinsic ``Content-Type`` is automatically - * set and will be used if **not overridden** by setting a custom - * header. - * - * If %%body%% is null, the body is cleared (along with the - * intrinsic ``Content-Type``) and the . - * - * If %%body%% is a string, the intrincis ``Content-Type`` is set to - * ``text/plain``. - * - * If %%body%% is a Uint8Array, the intrincis ``Content-Type`` is set to - * ``application/octet-stream``. - * - * If %%body%% is any other object, the intrincis ``Content-Type`` is - * set to ``application/json``. - */ - get body() { - if (this.#body == null) { - return null; - } - return new Uint8Array(this.#body); - } - set body(body) { - if (body == null) { - this.#body = undefined; - this.#bodyType = undefined; - } - else if (typeof body === "string") { - this.#body = toUtf8Bytes(body); - this.#bodyType = "text/plain"; - } - else if (body instanceof Uint8Array) { - this.#body = body; - this.#bodyType = "application/octet-stream"; - } - else if (typeof body === "object") { - this.#body = toUtf8Bytes(JSON.stringify(body)); - this.#bodyType = "application/json"; - } - else { - throw new Error("invalid body"); - } - } - /** - * Returns true if the request has a body. - */ - hasBody() { - return this.#body != null; - } - /** - * The HTTP method to use when requesting the URI. If no method - * has been explicitly set, then ``GET`` is used if the body is - * null and ``POST`` otherwise. - */ - get method() { - if (this.#method) { - return this.#method; - } - if (this.hasBody()) { - return "POST"; - } - return "GET"; - } - set method(method) { - if (method == null) { - method = ""; - } - this.#method = String(method).toUpperCase(); - } - /** - * The headers that will be used when requesting the URI. All - * keys are lower-case. - * - * This object is a copy, so any chnages will **NOT** be reflected - * in the ``FetchRequest``. - * - * To set a header entry, use the ``setHeader`` method. - */ - get headers() { - const headers = Object.assign({}, this.#headers); - if (this.#creds) { - headers["authorization"] = `Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`; - } - if (this.allowGzip) { - headers["accept-encoding"] = "gzip"; - } - if (headers["content-type"] == null && this.#bodyType) { - headers["content-type"] = this.#bodyType; - } - if (this.body) { - headers["content-length"] = String(this.body.length); - } - return headers; - } - /** - * Get the header for %%key%%, ignoring case. - */ - getHeader(key) { - return this.headers[key.toLowerCase()]; - } - /** - * Set the header for %%key%% to %%value%%. All values are coerced - * to a string. - */ - setHeader(key, value) { - this.#headers[String(key).toLowerCase()] = String(value); - } - /** - * Clear all headers, resetting all intrinsic headers. - */ - clearHeaders() { - this.#headers = {}; - } - [Symbol.iterator]() { - const headers = this.headers; - const keys = Object.keys(headers); - let index = 0; - return { - next: () => { - if (index < keys.length) { - const key = keys[index++]; - return { - value: [key, headers[key]], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - /** - * The value that will be sent for the ``Authorization`` header. - * - * To set the credentials, use the ``setCredentials`` method. - */ - get credentials() { - return this.#creds || null; - } - /** - * Sets an ``Authorization`` for %%username%% with %%password%%. - */ - setCredentials(username, password) { - assertArgument(!username.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"); - this.#creds = `${username}:${password}`; - } - /** - * Enable and request gzip-encoded responses. The response will - * automatically be decompressed. //(default: true)// - */ - get allowGzip() { - return this.#gzip; - } - set allowGzip(value) { - this.#gzip = !!value; - } - /** - * Allow ``Authentication`` credentials to be sent over insecure - * channels. //(default: false)// - */ - get allowInsecureAuthentication() { - return !!this.#allowInsecure; - } - set allowInsecureAuthentication(value) { - this.#allowInsecure = !!value; - } - /** - * The timeout (in milliseconds) to wait for a complere response. - * //(default: 5 minutes)// - */ - get timeout() { - return this.#timeout; - } - set timeout(timeout) { - assertArgument(timeout >= 0, "timeout must be non-zero", "timeout", timeout); - this.#timeout = timeout; - } - /** - * This function is called prior to each request, for example - * during a redirection or retry in case of server throttling. - * - * This offers an opportunity to populate headers or update - * content before sending a request. - */ - get preflightFunc() { - return this.#preflight || null; - } - set preflightFunc(preflight) { - this.#preflight = preflight; - } - /** - * This function is called after each response, offering an - * opportunity to provide client-level throttling or updating - * response data. - * - * Any error thrown in this causes the ``send()`` to throw. - * - * To schedule a retry attempt (assuming the maximum retry limit - * has not been reached), use [[response.throwThrottleError]]. - */ - get processFunc() { - return this.#process || null; - } - set processFunc(process) { - this.#process = process; - } - /** - * This function is called on each retry attempt. - */ - get retryFunc() { - return this.#retry || null; - } - set retryFunc(retry) { - this.#retry = retry; - } - /** - * Create a new FetchRequest instance with default values. - * - * Once created, each property may be set before issuing a - * ``.send()`` to make the request. - */ - constructor(url) { - this.#url = String(url); - this.#allowInsecure = false; - this.#gzip = true; - this.#headers = {}; - this.#method = ""; - this.#timeout = 300000; - this.#throttle = { - slotInterval: SLOT_INTERVAL, - maxAttempts: MAX_ATTEMPTS, - }; - } - toString() { - return ``; - } - /** - * Update the throttle parameters used to determine maximum - * attempts and exponential-backoff properties. - */ - setThrottleParams(params) { - if (params.slotInterval != null) { - this.#throttle.slotInterval = params.slotInterval; - } - if (params.maxAttempts != null) { - this.#throttle.maxAttempts = params.maxAttempts; - } - } - async #send(attempt, expires, delay, _request, _response) { - if (attempt >= this.#throttle.maxAttempts) { - return _response.makeServerError("exceeded maximum retry limit"); - } - assert(getTime$2() <= expires, "timeout", "TIMEOUT", { - operation: "request.send", - reason: "timeout", - request: _request, - }); - if (delay > 0) { - await wait(delay); - } - let req = this.clone(); - const scheme = (req.url.split(":")[0] || "").toLowerCase(); - // Process any Gateways - if (scheme in Gateways) { - const result = await Gateways[scheme](req.url, checkSignal(_request.#signal)); - if (result instanceof FetchResponse) { - let response = result; - if (this.processFunc) { - checkSignal(_request.#signal); - try { - response = await this.processFunc(req, response); - } - catch (error) { - // Something went wrong during processing; throw a 5xx server error - if (error.throttle == null || typeof error.stall !== "number") { - response - .makeServerError("error in post-processing function", error) - .assertOk(); - } - // Ignore throttling - } - } - return response; - } - req = result; - } - // We have a preflight function; update the request - if (this.preflightFunc) { - req = await this.preflightFunc(req); - } - const resp = await getUrlFunc(req, checkSignal(_request.#signal)); - let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); - if (response.statusCode === 301 || response.statusCode === 302) { - // Redirect - try { - const location = response.headers.location || ""; - return req - .redirect(location) - .#send(attempt + 1, expires, 0, _request, response); - } - catch (error) { } - // Things won't get any better on another attempt; abort - return response; - } - else if (response.statusCode === 429) { - // Throttle - if (this.retryFunc == null || - (await this.retryFunc(req, response, attempt))) { - const retryAfter = response.headers["retry-after"]; - let delay = this.#throttle.slotInterval * - Math.trunc(Math.random() * Math.pow(2, attempt)); - if (typeof retryAfter === "string" && - retryAfter.match(/^[1-9][0-9]*$/)) { - delay = parseInt(retryAfter); - } - return req - .clone() - .#send(attempt + 1, expires, delay, _request, response); - } - } - if (this.processFunc) { - checkSignal(_request.#signal); - try { - response = await this.processFunc(req, response); - } - catch (error) { - // Something went wrong during processing; throw a 5xx server error - if (error.throttle == null || typeof error.stall !== "number") { - response - .makeServerError("error in post-processing function", error) - .assertOk(); - } - // Throttle - let delay = this.#throttle.slotInterval * - Math.trunc(Math.random() * Math.pow(2, attempt)); - if (error.stall >= 0) { - delay = error.stall; - } - return req - .clone() - .#send(attempt + 1, expires, delay, _request, response); - } - } - return response; - } - /** - * Resolves to the response by sending the request. - */ - send() { - assert(this.#signal == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); - this.#signal = new FetchCancelSignal(this); - return this.#send(0, getTime$2() + this.timeout, 0, this, new FetchResponse(0, "", {}, null, this)); - } - /** - * Cancels the inflight response, causing a ``CANCELLED`` - * error to be rejected from the [[send]]. - */ - cancel() { - assert(this.#signal != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); - const signal = fetchSignals.get(this); - if (!signal) { - throw new Error("missing signal; should not happen"); - } - signal(); - } - /** - * Returns a new [[FetchRequest]] that represents the redirection - * to %%location%%. - */ - redirect(location) { - // Redirection; for now we only support absolute locataions - const current = this.url.split(":")[0].toLowerCase(); - const target = location.split(":")[0].toLowerCase(); - // Don't allow redirecting: - // - non-GET requests - // - downgrading the security (e.g. https => http) - // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?] - assert(this.method === "GET" && - (current !== "https" || target !== "http") && - location.match(/^https?:/), `unsupported redirect`, "UNSUPPORTED_OPERATION", { - operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})`, - }); - // Create a copy of this request, with a new URL - const req = new FetchRequest(location); - req.method = "GET"; - req.allowGzip = this.allowGzip; - req.timeout = this.timeout; - req.#headers = Object.assign({}, this.#headers); - if (this.#body) { - req.#body = new Uint8Array(this.#body); - } - req.#bodyType = this.#bodyType; - // Do not forward credentials unless on the same domain; only absolute - //req.allowInsecure = false; - // paths are currently supported; may want a way to specify to forward? - //setStore(req.#props, "creds", getStore(this.#pros, "creds")); - return req; - } - /** - * Create a new copy of this request. - */ - clone() { - const clone = new FetchRequest(this.url); - // Preserve "default method" (i.e. null) - clone.#method = this.#method; - // Preserve "default body" with type, copying the Uint8Array is present - if (this.#body) { - clone.#body = this.#body; - } - clone.#bodyType = this.#bodyType; - // Preserve "default headers" - clone.#headers = Object.assign({}, this.#headers); - // Credentials is readonly, so we copy internally - clone.#creds = this.#creds; - if (this.allowGzip) { - clone.allowGzip = true; - } - clone.timeout = this.timeout; - if (this.allowInsecureAuthentication) { - clone.allowInsecureAuthentication = true; - } - clone.#preflight = this.#preflight; - clone.#process = this.#process; - clone.#retry = this.#retry; - return clone; - } - /** - * Locks all static configuration for gateways and FetchGetUrlFunc - * registration. - */ - static lockConfig() { - locked$5 = true; - } - /** - * Get the current Gateway function for %%scheme%%. - */ - static getGateway(scheme) { - return Gateways[scheme.toLowerCase()] || null; - } - /** - * Use the %%func%% when fetching URIs using %%scheme%%. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGateway(scheme, func) { - scheme = scheme.toLowerCase(); - if (scheme === "http" || scheme === "https") { - throw new Error(`cannot intercept ${scheme}; use registerGetUrl`); - } - if (locked$5) { - throw new Error("gateways locked"); - } - Gateways[scheme] = func; - } - /** - * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGetUrl(getUrl) { - if (locked$5) { - throw new Error("gateways locked"); - } - getUrlFunc = getUrl; - } - /** - * Creates a function that can "fetch" data URIs. - * - * Note that this is automatically done internally to support - * data URIs, so it is not necessary to register it. - * - * This is not generally something that is needed, but may - * be useful in a wrapper to perfom custom data URI functionality. - */ - static createDataGateway() { - return dataGatewayFunc; - } - /** - * Creates a function that will fetch IPFS (unvalidated) from - * a custom gateway baseUrl. - * - * The default IPFS gateway used internally is - * ``"https:/\/gateway.ipfs.io/ipfs/"``. - */ - static createIpfsGatewayFunc(baseUrl) { - return getIpfsGatewayFunc(baseUrl); - } -} -/** - * The response for a FetchREquest. - */ -class FetchResponse { - #statusCode; - #statusMessage; - #headers; - #body; - #request; - #error; - toString() { - return ``; - } - /** - * The response status code. - */ - get statusCode() { - return this.#statusCode; - } - /** - * The response status message. - */ - get statusMessage() { - return this.#statusMessage; - } - /** - * The response headers. All keys are lower-case. - */ - get headers() { - return Object.assign({}, this.#headers); - } - /** - * The response body, or ``null`` if there was no body. - */ - get body() { - return this.#body == null ? null : new Uint8Array(this.#body); - } - /** - * The response body as a UTF-8 encoded string, or the empty - * string (i.e. ``""``) if there was no body. - * - * An error is thrown if the body is invalid UTF-8 data. - */ - get bodyText() { - try { - return this.#body == null ? "" : toUtf8String(this.#body); - } - catch (error) { - assert(false, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { - operation: "bodyText", - info: { response: this }, - }); - } - } - /** - * The response body, decoded as JSON. - * - * An error is thrown if the body is invalid JSON-encoded data - * or if there was no body. - */ - get bodyJson() { - try { - return JSON.parse(this.bodyText); - } - catch (error) { - assert(false, "response body is not valid JSON", "UNSUPPORTED_OPERATION", { - operation: "bodyJson", - info: { response: this }, - }); - } - } - [Symbol.iterator]() { - const headers = this.headers; - const keys = Object.keys(headers); - let index = 0; - return { - next: () => { - if (index < keys.length) { - const key = keys[index++]; - return { - value: [key, headers[key]], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - constructor(statusCode, statusMessage, headers, body, request) { - this.#statusCode = statusCode; - this.#statusMessage = statusMessage; - this.#headers = Object.keys(headers).reduce((accum, k) => { - accum[k.toLowerCase()] = String(headers[k]); - return accum; - }, {}); - this.#body = body == null ? null : new Uint8Array(body); - this.#request = request || null; - this.#error = { message: "" }; - } - /** - * Return a Response with matching headers and body, but with - * an error status code (i.e. 599) and %%message%% with an - * optional %%error%%. - */ - makeServerError(message, error) { - let statusMessage; - if (!message) { - message = `${this.statusCode} ${this.statusMessage}`; - statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`; - } - else { - statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; - } - const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined); - response.#error = { message, error }; - return response; - } - /** - * If called within a [request.processFunc](FetchRequest-processFunc) - * call, causes the request to retry as if throttled for %%stall%% - * milliseconds. - */ - throwThrottleError(message, stall) { - if (stall == null) { - stall = -1; - } - else { - assertArgument(Number.isInteger(stall) && stall >= 0, "invalid stall timeout", "stall", stall); - } - const error = new Error(message || "throttling requests"); - defineProperties(error, { stall, throttle: true }); - throw error; - } - /** - * Get the header value for %%key%%, ignoring case. - */ - getHeader(key) { - return this.headers[key.toLowerCase()]; - } - /** - * Returns true of the response has a body. - */ - hasBody() { - return this.#body != null; - } - /** - * The request made for this response. - */ - get request() { - return this.#request; - } - /** - * Returns true if this response was a success statusCode. - */ - ok() { - return (this.#error.message === "" && - this.statusCode >= 200 && - this.statusCode < 300); - } - /** - * Throws a ``SERVER_ERROR`` if this response is not ok. - */ - assertOk() { - if (this.ok()) { - return; - } - let { message, error } = this.#error; - if (message === "") { - message = `server response ${this.statusCode} ${this.statusMessage}`; - } - assert(false, message, "SERVER_ERROR", { - request: this.request || "unknown request", - response: this, - error, - }); - } -} -function getTime$2() { - return new Date().getTime(); -} -function unpercent(value) { - return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { - return String.fromCharCode(parseInt(code, 16)); - })); -} -function wait(delay) { - return new Promise((resolve) => setTimeout(resolve, delay)); -} - -var _a$1; -const BN_N1 = BigInt(-1); -const BN_0$7 = BigInt(0); -const BN_1$4 = BigInt(1); -const BN_5 = BigInt(5); -const _guard$5 = {}; -// Constant to pull zeros from for multipliers -let Zeros = "0000"; -while (Zeros.length < 80) { - Zeros += Zeros; -} -// Returns a string "1" followed by decimal "0"s -function getTens(decimals) { - let result = Zeros; - while (result.length < decimals) { - result += result; - } - return BigInt("1" + result.substring(0, decimals)); -} -function checkValue(val, format, safeOp) { - const width = BigInt(format.width); - if (format.signed) { - const limit = BN_1$4 << (width - BN_1$4); - assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { - operation: safeOp, - fault: "overflow", - value: val, - }); - if (val > BN_0$7) { - val = fromTwos(mask(val, width), width); - } - else { - val = -fromTwos(mask(-val, width), width); - } - } - else { - const limit = BN_1$4 << width; - assert(safeOp == null || (val >= 0 && val < limit), "overflow", "NUMERIC_FAULT", { - operation: safeOp, - fault: "overflow", - value: val, - }); - val = ((val % limit) + limit) % limit & (limit - BN_1$4); - } - return val; -} -function getFormat(value) { - if (typeof value === "number") { - value = `fixed128x${value}`; - } - let signed = true; - let width = 128; - let decimals = 18; - if (typeof value === "string") { - // Parse the format string - if (value === "fixed") ; - else if (value === "ufixed") { - signed = false; - } - else { - const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); - assertArgument(match, "invalid fixed format", "format", value); - signed = match[1] !== "u"; - width = parseInt(match[2]); - decimals = parseInt(match[3]); - } - } - else if (value) { - // Extract the values from the object - const v = value; - const check = (key, type, defaultValue) => { - if (v[key] == null) { - return defaultValue; - } - assertArgument(typeof v[key] === type, "invalid fixed format (" + key + " not " + type + ")", "format." + key, v[key]); - return v[key]; - }; - signed = check("signed", "boolean", signed); - width = check("width", "number", width); - decimals = check("decimals", "number", decimals); - } - assertArgument(width % 8 === 0, "invalid FixedNumber width (not byte aligned)", "format.width", width); - assertArgument(decimals <= 80, "invalid FixedNumber decimals (too large)", "format.decimals", decimals); - const name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); - return { signed, width, decimals, name }; -} -function toString(val, decimals) { - let negative = ""; - if (val < BN_0$7) { - negative = "-"; - val *= BN_N1; - } - let str = val.toString(); - // No decimal point for whole values - if (decimals === 0) { - return negative + str; - } - // Pad out to the whole component (including a whole digit) - while (str.length <= decimals) { - str = Zeros + str; - } - // Insert the decimal point - const index = str.length - decimals; - str = str.substring(0, index) + "." + str.substring(index); - // Trim the whole component (leaving at least one 0) - while (str[0] === "0" && str[1] !== ".") { - str = str.substring(1); - } - // Trim the decimal component (leaving at least one 0) - while (str[str.length - 1] === "0" && str[str.length - 2] !== ".") { - str = str.substring(0, str.length - 1); - } - return negative + str; -} -/** - * A FixedNumber represents a value over its [[FixedFormat]] - * arithmetic field. - * - * A FixedNumber can be used to perform math, losslessly, on - * values which have decmial places. - * - * A FixedNumber has a fixed bit-width to store values in, and stores all - * values internally by multiplying the value by 10 raised to the power of - * %%decimals%%. - * - * If operations are performed that cause a value to grow too high (close to - * positive infinity) or too low (close to negative infinity), the value - * is said to //overflow//. - * - * For example, an 8-bit signed value, with 0 decimals may only be within - * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become - * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. - * - * Many operation have a normal and //unsafe// variant. The normal variant - * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// - * variant will silently allow overflow, corrupting its value value. - * - * If operations are performed that cause a value to become too small - * (close to zero), the value loses precison and is said to //underflow//. - * - * For example, an value with 1 decimal place may store a number as small - * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit - * into 1 decimal place, so underflow occurs which means precision is lost - * and the value becomes ``0``. - * - * Some operations have a normal and //signalling// variant. The normal - * variant will silently ignore underflow, while the //signalling// variant - * will thow a [[NumericFaultError]] on underflow. - */ -class FixedNumber { - /** - * The specific fixed-point arithmetic field for this value. - */ - format; - #format; - // The actual value (accounting for decimals) - #val; - // A base-10 value to multiple values by to maintain the magnitude - #tens; - /** - * This is a property so console.log shows a human-meaningful value. - * - * @private - */ - _value; - // Use this when changing this file to get some typing info, - // but then switch to any to mask the internal type - //constructor(guard: any, value: bigint, format: _FixedFormat) { - /** - * @private - */ - constructor(guard, value, format) { - assertPrivate(guard, _guard$5, "FixedNumber"); - this.#val = value; - this.#format = format; - const _value = toString(value, format.decimals); - defineProperties(this, { format: format.name, _value }); - this.#tens = getTens(format.decimals); - } - /** - * If true, negative values are permitted, otherwise only - * positive values and zero are allowed. - */ - get signed() { - return this.#format.signed; - } - /** - * The number of bits available to store the value. - */ - get width() { - return this.#format.width; - } - /** - * The number of decimal places in the fixed-point arithment field. - */ - get decimals() { - return this.#format.decimals; - } - /** - * The value as an integer, based on the smallest unit the - * [[decimals]] allow. - */ - get value() { - return this.#val; - } - #checkFormat(other) { - assertArgument(this.format === other.format, "incompatible format; use fixedNumber.toFormat", "other", other); - } - #checkValue(val, safeOp) { - /* - const width = BigInt(this.width); - if (this.signed) { - const limit = (BN_1 << (width - BN_1)); - assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { - operation: safeOp, fault: "overflow", value: val - }); - - if (val > BN_0) { - val = fromTwos(mask(val, width), width); - } else { - val = -fromTwos(mask(-val, width), width); - } - - } else { - const masked = mask(val, width); - assert(safeOp == null || (val >= 0 && val === masked), "overflow", "NUMERIC_FAULT", { - operation: safeOp, fault: "overflow", value: val - }); - val = masked; - } - */ - val = checkValue(val, this.#format, safeOp); - return new _a$1(_guard$5, val, this.#format); - } - #add(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue(this.#val + o.#val, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%, ignoring overflow. - */ - addUnsafe(other) { - return this.#add(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - add(other) { - return this.#add(other, "add"); - } - #sub(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue(this.#val - o.#val, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%, ignoring overflow. - */ - subUnsafe(other) { - return this.#sub(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - sub(other) { - return this.#sub(other, "sub"); - } - #mul(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%, ignoring overflow and underflow (precision loss). - */ - mulUnsafe(other) { - return this.#mul(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - mul(other) { - return this.#mul(other, "mul"); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs or if underflow (precision loss) occurs. - */ - mulSignal(other) { - this.#checkFormat(other); - const value = this.#val * other.#val; - assert(value % this.#tens === BN_0$7, "precision lost during signalling mul", "NUMERIC_FAULT", { - operation: "mulSignal", - fault: "underflow", - value: this, - }); - return this.#checkValue(value / this.#tens, "mulSignal"); - } - #div(o, safeOp) { - assert(o.#val !== BN_0$7, "division by zero", "NUMERIC_FAULT", { - operation: "div", - fault: "divide-by-zero", - value: this, - }); - this.#checkFormat(o); - return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - divUnsafe(other) { - return this.#div(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - div(other) { - return this.#div(other, "div"); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%. A [[NumericFaultError]] is thrown if underflow - * (precision loss) occurs. - */ - divSignal(other) { - assert(other.#val !== BN_0$7, "division by zero", "NUMERIC_FAULT", { - operation: "div", - fault: "divide-by-zero", - value: this, - }); - this.#checkFormat(other); - const value = this.#val * this.#tens; - assert(value % other.#val === BN_0$7, "precision lost during signalling div", "NUMERIC_FAULT", { - operation: "divSignal", - fault: "underflow", - value: this, - }); - return this.#checkValue(value / other.#val, "divSignal"); - } - /** - * Returns a comparison result between %%this%% and %%other%%. - * - * This is suitable for use in sorting, where ``-1`` implies %%this%% - * is smaller, ``1`` implies %%other%% is larger and ``0`` implies - * both are equal. - */ - cmp(other) { - let a = this.value, b = other.value; - // Coerce a and b to the same magnitude - const delta = this.decimals - other.decimals; - if (delta > 0) { - b *= getTens(delta); - } - else if (delta < 0) { - a *= getTens(-delta); - } - // Comnpare - if (a < b) { - return -1; - } - if (a > b) { - return -1; - } - return 0; - } - /** - * Returns true if %%other%% is equal to %%this%%. - */ - eq(other) { - return this.cmp(other) === 0; - } - /** - * Returns true if %%other%% is less than to %%this%%. - */ - lt(other) { - return this.cmp(other) < 0; - } - /** - * Returns true if %%other%% is less than or equal to %%this%%. - */ - lte(other) { - return this.cmp(other) <= 0; - } - /** - * Returns true if %%other%% is greater than to %%this%%. - */ - gt(other) { - return this.cmp(other) > 0; - } - /** - * Returns true if %%other%% is greater than or equal to %%this%%. - */ - gte(other) { - return this.cmp(other) >= 0; - } - /** - * Returns a new [[FixedNumber]] which is the largest **integer** - * that is less than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - floor() { - let val = this.#val; - if (this.#val < BN_0$7) { - val -= this.#tens - BN_1$4; - } - val = (this.#val / this.#tens) * this.#tens; - return this.#checkValue(val, "floor"); - } - /** - * Returns a new [[FixedNumber]] which is the smallest **integer** - * that is greater than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - ceiling() { - let val = this.#val; - if (this.#val > BN_0$7) { - val += this.#tens - BN_1$4; - } - val = (this.#val / this.#tens) * this.#tens; - return this.#checkValue(val, "ceiling"); - } - /** - * Returns a new [[FixedNumber]] with the decimal component - * rounded up on ties at %%decimals%% places. - */ - round(decimals) { - if (decimals == null) { - decimals = 0; - } - // Not enough precision to not already be rounded - if (decimals >= this.decimals) { - return this; - } - const delta = this.decimals - decimals; - const bump = BN_5 * getTens(delta - 1); - let value = this.value + bump; - const tens = getTens(delta); - value = (value / tens) * tens; - checkValue(value, this.#format, "round"); - return new _a$1(_guard$5, value, this.#format); - } - /** - * Returns true if %%this%% is equal to ``0``. - */ - isZero() { - return this.#val === BN_0$7; - } - /** - * Returns true if %%this%% is less than ``0``. - */ - isNegative() { - return this.#val < BN_0$7; - } - /** - * Returns the string representation of %%this%%. - */ - toString() { - return this._value; - } - /** - * Returns a float approximation. - * - * Due to IEEE 754 precission (or lack thereof), this function - * can only return an approximation and most values will contain - * rounding errors. - */ - toUnsafeFloat() { - return parseFloat(this.toString()); - } - /** - * Return a new [[FixedNumber]] with the same value but has had - * its field set to %%format%%. - * - * This will throw if the value cannot fit into %%format%%. - */ - toFormat(format) { - return _a$1.fromString(this.toString(), format); - } - /** - * Creates a new [[FixedNumber]] for %%value%% divided by - * %%decimal%% places with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% (once adjusted - * for %%decimals%%) cannot fit in %%format%%, either due to overflow - * or underflow (precision loss). - */ - static fromValue(_value, decimals, _format) { - if (decimals == null) { - decimals = 0; - } - const format = getFormat(_format); - let value = getBigInt(_value, "value"); - const delta = decimals - format.decimals; - if (delta > 0) { - const tens = getTens(delta); - assert(value % tens === BN_0$7, "value loses precision for format", "NUMERIC_FAULT", { - operation: "fromValue", - fault: "underflow", - value: _value, - }); - value /= tens; - } - else if (delta < 0) { - value *= getTens(-delta); - } - checkValue(value, format, "fromValue"); - return new _a$1(_guard$5, value, format); - } - /** - * Creates a new [[FixedNumber]] for %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%%, either due to overflow or underflow (precision loss). - */ - static fromString(_value, _format) { - const match = _value.match(/^(-?)([0-9]*)\.?([0-9]*)$/); - assertArgument(match && match[2].length + match[3].length > 0, "invalid FixedNumber string value", "value", _value); - const format = getFormat(_format); - let whole = match[2] || "0", decimal = match[3] || ""; - // Pad out the decimals - while (decimal.length < format.decimals) { - decimal += Zeros; - } - // Check precision is safe - assert(decimal.substring(format.decimals).match(/^0*$/), "too many decimals for format", "NUMERIC_FAULT", { - operation: "fromString", - fault: "underflow", - value: _value, - }); - // Remove extra padding - decimal = decimal.substring(0, format.decimals); - const value = BigInt(match[1] + whole + decimal); - checkValue(value, format, "fromString"); - return new _a$1(_guard$5, value, format); - } - /** - * Creates a new [[FixedNumber]] with the big-endian representation - * %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%% due to overflow. - */ - static fromBytes(_value, _format) { - let value = toBigInt(getBytes(_value, "value")); - const format = getFormat(_format); - if (format.signed) { - value = fromTwos(value, format.width); - } - checkValue(value, format, "fromBytes"); - return new _a$1(_guard$5, value, format); - } -} -_a$1 = FixedNumber; -//const f1 = FixedNumber.fromString("12.56", "fixed16x2"); -//const f2 = FixedNumber.fromString("0.3", "fixed16x2"); -//console.log(f1.divSignal(f2)); -//const BUMP = FixedNumber.from("0.5"); - -function hexlifyByte(value) { - let result = value.toString(16); - while (result.length < 2) { - result = "0" + result; - } - return "0x" + result; -} -function unarrayifyInteger(data, offset, length) { - let result = 0; - for (let i = 0; i < length; i++) { - result = result * 256 + data[offset + i]; - } - return result; -} -function _decodeChildren(data, offset, childOffset, length) { - const result = []; - while (childOffset < offset + 1 + length) { - const decoded = _decode(data, childOffset); - result.push(decoded.result); - childOffset += decoded.consumed; - assert(childOffset <= offset + 1 + length, "child data too short", "BUFFER_OVERRUN", { - buffer: data, - length, - offset, - }); - } - return { consumed: 1 + length, result: result }; -} -// returns { consumed: number, result: Object } -function _decode(data, offset) { - assert(data.length !== 0, "data too short", "BUFFER_OVERRUN", { - buffer: data, - length: 0, - offset: 1, - }); - const checkOffset = (offset) => { - assert(offset <= data.length, "data short segment too short", "BUFFER_OVERRUN", { - buffer: data, - length: data.length, - offset, - }); - }; - // Array with extra length prefix - if (data[offset] >= 0xf8) { - const lengthLength = data[offset] - 0xf7; - checkOffset(offset + 1 + lengthLength); - const length = unarrayifyInteger(data, offset + 1, lengthLength); - checkOffset(offset + 1 + lengthLength + length); - return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); - } - else if (data[offset] >= 0xc0) { - const length = data[offset] - 0xc0; - checkOffset(offset + 1 + length); - return _decodeChildren(data, offset, offset + 1, length); - } - else if (data[offset] >= 0xb8) { - const lengthLength = data[offset] - 0xb7; - checkOffset(offset + 1 + lengthLength); - const length = unarrayifyInteger(data, offset + 1, lengthLength); - checkOffset(offset + 1 + lengthLength + length); - const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); - return { consumed: 1 + lengthLength + length, result: result }; - } - else if (data[offset] >= 0x80) { - const length = data[offset] - 0x80; - checkOffset(offset + 1 + length); - const result = hexlify(data.slice(offset + 1, offset + 1 + length)); - return { consumed: 1 + length, result: result }; - } - return { consumed: 1, result: hexlifyByte(data[offset]) }; -} -/** - * Decodes %%data%% into the structured data it represents. - */ -function decodeRlp(_data) { - const data = getBytes(_data, "data"); - const decoded = _decode(data, 0); - assertArgument(decoded.consumed === data.length, "unexpected junk after rlp payload", "data", _data); - return decoded.result; -} - -function arrayifyInteger(value) { - const result = []; - while (value) { - result.unshift(value & 0xff); - value >>= 8; - } - return result; -} -function _encode(object) { - if (Array.isArray(object)) { - let payload = []; - object.forEach(function (child) { - payload = payload.concat(_encode(child)); - }); - if (payload.length <= 55) { - payload.unshift(0xc0 + payload.length); - return payload; - } - const length = arrayifyInteger(payload.length); - length.unshift(0xf7 + length.length); - return length.concat(payload); - } - const data = Array.prototype.slice.call(getBytes(object, "object")); - if (data.length === 1 && data[0] <= 0x7f) { - return data; - } - else if (data.length <= 55) { - data.unshift(0x80 + data.length); - return data; - } - const length = arrayifyInteger(data.length); - length.unshift(0xb7 + length.length); - return length.concat(data); -} -const nibbles = "0123456789abcdef"; -/** - * Encodes %%object%% as an RLP-encoded [[DataHexString]]. - */ -function encodeRlp(object) { - let result = "0x"; - for (const v of _encode(object)) { - result += nibbles[v >> 4]; - result += nibbles[v & 0xf]; - } - return result; -} - -/** - * Most interactions with Core requires integer values, which use - * the smallest magnitude unit. - * - * For example, imagine dealing with dollars and cents. Since dollars - * are divisible, non-integer values are possible, such as ``$10.77``. - * By using the smallest indivisible unit (i.e. cents), the value can - * be kept as the integer ``1077``. - * - * When receiving decimal input from the user (as a decimal string), - * the value should be converted to an integer and when showing a user - * a value, the integer value should be converted to a decimal string. - * - * This creates a clear distinction, between values to be used by code - * (integers) and values used for display logic to users (decimals). - * - * The native unit in Core, //Core// is divisible to 18 decimal places, - * where each individual unit is called a //ore//. - * - * @_subsection api/utils:Unit Conversion [about-units] - */ -const names = [ - ///Ore, the smallest and atomic amount of Core - "ore", - ///fecore, 1000 ore - "fecore", - ///Picore, one million ore - "picore", - ///Nacore, one billion ore. Typically a reasonable unit to measure energy prices. - "nacore", - ///Μcore, 10^12 ore or 1 μCore - "mcore", - ///micore, 10^15 ore or 1 mcore - "micore", - "core", -]; -/** - * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal - * places. The %%unit%% may be the number of decimal places or the name of - * a unit - * - */ -function formatUnits(value, unit) { - let decimals = 18; - if (typeof unit === "string") { - const index = names.indexOf(unit); - assertArgument(index >= 0, "invalid unit", "unit", unit); - decimals = 3 * index; - } - else if (unit != null) { - decimals = getNumber(unit, "unit"); - } - return FixedNumber.fromValue(value, decimals, { decimals }).toString(); -} -/** - * Converts the //decimal string// %%value%% to a BigInt, assuming - * %%unit%% decimal places. The %%unit%% may the number of decimal places - * or the name of a unit. - */ -const scientificToDecimal = (num) => { - // @ts-ignore - var nsign = Math.sign(num); - //remove the sign - // @ts-ignore - num = Math.abs(num); - //if the number is in scientific notation remove it - // @ts-ignore - if (/\d+\.?\d*e[\+\-]*\d+/i.test(num)) { - var zero = "0", - // @ts-ignore - parts = String(num).toLowerCase().split("e"), //split into coeff and exponent - e = parts.pop(), //store the exponential part - // @ts-ignore - l = Math.abs(e), //get the number of zeros - // @ts-ignore - sign = e / l, coeff_array = parts[0].split("."); - if (sign === -1) { - l = l - coeff_array[0].length; - if (l < 0) { - // @ts-ignore - num = - coeff_array[0].slice(0, l) + - "." + - coeff_array[0].slice(l) + - (coeff_array.length === 2 ? coeff_array[1] : ""); - } - else { - // @ts-ignore - num = zero + "." + new Array(l + 1).join(zero) + coeff_array.join(""); - } - } - else { - var dec = coeff_array[1]; - if (dec) - l = l - dec.length; - if (l < 0) { - // @ts-ignore - num = coeff_array[0] + dec.slice(0, l) + "." + dec.slice(l); - } - else { - // @ts-ignore - num = coeff_array.join("") + new Array(l + 1).join(zero); - } - } - } - // @ts-ignore - return nsign < 0 ? "-" + num : num; -}; -const trimDecimals = (n, decimals = 18) => { - n += ""; - if (n.indexOf(".") === -1) - return n; - const arr = n.split("."); - const fraction = arr[1].substr(0, decimals); - return arr[0] + "." + fraction; -}; -function parseUnits(value, unit) { - assertArgument(typeof value === "string", "value must be a string", "value", value); - if (value.includes("e")) { - value = scientificToDecimal(value).toString(); - } - let decimals = 18; - if (typeof unit === "string") { - const index = names.indexOf(unit); - assertArgument(index >= 0, "invalid unit", "unit", unit); - decimals = 3 * index; - value = trimDecimals(value, decimals); - } - else if (unit != null) { - decimals = getNumber(unit, "unit"); - value = trimDecimals(value, decimals); - } - return FixedNumber.fromString(value, { decimals }).value; -} -/** - * Converts %%value%% into a //decimal string// using 18 decimal places. - */ -function formatXCB(ore) { - return formatUnits(ore, 18); -} -/** - * Converts the //decimal string// %%xcb%% to a BigInt, using 18 - * decimal places. - */ -function parseXCB(xcb) { - return parseUnits(xcb, 18); -} - -/** - * Explain UUID and link to RFC here. - * - * @_subsection: api/utils:UUID [about-uuid] - */ -/** - * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. - * - * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) - */ -function uuidV4(randomBytes) { - const bytes = getBytes(randomBytes, "randomBytes"); - // Section: 4.1.3: - // - time_hi_and_version[12:16] = 0b0100 - bytes[6] = (bytes[6] & 0x0f) | 0x40; - // Section 4.4 - // - clock_seq_hi_and_reserved[6] = 0b0 - // - clock_seq_hi_and_reserved[7] = 0b1 - bytes[8] = (bytes[8] & 0x3f) | 0x80; - const value = hexlify(bytes); - return [ - value.substring(2, 10), - value.substring(10, 14), - value.substring(14, 18), - value.substring(18, 22), - value.substring(22, 34), - ].join("-"); -} - -// @ts-ignore -class Ed448Goldilock { - static _channel = ed448; - static generatePrivateKey() { - var privateKey = ed448.privateKeyGenerate(); - privateKey[56] &= 0x7f; - return privateKey; - } - static getPublicKeyFromPrivateKey(privateKey) { - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var scalar = secret.slice(0, 56); - scalar[0] &= 0xfc; - scalar[55] |= 0x80; - var publicKey = this._channel.publicKeyFromScalar(scalar); - return Buffer.from(publicKey).toString("hex"); - } - else { - var publicKey = this._channel.publicKeyCreate(secret); - return Buffer.from(publicKey).toString("hex"); - } - } - static signWithPrivateKey(privateKey, msg) { - var msgToSign = Buffer.from(msg, "hex"); - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var prefix = secret.slice(0, 57); - prefix[0] &= 0xfc; - prefix[56] = 0; - prefix[55] |= 0x80; - var scalar = prefix.slice(0, 56); - var signedMessage = this._channel.signWithScalar(msgToSign, scalar, prefix); - return Buffer.from(signedMessage).toString("hex"); - } - else { - var signedMessage = this._channel.sign(msgToSign, secret); - return Buffer.from(signedMessage).toString("hex"); - } - } - static signWithPrivateKeyNConcatPubkey(privateKey, msg) { - var signedMessage = Ed448Goldilock.signWithPrivateKey(privateKey, msg); - var publicKey = Ed448Goldilock.getPublicKeyFromPrivateKey(privateKey); - return signedMessage + publicKey; - } - static verifySignature(msgHash, signedMsg, pubKey) { - return this._channel.verify(msgHash, signedMsg, pubKey); - } - static SHA512Hash(password, salt) { - var p1 = Buffer.from(password, "hex"); - var s1 = Buffer.from(salt, "hex"); - return Buffer.from(pbkdf2$2.derive(SHA3_512, p1, s1, 2048, 57)).toString("hex"); - } - static concatenateAndHex(prefix, key, index, salt) { - var ind = Buffer.alloc(4); - var p = Buffer.alloc(1); - p[0] = prefix % 256; - var j = index; - for (let i = 0; i < 4; i++) { - ind[i] = j % 256; - j = Math.floor(j / 256); - } - var t = p.toString("hex") + key + ind.toString("hex"); - return Ed448Goldilock.SHA512Hash(t, salt); - } - static addScalar(a, b) { - var a1 = Buffer.from(a, "hex"); - var b1 = Buffer.from(b.substr(0, 106) + "00000000", "hex"); - b1[0] &= 0xfc; - var c = Buffer.alloc(57); - var hold = 0; - for (let i = 0; i < 57; i++) { - hold += a1[i] + b1[i]; - c[i] = hold % 256; - hold = Math.floor(hold / 256); - } - return c.toString("hex"); - } - static seedToExtendedPrivate(seed) { - var s1 = Ed448Goldilock.SHA512Hash(seed, "6d6e656d6f6e6963666f72746865636861696e"); - var s2 = Ed448Goldilock.SHA512Hash(seed, "6d6e656d6f6e6963666f727468656b6579"); - var b = Buffer.from(s2, "hex"); - b[56] |= 0x80; - b[55] |= 0x80; - b[55] &= 0xbf; - var s3 = b.toString("hex"); - return s1 + s3; - } - static childPrivateToPrivate(s, index) { - var s0 = s.substr(0, 114); - var s1 = s.substr(114, 228); - var r0, r1; - if (index >= 0x80000000) { - r0 = Ed448Goldilock.concatenateAndHex(1, s1, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(0, s1, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } - else { - var pub = Ed448Goldilock.getPublicKeyFromPrivateKey(s1); - r0 = Ed448Goldilock.concatenateAndHex(3, pub, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(2, pub, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } - } - static HDWalletGenerateKeyFromSeed(seed, index) { - var m = Ed448Goldilock.seedToExtendedPrivate(seed); - var k1 = Ed448Goldilock.childPrivateToPrivate(m, 0x80000000 + 44); - var k2 = Ed448Goldilock.childPrivateToPrivate(k1, 0x80000000 + 654); - var k3 = Ed448Goldilock.childPrivateToPrivate(k2, 0x80000000 + 0); - var k4 = Ed448Goldilock.childPrivateToPrivate(k3, 0x80000000 + 0); - var k5 = Ed448Goldilock.childPrivateToPrivate(k4, index); - return k5.substr(114, 228); - } -} - -/* Browser Crypto Shims */ -function getGlobal$1() { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw new Error("unable to locate global object"); -} -const anyGlobal = getGlobal$1(); -const crypto = anyGlobal.crypto || anyGlobal.msCrypto; -function createHash(algo) { - switch (algo) { - case "sha256": - return sha256$1.create(); - case "sha512": - return sha512$1.create(); - case "sha3-256": - return sha3_256.create(); - case "sha3-512": - return sha3_512.create(); - } - assertArgument(false, "invalid hashing algorithm name", "algorithm", algo); -} -function createHmac(_algo, key) { - const algo = { sha256: sha256$1, sha512: sha512$1 }[_algo]; - assertArgument(algo != null, "invalid hmac algorithm", "algorithm", _algo); - return hmac.create(algo, key); -} -function pbkdf2Sync(password, salt, iterations, keylen, _algo) { - const algo = { sha256: sha256$1, sha512: sha512$1 }[_algo]; - assertArgument(algo != null, "invalid pbkdf2 algorithm", "algorithm", _algo); - return pbkdf2$1(algo, password, salt, { c: iterations, dkLen: keylen }); -} -function randomBytes$1(length) { - assert(crypto != null, "platform does not support secure random numbers", "UNSUPPORTED_OPERATION", { - operation: "randomBytes", - }); - assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, "invalid length", "length", length); - const result = new Uint8Array(length); - crypto.getRandomValues(result); - return result; -} - -const _sha256 = function (data) { - let v = "0x" + - createHash("sha3-256") - .update(Buffer$1.from(arrayify(data))) - .digest("hex"); - return v; -}; -const _sha512 = function (data) { - let v = "0x" + - createHash("sha3-512") - .update(Buffer$1.from(arrayify(data))) - .digest("hex"); - return v; -}; -let locked256 = false, locked512 = false; -/** - * Compute the cryptographic SHA2-256 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha256("0x") - * //_result: - * - * sha256("0x1337") - * //_result: - * - * sha256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ -var SupportedAlgorithm; -(function (SupportedAlgorithm) { - SupportedAlgorithm["sha256"] = "sha256"; - SupportedAlgorithm["sha512"] = "sha512"; -})(SupportedAlgorithm || (SupportedAlgorithm = {})); -function sha256(data) { - let createdHash = createHash("sha3-256") - .update(Buffer$1.from(arrayify(data))) - .digest("hex"); - const v = "0x" + createdHash; - if (typeof createdHash !== "string") { - createdHash = hexlify(createdHash); - return createdHash; - } - return v; -} -function legacySha256(data) { - const _data = getBytes(data, "data"); - const hexlified = hexlify(createHash("sha256").update(_data).digest()); - return hexlified; -} -sha256._ = _sha256; -sha256.lock = function () { - locked256 = true; -}; -sha256.register = function (func) { - if (locked256) { - throw new Error("sha256 is locked"); - } -}; -Object.freeze(sha256); -/** - * Compute the cryptographic SHA2-512 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha512("0x") - * //_result: - * - * sha512("0x1337") - * //_result: - * - * sha512(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - */ -function sha512(data) { - let createdHash = createHash("sha3-512") - .update(Buffer$1.from(arrayify(data))) - .digest("hex"); - const v = "0x" + createdHash; - if (typeof createdHash !== "string") { - createdHash = hexlify(createdHash); - return createdHash; - } - return v; -} -sha512._ = _sha512; -sha512.lock = function () { - locked512 = true; -}; -sha512.register = function (func) { - if (locked512) { - throw new Error("sha512 is locked"); - } -}; -Object.freeze(sha256); - -/** - * Addresses are a fundamental part of interacting with Core. They - * represent the gloabal identity of Externally Owned Accounts (accounts - * backed by a private key) and contracts. - * - * The Core Naming Service (CNS) provides an interconnected ecosystem - * of contracts, standards and libraries which enable looking up an - * address for an ENS name. - * - * These functions help convert between various formats, validate - * addresses and safely resolve ENS names. - * - * @_section: api/address:Addresses [about-addresses] - */ -const logger$3 = new Logger("address/0.0.1"); -const precompiledAddresses = [ - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000001", - "0000000000000000000000000000000000000000000000000000000000000002", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000005", - "0000000000000000000000000000000000000000000000000000000000000006", - "0000000000000000000000000000000000000000000000000000000000000007", - "0000000000000000000000000000000000000000000000000000000000000008", - "0000000000000000000000000000000000000000000000000000000000000009", -]; -function removeHexPrefix$1(val) { - return val.substring(0, 2) === "0x" ? val.substring(2) : val; -} -function calculateCheckSum(_address, _prefix) { - const address = getBytes("0x" + _address.replace("0x", "")); - const prefix = getBytes("0x" + _prefix.replace("0x", "")); - const tmpConcated = new Uint8Array([...address, ...prefix]); - const hexedConcat = hexlify(tmpConcated).replace("0x", "") + "00"; - const mods = Array.from(hexedConcat.toUpperCase(), (c) => { - const charCode = c.charCodeAt(0); - return charCode > 64 && charCode < 91 - ? (charCode - 55).toString() - : (charCode - 48).toString(); - }).join(""); - const bigVal = BigInt(mods); - const val97 = BigInt(97); - const val98 = BigInt(98); - const remainder = bigVal % val97; - const checkSum = val98 - remainder; - const result = checkSum > 9 ? checkSum.toString() : "0" + checkSum.toString(); - return result; -} -/** - * Returns a normalized and checksumed address for %%address%%. - * This accepts non-checksum addresses, checksum addresses and - * [[getIcapAddress]] formats. - * - * The checksum in Core uses the capitalization (upper-case - * vs lower-case) of the characters within an address to encode - * its checksum, which offers, on average, a checksum of 15-bits. - * - * If %%address%% contains both upper-case and lower-case, it is - * assumed to already be a checksum address and its checksum is - * validated, and if the address fails its expected checksum an - * error is thrown. - * - * If you wish the checksum of %%address%% to be ignore, it should - * be converted to lower-case (i.e. ``.toLowercase()``) before - * being passed in. This should be a very rare situation though, - * that you wish to bypass the safegaurds in place to protect - * against an address that has been incorrectly copied from another - * source. - * - * @example: - * // Adds the checksum (via upper-casing specific letters) - * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") - * //_result: - * - * // Converts ICAP address and adds checksum - * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); - * //_result: - * - * // Throws an error if an address contains mixed case, - * // but the checksum fails - * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") - * //_error: - */ -function getAddress(address) { - if (typeof address !== "string") { - logger$3.throwArgumentError("invalid address", "address", address); - } - if (!address.match(/^(0x)?[0-9a-fA-F]{44}$/)) { - logger$3.throwArgumentError("invalid address", "address", address); - } - const raw = removeHexPrefix$1(address); - if (precompiledAddresses.includes(raw)) { - return "0x" + raw; - } - const prefix = raw.substring(0, 2); - const val = raw.substring(4); - const checksum = calculateCheckSum(val, prefix); - if (checksum !== raw.substring(2, 4)) { - logger$3.throwArgumentError("bad address checksum", "address", address); - } - return "0x" + prefix + checksum + val; -} -function networkIdToPrefix(networkId) { - if (networkId == 1) { - return "cb"; - } - else if (networkId == 3 || networkId == 4) { - return "ab"; - } - else if (networkId > 10 || networkId == 0) { - return "ce"; - } - else { - logger$3.throwArgumentError("bad networkId", "networkId", networkId); - return ""; - } -} - -/** - * An **HMAC** enables verification that a given key was used - * to authenticate a payload. - * - * See: [[link-wiki-hmac]] - * - * @_subsection: api/crypto:HMAC [about-hmac] - */ -let locked$4 = false; -const _computeHmac = function (algorithm, key, data) { - return createHmac(algorithm, key).update(data).digest(); -}; -let __computeHmac = _computeHmac; -/** - * Return the HMAC for %%data%% using the %%key%% key with the underlying - * %%algo%% used for compression. - * - * @example: - * key = id("some-secret") - * - * // Compute the HMAC - * computeHmac("sha256", key, "0x1337") - * //_result: - * - * // To compute the HMAC of UTF-8 data, the data must be - * // converted to UTF-8 bytes - * computeHmac("sha256", key, toUtf8Bytes("Hello World")) - * //_result: - * - */ -function computeHmac(algorithm, _key, _data) { - const key = getBytes(_key, "key"); - const data = getBytes(_data, "data"); - return hexlify(__computeHmac(algorithm, key, data)); -} -computeHmac._ = _computeHmac; -computeHmac.lock = function () { - locked$4 = true; -}; -computeHmac.register = function (func) { - if (locked$4) { - throw new Error("computeHmac is locked"); - } - __computeHmac = func; -}; -Object.freeze(computeHmac); - -// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html -// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf -const Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]); -const Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i); -const Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16); -let idxL = [Id]; -let idxR = [Pi]; -for (let i = 0; i < 4; i++) - for (let j of [idxL, idxR]) - j.push(j[i].map((k) => Rho[k])); -const shifts = /* @__PURE__ */ [ - [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8], - [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7], - [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9], - [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6], - [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5], -].map((i) => new Uint8Array(i)); -const shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j])); -const shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j])); -const Kl = /* @__PURE__ */ new Uint32Array([ - 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e, -]); -const Kr = /* @__PURE__ */ new Uint32Array([ - 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000, -]); -// The rotate left (circular left shift) operation for uint32 -const rotl$1 = (word, shift) => (word << shift) | (word >>> (32 - shift)); -// It's called f() in spec. -function f(group, x, y, z) { - if (group === 0) - return x ^ y ^ z; - else if (group === 1) - return (x & y) | (~x & z); - else if (group === 2) - return (x | ~y) ^ z; - else if (group === 3) - return (x & z) | (y & ~z); - else - return x ^ (y | ~z); -} -// Temporary buffer, not used to store anything between runs -const BUF = /* @__PURE__ */ new Uint32Array(16); -class RIPEMD160 extends SHA2 { - constructor() { - super(64, 20, 8, true); - this.h0 = 0x67452301 | 0; - this.h1 = 0xefcdab89 | 0; - this.h2 = 0x98badcfe | 0; - this.h3 = 0x10325476 | 0; - this.h4 = 0xc3d2e1f0 | 0; - } - get() { - const { h0, h1, h2, h3, h4 } = this; - return [h0, h1, h2, h3, h4]; - } - set(h0, h1, h2, h3, h4) { - this.h0 = h0 | 0; - this.h1 = h1 | 0; - this.h2 = h2 | 0; - this.h3 = h3 | 0; - this.h4 = h4 | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - BUF[i] = view.getUint32(offset, true); - // prettier-ignore - let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el; - // Instead of iterating 0 to 80, we split it into 5 groups - // And use the groups in constants, functions, etc. Much simpler - for (let group = 0; group < 5; group++) { - const rGroup = 4 - group; - const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore - const rl = idxL[group], rr = idxR[group]; // prettier-ignore - const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore - for (let i = 0; i < 16; i++) { - const tl = (rotl$1(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0; - al = el, el = dl, dl = rotl$1(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore - } - // 2 loops are 10% faster - for (let i = 0; i < 16; i++) { - const tr = (rotl$1(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0; - ar = er, er = dr, dr = rotl$1(cr, 10) | 0, cr = br, br = tr; // prettier-ignore - } - } - // Add the compressed chunk to the current hash value - this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0); - } - roundClean() { - BUF.fill(0); - } - destroy() { - this.destroyed = true; - this.buffer.fill(0); - this.set(0, 0, 0, 0, 0); - } -} -/** - * RIPEMD-160 - a hash function from 1990s. - * @param message - msg that would be hashed - */ -const ripemd160$1 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160()); - -let locked$3 = false; -const _ripemd160 = function (data) { - return ripemd160$1(data); -}; -let __ripemd160 = _ripemd160; -/** - * Compute the cryptographic RIPEMD-160 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * ripemd160("0x") - * //_result: - * - * ripemd160("0x1337") - * //_result: - * - * ripemd160(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ -function ripemd160(_data) { - const data = getBytes(_data, "data"); - return hexlify(__ripemd160(data)); -} -ripemd160._ = _ripemd160; -ripemd160.lock = function () { - locked$3 = true; -}; -ripemd160.register = function (func) { - if (locked$3) { - throw new TypeError("ripemd160 is locked"); - } - __ripemd160 = func; -}; -Object.freeze(ripemd160); - -/** - * A **Password-Based Key-Derivation Function** is designed to create - * a sequence of bytes suitible as a **key** from a human-rememberable - * password. - * - * @_subsection: api/crypto:Passwords [about-pbkdf] - */ -let locked$2 = false; -const _pbkdf2 = function (password, salt, iterations, keylen, algo) { - return pbkdf2Sync(password, salt, iterations, keylen, algo); -}; -let __pbkdf2 = _pbkdf2; -/** - * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using - * the %%salt%% and using %%iterations%% of %%algo%%. - * - * This PBKDF is outdated and should not be used in new projects, but is - * required to decrypt older files. - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the PBKDF2 - * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") - * //_result: - */ -function pbkdf2(_password, _salt, iterations, keylen, algo) { - const password = getBytes(_password, "password"); - const salt = getBytes(_salt, "salt"); - return hexlify(__pbkdf2(password, salt, iterations, keylen, algo)); -} -pbkdf2._ = _pbkdf2; -pbkdf2.lock = function () { - locked$2 = true; -}; -pbkdf2.register = function (func) { - if (locked$2) { - throw new Error("pbkdf2 is locked"); - } - __pbkdf2 = func; -}; -Object.freeze(pbkdf2); - -/** - * A **Cryptographically Secure Random Value** is one that has been - * generated with additional care take to prevent side-channels - * from allowing others to detect it and prevent others from through - * coincidence generate the same values. - * - * @_subsection: api/crypto:Random Values [about-crypto-random] - */ -let locked$1 = false; -const _randomBytes = function (length) { - return new Uint8Array(randomBytes$1(length)); -}; -let __randomBytes = _randomBytes; -/** - * Return %%length%% bytes of cryptographically secure random data. - * - * @example: - * randomBytes(8) - * //_result: - */ -function randomBytes(length) { - return __randomBytes(length); -} -randomBytes._ = _randomBytes; -randomBytes.lock = function () { - locked$1 = true; -}; -randomBytes.register = function (func) { - if (locked$1) { - throw new Error("randomBytes is locked"); - } - __randomBytes = func; -}; -Object.freeze(randomBytes); - -// RFC 7914 Scrypt KDF -// Left rotate for uint32 -const rotl = (a, b) => (a << b) | (a >>> (32 - b)); -// The main Scrypt loop: uses Salsa extensively. -// Six versions of the function were tried, this is the fastest one. -// prettier-ignore -function XorAndSalsa(prev, pi, input, ii, out, oi) { - // Based on https://cr.yp.to/salsa20.html - // Xor blocks - let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++]; - let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++]; - let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++]; - let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++]; - let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++]; - let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++]; - let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++]; - let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++]; - // Save state to temporary variables (salsa) - let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15; - // Main loop (salsa) - for (let i = 0; i < 8; i += 2) { - x04 ^= rotl(x00 + x12 | 0, 7); - x08 ^= rotl(x04 + x00 | 0, 9); - x12 ^= rotl(x08 + x04 | 0, 13); - x00 ^= rotl(x12 + x08 | 0, 18); - x09 ^= rotl(x05 + x01 | 0, 7); - x13 ^= rotl(x09 + x05 | 0, 9); - x01 ^= rotl(x13 + x09 | 0, 13); - x05 ^= rotl(x01 + x13 | 0, 18); - x14 ^= rotl(x10 + x06 | 0, 7); - x02 ^= rotl(x14 + x10 | 0, 9); - x06 ^= rotl(x02 + x14 | 0, 13); - x10 ^= rotl(x06 + x02 | 0, 18); - x03 ^= rotl(x15 + x11 | 0, 7); - x07 ^= rotl(x03 + x15 | 0, 9); - x11 ^= rotl(x07 + x03 | 0, 13); - x15 ^= rotl(x11 + x07 | 0, 18); - x01 ^= rotl(x00 + x03 | 0, 7); - x02 ^= rotl(x01 + x00 | 0, 9); - x03 ^= rotl(x02 + x01 | 0, 13); - x00 ^= rotl(x03 + x02 | 0, 18); - x06 ^= rotl(x05 + x04 | 0, 7); - x07 ^= rotl(x06 + x05 | 0, 9); - x04 ^= rotl(x07 + x06 | 0, 13); - x05 ^= rotl(x04 + x07 | 0, 18); - x11 ^= rotl(x10 + x09 | 0, 7); - x08 ^= rotl(x11 + x10 | 0, 9); - x09 ^= rotl(x08 + x11 | 0, 13); - x10 ^= rotl(x09 + x08 | 0, 18); - x12 ^= rotl(x15 + x14 | 0, 7); - x13 ^= rotl(x12 + x15 | 0, 9); - x14 ^= rotl(x13 + x12 | 0, 13); - x15 ^= rotl(x14 + x13 | 0, 18); - } - // Write output (salsa) - out[oi++] = (y00 + x00) | 0; - out[oi++] = (y01 + x01) | 0; - out[oi++] = (y02 + x02) | 0; - out[oi++] = (y03 + x03) | 0; - out[oi++] = (y04 + x04) | 0; - out[oi++] = (y05 + x05) | 0; - out[oi++] = (y06 + x06) | 0; - out[oi++] = (y07 + x07) | 0; - out[oi++] = (y08 + x08) | 0; - out[oi++] = (y09 + x09) | 0; - out[oi++] = (y10 + x10) | 0; - out[oi++] = (y11 + x11) | 0; - out[oi++] = (y12 + x12) | 0; - out[oi++] = (y13 + x13) | 0; - out[oi++] = (y14 + x14) | 0; - out[oi++] = (y15 + x15) | 0; -} -function BlockMix(input, ii, out, oi, r) { - // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks) - let head = oi + 0; - let tail = oi + 16 * r; - for (let i = 0; i < 16; i++) - out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1] - for (let i = 0; i < r; i++, head += 16, ii += 16) { - // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1 - XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1]) - if (i > 0) - tail += 16; // First iteration overwrites tmp value in tail - XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i]) - } -} -// Common prologue and epilogue for sync/async functions -function scryptInit(password, salt, _opts) { - // Maxmem - 1GB+1KB by default - const opts = checkOpts({ - dkLen: 32, - asyncTick: 10, - maxmem: 1024 ** 3 + 1024, - }, _opts); - const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts; - number(N); - number(r); - number(p); - number(dkLen); - number(asyncTick); - number(maxmem); - if (onProgress !== undefined && typeof onProgress !== 'function') - throw new Error('progressCb should be function'); - const blockSize = 128 * r; - const blockSize32 = blockSize / 4; - if (N <= 1 || (N & (N - 1)) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) { - // NOTE: we limit N to be less than 2**32 because of 32 bit variant of Integrify function - // There is no JS engines that allows alocate more than 4GB per single Uint8Array for now, but can change in future. - throw new Error('Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32'); - } - if (p < 0 || p > ((2 ** 32 - 1) * 32) / blockSize) { - throw new Error('Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)'); - } - if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) { - throw new Error('Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32'); - } - const memUsed = blockSize * (N + p); - if (memUsed > maxmem) { - throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`); - } - // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor) - // Since it has only one iteration there is no reason to use async variant - const B = pbkdf2$1(sha256$1, password, salt, { c: 1, dkLen: blockSize * p }); - const B32 = u32(B); - // Re-used between parallel iterations. Array(iterations) of B - const V = u32(new Uint8Array(blockSize * N)); - const tmp = u32(new Uint8Array(blockSize)); - let blockMixCb = () => { }; - if (onProgress) { - const totalBlockMix = 2 * N * p; - // Invoke callback if progress changes from 10.01 to 10.02 - // Allows to draw smooth progress bar on up to 8K screen - const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1); - let blockMixCnt = 0; - blockMixCb = () => { - blockMixCnt++; - if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix)) - onProgress(blockMixCnt / totalBlockMix); - }; - } - return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick }; -} -function scryptOutput(password, dkLen, B, V, tmp) { - const res = pbkdf2$1(sha256$1, password, B, { c: 1, dkLen }); - B.fill(0); - V.fill(0); - tmp.fill(0); - return res; -} -/** - * Scrypt KDF from RFC 7914. - * @param password - pass - * @param salt - salt - * @param opts - parameters - * - `N` is cpu/mem work factor (power of 2 e.g. 2**18) - * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance - * - `p` is parallelization factor (1 is common) - * - `dkLen` is output key length in bytes e.g. 32. - * - `asyncTick` - (default: 10) max time in ms for which async function can block execution - * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt - * - `onProgress` - callback function that would be executed for progress report - * @returns Derived key - */ -function scrypt$1(password, salt, opts) { - const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts); - for (let pi = 0; pi < p; pi++) { - const Pi = blockSize32 * pi; - for (let i = 0; i < blockSize32; i++) - V[i] = B32[Pi + i]; // V[0] = B[i] - for (let i = 0, pos = 0; i < N - 1; i++) { - BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); - blockMixCb(); - } - BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element - blockMixCb(); - for (let i = 0; i < N; i++) { - // First u32 of the last 64-byte block (u32 is LE) - const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations - for (let k = 0; k < blockSize32; k++) - tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j] - BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) - blockMixCb(); - } - } - return scryptOutput(password, dkLen, B, V, tmp); -} -/** - * Scrypt KDF from RFC 7914. - */ -async function scryptAsync(password, salt, opts) { - const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts); - for (let pi = 0; pi < p; pi++) { - const Pi = blockSize32 * pi; - for (let i = 0; i < blockSize32; i++) - V[i] = B32[Pi + i]; // V[0] = B[i] - let pos = 0; - await asyncLoop(N - 1, asyncTick, () => { - BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); - blockMixCb(); - }); - BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element - blockMixCb(); - await asyncLoop(N, asyncTick, () => { - // First u32 of the last 64-byte block (u32 is LE) - const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations - for (let k = 0; k < blockSize32; k++) - tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j] - BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) - blockMixCb(); - }); - } - return scryptOutput(password, dkLen, B, V, tmp); -} - -let lockedSync = false, lockedAsync = false; -const _scryptAsync = async function (passwd, salt, N, r, p, dkLen, onProgress) { - return await scryptAsync(passwd, salt, { N, r, p, dkLen, onProgress }); -}; -const _scryptSync = function (passwd, salt, N, r, p, dkLen) { - return scrypt$1(passwd, salt, { N, r, p, dkLen }); -}; -let __scryptAsync = _scryptAsync; -let __scryptSync = _scryptSync; -/** - * The [[link-wiki-scrypt]] uses a memory and cpu hard method of - * derivation to increase the resource cost to brute-force a password - * for a given key. - * - * This means this algorithm is intentionally slow, and can be tuned to - * become slower. As computation and memory speed improve over time, - * increasing the difficulty maintains the cost of an attacker. - * - * For example, if a target time of 5 seconds is used, a legitimate user - * which knows their password requires only 5 seconds to unlock their - * account. A 6 character password has 68 billion possibilities, which - * would require an attacker to invest over 10,000 years of CPU time. This - * is of course a crude example (as password generally aren't random), - * but demonstrates to value of imposing large costs to decryption. - * - * For this reason, if building a UI which involved decrypting or - * encrypting datsa using scrypt, it is recommended to use a - * [[ProgressCallback]] (as event short periods can seem lik an eternity - * if the UI freezes). Including the phrase //"decrypting"// in the UI - * can also help, assuring the user their waiting is for a good reason. - * - * @_docloc: api/crypto:Passwords - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the scrypt - * scrypt(passwordBytes, salt, 1024, 8, 1, 16) - * //_result: - */ -async function scrypt(_passwd, _salt, N, r, p, dkLen, progress) { - const passwd = getBytes(_passwd, "passwd"); - const salt = getBytes(_salt, "salt"); - return hexlify(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress)); -} -scrypt._ = _scryptAsync; -scrypt.lock = function () { - lockedAsync = true; -}; -scrypt.register = function (func) { - if (lockedAsync) { - throw new Error("scrypt is locked"); - } - __scryptAsync = func; -}; -Object.freeze(scrypt); -/** - * Provides a synchronous variant of [[scrypt]]. - * - * This will completely lock up and freeze the UI in a browser and will - * prevent any event loop from progressing. For this reason, it is - * preferred to use the [async variant](scrypt). - * - * @_docloc: api/crypto:Passwords - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the scrypt - * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) - * //_result: - */ -function scryptSync(_passwd, _salt, N, r, p, dkLen) { - const passwd = getBytes(_passwd, "passwd"); - const salt = getBytes(_salt, "salt"); - return hexlify(__scryptSync(passwd, salt, N, r, p, dkLen)); -} -scryptSync._ = _scryptSync; -scryptSync.lock = function () { - lockedSync = true; -}; -scryptSync.register = function (func) { - if (lockedSync) { - throw new Error("scryptSync is locked"); - } - __scryptSync = func; -}; -Object.freeze(scryptSync); - -/** - * Cryptographic hashing functions - * - * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] - */ -let locked = false; -const _keccak256 = function (data) { - return keccak_256(data); -}; -let __keccak256 = _keccak256; -/** - * Compute the cryptographic KECCAK256 hash of %%data%%. - * - * The %%data%% **must** be a data representation, to compute the - * hash of UTF-8 data use the [[id]] function. - * - * @returns DataHexstring - * @example: - * keccak256("0x") - * //_result: - * - * keccak256("0x1337") - * //_result: - * - * keccak256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - * // Strings are assumed to be DataHexString, otherwise it will - * // throw. To hash UTF-8 data, see the note above. - * keccak256("Hello World") - * //_error: - */ -function keccak256(_data) { - const data = getBytes(_data, "data"); - return hexlify(__keccak256(data)); -} -keccak256._ = _keccak256; -keccak256.lock = function () { - locked = true; -}; -keccak256.register = function (func) { - if (locked) { - throw new TypeError("keccak256 is locked"); - } - __keccak256 = func; -}; -Object.freeze(keccak256); - -/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */ -const B256 = 2n ** 256n; // secp256k1 is short weierstrass curve -const P = B256 - 0x1000003d1n; // curve's field prime -const N$1 = B256 - 0x14551231950b75fc4402da1732fc9bebfn; // curve (group) order -const Gx = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n; // base point x -const Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n; // base point y -const CURVE = { p: P, n: N$1, a: 0n, b: 7n, Gx, Gy }; // exported variables incl. a, b -const fLen = 32; // field / group byte length -const crv = (x) => mod(mod(x * x) * x + CURVE.b); // x³ + ax + b weierstrass formula; no a -const err = (m = '') => { throw new Error(m); }; // error helper, messes-up stack trace -const big = (n) => typeof n === 'bigint'; // is big integer -const str = (s) => typeof s === 'string'; // is string -const fe = (n) => big(n) && 0n < n && n < P; // is field element (invertible) -const ge = (n) => big(n) && 0n < n && n < N$1; // is group element -const au8 = (a, l) => // is Uint8Array (of specific length) - !(a instanceof Uint8Array) || (typeof l === 'number' && l > 0 && a.length !== l) ? - err('Uint8Array expected') : a; -const u8n = (data) => new Uint8Array(data); // creates Uint8Array -const toU8 = (a, len) => au8(str(a) ? h2b(a) : u8n(a), len); // norm(hex/u8a) to u8a -const mod = (a, b = P) => { let r = a % b; return r >= 0n ? r : b + r; }; // mod division -const isPoint = (p) => (p instanceof Point ? p : err('Point expected')); // is 3d point -let Gpows = undefined; // precomputes for base point G -class Point { - constructor(px, py, pz) { - this.px = px; - this.py = py; - this.pz = pz; - } //3d=less inversions - static fromAffine(p) { return new Point(p.x, p.y, 1n); } - static fromHex(hex) { - hex = toU8(hex); // convert hex string to Uint8Array - let p = undefined; - const head = hex[0], tail = hex.subarray(1); // first byte is prefix, rest is data - const x = slcNum(tail, 0, fLen), len = hex.length; // next 32 bytes are x coordinate - if (len === 33 && [0x02, 0x03].includes(head)) { // compressed points: 33b, start - if (!fe(x)) - err('Point hex invalid: x not FE'); // with byte 0x02 or 0x03. Check if 0 0n; d = d.double(), n >>= 1n) { // double-and-add ladder - if (n & 1n) - p = p.add(d); // if bit is present, add to point - else if (safe) - f = f.add(d); // if not, add to fake for timing safety - } - return p; - } - mulAddQUns(R, u1, u2) { - return this.mul(u1, false).add(R.mul(u2, false)).ok(); // Unsafe: do NOT use for stuff related - } // to private keys. Doesn't use Shamir trick - toAffine() { - const { px: x, py: y, pz: z } = this; // (x, y, z) ∋ (x=x/z, y=y/z) - if (this.equals(I)) - return { x: 0n, y: 0n }; // fast-path for zero point - if (z === 1n) - return { x, y }; // if z is 1, pass affine coordinates as-is - const iz = inv(z); // z^-1: invert z - if (mod(z * iz) !== 1n) - err('invalid inverse'); // (z * z^-1) must be 1, otherwise bad math - return { x: mod(x * iz), y: mod(y * iz) }; // x = x*z^-1; y = y*z^-1 - } - assertValidity() { - const { x, y } = this.aff(); // convert to 2d xy affine point. - if (!fe(x) || !fe(y)) - err('Point invalid: x or y'); // x and y must be in range 0 < n < P - return mod(y * y) === crv(x) ? // y² = x³ + ax + b, must be equal - this : err('Point invalid: not on curve'); - } - multiply(n) { return this.mul(n); } // Aliases to compress code - aff() { return this.toAffine(); } - ok() { return this.assertValidity(); } - toHex(isCompressed = true) { - const { x, y } = this.aff(); // convert to 2d xy affine point - const head = isCompressed ? ((y & 1n) === 0n ? '02' : '03') : '04'; // 0x02, 0x03, 0x04 prefix - return head + n2h(x) + (isCompressed ? '' : n2h(y)); // prefix||x and ||y - } - toRawBytes(isCompressed = true) { - return h2b(this.toHex(isCompressed)); // re-use toHex(), convert hex to bytes - } -} -Point.BASE = new Point(Gx, Gy, 1n); // Generator / base point -Point.ZERO = new Point(0n, 1n, 0n); // Identity / zero point -const { BASE: G, ZERO: I } = Point; // Generator, identity points -const padh = (n, pad) => n.toString(16).padStart(pad, '0'); -const b2h = (b) => Array.from(b).map(e => padh(e, 2)).join(''); // bytes to hex -const h2b = (hex) => { - const l = hex.length; // error if not string, - if (!str(hex) || l % 2) - err('hex invalid 1'); // or has odd length like 3, 5. - const arr = u8n(l / 2); // create result array - for (let i = 0; i < arr.length; i++) { - const j = i * 2; - const h = hex.slice(j, j + 2); // hexByte. slice is faster than substr - const b = Number.parseInt(h, 16); // byte, created from string part - if (Number.isNaN(b) || b < 0) - err('hex invalid 2'); // byte must be valid 0 <= byte < 256 - arr[i] = b; - } - return arr; -}; -const b2n = (b) => BigInt('0x' + (b2h(b) || '0')); // bytes to number -const slcNum = (b, from, to) => b2n(b.slice(from, to)); // slice bytes num -const n2b = (num) => { - return big(num) && num >= 0n && num < B256 ? h2b(padh(num, 2 * fLen)) : err('bigint expected'); -}; -const n2h = (num) => b2h(n2b(num)); // number to 32b hex -const inv = (num, md = P) => { - if (num === 0n || md <= 0n) - err('no inverse n=' + num + ' mod=' + md); // no neg exponent for now - let a = mod(num, md), b = md, x = 0n, u = 1n; - while (a !== 0n) { // uses euclidean gcd algorithm - const q = b / a, r = b % a; // not constant-time - const m = x - u * q; - b = a, a = r, x = u, u = m; - } - return b === 1n ? mod(x, md) : err('no inverse'); // b is gcd at this point -}; -const sqrt = (n) => { - let r = 1n; // So, a special, fast case. Paper: "Square Roots from 1;24,51,10 to Dan Shanks". - for (let num = n, e = (P + 1n) / 4n; e > 0n; e >>= 1n) { // powMod: modular exponentiation. - if (e & 1n) - r = (r * num) % P; // Uses exponentiation by squaring. - num = (num * num) % P; // Not constant-time. - } - return mod(r * r) === n ? r : err('sqrt invalid'); // check if result is valid -}; -const toPriv = (p) => { - if (!big(p)) - p = b2n(toU8(p, fLen)); // convert to bigint when bytes - return ge(p) ? p : err('private key out of range'); // check if bigint is in range -}; -function getSharedSecret(privA, pubB, isCompressed = true) { - return Point.fromHex(pubB).mul(toPriv(privA)).toRawBytes(isCompressed); // ECDH -} -const W = 8; // Precomputes-related code. W = window size -const precompute = () => { - const points = []; // 10x sign(), 2x verify(). To achieve this, - const windows = 256 / W + 1; // app needs to spend 40ms+ to calculate - let p = G, b = p; // a lot of points related to base point G. - for (let w = 0; w < windows; w++) { // Points are stored in array and used - b = p; // any time Gx multiplication is done. - points.push(b); // They consume 16-32 MiB of RAM. - for (let i = 1; i < 2 ** (W - 1); i++) { - b = b.add(p); - points.push(b); - } - p = b.double(); // Precomputes don't speed-up getSharedKey, - } // which multiplies user point by scalar, - return points; // when precomputes are using base point -}; -const wNAF = (n) => { - // Compared to other point mult methods, - const comp = Gpows || (Gpows = precompute()); // stores 2x less points using subtraction - const neg = (cnd, p) => { let n = p.negate(); return cnd ? n : p; }; // negate - let p = I, f = G; // f must be G, or could become I in the end - const windows = 1 + 256 / W; // W=8 17 windows - const wsize = 2 ** (W - 1); // W=8 128 window size - const mask = BigInt(2 ** W - 1); // W=8 will create mask 0b11111111 - const maxNum = 2 ** W; // W=8 256 - const shiftBy = BigInt(W); // W=8 8 - for (let w = 0; w < windows; w++) { - const off = w * wsize; - let wbits = Number(n & mask); // extract W bits. - n >>= shiftBy; // shift number by W bits. - if (wbits > wsize) { - wbits -= maxNum; - n += 1n; - } // split if bits > max: +224 => 256-32 - const off1 = off, off2 = off + Math.abs(wbits) - 1; // offsets, evaluate both - const cnd1 = w % 2 !== 0, cnd2 = wbits < 0; // conditions, evaluate both - if (wbits === 0) { - f = f.add(neg(cnd1, comp[off1])); // bits are 0: add garbage to fake point - } - else { // ^ can't add off2, off2 = I - p = p.add(neg(cnd2, comp[off2])); // bits are 1: add to result point - } - } - return { p, f }; // return both real and fake points for JIT -}; // !! you can disable precomputes by commenting-out call of the wNAF() inside Point#mul() - -/** - * Add details about signing here. - * - * @_subsection: api/crypto:Signing [about-signing] - */ -const logger$2 = new Logger("signing-key/0.0.1"); -//const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); -// Make noble-secp256k1 sync -/** - * A **SigningKey** provides high-level access to the elliptic curve - * cryptography (ECC) operations and key management. - */ -class SigningKey { - #privateKey; - /** - * Creates a new **SigningKey** for %%privateKey%%. - */ - constructor(privateKey) { - let tmp = privateKey; - if (typeof tmp === "string" && tmp.startsWith("0x")) { - tmp = tmp.replace("0x", ""); - } - assertArgument(dataLength("0x" + tmp) === 57, "invalid private key", "privateKey", "[REDACTED]"); - this.#privateKey = hexlify("0x" + tmp); - } - /** - * The private key. - */ - get privateKey() { - return this.#privateKey; - } - /** - * The uncompressed public key. - * - * This will always begin with the prefix ``0x04`` and be 132 - * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). - */ - get publicKey() { - return SigningKey.computePublicKey(this.#privateKey); - } - /** - * The compressed public key. - * - * This will always begin with either the prefix ``0x02`` or ``0x03`` - * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal - * nibbles) - */ - get compressedPublicKey() { - return SigningKey.computePublicKey(this.#privateKey, true); - } - /** - * Return the signature of the signed %%digest%%. - */ - sign(digest) { - const key = getBytesCopy(this.#privateKey); - assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); - const keyBuffer = new Uint8Array(arrayify(key)); - if (keyBuffer.length !== 57) { - logger$2.throwArgumentError("invalid private key", "key", "[REDACTED]"); - } - const digestBuffer = new Uint8Array(arrayify(digest)); - if (digestBuffer.length !== 32) { - logger$2.throwArgumentError("bad digest length", "digest", digest); - } - if (keyBuffer[56] > 127) { - const prefix = keyBuffer.slice(0, 57); - prefix[0] &= 0xfc; - prefix[55] |= 0x80; - prefix[56] = 0; - const scalar = prefix.slice(0, 56); - const bufferDigest = Buffer$1.from(digestBuffer); - const bufferPrfx = Buffer$1.from(prefix); - const bufferScalar = Buffer$1.from(scalar); - const sig = ed448.signWithScalar(bufferDigest, bufferScalar, bufferPrfx); - const hexlified = hexlify(sig); - return hexConcat([hexlified, this.publicKey]); - } - const sig = ed448.sign(Buffer$1.from(digestBuffer), Buffer$1.from(keyBuffer)); - const hexlified = hexlify(sig); - return hexConcat([hexlified, this.publicKey]); - } - /** - * Returns the [[link-wiki-ecdh]] shared secret between this - * private key and the %%other%% key. - * - * The %%other%% key may be any type of key, a raw public key, - * a compressed/uncompressed pubic key or aprivate key. - * - * Best practice is usually to use a cryptographic hash on the - * returned value before using it as a symetric secret. - * - * @example: - * sign1 = new SigningKey(id("some-secret-1")) - * sign2 = new SigningKey(id("some-secret-2")) - * - * // Notice that privA.computeSharedSecret(pubB)... - * sign1.computeSharedSecret(sign2.publicKey) - * //_result: - * - * // ...is equal to privB.computeSharedSecret(pubA). - * sign2.computeSharedSecret(sign1.publicKey) - * //_result: - */ - computeSharedSecret(other) { - const pubKey = SigningKey.computePublicKey(other); - return hexlify(getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey))); - } - /** - * Compute the public key for %%key%%, optionally %%compressed%%. - * - * The %%key%% may be any type of key, a raw public key, a - * compressed/uncompressed public key or private key. - * - * @example: - * sign = new SigningKey(id("some-secret")); - * - * // Compute the uncompressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey) - * //_result: - * - * // Compute the compressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey, true) - * //_result: - * - * // Compute the uncompressed public key - * SigningKey.computePublicKey(sign.publicKey, false); - * //_result: - * - * // Compute the Compressed a public key - * SigningKey.computePublicKey(sign.publicKey, true); - * //_result: - */ - static computePublicKey(key, compressed) { - const bytes = Buffer$1.from(arrayify(key)); - if (bytes.length !== 57) { - logger$2.throwArgumentError("invalid private key", "key", "[REDACTED]"); - } - if (bytes[56] > 127) { - const scalar = bytes.slice(0, 56); - scalar[0] &= 0xfc; - scalar[55] |= 0x80; - const pub = ed448.publicKeyFromScalar(scalar); - return hexlify(pub); - } - const pub = ed448.publicKeyCreate(bytes); - return hexlify(pub); - } - /** - * Returns the public key for the private key which produced the - * %%signature%% for the given %%digest%%. - * - * @example: - * key = new SigningKey(id("some-secret")) - * digest = id("hello world") - * sig = key.sign(digest) - * - * // Notice the signer public key... - * key.publicKey - * //_result: - * - * // ...is equal to the recovered public key - * SigningKey.recoverPublicKey(digest, sig) - * //_result: - * - */ - static recoverPublicKey(digest, signature) { - assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); - const digestBuffer = Buffer$1.from(arrayify(digest)); - const sigBuffer = Buffer$1.from(arrayify(signature)); - if (sigBuffer.length !== 171) { - logger$2.throwArgumentError("invalid signature", "signature", signature); - } - const sig = sigBuffer.slice(0, 114); - const pub = sigBuffer.slice(114); - if (ed448.verify(digestBuffer, sig, pub)) { - return hexlify(pub); - } - logger$2.throwArgumentError("invalid signature", "signature", signature); - return ""; - } - /** - * Returns the point resulting from adding the ellipic curve points - * %%p0%% and %%p1%%. - * - * This is not a common function most developers should require, but - * can be useful for certain privacy-specific techniques. - * - * For example, it is used by [[HDNodeWallet]] to compute child - * addresses from parent public keys and chain codes. - */ - static addPoints(p0, p1, compressed) { - const pub0 = Point.fromHex(SigningKey.computePublicKey(p0).substring(2)); - const pub1 = Point.fromHex(SigningKey.computePublicKey(p1).substring(2)); - return "0x" + pub0.add(pub1).toHex(!!compressed); - } -} - -// Constants -const BN_0$6 = BigInt(0); -const BN_1$3 = BigInt(1); -const BN_2$1 = BigInt(2); -const BN_27 = BigInt(27); -const BN_28 = BigInt(28); -const BN_35 = BigInt(35); -const _guard$4 = {}; -/** - * A Signature @TODO - * - * - * @_docloc: api/crypto:Signing - */ -class Signature { - #r; - #s; - #v; - #networkV; - /** - * The ``r`` value for a signautre. - * - * This represents the ``x`` coordinate of a "reference" or - * challenge point, from which the ``y`` can be computed. - */ - get r() { - return this.#r; - } - set r(value) { - assertArgument(dataLength(value) === 32, "invalid r", "value", value); - this.#r = hexlify(value); - } - /** - * The ``s`` value for a signature. - */ - get s() { - return this.#s; - } - set s(_value) { - assertArgument(dataLength(_value) === 32, "invalid s", "value", _value); - const value = hexlify(_value); - assertArgument(parseInt(value.substring(0, 3)) < 8, "non-canonical s", "value", value); - this.#s = value; - } - /** - * The ``v`` value for a signature. - * - * Since a given ``x`` value for ``r`` has two possible values for - * its correspondin ``y``, the ``v`` indicates which of the two ``y`` - * values to use. - * - * It is normalized to the values ``27`` or ``28`` for legacy - * purposes. - */ - get v() { - return this.#v; - } - set v(value) { - const v = getNumber(value, "value"); - assertArgument(v === 27 || v === 28, "invalid v", "v", value); - this.#v = v; - } - /** - * The EIP-155 ``v`` for legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get networkV() { - return this.#networkV; - } - /** - * The chain ID for EIP-155 legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get legacynetworkId() { - const v = this.networkV; - if (v == null) { - return null; - } - return Signature.getnetworkId(v); - } - /** - * The ``yParity`` for the signature. - * - * See ``v`` for more details on how this value is used. - */ - get yParity() { - return this.v === 27 ? 0 : 1; - } - /** - * The [[link-eip-2098]] compact representation of the ``yParity`` - * and ``s`` compacted into a single ``bytes32``. - */ - get yParityAndS() { - // The EIP-2098 compact representation - const yParityAndS = getBytes(this.s); - if (this.yParity) { - yParityAndS[0] |= 0x80; - } - return hexlify(yParityAndS); - } - /** - * The [[link-eip-2098]] compact representation. - */ - get compactSerialized() { - return concat([this.r, this.yParityAndS]); - } - /** - * The serialized representation. - */ - get serialized() { - return concat([this.r, this.s, this.yParity ? "0x1c" : "0x1b"]); - } - /** - * @private - */ - constructor(guard, r, s, v) { - assertPrivate(guard, _guard$4, "Signature"); - this.#r = r; - this.#s = s; - this.#v = v; - this.#networkV = null; - } - [Symbol.for("nodejs.util.inspect.custom")]() { - return `Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`; - } - /** - * Returns a new identical [[Signature]]. - */ - clone() { - const clone = new Signature(_guard$4, this.r, this.s, this.v); - if (this.networkV) { - clone.#networkV = this.networkV; - } - return clone; - } - /** - * Returns a representation that is compatible with ``JSON.stringify``. - */ - toJSON() { - const networkV = this.networkV; - return { - _type: "signature", - networkV: networkV != null ? networkV.toString() : null, - r: this.r, - s: this.s, - v: this.v, - }; - } - /** - * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. - * - * @example: - * Signature.getnetworkId(45) - * //_result: - * - * Signature.getnetworkId(46) - * //_result: - */ - static getnetworkId(v) { - const bv = getBigInt(v, "v"); - // The v is not an EIP-155 v, so it is the unspecified chain ID - if (bv == BN_27 || bv == BN_28) { - return BN_0$6; - } - // Bad value for an EIP-155 v - assertArgument(bv >= BN_35, "invalid EIP-155 v", "v", v); - return (bv - BN_35) / BN_2$1; - } - /** - * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. - * - * Legacy transactions which use [[link-eip-155]] hijack the ``v`` - * property to include the chain ID. - * - * @example: - * Signature.getnetworkIdV(5, 27) - * //_result: - * - * Signature.getnetworkIdV(5, 28) - * //_result: - * - */ - static getnetworkIdV(networkId, v) { - return getBigInt(networkId) * BN_2$1 + BigInt(35 + v - 27); - } - /** - * Compute the normalized legacy transaction ``v`` from a ``yParirty``, - * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. - * - * @example: - * // The values 0 and 1 imply v is actually yParity - * Signature.getNormalizedV(0) - * //_result: - * - * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) - * Signature.getNormalizedV(27) - * //_result: - * - * // Legacy EIP-155 transaction (i.e. >= 35) - * Signature.getNormalizedV(46) - * //_result: - * - * // Invalid values throw - * Signature.getNormalizedV(5) - * //_error: - */ - static getNormalizedV(v) { - const bv = getBigInt(v); - if (bv === BN_0$6 || bv === BN_27) { - return 27; - } - if (bv === BN_1$3 || bv === BN_28) { - return 28; - } - assertArgument(bv >= BN_35, "invalid v", "v", v); - // Otherwise, EIP-155 v means odd is 27 and even is 28 - return bv & BN_1$3 ? 27 : 28; - } -} - -/** - * A fundamental building block of Core is the underlying - * cryptographic primitives. - * - * @_section: api/crypto:Cryptographic Functions [about-crypto] - */ -function lock() { - computeHmac.lock(); - pbkdf2.lock(); - randomBytes.lock(); - ripemd160.lock(); - scrypt.lock(); - scryptSync.lock(); - sha256.lock(); - sha512.lock(); - randomBytes.lock(); -} - -/** - * Returns the address for the %%key%%. - * - * The key may be any standard form of public key or a private key. - */ -function removeHexPrefix(val) { - return val.substring(0, 2) === "0x" ? val.substring(2) : val; -} -function publicToAddress(key, prefix) { - const val = hexDataSlice(sha256(key), 12); - const checksum = calculateCheckSum(val, prefix); - return "0x" + prefix + checksum + removeHexPrefix(val); -} -function computeAddress(key, prefix) { - let pubkey; - if (typeof key === "string") { - pubkey = SigningKey.computePublicKey(key, false); - } - else { - pubkey = key.publicKey; - } - return publicToAddress(pubkey, prefix); // getAddress(sha256("0x" + pubkey.substring(4)).substring(26)); -} -/** - * Returns the recovered address for the private key that was - * used to sign %%digest%% that resulted in %%signature%%. - */ -function recoverAddress(digest, signature, prefix) { - // return computeAddress(SigningKey.recoverPublicKey(digest, signature)); - const publicKey = SigningKey.recoverPublicKey(arrayify(digest), signature); - return publicToAddress(publicKey, prefix); -} -function extractPrefix(address) { - address = getAddress(address); - return address.substring(2, 4); -} - -/** - * @_ignore: - */ -const WordSize = 32; -const Padding = new Uint8Array(WordSize); -// Properties used to immediate pass through to the underlying object -// - `then` is used to detect if an object is a Promise for await -const passProperties$1 = ["then"]; -const _guard$3 = {}; -function throwError(name, error) { - const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`); - wrapped.error = error; - throw wrapped; -} -/** - * A [[Result]] is a sub-class of Array, which allows accessing any - * of its values either positionally by its index or, if keys are - * provided by its name. - * - * @_docloc: api/abi - */ -class Result extends Array { - #names; - /** - * @private - */ - constructor(...args) { - // To properly sub-class Array so the other built-in - // functions work, the constructor has to behave fairly - // well. So, in the event we are created via fromItems() - // we build the read-only Result object we want, but on - // any other input, we use the default constructor - // constructor(guard: any, items: Array, keys?: Array); - const guard = args[0]; - let items = args[1]; - let names = (args[2] || []).slice(); - let wrap = true; - if (guard !== _guard$3) { - items = args; - names = []; - wrap = false; - } - // Can't just pass in ...items since an array of length 1 - // is a special case in the super. - super(items.length); - items.forEach((item, index) => { - this[index] = item; - }); - // Find all unique keys - const nameCounts = names.reduce((accum, name) => { - if (typeof name === "string") { - accum.set(name, (accum.get(name) || 0) + 1); - } - return accum; - }, new Map()); - // Remove any key thats not unique - this.#names = Object.freeze(items.map((item, index) => { - const name = names[index]; - if (name != null && nameCounts.get(name) === 1) { - return name; - } - return null; - })); - if (!wrap) { - return; - } - // A wrapped Result is immutable - Object.freeze(this); - // Proxy indices and names so we can trap deferred errors - return new Proxy(this, { - get: (target, prop, receiver) => { - if (typeof prop === "string") { - // Index accessor - if (prop.match(/^[0-9]+$/)) { - const index = getNumber(prop, "%index"); - if (index < 0 || index >= this.length) { - throw new RangeError("out of result range"); - } - const item = target[index]; - if (item instanceof Error) { - throwError(`index ${index}`, item); - } - return item; - } - // Pass important checks (like `then` for Promise) through - if (passProperties$1.indexOf(prop) >= 0) { - return Reflect.get(target, prop, receiver); - } - const value = target[prop]; - if (value instanceof Function) { - // Make sure functions work with private variables - // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding - return function (...args) { - return value.apply(this === receiver ? target : this, args); - }; - } - else if (!(prop in target)) { - // Possible name accessor - return target.getValue.apply(this === receiver ? target : this, [ - prop, - ]); - } - } - return Reflect.get(target, prop, receiver); - }, - }); - } - /** - * Returns the Result as a normal Array. - * - * This will throw if there are any outstanding deferred - * errors. - */ - toArray() { - const result = []; - this.forEach((item, index) => { - if (item instanceof Error) { - throwError(`index ${index}`, item); - } - result.push(item); - }); - return result; - } - /** - * Returns the Result as an Object with each name-value pair. - * - * This will throw if any value is unnamed, or if there are - * any outstanding deferred errors. - */ - toObject() { - return this.#names.reduce((accum, name, index) => { - assert(name != null, "value at index ${ index } unnamed", "UNSUPPORTED_OPERATION", { - operation: "toObject()", - }); - // Add values for names that don't conflict - if (!(name in accum)) { - accum[name] = this.getValue(name); - } - return accum; - }, {}); - } - /** - * @_ignore - */ - slice(start, end) { - if (start == null) { - start = 0; - } - if (start < 0) { - start += this.length; - if (start < 0) { - start = 0; - } - } - if (end == null) { - end = this.length; - } - if (end < 0) { - end += this.length; - if (end < 0) { - end = 0; - } - } - if (end > this.length) { - end = this.length; - } - const result = [], names = []; - for (let i = start; i < end; i++) { - result.push(this[i]); - names.push(this.#names[i]); - } - return new Result(_guard$3, result, names); - } - /** - * @_ignore - */ - filter(callback, thisArg) { - const result = [], names = []; - for (let i = 0; i < this.length; i++) { - const item = this[i]; - if (item instanceof Error) { - throwError(`index ${i}`, item); - } - if (callback.call(thisArg, item, i, this)) { - result.push(item); - names.push(this.#names[i]); - } - } - return new Result(_guard$3, result, names); - } - /** - * Returns the value for %%name%%. - * - * Since it is possible to have a key whose name conflicts with - * a method on a [[Result]] or its superclass Array, or any - * JavaScript keyword, this ensures all named values are still - * accessible by name. - */ - getValue(name) { - const index = this.#names.indexOf(name); - if (index === -1) { - return undefined; - } - const value = this[index]; - if (value instanceof Error) { - throwError(`property ${JSON.stringify(name)}`, value.error); - } - return value; - } - /** - * Creates a new [[Result]] for %%items%% with each entry - * also accessible by its corresponding name in %%keys%%. - */ - static fromItems(items, keys) { - return new Result(_guard$3, items, keys); - } -} -/** - * Returns all errors found in a [[Result]]. - * - * Since certain errors encountered when creating a [[Result]] do - * not impact the ability to continue parsing data, they are - * deferred until they are actually accessed. Hence a faulty string - * in an Event that is never used does not impact the program flow. - * - * However, sometimes it may be useful to access, identify or - * validate correctness of a [[Result]]. - * - * @_docloc api/abi - */ -function checkResultErrors(result) { - // Find the first error (if any) - const errors = []; - const checkErrors = function (path, object) { - if (!Array.isArray(object)) { - return; - } - for (let key in object) { - const childPath = path.slice(); - childPath.push(key); - try { - checkErrors(childPath, object[key]); - } - catch (error) { - errors.push({ path: childPath, error: error }); - } - } - }; - checkErrors([], result); - return errors; -} -function getValue$1(value) { - let bytes = toBeArray(value); - assert(bytes.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { - buffer: bytes, - length: WordSize, - offset: bytes.length, - }); - if (bytes.length !== WordSize) { - bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes])); - } - return bytes; -} -/** - * @_ignore - */ -class Coder { - // The coder name: - // - address, uint256, tuple, array, etc. - name; - // The fully expanded type, including composite types: - // - address, uint256, tuple(address,bytes), uint256[3][4][], etc. - type; - // The localName bound in the signature, in this example it is "baz": - // - tuple(address foo, uint bar) baz - localName; - // Whether this type is dynamic: - // - Dynamic: bytes, string, address[], tuple(boolean[]), etc. - // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8) - dynamic; - constructor(name, type, localName, dynamic) { - defineProperties(this, { name, type, localName, dynamic }, { - name: "string", - type: "string", - localName: "string", - dynamic: "boolean", - }); - } - _throwError(message, value) { - assertArgument(false, message, this.localName, value); - } -} -/** - * @_ignore - */ -class Writer { - // An array of WordSize lengthed objects to concatenation - #data; - #dataLength; - constructor() { - this.#data = []; - this.#dataLength = 0; - } - get data() { - return concat(this.#data); - } - get length() { - return this.#dataLength; - } - #writeData(data) { - this.#data.push(data); - this.#dataLength += data.length; - return data.length; - } - appendWriter(writer) { - return this.#writeData(getBytesCopy(writer.data)); - } - // Arrayish item; pad on the right to *nearest* WordSize - writeBytes(value) { - let bytes = getBytesCopy(value); - const paddingOffset = bytes.length % WordSize; - if (paddingOffset) { - bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)])); - } - return this.#writeData(bytes); - } - // Numeric item; pad on the left *to* WordSize - writeValue(value) { - return this.#writeData(getValue$1(value)); - } - // Inserts a numeric place-holder, returning a callback that can - // be used to asjust the value later - writeUpdatableValue() { - const offset = this.#data.length; - this.#data.push(Padding); - this.#dataLength += WordSize; - return (value) => { - this.#data[offset] = getValue$1(value); - }; - } -} -/** - * @_ignore - */ -class Reader { - // Allows incomplete unpadded data to be read; otherwise an error - // is raised if attempting to overrun the buffer. This is required - // to deal with an old Solidity bug, in which event data for - // external (not public thoguh) was tightly packed. - allowLoose; - #data; - #offset; - constructor(data, allowLoose) { - defineProperties(this, { allowLoose: !!allowLoose }); - this.#data = getBytesCopy(data); - this.#offset = 0; - } - get data() { - return hexlify(this.#data); - } - get dataLength() { - return this.#data.length; - } - get consumed() { - return this.#offset; - } - get bytes() { - return new Uint8Array(this.#data); - } - #peekBytes(offset, length, loose) { - let alignedLength = Math.ceil(length / WordSize) * WordSize; - if (this.#offset + alignedLength > this.#data.length) { - if (this.allowLoose && - loose && - this.#offset + length <= this.#data.length) { - alignedLength = length; - } - else { - assert(false, "data out-of-bounds", "BUFFER_OVERRUN", { - buffer: getBytesCopy(this.#data), - length: this.#data.length, - offset: this.#offset + alignedLength, - }); - } - } - return this.#data.slice(this.#offset, this.#offset + alignedLength); - } - // Create a sub-reader with the same underlying data, but offset - subReader(offset) { - return new Reader(this.#data.slice(this.#offset + offset), this.allowLoose); - } - // Read bytes - readBytes(length, loose) { - let bytes = this.#peekBytes(0, length, !!loose); - this.#offset += bytes.length; - // @TODO: Make sure the length..end bytes are all 0? - return bytes.slice(0, length); - } - // Read a numeric values - readValue() { - return toBigInt(this.readBytes(WordSize)); - } - readIndex() { - return toNumber(this.readBytes(WordSize)); - } -} - -/** - * A Typed object allows a value to have its type explicitly - * specified. - * - * For example, in Solidity, the value ``45`` could represent a - * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent - * a ``bytes2`` or ``bytes``. - * - * Since JavaScript has no meaningful way to explicitly inform any - * APIs which what the type is, this allows transparent interoperation - * with Soldity. - * - * @_subsection: api/abi:Typed Values - */ -const _gaurd = {}; -function n(value, width) { - let signed = false; - if (width < 0) { - signed = true; - width *= -1; - } - // @TODO: Check range is valid for value - return new Typed(_gaurd, `${signed ? "" : "u"}int${width}`, value, { - signed, - width, - }); -} -function b(value, size) { - // @TODO: Check range is valid for value - return new Typed(_gaurd, `bytes${size ? size : ""}`, value, { size }); -} -const _typedSymbol = Symbol.for("_corebc_typed"); -class Typed { - type; - value; - #options; - _typedSymbol; - constructor(gaurd, type, value, options) { - if (options == null) { - options = null; - } - assertPrivate(_gaurd, gaurd, "Typed"); - defineProperties(this, { _typedSymbol, type, value }); - this.#options = options; - // Check the value is valid - this.format(); - } - format() { - if (this.type === "array") { - throw new Error(""); - } - else if (this.type === "dynamicArray") { - throw new Error(""); - } - else if (this.type === "tuple") { - return `tuple(${this.value.map((v) => v.format()).join(",")})`; - } - return this.type; - } - defaultValue() { - return 0; - } - minValue() { - return 0; - } - maxValue() { - return 0; - } - isBigInt() { - return !!this.type.match(/^u?int[0-9]+$/); - } - isData() { - return this.type.startsWith("bytes"); - } - isString() { - return this.type === "string"; - } - get tupleName() { - if (this.type !== "tuple") { - throw TypeError("not a tuple"); - } - return this.#options; - } - // Returns the length of this type as an array - // - `null` indicates the length is unforced, it could be dynamic - // - `-1` indicates the length is dynamic - // - any other value indicates it is a static array and is its length - get arrayLength() { - if (this.type !== "array") { - throw TypeError("not an array"); - } - if (this.#options === true) { - return -1; - } - if (this.#options === false) { - return this.value.length; - } - return null; - } - static from(type, value) { - return new Typed(_gaurd, type, value); - } - static uint8(v) { - return n(v, 8); - } - static uint16(v) { - return n(v, 16); - } - static uint24(v) { - return n(v, 24); - } - static uint32(v) { - return n(v, 32); - } - static uint40(v) { - return n(v, 40); - } - static uint48(v) { - return n(v, 48); - } - static uint56(v) { - return n(v, 56); - } - static uint64(v) { - return n(v, 64); - } - static uint72(v) { - return n(v, 72); - } - static uint80(v) { - return n(v, 80); - } - static uint88(v) { - return n(v, 88); - } - static uint96(v) { - return n(v, 96); - } - static uint104(v) { - return n(v, 104); - } - static uint112(v) { - return n(v, 112); - } - static uint120(v) { - return n(v, 120); - } - static uint128(v) { - return n(v, 128); - } - static uint136(v) { - return n(v, 136); - } - static uint144(v) { - return n(v, 144); - } - static uint152(v) { - return n(v, 152); - } - static uint160(v) { - return n(v, 160); - } - static uint168(v) { - return n(v, 168); - } - static uint176(v) { - return n(v, 176); - } - static uint184(v) { - return n(v, 184); - } - static uint192(v) { - return n(v, 192); - } - static uint200(v) { - return n(v, 200); - } - static uint208(v) { - return n(v, 208); - } - static uint216(v) { - return n(v, 216); - } - static uint224(v) { - return n(v, 224); - } - static uint232(v) { - return n(v, 232); - } - static uint240(v) { - return n(v, 240); - } - static uint248(v) { - return n(v, 248); - } - static uint256(v) { - return n(v, 256); - } - static uint(v) { - return n(v, 256); - } - static int8(v) { - return n(v, -8); - } - static int16(v) { - return n(v, -16); - } - static int24(v) { - return n(v, -24); - } - static int32(v) { - return n(v, -32); - } - static int40(v) { - return n(v, -40); - } - static int48(v) { - return n(v, -48); - } - static int56(v) { - return n(v, -56); - } - static int64(v) { - return n(v, -64); - } - static int72(v) { - return n(v, -72); - } - static int80(v) { - return n(v, -80); - } - static int88(v) { - return n(v, -88); - } - static int96(v) { - return n(v, -96); - } - static int104(v) { - return n(v, -104); - } - static int112(v) { - return n(v, -112); - } - static int120(v) { - return n(v, -120); - } - static int128(v) { - return n(v, -128); - } - static int136(v) { - return n(v, -136); - } - static int144(v) { - return n(v, -144); - } - static int152(v) { - return n(v, -152); - } - static int160(v) { - return n(v, -160); - } - static int168(v) { - return n(v, -168); - } - static int176(v) { - return n(v, -176); - } - static int184(v) { - return n(v, -184); - } - static int192(v) { - return n(v, -192); - } - static int200(v) { - return n(v, -200); - } - static int208(v) { - return n(v, -208); - } - static int216(v) { - return n(v, -216); - } - static int224(v) { - return n(v, -224); - } - static int232(v) { - return n(v, -232); - } - static int240(v) { - return n(v, -240); - } - static int248(v) { - return n(v, -248); - } - static int256(v) { - return n(v, -256); - } - static int(v) { - return n(v, -256); - } - static bytes1(v) { - return b(v, 1); - } - static bytes2(v) { - return b(v, 2); - } - static bytes3(v) { - return b(v, 3); - } - static bytes4(v) { - return b(v, 4); - } - static bytes5(v) { - return b(v, 5); - } - static bytes6(v) { - return b(v, 6); - } - static bytes7(v) { - return b(v, 7); - } - static bytes8(v) { - return b(v, 8); - } - static bytes9(v) { - return b(v, 9); - } - static bytes10(v) { - return b(v, 10); - } - static bytes11(v) { - return b(v, 11); - } - static bytes12(v) { - return b(v, 12); - } - static bytes13(v) { - return b(v, 13); - } - static bytes14(v) { - return b(v, 14); - } - static bytes15(v) { - return b(v, 15); - } - static bytes16(v) { - return b(v, 16); - } - static bytes17(v) { - return b(v, 17); - } - static bytes18(v) { - return b(v, 18); - } - static bytes19(v) { - return b(v, 19); - } - static bytes20(v) { - return b(v, 20); - } - static bytes21(v) { - return b(v, 21); - } - static bytes22(v) { - return b(v, 22); - } - static bytes23(v) { - return b(v, 23); - } - static bytes24(v) { - return b(v, 24); - } - static bytes25(v) { - return b(v, 25); - } - static bytes26(v) { - return b(v, 26); - } - static bytes27(v) { - return b(v, 27); - } - static bytes28(v) { - return b(v, 28); - } - static bytes29(v) { - return b(v, 29); - } - static bytes30(v) { - return b(v, 30); - } - static bytes31(v) { - return b(v, 31); - } - static bytes32(v) { - return b(v, 32); - } - static address(v) { - return new Typed(_gaurd, "address", v); - } - static bool(v) { - return new Typed(_gaurd, "bool", !!v); - } - static bytes(v) { - return new Typed(_gaurd, "bytes", v); - } - static string(v) { - return new Typed(_gaurd, "string", v); - } - static array(v, dynamic) { - throw new Error("not implemented yet"); - } - static tuple(v, name) { - throw new Error("not implemented yet"); - } - static overrides(v) { - return new Typed(_gaurd, "overrides", Object.assign({}, v)); - } - /** - * Returns true only if %%value%% is a [[Typed]] instance. - */ - static isTyped(value) { - return value && value._typedSymbol === _typedSymbol; - } - /** - * If the value is a [[Typed]] instance, validates the underlying value - * and returns it, otherwise returns value directly. - * - * This is useful for functions that with to accept either a [[Typed]] - * object or values. - */ - static dereference(value, type) { - if (Typed.isTyped(value)) { - if (value.type !== type) { - throw new Error(`invalid type: expecetd ${type}, got ${value.type}`); - } - return value.value; - } - return value; - } -} - -/** - * @_ignore - */ -class AddressCoder extends Coder { - constructor(localName) { - super("address", "address", localName, false); - } - defaultValue() { - return "0x0000000000000000000000000000000000000000"; - } - encode(writer, _value) { - let value = Typed.dereference(_value, "string"); - try { - value = getAddress(value); - } - catch (error) { - return this._throwError(error.message, _value); - } - return writer.writeValue(value); - } - decode(reader) { - return getAddress(toBeHex(reader.readValue(), 22)); - } -} - -/** - * Clones the functionality of an existing Coder, but without a localName - * - * @_ignore - */ -class AnonymousCoder extends Coder { - coder; - constructor(coder) { - super(coder.name, coder.type, "_", coder.dynamic); - this.coder = coder; - } - defaultValue() { - return this.coder.defaultValue(); - } - encode(writer, value) { - return this.coder.encode(writer, value); - } - decode(reader) { - return this.coder.decode(reader); - } -} - -/** - * @_ignore - */ -function pack(writer, coders, values) { - let arrayValues = []; - if (Array.isArray(values)) { - arrayValues = values; - } - else if (values && typeof values === "object") { - let unique = {}; - arrayValues = coders.map((coder) => { - const name = coder.localName; - assert(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); - assert(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); - unique[name] = true; - return values[name]; - }); - } - else { - assertArgument(false, "invalid tuple value", "tuple", values); - } - assertArgument(coders.length === arrayValues.length, "types/value length mismatch", "tuple", values); - let staticWriter = new Writer(); - let dynamicWriter = new Writer(); - let updateFuncs = []; - coders.forEach((coder, index) => { - let value = arrayValues[index]; - if (coder.dynamic) { - // Get current dynamic offset (for the future pointer) - let dynamicOffset = dynamicWriter.length; - // Encode the dynamic value into the dynamicWriter - coder.encode(dynamicWriter, value); - // Prepare to populate the correct offset once we are done - let updateFunc = staticWriter.writeUpdatableValue(); - updateFuncs.push((baseOffset) => { - updateFunc(baseOffset + dynamicOffset); - }); - } - else { - coder.encode(staticWriter, value); - } - }); - // Backfill all the dynamic offsets, now that we know the static length - updateFuncs.forEach((func) => { - func(staticWriter.length); - }); - let length = writer.appendWriter(staticWriter); - length += writer.appendWriter(dynamicWriter); - return length; -} -/** - * @_ignore - */ -function unpack(reader, coders) { - let values = []; - let keys = []; - // A reader anchored to this base - let baseReader = reader.subReader(0); - coders.forEach((coder) => { - let value = null; - if (coder.dynamic) { - let offset = reader.readIndex(); - let offsetReader = baseReader.subReader(offset); - try { - value = coder.decode(offsetReader); - } - catch (error) { - // Cannot recover from this - if (isError(error, "BUFFER_OVERRUN")) { - throw error; - } - value = error; - value.baseType = coder.name; - value.name = coder.localName; - value.type = coder.type; - } - } - else { - try { - value = coder.decode(reader); - } - catch (error) { - // Cannot recover from this - if (isError(error, "BUFFER_OVERRUN")) { - throw error; - } - value = error; - value.baseType = coder.name; - value.name = coder.localName; - value.type = coder.type; - } - } - if (value == undefined) { - throw new Error("investigate"); - } - values.push(value); - keys.push(coder.localName || null); - }); - return Result.fromItems(values, keys); -} -/** - * @_ignore - */ -class ArrayCoder extends Coder { - coder; - length; - constructor(coder, length, localName) { - const type = coder.type + "[" + (length >= 0 ? length : "") + "]"; - const dynamic = length === -1 || coder.dynamic; - super("array", type, localName, dynamic); - defineProperties(this, { coder, length }); - } - defaultValue() { - // Verifies the child coder is valid (even if the array is dynamic or 0-length) - const defaultChild = this.coder.defaultValue(); - const result = []; - for (let i = 0; i < this.length; i++) { - result.push(defaultChild); - } - return result; - } - encode(writer, _value) { - const value = Typed.dereference(_value, "array"); - if (!Array.isArray(value)) { - this._throwError("expected array value", value); - } - let count = this.length; - if (count === -1) { - count = value.length; - writer.writeValue(value.length); - } - assertArgumentCount(value.length, count, "coder array" + (this.localName ? " " + this.localName : "")); - let coders = []; - for (let i = 0; i < value.length; i++) { - coders.push(this.coder); - } - return pack(writer, coders, value); - } - decode(reader) { - let count = this.length; - if (count === -1) { - count = reader.readIndex(); - // Check that there is *roughly* enough data to ensure - // stray random data is not being read as a length. Each - // slot requires at least 32 bytes for their value (or 32 - // bytes as a link to the data). This could use a much - // tighter bound, but we are erroring on the side of safety. - assert(count * WordSize <= reader.dataLength, "insufficient data length", "BUFFER_OVERRUN", { - buffer: reader.bytes, - offset: count * WordSize, - length: reader.dataLength, - }); - } - let coders = []; - for (let i = 0; i < count; i++) { - coders.push(new AnonymousCoder(this.coder)); - } - return unpack(reader, coders); - } -} - -/** - * @_ignore - */ -class BooleanCoder extends Coder { - constructor(localName) { - super("bool", "bool", localName, false); - } - defaultValue() { - return false; - } - encode(writer, _value) { - const value = Typed.dereference(_value, "bool"); - return writer.writeValue(value ? 1 : 0); - } - decode(reader) { - return !!reader.readValue(); - } -} - -/** - * @_ignore - */ -class DynamicBytesCoder extends Coder { - constructor(type, localName) { - super(type, type, localName, true); - } - defaultValue() { - return "0x"; - } - encode(writer, value) { - value = getBytesCopy(value); - let length = writer.writeValue(value.length); - length += writer.writeBytes(value); - return length; - } - decode(reader) { - return reader.readBytes(reader.readIndex(), true); - } -} -/** - * @_ignore - */ -class BytesCoder extends DynamicBytesCoder { - constructor(localName) { - super("bytes", localName); - } - decode(reader) { - return hexlify(super.decode(reader)); - } -} - -/** - * @_ignore - */ -class FixedBytesCoder extends Coder { - size; - constructor(size, localName) { - let name = "bytes" + String(size); - super(name, name, localName, false); - defineProperties(this, { size }, { size: "number" }); - } - defaultValue() { - return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0, 2 + this.size * 2); - } - encode(writer, _value) { - let data = getBytesCopy(Typed.dereference(_value, this.type)); - if (data.length !== this.size) { - this._throwError("incorrect data length", _value); - } - return writer.writeBytes(data); - } - decode(reader) { - return hexlify(reader.readBytes(this.size)); - } -} - -const Empty = new Uint8Array([]); -/** - * @_ignore - */ -class NullCoder extends Coder { - constructor(localName) { - super("null", "", localName, false); - } - defaultValue() { - return null; - } - encode(writer, value) { - if (value != null) { - this._throwError("not null", value); - } - return writer.writeBytes(Empty); - } - decode(reader) { - reader.readBytes(0); - return null; - } -} - -const BN_0$5 = BigInt(0); -const BN_1$2 = BigInt(1); -const BN_MAX_UINT256$1 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -/** - * @_ignore - */ -class NumberCoder extends Coder { - size; - signed; - constructor(size, signed, localName) { - const name = (signed ? "int" : "uint") + size * 8; - super(name, name, localName, false); - defineProperties(this, { size, signed }, { size: "number", signed: "boolean" }); - } - defaultValue() { - return 0; - } - encode(writer, _value) { - let value = getBigInt(Typed.dereference(_value, this.type)); - // Check bounds are safe for encoding - let maxUintValue = mask(BN_MAX_UINT256$1, WordSize * 8); - if (this.signed) { - let bounds = mask(maxUintValue, this.size * 8 - 1); - if (value > bounds || value < -(bounds + BN_1$2)) { - this._throwError("value out-of-bounds", _value); - } - value = toTwos(value, 8 * WordSize); - } - else if (value < BN_0$5 || value > mask(maxUintValue, this.size * 8)) { - this._throwError("value out-of-bounds", _value); - } - return writer.writeValue(value); - } - decode(reader) { - let value = mask(reader.readValue(), this.size * 8); - if (this.signed) { - value = fromTwos(value, this.size * 8); - } - return value; - } -} - -/** - * @_ignore - */ -class StringCoder extends DynamicBytesCoder { - constructor(localName) { - super("string", localName); - } - defaultValue() { - return ""; - } - encode(writer, _value) { - return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, "string"))); - } - decode(reader) { - return toUtf8String(super.decode(reader)); - } -} - -/** - * @_ignore - */ -class TupleCoder extends Coder { - coders; - constructor(coders, localName) { - let dynamic = false; - const types = []; - coders.forEach((coder) => { - if (coder.dynamic) { - dynamic = true; - } - types.push(coder.type); - }); - const type = "tuple(" + types.join(",") + ")"; - super("tuple", type, localName, dynamic); - defineProperties(this, { - coders: Object.freeze(coders.slice()), - }); - } - defaultValue() { - const values = []; - this.coders.forEach((coder) => { - values.push(coder.defaultValue()); - }); - // We only output named properties for uniquely named coders - const uniqueNames = this.coders.reduce((accum, coder) => { - const name = coder.localName; - if (name) { - if (!accum[name]) { - accum[name] = 0; - } - accum[name]++; - } - return accum; - }, {}); - // Add named values - this.coders.forEach((coder, index) => { - let name = coder.localName; - if (!name || uniqueNames[name] !== 1) { - return; - } - if (name === "length") { - name = "_length"; - } - if (values[name] != null) { - return; - } - values[name] = values[index]; - }); - return Object.freeze(values); - } - encode(writer, _value) { - const value = Typed.dereference(_value, "tuple"); - return pack(writer, this.coders, value); - } - decode(reader) { - return unpack(reader, this.coders); - } -} - -/** - * A simple hashing function which operates on UTF-8 strings to - * compute an 32-byte identifier. - * - * - * @example: - * id("hello world") - * //_result: - */ -function id(value, useKeccak) { - if (useKeccak) { - return keccak256(toUtf8Bytes(value)); - } - return sha256(toUtf8Bytes(value)); -} - -/** - * A constant for the zero address. - * - * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) - */ -const ZeroAddress = "0x0000000000000000000000000000000000000000"; - -/** - * A constant for the zero hash. - * - * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) - */ -const ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000"; - -/** - * A constant for the order N for the secp256k1 curve. - * - * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) - */ -const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); -/** - * A constant for the number of ore in a single xcb. - * - * (**i.e.** ``1000000000000000000n``) - */ -const OrePerXCB = BigInt("1000000000000000000"); -/** - * A constant for the maximum value for a ``uint256``. - * - * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) - */ -const MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -/** - * A constant for the minimum value for an ``int256``. - * - * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) - */ -const MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * - BigInt(-1); -/** - * A constant for the maximum value for an ``int256``. - * - * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) - */ -const MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); - -// NFKC (composed) // (decomposed) -/** - * A constant for the core symbol (normalized using NFKC). - * - * (**i.e.** ``"\\u039e"``) - */ -const CoreSymbol = "\u039e"; // "\uD835\uDF63"; -/** - * A constant for the [[link-eip-191]] personal message prefix. - * - * (**i.e.** ``"\\x19Core Signed Message:\\n"``) - */ -const MessagePrefix = "\x19Core Signed Message:\n"; - -function accessSetify(addr, storageKeys) { - return { - address: getAddress(addr), - storageKeys: storageKeys.map((storageKey, index) => { - assertArgument(isHexString(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey); - return storageKey.toLowerCase(); - }), - }; -} -/** - * Returns a [[AccessList]] from any corebcsupported access-list structure. - */ -function accessListify(value) { - if (Array.isArray(value)) { - return value.map((set, index) => { - if (Array.isArray(set)) { - assertArgument(set.length === 2, "invalid slot set", `value[${index}]`, set); - return accessSetify(set[0], set[1]); - } - assertArgument(set != null && typeof set === "object", "invalid address-slot set", "value", value); - return accessSetify(set.address, set.storageKeys); - }); - } - assertArgument(value != null && typeof value === "object", "invalid access list", "value", value); - const result = Object.keys(value).map((addr) => { - const storageKeys = value[addr].reduce((accum, storageKey) => { - accum[storageKey] = true; - return accum; - }, {}); - return accessSetify(addr, Object.keys(storageKeys).sort()); - }); - result.sort((a, b) => a.address.localeCompare(b.address)); - return result; -} - -const logger$1 = new Logger("transaction/0.0.1"); -const BN_0$4 = BigInt(0); -function handleAddress(value) { - if (value === "0x") { - return null; - } - return getAddress(value); -} -function parse(data) { - const handleNumber = (value) => { - // @ts-ignore - if (value === "0x") { - return BigNumber.from(0); - } - return BigNumber.from(value); - }; - const transaction = decode$1(data); - if (transaction.length !== 7 && transaction.length !== 8) { - logger$1.throwArgumentError("invalid raw transaction", "data", data); - } - const isSigned = transaction.length === 8; - const tx = { - nonce: Number(handleNumber(transaction[0])), - energyPrice: handleNumber(transaction[1]).toBigInt(), - energyLimit: handleNumber(transaction[2]).toBigInt(), - networkId: handleNumber(transaction[isSigned ? 3 : 6]).toBigInt(), - to: handleAddress(transaction[isSigned ? 4 : 3]), - value: handleNumber(transaction[isSigned ? 5 : 4]).toBigInt(), - data: transaction[isSigned ? 6 : 5], - }; - if (transaction.length === 8) { - const prefix = networkIdToPrefix(Number(tx.networkId)); - const digest = sha256(serialize(tx)); - tx.hash = sha256(serialize(tx, transaction[7])); - tx.from = recoverAddress(digest, transaction[7], prefix); - tx.signature = transaction[7]; - } - return tx; -} -const unsignedTransactionFields = [ - { name: "nonce", maxLength: 32, numeric: true }, - { name: "energyPrice", maxLength: 32, numeric: true }, - { name: "energyLimit", maxLength: 32, numeric: true }, - { name: "to", length: 22 }, - { name: "value", maxLength: 32, numeric: true }, - { name: "data" }, - { name: "networkId", maxLength: 32, numeric: true }, -]; -const transactionFields = [ - { name: "nonce", maxLength: 32, numeric: true }, - { name: "energyPrice", maxLength: 32, numeric: true }, - { name: "energyLimit", maxLength: 32, numeric: true }, - { name: "networkId", maxLength: 32, numeric: true }, - { name: "to", length: 22 }, - { name: "value", maxLength: 32, numeric: true }, - { name: "data" }, -]; -const allowedTransactionKeys = { - networkId: true, - data: true, - energyLimit: true, - energyPrice: true, - nonce: true, - to: true, - value: true, -}; -function serialize(transaction, signature) { - checkProperties(transaction, allowedTransactionKeys); - const raw = []; - (!!signature ? transactionFields : unsignedTransactionFields).forEach(function ({ numeric, maxLength, name, length }) { - let value = transaction[name] || []; - const options = {}; - if (numeric) { - options.hexPad = "left"; - } - const tmpHexlified = hexlify(value, options); - value = arrayify(tmpHexlified); - // Fixed-width field - if (length && value.length !== length && value.length > 0) { - logger$1.throwArgumentError("invalid length for " + name, "transaction:" + name, value); - } - // Variable-width (with a maximum) - if (maxLength) { - value = stripZeros(value); - if (value.length > maxLength) { - logger$1.throwArgumentError("invalid length for " + name, "transaction:" + name, value); - } - } - const hexlified = hexlify(value); - raw.push(hexlified); - }); - if (!!signature) { - raw.push(hexlify(signature)); - } - const finalValue = encode(raw); - return finalValue; -} -/** - * A **Transaction** describes an operation to be executed on - * Core by an Externally Owned Account (EOA). It includes - * who (the [[to]] address), what (the [[data]]) and how much (the - * [[value]] in corebc) the operation should entail. - * - * @example: - * tx = new Transaction() - * //_result: - * - * tx.data = "0x1234"; - * //_result: - */ -class Transaction { - #to; - #data; - #nonce; - #energyLimit; - #energyPrice; - #value; - #networkId; - #sig; - /** - * The ``to`` address for the transaction or ``null`` if the - * transaction is an ``init`` transaction. - */ - get to() { - return this.#to; - } - set to(value) { - this.#to = value == null ? null : getAddress(value); - } - /** - * The transaction nonce. - */ - get nonce() { - return this.#nonce; - } - set nonce(value) { - this.#nonce = getNumber(value, "value"); - } - /** - * The energy limit. - */ - get energyLimit() { - return this.#energyLimit; - } - set energyLimit(value) { - this.#energyLimit = getBigInt(value); - } - /** - * The energy price. - * - * On legacy networks this defines the fee that will be paid. On - * EIP-1559 networks, this should be ``null``. - */ - get energyPrice() { - const value = this.#energyPrice; - if (value == null) { - return BN_0$4; - } - return value; - } - set energyPrice(value) { - this.#energyPrice = value == null ? null : getBigInt(value, "energyPrice"); - } - /** - * The transaction data. For ``init`` transactions this is the - * deployment code. - */ - get data() { - return this.#data; - } - set data(value) { - this.#data = hexlify(value); - } - /** - * The amount of xcb (in ore) to send in this transactions. - */ - get value() { - return this.#value; - } - set value(value) { - this.#value = getBigInt(value, "value"); - } - /** - * The chain ID this transaction is valid on. - */ - get networkId() { - return this.#networkId; - } - set networkId(value) { - this.#networkId = getBigInt(value); - } - /** - * If signed, the signature for this transaction. - */ - get signature() { - return this.#sig || null; - } - set signature(value) { - this.#sig = value == null ? null : value; - } - /** - * Creates a new Transaction with default values. - */ - constructor() { - this.#to = null; - this.#nonce = 0; - this.#energyLimit = BigInt(0); - this.#energyPrice = null; - this.#data = "0x"; - this.#value = BigInt(0); - this.#networkId = BigInt(0); - this.#sig = null; - } - /** - * The transaction hash, if signed. Otherwise, ``null``. - */ - get hash() { - if (this.signature == null) { - return null; - } - return sha256(this.serialized); - } - /** - * The pre-image hash of this transaction. - * - * This is the digest that a [[Signer]] must sign to authorize - * this transaction. - */ - get unsignedHash() { - return sha256(this.unsignedSerialized); - } - /** - * The sending address, if signed. Otherwise, ``null``. - */ - get from() { - if (this.signature == null) { - return null; - } - const prefix = networkIdToPrefix(Number(this.#networkId)); - return recoverAddress(this.unsignedHash, this.signature, prefix); - } - /** - * The public key of the sender, if signed. Otherwise, ``null``. - */ - get fromPublicKey() { - if (this.signature == null) { - return null; - } - return SigningKey.recoverPublicKey(this.unsignedHash, this.signature); - } - /** - * Returns true if signed. - * - * This provides a Type Guard that properties requiring a signed - * transaction are non-null. - */ - isSigned() { - //isSigned(): this is SignedTransaction { - return this.signature != null; - } - /** - * The serialized transaction. - * - * This throws if the transaction is unsigned. For the pre-image, - * use [[unsignedSerialized]]. - */ - get serialized() { - assert(this.signature != null, "cannot serialize unsigned transaction; maybe you meant .unsignedSerialized", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); - return serialize(this, this.signature); - } - /** - * The transaction pre-image. - * - * The hash of this is the digest which needs to be signed to - * authorize this transaction. - */ - get unsignedSerialized() { - return serialize(this); - } - /** - * Create a copy of this transaciton. - */ - clone() { - return Transaction.from(this); - } - /** - * Return a JSON-friendly object. - */ - toJSON() { - const s = (v) => { - if (v == null) { - return null; - } - return v.toString(); - }; - return { - to: this.to, - data: this.data, - nonce: this.nonce, - energyLimit: s(this.energyLimit), - energyPrice: s(this.energyPrice), - value: s(this.value), - networkId: s(this.networkId), - sig: this.signature ? this.signature : null, - }; - } - /** - * Create a **Transaction** from a serialized transaction or a - * Transaction-like object. - */ - static from(tx) { - if (tx == null) { - return new Transaction(); - } - if (typeof tx === "string") { - const payload = getBytes(tx); - return Transaction.from(parse(payload)); - } - const result = new Transaction(); - if (tx.to != null) { - result.to = tx.to; - } - if (tx.nonce != null) { - result.nonce = tx.nonce; - } - if (tx.energyLimit != null) { - result.energyLimit = tx.energyLimit; - } - if (tx.energyPrice != null) { - result.energyPrice = tx.energyPrice; - } - if (tx.data != null) { - result.data = tx.data; - } - if (tx.value != null) { - result.value = tx.value; - } - if (tx.networkId != null) { - result.networkId = tx.networkId; - } - if (tx.signature != null) { - result.signature = tx.signature; - } - if (tx.hash != null) { - assertArgument(result.isSigned(), "unsigned transaction cannot define hash", "tx", tx); - assertArgument(result.hash === tx.hash, "hash mismatch", "tx", tx); - } - if (tx.from != null) { - assertArgument(result.isSigned(), "unsigned transaction cannot define from", "tx", tx); - assertArgument(result.from.toLowerCase() === (tx.from || "").toLowerCase(), "from mismatch", "tx", tx); - } - return result; - } -} - -/** - * Computes the [[link-eip-191]] personal-sign message digest to sign. - * - * - * If %%message%% is a string, it is converted to its UTF-8 bytes - * first. To compute the digest of a [[DataHexString]], it must be converted - * to [bytes](getBytes). - * - * @example: - * hashMessage("Hello World") - * //_result: - * - * // Hashes the SIX (6) string characters, i.e. - * // [ "0", "x", "4", "2", "4", "3" ] - * hashMessage("0x4243") - * //_result: - * - * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... - * hashMessage(getBytes("0x4243")) - * //_result: - * - * // ...which is equal to using data - * hashMessage(new Uint8Array([ 0x42, 0x43 ])) - * //_result: - * - */ -function hashMessage(message) { - if (typeof message === "string") { - message = toUtf8Bytes(message); - } - return sha256(concat([ - toUtf8Bytes(MessagePrefix), - toUtf8Bytes(String(message.length)), - message, - ])); -} -/** - * Return the address of the private key that produced - * the signature %%sig%% during signing for %%message%%. - */ -function verifyMessage(message, sig, prefix) { - const digest = hashMessage(message); - return recoverAddress(digest, sig, prefix); -} - -const regexBytes = new RegExp("^bytes([0-9]+)$"); -const regexNumber = new RegExp("^(u?int)([0-9]*)$"); -const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); -function _pack(type, value, isArray) { - switch (type) { - case "address": - if (isArray) { - return getBytes(zeroPadValue(value, 32)); - } - return getBytes(getAddress(value)); - case "string": - return toUtf8Bytes(value); - case "bytes": - return getBytes(value); - case "bool": - value = !!value ? "0x01" : "0x00"; - if (isArray) { - return getBytes(zeroPadValue(value, 32)); - } - return getBytes(value); - } - let match = type.match(regexNumber); - if (match) { - let signed = match[1] === "int"; - let size = parseInt(match[2] || "256"); - assertArgument((!match[2] || match[2] === String(size)) && - size % 8 === 0 && - size !== 0 && - size <= 256, "invalid number type", "type", type); - if (isArray) { - size = 256; - } - if (signed) { - value = toTwos(value, size); - } - return getBytes(zeroPadValue(toBeArray(value), size / 8)); - } - match = type.match(regexBytes); - if (match) { - const size = parseInt(match[1]); - assertArgument(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type); - assertArgument(dataLength(value) === size, `invalid value for ${type}`, "value", value); - if (isArray) { - return getBytes(zeroPadBytes(value, 32)); - } - return value; - } - match = type.match(regexArray); - if (match && Array.isArray(value)) { - const baseType = match[1]; - const count = parseInt(match[2] || String(value.length)); - assertArgument(count === value.length, `invalid array length for ${type}`, "value", value); - const result = []; - value.forEach(function (value) { - result.push(_pack(baseType, value, true)); - }); - return getBytes(concat(result)); - } - assertArgument(false, "invalid type", "type", type); -} -// @TODO: Array Enum -/** - * Computes the [[link-solc-packed]] representation of %%values%% - * respectively to their %%types%%. - * - * @example: - * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" - * solidityPacked([ "address", "uint" ], [ addr, 45 ]); - * //_result: - */ -function solidityPacked(types, values) { - assertArgument(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values); - const tight = []; - types.forEach(function (type, index) { - tight.push(_pack(type, values[index])); - }); - return hexlify(concat(tight)); -} -/** - * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% - * respectively to their %%types%%. - * - * @example: - * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" - * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); - * //_result: - */ -function solidityPackedSha256(types, values) { - return sha256(solidityPacked(types, values)); -} - -const padding = new Uint8Array(32); -padding.fill(0); -const BN__1 = BigInt(-1); -const BN_0$3 = BigInt(0); -const BN_1$1 = BigInt(1); -const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -function hexPadRight(value) { - const bytes = getBytes(value); - const padOffset = bytes.length % 32; - if (padOffset) { - return concat([bytes, padding.slice(padOffset)]); - } - return hexlify(bytes); -} -const hexTrue = toBeHex(BN_1$1, 32); -const hexFalse = toBeHex(BN_0$3, 32); -const domainFieldTypes = { - name: "string", - version: "string", - networkId: "uint256", - verifyingContract: "address", - salt: "bytes32", -}; -const domainFieldNames = [ - "name", - "version", - "networkId", - "verifyingContract", - "salt", -]; -function checkString(key) { - return function (value) { - assertArgument(typeof value === "string", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); - return value; - }; -} -const domainChecks = { - name: checkString("name"), - version: checkString("version"), - networkId: function (_value) { - const value = getBigInt(_value, "domain.networkId"); - assertArgument(value >= 0, "invalid chain ID", "domain.networkId", _value); - if (Number.isSafeInteger(value)) { - return Number(value); - } - return toQuantity(value); - }, - verifyingContract: function (value) { - try { - return getAddress(value).toLowerCase(); - } - catch (error) { } - assertArgument(false, `invalid domain value "verifyingContract"`, "domain.verifyingContract", value); - }, - salt: function (value) { - const bytes = getBytes(value, "domain.salt"); - assertArgument(bytes.length === 32, `invalid domain value "salt"`, "domain.salt", value); - return hexlify(bytes); - }, -}; -function getBaseEncoder(type) { - // intXX and uintXX - { - const match = type.match(/^(u?)int(\d*)$/); - if (match) { - const signed = match[1] === ""; - const width = parseInt(match[2] || "256"); - assertArgument(width % 8 === 0 && - width !== 0 && - width <= 256 && - (match[2] == null || match[2] === String(width)), "invalid numeric width", "type", type); - const boundsUpper = mask(BN_MAX_UINT256, signed ? width - 1 : width); - const boundsLower = signed ? (boundsUpper + BN_1$1) * BN__1 : BN_0$3; - return function (_value) { - const value = getBigInt(_value, "value"); - assertArgument(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, "value", value); - return toBeHex(signed ? toTwos(value, 256) : value, 32); - }; - } - } - // bytesXX - { - const match = type.match(/^bytes(\d+)$/); - if (match) { - const width = parseInt(match[1]); - assertArgument(width !== 0 && width <= 32 && match[1] === String(width), "invalid bytes width", "type", type); - return function (value) { - const bytes = getBytes(value); - assertArgument(bytes.length === width, `invalid length for ${type}`, "value", value); - return hexPadRight(value); - }; - } - } - switch (type) { - case "address": - return function (value) { - return zeroPadValue(getAddress(value), 32); - }; - case "bool": - return function (value) { - return !value ? hexFalse : hexTrue; - }; - case "bytes": - return function (value) { - return sha256(value); - }; - case "string": - return function (value) { - return id(value); - }; - } - return null; -} -function encodeType(name, fields) { - return `${name}(${fields - .map(({ name, type }) => type + " " + name) - .join(",")})`; -} -class TypedDataEncoder { - primaryType; - #types; - get types() { - return JSON.parse(this.#types); - } - #fullTypes; - #encoderCache; - constructor(types) { - this.#types = JSON.stringify(types); - this.#fullTypes = new Map(); - this.#encoderCache = new Map(); - // Link struct types to their direct child structs - const links = new Map(); - // Link structs to structs which contain them as a child - const parents = new Map(); - // Link all subtypes within a given struct - const subtypes = new Map(); - Object.keys(types).forEach((type) => { - links.set(type, new Set()); - parents.set(type, []); - subtypes.set(type, new Set()); - }); - for (const name in types) { - const uniqueNames = new Set(); - for (const field of types[name]) { - // Check each field has a unique name - assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types); - uniqueNames.add(field.name); - // Get the base type (drop any array specifiers) - const baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1] || null; - assertArgument(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", types); - // Is this a base encoding type? - const encoder = getBaseEncoder(baseType); - if (encoder) { - continue; - } - assertArgument(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", types); - // Add linkage - parents.get(baseType).push(name); - links.get(name).add(baseType); - } - } - // Deduce the primary type - const primaryTypes = Array.from(parents.keys()).filter((n) => parents.get(n).length === 0); - assertArgument(primaryTypes.length !== 0, "missing primary type", "types", types); - assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes - .map((t) => JSON.stringify(t)) - .join(", ")}`, "types", types); - defineProperties(this, { primaryType: primaryTypes[0] }); - // Check for circular type references - function checkCircular(type, found) { - assertArgument(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", types); - found.add(type); - for (const child of links.get(type)) { - if (!parents.has(child)) { - continue; - } - // Recursively check children - checkCircular(child, found); - // Mark all ancestors as having this decendant - for (const subtype of found) { - subtypes.get(subtype).add(child); - } - } - found.delete(type); - } - checkCircular(this.primaryType, new Set()); - // Compute each fully describe type - for (const [name, set] of subtypes) { - const st = Array.from(set); - st.sort(); - this.#fullTypes.set(name, encodeType(name, types[name]) + - st.map((t) => encodeType(t, types[t])).join("")); - } - } - getEncoder(type) { - let encoder = this.#encoderCache.get(type); - if (!encoder) { - encoder = this.#getEncoder(type); - this.#encoderCache.set(type, encoder); - } - return encoder; - } - #getEncoder(type) { - // Basic encoder type (address, bool, uint256, etc) - { - const encoder = getBaseEncoder(type); - if (encoder) { - return encoder; - } - } - // Array - const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); - if (match) { - const subtype = match[1]; - const subEncoder = this.getEncoder(subtype); - return (value) => { - assertArgument(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value); - let result = value.map(subEncoder); - if (this.#fullTypes.has(subtype)) { - result = result.map(sha256); - } - return sha256(concat(result)); - }; - } - // Struct - const fields = this.types[type]; - if (fields) { - const encodedType = id(this.#fullTypes.get(type)); - return (value) => { - const values = fields.map(({ name, type }) => { - const result = this.getEncoder(type)(value[name]); - if (this.#fullTypes.has(type)) { - return sha256(result); - } - return result; - }); - values.unshift(encodedType); - return concat(values); - }; - } - assertArgument(false, `unknown type: ${type}`, "type", type); - } - encodeType(name) { - const result = this.#fullTypes.get(name); - assertArgument(result, `unknown type: ${JSON.stringify(name)}`, "name", name); - return result; - } - encodeData(type, value) { - return this.getEncoder(type)(value); - } - hashStruct(name, value) { - return sha256(this.encodeData(name, value)); - } - encode(value) { - return this.encodeData(this.primaryType, value); - } - hash(value) { - return this.hashStruct(this.primaryType, value); - } - _visit(type, value, callback) { - // Basic encoder type (address, bool, uint256, etc) - { - const encoder = getBaseEncoder(type); - if (encoder) { - return callback(type, value); - } - } - // Array - const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); - if (match) { - assertArgument(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value); - return value.map((v) => this._visit(match[1], v, callback)); - } - // Struct - const fields = this.types[type]; - if (fields) { - return fields.reduce((accum, { name, type }) => { - accum[name] = this._visit(type, value[name], callback); - return accum; - }, {}); - } - assertArgument(false, `unknown type: ${type}`, "type", type); - } - visit(value, callback) { - return this._visit(this.primaryType, value, callback); - } - static from(types) { - return new TypedDataEncoder(types); - } - static getPrimaryType(types) { - return TypedDataEncoder.from(types).primaryType; - } - static hashStruct(name, types, value) { - return TypedDataEncoder.from(types).hashStruct(name, value); - } - static hashDomain(domain) { - const domainFields = []; - for (const name in domain) { - if (domain[name] == null) { - continue; - } - const type = domainFieldTypes[name]; - assertArgument(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); - domainFields.push({ name, type }); - } - domainFields.sort((a, b) => { - return (domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name)); - }); - return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); - } - static encode(domain, types, value) { - return concat([ - "0x1901", - TypedDataEncoder.hashDomain(domain), - TypedDataEncoder.from(types).hash(value), - ]); - } - static hash(domain, types, value) { - return sha256(TypedDataEncoder.encode(domain, types, value)); - } - // Replaces all address types with ENS names with their looked up address - static async resolveNames(domain, types, value, resolveName) { - // Make a copy to isolate it from the object passed in - domain = Object.assign({}, domain); - // Allow passing null to ignore value - for (const key in domain) { - if (domain[key] == null) { - delete domain[key]; - } - } - // Look up all ENS names - const ensCache = {}; - // Do we need to look up the domain's verifyingContract? - if (domain.verifyingContract && - !isHexString(domain.verifyingContract, 20)) { - ensCache[domain.verifyingContract] = "0x"; - } - // We are going to use the encoder to visit all the base values - const encoder = TypedDataEncoder.from(types); - // Get a list of all the addresses - encoder.visit(value, (type, value) => { - if (type === "address" && !isHexString(value, 20)) { - ensCache[value] = "0x"; - } - return value; - }); - // Lookup each name - for (const name in ensCache) { - ensCache[name] = await resolveName(name); - } - // Replace the domain verifyingContract if needed - if (domain.verifyingContract && ensCache[domain.verifyingContract]) { - domain.verifyingContract = ensCache[domain.verifyingContract]; - } - // Replace all ENS names with their address - value = encoder.visit(value, (type, value) => { - if (type === "address" && ensCache[value]) { - return ensCache[value]; - } - return value; - }); - return { domain, value }; - } - static getPayload(domain, types, value) { - // Validate the domain fields - TypedDataEncoder.hashDomain(domain); - // Derive the EIP712Domain Struct reference type - const domainValues = {}; - const domainTypes = []; - domainFieldNames.forEach((name) => { - const value = domain[name]; - if (value == null) { - return; - } - domainValues[name] = domainChecks[name](value); - domainTypes.push({ name, type: domainFieldTypes[name] }); - }); - const encoder = TypedDataEncoder.from(types); - const typesWithDomain = Object.assign({}, types); - assertArgument(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types); - typesWithDomain.EIP712Domain = domainTypes; - // Validate the data structures and types - encoder.encode(value); - return { - types: typesWithDomain, - domain: domainValues, - primaryType: encoder.primaryType, - message: encoder.visit(value, (type, value) => { - // bytes - if (type.match(/^bytes(\d*)/)) { - return hexlify(getBytes(value)); - } - // uint or int - if (type.match(/^u?int/)) { - return getBigInt(value).toString(); - } - switch (type) { - case "address": - return value.toLowerCase(); - case "bool": - return !!value; - case "string": - assertArgument(typeof value === "string", "invalid string", "value", value); - return value; - } - assertArgument(false, "unsupported type", "type", type); - }), - }; - } -} -/** - * Compute the address used to sign the typed data for the %%signature%%. - */ -function verifyTypedData(domain, types, value, signature, prefix) { - return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature, prefix); -} - -/** - * About frgaments... - * - * @_subsection api/abi/abi-coder:Fragments [about-fragments] - */ -var _a; -// [ "a", "b" ] => { "a": 1, "b": 1 } -function setify(items) { - const result = new Set(); - items.forEach((k) => result.add(k)); - return Object.freeze(result); -} -// Visibility Keywords -const _kwVisib = "constant external internal payable private public pure view"; -const KwVisib = setify(_kwVisib.split(" ")); -const _kwTypes = "constructor error event fallback function receive struct"; -const KwTypes = setify(_kwTypes.split(" ")); -const _kwModifiers = "calldata memory storage payable indexed"; -const KwModifiers = setify(_kwModifiers.split(" ")); -const _kwOther = "tuple returns"; -// All Keywords -const _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(" "); -const Keywords = setify(_keywords.split(" ")); -// Single character tokens -const SimpleTokens = { - "(": "OPEN_PAREN", - ")": "CLOSE_PAREN", - "[": "OPEN_BRACKET", - "]": "CLOSE_BRACKET", - ",": "COMMA", - "@": "AT", -}; -// Parser regexes to consume the next token -const regexWhitespacePrefix = new RegExp("^(\\s*)"); -const regexNumberPrefix = new RegExp("^([0-9]+)"); -const regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"); -// Parser regexs to check validity -const regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"); -const regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"); -class TokenString { - #offset; - #tokens; - get offset() { - return this.#offset; - } - get length() { - return this.#tokens.length - this.#offset; - } - constructor(tokens) { - this.#offset = 0; - this.#tokens = tokens.slice(); - } - clone() { - return new _a(this.#tokens); - } - reset() { - this.#offset = 0; - } - #subTokenString(from = 0, to = 0) { - return new _a(this.#tokens.slice(from, to).map((t) => { - return Object.freeze(Object.assign({}, t, { - match: t.match - from, - linkBack: t.linkBack - from, - linkNext: t.linkNext - from, - })); - })); - } - // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens - popKeyword(allowed) { - const top = this.peek(); - if (top.type !== "KEYWORD" || !allowed.has(top.text)) { - throw new Error(`expected keyword ${top.text}`); - } - return this.pop().text; - } - // Pops and returns the value of the next token if it is `type`; throws if out of tokens - popType(type) { - if (this.peek().type !== type) { - throw new Error(`expected ${type}; got ${JSON.stringify(this.peek())}`); - } - return this.pop().text; - } - // Pops and returns a "(" TOKENS ")" - popParen() { - const top = this.peek(); - if (top.type !== "OPEN_PAREN") { - throw new Error("bad start"); - } - const result = this.#subTokenString(this.#offset + 1, top.match + 1); - this.#offset = top.match + 1; - return result; - } - // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" - popParams() { - const top = this.peek(); - if (top.type !== "OPEN_PAREN") { - throw new Error("bad start"); - } - const result = []; - while (this.#offset < top.match - 1) { - const link = this.peek().linkNext; - result.push(this.#subTokenString(this.#offset + 1, link)); - this.#offset = link; - } - this.#offset = top.match + 1; - return result; - } - // Returns the top Token, throwing if out of tokens - peek() { - if (this.#offset >= this.#tokens.length) { - throw new Error("out-of-bounds"); - } - return this.#tokens[this.#offset]; - } - // Returns the next value, if it is a keyword in `allowed` - peekKeyword(allowed) { - const top = this.peekType("KEYWORD"); - return top != null && allowed.has(top) ? top : null; - } - // Returns the value of the next token if it is `type` - peekType(type) { - if (this.length === 0) { - return null; - } - const top = this.peek(); - return top.type === type ? top.text : null; - } - // Returns the next token; throws if out of tokens - pop() { - const result = this.peek(); - this.#offset++; - return result; - } - toString() { - const tokens = []; - for (let i = this.#offset; i < this.#tokens.length; i++) { - const token = this.#tokens[i]; - tokens.push(`${token.type}:${token.text}`); - } - return ``; - } -} -_a = TokenString; -function lex(text) { - const tokens = []; - const throwError = (message) => { - const token = offset < text.length ? JSON.stringify(text[offset]) : "$EOI"; - throw new Error(`invalid token ${token} at ${offset}: ${message}`); - }; - let brackets = []; - let commas = []; - let offset = 0; - while (offset < text.length) { - // Strip off any leading whitespace - let cur = text.substring(offset); - let match = cur.match(regexWhitespacePrefix); - if (match) { - offset += match[1].length; - cur = text.substring(offset); - } - const token = { - depth: brackets.length, - linkBack: -1, - linkNext: -1, - match: -1, - type: "", - text: "", - offset, - value: -1, - }; - tokens.push(token); - let type = SimpleTokens[cur[0]] || ""; - if (type) { - token.type = type; - token.text = cur[0]; - offset++; - if (type === "OPEN_PAREN") { - brackets.push(tokens.length - 1); - commas.push(tokens.length - 1); - } - else if (type == "CLOSE_PAREN") { - if (brackets.length === 0) { - throwError("no matching open bracket"); - } - token.match = brackets.pop(); - tokens[token.match].match = tokens.length - 1; - token.depth--; - token.linkBack = commas.pop(); - tokens[token.linkBack].linkNext = tokens.length - 1; - } - else if (type === "COMMA") { - token.linkBack = commas.pop(); - tokens[token.linkBack].linkNext = tokens.length - 1; - commas.push(tokens.length - 1); - } - else if (type === "OPEN_BRACKET") { - token.type = "BRACKET"; - } - else if (type === "CLOSE_BRACKET") { - // Remove the CLOSE_BRACKET - let suffix = tokens.pop().text; - if (tokens.length > 0 && tokens[tokens.length - 1].type === "NUMBER") { - const value = tokens.pop().text; - suffix = value + suffix; - tokens[tokens.length - 1].value = - getNumber(value); - } - if (tokens.length === 0 || - tokens[tokens.length - 1].type !== "BRACKET") { - throw new Error("missing opening bracket"); - } - tokens[tokens.length - 1].text += suffix; - } - continue; - } - match = cur.match(regexIdPrefix); - if (match) { - token.text = match[1]; - offset += token.text.length; - if (Keywords.has(token.text)) { - token.type = "KEYWORD"; - continue; - } - if (token.text.match(regexType)) { - token.type = "TYPE"; - continue; - } - token.type = "ID"; - continue; - } - match = cur.match(regexNumberPrefix); - if (match) { - token.text = match[1]; - token.type = "NUMBER"; - offset += token.text.length; - continue; - } - throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`); - } - return new TokenString(tokens.map((t) => Object.freeze(t))); -} -// Check only one of `allowed` is in `set` -function allowSingle(set, allowed) { - let included = []; - for (const key in allowed.keys()) { - if (set.has(key)) { - included.push(key); - } - } - if (included.length > 1) { - throw new Error(`conflicting types: ${included.join(", ")}`); - } -} -// Functions to process a Solidity Signature TokenString from left-to-right for... -// ...the name with an optional type, returning the name -function consumeName(type, tokens) { - if (tokens.peekKeyword(KwTypes)) { - const keyword = tokens.pop().text; - if (keyword !== type) { - throw new Error(`expected ${type}, got ${keyword}`); - } - } - return tokens.popType("ID"); -} -// ...all keywords matching allowed, returning the keywords -function consumeKeywords(tokens, allowed) { - const keywords = new Set(); - while (true) { - const keyword = tokens.peekType("KEYWORD"); - if (keyword == null || (allowed && !allowed.has(keyword))) { - break; - } - tokens.pop(); - if (keywords.has(keyword)) { - throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`); - } - keywords.add(keyword); - } - return Object.freeze(keywords); -} -// ...all visibility keywords, returning the coalesced mutability -function consumeMutability(tokens) { - let modifiers = consumeKeywords(tokens, KwVisib); - // Detect conflicting modifiers - allowSingle(modifiers, setify("constant payable nonpayable".split(" "))); - allowSingle(modifiers, setify("pure view payable nonpayable".split(" "))); - // Process mutability states - if (modifiers.has("view")) { - return "view"; - } - if (modifiers.has("pure")) { - return "pure"; - } - if (modifiers.has("payable")) { - return "payable"; - } - if (modifiers.has("nonpayable")) { - return "nonpayable"; - } - // Process legacy `constant` last - if (modifiers.has("constant")) { - return "view"; - } - return "nonpayable"; -} -// ...a parameter list, returning the ParamType list -function consumeParams(tokens, allowIndexed) { - return tokens.popParams().map((t) => ParamType.from(t, allowIndexed)); -} -// ...a energy limit, returning a BigNumber or null if none -function consumeEnergy(tokens) { - if (tokens.peekType("AT")) { - tokens.pop(); - if (tokens.peekType("NUMBER")) { - return getBigInt(tokens.pop().text); - } - throw new Error("invalid energy"); - } - return null; -} -function consumeEoi(tokens) { - if (tokens.length) { - throw new Error(`unexpected tokens: ${tokens.toString()}`); - } -} -const regexArrayType = new RegExp(/^(.*)\[([0-9]*)\]$/); -function verifyBasicType(type) { - const match = type.match(regexType); - assertArgument(match, "invalid type", "type", type); - if (type === "uint") { - return "uint256"; - } - if (type === "int") { - return "int256"; - } - if (match[2]) { - // bytesXX - const length = parseInt(match[2]); - assertArgument(length !== 0 && length <= 32, "invalid bytes length", "type", type); - } - else if (match[3]) { - // intXX or uintXX - const size = parseInt(match[3]); - assertArgument(size !== 0 && size <= 256 && size % 8 === 0, "invalid numeric width", "type", type); - } - return type; -} -// Make the Fragment constructors effectively private -const _guard$2 = {}; -const internal$1 = Symbol.for("_corebc_internal"); -const ParamTypeInternal = "_ParamTypeInternal"; -const ErrorFragmentInternal = "_ErrorInternal"; -const EventFragmentInternal = "_EventInternal"; -const ConstructorFragmentInternal = "_ConstructorInternal"; -const FallbackFragmentInternal = "_FallbackInternal"; -const FunctionFragmentInternal = "_FunctionInternal"; -const StructFragmentInternal = "_StructInternal"; -/** - * Each input and output of a [[Fragment]] is an Array of **PAramType**. - */ -class ParamType { - /** - * The local name of the parameter (or ``""`` if unbound) - */ - name; - /** - * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, - * ``"uint256[3][]"``) - */ - type; - /** - * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) - */ - baseType; - /** - * True if the parameters is indexed. - * - * For non-indexable types this is ``null``. - */ - indexed; - /** - * The components for the tuple. - * - * For non-tuple types this is ``null``. - */ - components; - /** - * The array length, or ``-1`` for dynamic-lengthed arrays. - * - * For non-array types this is ``null``. - */ - arrayLength; - /** - * The type of each child in the array. - * - * For non-array types this is ``null``. - */ - arrayChildren; - /** - * @private - */ - constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) { - assertPrivate(guard, _guard$2, "ParamType"); - Object.defineProperty(this, internal$1, { value: ParamTypeInternal }); - if (components) { - components = Object.freeze(components.slice()); - } - if (baseType === "array") { - if (arrayLength == null || arrayChildren == null) { - throw new Error(""); - } - } - else if (arrayLength != null || arrayChildren != null) { - throw new Error(""); - } - if (baseType === "tuple") { - if (components == null) { - throw new Error(""); - } - } - else if (components != null) { - throw new Error(""); - } - defineProperties(this, { - name, - type, - baseType, - indexed, - components, - arrayLength, - arrayChildren, - }); - } - /** - * Return a string representation of this type. - * - * For example, - * - * ``sighash" => "(uint256,address)"`` - * - * ``"minimal" => "tuple(uint256,address) indexed"`` - * - * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` - */ - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - let result = { - type: this.baseType === "tuple" ? "tuple" : this.type, - name: this.name || undefined, - }; - if (typeof this.indexed === "boolean") { - result.indexed = this.indexed; - } - if (this.isTuple()) { - result.components = this.components.map((c) => JSON.parse(c.format(format))); - } - return JSON.stringify(result); - } - let result = ""; - // Array - if (this.isArray()) { - result += this.arrayChildren.format(format); - result += `[${this.arrayLength < 0 ? "" : String(this.arrayLength)}]`; - } - else { - if (this.isTuple()) { - if (format !== "sighash") { - result += this.type; - } - result += - "(" + - this.components - .map((comp) => comp.format(format)) - .join(format === "full" ? ", " : ",") + - ")"; - } - else { - result += this.type; - } - } - if (format !== "sighash") { - if (this.indexed === true) { - result += " indexed"; - } - if (format === "full" && this.name) { - result += " " + this.name; - } - } - return result; - } - /* - * Returns true if %%value%% is an Array type. - * - * This provides a type gaurd ensuring that the - * [[arrayChildren]] and [[arrayLength]] are non-null. - */ - //static isArray(value: any): value is { arrayChildren: ParamType, arrayLength: number } { - // return value && (value.baseType === "array") - //} - /** - * Returns true if %%this%% is an Array type. - * - * This provides a type gaurd ensuring that [[arrayChildren]] - * and [[arrayLength]] are non-null. - */ - isArray() { - return this.baseType === "array"; - } - /** - * Returns true if %%this%% is a Tuple type. - * - * This provides a type gaurd ensuring that [[components]] - * is non-null. - */ - isTuple() { - return this.baseType === "tuple"; - } - /** - * Returns true if %%this%% is an Indexable type. - * - * This provides a type gaurd ensuring that [[indexed]] - * is non-null. - */ - isIndexable() { - return this.indexed != null; - } - /** - * Walks the **ParamType** with %%value%%, calling %%process%% - * on each type, destructing the %%value%% recursively. - */ - walk(value, process) { - if (this.isArray()) { - if (!Array.isArray(value)) { - throw new Error("invalid array value"); - } - if (this.arrayLength !== -1 && value.length !== this.arrayLength) { - throw new Error("array is wrong length"); - } - const _this = this; - return value.map((v) => _this.arrayChildren.walk(v, process)); - } - if (this.isTuple()) { - if (!Array.isArray(value)) { - throw new Error("invalid tuple value"); - } - if (value.length !== this.components.length) { - throw new Error("array is wrong length"); - } - const _this = this; - return value.map((v, i) => _this.components[i].walk(v, process)); - } - return process(this.type, value); - } - #walkAsync(promises, value, process, setValue) { - if (this.isArray()) { - if (!Array.isArray(value)) { - throw new Error("invalid array value"); - } - if (this.arrayLength !== -1 && value.length !== this.arrayLength) { - throw new Error("array is wrong length"); - } - const childType = this.arrayChildren; - const result = value.slice(); - result.forEach((value, index) => { - childType.#walkAsync(promises, value, process, (value) => { - result[index] = value; - }); - }); - setValue(result); - return; - } - if (this.isTuple()) { - const components = this.components; - // Convert the object into an array - let result; - if (Array.isArray(value)) { - result = value.slice(); - } - else { - if (value == null || typeof value !== "object") { - throw new Error("invalid tuple value"); - } - result = components.map((param) => { - if (!param.name) { - throw new Error("cannot use object value with unnamed components"); - } - if (!(param.name in value)) { - throw new Error(`missing value for component ${param.name}`); - } - return value[param.name]; - }); - } - if (result.length !== this.components.length) { - throw new Error("array is wrong length"); - } - result.forEach((value, index) => { - components[index].#walkAsync(promises, value, process, (value) => { - result[index] = value; - }); - }); - setValue(result); - return; - } - const result = process(this.type, value); - if (result.then) { - promises.push((async function () { - setValue(await result); - })()); - } - else { - setValue(result); - } - } - /** - * Walks the **ParamType** with %%value%%, asynchronously calling - * %%process%% on each type, destructing the %%value%% recursively. - * - * This can be used to resolve ENS naes by walking and resolving each - * ``"address"`` type. - */ - async walkAsync(value, process) { - const promises = []; - const result = [value]; - this.#walkAsync(promises, value, process, (value) => { - result[0] = value; - }); - if (promises.length) { - await Promise.all(promises); - } - return result[0]; - } - /** - * Creates a new **ParamType** for %%obj%%. - * - * If %%allowIndexed%% then the ``indexed`` keyword is permitted, - * otherwise the ``indexed`` keyword will throw an error. - */ - static from(obj, allowIndexed) { - if (ParamType.isParamType(obj)) { - return obj; - } - if (typeof obj === "string") { - return ParamType.from(lex(obj), allowIndexed); - } - else if (obj instanceof TokenString) { - let type = "", baseType = ""; - let comps = null; - if (consumeKeywords(obj, setify(["tuple"])).has("tuple") || - obj.peekType("OPEN_PAREN")) { - // Tuple - baseType = "tuple"; - comps = obj.popParams().map((t) => ParamType.from(t)); - type = `tuple(${comps.map((c) => c.format()).join(",")})`; - } - else { - // Normal - type = verifyBasicType(obj.popType("TYPE")); - baseType = type; - } - // Check for Array - let arrayChildren = null; - let arrayLength = null; - while (obj.length && obj.peekType("BRACKET")) { - const bracket = obj.pop(); //arrays[i]; - arrayChildren = new ParamType(_guard$2, "", type, baseType, null, comps, arrayLength, arrayChildren); - arrayLength = bracket.value; - type += bracket.text; - baseType = "array"; - comps = null; - } - let indexed = null; - const keywords = consumeKeywords(obj, KwModifiers); - if (keywords.has("indexed")) { - if (!allowIndexed) { - throw new Error(""); - } - indexed = true; - } - const name = obj.peekType("ID") ? obj.pop().text : ""; - if (obj.length) { - throw new Error("leftover tokens"); - } - return new ParamType(_guard$2, name, type, baseType, indexed, comps, arrayLength, arrayChildren); - } - const name = obj.name; - assertArgument(!name || (typeof name === "string" && name.match(regexId)), "invalid name", "obj.name", name); - let indexed = obj.indexed; - if (indexed != null) { - assertArgument(allowIndexed, "parameter cannot be indexed", "obj.indexed", obj.indexed); - indexed = !!indexed; - } - let type = obj.type; - let arrayMatch = type.match(regexArrayType); - if (arrayMatch) { - const arrayLength = parseInt(arrayMatch[2] || "-1"); - const arrayChildren = ParamType.from({ - type: arrayMatch[1], - components: obj.components, - }); - return new ParamType(_guard$2, name || "", type, "array", indexed, null, arrayLength, arrayChildren); - } - if (type === "tuple" || - type.startsWith("tuple(" /* fix: ) */) || - type.startsWith("(" /* fix: ) */)) { - const comps = obj.components != null - ? obj.components.map((c) => ParamType.from(c)) - : null; - const tuple = new ParamType(_guard$2, name || "", type, "tuple", indexed, comps, null, null); - // @TODO: use lexer to validate and normalize type - return tuple; - } - type = verifyBasicType(obj.type); - return new ParamType(_guard$2, name || "", type, type, indexed, null, null, null); - } - /** - * Returns true if %%value%% is a **ParamType**. - */ - static isParamType(value) { - return value && value[internal$1] === ParamTypeInternal; - } -} -/** - * An abstract class to represent An individual fragment from a parse ABI. - */ -class Fragment { - /** - * The type of the fragment. - */ - type; - /** - * The inputs for the fragment. - */ - inputs; - /** - * @private - */ - constructor(guard, type, inputs) { - assertPrivate(guard, _guard$2, "Fragment"); - inputs = Object.freeze(inputs.slice()); - defineProperties(this, { type, inputs }); - } - /** - * Creates a new **Fragment** for %%obj%%, wich can be any supported - * ABI frgament type. - */ - static from(obj) { - if (typeof obj === "string") { - // Try parsing JSON... - try { - Fragment.from(JSON.parse(obj)); - } - catch (e) { } - // ...otherwise, use the human-readable lexer - return Fragment.from(lex(obj)); - } - if (obj instanceof TokenString) { - // Human-readable ABI (already lexed) - const type = obj.peekKeyword(KwTypes); - switch (type) { - case "constructor": - return ConstructorFragment.from(obj); - case "error": - return ErrorFragment.from(obj); - case "event": - return EventFragment.from(obj); - case "fallback": - case "receive": - return FallbackFragment.from(obj); - case "function": - return FunctionFragment.from(obj); - case "struct": - return StructFragment.from(obj); - } - } - else if (typeof obj === "object") { - // JSON ABI - switch (obj.type) { - case "constructor": - return ConstructorFragment.from(obj); - case "error": - return ErrorFragment.from(obj); - case "event": - return EventFragment.from(obj); - case "fallback": - case "receive": - return FallbackFragment.from(obj); - case "function": - return FunctionFragment.from(obj); - case "struct": - return StructFragment.from(obj); - } - assert(false, `unsupported type: ${obj.type}`, "UNSUPPORTED_OPERATION", { - operation: "Fragment.from", - }); - } - assertArgument(false, "unsupported frgament object", "obj", obj); - } - /** - * Returns true if %%value%% is a [[ConstructorFragment]]. - */ - static isConstructor(value) { - return ConstructorFragment.isFragment(value); - } - /** - * Returns true if %%value%% is an [[ErrorFragment]]. - */ - static isError(value) { - return ErrorFragment.isFragment(value); - } - /** - * Returns true if %%value%% is an [[EventFragment]]. - */ - static isEvent(value) { - return EventFragment.isFragment(value); - } - /** - * Returns true if %%value%% is a [[FunctionFragment]]. - */ - static isFunction(value) { - return FunctionFragment.isFragment(value); - } - /** - * Returns true if %%value%% is a [[StructFragment]]. - */ - static isStruct(value) { - return StructFragment.isFragment(value); - } -} -/** - * An abstract class to represent An individual fragment - * which has a name from a parse ABI. - */ -class NamedFragment extends Fragment { - /** - * The name of the fragment. - */ - name; - /** - * @private - */ - constructor(guard, type, name, inputs) { - super(guard, type, inputs); - assertArgument(typeof name === "string" && name.match(regexId), "invalid identifier", "name", name); - inputs = Object.freeze(inputs.slice()); - defineProperties(this, { name }); - } -} -function joinParams(format, params) { - return ("(" + - params.map((p) => p.format(format)).join(format === "full" ? ", " : ",") + - ")"); -} -/** - * A Fragment which represents a //Custom Error//. - */ -class ErrorFragment extends NamedFragment { - /** - * @private - */ - constructor(guard, name, inputs) { - super(guard, "error", name, inputs); - Object.defineProperty(this, internal$1, { value: ErrorFragmentInternal }); - } - /** - * The Custom Error selector. - */ - get selector() { - return id(this.format("sighash")).substring(0, 10); - } - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "error", - name: this.name, - inputs: this.inputs.map((input) => JSON.parse(input.format(format))), - }); - } - const result = []; - if (format !== "sighash") { - result.push("error"); - } - result.push(this.name + joinParams(format, this.inputs)); - return result.join(" "); - } - static from(obj) { - if (ErrorFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return ErrorFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("error", obj); - const inputs = consumeParams(obj); - consumeEoi(obj); - return new ErrorFragment(_guard$2, name, inputs); - } - return new ErrorFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); - } - static isFragment(value) { - return value && value[internal$1] === ErrorFragmentInternal; - } -} -/** - * A Fragment which represents an Event. - */ -class EventFragment extends NamedFragment { - anonymous; - /** - * @private - */ - constructor(guard, name, inputs, anonymous) { - super(guard, "event", name, inputs); - Object.defineProperty(this, internal$1, { value: EventFragmentInternal }); - defineProperties(this, { anonymous }); - } - /** - * The Event topic hash. - */ - get topicHash() { - return id(this.format("sighash")); - } - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "event", - anonymous: this.anonymous, - name: this.name, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - }); - } - const result = []; - if (format !== "sighash") { - result.push("event"); - } - result.push(this.name + joinParams(format, this.inputs)); - if (format !== "sighash" && this.anonymous) { - result.push("anonymous"); - } - return result.join(" "); - } - static getTopicHash(name, params) { - params = (params || []).map((p) => ParamType.from(p)); - const fragment = new EventFragment(_guard$2, name, params, false); - return fragment.topicHash; - } - static from(obj) { - if (EventFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return EventFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("event", obj); - const inputs = consumeParams(obj, true); - const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has("anonymous"); - consumeEoi(obj); - return new EventFragment(_guard$2, name, inputs, anonymous); - } - return new EventFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous); - } - static isFragment(value) { - return value && value[internal$1] === EventFragmentInternal; - } -} -/** - * A Fragment which represents a constructor. - */ -class ConstructorFragment extends Fragment { - payable; - energy; - /** - * @private - */ - constructor(guard, type, inputs, payable, energy) { - super(guard, type, inputs); - Object.defineProperty(this, internal$1, { - value: ConstructorFragmentInternal, - }); - defineProperties(this, { payable, energy }); - } - format(format) { - assert(format != null && format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" }); - if (format === "json") { - return JSON.stringify({ - type: "constructor", - stateMutability: this.payable ? "payable" : "undefined", - payable: this.payable, - energy: this.energy != null ? this.energy : undefined, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - }); - } - const result = [`constructor${joinParams(format, this.inputs)}`]; - result.push(this.payable ? "payable" : "nonpayable"); - if (this.energy != null) { - result.push(`@${this.energy.toString()}`); - } - return result.join(" "); - } - static from(obj) { - if (ConstructorFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return ConstructorFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - consumeKeywords(obj, setify(["constructor"])); - const inputs = consumeParams(obj); - const payable = !!consumeKeywords(obj, setify(["payable"])).has("payable"); - const energy = consumeEnergy(obj); - consumeEoi(obj); - return new ConstructorFragment(_guard$2, "constructor", inputs, payable, energy); - } - return new ConstructorFragment(_guard$2, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, obj.energy != null ? obj.energy : null); - } - static isFragment(value) { - return value && value[internal$1] === ConstructorFragmentInternal; - } -} -/** - * A Fragment which represents a method. - */ -class FallbackFragment extends Fragment { - /** - * If the function can be sent value during invocation. - */ - payable; - constructor(guard, inputs, payable) { - super(guard, "fallback", inputs); - Object.defineProperty(this, internal$1, { value: FallbackFragmentInternal }); - defineProperties(this, { payable }); - } - format(format) { - const type = this.inputs.length === 0 ? "receive" : "fallback"; - if (format === "json") { - const stateMutability = this.payable ? "payable" : "nonpayable"; - return JSON.stringify({ type, stateMutability }); - } - return `${type}()${this.payable ? " payable" : ""}`; - } - static from(obj) { - if (FallbackFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return FallbackFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const errorObj = obj.toString(); - const topIsValid = obj.peekKeyword(setify(["fallback", "receive"])); - assertArgument(topIsValid, "type must be fallback or receive", "obj", errorObj); - const type = obj.popKeyword(setify(["fallback", "receive"])); - // receive() - if (type === "receive") { - const inputs = consumeParams(obj); - assertArgument(inputs.length === 0, `receive cannot have arguments`, "obj.inputs", inputs); - consumeKeywords(obj, setify(["payable"])); - consumeEoi(obj); - return new FallbackFragment(_guard$2, [], true); - } - // fallback() [payable] - // fallback(bytes) [payable] returns (bytes) - let inputs = consumeParams(obj); - if (inputs.length) { - assertArgument(inputs.length === 1 && inputs[0].type === "bytes", "invalid fallback inputs", "obj.inputs", inputs.map((i) => i.format("minimal")).join(", ")); - } - else { - inputs = [ParamType.from("bytes")]; - } - const mutability = consumeMutability(obj); - assertArgument(mutability === "nonpayable" || mutability === "payable", "fallback cannot be constants", "obj.stateMutability", mutability); - if (consumeKeywords(obj, setify(["returns"])).has("returns")) { - const outputs = consumeParams(obj); - assertArgument(outputs.length === 1 && outputs[0].type === "bytes", "invalid fallback outputs", "obj.outputs", outputs.map((i) => i.format("minimal")).join(", ")); - } - consumeEoi(obj); - return new FallbackFragment(_guard$2, inputs, mutability === "payable"); - } - if (obj.type === "receive") { - return new FallbackFragment(_guard$2, [], true); - } - if (obj.type === "fallback") { - const inputs = [ParamType.from("bytes")]; - const payable = obj.stateMutability === "payable"; - return new FallbackFragment(_guard$2, inputs, payable); - } - assertArgument(false, "invalid fallback description", "obj", obj); - } - static isFragment(value) { - return value && value[internal$1] === FallbackFragmentInternal; - } -} -/** - * A Fragment which represents a method. - */ -class FunctionFragment extends NamedFragment { - /** - * If the function is constant (e.g. ``pure`` or ``view`` functions). - */ - constant; - /** - * The returned types for the result of calling this function. - */ - outputs; - /** - * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` - * or ``pure``) - */ - stateMutability; - /** - * If the function can be sent value during invocation. - */ - payable; - /** - * The amount of energy to send when calling this function - */ - energy; - /** - * @private - */ - constructor(guard, name, stateMutability, inputs, outputs, energy) { - super(guard, "function", name, inputs); - Object.defineProperty(this, internal$1, { value: FunctionFragmentInternal }); - outputs = Object.freeze(outputs.slice()); - const constant = stateMutability === "view" || stateMutability === "pure"; - const payable = stateMutability === "payable"; - defineProperties(this, { - constant, - energy, - outputs, - payable, - stateMutability, - }); - } - /** - * The Function selector. - */ - get selector() { - return id(this.format("sighash")).substring(0, 10); - } - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "function", - name: this.name, - constant: this.constant, - stateMutability: this.stateMutability !== "nonpayable" - ? this.stateMutability - : undefined, - payable: this.payable, - energy: this.energy != null ? this.energy : undefined, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - outputs: this.outputs.map((o) => JSON.parse(o.format(format))), - }); - } - const result = []; - if (format !== "sighash") { - result.push("function"); - } - result.push(this.name + joinParams(format, this.inputs)); - if (format !== "sighash") { - if (this.stateMutability !== "nonpayable") { - result.push(this.stateMutability); - } - if (this.outputs && this.outputs.length) { - result.push("returns"); - result.push(joinParams(format, this.outputs)); - } - if (this.energy != null) { - result.push(`@${this.energy.toString()}`); - } - } - return result.join(" "); - } - static getSelector(name, params) { - params = (params || []).map((p) => ParamType.from(p)); - const fragment = new FunctionFragment(_guard$2, name, "view", params, [], null); - return fragment.selector; - } - static from(obj) { - if (FunctionFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return FunctionFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("function", obj); - const inputs = consumeParams(obj); - const mutability = consumeMutability(obj); - let outputs = []; - if (consumeKeywords(obj, setify(["returns"])).has("returns")) { - outputs = consumeParams(obj); - } - const energy = consumeEnergy(obj); - consumeEoi(obj); - return new FunctionFragment(_guard$2, name, mutability, inputs, outputs, energy); - } - let stateMutability = obj.stateMutability; - // Use legacy Solidity ABI logic if stateMutability is missing - if (stateMutability == null) { - stateMutability = "payable"; - if (typeof obj.constant === "boolean") { - stateMutability = "view"; - if (!obj.constant) { - stateMutability = "payable"; - if (typeof obj.payable === "boolean" && !obj.payable) { - stateMutability = "nonpayable"; - } - } - } - else if (typeof obj.payable === "boolean" && !obj.payable) { - stateMutability = "nonpayable"; - } - } - // @TODO: verifyState for stateMutability (e.g. throw if - // payable: false but stateMutability is "nonpayable") - return new FunctionFragment(_guard$2, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], obj.energy != null ? obj.energy : null); - } - static isFragment(value) { - return value && value[internal$1] === FunctionFragmentInternal; - } -} -/** - * A Fragment which represents a structure. - */ -class StructFragment extends NamedFragment { - /** - * @private - */ - constructor(guard, name, inputs) { - super(guard, "struct", name, inputs); - Object.defineProperty(this, internal$1, { value: StructFragmentInternal }); - } - format() { - throw new Error("@TODO"); - } - static from(obj) { - if (typeof obj === "string") { - return StructFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("struct", obj); - const inputs = consumeParams(obj); - consumeEoi(obj); - return new StructFragment(_guard$2, name, inputs); - } - return new StructFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); - } - static isFragment(value) { - return value && value[internal$1] === StructFragmentInternal; - } -} - -/** - * When sending values to or receiving values from a [[Contract]], the - * data is generally encoded using the [ABI standard](link-solc-abi). - * - * The AbiCoder provides a utility to encode values to ABI data and - * decode values from ABI data. - * - * Most of the time, developers should favour the [[Contract]] class, - * which further abstracts a lot of the finer details of ABI data. - * - * @_section api/abi/abi-coder:ABI Encoding - */ -// https://docs.soliditylang.org/en/v0.8.17/control-structures.html -const PanicReasons$1 = new Map(); -PanicReasons$1.set(0x00, "GENERIC_PANIC"); -PanicReasons$1.set(0x01, "ASSERT_FALSE"); -PanicReasons$1.set(0x11, "OVERFLOW"); -PanicReasons$1.set(0x12, "DIVIDE_BY_ZERO"); -PanicReasons$1.set(0x21, "ENUM_RANGE_ERROR"); -PanicReasons$1.set(0x22, "BAD_STORAGE_DATA"); -PanicReasons$1.set(0x31, "STACK_UNDERFLOW"); -PanicReasons$1.set(0x32, "ARRAY_RANGE_ERROR"); -PanicReasons$1.set(0x41, "OUT_OF_MEMORY"); -PanicReasons$1.set(0x51, "UNINITIALIZED_FUNCTION_CALL"); -const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); -const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); -let defaultCoder = null; -function getBuiltinCallException(action, tx, data, abiCoder) { - let message = "missing revert data"; - let reason = null; - const invocation = null; - let revert = null; - if (data) { - message = "execution reverted"; - const bytes = getBytes(data); - data = hexlify(data); - if (bytes.length === 0) { - message += " (no data present; likely require(false) occurred"; - reason = "require(false)"; - } - else if (bytes.length % 32 !== 4) { - message += " (could not decode reason; invalid data length)"; - } - else if (hexlify(bytes.slice(0, 4)) === "0x08c379a0") { - // Error(string) - try { - reason = abiCoder.decode(["string"], bytes.slice(4))[0]; - revert = { - signature: "Error(string)", - name: "Error", - args: [reason], - }; - message += `: ${JSON.stringify(reason)}`; - } - catch (error) { - message += " (could not decode reason; invalid string data)"; - } - } - else if (hexlify(bytes.slice(0, 4)) === "0x4e487b71") { - // Panic(uint256) - try { - const code = Number(abiCoder.decode(["uint256"], bytes.slice(4))[0]); - revert = { - signature: "Panic(uint256)", - name: "Panic", - args: [code], - }; - reason = `Panic due to ${PanicReasons$1.get(code) || "UNKNOWN"}(${code})`; - message += `: ${reason}`; - } - catch (error) { - message += " (could not decode panic code)"; - } - } - else { - message += " (unknown custom error)"; - } - } - const transaction = { - to: tx.to ? getAddress(tx.to) : null, - data: tx.data || "0x", - }; - if (tx.from) { - transaction.from = getAddress(tx.from); - } - return makeError(message, "CALL_EXCEPTION", { - action, - data, - reason, - transaction, - invocation, - revert, - }); -} -/** - * About AbiCoder - */ -class AbiCoder { - #getCoder(param) { - if (param.isArray()) { - return new ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name); - } - if (param.isTuple()) { - return new TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name); - } - switch (param.baseType) { - case "address": - return new AddressCoder(param.name); - case "bool": - return new BooleanCoder(param.name); - case "string": - return new StringCoder(param.name); - case "bytes": - return new BytesCoder(param.name); - case "": - return new NullCoder(param.name); - } - // u?int[0-9]* - let match = param.type.match(paramTypeNumber); - if (match) { - let size = parseInt(match[2] || "256"); - assertArgument(size !== 0 && size <= 256 && size % 8 === 0, "invalid " + match[1] + " bit length", "param", param); - return new NumberCoder(size / 8, match[1] === "int", param.name); - } - // bytes[0-9]+ - match = param.type.match(paramTypeBytes); - if (match) { - let size = parseInt(match[1]); - assertArgument(size !== 0 && size <= 32, "invalid bytes length", "param", param); - return new FixedBytesCoder(size, param.name); - } - assertArgument(false, "invalid type", "type", param.type); - } - /** - * Get the default values for the given %%types%%. - * - * For example, a ``uint`` is by default ``0`` and ``bool`` - * is by default ``false``. - */ - getDefaultValue(types) { - const coders = types.map((type) => this.#getCoder(ParamType.from(type))); - const coder = new TupleCoder(coders, "_"); - return coder.defaultValue(); - } - /** - * Encode the %%values%% as the %%types%% into ABI data. - * - * @returns DataHexstring - */ - encode(types, values) { - assertArgumentCount(values.length, types.length, "types/values length mismatch"); - const coders = types.map((type) => this.#getCoder(ParamType.from(type))); - const coder = new TupleCoder(coders, "_"); - const writer = new Writer(); - coder.encode(writer, values); - return writer.data; - } - /** - * Decode the ABI %%data%% as the %%types%% into values. - * - * If %%loose%% decoding is enabled, then strict padding is - * not enforced. Some older versions of Solidity incorrectly - * padded event data emitted from ``external`` functions. - */ - decode(types, data, loose) { - const coders = types.map((type) => this.#getCoder(ParamType.from(type))); - const coder = new TupleCoder(coders, "_"); - return coder.decode(new Reader(data, loose)); - } - /** - * Returns the shared singleton instance of a default [[AbiCoder]]. - * - * On the first call, the instance is created internally. - */ - static defaultAbiCoder() { - if (defaultCoder == null) { - defaultCoder = new AbiCoder(); - } - return defaultCoder; - } - /** - * Returns an corebc-compatible [[CallExceptionError]] Error for the given - * result %%data%% for the [[CallExceptionAction]] %%action%% against - * the Transaction %%tx%%. - */ - static getBuiltinCallException(action, tx, data) { - return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder()); - } -} - -/** - * About bytes32 strings... - * - * @_docloc: api/utils:Bytes32 Strings - */ -/** - * Encodes %%text%% as a Bytes32 string. - */ -function encodeBytes32String(text) { - // Get the bytes - const bytes = toUtf8Bytes(text); - // Check we have room for null-termination - if (bytes.length > 31) { - throw new Error("bytes32 string must be less than 32 bytes"); - } - // Zero-pad (implicitly null-terminates) - return zeroPadBytes(bytes, 32); -} -/** - * Encodes the Bytes32-encoded %%bytes%% into a string. - */ -function decodeBytes32String(_bytes) { - const data = getBytes(_bytes, "bytes"); - // Must be 32 bytes with a null-termination - if (data.length !== 32) { - throw new Error("invalid bytes32 - not 32 bytes long"); - } - if (data[31] !== 0) { - throw new Error("invalid bytes32 string - no null terminator"); - } - // Find the null termination - let length = 31; - while (data[length - 1] === 0) { - length--; - } - // Determine the string value - return toUtf8String(data.slice(0, length)); -} - -/** - * About Interface - * - * @_subsection api/abi:Interfaces [interfaces] - */ -class LogDescription { - fragment; - name; - signature; - topic; - args; - constructor(fragment, topic, args) { - const name = fragment.name, signature = fragment.format(); - defineProperties(this, { - fragment, - name, - signature, - topic, - args, - }); - } -} -class TransactionDescription { - fragment; - name; - args; - signature; - selector; - value; - constructor(fragment, selector, args, value) { - const name = fragment.name, signature = fragment.format(); - defineProperties(this, { - fragment, - name, - args, - signature, - selector, - value, - }); - } -} -class ErrorDescription { - fragment; - name; - args; - signature; - selector; - constructor(fragment, selector, args) { - const name = fragment.name, signature = fragment.format(); - defineProperties(this, { - fragment, - name, - args, - signature, - selector, - }); - } -} -class Indexed { - hash; - _isIndexed; - static isIndexed(value) { - return !!(value && value._isIndexed); - } - constructor(hash) { - defineProperties(this, { hash, _isIndexed: true }); - } -} -// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require -const PanicReasons = { - "0": "generic panic", - "1": "assert(false)", - "17": "arithmetic overflow", - "18": "division or modulo by zero", - "33": "enum overflow", - "34": "invalid encoded storage byte array accessed", - "49": "out-of-bounds array access; popping on an empty array", - "50": "out-of-bounds access of an array or bytesN", - "65": "out of memory", - "81": "uninitialized function", -}; -const BuiltinErrors = { - "0x08c379a0": { - signature: "Error(string)", - name: "Error", - inputs: ["string"], - reason: (message) => { - return `reverted with reason string ${JSON.stringify(message)}`; - }, - }, - "0x4e487b71": { - signature: "Panic(uint256)", - name: "Panic", - inputs: ["uint256"], - reason: (code) => { - let reason = "unknown panic code"; - if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) { - reason = PanicReasons[code.toString()]; - } - return `reverted with panic code 0x${code.toString(16)} (${reason})`; - }, - }, -}; -/** - * An Interface abstracts many of the low-level details for - * encoding and decoding the data on the blockchain. - * - * An ABI provides information on how to encode data to send to - * a Contract, how to decode the results and events and how to - * interpret revert errors. - * - * The ABI can be specified by [any supported format](InterfaceAbi). - */ -class Interface { - /** - * All the Contract ABI members (i.e. methods, events, errors, etc). - */ - fragments; - /** - * The Contract constructor. - */ - deploy; - /** - * The Fallback method, if any. - */ - fallback; - /** - * If receiving xcb is supported. - */ - receive; - #errors; - #events; - #functions; - // #structs: Map; - #abiCoder; - /** - * Create a new Interface for the %%fragments%%. - */ - constructor(fragments) { - let abi = []; - if (typeof fragments === "string") { - abi = JSON.parse(fragments); - } - else { - abi = fragments; - } - this.#functions = new Map(); - this.#errors = new Map(); - this.#events = new Map(); - // this.#structs = new Map(); - const frags = []; - for (const a of abi) { - try { - frags.push(Fragment.from(a)); - } - catch (error) { - console.log("EE", error); - } - } - defineProperties(this, { - fragments: Object.freeze(frags), - }); - let fallback = null; - let receive = false; - this.#abiCoder = this.getAbiCoder(); - // Add all fragments by their signature - this.fragments.forEach((fragment, index) => { - let bucket; - switch (fragment.type) { - case "constructor": - if (this.deploy) { - console.log("duplicate definition - constructor"); - return; - } - //checkNames(fragment, "input", fragment.inputs); - defineProperties(this, { - deploy: fragment, - }); - return; - case "fallback": - if (fragment.inputs.length === 0) { - receive = true; - } - else { - assertArgument(!fallback || - fragment.payable !== fallback.payable, "conflicting fallback fragments", `fragments[${index}]`, fragment); - fallback = fragment; - receive = fallback.payable; - } - return; - case "function": - //checkNames(fragment, "input", fragment.inputs); - //checkNames(fragment, "output", (fragment).outputs); - bucket = this.#functions; - break; - case "event": - //checkNames(fragment, "input", fragment.inputs); - bucket = this.#events; - break; - case "error": - bucket = this.#errors; - break; - default: - return; - } - // Two identical entries; ignore it - const signature = fragment.format(); - if (bucket.has(signature)) { - return; - } - bucket.set(signature, fragment); - }); - // If we do not have a constructor add a default - if (!this.deploy) { - defineProperties(this, { - deploy: ConstructorFragment.from("constructor()"), - }); - } - defineProperties(this, { fallback, receive }); - } - /** - * Returns the entire Human-Readable ABI, as an array of - * signatures, optionally as %%minimal%% strings, which - * removes parameter names and unneceesary spaces. - */ - format(minimal) { - const format = minimal ? "minimal" : "full"; - const abi = this.fragments.map((f) => f.format(format)); - return abi; - } - /** - * Return the JSON-encoded ABI. This is the format Solidiy - * returns. - */ - formatJson() { - const abi = this.fragments.map((f) => f.format("json")); - // We need to re-bundle the JSON fragments a bit - return JSON.stringify(abi.map((j) => JSON.parse(j))); - } - /** - * The ABI coder that will be used to encode and decode binary - * data. - */ - getAbiCoder() { - return AbiCoder.defaultAbiCoder(); - } - // Find a function definition by any means necessary (unless it is ambiguous) - #getFunction(key, values, forceUnique) { - // Selector - if (isHexString(key)) { - const selector = key.toLowerCase(); - for (const fragment of this.#functions.values()) { - if (selector === fragment.selector) { - return fragment; - } - } - return null; - } - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of this.#functions) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - if (values) { - const lastValue = values.length > 0 ? values[values.length - 1] : null; - let valueLength = values.length; - let allowOptions = true; - if (Typed.isTyped(lastValue) && lastValue.type === "overrides") { - allowOptions = false; - valueLength--; - } - // Remove all matches that don't have a compatible length. The args - // may contain an overrides, so the match may have n or n - 1 parameters - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs.length; - if (inputs !== valueLength && - (!allowOptions || inputs !== valueLength - 1)) { - matching.splice(i, 1); - } - } - // Remove all matches that don't match the Typed signature - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs; - for (let j = 0; j < values.length; j++) { - // Not a typed value - if (!Typed.isTyped(values[j])) { - continue; - } - // We are past the inputs - if (j >= inputs.length) { - if (values[j].type === "overrides") { - continue; - } - matching.splice(i, 1); - break; - } - // Make sure the value type matches the input type - if (values[j].type !== inputs[j].baseType) { - matching.splice(i, 1); - break; - } - } - } - } - // We found a single matching signature with an overrides, but the - // last value is something that cannot possibly be an options - if (matching.length === 1 && - values && - values.length !== matching[0].inputs.length) { - const lastArg = values[values.length - 1]; - if (lastArg == null || - Array.isArray(lastArg) || - typeof lastArg !== "object") { - matching.splice(0, 1); - } - } - if (matching.length === 0) { - return null; - } - if (matching.length > 1 && forceUnique) { - const matchStr = matching - .map((m) => JSON.stringify(m.format())) - .join(", "); - assertArgument(false, `ambiguous function description (i.e. matches ${matchStr})`, "key", key); - } - return matching[0]; - } - // Normalize the signature and lookup the function - const result = this.#functions.get(FunctionFragment.from(key).format()); - if (result) { - return result; - } - return null; - } - /** - * Get the function name for %%key%%, which may be a function selector, - * function name or function signature that belongs to the ABI. - */ - getFunctionName(key) { - const fragment = this.#getFunction(key, null, false); - assertArgument(fragment, "no matching function", "key", key); - return fragment.name; - } - /** - * Returns true if %%key%% (a function selector, function name or - * function signature) is present in the ABI. - * - * In the case of a function name, the name may be ambiguous, so - * accessing the [[FunctionFragment]] may require refinement. - */ - hasFunction(key) { - return !!this.#getFunction(key, null, false); - } - /** - * Get the [[FunctionFragment]] for %%key%%, which may be a function - * selector, function name or function signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple functions match by name. - * - * If the %%key%% and %%values%% do not refine to a single function in - * the ABI, this will throw. - */ - getFunction(key, values) { - return this.#getFunction(key, values || null, true); - } - /** - * Iterate over all functions, calling %%callback%%, sorted by their name. - */ - forEachFunction(callback) { - const names = Array.from(this.#functions.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#functions.get(name), i); - } - } - // Find an event definition by any means necessary (unless it is ambiguous) - #getEvent(key, values, forceUnique) { - // EventTopic - if (isHexString(key)) { - const eventTopic = key.toLowerCase(); - for (const fragment of this.#events.values()) { - if (eventTopic === fragment.topicHash) { - return fragment; - } - } - return null; - } - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of this.#events) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - if (values) { - // Remove all matches that don't have a compatible length. - for (let i = matching.length - 1; i >= 0; i--) { - if (matching[i].inputs.length < values.length) { - matching.splice(i, 1); - } - } - // Remove all matches that don't match the Typed signature - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs; - for (let j = 0; j < values.length; j++) { - // Not a typed value - if (!Typed.isTyped(values[j])) { - continue; - } - // Make sure the value type matches the input type - if (values[j].type !== inputs[j].baseType) { - matching.splice(i, 1); - break; - } - } - } - } - if (matching.length === 0) { - return null; - } - if (matching.length > 1 && forceUnique) { - const matchStr = matching - .map((m) => JSON.stringify(m.format())) - .join(", "); - assertArgument(false, `ambiguous event description (i.e. matches ${matchStr})`, "key", key); - } - return matching[0]; - } - // Normalize the signature and lookup the function - const result = this.#events.get(EventFragment.from(key).format()); - if (result) { - return result; - } - return null; - } - /** - * Get the event name for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - */ - getEventName(key) { - const fragment = this.#getEvent(key, null, false); - assertArgument(fragment, "no matching event", "key", key); - return fragment.name; - } - /** - * Returns true if %%key%% (an event topic hash, event name or - * event signature) is present in the ABI. - * - * In the case of an event name, the name may be ambiguous, so - * accessing the [[EventFragment]] may require refinement. - */ - hasEvent(key) { - return !!this.#getEvent(key, null, false); - } - /** - * Get the [[EventFragment]] for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple events match by name. - * - * If the %%key%% and %%values%% do not refine to a single event in - * the ABI, this will throw. - */ - getEvent(key, values) { - return this.#getEvent(key, values || null, true); - } - /** - * Iterate over all events, calling %%callback%%, sorted by their name. - */ - forEachEvent(callback) { - const names = Array.from(this.#events.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#events.get(name), i); - } - } - /** - * Get the [[ErrorFragment]] for %%key%%, which may be an error - * selector, error name or error signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple errors match by name. - * - * If the %%key%% and %%values%% do not refine to a single error in - * the ABI, this will throw. - */ - getError(key, values) { - if (isHexString(key)) { - const selector = key.toLowerCase(); - if (BuiltinErrors[selector]) { - return ErrorFragment.from(BuiltinErrors[selector].signature); - } - for (const fragment of this.#errors.values()) { - if (selector === fragment.selector) { - return fragment; - } - } - return null; - } - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of this.#errors) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - if (matching.length === 0) { - if (key === "Error") { - return ErrorFragment.from("error Error(string)"); - } - if (key === "Panic") { - return ErrorFragment.from("error Panic(uint256)"); - } - return null; - } - else if (matching.length > 1) { - const matchStr = matching - .map((m) => JSON.stringify(m.format())) - .join(", "); - assertArgument(false, `ambiguous error description (i.e. ${matchStr})`, "name", key); - } - return matching[0]; - } - // Normalize the signature and lookup the function - key = ErrorFragment.from(key).format(); - if (key === "Error(string)") { - return ErrorFragment.from("error Error(string)"); - } - if (key === "Panic(uint256)") { - return ErrorFragment.from("error Panic(uint256)"); - } - const result = this.#errors.get(key); - if (result) { - return result; - } - return null; - } - /** - * Iterate over all errors, calling %%callback%%, sorted by their name. - */ - forEachError(callback) { - const names = Array.from(this.#errors.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#errors.get(name), i); - } - } - // Get the 4-byte selector used by Solidity to identify a function - /* - getSelector(fragment: ErrorFragment | FunctionFragment): string { - if (typeof(fragment) === "string") { - const matches: Array = [ ]; - - try { matches.push(this.getFunction(fragment)); } catch (error) { } - try { matches.push(this.getError(fragment)); } catch (_) { } - - if (matches.length === 0) { - logger.throwArgumentError("unknown fragment", "key", fragment); - } else if (matches.length > 1) { - logger.throwArgumentError("ambiguous fragment matches function and error", "key", fragment); - } - - fragment = matches[0]; - } - - return dataSlice(id(fragment.format()), 0, 4); - } - */ - // Get the 32-byte topic hash used by Solidity to identify an event - /* - getEventTopic(fragment: EventFragment): string { - //if (typeof(fragment) === "string") { fragment = this.getEvent(eventFragment); } - return id(fragment.format()); - } - */ - _decodeParams(params, data) { - return this.#abiCoder.decode(params, data); - } - _encodeParams(params, values) { - return this.#abiCoder.encode(params, values); - } - /** - * Encodes a ``tx.data`` object for deploying the Contract with - * the %%values%% as the constructor arguments. - */ - encodeDeploy(values) { - return this._encodeParams(this.deploy.inputs, values || []); - } - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified error (see [[getError]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeErrorResult(fragment, data) { - if (typeof fragment === "string") { - const f = this.getError(fragment); - assertArgument(f, "unknown error", "fragment", fragment); - fragment = f; - } - assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, "data", data); - return this._decodeParams(fragment.inputs, dataSlice(data, 4)); - } - /** - * Encodes the transaction revert data for a call result that - * reverted from the the Contract with the sepcified %%error%% - * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeErrorResult(fragment, values) { - if (typeof fragment === "string") { - const f = this.getError(fragment); - assertArgument(f, "unknown error", "fragment", fragment); - fragment = f; - } - return concat([ - fragment.selector, - this._encodeParams(fragment.inputs, values || []), - ]); - } - /** - * Decodes the %%data%% from a transaction ``tx.data`` for - * the function specified (see [[getFunction]] for valid values - * for %%fragment%%). - * - * Most developers should prefer the [[parseTransaction]] method - * instead, which will automatically detect the fragment. - */ - decodeFunctionData(fragment, data) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, "data", data); - return this._decodeParams(fragment.inputs, dataSlice(data, 4)); - } - /** - * Encodes the ``tx.data`` for a transaction that calls the function - * specified (see [[getFunction]] for valid values for %%fragment%%) with - * the %%values%%. - */ - encodeFunctionData(fragment, values) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - return concat([ - fragment.selector, - this._encodeParams(fragment.inputs, values || []), - ]); - } - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeFunctionResult(fragment, data) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - let message = "invalid length for result data"; - const bytes = getBytesCopy(data); - if (bytes.length % 32 === 0) { - try { - return this.#abiCoder.decode(fragment.outputs, bytes); - } - catch (error) { - message = "could not decode result data"; - } - } - // Call returned data with no error, but the data is junk - assert(false, message, "BAD_DATA", { - value: hexlify(bytes), - info: { method: fragment.name, signature: fragment.format() }, - }); - } - makeError(_data, tx) { - const data = getBytes(_data, "data"); - const error = AbiCoder.getBuiltinCallException("call", tx, data); - // Not a built-in error; try finding a custom error - const customPrefix = "execution reverted (unknown custom error)"; - if (error.message.startsWith(customPrefix)) { - const selector = hexlify(data.slice(0, 4)); - const ef = this.getError(selector); - if (ef) { - try { - const args = this.#abiCoder.decode(ef.inputs, data.slice(4)); - error.revert = { - name: ef.name, - signature: ef.format(), - args, - }; - error.reason = error.revert.signature; - error.message = `execution reverted: ${error.reason}`; - } - catch (e) { - error.message = `execution reverted (coult not decode custom error)`; - } - } - } - // Add the invocation, if available - const parsed = this.parseTransaction(tx); - if (parsed) { - error.invocation = { - method: parsed.name, - signature: parsed.signature, - args: parsed.args, - }; - } - return error; - } - /** - * Encodes the result data (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values - * for %%fragment%%) with %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeFunctionResult(fragment, values) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - return hexlify(this.#abiCoder.encode(fragment.outputs, values || [])); - } - /* - spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> { - const promises: Array> = [ ]; - const process = function(type: ParamType, value: any): any { - if (type.baseType === "array") { - return descend(type.child - } - if (type. === "address") { - } - }; - - const descend = function (inputs: Array, values: ReadonlyArray) { - if (inputs.length !== values.length) { throw new Error("length mismatch"); } - }; - - const result: Array = [ ]; - values.forEach((value, index) => { - if (value == null) { - topics.push(null); - } else if (param.baseType === "array" || param.baseType === "tuple") { - logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); - } else if (Array.isArray(value)) { - topics.push(value.map((value) => encodeTopic(param, value))); - } else { - topics.push(encodeTopic(param, value)); - } - }); - } - */ - // Create the filter for the event with search criteria (e.g. for xcb_filterLog) - encodeFilterTopics(fragment, values) { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - assertArgument(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - assert(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, "UNEXPECTED_ARGUMENT", { count: values.length, expectedCount: fragment.inputs.length }); - const topics = []; - if (!fragment.anonymous) { - topics.push(fragment.topicHash); - } - // @TODO: Use the coders for this; to properly support tuples, etc. - const encodeTopic = (param, value) => { - if (param.type === "string") { - return id(value); - } - else if (param.type === "bytes") { - return sha256(hexlify(value)); - } - if (param.type === "bool" && typeof value === "boolean") { - value = value ? "0x01" : "0x00"; - } - if (param.type.match(/^u?int/)) { - value = toBeHex(value); - } - // Check addresses are valid - if (param.type === "address") { - this.#abiCoder.encode(["address"], [value]); - } - return zeroPadValue(hexlify(value), 32); - //@TOOD should probably be return toHex(value, 32) - }; - values.forEach((value, index) => { - const param = fragment.inputs[index]; - if (!param.indexed) { - assertArgument(value == null, "cannot filter non-indexed parameters; must be null", "contract." + param.name, value); - return; - } - if (value == null) { - topics.push(null); - } - else if (param.baseType === "array" || param.baseType === "tuple") { - assertArgument(false, "filtering with tuples or arrays not supported", "contract." + param.name, value); - } - else if (Array.isArray(value)) { - topics.push(value.map((value) => encodeTopic(param, value))); - } - else { - topics.push(encodeTopic(param, value)); - } - }); - // Trim off trailing nulls - while (topics.length && topics[topics.length - 1] === null) { - topics.pop(); - } - return topics; - } - encodeEventLog(fragment, values) { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - assertArgument(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - const topics = []; - const dataTypes = []; - const dataValues = []; - if (!fragment.anonymous) { - topics.push(fragment.topicHash); - } - assertArgument(values.length === fragment.inputs.length, "event arguments/values mismatch", "values", values); - fragment.inputs.forEach((param, index) => { - const value = values[index]; - if (param.indexed) { - if (param.type === "string") { - topics.push(id(value)); - } - else if (param.type === "bytes") { - topics.push(sha256(value)); - } - else if (param.baseType === "tuple" || param.baseType === "array") { - // @TODO - throw new Error("not implemented"); - } - else { - topics.push(this.#abiCoder.encode([param.type], [value])); - } - } - else { - dataTypes.push(param); - dataValues.push(value); - } - }); - return { - data: this.#abiCoder.encode(dataTypes, dataValues), - topics: topics, - }; - } - // Decode a filter for the event and the search criteria - decodeEventLog(fragment, data, topics) { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - assertArgument(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - if (topics != null && !fragment.anonymous) { - const eventTopic = fragment.topicHash; - assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, "fragment/topic mismatch", "topics[0]", topics[0]); - topics = topics.slice(1); - } - const indexed = []; - const nonIndexed = []; - const dynamic = []; - fragment.inputs.forEach((param, index) => { - if (param.indexed) { - if (param.type === "string" || - param.type === "bytes" || - param.baseType === "tuple" || - param.baseType === "array") { - indexed.push(ParamType.from({ type: "bytes32", name: param.name })); - dynamic.push(true); - } - else { - indexed.push(param); - dynamic.push(false); - } - } - else { - nonIndexed.push(param); - dynamic.push(false); - } - }); - const resultIndexed = topics != null ? this.#abiCoder.decode(indexed, concat(topics)) : null; - const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true); - //const result: (Array & { [ key: string ]: any }) = [ ]; - const values = []; - const keys = []; - let nonIndexedIndex = 0, indexedIndex = 0; - fragment.inputs.forEach((param, index) => { - let value = null; - if (param.indexed) { - if (resultIndexed == null) { - value = new Indexed(null); - } - else if (dynamic[index]) { - value = new Indexed(resultIndexed[indexedIndex++]); - } - else { - try { - value = resultIndexed[indexedIndex++]; - } - catch (error) { - value = error; - } - } - } - else { - try { - value = resultNonIndexed[nonIndexedIndex++]; - } - catch (error) { - value = error; - } - } - values.push(value); - keys.push(param.name || null); - }); - return Result.fromItems(values, keys); - } - /** - * Parses a transaction, finding the matching function and extracts - * the parameter values along with other useful function details. - * - * If the matching function cannot be found, return null. - */ - parseTransaction(tx) { - const data = getBytes(tx.data, "tx.data"); - const value = getBigInt(tx.value != null ? tx.value : 0, "tx.value"); - const fragment = this.getFunction(hexlify(data.slice(0, 4))); - if (!fragment) { - return null; - } - const args = this.#abiCoder.decode(fragment.inputs, data.slice(4)); - return new TransactionDescription(fragment, fragment.selector, args, value); - } - parseCallResult(data) { - throw new Error("@TODO"); - } - /** - * Parses a receipt log, finding the matching event and extracts - * the parameter values along with other useful event details. - * - * If the matching event cannot be found, returns null. - */ - parseLog(log) { - const fragment = this.getEvent(log.topics[0]); - if (!fragment || fragment.anonymous) { - return null; - } - // @TODO: If anonymous, and the only method, and the input count matches, should we parse? - // Probably not, because just because it is the only event in the ABI does - // not mean we have the full ABI; maybe just a fragment? - return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics)); - } - /** - * Parses a revert data, finding the matching error and extracts - * the parameter values along with other useful error details. - * - * If the matching event cannot be found, returns null. - */ - parseError(data) { - const hexData = hexlify(data); - const fragment = this.getError(dataSlice(hexData, 0, 4)); - if (!fragment) { - return null; - } - const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4)); - return new ErrorDescription(fragment, fragment.selector, args); - } - /** - * Creates a new [[Interface]] from the ABI %%value%%. - * - * The %%value%% may be provided as an existing [[Interface]] object, - * a JSON-encoded ABI or any Human-Readable ABI format. - */ - static from(value) { - // Already an Interface, which is immutable - if (value instanceof Interface) { - return value; - } - // JSON - if (typeof value === "string") { - return new Interface(JSON.parse(value)); - } - // Maybe an interface from an older version, or from a symlinked copy - if (typeof value.format === "function") { - return new Interface(value.format("json")); - } - // Array of fragments - return new Interface(value); - } -} - -const logger = new Logger("contract-address/0.0.1"); -/** - * Returns the address that would result from a ``CREATE`` for %%tx%%. - * - * This can be used to compute the address a contract will be - * deployed to by an EOA when sending a deployment transaction (i.e. - * when the ``to`` address is ``null``). - * - * This can also be used to compute the address a contract will be - * deployed to by a contract, by using the contract's address as the - * ``to`` and the contract's nonce. - * - * @example - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; - * nonce = 5; - * - * getCreateAddress({ from, nonce }); - * //_result: - */ -function getCreateAddress(tx) { - const from = getAddress(tx.from); - const nonce = getBigInt(tx.nonce, "tx.nonce"); - let nonceHex = nonce.toString(16); - if (nonceHex === "0") { - nonceHex = "0x"; - } - else if (nonceHex.length % 2) { - nonceHex = "0x0" + nonceHex; - } - else { - nonceHex = "0x" + nonceHex; - } - return getAddress(from); -} -/** - * Returns the address that would result from a ``CREATE2`` operation - * with the given %%from%%, %%salt%% and %%initCodeHash%%. - - * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. - * - * @example - * // The address of the contract - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" - * - * // The salt - * salt = id("HelloWorld") - * - * getCreate2Address(from, salt, initCodeHash) - * //_result: - */ -function getCreate2Address(from, salt, initCodeHash) { - if (hexDataLength(salt) !== 32) { - logger.throwArgumentError("salt must be 32 bytes", "salt", salt); - } - if (hexDataLength(initCodeHash) !== 32) { - logger.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash); - } - const val = hexDataSlice(sha256(concat(["0xff", getAddress(from), salt, initCodeHash])), 12); - console.log({ "contract-address/74=>should be string": val }); - const prefix = from.substring(2, 4); - const checksum = calculateCheckSum(val, prefix); - return "0x" + prefix + checksum + removeHexPrefix(val); -} - -/** - * Returns true if %%value%% is an object which implements the - * [[Addressable]] interface. - * - * @example: - * // Wallets and AbstractSigner sub-classes - * isAddressable(Wallet.createRandom()) - * //_result: - * - * // Contracts - * contract = new Contract("dai.tokens.corebc.eth", [ ], provider) - * isAddressable(contract) - * //_result: - */ -function isAddressable(value) { - return value && typeof value.getAddress === "function"; -} -/** - * Returns true if %%value%% is a valid address. - * - * @example: - * // Valid address - * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") - * //_result: - * - * // Valid ICAP address - * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") - * //_result: - * - * // Invalid checksum - * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") - * //_result: - * - * // Invalid ICAP checksum - * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") - * //_result: - * - * // Not an address (an ENS name requires a provided and an - * // asynchronous API to access) - * isAddress("ricmoo.eth") - * //_result: - */ -function isAddress(value) { - try { - getAddress(value); - return true; - } - catch (error) { } - return false; -} -async function checkAddress(target, promise) { - const result = await promise; - if (result == null || - result === "0x0000000000000000000000000000000000000000") { - assert(typeof target !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target }); - assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target); - } - return getAddress(result); -} -/** - * Resolves to an address for the %%target%%, which may be any - * supported address type, an [[Addressable]] or a Promise which - * resolves to an address. - * - * If an ENS name is provided, but that name has not been correctly - * configured a [[UnconfiguredNameError]] is thrown. - * - * @example: - * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" - * - * // Addresses are return synchronously - * resolveAddress(addr, provider) - * //_result: - * - * // Address promises are resolved asynchronously - * resolveAddress(Promise.resolve(addr)) - * //_result: - * - * - * // Addressable objects are resolved asynchronously - * contract = new Contract(addr, [ ]) - * resolveAddress(contract, provider) - * //_result: - * - * // Unconfigured ENS names reject - * resolveAddress("nothing-here.ricmoo.eth", provider) - * //_error: - * - * // ENS names require a NameResolver object passed in - * // (notice the provider was omitted) - * resolveAddress("nothing-here.ricmoo.eth") - * //_error: - */ -function resolveAddress(target) { - if (typeof target === "string") { - return getAddress(target); - // assert(resolver != null, "ENS resolution requires a provider", - // "UNSUPPORTED_OPERATION", { operation: "resolveName" }); - // return checkAddress(target, resolver.resolveName(target)); - } - else if (isAddressable(target)) { - return checkAddress(target, target.getAddress()); - } - else if (target && typeof target.then === "function") { - return checkAddress(target, target); - } - assertArgument(false, "unsupported addressable value", "target", target); -} - -const BN_0$2 = BigInt(0); -// ----------------------- -function getValue(value) { - if (value == null) { - return null; - } - return value; -} -function toJson(value) { - if (value == null) { - return null; - } - return value.toString(); -} -// @TODO? implements Required -/** - * A **FeeData** wraps all the fee-related values associated with - * the network. - */ -class FeeData { - /** - * The energy price for legacy networks. - */ - energyPrice; - constructor(energyPrice) { - defineProperties(this, { - energyPrice: getValue(energyPrice), - }); - } - /** - * Returns a JSON-friendly value. - */ - toJSON() { - const { energyPrice } = this; - return { - _type: "FeeData", - energyPrice: toJson(energyPrice), - }; - } -} -function copyRequest(req) { - const result = {}; - // These could be addresses, ENS names or Addressables - if (req.to) { - result.to = req.to; - } - if (req.from) { - result.from = req.from; - } - if (req.data) { - result.data = hexlify(req.data); - } - const bigIntKeys = "networkId,energyLimit,energyPrice,value".split(/,/); - for (const key of bigIntKeys) { - if (!(key in req) || req[key] == null) { - continue; - } - result[key] = getBigInt(req[key], `request.${key}`); - } - const numberKeys = "type,nonce".split(/,/); - for (const key of numberKeys) { - if (!(key in req) || req[key] == null) { - continue; - } - result[key] = getNumber(req[key], `request.${key}`); - } - if ("blockTag" in req) { - result.blockTag = req.blockTag; - } - if ("enableCcipRead" in req) { - result.enableCcipReadEnabled = !!req.enableCcipRead; - } - if ("customData" in req) { - result.customData = req.customData; - } - return result; -} -/** - * A **Block** represents the data associated with a full block on - * Core. - */ -class Block { - /** - * The provider connected to the block used to fetch additional details - * if necessary. - */ - provider; - /** - * The block number, sometimes called the block height. This is a - * sequential number that is one higher than the parent block. - */ - number; - /** - * The block hash. - */ - hash; - /** - * The timestamp for this block, which is the number of seconds since - * epoch that this block was included. - */ - timestamp; - /** - * The block hash of the parent block. - */ - parentHash; - /** - * The nonce. - * - * On legacy networks, this is the random number inserted which - * permitted the difficulty target to be reached. - */ - nonce; - /** - * The difficulty target. - * - * On legacy networks, this is the proof-of-work target required - * for a block to meet the protocol rules to be included. - * - * On modern networks, this is a random number arrived at using - * randao. @TODO: Find links? - */ - difficulty; - /** - * The total energy limit for this block. - */ - energyLimit; - /** - * The total energy used in this block. - */ - energyUsed; - /** - * The miner coinbase address, wihch receives any subsidies for - * including this block. - */ - miner; - /** - * Any extra data the validator wished to include. - */ - extraData; - /** - * The base fee per energy that all transactions in this block were - * charged. - * - * This adjusts after each block, depending on how congested the network - * is. - */ - baseFeePerEnergy; - #transactions; - /** - * Create a new **Block** object. - * - * This should generally not be necessary as the unless implementing a - * low-level library. - */ - constructor(block, provider) { - this.#transactions = block.transactions.map((tx) => { - if (typeof tx !== "string") { - return new TransactionResponse(tx, provider); - } - return tx; - }); - defineProperties(this, { - provider, - hash: getValue(block.hash), - number: block.number, - timestamp: block.timestamp, - parentHash: block.parentHash, - nonce: block.nonce, - difficulty: block.difficulty, - energyLimit: block.energyLimit, - energyUsed: block.energyUsed, - miner: block.miner, - extraData: block.extraData, - baseFeePerEnergy: getValue(block.baseFeePerEnergy), - }); - } - /** - * Returns the list of transaction hashes. - */ - get transactions() { - return this.#transactions.map((tx) => { - if (typeof tx === "string") { - return tx; - } - return tx.hash; - }); - } - /** - * Returns the complete transactions for blocks which - * prefetched them, by passing ``true`` to %%prefetchTxs%% - * into [[provider_getBlock]]. - */ - get prefetchedTransactions() { - const txs = this.#transactions.slice(); - // Doesn't matter... - if (txs.length === 0) { - return []; - } - // Make sure we prefetched the transactions - assert(typeof txs[0] === "object", "transactions were not prefetched with block request", "UNSUPPORTED_OPERATION", { - operation: "transactionResponses()", - }); - return txs; - } - /** - * Returns a JSON-friendly value. - */ - toJSON() { - const { baseFeePerEnergy, difficulty, extraData, energyLimit, energyUsed, hash, miner, nonce, number, parentHash, timestamp, transactions, } = this; - return { - _type: "Block", - baseFeePerEnergy: toJson(baseFeePerEnergy), - difficulty: toJson(difficulty), - extraData, - energyLimit: toJson(energyLimit), - energyUsed: toJson(energyUsed), - hash, - miner, - nonce, - number, - parentHash, - timestamp, - transactions, - }; - } - [Symbol.iterator]() { - let index = 0; - const txs = this.transactions; - return { - next: () => { - if (index < this.length) { - return { - value: txs[index++], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - /** - * The number of transactions in this block. - */ - get length() { - return this.#transactions.length; - } - /** - * The [[link-js-date]] this block was included at. - */ - get date() { - if (this.timestamp == null) { - return null; - } - return new Date(this.timestamp * 1000); - } - /** - * Get the transaction at %%indexe%% within this block. - */ - async getTransaction(indexOrHash) { - // Find the internal value by its index or hash - let tx = undefined; - if (typeof indexOrHash === "number") { - tx = this.#transactions[indexOrHash]; - } - else { - const hash = indexOrHash.toLowerCase(); - for (const v of this.#transactions) { - if (typeof v === "string") { - if (v !== hash) { - continue; - } - tx = v; - break; - } - else { - if (v.hash === hash) { - continue; - } - tx = v; - break; - } - } - } - if (tx == null) { - throw new Error("no such tx"); - } - if (typeof tx === "string") { - return await this.provider.getTransaction(tx); - } - else { - return tx; - } - } - getPrefetchedTransaction(indexOrHash) { - const txs = this.prefetchedTransactions; - if (typeof indexOrHash === "number") { - return txs[indexOrHash]; - } - indexOrHash = indexOrHash.toLowerCase(); - for (const tx of txs) { - if (tx.hash === indexOrHash) { - return tx; - } - } - assertArgument(false, "no matching transaction", "indexOrHash", indexOrHash); - } - /** - * Has this block been mined. - * - * If true, the block has been typed-gaurded that all mined - * properties are non-null. - */ - isMined() { - return !!this.hash; - } - /** - * - */ - isLondon() { - return !!this.baseFeePerEnergy; - } - orphanedEvent() { - if (!this.isMined()) { - throw new Error(""); - } - return createOrphanedBlockFilter(this); - } -} -////////////////////// -// Log -class Log { - provider; - transactionHash; - blockHash; - blockNumber; - removed; - address; - data; - topics; - index; - transactionIndex; - constructor(log, provider) { - this.provider = provider; - const topics = Object.freeze(log.topics.slice()); - defineProperties(this, { - transactionHash: log.transactionHash, - blockHash: log.blockHash, - blockNumber: log.blockNumber, - removed: log.removed, - address: log.address, - data: log.data, - topics, - index: log.index, - transactionIndex: log.transactionIndex, - }); - } - toJSON() { - const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex, } = this; - return { - _type: "log", - address, - blockHash, - blockNumber, - data, - index, - removed, - topics, - transactionHash, - transactionIndex, - }; - } - async getBlock() { - const block = await this.provider.getBlock(this.blockHash); - assert(!!block, "failed to find transaction", "UNKNOWN_ERROR", {}); - return block; - } - async getTransaction() { - const tx = await this.provider.getTransaction(this.transactionHash); - assert(!!tx, "failed to find transaction", "UNKNOWN_ERROR", {}); - return tx; - } - async getTransactionReceipt() { - const receipt = await this.provider.getTransactionReceipt(this.transactionHash); - assert(!!receipt, "failed to find transaction receipt", "UNKNOWN_ERROR", {}); - return receipt; - } - removedEvent() { - return createRemovedLogFilter(this); - } -} -////////////////////// -// Transaction Receipt -/* -export interface LegacyTransactionReceipt { - byzantium: false; - status: null; - root: string; -} - -export interface ByzantiumTransactionReceipt { - byzantium: true; - status: number; - root: null; -} -*/ -class TransactionReceipt { - provider; - to; - from; - contractAddress; - hash; - index; - blockHash; - blockNumber; - logsBloom; - energyUsed; - cumulativeEnergyUsed; - energyPrice; - type; - //readonly byzantium!: boolean; - status; - root; - #logs; - constructor(tx, provider) { - this.#logs = Object.freeze(tx.logs.map((log) => { - return new Log(log, provider); - })); - defineProperties(this, { - provider, - to: tx.to, - from: tx.from, - contractAddress: tx.contractAddress, - hash: tx.hash, - index: tx.index, - blockHash: tx.blockHash, - blockNumber: tx.blockNumber, - logsBloom: tx.logsBloom, - energyUsed: tx.energyUsed, - cumulativeEnergyUsed: tx.cumulativeEnergyUsed, - energyPrice: (tx.effectiveEnergyPrice || tx.energyPrice), - //byzantium: tx.byzantium, - status: tx.status, - root: tx.root, - }); - } - get logs() { - return this.#logs; - } - toJSON() { - const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium, - status, root, } = this; - return { - _type: "TransactionReceipt", - blockHash, - blockNumber, - //byzantium, - contractAddress, - cumulativeEnergyUsed: toJson(this.cumulativeEnergyUsed), - from, - energyPrice: toJson(this.energyPrice), - energyUsed: toJson(this.energyUsed), - hash, - index, - logs, - logsBloom, - root, - status, - to, - }; - } - get length() { - return this.logs.length; - } - [Symbol.iterator]() { - let index = 0; - return { - next: () => { - if (index < this.length) { - return { value: this.logs[index++], done: false }; - } - return { value: undefined, done: true }; - }, - }; - } - get fee() { - return this.energyUsed * this.energyPrice; - } - async getBlock() { - const block = await this.provider.getBlock(this.blockHash); - if (block == null) { - throw new Error("TODO"); - } - return block; - } - async getTransaction() { - const tx = await this.provider.getTransaction(this.hash); - if (tx == null) { - throw new Error("TODO"); - } - return tx; - } - async getResult() { - return await this.provider.getTransactionResult(this.hash); - } - async confirmations() { - return (await this.provider.getBlockNumber()) - this.blockNumber + 1; - } - removedEvent() { - return createRemovedTransactionFilter(this); - } - reorderedEvent(other) { - assert(!other || other.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }); - return createReorderedTransactionFilter(this, other); - } -} -/* -export type ReplacementDetectionSetup = { - to: string; - from: string; - value: bigint; - data: string; - nonce: number; - block: number; -}; -*/ -class TransactionResponse { - /** - * The provider this is connected to, which will influence how its - * methods will resolve its async inspection methods. - */ - provider; - /** - * The block number of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - blockNumber; - /** - * The blockHash of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - blockHash; - /** - * The index within the block that this transaction resides at. - */ - index; - /** - * The transaction hash. - */ - hash; - /** - * The [[link-eip-2718]] transaction envelope type. This is - * ``0`` for legacy transactions types. - */ - type; - /** - * The receiver of this transaction. - * - * If ``null``, then the transaction is an initcode transaction. - * This means the result of executing the [[data]] will be deployed - * as a new contract on chain (assuming it does not revert) and the - * address may be computed using [[getCreateAddress]]. - */ - to; - /** - * The sender of this transaction. It is implicitly computed - * from the transaction pre-image hash (as the digest) and the - * [[signature]] using ecrecover. - */ - from; - /** - * The nonce, which is used to prevent replay attacks and offer - * a method to ensure transactions from a given sender are explicitly - * ordered. - * - * When sending a transaction, this must be equal to the number of - * transactions ever sent by [[from]]. - */ - nonce; - /** - * The maximum units of energy this transaction can consume. If execution - * exceeds this, the entries transaction is reverted and the sender - * is charged for the full amount, despite not state changes being made. - */ - energyLimit; - /** - * The energy price can have various values, depending on the network. - * - * In modern networks, for transactions that are included this is - * the //effective energy price// (the fee per energy that was actually - * charged), while for transactions that have not been included yet - * is the [[maxFeePerEnergy]]. - * - * For legacy transactions, or transactions on legacy networks, this - * is the fee that will be charged per unit of energy the transaction - * consumes. - */ - energyPrice; - /** - * The data. - */ - data; - /** - * The value, in ore. Use [[formatXCB]] to format this value - * as xcb. - */ - value; - /** - * The chain ID. - */ - networkId; - /** - * The signature. - */ - signature; - #startBlock; - /** - * Create a new TransactionResponse with %%tx%% parameters - * connected to %%provider%%. - */ - constructor(tx, provider) { - this.provider = provider; - this.blockNumber = tx.blockNumber != null ? tx.blockNumber : null; - this.blockHash = tx.blockHash != null ? tx.blockHash : null; - this.hash = tx.hash; - this.index = tx.index; - this.from = tx.from; - this.to = tx.to || null; - this.energyLimit = tx.energyLimit; - this.nonce = tx.nonce; - this.data = tx.data; - this.value = tx.value; - this.energyPrice = tx.energyPrice; - this.networkId = tx.networkId; - this.signature = tx.signature; - this.#startBlock = -1; - } - /** - * Returns a JSON representation of this transaction. - */ - toJSON() { - const { index, hash, type, to, from, nonce, data, signature } = this; - return { - _type: "TransactionReceipt", - networkId: toJson(this.networkId), - data, - from, - energyLimit: toJson(this.energyLimit), - energyPrice: toJson(this.energyPrice), - hash, - nonce, - signature, - to, - index, - type, - value: toJson(this.value), - }; - } - /** - * Resolves to the Block that this transaction was included in. - * - * This will return null if the transaction has not been included yet. - */ - async getBlock() { - let blockNumber = this.blockNumber; - if (blockNumber == null) { - const tx = await this.getTransaction(); - if (tx) { - blockNumber = tx.blockNumber; - } - } - if (blockNumber == null) { - return null; - } - const block = this.provider.getBlock(blockNumber); - if (block == null) { - throw new Error("TODO"); - } - return block; - } - /** - * Resolves to this transaction being re-requested from the - * provider. This can be used if you have an unmined transaction - * and wish to get an up-to-date populated instance. - */ - async getTransaction() { - return this.provider.getTransaction(this.hash); - } - /** - * Resolves once this transaction has been mined and has - * %%confirms%% blocks including it (default: ``1``) with an - * optional %%timeout%%. - * - * This can resolve to ``null`` only if %%confirms%% is ``0`` - * and the transaction has not been mined, otherwise this will - * wait until enough confirmations have completed. - */ - async wait(_confirms, _timeout) { - const confirms = _confirms == null ? 1 : _confirms; - const timeout = _timeout == null ? 0 : _timeout; - let startBlock = this.#startBlock; - let nextScan = -1; - let stopScanning = startBlock === -1 ? true : false; - const checkReplacement = async () => { - // Get the current transaction count for this sender - if (stopScanning) { - return null; - } - const { blockNumber, nonce } = await resolveProperties({ - blockNumber: this.provider.getBlockNumber(), - nonce: this.provider.getTransactionCount(this.from), - }); - // No transaction or our nonce has not been mined yet; but we - // can start scanning later when we do start - if (nonce < this.nonce) { - startBlock = blockNumber; - return; - } - // We were mined; no replacement - if (stopScanning) { - return null; - } - const mined = await this.getTransaction(); - if (mined && mined.blockNumber != null) { - return; - } - // We were replaced; start scanning for that transaction - // Starting to scan; look back a few extra blocks for safety - if (nextScan === -1) { - nextScan = startBlock - 3; - if (nextScan < this.#startBlock) { - nextScan = this.#startBlock; - } - } - while (nextScan <= blockNumber) { - // Get the next block to scan - if (stopScanning) { - return null; - } - const block = await this.provider.getBlock(nextScan, true); - // This should not happen; but we'll try again shortly - if (block == null) { - return; - } - // We were mined; no replacement - for (const hash of block) { - if (hash === this.hash) { - return; - } - } - // Search for the transaction that replaced us - for (let i = 0; i < block.length; i++) { - const tx = await block.getTransaction(i); - if (tx.from === this.from && tx.nonce === this.nonce) { - // Get the receipt - if (stopScanning) { - return null; - } - const receipt = await this.provider.getTransactionReceipt(tx.hash); - // This should not happen; but we'll try again shortly - if (receipt == null) { - return; - } - // We will retry this on the next block (this case could be optimized) - if (blockNumber - receipt.blockNumber + 1 < confirms) { - return; - } - // The reason we were replaced - let reason = "replaced"; - if (tx.data === this.data && - tx.to === this.to && - tx.value === this.value) { - reason = "repriced"; - } - else if (tx.data === "0x" && - tx.from === tx.to && - tx.value === BN_0$2) { - reason = "cancelled"; - } - assert(false, "transaction was replaced", "TRANSACTION_REPLACED", { - cancelled: reason === "replaced" || reason === "cancelled", - reason, - replacement: tx.replaceableTransaction(startBlock), - hash: tx.hash, - receipt, - }); - } - } - nextScan++; - } - return; - }; - const receipt = await this.provider.getTransactionReceipt(this.hash); - if (receipt) { - if ((await receipt.confirmations()) >= confirms) { - return receipt; - } - } - else { - // Check for a replacement; throws if a replacement was found - await checkReplacement(); - // Allow null only when the confirms is 0 - if (confirms === 0) { - return null; - } - } - const waiter = new Promise((resolve, reject) => { - // List of things to cancel when we have a result (one way or the other) - const cancellers = []; - const cancel = () => { - cancellers.forEach((c) => c()); - }; - // On cancel, stop scanning for replacements - cancellers.push(() => { - stopScanning = true; - }); - // Set up any timeout requested - if (timeout > 0) { - const timer = setTimeout(() => { - cancel(); - reject(makeError("wait for transaction timeout", "TIMEOUT")); - }, timeout); - cancellers.push(() => { - clearTimeout(timer); - }); - } - const txListener = async (receipt) => { - // Done; return it! - if ((await receipt.confirmations()) >= confirms) { - cancel(); - resolve(receipt); - } - }; - cancellers.push(() => { - this.provider.off(this.hash, txListener); - }); - this.provider.on(this.hash, txListener); - // We support replacement detection; start checking - if (startBlock >= 0) { - const replaceListener = async () => { - try { - // Check for a replacement; this throws only if one is found - await checkReplacement(); - } - catch (error) { - // We were replaced (with enough confirms); re-throw the error - if (isError(error, "TRANSACTION_REPLACED")) { - cancel(); - reject(error); - return; - } - } - // Rescheudle a check on the next block - if (!stopScanning) { - this.provider.once("block", replaceListener); - } - }; - cancellers.push(() => { - this.provider.off("block", replaceListener); - }); - this.provider.once("block", replaceListener); - } - }); - return await waiter; - } - /** - * Returns ``true`` if this transaction has been included. - * - * This is effective only as of the time the TransactionResponse - * was instantiated. To get up-to-date information, use - * [[getTransaction]]. - * - * This provides a Type Guard that this transaction will have - * non-null property values for properties that are null for - * unmined transactions. - */ - isMined() { - return this.blockHash != null; - } - /** - * Returns true if the transaction is a legacy (i.e. ``type == 0``) - * transaction. - * - * This provides a Type Guard that this transaction will have - * the ``null``-ness for hardfork-specific properties set correctly. - */ - isLegacy() { - return this.type === 0; - } - /** - * Returns a filter which can be used to listen for orphan events - * that evict this transaction. - */ - removedEvent() { - assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - return createRemovedTransactionFilter(this); - } - /** - * Returns a filter which can be used to listen for orphan events - * that re-order this event against %%other%%. - */ - reorderedEvent(other) { - assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - assert(!other || other.isMined(), "unmined 'other' transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - return createReorderedTransactionFilter(this, other); - } - /** - * Returns a new TransactionResponse instance which has the ability to - * detect (and throw an error) if the transaction is replaced, which - * will begin scanning at %%startBlock%%. - * - * This should generally not be used by developers and is intended - * primarily for internal use. Setting an incorrect %%startBlock%% can - * have devastating performance consequences if used incorrectly. - */ - replaceableTransaction(startBlock) { - assertArgument(Number.isInteger(startBlock) && startBlock >= 0, "invalid startBlock", "startBlock", startBlock); - const tx = new TransactionResponse(this, this.provider); - tx.#startBlock = startBlock; - return tx; - } -} -function createOrphanedBlockFilter(block) { - return { orphan: "drop-block", hash: block.hash, number: block.number }; -} -function createReorderedTransactionFilter(tx, other) { - return { orphan: "reorder-transaction", tx, other }; -} -function createRemovedTransactionFilter(tx) { - return { orphan: "drop-transaction", tx }; -} -function createRemovedLogFilter(log) { - return { - orphan: "drop-log", - log: { - transactionHash: log.transactionHash, - blockHash: log.blockHash, - blockNumber: log.blockNumber, - address: log.address, - data: log.data, - topics: Object.freeze(log.topics.slice()), - index: log.index, - }, - }; -} - -class EventLog extends Log { - interface; - fragment; - args; - constructor(log, iface, fragment) { - super(log, log.provider); - const args = iface.decodeEventLog(fragment, log.data, log.topics); - defineProperties(this, { args, fragment, interface: iface }); - } - get eventName() { - return this.fragment.name; - } - get eventSignature() { - return this.fragment.format(); - } -} -class ContractTransactionReceipt extends TransactionReceipt { - #iface; - constructor(iface, provider, tx) { - super(tx, provider); - this.#iface = iface; - } - get logs() { - return super.logs.map((log) => { - const fragment = log.topics.length - ? this.#iface.getEvent(log.topics[0]) - : null; - if (fragment) { - return new EventLog(log, this.#iface, fragment); - } - else { - return log; - } - }); - } -} -class ContractTransactionResponse extends TransactionResponse { - #iface; - constructor(iface, provider, tx) { - super(tx, provider); - this.#iface = iface; - } - async wait(confirms) { - const receipt = await super.wait(); - if (receipt == null) { - return null; - } - return new ContractTransactionReceipt(this.#iface, this.provider, receipt); - } -} -class ContractUnknownEventPayload extends EventPayload { - log; - constructor(contract, listener, filter, log) { - super(contract, listener, filter); - defineProperties(this, { log }); - } - async getBlock() { - return await this.log.getBlock(); - } - async getTransaction() { - return await this.log.getTransaction(); - } - async getTransactionReceipt() { - return await this.log.getTransactionReceipt(); - } -} -class ContractEventPayload extends ContractUnknownEventPayload { - constructor(contract, listener, filter, fragment, _log) { - super(contract, listener, filter, new EventLog(_log, contract.interface, fragment)); - const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics); - defineProperties(this, { args, fragment }); - } - get eventName() { - return this.fragment.name; - } - get eventSignature() { - return this.fragment.format(); - } -} - -const BN_0$1 = BigInt(0); -function canCall(value) { - return value && typeof value.call === "function"; -} -function canEstimate(value) { - return value && typeof value.estimateEnergy === "function"; -} -function canResolve(value) { - return value && typeof value.resolveName === "function"; -} -function canSend(value) { - return value && typeof value.sendTransaction === "function"; -} -class PreparedTopicFilter { - #filter; - fragment; - constructor(contract, fragment, args) { - defineProperties(this, { fragment }); - if (fragment.inputs.length < args.length) { - throw new Error("too many arguments"); - } - // Recursively descend into args and resolve any addresses - this.#filter = (async function () { - const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => { - const arg = args[index]; - if (arg == null) { - return null; - } - return param.walkAsync(args[index], (type, value) => { - if (type === "address") { - return resolveAddress(value); - } - return value; - }); - })); - return contract.interface.encodeFilterTopics(fragment, resolvedArgs); - })(); - } - getTopicFilter() { - return this.#filter; - } -} -// A = Arguments passed in as a tuple -// R = The result type of the call (i.e. if only one return type, -// the qualified type, otherwise Result) -// D = The type the default call will return (i.e. R for view/pure, -// TransactionResponse otherwise) -//export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> { -function getRunner(value, feature) { - if (value == null) { - return null; - } - if (typeof value[feature] === "function") { - return value; - } - if (value.provider && typeof value.provider[feature] === "function") { - return value.provider; - } - return null; -} -function getProvider(value) { - if (value == null) { - return null; - } - return value.provider || null; -} -/** - * @_ignore: - */ -async function copyOverrides(arg, allowed) { - // Create a shallow copy (we'll deep-ify anything needed during normalizing) - const overrides = copyRequest(Typed.dereference(arg, "overrides")); - assertArgument(overrides.to == null || (allowed || []).indexOf("to") >= 0, "cannot override to", "overrides.to", overrides.to); - assertArgument(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); - // Resolve any from - if (overrides.from) { - overrides.from = await resolveAddress(overrides.from); - } - return overrides; -} -/** - * @_ignore: - */ -async function resolveArgs(_runner, inputs, args) { - // Recursively descend into args and resolve any addresses - return await Promise.all(inputs.map((param, index) => { - return param.walkAsync(args[index], (type, value) => { - value = Typed.dereference(value, type); - if (type === "address") { - return resolveAddress(value); - } - return value; - }); - })); -} -function buildWrappedFallback(contract) { - const populateTransaction = async function (overrides) { - // If an overrides was passed in, copy it and normalize the values - const tx = (await copyOverrides(overrides, ["data"])); - tx.to = await contract.getAddress(); - const iface = contract.interface; - // Only allow payable contracts to set non-zero value - const payable = iface.receive || (iface.fallback && iface.fallback.payable); - assertArgument(payable || (tx.value || BN_0$1) === BN_0$1, "cannot send value to non-payable contract", "overrides.value", tx.value); - // Only allow fallback contracts to set non-empty data - assertArgument(iface.fallback || (tx.data || "0x") === "0x", "cannot send data to receive-only contract", "overrides.data", tx.data); - return tx; - }; - const staticCall = async function (overrides) { - const runner = getRunner(contract.runner, "call"); - assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); - const tx = await populateTransaction(overrides); - try { - return await runner.call(tx); - } - catch (error) { - if (isCallException(error) && error.data) { - throw contract.interface.makeError(error.data, tx); - } - throw error; - } - }; - const send = async function (overrides) { - const runner = contract.runner; - assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); - const tx = await runner.sendTransaction(await populateTransaction(overrides)); - const provider = getProvider(contract.runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - return new ContractTransactionResponse(contract.interface, provider, tx); - }; - const estimateEnergy = async function (overrides) { - const runner = getRunner(contract.runner, "estimateEnergy"); - assert(canEstimate(runner), "contract runner does not support energy estimation", "UNSUPPORTED_OPERATION", { operation: "estimateEnergy" }); - return await runner.estimateEnergy(await populateTransaction(overrides)); - }; - const method = async (overrides) => { - return await send(overrides); - }; - defineProperties(method, { - _contract: contract, - estimateEnergy, - populateTransaction, - send, - staticCall, - }); - return method; -} -function buildWrappedMethod(contract, key) { - const getFragment = function (...args) { - const fragment = contract.interface.getFunction(key, args); - assert(fragment, "no matching fragment in getFragment", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }; - const populateTransaction = async function (...args) { - const fragment = getFragment(...args); - // If an overrides was passed in, copy it and normalize the values - let overrides = {}; - if (fragment.inputs.length + 1 === args.length) { - overrides = await copyOverrides(args.pop()); - } - if (fragment.inputs.length !== args.length) { - throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); - } - const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args); - return Object.assign({}, overrides, await resolveProperties({ - to: contract.getAddress(), - data: contract.interface.encodeFunctionData(fragment, resolvedArgs), - })); - }; - const staticCall = async function (...args) { - const result = await staticCallResult(...args); - if (result.length === 1) { - return result[0]; - } - return result; - }; - const send = async function (...args) { - const runner = contract.runner; - assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); - const tx = await runner.sendTransaction(await populateTransaction(...args)); - const provider = getProvider(contract.runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - return new ContractTransactionResponse(contract.interface, provider, tx); - }; - const estimateEnergy = async function (...args) { - const runner = getRunner(contract.runner, "estimateEnergy"); - assert(canEstimate(runner), "contract runner does not support energy estimation", "UNSUPPORTED_OPERATION", { operation: "estimateEnergy" }); - return await runner.estimateEnergy(await populateTransaction(...args)); - }; - const staticCallResult = async function (...args) { - const runner = getRunner(contract.runner, "call"); - assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); - const tx = await populateTransaction(...args); - let result = "0x"; - try { - result = await runner.call(tx); - } - catch (error) { - if (isCallException(error) && error.data) { - throw contract.interface.makeError(error.data, tx); - } - throw error; - } - const fragment = getFragment(...args); - return contract.interface.decodeFunctionResult(fragment, result); - }; - const method = async (...args) => { - const fragment = getFragment(...args); - if (fragment.constant) { - return await staticCall(...args); - } - return await send(...args); - }; - defineProperties(method, { - name: contract.interface.getFunctionName(key), - _contract: contract, - _key: key, - getFragment, - estimateEnergy, - populateTransaction, - send, - staticCall, - staticCallResult, - }); - // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) - Object.defineProperty(method, "fragment", { - configurable: false, - enumerable: true, - get: () => { - const fragment = contract.interface.getFunction(key); - assert(fragment, "no matching fragment in defineProperty", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }, - }); - return method; -} -function buildWrappedEvent(contract, key) { - const getFragment = function (...args) { - const fragment = contract.interface.getEvent(key, args); - assert(fragment, "no matching fragment in", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }; - const method = function (...args) { - return new PreparedTopicFilter(contract, getFragment(...args), args); - }; - defineProperties(method, { - name: contract.interface.getEventName(key), - _contract: contract, - _key: key, - getFragment, - }); - // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) - Object.defineProperty(method, "fragment", { - configurable: false, - enumerable: true, - get: () => { - const fragment = contract.interface.getEvent(key); - assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }, - }); - return method; -} -// The combination of TypeScrype, Private Fields and Proxies makes -// the world go boom; so we hide variables with some trickery keeping -// a symbol attached to each BaseContract which its sub-class (even -// via a Proxy) can reach and use to look up its internal values. -const internal = Symbol.for("_corebcInternal_contract"); -const internalValues = new WeakMap(); -function setInternal(contract, values) { - internalValues.set(contract[internal], values); -} -function getInternal(contract) { - return internalValues.get(contract[internal]); -} -function isDeferred(value) { - return (value && - typeof value === "object" && - "getTopicFilter" in value && - typeof value.getTopicFilter === "function" && - value.fragment); -} -async function getSubInfo(contract, event) { - let topics; - let fragment = null; - // Convert named events to topicHash and get the fragment for - // events which need deconstructing. - if (Array.isArray(event)) { - const topicHashify = function (name) { - if (isHexString(name, 32)) { - return name; - } - const fragment = contract.interface.getEvent(name); - assertArgument(fragment, "unknown fragment", "name", name); - return fragment.topicHash; - }; - // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` - topics = event.map((e) => { - if (e == null) { - return null; - } - if (Array.isArray(e)) { - return e.map(topicHashify); - } - return topicHashify(e); - }); - } - else if (event === "*") { - topics = [null]; - } - else if (typeof event === "string") { - if (isHexString(event, 32)) { - // Topic Hash - topics = [event]; - } - else { - // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` - fragment = contract.interface.getEvent(event); - assertArgument(fragment, "unknown fragment", "event", event); - topics = [fragment.topicHash]; - } - } - else if (isDeferred(event)) { - // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)` - topics = await event.getTopicFilter(); - } - else if ("fragment" in event) { - // ContractEvent; e.g. `contract.filter.Transfer` - fragment = event.fragment; - topics = [fragment.topicHash]; - } - else { - assertArgument(false, "unknown event name", "event", event); - } - // Normalize topics and sort TopicSets - topics = topics.map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values()); - if (items.length === 1) { - return items[0]; - } - items.sort(); - return items; - } - return t.toLowerCase(); - }); - const tag = topics - .map((t) => { - if (t == null) { - return "null"; - } - if (Array.isArray(t)) { - return t.join("|"); - } - return t; - }) - .join("&"); - return { fragment, tag, topics }; -} -async function hasSub(contract, event) { - const { subs } = getInternal(contract); - return subs.get((await getSubInfo(contract, event)).tag) || null; -} -async function getSub(contract, operation, event) { - // Make sure our runner can actually subscribe to events - const provider = getProvider(contract.runner); - assert(provider, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation }); - const { fragment, tag, topics } = await getSubInfo(contract, event); - const { addr, subs } = getInternal(contract); - let sub = subs.get(tag); - if (!sub) { - const address = addr ? addr : contract; - const filter = { address, topics }; - const listener = (log) => { - let foundFragment = fragment; - if (foundFragment == null) { - try { - foundFragment = contract.interface.getEvent(log.topics[0]); - } - catch (error) { } - } - // If fragment is null, we do not deconstruct the args to emit - if (foundFragment) { - const _foundFragment = foundFragment; - const args = fragment - ? contract.interface.decodeEventLog(fragment, log.data, log.topics) - : []; - emit(contract, event, args, (listener) => { - return new ContractEventPayload(contract, listener, event, _foundFragment, log); - }); - } - else { - emit(contract, event, [], (listener) => { - return new ContractUnknownEventPayload(contract, listener, event, log); - }); - } - }; - let starting = []; - const start = () => { - if (starting.length) { - return; - } - starting.push(provider.on(filter, listener)); - }; - const stop = async () => { - if (starting.length == 0) { - return; - } - let started = starting; - starting = []; - await Promise.all(started); - provider.off(filter, listener); - }; - sub = { tag, listeners: [], start, stop }; - subs.set(tag, sub); - } - return sub; -} -// We use this to ensure one emit resolves before firing the next to -// ensure correct ordering (note this cannot throw and just adds the -// notice to the event queu using setTimeout). -let lastEmit = Promise.resolve(); -async function _emit(contract, event, args, payloadFunc) { - await lastEmit; - const sub = await hasSub(contract, event); - if (!sub) { - return false; - } - const count = sub.listeners.length; - sub.listeners = sub.listeners.filter(({ listener, once }) => { - const passArgs = Array.from(args); - if (payloadFunc) { - passArgs.push(payloadFunc(once ? null : listener)); - } - try { - listener.call(contract, ...passArgs); - } - catch (error) { } - return !once; - }); - return count > 0; -} -async function emit(contract, event, args, payloadFunc) { - try { - await lastEmit; - } - catch (error) { } - const resultPromise = _emit(contract, event, args, payloadFunc); - lastEmit = resultPromise; - return await resultPromise; -} -const passProperties = ["then"]; -class BaseContract { - target; - interface; - runner; - filters; - [internal]; - fallback; - constructor(target, abi, runner, _deployTx) { - if (runner == null) { - runner = null; - } - const iface = Interface.from(abi); - defineProperties(this, { target, runner, interface: iface }); - Object.defineProperty(this, internal, { value: {} }); - let addrPromise; - let addr = null; - let deployTx = null; - if (_deployTx) { - const provider = getProvider(runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx); - } - let subs = new Map(); - // Resolve the target as the address - if (typeof target === "string") { - if (isHexString(target)) { - addr = target; - addrPromise = Promise.resolve(target); - } - else { - const resolver = getRunner(runner, "resolveName"); - if (!canResolve(resolver)) { - throw makeError("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", { - operation: "resolveName", - }); - } - addrPromise = resolver.resolveName(target).then((addr) => { - if (addr == null) { - throw new Error("TODO"); - } - getInternal(this).addr = addr; - return addr; - }); - } - } - else { - addrPromise = target.getAddress().then((addr) => { - if (addr == null) { - throw new Error("TODO"); - } - getInternal(this).addr = addr; - return addr; - }); - } - // Set our private values - setInternal(this, { addrPromise, addr, deployTx, subs }); - // Add the event filters - const filters = new Proxy({}, { - get: (target, _prop, receiver) => { - // Pass important checks (like `then` for Promise) through - if (passProperties.indexOf(_prop) >= 0) { - return Reflect.get(target, _prop, receiver); - } - const prop = String(_prop); - const result = this.getEvent(prop); - if (result) { - return result; - } - throw new Error(`unknown contract event: ${prop}`); - }, - has: (target, prop) => { - // Pass important checks (like `then` for Promise) through - if (passProperties.indexOf(prop) >= 0) { - return Reflect.has(target, prop); - } - return (Reflect.has(target, prop) || this.interface.hasEvent(String(prop))); - }, - }); - defineProperties(this, { filters }); - defineProperties(this, { - fallback: iface.receive || iface.fallback ? buildWrappedFallback(this) : null, - }); - // Return a Proxy that will respond to functions - return new Proxy(this, { - get: (target, _prop, receiver) => { - if (_prop in target || passProperties.indexOf(_prop) >= 0) { - return Reflect.get(target, _prop, receiver); - } - const prop = String(_prop); - const result = target.getFunction(prop); - if (result) { - return result; - } - throw new Error(`unknown contract method: ${prop}`); - }, - has: (target, prop) => { - if (prop in target || passProperties.indexOf(prop) >= 0) { - return Reflect.has(target, prop); - } - return target.interface.hasFunction(String(prop)); - }, - }); - } - connect(runner) { - return new BaseContract(this.target, this.interface, runner); - } - async getAddress() { - return await getInternal(this).addrPromise; - } - async getDeployedCode() { - const provider = getProvider(this.runner); - assert(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" }); - const code = await provider.getCode(await this.getAddress()); - if (code === "0x") { - return null; - } - return code; - } - async waitForDeployment() { - // We have the deployement transaction; just use that (throws if deployement fails) - const deployTx = this.deploymentTransaction(); - if (deployTx) { - await deployTx.wait(); - return this; - } - // Check for code - const code = await this.getDeployedCode(); - if (code != null) { - return this; - } - // Make sure we can subscribe to a provider event - const provider = getProvider(this.runner); - assert(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }); - return new Promise((resolve, reject) => { - const checkCode = async () => { - try { - const code = await this.getDeployedCode(); - if (code != null) { - return resolve(this); - } - provider.once("block", checkCode); - } - catch (error) { - reject(error); - } - }; - checkCode(); - }); - } - deploymentTransaction() { - return getInternal(this).deployTx; - } - getFunction(key) { - if (typeof key !== "string") { - key = key.format(); - } - const func = buildWrappedMethod(this, key); - return func; - } - getEvent(key) { - if (typeof key !== "string") { - key = key.format(); - } - return buildWrappedEvent(this, key); - } - async queryTransaction(hash) { - // Is this useful? - throw new Error("@TODO"); - } - async queryFilter(event, fromBlock, toBlock) { - if (fromBlock == null) { - fromBlock = 0; - } - if (toBlock == null) { - toBlock = "latest"; - } - const { addr, addrPromise } = getInternal(this); - const address = addr ? addr : await addrPromise; - const { fragment, topics } = await getSubInfo(this, event); - const filter = { address, topics, fromBlock, toBlock }; - const provider = getProvider(this.runner); - assert(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); - return (await provider.getLogs(filter)).map((log) => { - let foundFragment = fragment; - if (foundFragment == null) { - try { - foundFragment = this.interface.getEvent(log.topics[0]); - } - catch (error) { } - } - if (foundFragment) { - return new EventLog(log, this.interface, foundFragment); - } - else { - return new Log(log, provider); - } - }); - } - async on(event, listener) { - const sub = await getSub(this, "on", event); - sub.listeners.push({ listener, once: false }); - sub.start(); - return this; - } - async once(event, listener) { - const sub = await getSub(this, "once", event); - sub.listeners.push({ listener, once: true }); - sub.start(); - return this; - } - async emit(event, ...args) { - return await emit(this, event, args, null); - } - async listenerCount(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return 0; - } - return sub.listeners.length; - } - const { subs } = getInternal(this); - let total = 0; - for (const { listeners } of subs.values()) { - total += listeners.length; - } - return total; - } - async listeners(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return []; - } - return sub.listeners.map(({ listener }) => listener); - } - const { subs } = getInternal(this); - let result = []; - for (const { listeners } of subs.values()) { - result = result.concat(listeners.map(({ listener }) => listener)); - } - return result; - } - async off(event, listener) { - const sub = await hasSub(this, event); - if (!sub) { - return this; - } - if (listener) { - const index = sub.listeners - .map(({ listener }) => listener) - .indexOf(listener); - if (index >= 0) { - sub.listeners.splice(index, 1); - } - } - if (listener == null || sub.listeners.length === 0) { - sub.stop(); - getInternal(this).subs.delete(sub.tag); - } - return this; - } - async removeAllListeners(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return this; - } - sub.stop(); - getInternal(this).subs.delete(sub.tag); - } - else { - const { subs } = getInternal(this); - for (const { tag, stop } of subs.values()) { - stop(); - subs.delete(tag); - } - } - return this; - } - // Alias for "on" - async addListener(event, listener) { - return await this.on(event, listener); - } - // Alias for "off" - async removeListener(event, listener) { - return await this.off(event, listener); - } - static buildClass(abi) { - class CustomContract extends BaseContract { - constructor(address, runner = null) { - super(address, abi, runner); - } - } - return CustomContract; - } - static from(target, abi, runner) { - if (runner == null) { - runner = null; - } - const contract = new this(target, abi, runner); - return contract; - } - static isIndexed(value) { - return Indexed.isIndexed(value); - } -} -function _ContractBase() { - return BaseContract; -} -class Contract extends _ContractBase() { -} - -// A = Arguments to the constructor -// I = Interface of deployed contracts -class ContractFactory { - interface; - bytecode; - runner; - constructor(abi, bytecode, runner) { - const iface = Interface.from(abi); - // Dereference Solidity bytecode objects and allow a missing `0x`-prefix - if (bytecode instanceof Uint8Array) { - bytecode = hexlify(getBytes(bytecode)); - } - else if (typeof bytecode === "string") { - bytecode = bytecode; - } - else if (isBytes(bytecode)) { - bytecode = hexlify(bytecode); - } - else if (bytecode && typeof bytecode.object === "string") { - // Allow the bytecode object from the Solidity compiler - bytecode = bytecode.object; - } - else { - // Crash in the next verification step - bytecode = "!"; - } - defineProperties(this, { - // @ts-ignore - bytecode, - interface: iface, - runner: runner || null, - }); - } - async getDeployTransaction(...args) { - let overrides = {}; - const fragment = this.interface.deploy; - if (fragment.inputs.length + 1 === args.length) { - overrides = await copyOverrides(args.pop()); - } - if (fragment.inputs.length !== args.length) { - throw new Error("incorrect number of arguments to constructor"); - } - const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args); - const data = concat([ - this.bytecode, - this.interface.encodeDeploy(resolvedArgs), - ]); - return Object.assign({}, overrides, { data }); - } - async deploy(...args) { - const tx = await this.getDeployTransaction(...args); - assert(this.runner && typeof this.runner.sendTransaction === "function", "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", { - operation: "sendTransaction", - }); - const sentTx = await this.runner.sendTransaction(tx); - const address = getCreateAddress(sentTx); - return new BaseContract(address, this.interface, this.runner, sentTx); - } - connect(runner) { - return new ContractFactory(this.interface, this.bytecode, runner); - } - static fromSolidity(output, runner) { - assertArgument(output != null, "bad compiler output", "output", output); - if (typeof output === "string") { - output = JSON.parse(output); - } - const abi = output.abi; - let bytecode = ""; - if (output.bytecode) { - bytecode = output.bytecode; - } - else if (output.evm && output.evm.bytecode) { - bytecode = output.evm.bytecode; - } - return new this(abi, bytecode, runner); - } -} - -/** - * @_ignore - */ -const BN_0 = BigInt(0); -function allowNull(format, nullValue) { - return function (value) { - if (value == null) { - return nullValue; - } - return format(value); - }; -} -function arrayOf(format) { - return (array) => { - if (!Array.isArray(array)) { - throw new Error("not an array"); - } - return array.map((i) => format(i)); - }; -} -// Requires an object which matches a fleet of other formatters -// Any FormatFunc may return `undefined` to have the value omitted -// from the result object. Calls preserve `this`. -function object(format, altNames) { - return (value) => { - const result = {}; - for (const key in format) { - let srcKey = key; - if (altNames && key in altNames && !(srcKey in value)) { - for (const altKey of altNames[key]) { - if (altKey in value) { - srcKey = altKey; - break; - } - } - } - try { - const nv = format[key](value[srcKey]); - if (nv !== undefined) { - result[key] = nv; - } - } - catch (error) { - const message = error instanceof Error ? error.message : "not-an-error"; - assert(false, `invalid value for value.${key} (${message})`, "BAD_DATA", { value }); - } - } - return result; - }; -} -function formatBoolean(value) { - switch (value) { - case true: - case "true": - return true; - case false: - case "false": - return false; - } - assertArgument(false, `invalid boolean; ${JSON.stringify(value)}`, "value", value); -} -function formatData(value) { - assertArgument(isHexString(value, true), "invalid data", "value", value); - return value; -} -function formatHash(value) { - assertArgument(isHexString(value, 32), "invalid hash", "value", value); - return value; -} -const _formatLog = object({ - address: getAddress, - blockHash: formatHash, - blockNumber: getNumber, - data: formatData, - index: getNumber, - removed: allowNull(formatBoolean, false), - topics: arrayOf(formatHash), - transactionHash: formatHash, - transactionIndex: getNumber, -}, { - index: ["logIndex"], -}); -function formatLog(value) { - return _formatLog(value); -} -const _formatBlock = object({ - hash: allowNull(formatHash), - parentHash: formatHash, - number: getNumber, - timestamp: getNumber, - nonce: allowNull(formatData), - difficulty: getBigInt, - energyLimit: getBigInt, - energyUsed: getBigInt, - miner: allowNull(getAddress), - extraData: formatData, - baseFeePerEnergy: allowNull(getBigInt), -}); -function formatBlock(value) { - const result = _formatBlock(value); - result.transactions = value.transactions.map((tx) => { - if (typeof tx === "string") { - return tx; - } - return formatTransactionResponse(tx); - }); - return result; -} -const _formatReceiptLog = object({ - transactionIndex: getNumber, - blockNumber: getNumber, - transactionHash: formatHash, - address: getAddress, - topics: arrayOf(formatHash), - data: formatData, - index: getNumber, - blockHash: formatHash, -}, { - index: ["logIndex"], -}); -function formatReceiptLog(value) { - return _formatReceiptLog(value); -} -const _formatTransactionReceipt = object({ - to: allowNull(getAddress, null), - from: allowNull(getAddress, null), - contractAddress: allowNull(getAddress, null), - // should be allowNull(hash), but broken-EIP-658 support is handled in receipt - index: getNumber, - root: allowNull(hexlify), - energyUsed: getBigInt, - logsBloom: allowNull(formatData), - blockHash: formatHash, - hash: formatHash, - logs: arrayOf(formatReceiptLog), - blockNumber: getNumber, - //confirmations: allowNull(getNumber, null), - cumulativeEnergyUsed: getBigInt, - effectiveEnergyPrice: allowNull(getBigInt), - status: allowNull(getNumber), - type: allowNull(getNumber, 0), -}, { - effectiveEnergyPrice: ["energyPrice"], - hash: ["transactionHash"], - index: ["transactionIndex"], -}); -function formatTransactionReceipt(value) { - return _formatTransactionReceipt(value); -} -function formatTransactionResponse(value) { - // Some clients (TestRPC) do strange things like return 0x0 for the - // 0 address; correct this to be a real address - if (value.to && !getAddress(value.to) && getBigInt(value.to) === BN_0) { - value.to = "0x0000000000000000000000000000000000000000"; - } - const result = object({ - hash: formatHash, - type: (value) => { - if (value === "0x" || value == null) { - return 0; - } - return getNumber(value); - }, - accessList: allowNull(accessListify, null), - blockHash: allowNull(formatHash, null), - blockNumber: allowNull(getNumber, null), - transactionIndex: allowNull(getNumber, null), - //confirmations: allowNull(getNumber, null), - from: getAddress, - maxFeePerEnergy: allowNull(getBigInt), - energyLimit: getBigInt, - to: allowNull(getAddress, null), - value: getBigInt, - nonce: getNumber, - data: formatData, - creates: allowNull(getAddress, null), - networkId: allowNull(getBigInt, null), - }, { - data: ["input"], - energyLimit: ["energy"], - })(value); - // If to and creates are empty, populate the creates from the value - if (result.to == null && result.creates == null) { - result.creates = getCreateAddress(result); - } - // Compute the signature - if (value.signature) { - result.signature = value.signature; - } - else { - result.signature = value; - } - // Some backends omit networkId on legacy transactions, but we can compute it - if (result.networkId == null) { - const networkId = result.signature.legacynetworkId; - if (networkId != null) { - result.networkId = networkId; - } - } - // @TODO: check networkId - /* - if (value.networkId != null) { - let networkId = value.networkId; - - if (isHexString(networkId)) { - networkId = BigNumber.from(networkId).toNumber(); - } - - result.networkId = networkId; - - } else { - let networkId = value.networkId; - - // geth-etc returns networkId - if (networkId == null && result.v == null) { - networkId = value.networkId; - } - - if (isHexString(networkId)) { - networkId = BigNumber.from(networkId).toNumber(); - } - - if (typeof(networkId) !== "number" && result.v != null) { - networkId = (result.v - 35) / 2; - if (networkId < 0) { networkId = 0; } - networkId = parseInt(networkId); - } - - if (typeof(networkId) !== "number") { networkId = 0; } - - result.networkId = networkId; - } - */ - // 0x0000... should actually be null - if (result.blockHash && getBigInt(result.blockHash) === BN_0) { - result.blockHash = null; - } - return result; -} - -class NetworkPlugin { - name; - constructor(name) { - defineProperties(this, { name }); - } - clone() { - return new NetworkPlugin(this.name); - } -} -class EnergyCostPlugin extends NetworkPlugin { - effectiveBlock; - txBase; - txCreate; - txDataZero; - txDataNonzero; - txAccessListStorageKey; - txAccessListAddress; - constructor(effectiveBlock, costs) { - if (effectiveBlock == null) { - effectiveBlock = 0; - } - super(`org.corebc.network.plugins.EnergyCost#${effectiveBlock || 0}`); - const props = { effectiveBlock }; - function set(name, nullish) { - let value = (costs || {})[name]; - if (value == null) { - value = nullish; - } - assertArgument(typeof value === "number", `invalud value for ${name}`, "costs", costs); - props[name] = value; - } - set("txBase", 21000); - set("txCreate", 32000); - set("txDataZero", 4); - set("txDataNonzero", 16); - set("txAccessListStorageKey", 1900); - set("txAccessListAddress", 2400); - defineProperties(this, props); - } - clone() { - return new EnergyCostPlugin(this.effectiveBlock, this); - } -} -class FeeDataNetworkPlugin extends NetworkPlugin { - #feeDataFunc; - get feeDataFunc() { - return this.#feeDataFunc; - } - constructor(feeDataFunc) { - super("org.corebc.plugins.network.FeeData"); - this.#feeDataFunc = feeDataFunc; - } - async getFeeData(provider) { - return await this.#feeDataFunc(provider); - } - clone() { - return new FeeDataNetworkPlugin(this.#feeDataFunc); - } -} -/* -export class CustomBlockNetworkPlugin extends NetworkPlugin { - readonly #blockFunc: (provider: Provider, block: BlockParams) => Block; - readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block; - - async getBlock(provider: Provider, block: BlockParams): Promise> { - return await this.#blockFunc(provider, block); - } - - async getBlockions(provider: Provider, block: BlockParams): Promise> { - return await this.#blockWithTxsFunc(provider, block); - } - - clone(): CustomBlockNetworkPlugin { - return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc); - } -} -*/ - -/** - * About networks - * - * @_subsection: api/providers:Networks [networks] - */ -/* * * * -// Networks which operation against an L2 can use this plugin to -// specify how to access L1, for the purpose of resolving ENS, -// for example. -export class LayerOneConnectionPlugin extends NetworkPlugin { - readonly provider!: Provider; -*/ -// Networks or clients with a higher need for security (such as clients -// that may automatically make CCIP requests without user interaction) -// can use this plugin to anonymize requests or intercept CCIP requests -// to notify and/or receive authorization from the user -const Networks = new Map(); -class Network { - #name; - #networkId; - #plugins; - constructor(name, networkId) { - this.#name = name; - this.#networkId = getBigInt(networkId); - this.#plugins = new Map(); - } - toJSON() { - return { name: this.name, networkId: String(this.networkId) }; - } - /** - * The network common name. - * - * This is the canonical name, as networks migh have multiple - * names. - */ - get name() { - return this.#name; - } - set name(value) { - this.#name = value; - } - /** - * The network chain ID. - */ - get networkId() { - return this.#networkId; - } - set networkId(value) { - this.#networkId = getBigInt(value, "networkId"); - } - /** - * Returns true if %%other%% matches this network. Any chain ID - * must match, and if no chain ID is present, the name must match. - * - * This method does not currently check for additional properties, - * such as ENS address or plug-in compatibility. - */ - matches(other) { - if (other == null) { - return false; - } - if (typeof other === "string") { - try { - return this.networkId === getBigInt(other); - } - catch (error) { } - return this.name === other; - } - if (typeof other === "number" || typeof other === "bigint") { - try { - return this.networkId === getBigInt(other); - } - catch (error) { } - return false; - } - if (typeof other === "object") { - if (other.networkId != null) { - try { - return this.networkId === getBigInt(other.networkId); - } - catch (error) { } - return false; - } - if (other.name != null) { - return this.name === other.name; - } - return false; - } - return false; - } - /** - * Returns the list of plugins currently attached to this Network. - */ - get plugins() { - return Array.from(this.#plugins.values()); - } - /** - * Attach a new %%plugin%% to this Network. The network name - * must be unique, excluding any fragment. - */ - attachPlugin(plugin) { - if (this.#plugins.get(plugin.name)) { - throw new Error(`cannot replace existing plugin: ${plugin.name} `); - } - this.#plugins.set(plugin.name, plugin.clone()); - return this; - } - /** - * Return the plugin, if any, matching %%name%% exactly. Plugins - * with fragments will not be returned unless %%name%% includes - * a fragment. - */ - getPlugin(name) { - return this.#plugins.get(name) || null; - } - /** - * Gets a list of all plugins that match %%name%%, with otr without - * a fragment. - */ - getPlugins(basename) { - return (this.plugins.filter((p) => p.name.split("#")[0] === basename)); - } - /** - * Create a copy of this Network. - */ - clone() { - const clone = new Network(this.name, this.networkId); - this.plugins.forEach((plugin) => { - clone.attachPlugin(plugin.clone()); - }); - return clone; - } - /** - * Compute the intrinsic energy required for a transaction. - * - * A EnergyCostPlugin can be attached to override the default - * values. - */ - computeIntrinsicEnergy(tx) { - const costs = this.getPlugin("org.corebc.plugins.network.EnergyCost") || new EnergyCostPlugin(); - let energy = costs.txBase; - if (tx.to == null) { - energy += costs.txCreate; - } - if (tx.data) { - for (let i = 2; i < tx.data.length; i += 2) { - if (tx.data.substring(i, i + 2) === "00") { - energy += costs.txDataZero; - } - else { - energy += costs.txDataNonzero; - } - } - } - return energy; - } - /** - * Returns a new Network for the %%network%% name or networkId. - */ - static from(network) { - injectCommonNetworks(); - // Default network - if (network == null) { - return Network.from("mainnet"); - } - // Canonical name or chain ID - if (typeof network === "number") { - network = BigInt(network); - } - if (typeof network === "string" || typeof network === "bigint") { - const networkFunc = Networks.get(network); - if (networkFunc) { - return networkFunc(); - } - if (typeof network === "bigint") { - return new Network("unknown", network); - } - assertArgument(false, "unknown network", "network", network); - } - // Clonable with network-like abilities - if (typeof network.clone === "function") { - const clone = network.clone(); - //if (typeof(network.name) !== "string" || typeof(network.networkId) !== "number") { - //} - return clone; - } - // Networkish - if (typeof network === "object") { - assertArgument(typeof network.name === "string" && - typeof network.networkId === "number", "invalid network object name or networkId", "network", network); - const custom = new Network(network.name, network.networkId); - //if ((network).layerOneConnection) { - // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection)); - //} - return custom; - } - assertArgument(false, "invalid network", "network", network); - } - /** - * Register %%nameOrnetworkId%% with a function which returns - * an instance of a Network representing that chain. - */ - static register(nameOrnetworkId, networkFunc) { - if (typeof nameOrnetworkId === "number") { - nameOrnetworkId = BigInt(nameOrnetworkId); - } - const existing = Networks.get(nameOrnetworkId); - if (existing) { - assertArgument(false, `conflicting network for ${JSON.stringify(existing.name)}`, "nameOrnetworkId", nameOrnetworkId); - } - Networks.set(nameOrnetworkId, networkFunc); - } -} -// See: https://chainlist.org -let injected = false; -function injectCommonNetworks() { - if (injected) { - return; - } - injected = true; - /// Register popular Core networks - function registerEth(name, networkId, options) { - const func = function () { - const network = new Network(name, networkId); - network.attachPlugin(new EnergyCostPlugin()); - return network; - }; - // Register the network by name and chain ID - Network.register(name, func); - Network.register(networkId, func); - if (options.altNames) { - options.altNames.forEach((name) => { - Network.register(name, func); - }); - } - } - registerEth("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] }); - registerEth("ropsten", 3, { ensNetwork: 3 }); - registerEth("rinkeby", 4, { ensNetwork: 4 }); - registerEth("goerli", 5, { ensNetwork: 5 }); - registerEth("kovan", 42, { ensNetwork: 42 }); - registerEth("sepolia", 11155111, {}); - registerEth("classic", 61, {}); - registerEth("classicKotti", 6, {}); - registerEth("xdai", 100, { ensNetwork: 1 }); -} - -function copy$2(obj) { - return JSON.parse(JSON.stringify(obj)); -} -// @TODO: refactor this -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -class PollingBlockSubscriber { - #provider; - #poller; - #interval; - // The most recent block we have scanned for events. The value -2 - // indicates we still need to fetch an initial block number - #blockNumber; - constructor(provider) { - this.#provider = provider; - this.#poller = null; - this.#interval = 4000; - this.#blockNumber = -2; - } - get pollingInterval() { - return this.#interval; - } - set pollingInterval(value) { - this.#interval = value; - } - async #poll() { - try { - const blockNumber = await this.#provider.getBlockNumber(); - // Bootstrap poll to setup our initial block number - if (this.#blockNumber === -2) { - this.#blockNumber = blockNumber; - return; - } - // @TODO: Put a cap on the maximum number of events per loop? - if (blockNumber !== this.#blockNumber) { - for (let b = this.#blockNumber + 1; b <= blockNumber; b++) { - // We have been stopped - if (this.#poller == null) { - return; - } - await this.#provider.emit("block", b); - } - this.#blockNumber = blockNumber; - } - } - catch (error) { - // @TODO: Minor bump, add an "error" event to let subscribers - // know things went awry. - //console.log(error); - } - // We have been stopped - if (this.#poller == null) { - return; - } - this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); - } - start() { - if (this.#poller) { - return; - } - this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); - this.#poll(); - } - stop() { - if (!this.#poller) { - return; - } - this.#provider._clearTimeout(this.#poller); - this.#poller = null; - } - pause(dropWhilePaused) { - this.stop(); - if (dropWhilePaused) { - this.#blockNumber = -2; - } - } - resume() { - this.start(); - } -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -class OnBlockSubscriber { - #provider; - #poll; - #running; - constructor(provider) { - this.#provider = provider; - this.#running = false; - this.#poll = (blockNumber) => { - this._poll(blockNumber, this.#provider); - }; - } - async _poll(blockNumber, provider) { - throw new Error("sub-classes must override this"); - } - start() { - if (this.#running) { - return; - } - this.#running = true; - this.#poll(-2); - this.#provider.on("block", this.#poll); - } - stop() { - if (!this.#running) { - return; - } - this.#running = false; - this.#provider.off("block", this.#poll); - } - pause(dropWhilePaused) { - this.stop(); - } - resume() { - this.start(); - } -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -class PollingOrphanSubscriber extends OnBlockSubscriber { - #filter; - constructor(provider, filter) { - super(provider); - this.#filter = copy$2(filter); - } - async _poll(blockNumber, provider) { - throw new Error("@TODO"); - } -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -class PollingTransactionSubscriber extends OnBlockSubscriber { - #hash; - constructor(provider, hash) { - super(provider); - this.#hash = hash; - } - async _poll(blockNumber, provider) { - const tx = await provider.getTransactionReceipt(this.#hash); - if (tx) { - provider.emit(this.#hash, tx); - } - } -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -class PollingEventSubscriber { - #provider; - #filter; - #poller; - #running; - // The most recent block we have scanned for events. The value -2 - // indicates we still need to fetch an initial block number - #blockNumber; - constructor(provider, filter) { - this.#provider = provider; - this.#filter = copy$2(filter); - this.#poller = this.#poll.bind(this); - this.#running = false; - this.#blockNumber = -2; - } - async #poll(blockNumber) { - // The initial block hasn't been determined yet - if (this.#blockNumber === -2) { - return; - } - const filter = copy$2(this.#filter); - filter.fromBlock = this.#blockNumber + 1; - filter.toBlock = blockNumber; - const logs = await this.#provider.getLogs(filter); - // No logs could just mean the node has not indexed them yet, - // so we keep a sliding window of 60 blocks to keep scanning - if (logs.length === 0) { - if (this.#blockNumber < blockNumber - 60) { - this.#blockNumber = blockNumber - 60; - } - return; - } - this.#blockNumber = blockNumber; - for (const log of logs) { - this.#provider.emit(this.#filter, log); - } - } - start() { - if (this.#running) { - return; - } - this.#running = true; - if (this.#blockNumber === -2) { - this.#provider.getBlockNumber().then((blockNumber) => { - this.#blockNumber = blockNumber; - }); - } - this.#provider.on("block", this.#poller); - } - stop() { - if (!this.#running) { - return; - } - this.#running = false; - this.#provider.off("block", this.#poller); - } - pause(dropWhilePaused) { - this.stop(); - if (dropWhilePaused) { - this.#blockNumber = -2; - } - } - resume() { - this.start(); - } -} - -/** - * About Subclassing the Provider... - * - * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] - */ -// @TODO -// Event coalescence -// When we register an event with an async value (e.g. address is a Signer -// or ENS name), we need to add it immeidately for the Event API, but also -// need time to resolve the address. Upon resolving the address, we need to -// migrate the listener to the static event. We also need to maintain a map -// of Signer/ENS name to address so we can sync respond to listenerCount. -const MAX_CCIP_REDIRECTS = 10; -function isPromise(value) { - return value && typeof value.then === "function"; -} -function getTag(prefix, value) { - return (prefix + - ":" + - JSON.stringify(value, (k, v) => { - if (v == null) { - return "null"; - } - if (typeof v === "bigint") { - return `bigint:${v.toString()}`; - } - if (typeof v === "string") { - return v.toLowerCase(); - } - // Sort object keys - if (typeof v === "object" && !Array.isArray(v)) { - const keys = Object.keys(v); - keys.sort(); - return keys.reduce((accum, key) => { - accum[key] = v[key]; - return accum; - }, {}); - } - return v; - })); -} -class UnmanagedSubscriber { - name; - constructor(name) { - defineProperties(this, { name }); - } - start() { } - stop() { } - pause(dropWhilePaused) { } - resume() { } -} -function copy$1(value) { - return JSON.parse(JSON.stringify(value)); -} -function concisify(items) { - items = Array.from(new Set(items).values()); - items.sort(); - return items; -} -async function getSubscription(_event, provider) { - if (_event == null) { - throw new Error("invalid event"); - } - // Normalize topic array info an EventFilter - if (Array.isArray(_event)) { - _event = { topics: _event }; - } - if (typeof _event === "string") { - switch (_event) { - case "block": - case "pending": - case "debug": - case "error": - case "network": { - return { type: _event, tag: _event }; - } - } - } - if (isHexString(_event, 32)) { - const hash = _event.toLowerCase(); - return { type: "transaction", tag: getTag("tx", { hash }), hash }; - } - if (_event.orphan) { - const event = _event; - // @TODO: Should lowercase and whatnot things here instead of copy... - return { - type: "orphan", - tag: getTag("orphan", event), - filter: copy$1(event), - }; - } - if (_event.address || _event.topics) { - const event = _event; - const filter = { - topics: (event.topics || []).map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - return concisify(t.map((t) => t.toLowerCase())); - } - return t.toLowerCase(); - }), - }; - if (event.address) { - const addresses = []; - const promises = []; - const addAddress = (addr) => { - if (isHexString(addr)) { - addresses.push(addr); - } - else { - promises.push((async () => { - addresses.push(await resolveAddress(addr)); - })()); - } - }; - if (Array.isArray(event.address)) { - event.address.forEach(addAddress); - } - else { - addAddress(event.address); - } - if (promises.length) { - await Promise.all(promises); - } - filter.address = concisify(addresses.map((a) => a.toLowerCase())); - } - return { filter, tag: getTag("event", filter), type: "event" }; - } - assertArgument(false, "unknown ProviderEvent", "event", _event); -} -function getTime$1() { - return new Date().getTime(); -} -class AbstractProvider { - #subs; - #plugins; - // null=unpaused, true=paused+dropWhilePaused, false=paused - #pausedState; - #networkPromise; - #anyNetwork; - #performCache; - // The most recent block number if running an event or -1 if no "block" event - #lastBlockNumber; - #nextTimer; - #timers; - #disableCcipRead; - // @TODO: This should be a () => Promise so network can be - // done when needed; or rely entirely on _detectNetwork? - constructor(_network) { - if (_network === "any") { - this.#anyNetwork = true; - this.#networkPromise = null; - } - else if (_network) { - const network = Network.from(_network); - this.#anyNetwork = false; - this.#networkPromise = Promise.resolve(network); - setTimeout(() => { - this.emit("network", network, null); - }, 0); - } - else { - this.#anyNetwork = false; - this.#networkPromise = null; - } - this.#lastBlockNumber = -1; - this.#performCache = new Map(); - this.#subs = new Map(); - this.#plugins = new Map(); - this.#pausedState = null; - this.#nextTimer = 1; - this.#timers = new Map(); - this.#disableCcipRead = false; - } - get provider() { - return this; - } - get plugins() { - return Array.from(this.#plugins.values()); - } - attachPlugin(plugin) { - if (this.#plugins.get(plugin.name)) { - throw new Error(`cannot replace existing plugin: ${plugin.name} `); - } - this.#plugins.set(plugin.name, plugin.connect(this)); - return this; - } - getPlugin(name) { - return this.#plugins.get(name) || null; - } - get disableCcipRead() { - return this.#disableCcipRead; - } - set disableCcipRead(value) { - this.#disableCcipRead = !!value; - } - // Shares multiple identical requests made during the same 250ms - async #perform(req) { - // Create a tag - const tag = getTag(req.method, req); - let perform = this.#performCache.get(tag); - if (!perform) { - perform = this._perform(req); - this.#performCache.set(tag, perform); - setTimeout(() => { - if (this.#performCache.get(tag) === perform) { - this.#performCache.delete(tag); - } - }, 250); - } - return await perform; - } - async ccipReadFetch(tx, calldata, urls) { - if (this.disableCcipRead || urls.length === 0 || tx.to == null) { - return null; - } - const sender = tx.to.toLowerCase(); - const data = calldata.toLowerCase(); - const errorMessages = []; - for (let i = 0; i < urls.length; i++) { - const url = urls[i]; - // URL expansion - const href = url.replace("{sender}", sender).replace("{data}", data); - // If no {data} is present, use POST; otherwise GET - //const json: string | null = (url.indexOf("{data}") >= 0) ? null: JSON.stringify({ data, sender }); - //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { - // value.status = response.statusCode; - // return value; - //}); - const request = new FetchRequest(href); - if (url.indexOf("{data}") === -1) { - request.body = { data, sender }; - } - this.emit("debug", { - action: "sendCcipReadFetchRequest", - request, - index: i, - urls, - }); - let errorMessage = "unknown error"; - const resp = await request.send(); - try { - const result = resp.bodyJson; - if (result.data) { - this.emit("debug", { - action: "receiveCcipReadFetchResult", - request, - result, - }); - return result.data; - } - if (result.message) { - errorMessage = result.message; - } - this.emit("debug", { - action: "receiveCcipReadFetchError", - request, - result, - }); - } - catch (error) { } - // 4xx indicates the result is not present; stop - assert(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, "OFFCHAIN_FAULT", { - reason: "404_MISSING_RESOURCE", - transaction: tx, - info: { url, errorMessage }, - }); - // 5xx indicates server issue; try the next url - errorMessages.push(errorMessage); - } - assert(false, `error encountered during CCIP fetch: ${errorMessages - .map((m) => JSON.stringify(m)) - .join(", ")}`, "OFFCHAIN_FAULT", { - reason: "500_SERVER_ERROR", - transaction: tx, - info: { urls, errorMessages }, - }); - } - _wrapBlock(value, network) { - return new Block(formatBlock(value), this); - } - _wrapLog(value, network) { - return new Log(formatLog(value), this); - } - _wrapTransactionReceipt(value, network) { - return new TransactionReceipt(formatTransactionReceipt(value), this); - } - _wrapTransactionResponse(tx, network) { - return new TransactionResponse(formatTransactionResponse(tx), this); - } - _detectNetwork() { - assert(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", { - operation: "_detectNetwork", - }); - } - // Sub-classes should override this and handle PerformActionRequest requests, calling - // the super for any unhandled actions. - async _perform(req) { - assert(false, `unsupported method: ${req.method}`, "UNSUPPORTED_OPERATION", { - operation: req.method, - info: req, - }); - } - // State - async getBlockNumber() { - const blockNumber = getNumber(await this.#perform({ method: "getBlockNumber" }), "%response"); - if (this.#lastBlockNumber >= 0) { - this.#lastBlockNumber = blockNumber; - } - return blockNumber; - } - _getAddress(address) { - return resolveAddress(address); - } - _getBlockTag(blockTag) { - if (blockTag == null) { - return "latest"; - } - switch (blockTag) { - case "earliest": - return "0x0"; - case "latest": - case "pending": - case "safe": - case "finalized": - return blockTag; - } - if (isHexString(blockTag)) { - if (isHexString(blockTag, 32)) { - return blockTag; - } - return toQuantity(blockTag); - } - if (typeof blockTag === "bigint") { - blockTag = getNumber(blockTag, "blockTag"); - } - if (typeof blockTag === "number") { - if (blockTag >= 0) { - return toQuantity(blockTag); - } - if (this.#lastBlockNumber >= 0) { - return toQuantity(this.#lastBlockNumber + blockTag); - } - return this.getBlockNumber().then((b) => toQuantity(b + blockTag)); - } - assertArgument(false, "invalid blockTag", "blockTag", blockTag); - } - _getFilter(filter) { - // Create a canonical representation of the topics - const topics = (filter.topics || []).map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - return concisify(t.map((t) => t.toLowerCase())); - } - return t.toLowerCase(); - }); - const blockHash = "blockHash" in filter ? filter.blockHash : undefined; - const resolve = (_address, fromBlock, toBlock) => { - let address = undefined; - switch (_address.length) { - case 0: - break; - case 1: - address = _address[0]; - break; - default: - _address.sort(); - address = _address; - } - if (blockHash) { - if (fromBlock != null || toBlock != null) { - throw new Error("invalid filter"); - } - } - const filter = {}; - if (address) { - filter.address = address; - } - if (topics.length) { - filter.topics = topics; - } - if (fromBlock) { - filter.fromBlock = fromBlock; - } - if (toBlock) { - filter.toBlock = toBlock; - } - if (blockHash) { - filter.blockHash = blockHash; - } - return filter; - }; - // Addresses could be async (ENS names or Addressables) - let address = []; - if (filter.address) { - if (Array.isArray(filter.address)) { - for (const addr of filter.address) { - address.push(this._getAddress(addr)); - } - } - else { - address.push(this._getAddress(filter.address)); - } - } - let fromBlock = undefined; - if ("fromBlock" in filter) { - fromBlock = this._getBlockTag(filter.fromBlock); - } - let toBlock = undefined; - if ("toBlock" in filter) { - toBlock = this._getBlockTag(filter.toBlock); - } - if (address.filter((a) => typeof a !== "string").length || - (fromBlock != null && typeof fromBlock !== "string") || - (toBlock != null && typeof toBlock !== "string")) { - return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result) => { - return resolve(result[0], result[1], result[2]); - }); - } - return resolve(address, fromBlock, toBlock); - } - _getTransactionRequest(_request) { - const request = copyRequest(_request); - const promises = []; - ["to", "from"].forEach((key) => { - if (request[key] == null) { - return; - } - const addr = resolveAddress(request[key]); - if (isPromise(addr)) { - promises.push((async function () { - request[key] = await addr; - })()); - } - else { - request[key] = addr; - } - }); - if (request.blockTag != null) { - const blockTag = this._getBlockTag(request.blockTag); - if (isPromise(blockTag)) { - promises.push((async function () { - request.blockTag = await blockTag; - })()); - } - else { - request.blockTag = blockTag; - } - } - if (promises.length) { - return (async function () { - await Promise.all(promises); - return request; - })(); - } - return request; - } - async getNetwork() { - // No explicit network was set and this is our first time - if (this.#networkPromise == null) { - // Detect the current network (shared with all calls) - const detectNetwork = this._detectNetwork().then((network) => { - this.emit("network", network, null); - return network; - }, (error) => { - // Reset the networkPromise on failure, so we will try again - if (this.#networkPromise === detectNetwork) { - this.#networkPromise = null; - } - throw error; - }); - this.#networkPromise = detectNetwork; - return (await detectNetwork).clone(); - } - const networkPromise = this.#networkPromise; - const [expected, actual] = await Promise.all([ - networkPromise, - this._detectNetwork(), // The actual connected network - ]); - if (expected.networkId !== actual.networkId) { - if (this.#anyNetwork) { - // The "any" network can change, so notify listeners - this.emit("network", actual, expected); - // Update the network if something else hasn't already changed it - if (this.#networkPromise === networkPromise) { - this.#networkPromise = Promise.resolve(actual); - } - } - else { - // Otherwise, we do not allow changes to the underlying network - assert(false, `network changed: ${expected.networkId} => ${actual.networkId} `, "NETWORK_ERROR", { - event: "changed", - }); - } - } - return expected.clone(); - } - async getEnergyPrice() { - const { energyPrice } = await resolveProperties({ - block: this.getBlock("latest"), - energyPrice: (async () => { - try { - const energyPrice = await this.#perform({ method: "getEnergyPrice" }); - return getBigInt(energyPrice, "%response"); - } - catch (error) { } - return null; - })(), - }); - return new FeeData(energyPrice); - } - async getFeeData() { - const { energyPrice } = await resolveProperties({ - block: this.getBlock("latest"), - energyPrice: (async () => { - try { - const energyPrice = await this.#perform({ method: "getEnergyPrice" }); - return getBigInt(energyPrice, "%response"); - } - catch (error) { } - return null; - })(), - }); - return new FeeData(energyPrice); - } - async estimateEnergy(_tx) { - let tx = this._getTransactionRequest(_tx); - if (isPromise(tx)) { - tx = await tx; - } - return getBigInt(await this.#perform({ - method: "estimateEnergy", - transaction: tx, - }), "%response"); - } - async #call(tx, blockTag, attempt) { - assert(attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", { - reason: "TOO_MANY_REDIRECTS", - transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }), - }); - // This came in as a PerformActionTransaction, so to/from are safe; we can cast - const transaction = copyRequest(tx); - try { - return hexlify(await this._perform({ method: "call", transaction, blockTag })); - } - catch (error) { - // CCIP Read OffchainLookup - if (!this.disableCcipRead && - isCallException(error) && - error.data && - attempt >= 0 && - blockTag === "latest" && - transaction.to != null && - dataSlice(error.data, 0, 4) === "0x556f1830") { - const data = error.data; - const txSender = await resolveAddress(transaction.to); - // Parse the CCIP Read Arguments - let ccipArgs; - try { - ccipArgs = parseOffchainLookup(dataSlice(error.data, 4)); - } - catch (error) { - assert(false, error.message, "OFFCHAIN_FAULT", { - reason: "BAD_DATA", - transaction, - info: { data }, - }); - } - // Check the sender of the OffchainLookup matches the transaction - assert(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), "CCIP Read sender mismatch", "CALL_EXCEPTION", { - action: "call", - data, - reason: "OffchainLookup", - transaction: transaction, - invocation: null, - revert: { - signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", - name: "OffchainLookup", - args: ccipArgs.errorArgs, - }, - }); - const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls); - assert(ccipResult != null, "CCIP Read failed to fetch data", "OFFCHAIN_FAULT", { - reason: "FETCH_FAILED", - transaction, - info: { data: error.data, errorArgs: ccipArgs.errorArgs }, - }); - const tx = { - to: txSender, - data: concat([ - ccipArgs.selector, - encodeBytes([ccipResult, ccipArgs.extraData]), - ]), - }; - this.emit("debug", { action: "sendCcipReadCall", transaction: tx }); - try { - const result = await this.#call(tx, blockTag, attempt + 1); - this.emit("debug", { - action: "receiveCcipReadCallResult", - transaction: Object.assign({}, tx), - result, - }); - return result; - } - catch (error) { - this.emit("debug", { - action: "receiveCcipReadCallError", - transaction: Object.assign({}, tx), - error, - }); - throw error; - } - } - throw error; - } - } - async #checkNetwork(promise) { - const { value } = await resolveProperties({ - network: this.getNetwork(), - value: promise, - }); - return value; - } - async call(_tx) { - const { tx, blockTag } = await resolveProperties({ - tx: this._getTransactionRequest(_tx), - blockTag: this._getBlockTag(_tx.blockTag), - }); - return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1)); - } - // Account - async #getAccountValue(request, _address, _blockTag) { - let address = this._getAddress(_address); - let blockTag = this._getBlockTag(_blockTag); - if (typeof address !== "string" || typeof blockTag !== "string") { - [address, blockTag] = await Promise.all([address, blockTag]); - } - return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag }))); - } - async getBalance(address, blockTag) { - return getBigInt(await this.#getAccountValue({ method: "getBalance" }, address, blockTag), "%response"); - } - async getTransactionCount(address, blockTag) { - return getNumber(await this.#getAccountValue({ method: "getTransactionCount" }, address, blockTag), "%response"); - } - async getCode(address, blockTag) { - return hexlify(await this.#getAccountValue({ method: "getCode" }, address, blockTag)); - } - async getStorage(address, _position, blockTag) { - const position = getBigInt(_position, "position"); - return hexlify(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag)); - } - // Write - async broadcastTransaction(signedTx) { - const { blockNumber, hash, network } = await resolveProperties({ - blockNumber: this.getBlockNumber(), - hash: this._perform({ - method: "broadcastTransaction", - signedTransaction: signedTx, - }), - network: this.getNetwork(), - }); - const tx = Transaction.from(signedTx); - if (tx.hash !== hash) { - throw new Error("@TODO: the returned hash did not match"); - } - return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber); - } - async #getBlock(block, includeTransactions) { - // @TODO: Add CustomBlockPlugin check - if (isHexString(block, 32)) { - return await this.#perform({ - method: "getBlock", - blockHash: block, - includeTransactions, - }); - } - let blockTag = this._getBlockTag(block); - if (typeof blockTag !== "string") { - blockTag = await blockTag; - } - return await this.#perform({ - method: "getBlock", - blockTag, - includeTransactions, - }); - } - // Queries - async getBlock(block, prefetchTxs) { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#getBlock(block, !!prefetchTxs), - }); - if (params == null) { - return null; - } - return this._wrapBlock(params, network); - } - async getTransaction(hash) { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#perform({ method: "getTransaction", hash }), - }); - if (params == null) { - return null; - } - return this._wrapTransactionResponse(params, network); - } - async getTransactionReceipt(hash) { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#perform({ method: "getTransactionReceipt", hash }), - }); - if (params == null) { - return null; - } - // Some backends did not backfill the effectiveEnergyPrice into old transactions - // in the receipt, so we look it up manually and inject it. - if (params.energyPrice == null && params.effectiveEnergyPrice == null) { - const tx = await this.#perform({ method: "getTransaction", hash }); - if (tx == null) { - throw new Error("report this; could not find tx or effectiveEnergyPrice"); - } - params.effectiveEnergyPrice = tx.energyPrice; - } - return this._wrapTransactionReceipt(params, network); - } - async getTransactionResult(hash) { - const { result } = await resolveProperties({ - network: this.getNetwork(), - result: this.#perform({ method: "getTransactionResult", hash }), - }); - if (result == null) { - return null; - } - return hexlify(result); - } - // Bloom-filter Queries - async getLogs(_filter) { - let filter = this._getFilter(_filter); - if (isPromise(filter)) { - filter = await filter; - } - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#perform({ method: "getLogs", filter }), - }); - return params.map((p) => this._wrapLog(p, network)); - } - // ENS - _getProvider(networkId) { - assert(false, "provider cannot connect to target network", "UNSUPPORTED_OPERATION", { - operation: "_getProvider()", - }); - } - async waitForTransaction(hash, _confirms, timeout) { - const confirms = _confirms != null ? _confirms : 1; - if (confirms === 0) { - return this.getTransactionReceipt(hash); - } - return new Promise(async (resolve, reject) => { - let timer = null; - const listener = async (blockNumber) => { - try { - const receipt = await this.getTransactionReceipt(hash); - if (receipt != null) { - if (blockNumber - receipt.blockNumber + 1 >= confirms) { - resolve(receipt); - //this.off("block", listener); - if (timer) { - clearTimeout(timer); - timer = null; - } - return; - } - } - } - catch (error) { - console.log("EEE", error); - } - this.once("block", listener); - }; - if (timeout != null) { - timer = setTimeout(() => { - if (timer == null) { - return; - } - timer = null; - this.off("block", listener); - reject(makeError("timeout", "TIMEOUT", { reason: "timeout" })); - }, timeout); - } - listener(await this.getBlockNumber()); - }); - } - async waitForBlock(blockTag) { - assert(false, "not implemented yet", "NOT_IMPLEMENTED", { - operation: "waitForBlock", - }); - } - _clearTimeout(timerId) { - const timer = this.#timers.get(timerId); - if (!timer) { - return; - } - if (timer.timer) { - clearTimeout(timer.timer); - } - this.#timers.delete(timerId); - } - _setTimeout(_func, timeout) { - if (timeout == null) { - timeout = 0; - } - const timerId = this.#nextTimer++; - const func = () => { - this.#timers.delete(timerId); - _func(); - }; - if (this.paused) { - this.#timers.set(timerId, { timer: null, func, time: timeout }); - } - else { - const timer = setTimeout(func, timeout); - this.#timers.set(timerId, { timer, func, time: getTime$1() }); - } - return timerId; - } - _forEachSubscriber(func) { - for (const sub of this.#subs.values()) { - func(sub.subscriber); - } - } - // Event API; sub-classes should override this; any supported - // event filter will have been munged into an EventFilter - _getSubscriber(sub) { - switch (sub.type) { - case "debug": - case "error": - case "network": - return new UnmanagedSubscriber(sub.type); - case "block": - return new PollingBlockSubscriber(this); - case "event": - return new PollingEventSubscriber(this, sub.filter); - case "transaction": - return new PollingTransactionSubscriber(this, sub.hash); - case "orphan": - return new PollingOrphanSubscriber(this, sub.filter); - } - throw new Error(`unsupported event: ${sub.type}`); - } - _recoverSubscriber(oldSub, newSub) { - for (const sub of this.#subs.values()) { - if (sub.subscriber === oldSub) { - if (sub.started) { - sub.subscriber.stop(); - } - sub.subscriber = newSub; - if (sub.started) { - newSub.start(); - } - if (this.#pausedState != null) { - newSub.pause(this.#pausedState); - } - break; - } - } - } - async #hasSub(event, emitArgs) { - let sub = await getSubscription(event); - // This is a log that is removing an existing log; we actually want - // to emit an orphan event for the removed log - if (sub.type === "event" && - emitArgs && - emitArgs.length > 0 && - emitArgs[0].removed === true) { - sub = await getSubscription({ orphan: "drop-log", log: emitArgs[0] }); - } - return this.#subs.get(sub.tag) || null; - } - async #getSub(event) { - const subscription = await getSubscription(event); - // Prevent tampering with our tag in any subclass' _getSubscriber - const tag = subscription.tag; - let sub = this.#subs.get(tag); - if (!sub) { - const subscriber = this._getSubscriber(subscription); - const addressableMap = new WeakMap(); - const nameMap = new Map(); - sub = { - subscriber, - tag, - addressableMap, - nameMap, - started: false, - listeners: [], - }; - this.#subs.set(tag, sub); - } - return sub; - } - async on(event, listener) { - const sub = await this.#getSub(event); - sub.listeners.push({ listener, once: false }); - if (!sub.started) { - sub.subscriber.start(); - sub.started = true; - if (this.#pausedState != null) { - sub.subscriber.pause(this.#pausedState); - } - } - return this; - } - async once(event, listener) { - const sub = await this.#getSub(event); - sub.listeners.push({ listener, once: true }); - if (!sub.started) { - sub.subscriber.start(); - sub.started = true; - if (this.#pausedState != null) { - sub.subscriber.pause(this.#pausedState); - } - } - return this; - } - async emit(event, ...args) { - const sub = await this.#hasSub(event, args); - // If there is not subscription or if a recent emit removed - // the last of them (which also deleted the sub) do nothing - if (!sub || sub.listeners.length === 0) { - return false; - } - const count = sub.listeners.length; - sub.listeners = sub.listeners.filter(({ listener, once }) => { - const payload = new EventPayload(this, once ? null : listener, event); - try { - listener.call(this, ...args, payload); - } - catch (error) { } - return !once; - }); - if (sub.listeners.length === 0) { - if (sub.started) { - sub.subscriber.stop(); - } - this.#subs.delete(sub.tag); - } - return count > 0; - } - async listenerCount(event) { - if (event) { - const sub = await this.#hasSub(event); - if (!sub) { - return 0; - } - return sub.listeners.length; - } - let total = 0; - for (const { listeners } of this.#subs.values()) { - total += listeners.length; - } - return total; - } - async listeners(event) { - if (event) { - const sub = await this.#hasSub(event); - if (!sub) { - return []; - } - return sub.listeners.map(({ listener }) => listener); - } - let result = []; - for (const { listeners } of this.#subs.values()) { - result = result.concat(listeners.map(({ listener }) => listener)); - } - return result; - } - async off(event, listener) { - const sub = await this.#hasSub(event); - if (!sub) { - return this; - } - if (listener) { - const index = sub.listeners - .map(({ listener }) => listener) - .indexOf(listener); - if (index >= 0) { - sub.listeners.splice(index, 1); - } - } - if (!listener || sub.listeners.length === 0) { - if (sub.started) { - sub.subscriber.stop(); - } - this.#subs.delete(sub.tag); - } - return this; - } - async removeAllListeners(event) { - if (event) { - const { tag, started, subscriber } = await this.#getSub(event); - if (started) { - subscriber.stop(); - } - this.#subs.delete(tag); - } - else { - for (const [tag, { started, subscriber }] of this.#subs) { - if (started) { - subscriber.stop(); - } - this.#subs.delete(tag); - } - } - return this; - } - // Alias for "on" - async addListener(event, listener) { - return await this.on(event, listener); - } - // Alias for "off" - async removeListener(event, listener) { - return this.off(event, listener); - } - // Sub-classes should override this to shutdown any sockets, etc. - // but MUST call this super.shutdown. - destroy() { - // Stop all listeners - this.removeAllListeners(); - // Shut down all tiemrs - for (const timerId of this.#timers.keys()) { - this._clearTimeout(timerId); - } - } - get paused() { - return this.#pausedState != null; - } - set paused(pause) { - if (!!pause === this.paused) { - return; - } - if (this.paused) { - this.resume(); - } - else { - this.pause(false); - } - } - pause(dropWhilePaused) { - this.#lastBlockNumber = -1; - if (this.#pausedState != null) { - if (this.#pausedState == !!dropWhilePaused) { - return; - } - assert(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", { - operation: "pause", - }); - } - this._forEachSubscriber((s) => s.pause(dropWhilePaused)); - this.#pausedState = !!dropWhilePaused; - for (const timer of this.#timers.values()) { - // Clear the timer - if (timer.timer) { - clearTimeout(timer.timer); - } - // Remaining time needed for when we become unpaused - timer.time = getTime$1() - timer.time; - } - } - resume() { - if (this.#pausedState == null) { - return; - } - this._forEachSubscriber((s) => s.resume()); - this.#pausedState = null; - for (const timer of this.#timers.values()) { - // Remaining time when we were paused - let timeout = timer.time; - if (timeout < 0) { - timeout = 0; - } - // Start time (in cause paused, so we con compute remaininf time) - timer.time = getTime$1(); - // Start the timer - setTimeout(timer.func, timeout); - } - } -} -function _parseString(result, start) { - try { - const bytes = _parseBytes(result, start); - if (bytes) { - return toUtf8String(bytes); - } - } - catch (error) { } - return null; -} -function _parseBytes(result, start) { - if (result === "0x") { - return null; - } - try { - const offset = getNumber(dataSlice(result, start, start + 32)); - const length = getNumber(dataSlice(result, offset, offset + 32)); - return dataSlice(result, offset + 32, offset + 32 + length); - } - catch (error) { } - return null; -} -function numPad(value) { - const result = toBeArray(value); - if (result.length > 32) { - throw new Error("internal; should not happen"); - } - const padded = new Uint8Array(32); - padded.set(result, 32 - result.length); - return padded; -} -function bytesPad(value) { - if (value.length % 32 === 0) { - return value; - } - const result = new Uint8Array(Math.ceil(value.length / 32) * 32); - result.set(value); - return result; -} -const empty = new Uint8Array([]); -// ABI Encodes a series of (bytes, bytes, ...) -function encodeBytes(datas) { - const result = []; - let byteCount = 0; - // Add place-holders for pointers as we add items - for (let i = 0; i < datas.length; i++) { - result.push(empty); - byteCount += 32; - } - for (let i = 0; i < datas.length; i++) { - const data = getBytes(datas[i]); - // Update the bytes offset - result[i] = numPad(byteCount); - // The length and padded value of data - result.push(numPad(data.length)); - result.push(bytesPad(data)); - byteCount += 32 + Math.ceil(data.length / 32) * 32; - } - return concat(result); -} -const zeros = "0x0000000000000000000000000000000000000000000000000000000000000000"; -function parseOffchainLookup(data) { - const result = { - sender: "", - urls: [], - calldata: "", - selector: "", - extraData: "", - errorArgs: [], - }; - assert(dataLength(data) >= 5 * 32, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", { - reason: "insufficient OffchainLookup data", - }); - const sender = dataSlice(data, 0, 32); - assert(dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup sender", - }); - result.sender = dataSlice(sender, 12); - // Read the URLs from the response - try { - const urls = []; - const urlsOffset = getNumber(dataSlice(data, 32, 64)); - const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32)); - const urlsData = dataSlice(data, urlsOffset + 32); - for (let u = 0; u < urlsLength; u++) { - const url = _parseString(urlsData, u * 32); - if (url == null) { - throw new Error("abort"); - } - urls.push(url); - } - result.urls = urls; - } - catch (error) { - assert(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup urls", - }); - } - // Get the CCIP calldata to forward - try { - const calldata = _parseBytes(data, 64); - if (calldata == null) { - throw new Error("abort"); - } - result.calldata = calldata; - } - catch (error) { - assert(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup calldata", - }); - } - // Get the callbackSelector (bytes4) - assert(dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup callbaackSelector", - }); - result.selector = dataSlice(data, 96, 100); - // Get the extra data to send back to the contract as context - try { - const extraData = _parseBytes(data, 128); - if (extraData == null) { - throw new Error("abort"); - } - result.extraData = extraData; - } - catch (error) { - assert(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup extraData", - }); - } - result.errorArgs = "sender,urls,calldata,selector,extraData" - .split(/,/) - .map((k) => result[k]); - return result; -} - -/** - * About Abstract Signer and subclassing - * - * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer] - */ -function checkProvider(signer, operation) { - if (signer.provider) { - return signer.provider; - } - assert(false, "missing provider", "UNSUPPORTED_OPERATION", { operation }); -} -async function populate(signer, tx) { - let pop = copyRequest(tx); - if (pop.to != null) { - pop.to = resolveAddress(pop.to); - } - if (pop.from != null) { - const from = pop.from; - pop.from = Promise.all([signer.getAddress(), resolveAddress(from)]).then(([address, from]) => { - assertArgument(address.toLowerCase() === from.toLowerCase(), "transaction from mismatch", "tx.from", from); - return address; - }); - } - else { - pop.from = signer.getAddress(); - } - return await resolveProperties(pop); -} -class AbstractSigner { - provider; - constructor(provider) { - defineProperties(this, { provider: provider || null }); - } - async getNonce(blockTag) { - return checkProvider(this, "getTransactionCount").getTransactionCount(await this.getAddress(), blockTag); - } - async populateCall(tx) { - const pop = await populate(this, tx); - return pop; - } - async populateTransaction(tx) { - const provider = checkProvider(this, "populateTransaction"); - const pop = await populate(this, tx); - if (pop.nonce == null) { - pop.nonce = await this.getNonce("pending"); - } - if (pop.energyLimit == null) { - pop.energyLimit = await this.estimateEnergy(pop); - } - // Populate the chain ID - const network = await this.provider.getNetwork(); - if (pop.networkId != null) { - const networkId = getBigInt(pop.networkId); - assertArgument(networkId === network.networkId, "transaction networkId mismatch", "tx.networkId", tx.networkId); - } - else { - pop.networkId = network.networkId; - } - // We need to get fee data to determine things - const feeData = await provider.getFeeData(); - // We need to auto-detect the intended type of this transaction... - if (feeData.energyPrice != null) { - // Network doesn't support EIP-1559... - // Populate missing fee data - if (pop.energyPrice == null) { - pop.energyPrice = feeData.energyPrice; - } - } - else { - // getFeeData has failed us. - assert(false, "failed to get consistent fee data", "UNSUPPORTED_OPERATION", { - operation: "signer.getFeeData", - }); - } - //@TOOD: Don't await all over the place; save them up for - // the end for better batching - return await resolveProperties(pop); - } - async estimateEnergy(tx) { - return checkProvider(this, "estimateEnergy").estimateEnergy(await this.populateCall(tx)); - } - async call(tx) { - return checkProvider(this, "call").call(await this.populateCall(tx)); - } - async resolveName(name) { - return getAddress(name); - } - async sendTransaction(tx) { - const provider = checkProvider(this, "sendTransaction"); - const pop = await this.populateTransaction(tx); - delete pop.from; - const txObj = Transaction.from(pop); - return await provider.broadcastTransaction(await this.signTransaction(txObj)); - } -} -class VoidSigner extends AbstractSigner { - address; - constructor(address, provider) { - super(provider); - defineProperties(this, { address }); - } - async getAddress() { - return this.address; - } - connect(provider) { - return new VoidSigner(this.address, provider); - } - #throwUnsupported(suffix, operation) { - assert(false, `VoidSigner cannot sign ${suffix}`, "UNSUPPORTED_OPERATION", { - operation, - }); - } - async signTransaction(tx) { - this.#throwUnsupported("transactions", "signTransaction"); - } - async signMessage(message) { - this.#throwUnsupported("messages", "signMessage"); - } - async signTypedData(domain, types, value) { - this.#throwUnsupported("typed-data", "signTypedData"); - } -} - -/** - * There are many awesome community services that provide Core - * nodes both for developers just starting out and for large-scale - * communities. - * - * @_section: api/providers/thirdparty: Community Providers [thirdparty] - */ -// Show the throttle message only once per service -const shown = new Set(); -/** - * Displays a warning in tht console when the community resource is - * being used too heavily by the app, recommending the developer - * acquire their own credentials instead of using the community - * credentials. - * - * The notification will only occur once per service. - */ -function showThrottleMessage(service) { - if (shown.has(service)) { - return; - } - shown.add(service); - console.log("========= NOTICE ========="); - console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`); - console.log(""); - console.log("The default API keys for each service are provided as a highly-throttled,"); - console.log("community resource for low-traffic projects and early prototyping."); - console.log(""); - console.log("While your application will continue to function, we highly recommended"); - console.log("signing up for your own API keys to improve performance, increase your"); - console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."); - console.log(""); -} - -function copy(obj) { - return JSON.parse(JSON.stringify(obj)); -} -/** - * Some backends support subscribing to events using a Filter ID. - * - * When subscribing with this technique, the node issues a unique - * //Filter ID//. At this point the node dedicates resources to - * the filter, so that periodic calls to follow up on the //Filter ID// - * will receive any events since the last call. - * - * @_docloc: api/providers/abstract-provider - */ -class FilterIdSubscriber { - #provider; - #filterIdPromise; - #poller; - #running; - #network; - #hault; - constructor(provider) { - this.#provider = provider; - this.#filterIdPromise = null; - this.#poller = this.#poll.bind(this); - this.#running = false; - this.#network = null; - this.#hault = false; - } - _subscribe(provider) { - throw new Error("subclasses must override this"); - } - _emitResults(provider, result) { - throw new Error("subclasses must override this"); - } - _recover(provider) { - throw new Error("subclasses must override this"); - } - async #poll(blockNumber) { - try { - // Subscribe if necessary - if (this.#filterIdPromise == null) { - this.#filterIdPromise = this._subscribe(this.#provider); - } - // Get the Filter ID - let filterId = null; - try { - filterId = await this.#filterIdPromise; - } - catch (error) { - if (!isError(error, "UNSUPPORTED_OPERATION") || - error.operation !== "xcb_newFilter") { - throw error; - } - } - // The backend does not support Filter ID; downgrade to - // polling - if (filterId == null) { - this.#filterIdPromise = null; - this.#provider._recoverSubscriber(this, this._recover(this.#provider)); - return; - } - const network = await this.#provider.getNetwork(); - if (!this.#network) { - this.#network = network; - } - if (this.#network.networkId !== network.networkId) { - throw new Error("chaid changed"); - } - if (this.#hault) { - return; - } - const result = await this.#provider.send("xcb_getFilterChanges", [ - filterId, - ]); - await this._emitResults(this.#provider, result); - } - catch (error) { - console.log("@TODO", error); - } - this.#provider.once("block", this.#poller); - } - #teardown() { - const filterIdPromise = this.#filterIdPromise; - if (filterIdPromise) { - this.#filterIdPromise = null; - filterIdPromise.then((filterId) => { - this.#provider.send("xcb_uninstallFilter", [filterId]); - }); - } - } - start() { - if (this.#running) { - return; - } - this.#running = true; - this.#poll(-2); - } - stop() { - if (!this.#running) { - return; - } - this.#running = false; - this.#hault = true; - this.#teardown(); - this.#provider.off("block", this.#poller); - } - pause(dropWhilePaused) { - if (dropWhilePaused) { - this.#teardown(); - } - this.#provider.off("block", this.#poller); - } - resume() { - this.start(); - } -} -/** - * A **FilterIdSubscriber** for receiving contract events. - * - * @_docloc: api/providers/abstract-provider - */ -class FilterIdEventSubscriber extends FilterIdSubscriber { - #event; - constructor(provider, filter) { - super(provider); - this.#event = copy(filter); - } - _recover(provider) { - return new PollingEventSubscriber(provider, this.#event); - } - async _subscribe(provider) { - const filterId = await provider.send("xcb_newFilter", [this.#event]); - return filterId; - } - async _emitResults(provider, results) { - for (const result of results) { - provider.emit(this.#event, provider._wrapLog(result, provider._network)); - } - } -} -/** - * A **FilterIdSubscriber** for receiving pending transactions events. - * - * @_docloc: api/providers/abstract-provider - */ -class FilterIdPendingSubscriber extends FilterIdSubscriber { - async _subscribe(provider) { - return await provider.send("xcb_newPendingTransactionFilter", []); - } - async _emitResults(provider, results) { - for (const result of results) { - provider.emit("pending", result); - } - } -} - -/** - * About JSON-RPC... - * - * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] - */ -// @TODO: -// - Add the batching API -const Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g); -//const Methods = "getAddress,then".split(/,/g); -function deepCopy(value) { - if (value == null || Primitive.indexOf(typeof value) >= 0) { - return value; - } - // Keep any Addressable - if (typeof value.getAddress === "function") { - return value; - } - if (Array.isArray(value)) { - return value.map(deepCopy); - } - if (typeof value === "object") { - return Object.keys(value).reduce((accum, key) => { - accum[key] = value[key]; - return accum; - }, {}); - } - throw new Error(`should not happen: ${value} (${typeof value})`); -} -function stall$3(duration) { - return new Promise((resolve) => { - setTimeout(resolve, duration); - }); -} -function getLowerCase(value) { - if (value) { - return value.toLowerCase(); - } - return value; -} -function isPollable(value) { - return value && typeof value.pollingInterval === "number"; -} -const defaultOptions = { - polling: false, - staticNetwork: null, - batchStallTime: 10, - batchMaxSize: 1 << 20, - batchMaxCount: 100, // 100 requests -}; -// @TODO: Unchecked Signers -class JsonRpcSigner extends AbstractSigner { - address; - constructor(provider, address) { - super(provider); - address = getAddress(address); - defineProperties(this, { address }); - } - connect(provider) { - assert(false, "cannot reconnect JsonRpcSigner", "UNSUPPORTED_OPERATION", { - operation: "signer.connect", - }); - } - async getAddress() { - return this.address; - } - // JSON-RPC will automatially fill in nonce, etc. so we just check from - async populateTransaction(tx) { - return await this.populateCall(tx); - } - // Returns just the hash of the transaction after sent, which is what - // the bare JSON-RPC API does; - async sendUncheckedTransaction(_tx) { - const tx = deepCopy(_tx); - const promises = []; - // Make sure the from matches the sender - if (tx.from) { - const _from = tx.from; - promises.push((async () => { - const from = await resolveAddress(_from); - assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); - tx.from = from; - })()); - } - else { - tx.from = this.address; - } - // The JSON-RPC for xcb_sendTransaction uses 90000 energy; if the user - // wishes to use this, it is easy to specify explicitly, otherwise - // we look it up for them. - if (tx.energyLimit == null) { - promises.push((async () => { - tx.energyLimit = await this.provider.estimateEnergy({ - ...tx, - from: this.address, - }); - })()); - } - // The address may be an ENS name or Addressable - if (tx.to != null) { - const _to = tx.to; - promises.push((async () => { - tx.to = await resolveAddress(_to); - })()); - } - // Wait until all of our properties are filled in - if (promises.length) { - await Promise.all(promises); - } - const hexTx = this.provider.getRpcTransaction(tx); - return this.provider.send("xcb_sendTransaction", [hexTx]); - } - async sendTransaction(tx) { - // This cannot be mined any earlier than any recent block - const blockNumber = await this.provider.getBlockNumber(); - // Send the transaction - const hash = await this.sendUncheckedTransaction(tx); - // Unfortunately, JSON-RPC only provides and opaque transaction hash - // for a response, and we need the actual transaction, so we poll - // for it; it should show up very quickly - return await new Promise((resolve, reject) => { - const timeouts = [1000, 100]; - const checkTx = async () => { - // Try getting the transaction - const tx = await this.provider.getTransaction(hash); - if (tx != null) { - resolve(tx.replaceableTransaction(blockNumber)); - return; - } - // Wait another 4 seconds - this.provider._setTimeout(() => { - checkTx(); - }, timeouts.pop() || 4000); - }; - checkTx(); - }); - } - async signTransaction(_tx) { - const tx = deepCopy(_tx); - // Make sure the from matches the sender - if (tx.from) { - const from = await resolveAddress(tx.from); - assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); - tx.from = from; - } - else { - tx.from = this.address; - } - const hexTx = this.provider.getRpcTransaction(tx); - return await this.provider.send("xcb_signTransaction", [hexTx]); - } - async signMessage(_message) { - const message = typeof _message === "string" ? toUtf8Bytes(_message) : _message; - return await this.provider.send("personal_sign", [ - hexlify(message), - this.address.toLowerCase(), - ]); - } - async signTypedData(domain, types, _value) { - const value = deepCopy(_value); - // Populate any ENS names (in-place) - const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (value) => { - const address = await resolveAddress(value); - assertArgument(address != null, "TypedData does not support null address", "value", value); - return address; - }); - return await this.provider.send("xcb_signTypedData_v4", [ - this.address.toLowerCase(), - JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value)), - ]); - } - async unlock(password) { - return this.provider.send("personal_unlockAccount", [ - this.address.toLowerCase(), - password, - null, - ]); - } - async _legacySignMessage(_message) { - const message = typeof _message === "string" ? toUtf8Bytes(_message) : _message; - return await this.provider.send("xcb_sign", [ - this.address.toLowerCase(), - hexlify(message), - ]); - } -} -/** - * The JsonRpcApiProvider is an abstract class and **MUST** be - * sub-classed. - * - * It provides the base for all JSON-RPC-based Provider interaction. - * - * Sub-classing Notes: - * - a sub-class MUST override _send - * - a sub-class MUST call the `_start()` method once connected - */ -class JsonRpcApiProvider extends AbstractProvider { - #options; - // The next ID to use for the JSON-RPC ID field - #nextId; - // Payloads are queued and triggered in batches using the drainTimer - #payloads; - #drainTimer; - #notReady; - #network; - #scheduleDrain() { - if (this.#drainTimer) { - return; - } - // If we aren't using batching, no hard in sending it immeidately - const stallTime = this._getOption("batchMaxCount") === 1 - ? 0 - : this._getOption("batchStallTime"); - this.#drainTimer = setTimeout(() => { - this.#drainTimer = null; - const payloads = this.#payloads; - this.#payloads = []; - while (payloads.length) { - // Create payload batches that satisfy our batch constraints - const batch = [payloads.shift()]; - while (payloads.length) { - if (batch.length === this.#options.batchMaxCount) { - break; - } - batch.push(payloads.shift()); - const bytes = JSON.stringify(batch.map((p) => p.payload)); - if (bytes.length > this.#options.batchMaxSize) { - payloads.unshift(batch.pop()); - break; - } - } - // Process the result to each payload - (async () => { - const payload = batch.length === 1 ? batch[0].payload : batch.map((p) => p.payload); - this.emit("debug", { action: "sendRpcPayload", payload }); - try { - // console.log({payload}) - const result = await this._send(payload); - // console.log({result}) - this.emit("debug", { action: "receiveRpcResult", result }); - // Process results in batch order - for (const { resolve, reject, payload } of batch) { - // Find the matching result - const resp = result.filter((r) => r.id === payload.id)[0]; - // No result; the node failed us in unexpected ways - if (resp == null) { - return reject(makeError("no response from server", "BAD_DATA", { - value: result, - info: { payload }, - })); - } - // The response is an error - if ("error" in resp) { - return reject(this.getRpcError(payload, resp)); - } - // All good; send the result - resolve(resp.result); - } - } - catch (error) { - this.emit("debug", { action: "receiveRpcError", error }); - for (const { reject } of batch) { - // @TODO: augment the error with the payload - reject(error); - } - } - })(); - } - }, stallTime); - } - constructor(network, options) { - super(network); - this.#nextId = 1; - this.#options = Object.assign({}, defaultOptions, options || {}); - this.#payloads = []; - this.#drainTimer = null; - this.#network = null; - { - let resolve = null; - const promise = new Promise((_resolve) => { - resolve = _resolve; - }); - this.#notReady = { promise, resolve }; - } - // Make sure any static network is compatbile with the provided netwrok - const staticNetwork = this._getOption("staticNetwork"); - if (staticNetwork) { - assertArgument(network == null || staticNetwork.matches(network), "staticNetwork MUST match network object", "options", options); - this.#network = staticNetwork; - } - } - /** - * Returns the value associated with the option %%key%%. - * - * Sub-classes can use this to inquire about configuration options. - */ - _getOption(key) { - return this.#options[key]; - } - /** - * Gets the [[Network]] this provider has committed to. On each call, the network - * is detected, and if it has changed, the call will reject. - */ - get _network() { - assert(this.#network, "network is not available yet", "NETWORK_ERROR"); - return this.#network; - } - /* - { - assert(false, "sub-classes must override _send", "UNSUPPORTED_OPERATION", { - operation: "jsonRpcApiProvider._send" - }); - } - */ - /** - * Resolves to the non-normalized value by performing %%req%%. - * - * Sub-classes may override this to modify behavior of actions, - * and should generally call ``super._perform`` as a fallback. - */ - async _perform(req) { - const request = this.getRpcRequest(req); - if (request != null) { - return await this.send(request.method, request.args); - } - return super._perform(req); - } - /** - * Sub-classes may override this; it detects the *actual* network that - * we are **currently** connected to. - * - * Keep in mind that [[send]] may only be used once [[ready]], otherwise the - * _send primitive must be used instead. - */ - async _detectNetwork() { - const network = this._getOption("staticNetwork"); - if (network) { - return network; - } - // If we are ready, use ``send``, which enabled requests to be batched - if (this.ready) { - return Network.from(getBigInt(await this.send("xcb_networkId", []))); - } - // We are not ready yet; use the primitive _send - const payload = { - id: this.#nextId++, - method: "xcb_networkId", - params: [], - jsonrpc: "2.0", - }; - this.emit("debug", { action: "sendRpcPayload", payload }); - let result; - try { - result = (await this._send(payload))[0]; - } - catch (error) { - this.emit("debug", { action: "receiveRpcError", error }); - throw error; - } - this.emit("debug", { action: "receiveRpcResult", result }); - if ("result" in result) { - return Network.from(getBigInt(result.result)); - } - throw this.getRpcError(payload, result); - } - /** - * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls - * will be passed to [[_send]] from [[send]]. If it is overridden, then - * ``super._start()`` **MUST** be called. - * - * Calling it multiple times is safe and has no effect. - */ - _start() { - if (this.#notReady == null || this.#notReady.resolve == null) { - return; - } - this.#notReady.resolve(); - this.#notReady = null; - (async () => { - // Bootstrap the network - while (this.#network == null) { - try { - this.#network = await this._detectNetwork(); - } - catch (error) { - console.log("JsonRpcProvider failed to startup; retry in 1s"); - await stall$3(1000); - } - } - // Start dispatching requests - this.#scheduleDrain(); - })(); - } - /** - * Resolves once the [[_start]] has been called. This can be used in - * sub-classes to defer sending data until the connection has been - * established. - */ - async _waitUntilReady() { - if (this.#notReady == null) { - return; - } - return await this.#notReady.promise; - } - /** - * Return a Subscriber that will manage the %%sub%%. - * - * Sub-classes may override this to modify the behavior of - * subscription management. - */ - _getSubscriber(sub) { - // Pending Filters aren't availble via polling - if (sub.type === "pending") { - return new FilterIdPendingSubscriber(this); - } - if (sub.type === "event") { - if (this._getOption("polling")) { - return new PollingEventSubscriber(this, sub.filter); - } - return new FilterIdEventSubscriber(this, sub.filter); - } - // Orphaned Logs are handled automatically, by the filter, since - // logs with removed are emitted by it - if (sub.type === "orphan" && sub.filter.orphan === "drop-log") { - return new UnmanagedSubscriber("orphan"); - } - return super._getSubscriber(sub); - } - /** - * Returns true only if the [[_start]] has been called. - */ - get ready() { - return this.#notReady == null; - } - /** - * Returns %%tx%% as a normalized JSON-RPC transaction request, - * which has all values hexlified and any numeric values converted - * to Quantity values. - */ - getRpcTransaction(tx) { - const result = {}; - // JSON-RPC now requires numeric values to be "quantity" values - [ - "networkId", - "energyLimit", - "energyPrice", - "type", - "nonce", - "value", - ].forEach((key) => { - if (tx[key] == null) { - return; - } - let dstKey = key; - if (key === "energyLimit") { - dstKey = "energy"; - } - result[dstKey] = toQuantity(getBigInt(tx[key], `tx.${key}`)); - }); - // Make sure addresses and data are lowercase - ["from", "to", "data"].forEach((key) => { - if (tx[key] == null) { - return; - } - result[key] = hexlify(tx[key]); - }); - return result; - } - /** - * Returns the request method and arguments required to perform - * %%req%%. - */ - getRpcRequest(req) { - switch (req.method) { - case "networkId": - return { method: "xcb_networkId", args: [] }; - case "getBlockNumber": - return { method: "xcb_blockNumber", args: [] }; - case "getEnergyPrice": - return { method: "xcb_energyPrice", args: [] }; - case "getBalance": { - return { - method: "xcb_getBalance", - args: [getLowerCase(req.address), req.blockTag], - }; - } - case "getTransactionCount": - return { - method: "xcb_getTransactionCount", - args: [getLowerCase(req.address), req.blockTag], - }; - case "getCode": - return { - method: "xcb_getCode", - args: [getLowerCase(req.address), req.blockTag], - }; - case "getStorage": - return { - method: "xcb_getStorageAt", - args: [ - getLowerCase(req.address), - "0x" + req.position.toString(16), - req.blockTag, - ], - }; - case "broadcastTransaction": - return { - method: "xcb_sendRawTransaction", - args: [req.signedTransaction], - }; - case "getBlock": - if ("blockTag" in req) { - return { - method: "xcb_getBlockByNumber", - args: [req.blockTag, !!req.includeTransactions], - }; - } - else if ("blockHash" in req) { - return { - method: "xcb_getBlockByHash", - args: [req.blockHash, !!req.includeTransactions], - }; - } - break; - case "getTransaction": - return { - method: "xcb_getTransactionByHash", - args: [req.hash], - }; - case "getTransactionReceipt": - return { - method: "xcb_getTransactionReceipt", - args: [req.hash], - }; - case "call": - return { - method: "xcb_call", - args: [this.getRpcTransaction(req.transaction), req.blockTag], - }; - case "estimateEnergy": { - return { - method: "xcb_estimateEnergy", - args: [this.getRpcTransaction(req.transaction)], - }; - } - case "getLogs": - if (req.filter && req.filter.address != null) { - if (Array.isArray(req.filter.address)) { - req.filter.address = req.filter.address.map(getLowerCase); - } - else { - req.filter.address = getLowerCase(req.filter.address); - } - } - return { method: "xcb_getLogs", args: [req.filter] }; - } - return null; - } - /** - * Returns an CoreBC-style Error for the given JSON-RPC error - * %%payload%%, coalescing the various strings and error shapes - * that different nodes return, coercing them into a machine-readable - * standardized error. - */ - getRpcError(payload, _error) { - const { method } = payload; - const { error } = _error; - if (method === "xcb_estimateEnergy" && error.message) { - const msg = error.message; - if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) { - return makeError("insufficient funds", "INSUFFICIENT_FUNDS", { - transaction: payload.params[0], - info: { payload, error }, - }); - } - } - if (method === "xcb_call" || method === "xcb_estimateEnergy") { - const result = spelunkData(error); - const e = AbiCoder.getBuiltinCallException(method === "xcb_call" ? "call" : "estimateEnergy", payload.params[0], result ? result.data : null); - e.info = { error, payload }; - return e; - } - // Only estimateEnergy and call can return arbitrary contract-defined text, so now we - // we can process text safely. - const message = JSON.stringify(spelunkMessage(error)); - if (typeof error.message === "string" && - error.message.match(/user denied|corebc-user-denied/i)) { - const actionMap = { - xcb_sign: "signMessage", - personal_sign: "signMessage", - xcb_signTypedData_v4: "signTypedData", - xcb_signTransaction: "signTransaction", - xcb_sendTransaction: "sendTransaction", - xcb_requestAccounts: "requestAccess", - wallet_requestAccounts: "requestAccess", - }; - return makeError(`user rejected action`, "ACTION_REJECTED", { - action: actionMap[method] || "unknown", - reason: "rejected", - info: { payload, error }, - }); - } - if (method === "xcb_sendRawTransaction" || - method === "xcb_sendTransaction") { - const transaction = payload.params[0]; - if (message.match(/insufficient funds|base fee exceeds energy limit/i)) { - return makeError("insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { - transaction, - info: { error }, - }); - } - if (message.match(/nonce/i) && message.match(/too low/i)) { - return makeError("nonce has already been used", "NONCE_EXPIRED", { - transaction, - info: { error }, - }); - } - // "replacement transaction underpriced" - if (message.match(/replacement transaction/i) && - message.match(/underpriced/i)) { - return makeError("replacement fee too low", "REPLACEMENT_UNDERPRICED", { - transaction, - info: { error }, - }); - } - if (message.match(/only replay-protected/i)) { - return makeError("legacy pre-eip-155 transactions not supported", "UNSUPPORTED_OPERATION", { - operation: method, - info: { transaction, info: { error } }, - }); - } - } - if (message.match(/the method .* does not exist/i)) { - return makeError("unsupported operation", "UNSUPPORTED_OPERATION", { - operation: payload.method, - info: { error }, - }); - } - return makeError("could not coalesce error", "UNKNOWN_ERROR", { error }); - } - /** - * Requests the %%method%% with %%params%% via the JSON-RPC protocol - * over the underlying channel. This can be used to call methods - * on the backend that do not have a high-level API within the Provider - * API. - * - * This method queues requests according to the batch constraints - * in the options, assigns the request a unique ID. - * - * **Do NOT override** this method in sub-classes; instead - * override [[_send]] or force the options values in the - * call to the constructor to modify this method's behavior. - */ - send(method, params) { - // @TODO: cache networkId?? purge on switch_networks - const id = this.#nextId++; - const promise = new Promise((resolve, reject) => { - this.#payloads.push({ - resolve, - reject, - payload: { method, params, id, jsonrpc: "2.0" }, - }); - }); - // If there is not a pending drainTimer, set one - this.#scheduleDrain(); - return promise; - } - /** - * Resolves to the [[Signer]] account for %%address%% managed by - * the client. - * - * If the %%address%% is a number, it is used as an index in the - * the accounts from [[listAccounts]]. - * - * This can only be used on clients which manage accounts (such as - * Geth with imported account or MetaMask). - * - * Throws if the account doesn't exist. - */ - async getSigner(address) { - if (address == null) { - address = 0; - } - const accountsPromise = this.send("xcb_accounts", []); - // Account index - if (typeof address === "number") { - const accounts = await accountsPromise; - if (address >= accounts.length) { - throw new Error("no such account"); - } - return new JsonRpcSigner(this, accounts[address]); - } - const { accounts } = await resolveProperties({ - network: this.getNetwork(), - accounts: accountsPromise, - }); - // Account address - address = getAddress(address); - for (const account of accounts) { - if (getAddress(account) === address) { - return new JsonRpcSigner(this, address); - } - } - throw new Error("invalid account"); - } - async listAccounts() { - const accounts = await this.send("xcb_accounts", []); - return accounts.map((a) => new JsonRpcSigner(this, a)); - } -} -class JsonRpcApiPollingProvider extends JsonRpcApiProvider { - #pollingInterval; - constructor(network, options) { - super(network, options); - this.#pollingInterval = 4000; - } - _getSubscriber(sub) { - const subscriber = super._getSubscriber(sub); - if (isPollable(subscriber)) { - subscriber.pollingInterval = this.#pollingInterval; - } - return subscriber; - } - /** - * The polling interval (default: 4000 ms) - */ - get pollingInterval() { - return this.#pollingInterval; - } - set pollingInterval(value) { - if (!Number.isInteger(value) || value < 0) { - throw new Error("invalid interval"); - } - this.#pollingInterval = value; - this._forEachSubscriber((sub) => { - if (isPollable(sub)) { - sub.pollingInterval = this.#pollingInterval; - } - }); - } -} -/** - * The JsonRpcProvider is one of the most common Providers, - * which performs all operations over HTTP (or HTTPS) requests. - * - * Events are processed by polling the backend for the current block - * number; when it advances, all block-base events are then checked - * for updates. - */ -class JsonRpcProvider extends JsonRpcApiPollingProvider { - #connect; - constructor(url, network, options) { - if (url == null) { - url = "http://localhost:8545"; - } - super(network, options); - if (typeof url === "string") { - this.#connect = new FetchRequest(url); - } - else { - this.#connect = url.clone(); - } - } - _getConnection() { - return this.#connect.clone(); - } - async send(method, params) { - // All requests are over HTTP, so we can just start handling requests - // We do this here rather than the constructor so that we don't send any - // requests to the network (i.e. xcb_networkId) until we absolutely have to. - await this._start(); - return await super.send(method, params); - } - async _send(payload) { - // Configure a POST connection for the requested method - const request = this._getConnection(); - request.body = JSON.stringify(payload); - request.setHeader("content-type", "application/json"); - const response = await request.send(); - response.assertOk(); - let resp = response.bodyJson; - if (!Array.isArray(resp)) { - resp = [resp]; - } - return resp; - } -} -function spelunkData(value) { - if (value == null) { - return null; - } - // These *are* the droids we're looking for. - if (typeof value.message === "string" && - value.message.match("reverted") && - isHexString(value.data)) { - return { message: value.message, data: value.data }; - } - // Spelunk further... - if (typeof value === "object") { - for (const key in value) { - const result = spelunkData(value[key]); - if (result) { - return result; - } - } - return null; - } - // Might be a JSON string we can further descend... - if (typeof value === "string") { - try { - return spelunkData(JSON.parse(value)); - } - catch (error) { } - } - return null; -} -function _spelunkMessage(value, result) { - if (value == null) { - return; - } - // These *are* the droids we're looking for. - if (typeof value.message === "string") { - result.push(value.message); - } - // Spelunk further... - if (typeof value === "object") { - for (const key in value) { - _spelunkMessage(value[key], result); - } - } - // Might be a JSON string we can further descend... - if (typeof value === "string") { - try { - return _spelunkMessage(JSON.parse(value), result); - } - catch (error) { } - } -} -function spelunkMessage(value) { - const result = []; - _spelunkMessage(value, result); - return result; -} - -/** - * [[link-ankr]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Polygon (``matic``) - * - Arbitrum (``arbitrum``) - * - * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] - */ -const defaultApiKey$1 = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; -function getHost$4(name) { - switch (name) { - case "mainnet": - return "rpc.ankr.com/eth"; - case "goerli": - return "rpc.ankr.com/xcb_goerli"; - case "matic": - return "rpc.ankr.com/polygon"; - case "arbitrum": - return "rpc.ankr.com/arbitrum"; - } - assertArgument(false, "unsupported network", "network", name); -} -/** - * The **AnkrProvider** connects to the [[link-ankr]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-ankr-signup). - */ -class AnkrProvider extends JsonRpcProvider { - /** - * The API key for the Ankr connection. - */ - apiKey; - /** - * Create a new **AnkrProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network, apiKey) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (apiKey == null) { - apiKey = defaultApiKey$1; - } - // Ankr does not support filterId, so we force polling - const options = { polling: true, staticNetwork: network }; - const request = AnkrProvider.getRequest(network, apiKey); - super(request, network, options); - defineProperties(this, { apiKey }); - } - _getProvider(networkId) { - try { - return new AnkrProvider(networkId, this.apiKey); - } - catch (error) { } - return super._getProvider(networkId); - } - /** - * Returns a prepared request for connecting to %%network%% with - * %%apiKey%%. - */ - static getRequest(network, apiKey) { - if (apiKey == null) { - apiKey = defaultApiKey$1; - } - const request = new FetchRequest(`https:/\/${getHost$4(network.name)}/${apiKey}`); - request.allowGzip = true; - if (apiKey === defaultApiKey$1) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("AnkrProvider"); - return true; - }; - } - return request; - } - getRpcError(payload, error) { - if (payload.method === "xcb_sendRawTransaction") { - if (error && - error.error && - error.error.message === "INTERNAL_ERROR: could not replace existing tx") { - error.error.message = "replacement transaction underpriced"; - } - } - return super.getRpcError(payload, error); - } - isCommunityResource() { - return this.apiKey === defaultApiKey$1; - } -} - -/** - * About Alchemy - * - * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] - */ -const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; -function getHost$3(name) { - switch (name) { - case "mainnet": - return "eth-mainnet.alchemyapi.io"; - case "goerli": - return "eth-goerli.g.alchemy.com"; - case "sepolia": - return "eth-sepolia.g.alchemy.com"; - case "arbitrum": - return "arb-mainnet.g.alchemy.com"; - case "arbitrum-goerli": - return "arb-goerli.g.alchemy.com"; - case "matic": - return "polygon-mainnet.g.alchemy.com"; - case "matic-mumbai": - return "polygon-mumbai.g.alchemy.com"; - case "optimism": - return "opt-mainnet.g.alchemy.com"; - case "optimism-goerli": - return "opt-goerli.g.alchemy.com"; - } - assertArgument(false, "unsupported network", "network", name); -} -/** - * The **AlchemyProvider** connects to the [[link-alchemy]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-alchemy-signup). - * - * @_docloc: api/providers/thirdparty - */ -class AlchemyProvider extends JsonRpcProvider { - apiKey; - constructor(_network, apiKey) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (apiKey == null) { - apiKey = defaultApiKey; - } - const request = AlchemyProvider.getRequest(network, apiKey); - super(request, network, { staticNetwork: network }); - defineProperties(this, { apiKey }); - } - _getProvider(networkId) { - try { - return new AlchemyProvider(networkId, this.apiKey); - } - catch (error) { } - return super._getProvider(networkId); - } - async _perform(req) { - // https://docs.alchemy.com/reference/trace-transaction - if (req.method === "getTransactionResult") { - const { trace, tx } = await resolveProperties({ - trace: this.send("trace_transaction", [req.hash]), - tx: this.getTransaction(req.hash), - }); - if (trace == null || tx == null) { - return null; - } - let data; - let error = false; - try { - data = trace[0].result.output; - error = trace[0].error === "Reverted"; - } - catch (error) { } - if (data) { - assert(!error, "an error occurred during transaction executions", "CALL_EXCEPTION", { - action: "getTransactionResult", - data, - reason: null, - transaction: tx, - invocation: null, - revert: null, // @TODO - }); - return data; - } - assert(false, "could not parse trace result", "BAD_DATA", { - value: trace, - }); - } - return await super._perform(req); - } - isCommunityResource() { - return this.apiKey === defaultApiKey; - } - static getRequest(network, apiKey) { - if (apiKey == null) { - apiKey = defaultApiKey; - } - const request = new FetchRequest(`https:/\/${getHost$3(network.name)}/v2/${apiKey}`); - request.allowGzip = true; - if (apiKey === defaultApiKey) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("alchemy"); - return true; - }; - } - return request; - } -} - -/** - * About Cloudflare - * - * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] - */ -/** - * About Cloudflare... - */ -class CloudflareProvider extends JsonRpcProvider { - constructor(_network) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - assertArgument(network.name === "mainnet", "unsupported network", "network", _network); - super("https://cloudflare-eth.com/", network, { staticNetwork: network }); - } -} - -function getGlobal() { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw new Error("unable to locate global object"); -} -const _WebSocket = getGlobal().WebSocket; - -/** - * Generic long-lived socket provider. - * - * Sub-classing notes - * - a sub-class MUST call the `_start()` method once connected - * - a sub-class MUST override the `_write(string)` method - * - a sub-class MUST call `_processMessage(string)` for each message - * - * @_subsection: api/providers/abstract-provider - */ -class SocketSubscriber { - #provider; - #filter; - get filter() { - return JSON.parse(this.#filter); - } - #filterId; - #paused; - #emitPromise; - constructor(provider, filter) { - this.#provider = provider; - this.#filter = JSON.stringify(filter); - this.#filterId = null; - this.#paused = null; - this.#emitPromise = null; - } - start() { - this.#filterId = this.#provider - .send("xcb_subscribe", this.filter) - .then((filterId) => { - this.#provider._register(filterId, this); - return filterId; - }); - } - stop() { - this.#filterId.then((filterId) => { - this.#provider.send("xcb_unsubscribe", [filterId]); - }); - this.#filterId = null; - } - // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs - // and resume - pause(dropWhilePaused) { - assert(dropWhilePaused, "preserve logs while paused not supported by SocketSubscriber yet", "UNSUPPORTED_OPERATION", { operation: "pause(false)" }); - this.#paused = !!dropWhilePaused; - } - resume() { - this.#paused = null; - } - _handleMessage(message) { - if (this.#filterId == null) { - return; - } - if (this.#paused === null) { - let emitPromise = this.#emitPromise; - if (emitPromise == null) { - emitPromise = this._emit(this.#provider, message); - } - else { - emitPromise = emitPromise.then(async () => { - await this._emit(this.#provider, message); - }); - } - this.#emitPromise = emitPromise.then(() => { - if (this.#emitPromise === emitPromise) { - this.#emitPromise = null; - } - }); - } - } - async _emit(provider, message) { - throw new Error("sub-classes must implemente this; _emit"); - } -} -class SocketBlockSubscriber extends SocketSubscriber { - constructor(provider) { - super(provider, ["newHeads"]); - } - async _emit(provider, message) { - provider.emit("block", parseInt(message.number)); - } -} -class SocketPendingSubscriber extends SocketSubscriber { - constructor(provider) { - super(provider, ["newPendingTransactions"]); - } - async _emit(provider, message) { - provider.emit("pending", message); - } -} -class SocketEventSubscriber extends SocketSubscriber { - #logFilter; - get logFilter() { - return JSON.parse(this.#logFilter); - } - constructor(provider, filter) { - super(provider, ["logs", filter]); - this.#logFilter = JSON.stringify(filter); - } - async _emit(provider, message) { - provider.emit(this.logFilter, provider._wrapLog(message, provider._network)); - } -} -/** - * SocketProvider... - * - */ -class SocketProvider extends JsonRpcApiProvider { - #callbacks; - // Maps each filterId to its subscriber - #subs; - // If any events come in before a subscriber has finished - // registering, queue them - #pending; - constructor(network) { - super(network, { batchMaxCount: 1 }); - this.#callbacks = new Map(); - this.#subs = new Map(); - this.#pending = new Map(); - } - // This value is only valid after _start has been called - /* - get _network(): Network { - if (this.#network == null) { - throw new Error("this shouldn't happen"); - } - return this.#network.clone(); - } - */ - _getSubscriber(sub) { - switch (sub.type) { - case "close": - return new UnmanagedSubscriber("close"); - case "block": - return new SocketBlockSubscriber(this); - case "pending": - return new SocketPendingSubscriber(this); - case "event": - return new SocketEventSubscriber(this, sub.filter); - case "orphan": - // Handled auto-matically within AbstractProvider - // when the log.removed = true - if (sub.filter.orphan === "drop-log") { - return new UnmanagedSubscriber("drop-log"); - } - } - return super._getSubscriber(sub); - } - _register(filterId, subscriber) { - this.#subs.set(filterId, subscriber); - const pending = this.#pending.get(filterId); - if (pending) { - for (const message of pending) { - subscriber._handleMessage(message); - } - this.#pending.delete(filterId); - } - } - async _send(payload) { - // WebSocket provider doesn't accept batches - assertArgument(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload); - // @TODO: stringify payloads here and store to prevent mutations - // Prepare a promise to respond to - const promise = new Promise((resolve, reject) => { - this.#callbacks.set(payload.id, { payload, resolve, reject }); - }); - // Wait until the socket is connected before writing to it - await this._waitUntilReady(); - // Write the request to the socket - await this._write(JSON.stringify(payload)); - return [await promise]; - } - // Sub-classes must call this once they are connected - /* - async _start(): Promise { - if (this.#ready) { return; } - - for (const { payload } of this.#callbacks.values()) { - await this._write(JSON.stringify(payload)); - } - - this.#ready = (async function() { - await super._start(); - })(); - } - */ - // Sub-classes must call this for each message - async _processMessage(message) { - const result = (JSON.parse(message)); - if ("id" in result) { - const callback = this.#callbacks.get(result.id); - if (callback == null) { - this.emit("error", makeError("received result for unknown id", "UNKNOWN_ERROR", { - reasonCode: "UNKNOWN_ID", - result, - })); - return; - } - this.#callbacks.delete(result.id); - callback.resolve(result); - } - else if (result.method === "xcb_subscription") { - const filterId = result.params.subscription; - const subscriber = this.#subs.get(filterId); - if (subscriber) { - subscriber._handleMessage(result.params.result); - } - else { - let pending = this.#pending.get(filterId); - if (pending == null) { - pending = []; - this.#pending.set(filterId, pending); - } - pending.push(result.params.result); - } - } - } - async _write(message) { - throw new Error("sub-classes must override this"); - } -} - -class WebSocketProvider extends SocketProvider { - #connect; - #websocket; - get websocket() { - if (this.#websocket == null) { - throw new Error("websocket closed"); - } - return this.#websocket; - } - constructor(url, network) { - super(network); - if (typeof url === "string") { - this.#connect = () => { - return new _WebSocket(url); - }; - this.#websocket = this.#connect(); - } - else if (typeof url === "function") { - this.#connect = url; - this.#websocket = url(); - } - else { - this.#connect = null; - this.#websocket = url; - } - this.websocket.onopen = async () => { - try { - await this._start(); - this.resume(); - } - catch (error) { - console.log("failed to start WebsocketProvider", error); - // @TODO: now what? Attempt reconnect? - } - }; - this.websocket.onmessage = (message) => { - this._processMessage(message.data); - }; - /* - this.websocket.onclose = (event) => { - // @TODO: What event.code should we reconnect on? - const reconnect = false; - if (reconnect) { - this.pause(true); - if (this.#connect) { - this.#websocket = this.#connect(); - this.#websocket.onopen = ... - // @TODO: this requires the super class to rebroadcast; move it there - } - this._reconnect(); - } - }; - */ - } - async _write(message) { - this.websocket.send(message); - } - async destroy() { - if (this.#websocket != null) { - this.#websocket.close(); - this.#websocket = null; - } - super.destroy(); - } -} - -/** - * [[link-infura]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Sepolia Testnet (``sepolia``) - * - Arbitrum (``arbitrum``) - * - Arbitrum Goerli Testnet (``arbitrum-goerli``) - * - Optimism (``optimism``) - * - Optimism Goerli Testnet (``optimism-goerli``) - * - Polygon (``matic``) - * - Polygon Mumbai Testnet (``matic-mumbai``) - * - * @_subsection: api/providers/thirdparty:INFURA [providers-infura] - */ -const defaultProjectId = "84842078b09946638c03157f83405213"; -function getHost$2(name) { - switch (name) { - case "mainnet": - return "mainnet.infura.io"; - case "goerli": - return "goerli.infura.io"; - case "sepolia": - return "sepolia.infura.io"; - case "arbitrum": - return "arbitrum-mainnet.infura.io"; - case "arbitrum-goerli": - return "arbitrum-goerli.infura.io"; - case "matic": - return "polygon-mainnet.infura.io"; - case "matic-mumbai": - return "polygon-mumbai.infura.io"; - case "optimism": - return "optimism-mainnet.infura.io"; - case "optimism-goerli": - return "optimism-goerli.infura.io"; - } - assertArgument(false, "unsupported network", "network", name); -} -/** - * The **InfuraWebSocketProvider** connects to the [[link-infura]] - * WebSocket end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-infura-signup). - */ -class InfuraWebSocketProvider extends WebSocketProvider { - /** - * The Project ID for the INFURA connection. - */ - projectId; - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - projectSecret; - /** - * Creates a new **InfuraWebSocketProvider**. - */ - constructor(network, projectId) { - const provider = new InfuraProvider(network, projectId); - const req = provider._getConnection(); - assert(!req.credentials, "INFURA WebSocket project secrets unsupported", "UNSUPPORTED_OPERATION", { operation: "InfuraProvider.getWebSocketProvider()" }); - const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); - super(url, network); - defineProperties(this, { - projectId: provider.projectId, - projectSecret: provider.projectSecret, - }); - } - isCommunityResource() { - return this.projectId === defaultProjectId; - } -} -/** - * The **InfuraProvider** connects to the [[link-infura]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-infura-signup). - */ -class InfuraProvider extends JsonRpcProvider { - /** - * The Project ID for the INFURA connection. - */ - projectId; - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - projectSecret; - /** - * Creates a new **InfuraProvider**. - */ - constructor(_network, projectId, projectSecret) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (projectId == null) { - projectId = defaultProjectId; - } - if (projectSecret == null) { - projectSecret = null; - } - const request = InfuraProvider.getRequest(network, projectId, projectSecret); - super(request, network, { staticNetwork: network }); - defineProperties(this, { projectId, projectSecret }); - } - _getProvider(networkId) { - try { - return new InfuraProvider(networkId, this.projectId, this.projectSecret); - } - catch (error) { } - return super._getProvider(networkId); - } - isCommunityResource() { - return this.projectId === defaultProjectId; - } - /** - * Creates a new **InfuraWebSocketProvider**. - */ - static getWebSocketProvider(network, projectId) { - return new InfuraWebSocketProvider(network, projectId); - } - /** - * Returns a prepared request for connecting to %%network%% - * with %%projectId%% and %%projectSecret%%. - */ - static getRequest(network, projectId, projectSecret) { - if (projectId == null) { - projectId = defaultProjectId; - } - if (projectSecret == null) { - projectSecret = null; - } - const request = new FetchRequest(`https:/\/${getHost$2(network.name)}/v3/${projectId}`); - request.allowGzip = true; - if (projectSecret) { - request.setCredentials("", projectSecret); - } - if (projectId === defaultProjectId) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("InfuraProvider"); - return true; - }; - } - return request; - } -} - -/** - * [[link-quicknode]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Arbitrum (``arbitrum``) - * - Arbitrum Goerli Testnet (``arbitrum-goerli``) - * - Optimism (``optimism``) - * - Optimism Goerli Testnet (``optimism-goerli``) - * - Polygon (``matic``) - * - Polygon Mumbai Testnet (``matic-mumbai``) - * - * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] - */ -const defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb"; -function getHost$1(name) { - switch (name) { - case "mainnet": - return "corebc.quiknode.pro"; - case "arbitrum": - return "corebc.arbitrum-mainnet.quiknode.pro"; - case "arbitrum-goerli": - return "corebc.arbitrum-goerli.quiknode.pro"; - case "matic": - return "corebc.matic.quiknode.pro"; - case "matic-mumbai": - return "corebc.matic-testnet.quiknode.pro"; - case "optimism": - return "corebc.optimism.quiknode.pro"; - case "optimism-goerli": - return "corebc.optimism-goerli.quiknode.pro"; - } - assertArgument(false, "unsupported network", "network", name); -} -/** - * The **QuickNodeProvider** connects to the [[link-quicknode]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API token is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-quicknode). - */ -class QuickNodeProvider extends JsonRpcProvider { - /** - * The API token. - */ - token; - /** - * Creates a new **QuickNodeProvider**. - */ - constructor(_network, token) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (token == null) { - token = defaultToken; - } - const request = QuickNodeProvider.getRequest(network, token); - super(request, network, { staticNetwork: network }); - defineProperties(this, { token }); - } - _getProvider(networkId) { - try { - return new QuickNodeProvider(networkId, this.token); - } - catch (error) { } - return super._getProvider(networkId); - } - isCommunityResource() { - return this.token === defaultToken; - } - /** - * Returns a new request prepared for %%network%% and the - * %%token%%. - */ - static getRequest(network, token) { - if (token == null) { - token = defaultToken; - } - const request = new FetchRequest(`https:/\/${getHost$1(network.name)}/${token}`); - request.allowGzip = true; - //if (projectSecret) { request.setCredentials("", projectSecret); } - if (token === defaultToken) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("QuickNodeProvider"); - return true; - }; - } - return request; - } -} - -/** - * Explain all the nitty-gritty about the **FallbackProvider**. - * - * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider] - */ -const BN_1 = BigInt("1"); -const BN_2 = BigInt("2"); -function shuffle(array) { - for (let i = array.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - const tmp = array[i]; - array[i] = array[j]; - array[j] = tmp; - } -} -function stall$2(duration) { - return new Promise((resolve) => { - setTimeout(resolve, duration); - }); -} -function getTime() { - return new Date().getTime(); -} -function stringify(value) { - return JSON.stringify(value, (key, value) => { - if (typeof value === "bigint") { - return { type: "bigint", value: value.toString() }; - } - return value; - }); -} -const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 }; -const defaultState = { - blockNumber: -2, - requests: 0, - lateResponses: 0, - errorResponses: 0, - outOfSync: -1, - unsupportedEvents: 0, - rollingDuration: 0, - score: 0, - _network: null, - _updateNumber: null, - _totalTime: 0, -}; -async function waitForSync(config, blockNumber) { - while (config.blockNumber < 0 || config.blockNumber < blockNumber) { - if (!config._updateNumber) { - config._updateNumber = (async () => { - const blockNumber = await config.provider.getBlockNumber(); - if (blockNumber > config.blockNumber) { - config.blockNumber = blockNumber; - } - config._updateNumber = null; - })(); - } - await config._updateNumber; - config.outOfSync++; - } -} -function _normalize(value) { - if (value == null) { - return "null"; - } - if (Array.isArray(value)) { - return "[" + value.map(_normalize).join(",") + "]"; - } - if (typeof value === "object" && typeof value.toJSON === "function") { - return _normalize(value.toJSON()); - } - switch (typeof value) { - case "boolean": - case "symbol": - return value.toString(); - case "bigint": - case "number": - return BigInt(value).toString(); - case "string": - return JSON.stringify(value); - case "object": { - const keys = Object.keys(value); - keys.sort(); - return ("{" + - keys - .map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`) - .join(",") + - "}"); - } - } - console.log("Could not serialize", value); - throw new Error("Hmm..."); -} -function normalizeResult(value) { - if ("error" in value) { - const error = value.error; - return { tag: _normalize(error), value: error }; - } - const result = value.result; - return { tag: _normalize(result), value: result }; -} -// This strategy picks the highest weight result, as long as the weight is -// equal to or greater than quorum -function checkQuorum(quorum, results) { - const tally = new Map(); - for (const { value, tag, weight } of results) { - const t = tally.get(tag) || { value, weight: 0 }; - t.weight += weight; - tally.set(tag, t); - } - let best = null; - for (const r of tally.values()) { - if (r.weight >= quorum && (!best || r.weight > best.weight)) { - best = r; - } - } - if (best) { - return best.value; - } - return undefined; -} -function getMedian(quorum, results) { - let resultWeight = 0; - const errorMap = new Map(); - let bestError = null; - const values = []; - for (const { value, tag, weight } of results) { - if (value instanceof Error) { - const e = errorMap.get(tag) || { value, weight: 0 }; - e.weight += weight; - errorMap.set(tag, e); - if (bestError == null || e.weight > bestError.weight) { - bestError = e; - } - } - else { - values.push(BigInt(value)); - resultWeight += weight; - } - } - if (resultWeight < quorum) { - // We have quorum for an error - if (bestError && bestError.weight >= quorum) { - return bestError.value; - } - // We do not have quorum for a result - return undefined; - } - // Get the sorted values - values.sort((a, b) => (a < b ? -1 : b > a ? 1 : 0)); - const mid = Math.floor(values.length / 2); - // Odd-length; take the middle value - if (values.length % 2) { - return values[mid]; - } - // Even length; take the ceiling of the mean of the center two values - return (values[mid - 1] + values[mid] + BN_1) / BN_2; -} -function getAnyResult(quorum, results) { - // If any value or error meets quorum, that is our preferred result - const result = checkQuorum(quorum, results); - if (result !== undefined) { - return result; - } - // Otherwise, do we have any result? - for (const r of results) { - if (r.value) { - return r.value; - } - } - // Nope! - return undefined; -} -function getFuzzyMode(quorum, results) { - if (quorum === 1) { - return getNumber(getMedian(quorum, results), "%internal"); - } - const tally = new Map(); - const add = (result, weight) => { - const t = tally.get(result) || { result, weight: 0 }; - t.weight += weight; - tally.set(result, t); - }; - for (const { weight, value } of results) { - const r = getNumber(value); - add(r - 1, weight); - add(r, weight); - add(r + 1, weight); - } - let bestWeight = 0; - let bestResult = undefined; - for (const { weight, result } of tally.values()) { - // Use this result, if this result meets quorum and has either: - // - a better weight - // - or equal weight, but the result is larger - if (weight >= quorum && - (weight > bestWeight || - (bestResult != null && weight === bestWeight && result > bestResult))) { - bestWeight = weight; - bestResult = result; - } - } - return bestResult; -} -/** - * A Fallback Provider. - * - */ -class FallbackProvider extends AbstractProvider { - quorum; - eventQuorum; - eventWorkers; - #configs; - #height; - #initialSyncPromise; - constructor(providers, network) { - super(network); - this.#configs = providers.map((p) => { - if (p instanceof AbstractProvider) { - return Object.assign({ provider: p }, defaultConfig, defaultState); - } - else { - return Object.assign({}, defaultConfig, p, defaultState); - } - }); - this.#height = -2; - this.#initialSyncPromise = null; - this.quorum = 2; //Math.ceil(providers.length / 2); - this.eventQuorum = 1; - this.eventWorkers = 1; - assertArgument(this.quorum <= this.#configs.reduce((a, c) => a + c.weight, 0), "quorum exceed provider wieght", "quorum", this.quorum); - } - get providerConfigs() { - return this.#configs.map((c) => { - const result = Object.assign({}, c); - for (const key in result) { - if (key[0] === "_") { - delete result[key]; - } - } - return result; - }); - } - async _detectNetwork() { - return Network.from(getBigInt(await this._perform({ method: "networkId" }))); - } - // @TODO: Add support to select providers to be the event subscriber - //_getSubscriber(sub: Subscription): Subscriber { - // throw new Error("@TODO"); - //} - async _translatePerform(provider, req) { - switch (req.method) { - case "broadcastTransaction": - return await provider.broadcastTransaction(req.signedTransaction); - case "call": - return await provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag })); - case "networkId": - return (await provider.getNetwork()).networkId; - case "estimateEnergy": - return await provider.estimateEnergy(req.transaction); - case "getBalance": - return await provider.getBalance(req.address, req.blockTag); - case "getBlock": { - const block = "blockHash" in req ? req.blockHash : req.blockTag; - return await provider.getBlock(block, req.includeTransactions); - } - case "getBlockNumber": - return await provider.getBlockNumber(); - case "getCode": - return await provider.getCode(req.address, req.blockTag); - case "getEnergyPrice": - return (await provider.getFeeData()).energyPrice; - case "getLogs": - return await provider.getLogs(req.filter); - case "getStorage": - return await provider.getStorage(req.address, req.position, req.blockTag); - case "getTransaction": - return await provider.getTransaction(req.hash); - case "getTransactionCount": - return await provider.getTransactionCount(req.address, req.blockTag); - case "getTransactionReceipt": - return await provider.getTransactionReceipt(req.hash); - case "getTransactionResult": - return await provider.getTransactionResult(req.hash); - } - } - // Grab the next (random) config that is not already part of - // the running set - #getNextConfig(running) { - // @TODO: Maybe do a check here to favour (heavily) providers that - // do not require waitForSync and disfavour providers that - // seem down-ish or are behaving slowly - const configs = Array.from(running).map((r) => r.config); - // Shuffle the states, sorted by priority - const allConfigs = this.#configs.slice(); - shuffle(allConfigs); - allConfigs.sort((a, b) => b.priority - a.priority); - for (const config of allConfigs) { - if (configs.indexOf(config) === -1) { - return config; - } - } - return null; - } - // Adds a new runner (if available) to running. - #addRunner(running, req) { - const config = this.#getNextConfig(running); - // No runners available - if (config == null) { - return null; - } - // Create a new runner - const runner = { - config, - result: null, - didBump: false, - perform: null, - staller: null, - }; - const now = getTime(); - // Start performing this operation - runner.perform = (async () => { - try { - config.requests++; - const result = await this._translatePerform(config.provider, req); - runner.result = { result }; - } - catch (error) { - config.errorResponses++; - runner.result = { error }; - } - const dt = getTime() - now; - config._totalTime += dt; - config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt; - runner.perform = null; - })(); - // Start a staller; when this times out, it's time to force - // kicking off another runner because we are taking too long - runner.staller = (async () => { - await stall$2(config.stallTimeout); - runner.staller = null; - })(); - running.add(runner); - return runner; - } - // Initializes the blockNumber and network for each runner and - // blocks until initialized - async #initialSync() { - let initialSync = this.#initialSyncPromise; - if (!initialSync) { - const promises = []; - this.#configs.forEach((config) => { - promises.push(waitForSync(config, 0)); - promises.push((async () => { - config._network = await config.provider.getNetwork(); - })()); - }); - this.#initialSyncPromise = initialSync = (async () => { - // Wait for all providers to have a block number and network - await Promise.all(promises); - // Check all the networks match - let networkId = null; - for (const config of this.#configs) { - const network = config._network; - if (networkId == null) { - networkId = network.networkId; - } - else if (network.networkId !== networkId) { - assert(false, "cannot mix providers on different networks", "UNSUPPORTED_OPERATION", { - operation: "new FallbackProvider", - }); - } - } - })(); - } - await initialSync; - } - async #checkQuorum(running, req) { - // Get all the result objects - const results = []; - for (const runner of running) { - if (runner.result != null) { - const { tag, value } = normalizeResult(runner.result); - results.push({ tag, value, weight: runner.config.weight }); - } - } - // Are there enough results to event meet quorum? - if (results.reduce((a, r) => a + r.weight, 0) < this.quorum) { - return undefined; - } - switch (req.method) { - case "getBlockNumber": { - // We need to get the bootstrap block height - if (this.#height === -2) { - this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.map((c) => ({ - value: c.blockNumber, - tag: getNumber(c.blockNumber).toString(), - weight: c.weight, - }))))); - } - // Find the mode across all the providers, allowing for - // a little drift between block heights - const mode = getFuzzyMode(this.quorum, results); - if (mode === undefined) { - return undefined; - } - if (mode > this.#height) { - this.#height = mode; - } - return this.#height; - } - case "getEnergyPrice": - case "estimateEnergy": - return getMedian(this.quorum, results); - case "getBlock": - // Pending blocks are in the mempool and already - // quite untrustworthy; just grab anything - if ("blockTag" in req && req.blockTag === "pending") { - return getAnyResult(this.quorum, results); - } - return checkQuorum(this.quorum, results); - case "call": - case "networkId": - case "getBalance": - case "getTransactionCount": - case "getCode": - case "getStorage": - case "getTransaction": - case "getTransactionReceipt": - case "getLogs": - return checkQuorum(this.quorum, results); - case "broadcastTransaction": - return getAnyResult(this.quorum, results); - } - assert(false, "unsupported method", "UNSUPPORTED_OPERATION", { - operation: `_perform(${stringify(req.method)})`, - }); - } - async #waitForQuorum(running, req) { - if (running.size === 0) { - throw new Error("no runners?!"); - } - // Any promises that are interesting to watch for; an expired stall - // or a successful perform - const interesting = []; - let newRunners = 0; - for (const runner of running) { - // No responses, yet; keep an eye on it - if (runner.perform) { - interesting.push(runner.perform); - } - // Still stalling... - if (runner.staller) { - interesting.push(runner.staller); - continue; - } - // This runner has already triggered another runner - if (runner.didBump) { - continue; - } - // Got a response (result or error) or stalled; kick off another runner - runner.didBump = true; - newRunners++; - } - // Check if we have reached quorum on a result (or error) - const value = await this.#checkQuorum(running, req); - if (value !== undefined) { - if (value instanceof Error) { - throw value; - } - return value; - } - // Add any new runners, because a staller timed out or a result - // or error response came in. - for (let i = 0; i < newRunners; i++) { - this.#addRunner(running, req); - } - // All providers have returned, and we have no result - assert(interesting.length > 0, "quorum not met", "SERVER_ERROR", { - request: "%sub-requests", - info: { - request: req, - results: Array.from(running).map((r) => stringify(r.result)), - }, - }); - // Wait for someone to either complete its perform or stall out - await Promise.race(interesting); - // This is recursive, but at worst case the depth is 2x the - // number of providers (each has a perform and a staller) - return await this.#waitForQuorum(running, req); - } - async _perform(req) { - // Broadcasting a transaction is rare (ish) and already incurs - // a cost on the user, so spamming is safe-ish. Just send it to - // every backend. - if (req.method === "broadcastTransaction") { - const results = await Promise.all(this.#configs.map(async ({ provider, weight }) => { - try { - const result = await provider._perform(req); - return Object.assign(normalizeResult({ result }), { weight }); - } - catch (error) { - return Object.assign(normalizeResult({ error }), { weight }); - } - })); - const result = getAnyResult(this.quorum, results); - assert(result !== undefined, "problem multi-broadcasting", "SERVER_ERROR", { - request: "%sub-requests", - info: { request: req, results: results.map(stringify) }, - }); - if (result instanceof Error) { - throw result; - } - return result; - } - await this.#initialSync(); - // Bootstrap enough runners to meet quorum - const running = new Set(); - for (let i = 0; i < this.quorum; i++) { - this.#addRunner(running, req); - } - const result = await this.#waitForQuorum(running, req); - // Track requests sent to a provider that are still - // outstanding after quorum has been otherwise found - for (const runner of running) { - if (runner.perform && runner.result == null) { - runner.config.lateResponses++; - } - } - return result; - } - async destroy() { - for (const { provider } of this.#configs) { - provider.destroy(); - } - super.destroy(); - } -} - -function isWebSocketLike(value) { - return (value && - typeof value.send === "function" && - typeof value.close === "function"); -} -function getDefaultProvider(network, options) { - if (options == null) { - options = {}; - } - if (typeof network === "string" && network.match(/^https?:/)) { - return new JsonRpcProvider(network); - } - if ((typeof network === "string" && network.match(/^wss?:/)) || - isWebSocketLike(network)) { - return new WebSocketProvider(network); - } - const providers = []; - if (options.alchemy !== "-") { - try { - providers.push(new AlchemyProvider(network, options.alchemy)); - } - catch (error) { - console.log(error); - } - } - if (options.ankr !== "-" && options.ankr != null) { - try { - providers.push(new AnkrProvider(network, options.ankr)); - } - catch (error) { - console.log(error); - } - } - if (options.cloudflare !== "-") { - try { - providers.push(new CloudflareProvider(network)); - } - catch (error) { - console.log(error); - } - } - if (options.infura !== "-") { - try { - let projectId = options.infura; - let projectSecret = undefined; - if (typeof projectId === "object") { - projectSecret = projectId.projectSecret; - projectId = projectId.projectId; - } - providers.push(new InfuraProvider(network, projectId, projectSecret)); - } - catch (error) { - console.log(error); - } - } - /* - if (options.pocket !== "-") { - try { - let appId = options.pocket; - let secretKey: undefined | string = undefined; - let loadBalancer: undefined | boolean = undefined; - if (typeof(appId) === "object") { - loadBalancer = !!appId.loadBalancer; - secretKey = appId.secretKey; - appId = appId.appId; - } - providers.push(new PocketProvider(network, appId, secretKey, loadBalancer)); - } catch (error) { console.log(error); } - } - */ - if (options.quicknode !== "-") { - try { - let token = options.quicknode; - providers.push(new QuickNodeProvider(network, token)); - } - catch (error) { - console.log(error); - } - } - assert(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", { - operation: "getDefaultProvider", - }); - if (providers.length === 1) { - return providers[0]; - } - return new FallbackProvider(providers); -} - -class NonceManager extends AbstractSigner { - signer; - #noncePromise; - #delta; - constructor(signer) { - super(signer.provider); - defineProperties(this, { signer }); - this.#noncePromise = null; - this.#delta = 0; - } - async getAddress() { - return this.signer.getAddress(); - } - connect(provider) { - return new NonceManager(this.signer.connect(provider)); - } - async getNonce(blockTag) { - if (blockTag === "pending") { - if (this.#noncePromise == null) { - this.#noncePromise = super.getNonce("pending"); - } - const delta = this.#delta; - return (await this.#noncePromise) + delta; - } - return super.getNonce(blockTag); - } - increment() { - this.#delta++; - } - reset() { - this.#delta = 0; - this.#noncePromise = null; - } - async sendTransaction(tx) { - const noncePromise = this.getNonce("pending"); - this.increment(); - tx = await this.signer.populateTransaction(tx); - tx.nonce = await noncePromise; - // @TODO: Maybe handle interesting/recoverable errors? - // Like don't increment if the tx was certainly not sent - return await this.signer.sendTransaction(tx); - } - signTransaction(tx) { - return this.signer.signTransaction(tx); - } - signMessage(message) { - return this.signer.signMessage(message); - } - signTypedData(domain, types, value) { - return this.signer.signTypedData(domain, types, value); - } -} - -class BrowserProvider extends JsonRpcApiPollingProvider { - #request; - constructor(core, network) { - super(network, { batchMaxCount: 1 }); - this.#request = async (method, params) => { - const payload = { method, params }; - this.emit("debug", { action: "sendEip1193Request", payload }); - try { - const result = await core.request(payload); - this.emit("debug", { action: "receiveEip1193Result", result }); - return result; - } - catch (e) { - const error = new Error(e.message); - error.code = e.code; - error.data = e.data; - error.payload = payload; - this.emit("debug", { action: "receiveEip1193Error", error }); - throw error; - } - }; - } - async send(method, params) { - await this._start(); - return await super.send(method, params); - } - async _send(payload) { - assertArgument(!Array.isArray(payload), "EIP-1193 does not support batch request", "payload", payload); - try { - const result = await this.#request(payload.method, payload.params || []); - return [{ id: payload.id, result }]; - } - catch (e) { - return [ - { - id: payload.id, - error: { code: e.code, data: e.data, message: e.message }, - }, - ]; - } - } - getRpcError(payload, error) { - error = JSON.parse(JSON.stringify(error)); - // EIP-1193 gives us some machine-readable error codes, so rewrite - // them into - switch (error.error.code || -1) { - case 4001: - error.error.message = `corebc-user-denied: ${error.error.message}`; - break; - case 4200: - error.error.message = `corebc-unsupported: ${error.error.message}`; - break; - } - return super.getRpcError(payload, error); - } - async hasSigner(address) { - if (address == null) { - address = 0; - } - const accounts = await this.send("xcb_accounts", []); - if (typeof address === "number") { - return accounts.length > address; - } - address = address.toLowerCase(); - return (accounts.filter((a) => a.toLowerCase() === address).length !== 0); - } - async getSigner(address) { - if (address == null) { - address = 0; - } - if (!(await this.hasSigner(address))) { - try { - //const resp = - await this.#request("xcb_requestAccounts", []); - //console.log("RESP", resp); - } - catch (error) { - const payload = error.payload; - throw this.getRpcError(payload, { id: payload.id, error }); - } - } - return await super.getSigner(address); - } -} - -/** - * [[link-pocket]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Polygon (``matic``) - * - Arbitrum (``arbitrum``) - * - * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] - */ -const defaultApplicationId = "62e1ad51b37b8e00394bda3b"; -function getHost(name) { - switch (name) { - case "mainnet": - return "eth-mainnet.gateway.pokt.network"; - case "goerli": - return "eth-goerli.gateway.pokt.network"; - case "matic": - return "poly-mainnet.gateway.pokt.network"; - case "matic-mumbai": - return "polygon-mumbai-rpc.gateway.pokt.network"; - } - assertArgument(false, "unsupported network", "network", name); -} -/** - * The **PocketProvider** connects to the [[link-pocket]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-pocket-signup). - */ -class PocketProvider extends JsonRpcProvider { - /** - * The Application ID for the Pocket connection. - */ - applicationId; - /** - * The Application Secret for making authenticated requests - * to the Pocket connection. - */ - applicationSecret; - /** - * Create a new **PocketProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network, applicationId, applicationSecret) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (applicationId == null) { - applicationId = defaultApplicationId; - } - if (applicationSecret == null) { - applicationSecret = null; - } - const options = { staticNetwork: network }; - const request = PocketProvider.getRequest(network, applicationId, applicationSecret); - super(request, network, options); - defineProperties(this, { - applicationId, - applicationSecret, - }); - } - _getProvider(networkId) { - try { - return new PocketProvider(networkId, this.applicationId, this.applicationSecret); - } - catch (error) { } - return super._getProvider(networkId); - } - /** - * Returns a prepared request for connecting to %%network%% with - * %%applicationId%%. - */ - static getRequest(network, applicationId, applicationSecret) { - if (applicationId == null) { - applicationId = defaultApplicationId; - } - const request = new FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`); - request.allowGzip = true; - if (applicationSecret) { - request.setCredentials("", applicationSecret); - } - if (applicationId === defaultApplicationId) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("PocketProvider"); - return true; - }; - } - return request; - } - isCommunityResource() { - return this.applicationId === defaultApplicationId; - } -} - -const IpcSocketProvider = undefined; - -/** - * The **BaseWallet** is a stream-lined implementation of a - * [[Signer]] that operates with a private key. - * - * It is preferred to use the [[Wallet]] class, as it offers - * additional functionality and simplifies loading a variety - * of JSON formats, Mnemonic Phrases, etc. - * - * This class may be of use for those attempting to implement - * a minimal Signer. - */ -class BaseWallet extends AbstractSigner { - /** - * The wallet address. - */ - address; - prefix; - #signingKey; - /** - * Creates a new BaseWallet for %%privateKey%%, optionally - * connected to %%provider%%. - * - * If %%provider%% is not specified, only offline methods can - * be used. - */ - constructor({ signingKey, prefix, provider, }) { - super(provider); - this.prefix = prefix; - assertArgument(signingKey && typeof signingKey.sign === "function", "invalid signingKey key", "signingKey", "[ REDACTED ]"); - this.#signingKey = signingKey; - const address = computeAddress(this.#signingKey, prefix); - defineProperties(this, { address }); - } - // Store private values behind getters to reduce visibility - // in console.log - /** - * The [[SigningKey]] used for signing payloads. - */ - get signingKey() { - return this.#signingKey; - } - /** - * The private key for this wallet. - */ - get privateKey() { - return this.signingKey.privateKey; - } - async getAddress() { - return this.address; - } - connect(provider) { - return new BaseWallet({ - signingKey: this.#signingKey, - prefix: this.prefix, - provider, - }); - } - async signTransaction(tx) { - // Replace any Addressable or ENS name with an address - const { to, from } = await resolveProperties({ - to: tx.to || undefined, - from: tx.from || undefined, - }); - if (to != null) { - tx.to = to; - } - if (from != null) { - tx.from = from; - } - if (tx.from != null) { - assertArgument(getAddress(tx.from) === this.address, "transaction from address mismatch", "tx.from", tx.from); - delete tx.from; - } - // Build the transaction - const btx = Transaction.from(tx); - const unSignedSerialized = btx.unsignedSerialized; - const unsignedHash = sha256(unSignedSerialized); - // sha256(btx.unsignedSerialized) - btx.signature = this.signingKey.sign(unsignedHash); - return btx.serialized; - } - async signMessage(message) { - return this.signMessageSync(message); - } - // @TODO: Add a secialized signTx and signTyped sync that enforces - // all parameters are known? - /** - * Returns the signature for %%message%% signed with this wallet. - */ - signMessageSync(message) { - return this.signingKey.sign(hashMessage(message)); - } - async signTypedData(domain, types, value) { - // Populate any ENS names - const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (name) => { - // @TODO: this should use resolveName; addresses don't - // need a provider - assert(this.provider != null, "cannot resolve ENS names without a provider", "UNSUPPORTED_OPERATION", { - operation: "resolveName", - info: { name }, - }); - const address = getAddress(name); - assert(address != null, "unconfigured ENS name", "UNCONFIGURED_NAME", { - value: name, - }); - return address; - }); - return this.signingKey.sign(TypedDataEncoder.hash(populated.domain, types, populated.value)); - } -} - -const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; -const Word = /^[a-z]*$/i; -function unfold(words, sep) { - let initial = 97; - return words.reduce((accum, word) => { - if (word === sep) { - initial++; - } - else if (word.match(Word)) { - accum.push(String.fromCharCode(initial) + word); - } - else { - initial = 97; - accum.push(word); - } - return accum; - }, []); -} -/** - * @_ignore - */ -function decode(data, subs) { - // Replace all the substitutions with their expanded form - for (let i = subsChrs.length - 1; i >= 0; i--) { - data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); - } - // Get all tle clumps; each suffix, first-increment and second-increment - const clumps = []; - const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => { - if (semi) { - for (let i = parseInt(semi); i >= 0; i--) { - clumps.push(";"); - } - } - else { - clumps.push(item.toLowerCase()); - } - return ""; - }); - /* c8 ignore start */ - if (leftover) { - throw new Error(`leftovers: ${JSON.stringify(leftover)}`); - } - /* c8 ignore stop */ - return unfold(unfold(clumps, ";"), ":"); -} -/** - * @_ignore - */ -function decodeOwl(data) { - assertArgument(data[0] === "0", "unsupported auwl data", "data", data); - return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length)); -} - -/** - * A Wordlist represents a collection of language-specific - * words used to encode and devoce [[link-bip-39]] encoded data - * by mapping words to 11-bit values and vice versa. - */ -class Wordlist { - locale; - /** - * Creates a new Wordlist instance. - * - * Sub-classes MUST call this if they provide their own constructor, - * passing in the locale string of the language. - * - * Generally there is no need to create instances of a Wordlist, - * since each language-specific Wordlist creates an instance and - * there is no state kept internally, so they are safe to share. - */ - constructor(locale) { - defineProperties(this, { locale }); - } - /** - * Sub-classes may override this to provide a language-specific - * method for spliting %%phrase%% into individual words. - * - * By default, %%phrase%% is split using any sequences of - * white-space as defined by regular expressions (i.e. ``/\s+/``). - */ - split(phrase) { - return phrase.toLowerCase().split(/\s+/g); - } - /** - * Sub-classes may override this to provider a language-specific - * method for joining %%words%% into a phrase. - * - * By default, %%words%% are joined by a single space. - */ - join(words) { - return words.join(" "); - } - static check(wordlist) { - const words = []; - for (let i = 0; i < 2048; i++) { - const word = wordlist.getWord(i); - /* istanbul ignore if */ - if (i !== wordlist.getWordIndex(word)) { - return "0x"; - } - words.push(word); - } - return id(words.join("\n") + "\n"); - } -} - -// Use the encode-latin.js script to create the necessary -// data files to be consumed by this class -/** - * An OWL format Wordlist is an encoding method that exploits - * the general locality of alphabetically sorted words to - * achieve a simple but effective means of compression. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on ASCII-7 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ -class WordlistOwl extends Wordlist { - #data; - #checksum; - /** - * Creates a new Wordlist for %%locale%% using the OWL %%data%% - * and validated against the %%checksum%%. - */ - constructor(locale, data, checksum) { - super(locale); - this.#data = data; - this.#checksum = checksum; - this.#words = null; - } - get _data() { - return this.#data; - } - _decodeWords() { - return decodeOwl(this.#data); - } - #words; - #loadWords() { - if (this.#words == null) { - const words = this._decodeWords(); - // Verify the computed list matches the official list - const checksum = id(words.join("\n") + "\n", true); - /* c8 ignore start */ - if (checksum !== this.#checksum) { - throw new Error(`BIP39 Wordlist for ${this.locale} FffffAILED`); - } - /* c8 ignore stop */ - this.#words = words; - } - return this.#words; - } - getWord(index) { - const words = this.#loadWords(); - assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); - return words[index]; - } - getWordIndex(word) { - return this.#loadWords().indexOf(word); - } -} - -const words = "0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`S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U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO"; -const checksum = "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"; -let wordlist = null; -/** - * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -class LangEn extends WordlistOwl { - /** - * Creates a new instance of the English language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langEn]] should suffice. - * - * @_ignore: - */ - constructor() { - super("en", words, checksum); - } - /** - * Returns a singleton instance of a ``LangEn``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist == null) { - wordlist = new LangEn(); - } - return wordlist; - } -} - -function mnemonicToSeed(mnemonic, password) { - if (!password) { - password = ""; - } - const t = generateSeed(mnemonic, password); - return t.goldilock; -} -const generateSeed = (mnemonic, password) => { - const goldilockSaltPrefix = "mnemonic"; - const aesSaltPrefix = "mnemonicfortheAESkey"; - const goldilockSalt = utf8.encode(goldilockSaltPrefix + password); - const aesSalt = utf8.encode(aesSaltPrefix + password); - const goldilockKey = pbkdf2Sync(Buffer.from(mnemonic), goldilockSalt, 2048, 64, "sha512"); - const aesKeySeed = pbkdf2Sync(Buffer.from(mnemonic), aesSalt, 2048, 64, "sha512"); - return { - aes: aesKeySeed.toString("hex"), - goldilock: goldilockKey.toString("hex"), - }; -}; - -// Returns a byte with the MSB bits set -function getUpperMask(bits) { - return (((1 << bits) - 1) << (8 - bits)) & 0xff; -} -// Returns a byte with the LSB bits set -function getLowerMask(bits) { - return ((1 << bits) - 1) & 0xff; -} -function mnemonicToEntropy(mnemonic, wordlist) { - assertNormalize("NFKD"); - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - const words = wordlist.split(mnemonic); - assertArgument(words.length % 3 === 0 && words.length >= 12 && words.length <= 24, "invalid mnemonic length", "mnemonic", "[ REDACTED ]"); - const entropy = new Uint8Array(Math.ceil((11 * words.length) / 8)); - let offset = 0; - for (let i = 0; i < words.length; i++) { - let index = wordlist.getWordIndex(words[i].normalize("NFKD")); - assertArgument(index >= 0, `invalid mnemonic word at index ${i}`, "mnemonic", "[ REDACTED ]"); - for (let bit = 0; bit < 11; bit++) { - if (index & (1 << (10 - bit))) { - entropy[offset >> 3] |= 1 << (7 - (offset % 8)); - } - offset++; - } - } - const entropyBits = (32 * words.length) / 3; - const checksumBits = words.length / 3; - const checksumMask = getUpperMask(checksumBits); - const checksum = getBytes(legacySha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; - assertArgument(checksum === (entropy[entropy.length - 1] & checksumMask), "invalid mnemonic checksum", "mnemonic", "[ REDACTED ]"); - return hexlify(entropy.slice(0, entropyBits / 8)); -} -function entropyToMnemonic(entropy, wordlist) { - assertArgument(entropy.length % 4 === 0 && entropy.length >= 16 && entropy.length <= 32, "invalid entropy size", "entropy", "[ REDACTED ]"); - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - const indices = [0]; - let remainingBits = 11; - for (let i = 0; i < entropy.length; i++) { - // Consume the whole byte (with still more to go) - if (remainingBits > 8) { - indices[indices.length - 1] <<= 8; - indices[indices.length - 1] |= entropy[i]; - remainingBits -= 8; - // This byte will complete an 11-bit index - } - else { - indices[indices.length - 1] <<= remainingBits; - indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); - // Start the next word - indices.push(entropy[i] & getLowerMask(8 - remainingBits)); - remainingBits += 3; - } - } - // Compute the checksum bits - const checksumBits = entropy.length / 4; - const checksum = parseInt(legacySha256(entropy).substring(2, 4), 16) & - getUpperMask(checksumBits); - // Shift the checksum into the word indices - indices[indices.length - 1] <<= checksumBits; - indices[indices.length - 1] |= checksum >> (8 - checksumBits); - return wordlist.join(indices.map((index) => wordlist.getWord(index))); -} -const _guard$1 = {}; -/** - * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] - * seeds and convert between phrases and entropy. - */ -class Mnemonic { - /** - * The mnemonic phrase of 12, 15, 18, 21 or 24 words. - * - * Use the [[wordlist]] ``split`` method to get the individual words. - */ - phrase; - /** - * The password used for this mnemonic. If no password is used this - * is the empty string (i.e. ``""``) as per the specification. - */ - password; - /** - * The wordlist for this mnemonic. - */ - wordlist; - /** - * The underlying entropy which the mnemonic encodes. - */ - entropy; - /** - * @private - */ - constructor(guard, entropy, phrase, password, wordlist) { - if (password == null) { - password = ""; - } - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - assertPrivate(guard, _guard$1, "Mnemonic"); - defineProperties(this, { phrase, password, wordlist, entropy }); - } - /** - * Returns the seed for the mnemonic. - */ - computeSeed() { - return mnemonicToSeed(this.phrase, this.password); - } - /** - * Creates a new Mnemonic for the %%phrase%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromPhrase({ phrase, password, wordlist, }) { - // Normalize the case and space; throws if invalid - const entropy = mnemonicToEntropy(phrase, wordlist); - phrase = entropyToMnemonic(getBytes(entropy), wordlist); - return new Mnemonic(_guard$1, entropy, phrase, password, wordlist); - } - /** - * Create a new **Mnemonic** from the %%entropy%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromEntropy(_entropy, password, wordlist) { - const entropy = getBytes(_entropy, "entropy"); - const phrase = entropyToMnemonic(entropy, wordlist); - return new Mnemonic(_guard$1, hexlify(entropy), phrase, password, wordlist); - } - /** - * Returns the phrase for %%mnemonic%%. - */ - static entropyToPhrase(_entropy, wordlist) { - const entropy = getBytes(_entropy, "entropy"); - return entropyToMnemonic(entropy, wordlist); - } - /** - * Returns the entropy for %%phrase%%. - */ - static phraseToEntropy(phrase, wordlist) { - return mnemonicToEntropy(phrase, wordlist); - } - /** - * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. - * - * This checks all the provided words belong to the %%wordlist%%, - * that the length is valid and the checksum is correct. - */ - static isValidMnemonic(phrase, wordlist) { - try { - mnemonicToEntropy(phrase, wordlist); - return true; - } - catch (error) { } - return false; - } -} - -/** - * @_ignore - */ -function looseArrayify(hexString) { - if (typeof hexString === "string" && !hexString.startsWith("0x")) { - hexString = "0x" + hexString; - } - return getBytesCopy(hexString); -} -function zpad(value, length) { - value = String(value); - while (value.length < length) { - value = "0" + value; - } - return value; -} -function getPassword(password) { - if (typeof password === "string") { - return toUtf8Bytes(password, "NFKC"); - } - return getBytesCopy(password); -} -function spelunk(object, _path) { - const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i); - assertArgument(match != null, "invalid path", "path", _path); - const path = match[1]; - const type = match[3]; - const reqd = match[4] === "!"; - let cur = object; - for (const comp of path.toLowerCase().split(".")) { - // Search for a child object with a case-insensitive matching key - if (Array.isArray(cur)) { - if (!comp.match(/^[0-9]+$/)) { - break; - } - cur = cur[parseInt(comp)]; - } - else if (typeof cur === "object") { - let found = null; - for (const key in cur) { - if (key.toLowerCase() === comp) { - found = cur[key]; - break; - } - } - cur = found; - } - else { - cur = null; - } - if (cur == null) { - break; - } - } - assertArgument(!reqd || cur != null, "missing required value", "path", path); - if (type && cur != null) { - if (type === "int") { - if (typeof cur === "string" && cur.match(/^-?[0-9]+$/)) { - return parseInt(cur); - } - else if (Number.isSafeInteger(cur)) { - return cur; - } - } - if (type === "number") { - if (typeof cur === "string" && cur.match(/^-?[0-9.]*$/)) { - return parseFloat(cur); - } - } - if (type === "data") { - if (typeof cur === "string") { - return looseArrayify(cur); - } - } - if (type === "array" && Array.isArray(cur)) { - return cur; - } - if (type === typeof cur) { - return cur; - } - assertArgument(false, `wrong type found for ${type} `, "path", path); - } - return cur; -} -/* -export function follow(object: any, path: string): null | string { - let currentChild = object; - - for (const comp of path.toLowerCase().split('/')) { - - // Search for a child object with a case-insensitive matching key - let matchingChild = null; - for (const key in currentChild) { - if (key.toLowerCase() === comp) { - matchingChild = currentChild[key]; - break; - } - } - - if (matchingChild === null) { return null; } - - currentChild = matchingChild; - } - - return currentChild; -} - -// "path/to/something:type!" -export function followRequired(data: any, path: string): string { - const value = follow(data, path); - if (value != null) { return value; } - return logger.throwArgumentError("invalid value", `data:${ path }`, - JSON.stringify(data)); -} -*/ -// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) -/* -export function uuidV4(randomBytes: BytesLike): string { - const bytes = getBytes(randomBytes, "randomBytes"); - - // Section: 4.1.3: - // - time_hi_and_version[12:16] = 0b0100 - bytes[6] = (bytes[6] & 0x0f) | 0x40; - - // Section 4.4 - // - clock_seq_hi_and_reserved[6] = 0b0 - // - clock_seq_hi_and_reserved[7] = 0b1 - bytes[8] = (bytes[8] & 0x3f) | 0x80; - - const value = hexlify(bytes); - - return [ - value.substring(2, 10), - value.substring(10, 14), - value.substring(14, 18), - value.substring(18, 22), - value.substring(22, 34), - ].join("-"); -} -*/ - -/** - * The JSON Wallet formats allow a simple way to store the private - * keys needed in Core along with related information and allows - * for extensible forms of encryption. - * - * These utilities facilitate decrypting and encrypting the most common - * JSON Wallet formats. - * - * @_subsection: api/wallet:JSON Wallets [json-wallets] - */ -// @ts-ignore -const { CTR } = pkg; -const defaultPath$1 = "m/44'/60'/0'/0/0"; -/** - * Returns true if %%json%% is a valid JSON Keystore Wallet. - */ -function isKeystoreJson(json) { - try { - const data = JSON.parse(json); - const version = data.version != null ? parseInt(data.version) : 0; - if (version === 3) { - return true; - } - } - catch (error) { } - return false; -} -function decrypt(data, key, ciphertext) { - const cipher = spelunk(data, "crypto.cipher:string"); - if (cipher === "aes-128-ctr") { - const iv = spelunk(data, "crypto.cipherparams.iv:data!"); - const aesCtr = new CTR(key, iv); - return hexlify(aesCtr.decrypt(ciphertext)); - } - assert(false, "unsupported cipher", "UNSUPPORTED_OPERATION", { - operation: "decrypt", - }); -} -function getAccount(data, _key) { - const key = getBytes(_key); - const ciphertext = spelunk(data, "crypto.ciphertext:data!"); - const computedMAC = hexlify(sha256(concat([key.slice(16, 32), ciphertext]))).substring(2); - assertArgument(computedMAC === spelunk(data, "crypto.mac:string!").toLowerCase(), "incorrect password", "password", "[ REDACTED ]"); - const privateKey = decrypt(data, key.slice(0, 16), ciphertext); - const address = getAddress(data.address); - const prefix = extractPrefix(address); - if (computeAddress(privateKey, prefix) !== address) { - throw new Error("address mismatch"); - } - if (data.address) { - let check = data.address.toLowerCase(); - if (!check.startsWith("0x")) { - check = "0x" + check; - } - assertArgument(getAddress(check) === address, "keystore address/privateKey mismatch", "address", data.address); - } - const account = { address, privateKey }; - // Version 0.1 x-corebc metadata must contain an encrypted mnemonic phrase - const version = spelunk(data, "x-corebc.version:string"); - if (version === "0.1") { - const mnemonicKey = key.slice(32, 64); - const mnemonicCiphertext = spelunk(data, "x-corebc.mnemonicCiphertext:data!"); - const mnemonicIv = spelunk(data, "x-corebc.mnemonicCounter:data!"); - const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); - account.mnemonic = { - path: spelunk(data, "x-corebc.path:string") || defaultPath$1, - locale: spelunk(data, "x-corebc.locale:string") || "en", - entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext))), - }; - } - return account; -} -function getDecryptKdfParams(data) { - const kdf = spelunk(data, "crypto.kdf:string"); - if (kdf && typeof kdf === "string") { - if (kdf.toLowerCase() === "scrypt") { - const salt = spelunk(data, "crypto.kdfparams.salt:data!"); - const N = spelunk(data, "crypto.kdfparams.n:int!"); - const r = spelunk(data, "crypto.kdfparams.r:int!"); - const p = spelunk(data, "crypto.kdfparams.p:int!"); - // Make sure N is a power of 2 - assertArgument(N > 0 && (N & (N - 1)) === 0, "invalid kdf.N", "kdf.N", N); - assertArgument(r > 0 && p > 0, "invalid kdf", "kdf", kdf); - const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); - assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dflen", dkLen); - return { name: "scrypt", salt, N, r, p, dkLen: 64 }; - } - else if (kdf.toLowerCase() === "pbkdf2") { - const salt = spelunk(data, "crypto.kdfparams.salt:data!"); - const prf = spelunk(data, "crypto.kdfparams.prf:string!"); - const algorithm = prf.split("-").pop(); - assertArgument(algorithm === "sha256" || algorithm === "sha512", "invalid kdf.pdf", "kdf.pdf", prf); - const count = spelunk(data, "crypto.kdfparams.c:int!"); - const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); - assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dklen", dkLen); - return { name: "pbkdf2", salt, count, dkLen, algorithm }; - } - } - assertArgument(false, "unsupported key-derivation function", "kdf", kdf); -} -/** - * Returns the account details for the JSON Keystore Wallet %%json%% - * using %%password%%. - * - * It is preferred to use the [async version](decryptKeystoreJson) - * instead, which allows a [[ProgressCallback]] to keep the user informed - * as to the decryption status. - * - * This method will block the event loop (freezing all UI) until decryption - * is complete, which can take quite some time, depending on the wallet - * paramters and platform. - */ -function decryptKeystoreJsonSync(json, _password) { - const data = JSON.parse(json); - const password = getPassword(_password); - const params = getDecryptKdfParams(data); - if (params.name === "pbkdf2") { - const { salt, count, dkLen, algorithm } = params; - const key = pbkdf2(password, salt, count, dkLen, algorithm); - return getAccount(data, key); - } - assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { - params, - }); - const { salt, N, r, p, dkLen } = params; - const key = scryptSync(password, salt, N, r, p, dkLen); - return getAccount(data, key); -} -function stall$1(duration) { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, duration); - }); -} -/** - * Resolves to the decrypted JSON Keystore Wallet %%json%% using the - * %%password%%. - * - * If provided, %%progress%% will be called periodically during the - * decrpytion to provide feedback, and if the function returns - * ``false`` will halt decryption. - * - * The %%progressCallback%% will **always** receive ``0`` before - * decryption begins and ``1`` when complete. - */ -async function decryptKeystoreJson(json, _password, progress) { - const data = JSON.parse(json); - const password = getPassword(_password); - const params = getDecryptKdfParams(data); - if (params.name === "pbkdf2") { - if (progress) { - progress(0); - await stall$1(0); - } - const { salt, count, dkLen, algorithm } = params; - const key = pbkdf2(password, salt, count, dkLen, algorithm); - if (progress) { - progress(1); - await stall$1(0); - } - return getAccount(data, key); - } - assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { - params, - }); - const { salt, N, r, p, dkLen } = params; - const key = await scrypt(password, salt, N, r, p, dkLen, progress); - return getAccount(data, key); -} -function getEncryptKdfParams(options) { - // Check/generate the salt - const salt = options.salt != null - ? getBytes(options.salt, "options.salt") - : randomBytes(32); - // Override the scrypt password-based key derivation function parameters - let N = 1 << 17, r = 8, p = 1; - if (options.scrypt) { - if (options.scrypt.N) { - N = options.scrypt.N; - } - if (options.scrypt.r) { - r = options.scrypt.r; - } - if (options.scrypt.p) { - p = options.scrypt.p; - } - } - assertArgument(typeof N === "number" && - N > 0 && - Number.isSafeInteger(N) && - (BigInt(N) & BigInt(N - 1)) === BigInt(0), "invalid scrypt N parameter", "options.N", N); - assertArgument(typeof r === "number" && r > 0 && Number.isSafeInteger(r), "invalid scrypt r parameter", "options.r", r); - assertArgument(typeof p === "number" && p > 0 && Number.isSafeInteger(p), "invalid scrypt p parameter", "options.p", p); - return { name: "scrypt", dkLen: 32, salt, N, r, p }; -} -function _encryptKeystore(key, kdf, account, options) { - const privateKey = getBytes(account.privateKey, "privateKey"); - // Override initialization vector - const iv = options.iv != null ? getBytes(options.iv, "options.iv") : randomBytes(16); - assertArgument(iv.length === 16, "invalid options.iv length", "options.iv", options.iv); - // Override the uuid - const uuidRandom = options.uuid != null - ? getBytes(options.uuid, "options.uuid") - : randomBytes(16); - assertArgument(uuidRandom.length === 16, "invalid options.uuid length", "options.uuid", options.iv); - // This will be used to encrypt the wallet (as per Web3 secret storage) - // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) - // - 32 bytes AES key to encrypt mnemonic with (required here to be corebc Wallet) - const derivedKey = key.slice(0, 16); - const macPrefix = key.slice(16, 32); - // Encrypt the private key - const aesCtr = new CTR(derivedKey, iv); - const ciphertext = getBytes(aesCtr.encrypt(privateKey)); - // Compute the message authentication code, used to check the password - const mac = sha256(concat([macPrefix, ciphertext])); - const data = { - address: account.address.substring(2).toLowerCase(), - id: uuidV4(uuidRandom), - version: 3, - Crypto: { - cipher: "aes-128-ctr", - cipherparams: { - iv: hexlify(iv).substring(2), - }, - ciphertext: hexlify(ciphertext).substring(2), - kdf: "scrypt", - kdfparams: { - salt: hexlify(kdf.salt).substring(2), - n: kdf.N, - dklen: 32, - p: kdf.p, - r: kdf.r, - }, - mac: mac.substring(2), - }, - }; - // If we have a mnemonic, encrypt it into the JSON wallet - if (account.mnemonic) { - const client = options.client != null ? options.client : `corebc/${version}`; - const path = account.mnemonic.path || defaultPath$1; - const locale = account.mnemonic.locale || "en"; - const mnemonicKey = key.slice(32, 64); - const entropy = getBytes(account.mnemonic.entropy, "account.mnemonic.entropy"); - const mnemonicIv = randomBytes(16); - const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); - const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy)); - const now = new Date(); - const timestamp = now.getUTCFullYear() + - "-" + - zpad(now.getUTCMonth() + 1, 2) + - "-" + - zpad(now.getUTCDate(), 2) + - "T" + - zpad(now.getUTCHours(), 2) + - "-" + - zpad(now.getUTCMinutes(), 2) + - "-" + - zpad(now.getUTCSeconds(), 2) + - ".0Z"; - const gethFilename = "UTC--" + timestamp + "--" + data.address; - data["x-corebc"] = { - client, - gethFilename, - path, - locale, - mnemonicCounter: hexlify(mnemonicIv).substring(2), - mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2), - version: "0.1", - }; - } - return JSON.stringify(data); -} -/** - * Return the JSON Keystore Wallet for %%account%% encrypted with - * %%password%%. - * - * The %%options%% can be used to tune the password-based key - * derivation function parameters, explicitly set the random values - * used. Any provided [[ProgressCallback]] is ignord. - */ -function encryptKeystoreJsonSync(account, password, options) { - if (options == null) { - options = {}; - } - const passwordBytes = getPassword(password); - const kdf = getEncryptKdfParams(options); - const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64); - return _encryptKeystore(getBytes(key), kdf, account, options); -} -/** - * Resolved to the JSON Keystore Wallet for %%account%% encrypted - * with %%password%%. - * - * The %%options%% can be used to tune the password-based key - * derivation function parameters, explicitly set the random values - * used and provide a [[ProgressCallback]] to receive periodic updates - * on the completion status.. - */ -async function encryptKeystoreJson(account, password, options) { - if (options == null) { - options = {}; - } - const passwordBytes = getPassword(password); - const kdf = getEncryptKdfParams(options); - const key = await scrypt(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback); - return _encryptKeystore(getBytes(key), kdf, account, options); -} - -/** - * Explain HD Wallets.. - * - * @_subsection: api/wallet:HD Wallets [hd-wallets] - */ -// import { arrayify, -// // hexDataSlice -// } from "../utils/data.js"; -// function sha512Hash(password: BytesLike, salt: BytesLike): Uint8Array { -// const p = getBytes(password); -// const s = getBytes(salt); -// return getBytes(pbkdf2(p, s, 2048, 57, "sha512")); -// } -/** - * The default derivation path for Core HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) - */ -const defaultPath = "m"; -// "Bitcoin seed" -// const MasterSecret = new Uint8Array([66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100]); -const HardenedBit = 0x80000000; -// function addScalar(a: Uint8Array, b: Uint8Array): Uint8Array { -// b = getBytes(concat([b.slice(0, 53), "0x00000000"])); -// b[0] &= 0xfc; -// const c = new Uint8Array(57); -// let hold = 0; -// for (let i = 0; i < 57; i++) { -// hold += a[i] + b[i]; -// c[i] = hold % 256; -// hold = Math.floor(hold / 256); -// } -// return c; -// }; -const _guard = {}; -function derivePath(node, path) { - const components = path.split("/"); - assertArgument(components.length > 0 && (components[0] === "m" || node.depth > 0), "invalid path", "path", path); - if (components[0] === "m") { - components.shift(); - } - let result = node; - for (let i = 0; i < components.length; i++) { - const component = components[i]; - if (component.match(/^[0-9]+'$/)) { - const index = parseInt(component.substring(0, component.length - 1)); - assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component); - result = result.deriveChild(HardenedBit + index); - } - else if (component.match(/^[0-9]+$/)) { - const index = parseInt(component); - assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component); - result = result.deriveChild(index); - } - else { - assertArgument(false, "invalid path component", `path[${i}]`, component); - } - } - return result; -} -/** - * An **HDNodeWallet** is a [[Signer]] backed by the private key derived - * from an HD Node using the [[link-bip-32]] stantard. - * - * An HD Node forms a hierarchal structure with each HD Node having a - * private key and the ability to derive child HD Nodes, defined by - * a path indicating the index of each child. - */ -class HDNodeWallet extends BaseWallet { - /** - * The compressed public key. - */ - publicKey; - prefix; - /** - * The fingerprint. - * - * A fingerprint allows quick qay to detect parent and child nodes, - * but developers should be prepared to deal with collisions as it - * is only 4 bytes. - */ - fingerprint; - /** - * The parent fingerprint. - */ - parentFingerprint; - /** - * The mnemonic used to create this HD Node, if available. - * - * Sources such as extended keys do not encode the mnemonic, in - * which case this will be ``null``. - */ - mnemonic; - #seed; - /** - * The derivation path of this wallet. - * - * Since extended keys do not provider full path details, this - * may be ``null``, if instantiated from a source that does not - * enocde it. - */ - path; - /** - * The child index of this wallet. Values over ``2 *\* 31`` indicate - * the node is hardened. - */ - index; - /** - * The depth of this wallet, which is the number of components - * in its path. - */ - depth; - /** - * @private - */ - constructor({ guard, seed, signingKey, parentFingerprint, path, index, depth, mnemonic, provider, prefix, }) { - super({ - signingKey, - prefix, - provider, - }); - assertPrivate(guard, _guard, "HDNodeWallet"); - defineProperties(this, { publicKey: signingKey.publicKey }); - this.prefix = prefix; - this.#seed = seed; - const fingerprint = dataSlice(ripemd160(sha256(this.publicKey)), 0, 4); - defineProperties(this, { - parentFingerprint, - fingerprint, - path, - index, - depth, - }); - defineProperties(this, { mnemonic }); - } - connect(provider) { - return new HDNodeWallet({ - guard: _guard, - signingKey: this.signingKey, - parentFingerprint: this.parentFingerprint, - path: this.path, - index: this.index, - depth: this.depth, - seed: this.#seed, - mnemonic: this.mnemonic, - provider, - prefix: this.prefix, - }); - } - #account() { - const account = { - address: this.address, - privateKey: this.privateKey, - }; - const m = this.mnemonic; - if (this.path && m && m.wordlist.locale === "en" && m.password === "") { - account.mnemonic = { - path: this.path, - locale: "en", - entropy: m.entropy, - }; - } - return account; - } - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - async encrypt(password, progressCallback) { - return await encryptKeystoreJson(this.#account(), password, { - progressCallback, - }); - } - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password) { - return encryptKeystoreJsonSync(this.#account(), password); - } - /** - * Returns true if this wallet has a path, providing a Type Guard - * that the path is non-null. - */ - hasPath() { - return this.path != null; - } - /** - * Return the child for %%index%%. - */ - deriveChild(_index) { - const newPrivateKey = Ed448Goldilock.HDWalletGenerateKeyFromSeed(this.#seed, Number(_index)); - const newSigningKey = new SigningKey(newPrivateKey); - // Base path - let path = this.path; - if (path) { - path += "/" + (_index & ~HardenedBit); - if (_index & HardenedBit) { - path += "'"; - } - } - return new HDNodeWallet({ - guard: _guard, - signingKey: newSigningKey, - parentFingerprint: this.fingerprint, - path, - index: _index, - seed: this.#seed, - depth: this.depth + 1, - mnemonic: this.mnemonic, - provider: this.provider, - prefix: this.prefix, - }); - } - /** - * Return the HDNode for %%path%% from this node. - */ - derivePath(path) { - return derivePath(this, path); - } - static #fromSeed({ _seed, mnemonic, prefix, path, }) { - const extendetPrivateKey = Ed448Goldilock.HDWalletGenerateKeyFromSeed(_seed, 0); - const signingKey = new SigningKey(extendetPrivateKey); - // console.log({ privateKey, thisKey: signingKey.privateKey,len:tmp.privateKey.length }) - return new HDNodeWallet({ - seed: _seed, - guard: _guard, - signingKey, - parentFingerprint: "0x00000000", - path: path || defaultPath, - index: 0, - depth: 0, - mnemonic, - provider: null, - prefix, - }); - } - /** - * Creates a new random HDNode. - */ - static createRandom(prefix, password, path, wordlist) { - if (password == null) { - password = ""; - } - if (path == null) { - path = defaultPath; - } - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - const mnemonic = Mnemonic.fromEntropy(randomBytes(32), password, wordlist); - return HDNodeWallet.#fromSeed({ - _seed: mnemonic.computeSeed(), - mnemonic, - prefix, - }).derivePath(path); - } - /** - * Create am HD Node from %%mnemonic%%. - */ - static fromMnemonic(mnemonic, prefix, path) { - if (!path) { - path = defaultPath; - } - return HDNodeWallet.#fromSeed({ - _seed: mnemonic.computeSeed(), - mnemonic, - prefix, - }).derivePath(path); - } - static mnemonicToSeed(mnemonic, password) { - const seed = mnemonicToSeed(mnemonic, password); - return seed; - } - /** - * Creates an HD Node from a mnemonic %%phrase%%. - */ - static fromPhrase({ phrase, prefix, password, path, wordlist, }) { - if (!password) { - password = ""; - } - if (!path) { - path = defaultPath; - } - if (!wordlist) { - wordlist = LangEn.wordlist(); - } - const mnemonic = Mnemonic.fromPhrase({ phrase, password, wordlist }); - const _seed = mnemonic.computeSeed(); - return HDNodeWallet.#fromSeed({ - _seed, - mnemonic, - prefix, - }).derivePath(path); - } - /** - * Creates an HD Node from a %%seed%%. - */ - static fromSeed({ seed, prefix, path, }) { - return HDNodeWallet.#fromSeed({ - _seed: seed, - mnemonic: null, - path: path || defaultPath, - prefix, - }); - } -} -/* -export class HDNodeWalletManager { - #root: HDNodeWallet; - - constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) { - if (password == null) { password = ""; } - if (path == null) { path = "m/44'/60'/0'/0"; } - if (locale == null) { locale = LangEn.wordlist(); } - this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale); - } - - getSigner(index?: number): HDNodeWallet { - return this.#root.deriveChild((index == null) ? 0: index); - } -} -*/ -/** - * Returns the [[link-bip-32]] path for the acount at %%index%%. - * - * This is the pattern used by wallets like Ledger. - * - * There is also an [alternate pattern](getIndexedAccountPath) used by - * some software. - */ -function getAccountPath(_index) { - const index = getNumber(_index, "index"); - assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); - return `m/44'/60'/${index}'/0/0`; -} -/** - * Returns the path using an alternative pattern for deriving accounts, - * at %%index%%. - * - * This derivation path uses the //index// component rather than the - * //account// component to derive sequential accounts. - * - * This is the pattern used by wallets like MetaMask. - */ -function getIndexedAccountPath(_index) { - const index = getNumber(_index, "index"); - assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); - return `m/44'/60'/0'/0/${index}`; -} - -/** - * @_subsection: api/wallet:JSON Wallets [json-wallets] - */ -// @ts-ignore -const { CBC, pkcs7Strip } = pkg; -/** - * Returns true if %%json%% is a valid JSON Crowdsale wallet. - */ -function isCrowdsaleJson(json) { - try { - const data = JSON.parse(json); - if (data.encseed) { - return true; - } - } - catch (error) { } - return false; -} -/** - * Before Core launched, it was necessary to create a wallet - * format for backers to use, which would be used to receive xcb - * as a reward for contributing to the project. - * - * The [[link-crowdsale]] format is now obsolete, but it is still - * useful to support and the additional code is fairly trivial as - * all the primitives required are used through core portions of - * the library. - */ -function decryptCrowdsaleJson(json, _password) { - const data = JSON.parse(json); - const password = getPassword(_password); - // Core Address - const address = getAddress(spelunk(data, "ethaddr:string!")); - // Encrypted Seed - const encseed = looseArrayify(spelunk(data, "encseed:string!")); - assertArgument(encseed && encseed.length % 16 === 0, "invalid encseed", "json", json); - const key = getBytes(pbkdf2(password, password, 2000, 32, "sha256")).slice(0, 16); - const iv = encseed.slice(0, 16); - const encryptedSeed = encseed.slice(16); - // Decrypt the seed - const aesCbc = new CBC(key, iv); - const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed))); - // This wallet format is weird... Convert the binary encoded hex to a string. - let seedHex = ""; - for (let i = 0; i < seed.length; i++) { - seedHex += String.fromCharCode(seed[i]); - } - return { address, privateKey: id(seedHex) }; -} - -function stall(duration) { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, duration); - }); -} -/** - * A **Wallet** manages a single private key which is used to sign - * transactions, messages and other common payloads. - * - * This class is generally the main entry point for developers - * that wish to use a private key directly, as it can create - * instances from a large variety of common sources, including - * raw private key, [[link-bip-39]] mnemonics and encrypte JSON - * wallets. - */ -class Wallet extends BaseWallet { - /** - * Create a new wallet for the %%privateKey%% or %%signingKey%%, optionally connected - * to %%provider%%. - */ - constructor({ key, prefix, provider, }) { - if (typeof key === "string" && !key.startsWith("0x")) { - key = "0x" + key; - } - let signingKey = typeof key === "string" ? new SigningKey(key) : key; - super({ - signingKey, - prefix, - provider, - }); - } - connect(provider) { - return new Wallet({ - key: this.signingKey, - prefix: this.prefix, - provider, - }); - } - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - async encrypt(password, progressCallback) { - const account = { address: this.address, privateKey: this.privateKey }; - return await encryptKeystoreJson(account, password, { progressCallback }); - } - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password) { - const account = { address: this.address, privateKey: this.privateKey }; - return encryptKeystoreJsonSync(account, password); - } - static #fromAccount(account) { - assertArgument(account, "invalid JSON wallet", "json", "[ REDACTED ]"); - const address = account.address; - const prefix = extractPrefix(address); - if ("mnemonic" in account && - account.mnemonic && - account.mnemonic.locale === "en") { - const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy); - const wallet = HDNodeWallet.fromMnemonic(mnemonic, prefix, account.mnemonic.path); - if (wallet.address === account.address && - wallet.privateKey === account.privateKey) { - return wallet; - } - console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key"); - } - const wallet = new Wallet({ - key: account.privateKey, - prefix, - }); - assertArgument(wallet.address === account.address, "address/privateKey mismatch", "json", "[ REDACTED ]"); - return wallet; - } - /** - * Creates (asynchronously) a **Wallet** by decrypting the %%json%% - * with %%password%%. - * - * If %%progress%% is provided, it is called periodically during - * decryption so that any UI can be updated. - */ - static async fromEncryptedJson(json, password, progress) { - let account = null; - if (isKeystoreJson(json)) { - account = await decryptKeystoreJson(json, password, progress); - } - else if (isCrowdsaleJson(json)) { - if (progress) { - progress(0); - await stall(0); - } - account = decryptCrowdsaleJson(json, password); - if (progress) { - progress(1); - await stall(0); - } - } - return Wallet.#fromAccount(account); - } - /** - * Creates a **Wallet** by decrypting the %%json%% with %%password%%. - * - * The [[fromEncryptedJson]] method is preferred, as this method - * will lock up and freeze the UI during decryption, which may take - * some time. - */ - static fromEncryptedJsonSync(json, password) { - let account = null; - if (isKeystoreJson(json)) { - account = decryptKeystoreJsonSync(json, password); - } - else if (isCrowdsaleJson(json)) { - account = decryptCrowdsaleJson(json, password); - } - else { - assertArgument(false, "invalid JSON wallet", "json", "[ REDACTED ]"); - } - return Wallet.#fromAccount(account); - } - /** - * Creates a new random [[HDNodeWallet]] using the avavilable - * [cryptographic random source](randomBytes). - * - * If there is no crytographic random source, this will throw. - */ - static createRandom(prefix, provider) { - const wallet = HDNodeWallet.createRandom(prefix, undefined, undefined, undefined); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } - /** - * Creates a [[HDNodeWallet]] for %%phrase%%. - */ - static fromPhrase({ phrase, prefix, provider, password, }) { - const wallet = HDNodeWallet.fromPhrase({ - phrase, - prefix, - password, - }); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } - static fromSeed({ seed, prefix, provider, path, }) { - const wallet = HDNodeWallet.fromSeed({ - seed, - prefix, - path: path || defaultPath, - }); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } -} - -const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; -/** - * @_ignore - */ -function decodeBits(width, data) { - const maxValue = (1 << width) - 1; - const result = []; - let accum = 0, bits = 0, flood = 0; - for (let i = 0; i < data.length; i++) { - // Accumulate 6 bits of data - accum = (accum << 6) | Base64.indexOf(data[i]); - bits += 6; - // While we have enough for a word... - while (bits >= width) { - // ...read the word - const value = accum >> (bits - width); - accum &= (1 << (bits - width)) - 1; - bits -= width; - // A value of 0 indicates we exceeded maxValue, it - // floods over into the next value - if (value === 0) { - flood += maxValue; - } - else { - result.push(value + flood); - flood = 0; - } - } - } - return result; -} - -/** - * @_ignore - */ -function decodeOwlA(data, accents) { - let words = decodeOwl(data).join(","); - // Inject the accents - accents.split(/,/g).forEach((accent) => { - const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); - assertArgument(match !== null, "internal error parsing accents", "accents", accents); - let posOffset = 0; - const positions = decodeBits(parseInt(match[3]), match[4]); - const charCode = parseInt(match[2]); - const regex = new RegExp(`([${match[1]}])`, "g"); - words = words.replace(regex, (all, letter) => { - const rem = --positions[posOffset]; - if (rem === 0) { - letter = String.fromCharCode(letter.charCodeAt(0), charCode); - posOffset++; - } - return letter; - }); - }); - return words.split(","); -} - -/** - * An OWL-A format Wordlist extends the OWL format to add an - * overlay onto an OWL format Wordlist to support diacritic - * marks. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on latin-1 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ -class WordlistOwlA extends WordlistOwl { - #accent; - constructor(locale, data, accent, checksum) { - super(locale, data, checksum); - this.#accent = accent; - } - get _accent() { - return this.#accent; - } - _decodeWords() { - return decodeOwlA(this._data, this._accent); - } -} - -const wordlists = { - en: LangEn.wordlist(), -}; - -var corebc = /*#__PURE__*/Object.freeze({ - __proto__: null, - AbiCoder: AbiCoder, - AbstractProvider: AbstractProvider, - AbstractSigner: AbstractSigner, - AlchemyProvider: AlchemyProvider, - AnkrProvider: AnkrProvider, - BaseContract: BaseContract, - BaseWallet: BaseWallet, - BigNumber: BigNumber, - Block: Block, - BrowserProvider: BrowserProvider, - CloudflareProvider: CloudflareProvider, - ConstructorFragment: ConstructorFragment, - Contract: Contract, - ContractEventPayload: ContractEventPayload, - ContractFactory: ContractFactory, - ContractTransactionReceipt: ContractTransactionReceipt, - ContractTransactionResponse: ContractTransactionResponse, - ContractUnknownEventPayload: ContractUnknownEventPayload, - CoreSymbol: CoreSymbol, - Ed448Goldilock: Ed448Goldilock, - EnergyCostPlugin: EnergyCostPlugin, - ErrorDescription: ErrorDescription, - ErrorFragment: ErrorFragment, - EventFragment: EventFragment, - EventLog: EventLog, - EventPayload: EventPayload, - FallbackFragment: FallbackFragment, - FallbackProvider: FallbackProvider, - FeeData: FeeData, - FeeDataNetworkPlugin: FeeDataNetworkPlugin, - FetchCancelSignal: FetchCancelSignal, - FetchRequest: FetchRequest, - FetchResponse: FetchResponse, - FixedNumber: FixedNumber, - Fragment: Fragment, - FunctionFragment: FunctionFragment, - HDNodeWallet: HDNodeWallet, - Indexed: Indexed, - InfuraProvider: InfuraProvider, - InfuraWebSocketProvider: InfuraWebSocketProvider, - Interface: Interface, - IpcSocketProvider: IpcSocketProvider, - JsonRpcApiProvider: JsonRpcApiProvider, - JsonRpcProvider: JsonRpcProvider, - JsonRpcSigner: JsonRpcSigner, - LangEn: LangEn, - Log: Log, - LogDescription: LogDescription, - MaxInt256: MaxInt256, - MaxUint256: MaxUint256, - MessagePrefix: MessagePrefix, - MinInt256: MinInt256, - Mnemonic: Mnemonic, - N: N, - NamedFragment: NamedFragment, - Network: Network, - NetworkPlugin: NetworkPlugin, - NonceManager: NonceManager, - OrePerXCB: OrePerXCB, - ParamType: ParamType, - PocketProvider: PocketProvider, - QuickNodeProvider: QuickNodeProvider, - Result: Result, - Signature: Signature, - SigningKey: SigningKey, - SocketBlockSubscriber: SocketBlockSubscriber, - SocketEventSubscriber: SocketEventSubscriber, - SocketPendingSubscriber: SocketPendingSubscriber, - SocketProvider: SocketProvider, - SocketSubscriber: SocketSubscriber, - StructFragment: StructFragment, - Transaction: Transaction, - TransactionDescription: TransactionDescription, - TransactionReceipt: TransactionReceipt, - TransactionResponse: TransactionResponse, - Typed: Typed, - TypedDataEncoder: TypedDataEncoder, - UnmanagedSubscriber: UnmanagedSubscriber, - Utf8ErrorFuncs: Utf8ErrorFuncs, - VoidSigner: VoidSigner, - Wallet: Wallet, - WebSocketProvider: WebSocketProvider, - Wordlist: Wordlist, - WordlistOwl: WordlistOwl, - WordlistOwlA: WordlistOwlA, - ZeroAddress: ZeroAddress, - ZeroHash: ZeroHash, - accessListify: accessListify, - arrayify: arrayify, - assert: assert, - assertArgument: assertArgument, - assertArgumentCount: assertArgumentCount, - assertNormalize: assertNormalize, - assertPrivate: assertPrivate, - checkResultErrors: checkResultErrors, - computeAddress: computeAddress, - computeHmac: computeHmac, - concat: concat, - copyRequest: copyRequest, - dataLength: dataLength, - dataSlice: dataSlice, - decodeBase58: decodeBase58, - decodeBase64: decodeBase64, - decodeBytes32String: decodeBytes32String, - decodeRlp: decodeRlp, - decryptCrowdsaleJson: decryptCrowdsaleJson, - decryptKeystoreJson: decryptKeystoreJson, - decryptKeystoreJsonSync: decryptKeystoreJsonSync, - defaultPath: defaultPath, - defineProperties: defineProperties, - encodeBase58: encodeBase58, - encodeBase64: encodeBase64, - encodeBytes32String: encodeBytes32String, - encodeRlp: encodeRlp, - encryptKeystoreJson: encryptKeystoreJson, - encryptKeystoreJsonSync: encryptKeystoreJsonSync, - formatUnits: formatUnits, - formatXCB: formatXCB, - fromTwos: fromTwos, - getAccountPath: getAccountPath, - getAddress: getAddress, - getBigInt: getBigInt, - getBytes: getBytes, - getBytesCopy: getBytesCopy, - getCreate2Address: getCreate2Address, - getCreateAddress: getCreateAddress, - getDefaultProvider: getDefaultProvider, - getIndexedAccountPath: getIndexedAccountPath, - getNumber: getNumber, - getUint: getUint, - hashMessage: hashMessage, - hexConcat: hexConcat, - hexlify: hexlify, - id: id, - isAddress: isAddress, - isAddressable: isAddressable, - isBytesLike: isBytesLike, - isCallException: isCallException, - isCrowdsaleJson: isCrowdsaleJson, - isError: isError, - isHexString: isHexString, - isKeystoreJson: isKeystoreJson, - keccak256: keccak256, - lock: lock, - makeError: makeError, - mask: mask, - networkIdToPrefix: networkIdToPrefix, - parseUnits: parseUnits, - parseXCB: parseXCB, - pbkdf2: pbkdf2, - publicToAddress: publicToAddress, - randomBytes: randomBytes, - recoverAddress: recoverAddress, - resolveAddress: resolveAddress, - resolveProperties: resolveProperties, - ripemd160: ripemd160, - scrypt: scrypt, - scryptSync: scryptSync, - sha256: sha256, - sha512: sha512, - showThrottleMessage: showThrottleMessage, - solidityPacked: solidityPacked, - solidityPackedSha256: solidityPackedSha256, - stripZerosLeft: stripZerosLeft, - toBeArray: toBeArray, - toBeHex: toBeHex, - toBigInt: toBigInt, - toNumber: toNumber, - toQuantity: toQuantity, - toTwos: toTwos, - toUtf8Bytes: toUtf8Bytes, - toUtf8CodePoints: toUtf8CodePoints, - toUtf8String: toUtf8String, - uuidV4: uuidV4, - verifyMessage: verifyMessage, - verifyTypedData: verifyTypedData, - version: version, - wordlists: wordlists, - zeroPadBytes: zeroPadBytes, - zeroPadValue: zeroPadValue -}); - -export { AbiCoder, AbstractProvider, AbstractSigner, AlchemyProvider, AnkrProvider, BaseContract, BaseWallet, BigNumber, Block, BrowserProvider, CloudflareProvider, ConstructorFragment, Contract, ContractEventPayload, ContractFactory, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, CoreSymbol, Ed448Goldilock, EnergyCostPlugin, ErrorDescription, ErrorFragment, EventFragment, EventLog, EventPayload, FallbackFragment, FallbackProvider, FeeData, FeeDataNetworkPlugin, FetchCancelSignal, FetchRequest, FetchResponse, FixedNumber, Fragment, FunctionFragment, HDNodeWallet, Indexed, InfuraProvider, InfuraWebSocketProvider, Interface, IpcSocketProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, LangEn, Log, LogDescription, MaxInt256, MaxUint256, MessagePrefix, MinInt256, Mnemonic, N, NamedFragment, Network, NetworkPlugin, NonceManager, OrePerXCB, ParamType, PocketProvider, QuickNodeProvider, Result, Signature, SigningKey, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketProvider, SocketSubscriber, StructFragment, Transaction, TransactionDescription, TransactionReceipt, TransactionResponse, Typed, TypedDataEncoder, UnmanagedSubscriber, Utf8ErrorFuncs, VoidSigner, Wallet, WebSocketProvider, Wordlist, WordlistOwl, WordlistOwlA, ZeroAddress, ZeroHash, accessListify, arrayify, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, checkResultErrors, computeAddress, computeHmac, concat, copyRequest, corebc, dataLength, dataSlice, decodeBase58, decodeBase64, decodeBytes32String, decodeRlp, decryptCrowdsaleJson, decryptKeystoreJson, decryptKeystoreJsonSync, defaultPath, defineProperties, encodeBase58, encodeBase64, encodeBytes32String, encodeRlp, encryptKeystoreJson, encryptKeystoreJsonSync, formatUnits, formatXCB, fromTwos, getAccountPath, getAddress, getBigInt, getBytes, getBytesCopy, getCreate2Address, getCreateAddress, getDefaultProvider, getIndexedAccountPath, getNumber, getUint, hashMessage, hexConcat, hexlify, id, isAddress, isAddressable, isBytesLike, isCallException, isCrowdsaleJson, isError, isHexString, isKeystoreJson, keccak256, lock, makeError, mask, networkIdToPrefix, parseUnits, parseXCB, pbkdf2, publicToAddress, randomBytes, recoverAddress, resolveAddress, resolveProperties, ripemd160, scrypt, scryptSync, sha256, sha512, showThrottleMessage, solidityPacked, solidityPackedSha256, stripZerosLeft, toBeArray, toBeHex, toBigInt, toNumber, toQuantity, toTwos, toUtf8Bytes, toUtf8CodePoints, toUtf8String, uuidV4, verifyMessage, verifyTypedData, version, wordlists, zeroPadBytes, zeroPadValue }; -//# sourceMappingURL=corebc.js.map diff --git a/dist/corebc.js.map b/dist/corebc.js.map deleted file mode 100644 index 61fd26d9a..000000000 --- a/dist/corebc.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"corebc.js","sources":["../lib.esm/_version.js","../lib.esm/logger/logger.js","../lib.esm/utils/properties.js","../lib.esm/utils/errors.js","../lib.esm/utils/data.js","../lib.esm/bigNumber/bigNumber.js","../lib.esm/crypto/rlp.js","../node_modules/@noble/hashes/esm/_assert.js","../node_modules/@noble/hashes/esm/utils.js","../node_modules/@noble/hashes/esm/hmac.js","../node_modules/@noble/hashes/esm/pbkdf2.js","../node_modules/@noble/hashes/esm/_sha2.js","../node_modules/@noble/hashes/esm/sha256.js","../node_modules/@noble/hashes/esm/_u64.js","../node_modules/@noble/hashes/esm/sha512.js","../node_modules/@noble/hashes/esm/sha3.js","../lib.esm/utils/maths.js","../lib.esm/utils/base58.js","../lib.esm/utils/base64-browser.js","../lib.esm/utils/events.js","../lib.esm/utils/utf8.js","../lib.esm/utils/geturl-browser.js","../lib.esm/utils/fetch.js","../lib.esm/utils/fixednumber.js","../lib.esm/utils/rlp-decode.js","../lib.esm/utils/rlp-encode.js","../lib.esm/utils/units.js","../lib.esm/utils/uuid.js","../lib.esm/crypto/ed448goldilock-browser.js","../lib.esm/crypto/crypto-browser.js","../lib.esm/crypto/sha3.js","../lib.esm/address/index.js","../lib.esm/crypto/hmac.js","../node_modules/@noble/hashes/esm/ripemd160.js","../lib.esm/crypto/ripemd160.js","../lib.esm/crypto/pbkdf2.js","../lib.esm/crypto/random.js","../node_modules/@noble/hashes/esm/scrypt.js","../lib.esm/crypto/scrypt.js","../lib.esm/crypto/keccak.js","../node_modules/@noble/secp256k1/index.js","../lib.esm/crypto/signing-key.js","../lib.esm/crypto/signature.js","../lib.esm/crypto/index.js","../lib.esm/transaction/address.js","../lib.esm/abi/coders/abstract-coder.js","../lib.esm/abi/typed.js","../lib.esm/abi/coders/address.js","../lib.esm/abi/coders/anonymous.js","../lib.esm/abi/coders/array.js","../lib.esm/abi/coders/boolean.js","../lib.esm/abi/coders/bytes.js","../lib.esm/abi/coders/fixed-bytes.js","../lib.esm/abi/coders/null.js","../lib.esm/abi/coders/number.js","../lib.esm/abi/coders/string.js","../lib.esm/abi/coders/tuple.js","../lib.esm/hash/id.js","../lib.esm/constants/addresses.js","../lib.esm/constants/hashes.js","../lib.esm/constants/numbers.js","../lib.esm/constants/strings.js","../lib.esm/transaction/accesslist.js","../lib.esm/transaction/transaction.js","../lib.esm/hash/message.js","../lib.esm/hash/solidity.js","../lib.esm/hash/typed-data.js","../lib.esm/abi/fragments.js","../lib.esm/abi/abi-coder.js","../lib.esm/abi/bytes32.js","../lib.esm/abi/interface.js","../lib.esm/address/contract-address.js","../lib.esm/address/checks.js","../lib.esm/providers/provider.js","../lib.esm/contract/wrappers.js","../lib.esm/contract/contract.js","../lib.esm/contract/factory.js","../lib.esm/providers/format.js","../lib.esm/providers/plugins-network.js","../lib.esm/providers/network.js","../lib.esm/providers/subscriber-polling.js","../lib.esm/providers/abstract-provider.js","../lib.esm/providers/abstract-signer.js","../lib.esm/providers/community.js","../lib.esm/providers/subscriber-filterid.js","../lib.esm/providers/provider-jsonrpc.js","../lib.esm/providers/provider-ankr.js","../lib.esm/providers/provider-alchemy.js","../lib.esm/providers/provider-cloudflare.js","../lib.esm/providers/ws-browser.js","../lib.esm/providers/provider-socket.js","../lib.esm/providers/provider-websocket.js","../lib.esm/providers/provider-infura.js","../lib.esm/providers/provider-quicknode.js","../lib.esm/providers/provider-fallback.js","../lib.esm/providers/default-provider.js","../lib.esm/providers/signer-noncemanager.js","../lib.esm/providers/provider-browser.js","../lib.esm/providers/provider-pocket.js","../lib.esm/providers/provider-ipcsocket-browser.js","../lib.esm/wallet/base-wallet.js","../lib.esm/wordlists/decode-owl.js","../lib.esm/wordlists/wordlist.js","../lib.esm/wordlists/wordlist-owl.js","../lib.esm/wordlists/lang-en.js","../lib.esm/wallet/mnemonicToSeed.js","../lib.esm/wallet/mnemonic.js","../lib.esm/wallet/utils.js","../lib.esm/wallet/json-keystore.js","../lib.esm/wallet/hdwallet.js","../lib.esm/wallet/json-crowdsale.js","../lib.esm/wallet/wallet.js","../lib.esm/wordlists/bit-reader.js","../lib.esm/wordlists/decode-owla.js","../lib.esm/wordlists/wordlist-owla.js","../lib.esm/wordlists/wordlists-browser.js"],"sourcesContent":["/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */\n/**\n * The current version of corebc.\n */\nexport const version = \"6.4.0\";\n//# sourceMappingURL=_version.js.map","\"use strict\";\nlet _permanentCensorErrors = false;\nlet _censorErrors = false;\nconst LogLevels = {\n debug: 1,\n default: 2,\n info: 2,\n warning: 3,\n error: 4,\n off: 5,\n};\nlet _logLevel = LogLevels[\"default\"];\nlet _globalLogger = null;\nfunction _checkNormalize() {\n try {\n const missing = [];\n // Make sure all forms of normalization are supported\n [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].forEach((form) => {\n try {\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad normalize\");\n }\n }\n catch (error) {\n missing.push(form);\n }\n });\n if (missing.length) {\n throw new Error(\"missing \" + missing.join(\", \"));\n }\n if (String.fromCharCode(0xe9).normalize(\"NFD\") !==\n String.fromCharCode(0x65, 0x0301)) {\n throw new Error(\"broken implementation\");\n }\n }\n catch (error) {\n return error.message;\n }\n return null;\n}\nconst _normalizeError = _checkNormalize();\nexport var LogLevel;\n(function (LogLevel) {\n LogLevel[\"DEBUG\"] = \"DEBUG\";\n LogLevel[\"INFO\"] = \"INFO\";\n LogLevel[\"WARNING\"] = \"WARNING\";\n LogLevel[\"ERROR\"] = \"ERROR\";\n LogLevel[\"OFF\"] = \"OFF\";\n})(LogLevel || (LogLevel = {}));\nexport var ErrorCode;\n(function (ErrorCode) {\n ///////////////////\n // Generic Errors\n // Unknown Error\n ErrorCode[\"UNKNOWN_ERROR\"] = \"UNKNOWN_ERROR\";\n // Not Implemented\n ErrorCode[\"NOT_IMPLEMENTED\"] = \"NOT_IMPLEMENTED\";\n // Unsupported Operation\n // - operation\n ErrorCode[\"UNSUPPORTED_OPERATION\"] = \"UNSUPPORTED_OPERATION\";\n // Network Error (i.e. Core Network, such as an invalid network ID)\n // - event (\"noNetwork\" is not re-thrown in provider.ready; otherwise thrown)\n ErrorCode[\"NETWORK_ERROR\"] = \"NETWORK_ERROR\";\n // Some sort of bad response from the server\n ErrorCode[\"SERVER_ERROR\"] = \"SERVER_ERROR\";\n // Timeout\n ErrorCode[\"TIMEOUT\"] = \"TIMEOUT\";\n ///////////////////\n // Operational Errors\n // Buffer Overrun\n ErrorCode[\"BUFFER_OVERRUN\"] = \"BUFFER_OVERRUN\";\n // Numeric Fault\n // - operation: the operation being executed\n // - fault: the reason this faulted\n ErrorCode[\"NUMERIC_FAULT\"] = \"NUMERIC_FAULT\";\n ///////////////////\n // Argument Errors\n // Missing new operator to an object\n // - name: The name of the class\n ErrorCode[\"MISSING_NEW\"] = \"MISSING_NEW\";\n // Invalid argument (e.g. value is incompatible with type) to a function:\n // - argument: The argument name that was invalid\n // - value: The value of the argument\n ErrorCode[\"INVALID_ARGUMENT\"] = \"INVALID_ARGUMENT\";\n // Missing argument to a function:\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"MISSING_ARGUMENT\"] = \"MISSING_ARGUMENT\";\n // Too many arguments\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"UNEXPECTED_ARGUMENT\"] = \"UNEXPECTED_ARGUMENT\";\n ///////////////////\n // Blockchain Errors\n // Call exception\n // - transaction: the transaction\n // - address?: the contract address\n // - args?: The arguments passed into the function\n // - method?: The Solidity method signature\n // - errorSignature?: The EIP848 error signature\n // - errorArgs?: The EIP848 error parameters\n // - reason: The reason (only for EIP848 \"Error(string)\")\n ErrorCode[\"CALL_EXCEPTION\"] = \"CALL_EXCEPTION\";\n // Insufficient funds (< value + energyLimit * energyPrice)\n // - transaction: the transaction attempted\n ErrorCode[\"INSUFFICIENT_FUNDS\"] = \"INSUFFICIENT_FUNDS\";\n // Nonce has already been used\n // - transaction: the transaction attempted\n ErrorCode[\"NONCE_EXPIRED\"] = \"NONCE_EXPIRED\";\n // The replacement fee for the transaction is too low\n // - transaction: the transaction attempted\n ErrorCode[\"REPLACEMENT_UNDERPRICED\"] = \"REPLACEMENT_UNDERPRICED\";\n // The energy limit could not be estimated\n // - transaction: the transaction passed to estimateEnergy\n ErrorCode[\"UNPREDICTABLE_ENERGY_LIMIT\"] = \"UNPREDICTABLE_ENERGY_LIMIT\";\n // The transaction was replaced by one with a higher energy price\n // - reason: \"cancelled\", \"replaced\" or \"repriced\"\n // - cancelled: true if reason == \"cancelled\" or reason == \"replaced\")\n // - hash: original transaction hash\n // - replacement: the full TransactionsResponse for the replacement\n // - receipt: the receipt of the replacement\n ErrorCode[\"TRANSACTION_REPLACED\"] = \"TRANSACTION_REPLACED\";\n})(ErrorCode || (ErrorCode = {}));\nconst HEX = \"0123456789abcdef\";\nexport class Logger {\n version = \"0.0.1\";\n static errors = ErrorCode;\n static levels = LogLevel;\n constructor(version) {\n Object.defineProperty(this, \"version\", {\n enumerable: true,\n value: version,\n writable: false,\n });\n }\n _log(logLevel, args) {\n const level = logLevel.toLowerCase();\n if (LogLevels[level] == null) {\n this.throwArgumentError(\"invalid log level name\", \"logLevel\", logLevel);\n }\n if (_logLevel > LogLevels[level]) {\n return;\n }\n console.log.apply(console, args);\n }\n debug(...args) {\n this._log(Logger.levels.DEBUG, args);\n }\n info(...args) {\n this._log(Logger.levels.INFO, args);\n }\n warn(...args) {\n this._log(Logger.levels.WARNING, args);\n }\n makeError(message, code, params) {\n // Errors are being censored\n if (_censorErrors) {\n return this.makeError(\"censored error\", code, {});\n }\n if (!code) {\n code = Logger.errors.UNKNOWN_ERROR;\n }\n if (!params) {\n params = {};\n }\n const messageDetails = [];\n Object.keys(params).forEach((key) => {\n const value = params[key];\n try {\n if (value instanceof Uint8Array) {\n let hex = \"\";\n for (let i = 0; i < value.length; i++) {\n hex += HEX[value[i] >> 4];\n hex += HEX[value[i] & 0x0f];\n }\n messageDetails.push(key + \"=Uint8Array(0x\" + hex + \")\");\n }\n else {\n messageDetails.push(key + \"=\" + JSON.stringify(value));\n }\n }\n catch (error) {\n messageDetails.push(key + \"=\" + JSON.stringify(params[key].toString()));\n }\n });\n messageDetails.push(`code=${code}`);\n messageDetails.push(`version=${this.version}`);\n const reason = message;\n if (messageDetails.length) {\n message += \" (\" + messageDetails.join(\", \") + \")\";\n }\n // @TODO: Any??\n const error = new Error(message);\n error.reason = reason;\n error.code = code;\n Object.keys(params).forEach(function (key) {\n error[key] = params[key];\n });\n return error;\n }\n throwError(message, code, params) {\n throw this.makeError(message, code, params);\n }\n throwArgumentError(message, name, value) {\n return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {\n argument: name,\n value: value,\n });\n }\n assert(condition, message, code, params) {\n if (!!condition) {\n return;\n }\n this.throwError(message, code, params);\n }\n assertArgument(condition, message, name, value) {\n if (!!condition) {\n return;\n }\n this.throwArgumentError(message, name, value);\n }\n checkNormalize(message) {\n if (message == null) {\n message = \"platform missing String.prototype.normalize\";\n }\n if (_normalizeError) {\n this.throwError(\"platform missing String.prototype.normalize\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"String.prototype.normalize\",\n form: _normalizeError,\n });\n }\n }\n checkSafeUint53(value, message) {\n if (typeof value !== \"number\") {\n return;\n }\n if (message == null) {\n message = \"value not safe\";\n }\n if (value < 0 || value >= 0x1fffffffffffff) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"out-of-safe-range\",\n value: value,\n });\n }\n if (value % 1) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"non-integer\",\n value: value,\n });\n }\n }\n checkArgumentCount(count, expectedCount, message) {\n if (message) {\n message = \": \" + message;\n }\n else {\n message = \"\";\n }\n if (count < expectedCount) {\n this.throwError(\"missing argument\" + message, Logger.errors.MISSING_ARGUMENT, {\n count: count,\n expectedCount: expectedCount,\n });\n }\n if (count > expectedCount) {\n this.throwError(\"too many arguments\" + message, Logger.errors.UNEXPECTED_ARGUMENT, {\n count: count,\n expectedCount: expectedCount,\n });\n }\n }\n checkNew(target, kind) {\n if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, {\n name: kind.name,\n });\n }\n }\n checkAbstract(target, kind) {\n if (target === kind) {\n this.throwError(\"cannot instantiate abstract class \" +\n JSON.stringify(kind.name) +\n \" directly; use a sub-class\", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: \"new\" });\n }\n else if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, {\n name: kind.name,\n });\n }\n }\n static globalLogger() {\n if (!_globalLogger) {\n _globalLogger = new Logger(\"logger/0.0.1\");\n }\n return _globalLogger;\n }\n static setCensorship(censorship, permanent) {\n if (!censorship && permanent) {\n this.globalLogger().throwError(\"cannot permanently disable censorship\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\",\n });\n }\n if (_permanentCensorErrors) {\n if (!censorship) {\n return;\n }\n this.globalLogger().throwError(\"error censorship permanent\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\",\n });\n }\n _censorErrors = !!censorship;\n _permanentCensorErrors = !!permanent;\n }\n static setLogLevel(logLevel) {\n const level = LogLevels[logLevel.toLowerCase()];\n if (level == null) {\n Logger.globalLogger().warn(\"invalid log level - \" + logLevel);\n return;\n }\n _logLevel = level;\n }\n static from(version) {\n return new Logger(version);\n }\n}\n//# sourceMappingURL=logger.js.map","import { Logger } from \"../logger/logger.js\";\n/**\n * Property helper functions.\n *\n * @_subsection api/utils:Properties [about-properties]\n */\nconst logger = new Logger(\"utils/properties/0.0.1\");\nfunction checkType(value, type, name) {\n const types = type.split(\"|\").map((t) => t.trim());\n for (let i = 0; i < types.length; i++) {\n switch (type) {\n case \"any\":\n return;\n case \"bigint\":\n case \"boolean\":\n case \"number\":\n case \"string\":\n if (typeof value === type) {\n return;\n }\n }\n }\n const error = new Error(`invalid value for type ${type}`);\n error.code = \"INVALID_ARGUMENT\";\n error.argument = `value.${name}`;\n error.value = value;\n throw error;\n}\n/**\n * Resolves to a new object that is a copy of %%value%%, but with all\n * values resolved.\n */\nexport async function resolveProperties(value) {\n const keys = Object.keys(value);\n const results = await Promise.all(keys.map((k) => Promise.resolve(value[k])));\n return results.reduce((accum, v, index) => {\n accum[keys[index]] = v;\n return accum;\n }, {});\n}\n/**\n * Assigns the %%values%% to %%target%% as read-only values.\n *\n * It %%types%% is specified, the values are checked.\n */\nexport function defineProperties(target, values, types) {\n for (let key in values) {\n let value = values[key];\n const type = types ? types[key] : null;\n if (type) {\n checkType(value, type, key);\n }\n Object.defineProperty(target, key, {\n enumerable: true,\n value,\n writable: false,\n });\n }\n}\nexport function checkProperties(object, properties) {\n if (!object || typeof object !== \"object\") {\n logger.throwArgumentError(\"invalid object\", \"object\", object);\n }\n Object.keys(object).forEach((key) => {\n if (!properties[key]) {\n logger.throwArgumentError(\"invalid object key - \" + key, \"transaction:\" + key, object);\n }\n });\n}\n//# sourceMappingURL=properties.js.map","/**\n * About Errors.\n *\n * @_section: api/utils/errors:Errors [about-errors]\n */\nimport { version } from \"../_version.js\";\nimport { defineProperties } from \"./properties.js\";\nfunction stringify(value) {\n if (value == null) {\n return \"null\";\n }\n if (Array.isArray(value)) {\n return \"[ \" + value.map(stringify).join(\", \") + \" ]\";\n }\n if (value instanceof Uint8Array) {\n const HEX = \"0123456789abcdef\";\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n result += HEX[value[i] >> 4];\n result += HEX[value[i] & 0xf];\n }\n return result;\n }\n if (typeof value === \"object\" && typeof value.toJSON === \"function\") {\n return stringify(value.toJSON());\n }\n switch (typeof value) {\n case \"boolean\":\n case \"symbol\":\n return value.toString();\n case \"bigint\":\n return BigInt(value).toString();\n case \"number\":\n return value.toString();\n case \"string\":\n return JSON.stringify(value);\n case \"object\": {\n const keys = Object.keys(value);\n keys.sort();\n return (\"{ \" +\n keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(\", \") +\n \" }\");\n }\n }\n return `[ COULD NOT SERIALIZE ]`;\n}\n/**\n * Returns true if the %%error%% matches an error thrown by corebc\n * that matches the error %%code%%.\n *\n * In TypeScript envornoments, this can be used to check that %%error%%\n * matches an corebcError type, which means the expected properties will\n * be set.\n *\n * @See [ErrorCodes](api:ErrorCode)\n * @example\n * try {\n * // code....\n * } catch (e) {\n * if (isError(e, \"CALL_EXCEPTION\")) {\n * // The Type Guard has validated this object\n * console.log(e.data);\n * }\n * }\n */\nexport function isError(error, code) {\n return error && error.code === code;\n}\n/**\n * Returns true if %%error%% is a [[CallExceptionError].\n */\nexport function isCallException(error) {\n return isError(error, \"CALL_EXCEPTION\");\n}\n/**\n * Returns a new Error configured to the format corebc emits errors, with\n * the %%message%%, [[api:ErrorCode]] %%code%% and additioanl properties\n * for the corresponding corebcError.\n *\n * Each error in corebc includes the version of corebc, a\n * machine-readable [[ErrorCode]], and depneding on %%code%%, additional\n * required properties. The error message will also include the %%meeage%%,\n * corebc version, %%code%% and all aditional properties, serialized.\n */\nexport function makeError(message, code, info) {\n {\n const details = [];\n if (info) {\n if (\"message\" in info || \"code\" in info || \"name\" in info) {\n throw new Error(`value will overwrite populated values: ${stringify(info)}`);\n }\n for (const key in info) {\n const value = info[key];\n // try {\n details.push(key + \"=\" + stringify(value));\n // } catch (error: any) {\n // console.log(\"MMM\", error.message);\n // details.push(key + \"=[could not serialize object]\");\n // }\n }\n }\n details.push(`code=${code}`);\n details.push(`version=${version}`);\n if (details.length) {\n message += \" (\" + details.join(\", \") + \")\";\n }\n }\n let error;\n switch (code) {\n case \"INVALID_ARGUMENT\":\n error = new TypeError(message);\n break;\n case \"NUMERIC_FAULT\":\n case \"BUFFER_OVERRUN\":\n error = new RangeError(message);\n break;\n default:\n error = new Error(message);\n }\n defineProperties(error, { code });\n if (info) {\n Object.assign(error, info);\n }\n return error;\n}\n/**\n * Throws an corebcError with %%message%%, %%code%% and additional error\n * %%info%% when %%check%% is falsish..\n *\n * @see [[api:makeError]]\n */\nexport function assert(check, message, code, info) {\n if (!check) {\n throw makeError(message, code, info);\n }\n}\n/**\n * A simple helper to simply ensuring provided arguments match expected\n * constraints, throwing if not.\n *\n * In TypeScript environments, the %%check%% has been asserted true, so\n * any further code does not need additional compile-time checks.\n */\nexport function assertArgument(check, message, name, value) {\n assert(check, message, \"INVALID_ARGUMENT\", { argument: name, value: value });\n}\nexport function assertArgumentCount(count, expectedCount, message) {\n if (message == null) {\n message = \"\";\n }\n if (message) {\n message = \": \" + message;\n }\n assert(count >= expectedCount, \"missing arguemnt\" + message, \"MISSING_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount,\n });\n assert(count <= expectedCount, \"too many arguemnts\" + message, \"UNEXPECTED_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount,\n });\n}\nconst _normalizeForms = [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].reduce((accum, form) => {\n try {\n // General test for normalize\n /* c8 ignore start */\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad\");\n }\n /* c8 ignore stop */\n if (form === \"NFD\") {\n const check = String.fromCharCode(0xe9).normalize(\"NFD\");\n const expected = String.fromCharCode(0x65, 0x0301);\n /* c8 ignore start */\n if (check !== expected) {\n throw new Error(\"broken\");\n }\n /* c8 ignore stop */\n }\n accum.push(form);\n }\n catch (error) { }\n return accum;\n}, []);\n/**\n * Throws if the normalization %%form%% is not supported.\n */\nexport function assertNormalize(form) {\n assert(_normalizeForms.indexOf(form) >= 0, \"platform missing String.prototype.normalize\", \"UNSUPPORTED_OPERATION\", {\n operation: \"String.prototype.normalize\",\n info: { form },\n });\n}\n/**\n * Many classes use file-scoped values to guard the constructor,\n * making it effectively private. This facilitates that pattern\n * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%,\n * throwing if not, indicating the %%className%% if provided.\n */\nexport function assertPrivate(givenGuard, guard, className) {\n if (className == null) {\n className = \"\";\n }\n if (givenGuard !== guard) {\n let method = className, operation = \"new\";\n if (className) {\n method += \".\";\n operation += \" \" + className;\n }\n assert(false, `private constructor; use ${method}from* methods`, \"UNSUPPORTED_OPERATION\", {\n operation,\n });\n }\n}\n//# sourceMappingURL=errors.js.map","/**\n * Some data helpers.\n *\n *\n * @_subsection api/utils:Data Helpers [about-data]\n */\nimport { Logger } from \"../logger/logger.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nconst logger = new Logger(\"utils/data/0.0.1\");\nfunction isHexable(value) {\n return !!value.toHexString;\n}\nfunction isInteger(value) {\n return typeof value === \"number\" && value == value && value % 1 === 0;\n}\nexport function isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof value === \"string\") {\n return false;\n }\n if (!isInteger(value.length) || value.length < 0) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n}\nfunction _getBytes(value, name, copy) {\n if (value instanceof Uint8Array) {\n if (copy) {\n return new Uint8Array(value);\n }\n return value;\n }\n if (typeof value === \"string\" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {\n const result = new Uint8Array((value.length - 2) / 2);\n let offset = 2;\n for (let i = 0; i < result.length; i++) {\n result[i] = parseInt(value.substring(offset, offset + 2), 16);\n offset += 2;\n }\n return result;\n }\n assertArgument(false, \"invalid BytesLike value\", name || \"value\", value);\n}\n/**\n * Get a typed Uint8Array for %%value%%. If already a Uint8Array\n * the original %%value%% is returned; if a copy is required use\n * [[getBytesCopy]].\n *\n * @see: getBytesCopy\n */\nexport function getBytes(value, name) {\n return _getBytes(value, name, false);\n}\n/**\n * Get a typed Uint8Array for %%value%%, creating a copy if necessary\n * to prevent any modifications of the returned value from being\n * reflected elsewhere.\n *\n * @see: getBytes\n */\nexport function getBytesCopy(value, name) {\n return _getBytes(value, name, true);\n}\n/**\n * Returns true if %%value%% is a valid [[HexString]].\n *\n * If %%length%% is ``true`` or a //number//, it also checks that\n * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//)\n * bytes of data (e.g. ``0x1234`` is 2 bytes).\n */\nexport function isHexString(value, length) {\n if (typeof value !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (typeof length === \"number\" && value.length !== 2 + 2 * length) {\n return false;\n }\n if (length === true && value.length % 2 !== 0) {\n return false;\n }\n return true;\n}\n/**\n * Returns true if %%value%% is a valid representation of arbitrary\n * data (i.e. a valid [[DataHexString]] or a Uint8Array).\n */\nexport function isBytesLike(value) {\n return isHexString(value, true) || value instanceof Uint8Array;\n}\nconst HexCharacters = \"0123456789abcdef\";\n/**\n * Returns a [[DataHexString]] representation of %%data%%.\n */\nexport function hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof value === \"string\") {\n if (value.includes(\",\") && value.startsWith(\"0x\")) {\n const v = value\n .replace(\"0x\", \"\")\n .split(\",\")\n .map((item) => Number(item));\n // @ts-ignore\n value = new Uint8Array(v);\n }\n }\n if (typeof value === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (typeof value === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) {\n return \"0x0\" + value;\n }\n return \"0x\" + value;\n }\n if (options.allowMissingPrefix &&\n typeof value === \"string\" &&\n value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/**\n * Returns a [[DataHexString]] by concatenating all values\n * within %%data%%.\n */\nexport function concat(items) {\n return \"0x\" + items.map((d) => hexlify(d).substring(2)).join(\"\");\n}\nexport function hexDataSlice(data, offset, endOffset) {\n if (typeof data !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || data.length % 2) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nexport function hexDataLength(data) {\n if (typeof data !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || data.length % 2) {\n return null;\n }\n return (data.length - 2) / 2;\n}\n/**\n * Returns the length of %%data%%, in bytes.\n */\nexport function dataLength(data) {\n if (isHexString(data, true)) {\n return (data.length - 2) / 2;\n }\n return getBytes(data).length;\n}\n/**\n * Returns a [[DataHexString]] by slicing %%data%% from the %%start%%\n * offset to the %%end%% offset.\n *\n * By default %%start%% is 0 and %%end%% is the length of %%data%%.\n */\nexport function dataSlice(data, start, end) {\n const bytes = getBytes(data);\n if (end != null && end > bytes.length) {\n assert(false, \"cannot slice beyond data bounds\", \"BUFFER_OVERRUN\", {\n buffer: bytes,\n length: bytes.length,\n offset: end,\n });\n }\n return hexlify(bytes.slice(start == null ? 0 : start, end == null ? bytes.length : end));\n}\n/**\n * Return the [[DataHexString]] result by stripping all **leading**\n ** zero bytes from %%data%%.\n */\nexport function stripZerosLeft(data) {\n let bytes = hexlify(data).substring(2);\n while (bytes.startsWith(\"00\")) {\n bytes = bytes.substring(2);\n }\n return \"0x\" + bytes;\n}\nfunction zeroPad(data, length, left) {\n const bytes = getBytes(data);\n assert(length >= bytes.length, \"padding exceeds data length\", \"BUFFER_OVERRUN\", {\n buffer: new Uint8Array(bytes),\n length: length,\n offset: length + 1,\n });\n const result = new Uint8Array(length);\n result.fill(0);\n if (left) {\n result.set(bytes, length - bytes.length);\n }\n else {\n result.set(bytes, 0);\n }\n return hexlify(result);\n}\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **left**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **values** are in Solidity\n * (e.g. ``uint128``).\n */\nexport function zeroPadValue(data, length) {\n return zeroPad(data, length, true);\n}\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **right**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **bytes** are in Solidity\n * (e.g. ``bytes16``).\n */\nexport function zeroPadBytes(data, length) {\n return zeroPad(data, length, false);\n}\nexport function stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nexport function arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof value === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n // @ts-ignore\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix &&\n typeof value === \"string\" &&\n value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0x0\" + hex.substring(2);\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n // @ts-ignore\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nfunction addSlice(array) {\n // @ts-ignore\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nexport function hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\n//# sourceMappingURL=data.js.map","\"use strict\";\n/**\n * BigNumber\n *\n * A wrapper around the BN.js object. We use the BN.js library\n * because it is used by elliptic, so it is required regardless.\n *\n */\nimport _BN from \"bn.js\";\nimport { Logger } from \"../logger/logger.js\";\nimport { isBytes, hexlify, isHexString, } from \"../utils/data.js\";\nvar BN = _BN.BN;\nconst logger = new Logger(\"bigNumber/0.0.1\");\nconst _constructorGuard = {};\nconst MAX_SAFE = 0x1fffffffffffff;\nexport function isBigNumberish(value) {\n return (value != null &&\n (BigNumber.isBigNumber(value) ||\n (typeof value === \"number\" && value % 1 === 0) ||\n (typeof value === \"string\" && !!value.match(/^-?[0-9]+$/)) ||\n isHexString(value) ||\n typeof value === \"bigint\" ||\n isBytes(value)));\n}\n// Only warn about passing 10 into radix once\nlet _warnedToStringRadix = false;\nexport class BigNumber {\n _hex;\n _isBigNumber;\n constructor(constructorGuard, hex) {\n logger.checkNew(new.target, BigNumber);\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"cannot call constructor directly; use BigNumber.from\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new (BigNumber)\",\n });\n }\n this._hex = hex;\n this._isBigNumber = true;\n Object.freeze(this);\n }\n fromTwos(value) {\n return toBigNumber(toBN(this).fromTwos(value));\n }\n toTwos(value) {\n return toBigNumber(toBN(this).toTwos(value));\n }\n abs() {\n if (this._hex[0] === \"-\") {\n return BigNumber.from(this._hex.substring(1));\n }\n return this;\n }\n add(other) {\n return toBigNumber(toBN(this).add(toBN(other)));\n }\n sub(other) {\n return toBigNumber(toBN(this).sub(toBN(other)));\n }\n div(other) {\n const o = BigNumber.from(other);\n if (o.isZero()) {\n throwFault(\"division by zero\", \"div\");\n }\n return toBigNumber(toBN(this).div(toBN(other)));\n }\n mul(other) {\n return toBigNumber(toBN(this).mul(toBN(other)));\n }\n mod(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"cannot modulo negative values\", \"mod\");\n }\n return toBigNumber(toBN(this).umod(value));\n }\n pow(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"cannot raise to negative values\", \"pow\");\n }\n return toBigNumber(toBN(this).pow(value));\n }\n and(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'and' negative values\", \"and\");\n }\n return toBigNumber(toBN(this).and(value));\n }\n or(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'or' negative values\", \"or\");\n }\n return toBigNumber(toBN(this).or(value));\n }\n xor(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'xor' negative values\", \"xor\");\n }\n return toBigNumber(toBN(this).xor(value));\n }\n mask(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot mask negative values\", \"mask\");\n }\n return toBigNumber(toBN(this).maskn(value));\n }\n shl(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot shift negative values\", \"shl\");\n }\n return toBigNumber(toBN(this).shln(value));\n }\n shr(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot shift negative values\", \"shr\");\n }\n return toBigNumber(toBN(this).shrn(value));\n }\n eq(other) {\n return toBN(this).eq(toBN(other));\n }\n lt(other) {\n return toBN(this).lt(toBN(other));\n }\n lte(other) {\n return toBN(this).lte(toBN(other));\n }\n gt(other) {\n return toBN(this).gt(toBN(other));\n }\n gte(other) {\n return toBN(this).gte(toBN(other));\n }\n isNegative() {\n return this._hex[0] === \"-\";\n }\n isZero() {\n return toBN(this).isZero();\n }\n toNumber() {\n try {\n return toBN(this).toNumber();\n }\n catch (error) {\n throwFault(\"overflow\", \"toNumber\", this.toString());\n }\n // @ts-ignore\n return null;\n }\n toBigInt() {\n try {\n return BigInt(this.toString());\n }\n catch (e) { }\n return logger.throwError(\"this platform does not support BigInt\", Logger.errors.UNSUPPORTED_OPERATION, {\n value: this.toString(),\n });\n }\n toString() {\n // Lots of people expect this, which we do not support, so check (See: #889)\n if (arguments.length > 0) {\n if (arguments[0] === 10) {\n if (!_warnedToStringRadix) {\n _warnedToStringRadix = true;\n logger.warn(\"BigNumber.toString does not accept any parameters; base-10 is assumed\");\n }\n }\n else if (arguments[0] === 16) {\n logger.throwError(\"BigNumber.toString does not accept any parameters; use bigNumber.toHexString()\", Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n else {\n logger.throwError(\"BigNumber.toString does not accept parameters\", Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n }\n return toBN(this).toString(10);\n }\n toHexString() {\n return this._hex;\n }\n toJSON(key) {\n return { type: \"BigNumber\", hex: this.toHexString() };\n }\n static from(value) {\n if (value instanceof BigNumber) {\n return value;\n }\n if (typeof value === \"string\") {\n if (value.match(/^-?0x[0-9a-f]+$/i)) {\n return new BigNumber(_constructorGuard, toHex(value));\n }\n if (value.match(/^-?[0-9]+$/)) {\n return new BigNumber(_constructorGuard, toHex(new BN(value)));\n }\n return logger.throwArgumentError(\"invalid BigNumber string\", \"value\", value);\n }\n if (typeof value === \"number\") {\n if (value % 1) {\n throwFault(\"underflow\", \"BigNumber.from\", value);\n }\n if (value >= MAX_SAFE || value <= -MAX_SAFE) {\n throwFault(\"overflow\", \"BigNumber.from\", value);\n }\n return BigNumber.from(String(value));\n }\n const anyValue = value;\n if (typeof anyValue === \"bigint\") {\n return BigNumber.from(anyValue.toString());\n }\n if (isBytes(anyValue)) {\n return BigNumber.from(hexlify(anyValue));\n }\n if (anyValue) {\n // Hexable interface (takes priority)\n if (anyValue.toHexString) {\n const hex = anyValue.toHexString();\n if (typeof hex === \"string\") {\n return BigNumber.from(hex);\n }\n }\n else {\n // For now, handle legacy JSON-ified values (goes away in v6)\n let hex = anyValue._hex;\n // New-form JSON\n if (hex == null && anyValue.type === \"BigNumber\") {\n hex = anyValue.hex;\n }\n if (typeof hex === \"string\") {\n if (isHexString(hex) ||\n (hex[0] === \"-\" && isHexString(hex.substring(1)))) {\n return BigNumber.from(hex);\n }\n }\n }\n }\n return logger.throwArgumentError(\"invalid BigNumber value\", \"value\", value);\n }\n static isBigNumber(value) {\n return !!(value && value._isBigNumber);\n }\n}\n// Normalize the hex string\n// @ts-ignore\nfunction toHex(value) {\n // For BN, call on the hex string\n if (typeof value !== \"string\") {\n return toHex(value.toString(16));\n }\n // If negative, prepend the negative sign to the normalized positive value\n if (value[0] === \"-\") {\n // Strip off the negative sign\n value = value.substring(1);\n // Cannot have multiple negative signs (e.g. \"--0x04\")\n if (value[0] === \"-\") {\n logger.throwArgumentError(\"invalid hex\", \"value\", value);\n }\n // Call toHex on the positive component\n value = toHex(value);\n // Do not allow \"-0x00\"\n if (value === \"0x00\") {\n return value;\n }\n // Negate the value\n return \"-\" + value;\n }\n // Add a \"0x\" prefix if missing\n if (value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n // Normalize zero\n if (value === \"0x\") {\n return \"0x00\";\n }\n // Make the string even length\n if (value.length % 2) {\n value = \"0x0\" + value.substring(2);\n }\n // Trim to smallest even-length string\n while (value.length > 4 && value.substring(0, 4) === \"0x00\") {\n value = \"0x\" + value.substring(4);\n }\n return value;\n}\n// @ts-ignore\nfunction toBigNumber(value) {\n return BigNumber.from(toHex(value));\n}\n// @ts-ignore\nfunction toBN(value) {\n const hex = BigNumber.from(value).toHexString();\n if (hex[0] === \"-\") {\n return new BN(\"-\" + hex.substring(3), 16);\n }\n return new BN(hex.substring(2), 16);\n}\nfunction throwFault(fault, operation, value) {\n const params = { fault: fault, operation: operation };\n if (value != null) {\n params.value = value;\n }\n return logger.throwError(fault, Logger.errors.NUMERIC_FAULT, params);\n}\n// value should have no prefix\nexport function _base36To16(value) {\n return new BN(value, 36).toString(16);\n}\n// value should have no prefix\nexport function _base16To36(value) {\n return new BN(value, 16).toString(36);\n}\n//# sourceMappingURL=bigNumber.js.map","\"use strict\";\nimport { Logger } from \"../logger/logger.js\";\nimport { arrayify, hexlify, isBytesLike } from \"../utils/data.js\";\nconst logger = new Logger(\"rlp/0.0.1\");\nfunction arrayifyInteger(value) {\n const result = [];\n while (value) {\n // @ts-ignore\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\nfunction unarrayifyInteger(data, offset, length) {\n let result = 0;\n for (let i = 0; i < length; i++) {\n result = result * 256 + data[offset + i];\n }\n return result;\n}\nfunction _encode(object) {\n if (Array.isArray(object)) {\n let payload = [];\n object.forEach(function (child) {\n payload = payload.concat(_encode(child));\n });\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length);\n return payload;\n }\n const length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n return length.concat(payload);\n }\n if (!isBytesLike(object)) {\n logger.throwArgumentError(\"RLP object must be BytesLike\", \"object\", object);\n }\n const data = Array.prototype.slice.call(arrayify(object));\n if (data.length === 1 && data[0] <= 0x7f) {\n return data;\n }\n else if (data.length <= 55) {\n data.unshift(0x80 + data.length);\n return data;\n }\n const length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n return length.concat(data);\n}\nexport function encode(object) {\n return hexlify(_encode(object));\n}\nfunction _decodeChildren(data, offset, childOffset, length) {\n const result = [];\n while (childOffset < offset + 1 + length) {\n const decoded = _decode(data, childOffset);\n result.push(decoded.result);\n childOffset += decoded.consumed;\n if (childOffset > offset + 1 + length) {\n logger.throwError(\"child data too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n }\n return { consumed: 1 + length, result: result };\n}\n// returns { consumed: number, result: Object }\nfunction _decode(data, offset) {\n if (data.length === 0) {\n logger.throwError(\"data too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n // Array with extra length prefix\n if (data[offset] >= 0xf8) {\n const lengthLength = data[offset] - 0xf7;\n if (offset + 1 + lengthLength > data.length) {\n logger.throwError(\"data short segment too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n logger.throwError(\"data long segment too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);\n }\n else if (data[offset] >= 0xc0) {\n const length = data[offset] - 0xc0;\n if (offset + 1 + length > data.length) {\n logger.throwError(\"data array too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n return _decodeChildren(data, offset, offset + 1, length);\n }\n else if (data[offset] >= 0xb8) {\n const lengthLength = data[offset] - 0xb7;\n if (offset + 1 + lengthLength > data.length) {\n logger.throwError(\"data array too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n logger.throwError(\"data array too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length));\n return { consumed: 1 + lengthLength + length, result: result };\n }\n else if (data[offset] >= 0x80) {\n const length = data[offset] - 0x80;\n if (offset + 1 + length > data.length) {\n logger.throwError(\"data too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n const result = hexlify(data.slice(offset + 1, offset + 1 + length));\n return { consumed: 1 + length, result: result };\n }\n return { consumed: 1, result: hexlify(data[offset]) };\n}\nexport function decode(data) {\n const bytes = arrayify(data);\n const decoded = _decode(bytes, 0);\n if (decoded.consumed !== bytes.length) {\n logger.throwArgumentError(\"invalid rlp data\", \"data\", data);\n }\n return decoded.result;\n}\n//# sourceMappingURL=rlp.js.map","function number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`Wrong positive integer: ${n}`);\n}\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`Expected boolean, not ${b}`);\n}\nfunction bytes(b, ...lengths) {\n if (!(b instanceof Uint8Array))\n throw new Error('Expected Uint8Array');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\nexport { number, bool, bytes, hash, exists, output };\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n//# sourceMappingURL=_assert.js.map","/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated, we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\nconst u8a = (a) => a instanceof Uint8Array;\n// Cast array to different type\nexport const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n// Cast array to view\nexport const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\n// big-endian hardware is rare. Just in case someone still decides to run hashes:\n// early-throw an error because we don't support BE yet.\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!isLE)\n throw new Error('Non little-endian hardware is not supported');\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n if (!u8a(data))\n throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\n// For runtime check if class implements interface\nexport class Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\nconst toStr = {}.toString;\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nexport function wrapConstructor(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nexport function wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nexport function wrapXOFConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32) {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map","import { hash as assertHash, bytes as assertBytes, exists as assertExists } from './_assert.js';\nimport { Hash, toBytes } from './utils.js';\n// HMAC (RFC 2104)\nexport class HMAC extends Hash {\n constructor(hash, _key) {\n super();\n this.finished = false;\n this.destroyed = false;\n assertHash(hash);\n const key = toBytes(_key);\n this.iHash = hash.create();\n if (typeof this.iHash.update !== 'function')\n throw new Error('Expected instance of class which extends utils.Hash');\n this.blockLen = this.iHash.blockLen;\n this.outputLen = this.iHash.outputLen;\n const blockLen = this.blockLen;\n const pad = new Uint8Array(blockLen);\n // blockLen can be bigger than outputLen\n pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36;\n this.iHash.update(pad);\n // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone\n this.oHash = hash.create();\n // Undo internal XOR && apply outer XOR\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36 ^ 0x5c;\n this.oHash.update(pad);\n pad.fill(0);\n }\n update(buf) {\n assertExists(this);\n this.iHash.update(buf);\n return this;\n }\n digestInto(out) {\n assertExists(this);\n assertBytes(out, this.outputLen);\n this.finished = true;\n this.iHash.digestInto(out);\n this.oHash.update(out);\n this.oHash.digestInto(out);\n this.destroy();\n }\n digest() {\n const out = new Uint8Array(this.oHash.outputLen);\n this.digestInto(out);\n return out;\n }\n _cloneInto(to) {\n // Create new instance without calling constructor since key already in state and we don't know it.\n to || (to = Object.create(Object.getPrototypeOf(this), {}));\n const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;\n to = to;\n to.finished = finished;\n to.destroyed = destroyed;\n to.blockLen = blockLen;\n to.outputLen = outputLen;\n to.oHash = oHash._cloneInto(to.oHash);\n to.iHash = iHash._cloneInto(to.iHash);\n return to;\n }\n destroy() {\n this.destroyed = true;\n this.oHash.destroy();\n this.iHash.destroy();\n }\n}\n/**\n * HMAC: RFC2104 message authentication code.\n * @param hash - function that would be used e.g. sha256\n * @param key - message key\n * @param message - message data\n */\nexport const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();\nhmac.create = (hash, key) => new HMAC(hash, key);\n//# sourceMappingURL=hmac.js.map","import { hash as assertHash, number as assertNumber } from './_assert.js';\nimport { hmac } from './hmac.js';\nimport { createView, toBytes, checkOpts, asyncLoop } from './utils.js';\n// Common prologue and epilogue for sync/async functions\nfunction pbkdf2Init(hash, _password, _salt, _opts) {\n assertHash(hash);\n const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);\n const { c, dkLen, asyncTick } = opts;\n assertNumber(c);\n assertNumber(dkLen);\n assertNumber(asyncTick);\n if (c < 1)\n throw new Error('PBKDF2: iterations (c) should be >= 1');\n const password = toBytes(_password);\n const salt = toBytes(_salt);\n // DK = PBKDF2(PRF, Password, Salt, c, dkLen);\n const DK = new Uint8Array(dkLen);\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n const PRF = hmac.create(hash, password);\n const PRFSalt = PRF._cloneInto().update(salt);\n return { c, dkLen, asyncTick, DK, PRF, PRFSalt };\n}\nfunction pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {\n PRF.destroy();\n PRFSalt.destroy();\n if (prfW)\n prfW.destroy();\n u.fill(0);\n return DK;\n}\n/**\n * PBKDF2-HMAC: RFC 2898 key derivation function\n * @param hash - hash function that would be used e.g. sha256\n * @param password - password from which a derived key is generated\n * @param salt - cryptographic salt\n * @param opts - {c, dkLen} where c is work factor and dkLen is output message size\n */\nexport function pbkdf2(hash, password, salt, opts) {\n const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);\n let prfW; // Working copy\n const arr = new Uint8Array(4);\n const view = createView(arr);\n const u = new Uint8Array(PRF.outputLen);\n // DK = T1 + T2 + ⋯ + Tdklen/hlen\n for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {\n // Ti = F(Password, Salt, c, i)\n const Ti = DK.subarray(pos, pos + PRF.outputLen);\n view.setInt32(0, ti, false);\n // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);\n Ti.set(u.subarray(0, Ti.length));\n for (let ui = 1; ui < c; ui++) {\n // Uc = PRF(Password, Uc−1)\n PRF._cloneInto(prfW).update(u).digestInto(u);\n for (let i = 0; i < Ti.length; i++)\n Ti[i] ^= u[i];\n }\n }\n return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);\n}\nexport async function pbkdf2Async(hash, password, salt, opts) {\n const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);\n let prfW; // Working copy\n const arr = new Uint8Array(4);\n const view = createView(arr);\n const u = new Uint8Array(PRF.outputLen);\n // DK = T1 + T2 + ⋯ + Tdklen/hlen\n for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {\n // Ti = F(Password, Salt, c, i)\n const Ti = DK.subarray(pos, pos + PRF.outputLen);\n view.setInt32(0, ti, false);\n // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);\n Ti.set(u.subarray(0, Ti.length));\n await asyncLoop(c - 1, asyncTick, () => {\n // Uc = PRF(Password, Uc−1)\n PRF._cloneInto(prfW).update(u).digestInto(u);\n for (let i = 0; i < Ti.length; i++)\n Ti[i] ^= u[i];\n });\n }\n return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);\n}\n//# sourceMappingURL=pbkdf2.js.map","import { exists, output } from './_assert.js';\nimport { Hash, createView, toBytes } from './utils.js';\n// Polyfill for Safari 14\nfunction setBigUint64(view, byteOffset, value, isLE) {\n if (typeof view.setBigUint64 === 'function')\n return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n// Base SHA2 class (RFC 6234)\nexport class SHA2 extends Hash {\n constructor(blockLen, outputLen, padOffset, isLE) {\n super();\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.finished = false;\n this.length = 0;\n this.pos = 0;\n this.destroyed = false;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data) {\n exists(this);\n const { view, buffer, blockLen } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n exists(this);\n output(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n this.buffer.subarray(pos).fill(0);\n // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to || (to = new this.constructor());\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.length = length;\n to.pos = pos;\n to.finished = finished;\n to.destroyed = destroyed;\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n}\n//# sourceMappingURL=_sha2.js.map","import { SHA2 } from './_sha2.js';\nimport { rotr, wrapConstructor } from './utils.js';\n// SHA2-256 need to try 2^128 hashes to execute birthday attack.\n// BTC network is doing 2^67 hashes/sec as per early 2023.\n// Choice: a ? b : c\nconst Chi = (a, b, c) => (a & b) ^ (~a & c);\n// Majority function, true if any two inpust is true\nconst Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);\n// Round constants:\n// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n// prettier-ignore\nconst IV = /* @__PURE__ */ new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n]);\n// Temporary buffer, not used to store anything between runs\n// Named this way because it matches specification.\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nclass SHA256 extends SHA2 {\n constructor() {\n super(64, 32, 8, false);\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n this.A = IV[0] | 0;\n this.B = IV[1] | 0;\n this.C = IV[2] | 0;\n this.D = IV[3] | 0;\n this.E = IV[4] | 0;\n this.F = IV[5] | 0;\n this.G = IV[6] | 0;\n this.H = IV[7] | 0;\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n SHA256_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\n// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf\nclass SHA224 extends SHA256 {\n constructor() {\n super();\n this.A = 0xc1059ed8 | 0;\n this.B = 0x367cd507 | 0;\n this.C = 0x3070dd17 | 0;\n this.D = 0xf70e5939 | 0;\n this.E = 0xffc00b31 | 0;\n this.F = 0x68581511 | 0;\n this.G = 0x64f98fa7 | 0;\n this.H = 0xbefa4fa4 | 0;\n this.outputLen = 28;\n }\n}\n/**\n * SHA2-256 hash function\n * @param message - data that would be hashed\n */\nexport const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());\nexport const sha224 = /* @__PURE__ */ wrapConstructor(() => new SHA224());\n//# sourceMappingURL=sha256.js.map","const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nconst rotr32L = (h, _l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add, add3L, add3H, add4L, add4H, add5H, add5L, };\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n//# sourceMappingURL=_u64.js.map","import { SHA2 } from './_sha2.js';\nimport u64 from './_u64.js';\nimport { wrapConstructor } from './utils.js';\n// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):\n// prettier-ignore\nconst [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\n// Temporary buffer, not used to store anything between runs\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\nexport class SHA512 extends SHA2 {\n constructor() {\n super(128, 64, 16, false);\n // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.\n // Also looks cleaner and easier to verify with spec.\n // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x6a09e667 | 0;\n this.Al = 0xf3bcc908 | 0;\n this.Bh = 0xbb67ae85 | 0;\n this.Bl = 0x84caa73b | 0;\n this.Ch = 0x3c6ef372 | 0;\n this.Cl = 0xfe94f82b | 0;\n this.Dh = 0xa54ff53a | 0;\n this.Dl = 0x5f1d36f1 | 0;\n this.Eh = 0x510e527f | 0;\n this.El = 0xade682d1 | 0;\n this.Fh = 0x9b05688c | 0;\n this.Fl = 0x2b3e6c1f | 0;\n this.Gh = 0x1f83d9ab | 0;\n this.Gl = 0xfb41bd6b | 0;\n this.Hh = 0x5be0cd19 | 0;\n this.Hl = 0x137e2179 | 0;\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n SHA512_W_H.fill(0);\n SHA512_W_L.fill(0);\n }\n destroy() {\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\nclass SHA512_224 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x8c3d37c8 | 0;\n this.Al = 0x19544da2 | 0;\n this.Bh = 0x73e19966 | 0;\n this.Bl = 0x89dcd4d6 | 0;\n this.Ch = 0x1dfab7ae | 0;\n this.Cl = 0x32ff9c82 | 0;\n this.Dh = 0x679dd514 | 0;\n this.Dl = 0x582f9fcf | 0;\n this.Eh = 0x0f6d2b69 | 0;\n this.El = 0x7bd44da8 | 0;\n this.Fh = 0x77e36f73 | 0;\n this.Fl = 0x04c48942 | 0;\n this.Gh = 0x3f9d85a8 | 0;\n this.Gl = 0x6a1d36c8 | 0;\n this.Hh = 0x1112e6ad | 0;\n this.Hl = 0x91d692a1 | 0;\n this.outputLen = 28;\n }\n}\nclass SHA512_256 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x22312194 | 0;\n this.Al = 0xfc2bf72c | 0;\n this.Bh = 0x9f555fa3 | 0;\n this.Bl = 0xc84c64c2 | 0;\n this.Ch = 0x2393b86b | 0;\n this.Cl = 0x6f53b151 | 0;\n this.Dh = 0x96387719 | 0;\n this.Dl = 0x5940eabd | 0;\n this.Eh = 0x96283ee2 | 0;\n this.El = 0xa88effe3 | 0;\n this.Fh = 0xbe5e1e25 | 0;\n this.Fl = 0x53863992 | 0;\n this.Gh = 0x2b0199fc | 0;\n this.Gl = 0x2c85b8aa | 0;\n this.Hh = 0x0eb72ddc | 0;\n this.Hl = 0x81c52ca2 | 0;\n this.outputLen = 32;\n }\n}\nclass SHA384 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0xcbbb9d5d | 0;\n this.Al = 0xc1059ed8 | 0;\n this.Bh = 0x629a292a | 0;\n this.Bl = 0x367cd507 | 0;\n this.Ch = 0x9159015a | 0;\n this.Cl = 0x3070dd17 | 0;\n this.Dh = 0x152fecd8 | 0;\n this.Dl = 0xf70e5939 | 0;\n this.Eh = 0x67332667 | 0;\n this.El = 0xffc00b31 | 0;\n this.Fh = 0x8eb44a87 | 0;\n this.Fl = 0x68581511 | 0;\n this.Gh = 0xdb0c2e0d | 0;\n this.Gl = 0x64f98fa7 | 0;\n this.Hh = 0x47b5481d | 0;\n this.Hl = 0xbefa4fa4 | 0;\n this.outputLen = 48;\n }\n}\nexport const sha512 = /* @__PURE__ */ wrapConstructor(() => new SHA512());\nexport const sha512_224 = /* @__PURE__ */ wrapConstructor(() => new SHA512_224());\nexport const sha512_256 = /* @__PURE__ */ wrapConstructor(() => new SHA512_256());\nexport const sha384 = /* @__PURE__ */ wrapConstructor(() => new SHA384());\n//# sourceMappingURL=sha512.js.map","import { bytes, exists, number, output } from './_assert.js';\nimport { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.js';\nimport { Hash, u32, toBytes, wrapConstructor, wrapXOFConstructorWithOpts, } from './utils.js';\n// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.\n// It's called a sponge function.\n// Various per round constants calculations\nconst [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nconst _2n = /* @__PURE__ */ BigInt(2);\nconst _7n = /* @__PURE__ */ BigInt(7);\nconst _256n = /* @__PURE__ */ BigInt(256);\nconst _0x71n = /* @__PURE__ */ BigInt(0x71);\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n)\n t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n// Same as keccakf1600, but allows to skip some rounds\nexport function keccakP(s, rounds = 24) {\n const B = new Uint32Array(5 * 2);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++)\n B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n for (let x = 0; x < 10; x += 2) {\n const idx1 = (x + 8) % 10;\n const idx0 = (x + 2) % 10;\n const B0 = B[idx0];\n const B1 = B[idx0 + 1];\n const Th = rotlH(B0, B1, 1) ^ B[idx1];\n const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n for (let y = 0; y < 50; y += 10) {\n s[x + y] ^= Th;\n s[x + y + 1] ^= Tl;\n }\n }\n // Rho (ρ) and Pi (π)\n let curH = s[2];\n let curL = s[3];\n for (let t = 0; t < 24; t++) {\n const shift = SHA3_ROTL[t];\n const Th = rotlH(curH, curL, shift);\n const Tl = rotlL(curH, curL, shift);\n const PI = SHA3_PI[t];\n curH = s[PI];\n curL = s[PI + 1];\n s[PI] = Th;\n s[PI + 1] = Tl;\n }\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n for (let x = 0; x < 10; x++)\n B[x] = s[y + x];\n for (let x = 0; x < 10; x++)\n s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n B.fill(0);\n}\nexport class Keccak extends Hash {\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n super();\n this.blockLen = blockLen;\n this.suffix = suffix;\n this.outputLen = outputLen;\n this.enableXOF = enableXOF;\n this.rounds = rounds;\n this.pos = 0;\n this.posOut = 0;\n this.finished = false;\n this.destroyed = false;\n // Can be passed from user as dkLen\n number(outputLen);\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n if (0 >= this.blockLen || this.blockLen >= 200)\n throw new Error('Sha3 supports only keccak-f1600 function');\n this.state = new Uint8Array(200);\n this.state32 = u32(this.state);\n }\n keccak() {\n keccakP(this.state32, this.rounds);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data) {\n exists(this);\n const { blockLen, state } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++)\n state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen)\n this.keccak();\n }\n return this;\n }\n finish() {\n if (this.finished)\n return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n writeInto(out) {\n exists(this, false);\n bytes(out);\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len;) {\n if (this.posOut >= blockLen)\n this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out) {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF)\n throw new Error('XOF is not possible for this instance');\n return this.writeInto(out);\n }\n xof(bytes) {\n number(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out) {\n output(out, this);\n if (this.finished)\n throw new Error('digest() was already called');\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n this.state.fill(0);\n }\n _cloneInto(to) {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\nconst gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));\nexport const sha3_224 = /* @__PURE__ */ gen(0x06, 144, 224 / 8);\n/**\n * SHA3-256 hash function\n * @param message - that would be hashed\n */\nexport const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8);\nexport const sha3_384 = /* @__PURE__ */ gen(0x06, 104, 384 / 8);\nexport const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);\nexport const keccak_224 = /* @__PURE__ */ gen(0x01, 144, 224 / 8);\n/**\n * keccak-256 hash function. Different from SHA3-256.\n * @param message - that would be hashed\n */\nexport const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);\nexport const keccak_384 = /* @__PURE__ */ gen(0x01, 104, 384 / 8);\nexport const keccak_512 = /* @__PURE__ */ gen(0x01, 72, 512 / 8);\nconst genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));\nexport const shake128 = /* @__PURE__ */ genShake(0x1f, 168, 128 / 8);\nexport const shake256 = /* @__PURE__ */ genShake(0x1f, 136, 256 / 8);\n//# sourceMappingURL=sha3.js.map","/**\n * Some mathematic operations.\n *\n * @_subsection: api/utils:Math Helpers [about-maths]\n */\nimport { hexlify, isBytesLike } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\n//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1;\n// IEEE 754 support 53-bits of mantissa\nconst maxValue = 0x1fffffffffffff;\n/**\n * Convert %%value%% from a twos-compliment representation of %%width%%\n * bits to its value.\n *\n * If the highest bit is ``1``, the result will be negative.\n */\nexport function fromTwos(_value, _width) {\n const value = getUint(_value, \"value\");\n const width = BigInt(getNumber(_width, \"width\"));\n assert(value >> width === BN_0, \"overflow\", \"NUMERIC_FAULT\", {\n operation: \"fromTwos\",\n fault: \"overflow\",\n value: _value,\n });\n // Top bit set; treat as a negative value\n if (value >> (width - BN_1)) {\n const mask = (BN_1 << width) - BN_1;\n return -((~value & mask) + BN_1);\n }\n return value;\n}\n/**\n * Convert %%value%% to a twos-compliment representation of\n * %%width%% bits.\n *\n * The result will always be positive.\n */\nexport function toTwos(_value, _width) {\n let value = getBigInt(_value, \"value\");\n const width = BigInt(getNumber(_width, \"width\"));\n const limit = BN_1 << (width - BN_1);\n if (value < BN_0) {\n value = -value;\n assert(value <= limit, \"too low\", \"NUMERIC_FAULT\", {\n operation: \"toTwos\",\n fault: \"overflow\",\n value: _value,\n });\n const mask = (BN_1 << width) - BN_1;\n return (~value & mask) + BN_1;\n }\n else {\n assert(value < limit, \"too high\", \"NUMERIC_FAULT\", {\n operation: \"toTwos\",\n fault: \"overflow\",\n value: _value,\n });\n }\n return value;\n}\n/**\n * Mask %%value%% with a bitmask of %%bits%% ones.\n */\nexport function mask(_value, _bits) {\n const value = getUint(_value, \"value\");\n const bits = BigInt(getNumber(_bits, \"bits\"));\n return value & ((BN_1 << bits) - BN_1);\n}\n/**\n * Gets a BigInt from %%value%%. If it is an invalid value for\n * a BigInt, then an ArgumentError will be thrown for %%name%%.\n */\nexport function getBigInt(value, name) {\n switch (typeof value) {\n case \"bigint\":\n return value;\n case \"number\":\n assertArgument(Number.isInteger(value), \"underflow\", name || \"value\", value);\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return BigInt(value);\n case \"string\":\n try {\n if (value === \"\") {\n throw new Error(\"empty string\");\n }\n if (value[0] === \"-\" && value[1] !== \"-\") {\n return -BigInt(value.substring(1));\n }\n return BigInt(value);\n }\n catch (e) {\n assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || \"value\", value);\n }\n }\n assertArgument(false, \"invalid BigNumberish value\", name || \"value\", value);\n}\nexport function getUint(value, name) {\n const result = getBigInt(value, name);\n assert(result >= BN_0, \"unsigned value cannot be negative\", \"NUMERIC_FAULT\", {\n fault: \"overflow\",\n operation: \"getUint\",\n value,\n });\n return result;\n}\nconst Nibbles = \"0123456789abcdef\";\n/*\n * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it\n * is treated as Big Endian data.\n */\nexport function toBigInt(value) {\n if (value instanceof Uint8Array) {\n let result = \"0x0\";\n for (const v of value) {\n result += Nibbles[v >> 4];\n result += Nibbles[v & 0x0f];\n }\n return BigInt(result);\n }\n return getBigInt(value);\n}\n/**\n * Gets a //number// from %%value%%. If it is an invalid value for\n * a //number//, then an ArgumentError will be thrown for %%name%%.\n */\nexport function getNumber(value, name) {\n switch (typeof value) {\n case \"bigint\":\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return Number(value);\n case \"number\":\n assertArgument(Number.isInteger(value), \"underflow\", name || \"value\", value);\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return value;\n case \"string\":\n try {\n if (value === \"\") {\n throw new Error(\"empty string\");\n }\n return getNumber(BigInt(value), name);\n }\n catch (e) {\n assertArgument(false, `invalid numeric string: ${e.message}`, name || \"value\", value);\n }\n }\n assertArgument(false, \"invalid numeric value\", name || \"value\", value);\n}\n/**\n * Converts %%value%% to a number. If %%value%% is a Uint8Array, it\n * is treated as Big Endian data. Throws if the value is not safe.\n */\nexport function toNumber(value) {\n return getNumber(toBigInt(value));\n}\n/**\n * Converts %%value%% to a Big Endian hexstring, optionally padded to\n * %%width%% bytes.\n */\nexport function toBeHex(_value, _width) {\n const value = getUint(_value, \"value\");\n let result = value.toString(16);\n if (_width == null) {\n // Ensure the value is of even length\n if (result.length % 2) {\n result = \"0\" + result;\n }\n }\n else {\n const width = getNumber(_width, \"width\");\n assert(width * 2 >= result.length, `value exceeds width (${width} bits)`, \"NUMERIC_FAULT\", {\n operation: \"toBeHex\",\n fault: \"overflow\",\n value: _value,\n });\n // Pad the value to the required width\n while (result.length < width * 2) {\n result = \"0\" + result;\n }\n }\n return \"0x\" + result;\n}\n/**\n * Converts %%value%% to a Big Endian Uint8Array.\n */\nexport function toBeArray(_value) {\n const value = getUint(_value, \"value\");\n if (value === BN_0) {\n return new Uint8Array([]);\n }\n let hex = value.toString(16);\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n const result = new Uint8Array(hex.length / 2);\n for (let i = 0; i < result.length; i++) {\n const offset = i * 2;\n result[i] = parseInt(hex.substring(offset, offset + 2), 16);\n }\n return result;\n}\n/**\n * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//.\n *\n * A //Quantity// does not have and leading 0 values unless the value is\n * the literal value `0x0`. This is most commonly used for JSSON-RPC\n * numeric values.\n */\nexport function toQuantity(value) {\n let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring(2);\n while (result.startsWith(\"0\")) {\n result = result.substring(1);\n }\n if (result === \"\") {\n result = \"0\";\n }\n return \"0x\" + result;\n}\n//# sourceMappingURL=maths.js.map","/**\n * The [Base58 Encoding](link-base58) scheme allows a **numeric** value\n * to be encoded as a compact string using a radix of 58 using only\n * alpha-numeric characters. Confusingly similar characters are omitted\n * (i.e. ``\"l0O\"``).\n *\n * Note that Base58 encodes a **numeric** value, not arbitrary bytes,\n * since any zero-bytes on the left would get removed. To mitigate this\n * issue most schemes that use Base58 choose specific high-order values\n * to ensure non-zero prefixes.\n *\n * @_subsection: api/utils:Base58 Encoding [about-base58]\n */\nimport { getBytes } from \"./data.js\";\nimport { assertArgument } from \"./errors.js\";\nimport { toBigInt } from \"./maths.js\";\nconst Alphabet = \"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";\nlet Lookup = null;\nfunction getAlpha(letter) {\n if (Lookup == null) {\n Lookup = {};\n for (let i = 0; i < Alphabet.length; i++) {\n Lookup[Alphabet[i]] = BigInt(i);\n }\n }\n const result = Lookup[letter];\n assertArgument(result != null, `invalid base58 value`, \"letter\", letter);\n return result;\n}\nconst BN_0 = BigInt(0);\nconst BN_58 = BigInt(58);\n/**\n * Encode %%value%% as a Base58-encoded string.\n */\nexport function encodeBase58(_value) {\n let value = toBigInt(getBytes(_value));\n let result = \"\";\n while (value) {\n result = Alphabet[Number(value % BN_58)] + result;\n value /= BN_58;\n }\n return result;\n}\n/**\n * Decode the Base58-encoded %%value%%.\n */\nexport function decodeBase58(value) {\n let result = BN_0;\n for (let i = 0; i < value.length; i++) {\n result *= BN_58;\n result += getAlpha(value[i]);\n }\n return result;\n}\n//# sourceMappingURL=base58.js.map","// utils/base64-browser\nimport { getBytes } from \"./data.js\";\nexport function decodeBase64(textData) {\n textData = atob(textData);\n const data = new Uint8Array(textData.length);\n for (let i = 0; i < textData.length; i++) {\n data[i] = textData.charCodeAt(i);\n }\n return getBytes(data);\n}\nexport function encodeBase64(_data) {\n const data = getBytes(_data);\n let textData = \"\";\n for (let i = 0; i < data.length; i++) {\n textData += String.fromCharCode(data[i]);\n }\n return btoa(textData);\n}\n//# sourceMappingURL=base64-browser.js.map","/**\n * Explain events...\n *\n * @_section api/utils/events:Events [about-events]\n */\nimport { defineProperties } from \"./properties.js\";\n/**\n * When an [[EventEmitterable]] triggers a [[Listener]], the\n * callback always ahas one additional argument passed, which is\n * an **EventPayload**.\n */\nexport class EventPayload {\n /**\n * The event filter.\n */\n filter;\n /**\n * The **EventEmitterable**.\n */\n emitter;\n #listener;\n /**\n * Create a new **EventPayload** for %%emitter%% with\n * the %%listener%% and for %%filter%%.\n */\n constructor(emitter, listener, filter) {\n this.#listener = listener;\n defineProperties(this, { emitter, filter });\n }\n /**\n * Unregister the triggered listener for future events.\n */\n async removeListener() {\n if (this.#listener == null) {\n return;\n }\n await this.emitter.off(this.filter, this.#listener);\n }\n}\n//# sourceMappingURL=events.js.map","/**\n * Using strings in Core (or any security-basd system) requires\n * additional care. These utilities attempt to mitigate some of the\n * safety issues as well as provide the ability to recover and analyse\n * strings.\n *\n * @_subsection api/utils:Strings and UTF-8 [about-strings]\n */\nimport { getBytes } from \"./data.js\";\nimport { assertArgument, assertNormalize } from \"./errors.js\";\nfunction errorFunc(reason, offset, bytes, output, badCodepoint) {\n assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, \"bytes\", bytes);\n}\nfunction ignoreFunc(reason, offset, bytes, output, badCodepoint) {\n // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes\n if (reason === \"BAD_PREFIX\" || reason === \"UNEXPECTED_CONTINUE\") {\n let i = 0;\n for (let o = offset + 1; o < bytes.length; o++) {\n if (bytes[o] >> 6 !== 0x02) {\n break;\n }\n i++;\n }\n return i;\n }\n // This byte runs us past the end of the string, so just jump to the end\n // (but the first byte was read already read and therefore skipped)\n if (reason === \"OVERRUN\") {\n return bytes.length - offset - 1;\n }\n // Nothing to skip\n return 0;\n}\nfunction replaceFunc(reason, offset, bytes, output, badCodepoint) {\n // Overlong representations are otherwise \"valid\" code points; just non-deistingtished\n if (reason === \"OVERLONG\") {\n assertArgument(typeof badCodepoint === \"number\", \"invalid bad code point for replacement\", \"badCodepoint\", badCodepoint);\n output.push(badCodepoint);\n return 0;\n }\n // Put the replacement character into the output\n output.push(0xfffd);\n // Otherwise, process as if ignoring errors\n return ignoreFunc(reason, offset, bytes, output, badCodepoint);\n}\n/**\n * A handful of popular, built-in UTF-8 error handling strategies.\n *\n * **``\"error\"``** - throws on ANY illegal UTF-8 sequence or\n * non-canonical (overlong) codepoints (this is the default)\n *\n * **``\"ignore\"``** - silently drops any illegal UTF-8 sequence\n * and accepts non-canonical (overlong) codepoints\n *\n * **``\"replace\"``** - replace any illegal UTF-8 sequence with the\n * UTF-8 replacement character (i.e. ``\"\\\\ufffd\"``) and accepts\n * non-canonical (overlong) codepoints\n *\n * @returns: Record<\"error\" | \"ignore\" | \"replace\", Utf8ErrorFunc>\n */\nexport const Utf8ErrorFuncs = Object.freeze({\n error: errorFunc,\n ignore: ignoreFunc,\n replace: replaceFunc,\n});\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction getUtf8CodePoints(_bytes, onError) {\n if (onError == null) {\n onError = Utf8ErrorFuncs.error;\n }\n const bytes = getBytes(_bytes, \"bytes\");\n const result = [];\n let i = 0;\n // Invalid bytes are ignored\n while (i < bytes.length) {\n const c = bytes[i++];\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result.push(c);\n continue;\n }\n // Multibyte; how many bytes left for this character?\n let extraLength = null;\n let overlongMask = null;\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n // 1110 xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n }\n else {\n if ((c & 0xc0) === 0x80) {\n i += onError(\"UNEXPECTED_CONTINUE\", i - 1, bytes, result);\n }\n else {\n i += onError(\"BAD_PREFIX\", i - 1, bytes, result);\n }\n continue;\n }\n // Do we have enough bytes in our data?\n if (i - 1 + extraLength >= bytes.length) {\n i += onError(\"OVERRUN\", i - 1, bytes, result);\n continue;\n }\n // Remove the length prefix from the char\n let res = c & ((1 << (8 - extraLength - 1)) - 1);\n for (let j = 0; j < extraLength; j++) {\n let nextChar = bytes[i];\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n i += onError(\"MISSING_CONTINUE\", i, bytes, result);\n res = null;\n break;\n }\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n // See above loop for invalid continuation byte\n if (res === null) {\n continue;\n }\n // Maximum code point\n if (res > 0x10ffff) {\n i += onError(\"OUT_OF_RANGE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n i += onError(\"UTF16_SURROGATE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Check for overlong sequences (more bytes than needed)\n if (res <= overlongMask) {\n i += onError(\"OVERLONG\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n result.push(res);\n }\n return result;\n}\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\n/**\n * Returns the UTF-8 byte representation of %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8Bytes(str, form) {\n if (form != null) {\n assertNormalize(form);\n str = str.normalize(form);\n }\n let result = [];\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i);\n if (c < 0x80) {\n result.push(c);\n }\n else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n }\n else if ((c & 0xfc00) == 0xd800) {\n i++;\n const c2 = str.charCodeAt(i);\n assertArgument(i < str.length && (c2 & 0xfc00) === 0xdc00, \"invalid surrogate pair\", \"str\", str);\n // Surrogate Pair\n const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((pair >> 18) | 0xf0);\n result.push(((pair >> 12) & 0x3f) | 0x80);\n result.push(((pair >> 6) & 0x3f) | 0x80);\n result.push((pair & 0x3f) | 0x80);\n }\n else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n return new Uint8Array(result);\n}\n//export\nfunction _toUtf8String(codePoints) {\n return codePoints\n .map((codePoint) => {\n if (codePoint <= 0xffff) {\n return String.fromCharCode(codePoint);\n }\n codePoint -= 0x10000;\n return String.fromCharCode(((codePoint >> 10) & 0x3ff) + 0xd800, (codePoint & 0x3ff) + 0xdc00);\n })\n .join(\"\");\n}\n/**\n * Returns the string represented by the UTF-8 data %%bytes%%.\n *\n * When %%onError%% function is specified, it is called on UTF-8\n * errors allowing recovery using the [[Utf8ErrorFunc]] API.\n * (default: [error](Utf8ErrorFuncs))\n */\nexport function toUtf8String(bytes, onError) {\n return _toUtf8String(getUtf8CodePoints(bytes, onError));\n}\n/**\n * Returns the UTF-8 code-points for %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8CodePoints(str, form) {\n return getUtf8CodePoints(toUtf8Bytes(str, form));\n}\n//# sourceMappingURL=utf8.js.map","import { assert } from \"./errors.js\";\n// @TODO: timeout is completely ignored; start a Promise.any with a reject?\n// @ts-ignore\nexport async function getUrl(req, _signal) {\n const protocol = req.url.split(\":\")[0].toLowerCase();\n assert(protocol === \"http\" || protocol === \"https\", `unsupported protocol ${protocol}`, \"UNSUPPORTED_OPERATION\", {\n info: { protocol },\n operation: \"request\",\n });\n assert(protocol === \"https\" || !req.credentials || req.allowInsecureAuthentication, \"insecure authorized connections unsupported\", \"UNSUPPORTED_OPERATION\", {\n operation: \"request\",\n });\n let signal = undefined;\n if (_signal) {\n const controller = new AbortController();\n signal = controller.signal;\n _signal.addListener(() => {\n controller.abort();\n });\n }\n const init = {\n method: req.method,\n headers: new Headers(Array.from(req)),\n body: req.body || undefined,\n signal,\n };\n try {\n const resp = await fetch(req.url, init);\n const headers = {};\n resp.headers.forEach((value, key) => {\n headers[key.toLowerCase()] = value;\n });\n const respBody = await resp.arrayBuffer();\n const body = respBody == null ? null : new Uint8Array(respBody);\n return {\n statusCode: resp.status,\n statusMessage: resp.statusText,\n headers,\n body,\n };\n }\n catch (error) {\n console.log({ error });\n return undefined;\n }\n}\n//# sourceMappingURL=geturl-browser.js.map","/**\n * Explain fetching here...\n *\n * @_section api/utils/fetching:Fetching Web Content [about-fetch]\n */\nimport { decodeBase64, encodeBase64 } from \"./base64.js\";\nimport { hexlify } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nimport { defineProperties } from \"./properties.js\";\nimport { toUtf8Bytes, toUtf8String } from \"./utf8.js\";\nimport { getUrl } from \"./geturl.js\";\nconst MAX_ATTEMPTS = 12;\nconst SLOT_INTERVAL = 250;\n// The global FetchGetUrlFunc implementation.\nlet getUrlFunc = getUrl;\nconst reData = new RegExp(\"^data:([^;:]*)?(;base64)?,(.*)$\", \"i\");\nconst reIpfs = new RegExp(\"^ipfs://(ipfs/)?(.*)$\", \"i\");\n// If locked, new Gateways cannot be added\nlet locked = false;\n// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs\nasync function dataGatewayFunc(url, signal) {\n try {\n const match = url.match(reData);\n if (!match) {\n throw new Error(\"invalid data\");\n }\n return new FetchResponse(200, \"OK\", {\n \"content-type\": match[1] || \"text/plain\",\n }, match[2] ? decodeBase64(match[3]) : unpercent(match[3]));\n }\n catch (error) {\n return new FetchResponse(599, \"BAD REQUEST (invalid data: URI)\", {}, null, new FetchRequest(url));\n }\n}\n/**\n * Returns a [[FetchGatewayFunc]] for fetching content from a standard\n * IPFS gateway hosted at %%baseUrl%%.\n */\nfunction getIpfsGatewayFunc(baseUrl) {\n async function gatewayIpfs(url, signal) {\n try {\n const match = url.match(reIpfs);\n if (!match) {\n throw new Error(\"invalid link\");\n }\n return new FetchRequest(`${baseUrl}${match[2]}`);\n }\n catch (error) {\n return new FetchResponse(599, \"BAD REQUEST (invalid IPFS URI)\", {}, null, new FetchRequest(url));\n }\n }\n return gatewayIpfs;\n}\nconst Gateways = {\n data: dataGatewayFunc,\n ipfs: getIpfsGatewayFunc(\"https://gateway.ipfs.io/ipfs/\"),\n};\nconst fetchSignals = new WeakMap();\n/**\n * @_ignore\n */\nexport class FetchCancelSignal {\n #listeners;\n #cancelled;\n constructor(request) {\n this.#listeners = [];\n this.#cancelled = false;\n fetchSignals.set(request, () => {\n if (this.#cancelled) {\n return;\n }\n this.#cancelled = true;\n for (const listener of this.#listeners) {\n setTimeout(() => {\n listener();\n }, 0);\n }\n this.#listeners = [];\n });\n }\n addListener(listener) {\n assert(!this.#cancelled, \"singal already cancelled\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fetchCancelSignal.addCancelListener\",\n });\n this.#listeners.push(listener);\n }\n get cancelled() {\n return this.#cancelled;\n }\n checkSignal() {\n assert(!this.cancelled, \"cancelled\", \"CANCELLED\", {});\n }\n}\n// Check the signal, throwing if it is cancelled\nfunction checkSignal(signal) {\n if (signal == null) {\n throw new Error(\"missing signal; should not happen\");\n }\n signal.checkSignal();\n return signal;\n}\n/**\n * Represents a request for a resource using a URI.\n *\n * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``,\n * and ``IPFS:``.\n *\n * Additional schemes can be added globally using [[registerGateway]].\n *\n * @example:\n * req = new FetchRequest(\"https://www.ricmoo.com\")\n * resp = await req.send()\n * resp.body.length\n * //_result:\n */\nexport class FetchRequest {\n #allowInsecure;\n #gzip;\n #headers;\n #method;\n #timeout;\n #url;\n #body;\n #bodyType;\n #creds;\n // Hooks\n #preflight;\n #process;\n #retry;\n #signal;\n #throttle;\n /**\n * The fetch URI to requrest.\n */\n get url() {\n return this.#url;\n }\n set url(url) {\n this.#url = String(url);\n }\n /**\n * The fetch body, if any, to send as the request body. //(default: null)//\n *\n * When setting a body, the intrinsic ``Content-Type`` is automatically\n * set and will be used if **not overridden** by setting a custom\n * header.\n *\n * If %%body%% is null, the body is cleared (along with the\n * intrinsic ``Content-Type``) and the .\n *\n * If %%body%% is a string, the intrincis ``Content-Type`` is set to\n * ``text/plain``.\n *\n * If %%body%% is a Uint8Array, the intrincis ``Content-Type`` is set to\n * ``application/octet-stream``.\n *\n * If %%body%% is any other object, the intrincis ``Content-Type`` is\n * set to ``application/json``.\n */\n get body() {\n if (this.#body == null) {\n return null;\n }\n return new Uint8Array(this.#body);\n }\n set body(body) {\n if (body == null) {\n this.#body = undefined;\n this.#bodyType = undefined;\n }\n else if (typeof body === \"string\") {\n this.#body = toUtf8Bytes(body);\n this.#bodyType = \"text/plain\";\n }\n else if (body instanceof Uint8Array) {\n this.#body = body;\n this.#bodyType = \"application/octet-stream\";\n }\n else if (typeof body === \"object\") {\n this.#body = toUtf8Bytes(JSON.stringify(body));\n this.#bodyType = \"application/json\";\n }\n else {\n throw new Error(\"invalid body\");\n }\n }\n /**\n * Returns true if the request has a body.\n */\n hasBody() {\n return this.#body != null;\n }\n /**\n * The HTTP method to use when requesting the URI. If no method\n * has been explicitly set, then ``GET`` is used if the body is\n * null and ``POST`` otherwise.\n */\n get method() {\n if (this.#method) {\n return this.#method;\n }\n if (this.hasBody()) {\n return \"POST\";\n }\n return \"GET\";\n }\n set method(method) {\n if (method == null) {\n method = \"\";\n }\n this.#method = String(method).toUpperCase();\n }\n /**\n * The headers that will be used when requesting the URI. All\n * keys are lower-case.\n *\n * This object is a copy, so any chnages will **NOT** be reflected\n * in the ``FetchRequest``.\n *\n * To set a header entry, use the ``setHeader`` method.\n */\n get headers() {\n const headers = Object.assign({}, this.#headers);\n if (this.#creds) {\n headers[\"authorization\"] = `Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`;\n }\n if (this.allowGzip) {\n headers[\"accept-encoding\"] = \"gzip\";\n }\n if (headers[\"content-type\"] == null && this.#bodyType) {\n headers[\"content-type\"] = this.#bodyType;\n }\n if (this.body) {\n headers[\"content-length\"] = String(this.body.length);\n }\n return headers;\n }\n /**\n * Get the header for %%key%%, ignoring case.\n */\n getHeader(key) {\n return this.headers[key.toLowerCase()];\n }\n /**\n * Set the header for %%key%% to %%value%%. All values are coerced\n * to a string.\n */\n setHeader(key, value) {\n this.#headers[String(key).toLowerCase()] = String(value);\n }\n /**\n * Clear all headers, resetting all intrinsic headers.\n */\n clearHeaders() {\n this.#headers = {};\n }\n [Symbol.iterator]() {\n const headers = this.headers;\n const keys = Object.keys(headers);\n let index = 0;\n return {\n next: () => {\n if (index < keys.length) {\n const key = keys[index++];\n return {\n value: [key, headers[key]],\n done: false,\n };\n }\n return { value: undefined, done: true };\n },\n };\n }\n /**\n * The value that will be sent for the ``Authorization`` header.\n *\n * To set the credentials, use the ``setCredentials`` method.\n */\n get credentials() {\n return this.#creds || null;\n }\n /**\n * Sets an ``Authorization`` for %%username%% with %%password%%.\n */\n setCredentials(username, password) {\n assertArgument(!username.match(/:/), \"invalid basic authentication username\", \"username\", \"[REDACTED]\");\n this.#creds = `${username}:${password}`;\n }\n /**\n * Enable and request gzip-encoded responses. The response will\n * automatically be decompressed. //(default: true)//\n */\n get allowGzip() {\n return this.#gzip;\n }\n set allowGzip(value) {\n this.#gzip = !!value;\n }\n /**\n * Allow ``Authentication`` credentials to be sent over insecure\n * channels. //(default: false)//\n */\n get allowInsecureAuthentication() {\n return !!this.#allowInsecure;\n }\n set allowInsecureAuthentication(value) {\n this.#allowInsecure = !!value;\n }\n /**\n * The timeout (in milliseconds) to wait for a complere response.\n * //(default: 5 minutes)//\n */\n get timeout() {\n return this.#timeout;\n }\n set timeout(timeout) {\n assertArgument(timeout >= 0, \"timeout must be non-zero\", \"timeout\", timeout);\n this.#timeout = timeout;\n }\n /**\n * This function is called prior to each request, for example\n * during a redirection or retry in case of server throttling.\n *\n * This offers an opportunity to populate headers or update\n * content before sending a request.\n */\n get preflightFunc() {\n return this.#preflight || null;\n }\n set preflightFunc(preflight) {\n this.#preflight = preflight;\n }\n /**\n * This function is called after each response, offering an\n * opportunity to provide client-level throttling or updating\n * response data.\n *\n * Any error thrown in this causes the ``send()`` to throw.\n *\n * To schedule a retry attempt (assuming the maximum retry limit\n * has not been reached), use [[response.throwThrottleError]].\n */\n get processFunc() {\n return this.#process || null;\n }\n set processFunc(process) {\n this.#process = process;\n }\n /**\n * This function is called on each retry attempt.\n */\n get retryFunc() {\n return this.#retry || null;\n }\n set retryFunc(retry) {\n this.#retry = retry;\n }\n /**\n * Create a new FetchRequest instance with default values.\n *\n * Once created, each property may be set before issuing a\n * ``.send()`` to make the request.\n */\n constructor(url) {\n this.#url = String(url);\n this.#allowInsecure = false;\n this.#gzip = true;\n this.#headers = {};\n this.#method = \"\";\n this.#timeout = 300000;\n this.#throttle = {\n slotInterval: SLOT_INTERVAL,\n maxAttempts: MAX_ATTEMPTS,\n };\n }\n toString() {\n return ``;\n }\n /**\n * Update the throttle parameters used to determine maximum\n * attempts and exponential-backoff properties.\n */\n setThrottleParams(params) {\n if (params.slotInterval != null) {\n this.#throttle.slotInterval = params.slotInterval;\n }\n if (params.maxAttempts != null) {\n this.#throttle.maxAttempts = params.maxAttempts;\n }\n }\n async #send(attempt, expires, delay, _request, _response) {\n if (attempt >= this.#throttle.maxAttempts) {\n return _response.makeServerError(\"exceeded maximum retry limit\");\n }\n assert(getTime() <= expires, \"timeout\", \"TIMEOUT\", {\n operation: \"request.send\",\n reason: \"timeout\",\n request: _request,\n });\n if (delay > 0) {\n await wait(delay);\n }\n let req = this.clone();\n const scheme = (req.url.split(\":\")[0] || \"\").toLowerCase();\n // Process any Gateways\n if (scheme in Gateways) {\n const result = await Gateways[scheme](req.url, checkSignal(_request.#signal));\n if (result instanceof FetchResponse) {\n let response = result;\n if (this.processFunc) {\n checkSignal(_request.#signal);\n try {\n response = await this.processFunc(req, response);\n }\n catch (error) {\n // Something went wrong during processing; throw a 5xx server error\n if (error.throttle == null || typeof error.stall !== \"number\") {\n response\n .makeServerError(\"error in post-processing function\", error)\n .assertOk();\n }\n // Ignore throttling\n }\n }\n return response;\n }\n req = result;\n }\n // We have a preflight function; update the request\n if (this.preflightFunc) {\n req = await this.preflightFunc(req);\n }\n const resp = await getUrlFunc(req, checkSignal(_request.#signal));\n let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request);\n if (response.statusCode === 301 || response.statusCode === 302) {\n // Redirect\n try {\n const location = response.headers.location || \"\";\n return req\n .redirect(location)\n .#send(attempt + 1, expires, 0, _request, response);\n }\n catch (error) { }\n // Things won't get any better on another attempt; abort\n return response;\n }\n else if (response.statusCode === 429) {\n // Throttle\n if (this.retryFunc == null ||\n (await this.retryFunc(req, response, attempt))) {\n const retryAfter = response.headers[\"retry-after\"];\n let delay = this.#throttle.slotInterval *\n Math.trunc(Math.random() * Math.pow(2, attempt));\n if (typeof retryAfter === \"string\" &&\n retryAfter.match(/^[1-9][0-9]*$/)) {\n delay = parseInt(retryAfter);\n }\n return req\n .clone()\n .#send(attempt + 1, expires, delay, _request, response);\n }\n }\n if (this.processFunc) {\n checkSignal(_request.#signal);\n try {\n response = await this.processFunc(req, response);\n }\n catch (error) {\n // Something went wrong during processing; throw a 5xx server error\n if (error.throttle == null || typeof error.stall !== \"number\") {\n response\n .makeServerError(\"error in post-processing function\", error)\n .assertOk();\n }\n // Throttle\n let delay = this.#throttle.slotInterval *\n Math.trunc(Math.random() * Math.pow(2, attempt));\n if (error.stall >= 0) {\n delay = error.stall;\n }\n return req\n .clone()\n .#send(attempt + 1, expires, delay, _request, response);\n }\n }\n return response;\n }\n /**\n * Resolves to the response by sending the request.\n */\n send() {\n assert(this.#signal == null, \"request already sent\", \"UNSUPPORTED_OPERATION\", { operation: \"fetchRequest.send\" });\n this.#signal = new FetchCancelSignal(this);\n return this.#send(0, getTime() + this.timeout, 0, this, new FetchResponse(0, \"\", {}, null, this));\n }\n /**\n * Cancels the inflight response, causing a ``CANCELLED``\n * error to be rejected from the [[send]].\n */\n cancel() {\n assert(this.#signal != null, \"request has not been sent\", \"UNSUPPORTED_OPERATION\", { operation: \"fetchRequest.cancel\" });\n const signal = fetchSignals.get(this);\n if (!signal) {\n throw new Error(\"missing signal; should not happen\");\n }\n signal();\n }\n /**\n * Returns a new [[FetchRequest]] that represents the redirection\n * to %%location%%.\n */\n redirect(location) {\n // Redirection; for now we only support absolute locataions\n const current = this.url.split(\":\")[0].toLowerCase();\n const target = location.split(\":\")[0].toLowerCase();\n // Don't allow redirecting:\n // - non-GET requests\n // - downgrading the security (e.g. https => http)\n // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?]\n assert(this.method === \"GET\" &&\n (current !== \"https\" || target !== \"http\") &&\n location.match(/^https?:/), `unsupported redirect`, \"UNSUPPORTED_OPERATION\", {\n operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})`,\n });\n // Create a copy of this request, with a new URL\n const req = new FetchRequest(location);\n req.method = \"GET\";\n req.allowGzip = this.allowGzip;\n req.timeout = this.timeout;\n req.#headers = Object.assign({}, this.#headers);\n if (this.#body) {\n req.#body = new Uint8Array(this.#body);\n }\n req.#bodyType = this.#bodyType;\n // Do not forward credentials unless on the same domain; only absolute\n //req.allowInsecure = false;\n // paths are currently supported; may want a way to specify to forward?\n //setStore(req.#props, \"creds\", getStore(this.#pros, \"creds\"));\n return req;\n }\n /**\n * Create a new copy of this request.\n */\n clone() {\n const clone = new FetchRequest(this.url);\n // Preserve \"default method\" (i.e. null)\n clone.#method = this.#method;\n // Preserve \"default body\" with type, copying the Uint8Array is present\n if (this.#body) {\n clone.#body = this.#body;\n }\n clone.#bodyType = this.#bodyType;\n // Preserve \"default headers\"\n clone.#headers = Object.assign({}, this.#headers);\n // Credentials is readonly, so we copy internally\n clone.#creds = this.#creds;\n if (this.allowGzip) {\n clone.allowGzip = true;\n }\n clone.timeout = this.timeout;\n if (this.allowInsecureAuthentication) {\n clone.allowInsecureAuthentication = true;\n }\n clone.#preflight = this.#preflight;\n clone.#process = this.#process;\n clone.#retry = this.#retry;\n return clone;\n }\n /**\n * Locks all static configuration for gateways and FetchGetUrlFunc\n * registration.\n */\n static lockConfig() {\n locked = true;\n }\n /**\n * Get the current Gateway function for %%scheme%%.\n */\n static getGateway(scheme) {\n return Gateways[scheme.toLowerCase()] || null;\n }\n /**\n * Use the %%func%% when fetching URIs using %%scheme%%.\n *\n * This method affects all requests globally.\n *\n * If [[lockConfig]] has been called, no change is made and this\n * throws.\n */\n static registerGateway(scheme, func) {\n scheme = scheme.toLowerCase();\n if (scheme === \"http\" || scheme === \"https\") {\n throw new Error(`cannot intercept ${scheme}; use registerGetUrl`);\n }\n if (locked) {\n throw new Error(\"gateways locked\");\n }\n Gateways[scheme] = func;\n }\n /**\n * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests.\n *\n * This method affects all requests globally.\n *\n * If [[lockConfig]] has been called, no change is made and this\n * throws.\n */\n static registerGetUrl(getUrl) {\n if (locked) {\n throw new Error(\"gateways locked\");\n }\n getUrlFunc = getUrl;\n }\n /**\n * Creates a function that can \"fetch\" data URIs.\n *\n * Note that this is automatically done internally to support\n * data URIs, so it is not necessary to register it.\n *\n * This is not generally something that is needed, but may\n * be useful in a wrapper to perfom custom data URI functionality.\n */\n static createDataGateway() {\n return dataGatewayFunc;\n }\n /**\n * Creates a function that will fetch IPFS (unvalidated) from\n * a custom gateway baseUrl.\n *\n * The default IPFS gateway used internally is\n * ``\"https:/\\/gateway.ipfs.io/ipfs/\"``.\n */\n static createIpfsGatewayFunc(baseUrl) {\n return getIpfsGatewayFunc(baseUrl);\n }\n}\n/**\n * The response for a FetchREquest.\n */\nexport class FetchResponse {\n #statusCode;\n #statusMessage;\n #headers;\n #body;\n #request;\n #error;\n toString() {\n return ``;\n }\n /**\n * The response status code.\n */\n get statusCode() {\n return this.#statusCode;\n }\n /**\n * The response status message.\n */\n get statusMessage() {\n return this.#statusMessage;\n }\n /**\n * The response headers. All keys are lower-case.\n */\n get headers() {\n return Object.assign({}, this.#headers);\n }\n /**\n * The response body, or ``null`` if there was no body.\n */\n get body() {\n return this.#body == null ? null : new Uint8Array(this.#body);\n }\n /**\n * The response body as a UTF-8 encoded string, or the empty\n * string (i.e. ``\"\"``) if there was no body.\n *\n * An error is thrown if the body is invalid UTF-8 data.\n */\n get bodyText() {\n try {\n return this.#body == null ? \"\" : toUtf8String(this.#body);\n }\n catch (error) {\n assert(false, \"response body is not valid UTF-8 data\", \"UNSUPPORTED_OPERATION\", {\n operation: \"bodyText\",\n info: { response: this },\n });\n }\n }\n /**\n * The response body, decoded as JSON.\n *\n * An error is thrown if the body is invalid JSON-encoded data\n * or if there was no body.\n */\n get bodyJson() {\n try {\n return JSON.parse(this.bodyText);\n }\n catch (error) {\n assert(false, \"response body is not valid JSON\", \"UNSUPPORTED_OPERATION\", {\n operation: \"bodyJson\",\n info: { response: this },\n });\n }\n }\n [Symbol.iterator]() {\n const headers = this.headers;\n const keys = Object.keys(headers);\n let index = 0;\n return {\n next: () => {\n if (index < keys.length) {\n const key = keys[index++];\n return {\n value: [key, headers[key]],\n done: false,\n };\n }\n return { value: undefined, done: true };\n },\n };\n }\n constructor(statusCode, statusMessage, headers, body, request) {\n this.#statusCode = statusCode;\n this.#statusMessage = statusMessage;\n this.#headers = Object.keys(headers).reduce((accum, k) => {\n accum[k.toLowerCase()] = String(headers[k]);\n return accum;\n }, {});\n this.#body = body == null ? null : new Uint8Array(body);\n this.#request = request || null;\n this.#error = { message: \"\" };\n }\n /**\n * Return a Response with matching headers and body, but with\n * an error status code (i.e. 599) and %%message%% with an\n * optional %%error%%.\n */\n makeServerError(message, error) {\n let statusMessage;\n if (!message) {\n message = `${this.statusCode} ${this.statusMessage}`;\n statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`;\n }\n else {\n statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`;\n }\n const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined);\n response.#error = { message, error };\n return response;\n }\n /**\n * If called within a [request.processFunc](FetchRequest-processFunc)\n * call, causes the request to retry as if throttled for %%stall%%\n * milliseconds.\n */\n throwThrottleError(message, stall) {\n if (stall == null) {\n stall = -1;\n }\n else {\n assertArgument(Number.isInteger(stall) && stall >= 0, \"invalid stall timeout\", \"stall\", stall);\n }\n const error = new Error(message || \"throttling requests\");\n defineProperties(error, { stall, throttle: true });\n throw error;\n }\n /**\n * Get the header value for %%key%%, ignoring case.\n */\n getHeader(key) {\n return this.headers[key.toLowerCase()];\n }\n /**\n * Returns true of the response has a body.\n */\n hasBody() {\n return this.#body != null;\n }\n /**\n * The request made for this response.\n */\n get request() {\n return this.#request;\n }\n /**\n * Returns true if this response was a success statusCode.\n */\n ok() {\n return (this.#error.message === \"\" &&\n this.statusCode >= 200 &&\n this.statusCode < 300);\n }\n /**\n * Throws a ``SERVER_ERROR`` if this response is not ok.\n */\n assertOk() {\n if (this.ok()) {\n return;\n }\n let { message, error } = this.#error;\n if (message === \"\") {\n message = `server response ${this.statusCode} ${this.statusMessage}`;\n }\n assert(false, message, \"SERVER_ERROR\", {\n request: this.request || \"unknown request\",\n response: this,\n error,\n });\n }\n}\nfunction getTime() {\n return new Date().getTime();\n}\nfunction unpercent(value) {\n return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => {\n return String.fromCharCode(parseInt(code, 16));\n }));\n}\nfunction wait(delay) {\n return new Promise((resolve) => setTimeout(resolve, delay));\n}\n//# sourceMappingURL=fetch.js.map","var _a;\n/**\n * About fixed-point math...\n *\n * @_section: api/utils/fixed-point-math:Fixed-Point Maths [about-fixed-point-math]\n */\nimport { getBytes } from \"./data.js\";\nimport { assert, assertArgument, assertPrivate } from \"./errors.js\";\nimport { getBigInt, fromTwos, mask, toBigInt } from \"./maths.js\";\nimport { defineProperties } from \"./properties.js\";\nconst BN_N1 = BigInt(-1);\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_5 = BigInt(5);\nconst _guard = {};\n// Constant to pull zeros from for multipliers\nlet Zeros = \"0000\";\nwhile (Zeros.length < 80) {\n Zeros += Zeros;\n}\n// Returns a string \"1\" followed by decimal \"0\"s\nfunction getTens(decimals) {\n let result = Zeros;\n while (result.length < decimals) {\n result += result;\n }\n return BigInt(\"1\" + result.substring(0, decimals));\n}\nfunction checkValue(val, format, safeOp) {\n const width = BigInt(format.width);\n if (format.signed) {\n const limit = BN_1 << (width - BN_1);\n assert(safeOp == null || (val >= -limit && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp,\n fault: \"overflow\",\n value: val,\n });\n if (val > BN_0) {\n val = fromTwos(mask(val, width), width);\n }\n else {\n val = -fromTwos(mask(-val, width), width);\n }\n }\n else {\n const limit = BN_1 << width;\n assert(safeOp == null || (val >= 0 && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp,\n fault: \"overflow\",\n value: val,\n });\n val = ((val % limit) + limit) % limit & (limit - BN_1);\n }\n return val;\n}\nfunction getFormat(value) {\n if (typeof value === \"number\") {\n value = `fixed128x${value}`;\n }\n let signed = true;\n let width = 128;\n let decimals = 18;\n if (typeof value === \"string\") {\n // Parse the format string\n if (value === \"fixed\") {\n // defaults...\n }\n else if (value === \"ufixed\") {\n signed = false;\n }\n else {\n const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);\n assertArgument(match, \"invalid fixed format\", \"format\", value);\n signed = match[1] !== \"u\";\n width = parseInt(match[2]);\n decimals = parseInt(match[3]);\n }\n }\n else if (value) {\n // Extract the values from the object\n const v = value;\n const check = (key, type, defaultValue) => {\n if (v[key] == null) {\n return defaultValue;\n }\n assertArgument(typeof v[key] === type, \"invalid fixed format (\" + key + \" not \" + type + \")\", \"format.\" + key, v[key]);\n return v[key];\n };\n signed = check(\"signed\", \"boolean\", signed);\n width = check(\"width\", \"number\", width);\n decimals = check(\"decimals\", \"number\", decimals);\n }\n assertArgument(width % 8 === 0, \"invalid FixedNumber width (not byte aligned)\", \"format.width\", width);\n assertArgument(decimals <= 80, \"invalid FixedNumber decimals (too large)\", \"format.decimals\", decimals);\n const name = (signed ? \"\" : \"u\") + \"fixed\" + String(width) + \"x\" + String(decimals);\n return { signed, width, decimals, name };\n}\nfunction toString(val, decimals) {\n let negative = \"\";\n if (val < BN_0) {\n negative = \"-\";\n val *= BN_N1;\n }\n let str = val.toString();\n // No decimal point for whole values\n if (decimals === 0) {\n return negative + str;\n }\n // Pad out to the whole component (including a whole digit)\n while (str.length <= decimals) {\n str = Zeros + str;\n }\n // Insert the decimal point\n const index = str.length - decimals;\n str = str.substring(0, index) + \".\" + str.substring(index);\n // Trim the whole component (leaving at least one 0)\n while (str[0] === \"0\" && str[1] !== \".\") {\n str = str.substring(1);\n }\n // Trim the decimal component (leaving at least one 0)\n while (str[str.length - 1] === \"0\" && str[str.length - 2] !== \".\") {\n str = str.substring(0, str.length - 1);\n }\n return negative + str;\n}\n/**\n * A FixedNumber represents a value over its [[FixedFormat]]\n * arithmetic field.\n *\n * A FixedNumber can be used to perform math, losslessly, on\n * values which have decmial places.\n *\n * A FixedNumber has a fixed bit-width to store values in, and stores all\n * values internally by multiplying the value by 10 raised to the power of\n * %%decimals%%.\n *\n * If operations are performed that cause a value to grow too high (close to\n * positive infinity) or too low (close to negative infinity), the value\n * is said to //overflow//.\n *\n * For example, an 8-bit signed value, with 0 decimals may only be within\n * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become\n * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``.\n *\n * Many operation have a normal and //unsafe// variant. The normal variant\n * will throw a [[NumericFaultError]] on any overflow, while the //unsafe//\n * variant will silently allow overflow, corrupting its value value.\n *\n * If operations are performed that cause a value to become too small\n * (close to zero), the value loses precison and is said to //underflow//.\n *\n * For example, an value with 1 decimal place may store a number as small\n * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit\n * into 1 decimal place, so underflow occurs which means precision is lost\n * and the value becomes ``0``.\n *\n * Some operations have a normal and //signalling// variant. The normal\n * variant will silently ignore underflow, while the //signalling// variant\n * will thow a [[NumericFaultError]] on underflow.\n */\nexport class FixedNumber {\n /**\n * The specific fixed-point arithmetic field for this value.\n */\n format;\n #format;\n // The actual value (accounting for decimals)\n #val;\n // A base-10 value to multiple values by to maintain the magnitude\n #tens;\n /**\n * This is a property so console.log shows a human-meaningful value.\n *\n * @private\n */\n _value;\n // Use this when changing this file to get some typing info,\n // but then switch to any to mask the internal type\n //constructor(guard: any, value: bigint, format: _FixedFormat) {\n /**\n * @private\n */\n constructor(guard, value, format) {\n assertPrivate(guard, _guard, \"FixedNumber\");\n this.#val = value;\n this.#format = format;\n const _value = toString(value, format.decimals);\n defineProperties(this, { format: format.name, _value });\n this.#tens = getTens(format.decimals);\n }\n /**\n * If true, negative values are permitted, otherwise only\n * positive values and zero are allowed.\n */\n get signed() {\n return this.#format.signed;\n }\n /**\n * The number of bits available to store the value.\n */\n get width() {\n return this.#format.width;\n }\n /**\n * The number of decimal places in the fixed-point arithment field.\n */\n get decimals() {\n return this.#format.decimals;\n }\n /**\n * The value as an integer, based on the smallest unit the\n * [[decimals]] allow.\n */\n get value() {\n return this.#val;\n }\n #checkFormat(other) {\n assertArgument(this.format === other.format, \"incompatible format; use fixedNumber.toFormat\", \"other\", other);\n }\n #checkValue(val, safeOp) {\n /*\n const width = BigInt(this.width);\n if (this.signed) {\n const limit = (BN_1 << (width - BN_1));\n assert(safeOp == null || (val >= -limit && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n \n if (val > BN_0) {\n val = fromTwos(mask(val, width), width);\n } else {\n val = -fromTwos(mask(-val, width), width);\n }\n \n } else {\n const masked = mask(val, width);\n assert(safeOp == null || (val >= 0 && val === masked), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n val = masked;\n }\n */\n val = checkValue(val, this.#format, safeOp);\n return new _a(_guard, val, this.#format);\n }\n #add(o, safeOp) {\n this.#checkFormat(o);\n return this.#checkValue(this.#val + o.#val, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% added\n * to %%other%%, ignoring overflow.\n */\n addUnsafe(other) {\n return this.#add(other);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% added\n * to %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n add(other) {\n return this.#add(other, \"add\");\n }\n #sub(o, safeOp) {\n this.#checkFormat(o);\n return this.#checkValue(this.#val - o.#val, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%other%% subtracted\n * from %%this%%, ignoring overflow.\n */\n subUnsafe(other) {\n return this.#sub(other);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%other%% subtracted\n * from %%this%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n sub(other) {\n return this.#sub(other, \"sub\");\n }\n #mul(o, safeOp) {\n this.#checkFormat(o);\n return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%, ignoring overflow and underflow (precision loss).\n */\n mulUnsafe(other) {\n return this.#mul(other);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n mul(other) {\n return this.#mul(other, \"mul\");\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs or if underflow (precision loss) occurs.\n */\n mulSignal(other) {\n this.#checkFormat(other);\n const value = this.#val * other.#val;\n assert(value % this.#tens === BN_0, \"precision lost during signalling mul\", \"NUMERIC_FAULT\", {\n operation: \"mulSignal\",\n fault: \"underflow\",\n value: this,\n });\n return this.#checkValue(value / this.#tens, \"mulSignal\");\n }\n #div(o, safeOp) {\n assert(o.#val !== BN_0, \"division by zero\", \"NUMERIC_FAULT\", {\n operation: \"div\",\n fault: \"divide-by-zero\",\n value: this,\n });\n this.#checkFormat(o);\n return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%, ignoring underflow (precision loss). A\n * [[NumericFaultError]] is thrown if overflow occurs.\n */\n divUnsafe(other) {\n return this.#div(other);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%, ignoring underflow (precision loss). A\n * [[NumericFaultError]] is thrown if overflow occurs.\n */\n div(other) {\n return this.#div(other, \"div\");\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%. A [[NumericFaultError]] is thrown if underflow\n * (precision loss) occurs.\n */\n divSignal(other) {\n assert(other.#val !== BN_0, \"division by zero\", \"NUMERIC_FAULT\", {\n operation: \"div\",\n fault: \"divide-by-zero\",\n value: this,\n });\n this.#checkFormat(other);\n const value = this.#val * this.#tens;\n assert(value % other.#val === BN_0, \"precision lost during signalling div\", \"NUMERIC_FAULT\", {\n operation: \"divSignal\",\n fault: \"underflow\",\n value: this,\n });\n return this.#checkValue(value / other.#val, \"divSignal\");\n }\n /**\n * Returns a comparison result between %%this%% and %%other%%.\n *\n * This is suitable for use in sorting, where ``-1`` implies %%this%%\n * is smaller, ``1`` implies %%other%% is larger and ``0`` implies\n * both are equal.\n */\n cmp(other) {\n let a = this.value, b = other.value;\n // Coerce a and b to the same magnitude\n const delta = this.decimals - other.decimals;\n if (delta > 0) {\n b *= getTens(delta);\n }\n else if (delta < 0) {\n a *= getTens(-delta);\n }\n // Comnpare\n if (a < b) {\n return -1;\n }\n if (a > b) {\n return -1;\n }\n return 0;\n }\n /**\n * Returns true if %%other%% is equal to %%this%%.\n */\n eq(other) {\n return this.cmp(other) === 0;\n }\n /**\n * Returns true if %%other%% is less than to %%this%%.\n */\n lt(other) {\n return this.cmp(other) < 0;\n }\n /**\n * Returns true if %%other%% is less than or equal to %%this%%.\n */\n lte(other) {\n return this.cmp(other) <= 0;\n }\n /**\n * Returns true if %%other%% is greater than to %%this%%.\n */\n gt(other) {\n return this.cmp(other) > 0;\n }\n /**\n * Returns true if %%other%% is greater than or equal to %%this%%.\n */\n gte(other) {\n return this.cmp(other) >= 0;\n }\n /**\n * Returns a new [[FixedNumber]] which is the largest **integer**\n * that is less than or equal to %%this%%.\n *\n * The decimal component of the result will always be ``0``.\n */\n floor() {\n let val = this.#val;\n if (this.#val < BN_0) {\n val -= this.#tens - BN_1;\n }\n val = (this.#val / this.#tens) * this.#tens;\n return this.#checkValue(val, \"floor\");\n }\n /**\n * Returns a new [[FixedNumber]] which is the smallest **integer**\n * that is greater than or equal to %%this%%.\n *\n * The decimal component of the result will always be ``0``.\n */\n ceiling() {\n let val = this.#val;\n if (this.#val > BN_0) {\n val += this.#tens - BN_1;\n }\n val = (this.#val / this.#tens) * this.#tens;\n return this.#checkValue(val, \"ceiling\");\n }\n /**\n * Returns a new [[FixedNumber]] with the decimal component\n * rounded up on ties at %%decimals%% places.\n */\n round(decimals) {\n if (decimals == null) {\n decimals = 0;\n }\n // Not enough precision to not already be rounded\n if (decimals >= this.decimals) {\n return this;\n }\n const delta = this.decimals - decimals;\n const bump = BN_5 * getTens(delta - 1);\n let value = this.value + bump;\n const tens = getTens(delta);\n value = (value / tens) * tens;\n checkValue(value, this.#format, \"round\");\n return new _a(_guard, value, this.#format);\n }\n /**\n * Returns true if %%this%% is equal to ``0``.\n */\n isZero() {\n return this.#val === BN_0;\n }\n /**\n * Returns true if %%this%% is less than ``0``.\n */\n isNegative() {\n return this.#val < BN_0;\n }\n /**\n * Returns the string representation of %%this%%.\n */\n toString() {\n return this._value;\n }\n /**\n * Returns a float approximation.\n *\n * Due to IEEE 754 precission (or lack thereof), this function\n * can only return an approximation and most values will contain\n * rounding errors.\n */\n toUnsafeFloat() {\n return parseFloat(this.toString());\n }\n /**\n * Return a new [[FixedNumber]] with the same value but has had\n * its field set to %%format%%.\n *\n * This will throw if the value cannot fit into %%format%%.\n */\n toFormat(format) {\n return _a.fromString(this.toString(), format);\n }\n /**\n * Creates a new [[FixedNumber]] for %%value%% divided by\n * %%decimal%% places with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% (once adjusted\n * for %%decimals%%) cannot fit in %%format%%, either due to overflow\n * or underflow (precision loss).\n */\n static fromValue(_value, decimals, _format) {\n if (decimals == null) {\n decimals = 0;\n }\n const format = getFormat(_format);\n let value = getBigInt(_value, \"value\");\n const delta = decimals - format.decimals;\n if (delta > 0) {\n const tens = getTens(delta);\n assert(value % tens === BN_0, \"value loses precision for format\", \"NUMERIC_FAULT\", {\n operation: \"fromValue\",\n fault: \"underflow\",\n value: _value,\n });\n value /= tens;\n }\n else if (delta < 0) {\n value *= getTens(-delta);\n }\n checkValue(value, format, \"fromValue\");\n return new _a(_guard, value, format);\n }\n /**\n * Creates a new [[FixedNumber]] for %%value%% with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% cannot fit\n * in %%format%%, either due to overflow or underflow (precision loss).\n */\n static fromString(_value, _format) {\n const match = _value.match(/^(-?)([0-9]*)\\.?([0-9]*)$/);\n assertArgument(match && match[2].length + match[3].length > 0, \"invalid FixedNumber string value\", \"value\", _value);\n const format = getFormat(_format);\n let whole = match[2] || \"0\", decimal = match[3] || \"\";\n // Pad out the decimals\n while (decimal.length < format.decimals) {\n decimal += Zeros;\n }\n // Check precision is safe\n assert(decimal.substring(format.decimals).match(/^0*$/), \"too many decimals for format\", \"NUMERIC_FAULT\", {\n operation: \"fromString\",\n fault: \"underflow\",\n value: _value,\n });\n // Remove extra padding\n decimal = decimal.substring(0, format.decimals);\n const value = BigInt(match[1] + whole + decimal);\n checkValue(value, format, \"fromString\");\n return new _a(_guard, value, format);\n }\n /**\n * Creates a new [[FixedNumber]] with the big-endian representation\n * %%value%% with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% cannot fit\n * in %%format%% due to overflow.\n */\n static fromBytes(_value, _format) {\n let value = toBigInt(getBytes(_value, \"value\"));\n const format = getFormat(_format);\n if (format.signed) {\n value = fromTwos(value, format.width);\n }\n checkValue(value, format, \"fromBytes\");\n return new _a(_guard, value, format);\n }\n}\n_a = FixedNumber;\n//const f1 = FixedNumber.fromString(\"12.56\", \"fixed16x2\");\n//const f2 = FixedNumber.fromString(\"0.3\", \"fixed16x2\");\n//console.log(f1.divSignal(f2));\n//const BUMP = FixedNumber.from(\"0.5\");\n//# sourceMappingURL=fixednumber.js.map","import { hexlify } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nimport { getBytes } from \"./data.js\";\nfunction hexlifyByte(value) {\n let result = value.toString(16);\n while (result.length < 2) {\n result = \"0\" + result;\n }\n return \"0x\" + result;\n}\nfunction unarrayifyInteger(data, offset, length) {\n let result = 0;\n for (let i = 0; i < length; i++) {\n result = result * 256 + data[offset + i];\n }\n return result;\n}\nfunction _decodeChildren(data, offset, childOffset, length) {\n const result = [];\n while (childOffset < offset + 1 + length) {\n const decoded = _decode(data, childOffset);\n result.push(decoded.result);\n childOffset += decoded.consumed;\n assert(childOffset <= offset + 1 + length, \"child data too short\", \"BUFFER_OVERRUN\", {\n buffer: data,\n length,\n offset,\n });\n }\n return { consumed: 1 + length, result: result };\n}\n// returns { consumed: number, result: Object }\nfunction _decode(data, offset) {\n assert(data.length !== 0, \"data too short\", \"BUFFER_OVERRUN\", {\n buffer: data,\n length: 0,\n offset: 1,\n });\n const checkOffset = (offset) => {\n assert(offset <= data.length, \"data short segment too short\", \"BUFFER_OVERRUN\", {\n buffer: data,\n length: data.length,\n offset,\n });\n };\n // Array with extra length prefix\n if (data[offset] >= 0xf8) {\n const lengthLength = data[offset] - 0xf7;\n checkOffset(offset + 1 + lengthLength);\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n checkOffset(offset + 1 + lengthLength + length);\n return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);\n }\n else if (data[offset] >= 0xc0) {\n const length = data[offset] - 0xc0;\n checkOffset(offset + 1 + length);\n return _decodeChildren(data, offset, offset + 1, length);\n }\n else if (data[offset] >= 0xb8) {\n const lengthLength = data[offset] - 0xb7;\n checkOffset(offset + 1 + lengthLength);\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n checkOffset(offset + 1 + lengthLength + length);\n const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length));\n return { consumed: 1 + lengthLength + length, result: result };\n }\n else if (data[offset] >= 0x80) {\n const length = data[offset] - 0x80;\n checkOffset(offset + 1 + length);\n const result = hexlify(data.slice(offset + 1, offset + 1 + length));\n return { consumed: 1 + length, result: result };\n }\n return { consumed: 1, result: hexlifyByte(data[offset]) };\n}\n/**\n * Decodes %%data%% into the structured data it represents.\n */\nexport function decodeRlp(_data) {\n const data = getBytes(_data, \"data\");\n const decoded = _decode(data, 0);\n assertArgument(decoded.consumed === data.length, \"unexpected junk after rlp payload\", \"data\", _data);\n return decoded.result;\n}\n//# sourceMappingURL=rlp-decode.js.map","import { getBytes } from \"./data.js\";\nfunction arrayifyInteger(value) {\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\nfunction _encode(object) {\n if (Array.isArray(object)) {\n let payload = [];\n object.forEach(function (child) {\n payload = payload.concat(_encode(child));\n });\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length);\n return payload;\n }\n const length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n return length.concat(payload);\n }\n const data = Array.prototype.slice.call(getBytes(object, \"object\"));\n if (data.length === 1 && data[0] <= 0x7f) {\n return data;\n }\n else if (data.length <= 55) {\n data.unshift(0x80 + data.length);\n return data;\n }\n const length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n return length.concat(data);\n}\nconst nibbles = \"0123456789abcdef\";\n/**\n * Encodes %%object%% as an RLP-encoded [[DataHexString]].\n */\nexport function encodeRlp(object) {\n let result = \"0x\";\n for (const v of _encode(object)) {\n result += nibbles[v >> 4];\n result += nibbles[v & 0xf];\n }\n return result;\n}\n//# sourceMappingURL=rlp-encode.js.map","/**\n * Most interactions with Core requires integer values, which use\n * the smallest magnitude unit.\n *\n * For example, imagine dealing with dollars and cents. Since dollars\n * are divisible, non-integer values are possible, such as ``$10.77``.\n * By using the smallest indivisible unit (i.e. cents), the value can\n * be kept as the integer ``1077``.\n *\n * When receiving decimal input from the user (as a decimal string),\n * the value should be converted to an integer and when showing a user\n * a value, the integer value should be converted to a decimal string.\n *\n * This creates a clear distinction, between values to be used by code\n * (integers) and values used for display logic to users (decimals).\n *\n * The native unit in Core, //Core// is divisible to 18 decimal places,\n * where each individual unit is called a //ore//.\n *\n * @_subsection api/utils:Unit Conversion [about-units]\n */\nimport { assertArgument } from \"./errors.js\";\nimport { FixedNumber } from \"./fixednumber.js\";\nimport { getNumber } from \"./maths.js\";\nconst names = [\n ///Ore, the smallest and atomic amount of Core\n \"ore\",\n ///fecore, 1000 ore\n \"fecore\",\n ///Picore, one million ore\n \"picore\",\n ///Nacore, one billion ore. Typically a reasonable unit to measure energy prices.\n \"nacore\",\n ///Μcore, 10^12 ore or 1 μCore\n \"mcore\",\n ///micore, 10^15 ore or 1 mcore\n \"micore\",\n \"core\",\n];\n/**\n * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal\n * places. The %%unit%% may be the number of decimal places or the name of\n * a unit\n *\n */\nexport function formatUnits(value, unit) {\n let decimals = 18;\n if (typeof unit === \"string\") {\n const index = names.indexOf(unit);\n assertArgument(index >= 0, \"invalid unit\", \"unit\", unit);\n decimals = 3 * index;\n }\n else if (unit != null) {\n decimals = getNumber(unit, \"unit\");\n }\n return FixedNumber.fromValue(value, decimals, { decimals }).toString();\n}\n/**\n * Converts the //decimal string// %%value%% to a BigInt, assuming\n * %%unit%% decimal places. The %%unit%% may the number of decimal places\n * or the name of a unit.\n */\nexport const scientificToDecimal = (num) => {\n // @ts-ignore\n var nsign = Math.sign(num);\n //remove the sign\n // @ts-ignore\n num = Math.abs(num);\n //if the number is in scientific notation remove it\n // @ts-ignore\n if (/\\d+\\.?\\d*e[\\+\\-]*\\d+/i.test(num)) {\n var zero = \"0\", \n // @ts-ignore\n parts = String(num).toLowerCase().split(\"e\"), //split into coeff and exponent\n e = parts.pop(), //store the exponential part\n // @ts-ignore\n l = Math.abs(e), //get the number of zeros\n // @ts-ignore\n sign = e / l, coeff_array = parts[0].split(\".\");\n if (sign === -1) {\n l = l - coeff_array[0].length;\n if (l < 0) {\n // @ts-ignore\n num =\n coeff_array[0].slice(0, l) +\n \".\" +\n coeff_array[0].slice(l) +\n (coeff_array.length === 2 ? coeff_array[1] : \"\");\n }\n else {\n // @ts-ignore\n num = zero + \".\" + new Array(l + 1).join(zero) + coeff_array.join(\"\");\n }\n }\n else {\n var dec = coeff_array[1];\n if (dec)\n l = l - dec.length;\n if (l < 0) {\n // @ts-ignore\n num = coeff_array[0] + dec.slice(0, l) + \".\" + dec.slice(l);\n }\n else {\n // @ts-ignore\n num = coeff_array.join(\"\") + new Array(l + 1).join(zero);\n }\n }\n }\n // @ts-ignore\n return nsign < 0 ? \"-\" + num : num;\n};\nexport const trimDecimals = (n, decimals = 18) => {\n n += \"\";\n if (n.indexOf(\".\") === -1)\n return n;\n const arr = n.split(\".\");\n const fraction = arr[1].substr(0, decimals);\n return arr[0] + \".\" + fraction;\n};\nexport function parseUnits(value, unit) {\n assertArgument(typeof value === \"string\", \"value must be a string\", \"value\", value);\n if (value.includes(\"e\")) {\n value = scientificToDecimal(value).toString();\n }\n let decimals = 18;\n if (typeof unit === \"string\") {\n const index = names.indexOf(unit);\n assertArgument(index >= 0, \"invalid unit\", \"unit\", unit);\n decimals = 3 * index;\n value = trimDecimals(value, decimals);\n }\n else if (unit != null) {\n decimals = getNumber(unit, \"unit\");\n value = trimDecimals(value, decimals);\n }\n return FixedNumber.fromString(value, { decimals }).value;\n}\n/**\n * Converts %%value%% into a //decimal string// using 18 decimal places.\n */\nexport function formatXCB(ore) {\n return formatUnits(ore, 18);\n}\n/**\n * Converts the //decimal string// %%xcb%% to a BigInt, using 18\n * decimal places.\n */\nexport function parseXCB(xcb) {\n return parseUnits(xcb, 18);\n}\n//# sourceMappingURL=units.js.map","/**\n * Explain UUID and link to RFC here.\n *\n * @_subsection: api/utils:UUID [about-uuid]\n */\nimport { getBytes, hexlify } from \"./data.js\";\n/**\n * Returns the version 4 [[link-uuid]] for the %%randomBytes%%.\n *\n * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4)\n */\nexport function uuidV4(randomBytes) {\n const bytes = getBytes(randomBytes, \"randomBytes\");\n // Section: 4.1.3:\n // - time_hi_and_version[12:16] = 0b0100\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n // Section 4.4\n // - clock_seq_hi_and_reserved[6] = 0b0\n // - clock_seq_hi_and_reserved[7] = 0b1\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n const value = hexlify(bytes);\n return [\n value.substring(2, 10),\n value.substring(10, 14),\n value.substring(14, 18),\n value.substring(18, 22),\n value.substring(22, 34),\n ].join(\"-\");\n}\n//# sourceMappingURL=uuid.js.map","// @ts-ignore\nimport ed448 from \"./browser-ed448.js\";\n// @ts-ignore\nimport pbkdf2 from \"./pbkdf2-browser.js\";\n// @ts-ignore\nimport SHA3_512 from \"bcrypto/lib/sha3-512.js\";\nexport class Ed448Goldilock {\n static _channel = ed448;\n static generatePrivateKey() {\n var privateKey = ed448.privateKeyGenerate();\n privateKey[56] &= 0x7f;\n return privateKey;\n }\n static getPublicKeyFromPrivateKey(privateKey) {\n var secret = Buffer.from(privateKey, \"hex\");\n if (secret[56] > 127) {\n var scalar = secret.slice(0, 56);\n scalar[0] &= 0xfc;\n scalar[55] |= 0x80;\n var publicKey = this._channel.publicKeyFromScalar(scalar);\n return Buffer.from(publicKey).toString(\"hex\");\n }\n else {\n var publicKey = this._channel.publicKeyCreate(secret);\n return Buffer.from(publicKey).toString(\"hex\");\n }\n }\n static signWithPrivateKey(privateKey, msg) {\n var msgToSign = Buffer.from(msg, \"hex\");\n var secret = Buffer.from(privateKey, \"hex\");\n if (secret[56] > 127) {\n var prefix = secret.slice(0, 57);\n prefix[0] &= 0xfc;\n prefix[56] = 0;\n prefix[55] |= 0x80;\n var scalar = prefix.slice(0, 56);\n var signedMessage = this._channel.signWithScalar(msgToSign, scalar, prefix);\n return Buffer.from(signedMessage).toString(\"hex\");\n }\n else {\n var signedMessage = this._channel.sign(msgToSign, secret);\n return Buffer.from(signedMessage).toString(\"hex\");\n }\n }\n static signWithPrivateKeyNConcatPubkey(privateKey, msg) {\n var signedMessage = Ed448Goldilock.signWithPrivateKey(privateKey, msg);\n var publicKey = Ed448Goldilock.getPublicKeyFromPrivateKey(privateKey);\n return signedMessage + publicKey;\n }\n static verifySignature(msgHash, signedMsg, pubKey) {\n return this._channel.verify(msgHash, signedMsg, pubKey);\n }\n static SHA512Hash(password, salt) {\n var p1 = Buffer.from(password, \"hex\");\n var s1 = Buffer.from(salt, \"hex\");\n return Buffer.from(pbkdf2.derive(SHA3_512, p1, s1, 2048, 57)).toString(\"hex\");\n }\n static concatenateAndHex(prefix, key, index, salt) {\n var ind = Buffer.alloc(4);\n var p = Buffer.alloc(1);\n p[0] = prefix % 256;\n var j = index;\n for (let i = 0; i < 4; i++) {\n ind[i] = j % 256;\n j = Math.floor(j / 256);\n }\n var t = p.toString(\"hex\") + key + ind.toString(\"hex\");\n return Ed448Goldilock.SHA512Hash(t, salt);\n }\n static addScalar(a, b) {\n var a1 = Buffer.from(a, \"hex\");\n var b1 = Buffer.from(b.substr(0, 106) + \"00000000\", \"hex\");\n b1[0] &= 0xfc;\n var c = Buffer.alloc(57);\n var hold = 0;\n for (let i = 0; i < 57; i++) {\n hold += a1[i] + b1[i];\n c[i] = hold % 256;\n hold = Math.floor(hold / 256);\n }\n return c.toString(\"hex\");\n }\n static seedToExtendedPrivate(seed) {\n var s1 = Ed448Goldilock.SHA512Hash(seed, \"6d6e656d6f6e6963666f72746865636861696e\");\n var s2 = Ed448Goldilock.SHA512Hash(seed, \"6d6e656d6f6e6963666f727468656b6579\");\n var b = Buffer.from(s2, \"hex\");\n b[56] |= 0x80;\n b[55] |= 0x80;\n b[55] &= 0xbf;\n var s3 = b.toString(\"hex\");\n return s1 + s3;\n }\n static childPrivateToPrivate(s, index) {\n var s0 = s.substr(0, 114);\n var s1 = s.substr(114, 228);\n var r0, r1;\n if (index >= 0x80000000) {\n r0 = Ed448Goldilock.concatenateAndHex(1, s1, index, s0);\n r1 = Ed448Goldilock.concatenateAndHex(0, s1, index, s0);\n return r0 + Ed448Goldilock.addScalar(s1, r1);\n }\n else {\n var pub = Ed448Goldilock.getPublicKeyFromPrivateKey(s1);\n r0 = Ed448Goldilock.concatenateAndHex(3, pub, index, s0);\n r1 = Ed448Goldilock.concatenateAndHex(2, pub, index, s0);\n return r0 + Ed448Goldilock.addScalar(s1, r1);\n }\n }\n static HDWalletGenerateKeyFromSeed(seed, index) {\n var m = Ed448Goldilock.seedToExtendedPrivate(seed);\n var k1 = Ed448Goldilock.childPrivateToPrivate(m, 0x80000000 + 44);\n var k2 = Ed448Goldilock.childPrivateToPrivate(k1, 0x80000000 + 654);\n var k3 = Ed448Goldilock.childPrivateToPrivate(k2, 0x80000000 + 0);\n var k4 = Ed448Goldilock.childPrivateToPrivate(k3, 0x80000000 + 0);\n var k5 = Ed448Goldilock.childPrivateToPrivate(k4, index);\n return k5.substr(114, 228);\n }\n}\n//# sourceMappingURL=ed448goldilock-browser.js.map","/* Browser Crypto Shims */\nimport { hmac } from \"@noble/hashes/hmac\";\nimport { pbkdf2 } from \"@noble/hashes/pbkdf2\";\nimport { sha256 } from \"@noble/hashes/sha256\";\nimport { sha512 } from \"@noble/hashes/sha512\";\nimport { sha3_256, sha3_512 } from \"@noble/hashes/sha3\";\nimport ed448 from \"./browser-ed448.js\";\nimport { assert, assertArgument } from \"../utils/index.js\";\nexport { ed448 };\nexport { Ed448Goldilock } from \"./ed448goldilock-browser.js\";\nfunction getGlobal() {\n if (typeof self !== \"undefined\") {\n return self;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof global !== \"undefined\") {\n return global;\n }\n throw new Error(\"unable to locate global object\");\n}\nconst anyGlobal = getGlobal();\nconst crypto = anyGlobal.crypto || anyGlobal.msCrypto;\nexport function createHash(algo) {\n switch (algo) {\n case \"sha256\":\n return sha256.create();\n case \"sha512\":\n return sha512.create();\n case \"sha3-256\":\n return sha3_256.create();\n case \"sha3-512\":\n return sha3_512.create();\n }\n assertArgument(false, \"invalid hashing algorithm name\", \"algorithm\", algo);\n}\nexport function createHmac(_algo, key) {\n const algo = { sha256, sha512 }[_algo];\n assertArgument(algo != null, \"invalid hmac algorithm\", \"algorithm\", _algo);\n return hmac.create(algo, key);\n}\nexport function pbkdf2Sync(password, salt, iterations, keylen, _algo) {\n const algo = { sha256, sha512 }[_algo];\n assertArgument(algo != null, \"invalid pbkdf2 algorithm\", \"algorithm\", _algo);\n return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen });\n}\nexport function randomBytes(length) {\n assert(crypto != null, \"platform does not support secure random numbers\", \"UNSUPPORTED_OPERATION\", {\n operation: \"randomBytes\",\n });\n assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, \"invalid length\", \"length\", length);\n const result = new Uint8Array(length);\n crypto.getRandomValues(result);\n return result;\n}\n//# sourceMappingURL=crypto-browser.js.map","import { Logger } from \"../logger/logger.js\";\nimport { arrayify, getBytes, hexlify } from \"../utils/data.js\";\nimport { createHash, createHmac } from \"./crypto.js\";\nimport { Buffer } from \"buffer\";\nconst logger = new Logger(\"sha3/0.0.1\");\nconst _sha256 = function (data) {\n let v = \"0x\" +\n createHash(\"sha3-256\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n return v;\n};\nconst _sha512 = function (data) {\n let v = \"0x\" +\n createHash(\"sha3-512\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n return v;\n};\n// @ts-ignore\nlet __sha256 = _sha256;\n// @ts-ignore\nlet __sha512 = _sha512;\nlet locked256 = false, locked512 = false;\n/**\n * Compute the cryptographic SHA2-256 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * sha256(\"0x\")\n * //_result:\n *\n * sha256(\"0x1337\")\n * //_result:\n *\n * sha256(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n */\nexport var SupportedAlgorithm;\n(function (SupportedAlgorithm) {\n SupportedAlgorithm[\"sha256\"] = \"sha256\";\n SupportedAlgorithm[\"sha512\"] = \"sha512\";\n})(SupportedAlgorithm || (SupportedAlgorithm = {}));\nexport function ripemd160(data) {\n let createdHash = \"0x\" +\n createHash(\"ripemd160\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n const v = \"0x\" + createdHash;\n if (typeof createdHash !== \"string\") {\n createdHash = hexlify(createdHash);\n return createdHash;\n }\n return v;\n}\nexport function sha256(data) {\n let createdHash = createHash(\"sha3-256\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n const v = \"0x\" + createdHash;\n if (typeof createdHash !== \"string\") {\n createdHash = hexlify(createdHash);\n return createdHash;\n }\n return v;\n}\nexport function legacySha256(data) {\n const _data = getBytes(data, \"data\");\n const hexlified = hexlify(createHash(\"sha256\").update(_data).digest());\n return hexlified;\n}\nexport function computeHmac(algorithm, key, data) {\n const d = Buffer.from(arrayify(data));\n const k = Buffer.from(arrayify(key));\n if (algorithm === SupportedAlgorithm.sha256) {\n return \"0x\" + createHmac(\"sha3-256\", k).update(d).digest(\"hex\");\n }\n else if (algorithm === SupportedAlgorithm.sha512) {\n return \"0x\" + createHmac(\"sha3-512\", k).update(d).digest(\"hex\");\n }\n logger.throwError(\"unsupported algorithm - \" + algorithm, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"computeHmac\",\n algorithm: algorithm,\n });\n return \"\";\n}\nsha256._ = _sha256;\nsha256.lock = function () {\n locked256 = true;\n};\nsha256.register = function (func) {\n if (locked256) {\n throw new Error(\"sha256 is locked\");\n }\n __sha256 = func;\n};\nObject.freeze(sha256);\n/**\n * Compute the cryptographic SHA2-512 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * sha512(\"0x\")\n * //_result:\n *\n * sha512(\"0x1337\")\n * //_result:\n *\n * sha512(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n */\nexport function sha512(data) {\n let createdHash = createHash(\"sha3-512\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n const v = \"0x\" + createdHash;\n if (typeof createdHash !== \"string\") {\n createdHash = hexlify(createdHash);\n return createdHash;\n }\n return v;\n}\nsha512._ = _sha512;\nsha512.lock = function () {\n locked512 = true;\n};\nsha512.register = function (func) {\n if (locked512) {\n throw new Error(\"sha512 is locked\");\n }\n __sha512 = func;\n};\nObject.freeze(sha256);\n//# sourceMappingURL=sha3.js.map","/**\n * Addresses are a fundamental part of interacting with Core. They\n * represent the gloabal identity of Externally Owned Accounts (accounts\n * backed by a private key) and contracts.\n *\n * The Core Naming Service (CNS) provides an interconnected ecosystem\n * of contracts, standards and libraries which enable looking up an\n * address for an ENS name.\n *\n * These functions help convert between various formats, validate\n * addresses and safely resolve ENS names.\n *\n * @_section: api/address:Addresses [about-addresses]\n */\nnull;\nimport { BigNumber } from \"../bigNumber/bigNumber.js\";\nimport { encode } from \"../crypto/rlp.js\";\nimport { sha256 } from \"../crypto/sha3.js\";\nimport { Logger } from \"../logger/logger.js\";\nimport { arrayify, getBytes, hexDataSlice, hexlify, stripZeros, } from \"../utils/data.js\";\nconst logger = new Logger(\"address/0.0.1\");\nconst precompiledAddresses = [\n \"0000000000000000000000000000000000000000000000000000000000000000\",\n \"0000000000000000000000000000000000000000000000000000000000000001\",\n \"0000000000000000000000000000000000000000000000000000000000000002\",\n \"0000000000000000000000000000000000000000000000000000000000000003\",\n \"0000000000000000000000000000000000000000000000000000000000000004\",\n \"0000000000000000000000000000000000000000000000000000000000000005\",\n \"0000000000000000000000000000000000000000000000000000000000000006\",\n \"0000000000000000000000000000000000000000000000000000000000000007\",\n \"0000000000000000000000000000000000000000000000000000000000000008\",\n \"0000000000000000000000000000000000000000000000000000000000000009\",\n];\nfunction removeHexPrefix(val) {\n return val.substring(0, 2) === \"0x\" ? val.substring(2) : val;\n}\nfunction calculateCheckSum(_address, _prefix) {\n const address = getBytes(\"0x\" + _address.replace(\"0x\", \"\"));\n const prefix = getBytes(\"0x\" + _prefix.replace(\"0x\", \"\"));\n const tmpConcated = new Uint8Array([...address, ...prefix]);\n const hexedConcat = hexlify(tmpConcated).replace(\"0x\", \"\") + \"00\";\n const mods = Array.from(hexedConcat.toUpperCase(), (c) => {\n const charCode = c.charCodeAt(0);\n return charCode > 64 && charCode < 91\n ? (charCode - 55).toString()\n : (charCode - 48).toString();\n }).join(\"\");\n const bigVal = BigInt(mods);\n const val97 = BigInt(97);\n const val98 = BigInt(98);\n const remainder = bigVal % val97;\n const checkSum = val98 - remainder;\n const result = checkSum > 9 ? checkSum.toString() : \"0\" + checkSum.toString();\n return result;\n}\n// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number\n// Create lookup table\nconst ibanLookup = {};\nfor (let i = 0; i < 10; i++) {\n ibanLookup[String(i)] = String(i);\n}\nfor (let i = 0; i < 26; i++) {\n ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);\n}\n// How many decimal digits can we process? (for 64-bit float, this is 15)\n// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER));\nconst safeDigits = 15;\nfunction ibanChecksum(address) {\n address = address.toUpperCase();\n address = address.substring(4) + address.substring(0, 2) + \"00\";\n let expanded = address\n .split(\"\")\n .map((c) => {\n return ibanLookup[c];\n })\n .join(\"\");\n // Javascript can handle integers safely up to 15 (decimal) digits\n while (expanded.length >= safeDigits) {\n let block = expanded.substring(0, safeDigits);\n expanded = (parseInt(block, 10) % 97) + expanded.substring(block.length);\n }\n let checksum = String(98 - (parseInt(expanded, 10) % 97));\n while (checksum.length < 2) {\n checksum = \"0\" + checksum;\n }\n return checksum;\n}\n/**\n * Returns a normalized and checksumed address for %%address%%.\n * This accepts non-checksum addresses, checksum addresses and\n * [[getIcapAddress]] formats.\n *\n * The checksum in Core uses the capitalization (upper-case\n * vs lower-case) of the characters within an address to encode\n * its checksum, which offers, on average, a checksum of 15-bits.\n *\n * If %%address%% contains both upper-case and lower-case, it is\n * assumed to already be a checksum address and its checksum is\n * validated, and if the address fails its expected checksum an\n * error is thrown.\n *\n * If you wish the checksum of %%address%% to be ignore, it should\n * be converted to lower-case (i.e. ``.toLowercase()``) before\n * being passed in. This should be a very rare situation though,\n * that you wish to bypass the safegaurds in place to protect\n * against an address that has been incorrectly copied from another\n * source.\n *\n * @example:\n * // Adds the checksum (via upper-casing specific letters)\n * getAddress(\"0x8ba1f109551bd432803012645ac136ddd64dba72\")\n * //_result:\n *\n * // Converts ICAP address and adds checksum\n * getAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\");\n * //_result:\n *\n * // Throws an error if an address contains mixed case,\n * // but the checksum fails\n * getAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_error:\n */\nfunction getAddress(address) {\n if (typeof address !== \"string\") {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n if (!address.match(/^(0x)?[0-9a-fA-F]{44}$/)) {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n const raw = removeHexPrefix(address);\n if (precompiledAddresses.includes(raw)) {\n return \"0x\" + raw;\n }\n const prefix = raw.substring(0, 2);\n const val = raw.substring(4);\n const checksum = calculateCheckSum(val, prefix);\n if (checksum !== raw.substring(2, 4)) {\n logger.throwArgumentError(\"bad address checksum\", \"address\", address);\n }\n return \"0x\" + prefix + checksum + val;\n}\n/**\n * The [ICAP Address format](link-icap) format is an early checksum\n * format which attempts to be compatible with the banking\n * industry [IBAN format](link-wiki-iban) for bank accounts.\n *\n * It is no longer common or a recommended format.\n *\n * @example:\n * getIcapAddress(\"0x8ba1f109551bd432803012645ac136ddd64dba72\");\n * //_result:\n *\n * getIcapAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\");\n * //_result:\n *\n * // Throws an error if the ICAP checksum is wrong\n * getIcapAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37\");\n * //_error:\n */\nfunction getIcapAddress(address) {\n //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase();\n let base36 = BigInt(getAddress(address)).toString(36).toUpperCase();\n while (base36.length < 30) {\n base36 = \"0\" + base36;\n }\n return \"XE\" + ibanChecksum(\"XE00\" + base36) + base36;\n}\nfunction networkIdToPrefix(networkId) {\n if (networkId == 1) {\n return \"cb\";\n }\n else if (networkId == 3 || networkId == 4) {\n return \"ab\";\n }\n else if (networkId > 10 || networkId == 0) {\n return \"ce\";\n }\n else {\n logger.throwArgumentError(\"bad networkId\", \"networkId\", networkId);\n return \"\";\n }\n}\nfunction getContractAddress(transaction) {\n let from = null;\n try {\n from = getAddress(transaction.from);\n }\n catch (error) {\n logger.throwArgumentError(\"missing from address\", \"transaction\", transaction);\n }\n const nonce = stripZeros(arrayify(BigNumber.from(transaction.nonce).toHexString()));\n const val = hexDataSlice(sha256(encode([from, nonce])), 12);\n const prefix = from.substring(2, 4);\n const checksum = calculateCheckSum(val, prefix);\n return \"0x\" + prefix + checksum + removeHexPrefix(val);\n}\nexport { getAddress, getIcapAddress, calculateCheckSum, networkIdToPrefix, getContractAddress, };\n//# sourceMappingURL=index.js.map","/**\n * An **HMAC** enables verification that a given key was used\n * to authenticate a payload.\n *\n * See: [[link-wiki-hmac]]\n *\n * @_subsection: api/crypto:HMAC [about-hmac]\n */\nimport { createHmac } from \"./crypto.js\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _computeHmac = function (algorithm, key, data) {\n return createHmac(algorithm, key).update(data).digest();\n};\nlet __computeHmac = _computeHmac;\n/**\n * Return the HMAC for %%data%% using the %%key%% key with the underlying\n * %%algo%% used for compression.\n *\n * @example:\n * key = id(\"some-secret\")\n *\n * // Compute the HMAC\n * computeHmac(\"sha256\", key, \"0x1337\")\n * //_result:\n *\n * // To compute the HMAC of UTF-8 data, the data must be\n * // converted to UTF-8 bytes\n * computeHmac(\"sha256\", key, toUtf8Bytes(\"Hello World\"))\n * //_result:\n *\n */\nexport function computeHmac(algorithm, _key, _data) {\n const key = getBytes(_key, \"key\");\n const data = getBytes(_data, \"data\");\n return hexlify(__computeHmac(algorithm, key, data));\n}\ncomputeHmac._ = _computeHmac;\ncomputeHmac.lock = function () {\n locked = true;\n};\ncomputeHmac.register = function (func) {\n if (locked) {\n throw new Error(\"computeHmac is locked\");\n }\n __computeHmac = func;\n};\nObject.freeze(computeHmac);\n//# sourceMappingURL=hmac.js.map","import { SHA2 } from './_sha2.js';\nimport { wrapConstructor } from './utils.js';\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf\nconst Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);\nconst Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i);\nconst Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);\nlet idxL = [Id];\nlet idxR = [Pi];\nfor (let i = 0; i < 4; i++)\n for (let j of [idxL, idxR])\n j.push(j[i].map((k) => Rho[k]));\nconst shifts = /* @__PURE__ */ [\n [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],\n [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],\n [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],\n [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],\n [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5],\n].map((i) => new Uint8Array(i));\nconst shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst Kl = /* @__PURE__ */ new Uint32Array([\n 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e,\n]);\nconst Kr = /* @__PURE__ */ new Uint32Array([\n 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000,\n]);\n// The rotate left (circular left shift) operation for uint32\nconst rotl = (word, shift) => (word << shift) | (word >>> (32 - shift));\n// It's called f() in spec.\nfunction f(group, x, y, z) {\n if (group === 0)\n return x ^ y ^ z;\n else if (group === 1)\n return (x & y) | (~x & z);\n else if (group === 2)\n return (x | ~y) ^ z;\n else if (group === 3)\n return (x & z) | (y & ~z);\n else\n return x ^ (y | ~z);\n}\n// Temporary buffer, not used to store anything between runs\nconst BUF = /* @__PURE__ */ new Uint32Array(16);\nexport class RIPEMD160 extends SHA2 {\n constructor() {\n super(64, 20, 8, true);\n this.h0 = 0x67452301 | 0;\n this.h1 = 0xefcdab89 | 0;\n this.h2 = 0x98badcfe | 0;\n this.h3 = 0x10325476 | 0;\n this.h4 = 0xc3d2e1f0 | 0;\n }\n get() {\n const { h0, h1, h2, h3, h4 } = this;\n return [h0, h1, h2, h3, h4];\n }\n set(h0, h1, h2, h3, h4) {\n this.h0 = h0 | 0;\n this.h1 = h1 | 0;\n this.h2 = h2 | 0;\n this.h3 = h3 | 0;\n this.h4 = h4 | 0;\n }\n process(view, offset) {\n for (let i = 0; i < 16; i++, offset += 4)\n BUF[i] = view.getUint32(offset, true);\n // prettier-ignore\n let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;\n // Instead of iterating 0 to 80, we split it into 5 groups\n // And use the groups in constants, functions, etc. Much simpler\n for (let group = 0; group < 5; group++) {\n const rGroup = 4 - group;\n const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore\n const rl = idxL[group], rr = idxR[group]; // prettier-ignore\n const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore\n for (let i = 0; i < 16; i++) {\n const tl = (rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0;\n al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore\n }\n // 2 loops are 10% faster\n for (let i = 0; i < 16; i++) {\n const tr = (rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0;\n ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore\n }\n }\n // Add the compressed chunk to the current hash value\n this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0);\n }\n roundClean() {\n BUF.fill(0);\n }\n destroy() {\n this.destroyed = true;\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0);\n }\n}\n/**\n * RIPEMD-160 - a hash function from 1990s.\n * @param message - msg that would be hashed\n */\nexport const ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());\n//# sourceMappingURL=ripemd160.js.map","import { ripemd160 as noble_ripemd160 } from \"@noble/hashes/ripemd160\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _ripemd160 = function (data) {\n return noble_ripemd160(data);\n};\nlet __ripemd160 = _ripemd160;\n/**\n * Compute the cryptographic RIPEMD-160 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * ripemd160(\"0x\")\n * //_result:\n *\n * ripemd160(\"0x1337\")\n * //_result:\n *\n * ripemd160(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n */\nexport function ripemd160(_data) {\n const data = getBytes(_data, \"data\");\n return hexlify(__ripemd160(data));\n}\nripemd160._ = _ripemd160;\nripemd160.lock = function () {\n locked = true;\n};\nripemd160.register = function (func) {\n if (locked) {\n throw new TypeError(\"ripemd160 is locked\");\n }\n __ripemd160 = func;\n};\nObject.freeze(ripemd160);\n//# sourceMappingURL=ripemd160.js.map","/**\n * A **Password-Based Key-Derivation Function** is designed to create\n * a sequence of bytes suitible as a **key** from a human-rememberable\n * password.\n *\n * @_subsection: api/crypto:Passwords [about-pbkdf]\n */\nimport { pbkdf2Sync } from \"./crypto.js\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _pbkdf2 = function (password, salt, iterations, keylen, algo) {\n return pbkdf2Sync(password, salt, iterations, keylen, algo);\n};\nlet __pbkdf2 = _pbkdf2;\n/**\n * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using\n * the %%salt%% and using %%iterations%% of %%algo%%.\n *\n * This PBKDF is outdated and should not be used in new projects, but is\n * required to decrypt older files.\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the PBKDF2\n * pbkdf2(passwordBytes, salt, 1024, 16, \"sha256\")\n * //_result:\n */\nexport function pbkdf2(_password, _salt, iterations, keylen, algo) {\n const password = getBytes(_password, \"password\");\n const salt = getBytes(_salt, \"salt\");\n return hexlify(__pbkdf2(password, salt, iterations, keylen, algo));\n}\npbkdf2._ = _pbkdf2;\npbkdf2.lock = function () {\n locked = true;\n};\npbkdf2.register = function (func) {\n if (locked) {\n throw new Error(\"pbkdf2 is locked\");\n }\n __pbkdf2 = func;\n};\nObject.freeze(pbkdf2);\n//# sourceMappingURL=pbkdf2.js.map","/**\n * A **Cryptographically Secure Random Value** is one that has been\n * generated with additional care take to prevent side-channels\n * from allowing others to detect it and prevent others from through\n * coincidence generate the same values.\n *\n * @_subsection: api/crypto:Random Values [about-crypto-random]\n */\nimport { randomBytes as crypto_random } from \"./crypto.js\";\nlet locked = false;\nconst _randomBytes = function (length) {\n return new Uint8Array(crypto_random(length));\n};\nlet __randomBytes = _randomBytes;\n/**\n * Return %%length%% bytes of cryptographically secure random data.\n *\n * @example:\n * randomBytes(8)\n * //_result:\n */\nexport function randomBytes(length) {\n return __randomBytes(length);\n}\nrandomBytes._ = _randomBytes;\nrandomBytes.lock = function () {\n locked = true;\n};\nrandomBytes.register = function (func) {\n if (locked) {\n throw new Error(\"randomBytes is locked\");\n }\n __randomBytes = func;\n};\nObject.freeze(randomBytes);\n//# sourceMappingURL=random.js.map","import { number as assertNumber } from './_assert.js';\nimport { sha256 } from './sha256.js';\nimport { pbkdf2 } from './pbkdf2.js';\nimport { asyncLoop, checkOpts, u32 } from './utils.js';\n// RFC 7914 Scrypt KDF\n// Left rotate for uint32\nconst rotl = (a, b) => (a << b) | (a >>> (32 - b));\n// The main Scrypt loop: uses Salsa extensively.\n// Six versions of the function were tried, this is the fastest one.\n// prettier-ignore\nfunction XorAndSalsa(prev, pi, input, ii, out, oi) {\n // Based on https://cr.yp.to/salsa20.html\n // Xor blocks\n let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++];\n let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++];\n let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++];\n let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++];\n let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++];\n let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++];\n let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++];\n let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++];\n // Save state to temporary variables (salsa)\n let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15;\n // Main loop (salsa)\n for (let i = 0; i < 8; i += 2) {\n x04 ^= rotl(x00 + x12 | 0, 7);\n x08 ^= rotl(x04 + x00 | 0, 9);\n x12 ^= rotl(x08 + x04 | 0, 13);\n x00 ^= rotl(x12 + x08 | 0, 18);\n x09 ^= rotl(x05 + x01 | 0, 7);\n x13 ^= rotl(x09 + x05 | 0, 9);\n x01 ^= rotl(x13 + x09 | 0, 13);\n x05 ^= rotl(x01 + x13 | 0, 18);\n x14 ^= rotl(x10 + x06 | 0, 7);\n x02 ^= rotl(x14 + x10 | 0, 9);\n x06 ^= rotl(x02 + x14 | 0, 13);\n x10 ^= rotl(x06 + x02 | 0, 18);\n x03 ^= rotl(x15 + x11 | 0, 7);\n x07 ^= rotl(x03 + x15 | 0, 9);\n x11 ^= rotl(x07 + x03 | 0, 13);\n x15 ^= rotl(x11 + x07 | 0, 18);\n x01 ^= rotl(x00 + x03 | 0, 7);\n x02 ^= rotl(x01 + x00 | 0, 9);\n x03 ^= rotl(x02 + x01 | 0, 13);\n x00 ^= rotl(x03 + x02 | 0, 18);\n x06 ^= rotl(x05 + x04 | 0, 7);\n x07 ^= rotl(x06 + x05 | 0, 9);\n x04 ^= rotl(x07 + x06 | 0, 13);\n x05 ^= rotl(x04 + x07 | 0, 18);\n x11 ^= rotl(x10 + x09 | 0, 7);\n x08 ^= rotl(x11 + x10 | 0, 9);\n x09 ^= rotl(x08 + x11 | 0, 13);\n x10 ^= rotl(x09 + x08 | 0, 18);\n x12 ^= rotl(x15 + x14 | 0, 7);\n x13 ^= rotl(x12 + x15 | 0, 9);\n x14 ^= rotl(x13 + x12 | 0, 13);\n x15 ^= rotl(x14 + x13 | 0, 18);\n }\n // Write output (salsa)\n out[oi++] = (y00 + x00) | 0;\n out[oi++] = (y01 + x01) | 0;\n out[oi++] = (y02 + x02) | 0;\n out[oi++] = (y03 + x03) | 0;\n out[oi++] = (y04 + x04) | 0;\n out[oi++] = (y05 + x05) | 0;\n out[oi++] = (y06 + x06) | 0;\n out[oi++] = (y07 + x07) | 0;\n out[oi++] = (y08 + x08) | 0;\n out[oi++] = (y09 + x09) | 0;\n out[oi++] = (y10 + x10) | 0;\n out[oi++] = (y11 + x11) | 0;\n out[oi++] = (y12 + x12) | 0;\n out[oi++] = (y13 + x13) | 0;\n out[oi++] = (y14 + x14) | 0;\n out[oi++] = (y15 + x15) | 0;\n}\nfunction BlockMix(input, ii, out, oi, r) {\n // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks)\n let head = oi + 0;\n let tail = oi + 16 * r;\n for (let i = 0; i < 16; i++)\n out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1]\n for (let i = 0; i < r; i++, head += 16, ii += 16) {\n // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1\n XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1])\n if (i > 0)\n tail += 16; // First iteration overwrites tmp value in tail\n XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i])\n }\n}\n// Common prologue and epilogue for sync/async functions\nfunction scryptInit(password, salt, _opts) {\n // Maxmem - 1GB+1KB by default\n const opts = checkOpts({\n dkLen: 32,\n asyncTick: 10,\n maxmem: 1024 ** 3 + 1024,\n }, _opts);\n const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts;\n assertNumber(N);\n assertNumber(r);\n assertNumber(p);\n assertNumber(dkLen);\n assertNumber(asyncTick);\n assertNumber(maxmem);\n if (onProgress !== undefined && typeof onProgress !== 'function')\n throw new Error('progressCb should be function');\n const blockSize = 128 * r;\n const blockSize32 = blockSize / 4;\n if (N <= 1 || (N & (N - 1)) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) {\n // NOTE: we limit N to be less than 2**32 because of 32 bit variant of Integrify function\n // There is no JS engines that allows alocate more than 4GB per single Uint8Array for now, but can change in future.\n throw new Error('Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32');\n }\n if (p < 0 || p > ((2 ** 32 - 1) * 32) / blockSize) {\n throw new Error('Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)');\n }\n if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) {\n throw new Error('Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32');\n }\n const memUsed = blockSize * (N + p);\n if (memUsed > maxmem) {\n throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`);\n }\n // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor)\n // Since it has only one iteration there is no reason to use async variant\n const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p });\n const B32 = u32(B);\n // Re-used between parallel iterations. Array(iterations) of B\n const V = u32(new Uint8Array(blockSize * N));\n const tmp = u32(new Uint8Array(blockSize));\n let blockMixCb = () => { };\n if (onProgress) {\n const totalBlockMix = 2 * N * p;\n // Invoke callback if progress changes from 10.01 to 10.02\n // Allows to draw smooth progress bar on up to 8K screen\n const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1);\n let blockMixCnt = 0;\n blockMixCb = () => {\n blockMixCnt++;\n if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix))\n onProgress(blockMixCnt / totalBlockMix);\n };\n }\n return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick };\n}\nfunction scryptOutput(password, dkLen, B, V, tmp) {\n const res = pbkdf2(sha256, password, B, { c: 1, dkLen });\n B.fill(0);\n V.fill(0);\n tmp.fill(0);\n return res;\n}\n/**\n * Scrypt KDF from RFC 7914.\n * @param password - pass\n * @param salt - salt\n * @param opts - parameters\n * - `N` is cpu/mem work factor (power of 2 e.g. 2**18)\n * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance\n * - `p` is parallelization factor (1 is common)\n * - `dkLen` is output key length in bytes e.g. 32.\n * - `asyncTick` - (default: 10) max time in ms for which async function can block execution\n * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt\n * - `onProgress` - callback function that would be executed for progress report\n * @returns Derived key\n */\nexport function scrypt(password, salt, opts) {\n const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts);\n for (let pi = 0; pi < p; pi++) {\n const Pi = blockSize32 * pi;\n for (let i = 0; i < blockSize32; i++)\n V[i] = B32[Pi + i]; // V[0] = B[i]\n for (let i = 0, pos = 0; i < N - 1; i++) {\n BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);\n blockMixCb();\n }\n BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element\n blockMixCb();\n for (let i = 0; i < N; i++) {\n // First u32 of the last 64-byte block (u32 is LE)\n const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations\n for (let k = 0; k < blockSize32; k++)\n tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]\n BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])\n blockMixCb();\n }\n }\n return scryptOutput(password, dkLen, B, V, tmp);\n}\n/**\n * Scrypt KDF from RFC 7914.\n */\nexport async function scryptAsync(password, salt, opts) {\n const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts);\n for (let pi = 0; pi < p; pi++) {\n const Pi = blockSize32 * pi;\n for (let i = 0; i < blockSize32; i++)\n V[i] = B32[Pi + i]; // V[0] = B[i]\n let pos = 0;\n await asyncLoop(N - 1, asyncTick, () => {\n BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);\n blockMixCb();\n });\n BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element\n blockMixCb();\n await asyncLoop(N, asyncTick, () => {\n // First u32 of the last 64-byte block (u32 is LE)\n const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations\n for (let k = 0; k < blockSize32; k++)\n tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]\n BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])\n blockMixCb();\n });\n }\n return scryptOutput(password, dkLen, B, V, tmp);\n}\n//# sourceMappingURL=scrypt.js.map","import { scrypt as _nobleSync, scryptAsync as _nobleAsync, } from \"@noble/hashes/scrypt\";\nimport { getBytes, hexlify as H } from \"../utils/index.js\";\nlet lockedSync = false, lockedAsync = false;\nconst _scryptAsync = async function (passwd, salt, N, r, p, dkLen, onProgress) {\n return await _nobleAsync(passwd, salt, { N, r, p, dkLen, onProgress });\n};\nconst _scryptSync = function (passwd, salt, N, r, p, dkLen) {\n return _nobleSync(passwd, salt, { N, r, p, dkLen });\n};\nlet __scryptAsync = _scryptAsync;\nlet __scryptSync = _scryptSync;\n/**\n * The [[link-wiki-scrypt]] uses a memory and cpu hard method of\n * derivation to increase the resource cost to brute-force a password\n * for a given key.\n *\n * This means this algorithm is intentionally slow, and can be tuned to\n * become slower. As computation and memory speed improve over time,\n * increasing the difficulty maintains the cost of an attacker.\n *\n * For example, if a target time of 5 seconds is used, a legitimate user\n * which knows their password requires only 5 seconds to unlock their\n * account. A 6 character password has 68 billion possibilities, which\n * would require an attacker to invest over 10,000 years of CPU time. This\n * is of course a crude example (as password generally aren't random),\n * but demonstrates to value of imposing large costs to decryption.\n *\n * For this reason, if building a UI which involved decrypting or\n * encrypting datsa using scrypt, it is recommended to use a\n * [[ProgressCallback]] (as event short periods can seem lik an eternity\n * if the UI freezes). Including the phrase //\"decrypting\"// in the UI\n * can also help, assuring the user their waiting is for a good reason.\n *\n * @_docloc: api/crypto:Passwords\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the scrypt\n * scrypt(passwordBytes, salt, 1024, 8, 1, 16)\n * //_result:\n */\nexport async function scrypt(_passwd, _salt, N, r, p, dkLen, progress) {\n const passwd = getBytes(_passwd, \"passwd\");\n const salt = getBytes(_salt, \"salt\");\n return H(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress));\n}\nscrypt._ = _scryptAsync;\nscrypt.lock = function () {\n lockedAsync = true;\n};\nscrypt.register = function (func) {\n if (lockedAsync) {\n throw new Error(\"scrypt is locked\");\n }\n __scryptAsync = func;\n};\nObject.freeze(scrypt);\n/**\n * Provides a synchronous variant of [[scrypt]].\n *\n * This will completely lock up and freeze the UI in a browser and will\n * prevent any event loop from progressing. For this reason, it is\n * preferred to use the [async variant](scrypt).\n *\n * @_docloc: api/crypto:Passwords\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the scrypt\n * scryptSync(passwordBytes, salt, 1024, 8, 1, 16)\n * //_result:\n */\nexport function scryptSync(_passwd, _salt, N, r, p, dkLen) {\n const passwd = getBytes(_passwd, \"passwd\");\n const salt = getBytes(_salt, \"salt\");\n return H(__scryptSync(passwd, salt, N, r, p, dkLen));\n}\nscryptSync._ = _scryptSync;\nscryptSync.lock = function () {\n lockedSync = true;\n};\nscryptSync.register = function (func) {\n if (lockedSync) {\n throw new Error(\"scryptSync is locked\");\n }\n __scryptSync = func;\n};\nObject.freeze(scryptSync);\n//# sourceMappingURL=scrypt.js.map","/**\n * Cryptographic hashing functions\n *\n * @_subsection: api/crypto:Hash Functions [about-crypto-hashing]\n */\nimport { keccak_256 } from \"@noble/hashes/sha3\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _keccak256 = function (data) {\n return keccak_256(data);\n};\nlet __keccak256 = _keccak256;\n/**\n * Compute the cryptographic KECCAK256 hash of %%data%%.\n *\n * The %%data%% **must** be a data representation, to compute the\n * hash of UTF-8 data use the [[id]] function.\n *\n * @returns DataHexstring\n * @example:\n * keccak256(\"0x\")\n * //_result:\n *\n * keccak256(\"0x1337\")\n * //_result:\n *\n * keccak256(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n * // Strings are assumed to be DataHexString, otherwise it will\n * // throw. To hash UTF-8 data, see the note above.\n * keccak256(\"Hello World\")\n * //_error:\n */\nexport function keccak256(_data) {\n const data = getBytes(_data, \"data\");\n return hexlify(__keccak256(data));\n}\nkeccak256._ = _keccak256;\nkeccak256.lock = function () {\n locked = true;\n};\nkeccak256.register = function (func) {\n if (locked) {\n throw new TypeError(\"keccak256 is locked\");\n }\n __keccak256 = func;\n};\nObject.freeze(keccak256);\n//# sourceMappingURL=keccak.js.map","/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */\nconst B256 = 2n ** 256n; // secp256k1 is short weierstrass curve\nconst P = B256 - 0x1000003d1n; // curve's field prime\nconst N = B256 - 0x14551231950b75fc4402da1732fc9bebfn; // curve (group) order\nconst Gx = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n; // base point x\nconst Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n; // base point y\nconst CURVE = { p: P, n: N, a: 0n, b: 7n, Gx, Gy }; // exported variables incl. a, b\nconst fLen = 32; // field / group byte length\nconst crv = (x) => mod(mod(x * x) * x + CURVE.b); // x³ + ax + b weierstrass formula; no a\nconst err = (m = '') => { throw new Error(m); }; // error helper, messes-up stack trace\nconst big = (n) => typeof n === 'bigint'; // is big integer\nconst str = (s) => typeof s === 'string'; // is string\nconst fe = (n) => big(n) && 0n < n && n < P; // is field element (invertible)\nconst ge = (n) => big(n) && 0n < n && n < N; // is group element\nconst au8 = (a, l) => // is Uint8Array (of specific length)\n !(a instanceof Uint8Array) || (typeof l === 'number' && l > 0 && a.length !== l) ?\n err('Uint8Array expected') : a;\nconst u8n = (data) => new Uint8Array(data); // creates Uint8Array\nconst toU8 = (a, len) => au8(str(a) ? h2b(a) : u8n(a), len); // norm(hex/u8a) to u8a\nconst mod = (a, b = P) => { let r = a % b; return r >= 0n ? r : b + r; }; // mod division\nconst isPoint = (p) => (p instanceof Point ? p : err('Point expected')); // is 3d point\nlet Gpows = undefined; // precomputes for base point G\nclass Point {\n constructor(px, py, pz) {\n this.px = px;\n this.py = py;\n this.pz = pz;\n } //3d=less inversions\n static fromAffine(p) { return new Point(p.x, p.y, 1n); }\n static fromHex(hex) {\n hex = toU8(hex); // convert hex string to Uint8Array\n let p = undefined;\n const head = hex[0], tail = hex.subarray(1); // first byte is prefix, rest is data\n const x = slcNum(tail, 0, fLen), len = hex.length; // next 32 bytes are x coordinate\n if (len === 33 && [0x02, 0x03].includes(head)) { // compressed points: 33b, start\n if (!fe(x))\n err('Point hex invalid: x not FE'); // with byte 0x02 or 0x03. Check if 0 0n; d = d.double(), n >>= 1n) { // double-and-add ladder\n if (n & 1n)\n p = p.add(d); // if bit is present, add to point\n else if (safe)\n f = f.add(d); // if not, add to fake for timing safety\n }\n return p;\n }\n mulAddQUns(R, u1, u2) {\n return this.mul(u1, false).add(R.mul(u2, false)).ok(); // Unsafe: do NOT use for stuff related\n } // to private keys. Doesn't use Shamir trick\n toAffine() {\n const { px: x, py: y, pz: z } = this; // (x, y, z) ∋ (x=x/z, y=y/z)\n if (this.equals(I))\n return { x: 0n, y: 0n }; // fast-path for zero point\n if (z === 1n)\n return { x, y }; // if z is 1, pass affine coordinates as-is\n const iz = inv(z); // z^-1: invert z\n if (mod(z * iz) !== 1n)\n err('invalid inverse'); // (z * z^-1) must be 1, otherwise bad math\n return { x: mod(x * iz), y: mod(y * iz) }; // x = x*z^-1; y = y*z^-1\n }\n assertValidity() {\n const { x, y } = this.aff(); // convert to 2d xy affine point.\n if (!fe(x) || !fe(y))\n err('Point invalid: x or y'); // x and y must be in range 0 < n < P\n return mod(y * y) === crv(x) ? // y² = x³ + ax + b, must be equal\n this : err('Point invalid: not on curve');\n }\n multiply(n) { return this.mul(n); } // Aliases to compress code\n aff() { return this.toAffine(); }\n ok() { return this.assertValidity(); }\n toHex(isCompressed = true) {\n const { x, y } = this.aff(); // convert to 2d xy affine point\n const head = isCompressed ? ((y & 1n) === 0n ? '02' : '03') : '04'; // 0x02, 0x03, 0x04 prefix\n return head + n2h(x) + (isCompressed ? '' : n2h(y)); // prefix||x and ||y\n }\n toRawBytes(isCompressed = true) {\n return h2b(this.toHex(isCompressed)); // re-use toHex(), convert hex to bytes\n }\n}\nPoint.BASE = new Point(Gx, Gy, 1n); // Generator / base point\nPoint.ZERO = new Point(0n, 1n, 0n); // Identity / zero point\nconst { BASE: G, ZERO: I } = Point; // Generator, identity points\nconst padh = (n, pad) => n.toString(16).padStart(pad, '0');\nconst b2h = (b) => Array.from(b).map(e => padh(e, 2)).join(''); // bytes to hex\nconst h2b = (hex) => {\n const l = hex.length; // error if not string,\n if (!str(hex) || l % 2)\n err('hex invalid 1'); // or has odd length like 3, 5.\n const arr = u8n(l / 2); // create result array\n for (let i = 0; i < arr.length; i++) {\n const j = i * 2;\n const h = hex.slice(j, j + 2); // hexByte. slice is faster than substr\n const b = Number.parseInt(h, 16); // byte, created from string part\n if (Number.isNaN(b) || b < 0)\n err('hex invalid 2'); // byte must be valid 0 <= byte < 256\n arr[i] = b;\n }\n return arr;\n};\nconst b2n = (b) => BigInt('0x' + (b2h(b) || '0')); // bytes to number\nconst slcNum = (b, from, to) => b2n(b.slice(from, to)); // slice bytes num\nconst n2b = (num) => {\n return big(num) && num >= 0n && num < B256 ? h2b(padh(num, 2 * fLen)) : err('bigint expected');\n};\nconst n2h = (num) => b2h(n2b(num)); // number to 32b hex\nconst concatB = (...arrs) => {\n const r = u8n(arrs.reduce((sum, a) => sum + au8(a).length, 0)); // create u8a of summed length\n let pad = 0; // walk through each array,\n arrs.forEach(a => { r.set(a, pad); pad += a.length; }); // ensure they have proper type\n return r;\n};\nconst inv = (num, md = P) => {\n if (num === 0n || md <= 0n)\n err('no inverse n=' + num + ' mod=' + md); // no neg exponent for now\n let a = mod(num, md), b = md, x = 0n, y = 1n, u = 1n, v = 0n;\n while (a !== 0n) { // uses euclidean gcd algorithm\n const q = b / a, r = b % a; // not constant-time\n const m = x - u * q, n = y - v * q;\n b = a, a = r, x = u, y = v, u = m, v = n;\n }\n return b === 1n ? mod(x, md) : err('no inverse'); // b is gcd at this point\n};\nconst sqrt = (n) => {\n let r = 1n; // So, a special, fast case. Paper: \"Square Roots from 1;24,51,10 to Dan Shanks\".\n for (let num = n, e = (P + 1n) / 4n; e > 0n; e >>= 1n) { // powMod: modular exponentiation.\n if (e & 1n)\n r = (r * num) % P; // Uses exponentiation by squaring.\n num = (num * num) % P; // Not constant-time.\n }\n return mod(r * r) === n ? r : err('sqrt invalid'); // check if result is valid\n};\nconst toPriv = (p) => {\n if (!big(p))\n p = b2n(toU8(p, fLen)); // convert to bigint when bytes\n return ge(p) ? p : err('private key out of range'); // check if bigint is in range\n};\nconst moreThanHalfN = (n) => n > (N >> 1n); // if a number is bigger than CURVE.n/2\nfunction getPublicKey(privKey, isCompressed = true) {\n return Point.fromPrivateKey(privKey).toRawBytes(isCompressed); // 33b or 65b output\n}\nclass Signature {\n constructor(r, s, recovery) {\n this.r = r;\n this.s = s;\n this.recovery = recovery;\n this.assertValidity(); // recovery bit is optional when\n } // constructed outside.\n static fromCompact(hex) {\n hex = toU8(hex, 64); // compact repr is (32b r)||(32b s)\n return new Signature(slcNum(hex, 0, fLen), slcNum(hex, fLen, 2 * fLen));\n }\n assertValidity() { return ge(this.r) && ge(this.s) ? this : err(); } // 0 < r or s < CURVE.n\n addRecoveryBit(rec) { return new Signature(this.r, this.s, rec); }\n hasHighS() { return moreThanHalfN(this.s); }\n recoverPublicKey(msgh) {\n const { r, s, recovery: rec } = this; // secg.org/sec1-v2.pdf 4.1.6\n if (![0, 1, 2, 3].includes(rec))\n err('recovery id invalid'); // check recovery id\n const h = bits2int_modN(toU8(msgh, 32)); // Truncate hash\n const radj = rec === 2 || rec === 3 ? r + N : r; // If rec was 2 or 3, q.x is bigger than n\n if (radj >= P)\n err('q.x invalid'); // ensure q.x is still a field element\n const head = (rec & 1) === 0 ? '02' : '03'; // head is 0x02 or 0x03\n const R = Point.fromHex(head + n2h(radj)); // concat head + hex repr of r\n const ir = inv(radj, N); // r^-1\n const u1 = mod(-h * ir, N); // -hr^-1\n const u2 = mod(s * ir, N); // sr^-1\n return G.mulAddQUns(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1)\n }\n toCompactRawBytes() { return h2b(this.toCompactHex()); } // Uint8Array 64b compact repr\n toCompactHex() { return n2h(this.r) + n2h(this.s); } // hex 64b compact repr\n}\nconst bits2int = (bytes) => {\n const delta = bytes.length * 8 - 256; // RFC suggests optional truncating via bits2octets\n const num = b2n(bytes); // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which\n return delta > 0 ? num >> BigInt(delta) : num; // matches bits2int. bits2int can produce res>N.\n};\nconst bits2int_modN = (bytes) => {\n return mod(bits2int(bytes), N); // with 0: BAD for trunc as per RFC vectors\n};\nconst i2o = (num) => n2b(num); // int to octets\nconst cr = () => // We support: 1) browsers 2) node.js 19+ 3) deno, other envs with crypto\n typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;\nlet _hmacSync; // Can be redefined by use in utils; built-ins don't provide it\nconst optS = { lowS: true }; // opts for sign()\nconst optV = { lowS: true }; // standard opts for verify()\nfunction prepSig(msgh, priv, opts = optS) {\n if (['der', 'recovered', 'canonical'].some(k => k in opts)) // Ban legacy options\n err('sign() legacy options not supported');\n let { lowS } = opts; // generates low-s sigs by default\n if (lowS == null)\n lowS = true; // RFC6979 3.2: we skip step A\n const h1i = bits2int_modN(toU8(msgh)); // msg bigint\n const h1o = i2o(h1i); // msg octets\n const d = toPriv(priv); // validate private key, convert to bigint\n const seed = [i2o(d), h1o]; // Step D of RFC6979 3.2\n let ent = opts.extraEntropy; // RFC6979 3.6: additional k' (optional)\n if (ent) { // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k')\n if (ent === true)\n ent = etc.randomBytes(fLen); // if true, use CSPRNG to generate data\n const e = toU8(ent); // convert Hex|Bytes to Bytes\n if (e.length !== fLen)\n err(); // Expected 32 bytes of extra data\n seed.push(e);\n }\n const m = h1i; // convert msg to bigint\n const k2sig = (kBytes) => {\n const k = bits2int(kBytes); // RFC6979 method.\n if (!ge(k))\n return; // Check 0 < k < CURVE.n\n const ik = inv(k, N); // k^-1 mod n, NOT mod P\n const q = G.mul(k).aff(); // q = Gk\n const r = mod(q.x, N); // r = q.x mod n\n if (r === 0n)\n return; // r=0 invalid\n const s = mod(ik * mod(m + mod(d * r, N), N), N); // s = k^-1(m + rd) mod n\n if (s === 0n)\n return; // s=0 invalid\n let normS = s; // normalized S\n let rec = (q.x === r ? 0 : 2) | Number(q.y & 1n); // recovery bit\n if (lowS && moreThanHalfN(s)) { // if lowS was passed, ensure s is always\n normS = mod(-s, N); // in the bottom half of CURVE.n\n rec ^= 1;\n }\n return new Signature(r, normS, rec); // use normS, not s\n };\n return { seed: concatB(...seed), k2sig };\n}\nfunction hmacDrbg(asynchronous) {\n let v = u8n(fLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n let k = u8n(fLen); // Steps B, C of RFC6979 3.2: set hashLen, in our case always same\n let i = 0; // Iterations counter, will throw when over 1000\n const reset = () => { v.fill(1); k.fill(0); i = 0; };\n const _e = 'drbg: tried 1000 values';\n if (asynchronous) { // asynchronous=true\n const h = (...b) => etc.hmacSha256Async(k, v, ...b); // hmac(k)(v, ...values)\n const reseed = async (seed = u8n()) => {\n k = await h(u8n([0x00]), seed); // k = hmac(K || V || 0x00 || seed)\n v = await h(); // v = hmac(K || V)\n if (seed.length === 0)\n return;\n k = await h(u8n([0x01]), seed); // k = hmac(K || V || 0x01 || seed)\n v = await h(); // v = hmac(K || V)\n };\n const gen = async () => {\n if (i++ >= 1000)\n err(_e);\n v = await h(); // v = hmac(K || V)\n return v;\n };\n return async (seed, pred) => {\n reset(); // the returned fn, don't, it's: 1. slower (JIT). 2. unsafe (async race conditions)\n await reseed(seed); // Steps D-G\n let res = undefined; // Step H: grind until k is in [1..n-1]\n while (!(res = pred(await gen())))\n await reseed(); // test predicate until it returns ok\n reset();\n return res;\n };\n }\n else {\n const h = (...b) => {\n const f = _hmacSync;\n if (!f)\n err('etc.hmacSha256Sync not set');\n return f(k, v, ...b); // hmac(k)(v, ...values)\n };\n const reseed = (seed = u8n()) => {\n k = h(u8n([0x00]), seed); // k = hmac(k || v || 0x00 || seed)\n v = h(); // v = hmac(k || v)\n if (seed.length === 0)\n return;\n k = h(u8n([0x01]), seed); // k = hmac(k || v || 0x01 || seed)\n v = h(); // v = hmac(k || v)\n };\n const gen = () => {\n if (i++ >= 1000)\n err(_e);\n v = h(); // v = hmac(k || v)\n return v;\n };\n return (seed, pred) => {\n reset();\n reseed(seed); // Steps D-G\n let res = undefined; // Step H: grind until k is in [1..n-1]\n while (!(res = pred(gen())))\n reseed(); // test predicate until it returns ok\n reset();\n return res;\n };\n }\n}\n// ECDSA signature generation. via secg.org/sec1-v2.pdf 4.1.2 + RFC6979 deterministic k\nasync function signAsync(msgh, priv, opts = optS) {\n const { seed, k2sig } = prepSig(msgh, priv, opts); // Extract arguments for hmac-drbg\n return hmacDrbg(true)(seed, k2sig); // Re-run hmac-drbg until k2sig returns ok\n}\nfunction sign(msgh, priv, opts = optS) {\n const { seed, k2sig } = prepSig(msgh, priv, opts); // Extract arguments for hmac-drbg\n return hmacDrbg(false)(seed, k2sig); // Re-run hmac-drbg until k2sig returns ok\n}\nfunction verify(sig, msgh, pub, opts = optV) {\n let { lowS } = opts; // ECDSA signature verification\n if (lowS == null)\n lowS = true; // Default lowS=true\n if ('strict' in opts)\n err('verify() legacy options not supported'); // legacy param\n let sig_, h, P; // secg.org/sec1-v2.pdf 4.1.4\n const rs = sig && typeof sig === 'object' && 'r' in sig; // Previous ver supported DER sigs. We\n if (!rs && (toU8(sig).length !== 2 * fLen)) // throw error when DER is suspected now.\n err('signature must be 64 bytes');\n try {\n sig_ = rs ? new Signature(sig.r, sig.s).assertValidity() : Signature.fromCompact(sig);\n h = bits2int_modN(toU8(msgh, fLen)); // Truncate hash\n P = pub instanceof Point ? pub.ok() : Point.fromHex(pub); // Validate public key\n }\n catch (e) {\n return false;\n } // Check sig for validity in both cases\n if (!sig_)\n return false;\n const { r, s } = sig_;\n if (lowS && moreThanHalfN(s))\n return false; // lowS bans sig.s >= CURVE.n/2\n let R;\n try {\n const is = inv(s, N); // s^-1\n const u1 = mod(h * is, N); // u1 = hs^-1 mod n\n const u2 = mod(r * is, N); // u2 = rs^-1 mod n\n R = G.mulAddQUns(P, u1, u2).aff(); // R = u1⋅G + u2⋅P\n }\n catch (error) {\n return false;\n }\n if (!R)\n return false; // stop if R is identity / zero point\n const v = mod(R.x, N); // <== The weird ECDSA part. R.x must be in N's field, not P's\n return v === r; // mod(R.x, n) == r\n}\nfunction getSharedSecret(privA, pubB, isCompressed = true) {\n return Point.fromHex(pubB).mul(toPriv(privA)).toRawBytes(isCompressed); // ECDH\n}\nfunction hashToPrivateKey(hash) {\n hash = toU8(hash); // produces private keys with modulo bias\n const minLen = fLen + 8; // being neglible.\n if (hash.length < minLen || hash.length > 1024)\n err('expected proper params');\n const num = mod(b2n(hash), N - 1n) + 1n; // takes at least n+8 bytes\n return n2b(num);\n}\nconst etc = {\n hexToBytes: h2b, bytesToHex: b2h,\n concatBytes: concatB, bytesToNumberBE: b2n, numberToBytesBE: n2b,\n mod, invert: inv,\n hmacSha256Async: async (key, ...msgs) => {\n const crypto = cr(); // HMAC-SHA256 async. No sync built-in!\n if (!crypto)\n return err('etc.hmacSha256Async not set'); // Uses webcrypto: native cryptography.\n const s = crypto.subtle;\n const k = await s.importKey('raw', key, { name: 'HMAC', hash: { name: 'SHA-256' } }, false, ['sign']);\n return u8n(await s.sign('HMAC', k, concatB(...msgs)));\n },\n hmacSha256Sync: _hmacSync,\n hashToPrivateKey,\n randomBytes: (len) => {\n const crypto = cr(); // Can be shimmed in node.js <= 18 to prevent error:\n // import { webcrypto } from 'node:crypto';\n // if (!globalThis.crypto) globalThis.crypto = webcrypto;\n if (!crypto)\n err('crypto.getRandomValues must be defined');\n return crypto.getRandomValues(u8n(len));\n },\n};\nconst utils = {\n normPrivateKeyToScalar: toPriv,\n isValidPrivateKey: (key) => { try {\n return !!toPriv(key);\n }\n catch (e) {\n return false;\n } },\n randomPrivateKey: () => hashToPrivateKey(etc.randomBytes(fLen + 8)),\n precompute(w = 8, p = G) { p.multiply(3n); return p; }, // no-op\n};\nObject.defineProperties(etc, { hmacSha256Sync: {\n configurable: false, get() { return _hmacSync; }, set(f) { if (!_hmacSync)\n _hmacSync = f; },\n } });\nconst W = 8; // Precomputes-related code. W = window size\nconst precompute = () => {\n const points = []; // 10x sign(), 2x verify(). To achieve this,\n const windows = 256 / W + 1; // app needs to spend 40ms+ to calculate\n let p = G, b = p; // a lot of points related to base point G.\n for (let w = 0; w < windows; w++) { // Points are stored in array and used\n b = p; // any time Gx multiplication is done.\n points.push(b); // They consume 16-32 MiB of RAM.\n for (let i = 1; i < 2 ** (W - 1); i++) {\n b = b.add(p);\n points.push(b);\n }\n p = b.double(); // Precomputes don't speed-up getSharedKey,\n } // which multiplies user point by scalar,\n return points; // when precomputes are using base point\n};\nconst wNAF = (n) => {\n // Compared to other point mult methods,\n const comp = Gpows || (Gpows = precompute()); // stores 2x less points using subtraction\n const neg = (cnd, p) => { let n = p.negate(); return cnd ? n : p; }; // negate\n let p = I, f = G; // f must be G, or could become I in the end\n const windows = 1 + 256 / W; // W=8 17 windows\n const wsize = 2 ** (W - 1); // W=8 128 window size\n const mask = BigInt(2 ** W - 1); // W=8 will create mask 0b11111111\n const maxNum = 2 ** W; // W=8 256\n const shiftBy = BigInt(W); // W=8 8\n for (let w = 0; w < windows; w++) {\n const off = w * wsize;\n let wbits = Number(n & mask); // extract W bits.\n n >>= shiftBy; // shift number by W bits.\n if (wbits > wsize) {\n wbits -= maxNum;\n n += 1n;\n } // split if bits > max: +224 => 256-32\n const off1 = off, off2 = off + Math.abs(wbits) - 1; // offsets, evaluate both\n const cnd1 = w % 2 !== 0, cnd2 = wbits < 0; // conditions, evaluate both\n if (wbits === 0) {\n f = f.add(neg(cnd1, comp[off1])); // bits are 0: add garbage to fake point\n }\n else { // ^ can't add off2, off2 = I\n p = p.add(neg(cnd2, comp[off2])); // bits are 1: add to result point\n }\n }\n return { p, f }; // return both real and fake points for JIT\n}; // !! you can disable precomputes by commenting-out call of the wNAF() inside Point#mul()\nexport { getPublicKey, sign, signAsync, verify, CURVE, // Remove the export to easily use in REPL\ngetSharedSecret, etc, utils, Point as ProjectivePoint, Signature }; // envs like browser console\n","/**\n * Add details about signing here.\n *\n * @_subsection: api/crypto:Signing [about-signing]\n */\nimport * as secp256k1 from \"@noble/secp256k1\";\nimport { dataLength, getBytes, getBytesCopy, hexlify, assertArgument, } from \"../utils/index.js\";\nimport { arrayify, hexConcat } from \"../utils/data.js\";\nimport { Logger } from \"../logger/logger.js\";\nimport { ed448 } from \"./crypto.js\";\nimport { Buffer } from \"buffer\";\nconst logger = new Logger(\"signing-key/0.0.1\");\n//const N = BigInt(\"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\");\n// Make noble-secp256k1 sync\n/**\n * A **SigningKey** provides high-level access to the elliptic curve\n * cryptography (ECC) operations and key management.\n */\nexport class SigningKey {\n #privateKey;\n /**\n * Creates a new **SigningKey** for %%privateKey%%.\n */\n constructor(privateKey) {\n let tmp = privateKey;\n if (typeof tmp === \"string\" && tmp.startsWith(\"0x\")) {\n tmp = tmp.replace(\"0x\", \"\");\n }\n assertArgument(dataLength(\"0x\" + tmp) === 57, \"invalid private key\", \"privateKey\", \"[REDACTED]\");\n this.#privateKey = hexlify(\"0x\" + tmp);\n }\n /**\n * The private key.\n */\n get privateKey() {\n return this.#privateKey;\n }\n /**\n * The uncompressed public key.\n *\n * This will always begin with the prefix ``0x04`` and be 132\n * characters long (the ``0x`` prefix and 130 hexadecimal nibbles).\n */\n get publicKey() {\n return SigningKey.computePublicKey(this.#privateKey);\n }\n /**\n * The compressed public key.\n *\n * This will always begin with either the prefix ``0x02`` or ``0x03``\n * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal\n * nibbles)\n */\n get compressedPublicKey() {\n return SigningKey.computePublicKey(this.#privateKey, true);\n }\n /**\n * Return the signature of the signed %%digest%%.\n */\n sign(digest) {\n const key = getBytesCopy(this.#privateKey);\n assertArgument(dataLength(digest) === 32, \"invalid digest length\", \"digest\", digest);\n const keyBuffer = new Uint8Array(arrayify(key));\n if (keyBuffer.length !== 57) {\n logger.throwArgumentError(\"invalid private key\", \"key\", \"[REDACTED]\");\n }\n const digestBuffer = new Uint8Array(arrayify(digest));\n if (digestBuffer.length !== 32) {\n logger.throwArgumentError(\"bad digest length\", \"digest\", digest);\n }\n if (keyBuffer[56] > 127) {\n const prefix = keyBuffer.slice(0, 57);\n prefix[0] &= 0xfc;\n prefix[55] |= 0x80;\n prefix[56] = 0;\n const scalar = prefix.slice(0, 56);\n const bufferDigest = Buffer.from(digestBuffer);\n const bufferPrfx = Buffer.from(prefix);\n const bufferScalar = Buffer.from(scalar);\n const sig = ed448.signWithScalar(bufferDigest, bufferScalar, bufferPrfx);\n const hexlified = hexlify(sig);\n return hexConcat([hexlified, this.publicKey]);\n }\n const sig = ed448.sign(Buffer.from(digestBuffer), Buffer.from(keyBuffer));\n const hexlified = hexlify(sig);\n return hexConcat([hexlified, this.publicKey]);\n }\n /**\n * Returns the [[link-wiki-ecdh]] shared secret between this\n * private key and the %%other%% key.\n *\n * The %%other%% key may be any type of key, a raw public key,\n * a compressed/uncompressed pubic key or aprivate key.\n *\n * Best practice is usually to use a cryptographic hash on the\n * returned value before using it as a symetric secret.\n *\n * @example:\n * sign1 = new SigningKey(id(\"some-secret-1\"))\n * sign2 = new SigningKey(id(\"some-secret-2\"))\n *\n * // Notice that privA.computeSharedSecret(pubB)...\n * sign1.computeSharedSecret(sign2.publicKey)\n * //_result:\n *\n * // ...is equal to privB.computeSharedSecret(pubA).\n * sign2.computeSharedSecret(sign1.publicKey)\n * //_result:\n */\n computeSharedSecret(other) {\n const pubKey = SigningKey.computePublicKey(other);\n return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey)));\n }\n /**\n * Compute the public key for %%key%%, optionally %%compressed%%.\n *\n * The %%key%% may be any type of key, a raw public key, a\n * compressed/uncompressed public key or private key.\n *\n * @example:\n * sign = new SigningKey(id(\"some-secret\"));\n *\n * // Compute the uncompressed public key for a private key\n * SigningKey.computePublicKey(sign.privateKey)\n * //_result:\n *\n * // Compute the compressed public key for a private key\n * SigningKey.computePublicKey(sign.privateKey, true)\n * //_result:\n *\n * // Compute the uncompressed public key\n * SigningKey.computePublicKey(sign.publicKey, false);\n * //_result:\n *\n * // Compute the Compressed a public key\n * SigningKey.computePublicKey(sign.publicKey, true);\n * //_result:\n */\n static computePublicKey(key, compressed) {\n const bytes = Buffer.from(arrayify(key));\n if (bytes.length !== 57) {\n logger.throwArgumentError(\"invalid private key\", \"key\", \"[REDACTED]\");\n }\n if (bytes[56] > 127) {\n const scalar = bytes.slice(0, 56);\n scalar[0] &= 0xfc;\n scalar[55] |= 0x80;\n const pub = ed448.publicKeyFromScalar(scalar);\n return hexlify(pub);\n }\n const pub = ed448.publicKeyCreate(bytes);\n return hexlify(pub);\n }\n /**\n * Returns the public key for the private key which produced the\n * %%signature%% for the given %%digest%%.\n *\n * @example:\n * key = new SigningKey(id(\"some-secret\"))\n * digest = id(\"hello world\")\n * sig = key.sign(digest)\n *\n * // Notice the signer public key...\n * key.publicKey\n * //_result:\n *\n * // ...is equal to the recovered public key\n * SigningKey.recoverPublicKey(digest, sig)\n * //_result:\n *\n */\n static recoverPublicKey(digest, signature) {\n assertArgument(dataLength(digest) === 32, \"invalid digest length\", \"digest\", digest);\n const digestBuffer = Buffer.from(arrayify(digest));\n const sigBuffer = Buffer.from(arrayify(signature));\n if (sigBuffer.length !== 171) {\n logger.throwArgumentError(\"invalid signature\", \"signature\", signature);\n }\n const sig = sigBuffer.slice(0, 114);\n const pub = sigBuffer.slice(114);\n if (ed448.verify(digestBuffer, sig, pub)) {\n return hexlify(pub);\n }\n logger.throwArgumentError(\"invalid signature\", \"signature\", signature);\n return \"\";\n }\n /**\n * Returns the point resulting from adding the ellipic curve points\n * %%p0%% and %%p1%%.\n *\n * This is not a common function most developers should require, but\n * can be useful for certain privacy-specific techniques.\n *\n * For example, it is used by [[HDNodeWallet]] to compute child\n * addresses from parent public keys and chain codes.\n */\n static addPoints(p0, p1, compressed) {\n const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2));\n const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2));\n return \"0x\" + pub0.add(pub1).toHex(!!compressed);\n }\n}\n//# sourceMappingURL=signing-key.js.map","import { concat, dataLength, getBigInt, getBytes, getNumber, hexlify, assertArgument, assertPrivate, } from \"../utils/index.js\";\n// Constants\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_2 = BigInt(2);\nconst BN_27 = BigInt(27);\nconst BN_28 = BigInt(28);\nconst BN_35 = BigInt(35);\nconst _guard = {};\n/**\n * A Signature @TODO\n *\n *\n * @_docloc: api/crypto:Signing\n */\nexport class Signature {\n #r;\n #s;\n #v;\n #networkV;\n /**\n * The ``r`` value for a signautre.\n *\n * This represents the ``x`` coordinate of a \"reference\" or\n * challenge point, from which the ``y`` can be computed.\n */\n get r() {\n return this.#r;\n }\n set r(value) {\n assertArgument(dataLength(value) === 32, \"invalid r\", \"value\", value);\n this.#r = hexlify(value);\n }\n /**\n * The ``s`` value for a signature.\n */\n get s() {\n return this.#s;\n }\n set s(_value) {\n assertArgument(dataLength(_value) === 32, \"invalid s\", \"value\", _value);\n const value = hexlify(_value);\n assertArgument(parseInt(value.substring(0, 3)) < 8, \"non-canonical s\", \"value\", value);\n this.#s = value;\n }\n /**\n * The ``v`` value for a signature.\n *\n * Since a given ``x`` value for ``r`` has two possible values for\n * its correspondin ``y``, the ``v`` indicates which of the two ``y``\n * values to use.\n *\n * It is normalized to the values ``27`` or ``28`` for legacy\n * purposes.\n */\n get v() {\n return this.#v;\n }\n set v(value) {\n const v = getNumber(value, \"value\");\n assertArgument(v === 27 || v === 28, \"invalid v\", \"v\", value);\n this.#v = v;\n }\n /**\n * The EIP-155 ``v`` for legacy transactions. For non-legacy\n * transactions, this value is ``null``.\n */\n get networkV() {\n return this.#networkV;\n }\n /**\n * The chain ID for EIP-155 legacy transactions. For non-legacy\n * transactions, this value is ``null``.\n */\n get legacynetworkId() {\n const v = this.networkV;\n if (v == null) {\n return null;\n }\n return Signature.getnetworkId(v);\n }\n /**\n * The ``yParity`` for the signature.\n *\n * See ``v`` for more details on how this value is used.\n */\n get yParity() {\n return this.v === 27 ? 0 : 1;\n }\n /**\n * The [[link-eip-2098]] compact representation of the ``yParity``\n * and ``s`` compacted into a single ``bytes32``.\n */\n get yParityAndS() {\n // The EIP-2098 compact representation\n const yParityAndS = getBytes(this.s);\n if (this.yParity) {\n yParityAndS[0] |= 0x80;\n }\n return hexlify(yParityAndS);\n }\n /**\n * The [[link-eip-2098]] compact representation.\n */\n get compactSerialized() {\n return concat([this.r, this.yParityAndS]);\n }\n /**\n * The serialized representation.\n */\n get serialized() {\n return concat([this.r, this.s, this.yParity ? \"0x1c\" : \"0x1b\"]);\n }\n /**\n * @private\n */\n constructor(guard, r, s, v) {\n assertPrivate(guard, _guard, \"Signature\");\n this.#r = r;\n this.#s = s;\n this.#v = v;\n this.#networkV = null;\n }\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n return `Signature { r: \"${this.r}\", s: \"${this.s}\", yParity: ${this.yParity}, networkV: ${this.networkV} }`;\n }\n /**\n * Returns a new identical [[Signature]].\n */\n clone() {\n const clone = new Signature(_guard, this.r, this.s, this.v);\n if (this.networkV) {\n clone.#networkV = this.networkV;\n }\n return clone;\n }\n /**\n * Returns a representation that is compatible with ``JSON.stringify``.\n */\n toJSON() {\n const networkV = this.networkV;\n return {\n _type: \"signature\",\n networkV: networkV != null ? networkV.toString() : null,\n r: this.r,\n s: this.s,\n v: this.v,\n };\n }\n /**\n * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions.\n *\n * @example:\n * Signature.getnetworkId(45)\n * //_result:\n *\n * Signature.getnetworkId(46)\n * //_result:\n */\n static getnetworkId(v) {\n const bv = getBigInt(v, \"v\");\n // The v is not an EIP-155 v, so it is the unspecified chain ID\n if (bv == BN_27 || bv == BN_28) {\n return BN_0;\n }\n // Bad value for an EIP-155 v\n assertArgument(bv >= BN_35, \"invalid EIP-155 v\", \"v\", v);\n return (bv - BN_35) / BN_2;\n }\n /**\n * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.\n *\n * Legacy transactions which use [[link-eip-155]] hijack the ``v``\n * property to include the chain ID.\n *\n * @example:\n * Signature.getnetworkIdV(5, 27)\n * //_result:\n *\n * Signature.getnetworkIdV(5, 28)\n * //_result:\n *\n */\n static getnetworkIdV(networkId, v) {\n return getBigInt(networkId) * BN_2 + BigInt(35 + v - 27);\n }\n /**\n * Compute the normalized legacy transaction ``v`` from a ``yParirty``,\n * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.\n *\n * @example:\n * // The values 0 and 1 imply v is actually yParity\n * Signature.getNormalizedV(0)\n * //_result:\n *\n * // Legacy non-EIP-1559 transaction (i.e. 27 or 28)\n * Signature.getNormalizedV(27)\n * //_result:\n *\n * // Legacy EIP-155 transaction (i.e. >= 35)\n * Signature.getNormalizedV(46)\n * //_result:\n *\n * // Invalid values throw\n * Signature.getNormalizedV(5)\n * //_error:\n */\n static getNormalizedV(v) {\n const bv = getBigInt(v);\n if (bv === BN_0 || bv === BN_27) {\n return 27;\n }\n if (bv === BN_1 || bv === BN_28) {\n return 28;\n }\n assertArgument(bv >= BN_35, \"invalid v\", \"v\", v);\n // Otherwise, EIP-155 v means odd is 27 and even is 28\n return bv & BN_1 ? 27 : 28;\n }\n}\n//# sourceMappingURL=signature.js.map","/**\n * A fundamental building block of Core is the underlying\n * cryptographic primitives.\n *\n * @_section: api/crypto:Cryptographic Functions [about-crypto]\n */\nnull;\n// We import all these so we can export lock()\nimport { computeHmac } from \"./hmac.js\";\nimport { ripemd160 } from \"./ripemd160.js\";\nimport { pbkdf2 } from \"./pbkdf2.js\";\nimport { randomBytes } from \"./random.js\";\nimport { scrypt, scryptSync } from \"./scrypt.js\";\nimport { sha256, sha512 } from \"./sha3.js\";\nimport { Ed448Goldilock } from \"./crypto.js\";\nimport { keccak256 } from \"./keccak.js\";\nexport { computeHmac, randomBytes, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, keccak256, Ed448Goldilock, };\nexport { SigningKey } from \"./signing-key.js\";\nexport { Signature } from \"./signature.js\";\nfunction lock() {\n computeHmac.lock();\n pbkdf2.lock();\n randomBytes.lock();\n ripemd160.lock();\n scrypt.lock();\n scryptSync.lock();\n sha256.lock();\n sha512.lock();\n randomBytes.lock();\n}\nexport { lock };\n//# sourceMappingURL=index.js.map","import { getAddress } from \"../address/index.js\";\nimport { sha256, SigningKey } from \"../crypto/index.js\";\nimport { arrayify, hexDataSlice } from \"../utils/data.js\";\nimport { calculateCheckSum } from \"../address/index.js\";\n/**\n * Returns the address for the %%key%%.\n *\n * The key may be any standard form of public key or a private key.\n */\nexport function removeHexPrefix(val) {\n return val.substring(0, 2) === \"0x\" ? val.substring(2) : val;\n}\nexport function publicToAddress(key, prefix) {\n const val = hexDataSlice(sha256(key), 12);\n const checksum = calculateCheckSum(val, prefix);\n return \"0x\" + prefix + checksum + removeHexPrefix(val);\n}\nexport function computeAddress(key, prefix) {\n let pubkey;\n if (typeof key === \"string\") {\n pubkey = SigningKey.computePublicKey(key, false);\n }\n else {\n pubkey = key.publicKey;\n }\n return publicToAddress(pubkey, prefix); // getAddress(sha256(\"0x\" + pubkey.substring(4)).substring(26));\n}\n/**\n * Returns the recovered address for the private key that was\n * used to sign %%digest%% that resulted in %%signature%%.\n */\nexport function recoverAddress(digest, signature, prefix) {\n // return computeAddress(SigningKey.recoverPublicKey(digest, signature));\n const publicKey = SigningKey.recoverPublicKey(arrayify(digest), signature);\n return publicToAddress(publicKey, prefix);\n}\nexport function extractPrefix(address) {\n address = getAddress(address);\n return address.substring(2, 4);\n}\n//# sourceMappingURL=address.js.map","import { defineProperties, concat, getBytesCopy, getNumber, hexlify, toBeArray, toBigInt, toNumber, assert, assertArgument, } from \"../../utils/index.js\";\n/**\n * @_ignore:\n */\nexport const WordSize = 32;\nconst Padding = new Uint8Array(WordSize);\n// Properties used to immediate pass through to the underlying object\n// - `then` is used to detect if an object is a Promise for await\nconst passProperties = [\"then\"];\nconst _guard = {};\nfunction throwError(name, error) {\n const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`);\n wrapped.error = error;\n throw wrapped;\n}\n/**\n * A [[Result]] is a sub-class of Array, which allows accessing any\n * of its values either positionally by its index or, if keys are\n * provided by its name.\n *\n * @_docloc: api/abi\n */\nexport class Result extends Array {\n #names;\n /**\n * @private\n */\n constructor(...args) {\n // To properly sub-class Array so the other built-in\n // functions work, the constructor has to behave fairly\n // well. So, in the event we are created via fromItems()\n // we build the read-only Result object we want, but on\n // any other input, we use the default constructor\n // constructor(guard: any, items: Array, keys?: Array);\n const guard = args[0];\n let items = args[1];\n let names = (args[2] || []).slice();\n let wrap = true;\n if (guard !== _guard) {\n items = args;\n names = [];\n wrap = false;\n }\n // Can't just pass in ...items since an array of length 1\n // is a special case in the super.\n super(items.length);\n items.forEach((item, index) => {\n this[index] = item;\n });\n // Find all unique keys\n const nameCounts = names.reduce((accum, name) => {\n if (typeof name === \"string\") {\n accum.set(name, (accum.get(name) || 0) + 1);\n }\n return accum;\n }, new Map());\n // Remove any key thats not unique\n this.#names = Object.freeze(items.map((item, index) => {\n const name = names[index];\n if (name != null && nameCounts.get(name) === 1) {\n return name;\n }\n return null;\n }));\n if (!wrap) {\n return;\n }\n // A wrapped Result is immutable\n Object.freeze(this);\n // Proxy indices and names so we can trap deferred errors\n return new Proxy(this, {\n get: (target, prop, receiver) => {\n if (typeof prop === \"string\") {\n // Index accessor\n if (prop.match(/^[0-9]+$/)) {\n const index = getNumber(prop, \"%index\");\n if (index < 0 || index >= this.length) {\n throw new RangeError(\"out of result range\");\n }\n const item = target[index];\n if (item instanceof Error) {\n throwError(`index ${index}`, item);\n }\n return item;\n }\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n const value = target[prop];\n if (value instanceof Function) {\n // Make sure functions work with private variables\n // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding\n return function (...args) {\n return value.apply(this === receiver ? target : this, args);\n };\n }\n else if (!(prop in target)) {\n // Possible name accessor\n return target.getValue.apply(this === receiver ? target : this, [\n prop,\n ]);\n }\n }\n return Reflect.get(target, prop, receiver);\n },\n });\n }\n /**\n * Returns the Result as a normal Array.\n *\n * This will throw if there are any outstanding deferred\n * errors.\n */\n toArray() {\n const result = [];\n this.forEach((item, index) => {\n if (item instanceof Error) {\n throwError(`index ${index}`, item);\n }\n result.push(item);\n });\n return result;\n }\n /**\n * Returns the Result as an Object with each name-value pair.\n *\n * This will throw if any value is unnamed, or if there are\n * any outstanding deferred errors.\n */\n toObject() {\n return this.#names.reduce((accum, name, index) => {\n assert(name != null, \"value at index ${ index } unnamed\", \"UNSUPPORTED_OPERATION\", {\n operation: \"toObject()\",\n });\n // Add values for names that don't conflict\n if (!(name in accum)) {\n accum[name] = this.getValue(name);\n }\n return accum;\n }, {});\n }\n /**\n * @_ignore\n */\n slice(start, end) {\n if (start == null) {\n start = 0;\n }\n if (start < 0) {\n start += this.length;\n if (start < 0) {\n start = 0;\n }\n }\n if (end == null) {\n end = this.length;\n }\n if (end < 0) {\n end += this.length;\n if (end < 0) {\n end = 0;\n }\n }\n if (end > this.length) {\n end = this.length;\n }\n const result = [], names = [];\n for (let i = start; i < end; i++) {\n result.push(this[i]);\n names.push(this.#names[i]);\n }\n return new Result(_guard, result, names);\n }\n /**\n * @_ignore\n */\n filter(callback, thisArg) {\n const result = [], names = [];\n for (let i = 0; i < this.length; i++) {\n const item = this[i];\n if (item instanceof Error) {\n throwError(`index ${i}`, item);\n }\n if (callback.call(thisArg, item, i, this)) {\n result.push(item);\n names.push(this.#names[i]);\n }\n }\n return new Result(_guard, result, names);\n }\n /**\n * Returns the value for %%name%%.\n *\n * Since it is possible to have a key whose name conflicts with\n * a method on a [[Result]] or its superclass Array, or any\n * JavaScript keyword, this ensures all named values are still\n * accessible by name.\n */\n getValue(name) {\n const index = this.#names.indexOf(name);\n if (index === -1) {\n return undefined;\n }\n const value = this[index];\n if (value instanceof Error) {\n throwError(`property ${JSON.stringify(name)}`, value.error);\n }\n return value;\n }\n /**\n * Creates a new [[Result]] for %%items%% with each entry\n * also accessible by its corresponding name in %%keys%%.\n */\n static fromItems(items, keys) {\n return new Result(_guard, items, keys);\n }\n}\n/**\n * Returns all errors found in a [[Result]].\n *\n * Since certain errors encountered when creating a [[Result]] do\n * not impact the ability to continue parsing data, they are\n * deferred until they are actually accessed. Hence a faulty string\n * in an Event that is never used does not impact the program flow.\n *\n * However, sometimes it may be useful to access, identify or\n * validate correctness of a [[Result]].\n *\n * @_docloc api/abi\n */\nexport function checkResultErrors(result) {\n // Find the first error (if any)\n const errors = [];\n const checkErrors = function (path, object) {\n if (!Array.isArray(object)) {\n return;\n }\n for (let key in object) {\n const childPath = path.slice();\n childPath.push(key);\n try {\n checkErrors(childPath, object[key]);\n }\n catch (error) {\n errors.push({ path: childPath, error: error });\n }\n }\n };\n checkErrors([], result);\n return errors;\n}\nfunction getValue(value) {\n let bytes = toBeArray(value);\n assert(bytes.length <= WordSize, \"value out-of-bounds\", \"BUFFER_OVERRUN\", {\n buffer: bytes,\n length: WordSize,\n offset: bytes.length,\n });\n if (bytes.length !== WordSize) {\n bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes]));\n }\n return bytes;\n}\n/**\n * @_ignore\n */\nexport class Coder {\n // The coder name:\n // - address, uint256, tuple, array, etc.\n name;\n // The fully expanded type, including composite types:\n // - address, uint256, tuple(address,bytes), uint256[3][4][], etc.\n type;\n // The localName bound in the signature, in this example it is \"baz\":\n // - tuple(address foo, uint bar) baz\n localName;\n // Whether this type is dynamic:\n // - Dynamic: bytes, string, address[], tuple(boolean[]), etc.\n // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8)\n dynamic;\n constructor(name, type, localName, dynamic) {\n defineProperties(this, { name, type, localName, dynamic }, {\n name: \"string\",\n type: \"string\",\n localName: \"string\",\n dynamic: \"boolean\",\n });\n }\n _throwError(message, value) {\n assertArgument(false, message, this.localName, value);\n }\n}\n/**\n * @_ignore\n */\nexport class Writer {\n // An array of WordSize lengthed objects to concatenation\n #data;\n #dataLength;\n constructor() {\n this.#data = [];\n this.#dataLength = 0;\n }\n get data() {\n return concat(this.#data);\n }\n get length() {\n return this.#dataLength;\n }\n #writeData(data) {\n this.#data.push(data);\n this.#dataLength += data.length;\n return data.length;\n }\n appendWriter(writer) {\n return this.#writeData(getBytesCopy(writer.data));\n }\n // Arrayish item; pad on the right to *nearest* WordSize\n writeBytes(value) {\n let bytes = getBytesCopy(value);\n const paddingOffset = bytes.length % WordSize;\n if (paddingOffset) {\n bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)]));\n }\n return this.#writeData(bytes);\n }\n // Numeric item; pad on the left *to* WordSize\n writeValue(value) {\n return this.#writeData(getValue(value));\n }\n // Inserts a numeric place-holder, returning a callback that can\n // be used to asjust the value later\n writeUpdatableValue() {\n const offset = this.#data.length;\n this.#data.push(Padding);\n this.#dataLength += WordSize;\n return (value) => {\n this.#data[offset] = getValue(value);\n };\n }\n}\n/**\n * @_ignore\n */\nexport class Reader {\n // Allows incomplete unpadded data to be read; otherwise an error\n // is raised if attempting to overrun the buffer. This is required\n // to deal with an old Solidity bug, in which event data for\n // external (not public thoguh) was tightly packed.\n allowLoose;\n #data;\n #offset;\n constructor(data, allowLoose) {\n defineProperties(this, { allowLoose: !!allowLoose });\n this.#data = getBytesCopy(data);\n this.#offset = 0;\n }\n get data() {\n return hexlify(this.#data);\n }\n get dataLength() {\n return this.#data.length;\n }\n get consumed() {\n return this.#offset;\n }\n get bytes() {\n return new Uint8Array(this.#data);\n }\n #peekBytes(offset, length, loose) {\n let alignedLength = Math.ceil(length / WordSize) * WordSize;\n if (this.#offset + alignedLength > this.#data.length) {\n if (this.allowLoose &&\n loose &&\n this.#offset + length <= this.#data.length) {\n alignedLength = length;\n }\n else {\n assert(false, \"data out-of-bounds\", \"BUFFER_OVERRUN\", {\n buffer: getBytesCopy(this.#data),\n length: this.#data.length,\n offset: this.#offset + alignedLength,\n });\n }\n }\n return this.#data.slice(this.#offset, this.#offset + alignedLength);\n }\n // Create a sub-reader with the same underlying data, but offset\n subReader(offset) {\n return new Reader(this.#data.slice(this.#offset + offset), this.allowLoose);\n }\n // Read bytes\n readBytes(length, loose) {\n let bytes = this.#peekBytes(0, length, !!loose);\n this.#offset += bytes.length;\n // @TODO: Make sure the length..end bytes are all 0?\n return bytes.slice(0, length);\n }\n // Read a numeric values\n readValue() {\n return toBigInt(this.readBytes(WordSize));\n }\n readIndex() {\n return toNumber(this.readBytes(WordSize));\n }\n}\n//# sourceMappingURL=abstract-coder.js.map","/**\n * A Typed object allows a value to have its type explicitly\n * specified.\n *\n * For example, in Solidity, the value ``45`` could represent a\n * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent\n * a ``bytes2`` or ``bytes``.\n *\n * Since JavaScript has no meaningful way to explicitly inform any\n * APIs which what the type is, this allows transparent interoperation\n * with Soldity.\n *\n * @_subsection: api/abi:Typed Values\n */\nimport { assertPrivate, defineProperties } from \"../utils/index.js\";\nconst _gaurd = {};\nfunction n(value, width) {\n let signed = false;\n if (width < 0) {\n signed = true;\n width *= -1;\n }\n // @TODO: Check range is valid for value\n return new Typed(_gaurd, `${signed ? \"\" : \"u\"}int${width}`, value, {\n signed,\n width,\n });\n}\nfunction b(value, size) {\n // @TODO: Check range is valid for value\n return new Typed(_gaurd, `bytes${size ? size : \"\"}`, value, { size });\n}\nconst _typedSymbol = Symbol.for(\"_corebc_typed\");\nexport class Typed {\n type;\n value;\n #options;\n _typedSymbol;\n constructor(gaurd, type, value, options) {\n if (options == null) {\n options = null;\n }\n assertPrivate(_gaurd, gaurd, \"Typed\");\n defineProperties(this, { _typedSymbol, type, value });\n this.#options = options;\n // Check the value is valid\n this.format();\n }\n format() {\n if (this.type === \"array\") {\n throw new Error(\"\");\n }\n else if (this.type === \"dynamicArray\") {\n throw new Error(\"\");\n }\n else if (this.type === \"tuple\") {\n return `tuple(${this.value.map((v) => v.format()).join(\",\")})`;\n }\n return this.type;\n }\n defaultValue() {\n return 0;\n }\n minValue() {\n return 0;\n }\n maxValue() {\n return 0;\n }\n isBigInt() {\n return !!this.type.match(/^u?int[0-9]+$/);\n }\n isData() {\n return this.type.startsWith(\"bytes\");\n }\n isString() {\n return this.type === \"string\";\n }\n get tupleName() {\n if (this.type !== \"tuple\") {\n throw TypeError(\"not a tuple\");\n }\n return this.#options;\n }\n // Returns the length of this type as an array\n // - `null` indicates the length is unforced, it could be dynamic\n // - `-1` indicates the length is dynamic\n // - any other value indicates it is a static array and is its length\n get arrayLength() {\n if (this.type !== \"array\") {\n throw TypeError(\"not an array\");\n }\n if (this.#options === true) {\n return -1;\n }\n if (this.#options === false) {\n return this.value.length;\n }\n return null;\n }\n static from(type, value) {\n return new Typed(_gaurd, type, value);\n }\n static uint8(v) {\n return n(v, 8);\n }\n static uint16(v) {\n return n(v, 16);\n }\n static uint24(v) {\n return n(v, 24);\n }\n static uint32(v) {\n return n(v, 32);\n }\n static uint40(v) {\n return n(v, 40);\n }\n static uint48(v) {\n return n(v, 48);\n }\n static uint56(v) {\n return n(v, 56);\n }\n static uint64(v) {\n return n(v, 64);\n }\n static uint72(v) {\n return n(v, 72);\n }\n static uint80(v) {\n return n(v, 80);\n }\n static uint88(v) {\n return n(v, 88);\n }\n static uint96(v) {\n return n(v, 96);\n }\n static uint104(v) {\n return n(v, 104);\n }\n static uint112(v) {\n return n(v, 112);\n }\n static uint120(v) {\n return n(v, 120);\n }\n static uint128(v) {\n return n(v, 128);\n }\n static uint136(v) {\n return n(v, 136);\n }\n static uint144(v) {\n return n(v, 144);\n }\n static uint152(v) {\n return n(v, 152);\n }\n static uint160(v) {\n return n(v, 160);\n }\n static uint168(v) {\n return n(v, 168);\n }\n static uint176(v) {\n return n(v, 176);\n }\n static uint184(v) {\n return n(v, 184);\n }\n static uint192(v) {\n return n(v, 192);\n }\n static uint200(v) {\n return n(v, 200);\n }\n static uint208(v) {\n return n(v, 208);\n }\n static uint216(v) {\n return n(v, 216);\n }\n static uint224(v) {\n return n(v, 224);\n }\n static uint232(v) {\n return n(v, 232);\n }\n static uint240(v) {\n return n(v, 240);\n }\n static uint248(v) {\n return n(v, 248);\n }\n static uint256(v) {\n return n(v, 256);\n }\n static uint(v) {\n return n(v, 256);\n }\n static int8(v) {\n return n(v, -8);\n }\n static int16(v) {\n return n(v, -16);\n }\n static int24(v) {\n return n(v, -24);\n }\n static int32(v) {\n return n(v, -32);\n }\n static int40(v) {\n return n(v, -40);\n }\n static int48(v) {\n return n(v, -48);\n }\n static int56(v) {\n return n(v, -56);\n }\n static int64(v) {\n return n(v, -64);\n }\n static int72(v) {\n return n(v, -72);\n }\n static int80(v) {\n return n(v, -80);\n }\n static int88(v) {\n return n(v, -88);\n }\n static int96(v) {\n return n(v, -96);\n }\n static int104(v) {\n return n(v, -104);\n }\n static int112(v) {\n return n(v, -112);\n }\n static int120(v) {\n return n(v, -120);\n }\n static int128(v) {\n return n(v, -128);\n }\n static int136(v) {\n return n(v, -136);\n }\n static int144(v) {\n return n(v, -144);\n }\n static int152(v) {\n return n(v, -152);\n }\n static int160(v) {\n return n(v, -160);\n }\n static int168(v) {\n return n(v, -168);\n }\n static int176(v) {\n return n(v, -176);\n }\n static int184(v) {\n return n(v, -184);\n }\n static int192(v) {\n return n(v, -192);\n }\n static int200(v) {\n return n(v, -200);\n }\n static int208(v) {\n return n(v, -208);\n }\n static int216(v) {\n return n(v, -216);\n }\n static int224(v) {\n return n(v, -224);\n }\n static int232(v) {\n return n(v, -232);\n }\n static int240(v) {\n return n(v, -240);\n }\n static int248(v) {\n return n(v, -248);\n }\n static int256(v) {\n return n(v, -256);\n }\n static int(v) {\n return n(v, -256);\n }\n static bytes1(v) {\n return b(v, 1);\n }\n static bytes2(v) {\n return b(v, 2);\n }\n static bytes3(v) {\n return b(v, 3);\n }\n static bytes4(v) {\n return b(v, 4);\n }\n static bytes5(v) {\n return b(v, 5);\n }\n static bytes6(v) {\n return b(v, 6);\n }\n static bytes7(v) {\n return b(v, 7);\n }\n static bytes8(v) {\n return b(v, 8);\n }\n static bytes9(v) {\n return b(v, 9);\n }\n static bytes10(v) {\n return b(v, 10);\n }\n static bytes11(v) {\n return b(v, 11);\n }\n static bytes12(v) {\n return b(v, 12);\n }\n static bytes13(v) {\n return b(v, 13);\n }\n static bytes14(v) {\n return b(v, 14);\n }\n static bytes15(v) {\n return b(v, 15);\n }\n static bytes16(v) {\n return b(v, 16);\n }\n static bytes17(v) {\n return b(v, 17);\n }\n static bytes18(v) {\n return b(v, 18);\n }\n static bytes19(v) {\n return b(v, 19);\n }\n static bytes20(v) {\n return b(v, 20);\n }\n static bytes21(v) {\n return b(v, 21);\n }\n static bytes22(v) {\n return b(v, 22);\n }\n static bytes23(v) {\n return b(v, 23);\n }\n static bytes24(v) {\n return b(v, 24);\n }\n static bytes25(v) {\n return b(v, 25);\n }\n static bytes26(v) {\n return b(v, 26);\n }\n static bytes27(v) {\n return b(v, 27);\n }\n static bytes28(v) {\n return b(v, 28);\n }\n static bytes29(v) {\n return b(v, 29);\n }\n static bytes30(v) {\n return b(v, 30);\n }\n static bytes31(v) {\n return b(v, 31);\n }\n static bytes32(v) {\n return b(v, 32);\n }\n static address(v) {\n return new Typed(_gaurd, \"address\", v);\n }\n static bool(v) {\n return new Typed(_gaurd, \"bool\", !!v);\n }\n static bytes(v) {\n return new Typed(_gaurd, \"bytes\", v);\n }\n static string(v) {\n return new Typed(_gaurd, \"string\", v);\n }\n static array(v, dynamic) {\n throw new Error(\"not implemented yet\");\n return new Typed(_gaurd, \"array\", v, dynamic);\n }\n static tuple(v, name) {\n throw new Error(\"not implemented yet\");\n return new Typed(_gaurd, \"tuple\", v, name);\n }\n static overrides(v) {\n return new Typed(_gaurd, \"overrides\", Object.assign({}, v));\n }\n /**\n * Returns true only if %%value%% is a [[Typed]] instance.\n */\n static isTyped(value) {\n return value && value._typedSymbol === _typedSymbol;\n }\n /**\n * If the value is a [[Typed]] instance, validates the underlying value\n * and returns it, otherwise returns value directly.\n *\n * This is useful for functions that with to accept either a [[Typed]]\n * object or values.\n */\n static dereference(value, type) {\n if (Typed.isTyped(value)) {\n if (value.type !== type) {\n throw new Error(`invalid type: expecetd ${type}, got ${value.type}`);\n }\n return value.value;\n }\n return value;\n }\n}\n//# sourceMappingURL=typed.js.map","import { getAddress } from \"../../address/index.js\";\nimport { toBeHex } from \"../../utils/maths.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class AddressCoder extends Coder {\n constructor(localName) {\n super(\"address\", \"address\", localName, false);\n }\n defaultValue() {\n return \"0x0000000000000000000000000000000000000000\";\n }\n encode(writer, _value) {\n let value = Typed.dereference(_value, \"string\");\n try {\n value = getAddress(value);\n }\n catch (error) {\n return this._throwError(error.message, _value);\n }\n return writer.writeValue(value);\n }\n decode(reader) {\n return getAddress(toBeHex(reader.readValue(), 22));\n }\n}\n//# sourceMappingURL=address.js.map","import { Coder } from \"./abstract-coder.js\";\n/**\n * Clones the functionality of an existing Coder, but without a localName\n *\n * @_ignore\n */\nexport class AnonymousCoder extends Coder {\n coder;\n constructor(coder) {\n super(coder.name, coder.type, \"_\", coder.dynamic);\n this.coder = coder;\n }\n defaultValue() {\n return this.coder.defaultValue();\n }\n encode(writer, value) {\n return this.coder.encode(writer, value);\n }\n decode(reader) {\n return this.coder.decode(reader);\n }\n}\n//# sourceMappingURL=anonymous.js.map","import { defineProperties, isError, assert, assertArgument, assertArgumentCount, } from \"../../utils/index.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder, Result, WordSize, Writer } from \"./abstract-coder.js\";\nimport { AnonymousCoder } from \"./anonymous.js\";\n/**\n * @_ignore\n */\nexport function pack(writer, coders, values) {\n let arrayValues = [];\n if (Array.isArray(values)) {\n arrayValues = values;\n }\n else if (values && typeof values === \"object\") {\n let unique = {};\n arrayValues = coders.map((coder) => {\n const name = coder.localName;\n assert(name, \"cannot encode object for signature with missing names\", \"INVALID_ARGUMENT\", { argument: \"values\", info: { coder }, value: values });\n assert(!unique[name], \"cannot encode object for signature with duplicate names\", \"INVALID_ARGUMENT\", { argument: \"values\", info: { coder }, value: values });\n unique[name] = true;\n return values[name];\n });\n }\n else {\n assertArgument(false, \"invalid tuple value\", \"tuple\", values);\n }\n assertArgument(coders.length === arrayValues.length, \"types/value length mismatch\", \"tuple\", values);\n let staticWriter = new Writer();\n let dynamicWriter = new Writer();\n let updateFuncs = [];\n coders.forEach((coder, index) => {\n let value = arrayValues[index];\n if (coder.dynamic) {\n // Get current dynamic offset (for the future pointer)\n let dynamicOffset = dynamicWriter.length;\n // Encode the dynamic value into the dynamicWriter\n coder.encode(dynamicWriter, value);\n // Prepare to populate the correct offset once we are done\n let updateFunc = staticWriter.writeUpdatableValue();\n updateFuncs.push((baseOffset) => {\n updateFunc(baseOffset + dynamicOffset);\n });\n }\n else {\n coder.encode(staticWriter, value);\n }\n });\n // Backfill all the dynamic offsets, now that we know the static length\n updateFuncs.forEach((func) => {\n func(staticWriter.length);\n });\n let length = writer.appendWriter(staticWriter);\n length += writer.appendWriter(dynamicWriter);\n return length;\n}\n/**\n * @_ignore\n */\nexport function unpack(reader, coders) {\n let values = [];\n let keys = [];\n // A reader anchored to this base\n let baseReader = reader.subReader(0);\n coders.forEach((coder) => {\n let value = null;\n if (coder.dynamic) {\n let offset = reader.readIndex();\n let offsetReader = baseReader.subReader(offset);\n try {\n value = coder.decode(offsetReader);\n }\n catch (error) {\n // Cannot recover from this\n if (isError(error, \"BUFFER_OVERRUN\")) {\n throw error;\n }\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n }\n else {\n try {\n value = coder.decode(reader);\n }\n catch (error) {\n // Cannot recover from this\n if (isError(error, \"BUFFER_OVERRUN\")) {\n throw error;\n }\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n }\n if (value == undefined) {\n throw new Error(\"investigate\");\n }\n values.push(value);\n keys.push(coder.localName || null);\n });\n return Result.fromItems(values, keys);\n}\n/**\n * @_ignore\n */\nexport class ArrayCoder extends Coder {\n coder;\n length;\n constructor(coder, length, localName) {\n const type = coder.type + \"[\" + (length >= 0 ? length : \"\") + \"]\";\n const dynamic = length === -1 || coder.dynamic;\n super(\"array\", type, localName, dynamic);\n defineProperties(this, { coder, length });\n }\n defaultValue() {\n // Verifies the child coder is valid (even if the array is dynamic or 0-length)\n const defaultChild = this.coder.defaultValue();\n const result = [];\n for (let i = 0; i < this.length; i++) {\n result.push(defaultChild);\n }\n return result;\n }\n encode(writer, _value) {\n const value = Typed.dereference(_value, \"array\");\n if (!Array.isArray(value)) {\n this._throwError(\"expected array value\", value);\n }\n let count = this.length;\n if (count === -1) {\n count = value.length;\n writer.writeValue(value.length);\n }\n assertArgumentCount(value.length, count, \"coder array\" + (this.localName ? \" \" + this.localName : \"\"));\n let coders = [];\n for (let i = 0; i < value.length; i++) {\n coders.push(this.coder);\n }\n return pack(writer, coders, value);\n }\n decode(reader) {\n let count = this.length;\n if (count === -1) {\n count = reader.readIndex();\n // Check that there is *roughly* enough data to ensure\n // stray random data is not being read as a length. Each\n // slot requires at least 32 bytes for their value (or 32\n // bytes as a link to the data). This could use a much\n // tighter bound, but we are erroring on the side of safety.\n assert(count * WordSize <= reader.dataLength, \"insufficient data length\", \"BUFFER_OVERRUN\", {\n buffer: reader.bytes,\n offset: count * WordSize,\n length: reader.dataLength,\n });\n }\n let coders = [];\n for (let i = 0; i < count; i++) {\n coders.push(new AnonymousCoder(this.coder));\n }\n return unpack(reader, coders);\n }\n}\n//# sourceMappingURL=array.js.map","import { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class BooleanCoder extends Coder {\n constructor(localName) {\n super(\"bool\", \"bool\", localName, false);\n }\n defaultValue() {\n return false;\n }\n encode(writer, _value) {\n const value = Typed.dereference(_value, \"bool\");\n return writer.writeValue(value ? 1 : 0);\n }\n decode(reader) {\n return !!reader.readValue();\n }\n}\n//# sourceMappingURL=boolean.js.map","import { getBytesCopy, hexlify } from \"../../utils/index.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class DynamicBytesCoder extends Coder {\n constructor(type, localName) {\n super(type, type, localName, true);\n }\n defaultValue() {\n return \"0x\";\n }\n encode(writer, value) {\n value = getBytesCopy(value);\n let length = writer.writeValue(value.length);\n length += writer.writeBytes(value);\n return length;\n }\n decode(reader) {\n return reader.readBytes(reader.readIndex(), true);\n }\n}\n/**\n * @_ignore\n */\nexport class BytesCoder extends DynamicBytesCoder {\n constructor(localName) {\n super(\"bytes\", localName);\n }\n decode(reader) {\n return hexlify(super.decode(reader));\n }\n}\n//# sourceMappingURL=bytes.js.map","import { defineProperties, getBytesCopy, hexlify } from \"../../utils/index.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class FixedBytesCoder extends Coder {\n size;\n constructor(size, localName) {\n let name = \"bytes\" + String(size);\n super(name, name, localName, false);\n defineProperties(this, { size }, { size: \"number\" });\n }\n defaultValue() {\n return \"0x0000000000000000000000000000000000000000000000000000000000000000\".substring(0, 2 + this.size * 2);\n }\n encode(writer, _value) {\n let data = getBytesCopy(Typed.dereference(_value, this.type));\n if (data.length !== this.size) {\n this._throwError(\"incorrect data length\", _value);\n }\n return writer.writeBytes(data);\n }\n decode(reader) {\n return hexlify(reader.readBytes(this.size));\n }\n}\n//# sourceMappingURL=fixed-bytes.js.map","import { Coder } from \"./abstract-coder.js\";\nconst Empty = new Uint8Array([]);\n/**\n * @_ignore\n */\nexport class NullCoder extends Coder {\n constructor(localName) {\n super(\"null\", \"\", localName, false);\n }\n defaultValue() {\n return null;\n }\n encode(writer, value) {\n if (value != null) {\n this._throwError(\"not null\", value);\n }\n return writer.writeBytes(Empty);\n }\n decode(reader) {\n reader.readBytes(0);\n return null;\n }\n}\n//# sourceMappingURL=null.js.map","import { defineProperties, fromTwos, getBigInt, mask, toTwos, } from \"../../utils/index.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder, WordSize } from \"./abstract-coder.js\";\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_MAX_UINT256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n/**\n * @_ignore\n */\nexport class NumberCoder extends Coder {\n size;\n signed;\n constructor(size, signed, localName) {\n const name = (signed ? \"int\" : \"uint\") + size * 8;\n super(name, name, localName, false);\n defineProperties(this, { size, signed }, { size: \"number\", signed: \"boolean\" });\n }\n defaultValue() {\n return 0;\n }\n encode(writer, _value) {\n let value = getBigInt(Typed.dereference(_value, this.type));\n // Check bounds are safe for encoding\n let maxUintValue = mask(BN_MAX_UINT256, WordSize * 8);\n if (this.signed) {\n let bounds = mask(maxUintValue, this.size * 8 - 1);\n if (value > bounds || value < -(bounds + BN_1)) {\n this._throwError(\"value out-of-bounds\", _value);\n }\n value = toTwos(value, 8 * WordSize);\n }\n else if (value < BN_0 || value > mask(maxUintValue, this.size * 8)) {\n this._throwError(\"value out-of-bounds\", _value);\n }\n return writer.writeValue(value);\n }\n decode(reader) {\n let value = mask(reader.readValue(), this.size * 8);\n if (this.signed) {\n value = fromTwos(value, this.size * 8);\n }\n return value;\n }\n}\n//# sourceMappingURL=number.js.map","import { toUtf8Bytes, toUtf8String } from \"../../utils/utf8.js\";\nimport { Typed } from \"../typed.js\";\nimport { DynamicBytesCoder } from \"./bytes.js\";\n/**\n * @_ignore\n */\nexport class StringCoder extends DynamicBytesCoder {\n constructor(localName) {\n super(\"string\", localName);\n }\n defaultValue() {\n return \"\";\n }\n encode(writer, _value) {\n return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, \"string\")));\n }\n decode(reader) {\n return toUtf8String(super.decode(reader));\n }\n}\n//# sourceMappingURL=string.js.map","import { defineProperties } from \"../../utils/properties.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\nimport { pack, unpack } from \"./array.js\";\n/**\n * @_ignore\n */\nexport class TupleCoder extends Coder {\n coders;\n constructor(coders, localName) {\n let dynamic = false;\n const types = [];\n coders.forEach((coder) => {\n if (coder.dynamic) {\n dynamic = true;\n }\n types.push(coder.type);\n });\n const type = \"tuple(\" + types.join(\",\") + \")\";\n super(\"tuple\", type, localName, dynamic);\n defineProperties(this, {\n coders: Object.freeze(coders.slice()),\n });\n }\n defaultValue() {\n const values = [];\n this.coders.forEach((coder) => {\n values.push(coder.defaultValue());\n });\n // We only output named properties for uniquely named coders\n const uniqueNames = this.coders.reduce((accum, coder) => {\n const name = coder.localName;\n if (name) {\n if (!accum[name]) {\n accum[name] = 0;\n }\n accum[name]++;\n }\n return accum;\n }, {});\n // Add named values\n this.coders.forEach((coder, index) => {\n let name = coder.localName;\n if (!name || uniqueNames[name] !== 1) {\n return;\n }\n if (name === \"length\") {\n name = \"_length\";\n }\n if (values[name] != null) {\n return;\n }\n values[name] = values[index];\n });\n return Object.freeze(values);\n }\n encode(writer, _value) {\n const value = Typed.dereference(_value, \"tuple\");\n return pack(writer, this.coders, value);\n }\n decode(reader) {\n return unpack(reader, this.coders);\n }\n}\n//# sourceMappingURL=tuple.js.map","import { keccak256 } from \"../crypto/keccak.js\";\nimport { sha256 } from \"../crypto/sha3.js\";\nimport { toUtf8Bytes } from \"../utils/index.js\";\n/**\n * A simple hashing function which operates on UTF-8 strings to\n * compute an 32-byte identifier.\n *\n *\n * @example:\n * id(\"hello world\")\n * //_result:\n */\nexport function id(value, useKeccak) {\n if (useKeccak) {\n return keccak256(toUtf8Bytes(value));\n }\n return sha256(toUtf8Bytes(value));\n}\n//# sourceMappingURL=id.js.map","/**\n * A constant for the zero address.\n *\n * (**i.e.** ``\"0x0000000000000000000000000000000000000000\"``)\n */\nexport const ZeroAddress = \"0x0000000000000000000000000000000000000000\";\n//# sourceMappingURL=addresses.js.map","/**\n * A constant for the zero hash.\n *\n * (**i.e.** ``\"0x0000000000000000000000000000000000000000000000000000000000000000\"``)\n */\nexport const ZeroHash = \"0x0000000000000000000000000000000000000000000000000000000000000000\";\n//# sourceMappingURL=hashes.js.map","/**\n * A constant for the order N for the secp256k1 curve.\n *\n * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``)\n */\nexport const N = BigInt(\"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\");\n/**\n * A constant for the number of ore in a single xcb.\n *\n * (**i.e.** ``1000000000000000000n``)\n */\nexport const OrePerXCB = BigInt(\"1000000000000000000\");\n/**\n * A constant for the maximum value for a ``uint256``.\n *\n * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)\n */\nexport const MaxUint256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n/**\n * A constant for the minimum value for an ``int256``.\n *\n * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``)\n */\nexport const MinInt256 = BigInt(\"0x8000000000000000000000000000000000000000000000000000000000000000\") *\n BigInt(-1);\n/**\n * A constant for the maximum value for an ``int256``.\n *\n * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)\n */\nexport const MaxInt256 = BigInt(\"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\nexport const NegativeOne = /*#__PURE__*/ BigInt(-1);\nexport const Zero = /*#__PURE__*/ BigInt(0);\nexport const One = /*#__PURE__*/ BigInt(1);\nexport const Two = /*#__PURE__*/ BigInt(2);\n//# sourceMappingURL=numbers.js.map","// NFKC (composed) // (decomposed)\n/**\n * A constant for the core symbol (normalized using NFKC).\n *\n * (**i.e.** ``\"\\\\u039e\"``)\n */\nexport const CoreSymbol = \"\\u039e\"; // \"\\uD835\\uDF63\";\n/**\n * A constant for the [[link-eip-191]] personal message prefix.\n *\n * (**i.e.** ``\"\\\\x19Core Signed Message:\\\\n\"``)\n */\nexport const MessagePrefix = \"\\x19Core Signed Message:\\n\";\n//# sourceMappingURL=strings.js.map","import { getAddress } from \"../address/index.js\";\nimport { assertArgument, isHexString } from \"../utils/index.js\";\nfunction accessSetify(addr, storageKeys) {\n return {\n address: getAddress(addr),\n storageKeys: storageKeys.map((storageKey, index) => {\n assertArgument(isHexString(storageKey, 32), \"invalid slot\", `storageKeys[${index}]`, storageKey);\n return storageKey.toLowerCase();\n }),\n };\n}\n/**\n * Returns a [[AccessList]] from any corebcsupported access-list structure.\n */\nexport function accessListify(value) {\n if (Array.isArray(value)) {\n return value.map((set, index) => {\n if (Array.isArray(set)) {\n assertArgument(set.length === 2, \"invalid slot set\", `value[${index}]`, set);\n return accessSetify(set[0], set[1]);\n }\n assertArgument(set != null && typeof set === \"object\", \"invalid address-slot set\", \"value\", value);\n return accessSetify(set.address, set.storageKeys);\n });\n }\n assertArgument(value != null && typeof value === \"object\", \"invalid access list\", \"value\", value);\n const result = Object.keys(value).map((addr) => {\n const storageKeys = value[addr].reduce((accum, storageKey) => {\n accum[storageKey] = true;\n return accum;\n }, {});\n return accessSetify(addr, Object.keys(storageKeys).sort());\n });\n result.sort((a, b) => a.address.localeCompare(b.address));\n return result;\n}\n//# sourceMappingURL=accesslist.js.map","import { getAddress } from \"../address/index.js\";\nimport { sha256, SigningKey } from \"../crypto/index.js\";\nimport { getBytes, getBigInt, getNumber, hexlify, assert, assertArgument, } from \"../utils/index.js\";\nimport { recoverAddress } from \"./address.js\";\nimport { checkProperties } from \"../utils/properties.js\";\nimport { arrayify, stripZeros } from \"../utils/data.js\";\nimport { Logger } from \"../logger/logger.js\";\nimport * as RLP from \"../crypto/rlp.js\";\nimport { BigNumber } from \"../bigNumber/bigNumber.js\";\nimport { networkIdToPrefix } from \"../address/index.js\";\nconst logger = new Logger(\"transaction/0.0.1\");\nconst BN_0 = BigInt(0);\nfunction handleAddress(value) {\n if (value === \"0x\") {\n return null;\n }\n return getAddress(value);\n}\nfunction parse(data) {\n const handleNumber = (value) => {\n // @ts-ignore\n if (value === \"0x\") {\n return BigNumber.from(0);\n }\n return BigNumber.from(value);\n };\n const transaction = RLP.decode(data);\n if (transaction.length !== 7 && transaction.length !== 8) {\n logger.throwArgumentError(\"invalid raw transaction\", \"data\", data);\n }\n const isSigned = transaction.length === 8;\n const tx = {\n nonce: Number(handleNumber(transaction[0])),\n energyPrice: handleNumber(transaction[1]).toBigInt(),\n energyLimit: handleNumber(transaction[2]).toBigInt(),\n networkId: handleNumber(transaction[isSigned ? 3 : 6]).toBigInt(),\n to: handleAddress(transaction[isSigned ? 4 : 3]),\n value: handleNumber(transaction[isSigned ? 5 : 4]).toBigInt(),\n data: transaction[isSigned ? 6 : 5],\n };\n if (transaction.length === 8) {\n const prefix = networkIdToPrefix(Number(tx.networkId));\n const digest = sha256(serialize(tx));\n tx.hash = sha256(serialize(tx, transaction[7]));\n tx.from = recoverAddress(digest, transaction[7], prefix);\n tx.signature = transaction[7];\n }\n return tx;\n}\nconst unsignedTransactionFields = [\n { name: \"nonce\", maxLength: 32, numeric: true },\n { name: \"energyPrice\", maxLength: 32, numeric: true },\n { name: \"energyLimit\", maxLength: 32, numeric: true },\n { name: \"to\", length: 22 },\n { name: \"value\", maxLength: 32, numeric: true },\n { name: \"data\" },\n { name: \"networkId\", maxLength: 32, numeric: true },\n];\nconst transactionFields = [\n { name: \"nonce\", maxLength: 32, numeric: true },\n { name: \"energyPrice\", maxLength: 32, numeric: true },\n { name: \"energyLimit\", maxLength: 32, numeric: true },\n { name: \"networkId\", maxLength: 32, numeric: true },\n { name: \"to\", length: 22 },\n { name: \"value\", maxLength: 32, numeric: true },\n { name: \"data\" },\n];\nconst allowedTransactionKeys = {\n networkId: true,\n data: true,\n energyLimit: true,\n energyPrice: true,\n nonce: true,\n to: true,\n value: true,\n};\nfunction serialize(transaction, signature) {\n checkProperties(transaction, allowedTransactionKeys);\n const raw = [];\n (!!signature ? transactionFields : unsignedTransactionFields).forEach(function ({ numeric, maxLength, name, length }) {\n let value = transaction[name] || [];\n const options = {};\n if (numeric) {\n options.hexPad = \"left\";\n }\n const tmpHexlified = hexlify(value, options);\n value = arrayify(tmpHexlified);\n // Fixed-width field\n if (length && value.length !== length && value.length > 0) {\n logger.throwArgumentError(\"invalid length for \" + name, \"transaction:\" + name, value);\n }\n // Variable-width (with a maximum)\n if (maxLength) {\n value = stripZeros(value);\n if (value.length > maxLength) {\n logger.throwArgumentError(\"invalid length for \" + name, \"transaction:\" + name, value);\n }\n }\n const hexlified = hexlify(value);\n raw.push(hexlified);\n });\n if (!!signature) {\n raw.push(hexlify(signature));\n }\n const finalValue = RLP.encode(raw);\n return finalValue;\n}\n/**\n * A **Transaction** describes an operation to be executed on\n * Core by an Externally Owned Account (EOA). It includes\n * who (the [[to]] address), what (the [[data]]) and how much (the\n * [[value]] in corebc) the operation should entail.\n *\n * @example:\n * tx = new Transaction()\n * //_result:\n *\n * tx.data = \"0x1234\";\n * //_result:\n */\nexport class Transaction {\n #to;\n #data;\n #nonce;\n #energyLimit;\n #energyPrice;\n #value;\n #networkId;\n #sig;\n /**\n * The ``to`` address for the transaction or ``null`` if the\n * transaction is an ``init`` transaction.\n */\n get to() {\n return this.#to;\n }\n set to(value) {\n this.#to = value == null ? null : getAddress(value);\n }\n /**\n * The transaction nonce.\n */\n get nonce() {\n return this.#nonce;\n }\n set nonce(value) {\n this.#nonce = getNumber(value, \"value\");\n }\n /**\n * The energy limit.\n */\n get energyLimit() {\n return this.#energyLimit;\n }\n set energyLimit(value) {\n this.#energyLimit = getBigInt(value);\n }\n /**\n * The energy price.\n *\n * On legacy networks this defines the fee that will be paid. On\n * EIP-1559 networks, this should be ``null``.\n */\n get energyPrice() {\n const value = this.#energyPrice;\n if (value == null) {\n return BN_0;\n }\n return value;\n }\n set energyPrice(value) {\n this.#energyPrice = value == null ? null : getBigInt(value, \"energyPrice\");\n }\n /**\n * The transaction data. For ``init`` transactions this is the\n * deployment code.\n */\n get data() {\n return this.#data;\n }\n set data(value) {\n this.#data = hexlify(value);\n }\n /**\n * The amount of xcb (in ore) to send in this transactions.\n */\n get value() {\n return this.#value;\n }\n set value(value) {\n this.#value = getBigInt(value, \"value\");\n }\n /**\n * The chain ID this transaction is valid on.\n */\n get networkId() {\n return this.#networkId;\n }\n set networkId(value) {\n this.#networkId = getBigInt(value);\n }\n /**\n * If signed, the signature for this transaction.\n */\n get signature() {\n return this.#sig || null;\n }\n set signature(value) {\n this.#sig = value == null ? null : value;\n }\n /**\n * Creates a new Transaction with default values.\n */\n constructor() {\n this.#to = null;\n this.#nonce = 0;\n this.#energyLimit = BigInt(0);\n this.#energyPrice = null;\n this.#data = \"0x\";\n this.#value = BigInt(0);\n this.#networkId = BigInt(0);\n this.#sig = null;\n }\n /**\n * The transaction hash, if signed. Otherwise, ``null``.\n */\n get hash() {\n if (this.signature == null) {\n return null;\n }\n return sha256(this.serialized);\n }\n /**\n * The pre-image hash of this transaction.\n *\n * This is the digest that a [[Signer]] must sign to authorize\n * this transaction.\n */\n get unsignedHash() {\n return sha256(this.unsignedSerialized);\n }\n /**\n * The sending address, if signed. Otherwise, ``null``.\n */\n get from() {\n if (this.signature == null) {\n return null;\n }\n const prefix = networkIdToPrefix(Number(this.#networkId));\n return recoverAddress(this.unsignedHash, this.signature, prefix);\n }\n /**\n * The public key of the sender, if signed. Otherwise, ``null``.\n */\n get fromPublicKey() {\n if (this.signature == null) {\n return null;\n }\n return SigningKey.recoverPublicKey(this.unsignedHash, this.signature);\n }\n /**\n * Returns true if signed.\n *\n * This provides a Type Guard that properties requiring a signed\n * transaction are non-null.\n */\n isSigned() {\n //isSigned(): this is SignedTransaction {\n return this.signature != null;\n }\n /**\n * The serialized transaction.\n *\n * This throws if the transaction is unsigned. For the pre-image,\n * use [[unsignedSerialized]].\n */\n get serialized() {\n assert(this.signature != null, \"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized\", \"UNSUPPORTED_OPERATION\", { operation: \".serialized\" });\n return serialize(this, this.signature);\n }\n /**\n * The transaction pre-image.\n *\n * The hash of this is the digest which needs to be signed to\n * authorize this transaction.\n */\n get unsignedSerialized() {\n return serialize(this);\n }\n /**\n * Create a copy of this transaciton.\n */\n clone() {\n return Transaction.from(this);\n }\n /**\n * Return a JSON-friendly object.\n */\n toJSON() {\n const s = (v) => {\n if (v == null) {\n return null;\n }\n return v.toString();\n };\n return {\n to: this.to,\n data: this.data,\n nonce: this.nonce,\n energyLimit: s(this.energyLimit),\n energyPrice: s(this.energyPrice),\n value: s(this.value),\n networkId: s(this.networkId),\n sig: this.signature ? this.signature : null,\n };\n }\n /**\n * Create a **Transaction** from a serialized transaction or a\n * Transaction-like object.\n */\n static from(tx) {\n if (tx == null) {\n return new Transaction();\n }\n if (typeof tx === \"string\") {\n const payload = getBytes(tx);\n return Transaction.from(parse(payload));\n }\n const result = new Transaction();\n if (tx.to != null) {\n result.to = tx.to;\n }\n if (tx.nonce != null) {\n result.nonce = tx.nonce;\n }\n if (tx.energyLimit != null) {\n result.energyLimit = tx.energyLimit;\n }\n if (tx.energyPrice != null) {\n result.energyPrice = tx.energyPrice;\n }\n if (tx.data != null) {\n result.data = tx.data;\n }\n if (tx.value != null) {\n result.value = tx.value;\n }\n if (tx.networkId != null) {\n result.networkId = tx.networkId;\n }\n if (tx.signature != null) {\n result.signature = tx.signature;\n }\n if (tx.hash != null) {\n assertArgument(result.isSigned(), \"unsigned transaction cannot define hash\", \"tx\", tx);\n assertArgument(result.hash === tx.hash, \"hash mismatch\", \"tx\", tx);\n }\n if (tx.from != null) {\n assertArgument(result.isSigned(), \"unsigned transaction cannot define from\", \"tx\", tx);\n assertArgument(result.from.toLowerCase() === (tx.from || \"\").toLowerCase(), \"from mismatch\", \"tx\", tx);\n }\n return result;\n }\n}\n//# sourceMappingURL=transaction.js.map","import { MessagePrefix } from \"../constants/index.js\";\nimport { recoverAddress } from \"../transaction/index.js\";\nimport { concat, toUtf8Bytes } from \"../utils/index.js\";\nimport { sha256 } from \"../crypto/index.js\";\n/**\n * Computes the [[link-eip-191]] personal-sign message digest to sign.\n *\n *\n * If %%message%% is a string, it is converted to its UTF-8 bytes\n * first. To compute the digest of a [[DataHexString]], it must be converted\n * to [bytes](getBytes).\n *\n * @example:\n * hashMessage(\"Hello World\")\n * //_result:\n *\n * // Hashes the SIX (6) string characters, i.e.\n * // [ \"0\", \"x\", \"4\", \"2\", \"4\", \"3\" ]\n * hashMessage(\"0x4243\")\n * //_result:\n *\n * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]...\n * hashMessage(getBytes(\"0x4243\"))\n * //_result:\n *\n * // ...which is equal to using data\n * hashMessage(new Uint8Array([ 0x42, 0x43 ]))\n * //_result:\n *\n */\nexport function hashMessage(message) {\n if (typeof message === \"string\") {\n message = toUtf8Bytes(message);\n }\n return sha256(concat([\n toUtf8Bytes(MessagePrefix),\n toUtf8Bytes(String(message.length)),\n message,\n ]));\n}\n/**\n * Return the address of the private key that produced\n * the signature %%sig%% during signing for %%message%%.\n */\nexport function verifyMessage(message, sig, prefix) {\n const digest = hashMessage(message);\n return recoverAddress(digest, sig, prefix);\n}\n//# sourceMappingURL=message.js.map","import { getAddress } from \"../address/index.js\";\nimport { sha256 as _sha256 } from \"../crypto/index.js\";\nimport { concat, dataLength, getBytes, hexlify, toBeArray, toTwos, toUtf8Bytes, zeroPadBytes, zeroPadValue, assertArgument, } from \"../utils/index.js\";\nconst regexBytes = new RegExp(\"^bytes([0-9]+)$\");\nconst regexNumber = new RegExp(\"^(u?int)([0-9]*)$\");\nconst regexArray = new RegExp(\"^(.*)\\\\[([0-9]*)\\\\]$\");\nfunction _pack(type, value, isArray) {\n switch (type) {\n case \"address\":\n if (isArray) {\n return getBytes(zeroPadValue(value, 32));\n }\n return getBytes(getAddress(value));\n case \"string\":\n return toUtf8Bytes(value);\n case \"bytes\":\n return getBytes(value);\n case \"bool\":\n value = !!value ? \"0x01\" : \"0x00\";\n if (isArray) {\n return getBytes(zeroPadValue(value, 32));\n }\n return getBytes(value);\n }\n let match = type.match(regexNumber);\n if (match) {\n let signed = match[1] === \"int\";\n let size = parseInt(match[2] || \"256\");\n assertArgument((!match[2] || match[2] === String(size)) &&\n size % 8 === 0 &&\n size !== 0 &&\n size <= 256, \"invalid number type\", \"type\", type);\n if (isArray) {\n size = 256;\n }\n if (signed) {\n value = toTwos(value, size);\n }\n return getBytes(zeroPadValue(toBeArray(value), size / 8));\n }\n match = type.match(regexBytes);\n if (match) {\n const size = parseInt(match[1]);\n assertArgument(String(size) === match[1] && size !== 0 && size <= 32, \"invalid bytes type\", \"type\", type);\n assertArgument(dataLength(value) === size, `invalid value for ${type}`, \"value\", value);\n if (isArray) {\n return getBytes(zeroPadBytes(value, 32));\n }\n return value;\n }\n match = type.match(regexArray);\n if (match && Array.isArray(value)) {\n const baseType = match[1];\n const count = parseInt(match[2] || String(value.length));\n assertArgument(count === value.length, `invalid array length for ${type}`, \"value\", value);\n const result = [];\n value.forEach(function (value) {\n result.push(_pack(baseType, value, true));\n });\n return getBytes(concat(result));\n }\n assertArgument(false, \"invalid type\", \"type\", type);\n}\n// @TODO: Array Enum\n/**\n * Computes the [[link-solc-packed]] representation of %%values%%\n * respectively to their %%types%%.\n *\n * @example:\n * addr = \"0x8ba1f109551bd432803012645ac136ddd64dba72\"\n * solidityPacked([ \"address\", \"uint\" ], [ addr, 45 ]);\n * //_result:\n */\nexport function solidityPacked(types, values) {\n assertArgument(types.length === values.length, \"wrong number of values; expected ${ types.length }\", \"values\", values);\n const tight = [];\n types.forEach(function (type, index) {\n tight.push(_pack(type, values[index]));\n });\n return hexlify(concat(tight));\n}\n/**\n * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%%\n * respectively to their %%types%%.\n *\n * @example:\n * addr = \"0x8ba1f109551bd432803012645ac136ddd64dba72\"\n * solidityPackedSha256([ \"address\", \"uint\" ], [ addr, 45 ]);\n * //_result:\n */\nexport function solidityPackedSha256(types, values) {\n return _sha256(solidityPacked(types, values));\n}\n//# sourceMappingURL=solidity.js.map","import { getAddress } from \"../address/index.js\";\nimport { recoverAddress } from \"../transaction/index.js\";\nimport { concat, defineProperties, getBigInt, getBytes, hexlify, isHexString, mask, toBeHex, toQuantity, toTwos, zeroPadValue, assertArgument, } from \"../utils/index.js\";\nimport { id } from \"./id.js\";\nimport { sha256 } from \"../crypto/index.js\";\nconst padding = new Uint8Array(32);\npadding.fill(0);\nconst BN__1 = BigInt(-1);\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_MAX_UINT256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\nfunction hexPadRight(value) {\n const bytes = getBytes(value);\n const padOffset = bytes.length % 32;\n if (padOffset) {\n return concat([bytes, padding.slice(padOffset)]);\n }\n return hexlify(bytes);\n}\nconst hexTrue = toBeHex(BN_1, 32);\nconst hexFalse = toBeHex(BN_0, 32);\nconst domainFieldTypes = {\n name: \"string\",\n version: \"string\",\n networkId: \"uint256\",\n verifyingContract: \"address\",\n salt: \"bytes32\",\n};\nconst domainFieldNames = [\n \"name\",\n \"version\",\n \"networkId\",\n \"verifyingContract\",\n \"salt\",\n];\nfunction checkString(key) {\n return function (value) {\n assertArgument(typeof value === \"string\", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value);\n return value;\n };\n}\nconst domainChecks = {\n name: checkString(\"name\"),\n version: checkString(\"version\"),\n networkId: function (_value) {\n const value = getBigInt(_value, \"domain.networkId\");\n assertArgument(value >= 0, \"invalid chain ID\", \"domain.networkId\", _value);\n if (Number.isSafeInteger(value)) {\n return Number(value);\n }\n return toQuantity(value);\n },\n verifyingContract: function (value) {\n try {\n return getAddress(value).toLowerCase();\n }\n catch (error) { }\n assertArgument(false, `invalid domain value \"verifyingContract\"`, \"domain.verifyingContract\", value);\n },\n salt: function (value) {\n const bytes = getBytes(value, \"domain.salt\");\n assertArgument(bytes.length === 32, `invalid domain value \"salt\"`, \"domain.salt\", value);\n return hexlify(bytes);\n },\n};\nfunction getBaseEncoder(type) {\n // intXX and uintXX\n {\n const match = type.match(/^(u?)int(\\d*)$/);\n if (match) {\n const signed = match[1] === \"\";\n const width = parseInt(match[2] || \"256\");\n assertArgument(width % 8 === 0 &&\n width !== 0 &&\n width <= 256 &&\n (match[2] == null || match[2] === String(width)), \"invalid numeric width\", \"type\", type);\n const boundsUpper = mask(BN_MAX_UINT256, signed ? width - 1 : width);\n const boundsLower = signed ? (boundsUpper + BN_1) * BN__1 : BN_0;\n return function (_value) {\n const value = getBigInt(_value, \"value\");\n assertArgument(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, \"value\", value);\n return toBeHex(signed ? toTwos(value, 256) : value, 32);\n };\n }\n }\n // bytesXX\n {\n const match = type.match(/^bytes(\\d+)$/);\n if (match) {\n const width = parseInt(match[1]);\n assertArgument(width !== 0 && width <= 32 && match[1] === String(width), \"invalid bytes width\", \"type\", type);\n return function (value) {\n const bytes = getBytes(value);\n assertArgument(bytes.length === width, `invalid length for ${type}`, \"value\", value);\n return hexPadRight(value);\n };\n }\n }\n switch (type) {\n case \"address\":\n return function (value) {\n return zeroPadValue(getAddress(value), 32);\n };\n case \"bool\":\n return function (value) {\n return !value ? hexFalse : hexTrue;\n };\n case \"bytes\":\n return function (value) {\n return sha256(value);\n };\n case \"string\":\n return function (value) {\n return id(value);\n };\n }\n return null;\n}\nfunction encodeType(name, fields) {\n return `${name}(${fields\n .map(({ name, type }) => type + \" \" + name)\n .join(\",\")})`;\n}\nexport class TypedDataEncoder {\n primaryType;\n #types;\n get types() {\n return JSON.parse(this.#types);\n }\n #fullTypes;\n #encoderCache;\n constructor(types) {\n this.#types = JSON.stringify(types);\n this.#fullTypes = new Map();\n this.#encoderCache = new Map();\n // Link struct types to their direct child structs\n const links = new Map();\n // Link structs to structs which contain them as a child\n const parents = new Map();\n // Link all subtypes within a given struct\n const subtypes = new Map();\n Object.keys(types).forEach((type) => {\n links.set(type, new Set());\n parents.set(type, []);\n subtypes.set(type, new Set());\n });\n for (const name in types) {\n const uniqueNames = new Set();\n for (const field of types[name]) {\n // Check each field has a unique name\n assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, \"types\", types);\n uniqueNames.add(field.name);\n // Get the base type (drop any array specifiers)\n const baseType = field.type.match(/^([^\\x5b]*)(\\x5b|$)/)[1] || null;\n assertArgument(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, \"types\", types);\n // Is this a base encoding type?\n const encoder = getBaseEncoder(baseType);\n if (encoder) {\n continue;\n }\n assertArgument(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, \"types\", types);\n // Add linkage\n parents.get(baseType).push(name);\n links.get(name).add(baseType);\n }\n }\n // Deduce the primary type\n const primaryTypes = Array.from(parents.keys()).filter((n) => parents.get(n).length === 0);\n assertArgument(primaryTypes.length !== 0, \"missing primary type\", \"types\", types);\n assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes\n .map((t) => JSON.stringify(t))\n .join(\", \")}`, \"types\", types);\n defineProperties(this, { primaryType: primaryTypes[0] });\n // Check for circular type references\n function checkCircular(type, found) {\n assertArgument(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, \"types\", types);\n found.add(type);\n for (const child of links.get(type)) {\n if (!parents.has(child)) {\n continue;\n }\n // Recursively check children\n checkCircular(child, found);\n // Mark all ancestors as having this decendant\n for (const subtype of found) {\n subtypes.get(subtype).add(child);\n }\n }\n found.delete(type);\n }\n checkCircular(this.primaryType, new Set());\n // Compute each fully describe type\n for (const [name, set] of subtypes) {\n const st = Array.from(set);\n st.sort();\n this.#fullTypes.set(name, encodeType(name, types[name]) +\n st.map((t) => encodeType(t, types[t])).join(\"\"));\n }\n }\n getEncoder(type) {\n let encoder = this.#encoderCache.get(type);\n if (!encoder) {\n encoder = this.#getEncoder(type);\n this.#encoderCache.set(type, encoder);\n }\n return encoder;\n }\n #getEncoder(type) {\n // Basic encoder type (address, bool, uint256, etc)\n {\n const encoder = getBaseEncoder(type);\n if (encoder) {\n return encoder;\n }\n }\n // Array\n const match = type.match(/^(.*)(\\x5b(\\d*)\\x5d)$/);\n if (match) {\n const subtype = match[1];\n const subEncoder = this.getEncoder(subtype);\n return (value) => {\n assertArgument(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, \"value\", value);\n let result = value.map(subEncoder);\n if (this.#fullTypes.has(subtype)) {\n result = result.map(sha256);\n }\n return sha256(concat(result));\n };\n }\n // Struct\n const fields = this.types[type];\n if (fields) {\n const encodedType = id(this.#fullTypes.get(type));\n return (value) => {\n const values = fields.map(({ name, type }) => {\n const result = this.getEncoder(type)(value[name]);\n if (this.#fullTypes.has(type)) {\n return sha256(result);\n }\n return result;\n });\n values.unshift(encodedType);\n return concat(values);\n };\n }\n assertArgument(false, `unknown type: ${type}`, \"type\", type);\n }\n encodeType(name) {\n const result = this.#fullTypes.get(name);\n assertArgument(result, `unknown type: ${JSON.stringify(name)}`, \"name\", name);\n return result;\n }\n encodeData(type, value) {\n return this.getEncoder(type)(value);\n }\n hashStruct(name, value) {\n return sha256(this.encodeData(name, value));\n }\n encode(value) {\n return this.encodeData(this.primaryType, value);\n }\n hash(value) {\n return this.hashStruct(this.primaryType, value);\n }\n _visit(type, value, callback) {\n // Basic encoder type (address, bool, uint256, etc)\n {\n const encoder = getBaseEncoder(type);\n if (encoder) {\n return callback(type, value);\n }\n }\n // Array\n const match = type.match(/^(.*)(\\x5b(\\d*)\\x5d)$/);\n if (match) {\n assertArgument(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, \"value\", value);\n return value.map((v) => this._visit(match[1], v, callback));\n }\n // Struct\n const fields = this.types[type];\n if (fields) {\n return fields.reduce((accum, { name, type }) => {\n accum[name] = this._visit(type, value[name], callback);\n return accum;\n }, {});\n }\n assertArgument(false, `unknown type: ${type}`, \"type\", type);\n }\n visit(value, callback) {\n return this._visit(this.primaryType, value, callback);\n }\n static from(types) {\n return new TypedDataEncoder(types);\n }\n static getPrimaryType(types) {\n return TypedDataEncoder.from(types).primaryType;\n }\n static hashStruct(name, types, value) {\n return TypedDataEncoder.from(types).hashStruct(name, value);\n }\n static hashDomain(domain) {\n const domainFields = [];\n for (const name in domain) {\n if (domain[name] == null) {\n continue;\n }\n const type = domainFieldTypes[name];\n assertArgument(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, \"domain\", domain);\n domainFields.push({ name, type });\n }\n domainFields.sort((a, b) => {\n return (domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name));\n });\n return TypedDataEncoder.hashStruct(\"EIP712Domain\", { EIP712Domain: domainFields }, domain);\n }\n static encode(domain, types, value) {\n return concat([\n \"0x1901\",\n TypedDataEncoder.hashDomain(domain),\n TypedDataEncoder.from(types).hash(value),\n ]);\n }\n static hash(domain, types, value) {\n return sha256(TypedDataEncoder.encode(domain, types, value));\n }\n // Replaces all address types with ENS names with their looked up address\n static async resolveNames(domain, types, value, resolveName) {\n // Make a copy to isolate it from the object passed in\n domain = Object.assign({}, domain);\n // Allow passing null to ignore value\n for (const key in domain) {\n if (domain[key] == null) {\n delete domain[key];\n }\n }\n // Look up all ENS names\n const ensCache = {};\n // Do we need to look up the domain's verifyingContract?\n if (domain.verifyingContract &&\n !isHexString(domain.verifyingContract, 20)) {\n ensCache[domain.verifyingContract] = \"0x\";\n }\n // We are going to use the encoder to visit all the base values\n const encoder = TypedDataEncoder.from(types);\n // Get a list of all the addresses\n encoder.visit(value, (type, value) => {\n if (type === \"address\" && !isHexString(value, 20)) {\n ensCache[value] = \"0x\";\n }\n return value;\n });\n // Lookup each name\n for (const name in ensCache) {\n ensCache[name] = await resolveName(name);\n }\n // Replace the domain verifyingContract if needed\n if (domain.verifyingContract && ensCache[domain.verifyingContract]) {\n domain.verifyingContract = ensCache[domain.verifyingContract];\n }\n // Replace all ENS names with their address\n value = encoder.visit(value, (type, value) => {\n if (type === \"address\" && ensCache[value]) {\n return ensCache[value];\n }\n return value;\n });\n return { domain, value };\n }\n static getPayload(domain, types, value) {\n // Validate the domain fields\n TypedDataEncoder.hashDomain(domain);\n // Derive the EIP712Domain Struct reference type\n const domainValues = {};\n const domainTypes = [];\n domainFieldNames.forEach((name) => {\n const value = domain[name];\n if (value == null) {\n return;\n }\n domainValues[name] = domainChecks[name](value);\n domainTypes.push({ name, type: domainFieldTypes[name] });\n });\n const encoder = TypedDataEncoder.from(types);\n const typesWithDomain = Object.assign({}, types);\n assertArgument(typesWithDomain.EIP712Domain == null, \"types must not contain EIP712Domain type\", \"types.EIP712Domain\", types);\n typesWithDomain.EIP712Domain = domainTypes;\n // Validate the data structures and types\n encoder.encode(value);\n return {\n types: typesWithDomain,\n domain: domainValues,\n primaryType: encoder.primaryType,\n message: encoder.visit(value, (type, value) => {\n // bytes\n if (type.match(/^bytes(\\d*)/)) {\n return hexlify(getBytes(value));\n }\n // uint or int\n if (type.match(/^u?int/)) {\n return getBigInt(value).toString();\n }\n switch (type) {\n case \"address\":\n return value.toLowerCase();\n case \"bool\":\n return !!value;\n case \"string\":\n assertArgument(typeof value === \"string\", \"invalid string\", \"value\", value);\n return value;\n }\n assertArgument(false, \"unsupported type\", \"type\", type);\n }),\n };\n }\n}\n/**\n * Compute the address used to sign the typed data for the %%signature%%.\n */\nexport function verifyTypedData(domain, types, value, signature, prefix) {\n return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature, prefix);\n}\n//# sourceMappingURL=typed-data.js.map","/**\n * About frgaments...\n *\n * @_subsection api/abi/abi-coder:Fragments [about-fragments]\n */\nvar _a;\nimport { defineProperties, getBigInt, getNumber, assert, assertPrivate, assertArgument, } from \"../utils/index.js\";\nimport { id } from \"../hash/index.js\";\n// [ \"a\", \"b\" ] => { \"a\": 1, \"b\": 1 }\nfunction setify(items) {\n const result = new Set();\n items.forEach((k) => result.add(k));\n return Object.freeze(result);\n}\n// Visibility Keywords\nconst _kwVisib = \"constant external internal payable private public pure view\";\nconst KwVisib = setify(_kwVisib.split(\" \"));\nconst _kwTypes = \"constructor error event fallback function receive struct\";\nconst KwTypes = setify(_kwTypes.split(\" \"));\nconst _kwModifiers = \"calldata memory storage payable indexed\";\nconst KwModifiers = setify(_kwModifiers.split(\" \"));\nconst _kwOther = \"tuple returns\";\n// All Keywords\nconst _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(\" \");\nconst Keywords = setify(_keywords.split(\" \"));\n// Single character tokens\nconst SimpleTokens = {\n \"(\": \"OPEN_PAREN\",\n \")\": \"CLOSE_PAREN\",\n \"[\": \"OPEN_BRACKET\",\n \"]\": \"CLOSE_BRACKET\",\n \",\": \"COMMA\",\n \"@\": \"AT\",\n};\n// Parser regexes to consume the next token\nconst regexWhitespacePrefix = new RegExp(\"^(\\\\s*)\");\nconst regexNumberPrefix = new RegExp(\"^([0-9]+)\");\nconst regexIdPrefix = new RegExp(\"^([a-zA-Z$_][a-zA-Z0-9$_]*)\");\n// Parser regexs to check validity\nconst regexId = new RegExp(\"^([a-zA-Z$_][a-zA-Z0-9$_]*)$\");\nconst regexType = new RegExp(\"^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$\");\nclass TokenString {\n #offset;\n #tokens;\n get offset() {\n return this.#offset;\n }\n get length() {\n return this.#tokens.length - this.#offset;\n }\n constructor(tokens) {\n this.#offset = 0;\n this.#tokens = tokens.slice();\n }\n clone() {\n return new _a(this.#tokens);\n }\n reset() {\n this.#offset = 0;\n }\n #subTokenString(from = 0, to = 0) {\n return new _a(this.#tokens.slice(from, to).map((t) => {\n return Object.freeze(Object.assign({}, t, {\n match: t.match - from,\n linkBack: t.linkBack - from,\n linkNext: t.linkNext - from,\n }));\n }));\n }\n // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens\n popKeyword(allowed) {\n const top = this.peek();\n if (top.type !== \"KEYWORD\" || !allowed.has(top.text)) {\n throw new Error(`expected keyword ${top.text}`);\n }\n return this.pop().text;\n }\n // Pops and returns the value of the next token if it is `type`; throws if out of tokens\n popType(type) {\n if (this.peek().type !== type) {\n throw new Error(`expected ${type}; got ${JSON.stringify(this.peek())}`);\n }\n return this.pop().text;\n }\n // Pops and returns a \"(\" TOKENS \")\"\n popParen() {\n const top = this.peek();\n if (top.type !== \"OPEN_PAREN\") {\n throw new Error(\"bad start\");\n }\n const result = this.#subTokenString(this.#offset + 1, top.match + 1);\n this.#offset = top.match + 1;\n return result;\n }\n // Pops and returns the items within \"(\" ITEM1 \",\" ITEM2 \",\" ... \")\"\n popParams() {\n const top = this.peek();\n if (top.type !== \"OPEN_PAREN\") {\n throw new Error(\"bad start\");\n }\n const result = [];\n while (this.#offset < top.match - 1) {\n const link = this.peek().linkNext;\n result.push(this.#subTokenString(this.#offset + 1, link));\n this.#offset = link;\n }\n this.#offset = top.match + 1;\n return result;\n }\n // Returns the top Token, throwing if out of tokens\n peek() {\n if (this.#offset >= this.#tokens.length) {\n throw new Error(\"out-of-bounds\");\n }\n return this.#tokens[this.#offset];\n }\n // Returns the next value, if it is a keyword in `allowed`\n peekKeyword(allowed) {\n const top = this.peekType(\"KEYWORD\");\n return top != null && allowed.has(top) ? top : null;\n }\n // Returns the value of the next token if it is `type`\n peekType(type) {\n if (this.length === 0) {\n return null;\n }\n const top = this.peek();\n return top.type === type ? top.text : null;\n }\n // Returns the next token; throws if out of tokens\n pop() {\n const result = this.peek();\n this.#offset++;\n return result;\n }\n toString() {\n const tokens = [];\n for (let i = this.#offset; i < this.#tokens.length; i++) {\n const token = this.#tokens[i];\n tokens.push(`${token.type}:${token.text}`);\n }\n return ``;\n }\n}\n_a = TokenString;\nfunction lex(text) {\n const tokens = [];\n const throwError = (message) => {\n const token = offset < text.length ? JSON.stringify(text[offset]) : \"$EOI\";\n throw new Error(`invalid token ${token} at ${offset}: ${message}`);\n };\n let brackets = [];\n let commas = [];\n let offset = 0;\n while (offset < text.length) {\n // Strip off any leading whitespace\n let cur = text.substring(offset);\n let match = cur.match(regexWhitespacePrefix);\n if (match) {\n offset += match[1].length;\n cur = text.substring(offset);\n }\n const token = {\n depth: brackets.length,\n linkBack: -1,\n linkNext: -1,\n match: -1,\n type: \"\",\n text: \"\",\n offset,\n value: -1,\n };\n tokens.push(token);\n let type = SimpleTokens[cur[0]] || \"\";\n if (type) {\n token.type = type;\n token.text = cur[0];\n offset++;\n if (type === \"OPEN_PAREN\") {\n brackets.push(tokens.length - 1);\n commas.push(tokens.length - 1);\n }\n else if (type == \"CLOSE_PAREN\") {\n if (brackets.length === 0) {\n throwError(\"no matching open bracket\");\n }\n token.match = brackets.pop();\n tokens[token.match].match = tokens.length - 1;\n token.depth--;\n token.linkBack = commas.pop();\n tokens[token.linkBack].linkNext = tokens.length - 1;\n }\n else if (type === \"COMMA\") {\n token.linkBack = commas.pop();\n tokens[token.linkBack].linkNext = tokens.length - 1;\n commas.push(tokens.length - 1);\n }\n else if (type === \"OPEN_BRACKET\") {\n token.type = \"BRACKET\";\n }\n else if (type === \"CLOSE_BRACKET\") {\n // Remove the CLOSE_BRACKET\n let suffix = tokens.pop().text;\n if (tokens.length > 0 && tokens[tokens.length - 1].type === \"NUMBER\") {\n const value = tokens.pop().text;\n suffix = value + suffix;\n tokens[tokens.length - 1].value =\n getNumber(value);\n }\n if (tokens.length === 0 ||\n tokens[tokens.length - 1].type !== \"BRACKET\") {\n throw new Error(\"missing opening bracket\");\n }\n tokens[tokens.length - 1].text += suffix;\n }\n continue;\n }\n match = cur.match(regexIdPrefix);\n if (match) {\n token.text = match[1];\n offset += token.text.length;\n if (Keywords.has(token.text)) {\n token.type = \"KEYWORD\";\n continue;\n }\n if (token.text.match(regexType)) {\n token.type = \"TYPE\";\n continue;\n }\n token.type = \"ID\";\n continue;\n }\n match = cur.match(regexNumberPrefix);\n if (match) {\n token.text = match[1];\n token.type = \"NUMBER\";\n offset += token.text.length;\n continue;\n }\n throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`);\n }\n return new TokenString(tokens.map((t) => Object.freeze(t)));\n}\n// Check only one of `allowed` is in `set`\nfunction allowSingle(set, allowed) {\n let included = [];\n for (const key in allowed.keys()) {\n if (set.has(key)) {\n included.push(key);\n }\n }\n if (included.length > 1) {\n throw new Error(`conflicting types: ${included.join(\", \")}`);\n }\n}\n// Functions to process a Solidity Signature TokenString from left-to-right for...\n// ...the name with an optional type, returning the name\nfunction consumeName(type, tokens) {\n if (tokens.peekKeyword(KwTypes)) {\n const keyword = tokens.pop().text;\n if (keyword !== type) {\n throw new Error(`expected ${type}, got ${keyword}`);\n }\n }\n return tokens.popType(\"ID\");\n}\n// ...all keywords matching allowed, returning the keywords\nfunction consumeKeywords(tokens, allowed) {\n const keywords = new Set();\n while (true) {\n const keyword = tokens.peekType(\"KEYWORD\");\n if (keyword == null || (allowed && !allowed.has(keyword))) {\n break;\n }\n tokens.pop();\n if (keywords.has(keyword)) {\n throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`);\n }\n keywords.add(keyword);\n }\n return Object.freeze(keywords);\n}\n// ...all visibility keywords, returning the coalesced mutability\nfunction consumeMutability(tokens) {\n let modifiers = consumeKeywords(tokens, KwVisib);\n // Detect conflicting modifiers\n allowSingle(modifiers, setify(\"constant payable nonpayable\".split(\" \")));\n allowSingle(modifiers, setify(\"pure view payable nonpayable\".split(\" \")));\n // Process mutability states\n if (modifiers.has(\"view\")) {\n return \"view\";\n }\n if (modifiers.has(\"pure\")) {\n return \"pure\";\n }\n if (modifiers.has(\"payable\")) {\n return \"payable\";\n }\n if (modifiers.has(\"nonpayable\")) {\n return \"nonpayable\";\n }\n // Process legacy `constant` last\n if (modifiers.has(\"constant\")) {\n return \"view\";\n }\n return \"nonpayable\";\n}\n// ...a parameter list, returning the ParamType list\nfunction consumeParams(tokens, allowIndexed) {\n return tokens.popParams().map((t) => ParamType.from(t, allowIndexed));\n}\n// ...a energy limit, returning a BigNumber or null if none\nfunction consumeEnergy(tokens) {\n if (tokens.peekType(\"AT\")) {\n tokens.pop();\n if (tokens.peekType(\"NUMBER\")) {\n return getBigInt(tokens.pop().text);\n }\n throw new Error(\"invalid energy\");\n }\n return null;\n}\nfunction consumeEoi(tokens) {\n if (tokens.length) {\n throw new Error(`unexpected tokens: ${tokens.toString()}`);\n }\n}\nconst regexArrayType = new RegExp(/^(.*)\\[([0-9]*)\\]$/);\nfunction verifyBasicType(type) {\n const match = type.match(regexType);\n assertArgument(match, \"invalid type\", \"type\", type);\n if (type === \"uint\") {\n return \"uint256\";\n }\n if (type === \"int\") {\n return \"int256\";\n }\n if (match[2]) {\n // bytesXX\n const length = parseInt(match[2]);\n assertArgument(length !== 0 && length <= 32, \"invalid bytes length\", \"type\", type);\n }\n else if (match[3]) {\n // intXX or uintXX\n const size = parseInt(match[3]);\n assertArgument(size !== 0 && size <= 256 && size % 8 === 0, \"invalid numeric width\", \"type\", type);\n }\n return type;\n}\n// Make the Fragment constructors effectively private\nconst _guard = {};\nconst internal = Symbol.for(\"_corebc_internal\");\nconst ParamTypeInternal = \"_ParamTypeInternal\";\nconst ErrorFragmentInternal = \"_ErrorInternal\";\nconst EventFragmentInternal = \"_EventInternal\";\nconst ConstructorFragmentInternal = \"_ConstructorInternal\";\nconst FallbackFragmentInternal = \"_FallbackInternal\";\nconst FunctionFragmentInternal = \"_FunctionInternal\";\nconst StructFragmentInternal = \"_StructInternal\";\n/**\n * Each input and output of a [[Fragment]] is an Array of **PAramType**.\n */\nexport class ParamType {\n /**\n * The local name of the parameter (or ``\"\"`` if unbound)\n */\n name;\n /**\n * The fully qualified type (e.g. ``\"address\"``, ``\"tuple(address)\"``,\n * ``\"uint256[3][]\"``)\n */\n type;\n /**\n * The base type (e.g. ``\"address\"``, ``\"tuple\"``, ``\"array\"``)\n */\n baseType;\n /**\n * True if the parameters is indexed.\n *\n * For non-indexable types this is ``null``.\n */\n indexed;\n /**\n * The components for the tuple.\n *\n * For non-tuple types this is ``null``.\n */\n components;\n /**\n * The array length, or ``-1`` for dynamic-lengthed arrays.\n *\n * For non-array types this is ``null``.\n */\n arrayLength;\n /**\n * The type of each child in the array.\n *\n * For non-array types this is ``null``.\n */\n arrayChildren;\n /**\n * @private\n */\n constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) {\n assertPrivate(guard, _guard, \"ParamType\");\n Object.defineProperty(this, internal, { value: ParamTypeInternal });\n if (components) {\n components = Object.freeze(components.slice());\n }\n if (baseType === \"array\") {\n if (arrayLength == null || arrayChildren == null) {\n throw new Error(\"\");\n }\n }\n else if (arrayLength != null || arrayChildren != null) {\n throw new Error(\"\");\n }\n if (baseType === \"tuple\") {\n if (components == null) {\n throw new Error(\"\");\n }\n }\n else if (components != null) {\n throw new Error(\"\");\n }\n defineProperties(this, {\n name,\n type,\n baseType,\n indexed,\n components,\n arrayLength,\n arrayChildren,\n });\n }\n /**\n * Return a string representation of this type.\n *\n * For example,\n *\n * ``sighash\" => \"(uint256,address)\"``\n *\n * ``\"minimal\" => \"tuple(uint256,address) indexed\"``\n *\n * ``\"full\" => \"tuple(uint256 foo, address bar) indexed baz\"``\n */\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n let result = {\n type: this.baseType === \"tuple\" ? \"tuple\" : this.type,\n name: this.name || undefined,\n };\n if (typeof this.indexed === \"boolean\") {\n result.indexed = this.indexed;\n }\n if (this.isTuple()) {\n result.components = this.components.map((c) => JSON.parse(c.format(format)));\n }\n return JSON.stringify(result);\n }\n let result = \"\";\n // Array\n if (this.isArray()) {\n result += this.arrayChildren.format(format);\n result += `[${this.arrayLength < 0 ? \"\" : String(this.arrayLength)}]`;\n }\n else {\n if (this.isTuple()) {\n if (format !== \"sighash\") {\n result += this.type;\n }\n result +=\n \"(\" +\n this.components\n .map((comp) => comp.format(format))\n .join(format === \"full\" ? \", \" : \",\") +\n \")\";\n }\n else {\n result += this.type;\n }\n }\n if (format !== \"sighash\") {\n if (this.indexed === true) {\n result += \" indexed\";\n }\n if (format === \"full\" && this.name) {\n result += \" \" + this.name;\n }\n }\n return result;\n }\n /*\n * Returns true if %%value%% is an Array type.\n *\n * This provides a type gaurd ensuring that the\n * [[arrayChildren]] and [[arrayLength]] are non-null.\n */\n //static isArray(value: any): value is { arrayChildren: ParamType, arrayLength: number } {\n // return value && (value.baseType === \"array\")\n //}\n /**\n * Returns true if %%this%% is an Array type.\n *\n * This provides a type gaurd ensuring that [[arrayChildren]]\n * and [[arrayLength]] are non-null.\n */\n isArray() {\n return this.baseType === \"array\";\n }\n /**\n * Returns true if %%this%% is a Tuple type.\n *\n * This provides a type gaurd ensuring that [[components]]\n * is non-null.\n */\n isTuple() {\n return this.baseType === \"tuple\";\n }\n /**\n * Returns true if %%this%% is an Indexable type.\n *\n * This provides a type gaurd ensuring that [[indexed]]\n * is non-null.\n */\n isIndexable() {\n return this.indexed != null;\n }\n /**\n * Walks the **ParamType** with %%value%%, calling %%process%%\n * on each type, destructing the %%value%% recursively.\n */\n walk(value, process) {\n if (this.isArray()) {\n if (!Array.isArray(value)) {\n throw new Error(\"invalid array value\");\n }\n if (this.arrayLength !== -1 && value.length !== this.arrayLength) {\n throw new Error(\"array is wrong length\");\n }\n const _this = this;\n return value.map((v) => _this.arrayChildren.walk(v, process));\n }\n if (this.isTuple()) {\n if (!Array.isArray(value)) {\n throw new Error(\"invalid tuple value\");\n }\n if (value.length !== this.components.length) {\n throw new Error(\"array is wrong length\");\n }\n const _this = this;\n return value.map((v, i) => _this.components[i].walk(v, process));\n }\n return process(this.type, value);\n }\n #walkAsync(promises, value, process, setValue) {\n if (this.isArray()) {\n if (!Array.isArray(value)) {\n throw new Error(\"invalid array value\");\n }\n if (this.arrayLength !== -1 && value.length !== this.arrayLength) {\n throw new Error(\"array is wrong length\");\n }\n const childType = this.arrayChildren;\n const result = value.slice();\n result.forEach((value, index) => {\n childType.#walkAsync(promises, value, process, (value) => {\n result[index] = value;\n });\n });\n setValue(result);\n return;\n }\n if (this.isTuple()) {\n const components = this.components;\n // Convert the object into an array\n let result;\n if (Array.isArray(value)) {\n result = value.slice();\n }\n else {\n if (value == null || typeof value !== \"object\") {\n throw new Error(\"invalid tuple value\");\n }\n result = components.map((param) => {\n if (!param.name) {\n throw new Error(\"cannot use object value with unnamed components\");\n }\n if (!(param.name in value)) {\n throw new Error(`missing value for component ${param.name}`);\n }\n return value[param.name];\n });\n }\n if (result.length !== this.components.length) {\n throw new Error(\"array is wrong length\");\n }\n result.forEach((value, index) => {\n components[index].#walkAsync(promises, value, process, (value) => {\n result[index] = value;\n });\n });\n setValue(result);\n return;\n }\n const result = process(this.type, value);\n if (result.then) {\n promises.push((async function () {\n setValue(await result);\n })());\n }\n else {\n setValue(result);\n }\n }\n /**\n * Walks the **ParamType** with %%value%%, asynchronously calling\n * %%process%% on each type, destructing the %%value%% recursively.\n *\n * This can be used to resolve ENS naes by walking and resolving each\n * ``\"address\"`` type.\n */\n async walkAsync(value, process) {\n const promises = [];\n const result = [value];\n this.#walkAsync(promises, value, process, (value) => {\n result[0] = value;\n });\n if (promises.length) {\n await Promise.all(promises);\n }\n return result[0];\n }\n /**\n * Creates a new **ParamType** for %%obj%%.\n *\n * If %%allowIndexed%% then the ``indexed`` keyword is permitted,\n * otherwise the ``indexed`` keyword will throw an error.\n */\n static from(obj, allowIndexed) {\n if (ParamType.isParamType(obj)) {\n return obj;\n }\n if (typeof obj === \"string\") {\n return ParamType.from(lex(obj), allowIndexed);\n }\n else if (obj instanceof TokenString) {\n let type = \"\", baseType = \"\";\n let comps = null;\n if (consumeKeywords(obj, setify([\"tuple\"])).has(\"tuple\") ||\n obj.peekType(\"OPEN_PAREN\")) {\n // Tuple\n baseType = \"tuple\";\n comps = obj.popParams().map((t) => ParamType.from(t));\n type = `tuple(${comps.map((c) => c.format()).join(\",\")})`;\n }\n else {\n // Normal\n type = verifyBasicType(obj.popType(\"TYPE\"));\n baseType = type;\n }\n // Check for Array\n let arrayChildren = null;\n let arrayLength = null;\n while (obj.length && obj.peekType(\"BRACKET\")) {\n const bracket = obj.pop(); //arrays[i];\n arrayChildren = new ParamType(_guard, \"\", type, baseType, null, comps, arrayLength, arrayChildren);\n arrayLength = bracket.value;\n type += bracket.text;\n baseType = \"array\";\n comps = null;\n }\n let indexed = null;\n const keywords = consumeKeywords(obj, KwModifiers);\n if (keywords.has(\"indexed\")) {\n if (!allowIndexed) {\n throw new Error(\"\");\n }\n indexed = true;\n }\n const name = obj.peekType(\"ID\") ? obj.pop().text : \"\";\n if (obj.length) {\n throw new Error(\"leftover tokens\");\n }\n return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren);\n }\n const name = obj.name;\n assertArgument(!name || (typeof name === \"string\" && name.match(regexId)), \"invalid name\", \"obj.name\", name);\n let indexed = obj.indexed;\n if (indexed != null) {\n assertArgument(allowIndexed, \"parameter cannot be indexed\", \"obj.indexed\", obj.indexed);\n indexed = !!indexed;\n }\n let type = obj.type;\n let arrayMatch = type.match(regexArrayType);\n if (arrayMatch) {\n const arrayLength = parseInt(arrayMatch[2] || \"-1\");\n const arrayChildren = ParamType.from({\n type: arrayMatch[1],\n components: obj.components,\n });\n return new ParamType(_guard, name || \"\", type, \"array\", indexed, null, arrayLength, arrayChildren);\n }\n if (type === \"tuple\" ||\n type.startsWith(\"tuple(\" /* fix: ) */) ||\n type.startsWith(\"(\" /* fix: ) */)) {\n const comps = obj.components != null\n ? obj.components.map((c) => ParamType.from(c))\n : null;\n const tuple = new ParamType(_guard, name || \"\", type, \"tuple\", indexed, comps, null, null);\n // @TODO: use lexer to validate and normalize type\n return tuple;\n }\n type = verifyBasicType(obj.type);\n return new ParamType(_guard, name || \"\", type, type, indexed, null, null, null);\n }\n /**\n * Returns true if %%value%% is a **ParamType**.\n */\n static isParamType(value) {\n return value && value[internal] === ParamTypeInternal;\n }\n}\n/**\n * An abstract class to represent An individual fragment from a parse ABI.\n */\nexport class Fragment {\n /**\n * The type of the fragment.\n */\n type;\n /**\n * The inputs for the fragment.\n */\n inputs;\n /**\n * @private\n */\n constructor(guard, type, inputs) {\n assertPrivate(guard, _guard, \"Fragment\");\n inputs = Object.freeze(inputs.slice());\n defineProperties(this, { type, inputs });\n }\n /**\n * Creates a new **Fragment** for %%obj%%, wich can be any supported\n * ABI frgament type.\n */\n static from(obj) {\n if (typeof obj === \"string\") {\n // Try parsing JSON...\n try {\n Fragment.from(JSON.parse(obj));\n }\n catch (e) { }\n // ...otherwise, use the human-readable lexer\n return Fragment.from(lex(obj));\n }\n if (obj instanceof TokenString) {\n // Human-readable ABI (already lexed)\n const type = obj.peekKeyword(KwTypes);\n switch (type) {\n case \"constructor\":\n return ConstructorFragment.from(obj);\n case \"error\":\n return ErrorFragment.from(obj);\n case \"event\":\n return EventFragment.from(obj);\n case \"fallback\":\n case \"receive\":\n return FallbackFragment.from(obj);\n case \"function\":\n return FunctionFragment.from(obj);\n case \"struct\":\n return StructFragment.from(obj);\n }\n }\n else if (typeof obj === \"object\") {\n // JSON ABI\n switch (obj.type) {\n case \"constructor\":\n return ConstructorFragment.from(obj);\n case \"error\":\n return ErrorFragment.from(obj);\n case \"event\":\n return EventFragment.from(obj);\n case \"fallback\":\n case \"receive\":\n return FallbackFragment.from(obj);\n case \"function\":\n return FunctionFragment.from(obj);\n case \"struct\":\n return StructFragment.from(obj);\n }\n assert(false, `unsupported type: ${obj.type}`, \"UNSUPPORTED_OPERATION\", {\n operation: \"Fragment.from\",\n });\n }\n assertArgument(false, \"unsupported frgament object\", \"obj\", obj);\n }\n /**\n * Returns true if %%value%% is a [[ConstructorFragment]].\n */\n static isConstructor(value) {\n return ConstructorFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is an [[ErrorFragment]].\n */\n static isError(value) {\n return ErrorFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is an [[EventFragment]].\n */\n static isEvent(value) {\n return EventFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is a [[FunctionFragment]].\n */\n static isFunction(value) {\n return FunctionFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is a [[StructFragment]].\n */\n static isStruct(value) {\n return StructFragment.isFragment(value);\n }\n}\n/**\n * An abstract class to represent An individual fragment\n * which has a name from a parse ABI.\n */\nexport class NamedFragment extends Fragment {\n /**\n * The name of the fragment.\n */\n name;\n /**\n * @private\n */\n constructor(guard, type, name, inputs) {\n super(guard, type, inputs);\n assertArgument(typeof name === \"string\" && name.match(regexId), \"invalid identifier\", \"name\", name);\n inputs = Object.freeze(inputs.slice());\n defineProperties(this, { name });\n }\n}\nfunction joinParams(format, params) {\n return (\"(\" +\n params.map((p) => p.format(format)).join(format === \"full\" ? \", \" : \",\") +\n \")\");\n}\n/**\n * A Fragment which represents a //Custom Error//.\n */\nexport class ErrorFragment extends NamedFragment {\n /**\n * @private\n */\n constructor(guard, name, inputs) {\n super(guard, \"error\", name, inputs);\n Object.defineProperty(this, internal, { value: ErrorFragmentInternal });\n }\n /**\n * The Custom Error selector.\n */\n get selector() {\n return id(this.format(\"sighash\")).substring(0, 10);\n }\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"error\",\n name: this.name,\n inputs: this.inputs.map((input) => JSON.parse(input.format(format))),\n });\n }\n const result = [];\n if (format !== \"sighash\") {\n result.push(\"error\");\n }\n result.push(this.name + joinParams(format, this.inputs));\n return result.join(\" \");\n }\n static from(obj) {\n if (ErrorFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof obj === \"string\") {\n return ErrorFragment.from(lex(obj));\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"error\", obj);\n const inputs = consumeParams(obj);\n consumeEoi(obj);\n return new ErrorFragment(_guard, name, inputs);\n }\n return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);\n }\n static isFragment(value) {\n return value && value[internal] === ErrorFragmentInternal;\n }\n}\n/**\n * A Fragment which represents an Event.\n */\nexport class EventFragment extends NamedFragment {\n anonymous;\n /**\n * @private\n */\n constructor(guard, name, inputs, anonymous) {\n super(guard, \"event\", name, inputs);\n Object.defineProperty(this, internal, { value: EventFragmentInternal });\n defineProperties(this, { anonymous });\n }\n /**\n * The Event topic hash.\n */\n get topicHash() {\n return id(this.format(\"sighash\"));\n }\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"event\",\n anonymous: this.anonymous,\n name: this.name,\n inputs: this.inputs.map((i) => JSON.parse(i.format(format))),\n });\n }\n const result = [];\n if (format !== \"sighash\") {\n result.push(\"event\");\n }\n result.push(this.name + joinParams(format, this.inputs));\n if (format !== \"sighash\" && this.anonymous) {\n result.push(\"anonymous\");\n }\n return result.join(\" \");\n }\n static getTopicHash(name, params) {\n params = (params || []).map((p) => ParamType.from(p));\n const fragment = new EventFragment(_guard, name, params, false);\n return fragment.topicHash;\n }\n static from(obj) {\n if (EventFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof obj === \"string\") {\n return EventFragment.from(lex(obj));\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"event\", obj);\n const inputs = consumeParams(obj, true);\n const anonymous = !!consumeKeywords(obj, setify([\"anonymous\"])).has(\"anonymous\");\n consumeEoi(obj);\n return new EventFragment(_guard, name, inputs, anonymous);\n }\n return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous);\n }\n static isFragment(value) {\n return value && value[internal] === EventFragmentInternal;\n }\n}\n/**\n * A Fragment which represents a constructor.\n */\nexport class ConstructorFragment extends Fragment {\n payable;\n energy;\n /**\n * @private\n */\n constructor(guard, type, inputs, payable, energy) {\n super(guard, type, inputs);\n Object.defineProperty(this, internal, {\n value: ConstructorFragmentInternal,\n });\n defineProperties(this, { payable, energy });\n }\n format(format) {\n assert(format != null && format !== \"sighash\", \"cannot format a constructor for sighash\", \"UNSUPPORTED_OPERATION\", { operation: \"format(sighash)\" });\n if (format === \"json\") {\n return JSON.stringify({\n type: \"constructor\",\n stateMutability: this.payable ? \"payable\" : \"undefined\",\n payable: this.payable,\n energy: this.energy != null ? this.energy : undefined,\n inputs: this.inputs.map((i) => JSON.parse(i.format(format))),\n });\n }\n const result = [`constructor${joinParams(format, this.inputs)}`];\n result.push(this.payable ? \"payable\" : \"nonpayable\");\n if (this.energy != null) {\n result.push(`@${this.energy.toString()}`);\n }\n return result.join(\" \");\n }\n static from(obj) {\n if (ConstructorFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof obj === \"string\") {\n return ConstructorFragment.from(lex(obj));\n }\n else if (obj instanceof TokenString) {\n consumeKeywords(obj, setify([\"constructor\"]));\n const inputs = consumeParams(obj);\n const payable = !!consumeKeywords(obj, setify([\"payable\"])).has(\"payable\");\n const energy = consumeEnergy(obj);\n consumeEoi(obj);\n return new ConstructorFragment(_guard, \"constructor\", inputs, payable, energy);\n }\n return new ConstructorFragment(_guard, \"constructor\", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, obj.energy != null ? obj.energy : null);\n }\n static isFragment(value) {\n return value && value[internal] === ConstructorFragmentInternal;\n }\n}\n/**\n * A Fragment which represents a method.\n */\nexport class FallbackFragment extends Fragment {\n /**\n * If the function can be sent value during invocation.\n */\n payable;\n constructor(guard, inputs, payable) {\n super(guard, \"fallback\", inputs);\n Object.defineProperty(this, internal, { value: FallbackFragmentInternal });\n defineProperties(this, { payable });\n }\n format(format) {\n const type = this.inputs.length === 0 ? \"receive\" : \"fallback\";\n if (format === \"json\") {\n const stateMutability = this.payable ? \"payable\" : \"nonpayable\";\n return JSON.stringify({ type, stateMutability });\n }\n return `${type}()${this.payable ? \" payable\" : \"\"}`;\n }\n static from(obj) {\n if (FallbackFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof obj === \"string\") {\n return FallbackFragment.from(lex(obj));\n }\n else if (obj instanceof TokenString) {\n const errorObj = obj.toString();\n const topIsValid = obj.peekKeyword(setify([\"fallback\", \"receive\"]));\n assertArgument(topIsValid, \"type must be fallback or receive\", \"obj\", errorObj);\n const type = obj.popKeyword(setify([\"fallback\", \"receive\"]));\n // receive()\n if (type === \"receive\") {\n const inputs = consumeParams(obj);\n assertArgument(inputs.length === 0, `receive cannot have arguments`, \"obj.inputs\", inputs);\n consumeKeywords(obj, setify([\"payable\"]));\n consumeEoi(obj);\n return new FallbackFragment(_guard, [], true);\n }\n // fallback() [payable]\n // fallback(bytes) [payable] returns (bytes)\n let inputs = consumeParams(obj);\n if (inputs.length) {\n assertArgument(inputs.length === 1 && inputs[0].type === \"bytes\", \"invalid fallback inputs\", \"obj.inputs\", inputs.map((i) => i.format(\"minimal\")).join(\", \"));\n }\n else {\n inputs = [ParamType.from(\"bytes\")];\n }\n const mutability = consumeMutability(obj);\n assertArgument(mutability === \"nonpayable\" || mutability === \"payable\", \"fallback cannot be constants\", \"obj.stateMutability\", mutability);\n if (consumeKeywords(obj, setify([\"returns\"])).has(\"returns\")) {\n const outputs = consumeParams(obj);\n assertArgument(outputs.length === 1 && outputs[0].type === \"bytes\", \"invalid fallback outputs\", \"obj.outputs\", outputs.map((i) => i.format(\"minimal\")).join(\", \"));\n }\n consumeEoi(obj);\n return new FallbackFragment(_guard, inputs, mutability === \"payable\");\n }\n if (obj.type === \"receive\") {\n return new FallbackFragment(_guard, [], true);\n }\n if (obj.type === \"fallback\") {\n const inputs = [ParamType.from(\"bytes\")];\n const payable = obj.stateMutability === \"payable\";\n return new FallbackFragment(_guard, inputs, payable);\n }\n assertArgument(false, \"invalid fallback description\", \"obj\", obj);\n }\n static isFragment(value) {\n return value && value[internal] === FallbackFragmentInternal;\n }\n}\n/**\n * A Fragment which represents a method.\n */\nexport class FunctionFragment extends NamedFragment {\n /**\n * If the function is constant (e.g. ``pure`` or ``view`` functions).\n */\n constant;\n /**\n * The returned types for the result of calling this function.\n */\n outputs;\n /**\n * The state mutability (e.g. ``payable``, ``nonpayable``, ``view``\n * or ``pure``)\n */\n stateMutability;\n /**\n * If the function can be sent value during invocation.\n */\n payable;\n /**\n * The amount of energy to send when calling this function\n */\n energy;\n /**\n * @private\n */\n constructor(guard, name, stateMutability, inputs, outputs, energy) {\n super(guard, \"function\", name, inputs);\n Object.defineProperty(this, internal, { value: FunctionFragmentInternal });\n outputs = Object.freeze(outputs.slice());\n const constant = stateMutability === \"view\" || stateMutability === \"pure\";\n const payable = stateMutability === \"payable\";\n defineProperties(this, {\n constant,\n energy,\n outputs,\n payable,\n stateMutability,\n });\n }\n /**\n * The Function selector.\n */\n get selector() {\n return id(this.format(\"sighash\")).substring(0, 10);\n }\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"function\",\n name: this.name,\n constant: this.constant,\n stateMutability: this.stateMutability !== \"nonpayable\"\n ? this.stateMutability\n : undefined,\n payable: this.payable,\n energy: this.energy != null ? this.energy : undefined,\n inputs: this.inputs.map((i) => JSON.parse(i.format(format))),\n outputs: this.outputs.map((o) => JSON.parse(o.format(format))),\n });\n }\n const result = [];\n if (format !== \"sighash\") {\n result.push(\"function\");\n }\n result.push(this.name + joinParams(format, this.inputs));\n if (format !== \"sighash\") {\n if (this.stateMutability !== \"nonpayable\") {\n result.push(this.stateMutability);\n }\n if (this.outputs && this.outputs.length) {\n result.push(\"returns\");\n result.push(joinParams(format, this.outputs));\n }\n if (this.energy != null) {\n result.push(`@${this.energy.toString()}`);\n }\n }\n return result.join(\" \");\n }\n static getSelector(name, params) {\n params = (params || []).map((p) => ParamType.from(p));\n const fragment = new FunctionFragment(_guard, name, \"view\", params, [], null);\n return fragment.selector;\n }\n static from(obj) {\n if (FunctionFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof obj === \"string\") {\n return FunctionFragment.from(lex(obj));\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"function\", obj);\n const inputs = consumeParams(obj);\n const mutability = consumeMutability(obj);\n let outputs = [];\n if (consumeKeywords(obj, setify([\"returns\"])).has(\"returns\")) {\n outputs = consumeParams(obj);\n }\n const energy = consumeEnergy(obj);\n consumeEoi(obj);\n return new FunctionFragment(_guard, name, mutability, inputs, outputs, energy);\n }\n let stateMutability = obj.stateMutability;\n // Use legacy Solidity ABI logic if stateMutability is missing\n if (stateMutability == null) {\n stateMutability = \"payable\";\n if (typeof obj.constant === \"boolean\") {\n stateMutability = \"view\";\n if (!obj.constant) {\n stateMutability = \"payable\";\n if (typeof obj.payable === \"boolean\" && !obj.payable) {\n stateMutability = \"nonpayable\";\n }\n }\n }\n else if (typeof obj.payable === \"boolean\" && !obj.payable) {\n stateMutability = \"nonpayable\";\n }\n }\n // @TODO: verifyState for stateMutability (e.g. throw if\n // payable: false but stateMutability is \"nonpayable\")\n return new FunctionFragment(_guard, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], obj.energy != null ? obj.energy : null);\n }\n static isFragment(value) {\n return value && value[internal] === FunctionFragmentInternal;\n }\n}\n/**\n * A Fragment which represents a structure.\n */\nexport class StructFragment extends NamedFragment {\n /**\n * @private\n */\n constructor(guard, name, inputs) {\n super(guard, \"struct\", name, inputs);\n Object.defineProperty(this, internal, { value: StructFragmentInternal });\n }\n format() {\n throw new Error(\"@TODO\");\n }\n static from(obj) {\n if (typeof obj === \"string\") {\n return StructFragment.from(lex(obj));\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"struct\", obj);\n const inputs = consumeParams(obj);\n consumeEoi(obj);\n return new StructFragment(_guard, name, inputs);\n }\n return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);\n }\n static isFragment(value) {\n return value && value[internal] === StructFragmentInternal;\n }\n}\n//# sourceMappingURL=fragments.js.map","/**\n * When sending values to or receiving values from a [[Contract]], the\n * data is generally encoded using the [ABI standard](link-solc-abi).\n *\n * The AbiCoder provides a utility to encode values to ABI data and\n * decode values from ABI data.\n *\n * Most of the time, developers should favour the [[Contract]] class,\n * which further abstracts a lot of the finer details of ABI data.\n *\n * @_section api/abi/abi-coder:ABI Encoding\n */\nimport { assertArgumentCount, assertArgument } from \"../utils/index.js\";\nimport { Reader, Writer } from \"./coders/abstract-coder.js\";\nimport { AddressCoder } from \"./coders/address.js\";\nimport { ArrayCoder } from \"./coders/array.js\";\nimport { BooleanCoder } from \"./coders/boolean.js\";\nimport { BytesCoder } from \"./coders/bytes.js\";\nimport { FixedBytesCoder } from \"./coders/fixed-bytes.js\";\nimport { NullCoder } from \"./coders/null.js\";\nimport { NumberCoder } from \"./coders/number.js\";\nimport { StringCoder } from \"./coders/string.js\";\nimport { TupleCoder } from \"./coders/tuple.js\";\nimport { ParamType } from \"./fragments.js\";\nimport { getAddress } from \"../address/index.js\";\nimport { getBytes, hexlify, makeError } from \"../utils/index.js\";\n// https://docs.soliditylang.org/en/v0.8.17/control-structures.html\nconst PanicReasons = new Map();\nPanicReasons.set(0x00, \"GENERIC_PANIC\");\nPanicReasons.set(0x01, \"ASSERT_FALSE\");\nPanicReasons.set(0x11, \"OVERFLOW\");\nPanicReasons.set(0x12, \"DIVIDE_BY_ZERO\");\nPanicReasons.set(0x21, \"ENUM_RANGE_ERROR\");\nPanicReasons.set(0x22, \"BAD_STORAGE_DATA\");\nPanicReasons.set(0x31, \"STACK_UNDERFLOW\");\nPanicReasons.set(0x32, \"ARRAY_RANGE_ERROR\");\nPanicReasons.set(0x41, \"OUT_OF_MEMORY\");\nPanicReasons.set(0x51, \"UNINITIALIZED_FUNCTION_CALL\");\nconst paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);\nconst paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);\nlet defaultCoder = null;\nfunction getBuiltinCallException(action, tx, data, abiCoder) {\n let message = \"missing revert data\";\n let reason = null;\n const invocation = null;\n let revert = null;\n if (data) {\n message = \"execution reverted\";\n const bytes = getBytes(data);\n data = hexlify(data);\n if (bytes.length === 0) {\n message += \" (no data present; likely require(false) occurred\";\n reason = \"require(false)\";\n }\n else if (bytes.length % 32 !== 4) {\n message += \" (could not decode reason; invalid data length)\";\n }\n else if (hexlify(bytes.slice(0, 4)) === \"0x08c379a0\") {\n // Error(string)\n try {\n reason = abiCoder.decode([\"string\"], bytes.slice(4))[0];\n revert = {\n signature: \"Error(string)\",\n name: \"Error\",\n args: [reason],\n };\n message += `: ${JSON.stringify(reason)}`;\n }\n catch (error) {\n message += \" (could not decode reason; invalid string data)\";\n }\n }\n else if (hexlify(bytes.slice(0, 4)) === \"0x4e487b71\") {\n // Panic(uint256)\n try {\n const code = Number(abiCoder.decode([\"uint256\"], bytes.slice(4))[0]);\n revert = {\n signature: \"Panic(uint256)\",\n name: \"Panic\",\n args: [code],\n };\n reason = `Panic due to ${PanicReasons.get(code) || \"UNKNOWN\"}(${code})`;\n message += `: ${reason}`;\n }\n catch (error) {\n message += \" (could not decode panic code)\";\n }\n }\n else {\n message += \" (unknown custom error)\";\n }\n }\n const transaction = {\n to: tx.to ? getAddress(tx.to) : null,\n data: tx.data || \"0x\",\n };\n if (tx.from) {\n transaction.from = getAddress(tx.from);\n }\n return makeError(message, \"CALL_EXCEPTION\", {\n action,\n data,\n reason,\n transaction,\n invocation,\n revert,\n });\n}\n/**\n * About AbiCoder\n */\nexport class AbiCoder {\n #getCoder(param) {\n if (param.isArray()) {\n return new ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name);\n }\n if (param.isTuple()) {\n return new TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name);\n }\n switch (param.baseType) {\n case \"address\":\n return new AddressCoder(param.name);\n case \"bool\":\n return new BooleanCoder(param.name);\n case \"string\":\n return new StringCoder(param.name);\n case \"bytes\":\n return new BytesCoder(param.name);\n case \"\":\n return new NullCoder(param.name);\n }\n // u?int[0-9]*\n let match = param.type.match(paramTypeNumber);\n if (match) {\n let size = parseInt(match[2] || \"256\");\n assertArgument(size !== 0 && size <= 256 && size % 8 === 0, \"invalid \" + match[1] + \" bit length\", \"param\", param);\n return new NumberCoder(size / 8, match[1] === \"int\", param.name);\n }\n // bytes[0-9]+\n match = param.type.match(paramTypeBytes);\n if (match) {\n let size = parseInt(match[1]);\n assertArgument(size !== 0 && size <= 32, \"invalid bytes length\", \"param\", param);\n return new FixedBytesCoder(size, param.name);\n }\n assertArgument(false, \"invalid type\", \"type\", param.type);\n }\n /**\n * Get the default values for the given %%types%%.\n *\n * For example, a ``uint`` is by default ``0`` and ``bool``\n * is by default ``false``.\n */\n getDefaultValue(types) {\n const coders = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n return coder.defaultValue();\n }\n /**\n * Encode the %%values%% as the %%types%% into ABI data.\n *\n * @returns DataHexstring\n */\n encode(types, values) {\n assertArgumentCount(values.length, types.length, \"types/values length mismatch\");\n const coders = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n const writer = new Writer();\n coder.encode(writer, values);\n return writer.data;\n }\n /**\n * Decode the ABI %%data%% as the %%types%% into values.\n *\n * If %%loose%% decoding is enabled, then strict padding is\n * not enforced. Some older versions of Solidity incorrectly\n * padded event data emitted from ``external`` functions.\n */\n decode(types, data, loose) {\n const coders = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n return coder.decode(new Reader(data, loose));\n }\n /**\n * Returns the shared singleton instance of a default [[AbiCoder]].\n *\n * On the first call, the instance is created internally.\n */\n static defaultAbiCoder() {\n if (defaultCoder == null) {\n defaultCoder = new AbiCoder();\n }\n return defaultCoder;\n }\n /**\n * Returns an corebc-compatible [[CallExceptionError]] Error for the given\n * result %%data%% for the [[CallExceptionAction]] %%action%% against\n * the Transaction %%tx%%.\n */\n static getBuiltinCallException(action, tx, data) {\n return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder());\n }\n}\n//# sourceMappingURL=abi-coder.js.map","/**\n * About bytes32 strings...\n *\n * @_docloc: api/utils:Bytes32 Strings\n */\nimport { getBytes, toUtf8Bytes, toUtf8String, zeroPadBytes, } from \"../utils/index.js\";\n/**\n * Encodes %%text%% as a Bytes32 string.\n */\nexport function encodeBytes32String(text) {\n // Get the bytes\n const bytes = toUtf8Bytes(text);\n // Check we have room for null-termination\n if (bytes.length > 31) {\n throw new Error(\"bytes32 string must be less than 32 bytes\");\n }\n // Zero-pad (implicitly null-terminates)\n return zeroPadBytes(bytes, 32);\n}\n/**\n * Encodes the Bytes32-encoded %%bytes%% into a string.\n */\nexport function decodeBytes32String(_bytes) {\n const data = getBytes(_bytes, \"bytes\");\n // Must be 32 bytes with a null-termination\n if (data.length !== 32) {\n throw new Error(\"invalid bytes32 - not 32 bytes long\");\n }\n if (data[31] !== 0) {\n throw new Error(\"invalid bytes32 string - no null terminator\");\n }\n // Find the null termination\n let length = 31;\n while (data[length - 1] === 0) {\n length--;\n }\n // Determine the string value\n return toUtf8String(data.slice(0, length));\n}\n//# sourceMappingURL=bytes32.js.map","/**\n * About Interface\n *\n * @_subsection api/abi:Interfaces [interfaces]\n */\nimport { id } from \"../hash/index.js\";\nimport { concat, dataSlice, getBigInt, getBytes, getBytesCopy, hexlify, zeroPadValue, isHexString, defineProperties, assertArgument, toBeHex, assert, } from \"../utils/index.js\";\nimport { AbiCoder } from \"./abi-coder.js\";\nimport { checkResultErrors, Result } from \"./coders/abstract-coder.js\";\nimport { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, } from \"./fragments.js\";\nimport { Typed } from \"./typed.js\";\nimport { sha256 } from \"../crypto/sha3.js\";\nexport { checkResultErrors, Result };\nexport class LogDescription {\n fragment;\n name;\n signature;\n topic;\n args;\n constructor(fragment, topic, args) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment,\n name,\n signature,\n topic,\n args,\n });\n }\n}\nexport class TransactionDescription {\n fragment;\n name;\n args;\n signature;\n selector;\n value;\n constructor(fragment, selector, args, value) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment,\n name,\n args,\n signature,\n selector,\n value,\n });\n }\n}\nexport class ErrorDescription {\n fragment;\n name;\n args;\n signature;\n selector;\n constructor(fragment, selector, args) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment,\n name,\n args,\n signature,\n selector,\n });\n }\n}\nexport class Indexed {\n hash;\n _isIndexed;\n static isIndexed(value) {\n return !!(value && value._isIndexed);\n }\n constructor(hash) {\n defineProperties(this, { hash, _isIndexed: true });\n }\n}\n// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require\nconst PanicReasons = {\n \"0\": \"generic panic\",\n \"1\": \"assert(false)\",\n \"17\": \"arithmetic overflow\",\n \"18\": \"division or modulo by zero\",\n \"33\": \"enum overflow\",\n \"34\": \"invalid encoded storage byte array accessed\",\n \"49\": \"out-of-bounds array access; popping on an empty array\",\n \"50\": \"out-of-bounds access of an array or bytesN\",\n \"65\": \"out of memory\",\n \"81\": \"uninitialized function\",\n};\nconst BuiltinErrors = {\n \"0x08c379a0\": {\n signature: \"Error(string)\",\n name: \"Error\",\n inputs: [\"string\"],\n reason: (message) => {\n return `reverted with reason string ${JSON.stringify(message)}`;\n },\n },\n \"0x4e487b71\": {\n signature: \"Panic(uint256)\",\n name: \"Panic\",\n inputs: [\"uint256\"],\n reason: (code) => {\n let reason = \"unknown panic code\";\n if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) {\n reason = PanicReasons[code.toString()];\n }\n return `reverted with panic code 0x${code.toString(16)} (${reason})`;\n },\n },\n};\n/**\n * An Interface abstracts many of the low-level details for\n * encoding and decoding the data on the blockchain.\n *\n * An ABI provides information on how to encode data to send to\n * a Contract, how to decode the results and events and how to\n * interpret revert errors.\n *\n * The ABI can be specified by [any supported format](InterfaceAbi).\n */\nexport class Interface {\n /**\n * All the Contract ABI members (i.e. methods, events, errors, etc).\n */\n fragments;\n /**\n * The Contract constructor.\n */\n deploy;\n /**\n * The Fallback method, if any.\n */\n fallback;\n /**\n * If receiving xcb is supported.\n */\n receive;\n #errors;\n #events;\n #functions;\n // #structs: Map;\n #abiCoder;\n /**\n * Create a new Interface for the %%fragments%%.\n */\n constructor(fragments) {\n let abi = [];\n if (typeof fragments === \"string\") {\n abi = JSON.parse(fragments);\n }\n else {\n abi = fragments;\n }\n this.#functions = new Map();\n this.#errors = new Map();\n this.#events = new Map();\n // this.#structs = new Map();\n const frags = [];\n for (const a of abi) {\n try {\n frags.push(Fragment.from(a));\n }\n catch (error) {\n console.log(\"EE\", error);\n }\n }\n defineProperties(this, {\n fragments: Object.freeze(frags),\n });\n let fallback = null;\n let receive = false;\n this.#abiCoder = this.getAbiCoder();\n // Add all fragments by their signature\n this.fragments.forEach((fragment, index) => {\n let bucket;\n switch (fragment.type) {\n case \"constructor\":\n if (this.deploy) {\n console.log(\"duplicate definition - constructor\");\n return;\n }\n //checkNames(fragment, \"input\", fragment.inputs);\n defineProperties(this, {\n deploy: fragment,\n });\n return;\n case \"fallback\":\n if (fragment.inputs.length === 0) {\n receive = true;\n }\n else {\n assertArgument(!fallback ||\n fragment.payable !== fallback.payable, \"conflicting fallback fragments\", `fragments[${index}]`, fragment);\n fallback = fragment;\n receive = fallback.payable;\n }\n return;\n case \"function\":\n //checkNames(fragment, \"input\", fragment.inputs);\n //checkNames(fragment, \"output\", (fragment).outputs);\n bucket = this.#functions;\n break;\n case \"event\":\n //checkNames(fragment, \"input\", fragment.inputs);\n bucket = this.#events;\n break;\n case \"error\":\n bucket = this.#errors;\n break;\n default:\n return;\n }\n // Two identical entries; ignore it\n const signature = fragment.format();\n if (bucket.has(signature)) {\n return;\n }\n bucket.set(signature, fragment);\n });\n // If we do not have a constructor add a default\n if (!this.deploy) {\n defineProperties(this, {\n deploy: ConstructorFragment.from(\"constructor()\"),\n });\n }\n defineProperties(this, { fallback, receive });\n }\n /**\n * Returns the entire Human-Readable ABI, as an array of\n * signatures, optionally as %%minimal%% strings, which\n * removes parameter names and unneceesary spaces.\n */\n format(minimal) {\n const format = minimal ? \"minimal\" : \"full\";\n const abi = this.fragments.map((f) => f.format(format));\n return abi;\n }\n /**\n * Return the JSON-encoded ABI. This is the format Solidiy\n * returns.\n */\n formatJson() {\n const abi = this.fragments.map((f) => f.format(\"json\"));\n // We need to re-bundle the JSON fragments a bit\n return JSON.stringify(abi.map((j) => JSON.parse(j)));\n }\n /**\n * The ABI coder that will be used to encode and decode binary\n * data.\n */\n getAbiCoder() {\n return AbiCoder.defaultAbiCoder();\n }\n // Find a function definition by any means necessary (unless it is ambiguous)\n #getFunction(key, values, forceUnique) {\n // Selector\n if (isHexString(key)) {\n const selector = key.toLowerCase();\n for (const fragment of this.#functions.values()) {\n if (selector === fragment.selector) {\n return fragment;\n }\n }\n return null;\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching = [];\n for (const [name, fragment] of this.#functions) {\n if (name.split(\"(\" /* fix:) */)[0] === key) {\n matching.push(fragment);\n }\n }\n if (values) {\n const lastValue = values.length > 0 ? values[values.length - 1] : null;\n let valueLength = values.length;\n let allowOptions = true;\n if (Typed.isTyped(lastValue) && lastValue.type === \"overrides\") {\n allowOptions = false;\n valueLength--;\n }\n // Remove all matches that don't have a compatible length. The args\n // may contain an overrides, so the match may have n or n - 1 parameters\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs.length;\n if (inputs !== valueLength &&\n (!allowOptions || inputs !== valueLength - 1)) {\n matching.splice(i, 1);\n }\n }\n // Remove all matches that don't match the Typed signature\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs;\n for (let j = 0; j < values.length; j++) {\n // Not a typed value\n if (!Typed.isTyped(values[j])) {\n continue;\n }\n // We are past the inputs\n if (j >= inputs.length) {\n if (values[j].type === \"overrides\") {\n continue;\n }\n matching.splice(i, 1);\n break;\n }\n // Make sure the value type matches the input type\n if (values[j].type !== inputs[j].baseType) {\n matching.splice(i, 1);\n break;\n }\n }\n }\n }\n // We found a single matching signature with an overrides, but the\n // last value is something that cannot possibly be an options\n if (matching.length === 1 &&\n values &&\n values.length !== matching[0].inputs.length) {\n const lastArg = values[values.length - 1];\n if (lastArg == null ||\n Array.isArray(lastArg) ||\n typeof lastArg !== \"object\") {\n matching.splice(0, 1);\n }\n }\n if (matching.length === 0) {\n return null;\n }\n if (matching.length > 1 && forceUnique) {\n const matchStr = matching\n .map((m) => JSON.stringify(m.format()))\n .join(\", \");\n assertArgument(false, `ambiguous function description (i.e. matches ${matchStr})`, \"key\", key);\n }\n return matching[0];\n }\n // Normalize the signature and lookup the function\n const result = this.#functions.get(FunctionFragment.from(key).format());\n if (result) {\n return result;\n }\n return null;\n }\n /**\n * Get the function name for %%key%%, which may be a function selector,\n * function name or function signature that belongs to the ABI.\n */\n getFunctionName(key) {\n const fragment = this.#getFunction(key, null, false);\n assertArgument(fragment, \"no matching function\", \"key\", key);\n return fragment.name;\n }\n /**\n * Returns true if %%key%% (a function selector, function name or\n * function signature) is present in the ABI.\n *\n * In the case of a function name, the name may be ambiguous, so\n * accessing the [[FunctionFragment]] may require refinement.\n */\n hasFunction(key) {\n return !!this.#getFunction(key, null, false);\n }\n /**\n * Get the [[FunctionFragment]] for %%key%%, which may be a function\n * selector, function name or function signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple functions match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single function in\n * the ABI, this will throw.\n */\n getFunction(key, values) {\n return this.#getFunction(key, values || null, true);\n }\n /**\n * Iterate over all functions, calling %%callback%%, sorted by their name.\n */\n forEachFunction(callback) {\n const names = Array.from(this.#functions.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback(this.#functions.get(name), i);\n }\n }\n // Find an event definition by any means necessary (unless it is ambiguous)\n #getEvent(key, values, forceUnique) {\n // EventTopic\n if (isHexString(key)) {\n const eventTopic = key.toLowerCase();\n for (const fragment of this.#events.values()) {\n if (eventTopic === fragment.topicHash) {\n return fragment;\n }\n }\n return null;\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching = [];\n for (const [name, fragment] of this.#events) {\n if (name.split(\"(\" /* fix:) */)[0] === key) {\n matching.push(fragment);\n }\n }\n if (values) {\n // Remove all matches that don't have a compatible length.\n for (let i = matching.length - 1; i >= 0; i--) {\n if (matching[i].inputs.length < values.length) {\n matching.splice(i, 1);\n }\n }\n // Remove all matches that don't match the Typed signature\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs;\n for (let j = 0; j < values.length; j++) {\n // Not a typed value\n if (!Typed.isTyped(values[j])) {\n continue;\n }\n // Make sure the value type matches the input type\n if (values[j].type !== inputs[j].baseType) {\n matching.splice(i, 1);\n break;\n }\n }\n }\n }\n if (matching.length === 0) {\n return null;\n }\n if (matching.length > 1 && forceUnique) {\n const matchStr = matching\n .map((m) => JSON.stringify(m.format()))\n .join(\", \");\n assertArgument(false, `ambiguous event description (i.e. matches ${matchStr})`, \"key\", key);\n }\n return matching[0];\n }\n // Normalize the signature and lookup the function\n const result = this.#events.get(EventFragment.from(key).format());\n if (result) {\n return result;\n }\n return null;\n }\n /**\n * Get the event name for %%key%%, which may be a topic hash,\n * event name or event signature that belongs to the ABI.\n */\n getEventName(key) {\n const fragment = this.#getEvent(key, null, false);\n assertArgument(fragment, \"no matching event\", \"key\", key);\n return fragment.name;\n }\n /**\n * Returns true if %%key%% (an event topic hash, event name or\n * event signature) is present in the ABI.\n *\n * In the case of an event name, the name may be ambiguous, so\n * accessing the [[EventFragment]] may require refinement.\n */\n hasEvent(key) {\n return !!this.#getEvent(key, null, false);\n }\n /**\n * Get the [[EventFragment]] for %%key%%, which may be a topic hash,\n * event name or event signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple events match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single event in\n * the ABI, this will throw.\n */\n getEvent(key, values) {\n return this.#getEvent(key, values || null, true);\n }\n /**\n * Iterate over all events, calling %%callback%%, sorted by their name.\n */\n forEachEvent(callback) {\n const names = Array.from(this.#events.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback(this.#events.get(name), i);\n }\n }\n /**\n * Get the [[ErrorFragment]] for %%key%%, which may be an error\n * selector, error name or error signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple errors match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single error in\n * the ABI, this will throw.\n */\n getError(key, values) {\n if (isHexString(key)) {\n const selector = key.toLowerCase();\n if (BuiltinErrors[selector]) {\n return ErrorFragment.from(BuiltinErrors[selector].signature);\n }\n for (const fragment of this.#errors.values()) {\n if (selector === fragment.selector) {\n return fragment;\n }\n }\n return null;\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching = [];\n for (const [name, fragment] of this.#errors) {\n if (name.split(\"(\" /* fix:) */)[0] === key) {\n matching.push(fragment);\n }\n }\n if (matching.length === 0) {\n if (key === \"Error\") {\n return ErrorFragment.from(\"error Error(string)\");\n }\n if (key === \"Panic\") {\n return ErrorFragment.from(\"error Panic(uint256)\");\n }\n return null;\n }\n else if (matching.length > 1) {\n const matchStr = matching\n .map((m) => JSON.stringify(m.format()))\n .join(\", \");\n assertArgument(false, `ambiguous error description (i.e. ${matchStr})`, \"name\", key);\n }\n return matching[0];\n }\n // Normalize the signature and lookup the function\n key = ErrorFragment.from(key).format();\n if (key === \"Error(string)\") {\n return ErrorFragment.from(\"error Error(string)\");\n }\n if (key === \"Panic(uint256)\") {\n return ErrorFragment.from(\"error Panic(uint256)\");\n }\n const result = this.#errors.get(key);\n if (result) {\n return result;\n }\n return null;\n }\n /**\n * Iterate over all errors, calling %%callback%%, sorted by their name.\n */\n forEachError(callback) {\n const names = Array.from(this.#errors.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback(this.#errors.get(name), i);\n }\n }\n // Get the 4-byte selector used by Solidity to identify a function\n /*\n getSelector(fragment: ErrorFragment | FunctionFragment): string {\n if (typeof(fragment) === \"string\") {\n const matches: Array = [ ];\n \n try { matches.push(this.getFunction(fragment)); } catch (error) { }\n try { matches.push(this.getError(fragment)); } catch (_) { }\n \n if (matches.length === 0) {\n logger.throwArgumentError(\"unknown fragment\", \"key\", fragment);\n } else if (matches.length > 1) {\n logger.throwArgumentError(\"ambiguous fragment matches function and error\", \"key\", fragment);\n }\n \n fragment = matches[0];\n }\n \n return dataSlice(id(fragment.format()), 0, 4);\n }\n */\n // Get the 32-byte topic hash used by Solidity to identify an event\n /*\n getEventTopic(fragment: EventFragment): string {\n //if (typeof(fragment) === \"string\") { fragment = this.getEvent(eventFragment); }\n return id(fragment.format());\n }\n */\n _decodeParams(params, data) {\n return this.#abiCoder.decode(params, data);\n }\n _encodeParams(params, values) {\n return this.#abiCoder.encode(params, values);\n }\n /**\n * Encodes a ``tx.data`` object for deploying the Contract with\n * the %%values%% as the constructor arguments.\n */\n encodeDeploy(values) {\n return this._encodeParams(this.deploy.inputs, values || []);\n }\n /**\n * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the\n * specified error (see [[getError]] for valid values for\n * %%key%%).\n *\n * Most developers should prefer the [[parseCallResult]] method instead,\n * which will automatically detect a ``CALL_EXCEPTION`` and throw the\n * corresponding error.\n */\n decodeErrorResult(fragment, data) {\n if (typeof fragment === \"string\") {\n const f = this.getError(fragment);\n assertArgument(f, \"unknown error\", \"fragment\", fragment);\n fragment = f;\n }\n assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, \"data\", data);\n return this._decodeParams(fragment.inputs, dataSlice(data, 4));\n }\n /**\n * Encodes the transaction revert data for a call result that\n * reverted from the the Contract with the sepcified %%error%%\n * (see [[getError]] for valid values for %%fragment%%) with the %%values%%.\n *\n * This is generally not used by most developers, unless trying to mock\n * a result from a Contract.\n */\n encodeErrorResult(fragment, values) {\n if (typeof fragment === \"string\") {\n const f = this.getError(fragment);\n assertArgument(f, \"unknown error\", \"fragment\", fragment);\n fragment = f;\n }\n return concat([\n fragment.selector,\n this._encodeParams(fragment.inputs, values || []),\n ]);\n }\n /**\n * Decodes the %%data%% from a transaction ``tx.data`` for\n * the function specified (see [[getFunction]] for valid values\n * for %%fragment%%).\n *\n * Most developers should prefer the [[parseTransaction]] method\n * instead, which will automatically detect the fragment.\n */\n decodeFunctionData(fragment, data) {\n if (typeof fragment === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, \"data\", data);\n return this._decodeParams(fragment.inputs, dataSlice(data, 4));\n }\n /**\n * Encodes the ``tx.data`` for a transaction that calls the function\n * specified (see [[getFunction]] for valid values for %%fragment%%) with\n * the %%values%%.\n */\n encodeFunctionData(fragment, values) {\n if (typeof fragment === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n return concat([\n fragment.selector,\n this._encodeParams(fragment.inputs, values || []),\n ]);\n }\n /**\n * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the\n * specified function (see [[getFunction]] for valid values for\n * %%key%%).\n *\n * Most developers should prefer the [[parseCallResult]] method instead,\n * which will automatically detect a ``CALL_EXCEPTION`` and throw the\n * corresponding error.\n */\n decodeFunctionResult(fragment, data) {\n if (typeof fragment === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n let message = \"invalid length for result data\";\n const bytes = getBytesCopy(data);\n if (bytes.length % 32 === 0) {\n try {\n return this.#abiCoder.decode(fragment.outputs, bytes);\n }\n catch (error) {\n message = \"could not decode result data\";\n }\n }\n // Call returned data with no error, but the data is junk\n assert(false, message, \"BAD_DATA\", {\n value: hexlify(bytes),\n info: { method: fragment.name, signature: fragment.format() },\n });\n }\n makeError(_data, tx) {\n const data = getBytes(_data, \"data\");\n const error = AbiCoder.getBuiltinCallException(\"call\", tx, data);\n // Not a built-in error; try finding a custom error\n const customPrefix = \"execution reverted (unknown custom error)\";\n if (error.message.startsWith(customPrefix)) {\n const selector = hexlify(data.slice(0, 4));\n const ef = this.getError(selector);\n if (ef) {\n try {\n const args = this.#abiCoder.decode(ef.inputs, data.slice(4));\n error.revert = {\n name: ef.name,\n signature: ef.format(),\n args,\n };\n error.reason = error.revert.signature;\n error.message = `execution reverted: ${error.reason}`;\n }\n catch (e) {\n error.message = `execution reverted (coult not decode custom error)`;\n }\n }\n }\n // Add the invocation, if available\n const parsed = this.parseTransaction(tx);\n if (parsed) {\n error.invocation = {\n method: parsed.name,\n signature: parsed.signature,\n args: parsed.args,\n };\n }\n return error;\n }\n /**\n * Encodes the result data (e.g. from an ``xcb_call``) for the\n * specified function (see [[getFunction]] for valid values\n * for %%fragment%%) with %%values%%.\n *\n * This is generally not used by most developers, unless trying to mock\n * a result from a Contract.\n */\n encodeFunctionResult(fragment, values) {\n if (typeof fragment === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n return hexlify(this.#abiCoder.encode(fragment.outputs, values || []));\n }\n /*\n spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> {\n const promises: Array> = [ ];\n const process = function(type: ParamType, value: any): any {\n if (type.baseType === \"array\") {\n return descend(type.child\n }\n if (type. === \"address\") {\n }\n };\n \n const descend = function (inputs: Array, values: ReadonlyArray) {\n if (inputs.length !== values.length) { throw new Error(\"length mismatch\"); }\n };\n \n const result: Array = [ ];\n values.forEach((value, index) => {\n if (value == null) {\n topics.push(null);\n } else if (param.baseType === \"array\" || param.baseType === \"tuple\") {\n logger.throwArgumentError(\"filtering with tuples or arrays not supported\", (\"contract.\" + param.name), value);\n } else if (Array.isArray(value)) {\n topics.push(value.map((value) => encodeTopic(param, value)));\n } else {\n topics.push(encodeTopic(param, value));\n }\n });\n }\n */\n // Create the filter for the event with search criteria (e.g. for xcb_filterLog)\n encodeFilterTopics(fragment, values) {\n if (typeof fragment === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n assert(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, \"UNEXPECTED_ARGUMENT\", { count: values.length, expectedCount: fragment.inputs.length });\n const topics = [];\n if (!fragment.anonymous) {\n topics.push(fragment.topicHash);\n }\n // @TODO: Use the coders for this; to properly support tuples, etc.\n const encodeTopic = (param, value) => {\n if (param.type === \"string\") {\n return id(value);\n }\n else if (param.type === \"bytes\") {\n return sha256(hexlify(value));\n }\n if (param.type === \"bool\" && typeof value === \"boolean\") {\n value = value ? \"0x01\" : \"0x00\";\n }\n if (param.type.match(/^u?int/)) {\n value = toBeHex(value);\n }\n // Check addresses are valid\n if (param.type === \"address\") {\n this.#abiCoder.encode([\"address\"], [value]);\n }\n return zeroPadValue(hexlify(value), 32);\n //@TOOD should probably be return toHex(value, 32)\n };\n values.forEach((value, index) => {\n const param = fragment.inputs[index];\n if (!param.indexed) {\n assertArgument(value == null, \"cannot filter non-indexed parameters; must be null\", \"contract.\" + param.name, value);\n return;\n }\n if (value == null) {\n topics.push(null);\n }\n else if (param.baseType === \"array\" || param.baseType === \"tuple\") {\n assertArgument(false, \"filtering with tuples or arrays not supported\", \"contract.\" + param.name, value);\n }\n else if (Array.isArray(value)) {\n topics.push(value.map((value) => encodeTopic(param, value)));\n }\n else {\n topics.push(encodeTopic(param, value));\n }\n });\n // Trim off trailing nulls\n while (topics.length && topics[topics.length - 1] === null) {\n topics.pop();\n }\n return topics;\n }\n encodeEventLog(fragment, values) {\n if (typeof fragment === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n const topics = [];\n const dataTypes = [];\n const dataValues = [];\n if (!fragment.anonymous) {\n topics.push(fragment.topicHash);\n }\n assertArgument(values.length === fragment.inputs.length, \"event arguments/values mismatch\", \"values\", values);\n fragment.inputs.forEach((param, index) => {\n const value = values[index];\n if (param.indexed) {\n if (param.type === \"string\") {\n topics.push(id(value));\n }\n else if (param.type === \"bytes\") {\n topics.push(sha256(value));\n }\n else if (param.baseType === \"tuple\" || param.baseType === \"array\") {\n // @TODO\n throw new Error(\"not implemented\");\n }\n else {\n topics.push(this.#abiCoder.encode([param.type], [value]));\n }\n }\n else {\n dataTypes.push(param);\n dataValues.push(value);\n }\n });\n return {\n data: this.#abiCoder.encode(dataTypes, dataValues),\n topics: topics,\n };\n }\n // Decode a filter for the event and the search criteria\n decodeEventLog(fragment, data, topics) {\n if (typeof fragment === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n if (topics != null && !fragment.anonymous) {\n const eventTopic = fragment.topicHash;\n assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, \"fragment/topic mismatch\", \"topics[0]\", topics[0]);\n topics = topics.slice(1);\n }\n const indexed = [];\n const nonIndexed = [];\n const dynamic = [];\n fragment.inputs.forEach((param, index) => {\n if (param.indexed) {\n if (param.type === \"string\" ||\n param.type === \"bytes\" ||\n param.baseType === \"tuple\" ||\n param.baseType === \"array\") {\n indexed.push(ParamType.from({ type: \"bytes32\", name: param.name }));\n dynamic.push(true);\n }\n else {\n indexed.push(param);\n dynamic.push(false);\n }\n }\n else {\n nonIndexed.push(param);\n dynamic.push(false);\n }\n });\n const resultIndexed = topics != null ? this.#abiCoder.decode(indexed, concat(topics)) : null;\n const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true);\n //const result: (Array & { [ key: string ]: any }) = [ ];\n const values = [];\n const keys = [];\n let nonIndexedIndex = 0, indexedIndex = 0;\n fragment.inputs.forEach((param, index) => {\n let value = null;\n if (param.indexed) {\n if (resultIndexed == null) {\n value = new Indexed(null);\n }\n else if (dynamic[index]) {\n value = new Indexed(resultIndexed[indexedIndex++]);\n }\n else {\n try {\n value = resultIndexed[indexedIndex++];\n }\n catch (error) {\n value = error;\n }\n }\n }\n else {\n try {\n value = resultNonIndexed[nonIndexedIndex++];\n }\n catch (error) {\n value = error;\n }\n }\n values.push(value);\n keys.push(param.name || null);\n });\n return Result.fromItems(values, keys);\n }\n /**\n * Parses a transaction, finding the matching function and extracts\n * the parameter values along with other useful function details.\n *\n * If the matching function cannot be found, return null.\n */\n parseTransaction(tx) {\n const data = getBytes(tx.data, \"tx.data\");\n const value = getBigInt(tx.value != null ? tx.value : 0, \"tx.value\");\n const fragment = this.getFunction(hexlify(data.slice(0, 4)));\n if (!fragment) {\n return null;\n }\n const args = this.#abiCoder.decode(fragment.inputs, data.slice(4));\n return new TransactionDescription(fragment, fragment.selector, args, value);\n }\n parseCallResult(data) {\n throw new Error(\"@TODO\");\n }\n /**\n * Parses a receipt log, finding the matching event and extracts\n * the parameter values along with other useful event details.\n *\n * If the matching event cannot be found, returns null.\n */\n parseLog(log) {\n const fragment = this.getEvent(log.topics[0]);\n if (!fragment || fragment.anonymous) {\n return null;\n }\n // @TODO: If anonymous, and the only method, and the input count matches, should we parse?\n // Probably not, because just because it is the only event in the ABI does\n // not mean we have the full ABI; maybe just a fragment?\n return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics));\n }\n /**\n * Parses a revert data, finding the matching error and extracts\n * the parameter values along with other useful error details.\n *\n * If the matching event cannot be found, returns null.\n */\n parseError(data) {\n const hexData = hexlify(data);\n const fragment = this.getError(dataSlice(hexData, 0, 4));\n if (!fragment) {\n return null;\n }\n const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4));\n return new ErrorDescription(fragment, fragment.selector, args);\n }\n /**\n * Creates a new [[Interface]] from the ABI %%value%%.\n *\n * The %%value%% may be provided as an existing [[Interface]] object,\n * a JSON-encoded ABI or any Human-Readable ABI format.\n */\n static from(value) {\n // Already an Interface, which is immutable\n if (value instanceof Interface) {\n return value;\n }\n // JSON\n if (typeof value === \"string\") {\n return new Interface(JSON.parse(value));\n }\n // Maybe an interface from an older version, or from a symlinked copy\n if (typeof value.format === \"function\") {\n return new Interface(value.format(\"json\"));\n }\n // Array of fragments\n return new Interface(value);\n }\n}\n//# sourceMappingURL=interface.js.map","import { concat, \n// dataSlice,\ngetBigInt,\n// encodeRlp\n } from \"../utils/index.js\";\nimport { getAddress } from \"./index.js\";\nimport { sha256 } from \"../crypto/sha3.js\";\nimport { hexDataLength, hexDataSlice } from \"../utils/data.js\";\nimport { Logger } from \"../logger/logger.js\";\nimport { removeHexPrefix } from \"../transaction/address.js\";\nimport { calculateCheckSum } from \"./index.js\";\nconst logger = new Logger(\"contract-address/0.0.1\");\n/**\n * Returns the address that would result from a ``CREATE`` for %%tx%%.\n *\n * This can be used to compute the address a contract will be\n * deployed to by an EOA when sending a deployment transaction (i.e.\n * when the ``to`` address is ``null``).\n *\n * This can also be used to compute the address a contract will be\n * deployed to by a contract, by using the contract's address as the\n * ``to`` and the contract's nonce.\n *\n * @example\n * from = \"0x8ba1f109551bD432803012645Ac136ddd64DBA72\";\n * nonce = 5;\n *\n * getCreateAddress({ from, nonce });\n * //_result:\n */\nexport function getCreateAddress(tx) {\n const from = getAddress(tx.from);\n const nonce = getBigInt(tx.nonce, \"tx.nonce\");\n let nonceHex = nonce.toString(16);\n if (nonceHex === \"0\") {\n nonceHex = \"0x\";\n }\n else if (nonceHex.length % 2) {\n nonceHex = \"0x0\" + nonceHex;\n }\n else {\n nonceHex = \"0x\" + nonceHex;\n }\n return getAddress(from);\n}\n/**\n * Returns the address that would result from a ``CREATE2`` operation\n * with the given %%from%%, %%salt%% and %%initCodeHash%%.\n\n * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]].\n *\n * @example\n * // The address of the contract\n * from = \"0x8ba1f109551bD432803012645Ac136ddd64DBA72\"\n *\n * // The salt\n * salt = id(\"HelloWorld\")\n *\n * getCreate2Address(from, salt, initCodeHash)\n * //_result:\n */\nexport function getCreate2Address(from, salt, initCodeHash) {\n if (hexDataLength(salt) !== 32) {\n logger.throwArgumentError(\"salt must be 32 bytes\", \"salt\", salt);\n }\n if (hexDataLength(initCodeHash) !== 32) {\n logger.throwArgumentError(\"initCodeHash must be 32 bytes\", \"initCodeHash\", initCodeHash);\n }\n const val = hexDataSlice(sha256(concat([\"0xff\", getAddress(from), salt, initCodeHash])), 12);\n console.log({ \"contract-address/74=>should be string\": val });\n const prefix = from.substring(2, 4);\n const checksum = calculateCheckSum(val, prefix);\n return \"0x\" + prefix + checksum + removeHexPrefix(val);\n}\n//# sourceMappingURL=contract-address.js.map","import { assert, assertArgument } from \"../utils/index.js\";\nimport { getAddress } from \"./index.js\";\n/**\n * Returns true if %%value%% is an object which implements the\n * [[Addressable]] interface.\n *\n * @example:\n * // Wallets and AbstractSigner sub-classes\n * isAddressable(Wallet.createRandom())\n * //_result:\n *\n * // Contracts\n * contract = new Contract(\"dai.tokens.corebc.eth\", [ ], provider)\n * isAddressable(contract)\n * //_result:\n */\nexport function isAddressable(value) {\n return value && typeof value.getAddress === \"function\";\n}\n/**\n * Returns true if %%value%% is a valid address.\n *\n * @example:\n * // Valid address\n * isAddress(\"0x8ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_result:\n *\n * // Valid ICAP address\n * isAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\")\n * //_result:\n *\n * // Invalid checksum\n * isAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBa72\")\n * //_result:\n *\n * // Invalid ICAP checksum\n * isAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_result:\n *\n * // Not an address (an ENS name requires a provided and an\n * // asynchronous API to access)\n * isAddress(\"ricmoo.eth\")\n * //_result:\n */\nexport function isAddress(value) {\n try {\n getAddress(value);\n return true;\n }\n catch (error) { }\n return false;\n}\nasync function checkAddress(target, promise) {\n const result = await promise;\n if (result == null ||\n result === \"0x0000000000000000000000000000000000000000\") {\n assert(typeof target !== \"string\", \"unconfigured name\", \"UNCONFIGURED_NAME\", { value: target });\n assertArgument(false, \"invalid AddressLike value; did not resolve to a value address\", \"target\", target);\n }\n return getAddress(result);\n}\n/**\n * Resolves to an address for the %%target%%, which may be any\n * supported address type, an [[Addressable]] or a Promise which\n * resolves to an address.\n *\n * If an ENS name is provided, but that name has not been correctly\n * configured a [[UnconfiguredNameError]] is thrown.\n *\n * @example:\n * addr = \"0x6B175474E89094C44Da98b954EedeAC495271d0F\"\n *\n * // Addresses are return synchronously\n * resolveAddress(addr, provider)\n * //_result:\n *\n * // Address promises are resolved asynchronously\n * resolveAddress(Promise.resolve(addr))\n * //_result:\n *\n *\n * // Addressable objects are resolved asynchronously\n * contract = new Contract(addr, [ ])\n * resolveAddress(contract, provider)\n * //_result:\n *\n * // Unconfigured ENS names reject\n * resolveAddress(\"nothing-here.ricmoo.eth\", provider)\n * //_error:\n *\n * // ENS names require a NameResolver object passed in\n * // (notice the provider was omitted)\n * resolveAddress(\"nothing-here.ricmoo.eth\")\n * //_error:\n */\nexport function resolveAddress(target) {\n if (typeof target === \"string\") {\n return getAddress(target);\n // assert(resolver != null, \"ENS resolution requires a provider\",\n // \"UNSUPPORTED_OPERATION\", { operation: \"resolveName\" });\n // return checkAddress(target, resolver.resolveName(target));\n }\n else if (isAddressable(target)) {\n return checkAddress(target, target.getAddress());\n }\n else if (target && typeof target.then === \"function\") {\n return checkAddress(target, target);\n }\n assertArgument(false, \"unsupported addressable value\", \"target\", target);\n}\n//# sourceMappingURL=checks.js.map","import { defineProperties, getBigInt, getNumber, hexlify, resolveProperties, assert, assertArgument, isError, makeError, } from \"../utils/index.js\";\nconst BN_0 = BigInt(0);\n// -----------------------\nfunction getValue(value) {\n if (value == null) {\n return null;\n }\n return value;\n}\nfunction toJson(value) {\n if (value == null) {\n return null;\n }\n return value.toString();\n}\n// @TODO? implements Required\n/**\n * A **FeeData** wraps all the fee-related values associated with\n * the network.\n */\nexport class FeeData {\n /**\n * The energy price for legacy networks.\n */\n energyPrice;\n constructor(energyPrice) {\n defineProperties(this, {\n energyPrice: getValue(energyPrice),\n });\n }\n /**\n * Returns a JSON-friendly value.\n */\n toJSON() {\n const { energyPrice } = this;\n return {\n _type: \"FeeData\",\n energyPrice: toJson(energyPrice),\n };\n }\n}\nexport function copyRequest(req) {\n const result = {};\n // These could be addresses, ENS names or Addressables\n if (req.to) {\n result.to = req.to;\n }\n if (req.from) {\n result.from = req.from;\n }\n if (req.data) {\n result.data = hexlify(req.data);\n }\n const bigIntKeys = \"networkId,energyLimit,energyPrice,value\".split(/,/);\n for (const key of bigIntKeys) {\n if (!(key in req) || req[key] == null) {\n continue;\n }\n result[key] = getBigInt(req[key], `request.${key}`);\n }\n const numberKeys = \"type,nonce\".split(/,/);\n for (const key of numberKeys) {\n if (!(key in req) || req[key] == null) {\n continue;\n }\n result[key] = getNumber(req[key], `request.${key}`);\n }\n if (\"blockTag\" in req) {\n result.blockTag = req.blockTag;\n }\n if (\"enableCcipRead\" in req) {\n result.enableCcipReadEnabled = !!req.enableCcipRead;\n }\n if (\"customData\" in req) {\n result.customData = req.customData;\n }\n return result;\n}\n/**\n * A **Block** represents the data associated with a full block on\n * Core.\n */\nexport class Block {\n /**\n * The provider connected to the block used to fetch additional details\n * if necessary.\n */\n provider;\n /**\n * The block number, sometimes called the block height. This is a\n * sequential number that is one higher than the parent block.\n */\n number;\n /**\n * The block hash.\n */\n hash;\n /**\n * The timestamp for this block, which is the number of seconds since\n * epoch that this block was included.\n */\n timestamp;\n /**\n * The block hash of the parent block.\n */\n parentHash;\n /**\n * The nonce.\n *\n * On legacy networks, this is the random number inserted which\n * permitted the difficulty target to be reached.\n */\n nonce;\n /**\n * The difficulty target.\n *\n * On legacy networks, this is the proof-of-work target required\n * for a block to meet the protocol rules to be included.\n *\n * On modern networks, this is a random number arrived at using\n * randao. @TODO: Find links?\n */\n difficulty;\n /**\n * The total energy limit for this block.\n */\n energyLimit;\n /**\n * The total energy used in this block.\n */\n energyUsed;\n /**\n * The miner coinbase address, wihch receives any subsidies for\n * including this block.\n */\n miner;\n /**\n * Any extra data the validator wished to include.\n */\n extraData;\n /**\n * The base fee per energy that all transactions in this block were\n * charged.\n *\n * This adjusts after each block, depending on how congested the network\n * is.\n */\n baseFeePerEnergy;\n #transactions;\n /**\n * Create a new **Block** object.\n *\n * This should generally not be necessary as the unless implementing a\n * low-level library.\n */\n constructor(block, provider) {\n this.#transactions = block.transactions.map((tx) => {\n if (typeof tx !== \"string\") {\n return new TransactionResponse(tx, provider);\n }\n return tx;\n });\n defineProperties(this, {\n provider,\n hash: getValue(block.hash),\n number: block.number,\n timestamp: block.timestamp,\n parentHash: block.parentHash,\n nonce: block.nonce,\n difficulty: block.difficulty,\n energyLimit: block.energyLimit,\n energyUsed: block.energyUsed,\n miner: block.miner,\n extraData: block.extraData,\n baseFeePerEnergy: getValue(block.baseFeePerEnergy),\n });\n }\n /**\n * Returns the list of transaction hashes.\n */\n get transactions() {\n return this.#transactions.map((tx) => {\n if (typeof tx === \"string\") {\n return tx;\n }\n return tx.hash;\n });\n }\n /**\n * Returns the complete transactions for blocks which\n * prefetched them, by passing ``true`` to %%prefetchTxs%%\n * into [[provider_getBlock]].\n */\n get prefetchedTransactions() {\n const txs = this.#transactions.slice();\n // Doesn't matter...\n if (txs.length === 0) {\n return [];\n }\n // Make sure we prefetched the transactions\n assert(typeof txs[0] === \"object\", \"transactions were not prefetched with block request\", \"UNSUPPORTED_OPERATION\", {\n operation: \"transactionResponses()\",\n });\n return txs;\n }\n /**\n * Returns a JSON-friendly value.\n */\n toJSON() {\n const { baseFeePerEnergy, difficulty, extraData, energyLimit, energyUsed, hash, miner, nonce, number, parentHash, timestamp, transactions, } = this;\n return {\n _type: \"Block\",\n baseFeePerEnergy: toJson(baseFeePerEnergy),\n difficulty: toJson(difficulty),\n extraData,\n energyLimit: toJson(energyLimit),\n energyUsed: toJson(energyUsed),\n hash,\n miner,\n nonce,\n number,\n parentHash,\n timestamp,\n transactions,\n };\n }\n [Symbol.iterator]() {\n let index = 0;\n const txs = this.transactions;\n return {\n next: () => {\n if (index < this.length) {\n return {\n value: txs[index++],\n done: false,\n };\n }\n return { value: undefined, done: true };\n },\n };\n }\n /**\n * The number of transactions in this block.\n */\n get length() {\n return this.#transactions.length;\n }\n /**\n * The [[link-js-date]] this block was included at.\n */\n get date() {\n if (this.timestamp == null) {\n return null;\n }\n return new Date(this.timestamp * 1000);\n }\n /**\n * Get the transaction at %%indexe%% within this block.\n */\n async getTransaction(indexOrHash) {\n // Find the internal value by its index or hash\n let tx = undefined;\n if (typeof indexOrHash === \"number\") {\n tx = this.#transactions[indexOrHash];\n }\n else {\n const hash = indexOrHash.toLowerCase();\n for (const v of this.#transactions) {\n if (typeof v === \"string\") {\n if (v !== hash) {\n continue;\n }\n tx = v;\n break;\n }\n else {\n if (v.hash === hash) {\n continue;\n }\n tx = v;\n break;\n }\n }\n }\n if (tx == null) {\n throw new Error(\"no such tx\");\n }\n if (typeof tx === \"string\") {\n return await this.provider.getTransaction(tx);\n }\n else {\n return tx;\n }\n }\n getPrefetchedTransaction(indexOrHash) {\n const txs = this.prefetchedTransactions;\n if (typeof indexOrHash === \"number\") {\n return txs[indexOrHash];\n }\n indexOrHash = indexOrHash.toLowerCase();\n for (const tx of txs) {\n if (tx.hash === indexOrHash) {\n return tx;\n }\n }\n assertArgument(false, \"no matching transaction\", \"indexOrHash\", indexOrHash);\n }\n /**\n * Has this block been mined.\n *\n * If true, the block has been typed-gaurded that all mined\n * properties are non-null.\n */\n isMined() {\n return !!this.hash;\n }\n /**\n *\n */\n isLondon() {\n return !!this.baseFeePerEnergy;\n }\n orphanedEvent() {\n if (!this.isMined()) {\n throw new Error(\"\");\n }\n return createOrphanedBlockFilter(this);\n }\n}\n//////////////////////\n// Log\nexport class Log {\n provider;\n transactionHash;\n blockHash;\n blockNumber;\n removed;\n address;\n data;\n topics;\n index;\n transactionIndex;\n constructor(log, provider) {\n this.provider = provider;\n const topics = Object.freeze(log.topics.slice());\n defineProperties(this, {\n transactionHash: log.transactionHash,\n blockHash: log.blockHash,\n blockNumber: log.blockNumber,\n removed: log.removed,\n address: log.address,\n data: log.data,\n topics,\n index: log.index,\n transactionIndex: log.transactionIndex,\n });\n }\n toJSON() {\n const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex, } = this;\n return {\n _type: \"log\",\n address,\n blockHash,\n blockNumber,\n data,\n index,\n removed,\n topics,\n transactionHash,\n transactionIndex,\n };\n }\n async getBlock() {\n const block = await this.provider.getBlock(this.blockHash);\n assert(!!block, \"failed to find transaction\", \"UNKNOWN_ERROR\", {});\n return block;\n }\n async getTransaction() {\n const tx = await this.provider.getTransaction(this.transactionHash);\n assert(!!tx, \"failed to find transaction\", \"UNKNOWN_ERROR\", {});\n return tx;\n }\n async getTransactionReceipt() {\n const receipt = await this.provider.getTransactionReceipt(this.transactionHash);\n assert(!!receipt, \"failed to find transaction receipt\", \"UNKNOWN_ERROR\", {});\n return receipt;\n }\n removedEvent() {\n return createRemovedLogFilter(this);\n }\n}\n//////////////////////\n// Transaction Receipt\n/*\nexport interface LegacyTransactionReceipt {\n byzantium: false;\n status: null;\n root: string;\n}\n\nexport interface ByzantiumTransactionReceipt {\n byzantium: true;\n status: number;\n root: null;\n}\n*/\nexport class TransactionReceipt {\n provider;\n to;\n from;\n contractAddress;\n hash;\n index;\n blockHash;\n blockNumber;\n logsBloom;\n energyUsed;\n cumulativeEnergyUsed;\n energyPrice;\n type;\n //readonly byzantium!: boolean;\n status;\n root;\n #logs;\n constructor(tx, provider) {\n this.#logs = Object.freeze(tx.logs.map((log) => {\n return new Log(log, provider);\n }));\n defineProperties(this, {\n provider,\n to: tx.to,\n from: tx.from,\n contractAddress: tx.contractAddress,\n hash: tx.hash,\n index: tx.index,\n blockHash: tx.blockHash,\n blockNumber: tx.blockNumber,\n logsBloom: tx.logsBloom,\n energyUsed: tx.energyUsed,\n cumulativeEnergyUsed: tx.cumulativeEnergyUsed,\n energyPrice: (tx.effectiveEnergyPrice || tx.energyPrice),\n //byzantium: tx.byzantium,\n status: tx.status,\n root: tx.root,\n });\n }\n get logs() {\n return this.#logs;\n }\n toJSON() {\n const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium,\n status, root, } = this;\n return {\n _type: \"TransactionReceipt\",\n blockHash,\n blockNumber,\n //byzantium,\n contractAddress,\n cumulativeEnergyUsed: toJson(this.cumulativeEnergyUsed),\n from,\n energyPrice: toJson(this.energyPrice),\n energyUsed: toJson(this.energyUsed),\n hash,\n index,\n logs,\n logsBloom,\n root,\n status,\n to,\n };\n }\n get length() {\n return this.logs.length;\n }\n [Symbol.iterator]() {\n let index = 0;\n return {\n next: () => {\n if (index < this.length) {\n return { value: this.logs[index++], done: false };\n }\n return { value: undefined, done: true };\n },\n };\n }\n get fee() {\n return this.energyUsed * this.energyPrice;\n }\n async getBlock() {\n const block = await this.provider.getBlock(this.blockHash);\n if (block == null) {\n throw new Error(\"TODO\");\n }\n return block;\n }\n async getTransaction() {\n const tx = await this.provider.getTransaction(this.hash);\n if (tx == null) {\n throw new Error(\"TODO\");\n }\n return tx;\n }\n async getResult() {\n return await this.provider.getTransactionResult(this.hash);\n }\n async confirmations() {\n return (await this.provider.getBlockNumber()) - this.blockNumber + 1;\n }\n removedEvent() {\n return createRemovedTransactionFilter(this);\n }\n reorderedEvent(other) {\n assert(!other || other.isMined(), \"unmined 'other' transction cannot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"reorderedEvent(other)\" });\n return createReorderedTransactionFilter(this, other);\n }\n}\n/*\nexport type ReplacementDetectionSetup = {\n to: string;\n from: string;\n value: bigint;\n data: string;\n nonce: number;\n block: number;\n};\n*/\nexport class TransactionResponse {\n /**\n * The provider this is connected to, which will influence how its\n * methods will resolve its async inspection methods.\n */\n provider;\n /**\n * The block number of the block that this transaction was included in.\n *\n * This is ``null`` for pending transactions.\n */\n blockNumber;\n /**\n * The blockHash of the block that this transaction was included in.\n *\n * This is ``null`` for pending transactions.\n */\n blockHash;\n /**\n * The index within the block that this transaction resides at.\n */\n index;\n /**\n * The transaction hash.\n */\n hash;\n /**\n * The [[link-eip-2718]] transaction envelope type. This is\n * ``0`` for legacy transactions types.\n */\n type;\n /**\n * The receiver of this transaction.\n *\n * If ``null``, then the transaction is an initcode transaction.\n * This means the result of executing the [[data]] will be deployed\n * as a new contract on chain (assuming it does not revert) and the\n * address may be computed using [[getCreateAddress]].\n */\n to;\n /**\n * The sender of this transaction. It is implicitly computed\n * from the transaction pre-image hash (as the digest) and the\n * [[signature]] using ecrecover.\n */\n from;\n /**\n * The nonce, which is used to prevent replay attacks and offer\n * a method to ensure transactions from a given sender are explicitly\n * ordered.\n *\n * When sending a transaction, this must be equal to the number of\n * transactions ever sent by [[from]].\n */\n nonce;\n /**\n * The maximum units of energy this transaction can consume. If execution\n * exceeds this, the entries transaction is reverted and the sender\n * is charged for the full amount, despite not state changes being made.\n */\n energyLimit;\n /**\n * The energy price can have various values, depending on the network.\n *\n * In modern networks, for transactions that are included this is\n * the //effective energy price// (the fee per energy that was actually\n * charged), while for transactions that have not been included yet\n * is the [[maxFeePerEnergy]].\n *\n * For legacy transactions, or transactions on legacy networks, this\n * is the fee that will be charged per unit of energy the transaction\n * consumes.\n */\n energyPrice;\n /**\n * The data.\n */\n data;\n /**\n * The value, in ore. Use [[formatXCB]] to format this value\n * as xcb.\n */\n value;\n /**\n * The chain ID.\n */\n networkId;\n /**\n * The signature.\n */\n signature;\n #startBlock;\n /**\n * Create a new TransactionResponse with %%tx%% parameters\n * connected to %%provider%%.\n */\n constructor(tx, provider) {\n this.provider = provider;\n this.blockNumber = tx.blockNumber != null ? tx.blockNumber : null;\n this.blockHash = tx.blockHash != null ? tx.blockHash : null;\n this.hash = tx.hash;\n this.index = tx.index;\n this.from = tx.from;\n this.to = tx.to || null;\n this.energyLimit = tx.energyLimit;\n this.nonce = tx.nonce;\n this.data = tx.data;\n this.value = tx.value;\n this.energyPrice = tx.energyPrice;\n this.networkId = tx.networkId;\n this.signature = tx.signature;\n this.#startBlock = -1;\n }\n /**\n * Returns a JSON representation of this transaction.\n */\n toJSON() {\n const { index, hash, type, to, from, nonce, data, signature } = this;\n return {\n _type: \"TransactionReceipt\",\n networkId: toJson(this.networkId),\n data,\n from,\n energyLimit: toJson(this.energyLimit),\n energyPrice: toJson(this.energyPrice),\n hash,\n nonce,\n signature,\n to,\n index,\n type,\n value: toJson(this.value),\n };\n }\n /**\n * Resolves to the Block that this transaction was included in.\n *\n * This will return null if the transaction has not been included yet.\n */\n async getBlock() {\n let blockNumber = this.blockNumber;\n if (blockNumber == null) {\n const tx = await this.getTransaction();\n if (tx) {\n blockNumber = tx.blockNumber;\n }\n }\n if (blockNumber == null) {\n return null;\n }\n const block = this.provider.getBlock(blockNumber);\n if (block == null) {\n throw new Error(\"TODO\");\n }\n return block;\n }\n /**\n * Resolves to this transaction being re-requested from the\n * provider. This can be used if you have an unmined transaction\n * and wish to get an up-to-date populated instance.\n */\n async getTransaction() {\n return this.provider.getTransaction(this.hash);\n }\n /**\n * Resolves once this transaction has been mined and has\n * %%confirms%% blocks including it (default: ``1``) with an\n * optional %%timeout%%.\n *\n * This can resolve to ``null`` only if %%confirms%% is ``0``\n * and the transaction has not been mined, otherwise this will\n * wait until enough confirmations have completed.\n */\n async wait(_confirms, _timeout) {\n const confirms = _confirms == null ? 1 : _confirms;\n const timeout = _timeout == null ? 0 : _timeout;\n let startBlock = this.#startBlock;\n let nextScan = -1;\n let stopScanning = startBlock === -1 ? true : false;\n const checkReplacement = async () => {\n // Get the current transaction count for this sender\n if (stopScanning) {\n return null;\n }\n const { blockNumber, nonce } = await resolveProperties({\n blockNumber: this.provider.getBlockNumber(),\n nonce: this.provider.getTransactionCount(this.from),\n });\n // No transaction or our nonce has not been mined yet; but we\n // can start scanning later when we do start\n if (nonce < this.nonce) {\n startBlock = blockNumber;\n return;\n }\n // We were mined; no replacement\n if (stopScanning) {\n return null;\n }\n const mined = await this.getTransaction();\n if (mined && mined.blockNumber != null) {\n return;\n }\n // We were replaced; start scanning for that transaction\n // Starting to scan; look back a few extra blocks for safety\n if (nextScan === -1) {\n nextScan = startBlock - 3;\n if (nextScan < this.#startBlock) {\n nextScan = this.#startBlock;\n }\n }\n while (nextScan <= blockNumber) {\n // Get the next block to scan\n if (stopScanning) {\n return null;\n }\n const block = await this.provider.getBlock(nextScan, true);\n // This should not happen; but we'll try again shortly\n if (block == null) {\n return;\n }\n // We were mined; no replacement\n for (const hash of block) {\n if (hash === this.hash) {\n return;\n }\n }\n // Search for the transaction that replaced us\n for (let i = 0; i < block.length; i++) {\n const tx = await block.getTransaction(i);\n if (tx.from === this.from && tx.nonce === this.nonce) {\n // Get the receipt\n if (stopScanning) {\n return null;\n }\n const receipt = await this.provider.getTransactionReceipt(tx.hash);\n // This should not happen; but we'll try again shortly\n if (receipt == null) {\n return;\n }\n // We will retry this on the next block (this case could be optimized)\n if (blockNumber - receipt.blockNumber + 1 < confirms) {\n return;\n }\n // The reason we were replaced\n let reason = \"replaced\";\n if (tx.data === this.data &&\n tx.to === this.to &&\n tx.value === this.value) {\n reason = \"repriced\";\n }\n else if (tx.data === \"0x\" &&\n tx.from === tx.to &&\n tx.value === BN_0) {\n reason = \"cancelled\";\n }\n assert(false, \"transaction was replaced\", \"TRANSACTION_REPLACED\", {\n cancelled: reason === \"replaced\" || reason === \"cancelled\",\n reason,\n replacement: tx.replaceableTransaction(startBlock),\n hash: tx.hash,\n receipt,\n });\n }\n }\n nextScan++;\n }\n return;\n };\n const receipt = await this.provider.getTransactionReceipt(this.hash);\n if (receipt) {\n if ((await receipt.confirmations()) >= confirms) {\n return receipt;\n }\n }\n else {\n // Check for a replacement; throws if a replacement was found\n await checkReplacement();\n // Allow null only when the confirms is 0\n if (confirms === 0) {\n return null;\n }\n }\n const waiter = new Promise((resolve, reject) => {\n // List of things to cancel when we have a result (one way or the other)\n const cancellers = [];\n const cancel = () => {\n cancellers.forEach((c) => c());\n };\n // On cancel, stop scanning for replacements\n cancellers.push(() => {\n stopScanning = true;\n });\n // Set up any timeout requested\n if (timeout > 0) {\n const timer = setTimeout(() => {\n cancel();\n reject(makeError(\"wait for transaction timeout\", \"TIMEOUT\"));\n }, timeout);\n cancellers.push(() => {\n clearTimeout(timer);\n });\n }\n const txListener = async (receipt) => {\n // Done; return it!\n if ((await receipt.confirmations()) >= confirms) {\n cancel();\n resolve(receipt);\n }\n };\n cancellers.push(() => {\n this.provider.off(this.hash, txListener);\n });\n this.provider.on(this.hash, txListener);\n // We support replacement detection; start checking\n if (startBlock >= 0) {\n const replaceListener = async () => {\n try {\n // Check for a replacement; this throws only if one is found\n await checkReplacement();\n }\n catch (error) {\n // We were replaced (with enough confirms); re-throw the error\n if (isError(error, \"TRANSACTION_REPLACED\")) {\n cancel();\n reject(error);\n return;\n }\n }\n // Rescheudle a check on the next block\n if (!stopScanning) {\n this.provider.once(\"block\", replaceListener);\n }\n };\n cancellers.push(() => {\n this.provider.off(\"block\", replaceListener);\n });\n this.provider.once(\"block\", replaceListener);\n }\n });\n return await waiter;\n }\n /**\n * Returns ``true`` if this transaction has been included.\n *\n * This is effective only as of the time the TransactionResponse\n * was instantiated. To get up-to-date information, use\n * [[getTransaction]].\n *\n * This provides a Type Guard that this transaction will have\n * non-null property values for properties that are null for\n * unmined transactions.\n */\n isMined() {\n return this.blockHash != null;\n }\n /**\n * Returns true if the transaction is a legacy (i.e. ``type == 0``)\n * transaction.\n *\n * This provides a Type Guard that this transaction will have\n * the ``null``-ness for hardfork-specific properties set correctly.\n */\n isLegacy() {\n return this.type === 0;\n }\n /**\n * Returns a filter which can be used to listen for orphan events\n * that evict this transaction.\n */\n removedEvent() {\n assert(this.isMined(), \"unmined transaction canot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n return createRemovedTransactionFilter(this);\n }\n /**\n * Returns a filter which can be used to listen for orphan events\n * that re-order this event against %%other%%.\n */\n reorderedEvent(other) {\n assert(this.isMined(), \"unmined transaction canot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n assert(!other || other.isMined(), \"unmined 'other' transaction canot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n return createReorderedTransactionFilter(this, other);\n }\n /**\n * Returns a new TransactionResponse instance which has the ability to\n * detect (and throw an error) if the transaction is replaced, which\n * will begin scanning at %%startBlock%%.\n *\n * This should generally not be used by developers and is intended\n * primarily for internal use. Setting an incorrect %%startBlock%% can\n * have devastating performance consequences if used incorrectly.\n */\n replaceableTransaction(startBlock) {\n assertArgument(Number.isInteger(startBlock) && startBlock >= 0, \"invalid startBlock\", \"startBlock\", startBlock);\n const tx = new TransactionResponse(this, this.provider);\n tx.#startBlock = startBlock;\n return tx;\n }\n}\nfunction createOrphanedBlockFilter(block) {\n return { orphan: \"drop-block\", hash: block.hash, number: block.number };\n}\nfunction createReorderedTransactionFilter(tx, other) {\n return { orphan: \"reorder-transaction\", tx, other };\n}\nfunction createRemovedTransactionFilter(tx) {\n return { orphan: \"drop-transaction\", tx };\n}\nfunction createRemovedLogFilter(log) {\n return {\n orphan: \"drop-log\",\n log: {\n transactionHash: log.transactionHash,\n blockHash: log.blockHash,\n blockNumber: log.blockNumber,\n address: log.address,\n data: log.data,\n topics: Object.freeze(log.topics.slice()),\n index: log.index,\n },\n };\n}\n//# sourceMappingURL=provider.js.map","import { Log, TransactionReceipt, TransactionResponse, } from \"../providers/provider.js\";\nimport { defineProperties, EventPayload } from \"../utils/index.js\";\nexport class EventLog extends Log {\n interface;\n fragment;\n args;\n constructor(log, iface, fragment) {\n super(log, log.provider);\n const args = iface.decodeEventLog(fragment, log.data, log.topics);\n defineProperties(this, { args, fragment, interface: iface });\n }\n get eventName() {\n return this.fragment.name;\n }\n get eventSignature() {\n return this.fragment.format();\n }\n}\nexport class ContractTransactionReceipt extends TransactionReceipt {\n #iface;\n constructor(iface, provider, tx) {\n super(tx, provider);\n this.#iface = iface;\n }\n get logs() {\n return super.logs.map((log) => {\n const fragment = log.topics.length\n ? this.#iface.getEvent(log.topics[0])\n : null;\n if (fragment) {\n return new EventLog(log, this.#iface, fragment);\n }\n else {\n return log;\n }\n });\n }\n}\nexport class ContractTransactionResponse extends TransactionResponse {\n #iface;\n constructor(iface, provider, tx) {\n super(tx, provider);\n this.#iface = iface;\n }\n async wait(confirms) {\n const receipt = await super.wait();\n if (receipt == null) {\n return null;\n }\n return new ContractTransactionReceipt(this.#iface, this.provider, receipt);\n }\n}\nexport class ContractUnknownEventPayload extends EventPayload {\n log;\n constructor(contract, listener, filter, log) {\n super(contract, listener, filter);\n defineProperties(this, { log });\n }\n async getBlock() {\n return await this.log.getBlock();\n }\n async getTransaction() {\n return await this.log.getTransaction();\n }\n async getTransactionReceipt() {\n return await this.log.getTransactionReceipt();\n }\n}\nexport class ContractEventPayload extends ContractUnknownEventPayload {\n constructor(contract, listener, filter, fragment, _log) {\n super(contract, listener, filter, new EventLog(_log, contract.interface, fragment));\n const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics);\n defineProperties(this, { args, fragment });\n }\n get eventName() {\n return this.fragment.name;\n }\n get eventSignature() {\n return this.fragment.format();\n }\n}\n//# sourceMappingURL=wrappers.js.map","import { Indexed, Interface, Typed } from \"../abi/index.js\";\nimport { resolveAddress } from \"../address/checks.js\";\nimport { copyRequest, Log, } from \"../providers/provider.js\";\nimport { defineProperties, isCallException, isHexString, resolveProperties, makeError, assert, assertArgument, } from \"../utils/index.js\";\nimport { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionResponse, EventLog, } from \"./wrappers.js\";\nconst BN_0 = BigInt(0);\nfunction canCall(value) {\n return value && typeof value.call === \"function\";\n}\nfunction canEstimate(value) {\n return value && typeof value.estimateEnergy === \"function\";\n}\nfunction canResolve(value) {\n return value && typeof value.resolveName === \"function\";\n}\nfunction canSend(value) {\n return value && typeof value.sendTransaction === \"function\";\n}\nclass PreparedTopicFilter {\n #filter;\n fragment;\n constructor(contract, fragment, args) {\n defineProperties(this, { fragment });\n if (fragment.inputs.length < args.length) {\n throw new Error(\"too many arguments\");\n }\n // Recursively descend into args and resolve any addresses\n this.#filter = (async function () {\n const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => {\n const arg = args[index];\n if (arg == null) {\n return null;\n }\n return param.walkAsync(args[index], (type, value) => {\n if (type === \"address\") {\n return resolveAddress(value);\n }\n return value;\n });\n }));\n return contract.interface.encodeFilterTopics(fragment, resolvedArgs);\n })();\n }\n getTopicFilter() {\n return this.#filter;\n }\n}\n// A = Arguments passed in as a tuple\n// R = The result type of the call (i.e. if only one return type,\n// the qualified type, otherwise Result)\n// D = The type the default call will return (i.e. R for view/pure,\n// TransactionResponse otherwise)\n//export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> {\nfunction getRunner(value, feature) {\n if (value == null) {\n return null;\n }\n if (typeof value[feature] === \"function\") {\n return value;\n }\n if (value.provider && typeof value.provider[feature] === \"function\") {\n return value.provider;\n }\n return null;\n}\nfunction getProvider(value) {\n if (value == null) {\n return null;\n }\n return value.provider || null;\n}\n/**\n * @_ignore:\n */\nexport async function copyOverrides(arg, allowed) {\n // Create a shallow copy (we'll deep-ify anything needed during normalizing)\n const overrides = copyRequest(Typed.dereference(arg, \"overrides\"));\n assertArgument(overrides.to == null || (allowed || []).indexOf(\"to\") >= 0, \"cannot override to\", \"overrides.to\", overrides.to);\n assertArgument(overrides.data == null || (allowed || []).indexOf(\"data\") >= 0, \"cannot override data\", \"overrides.data\", overrides.data);\n // Resolve any from\n if (overrides.from) {\n overrides.from = await resolveAddress(overrides.from);\n }\n return overrides;\n}\n/**\n * @_ignore:\n */\nexport async function resolveArgs(_runner, inputs, args) {\n // Recursively descend into args and resolve any addresses\n return await Promise.all(inputs.map((param, index) => {\n return param.walkAsync(args[index], (type, value) => {\n value = Typed.dereference(value, type);\n if (type === \"address\") {\n return resolveAddress(value);\n }\n return value;\n });\n }));\n}\nfunction buildWrappedFallback(contract) {\n const populateTransaction = async function (overrides) {\n // If an overrides was passed in, copy it and normalize the values\n const tx = (await copyOverrides(overrides, [\"data\"]));\n tx.to = await contract.getAddress();\n const iface = contract.interface;\n // Only allow payable contracts to set non-zero value\n const payable = iface.receive || (iface.fallback && iface.fallback.payable);\n assertArgument(payable || (tx.value || BN_0) === BN_0, \"cannot send value to non-payable contract\", \"overrides.value\", tx.value);\n // Only allow fallback contracts to set non-empty data\n assertArgument(iface.fallback || (tx.data || \"0x\") === \"0x\", \"cannot send data to receive-only contract\", \"overrides.data\", tx.data);\n return tx;\n };\n const staticCall = async function (overrides) {\n const runner = getRunner(contract.runner, \"call\");\n assert(canCall(runner), \"contract runner does not support calling\", \"UNSUPPORTED_OPERATION\", { operation: \"call\" });\n const tx = await populateTransaction(overrides);\n try {\n return await runner.call(tx);\n }\n catch (error) {\n if (isCallException(error) && error.data) {\n throw contract.interface.makeError(error.data, tx);\n }\n throw error;\n }\n };\n const send = async function (overrides) {\n const runner = contract.runner;\n assert(canSend(runner), \"contract runner does not support sending transactions\", \"UNSUPPORTED_OPERATION\", { operation: \"sendTransaction\" });\n const tx = await runner.sendTransaction(await populateTransaction(overrides));\n const provider = getProvider(contract.runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n return new ContractTransactionResponse(contract.interface, provider, tx);\n };\n const estimateEnergy = async function (overrides) {\n const runner = getRunner(contract.runner, \"estimateEnergy\");\n assert(canEstimate(runner), \"contract runner does not support energy estimation\", \"UNSUPPORTED_OPERATION\", { operation: \"estimateEnergy\" });\n return await runner.estimateEnergy(await populateTransaction(overrides));\n };\n const method = async (overrides) => {\n return await send(overrides);\n };\n defineProperties(method, {\n _contract: contract,\n estimateEnergy,\n populateTransaction,\n send,\n staticCall,\n });\n return method;\n}\nfunction buildWrappedMethod(contract, key) {\n const getFragment = function (...args) {\n const fragment = contract.interface.getFunction(key, args);\n assert(fragment, \"no matching fragment in getFragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n });\n return fragment;\n };\n const populateTransaction = async function (...args) {\n const fragment = getFragment(...args);\n // If an overrides was passed in, copy it and normalize the values\n let overrides = {};\n if (fragment.inputs.length + 1 === args.length) {\n overrides = await copyOverrides(args.pop());\n }\n if (fragment.inputs.length !== args.length) {\n throw new Error(\"internal error: fragment inputs doesn't match arguments; should not happen\");\n }\n const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args);\n return Object.assign({}, overrides, await resolveProperties({\n to: contract.getAddress(),\n data: contract.interface.encodeFunctionData(fragment, resolvedArgs),\n }));\n };\n const staticCall = async function (...args) {\n const result = await staticCallResult(...args);\n if (result.length === 1) {\n return result[0];\n }\n return result;\n };\n const send = async function (...args) {\n const runner = contract.runner;\n assert(canSend(runner), \"contract runner does not support sending transactions\", \"UNSUPPORTED_OPERATION\", { operation: \"sendTransaction\" });\n const tx = await runner.sendTransaction(await populateTransaction(...args));\n const provider = getProvider(contract.runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n return new ContractTransactionResponse(contract.interface, provider, tx);\n };\n const estimateEnergy = async function (...args) {\n const runner = getRunner(contract.runner, \"estimateEnergy\");\n assert(canEstimate(runner), \"contract runner does not support energy estimation\", \"UNSUPPORTED_OPERATION\", { operation: \"estimateEnergy\" });\n return await runner.estimateEnergy(await populateTransaction(...args));\n };\n const staticCallResult = async function (...args) {\n const runner = getRunner(contract.runner, \"call\");\n assert(canCall(runner), \"contract runner does not support calling\", \"UNSUPPORTED_OPERATION\", { operation: \"call\" });\n const tx = await populateTransaction(...args);\n let result = \"0x\";\n try {\n result = await runner.call(tx);\n }\n catch (error) {\n if (isCallException(error) && error.data) {\n throw contract.interface.makeError(error.data, tx);\n }\n throw error;\n }\n const fragment = getFragment(...args);\n return contract.interface.decodeFunctionResult(fragment, result);\n };\n const method = async (...args) => {\n const fragment = getFragment(...args);\n if (fragment.constant) {\n return await staticCall(...args);\n }\n return await send(...args);\n };\n defineProperties(method, {\n name: contract.interface.getFunctionName(key),\n _contract: contract,\n _key: key,\n getFragment,\n estimateEnergy,\n populateTransaction,\n send,\n staticCall,\n staticCallResult,\n });\n // Only works on non-ambiguous keys (refined fragment is always non-ambiguous)\n Object.defineProperty(method, \"fragment\", {\n configurable: false,\n enumerable: true,\n get: () => {\n const fragment = contract.interface.getFunction(key);\n assert(fragment, \"no matching fragment in defineProperty\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n });\n return fragment;\n },\n });\n return method;\n}\nfunction buildWrappedEvent(contract, key) {\n const getFragment = function (...args) {\n const fragment = contract.interface.getEvent(key, args);\n assert(fragment, \"no matching fragment in\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n });\n return fragment;\n };\n const method = function (...args) {\n return new PreparedTopicFilter(contract, getFragment(...args), args);\n };\n defineProperties(method, {\n name: contract.interface.getEventName(key),\n _contract: contract,\n _key: key,\n getFragment,\n });\n // Only works on non-ambiguous keys (refined fragment is always non-ambiguous)\n Object.defineProperty(method, \"fragment\", {\n configurable: false,\n enumerable: true,\n get: () => {\n const fragment = contract.interface.getEvent(key);\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n });\n return fragment;\n },\n });\n return method;\n}\n// The combination of TypeScrype, Private Fields and Proxies makes\n// the world go boom; so we hide variables with some trickery keeping\n// a symbol attached to each BaseContract which its sub-class (even\n// via a Proxy) can reach and use to look up its internal values.\nconst internal = Symbol.for(\"_corebcInternal_contract\");\nconst internalValues = new WeakMap();\nfunction setInternal(contract, values) {\n internalValues.set(contract[internal], values);\n}\nfunction getInternal(contract) {\n return internalValues.get(contract[internal]);\n}\nfunction isDeferred(value) {\n return (value &&\n typeof value === \"object\" &&\n \"getTopicFilter\" in value &&\n typeof value.getTopicFilter === \"function\" &&\n value.fragment);\n}\nasync function getSubInfo(contract, event) {\n let topics;\n let fragment = null;\n // Convert named events to topicHash and get the fragment for\n // events which need deconstructing.\n if (Array.isArray(event)) {\n const topicHashify = function (name) {\n if (isHexString(name, 32)) {\n return name;\n }\n const fragment = contract.interface.getEvent(name);\n assertArgument(fragment, \"unknown fragment\", \"name\", name);\n return fragment.topicHash;\n };\n // Array of Topics and Names; e.g. `[ \"0x1234...89ab\", \"Transfer(address)\" ]`\n topics = event.map((e) => {\n if (e == null) {\n return null;\n }\n if (Array.isArray(e)) {\n return e.map(topicHashify);\n }\n return topicHashify(e);\n });\n }\n else if (event === \"*\") {\n topics = [null];\n }\n else if (typeof event === \"string\") {\n if (isHexString(event, 32)) {\n // Topic Hash\n topics = [event];\n }\n else {\n // Name or Signature; e.g. `\"Transfer\", `\"Transfer(address)\"`\n fragment = contract.interface.getEvent(event);\n assertArgument(fragment, \"unknown fragment\", \"event\", event);\n topics = [fragment.topicHash];\n }\n }\n else if (isDeferred(event)) {\n // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)`\n topics = await event.getTopicFilter();\n }\n else if (\"fragment\" in event) {\n // ContractEvent; e.g. `contract.filter.Transfer`\n fragment = event.fragment;\n topics = [fragment.topicHash];\n }\n else {\n assertArgument(false, \"unknown event name\", \"event\", event);\n }\n // Normalize topics and sort TopicSets\n topics = topics.map((t) => {\n if (t == null) {\n return null;\n }\n if (Array.isArray(t)) {\n const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values());\n if (items.length === 1) {\n return items[0];\n }\n items.sort();\n return items;\n }\n return t.toLowerCase();\n });\n const tag = topics\n .map((t) => {\n if (t == null) {\n return \"null\";\n }\n if (Array.isArray(t)) {\n return t.join(\"|\");\n }\n return t;\n })\n .join(\"&\");\n return { fragment, tag, topics };\n}\nasync function hasSub(contract, event) {\n const { subs } = getInternal(contract);\n return subs.get((await getSubInfo(contract, event)).tag) || null;\n}\nasync function getSub(contract, operation, event) {\n // Make sure our runner can actually subscribe to events\n const provider = getProvider(contract.runner);\n assert(provider, \"contract runner does not support subscribing\", \"UNSUPPORTED_OPERATION\", { operation });\n const { fragment, tag, topics } = await getSubInfo(contract, event);\n const { addr, subs } = getInternal(contract);\n let sub = subs.get(tag);\n if (!sub) {\n const address = addr ? addr : contract;\n const filter = { address, topics };\n const listener = (log) => {\n let foundFragment = fragment;\n if (foundFragment == null) {\n try {\n foundFragment = contract.interface.getEvent(log.topics[0]);\n }\n catch (error) { }\n }\n // If fragment is null, we do not deconstruct the args to emit\n if (foundFragment) {\n const _foundFragment = foundFragment;\n const args = fragment\n ? contract.interface.decodeEventLog(fragment, log.data, log.topics)\n : [];\n emit(contract, event, args, (listener) => {\n return new ContractEventPayload(contract, listener, event, _foundFragment, log);\n });\n }\n else {\n emit(contract, event, [], (listener) => {\n return new ContractUnknownEventPayload(contract, listener, event, log);\n });\n }\n };\n let starting = [];\n const start = () => {\n if (starting.length) {\n return;\n }\n starting.push(provider.on(filter, listener));\n };\n const stop = async () => {\n if (starting.length == 0) {\n return;\n }\n let started = starting;\n starting = [];\n await Promise.all(started);\n provider.off(filter, listener);\n };\n sub = { tag, listeners: [], start, stop };\n subs.set(tag, sub);\n }\n return sub;\n}\n// We use this to ensure one emit resolves before firing the next to\n// ensure correct ordering (note this cannot throw and just adds the\n// notice to the event queu using setTimeout).\nlet lastEmit = Promise.resolve();\nasync function _emit(contract, event, args, payloadFunc) {\n await lastEmit;\n const sub = await hasSub(contract, event);\n if (!sub) {\n return false;\n }\n const count = sub.listeners.length;\n sub.listeners = sub.listeners.filter(({ listener, once }) => {\n const passArgs = Array.from(args);\n if (payloadFunc) {\n passArgs.push(payloadFunc(once ? null : listener));\n }\n try {\n listener.call(contract, ...passArgs);\n }\n catch (error) { }\n return !once;\n });\n return count > 0;\n}\nasync function emit(contract, event, args, payloadFunc) {\n try {\n await lastEmit;\n }\n catch (error) { }\n const resultPromise = _emit(contract, event, args, payloadFunc);\n lastEmit = resultPromise;\n return await resultPromise;\n}\nconst passProperties = [\"then\"];\nexport class BaseContract {\n target;\n interface;\n runner;\n filters;\n [internal];\n fallback;\n constructor(target, abi, runner, _deployTx) {\n if (runner == null) {\n runner = null;\n }\n const iface = Interface.from(abi);\n defineProperties(this, { target, runner, interface: iface });\n Object.defineProperty(this, internal, { value: {} });\n let addrPromise;\n let addr = null;\n let deployTx = null;\n if (_deployTx) {\n const provider = getProvider(runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx);\n }\n let subs = new Map();\n // Resolve the target as the address\n if (typeof target === \"string\") {\n if (isHexString(target)) {\n addr = target;\n addrPromise = Promise.resolve(target);\n }\n else {\n const resolver = getRunner(runner, \"resolveName\");\n if (!canResolve(resolver)) {\n throw makeError(\"contract runner does not support name resolution\", \"UNSUPPORTED_OPERATION\", {\n operation: \"resolveName\",\n });\n }\n addrPromise = resolver.resolveName(target).then((addr) => {\n if (addr == null) {\n throw new Error(\"TODO\");\n }\n getInternal(this).addr = addr;\n return addr;\n });\n }\n }\n else {\n addrPromise = target.getAddress().then((addr) => {\n if (addr == null) {\n throw new Error(\"TODO\");\n }\n getInternal(this).addr = addr;\n return addr;\n });\n }\n // Set our private values\n setInternal(this, { addrPromise, addr, deployTx, subs });\n // Add the event filters\n const filters = new Proxy({}, {\n get: (target, _prop, receiver) => {\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(_prop) >= 0) {\n return Reflect.get(target, _prop, receiver);\n }\n const prop = String(_prop);\n const result = this.getEvent(prop);\n if (result) {\n return result;\n }\n throw new Error(`unknown contract event: ${prop}`);\n },\n has: (target, prop) => {\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(prop) >= 0) {\n return Reflect.has(target, prop);\n }\n return (Reflect.has(target, prop) || this.interface.hasEvent(String(prop)));\n },\n });\n defineProperties(this, { filters });\n defineProperties(this, {\n fallback: iface.receive || iface.fallback ? buildWrappedFallback(this) : null,\n });\n // Return a Proxy that will respond to functions\n return new Proxy(this, {\n get: (target, _prop, receiver) => {\n if (_prop in target || passProperties.indexOf(_prop) >= 0) {\n return Reflect.get(target, _prop, receiver);\n }\n const prop = String(_prop);\n const result = target.getFunction(prop);\n if (result) {\n return result;\n }\n throw new Error(`unknown contract method: ${prop}`);\n },\n has: (target, prop) => {\n if (prop in target || passProperties.indexOf(prop) >= 0) {\n return Reflect.has(target, prop);\n }\n return target.interface.hasFunction(String(prop));\n },\n });\n }\n connect(runner) {\n return new BaseContract(this.target, this.interface, runner);\n }\n async getAddress() {\n return await getInternal(this).addrPromise;\n }\n async getDeployedCode() {\n const provider = getProvider(this.runner);\n assert(provider, \"runner does not support .provider\", \"UNSUPPORTED_OPERATION\", { operation: \"getDeployedCode\" });\n const code = await provider.getCode(await this.getAddress());\n if (code === \"0x\") {\n return null;\n }\n return code;\n }\n async waitForDeployment() {\n // We have the deployement transaction; just use that (throws if deployement fails)\n const deployTx = this.deploymentTransaction();\n if (deployTx) {\n await deployTx.wait();\n return this;\n }\n // Check for code\n const code = await this.getDeployedCode();\n if (code != null) {\n return this;\n }\n // Make sure we can subscribe to a provider event\n const provider = getProvider(this.runner);\n assert(provider != null, \"contract runner does not support .provider\", \"UNSUPPORTED_OPERATION\", { operation: \"waitForDeployment\" });\n return new Promise((resolve, reject) => {\n const checkCode = async () => {\n try {\n const code = await this.getDeployedCode();\n if (code != null) {\n return resolve(this);\n }\n provider.once(\"block\", checkCode);\n }\n catch (error) {\n reject(error);\n }\n };\n checkCode();\n });\n }\n deploymentTransaction() {\n return getInternal(this).deployTx;\n }\n getFunction(key) {\n if (typeof key !== \"string\") {\n key = key.format();\n }\n const func = buildWrappedMethod(this, key);\n return func;\n }\n getEvent(key) {\n if (typeof key !== \"string\") {\n key = key.format();\n }\n return buildWrappedEvent(this, key);\n }\n async queryTransaction(hash) {\n // Is this useful?\n throw new Error(\"@TODO\");\n }\n async queryFilter(event, fromBlock, toBlock) {\n if (fromBlock == null) {\n fromBlock = 0;\n }\n if (toBlock == null) {\n toBlock = \"latest\";\n }\n const { addr, addrPromise } = getInternal(this);\n const address = addr ? addr : await addrPromise;\n const { fragment, topics } = await getSubInfo(this, event);\n const filter = { address, topics, fromBlock, toBlock };\n const provider = getProvider(this.runner);\n assert(provider, \"contract runner does not have a provider\", \"UNSUPPORTED_OPERATION\", { operation: \"queryFilter\" });\n return (await provider.getLogs(filter)).map((log) => {\n let foundFragment = fragment;\n if (foundFragment == null) {\n try {\n foundFragment = this.interface.getEvent(log.topics[0]);\n }\n catch (error) { }\n }\n if (foundFragment) {\n return new EventLog(log, this.interface, foundFragment);\n }\n else {\n return new Log(log, provider);\n }\n });\n }\n async on(event, listener) {\n const sub = await getSub(this, \"on\", event);\n sub.listeners.push({ listener, once: false });\n sub.start();\n return this;\n }\n async once(event, listener) {\n const sub = await getSub(this, \"once\", event);\n sub.listeners.push({ listener, once: true });\n sub.start();\n return this;\n }\n async emit(event, ...args) {\n return await emit(this, event, args, null);\n }\n async listenerCount(event) {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return 0;\n }\n return sub.listeners.length;\n }\n const { subs } = getInternal(this);\n let total = 0;\n for (const { listeners } of subs.values()) {\n total += listeners.length;\n }\n return total;\n }\n async listeners(event) {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return [];\n }\n return sub.listeners.map(({ listener }) => listener);\n }\n const { subs } = getInternal(this);\n let result = [];\n for (const { listeners } of subs.values()) {\n result = result.concat(listeners.map(({ listener }) => listener));\n }\n return result;\n }\n async off(event, listener) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return this;\n }\n if (listener) {\n const index = sub.listeners\n .map(({ listener }) => listener)\n .indexOf(listener);\n if (index >= 0) {\n sub.listeners.splice(index, 1);\n }\n }\n if (listener == null || sub.listeners.length === 0) {\n sub.stop();\n getInternal(this).subs.delete(sub.tag);\n }\n return this;\n }\n async removeAllListeners(event) {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return this;\n }\n sub.stop();\n getInternal(this).subs.delete(sub.tag);\n }\n else {\n const { subs } = getInternal(this);\n for (const { tag, stop } of subs.values()) {\n stop();\n subs.delete(tag);\n }\n }\n return this;\n }\n // Alias for \"on\"\n async addListener(event, listener) {\n return await this.on(event, listener);\n }\n // Alias for \"off\"\n async removeListener(event, listener) {\n return await this.off(event, listener);\n }\n static buildClass(abi) {\n class CustomContract extends BaseContract {\n constructor(address, runner = null) {\n super(address, abi, runner);\n }\n }\n return CustomContract;\n }\n static from(target, abi, runner) {\n if (runner == null) {\n runner = null;\n }\n const contract = new this(target, abi, runner);\n return contract;\n }\n static isIndexed(value) {\n return Indexed.isIndexed(value);\n }\n}\nfunction _ContractBase() {\n return BaseContract;\n}\nexport class Contract extends _ContractBase() {\n}\n//# sourceMappingURL=contract.js.map","import { Interface } from \"../abi/index.js\";\nimport { getCreateAddress } from \"../address/contract-address.js\";\nimport { concat, defineProperties, getBytes, hexlify, assert, assertArgument, } from \"../utils/index.js\";\nimport { BaseContract, copyOverrides, resolveArgs } from \"./contract.js\";\nimport { isBytes } from \"../utils/data.js\";\n// A = Arguments to the constructor\n// I = Interface of deployed contracts\nexport class ContractFactory {\n interface;\n bytecode;\n runner;\n constructor(abi, bytecode, runner) {\n const iface = Interface.from(abi);\n // Dereference Solidity bytecode objects and allow a missing `0x`-prefix\n if (bytecode instanceof Uint8Array) {\n bytecode = hexlify(getBytes(bytecode));\n }\n else if (typeof bytecode === \"string\") {\n bytecode = bytecode;\n }\n else if (isBytes(bytecode)) {\n bytecode = hexlify(bytecode);\n }\n else if (bytecode && typeof bytecode.object === \"string\") {\n // Allow the bytecode object from the Solidity compiler\n bytecode = bytecode.object;\n }\n else {\n // Crash in the next verification step\n bytecode = \"!\";\n }\n defineProperties(this, {\n // @ts-ignore\n bytecode,\n interface: iface,\n runner: runner || null,\n });\n }\n async getDeployTransaction(...args) {\n let overrides = {};\n const fragment = this.interface.deploy;\n if (fragment.inputs.length + 1 === args.length) {\n overrides = await copyOverrides(args.pop());\n }\n if (fragment.inputs.length !== args.length) {\n throw new Error(\"incorrect number of arguments to constructor\");\n }\n const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args);\n const data = concat([\n this.bytecode,\n this.interface.encodeDeploy(resolvedArgs),\n ]);\n return Object.assign({}, overrides, { data });\n }\n async deploy(...args) {\n const tx = await this.getDeployTransaction(...args);\n assert(this.runner && typeof this.runner.sendTransaction === \"function\", \"factory runner does not support sending transactions\", \"UNSUPPORTED_OPERATION\", {\n operation: \"sendTransaction\",\n });\n const sentTx = await this.runner.sendTransaction(tx);\n const address = getCreateAddress(sentTx);\n return new BaseContract(address, this.interface, this.runner, sentTx);\n }\n connect(runner) {\n return new ContractFactory(this.interface, this.bytecode, runner);\n }\n static fromSolidity(output, runner) {\n assertArgument(output != null, \"bad compiler output\", \"output\", output);\n if (typeof output === \"string\") {\n output = JSON.parse(output);\n }\n const abi = output.abi;\n let bytecode = \"\";\n if (output.bytecode) {\n bytecode = output.bytecode;\n }\n else if (output.evm && output.evm.bytecode) {\n bytecode = output.evm.bytecode;\n }\n return new this(abi, bytecode, runner);\n }\n}\n//# sourceMappingURL=factory.js.map","/**\n * @_ignore\n */\nimport { getAddress } from \"../address/index.js\";\nimport { getCreateAddress } from \"../address/contract-address.js\";\nimport { accessListify } from \"../transaction/index.js\";\nimport { getBigInt, getNumber, hexlify, isHexString, zeroPadValue, assert, assertArgument, } from \"../utils/index.js\";\nconst BN_0 = BigInt(0);\nexport function allowNull(format, nullValue) {\n return function (value) {\n if (value == null) {\n return nullValue;\n }\n return format(value);\n };\n}\nexport function arrayOf(format) {\n return (array) => {\n if (!Array.isArray(array)) {\n throw new Error(\"not an array\");\n }\n return array.map((i) => format(i));\n };\n}\n// Requires an object which matches a fleet of other formatters\n// Any FormatFunc may return `undefined` to have the value omitted\n// from the result object. Calls preserve `this`.\nexport function object(format, altNames) {\n return (value) => {\n const result = {};\n for (const key in format) {\n let srcKey = key;\n if (altNames && key in altNames && !(srcKey in value)) {\n for (const altKey of altNames[key]) {\n if (altKey in value) {\n srcKey = altKey;\n break;\n }\n }\n }\n try {\n const nv = format[key](value[srcKey]);\n if (nv !== undefined) {\n result[key] = nv;\n }\n }\n catch (error) {\n const message = error instanceof Error ? error.message : \"not-an-error\";\n assert(false, `invalid value for value.${key} (${message})`, \"BAD_DATA\", { value });\n }\n }\n return result;\n };\n}\nexport function formatBoolean(value) {\n switch (value) {\n case true:\n case \"true\":\n return true;\n case false:\n case \"false\":\n return false;\n }\n assertArgument(false, `invalid boolean; ${JSON.stringify(value)}`, \"value\", value);\n}\nexport function formatData(value) {\n assertArgument(isHexString(value, true), \"invalid data\", \"value\", value);\n return value;\n}\nexport function formatHash(value) {\n assertArgument(isHexString(value, 32), \"invalid hash\", \"value\", value);\n return value;\n}\nexport function formatUint256(value) {\n if (!isHexString(value)) {\n throw new Error(\"invalid uint256\");\n }\n return zeroPadValue(value, 32);\n}\nconst _formatLog = object({\n address: getAddress,\n blockHash: formatHash,\n blockNumber: getNumber,\n data: formatData,\n index: getNumber,\n removed: allowNull(formatBoolean, false),\n topics: arrayOf(formatHash),\n transactionHash: formatHash,\n transactionIndex: getNumber,\n}, {\n index: [\"logIndex\"],\n});\nexport function formatLog(value) {\n return _formatLog(value);\n}\nconst _formatBlock = object({\n hash: allowNull(formatHash),\n parentHash: formatHash,\n number: getNumber,\n timestamp: getNumber,\n nonce: allowNull(formatData),\n difficulty: getBigInt,\n energyLimit: getBigInt,\n energyUsed: getBigInt,\n miner: allowNull(getAddress),\n extraData: formatData,\n baseFeePerEnergy: allowNull(getBigInt),\n});\nexport function formatBlock(value) {\n const result = _formatBlock(value);\n result.transactions = value.transactions.map((tx) => {\n if (typeof tx === \"string\") {\n return tx;\n }\n return formatTransactionResponse(tx);\n });\n return result;\n}\nconst _formatReceiptLog = object({\n transactionIndex: getNumber,\n blockNumber: getNumber,\n transactionHash: formatHash,\n address: getAddress,\n topics: arrayOf(formatHash),\n data: formatData,\n index: getNumber,\n blockHash: formatHash,\n}, {\n index: [\"logIndex\"],\n});\nexport function formatReceiptLog(value) {\n return _formatReceiptLog(value);\n}\nconst _formatTransactionReceipt = object({\n to: allowNull(getAddress, null),\n from: allowNull(getAddress, null),\n contractAddress: allowNull(getAddress, null),\n // should be allowNull(hash), but broken-EIP-658 support is handled in receipt\n index: getNumber,\n root: allowNull(hexlify),\n energyUsed: getBigInt,\n logsBloom: allowNull(formatData),\n blockHash: formatHash,\n hash: formatHash,\n logs: arrayOf(formatReceiptLog),\n blockNumber: getNumber,\n //confirmations: allowNull(getNumber, null),\n cumulativeEnergyUsed: getBigInt,\n effectiveEnergyPrice: allowNull(getBigInt),\n status: allowNull(getNumber),\n type: allowNull(getNumber, 0),\n}, {\n effectiveEnergyPrice: [\"energyPrice\"],\n hash: [\"transactionHash\"],\n index: [\"transactionIndex\"],\n});\nexport function formatTransactionReceipt(value) {\n return _formatTransactionReceipt(value);\n}\nexport function formatTransactionResponse(value) {\n // Some clients (TestRPC) do strange things like return 0x0 for the\n // 0 address; correct this to be a real address\n if (value.to && !getAddress(value.to) && getBigInt(value.to) === BN_0) {\n value.to = \"0x0000000000000000000000000000000000000000\";\n }\n const result = object({\n hash: formatHash,\n type: (value) => {\n if (value === \"0x\" || value == null) {\n return 0;\n }\n return getNumber(value);\n },\n accessList: allowNull(accessListify, null),\n blockHash: allowNull(formatHash, null),\n blockNumber: allowNull(getNumber, null),\n transactionIndex: allowNull(getNumber, null),\n //confirmations: allowNull(getNumber, null),\n from: getAddress,\n maxFeePerEnergy: allowNull(getBigInt),\n energyLimit: getBigInt,\n to: allowNull(getAddress, null),\n value: getBigInt,\n nonce: getNumber,\n data: formatData,\n creates: allowNull(getAddress, null),\n networkId: allowNull(getBigInt, null),\n }, {\n data: [\"input\"],\n energyLimit: [\"energy\"],\n })(value);\n // If to and creates are empty, populate the creates from the value\n if (result.to == null && result.creates == null) {\n result.creates = getCreateAddress(result);\n }\n // Compute the signature\n if (value.signature) {\n result.signature = value.signature;\n }\n else {\n result.signature = value;\n }\n // Some backends omit networkId on legacy transactions, but we can compute it\n if (result.networkId == null) {\n const networkId = result.signature.legacynetworkId;\n if (networkId != null) {\n result.networkId = networkId;\n }\n }\n // @TODO: check networkId\n /*\n if (value.networkId != null) {\n let networkId = value.networkId;\n \n if (isHexString(networkId)) {\n networkId = BigNumber.from(networkId).toNumber();\n }\n \n result.networkId = networkId;\n \n } else {\n let networkId = value.networkId;\n \n // geth-etc returns networkId\n if (networkId == null && result.v == null) {\n networkId = value.networkId;\n }\n \n if (isHexString(networkId)) {\n networkId = BigNumber.from(networkId).toNumber();\n }\n \n if (typeof(networkId) !== \"number\" && result.v != null) {\n networkId = (result.v - 35) / 2;\n if (networkId < 0) { networkId = 0; }\n networkId = parseInt(networkId);\n }\n \n if (typeof(networkId) !== \"number\") { networkId = 0; }\n \n result.networkId = networkId;\n }\n */\n // 0x0000... should actually be null\n if (result.blockHash && getBigInt(result.blockHash) === BN_0) {\n result.blockHash = null;\n }\n return result;\n}\n//# sourceMappingURL=format.js.map","import { defineProperties } from \"../utils/properties.js\";\nimport { assertArgument } from \"../utils/index.js\";\nexport class NetworkPlugin {\n name;\n constructor(name) {\n defineProperties(this, { name });\n }\n clone() {\n return new NetworkPlugin(this.name);\n }\n}\nexport class EnergyCostPlugin extends NetworkPlugin {\n effectiveBlock;\n txBase;\n txCreate;\n txDataZero;\n txDataNonzero;\n txAccessListStorageKey;\n txAccessListAddress;\n constructor(effectiveBlock, costs) {\n if (effectiveBlock == null) {\n effectiveBlock = 0;\n }\n super(`org.corebc.network.plugins.EnergyCost#${effectiveBlock || 0}`);\n const props = { effectiveBlock };\n function set(name, nullish) {\n let value = (costs || {})[name];\n if (value == null) {\n value = nullish;\n }\n assertArgument(typeof value === \"number\", `invalud value for ${name}`, \"costs\", costs);\n props[name] = value;\n }\n set(\"txBase\", 21000);\n set(\"txCreate\", 32000);\n set(\"txDataZero\", 4);\n set(\"txDataNonzero\", 16);\n set(\"txAccessListStorageKey\", 1900);\n set(\"txAccessListAddress\", 2400);\n defineProperties(this, props);\n }\n clone() {\n return new EnergyCostPlugin(this.effectiveBlock, this);\n }\n}\nexport class FeeDataNetworkPlugin extends NetworkPlugin {\n #feeDataFunc;\n get feeDataFunc() {\n return this.#feeDataFunc;\n }\n constructor(feeDataFunc) {\n super(\"org.corebc.plugins.network.FeeData\");\n this.#feeDataFunc = feeDataFunc;\n }\n async getFeeData(provider) {\n return await this.#feeDataFunc(provider);\n }\n clone() {\n return new FeeDataNetworkPlugin(this.#feeDataFunc);\n }\n}\n/*\nexport class CustomBlockNetworkPlugin extends NetworkPlugin {\n readonly #blockFunc: (provider: Provider, block: BlockParams) => Block;\n readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block;\n\n async getBlock(provider: Provider, block: BlockParams): Promise> {\n return await this.#blockFunc(provider, block);\n }\n\n async getBlockions(provider: Provider, block: BlockParams): Promise> {\n return await this.#blockWithTxsFunc(provider, block);\n }\n\n clone(): CustomBlockNetworkPlugin {\n return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc);\n }\n}\n*/\n//# sourceMappingURL=plugins-network.js.map","/**\n * About networks\n *\n * @_subsection: api/providers:Networks [networks]\n */\nimport { getBigInt, assertArgument } from \"../utils/index.js\";\nimport { EnergyCostPlugin } from \"./plugins-network.js\";\n/* * * *\n// Networks which operation against an L2 can use this plugin to\n// specify how to access L1, for the purpose of resolving ENS,\n// for example.\nexport class LayerOneConnectionPlugin extends NetworkPlugin {\n readonly provider!: Provider;\n*/\n// Networks or clients with a higher need for security (such as clients\n// that may automatically make CCIP requests without user interaction)\n// can use this plugin to anonymize requests or intercept CCIP requests\n// to notify and/or receive authorization from the user\nconst Networks = new Map();\nexport class Network {\n #name;\n #networkId;\n #plugins;\n constructor(name, networkId) {\n this.#name = name;\n this.#networkId = getBigInt(networkId);\n this.#plugins = new Map();\n }\n toJSON() {\n return { name: this.name, networkId: String(this.networkId) };\n }\n /**\n * The network common name.\n *\n * This is the canonical name, as networks migh have multiple\n * names.\n */\n get name() {\n return this.#name;\n }\n set name(value) {\n this.#name = value;\n }\n /**\n * The network chain ID.\n */\n get networkId() {\n return this.#networkId;\n }\n set networkId(value) {\n this.#networkId = getBigInt(value, \"networkId\");\n }\n /**\n * Returns true if %%other%% matches this network. Any chain ID\n * must match, and if no chain ID is present, the name must match.\n *\n * This method does not currently check for additional properties,\n * such as ENS address or plug-in compatibility.\n */\n matches(other) {\n if (other == null) {\n return false;\n }\n if (typeof other === \"string\") {\n try {\n return this.networkId === getBigInt(other);\n }\n catch (error) { }\n return this.name === other;\n }\n if (typeof other === \"number\" || typeof other === \"bigint\") {\n try {\n return this.networkId === getBigInt(other);\n }\n catch (error) { }\n return false;\n }\n if (typeof other === \"object\") {\n if (other.networkId != null) {\n try {\n return this.networkId === getBigInt(other.networkId);\n }\n catch (error) { }\n return false;\n }\n if (other.name != null) {\n return this.name === other.name;\n }\n return false;\n }\n return false;\n }\n /**\n * Returns the list of plugins currently attached to this Network.\n */\n get plugins() {\n return Array.from(this.#plugins.values());\n }\n /**\n * Attach a new %%plugin%% to this Network. The network name\n * must be unique, excluding any fragment.\n */\n attachPlugin(plugin) {\n if (this.#plugins.get(plugin.name)) {\n throw new Error(`cannot replace existing plugin: ${plugin.name} `);\n }\n this.#plugins.set(plugin.name, plugin.clone());\n return this;\n }\n /**\n * Return the plugin, if any, matching %%name%% exactly. Plugins\n * with fragments will not be returned unless %%name%% includes\n * a fragment.\n */\n getPlugin(name) {\n return this.#plugins.get(name) || null;\n }\n /**\n * Gets a list of all plugins that match %%name%%, with otr without\n * a fragment.\n */\n getPlugins(basename) {\n return (this.plugins.filter((p) => p.name.split(\"#\")[0] === basename));\n }\n /**\n * Create a copy of this Network.\n */\n clone() {\n const clone = new Network(this.name, this.networkId);\n this.plugins.forEach((plugin) => {\n clone.attachPlugin(plugin.clone());\n });\n return clone;\n }\n /**\n * Compute the intrinsic energy required for a transaction.\n *\n * A EnergyCostPlugin can be attached to override the default\n * values.\n */\n computeIntrinsicEnergy(tx) {\n const costs = this.getPlugin(\"org.corebc.plugins.network.EnergyCost\") || new EnergyCostPlugin();\n let energy = costs.txBase;\n if (tx.to == null) {\n energy += costs.txCreate;\n }\n if (tx.data) {\n for (let i = 2; i < tx.data.length; i += 2) {\n if (tx.data.substring(i, i + 2) === \"00\") {\n energy += costs.txDataZero;\n }\n else {\n energy += costs.txDataNonzero;\n }\n }\n }\n return energy;\n }\n /**\n * Returns a new Network for the %%network%% name or networkId.\n */\n static from(network) {\n injectCommonNetworks();\n // Default network\n if (network == null) {\n return Network.from(\"mainnet\");\n }\n // Canonical name or chain ID\n if (typeof network === \"number\") {\n network = BigInt(network);\n }\n if (typeof network === \"string\" || typeof network === \"bigint\") {\n const networkFunc = Networks.get(network);\n if (networkFunc) {\n return networkFunc();\n }\n if (typeof network === \"bigint\") {\n return new Network(\"unknown\", network);\n }\n assertArgument(false, \"unknown network\", \"network\", network);\n }\n // Clonable with network-like abilities\n if (typeof network.clone === \"function\") {\n const clone = network.clone();\n //if (typeof(network.name) !== \"string\" || typeof(network.networkId) !== \"number\") {\n //}\n return clone;\n }\n // Networkish\n if (typeof network === \"object\") {\n assertArgument(typeof network.name === \"string\" &&\n typeof network.networkId === \"number\", \"invalid network object name or networkId\", \"network\", network);\n const custom = new Network(network.name, network.networkId);\n //if ((network).layerOneConnection) {\n // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection));\n //}\n return custom;\n }\n assertArgument(false, \"invalid network\", \"network\", network);\n }\n /**\n * Register %%nameOrnetworkId%% with a function which returns\n * an instance of a Network representing that chain.\n */\n static register(nameOrnetworkId, networkFunc) {\n if (typeof nameOrnetworkId === \"number\") {\n nameOrnetworkId = BigInt(nameOrnetworkId);\n }\n const existing = Networks.get(nameOrnetworkId);\n if (existing) {\n assertArgument(false, `conflicting network for ${JSON.stringify(existing.name)}`, \"nameOrnetworkId\", nameOrnetworkId);\n }\n Networks.set(nameOrnetworkId, networkFunc);\n }\n}\n// See: https://chainlist.org\nlet injected = false;\nfunction injectCommonNetworks() {\n if (injected) {\n return;\n }\n injected = true;\n /// Register popular Core networks\n function registerEth(name, networkId, options) {\n const func = function () {\n const network = new Network(name, networkId);\n network.attachPlugin(new EnergyCostPlugin());\n return network;\n };\n // Register the network by name and chain ID\n Network.register(name, func);\n Network.register(networkId, func);\n if (options.altNames) {\n options.altNames.forEach((name) => {\n Network.register(name, func);\n });\n }\n }\n registerEth(\"mainnet\", 1, { ensNetwork: 1, altNames: [\"homestead\"] });\n registerEth(\"ropsten\", 3, { ensNetwork: 3 });\n registerEth(\"rinkeby\", 4, { ensNetwork: 4 });\n registerEth(\"goerli\", 5, { ensNetwork: 5 });\n registerEth(\"kovan\", 42, { ensNetwork: 42 });\n registerEth(\"sepolia\", 11155111, {});\n registerEth(\"classic\", 61, {});\n registerEth(\"classicKotti\", 6, {});\n registerEth(\"xdai\", 100, { ensNetwork: 1 });\n}\n//# sourceMappingURL=network.js.map","import { assert, isHexString } from \"../utils/index.js\";\nfunction copy(obj) {\n return JSON.parse(JSON.stringify(obj));\n}\n/**\n * @TODO\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport function getPollingSubscriber(provider, event) {\n if (event === \"block\") {\n return new PollingBlockSubscriber(provider);\n }\n if (isHexString(event, 32)) {\n return new PollingTransactionSubscriber(provider, event);\n }\n assert(false, \"unsupported polling event\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getPollingSubscriber\",\n info: { event },\n });\n}\n// @TODO: refactor this\n/**\n * @TODO\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingBlockSubscriber {\n #provider;\n #poller;\n #interval;\n // The most recent block we have scanned for events. The value -2\n // indicates we still need to fetch an initial block number\n #blockNumber;\n constructor(provider) {\n this.#provider = provider;\n this.#poller = null;\n this.#interval = 4000;\n this.#blockNumber = -2;\n }\n get pollingInterval() {\n return this.#interval;\n }\n set pollingInterval(value) {\n this.#interval = value;\n }\n async #poll() {\n try {\n const blockNumber = await this.#provider.getBlockNumber();\n // Bootstrap poll to setup our initial block number\n if (this.#blockNumber === -2) {\n this.#blockNumber = blockNumber;\n return;\n }\n // @TODO: Put a cap on the maximum number of events per loop?\n if (blockNumber !== this.#blockNumber) {\n for (let b = this.#blockNumber + 1; b <= blockNumber; b++) {\n // We have been stopped\n if (this.#poller == null) {\n return;\n }\n await this.#provider.emit(\"block\", b);\n }\n this.#blockNumber = blockNumber;\n }\n }\n catch (error) {\n // @TODO: Minor bump, add an \"error\" event to let subscribers\n // know things went awry.\n //console.log(error);\n }\n // We have been stopped\n if (this.#poller == null) {\n return;\n }\n this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval);\n }\n start() {\n if (this.#poller) {\n return;\n }\n this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval);\n this.#poll();\n }\n stop() {\n if (!this.#poller) {\n return;\n }\n this.#provider._clearTimeout(this.#poller);\n this.#poller = null;\n }\n pause(dropWhilePaused) {\n this.stop();\n if (dropWhilePaused) {\n this.#blockNumber = -2;\n }\n }\n resume() {\n this.start();\n }\n}\n/**\n * @TODO\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class OnBlockSubscriber {\n #provider;\n #poll;\n #running;\n constructor(provider) {\n this.#provider = provider;\n this.#running = false;\n this.#poll = (blockNumber) => {\n this._poll(blockNumber, this.#provider);\n };\n }\n async _poll(blockNumber, provider) {\n throw new Error(\"sub-classes must override this\");\n }\n start() {\n if (this.#running) {\n return;\n }\n this.#running = true;\n this.#poll(-2);\n this.#provider.on(\"block\", this.#poll);\n }\n stop() {\n if (!this.#running) {\n return;\n }\n this.#running = false;\n this.#provider.off(\"block\", this.#poll);\n }\n pause(dropWhilePaused) {\n this.stop();\n }\n resume() {\n this.start();\n }\n}\n/**\n * @TODO\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingOrphanSubscriber extends OnBlockSubscriber {\n #filter;\n constructor(provider, filter) {\n super(provider);\n this.#filter = copy(filter);\n }\n async _poll(blockNumber, provider) {\n throw new Error(\"@TODO\");\n console.log(this.#filter);\n }\n}\n/**\n * @TODO\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingTransactionSubscriber extends OnBlockSubscriber {\n #hash;\n constructor(provider, hash) {\n super(provider);\n this.#hash = hash;\n }\n async _poll(blockNumber, provider) {\n const tx = await provider.getTransactionReceipt(this.#hash);\n if (tx) {\n provider.emit(this.#hash, tx);\n }\n }\n}\n/**\n * @TODO\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingEventSubscriber {\n #provider;\n #filter;\n #poller;\n #running;\n // The most recent block we have scanned for events. The value -2\n // indicates we still need to fetch an initial block number\n #blockNumber;\n constructor(provider, filter) {\n this.#provider = provider;\n this.#filter = copy(filter);\n this.#poller = this.#poll.bind(this);\n this.#running = false;\n this.#blockNumber = -2;\n }\n async #poll(blockNumber) {\n // The initial block hasn't been determined yet\n if (this.#blockNumber === -2) {\n return;\n }\n const filter = copy(this.#filter);\n filter.fromBlock = this.#blockNumber + 1;\n filter.toBlock = blockNumber;\n const logs = await this.#provider.getLogs(filter);\n // No logs could just mean the node has not indexed them yet,\n // so we keep a sliding window of 60 blocks to keep scanning\n if (logs.length === 0) {\n if (this.#blockNumber < blockNumber - 60) {\n this.#blockNumber = blockNumber - 60;\n }\n return;\n }\n this.#blockNumber = blockNumber;\n for (const log of logs) {\n this.#provider.emit(this.#filter, log);\n }\n }\n start() {\n if (this.#running) {\n return;\n }\n this.#running = true;\n if (this.#blockNumber === -2) {\n this.#provider.getBlockNumber().then((blockNumber) => {\n this.#blockNumber = blockNumber;\n });\n }\n this.#provider.on(\"block\", this.#poller);\n }\n stop() {\n if (!this.#running) {\n return;\n }\n this.#running = false;\n this.#provider.off(\"block\", this.#poller);\n }\n pause(dropWhilePaused) {\n this.stop();\n if (dropWhilePaused) {\n this.#blockNumber = -2;\n }\n }\n resume() {\n this.start();\n }\n}\n//# sourceMappingURL=subscriber-polling.js.map","/**\n * About Subclassing the Provider...\n *\n * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider]\n */\n// @TODO\n// Event coalescence\n// When we register an event with an async value (e.g. address is a Signer\n// or ENS name), we need to add it immeidately for the Event API, but also\n// need time to resolve the address. Upon resolving the address, we need to\n// migrate the listener to the static event. We also need to maintain a map\n// of Signer/ENS name to address so we can sync respond to listenerCount.\nimport { resolveAddress } from \"../address/checks.js\";\nimport { Transaction } from \"../transaction/index.js\";\nimport { concat, dataLength, dataSlice, hexlify, isHexString, getBigInt, getBytes, getNumber, isCallException, makeError, assert, assertArgument, FetchRequest, toBeArray, toQuantity, defineProperties, EventPayload, resolveProperties, toUtf8String, } from \"../utils/index.js\";\nimport { formatBlock, formatLog, formatTransactionReceipt, formatTransactionResponse, } from \"./format.js\";\nimport { Network } from \"./network.js\";\nimport { copyRequest, Block, FeeData, Log, TransactionReceipt, TransactionResponse, } from \"./provider.js\";\nimport { PollingBlockSubscriber, PollingEventSubscriber, PollingOrphanSubscriber, PollingTransactionSubscriber, } from \"./subscriber-polling.js\";\nconst MAX_CCIP_REDIRECTS = 10;\nfunction isPromise(value) {\n return value && typeof value.then === \"function\";\n}\nfunction getTag(prefix, value) {\n return (prefix +\n \":\" +\n JSON.stringify(value, (k, v) => {\n if (v == null) {\n return \"null\";\n }\n if (typeof v === \"bigint\") {\n return `bigint:${v.toString()}`;\n }\n if (typeof v === \"string\") {\n return v.toLowerCase();\n }\n // Sort object keys\n if (typeof v === \"object\" && !Array.isArray(v)) {\n const keys = Object.keys(v);\n keys.sort();\n return keys.reduce((accum, key) => {\n accum[key] = v[key];\n return accum;\n }, {});\n }\n return v;\n }));\n}\nexport class UnmanagedSubscriber {\n name;\n constructor(name) {\n defineProperties(this, { name });\n }\n start() { }\n stop() { }\n pause(dropWhilePaused) { }\n resume() { }\n}\nfunction copy(value) {\n return JSON.parse(JSON.stringify(value));\n}\nfunction concisify(items) {\n items = Array.from(new Set(items).values());\n items.sort();\n return items;\n}\nasync function getSubscription(_event, provider) {\n if (_event == null) {\n throw new Error(\"invalid event\");\n }\n // Normalize topic array info an EventFilter\n if (Array.isArray(_event)) {\n _event = { topics: _event };\n }\n if (typeof _event === \"string\") {\n switch (_event) {\n case \"block\":\n case \"pending\":\n case \"debug\":\n case \"error\":\n case \"network\": {\n return { type: _event, tag: _event };\n }\n }\n }\n if (isHexString(_event, 32)) {\n const hash = _event.toLowerCase();\n return { type: \"transaction\", tag: getTag(\"tx\", { hash }), hash };\n }\n if (_event.orphan) {\n const event = _event;\n // @TODO: Should lowercase and whatnot things here instead of copy...\n return {\n type: \"orphan\",\n tag: getTag(\"orphan\", event),\n filter: copy(event),\n };\n }\n if (_event.address || _event.topics) {\n const event = _event;\n const filter = {\n topics: (event.topics || []).map((t) => {\n if (t == null) {\n return null;\n }\n if (Array.isArray(t)) {\n return concisify(t.map((t) => t.toLowerCase()));\n }\n return t.toLowerCase();\n }),\n };\n if (event.address) {\n const addresses = [];\n const promises = [];\n const addAddress = (addr) => {\n if (isHexString(addr)) {\n addresses.push(addr);\n }\n else {\n promises.push((async () => {\n addresses.push(await resolveAddress(addr));\n })());\n }\n };\n if (Array.isArray(event.address)) {\n event.address.forEach(addAddress);\n }\n else {\n addAddress(event.address);\n }\n if (promises.length) {\n await Promise.all(promises);\n }\n filter.address = concisify(addresses.map((a) => a.toLowerCase()));\n }\n return { filter, tag: getTag(\"event\", filter), type: \"event\" };\n }\n assertArgument(false, \"unknown ProviderEvent\", \"event\", _event);\n}\nfunction getTime() {\n return new Date().getTime();\n}\nexport class AbstractProvider {\n #subs;\n #plugins;\n // null=unpaused, true=paused+dropWhilePaused, false=paused\n #pausedState;\n #networkPromise;\n #anyNetwork;\n #performCache;\n // The most recent block number if running an event or -1 if no \"block\" event\n #lastBlockNumber;\n #nextTimer;\n #timers;\n #disableCcipRead;\n // @TODO: This should be a () => Promise so network can be\n // done when needed; or rely entirely on _detectNetwork?\n constructor(_network) {\n if (_network === \"any\") {\n this.#anyNetwork = true;\n this.#networkPromise = null;\n }\n else if (_network) {\n const network = Network.from(_network);\n this.#anyNetwork = false;\n this.#networkPromise = Promise.resolve(network);\n setTimeout(() => {\n this.emit(\"network\", network, null);\n }, 0);\n }\n else {\n this.#anyNetwork = false;\n this.#networkPromise = null;\n }\n this.#lastBlockNumber = -1;\n this.#performCache = new Map();\n this.#subs = new Map();\n this.#plugins = new Map();\n this.#pausedState = null;\n this.#nextTimer = 1;\n this.#timers = new Map();\n this.#disableCcipRead = false;\n }\n get provider() {\n return this;\n }\n get plugins() {\n return Array.from(this.#plugins.values());\n }\n attachPlugin(plugin) {\n if (this.#plugins.get(plugin.name)) {\n throw new Error(`cannot replace existing plugin: ${plugin.name} `);\n }\n this.#plugins.set(plugin.name, plugin.connect(this));\n return this;\n }\n getPlugin(name) {\n return this.#plugins.get(name) || null;\n }\n get disableCcipRead() {\n return this.#disableCcipRead;\n }\n set disableCcipRead(value) {\n this.#disableCcipRead = !!value;\n }\n // Shares multiple identical requests made during the same 250ms\n async #perform(req) {\n // Create a tag\n const tag = getTag(req.method, req);\n let perform = this.#performCache.get(tag);\n if (!perform) {\n perform = this._perform(req);\n this.#performCache.set(tag, perform);\n setTimeout(() => {\n if (this.#performCache.get(tag) === perform) {\n this.#performCache.delete(tag);\n }\n }, 250);\n }\n return await perform;\n }\n async ccipReadFetch(tx, calldata, urls) {\n if (this.disableCcipRead || urls.length === 0 || tx.to == null) {\n return null;\n }\n const sender = tx.to.toLowerCase();\n const data = calldata.toLowerCase();\n const errorMessages = [];\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n // URL expansion\n const href = url.replace(\"{sender}\", sender).replace(\"{data}\", data);\n // If no {data} is present, use POST; otherwise GET\n //const json: string | null = (url.indexOf(\"{data}\") >= 0) ? null: JSON.stringify({ data, sender });\n //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => {\n // value.status = response.statusCode;\n // return value;\n //});\n const request = new FetchRequest(href);\n if (url.indexOf(\"{data}\") === -1) {\n request.body = { data, sender };\n }\n this.emit(\"debug\", {\n action: \"sendCcipReadFetchRequest\",\n request,\n index: i,\n urls,\n });\n let errorMessage = \"unknown error\";\n const resp = await request.send();\n try {\n const result = resp.bodyJson;\n if (result.data) {\n this.emit(\"debug\", {\n action: \"receiveCcipReadFetchResult\",\n request,\n result,\n });\n return result.data;\n }\n if (result.message) {\n errorMessage = result.message;\n }\n this.emit(\"debug\", {\n action: \"receiveCcipReadFetchError\",\n request,\n result,\n });\n }\n catch (error) { }\n // 4xx indicates the result is not present; stop\n assert(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, \"OFFCHAIN_FAULT\", {\n reason: \"404_MISSING_RESOURCE\",\n transaction: tx,\n info: { url, errorMessage },\n });\n // 5xx indicates server issue; try the next url\n errorMessages.push(errorMessage);\n }\n assert(false, `error encountered during CCIP fetch: ${errorMessages\n .map((m) => JSON.stringify(m))\n .join(\", \")}`, \"OFFCHAIN_FAULT\", {\n reason: \"500_SERVER_ERROR\",\n transaction: tx,\n info: { urls, errorMessages },\n });\n }\n _wrapBlock(value, network) {\n return new Block(formatBlock(value), this);\n }\n _wrapLog(value, network) {\n return new Log(formatLog(value), this);\n }\n _wrapTransactionReceipt(value, network) {\n return new TransactionReceipt(formatTransactionReceipt(value), this);\n }\n _wrapTransactionResponse(tx, network) {\n return new TransactionResponse(formatTransactionResponse(tx), this);\n }\n _detectNetwork() {\n assert(false, \"sub-classes must implement this\", \"UNSUPPORTED_OPERATION\", {\n operation: \"_detectNetwork\",\n });\n }\n // Sub-classes should override this and handle PerformActionRequest requests, calling\n // the super for any unhandled actions.\n async _perform(req) {\n assert(false, `unsupported method: ${req.method}`, \"UNSUPPORTED_OPERATION\", {\n operation: req.method,\n info: req,\n });\n }\n // State\n async getBlockNumber() {\n const blockNumber = getNumber(await this.#perform({ method: \"getBlockNumber\" }), \"%response\");\n if (this.#lastBlockNumber >= 0) {\n this.#lastBlockNumber = blockNumber;\n }\n return blockNumber;\n }\n _getAddress(address) {\n return resolveAddress(address);\n }\n _getBlockTag(blockTag) {\n if (blockTag == null) {\n return \"latest\";\n }\n switch (blockTag) {\n case \"earliest\":\n return \"0x0\";\n case \"latest\":\n case \"pending\":\n case \"safe\":\n case \"finalized\":\n return blockTag;\n }\n if (isHexString(blockTag)) {\n if (isHexString(blockTag, 32)) {\n return blockTag;\n }\n return toQuantity(blockTag);\n }\n if (typeof blockTag === \"bigint\") {\n blockTag = getNumber(blockTag, \"blockTag\");\n }\n if (typeof blockTag === \"number\") {\n if (blockTag >= 0) {\n return toQuantity(blockTag);\n }\n if (this.#lastBlockNumber >= 0) {\n return toQuantity(this.#lastBlockNumber + blockTag);\n }\n return this.getBlockNumber().then((b) => toQuantity(b + blockTag));\n }\n assertArgument(false, \"invalid blockTag\", \"blockTag\", blockTag);\n }\n _getFilter(filter) {\n // Create a canonical representation of the topics\n const topics = (filter.topics || []).map((t) => {\n if (t == null) {\n return null;\n }\n if (Array.isArray(t)) {\n return concisify(t.map((t) => t.toLowerCase()));\n }\n return t.toLowerCase();\n });\n const blockHash = \"blockHash\" in filter ? filter.blockHash : undefined;\n const resolve = (_address, fromBlock, toBlock) => {\n let address = undefined;\n switch (_address.length) {\n case 0:\n break;\n case 1:\n address = _address[0];\n break;\n default:\n _address.sort();\n address = _address;\n }\n if (blockHash) {\n if (fromBlock != null || toBlock != null) {\n throw new Error(\"invalid filter\");\n }\n }\n const filter = {};\n if (address) {\n filter.address = address;\n }\n if (topics.length) {\n filter.topics = topics;\n }\n if (fromBlock) {\n filter.fromBlock = fromBlock;\n }\n if (toBlock) {\n filter.toBlock = toBlock;\n }\n if (blockHash) {\n filter.blockHash = blockHash;\n }\n return filter;\n };\n // Addresses could be async (ENS names or Addressables)\n let address = [];\n if (filter.address) {\n if (Array.isArray(filter.address)) {\n for (const addr of filter.address) {\n address.push(this._getAddress(addr));\n }\n }\n else {\n address.push(this._getAddress(filter.address));\n }\n }\n let fromBlock = undefined;\n if (\"fromBlock\" in filter) {\n fromBlock = this._getBlockTag(filter.fromBlock);\n }\n let toBlock = undefined;\n if (\"toBlock\" in filter) {\n toBlock = this._getBlockTag(filter.toBlock);\n }\n if (address.filter((a) => typeof a !== \"string\").length ||\n (fromBlock != null && typeof fromBlock !== \"string\") ||\n (toBlock != null && typeof toBlock !== \"string\")) {\n return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result) => {\n return resolve(result[0], result[1], result[2]);\n });\n }\n return resolve(address, fromBlock, toBlock);\n }\n _getTransactionRequest(_request) {\n const request = copyRequest(_request);\n const promises = [];\n [\"to\", \"from\"].forEach((key) => {\n if (request[key] == null) {\n return;\n }\n const addr = resolveAddress(request[key]);\n if (isPromise(addr)) {\n promises.push((async function () {\n request[key] = await addr;\n })());\n }\n else {\n request[key] = addr;\n }\n });\n if (request.blockTag != null) {\n const blockTag = this._getBlockTag(request.blockTag);\n if (isPromise(blockTag)) {\n promises.push((async function () {\n request.blockTag = await blockTag;\n })());\n }\n else {\n request.blockTag = blockTag;\n }\n }\n if (promises.length) {\n return (async function () {\n await Promise.all(promises);\n return request;\n })();\n }\n return request;\n }\n async getNetwork() {\n // No explicit network was set and this is our first time\n if (this.#networkPromise == null) {\n // Detect the current network (shared with all calls)\n const detectNetwork = this._detectNetwork().then((network) => {\n this.emit(\"network\", network, null);\n return network;\n }, (error) => {\n // Reset the networkPromise on failure, so we will try again\n if (this.#networkPromise === detectNetwork) {\n this.#networkPromise = null;\n }\n throw error;\n });\n this.#networkPromise = detectNetwork;\n return (await detectNetwork).clone();\n }\n const networkPromise = this.#networkPromise;\n const [expected, actual] = await Promise.all([\n networkPromise,\n this._detectNetwork(), // The actual connected network\n ]);\n if (expected.networkId !== actual.networkId) {\n if (this.#anyNetwork) {\n // The \"any\" network can change, so notify listeners\n this.emit(\"network\", actual, expected);\n // Update the network if something else hasn't already changed it\n if (this.#networkPromise === networkPromise) {\n this.#networkPromise = Promise.resolve(actual);\n }\n }\n else {\n // Otherwise, we do not allow changes to the underlying network\n assert(false, `network changed: ${expected.networkId} => ${actual.networkId} `, \"NETWORK_ERROR\", {\n event: \"changed\",\n });\n }\n }\n return expected.clone();\n }\n async getEnergyPrice() {\n const { energyPrice } = await resolveProperties({\n block: this.getBlock(\"latest\"),\n energyPrice: (async () => {\n try {\n const energyPrice = await this.#perform({ method: \"getEnergyPrice\" });\n return getBigInt(energyPrice, \"%response\");\n }\n catch (error) { }\n return null;\n })(),\n });\n return new FeeData(energyPrice);\n }\n async getFeeData() {\n const { energyPrice } = await resolveProperties({\n block: this.getBlock(\"latest\"),\n energyPrice: (async () => {\n try {\n const energyPrice = await this.#perform({ method: \"getEnergyPrice\" });\n return getBigInt(energyPrice, \"%response\");\n }\n catch (error) { }\n return null;\n })(),\n });\n return new FeeData(energyPrice);\n }\n async estimateEnergy(_tx) {\n let tx = this._getTransactionRequest(_tx);\n if (isPromise(tx)) {\n tx = await tx;\n }\n return getBigInt(await this.#perform({\n method: \"estimateEnergy\",\n transaction: tx,\n }), \"%response\");\n }\n async #call(tx, blockTag, attempt) {\n assert(attempt < MAX_CCIP_REDIRECTS, \"CCIP read exceeded maximum redirections\", \"OFFCHAIN_FAULT\", {\n reason: \"TOO_MANY_REDIRECTS\",\n transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }),\n });\n // This came in as a PerformActionTransaction, so to/from are safe; we can cast\n const transaction = copyRequest(tx);\n try {\n return hexlify(await this._perform({ method: \"call\", transaction, blockTag }));\n }\n catch (error) {\n // CCIP Read OffchainLookup\n if (!this.disableCcipRead &&\n isCallException(error) &&\n error.data &&\n attempt >= 0 &&\n blockTag === \"latest\" &&\n transaction.to != null &&\n dataSlice(error.data, 0, 4) === \"0x556f1830\") {\n const data = error.data;\n const txSender = await resolveAddress(transaction.to);\n // Parse the CCIP Read Arguments\n let ccipArgs;\n try {\n ccipArgs = parseOffchainLookup(dataSlice(error.data, 4));\n }\n catch (error) {\n assert(false, error.message, \"OFFCHAIN_FAULT\", {\n reason: \"BAD_DATA\",\n transaction,\n info: { data },\n });\n }\n // Check the sender of the OffchainLookup matches the transaction\n assert(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), \"CCIP Read sender mismatch\", \"CALL_EXCEPTION\", {\n action: \"call\",\n data,\n reason: \"OffchainLookup\",\n transaction: transaction,\n invocation: null,\n revert: {\n signature: \"OffchainLookup(address,string[],bytes,bytes4,bytes)\",\n name: \"OffchainLookup\",\n args: ccipArgs.errorArgs,\n },\n });\n const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls);\n assert(ccipResult != null, \"CCIP Read failed to fetch data\", \"OFFCHAIN_FAULT\", {\n reason: \"FETCH_FAILED\",\n transaction,\n info: { data: error.data, errorArgs: ccipArgs.errorArgs },\n });\n const tx = {\n to: txSender,\n data: concat([\n ccipArgs.selector,\n encodeBytes([ccipResult, ccipArgs.extraData]),\n ]),\n };\n this.emit(\"debug\", { action: \"sendCcipReadCall\", transaction: tx });\n try {\n const result = await this.#call(tx, blockTag, attempt + 1);\n this.emit(\"debug\", {\n action: \"receiveCcipReadCallResult\",\n transaction: Object.assign({}, tx),\n result,\n });\n return result;\n }\n catch (error) {\n this.emit(\"debug\", {\n action: \"receiveCcipReadCallError\",\n transaction: Object.assign({}, tx),\n error,\n });\n throw error;\n }\n }\n throw error;\n }\n }\n async #checkNetwork(promise) {\n const { value } = await resolveProperties({\n network: this.getNetwork(),\n value: promise,\n });\n return value;\n }\n async call(_tx) {\n const { tx, blockTag } = await resolveProperties({\n tx: this._getTransactionRequest(_tx),\n blockTag: this._getBlockTag(_tx.blockTag),\n });\n return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1));\n }\n // Account\n async #getAccountValue(request, _address, _blockTag) {\n let address = this._getAddress(_address);\n let blockTag = this._getBlockTag(_blockTag);\n if (typeof address !== \"string\" || typeof blockTag !== \"string\") {\n [address, blockTag] = await Promise.all([address, blockTag]);\n }\n return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag })));\n }\n async getBalance(address, blockTag) {\n return getBigInt(await this.#getAccountValue({ method: \"getBalance\" }, address, blockTag), \"%response\");\n }\n async getTransactionCount(address, blockTag) {\n return getNumber(await this.#getAccountValue({ method: \"getTransactionCount\" }, address, blockTag), \"%response\");\n }\n async getCode(address, blockTag) {\n return hexlify(await this.#getAccountValue({ method: \"getCode\" }, address, blockTag));\n }\n async getStorage(address, _position, blockTag) {\n const position = getBigInt(_position, \"position\");\n return hexlify(await this.#getAccountValue({ method: \"getStorage\", position }, address, blockTag));\n }\n // Write\n async broadcastTransaction(signedTx) {\n const { blockNumber, hash, network } = await resolveProperties({\n blockNumber: this.getBlockNumber(),\n hash: this._perform({\n method: \"broadcastTransaction\",\n signedTransaction: signedTx,\n }),\n network: this.getNetwork(),\n });\n const tx = Transaction.from(signedTx);\n if (tx.hash !== hash) {\n throw new Error(\"@TODO: the returned hash did not match\");\n }\n return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber);\n }\n async #getBlock(block, includeTransactions) {\n // @TODO: Add CustomBlockPlugin check\n if (isHexString(block, 32)) {\n return await this.#perform({\n method: \"getBlock\",\n blockHash: block,\n includeTransactions,\n });\n }\n let blockTag = this._getBlockTag(block);\n if (typeof blockTag !== \"string\") {\n blockTag = await blockTag;\n }\n return await this.#perform({\n method: \"getBlock\",\n blockTag,\n includeTransactions,\n });\n }\n // Queries\n async getBlock(block, prefetchTxs) {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#getBlock(block, !!prefetchTxs),\n });\n if (params == null) {\n return null;\n }\n return this._wrapBlock(params, network);\n }\n async getTransaction(hash) {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform({ method: \"getTransaction\", hash }),\n });\n if (params == null) {\n return null;\n }\n return this._wrapTransactionResponse(params, network);\n }\n async getTransactionReceipt(hash) {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform({ method: \"getTransactionReceipt\", hash }),\n });\n if (params == null) {\n return null;\n }\n // Some backends did not backfill the effectiveEnergyPrice into old transactions\n // in the receipt, so we look it up manually and inject it.\n if (params.energyPrice == null && params.effectiveEnergyPrice == null) {\n const tx = await this.#perform({ method: \"getTransaction\", hash });\n if (tx == null) {\n throw new Error(\"report this; could not find tx or effectiveEnergyPrice\");\n }\n params.effectiveEnergyPrice = tx.energyPrice;\n }\n return this._wrapTransactionReceipt(params, network);\n }\n async getTransactionResult(hash) {\n const { result } = await resolveProperties({\n network: this.getNetwork(),\n result: this.#perform({ method: \"getTransactionResult\", hash }),\n });\n if (result == null) {\n return null;\n }\n return hexlify(result);\n }\n // Bloom-filter Queries\n async getLogs(_filter) {\n let filter = this._getFilter(_filter);\n if (isPromise(filter)) {\n filter = await filter;\n }\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform({ method: \"getLogs\", filter }),\n });\n return params.map((p) => this._wrapLog(p, network));\n }\n // ENS\n _getProvider(networkId) {\n assert(false, \"provider cannot connect to target network\", \"UNSUPPORTED_OPERATION\", {\n operation: \"_getProvider()\",\n });\n }\n async waitForTransaction(hash, _confirms, timeout) {\n const confirms = _confirms != null ? _confirms : 1;\n if (confirms === 0) {\n return this.getTransactionReceipt(hash);\n }\n return new Promise(async (resolve, reject) => {\n let timer = null;\n const listener = async (blockNumber) => {\n try {\n const receipt = await this.getTransactionReceipt(hash);\n if (receipt != null) {\n if (blockNumber - receipt.blockNumber + 1 >= confirms) {\n resolve(receipt);\n //this.off(\"block\", listener);\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n return;\n }\n }\n }\n catch (error) {\n console.log(\"EEE\", error);\n }\n this.once(\"block\", listener);\n };\n if (timeout != null) {\n timer = setTimeout(() => {\n if (timer == null) {\n return;\n }\n timer = null;\n this.off(\"block\", listener);\n reject(makeError(\"timeout\", \"TIMEOUT\", { reason: \"timeout\" }));\n }, timeout);\n }\n listener(await this.getBlockNumber());\n });\n }\n async waitForBlock(blockTag) {\n assert(false, \"not implemented yet\", \"NOT_IMPLEMENTED\", {\n operation: \"waitForBlock\",\n });\n }\n _clearTimeout(timerId) {\n const timer = this.#timers.get(timerId);\n if (!timer) {\n return;\n }\n if (timer.timer) {\n clearTimeout(timer.timer);\n }\n this.#timers.delete(timerId);\n }\n _setTimeout(_func, timeout) {\n if (timeout == null) {\n timeout = 0;\n }\n const timerId = this.#nextTimer++;\n const func = () => {\n this.#timers.delete(timerId);\n _func();\n };\n if (this.paused) {\n this.#timers.set(timerId, { timer: null, func, time: timeout });\n }\n else {\n const timer = setTimeout(func, timeout);\n this.#timers.set(timerId, { timer, func, time: getTime() });\n }\n return timerId;\n }\n _forEachSubscriber(func) {\n for (const sub of this.#subs.values()) {\n func(sub.subscriber);\n }\n }\n // Event API; sub-classes should override this; any supported\n // event filter will have been munged into an EventFilter\n _getSubscriber(sub) {\n switch (sub.type) {\n case \"debug\":\n case \"error\":\n case \"network\":\n return new UnmanagedSubscriber(sub.type);\n case \"block\":\n return new PollingBlockSubscriber(this);\n case \"event\":\n return new PollingEventSubscriber(this, sub.filter);\n case \"transaction\":\n return new PollingTransactionSubscriber(this, sub.hash);\n case \"orphan\":\n return new PollingOrphanSubscriber(this, sub.filter);\n }\n throw new Error(`unsupported event: ${sub.type}`);\n }\n _recoverSubscriber(oldSub, newSub) {\n for (const sub of this.#subs.values()) {\n if (sub.subscriber === oldSub) {\n if (sub.started) {\n sub.subscriber.stop();\n }\n sub.subscriber = newSub;\n if (sub.started) {\n newSub.start();\n }\n if (this.#pausedState != null) {\n newSub.pause(this.#pausedState);\n }\n break;\n }\n }\n }\n async #hasSub(event, emitArgs) {\n let sub = await getSubscription(event, this);\n // This is a log that is removing an existing log; we actually want\n // to emit an orphan event for the removed log\n if (sub.type === \"event\" &&\n emitArgs &&\n emitArgs.length > 0 &&\n emitArgs[0].removed === true) {\n sub = await getSubscription({ orphan: \"drop-log\", log: emitArgs[0] }, this);\n }\n return this.#subs.get(sub.tag) || null;\n }\n async #getSub(event) {\n const subscription = await getSubscription(event, this);\n // Prevent tampering with our tag in any subclass' _getSubscriber\n const tag = subscription.tag;\n let sub = this.#subs.get(tag);\n if (!sub) {\n const subscriber = this._getSubscriber(subscription);\n const addressableMap = new WeakMap();\n const nameMap = new Map();\n sub = {\n subscriber,\n tag,\n addressableMap,\n nameMap,\n started: false,\n listeners: [],\n };\n this.#subs.set(tag, sub);\n }\n return sub;\n }\n async on(event, listener) {\n const sub = await this.#getSub(event);\n sub.listeners.push({ listener, once: false });\n if (!sub.started) {\n sub.subscriber.start();\n sub.started = true;\n if (this.#pausedState != null) {\n sub.subscriber.pause(this.#pausedState);\n }\n }\n return this;\n }\n async once(event, listener) {\n const sub = await this.#getSub(event);\n sub.listeners.push({ listener, once: true });\n if (!sub.started) {\n sub.subscriber.start();\n sub.started = true;\n if (this.#pausedState != null) {\n sub.subscriber.pause(this.#pausedState);\n }\n }\n return this;\n }\n async emit(event, ...args) {\n const sub = await this.#hasSub(event, args);\n // If there is not subscription or if a recent emit removed\n // the last of them (which also deleted the sub) do nothing\n if (!sub || sub.listeners.length === 0) {\n return false;\n }\n const count = sub.listeners.length;\n sub.listeners = sub.listeners.filter(({ listener, once }) => {\n const payload = new EventPayload(this, once ? null : listener, event);\n try {\n listener.call(this, ...args, payload);\n }\n catch (error) { }\n return !once;\n });\n if (sub.listeners.length === 0) {\n if (sub.started) {\n sub.subscriber.stop();\n }\n this.#subs.delete(sub.tag);\n }\n return count > 0;\n }\n async listenerCount(event) {\n if (event) {\n const sub = await this.#hasSub(event);\n if (!sub) {\n return 0;\n }\n return sub.listeners.length;\n }\n let total = 0;\n for (const { listeners } of this.#subs.values()) {\n total += listeners.length;\n }\n return total;\n }\n async listeners(event) {\n if (event) {\n const sub = await this.#hasSub(event);\n if (!sub) {\n return [];\n }\n return sub.listeners.map(({ listener }) => listener);\n }\n let result = [];\n for (const { listeners } of this.#subs.values()) {\n result = result.concat(listeners.map(({ listener }) => listener));\n }\n return result;\n }\n async off(event, listener) {\n const sub = await this.#hasSub(event);\n if (!sub) {\n return this;\n }\n if (listener) {\n const index = sub.listeners\n .map(({ listener }) => listener)\n .indexOf(listener);\n if (index >= 0) {\n sub.listeners.splice(index, 1);\n }\n }\n if (!listener || sub.listeners.length === 0) {\n if (sub.started) {\n sub.subscriber.stop();\n }\n this.#subs.delete(sub.tag);\n }\n return this;\n }\n async removeAllListeners(event) {\n if (event) {\n const { tag, started, subscriber } = await this.#getSub(event);\n if (started) {\n subscriber.stop();\n }\n this.#subs.delete(tag);\n }\n else {\n for (const [tag, { started, subscriber }] of this.#subs) {\n if (started) {\n subscriber.stop();\n }\n this.#subs.delete(tag);\n }\n }\n return this;\n }\n // Alias for \"on\"\n async addListener(event, listener) {\n return await this.on(event, listener);\n }\n // Alias for \"off\"\n async removeListener(event, listener) {\n return this.off(event, listener);\n }\n // Sub-classes should override this to shutdown any sockets, etc.\n // but MUST call this super.shutdown.\n destroy() {\n // Stop all listeners\n this.removeAllListeners();\n // Shut down all tiemrs\n for (const timerId of this.#timers.keys()) {\n this._clearTimeout(timerId);\n }\n }\n get paused() {\n return this.#pausedState != null;\n }\n set paused(pause) {\n if (!!pause === this.paused) {\n return;\n }\n if (this.paused) {\n this.resume();\n }\n else {\n this.pause(false);\n }\n }\n pause(dropWhilePaused) {\n this.#lastBlockNumber = -1;\n if (this.#pausedState != null) {\n if (this.#pausedState == !!dropWhilePaused) {\n return;\n }\n assert(false, \"cannot change pause type; resume first\", \"UNSUPPORTED_OPERATION\", {\n operation: \"pause\",\n });\n }\n this._forEachSubscriber((s) => s.pause(dropWhilePaused));\n this.#pausedState = !!dropWhilePaused;\n for (const timer of this.#timers.values()) {\n // Clear the timer\n if (timer.timer) {\n clearTimeout(timer.timer);\n }\n // Remaining time needed for when we become unpaused\n timer.time = getTime() - timer.time;\n }\n }\n resume() {\n if (this.#pausedState == null) {\n return;\n }\n this._forEachSubscriber((s) => s.resume());\n this.#pausedState = null;\n for (const timer of this.#timers.values()) {\n // Remaining time when we were paused\n let timeout = timer.time;\n if (timeout < 0) {\n timeout = 0;\n }\n // Start time (in cause paused, so we con compute remaininf time)\n timer.time = getTime();\n // Start the timer\n setTimeout(timer.func, timeout);\n }\n }\n}\nfunction _parseString(result, start) {\n try {\n const bytes = _parseBytes(result, start);\n if (bytes) {\n return toUtf8String(bytes);\n }\n }\n catch (error) { }\n return null;\n}\nfunction _parseBytes(result, start) {\n if (result === \"0x\") {\n return null;\n }\n try {\n const offset = getNumber(dataSlice(result, start, start + 32));\n const length = getNumber(dataSlice(result, offset, offset + 32));\n return dataSlice(result, offset + 32, offset + 32 + length);\n }\n catch (error) { }\n return null;\n}\nfunction numPad(value) {\n const result = toBeArray(value);\n if (result.length > 32) {\n throw new Error(\"internal; should not happen\");\n }\n const padded = new Uint8Array(32);\n padded.set(result, 32 - result.length);\n return padded;\n}\nfunction bytesPad(value) {\n if (value.length % 32 === 0) {\n return value;\n }\n const result = new Uint8Array(Math.ceil(value.length / 32) * 32);\n result.set(value);\n return result;\n}\nconst empty = new Uint8Array([]);\n// ABI Encodes a series of (bytes, bytes, ...)\nfunction encodeBytes(datas) {\n const result = [];\n let byteCount = 0;\n // Add place-holders for pointers as we add items\n for (let i = 0; i < datas.length; i++) {\n result.push(empty);\n byteCount += 32;\n }\n for (let i = 0; i < datas.length; i++) {\n const data = getBytes(datas[i]);\n // Update the bytes offset\n result[i] = numPad(byteCount);\n // The length and padded value of data\n result.push(numPad(data.length));\n result.push(bytesPad(data));\n byteCount += 32 + Math.ceil(data.length / 32) * 32;\n }\n return concat(result);\n}\nconst zeros = \"0x0000000000000000000000000000000000000000000000000000000000000000\";\nfunction parseOffchainLookup(data) {\n const result = {\n sender: \"\",\n urls: [],\n calldata: \"\",\n selector: \"\",\n extraData: \"\",\n errorArgs: [],\n };\n assert(dataLength(data) >= 5 * 32, \"insufficient OffchainLookup data\", \"OFFCHAIN_FAULT\", {\n reason: \"insufficient OffchainLookup data\",\n });\n const sender = dataSlice(data, 0, 32);\n assert(dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), \"corrupt OffchainLookup sender\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup sender\",\n });\n result.sender = dataSlice(sender, 12);\n // Read the URLs from the response\n try {\n const urls = [];\n const urlsOffset = getNumber(dataSlice(data, 32, 64));\n const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32));\n const urlsData = dataSlice(data, urlsOffset + 32);\n for (let u = 0; u < urlsLength; u++) {\n const url = _parseString(urlsData, u * 32);\n if (url == null) {\n throw new Error(\"abort\");\n }\n urls.push(url);\n }\n result.urls = urls;\n }\n catch (error) {\n assert(false, \"corrupt OffchainLookup urls\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup urls\",\n });\n }\n // Get the CCIP calldata to forward\n try {\n const calldata = _parseBytes(data, 64);\n if (calldata == null) {\n throw new Error(\"abort\");\n }\n result.calldata = calldata;\n }\n catch (error) {\n assert(false, \"corrupt OffchainLookup calldata\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup calldata\",\n });\n }\n // Get the callbackSelector (bytes4)\n assert(dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), \"corrupt OffchainLookup callbaackSelector\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup callbaackSelector\",\n });\n result.selector = dataSlice(data, 96, 100);\n // Get the extra data to send back to the contract as context\n try {\n const extraData = _parseBytes(data, 128);\n if (extraData == null) {\n throw new Error(\"abort\");\n }\n result.extraData = extraData;\n }\n catch (error) {\n assert(false, \"corrupt OffchainLookup extraData\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup extraData\",\n });\n }\n result.errorArgs = \"sender,urls,calldata,selector,extraData\"\n .split(/,/)\n .map((k) => result[k]);\n return result;\n}\n//# sourceMappingURL=abstract-provider.js.map","/**\n * About Abstract Signer and subclassing\n *\n * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer]\n */\nimport { resolveAddress } from \"../address/checks.js\";\nimport { getAddress } from \"../address/index.js\";\nimport { Transaction } from \"../transaction/index.js\";\nimport { defineProperties, getBigInt, resolveProperties, assert, assertArgument, } from \"../utils/index.js\";\nimport { copyRequest } from \"./provider.js\";\nfunction checkProvider(signer, operation) {\n if (signer.provider) {\n return signer.provider;\n }\n assert(false, \"missing provider\", \"UNSUPPORTED_OPERATION\", { operation });\n}\nasync function populate(signer, tx) {\n let pop = copyRequest(tx);\n if (pop.to != null) {\n pop.to = resolveAddress(pop.to);\n }\n if (pop.from != null) {\n const from = pop.from;\n pop.from = Promise.all([signer.getAddress(), resolveAddress(from)]).then(([address, from]) => {\n assertArgument(address.toLowerCase() === from.toLowerCase(), \"transaction from mismatch\", \"tx.from\", from);\n return address;\n });\n }\n else {\n pop.from = signer.getAddress();\n }\n return await resolveProperties(pop);\n}\nexport class AbstractSigner {\n provider;\n constructor(provider) {\n defineProperties(this, { provider: provider || null });\n }\n async getNonce(blockTag) {\n return checkProvider(this, \"getTransactionCount\").getTransactionCount(await this.getAddress(), blockTag);\n }\n async populateCall(tx) {\n const pop = await populate(this, tx);\n return pop;\n }\n async populateTransaction(tx) {\n const provider = checkProvider(this, \"populateTransaction\");\n const pop = await populate(this, tx);\n if (pop.nonce == null) {\n pop.nonce = await this.getNonce(\"pending\");\n }\n if (pop.energyLimit == null) {\n pop.energyLimit = await this.estimateEnergy(pop);\n }\n // Populate the chain ID\n const network = await this.provider.getNetwork();\n if (pop.networkId != null) {\n const networkId = getBigInt(pop.networkId);\n assertArgument(networkId === network.networkId, \"transaction networkId mismatch\", \"tx.networkId\", tx.networkId);\n }\n else {\n pop.networkId = network.networkId;\n }\n // We need to get fee data to determine things\n const feeData = await provider.getFeeData();\n // We need to auto-detect the intended type of this transaction...\n if (feeData.energyPrice != null) {\n // Network doesn't support EIP-1559...\n // Populate missing fee data\n if (pop.energyPrice == null) {\n pop.energyPrice = feeData.energyPrice;\n }\n }\n else {\n // getFeeData has failed us.\n assert(false, \"failed to get consistent fee data\", \"UNSUPPORTED_OPERATION\", {\n operation: \"signer.getFeeData\",\n });\n }\n //@TOOD: Don't await all over the place; save them up for\n // the end for better batching\n return await resolveProperties(pop);\n }\n async estimateEnergy(tx) {\n return checkProvider(this, \"estimateEnergy\").estimateEnergy(await this.populateCall(tx));\n }\n async call(tx) {\n return checkProvider(this, \"call\").call(await this.populateCall(tx));\n }\n async resolveName(name) {\n return getAddress(name);\n }\n async sendTransaction(tx) {\n const provider = checkProvider(this, \"sendTransaction\");\n const pop = await this.populateTransaction(tx);\n delete pop.from;\n const txObj = Transaction.from(pop);\n return await provider.broadcastTransaction(await this.signTransaction(txObj));\n }\n}\nexport class VoidSigner extends AbstractSigner {\n address;\n constructor(address, provider) {\n super(provider);\n defineProperties(this, { address });\n }\n async getAddress() {\n return this.address;\n }\n connect(provider) {\n return new VoidSigner(this.address, provider);\n }\n #throwUnsupported(suffix, operation) {\n assert(false, `VoidSigner cannot sign ${suffix}`, \"UNSUPPORTED_OPERATION\", {\n operation,\n });\n }\n async signTransaction(tx) {\n this.#throwUnsupported(\"transactions\", \"signTransaction\");\n }\n async signMessage(message) {\n this.#throwUnsupported(\"messages\", \"signMessage\");\n }\n async signTypedData(domain, types, value) {\n this.#throwUnsupported(\"typed-data\", \"signTypedData\");\n }\n}\n//# sourceMappingURL=abstract-signer.js.map","/**\n * There are many awesome community services that provide Core\n * nodes both for developers just starting out and for large-scale\n * communities.\n *\n * @_section: api/providers/thirdparty: Community Providers [thirdparty]\n */\n// Show the throttle message only once per service\nconst shown = new Set();\n/**\n * Displays a warning in tht console when the community resource is\n * being used too heavily by the app, recommending the developer\n * acquire their own credentials instead of using the community\n * credentials.\n *\n * The notification will only occur once per service.\n */\nexport function showThrottleMessage(service) {\n if (shown.has(service)) {\n return;\n }\n shown.add(service);\n console.log(\"========= NOTICE =========\");\n console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`);\n console.log(\"\");\n console.log(\"The default API keys for each service are provided as a highly-throttled,\");\n console.log(\"community resource for low-traffic projects and early prototyping.\");\n console.log(\"\");\n console.log(\"While your application will continue to function, we highly recommended\");\n console.log(\"signing up for your own API keys to improve performance, increase your\");\n console.log(\"request rate/limit and enable other perks, such as metrics and advanced APIs.\");\n console.log(\"\");\n}\n//# sourceMappingURL=community.js.map","import { isError } from \"../utils/index.js\";\nimport { PollingEventSubscriber } from \"./subscriber-polling.js\";\nfunction copy(obj) {\n return JSON.parse(JSON.stringify(obj));\n}\n/**\n * Some backends support subscribing to events using a Filter ID.\n *\n * When subscribing with this technique, the node issues a unique\n * //Filter ID//. At this point the node dedicates resources to\n * the filter, so that periodic calls to follow up on the //Filter ID//\n * will receive any events since the last call.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdSubscriber {\n #provider;\n #filterIdPromise;\n #poller;\n #running;\n #network;\n #hault;\n constructor(provider) {\n this.#provider = provider;\n this.#filterIdPromise = null;\n this.#poller = this.#poll.bind(this);\n this.#running = false;\n this.#network = null;\n this.#hault = false;\n }\n _subscribe(provider) {\n throw new Error(\"subclasses must override this\");\n }\n _emitResults(provider, result) {\n throw new Error(\"subclasses must override this\");\n }\n _recover(provider) {\n throw new Error(\"subclasses must override this\");\n }\n async #poll(blockNumber) {\n try {\n // Subscribe if necessary\n if (this.#filterIdPromise == null) {\n this.#filterIdPromise = this._subscribe(this.#provider);\n }\n // Get the Filter ID\n let filterId = null;\n try {\n filterId = await this.#filterIdPromise;\n }\n catch (error) {\n if (!isError(error, \"UNSUPPORTED_OPERATION\") ||\n error.operation !== \"xcb_newFilter\") {\n throw error;\n }\n }\n // The backend does not support Filter ID; downgrade to\n // polling\n if (filterId == null) {\n this.#filterIdPromise = null;\n this.#provider._recoverSubscriber(this, this._recover(this.#provider));\n return;\n }\n const network = await this.#provider.getNetwork();\n if (!this.#network) {\n this.#network = network;\n }\n if (this.#network.networkId !== network.networkId) {\n throw new Error(\"chaid changed\");\n }\n if (this.#hault) {\n return;\n }\n const result = await this.#provider.send(\"xcb_getFilterChanges\", [\n filterId,\n ]);\n await this._emitResults(this.#provider, result);\n }\n catch (error) {\n console.log(\"@TODO\", error);\n }\n this.#provider.once(\"block\", this.#poller);\n }\n #teardown() {\n const filterIdPromise = this.#filterIdPromise;\n if (filterIdPromise) {\n this.#filterIdPromise = null;\n filterIdPromise.then((filterId) => {\n this.#provider.send(\"xcb_uninstallFilter\", [filterId]);\n });\n }\n }\n start() {\n if (this.#running) {\n return;\n }\n this.#running = true;\n this.#poll(-2);\n }\n stop() {\n if (!this.#running) {\n return;\n }\n this.#running = false;\n this.#hault = true;\n this.#teardown();\n this.#provider.off(\"block\", this.#poller);\n }\n pause(dropWhilePaused) {\n if (dropWhilePaused) {\n this.#teardown();\n }\n this.#provider.off(\"block\", this.#poller);\n }\n resume() {\n this.start();\n }\n}\n/**\n * A **FilterIdSubscriber** for receiving contract events.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdEventSubscriber extends FilterIdSubscriber {\n #event;\n constructor(provider, filter) {\n super(provider);\n this.#event = copy(filter);\n }\n _recover(provider) {\n return new PollingEventSubscriber(provider, this.#event);\n }\n async _subscribe(provider) {\n const filterId = await provider.send(\"xcb_newFilter\", [this.#event]);\n return filterId;\n }\n async _emitResults(provider, results) {\n for (const result of results) {\n provider.emit(this.#event, provider._wrapLog(result, provider._network));\n }\n }\n}\n/**\n * A **FilterIdSubscriber** for receiving pending transactions events.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdPendingSubscriber extends FilterIdSubscriber {\n async _subscribe(provider) {\n return await provider.send(\"xcb_newPendingTransactionFilter\", []);\n }\n async _emitResults(provider, results) {\n for (const result of results) {\n provider.emit(\"pending\", result);\n }\n }\n}\n//# sourceMappingURL=subscriber-filterid.js.map","/**\n * About JSON-RPC...\n *\n * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider]\n */\n// @TODO:\n// - Add the batching API\nimport { AbiCoder } from \"../abi/index.js\";\nimport { getAddress } from \"../address/index.js\";\nimport { TypedDataEncoder } from \"../hash/index.js\";\nimport { defineProperties, getBigInt, hexlify, isHexString, toQuantity, toUtf8Bytes, makeError, assert, assertArgument, FetchRequest, resolveProperties, } from \"../utils/index.js\";\nimport { AbstractProvider, UnmanagedSubscriber } from \"./abstract-provider.js\";\nimport { AbstractSigner } from \"./abstract-signer.js\";\nimport { Network } from \"./network.js\";\nimport { FilterIdEventSubscriber, FilterIdPendingSubscriber, } from \"./subscriber-filterid.js\";\nimport { PollingEventSubscriber } from \"./subscriber-polling.js\";\nimport { resolveAddress } from \"../address/checks.js\";\nconst Primitive = \"bigint,boolean,function,number,string,symbol\".split(/,/g);\n//const Methods = \"getAddress,then\".split(/,/g);\nfunction deepCopy(value) {\n if (value == null || Primitive.indexOf(typeof value) >= 0) {\n return value;\n }\n // Keep any Addressable\n if (typeof value.getAddress === \"function\") {\n return value;\n }\n if (Array.isArray(value)) {\n return value.map(deepCopy);\n }\n if (typeof value === \"object\") {\n return Object.keys(value).reduce((accum, key) => {\n accum[key] = value[key];\n return accum;\n }, {});\n }\n throw new Error(`should not happen: ${value} (${typeof value})`);\n}\nfunction stall(duration) {\n return new Promise((resolve) => {\n setTimeout(resolve, duration);\n });\n}\nfunction getLowerCase(value) {\n if (value) {\n return value.toLowerCase();\n }\n return value;\n}\nfunction isPollable(value) {\n return value && typeof value.pollingInterval === \"number\";\n}\nconst defaultOptions = {\n polling: false,\n staticNetwork: null,\n batchStallTime: 10,\n batchMaxSize: 1 << 20,\n batchMaxCount: 100, // 100 requests\n};\n// @TODO: Unchecked Signers\nexport class JsonRpcSigner extends AbstractSigner {\n address;\n constructor(provider, address) {\n super(provider);\n address = getAddress(address);\n defineProperties(this, { address });\n }\n connect(provider) {\n assert(false, \"cannot reconnect JsonRpcSigner\", \"UNSUPPORTED_OPERATION\", {\n operation: \"signer.connect\",\n });\n }\n async getAddress() {\n return this.address;\n }\n // JSON-RPC will automatially fill in nonce, etc. so we just check from\n async populateTransaction(tx) {\n return await this.populateCall(tx);\n }\n // Returns just the hash of the transaction after sent, which is what\n // the bare JSON-RPC API does;\n async sendUncheckedTransaction(_tx) {\n const tx = deepCopy(_tx);\n const promises = [];\n // Make sure the from matches the sender\n if (tx.from) {\n const _from = tx.from;\n promises.push((async () => {\n const from = await resolveAddress(_from);\n assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), \"from address mismatch\", \"transaction\", _tx);\n tx.from = from;\n })());\n }\n else {\n tx.from = this.address;\n }\n // The JSON-RPC for xcb_sendTransaction uses 90000 energy; if the user\n // wishes to use this, it is easy to specify explicitly, otherwise\n // we look it up for them.\n if (tx.energyLimit == null) {\n promises.push((async () => {\n tx.energyLimit = await this.provider.estimateEnergy({\n ...tx,\n from: this.address,\n });\n })());\n }\n // The address may be an ENS name or Addressable\n if (tx.to != null) {\n const _to = tx.to;\n promises.push((async () => {\n tx.to = await resolveAddress(_to);\n })());\n }\n // Wait until all of our properties are filled in\n if (promises.length) {\n await Promise.all(promises);\n }\n const hexTx = this.provider.getRpcTransaction(tx);\n return this.provider.send(\"xcb_sendTransaction\", [hexTx]);\n }\n async sendTransaction(tx) {\n // This cannot be mined any earlier than any recent block\n const blockNumber = await this.provider.getBlockNumber();\n // Send the transaction\n const hash = await this.sendUncheckedTransaction(tx);\n // Unfortunately, JSON-RPC only provides and opaque transaction hash\n // for a response, and we need the actual transaction, so we poll\n // for it; it should show up very quickly\n return await new Promise((resolve, reject) => {\n const timeouts = [1000, 100];\n const checkTx = async () => {\n // Try getting the transaction\n const tx = await this.provider.getTransaction(hash);\n if (tx != null) {\n resolve(tx.replaceableTransaction(blockNumber));\n return;\n }\n // Wait another 4 seconds\n this.provider._setTimeout(() => {\n checkTx();\n }, timeouts.pop() || 4000);\n };\n checkTx();\n });\n }\n async signTransaction(_tx) {\n const tx = deepCopy(_tx);\n // Make sure the from matches the sender\n if (tx.from) {\n const from = await resolveAddress(tx.from);\n assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), \"from address mismatch\", \"transaction\", _tx);\n tx.from = from;\n }\n else {\n tx.from = this.address;\n }\n const hexTx = this.provider.getRpcTransaction(tx);\n return await this.provider.send(\"xcb_signTransaction\", [hexTx]);\n }\n async signMessage(_message) {\n const message = typeof _message === \"string\" ? toUtf8Bytes(_message) : _message;\n return await this.provider.send(\"personal_sign\", [\n hexlify(message),\n this.address.toLowerCase(),\n ]);\n }\n async signTypedData(domain, types, _value) {\n const value = deepCopy(_value);\n // Populate any ENS names (in-place)\n const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (value) => {\n const address = await resolveAddress(value);\n assertArgument(address != null, \"TypedData does not support null address\", \"value\", value);\n return address;\n });\n return await this.provider.send(\"xcb_signTypedData_v4\", [\n this.address.toLowerCase(),\n JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value)),\n ]);\n }\n async unlock(password) {\n return this.provider.send(\"personal_unlockAccount\", [\n this.address.toLowerCase(),\n password,\n null,\n ]);\n }\n async _legacySignMessage(_message) {\n const message = typeof _message === \"string\" ? toUtf8Bytes(_message) : _message;\n return await this.provider.send(\"xcb_sign\", [\n this.address.toLowerCase(),\n hexlify(message),\n ]);\n }\n}\n/**\n * The JsonRpcApiProvider is an abstract class and **MUST** be\n * sub-classed.\n *\n * It provides the base for all JSON-RPC-based Provider interaction.\n *\n * Sub-classing Notes:\n * - a sub-class MUST override _send\n * - a sub-class MUST call the `_start()` method once connected\n */\nexport class JsonRpcApiProvider extends AbstractProvider {\n #options;\n // The next ID to use for the JSON-RPC ID field\n #nextId;\n // Payloads are queued and triggered in batches using the drainTimer\n #payloads;\n #drainTimer;\n #notReady;\n #network;\n #scheduleDrain() {\n if (this.#drainTimer) {\n return;\n }\n // If we aren't using batching, no hard in sending it immeidately\n const stallTime = this._getOption(\"batchMaxCount\") === 1\n ? 0\n : this._getOption(\"batchStallTime\");\n this.#drainTimer = setTimeout(() => {\n this.#drainTimer = null;\n const payloads = this.#payloads;\n this.#payloads = [];\n while (payloads.length) {\n // Create payload batches that satisfy our batch constraints\n const batch = [payloads.shift()];\n while (payloads.length) {\n if (batch.length === this.#options.batchMaxCount) {\n break;\n }\n batch.push(payloads.shift());\n const bytes = JSON.stringify(batch.map((p) => p.payload));\n if (bytes.length > this.#options.batchMaxSize) {\n payloads.unshift(batch.pop());\n break;\n }\n }\n // Process the result to each payload\n (async () => {\n const payload = batch.length === 1 ? batch[0].payload : batch.map((p) => p.payload);\n this.emit(\"debug\", { action: \"sendRpcPayload\", payload });\n try {\n // console.log({payload})\n const result = await this._send(payload);\n // console.log({result})\n this.emit(\"debug\", { action: \"receiveRpcResult\", result });\n // Process results in batch order\n for (const { resolve, reject, payload } of batch) {\n // Find the matching result\n const resp = result.filter((r) => r.id === payload.id)[0];\n // No result; the node failed us in unexpected ways\n if (resp == null) {\n return reject(makeError(\"no response from server\", \"BAD_DATA\", {\n value: result,\n info: { payload },\n }));\n }\n // The response is an error\n if (\"error\" in resp) {\n return reject(this.getRpcError(payload, resp));\n }\n // All good; send the result\n resolve(resp.result);\n }\n }\n catch (error) {\n this.emit(\"debug\", { action: \"receiveRpcError\", error });\n for (const { reject } of batch) {\n // @TODO: augment the error with the payload\n reject(error);\n }\n }\n })();\n }\n }, stallTime);\n }\n constructor(network, options) {\n super(network);\n this.#nextId = 1;\n this.#options = Object.assign({}, defaultOptions, options || {});\n this.#payloads = [];\n this.#drainTimer = null;\n this.#network = null;\n {\n let resolve = null;\n const promise = new Promise((_resolve) => {\n resolve = _resolve;\n });\n this.#notReady = { promise, resolve };\n }\n // Make sure any static network is compatbile with the provided netwrok\n const staticNetwork = this._getOption(\"staticNetwork\");\n if (staticNetwork) {\n assertArgument(network == null || staticNetwork.matches(network), \"staticNetwork MUST match network object\", \"options\", options);\n this.#network = staticNetwork;\n }\n }\n /**\n * Returns the value associated with the option %%key%%.\n *\n * Sub-classes can use this to inquire about configuration options.\n */\n _getOption(key) {\n return this.#options[key];\n }\n /**\n * Gets the [[Network]] this provider has committed to. On each call, the network\n * is detected, and if it has changed, the call will reject.\n */\n get _network() {\n assert(this.#network, \"network is not available yet\", \"NETWORK_ERROR\");\n return this.#network;\n }\n /*\n {\n assert(false, \"sub-classes must override _send\", \"UNSUPPORTED_OPERATION\", {\n operation: \"jsonRpcApiProvider._send\"\n });\n }\n */\n /**\n * Resolves to the non-normalized value by performing %%req%%.\n *\n * Sub-classes may override this to modify behavior of actions,\n * and should generally call ``super._perform`` as a fallback.\n */\n async _perform(req) {\n const request = this.getRpcRequest(req);\n if (request != null) {\n return await this.send(request.method, request.args);\n }\n return super._perform(req);\n }\n /**\n * Sub-classes may override this; it detects the *actual* network that\n * we are **currently** connected to.\n *\n * Keep in mind that [[send]] may only be used once [[ready]], otherwise the\n * _send primitive must be used instead.\n */\n async _detectNetwork() {\n const network = this._getOption(\"staticNetwork\");\n if (network) {\n return network;\n }\n // If we are ready, use ``send``, which enabled requests to be batched\n if (this.ready) {\n return Network.from(getBigInt(await this.send(\"xcb_networkId\", [])));\n }\n // We are not ready yet; use the primitive _send\n const payload = {\n id: this.#nextId++,\n method: \"xcb_networkId\",\n params: [],\n jsonrpc: \"2.0\",\n };\n this.emit(\"debug\", { action: \"sendRpcPayload\", payload });\n let result;\n try {\n result = (await this._send(payload))[0];\n }\n catch (error) {\n this.emit(\"debug\", { action: \"receiveRpcError\", error });\n throw error;\n }\n this.emit(\"debug\", { action: \"receiveRpcResult\", result });\n if (\"result\" in result) {\n return Network.from(getBigInt(result.result));\n }\n throw this.getRpcError(payload, result);\n }\n /**\n * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls\n * will be passed to [[_send]] from [[send]]. If it is overridden, then\n * ``super._start()`` **MUST** be called.\n *\n * Calling it multiple times is safe and has no effect.\n */\n _start() {\n if (this.#notReady == null || this.#notReady.resolve == null) {\n return;\n }\n this.#notReady.resolve();\n this.#notReady = null;\n (async () => {\n // Bootstrap the network\n while (this.#network == null) {\n try {\n this.#network = await this._detectNetwork();\n }\n catch (error) {\n console.log(\"JsonRpcProvider failed to startup; retry in 1s\");\n await stall(1000);\n }\n }\n // Start dispatching requests\n this.#scheduleDrain();\n })();\n }\n /**\n * Resolves once the [[_start]] has been called. This can be used in\n * sub-classes to defer sending data until the connection has been\n * established.\n */\n async _waitUntilReady() {\n if (this.#notReady == null) {\n return;\n }\n return await this.#notReady.promise;\n }\n /**\n * Return a Subscriber that will manage the %%sub%%.\n *\n * Sub-classes may override this to modify the behavior of\n * subscription management.\n */\n _getSubscriber(sub) {\n // Pending Filters aren't availble via polling\n if (sub.type === \"pending\") {\n return new FilterIdPendingSubscriber(this);\n }\n if (sub.type === \"event\") {\n if (this._getOption(\"polling\")) {\n return new PollingEventSubscriber(this, sub.filter);\n }\n return new FilterIdEventSubscriber(this, sub.filter);\n }\n // Orphaned Logs are handled automatically, by the filter, since\n // logs with removed are emitted by it\n if (sub.type === \"orphan\" && sub.filter.orphan === \"drop-log\") {\n return new UnmanagedSubscriber(\"orphan\");\n }\n return super._getSubscriber(sub);\n }\n /**\n * Returns true only if the [[_start]] has been called.\n */\n get ready() {\n return this.#notReady == null;\n }\n /**\n * Returns %%tx%% as a normalized JSON-RPC transaction request,\n * which has all values hexlified and any numeric values converted\n * to Quantity values.\n */\n getRpcTransaction(tx) {\n const result = {};\n // JSON-RPC now requires numeric values to be \"quantity\" values\n [\n \"networkId\",\n \"energyLimit\",\n \"energyPrice\",\n \"type\",\n \"nonce\",\n \"value\",\n ].forEach((key) => {\n if (tx[key] == null) {\n return;\n }\n let dstKey = key;\n if (key === \"energyLimit\") {\n dstKey = \"energy\";\n }\n result[dstKey] = toQuantity(getBigInt(tx[key], `tx.${key}`));\n });\n // Make sure addresses and data are lowercase\n [\"from\", \"to\", \"data\"].forEach((key) => {\n if (tx[key] == null) {\n return;\n }\n result[key] = hexlify(tx[key]);\n });\n return result;\n }\n /**\n * Returns the request method and arguments required to perform\n * %%req%%.\n */\n getRpcRequest(req) {\n switch (req.method) {\n case \"networkId\":\n return { method: \"xcb_networkId\", args: [] };\n case \"getBlockNumber\":\n return { method: \"xcb_blockNumber\", args: [] };\n case \"getEnergyPrice\":\n return { method: \"xcb_energyPrice\", args: [] };\n case \"getBalance\": {\n return {\n method: \"xcb_getBalance\",\n args: [getLowerCase(req.address), req.blockTag],\n };\n }\n case \"getTransactionCount\":\n return {\n method: \"xcb_getTransactionCount\",\n args: [getLowerCase(req.address), req.blockTag],\n };\n case \"getCode\":\n return {\n method: \"xcb_getCode\",\n args: [getLowerCase(req.address), req.blockTag],\n };\n case \"getStorage\":\n return {\n method: \"xcb_getStorageAt\",\n args: [\n getLowerCase(req.address),\n \"0x\" + req.position.toString(16),\n req.blockTag,\n ],\n };\n case \"broadcastTransaction\":\n return {\n method: \"xcb_sendRawTransaction\",\n args: [req.signedTransaction],\n };\n case \"getBlock\":\n if (\"blockTag\" in req) {\n return {\n method: \"xcb_getBlockByNumber\",\n args: [req.blockTag, !!req.includeTransactions],\n };\n }\n else if (\"blockHash\" in req) {\n return {\n method: \"xcb_getBlockByHash\",\n args: [req.blockHash, !!req.includeTransactions],\n };\n }\n break;\n case \"getTransaction\":\n return {\n method: \"xcb_getTransactionByHash\",\n args: [req.hash],\n };\n case \"getTransactionReceipt\":\n return {\n method: \"xcb_getTransactionReceipt\",\n args: [req.hash],\n };\n case \"call\":\n return {\n method: \"xcb_call\",\n args: [this.getRpcTransaction(req.transaction), req.blockTag],\n };\n case \"estimateEnergy\": {\n return {\n method: \"xcb_estimateEnergy\",\n args: [this.getRpcTransaction(req.transaction)],\n };\n }\n case \"getLogs\":\n if (req.filter && req.filter.address != null) {\n if (Array.isArray(req.filter.address)) {\n req.filter.address = req.filter.address.map(getLowerCase);\n }\n else {\n req.filter.address = getLowerCase(req.filter.address);\n }\n }\n return { method: \"xcb_getLogs\", args: [req.filter] };\n }\n return null;\n }\n /**\n * Returns an CoreBC-style Error for the given JSON-RPC error\n * %%payload%%, coalescing the various strings and error shapes\n * that different nodes return, coercing them into a machine-readable\n * standardized error.\n */\n getRpcError(payload, _error) {\n const { method } = payload;\n const { error } = _error;\n if (method === \"xcb_estimateEnergy\" && error.message) {\n const msg = error.message;\n if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) {\n return makeError(\"insufficient funds\", \"INSUFFICIENT_FUNDS\", {\n transaction: payload.params[0],\n info: { payload, error },\n });\n }\n }\n if (method === \"xcb_call\" || method === \"xcb_estimateEnergy\") {\n const result = spelunkData(error);\n const e = AbiCoder.getBuiltinCallException(method === \"xcb_call\" ? \"call\" : \"estimateEnergy\", payload.params[0], result ? result.data : null);\n e.info = { error, payload };\n return e;\n }\n // Only estimateEnergy and call can return arbitrary contract-defined text, so now we\n // we can process text safely.\n const message = JSON.stringify(spelunkMessage(error));\n if (typeof error.message === \"string\" &&\n error.message.match(/user denied|corebc-user-denied/i)) {\n const actionMap = {\n xcb_sign: \"signMessage\",\n personal_sign: \"signMessage\",\n xcb_signTypedData_v4: \"signTypedData\",\n xcb_signTransaction: \"signTransaction\",\n xcb_sendTransaction: \"sendTransaction\",\n xcb_requestAccounts: \"requestAccess\",\n wallet_requestAccounts: \"requestAccess\",\n };\n return makeError(`user rejected action`, \"ACTION_REJECTED\", {\n action: actionMap[method] || \"unknown\",\n reason: \"rejected\",\n info: { payload, error },\n });\n }\n if (method === \"xcb_sendRawTransaction\" ||\n method === \"xcb_sendTransaction\") {\n const transaction = payload.params[0];\n if (message.match(/insufficient funds|base fee exceeds energy limit/i)) {\n return makeError(\"insufficient funds for intrinsic transaction cost\", \"INSUFFICIENT_FUNDS\", {\n transaction,\n info: { error },\n });\n }\n if (message.match(/nonce/i) && message.match(/too low/i)) {\n return makeError(\"nonce has already been used\", \"NONCE_EXPIRED\", {\n transaction,\n info: { error },\n });\n }\n // \"replacement transaction underpriced\"\n if (message.match(/replacement transaction/i) &&\n message.match(/underpriced/i)) {\n return makeError(\"replacement fee too low\", \"REPLACEMENT_UNDERPRICED\", {\n transaction,\n info: { error },\n });\n }\n if (message.match(/only replay-protected/i)) {\n return makeError(\"legacy pre-eip-155 transactions not supported\", \"UNSUPPORTED_OPERATION\", {\n operation: method,\n info: { transaction, info: { error } },\n });\n }\n }\n if (message.match(/the method .* does not exist/i)) {\n return makeError(\"unsupported operation\", \"UNSUPPORTED_OPERATION\", {\n operation: payload.method,\n info: { error },\n });\n }\n return makeError(\"could not coalesce error\", \"UNKNOWN_ERROR\", { error });\n }\n /**\n * Requests the %%method%% with %%params%% via the JSON-RPC protocol\n * over the underlying channel. This can be used to call methods\n * on the backend that do not have a high-level API within the Provider\n * API.\n *\n * This method queues requests according to the batch constraints\n * in the options, assigns the request a unique ID.\n *\n * **Do NOT override** this method in sub-classes; instead\n * override [[_send]] or force the options values in the\n * call to the constructor to modify this method's behavior.\n */\n send(method, params) {\n // @TODO: cache networkId?? purge on switch_networks\n const id = this.#nextId++;\n const promise = new Promise((resolve, reject) => {\n this.#payloads.push({\n resolve,\n reject,\n payload: { method, params, id, jsonrpc: \"2.0\" },\n });\n });\n // If there is not a pending drainTimer, set one\n this.#scheduleDrain();\n return promise;\n }\n /**\n * Resolves to the [[Signer]] account for %%address%% managed by\n * the client.\n *\n * If the %%address%% is a number, it is used as an index in the\n * the accounts from [[listAccounts]].\n *\n * This can only be used on clients which manage accounts (such as\n * Geth with imported account or MetaMask).\n *\n * Throws if the account doesn't exist.\n */\n async getSigner(address) {\n if (address == null) {\n address = 0;\n }\n const accountsPromise = this.send(\"xcb_accounts\", []);\n // Account index\n if (typeof address === \"number\") {\n const accounts = await accountsPromise;\n if (address >= accounts.length) {\n throw new Error(\"no such account\");\n }\n return new JsonRpcSigner(this, accounts[address]);\n }\n const { accounts } = await resolveProperties({\n network: this.getNetwork(),\n accounts: accountsPromise,\n });\n // Account address\n address = getAddress(address);\n for (const account of accounts) {\n if (getAddress(account) === address) {\n return new JsonRpcSigner(this, address);\n }\n }\n throw new Error(\"invalid account\");\n }\n async listAccounts() {\n const accounts = await this.send(\"xcb_accounts\", []);\n return accounts.map((a) => new JsonRpcSigner(this, a));\n }\n}\nexport class JsonRpcApiPollingProvider extends JsonRpcApiProvider {\n #pollingInterval;\n constructor(network, options) {\n super(network, options);\n this.#pollingInterval = 4000;\n }\n _getSubscriber(sub) {\n const subscriber = super._getSubscriber(sub);\n if (isPollable(subscriber)) {\n subscriber.pollingInterval = this.#pollingInterval;\n }\n return subscriber;\n }\n /**\n * The polling interval (default: 4000 ms)\n */\n get pollingInterval() {\n return this.#pollingInterval;\n }\n set pollingInterval(value) {\n if (!Number.isInteger(value) || value < 0) {\n throw new Error(\"invalid interval\");\n }\n this.#pollingInterval = value;\n this._forEachSubscriber((sub) => {\n if (isPollable(sub)) {\n sub.pollingInterval = this.#pollingInterval;\n }\n });\n }\n}\n/**\n * The JsonRpcProvider is one of the most common Providers,\n * which performs all operations over HTTP (or HTTPS) requests.\n *\n * Events are processed by polling the backend for the current block\n * number; when it advances, all block-base events are then checked\n * for updates.\n */\nexport class JsonRpcProvider extends JsonRpcApiPollingProvider {\n #connect;\n constructor(url, network, options) {\n if (url == null) {\n url = \"http://localhost:8545\";\n }\n super(network, options);\n if (typeof url === \"string\") {\n this.#connect = new FetchRequest(url);\n }\n else {\n this.#connect = url.clone();\n }\n }\n _getConnection() {\n return this.#connect.clone();\n }\n async send(method, params) {\n // All requests are over HTTP, so we can just start handling requests\n // We do this here rather than the constructor so that we don't send any\n // requests to the network (i.e. xcb_networkId) until we absolutely have to.\n await this._start();\n return await super.send(method, params);\n }\n async _send(payload) {\n // Configure a POST connection for the requested method\n const request = this._getConnection();\n request.body = JSON.stringify(payload);\n request.setHeader(\"content-type\", \"application/json\");\n const response = await request.send();\n response.assertOk();\n let resp = response.bodyJson;\n if (!Array.isArray(resp)) {\n resp = [resp];\n }\n return resp;\n }\n}\nfunction spelunkData(value) {\n if (value == null) {\n return null;\n }\n // These *are* the droids we're looking for.\n if (typeof value.message === \"string\" &&\n value.message.match(\"reverted\") &&\n isHexString(value.data)) {\n return { message: value.message, data: value.data };\n }\n // Spelunk further...\n if (typeof value === \"object\") {\n for (const key in value) {\n const result = spelunkData(value[key]);\n if (result) {\n return result;\n }\n }\n return null;\n }\n // Might be a JSON string we can further descend...\n if (typeof value === \"string\") {\n try {\n return spelunkData(JSON.parse(value));\n }\n catch (error) { }\n }\n return null;\n}\nfunction _spelunkMessage(value, result) {\n if (value == null) {\n return;\n }\n // These *are* the droids we're looking for.\n if (typeof value.message === \"string\") {\n result.push(value.message);\n }\n // Spelunk further...\n if (typeof value === \"object\") {\n for (const key in value) {\n _spelunkMessage(value[key], result);\n }\n }\n // Might be a JSON string we can further descend...\n if (typeof value === \"string\") {\n try {\n return _spelunkMessage(JSON.parse(value), result);\n }\n catch (error) { }\n }\n}\nfunction spelunkMessage(value) {\n const result = [];\n _spelunkMessage(value, result);\n return result;\n}\n//# sourceMappingURL=provider-jsonrpc.js.map","/**\n * [[link-ankr]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Core Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Polygon (``matic``)\n * - Arbitrum (``arbitrum``)\n *\n * @_subsection: api/providers/thirdparty:Ankr [providers-ankr]\n */\nimport { defineProperties, FetchRequest, assertArgument, } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultApiKey = \"9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"rpc.ankr.com/eth\";\n case \"goerli\":\n return \"rpc.ankr.com/xcb_goerli\";\n case \"matic\":\n return \"rpc.ankr.com/polygon\";\n case \"arbitrum\":\n return \"rpc.ankr.com/arbitrum\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **AnkrProvider** connects to the [[link-ankr]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-ankr-signup).\n */\nexport class AnkrProvider extends JsonRpcProvider {\n /**\n * The API key for the Ankr connection.\n */\n apiKey;\n /**\n * Create a new **AnkrProvider**.\n *\n * By default connecting to ``mainnet`` with a highly throttled\n * API key.\n */\n constructor(_network, apiKey) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n // Ankr does not support filterId, so we force polling\n const options = { polling: true, staticNetwork: network };\n const request = AnkrProvider.getRequest(network, apiKey);\n super(request, network, options);\n defineProperties(this, { apiKey });\n }\n _getProvider(networkId) {\n try {\n return new AnkrProvider(networkId, this.apiKey);\n }\n catch (error) { }\n return super._getProvider(networkId);\n }\n /**\n * Returns a prepared request for connecting to %%network%% with\n * %%apiKey%%.\n */\n static getRequest(network, apiKey) {\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/${apiKey}`);\n request.allowGzip = true;\n if (apiKey === defaultApiKey) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"AnkrProvider\");\n return true;\n };\n }\n return request;\n }\n getRpcError(payload, error) {\n if (payload.method === \"xcb_sendRawTransaction\") {\n if (error &&\n error.error &&\n error.error.message === \"INTERNAL_ERROR: could not replace existing tx\") {\n error.error.message = \"replacement transaction underpriced\";\n }\n }\n return super.getRpcError(payload, error);\n }\n isCommunityResource() {\n return this.apiKey === defaultApiKey;\n }\n}\n//# sourceMappingURL=provider-ankr.js.map","/**\n * About Alchemy\n *\n * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy]\n */\nimport { defineProperties, resolveProperties, assert, assertArgument, FetchRequest, } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultApiKey = \"_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"eth-mainnet.alchemyapi.io\";\n case \"goerli\":\n return \"eth-goerli.g.alchemy.com\";\n case \"sepolia\":\n return \"eth-sepolia.g.alchemy.com\";\n case \"arbitrum\":\n return \"arb-mainnet.g.alchemy.com\";\n case \"arbitrum-goerli\":\n return \"arb-goerli.g.alchemy.com\";\n case \"matic\":\n return \"polygon-mainnet.g.alchemy.com\";\n case \"matic-mumbai\":\n return \"polygon-mumbai.g.alchemy.com\";\n case \"optimism\":\n return \"opt-mainnet.g.alchemy.com\";\n case \"optimism-goerli\":\n return \"opt-goerli.g.alchemy.com\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **AlchemyProvider** connects to the [[link-alchemy]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-alchemy-signup).\n *\n * @_docloc: api/providers/thirdparty\n */\nexport class AlchemyProvider extends JsonRpcProvider {\n apiKey;\n constructor(_network, apiKey) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n const request = AlchemyProvider.getRequest(network, apiKey);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { apiKey });\n }\n _getProvider(networkId) {\n try {\n return new AlchemyProvider(networkId, this.apiKey);\n }\n catch (error) { }\n return super._getProvider(networkId);\n }\n async _perform(req) {\n // https://docs.alchemy.com/reference/trace-transaction\n if (req.method === \"getTransactionResult\") {\n const { trace, tx } = await resolveProperties({\n trace: this.send(\"trace_transaction\", [req.hash]),\n tx: this.getTransaction(req.hash),\n });\n if (trace == null || tx == null) {\n return null;\n }\n let data;\n let error = false;\n try {\n data = trace[0].result.output;\n error = trace[0].error === \"Reverted\";\n }\n catch (error) { }\n if (data) {\n assert(!error, \"an error occurred during transaction executions\", \"CALL_EXCEPTION\", {\n action: \"getTransactionResult\",\n data,\n reason: null,\n transaction: tx,\n invocation: null,\n revert: null, // @TODO\n });\n return data;\n }\n assert(false, \"could not parse trace result\", \"BAD_DATA\", {\n value: trace,\n });\n }\n return await super._perform(req);\n }\n isCommunityResource() {\n return this.apiKey === defaultApiKey;\n }\n static getRequest(network, apiKey) {\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/v2/${apiKey}`);\n request.allowGzip = true;\n if (apiKey === defaultApiKey) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"alchemy\");\n return true;\n };\n }\n return request;\n }\n}\n//# sourceMappingURL=provider-alchemy.js.map","/**\n * About Cloudflare\n *\n * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare]\n */\nimport { assertArgument } from \"../utils/index.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\n/**\n * About Cloudflare...\n */\nexport class CloudflareProvider extends JsonRpcProvider {\n constructor(_network) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n assertArgument(network.name === \"mainnet\", \"unsupported network\", \"network\", _network);\n super(\"https://cloudflare-eth.com/\", network, { staticNetwork: network });\n }\n}\n//# sourceMappingURL=provider-cloudflare.js.map","function getGlobal() {\n if (typeof self !== \"undefined\") {\n return self;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof global !== \"undefined\") {\n return global;\n }\n throw new Error(\"unable to locate global object\");\n}\nconst _WebSocket = getGlobal().WebSocket;\nexport { _WebSocket as WebSocket };\n//# sourceMappingURL=ws-browser.js.map","/**\n * Generic long-lived socket provider.\n *\n * Sub-classing notes\n * - a sub-class MUST call the `_start()` method once connected\n * - a sub-class MUST override the `_write(string)` method\n * - a sub-class MUST call `_processMessage(string)` for each message\n *\n * @_subsection: api/providers/abstract-provider\n */\nimport { UnmanagedSubscriber } from \"./abstract-provider.js\";\nimport { assert, assertArgument, makeError } from \"../utils/index.js\";\nimport { JsonRpcApiProvider } from \"./provider-jsonrpc.js\";\nexport class SocketSubscriber {\n #provider;\n #filter;\n get filter() {\n return JSON.parse(this.#filter);\n }\n #filterId;\n #paused;\n #emitPromise;\n constructor(provider, filter) {\n this.#provider = provider;\n this.#filter = JSON.stringify(filter);\n this.#filterId = null;\n this.#paused = null;\n this.#emitPromise = null;\n }\n start() {\n this.#filterId = this.#provider\n .send(\"xcb_subscribe\", this.filter)\n .then((filterId) => {\n this.#provider._register(filterId, this);\n return filterId;\n });\n }\n stop() {\n this.#filterId.then((filterId) => {\n this.#provider.send(\"xcb_unsubscribe\", [filterId]);\n });\n this.#filterId = null;\n }\n // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs\n // and resume\n pause(dropWhilePaused) {\n assert(dropWhilePaused, \"preserve logs while paused not supported by SocketSubscriber yet\", \"UNSUPPORTED_OPERATION\", { operation: \"pause(false)\" });\n this.#paused = !!dropWhilePaused;\n }\n resume() {\n this.#paused = null;\n }\n _handleMessage(message) {\n if (this.#filterId == null) {\n return;\n }\n if (this.#paused === null) {\n let emitPromise = this.#emitPromise;\n if (emitPromise == null) {\n emitPromise = this._emit(this.#provider, message);\n }\n else {\n emitPromise = emitPromise.then(async () => {\n await this._emit(this.#provider, message);\n });\n }\n this.#emitPromise = emitPromise.then(() => {\n if (this.#emitPromise === emitPromise) {\n this.#emitPromise = null;\n }\n });\n }\n }\n async _emit(provider, message) {\n throw new Error(\"sub-classes must implemente this; _emit\");\n }\n}\nexport class SocketBlockSubscriber extends SocketSubscriber {\n constructor(provider) {\n super(provider, [\"newHeads\"]);\n }\n async _emit(provider, message) {\n provider.emit(\"block\", parseInt(message.number));\n }\n}\nexport class SocketPendingSubscriber extends SocketSubscriber {\n constructor(provider) {\n super(provider, [\"newPendingTransactions\"]);\n }\n async _emit(provider, message) {\n provider.emit(\"pending\", message);\n }\n}\nexport class SocketEventSubscriber extends SocketSubscriber {\n #logFilter;\n get logFilter() {\n return JSON.parse(this.#logFilter);\n }\n constructor(provider, filter) {\n super(provider, [\"logs\", filter]);\n this.#logFilter = JSON.stringify(filter);\n }\n async _emit(provider, message) {\n provider.emit(this.logFilter, provider._wrapLog(message, provider._network));\n }\n}\n/**\n * SocketProvider...\n *\n */\nexport class SocketProvider extends JsonRpcApiProvider {\n #callbacks;\n // Maps each filterId to its subscriber\n #subs;\n // If any events come in before a subscriber has finished\n // registering, queue them\n #pending;\n constructor(network) {\n super(network, { batchMaxCount: 1 });\n this.#callbacks = new Map();\n this.#subs = new Map();\n this.#pending = new Map();\n }\n // This value is only valid after _start has been called\n /*\n get _network(): Network {\n if (this.#network == null) {\n throw new Error(\"this shouldn't happen\");\n }\n return this.#network.clone();\n }\n */\n _getSubscriber(sub) {\n switch (sub.type) {\n case \"close\":\n return new UnmanagedSubscriber(\"close\");\n case \"block\":\n return new SocketBlockSubscriber(this);\n case \"pending\":\n return new SocketPendingSubscriber(this);\n case \"event\":\n return new SocketEventSubscriber(this, sub.filter);\n case \"orphan\":\n // Handled auto-matically within AbstractProvider\n // when the log.removed = true\n if (sub.filter.orphan === \"drop-log\") {\n return new UnmanagedSubscriber(\"drop-log\");\n }\n }\n return super._getSubscriber(sub);\n }\n _register(filterId, subscriber) {\n this.#subs.set(filterId, subscriber);\n const pending = this.#pending.get(filterId);\n if (pending) {\n for (const message of pending) {\n subscriber._handleMessage(message);\n }\n this.#pending.delete(filterId);\n }\n }\n async _send(payload) {\n // WebSocket provider doesn't accept batches\n assertArgument(!Array.isArray(payload), \"WebSocket does not support batch send\", \"payload\", payload);\n // @TODO: stringify payloads here and store to prevent mutations\n // Prepare a promise to respond to\n const promise = new Promise((resolve, reject) => {\n this.#callbacks.set(payload.id, { payload, resolve, reject });\n });\n // Wait until the socket is connected before writing to it\n await this._waitUntilReady();\n // Write the request to the socket\n await this._write(JSON.stringify(payload));\n return [await promise];\n }\n // Sub-classes must call this once they are connected\n /*\n async _start(): Promise {\n if (this.#ready) { return; }\n \n for (const { payload } of this.#callbacks.values()) {\n await this._write(JSON.stringify(payload));\n }\n \n this.#ready = (async function() {\n await super._start();\n })();\n }\n */\n // Sub-classes must call this for each message\n async _processMessage(message) {\n const result = (JSON.parse(message));\n if (\"id\" in result) {\n const callback = this.#callbacks.get(result.id);\n if (callback == null) {\n this.emit(\"error\", makeError(\"received result for unknown id\", \"UNKNOWN_ERROR\", {\n reasonCode: \"UNKNOWN_ID\",\n result,\n }));\n return;\n }\n this.#callbacks.delete(result.id);\n callback.resolve(result);\n }\n else if (result.method === \"xcb_subscription\") {\n const filterId = result.params.subscription;\n const subscriber = this.#subs.get(filterId);\n if (subscriber) {\n subscriber._handleMessage(result.params.result);\n }\n else {\n let pending = this.#pending.get(filterId);\n if (pending == null) {\n pending = [];\n this.#pending.set(filterId, pending);\n }\n pending.push(result.params.result);\n }\n }\n }\n async _write(message) {\n throw new Error(\"sub-classes must override this\");\n }\n}\n//# sourceMappingURL=provider-socket.js.map","import { WebSocket as _WebSocket } from \"./ws.js\"; /*-browser*/\nimport { SocketProvider } from \"./provider-socket.js\";\nexport class WebSocketProvider extends SocketProvider {\n #connect;\n #websocket;\n get websocket() {\n if (this.#websocket == null) {\n throw new Error(\"websocket closed\");\n }\n return this.#websocket;\n }\n constructor(url, network) {\n super(network);\n if (typeof url === \"string\") {\n this.#connect = () => {\n return new _WebSocket(url);\n };\n this.#websocket = this.#connect();\n }\n else if (typeof url === \"function\") {\n this.#connect = url;\n this.#websocket = url();\n }\n else {\n this.#connect = null;\n this.#websocket = url;\n }\n this.websocket.onopen = async () => {\n try {\n await this._start();\n this.resume();\n }\n catch (error) {\n console.log(\"failed to start WebsocketProvider\", error);\n // @TODO: now what? Attempt reconnect?\n }\n };\n this.websocket.onmessage = (message) => {\n this._processMessage(message.data);\n };\n /*\n this.websocket.onclose = (event) => {\n // @TODO: What event.code should we reconnect on?\n const reconnect = false;\n if (reconnect) {\n this.pause(true);\n if (this.#connect) {\n this.#websocket = this.#connect();\n this.#websocket.onopen = ...\n // @TODO: this requires the super class to rebroadcast; move it there\n }\n this._reconnect();\n }\n };\n */\n }\n async _write(message) {\n this.websocket.send(message);\n }\n async destroy() {\n if (this.#websocket != null) {\n this.#websocket.close();\n this.#websocket = null;\n }\n super.destroy();\n }\n}\n//# sourceMappingURL=provider-websocket.js.map","/**\n * [[link-infura]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Core Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:INFURA [providers-infura]\n */\nimport { defineProperties, FetchRequest, assert, assertArgument, } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nimport { WebSocketProvider } from \"./provider-websocket.js\";\nconst defaultProjectId = \"84842078b09946638c03157f83405213\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"mainnet.infura.io\";\n case \"goerli\":\n return \"goerli.infura.io\";\n case \"sepolia\":\n return \"sepolia.infura.io\";\n case \"arbitrum\":\n return \"arbitrum-mainnet.infura.io\";\n case \"arbitrum-goerli\":\n return \"arbitrum-goerli.infura.io\";\n case \"matic\":\n return \"polygon-mainnet.infura.io\";\n case \"matic-mumbai\":\n return \"polygon-mumbai.infura.io\";\n case \"optimism\":\n return \"optimism-mainnet.infura.io\";\n case \"optimism-goerli\":\n return \"optimism-goerli.infura.io\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **InfuraWebSocketProvider** connects to the [[link-infura]]\n * WebSocket end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-infura-signup).\n */\nexport class InfuraWebSocketProvider extends WebSocketProvider {\n /**\n * The Project ID for the INFURA connection.\n */\n projectId;\n /**\n * The Project Secret.\n *\n * If null, no authenticated requests are made. This should not\n * be used outside of private contexts.\n */\n projectSecret;\n /**\n * Creates a new **InfuraWebSocketProvider**.\n */\n constructor(network, projectId) {\n const provider = new InfuraProvider(network, projectId);\n const req = provider._getConnection();\n assert(!req.credentials, \"INFURA WebSocket project secrets unsupported\", \"UNSUPPORTED_OPERATION\", { operation: \"InfuraProvider.getWebSocketProvider()\" });\n const url = req.url.replace(/^http/i, \"ws\").replace(\"/v3/\", \"/ws/v3/\");\n super(url, network);\n defineProperties(this, {\n projectId: provider.projectId,\n projectSecret: provider.projectSecret,\n });\n }\n isCommunityResource() {\n return this.projectId === defaultProjectId;\n }\n}\n/**\n * The **InfuraProvider** connects to the [[link-infura]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-infura-signup).\n */\nexport class InfuraProvider extends JsonRpcProvider {\n /**\n * The Project ID for the INFURA connection.\n */\n projectId;\n /**\n * The Project Secret.\n *\n * If null, no authenticated requests are made. This should not\n * be used outside of private contexts.\n */\n projectSecret;\n /**\n * Creates a new **InfuraProvider**.\n */\n constructor(_network, projectId, projectSecret) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (projectId == null) {\n projectId = defaultProjectId;\n }\n if (projectSecret == null) {\n projectSecret = null;\n }\n const request = InfuraProvider.getRequest(network, projectId, projectSecret);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { projectId, projectSecret });\n }\n _getProvider(networkId) {\n try {\n return new InfuraProvider(networkId, this.projectId, this.projectSecret);\n }\n catch (error) { }\n return super._getProvider(networkId);\n }\n isCommunityResource() {\n return this.projectId === defaultProjectId;\n }\n /**\n * Creates a new **InfuraWebSocketProvider**.\n */\n static getWebSocketProvider(network, projectId) {\n return new InfuraWebSocketProvider(network, projectId);\n }\n /**\n * Returns a prepared request for connecting to %%network%%\n * with %%projectId%% and %%projectSecret%%.\n */\n static getRequest(network, projectId, projectSecret) {\n if (projectId == null) {\n projectId = defaultProjectId;\n }\n if (projectSecret == null) {\n projectSecret = null;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/v3/${projectId}`);\n request.allowGzip = true;\n if (projectSecret) {\n request.setCredentials(\"\", projectSecret);\n }\n if (projectId === defaultProjectId) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"InfuraProvider\");\n return true;\n };\n }\n return request;\n }\n}\n//# sourceMappingURL=provider-infura.js.map","/**\n * [[link-quicknode]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Core Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode]\n */\nimport { defineProperties, FetchRequest, assertArgument, } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultToken = \"919b412a057b5e9c9b6dce193c5a60242d6efadb\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"corebc.quiknode.pro\";\n case \"arbitrum\":\n return \"corebc.arbitrum-mainnet.quiknode.pro\";\n case \"arbitrum-goerli\":\n return \"corebc.arbitrum-goerli.quiknode.pro\";\n case \"matic\":\n return \"corebc.matic.quiknode.pro\";\n case \"matic-mumbai\":\n return \"corebc.matic-testnet.quiknode.pro\";\n case \"optimism\":\n return \"corebc.optimism.quiknode.pro\";\n case \"optimism-goerli\":\n return \"corebc.optimism-goerli.quiknode.pro\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **QuickNodeProvider** connects to the [[link-quicknode]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API token is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-quicknode).\n */\nexport class QuickNodeProvider extends JsonRpcProvider {\n /**\n * The API token.\n */\n token;\n /**\n * Creates a new **QuickNodeProvider**.\n */\n constructor(_network, token) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (token == null) {\n token = defaultToken;\n }\n const request = QuickNodeProvider.getRequest(network, token);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { token });\n }\n _getProvider(networkId) {\n try {\n return new QuickNodeProvider(networkId, this.token);\n }\n catch (error) { }\n return super._getProvider(networkId);\n }\n isCommunityResource() {\n return this.token === defaultToken;\n }\n /**\n * Returns a new request prepared for %%network%% and the\n * %%token%%.\n */\n static getRequest(network, token) {\n if (token == null) {\n token = defaultToken;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/${token}`);\n request.allowGzip = true;\n //if (projectSecret) { request.setCredentials(\"\", projectSecret); }\n if (token === defaultToken) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"QuickNodeProvider\");\n return true;\n };\n }\n return request;\n }\n}\n//# sourceMappingURL=provider-quicknode.js.map","/**\n * Explain all the nitty-gritty about the **FallbackProvider**.\n *\n * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider]\n */\nimport { getBigInt, getNumber, assert, assertArgument, } from \"../utils/index.js\";\nimport { AbstractProvider } from \"./abstract-provider.js\";\nimport { Network } from \"./network.js\";\nconst BN_1 = BigInt(\"1\");\nconst BN_2 = BigInt(\"2\");\nfunction shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n const tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n }\n}\nfunction stall(duration) {\n return new Promise((resolve) => {\n setTimeout(resolve, duration);\n });\n}\nfunction getTime() {\n return new Date().getTime();\n}\nfunction stringify(value) {\n return JSON.stringify(value, (key, value) => {\n if (typeof value === \"bigint\") {\n return { type: \"bigint\", value: value.toString() };\n }\n return value;\n });\n}\nconst defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 };\nconst defaultState = {\n blockNumber: -2,\n requests: 0,\n lateResponses: 0,\n errorResponses: 0,\n outOfSync: -1,\n unsupportedEvents: 0,\n rollingDuration: 0,\n score: 0,\n _network: null,\n _updateNumber: null,\n _totalTime: 0,\n};\nasync function waitForSync(config, blockNumber) {\n while (config.blockNumber < 0 || config.blockNumber < blockNumber) {\n if (!config._updateNumber) {\n config._updateNumber = (async () => {\n const blockNumber = await config.provider.getBlockNumber();\n if (blockNumber > config.blockNumber) {\n config.blockNumber = blockNumber;\n }\n config._updateNumber = null;\n })();\n }\n await config._updateNumber;\n config.outOfSync++;\n }\n}\nfunction _normalize(value) {\n if (value == null) {\n return \"null\";\n }\n if (Array.isArray(value)) {\n return \"[\" + value.map(_normalize).join(\",\") + \"]\";\n }\n if (typeof value === \"object\" && typeof value.toJSON === \"function\") {\n return _normalize(value.toJSON());\n }\n switch (typeof value) {\n case \"boolean\":\n case \"symbol\":\n return value.toString();\n case \"bigint\":\n case \"number\":\n return BigInt(value).toString();\n case \"string\":\n return JSON.stringify(value);\n case \"object\": {\n const keys = Object.keys(value);\n keys.sort();\n return (\"{\" +\n keys\n .map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`)\n .join(\",\") +\n \"}\");\n }\n }\n console.log(\"Could not serialize\", value);\n throw new Error(\"Hmm...\");\n}\nfunction normalizeResult(value) {\n if (\"error\" in value) {\n const error = value.error;\n return { tag: _normalize(error), value: error };\n }\n const result = value.result;\n return { tag: _normalize(result), value: result };\n}\n// This strategy picks the highest weight result, as long as the weight is\n// equal to or greater than quorum\nfunction checkQuorum(quorum, results) {\n const tally = new Map();\n for (const { value, tag, weight } of results) {\n const t = tally.get(tag) || { value, weight: 0 };\n t.weight += weight;\n tally.set(tag, t);\n }\n let best = null;\n for (const r of tally.values()) {\n if (r.weight >= quorum && (!best || r.weight > best.weight)) {\n best = r;\n }\n }\n if (best) {\n return best.value;\n }\n return undefined;\n}\nfunction getMedian(quorum, results) {\n let resultWeight = 0;\n const errorMap = new Map();\n let bestError = null;\n const values = [];\n for (const { value, tag, weight } of results) {\n if (value instanceof Error) {\n const e = errorMap.get(tag) || { value, weight: 0 };\n e.weight += weight;\n errorMap.set(tag, e);\n if (bestError == null || e.weight > bestError.weight) {\n bestError = e;\n }\n }\n else {\n values.push(BigInt(value));\n resultWeight += weight;\n }\n }\n if (resultWeight < quorum) {\n // We have quorum for an error\n if (bestError && bestError.weight >= quorum) {\n return bestError.value;\n }\n // We do not have quorum for a result\n return undefined;\n }\n // Get the sorted values\n values.sort((a, b) => (a < b ? -1 : b > a ? 1 : 0));\n const mid = Math.floor(values.length / 2);\n // Odd-length; take the middle value\n if (values.length % 2) {\n return values[mid];\n }\n // Even length; take the ceiling of the mean of the center two values\n return (values[mid - 1] + values[mid] + BN_1) / BN_2;\n}\nfunction getAnyResult(quorum, results) {\n // If any value or error meets quorum, that is our preferred result\n const result = checkQuorum(quorum, results);\n if (result !== undefined) {\n return result;\n }\n // Otherwise, do we have any result?\n for (const r of results) {\n if (r.value) {\n return r.value;\n }\n }\n // Nope!\n return undefined;\n}\nfunction getFuzzyMode(quorum, results) {\n if (quorum === 1) {\n return getNumber(getMedian(quorum, results), \"%internal\");\n }\n const tally = new Map();\n const add = (result, weight) => {\n const t = tally.get(result) || { result, weight: 0 };\n t.weight += weight;\n tally.set(result, t);\n };\n for (const { weight, value } of results) {\n const r = getNumber(value);\n add(r - 1, weight);\n add(r, weight);\n add(r + 1, weight);\n }\n let bestWeight = 0;\n let bestResult = undefined;\n for (const { weight, result } of tally.values()) {\n // Use this result, if this result meets quorum and has either:\n // - a better weight\n // - or equal weight, but the result is larger\n if (weight >= quorum &&\n (weight > bestWeight ||\n (bestResult != null && weight === bestWeight && result > bestResult))) {\n bestWeight = weight;\n bestResult = result;\n }\n }\n return bestResult;\n}\n/**\n * A Fallback Provider.\n *\n */\nexport class FallbackProvider extends AbstractProvider {\n quorum;\n eventQuorum;\n eventWorkers;\n #configs;\n #height;\n #initialSyncPromise;\n constructor(providers, network) {\n super(network);\n this.#configs = providers.map((p) => {\n if (p instanceof AbstractProvider) {\n return Object.assign({ provider: p }, defaultConfig, defaultState);\n }\n else {\n return Object.assign({}, defaultConfig, p, defaultState);\n }\n });\n this.#height = -2;\n this.#initialSyncPromise = null;\n this.quorum = 2; //Math.ceil(providers.length / 2);\n this.eventQuorum = 1;\n this.eventWorkers = 1;\n assertArgument(this.quorum <= this.#configs.reduce((a, c) => a + c.weight, 0), \"quorum exceed provider wieght\", \"quorum\", this.quorum);\n }\n get providerConfigs() {\n return this.#configs.map((c) => {\n const result = Object.assign({}, c);\n for (const key in result) {\n if (key[0] === \"_\") {\n delete result[key];\n }\n }\n return result;\n });\n }\n async _detectNetwork() {\n return Network.from(getBigInt(await this._perform({ method: \"networkId\" })));\n }\n // @TODO: Add support to select providers to be the event subscriber\n //_getSubscriber(sub: Subscription): Subscriber {\n // throw new Error(\"@TODO\");\n //}\n async _translatePerform(provider, req) {\n switch (req.method) {\n case \"broadcastTransaction\":\n return await provider.broadcastTransaction(req.signedTransaction);\n case \"call\":\n return await provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag }));\n case \"networkId\":\n return (await provider.getNetwork()).networkId;\n case \"estimateEnergy\":\n return await provider.estimateEnergy(req.transaction);\n case \"getBalance\":\n return await provider.getBalance(req.address, req.blockTag);\n case \"getBlock\": {\n const block = \"blockHash\" in req ? req.blockHash : req.blockTag;\n return await provider.getBlock(block, req.includeTransactions);\n }\n case \"getBlockNumber\":\n return await provider.getBlockNumber();\n case \"getCode\":\n return await provider.getCode(req.address, req.blockTag);\n case \"getEnergyPrice\":\n return (await provider.getFeeData()).energyPrice;\n case \"getLogs\":\n return await provider.getLogs(req.filter);\n case \"getStorage\":\n return await provider.getStorage(req.address, req.position, req.blockTag);\n case \"getTransaction\":\n return await provider.getTransaction(req.hash);\n case \"getTransactionCount\":\n return await provider.getTransactionCount(req.address, req.blockTag);\n case \"getTransactionReceipt\":\n return await provider.getTransactionReceipt(req.hash);\n case \"getTransactionResult\":\n return await provider.getTransactionResult(req.hash);\n }\n }\n // Grab the next (random) config that is not already part of\n // the running set\n #getNextConfig(running) {\n // @TODO: Maybe do a check here to favour (heavily) providers that\n // do not require waitForSync and disfavour providers that\n // seem down-ish or are behaving slowly\n const configs = Array.from(running).map((r) => r.config);\n // Shuffle the states, sorted by priority\n const allConfigs = this.#configs.slice();\n shuffle(allConfigs);\n allConfigs.sort((a, b) => b.priority - a.priority);\n for (const config of allConfigs) {\n if (configs.indexOf(config) === -1) {\n return config;\n }\n }\n return null;\n }\n // Adds a new runner (if available) to running.\n #addRunner(running, req) {\n const config = this.#getNextConfig(running);\n // No runners available\n if (config == null) {\n return null;\n }\n // Create a new runner\n const runner = {\n config,\n result: null,\n didBump: false,\n perform: null,\n staller: null,\n };\n const now = getTime();\n // Start performing this operation\n runner.perform = (async () => {\n try {\n config.requests++;\n const result = await this._translatePerform(config.provider, req);\n runner.result = { result };\n }\n catch (error) {\n config.errorResponses++;\n runner.result = { error };\n }\n const dt = getTime() - now;\n config._totalTime += dt;\n config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt;\n runner.perform = null;\n })();\n // Start a staller; when this times out, it's time to force\n // kicking off another runner because we are taking too long\n runner.staller = (async () => {\n await stall(config.stallTimeout);\n runner.staller = null;\n })();\n running.add(runner);\n return runner;\n }\n // Initializes the blockNumber and network for each runner and\n // blocks until initialized\n async #initialSync() {\n let initialSync = this.#initialSyncPromise;\n if (!initialSync) {\n const promises = [];\n this.#configs.forEach((config) => {\n promises.push(waitForSync(config, 0));\n promises.push((async () => {\n config._network = await config.provider.getNetwork();\n })());\n });\n this.#initialSyncPromise = initialSync = (async () => {\n // Wait for all providers to have a block number and network\n await Promise.all(promises);\n // Check all the networks match\n let networkId = null;\n for (const config of this.#configs) {\n const network = config._network;\n if (networkId == null) {\n networkId = network.networkId;\n }\n else if (network.networkId !== networkId) {\n assert(false, \"cannot mix providers on different networks\", \"UNSUPPORTED_OPERATION\", {\n operation: \"new FallbackProvider\",\n });\n }\n }\n })();\n }\n await initialSync;\n }\n async #checkQuorum(running, req) {\n // Get all the result objects\n const results = [];\n for (const runner of running) {\n if (runner.result != null) {\n const { tag, value } = normalizeResult(runner.result);\n results.push({ tag, value, weight: runner.config.weight });\n }\n }\n // Are there enough results to event meet quorum?\n if (results.reduce((a, r) => a + r.weight, 0) < this.quorum) {\n return undefined;\n }\n switch (req.method) {\n case \"getBlockNumber\": {\n // We need to get the bootstrap block height\n if (this.#height === -2) {\n this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.map((c) => ({\n value: c.blockNumber,\n tag: getNumber(c.blockNumber).toString(),\n weight: c.weight,\n })))));\n }\n // Find the mode across all the providers, allowing for\n // a little drift between block heights\n const mode = getFuzzyMode(this.quorum, results);\n if (mode === undefined) {\n return undefined;\n }\n if (mode > this.#height) {\n this.#height = mode;\n }\n return this.#height;\n }\n case \"getEnergyPrice\":\n case \"estimateEnergy\":\n return getMedian(this.quorum, results);\n case \"getBlock\":\n // Pending blocks are in the mempool and already\n // quite untrustworthy; just grab anything\n if (\"blockTag\" in req && req.blockTag === \"pending\") {\n return getAnyResult(this.quorum, results);\n }\n return checkQuorum(this.quorum, results);\n case \"call\":\n case \"networkId\":\n case \"getBalance\":\n case \"getTransactionCount\":\n case \"getCode\":\n case \"getStorage\":\n case \"getTransaction\":\n case \"getTransactionReceipt\":\n case \"getLogs\":\n return checkQuorum(this.quorum, results);\n case \"broadcastTransaction\":\n return getAnyResult(this.quorum, results);\n }\n assert(false, \"unsupported method\", \"UNSUPPORTED_OPERATION\", {\n operation: `_perform(${stringify(req.method)})`,\n });\n }\n async #waitForQuorum(running, req) {\n if (running.size === 0) {\n throw new Error(\"no runners?!\");\n }\n // Any promises that are interesting to watch for; an expired stall\n // or a successful perform\n const interesting = [];\n let newRunners = 0;\n for (const runner of running) {\n // No responses, yet; keep an eye on it\n if (runner.perform) {\n interesting.push(runner.perform);\n }\n // Still stalling...\n if (runner.staller) {\n interesting.push(runner.staller);\n continue;\n }\n // This runner has already triggered another runner\n if (runner.didBump) {\n continue;\n }\n // Got a response (result or error) or stalled; kick off another runner\n runner.didBump = true;\n newRunners++;\n }\n // Check if we have reached quorum on a result (or error)\n const value = await this.#checkQuorum(running, req);\n if (value !== undefined) {\n if (value instanceof Error) {\n throw value;\n }\n return value;\n }\n // Add any new runners, because a staller timed out or a result\n // or error response came in.\n for (let i = 0; i < newRunners; i++) {\n this.#addRunner(running, req);\n }\n // All providers have returned, and we have no result\n assert(interesting.length > 0, \"quorum not met\", \"SERVER_ERROR\", {\n request: \"%sub-requests\",\n info: {\n request: req,\n results: Array.from(running).map((r) => stringify(r.result)),\n },\n });\n // Wait for someone to either complete its perform or stall out\n await Promise.race(interesting);\n // This is recursive, but at worst case the depth is 2x the\n // number of providers (each has a perform and a staller)\n return await this.#waitForQuorum(running, req);\n }\n async _perform(req) {\n // Broadcasting a transaction is rare (ish) and already incurs\n // a cost on the user, so spamming is safe-ish. Just send it to\n // every backend.\n if (req.method === \"broadcastTransaction\") {\n const results = await Promise.all(this.#configs.map(async ({ provider, weight }) => {\n try {\n const result = await provider._perform(req);\n return Object.assign(normalizeResult({ result }), { weight });\n }\n catch (error) {\n return Object.assign(normalizeResult({ error }), { weight });\n }\n }));\n const result = getAnyResult(this.quorum, results);\n assert(result !== undefined, \"problem multi-broadcasting\", \"SERVER_ERROR\", {\n request: \"%sub-requests\",\n info: { request: req, results: results.map(stringify) },\n });\n if (result instanceof Error) {\n throw result;\n }\n return result;\n }\n await this.#initialSync();\n // Bootstrap enough runners to meet quorum\n const running = new Set();\n for (let i = 0; i < this.quorum; i++) {\n this.#addRunner(running, req);\n }\n const result = await this.#waitForQuorum(running, req);\n // Track requests sent to a provider that are still\n // outstanding after quorum has been otherwise found\n for (const runner of running) {\n if (runner.perform && runner.result == null) {\n runner.config.lateResponses++;\n }\n }\n return result;\n }\n async destroy() {\n for (const { provider } of this.#configs) {\n provider.destroy();\n }\n super.destroy();\n }\n}\n//# sourceMappingURL=provider-fallback.js.map","import { assert } from \"../utils/index.js\";\nimport { AnkrProvider } from \"./provider-ankr.js\";\nimport { AlchemyProvider } from \"./provider-alchemy.js\";\nimport { CloudflareProvider } from \"./provider-cloudflare.js\";\nimport { InfuraProvider } from \"./provider-infura.js\";\n//import { PocketProvider } from \"./provider-pocket.js\";\nimport { QuickNodeProvider } from \"./provider-quicknode.js\";\nimport { FallbackProvider } from \"./provider-fallback.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nimport { WebSocketProvider } from \"./provider-websocket.js\";\nfunction isWebSocketLike(value) {\n return (value &&\n typeof value.send === \"function\" &&\n typeof value.close === \"function\");\n}\nexport function getDefaultProvider(network, options) {\n if (options == null) {\n options = {};\n }\n if (typeof network === \"string\" && network.match(/^https?:/)) {\n return new JsonRpcProvider(network);\n }\n if ((typeof network === \"string\" && network.match(/^wss?:/)) ||\n isWebSocketLike(network)) {\n return new WebSocketProvider(network);\n }\n const providers = [];\n if (options.alchemy !== \"-\") {\n try {\n providers.push(new AlchemyProvider(network, options.alchemy));\n }\n catch (error) {\n console.log(error);\n }\n }\n if (options.ankr !== \"-\" && options.ankr != null) {\n try {\n providers.push(new AnkrProvider(network, options.ankr));\n }\n catch (error) {\n console.log(error);\n }\n }\n if (options.cloudflare !== \"-\") {\n try {\n providers.push(new CloudflareProvider(network));\n }\n catch (error) {\n console.log(error);\n }\n }\n if (options.infura !== \"-\") {\n try {\n let projectId = options.infura;\n let projectSecret = undefined;\n if (typeof projectId === \"object\") {\n projectSecret = projectId.projectSecret;\n projectId = projectId.projectId;\n }\n providers.push(new InfuraProvider(network, projectId, projectSecret));\n }\n catch (error) {\n console.log(error);\n }\n }\n /*\n if (options.pocket !== \"-\") {\n try {\n let appId = options.pocket;\n let secretKey: undefined | string = undefined;\n let loadBalancer: undefined | boolean = undefined;\n if (typeof(appId) === \"object\") {\n loadBalancer = !!appId.loadBalancer;\n secretKey = appId.secretKey;\n appId = appId.appId;\n }\n providers.push(new PocketProvider(network, appId, secretKey, loadBalancer));\n } catch (error) { console.log(error); }\n }\n */\n if (options.quicknode !== \"-\") {\n try {\n let token = options.quicknode;\n providers.push(new QuickNodeProvider(network, token));\n }\n catch (error) {\n console.log(error);\n }\n }\n assert(providers.length, \"unsupported default network\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getDefaultProvider\",\n });\n if (providers.length === 1) {\n return providers[0];\n }\n return new FallbackProvider(providers);\n}\n//# sourceMappingURL=default-provider.js.map","import { defineProperties } from \"../utils/index.js\";\nimport { AbstractSigner } from \"./abstract-signer.js\";\nexport class NonceManager extends AbstractSigner {\n signer;\n #noncePromise;\n #delta;\n constructor(signer) {\n super(signer.provider);\n defineProperties(this, { signer });\n this.#noncePromise = null;\n this.#delta = 0;\n }\n async getAddress() {\n return this.signer.getAddress();\n }\n connect(provider) {\n return new NonceManager(this.signer.connect(provider));\n }\n async getNonce(blockTag) {\n if (blockTag === \"pending\") {\n if (this.#noncePromise == null) {\n this.#noncePromise = super.getNonce(\"pending\");\n }\n const delta = this.#delta;\n return (await this.#noncePromise) + delta;\n }\n return super.getNonce(blockTag);\n }\n increment() {\n this.#delta++;\n }\n reset() {\n this.#delta = 0;\n this.#noncePromise = null;\n }\n async sendTransaction(tx) {\n const noncePromise = this.getNonce(\"pending\");\n this.increment();\n tx = await this.signer.populateTransaction(tx);\n tx.nonce = await noncePromise;\n // @TODO: Maybe handle interesting/recoverable errors?\n // Like don't increment if the tx was certainly not sent\n return await this.signer.sendTransaction(tx);\n }\n signTransaction(tx) {\n return this.signer.signTransaction(tx);\n }\n signMessage(message) {\n return this.signer.signMessage(message);\n }\n signTypedData(domain, types, value) {\n return this.signer.signTypedData(domain, types, value);\n }\n}\n//# sourceMappingURL=signer-noncemanager.js.map","import { assertArgument } from \"../utils/index.js\";\nimport { JsonRpcApiPollingProvider } from \"./provider-jsonrpc.js\";\nexport class BrowserProvider extends JsonRpcApiPollingProvider {\n #request;\n constructor(core, network) {\n super(network, { batchMaxCount: 1 });\n this.#request = async (method, params) => {\n const payload = { method, params };\n this.emit(\"debug\", { action: \"sendEip1193Request\", payload });\n try {\n const result = await core.request(payload);\n this.emit(\"debug\", { action: \"receiveEip1193Result\", result });\n return result;\n }\n catch (e) {\n const error = new Error(e.message);\n error.code = e.code;\n error.data = e.data;\n error.payload = payload;\n this.emit(\"debug\", { action: \"receiveEip1193Error\", error });\n throw error;\n }\n };\n }\n async send(method, params) {\n await this._start();\n return await super.send(method, params);\n }\n async _send(payload) {\n assertArgument(!Array.isArray(payload), \"EIP-1193 does not support batch request\", \"payload\", payload);\n try {\n const result = await this.#request(payload.method, payload.params || []);\n return [{ id: payload.id, result }];\n }\n catch (e) {\n return [\n {\n id: payload.id,\n error: { code: e.code, data: e.data, message: e.message },\n },\n ];\n }\n }\n getRpcError(payload, error) {\n error = JSON.parse(JSON.stringify(error));\n // EIP-1193 gives us some machine-readable error codes, so rewrite\n // them into\n switch (error.error.code || -1) {\n case 4001:\n error.error.message = `corebc-user-denied: ${error.error.message}`;\n break;\n case 4200:\n error.error.message = `corebc-unsupported: ${error.error.message}`;\n break;\n }\n return super.getRpcError(payload, error);\n }\n async hasSigner(address) {\n if (address == null) {\n address = 0;\n }\n const accounts = await this.send(\"xcb_accounts\", []);\n if (typeof address === \"number\") {\n return accounts.length > address;\n }\n address = address.toLowerCase();\n return (accounts.filter((a) => a.toLowerCase() === address).length !== 0);\n }\n async getSigner(address) {\n if (address == null) {\n address = 0;\n }\n if (!(await this.hasSigner(address))) {\n try {\n //const resp =\n await this.#request(\"xcb_requestAccounts\", []);\n //console.log(\"RESP\", resp);\n }\n catch (error) {\n const payload = error.payload;\n throw this.getRpcError(payload, { id: payload.id, error });\n }\n }\n return await super.getSigner(address);\n }\n}\n//# sourceMappingURL=provider-browser.js.map","/**\n * [[link-pocket]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Core Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Polygon (``matic``)\n * - Arbitrum (``arbitrum``)\n *\n * @_subsection: api/providers/thirdparty:Pocket [providers-pocket]\n */\nimport { defineProperties, FetchRequest, assertArgument, } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultApplicationId = \"62e1ad51b37b8e00394bda3b\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"eth-mainnet.gateway.pokt.network\";\n case \"goerli\":\n return \"eth-goerli.gateway.pokt.network\";\n case \"matic\":\n return \"poly-mainnet.gateway.pokt.network\";\n case \"matic-mumbai\":\n return \"polygon-mumbai-rpc.gateway.pokt.network\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **PocketProvider** connects to the [[link-pocket]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-pocket-signup).\n */\nexport class PocketProvider extends JsonRpcProvider {\n /**\n * The Application ID for the Pocket connection.\n */\n applicationId;\n /**\n * The Application Secret for making authenticated requests\n * to the Pocket connection.\n */\n applicationSecret;\n /**\n * Create a new **PocketProvider**.\n *\n * By default connecting to ``mainnet`` with a highly throttled\n * API key.\n */\n constructor(_network, applicationId, applicationSecret) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (applicationId == null) {\n applicationId = defaultApplicationId;\n }\n if (applicationSecret == null) {\n applicationSecret = null;\n }\n const options = { staticNetwork: network };\n const request = PocketProvider.getRequest(network, applicationId, applicationSecret);\n super(request, network, options);\n defineProperties(this, {\n applicationId,\n applicationSecret,\n });\n }\n _getProvider(networkId) {\n try {\n return new PocketProvider(networkId, this.applicationId, this.applicationSecret);\n }\n catch (error) { }\n return super._getProvider(networkId);\n }\n /**\n * Returns a prepared request for connecting to %%network%% with\n * %%applicationId%%.\n */\n static getRequest(network, applicationId, applicationSecret) {\n if (applicationId == null) {\n applicationId = defaultApplicationId;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/v1/lb/${applicationId}`);\n request.allowGzip = true;\n if (applicationSecret) {\n request.setCredentials(\"\", applicationSecret);\n }\n if (applicationId === defaultApplicationId) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"PocketProvider\");\n return true;\n };\n }\n return request;\n }\n isCommunityResource() {\n return this.applicationId === defaultApplicationId;\n }\n}\n//# sourceMappingURL=provider-pocket.js.map","const IpcSocketProvider = undefined;\nexport { IpcSocketProvider };\n//# sourceMappingURL=provider-ipcsocket-browser.js.map","import { getAddress } from \"../address/index.js\";\nimport { hashMessage, TypedDataEncoder } from \"../hash/index.js\";\nimport { AbstractSigner } from \"../providers/index.js\";\nimport { computeAddress, Transaction } from \"../transaction/index.js\";\nimport { defineProperties, resolveProperties, assert, assertArgument, } from \"../utils/index.js\";\nimport { sha256 } from \"../crypto/index.js\";\n/**\n * The **BaseWallet** is a stream-lined implementation of a\n * [[Signer]] that operates with a private key.\n *\n * It is preferred to use the [[Wallet]] class, as it offers\n * additional functionality and simplifies loading a variety\n * of JSON formats, Mnemonic Phrases, etc.\n *\n * This class may be of use for those attempting to implement\n * a minimal Signer.\n */\nexport class BaseWallet extends AbstractSigner {\n /**\n * The wallet address.\n */\n address;\n prefix;\n #signingKey;\n /**\n * Creates a new BaseWallet for %%privateKey%%, optionally\n * connected to %%provider%%.\n *\n * If %%provider%% is not specified, only offline methods can\n * be used.\n */\n constructor({ signingKey, prefix, provider, }) {\n super(provider);\n this.prefix = prefix;\n assertArgument(signingKey && typeof signingKey.sign === \"function\", \"invalid signingKey key\", \"signingKey\", \"[ REDACTED ]\");\n this.#signingKey = signingKey;\n const address = computeAddress(this.#signingKey, prefix);\n defineProperties(this, { address });\n }\n // Store private values behind getters to reduce visibility\n // in console.log\n /**\n * The [[SigningKey]] used for signing payloads.\n */\n get signingKey() {\n return this.#signingKey;\n }\n /**\n * The private key for this wallet.\n */\n get privateKey() {\n return this.signingKey.privateKey;\n }\n async getAddress() {\n return this.address;\n }\n connect(provider) {\n return new BaseWallet({\n signingKey: this.#signingKey,\n prefix: this.prefix,\n provider,\n });\n }\n async signTransaction(tx) {\n // Replace any Addressable or ENS name with an address\n const { to, from } = await resolveProperties({\n to: tx.to || undefined,\n from: tx.from || undefined,\n });\n if (to != null) {\n tx.to = to;\n }\n if (from != null) {\n tx.from = from;\n }\n if (tx.from != null) {\n assertArgument(getAddress(tx.from) === this.address, \"transaction from address mismatch\", \"tx.from\", tx.from);\n delete tx.from;\n }\n // Build the transaction\n const btx = Transaction.from(tx);\n const unSignedSerialized = btx.unsignedSerialized;\n const unsignedHash = sha256(unSignedSerialized);\n // sha256(btx.unsignedSerialized)\n btx.signature = this.signingKey.sign(unsignedHash);\n return btx.serialized;\n }\n async signMessage(message) {\n return this.signMessageSync(message);\n }\n // @TODO: Add a secialized signTx and signTyped sync that enforces\n // all parameters are known?\n /**\n * Returns the signature for %%message%% signed with this wallet.\n */\n signMessageSync(message) {\n return this.signingKey.sign(hashMessage(message));\n }\n async signTypedData(domain, types, value) {\n // Populate any ENS names\n const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (name) => {\n // @TODO: this should use resolveName; addresses don't\n // need a provider\n assert(this.provider != null, \"cannot resolve ENS names without a provider\", \"UNSUPPORTED_OPERATION\", {\n operation: \"resolveName\",\n info: { name },\n });\n const address = getAddress(name);\n assert(address != null, \"unconfigured ENS name\", \"UNCONFIGURED_NAME\", {\n value: name,\n });\n return address;\n });\n return this.signingKey.sign(TypedDataEncoder.hash(populated.domain, types, populated.value));\n }\n}\n//# sourceMappingURL=base-wallet.js.map","import { assertArgument } from \"../utils/index.js\";\nconst subsChrs = \" !#$%&'()*+,-./<=>?@[]^_`{|}~\";\nconst Word = /^[a-z]*$/i;\nfunction unfold(words, sep) {\n let initial = 97;\n return words.reduce((accum, word) => {\n if (word === sep) {\n initial++;\n }\n else if (word.match(Word)) {\n accum.push(String.fromCharCode(initial) + word);\n }\n else {\n initial = 97;\n accum.push(word);\n }\n return accum;\n }, []);\n}\n/**\n * @_ignore\n */\nexport function decode(data, subs) {\n // Replace all the substitutions with their expanded form\n for (let i = subsChrs.length - 1; i >= 0; i--) {\n data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2));\n }\n // Get all tle clumps; each suffix, first-increment and second-increment\n const clumps = [];\n const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => {\n if (semi) {\n for (let i = parseInt(semi); i >= 0; i--) {\n clumps.push(\";\");\n }\n }\n else {\n clumps.push(item.toLowerCase());\n }\n return \"\";\n });\n /* c8 ignore start */\n if (leftover) {\n throw new Error(`leftovers: ${JSON.stringify(leftover)}`);\n }\n /* c8 ignore stop */\n return unfold(unfold(clumps, \";\"), \":\");\n}\n/**\n * @_ignore\n */\nexport function decodeOwl(data) {\n assertArgument(data[0] === \"0\", \"unsupported auwl data\", \"data\", data);\n return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length));\n}\n//# sourceMappingURL=decode-owl.js.map","import { id } from \"../hash/id.js\";\nimport { defineProperties } from \"../utils/index.js\";\n/**\n * A Wordlist represents a collection of language-specific\n * words used to encode and devoce [[link-bip-39]] encoded data\n * by mapping words to 11-bit values and vice versa.\n */\nexport class Wordlist {\n locale;\n /**\n * Creates a new Wordlist instance.\n *\n * Sub-classes MUST call this if they provide their own constructor,\n * passing in the locale string of the language.\n *\n * Generally there is no need to create instances of a Wordlist,\n * since each language-specific Wordlist creates an instance and\n * there is no state kept internally, so they are safe to share.\n */\n constructor(locale) {\n defineProperties(this, { locale });\n }\n /**\n * Sub-classes may override this to provide a language-specific\n * method for spliting %%phrase%% into individual words.\n *\n * By default, %%phrase%% is split using any sequences of\n * white-space as defined by regular expressions (i.e. ``/\\s+/``).\n */\n split(phrase) {\n return phrase.toLowerCase().split(/\\s+/g);\n }\n /**\n * Sub-classes may override this to provider a language-specific\n * method for joining %%words%% into a phrase.\n *\n * By default, %%words%% are joined by a single space.\n */\n join(words) {\n return words.join(\" \");\n }\n static check(wordlist) {\n const words = [];\n for (let i = 0; i < 2048; i++) {\n const word = wordlist.getWord(i);\n /* istanbul ignore if */\n if (i !== wordlist.getWordIndex(word)) {\n return \"0x\";\n }\n words.push(word);\n }\n return id(words.join(\"\\n\") + \"\\n\");\n }\n}\n//# sourceMappingURL=wordlist.js.map","// Use the encode-latin.js script to create the necessary\n// data files to be consumed by this class\nimport { id } from \"../hash/index.js\";\nimport { assertArgument } from \"../utils/index.js\";\nimport { decodeOwl } from \"./decode-owl.js\";\nimport { Wordlist } from \"./wordlist.js\";\n/**\n * An OWL format Wordlist is an encoding method that exploits\n * the general locality of alphabetically sorted words to\n * achieve a simple but effective means of compression.\n *\n * This class is generally not useful to most developers as\n * it is used mainly internally to keep Wordlists for languages\n * based on ASCII-7 small.\n *\n * If necessary, there are tools within the ``generation/`` folder\n * to create these necessary data.\n */\nexport class WordlistOwl extends Wordlist {\n #data;\n #checksum;\n /**\n * Creates a new Wordlist for %%locale%% using the OWL %%data%%\n * and validated against the %%checksum%%.\n */\n constructor(locale, data, checksum) {\n super(locale);\n this.#data = data;\n this.#checksum = checksum;\n this.#words = null;\n }\n get _data() {\n return this.#data;\n }\n _decodeWords() {\n return decodeOwl(this.#data);\n }\n #words;\n #loadWords() {\n if (this.#words == null) {\n const words = this._decodeWords();\n // Verify the computed list matches the official list\n const checksum = id(words.join(\"\\n\") + \"\\n\", true);\n /* c8 ignore start */\n if (checksum !== this.#checksum) {\n throw new Error(`BIP39 Wordlist for ${this.locale} FffffAILED`);\n }\n /* c8 ignore stop */\n this.#words = words;\n }\n return this.#words;\n }\n getWord(index) {\n const words = this.#loadWords();\n assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, \"index\", index);\n return words[index];\n }\n getWordIndex(word) {\n return this.#loadWords().indexOf(word);\n }\n}\n//# sourceMappingURL=wordlist-owl.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nconst words = \"0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOnomy0GeItUca>1F%t0G1GhtTh 2BowD E@r-EgSe0B?kBodyBra)Er+Ot]PloyPow Pty0Ab!A@DD![D%'EmyErgyF%)Ga+G(eH<)JoyLi,OughR-hRollSu*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.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO\";\nconst checksum = \"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60\";\nlet wordlist = null;\n/**\n * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangEn extends WordlistOwl {\n /**\n * Creates a new instance of the English language Wordlist.\n *\n * This should be unnecessary most of the time as the exported\n * [[langEn]] should suffice.\n *\n * @_ignore:\n */\n constructor() {\n super(\"en\", words, checksum);\n }\n /**\n * Returns a singleton instance of a ``LangEn``, creating it\n * if this is the first time being called.\n */\n static wordlist() {\n if (wordlist == null) {\n wordlist = new LangEn();\n }\n return wordlist;\n }\n}\n//# sourceMappingURL=lang-en.js.map","import { pbkdf2Sync } from \"../crypto/crypto.js\";\nimport utf8 from \"utf8\";\nexport function mnemonicToSeed(mnemonic, password) {\n if (!password) {\n password = \"\";\n }\n const t = generateSeed(mnemonic, password);\n return t.goldilock;\n}\nconst generateSeed = (mnemonic, password) => {\n const goldilockSaltPrefix = \"mnemonic\";\n const aesSaltPrefix = \"mnemonicfortheAESkey\";\n const goldilockSalt = utf8.encode(goldilockSaltPrefix + password);\n const aesSalt = utf8.encode(aesSaltPrefix + password);\n const goldilockKey = pbkdf2Sync(Buffer.from(mnemonic), goldilockSalt, 2048, 64, \"sha512\");\n const aesKeySeed = pbkdf2Sync(Buffer.from(mnemonic), aesSalt, 2048, 64, \"sha512\");\n return {\n aes: aesKeySeed.toString(\"hex\"),\n goldilock: goldilockKey.toString(\"hex\"),\n };\n};\n//# sourceMappingURL=mnemonicToSeed.js.map","import { defineProperties, getBytes, hexlify, assertNormalize, assertPrivate, assertArgument, } from \"../utils/index.js\";\nimport { LangEn } from \"../wordlists/lang-en.js\";\nimport { legacySha256 } from \"../crypto/sha3.js\";\nimport { mnemonicToSeed } from \"./mnemonicToSeed.js\";\n// Returns a byte with the MSB bits set\nfunction getUpperMask(bits) {\n return (((1 << bits) - 1) << (8 - bits)) & 0xff;\n}\n// Returns a byte with the LSB bits set\nfunction getLowerMask(bits) {\n return ((1 << bits) - 1) & 0xff;\n}\nfunction mnemonicToEntropy(mnemonic, wordlist) {\n assertNormalize(\"NFKD\");\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n const words = wordlist.split(mnemonic);\n assertArgument(words.length % 3 === 0 && words.length >= 12 && words.length <= 24, \"invalid mnemonic length\", \"mnemonic\", \"[ REDACTED ]\");\n const entropy = new Uint8Array(Math.ceil((11 * words.length) / 8));\n let offset = 0;\n for (let i = 0; i < words.length; i++) {\n let index = wordlist.getWordIndex(words[i].normalize(\"NFKD\"));\n assertArgument(index >= 0, `invalid mnemonic word at index ${i}`, \"mnemonic\", \"[ REDACTED ]\");\n for (let bit = 0; bit < 11; bit++) {\n if (index & (1 << (10 - bit))) {\n entropy[offset >> 3] |= 1 << (7 - (offset % 8));\n }\n offset++;\n }\n }\n const entropyBits = (32 * words.length) / 3;\n const checksumBits = words.length / 3;\n const checksumMask = getUpperMask(checksumBits);\n const checksum = getBytes(legacySha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;\n assertArgument(checksum === (entropy[entropy.length - 1] & checksumMask), \"invalid mnemonic checksum\", \"mnemonic\", \"[ REDACTED ]\");\n return hexlify(entropy.slice(0, entropyBits / 8));\n}\nfunction entropyToMnemonic(entropy, wordlist) {\n assertArgument(entropy.length % 4 === 0 && entropy.length >= 16 && entropy.length <= 32, \"invalid entropy size\", \"entropy\", \"[ REDACTED ]\");\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n const indices = [0];\n let remainingBits = 11;\n for (let i = 0; i < entropy.length; i++) {\n // Consume the whole byte (with still more to go)\n if (remainingBits > 8) {\n indices[indices.length - 1] <<= 8;\n indices[indices.length - 1] |= entropy[i];\n remainingBits -= 8;\n // This byte will complete an 11-bit index\n }\n else {\n indices[indices.length - 1] <<= remainingBits;\n indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits);\n // Start the next word\n indices.push(entropy[i] & getLowerMask(8 - remainingBits));\n remainingBits += 3;\n }\n }\n // Compute the checksum bits\n const checksumBits = entropy.length / 4;\n const checksum = parseInt(legacySha256(entropy).substring(2, 4), 16) &\n getUpperMask(checksumBits);\n // Shift the checksum into the word indices\n indices[indices.length - 1] <<= checksumBits;\n indices[indices.length - 1] |= checksum >> (8 - checksumBits);\n return wordlist.join(indices.map((index) => wordlist.getWord(index)));\n}\nconst _guard = {};\n/**\n * A **Mnemonic** wraps all properties required to compute [[link-bip-39]]\n * seeds and convert between phrases and entropy.\n */\nexport class Mnemonic {\n /**\n * The mnemonic phrase of 12, 15, 18, 21 or 24 words.\n *\n * Use the [[wordlist]] ``split`` method to get the individual words.\n */\n phrase;\n /**\n * The password used for this mnemonic. If no password is used this\n * is the empty string (i.e. ``\"\"``) as per the specification.\n */\n password;\n /**\n * The wordlist for this mnemonic.\n */\n wordlist;\n /**\n * The underlying entropy which the mnemonic encodes.\n */\n entropy;\n /**\n * @private\n */\n constructor(guard, entropy, phrase, password, wordlist) {\n if (password == null) {\n password = \"\";\n }\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n assertPrivate(guard, _guard, \"Mnemonic\");\n defineProperties(this, { phrase, password, wordlist, entropy });\n }\n /**\n * Returns the seed for the mnemonic.\n */\n computeSeed() {\n return mnemonicToSeed(this.phrase, this.password);\n }\n /**\n * Creates a new Mnemonic for the %%phrase%%.\n *\n * The default %%password%% is the empty string and the default\n * wordlist is the [English wordlists](LangEn).\n */\n static fromPhrase({ phrase, password, wordlist, }) {\n // Normalize the case and space; throws if invalid\n const entropy = mnemonicToEntropy(phrase, wordlist);\n phrase = entropyToMnemonic(getBytes(entropy), wordlist);\n return new Mnemonic(_guard, entropy, phrase, password, wordlist);\n }\n /**\n * Create a new **Mnemonic** from the %%entropy%%.\n *\n * The default %%password%% is the empty string and the default\n * wordlist is the [English wordlists](LangEn).\n */\n static fromEntropy(_entropy, password, wordlist) {\n const entropy = getBytes(_entropy, \"entropy\");\n const phrase = entropyToMnemonic(entropy, wordlist);\n return new Mnemonic(_guard, hexlify(entropy), phrase, password, wordlist);\n }\n /**\n * Returns the phrase for %%mnemonic%%.\n */\n static entropyToPhrase(_entropy, wordlist) {\n const entropy = getBytes(_entropy, \"entropy\");\n return entropyToMnemonic(entropy, wordlist);\n }\n /**\n * Returns the entropy for %%phrase%%.\n */\n static phraseToEntropy(phrase, wordlist) {\n return mnemonicToEntropy(phrase, wordlist);\n }\n /**\n * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase.\n *\n * This checks all the provided words belong to the %%wordlist%%,\n * that the length is valid and the checksum is correct.\n */\n static isValidMnemonic(phrase, wordlist) {\n try {\n mnemonicToEntropy(phrase, wordlist);\n return true;\n }\n catch (error) { }\n return false;\n }\n}\n//# sourceMappingURL=mnemonic.js.map","/**\n * @_ignore\n */\nimport { getBytesCopy, assertArgument, toUtf8Bytes } from \"../utils/index.js\";\nexport function looseArrayify(hexString) {\n if (typeof hexString === \"string\" && !hexString.startsWith(\"0x\")) {\n hexString = \"0x\" + hexString;\n }\n return getBytesCopy(hexString);\n}\nexport function zpad(value, length) {\n value = String(value);\n while (value.length < length) {\n value = \"0\" + value;\n }\n return value;\n}\nexport function getPassword(password) {\n if (typeof password === \"string\") {\n return toUtf8Bytes(password, \"NFKC\");\n }\n return getBytesCopy(password);\n}\nexport function spelunk(object, _path) {\n const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);\n assertArgument(match != null, \"invalid path\", \"path\", _path);\n const path = match[1];\n const type = match[3];\n const reqd = match[4] === \"!\";\n let cur = object;\n for (const comp of path.toLowerCase().split(\".\")) {\n // Search for a child object with a case-insensitive matching key\n if (Array.isArray(cur)) {\n if (!comp.match(/^[0-9]+$/)) {\n break;\n }\n cur = cur[parseInt(comp)];\n }\n else if (typeof cur === \"object\") {\n let found = null;\n for (const key in cur) {\n if (key.toLowerCase() === comp) {\n found = cur[key];\n break;\n }\n }\n cur = found;\n }\n else {\n cur = null;\n }\n if (cur == null) {\n break;\n }\n }\n assertArgument(!reqd || cur != null, \"missing required value\", \"path\", path);\n if (type && cur != null) {\n if (type === \"int\") {\n if (typeof cur === \"string\" && cur.match(/^-?[0-9]+$/)) {\n return parseInt(cur);\n }\n else if (Number.isSafeInteger(cur)) {\n return cur;\n }\n }\n if (type === \"number\") {\n if (typeof cur === \"string\" && cur.match(/^-?[0-9.]*$/)) {\n return parseFloat(cur);\n }\n }\n if (type === \"data\") {\n if (typeof cur === \"string\") {\n return looseArrayify(cur);\n }\n }\n if (type === \"array\" && Array.isArray(cur)) {\n return cur;\n }\n if (type === typeof cur) {\n return cur;\n }\n assertArgument(false, `wrong type found for ${type} `, \"path\", path);\n }\n return cur;\n}\n/*\nexport function follow(object: any, path: string): null | string {\n let currentChild = object;\n\n for (const comp of path.toLowerCase().split('/')) {\n\n // Search for a child object with a case-insensitive matching key\n let matchingChild = null;\n for (const key in currentChild) {\n if (key.toLowerCase() === comp) {\n matchingChild = currentChild[key];\n break;\n }\n }\n\n if (matchingChild === null) { return null; }\n\n currentChild = matchingChild;\n }\n\n return currentChild;\n}\n\n// \"path/to/something:type!\"\nexport function followRequired(data: any, path: string): string {\n const value = follow(data, path);\n if (value != null) { return value; }\n return logger.throwArgumentError(\"invalid value\", `data:${ path }`,\n JSON.stringify(data));\n}\n*/\n// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4)\n/*\nexport function uuidV4(randomBytes: BytesLike): string {\n const bytes = getBytes(randomBytes, \"randomBytes\");\n\n // Section: 4.1.3:\n // - time_hi_and_version[12:16] = 0b0100\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n\n // Section 4.4\n // - clock_seq_hi_and_reserved[6] = 0b0\n // - clock_seq_hi_and_reserved[7] = 0b1\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n\n const value = hexlify(bytes);\n\n return [\n value.substring(2, 10),\n value.substring(10, 14),\n value.substring(14, 18),\n value.substring(18, 22),\n value.substring(22, 34),\n ].join(\"-\");\n}\n*/\n//# sourceMappingURL=utils.js.map","/**\n * The JSON Wallet formats allow a simple way to store the private\n * keys needed in Core along with related information and allows\n * for extensible forms of encryption.\n *\n * These utilities facilitate decrypting and encrypting the most common\n * JSON Wallet formats.\n *\n * @_subsection: api/wallet:JSON Wallets [json-wallets]\n */\n// @ts-ignore\nimport pkg from \"aes-js\";\nconst { CTR } = pkg;\nimport { getAddress } from \"../address/index.js\";\nimport { pbkdf2, randomBytes, scrypt, scryptSync, sha256, } from \"../crypto/index.js\";\nimport { concat, getBytes, hexlify, uuidV4, assert, assertArgument, } from \"../utils/index.js\";\nimport { getPassword, spelunk, zpad } from \"./utils.js\";\nimport { version } from \"../_version.js\";\nimport { computeAddress, extractPrefix } from \"../transaction/address.js\";\nconst defaultPath = \"m/44'/60'/0'/0/0\";\n/**\n * Returns true if %%json%% is a valid JSON Keystore Wallet.\n */\nexport function isKeystoreJson(json) {\n try {\n const data = JSON.parse(json);\n const version = data.version != null ? parseInt(data.version) : 0;\n if (version === 3) {\n return true;\n }\n }\n catch (error) { }\n return false;\n}\nfunction decrypt(data, key, ciphertext) {\n const cipher = spelunk(data, \"crypto.cipher:string\");\n if (cipher === \"aes-128-ctr\") {\n const iv = spelunk(data, \"crypto.cipherparams.iv:data!\");\n const aesCtr = new CTR(key, iv);\n return hexlify(aesCtr.decrypt(ciphertext));\n }\n assert(false, \"unsupported cipher\", \"UNSUPPORTED_OPERATION\", {\n operation: \"decrypt\",\n });\n}\nfunction getAccount(data, _key) {\n const key = getBytes(_key);\n const ciphertext = spelunk(data, \"crypto.ciphertext:data!\");\n const computedMAC = hexlify(sha256(concat([key.slice(16, 32), ciphertext]))).substring(2);\n assertArgument(computedMAC === spelunk(data, \"crypto.mac:string!\").toLowerCase(), \"incorrect password\", \"password\", \"[ REDACTED ]\");\n const privateKey = decrypt(data, key.slice(0, 16), ciphertext);\n const address = getAddress(data.address);\n const prefix = extractPrefix(address);\n if (computeAddress(privateKey, prefix) !== address) {\n throw new Error(\"address mismatch\");\n }\n if (data.address) {\n let check = data.address.toLowerCase();\n if (!check.startsWith(\"0x\")) {\n check = \"0x\" + check;\n }\n assertArgument(getAddress(check) === address, \"keystore address/privateKey mismatch\", \"address\", data.address);\n }\n const account = { address, privateKey };\n // Version 0.1 x-corebc metadata must contain an encrypted mnemonic phrase\n const version = spelunk(data, \"x-corebc.version:string\");\n if (version === \"0.1\") {\n const mnemonicKey = key.slice(32, 64);\n const mnemonicCiphertext = spelunk(data, \"x-corebc.mnemonicCiphertext:data!\");\n const mnemonicIv = spelunk(data, \"x-corebc.mnemonicCounter:data!\");\n const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv);\n account.mnemonic = {\n path: spelunk(data, \"x-corebc.path:string\") || defaultPath,\n locale: spelunk(data, \"x-corebc.locale:string\") || \"en\",\n entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext))),\n };\n }\n return account;\n}\nfunction getDecryptKdfParams(data) {\n const kdf = spelunk(data, \"crypto.kdf:string\");\n if (kdf && typeof kdf === \"string\") {\n if (kdf.toLowerCase() === \"scrypt\") {\n const salt = spelunk(data, \"crypto.kdfparams.salt:data!\");\n const N = spelunk(data, \"crypto.kdfparams.n:int!\");\n const r = spelunk(data, \"crypto.kdfparams.r:int!\");\n const p = spelunk(data, \"crypto.kdfparams.p:int!\");\n // Make sure N is a power of 2\n assertArgument(N > 0 && (N & (N - 1)) === 0, \"invalid kdf.N\", \"kdf.N\", N);\n assertArgument(r > 0 && p > 0, \"invalid kdf\", \"kdf\", kdf);\n const dkLen = spelunk(data, \"crypto.kdfparams.dklen:int!\");\n assertArgument(dkLen === 32, \"invalid kdf.dklen\", \"kdf.dflen\", dkLen);\n return { name: \"scrypt\", salt, N, r, p, dkLen: 64 };\n }\n else if (kdf.toLowerCase() === \"pbkdf2\") {\n const salt = spelunk(data, \"crypto.kdfparams.salt:data!\");\n const prf = spelunk(data, \"crypto.kdfparams.prf:string!\");\n const algorithm = prf.split(\"-\").pop();\n assertArgument(algorithm === \"sha256\" || algorithm === \"sha512\", \"invalid kdf.pdf\", \"kdf.pdf\", prf);\n const count = spelunk(data, \"crypto.kdfparams.c:int!\");\n const dkLen = spelunk(data, \"crypto.kdfparams.dklen:int!\");\n assertArgument(dkLen === 32, \"invalid kdf.dklen\", \"kdf.dklen\", dkLen);\n return { name: \"pbkdf2\", salt, count, dkLen, algorithm };\n }\n }\n assertArgument(false, \"unsupported key-derivation function\", \"kdf\", kdf);\n}\n/**\n * Returns the account details for the JSON Keystore Wallet %%json%%\n * using %%password%%.\n *\n * It is preferred to use the [async version](decryptKeystoreJson)\n * instead, which allows a [[ProgressCallback]] to keep the user informed\n * as to the decryption status.\n *\n * This method will block the event loop (freezing all UI) until decryption\n * is complete, which can take quite some time, depending on the wallet\n * paramters and platform.\n */\nexport function decryptKeystoreJsonSync(json, _password) {\n const data = JSON.parse(json);\n const password = getPassword(_password);\n const params = getDecryptKdfParams(data);\n if (params.name === \"pbkdf2\") {\n const { salt, count, dkLen, algorithm } = params;\n const key = pbkdf2(password, salt, count, dkLen, algorithm);\n return getAccount(data, key);\n }\n assert(params.name === \"scrypt\", \"cannot be reached\", \"UNKNOWN_ERROR\", {\n params,\n });\n const { salt, N, r, p, dkLen } = params;\n const key = scryptSync(password, salt, N, r, p, dkLen);\n return getAccount(data, key);\n}\nfunction stall(duration) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve();\n }, duration);\n });\n}\n/**\n * Resolves to the decrypted JSON Keystore Wallet %%json%% using the\n * %%password%%.\n *\n * If provided, %%progress%% will be called periodically during the\n * decrpytion to provide feedback, and if the function returns\n * ``false`` will halt decryption.\n *\n * The %%progressCallback%% will **always** receive ``0`` before\n * decryption begins and ``1`` when complete.\n */\nexport async function decryptKeystoreJson(json, _password, progress) {\n const data = JSON.parse(json);\n const password = getPassword(_password);\n const params = getDecryptKdfParams(data);\n if (params.name === \"pbkdf2\") {\n if (progress) {\n progress(0);\n await stall(0);\n }\n const { salt, count, dkLen, algorithm } = params;\n const key = pbkdf2(password, salt, count, dkLen, algorithm);\n if (progress) {\n progress(1);\n await stall(0);\n }\n return getAccount(data, key);\n }\n assert(params.name === \"scrypt\", \"cannot be reached\", \"UNKNOWN_ERROR\", {\n params,\n });\n const { salt, N, r, p, dkLen } = params;\n const key = await scrypt(password, salt, N, r, p, dkLen, progress);\n return getAccount(data, key);\n}\nfunction getEncryptKdfParams(options) {\n // Check/generate the salt\n const salt = options.salt != null\n ? getBytes(options.salt, \"options.salt\")\n : randomBytes(32);\n // Override the scrypt password-based key derivation function parameters\n let N = 1 << 17, r = 8, p = 1;\n if (options.scrypt) {\n if (options.scrypt.N) {\n N = options.scrypt.N;\n }\n if (options.scrypt.r) {\n r = options.scrypt.r;\n }\n if (options.scrypt.p) {\n p = options.scrypt.p;\n }\n }\n assertArgument(typeof N === \"number\" &&\n N > 0 &&\n Number.isSafeInteger(N) &&\n (BigInt(N) & BigInt(N - 1)) === BigInt(0), \"invalid scrypt N parameter\", \"options.N\", N);\n assertArgument(typeof r === \"number\" && r > 0 && Number.isSafeInteger(r), \"invalid scrypt r parameter\", \"options.r\", r);\n assertArgument(typeof p === \"number\" && p > 0 && Number.isSafeInteger(p), \"invalid scrypt p parameter\", \"options.p\", p);\n return { name: \"scrypt\", dkLen: 32, salt, N, r, p };\n}\nfunction _encryptKeystore(key, kdf, account, options) {\n const privateKey = getBytes(account.privateKey, \"privateKey\");\n // Override initialization vector\n const iv = options.iv != null ? getBytes(options.iv, \"options.iv\") : randomBytes(16);\n assertArgument(iv.length === 16, \"invalid options.iv length\", \"options.iv\", options.iv);\n // Override the uuid\n const uuidRandom = options.uuid != null\n ? getBytes(options.uuid, \"options.uuid\")\n : randomBytes(16);\n assertArgument(uuidRandom.length === 16, \"invalid options.uuid length\", \"options.uuid\", options.iv);\n // This will be used to encrypt the wallet (as per Web3 secret storage)\n // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix)\n // - 32 bytes AES key to encrypt mnemonic with (required here to be corebc Wallet)\n const derivedKey = key.slice(0, 16);\n const macPrefix = key.slice(16, 32);\n // Encrypt the private key\n const aesCtr = new CTR(derivedKey, iv);\n const ciphertext = getBytes(aesCtr.encrypt(privateKey));\n // Compute the message authentication code, used to check the password\n const mac = sha256(concat([macPrefix, ciphertext]));\n const data = {\n address: account.address.substring(2).toLowerCase(),\n id: uuidV4(uuidRandom),\n version: 3,\n Crypto: {\n cipher: \"aes-128-ctr\",\n cipherparams: {\n iv: hexlify(iv).substring(2),\n },\n ciphertext: hexlify(ciphertext).substring(2),\n kdf: \"scrypt\",\n kdfparams: {\n salt: hexlify(kdf.salt).substring(2),\n n: kdf.N,\n dklen: 32,\n p: kdf.p,\n r: kdf.r,\n },\n mac: mac.substring(2),\n },\n };\n // If we have a mnemonic, encrypt it into the JSON wallet\n if (account.mnemonic) {\n const client = options.client != null ? options.client : `corebc/${version}`;\n const path = account.mnemonic.path || defaultPath;\n const locale = account.mnemonic.locale || \"en\";\n const mnemonicKey = key.slice(32, 64);\n const entropy = getBytes(account.mnemonic.entropy, \"account.mnemonic.entropy\");\n const mnemonicIv = randomBytes(16);\n const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv);\n const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy));\n const now = new Date();\n const timestamp = now.getUTCFullYear() +\n \"-\" +\n zpad(now.getUTCMonth() + 1, 2) +\n \"-\" +\n zpad(now.getUTCDate(), 2) +\n \"T\" +\n zpad(now.getUTCHours(), 2) +\n \"-\" +\n zpad(now.getUTCMinutes(), 2) +\n \"-\" +\n zpad(now.getUTCSeconds(), 2) +\n \".0Z\";\n const gethFilename = \"UTC--\" + timestamp + \"--\" + data.address;\n data[\"x-corebc\"] = {\n client,\n gethFilename,\n path,\n locale,\n mnemonicCounter: hexlify(mnemonicIv).substring(2),\n mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2),\n version: \"0.1\",\n };\n }\n return JSON.stringify(data);\n}\n/**\n * Return the JSON Keystore Wallet for %%account%% encrypted with\n * %%password%%.\n *\n * The %%options%% can be used to tune the password-based key\n * derivation function parameters, explicitly set the random values\n * used. Any provided [[ProgressCallback]] is ignord.\n */\nexport function encryptKeystoreJsonSync(account, password, options) {\n if (options == null) {\n options = {};\n }\n const passwordBytes = getPassword(password);\n const kdf = getEncryptKdfParams(options);\n const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64);\n return _encryptKeystore(getBytes(key), kdf, account, options);\n}\n/**\n * Resolved to the JSON Keystore Wallet for %%account%% encrypted\n * with %%password%%.\n *\n * The %%options%% can be used to tune the password-based key\n * derivation function parameters, explicitly set the random values\n * used and provide a [[ProgressCallback]] to receive periodic updates\n * on the completion status..\n */\nexport async function encryptKeystoreJson(account, password, options) {\n if (options == null) {\n options = {};\n }\n const passwordBytes = getPassword(password);\n const kdf = getEncryptKdfParams(options);\n const key = await scrypt(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback);\n return _encryptKeystore(getBytes(key), kdf, account, options);\n}\n//# sourceMappingURL=json-keystore.js.map","/**\n * Explain HD Wallets..\n *\n * @_subsection: api/wallet:HD Wallets [hd-wallets]\n */\nimport { randomBytes, ripemd160, SigningKey, sha256 } from \"../crypto/index.js\";\nimport { dataSlice, defineProperties, getNumber, assertPrivate, assertArgument, } from \"../utils/index.js\";\nimport { LangEn } from \"../wordlists/lang-en.js\";\nimport { BaseWallet } from \"./base-wallet.js\";\nimport { Mnemonic } from \"./mnemonic.js\";\nimport { encryptKeystoreJson, encryptKeystoreJsonSync, } from \"./json-keystore.js\";\nimport { Ed448Goldilock } from \"../crypto/crypto.js\";\nimport { mnemonicToSeed } from \"./mnemonicToSeed.js\";\n// import { arrayify,\n// // hexDataSlice\n// } from \"../utils/data.js\";\n// function sha512Hash(password: BytesLike, salt: BytesLike): Uint8Array {\n// const p = getBytes(password);\n// const s = getBytes(salt);\n// return getBytes(pbkdf2(p, s, 2048, 57, \"sha512\"));\n// }\n/**\n * The default derivation path for Core HD Nodes. (i.e. ``\"m/44'/60'/0'/0/0\"``)\n */\nexport const defaultPath = \"m\";\n// \"Bitcoin seed\"\n// const MasterSecret = new Uint8Array([66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100]);\nconst HardenedBit = 0x80000000;\n// function addScalar(a: Uint8Array, b: Uint8Array): Uint8Array {\n// b = getBytes(concat([b.slice(0, 53), \"0x00000000\"]));\n// b[0] &= 0xfc;\n// const c = new Uint8Array(57);\n// let hold = 0;\n// for (let i = 0; i < 57; i++) {\n// hold += a[i] + b[i];\n// c[i] = hold % 256;\n// hold = Math.floor(hold / 256);\n// }\n// return c;\n// };\nconst _guard = {};\nfunction derivePath(node, path) {\n const components = path.split(\"/\");\n assertArgument(components.length > 0 && (components[0] === \"m\" || node.depth > 0), \"invalid path\", \"path\", path);\n if (components[0] === \"m\") {\n components.shift();\n }\n let result = node;\n for (let i = 0; i < components.length; i++) {\n const component = components[i];\n if (component.match(/^[0-9]+'$/)) {\n const index = parseInt(component.substring(0, component.length - 1));\n assertArgument(index < HardenedBit, \"invalid path index\", `path[${i}]`, component);\n result = result.deriveChild(HardenedBit + index);\n }\n else if (component.match(/^[0-9]+$/)) {\n const index = parseInt(component);\n assertArgument(index < HardenedBit, \"invalid path index\", `path[${i}]`, component);\n result = result.deriveChild(index);\n }\n else {\n assertArgument(false, \"invalid path component\", `path[${i}]`, component);\n }\n }\n return result;\n}\n/**\n * An **HDNodeWallet** is a [[Signer]] backed by the private key derived\n * from an HD Node using the [[link-bip-32]] stantard.\n *\n * An HD Node forms a hierarchal structure with each HD Node having a\n * private key and the ability to derive child HD Nodes, defined by\n * a path indicating the index of each child.\n */\nexport class HDNodeWallet extends BaseWallet {\n /**\n * The compressed public key.\n */\n publicKey;\n prefix;\n /**\n * The fingerprint.\n *\n * A fingerprint allows quick qay to detect parent and child nodes,\n * but developers should be prepared to deal with collisions as it\n * is only 4 bytes.\n */\n fingerprint;\n /**\n * The parent fingerprint.\n */\n parentFingerprint;\n /**\n * The mnemonic used to create this HD Node, if available.\n *\n * Sources such as extended keys do not encode the mnemonic, in\n * which case this will be ``null``.\n */\n mnemonic;\n #seed;\n /**\n * The derivation path of this wallet.\n *\n * Since extended keys do not provider full path details, this\n * may be ``null``, if instantiated from a source that does not\n * enocde it.\n */\n path;\n /**\n * The child index of this wallet. Values over ``2 *\\* 31`` indicate\n * the node is hardened.\n */\n index;\n /**\n * The depth of this wallet, which is the number of components\n * in its path.\n */\n depth;\n /**\n * @private\n */\n constructor({ guard, seed, signingKey, parentFingerprint, path, index, depth, mnemonic, provider, prefix, }) {\n super({\n signingKey,\n prefix,\n provider,\n });\n assertPrivate(guard, _guard, \"HDNodeWallet\");\n defineProperties(this, { publicKey: signingKey.publicKey });\n this.prefix = prefix;\n this.#seed = seed;\n const fingerprint = dataSlice(ripemd160(sha256(this.publicKey)), 0, 4);\n defineProperties(this, {\n parentFingerprint,\n fingerprint,\n path,\n index,\n depth,\n });\n defineProperties(this, { mnemonic });\n }\n connect(provider) {\n return new HDNodeWallet({\n guard: _guard,\n signingKey: this.signingKey,\n parentFingerprint: this.parentFingerprint,\n path: this.path,\n index: this.index,\n depth: this.depth,\n seed: this.#seed,\n mnemonic: this.mnemonic,\n provider,\n prefix: this.prefix,\n });\n }\n #account() {\n const account = {\n address: this.address,\n privateKey: this.privateKey,\n };\n const m = this.mnemonic;\n if (this.path && m && m.wordlist.locale === \"en\" && m.password === \"\") {\n account.mnemonic = {\n path: this.path,\n locale: \"en\",\n entropy: m.entropy,\n };\n }\n return account;\n }\n /**\n * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with\n * %%password%%.\n *\n * If %%progressCallback%% is specified, it will receive periodic\n * updates as the encryption process progreses.\n */\n async encrypt(password, progressCallback) {\n return await encryptKeystoreJson(this.#account(), password, {\n progressCallback,\n });\n }\n /**\n * Returns a [JSON Keystore Wallet](json-wallets) encryped with\n * %%password%%.\n *\n * It is preferred to use the [async version](encrypt) instead,\n * which allows a [[ProgressCallback]] to keep the user informed.\n *\n * This method will block the event loop (freezing all UI) until\n * it is complete, which may be a non-trivial duration.\n */\n encryptSync(password) {\n return encryptKeystoreJsonSync(this.#account(), password);\n }\n /**\n * Returns true if this wallet has a path, providing a Type Guard\n * that the path is non-null.\n */\n hasPath() {\n return this.path != null;\n }\n /**\n * Return the child for %%index%%.\n */\n deriveChild(_index) {\n const newPrivateKey = Ed448Goldilock.HDWalletGenerateKeyFromSeed(this.#seed, Number(_index));\n const newSigningKey = new SigningKey(newPrivateKey);\n // Base path\n let path = this.path;\n if (path) {\n path += \"/\" + (_index & ~HardenedBit);\n if (_index & HardenedBit) {\n path += \"'\";\n }\n }\n return new HDNodeWallet({\n guard: _guard,\n signingKey: newSigningKey,\n parentFingerprint: this.fingerprint,\n path,\n index: _index,\n seed: this.#seed,\n depth: this.depth + 1,\n mnemonic: this.mnemonic,\n provider: this.provider,\n prefix: this.prefix,\n });\n }\n /**\n * Return the HDNode for %%path%% from this node.\n */\n derivePath(path) {\n return derivePath(this, path);\n }\n static #fromSeed({ _seed, mnemonic, prefix, path, }) {\n const extendetPrivateKey = Ed448Goldilock.HDWalletGenerateKeyFromSeed(_seed, 0);\n const signingKey = new SigningKey(extendetPrivateKey);\n // console.log({ privateKey, thisKey: signingKey.privateKey,len:tmp.privateKey.length })\n return new HDNodeWallet({\n seed: _seed,\n guard: _guard,\n signingKey,\n parentFingerprint: \"0x00000000\",\n path: path || defaultPath,\n index: 0,\n depth: 0,\n mnemonic,\n provider: null,\n prefix,\n });\n }\n /**\n * Creates a new random HDNode.\n */\n static createRandom(prefix, password, path, wordlist) {\n if (password == null) {\n password = \"\";\n }\n if (path == null) {\n path = defaultPath;\n }\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n const mnemonic = Mnemonic.fromEntropy(randomBytes(32), password, wordlist);\n return HDNodeWallet.#fromSeed({\n _seed: mnemonic.computeSeed(),\n mnemonic,\n prefix,\n }).derivePath(path);\n }\n /**\n * Create am HD Node from %%mnemonic%%.\n */\n static fromMnemonic(mnemonic, prefix, path) {\n if (!path) {\n path = defaultPath;\n }\n return HDNodeWallet.#fromSeed({\n _seed: mnemonic.computeSeed(),\n mnemonic,\n prefix,\n }).derivePath(path);\n }\n static mnemonicToSeed(mnemonic, password) {\n const seed = mnemonicToSeed(mnemonic, password);\n return seed;\n }\n /**\n * Creates an HD Node from a mnemonic %%phrase%%.\n */\n static fromPhrase({ phrase, prefix, password, path, wordlist, }) {\n if (!password) {\n password = \"\";\n }\n if (!path) {\n path = defaultPath;\n }\n if (!wordlist) {\n wordlist = LangEn.wordlist();\n }\n const mnemonic = Mnemonic.fromPhrase({ phrase, password, wordlist });\n const _seed = mnemonic.computeSeed();\n return HDNodeWallet.#fromSeed({\n _seed,\n mnemonic,\n prefix,\n }).derivePath(path);\n }\n /**\n * Creates an HD Node from a %%seed%%.\n */\n static fromSeed({ seed, prefix, path, }) {\n return HDNodeWallet.#fromSeed({\n _seed: seed,\n mnemonic: null,\n path: path || defaultPath,\n prefix,\n });\n }\n}\n/*\nexport class HDNodeWalletManager {\n #root: HDNodeWallet;\n\n constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) {\n if (password == null) { password = \"\"; }\n if (path == null) { path = \"m/44'/60'/0'/0\"; }\n if (locale == null) { locale = LangEn.wordlist(); }\n this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale);\n }\n\n getSigner(index?: number): HDNodeWallet {\n return this.#root.deriveChild((index == null) ? 0: index);\n }\n}\n*/\n/**\n * Returns the [[link-bip-32]] path for the acount at %%index%%.\n *\n * This is the pattern used by wallets like Ledger.\n *\n * There is also an [alternate pattern](getIndexedAccountPath) used by\n * some software.\n */\nexport function getAccountPath(_index) {\n const index = getNumber(_index, \"index\");\n assertArgument(index >= 0 && index < HardenedBit, \"invalid account index\", \"index\", index);\n return `m/44'/60'/${index}'/0/0`;\n}\n/**\n * Returns the path using an alternative pattern for deriving accounts,\n * at %%index%%.\n *\n * This derivation path uses the //index// component rather than the\n * //account// component to derive sequential accounts.\n *\n * This is the pattern used by wallets like MetaMask.\n */\nexport function getIndexedAccountPath(_index) {\n const index = getNumber(_index, \"index\");\n assertArgument(index >= 0 && index < HardenedBit, \"invalid account index\", \"index\", index);\n return `m/44'/60'/0'/0/${index}`;\n}\n//# sourceMappingURL=hdwallet.js.map","/**\n * @_subsection: api/wallet:JSON Wallets [json-wallets]\n */\n// @ts-ignore\nimport pkg from \"aes-js\";\nconst { CBC, pkcs7Strip } = pkg;\nimport { getAddress } from \"../address/index.js\";\nimport { pbkdf2 } from \"../crypto/index.js\";\nimport { id } from \"../hash/index.js\";\nimport { getBytes, assertArgument } from \"../utils/index.js\";\nimport { getPassword, looseArrayify, spelunk } from \"./utils.js\";\n/**\n * Returns true if %%json%% is a valid JSON Crowdsale wallet.\n */\nexport function isCrowdsaleJson(json) {\n try {\n const data = JSON.parse(json);\n if (data.encseed) {\n return true;\n }\n }\n catch (error) { }\n return false;\n}\n/**\n * Before Core launched, it was necessary to create a wallet\n * format for backers to use, which would be used to receive xcb\n * as a reward for contributing to the project.\n *\n * The [[link-crowdsale]] format is now obsolete, but it is still\n * useful to support and the additional code is fairly trivial as\n * all the primitives required are used through core portions of\n * the library.\n */\nexport function decryptCrowdsaleJson(json, _password) {\n const data = JSON.parse(json);\n const password = getPassword(_password);\n // Core Address\n const address = getAddress(spelunk(data, \"ethaddr:string!\"));\n // Encrypted Seed\n const encseed = looseArrayify(spelunk(data, \"encseed:string!\"));\n assertArgument(encseed && encseed.length % 16 === 0, \"invalid encseed\", \"json\", json);\n const key = getBytes(pbkdf2(password, password, 2000, 32, \"sha256\")).slice(0, 16);\n const iv = encseed.slice(0, 16);\n const encryptedSeed = encseed.slice(16);\n // Decrypt the seed\n const aesCbc = new CBC(key, iv);\n const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed)));\n // This wallet format is weird... Convert the binary encoded hex to a string.\n let seedHex = \"\";\n for (let i = 0; i < seed.length; i++) {\n seedHex += String.fromCharCode(seed[i]);\n }\n return { address, privateKey: id(seedHex) };\n}\n//# sourceMappingURL=json-crowdsale.js.map","import { SigningKey } from \"../crypto/index.js\";\nimport { assertArgument } from \"../utils/index.js\";\nimport { BaseWallet } from \"./base-wallet.js\";\nimport { defaultPath, HDNodeWallet } from \"./hdwallet.js\";\nimport { decryptCrowdsaleJson, isCrowdsaleJson } from \"./json-crowdsale.js\";\nimport { decryptKeystoreJson, decryptKeystoreJsonSync, encryptKeystoreJson, encryptKeystoreJsonSync, isKeystoreJson, } from \"./json-keystore.js\";\nimport { Mnemonic } from \"./mnemonic.js\";\nimport { extractPrefix } from \"../transaction/address.js\";\nfunction stall(duration) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve();\n }, duration);\n });\n}\n/**\n * A **Wallet** manages a single private key which is used to sign\n * transactions, messages and other common payloads.\n *\n * This class is generally the main entry point for developers\n * that wish to use a private key directly, as it can create\n * instances from a large variety of common sources, including\n * raw private key, [[link-bip-39]] mnemonics and encrypte JSON\n * wallets.\n */\nexport class Wallet extends BaseWallet {\n /**\n * Create a new wallet for the %%privateKey%% or %%signingKey%%, optionally connected\n * to %%provider%%.\n */\n constructor({ key, prefix, provider, }) {\n if (typeof key === \"string\" && !key.startsWith(\"0x\")) {\n key = \"0x\" + key;\n }\n let signingKey = typeof key === \"string\" ? new SigningKey(key) : key;\n super({\n signingKey,\n prefix,\n provider,\n });\n }\n connect(provider) {\n return new Wallet({\n key: this.signingKey,\n prefix: this.prefix,\n provider,\n });\n }\n /**\n * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with\n * %%password%%.\n *\n * If %%progressCallback%% is specified, it will receive periodic\n * updates as the encryption process progreses.\n */\n async encrypt(password, progressCallback) {\n const account = { address: this.address, privateKey: this.privateKey };\n return await encryptKeystoreJson(account, password, { progressCallback });\n }\n /**\n * Returns a [JSON Keystore Wallet](json-wallets) encryped with\n * %%password%%.\n *\n * It is preferred to use the [async version](encrypt) instead,\n * which allows a [[ProgressCallback]] to keep the user informed.\n *\n * This method will block the event loop (freezing all UI) until\n * it is complete, which may be a non-trivial duration.\n */\n encryptSync(password) {\n const account = { address: this.address, privateKey: this.privateKey };\n return encryptKeystoreJsonSync(account, password);\n }\n static #fromAccount(account) {\n assertArgument(account, \"invalid JSON wallet\", \"json\", \"[ REDACTED ]\");\n const address = account.address;\n const prefix = extractPrefix(address);\n if (\"mnemonic\" in account &&\n account.mnemonic &&\n account.mnemonic.locale === \"en\") {\n const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy);\n const wallet = HDNodeWallet.fromMnemonic(mnemonic, prefix, account.mnemonic.path);\n if (wallet.address === account.address &&\n wallet.privateKey === account.privateKey) {\n return wallet;\n }\n console.log(\"WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key\");\n }\n const wallet = new Wallet({\n key: account.privateKey,\n prefix,\n });\n assertArgument(wallet.address === account.address, \"address/privateKey mismatch\", \"json\", \"[ REDACTED ]\");\n return wallet;\n }\n /**\n * Creates (asynchronously) a **Wallet** by decrypting the %%json%%\n * with %%password%%.\n *\n * If %%progress%% is provided, it is called periodically during\n * decryption so that any UI can be updated.\n */\n static async fromEncryptedJson(json, password, progress) {\n let account = null;\n if (isKeystoreJson(json)) {\n account = await decryptKeystoreJson(json, password, progress);\n }\n else if (isCrowdsaleJson(json)) {\n if (progress) {\n progress(0);\n await stall(0);\n }\n account = decryptCrowdsaleJson(json, password);\n if (progress) {\n progress(1);\n await stall(0);\n }\n }\n return Wallet.#fromAccount(account);\n }\n /**\n * Creates a **Wallet** by decrypting the %%json%% with %%password%%.\n *\n * The [[fromEncryptedJson]] method is preferred, as this method\n * will lock up and freeze the UI during decryption, which may take\n * some time.\n */\n static fromEncryptedJsonSync(json, password) {\n let account = null;\n if (isKeystoreJson(json)) {\n account = decryptKeystoreJsonSync(json, password);\n }\n else if (isCrowdsaleJson(json)) {\n account = decryptCrowdsaleJson(json, password);\n }\n else {\n assertArgument(false, \"invalid JSON wallet\", \"json\", \"[ REDACTED ]\");\n }\n return Wallet.#fromAccount(account);\n }\n /**\n * Creates a new random [[HDNodeWallet]] using the avavilable\n * [cryptographic random source](randomBytes).\n *\n * If there is no crytographic random source, this will throw.\n */\n static createRandom(prefix, provider) {\n const wallet = HDNodeWallet.createRandom(prefix, undefined, undefined, undefined);\n if (provider) {\n return wallet.connect(provider);\n }\n return wallet;\n }\n /**\n * Creates a [[HDNodeWallet]] for %%phrase%%.\n */\n static fromPhrase({ phrase, prefix, provider, password, }) {\n const wallet = HDNodeWallet.fromPhrase({\n phrase,\n prefix,\n password,\n });\n if (provider) {\n return wallet.connect(provider);\n }\n return wallet;\n }\n static fromSeed({ seed, prefix, provider, path, }) {\n const wallet = HDNodeWallet.fromSeed({\n seed,\n prefix,\n path: path || defaultPath,\n });\n if (provider) {\n return wallet.connect(provider);\n }\n return wallet;\n }\n}\n//# sourceMappingURL=wallet.js.map","const Base64 = \")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_\";\n/**\n * @_ignore\n */\nexport function decodeBits(width, data) {\n const maxValue = (1 << width) - 1;\n const result = [];\n let accum = 0, bits = 0, flood = 0;\n for (let i = 0; i < data.length; i++) {\n // Accumulate 6 bits of data\n accum = (accum << 6) | Base64.indexOf(data[i]);\n bits += 6;\n // While we have enough for a word...\n while (bits >= width) {\n // ...read the word\n const value = accum >> (bits - width);\n accum &= (1 << (bits - width)) - 1;\n bits -= width;\n // A value of 0 indicates we exceeded maxValue, it\n // floods over into the next value\n if (value === 0) {\n flood += maxValue;\n }\n else {\n result.push(value + flood);\n flood = 0;\n }\n }\n }\n return result;\n}\n//# sourceMappingURL=bit-reader.js.map","import { assertArgument } from \"../utils/index.js\";\nimport { decodeBits } from \"./bit-reader.js\";\nimport { decodeOwl } from \"./decode-owl.js\";\n/**\n * @_ignore\n */\nexport function decodeOwlA(data, accents) {\n let words = decodeOwl(data).join(\",\");\n // Inject the accents\n accents.split(/,/g).forEach((accent) => {\n const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);\n assertArgument(match !== null, \"internal error parsing accents\", \"accents\", accents);\n let posOffset = 0;\n const positions = decodeBits(parseInt(match[3]), match[4]);\n const charCode = parseInt(match[2]);\n const regex = new RegExp(`([${match[1]}])`, \"g\");\n words = words.replace(regex, (all, letter) => {\n const rem = --positions[posOffset];\n if (rem === 0) {\n letter = String.fromCharCode(letter.charCodeAt(0), charCode);\n posOffset++;\n }\n return letter;\n });\n });\n return words.split(\",\");\n}\n//# sourceMappingURL=decode-owla.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nimport { decodeOwlA } from \"./decode-owla.js\";\n/**\n * An OWL-A format Wordlist extends the OWL format to add an\n * overlay onto an OWL format Wordlist to support diacritic\n * marks.\n *\n * This class is generally not useful to most developers as\n * it is used mainly internally to keep Wordlists for languages\n * based on latin-1 small.\n *\n * If necessary, there are tools within the ``generation/`` folder\n * to create these necessary data.\n */\nexport class WordlistOwlA extends WordlistOwl {\n #accent;\n constructor(locale, data, accent, checksum) {\n super(locale, data, checksum);\n this.#accent = accent;\n }\n get _accent() {\n return this.#accent;\n }\n _decodeWords() {\n return decodeOwlA(this._data, this._accent);\n }\n}\n//# sourceMappingURL=wordlist-owla.js.map","import { LangEn } from \"./lang-en.js\";\nexport const wordlists = {\n en: LangEn.wordlist(),\n};\n//# sourceMappingURL=wordlists-browser.js.map"],"names":["logger","stringify","arrayifyInteger","unarrayifyInteger","_encode","_decodeChildren","_decode","decode","hash","assertHash","assertExists","assertBytes","assertNumber","pbkdf2","sha256","u64","sha512","BN_0","BN_1","locked","getTime","_a","_guard","getGlobal","randomBytes","Buffer","removeHexPrefix","rotl","ripemd160","noble_ripemd160","crypto_random","scrypt","_nobleAsync","_nobleSync","H","N","secp256k1.getSharedSecret","secp256k1.ProjectivePoint","BN_2","passProperties","getValue","BN_MAX_UINT256","RLP.decode","RLP.encode","_sha256","internal","PanicReasons","copy","stall","defaultApiKey","getHost","defaultPath"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG;;ACHvB,IAAI,sBAAsB,GAAG,KAAK,CAAC;AACnC,IAAI,aAAa,GAAG,K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IAAI,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;AAC7E,KAAK;AACL,IAAI,YAAY,GAAG;AACnB,QAAQ,OAAO,8BAA8B,CAAC,IAAI,CAAC,CAAC;AACpD,KAAK;AACL,IAAI,cAAc,CAAC,KAAK,EAAE;AAC1B,QAAQ,MAAM,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,+CAA+C,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC,CAAC;AAC5J,QAAQ,OAAO,gCAAgC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC7D,KAAK;AACL,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,mBAAmB,CAAC;AACjC;AACA;AACA;AACA;AACA,IAAI,QAAQ,CAAC;AACb;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC;AAChB;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC;AACd;AACA;AACA;AACA,IAAI,KAAK,CAAC;AACV;AACA;AACA;AACA,IAAI,IAAI,CAAC;AACT;AACA;AACA;AACA;AACA,IAAI,IAAI,CAAC;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,EAAE,CAAC;AACP;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,CAAC;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,KAAK,CAAC;AACV;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC;AAChB;AACA;AACA;AACA,IAAI,IAAI,CAAC;AACT;AACA;AACA;AACA;AACA,IAAI,KAAK,CAAC;AACV;AACA;AACA;AACA,IAAI,SAAS,CAAC;AACd;AACA;AACA;AACA,IAAI,SAAS,CAAC;AACd,IAAI,WAAW,CAAC;AAChB;AACA;A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;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,YAAY,SAAS,WAAW,CAAC;AAC9C,IAAI,OAAO,CAAC;AACZ,IAAI,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE;AAChD,QAAQ,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AACtC,QAAQ,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;AAC9B,KAAK;AACL,IAAI,IAAI,OAAO,GAAG;AAClB,QAAQ,OAAO,IAAI,CAAC,OAAO,CAAC;AAC5B,KAAK;AACL,IAAI,YAAY,GAAG;AACnB,QAAQ,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;AACpD,KAAK;AACL;;ACzBY,MAAC,SAAS,GAAG;AACzB,IAAI,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;AACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[7,8,9,10,11,12,13,14,15,33,37,40]} \ No newline at end of file diff --git a/dist/corebc.min.js b/dist/corebc.min.js deleted file mode 100644 index e7175dcd3..000000000 --- a/dist/corebc.min.js +++ /dev/null @@ -1 +0,0 @@ -const __$G=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};import{Buffer as Buffer$1}from"buffer";export{Buffer}from"buffer";import ed448 from"bcrypto/lib/ed448-browser.js";import _BN from"bn.js";import pbkdf2$2 from"bcrypto/lib/pbkdf2-browser.js";import SHA3_512 from"bcrypto/lib/sha3-512.js";import utf8 from"utf8";import pkg from"aes-js";const version="6.4.0";let _permanentCensorErrors=false;let _censorErrors=false;const LogLevels={debug:1,default:2,info:2,warning:3,error:4,off:5};let _logLevel=LogLevels["default"];let _globalLogger=null;function _checkNormalize(){try{const missing=[];["NFD","NFC","NFKD","NFKC"].forEach(form=>{try{if("test".normalize(form)!=="test"){throw new Error("bad normalize")}}catch(error){missing.push(form)}});if(missing.length){throw new Error("missing "+missing.join(", "))}if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769)){throw new Error("broken implementation")}}catch(error){return error.message}return null}const _normalizeError=_checkNormalize();var LogLevel;(function(LogLevel){LogLevel["DEBUG"]="DEBUG";LogLevel["INFO"]="INFO";LogLevel["WARNING"]="WARNING";LogLevel["ERROR"]="ERROR";LogLevel["OFF"]="OFF"})(LogLevel||(LogLevel={}));var ErrorCode;(function(ErrorCode){ErrorCode["UNKNOWN_ERROR"]="UNKNOWN_ERROR";ErrorCode["NOT_IMPLEMENTED"]="NOT_IMPLEMENTED";ErrorCode["UNSUPPORTED_OPERATION"]="UNSUPPORTED_OPERATION";ErrorCode["NETWORK_ERROR"]="NETWORK_ERROR";ErrorCode["SERVER_ERROR"]="SERVER_ERROR";ErrorCode["TIMEOUT"]="TIMEOUT";ErrorCode["BUFFER_OVERRUN"]="BUFFER_OVERRUN";ErrorCode["NUMERIC_FAULT"]="NUMERIC_FAULT";ErrorCode["MISSING_NEW"]="MISSING_NEW";ErrorCode["INVALID_ARGUMENT"]="INVALID_ARGUMENT";ErrorCode["MISSING_ARGUMENT"]="MISSING_ARGUMENT";ErrorCode["UNEXPECTED_ARGUMENT"]="UNEXPECTED_ARGUMENT";ErrorCode["CALL_EXCEPTION"]="CALL_EXCEPTION";ErrorCode["INSUFFICIENT_FUNDS"]="INSUFFICIENT_FUNDS";ErrorCode["NONCE_EXPIRED"]="NONCE_EXPIRED";ErrorCode["REPLACEMENT_UNDERPRICED"]="REPLACEMENT_UNDERPRICED";ErrorCode["UNPREDICTABLE_ENERGY_LIMIT"]="UNPREDICTABLE_ENERGY_LIMIT";ErrorCode["TRANSACTION_REPLACED"]="TRANSACTION_REPLACED"})(ErrorCode||(ErrorCode={}));const HEX="0123456789abcdef";class Logger{version="0.0.1";static errors=ErrorCode;static levels=LogLevel;constructor(version){Object.defineProperty(this,"version",{enumerable:true,value:version,writable:false})}_log(logLevel,args){const level=logLevel.toLowerCase();if(LogLevels[level]==null){this.throwArgumentError("invalid log level name","logLevel",logLevel)}if(_logLevel>LogLevels[level]){return}console.log.apply(console,args)}debug(...args){this._log(Logger.levels.DEBUG,args)}info(...args){this._log(Logger.levels.INFO,args)}warn(...args){this._log(Logger.levels.WARNING,args)}makeError(message,code,params){if(_censorErrors){return this.makeError("censored error",code,{})}if(!code){code=Logger.errors.UNKNOWN_ERROR}if(!params){params={}}const messageDetails=[];Object.keys(params).forEach(key=>{const value=params[key];try{if(value instanceof Uint8Array){let hex="";for(let i=0;i>4];hex+=HEX[value[i]&15]}messageDetails.push(key+"=Uint8Array(0x"+hex+")")}else{messageDetails.push(key+"="+JSON.stringify(value))}}catch(error){messageDetails.push(key+"="+JSON.stringify(params[key].toString()))}});messageDetails.push(`code=${code}`);messageDetails.push(`version=${this.version}`);const reason=message;if(messageDetails.length){message+=" ("+messageDetails.join(", ")+")"}const error=new Error(message);error.reason=reason;error.code=code;Object.keys(params).forEach(function(key){error[key]=params[key]});return error}throwError(message,code,params){throw this.makeError(message,code,params)}throwArgumentError(message,name,value){return this.throwError(message,Logger.errors.INVALID_ARGUMENT,{argument:name,value:value})}assert(condition,message,code,params){if(!!condition){return}this.throwError(message,code,params)}assertArgument(condition,message,name,value){if(!!condition){return}this.throwArgumentError(message,name,value)}checkNormalize(message){if(_normalizeError){this.throwError("platform missing String.prototype.normalize",Logger.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_normalizeError})}}checkSafeUint53(value,message){if(typeof value!=="number"){return}if(message==null){message="value not safe"}if(value<0||value>=9007199254740991){this.throwError(message,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:value})}if(value%1){this.throwError(message,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:value})}}checkArgumentCount(count,expectedCount,message){if(message){message=": "+message}else{message=""}if(countexpectedCount){this.throwError("too many arguments"+message,Logger.errors.UNEXPECTED_ARGUMENT,{count:count,expectedCount:expectedCount})}}checkNew(target,kind){if(target===Object||target==null){this.throwError("missing new",Logger.errors.MISSING_NEW,{name:kind.name})}}checkAbstract(target,kind){if(target===kind){this.throwError("cannot instantiate abstract class "+JSON.stringify(kind.name)+" directly; use a sub-class",Logger.errors.UNSUPPORTED_OPERATION,{name:target.name,operation:"new"})}else if(target===Object||target==null){this.throwError("missing new",Logger.errors.MISSING_NEW,{name:kind.name})}}static globalLogger(){if(!_globalLogger){_globalLogger=new Logger("logger/0.0.1")}return _globalLogger}static setCensorship(censorship,permanent){if(!censorship&&permanent){this.globalLogger().throwError("cannot permanently disable censorship",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}if(_permanentCensorErrors){if(!censorship){return}this.globalLogger().throwError("error censorship permanent",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_censorErrors=!!censorship;_permanentCensorErrors=!!permanent}static setLogLevel(logLevel){const level=LogLevels[logLevel.toLowerCase()];if(level==null){Logger.globalLogger().warn("invalid log level - "+logLevel);return}_logLevel=level}static from(version){return new Logger(version)}}const logger$7=new Logger("utils/properties/0.0.1");function checkType(value,type,name){const types=type.split("|").map(t=>t.trim());for(let i=0;iPromise.resolve(value[k])));return results.reduce((accum,v,index)=>{accum[keys[index]]=v;return accum},{})}function defineProperties(target,values,types){for(let key in values){let value=values[key];const type=types?types[key]:null;if(type){checkType(value,type,key)}Object.defineProperty(target,key,{enumerable:true,value:value,writable:false})}}function checkProperties(object,properties){if(!object||typeof object!=="object"){logger$7.throwArgumentError("invalid object","object",object)}Object.keys(object).forEach(key=>{if(!properties[key]){logger$7.throwArgumentError("invalid object key - "+key,"transaction:"+key,object)}})}function stringify$1(value){if(value==null){return"null"}if(Array.isArray(value)){return"[ "+value.map(stringify$1).join(", ")+" ]"}if(value instanceof Uint8Array){const HEX="0123456789abcdef";let result="0x";for(let i=0;i>4];result+=HEX[value[i]&15]}return result}if(typeof value==="object"&&typeof value.toJSON==="function"){return stringify$1(value.toJSON())}switch(typeof value){case"boolean":case"symbol":return value.toString();case"bigint":return BigInt(value).toString();case"number":return value.toString();case"string":return JSON.stringify(value);case"object":{const keys=Object.keys(value);keys.sort();return"{ "+keys.map(k=>`${stringify$1(k)}: ${stringify$1(value[k])}`).join(", ")+" }"}}return`[ COULD NOT SERIALIZE ]`}function isError(error,code){return error&&error.code===code}function isCallException(error){return isError(error,"CALL_EXCEPTION")}function makeError(message,code,info){{const details=[];if(info){if("message"in info||"code"in info||"name"in info){throw new Error(`value will overwrite populated values: ${stringify$1(info)}`)}for(const key in info){const value=info[key];details.push(key+"="+stringify$1(value))}}details.push(`code=${code}`);details.push(`version=${version}`);if(details.length){message+=" ("+details.join(", ")+")"}}let error;switch(code){case"INVALID_ARGUMENT":error=new TypeError(message);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":error=new RangeError(message);break;default:error=new Error(message)}defineProperties(error,{code:code});if(info){Object.assign(error,info)}return error}function assert(check,message,code,info){if(!check){throw makeError(message,code,info)}}function assertArgument(check,message,name,value){assert(check,message,"INVALID_ARGUMENT",{argument:name,value:value})}function assertArgumentCount(count,expectedCount,message){if(message==null){message=""}if(message){message=": "+message}assert(count>=expectedCount,"missing arguemnt"+message,"MISSING_ARGUMENT",{count:count,expectedCount:expectedCount});assert(count<=expectedCount,"too many arguemnts"+message,"UNEXPECTED_ARGUMENT",{count:count,expectedCount:expectedCount})}const _normalizeForms=["NFD","NFC","NFKD","NFKC"].reduce((accum,form)=>{try{if("test".normalize(form)!=="test"){throw new Error("bad")}if(form==="NFD"){const check=String.fromCharCode(233).normalize("NFD");const expected=String.fromCharCode(101,769);if(check!==expected){throw new Error("broken")}}accum.push(form)}catch(error){}return accum},[]);function assertNormalize(form){assert(_normalizeForms.indexOf(form)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:form}})}function assertPrivate(givenGuard,guard,className){if(className==null){className=""}if(givenGuard!==guard){let method=className,operation="new";if(className){method+=".";operation+=" "+className}assert(false,`private constructor; use ${method}from* methods`,"UNSUPPORTED_OPERATION",{operation:operation})}}const logger$6=new Logger("utils/data/0.0.1");function isHexable(value){return!!value.toHexString}function isInteger(value){return typeof value==="number"&&value==value&&value%1===0}function isBytes(value){if(value==null){return false}if(value.constructor===Uint8Array){return true}if(typeof value==="string"){return false}if(!isInteger(value.length)||value.length<0){return false}for(let i=0;i=256){return false}}return true}function _getBytes(value,name,copy){if(value instanceof Uint8Array){if(copy){return new Uint8Array(value)}return value}if(typeof value==="string"&&value.match(/^0x([0-9a-f][0-9a-f])*$/i)){const result=new Uint8Array((value.length-2)/2);let offset=2;for(let i=0;iNumber(item));value=new Uint8Array(v)}}if(typeof value==="number"){logger$6.checkSafeUint53(value,"invalid hexlify value");let hex="";while(value){hex=HexCharacters[value&15]+hex;value=Math.floor(value/16)}if(hex.length){if(hex.length%2){hex="0"+hex}return"0x"+hex}return"0x00"}if(typeof value==="bigint"){value=value.toString(16);if(value.length%2){return"0x0"+value}return"0x"+value}if(options.allowMissingPrefix&&typeof value==="string"&&value.substring(0,2)!=="0x"){value="0x"+value}if(isHexable(value)){return value.toHexString()}if(isHexString(value)){if(value.length%2){if(options.hexPad==="left"){value="0x0"+value.substring(2)}else if(options.hexPad==="right"){value+="0"}else{logger$6.throwArgumentError("hex data is odd-length","value",value)}}return value.toLowerCase()}if(isBytes(value)){let result="0x";for(let i=0;i>4]+HexCharacters[v&15]}return result}return logger$6.throwArgumentError("invalid hexlify value","value",value)}function concat(items){return"0x"+items.map(d=>hexlify(d).substring(2)).join("")}function hexDataSlice(data,offset,endOffset){if(typeof data!=="string"){data=hexlify(data)}else if(!isHexString(data)||data.length%2){logger$6.throwArgumentError("invalid hexData","value",data)}offset=2+2*offset;if(endOffset!=null){return"0x"+data.substring(offset,2+2*endOffset)}return"0x"+data.substring(offset)}function hexDataLength(data){if(typeof data!=="string"){data=hexlify(data)}else if(!isHexString(data)||data.length%2){return null}return(data.length-2)/2}function dataLength(data){if(isHexString(data,true)){return(data.length-2)/2}return getBytes(data).length}function dataSlice(data,start,end){const bytes=getBytes(data);if(end!=null&&end>bytes.length){assert(false,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:bytes,length:bytes.length,offset:end})}return hexlify(bytes.slice(start==null?0:start,end==null?bytes.length:end))}function stripZerosLeft(data){let bytes=hexlify(data).substring(2);while(bytes.startsWith("00")){bytes=bytes.substring(2)}return"0x"+bytes}function zeroPad(data,length,left){const bytes=getBytes(data);assert(length>=bytes.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(bytes),length:length,offset:length+1});const result=new Uint8Array(length);result.fill(0);if(left){result.set(bytes,length-bytes.length)}else{result.set(bytes,0)}return hexlify(result)}function zeroPadValue(data,length){return zeroPad(data,length,true)}function zeroPadBytes(data,length){return zeroPad(data,length,false)}function stripZeros(value){let result=arrayify(value);if(result.length===0){return result}let start=0;while(start{result+=hexlify(item).substring(2)});return result}var BN=_BN.BN;const logger$5=new Logger("bigNumber/0.0.1");const _constructorGuard={};const MAX_SAFE=9007199254740991;let _warnedToStringRadix=false;class BigNumber{_hex;_isBigNumber;constructor(constructorGuard,hex){logger$5.checkNew(new.target,BigNumber);if(constructorGuard!==_constructorGuard){logger$5.throwError("cannot call constructor directly; use BigNumber.from",Logger.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"})}this._hex=hex;this._isBigNumber=true;Object.freeze(this)}fromTwos(value){return toBigNumber(toBN(this).fromTwos(value))}toTwos(value){return toBigNumber(toBN(this).toTwos(value))}abs(){if(this._hex[0]==="-"){return BigNumber.from(this._hex.substring(1))}return this}add(other){return toBigNumber(toBN(this).add(toBN(other)))}sub(other){return toBigNumber(toBN(this).sub(toBN(other)))}div(other){const o=BigNumber.from(other);if(o.isZero()){throwFault("division by zero","div")}return toBigNumber(toBN(this).div(toBN(other)))}mul(other){return toBigNumber(toBN(this).mul(toBN(other)))}mod(other){const value=toBN(other);if(value.isNeg()){throwFault("cannot modulo negative values","mod")}return toBigNumber(toBN(this).umod(value))}pow(other){const value=toBN(other);if(value.isNeg()){throwFault("cannot raise to negative values","pow")}return toBigNumber(toBN(this).pow(value))}and(other){const value=toBN(other);if(this.isNegative()||value.isNeg()){throwFault("cannot 'and' negative values","and")}return toBigNumber(toBN(this).and(value))}or(other){const value=toBN(other);if(this.isNegative()||value.isNeg()){throwFault("cannot 'or' negative values","or")}return toBigNumber(toBN(this).or(value))}xor(other){const value=toBN(other);if(this.isNegative()||value.isNeg()){throwFault("cannot 'xor' negative values","xor")}return toBigNumber(toBN(this).xor(value))}mask(value){if(this.isNegative()||value<0){throwFault("cannot mask negative values","mask")}return toBigNumber(toBN(this).maskn(value))}shl(value){if(this.isNegative()||value<0){throwFault("cannot shift negative values","shl")}return toBigNumber(toBN(this).shln(value))}shr(value){if(this.isNegative()||value<0){throwFault("cannot shift negative values","shr")}return toBigNumber(toBN(this).shrn(value))}eq(other){return toBN(this).eq(toBN(other))}lt(other){return toBN(this).lt(toBN(other))}lte(other){return toBN(this).lte(toBN(other))}gt(other){return toBN(this).gt(toBN(other))}gte(other){return toBN(this).gte(toBN(other))}isNegative(){return this._hex[0]==="-"}isZero(){return toBN(this).isZero()}toNumber(){try{return toBN(this).toNumber()}catch(error){throwFault("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return logger$5.throwError("this platform does not support BigInt",Logger.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){if(arguments.length>0){if(arguments[0]===10){if(!_warnedToStringRadix){_warnedToStringRadix=true;logger$5.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")}}else if(arguments[0]===16){logger$5.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Logger.errors.UNEXPECTED_ARGUMENT,{})}else{logger$5.throwError("BigNumber.toString does not accept parameters",Logger.errors.UNEXPECTED_ARGUMENT,{})}}return toBN(this).toString(10)}toHexString(){return this._hex}toJSON(key){return{type:"BigNumber",hex:this.toHexString()}}static from(value){if(value instanceof BigNumber){return value}if(typeof value==="string"){if(value.match(/^-?0x[0-9a-f]+$/i)){return new BigNumber(_constructorGuard,toHex(value))}if(value.match(/^-?[0-9]+$/)){return new BigNumber(_constructorGuard,toHex(new BN(value)))}return logger$5.throwArgumentError("invalid BigNumber string","value",value)}if(typeof value==="number"){if(value%1){throwFault("underflow","BigNumber.from",value)}if(value>=MAX_SAFE||value<=-MAX_SAFE){throwFault("overflow","BigNumber.from",value)}return BigNumber.from(String(value))}const anyValue=value;if(typeof anyValue==="bigint"){return BigNumber.from(anyValue.toString())}if(isBytes(anyValue)){return BigNumber.from(hexlify(anyValue))}if(anyValue){if(anyValue.toHexString){const hex=anyValue.toHexString();if(typeof hex==="string"){return BigNumber.from(hex)}}else{let hex=anyValue._hex;if(hex==null&&anyValue.type==="BigNumber"){hex=anyValue.hex}if(typeof hex==="string"){if(isHexString(hex)||hex[0]==="-"&&isHexString(hex.substring(1))){return BigNumber.from(hex)}}}}return logger$5.throwArgumentError("invalid BigNumber value","value",value)}static isBigNumber(value){return!!(value&&value._isBigNumber)}}function toHex(value){if(typeof value!=="string"){return toHex(value.toString(16))}if(value[0]==="-"){value=value.substring(1);if(value[0]==="-"){logger$5.throwArgumentError("invalid hex","value",value)}value=toHex(value);if(value==="0x00"){return value}return"-"+value}if(value.substring(0,2)!=="0x"){value="0x"+value}if(value==="0x"){return"0x00"}if(value.length%2){value="0x0"+value.substring(2)}while(value.length>4&&value.substring(0,4)==="0x00"){value="0x"+value.substring(4)}return value}function toBigNumber(value){return BigNumber.from(toHex(value))}function toBN(value){const hex=BigNumber.from(value).toHexString();if(hex[0]==="-"){return new BN("-"+hex.substring(3),16)}return new BN(hex.substring(2),16)}function throwFault(fault,operation,value){const params={fault:fault,operation:operation};if(value!=null){params.value=value}return logger$5.throwError(fault,Logger.errors.NUMERIC_FAULT,params)}const logger$4=new Logger("rlp/0.0.1");function arrayifyInteger$1(value){const result=[];while(value){result.unshift(value&255);value>>=8}return result}function unarrayifyInteger$1(data,offset,length){let result=0;for(let i=0;ioffset+1+length){logger$4.throwError("child data too short",Logger.errors.BUFFER_OVERRUN,{})}}return{consumed:1+length,result:result}}function _decode$1(data,offset){if(data.length===0){logger$4.throwError("data too short",Logger.errors.BUFFER_OVERRUN,{})}if(data[offset]>=248){const lengthLength=data[offset]-247;if(offset+1+lengthLength>data.length){logger$4.throwError("data short segment too short",Logger.errors.BUFFER_OVERRUN,{})}const length=unarrayifyInteger$1(data,offset+1,lengthLength);if(offset+1+lengthLength+length>data.length){logger$4.throwError("data long segment too short",Logger.errors.BUFFER_OVERRUN,{})}return _decodeChildren$1(data,offset,offset+1+lengthLength,lengthLength+length)}else if(data[offset]>=192){const length=data[offset]-192;if(offset+1+length>data.length){logger$4.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{})}return _decodeChildren$1(data,offset,offset+1,length)}else if(data[offset]>=184){const lengthLength=data[offset]-183;if(offset+1+lengthLength>data.length){logger$4.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{})}const length=unarrayifyInteger$1(data,offset+1,lengthLength);if(offset+1+lengthLength+length>data.length){logger$4.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{})}const result=hexlify(data.slice(offset+1+lengthLength,offset+1+lengthLength+length));return{consumed:1+lengthLength+length,result:result}}else if(data[offset]>=128){const length=data[offset]-128;if(offset+1+length>data.length){logger$4.throwError("data too short",Logger.errors.BUFFER_OVERRUN,{})}const result=hexlify(data.slice(offset+1,offset+1+length));return{consumed:1+length,result:result}}return{consumed:1,result:hexlify(data[offset])}}function decode$1(data){const bytes=arrayify(data);const decoded=_decode$1(bytes,0);if(decoded.consumed!==bytes.length){logger$4.throwArgumentError("invalid rlp data","data",data)}return decoded.result}function number(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function bytes(b,...lengths){if(!(b instanceof Uint8Array))throw new Error("Expected Uint8Array");if(lengths.length>0&&!lengths.includes(b.length))throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`)}function hash(hash){if(typeof hash!=="function"||typeof hash.create!=="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number(hash.outputLen);number(hash.blockLen)}function exists(instance,checkFinished=true){if(instance.destroyed)throw new Error("Hash instance has been destroyed");if(checkFinished&&instance.finished)throw new Error("Hash#digest() has already been called")}function output(out,instance){bytes(out);const min=instance.outputLen;if(out.lengtha instanceof Uint8Array;const u32=arr=>new Uint32Array(arr.buffer,arr.byteOffset,Math.floor(arr.byteLength/4));const createView=arr=>new DataView(arr.buffer,arr.byteOffset,arr.byteLength);const rotr=(word,shift)=>word<<32-shift|word>>>shift;const isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");const nextTick=async()=>{};async function asyncLoop(iters,tick,cb){let ts=Date.now();for(let i=0;i=0&&diffhashCons().update(toBytes(msg)).digest();const tmp=hashCons();hashC.outputLen=tmp.outputLen;hashC.blockLen=tmp.blockLen;hashC.create=()=>hashCons();return hashC}class HMAC extends Hash{constructor(hash$1,_key){super();this.finished=false;this.destroyed=false;hash(hash$1);const key=toBytes(_key);this.iHash=hash$1.create();if(typeof this.iHash.update!=="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen;this.outputLen=this.iHash.outputLen;const blockLen=this.blockLen;const pad=new Uint8Array(blockLen);pad.set(key.length>blockLen?hash$1.create().update(key).digest():key);for(let i=0;inew HMAC(hash,key).update(message).digest();hmac.create=(hash,key)=>new HMAC(hash,key);function pbkdf2Init(hash$1,_password,_salt,_opts){hash(hash$1);const opts=checkOpts({dkLen:32,asyncTick:10},_opts);const{c,dkLen,asyncTick}=opts;number(c);number(dkLen);number(asyncTick);if(c<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const password=toBytes(_password);const salt=toBytes(_salt);const DK=new Uint8Array(dkLen);const PRF=hmac.create(hash$1,password);const PRFSalt=PRF._cloneInto().update(salt);return{c:c,dkLen:dkLen,asyncTick:asyncTick,DK:DK,PRF:PRF,PRFSalt:PRFSalt}}function pbkdf2Output(PRF,PRFSalt,DK,prfW,u){PRF.destroy();PRFSalt.destroy();if(prfW)prfW.destroy();u.fill(0);return DK}function pbkdf2$1(hash,password,salt,opts){const{c,dkLen,DK,PRF,PRFSalt}=pbkdf2Init(hash,password,salt,opts);let prfW;const arr=new Uint8Array(4);const view=createView(arr);const u=new Uint8Array(PRF.outputLen);for(let ti=1,pos=0;pos>_32n&_u32_max);const wl=Number(value&_u32_max);const h=isLE?4:0;const l=isLE?0:4;view.setUint32(byteOffset+h,wh,isLE);view.setUint32(byteOffset+l,wl,isLE)}class SHA2 extends Hash{constructor(blockLen,outputLen,padOffset,isLE){super();this.blockLen=blockLen;this.outputLen=outputLen;this.padOffset=padOffset;this.isLE=isLE;this.finished=false;this.length=0;this.pos=0;this.destroyed=false;this.buffer=new Uint8Array(blockLen);this.view=createView(this.buffer)}update(data){exists(this);const{view,buffer,blockLen}=this;data=toBytes(data);const len=data.length;for(let pos=0;posblockLen-pos){this.process(view,0);pos=0}for(let i=pos;istate.length)throw new Error("_sha2: outputLen bigger than state");for(let i=0;ia&b^~a&c;const Maj=(a,b,c)=>a&b^a&c^b&c;const SHA256_K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);const IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);const SHA256_W=new Uint32Array(64);class SHA256 extends SHA2{constructor(){super(64,32,8,false);this.A=IV[0]|0;this.B=IV[1]|0;this.C=IV[2]|0;this.D=IV[3]|0;this.E=IV[4]|0;this.F=IV[5]|0;this.G=IV[6]|0;this.H=IV[7]|0}get(){const{A,B,C,D,E,F,G,H}=this;return[A,B,C,D,E,F,G,H]}set(A,B,C,D,E,F,G,H){this.A=A|0;this.B=B|0;this.C=C|0;this.D=D|0;this.E=E|0;this.F=F|0;this.G=G|0;this.H=H|0}process(view,offset){for(let i=0;i<16;i++,offset+=4)SHA256_W[i]=view.getUint32(offset,false);for(let i=16;i<64;i++){const W15=SHA256_W[i-15];const W2=SHA256_W[i-2];const s0=rotr(W15,7)^rotr(W15,18)^W15>>>3;const s1=rotr(W2,17)^rotr(W2,19)^W2>>>10;SHA256_W[i]=s1+SHA256_W[i-7]+s0+SHA256_W[i-16]|0}let{A,B,C,D,E,F,G,H}=this;for(let i=0;i<64;i++){const sigma1=rotr(E,6)^rotr(E,11)^rotr(E,25);const T1=H+sigma1+Chi(E,F,G)+SHA256_K[i]+SHA256_W[i]|0;const sigma0=rotr(A,2)^rotr(A,13)^rotr(A,22);const T2=sigma0+Maj(A,B,C)|0;H=G;G=F;F=E;E=D+T1|0;D=C;C=B;B=A;A=T1+T2|0}A=A+this.A|0;B=B+this.B|0;C=C+this.C|0;D=D+this.D|0;E=E+this.E|0;F=F+this.F|0;G=G+this.G|0;H=H+this.H|0;this.set(A,B,C,D,E,F,G,H)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0);this.buffer.fill(0)}}const sha256$1=wrapConstructor(()=>new SHA256);const U32_MASK64=BigInt(2**32-1);const _32n=BigInt(32);function fromBig(n,le=false){if(le)return{h:Number(n&U32_MASK64),l:Number(n>>_32n&U32_MASK64)};return{h:Number(n>>_32n&U32_MASK64)|0,l:Number(n&U32_MASK64)|0}}function split(lst,le=false){let Ah=new Uint32Array(lst.length);let Al=new Uint32Array(lst.length);for(let i=0;iBigInt(h>>>0)<<_32n|BigInt(l>>>0);const shrSH=(h,_l,s)=>h>>>s;const shrSL=(h,l,s)=>h<<32-s|l>>>s;const rotrSH=(h,l,s)=>h>>>s|l<<32-s;const rotrSL=(h,l,s)=>h<<32-s|l>>>s;const rotrBH=(h,l,s)=>h<<64-s|l>>>s-32;const rotrBL=(h,l,s)=>h>>>s-32|l<<64-s;const rotr32H=(_h,l)=>l;const rotr32L=(h,_l)=>h;const rotlSH=(h,l,s)=>h<>>32-s;const rotlSL=(h,l,s)=>l<>>32-s;const rotlBH=(h,l,s)=>l<>>64-s;const rotlBL=(h,l,s)=>h<>>64-s;function add(Ah,Al,Bh,Bl){const l=(Al>>>0)+(Bl>>>0);return{h:Ah+Bh+(l/2**32|0)|0,l:l|0}}const add3L=(Al,Bl,Cl)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0);const add3H=(low,Ah,Bh,Ch)=>Ah+Bh+Ch+(low/2**32|0)|0;const add4L=(Al,Bl,Cl,Dl)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0)+(Dl>>>0);const add4H=(low,Ah,Bh,Ch,Dh)=>Ah+Bh+Ch+Dh+(low/2**32|0)|0;const add5L=(Al,Bl,Cl,Dl,El)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0)+(Dl>>>0)+(El>>>0);const add5H=(low,Ah,Bh,Ch,Dh,Eh)=>Ah+Bh+Ch+Dh+Eh+(low/2**32|0)|0;const u64={fromBig:fromBig,split:split,toBig:toBig,shrSH:shrSH,shrSL:shrSL,rotrSH:rotrSH,rotrSL:rotrSL,rotrBH:rotrBH,rotrBL:rotrBL,rotr32H:rotr32H,rotr32L:rotr32L,rotlSH:rotlSH,rotlSL:rotlSL,rotlBH:rotlBH,rotlBL:rotlBL,add:add,add3L:add3L,add3H:add3H,add4L:add4L,add4H:add4H,add5H:add5H,add5L:add5L};var u64$1=u64;const[SHA512_Kh,SHA512_Kl]=(()=>u64$1.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))))();const SHA512_W_H=new Uint32Array(80);const SHA512_W_L=new Uint32Array(80);class SHA512 extends SHA2{constructor(){super(128,64,16,false);this.Ah=1779033703|0;this.Al=4089235720|0;this.Bh=3144134277|0;this.Bl=2227873595|0;this.Ch=1013904242|0;this.Cl=4271175723|0;this.Dh=2773480762|0;this.Dl=1595750129|0;this.Eh=1359893119|0;this.El=2917565137|0;this.Fh=2600822924|0;this.Fl=725511199|0;this.Gh=528734635|0;this.Gl=4215389547|0;this.Hh=1541459225|0;this.Hl=327033209|0}get(){const{Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl}=this;return[Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl]}set(Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl){this.Ah=Ah|0;this.Al=Al|0;this.Bh=Bh|0;this.Bl=Bl|0;this.Ch=Ch|0;this.Cl=Cl|0;this.Dh=Dh|0;this.Dl=Dl|0;this.Eh=Eh|0;this.El=El|0;this.Fh=Fh|0;this.Fl=Fl|0;this.Gh=Gh|0;this.Gl=Gl|0;this.Hh=Hh|0;this.Hl=Hl|0}process(view,offset){for(let i=0;i<16;i++,offset+=4){SHA512_W_H[i]=view.getUint32(offset);SHA512_W_L[i]=view.getUint32(offset+=4)}for(let i=16;i<80;i++){const W15h=SHA512_W_H[i-15]|0;const W15l=SHA512_W_L[i-15]|0;const s0h=u64$1.rotrSH(W15h,W15l,1)^u64$1.rotrSH(W15h,W15l,8)^u64$1.shrSH(W15h,W15l,7);const s0l=u64$1.rotrSL(W15h,W15l,1)^u64$1.rotrSL(W15h,W15l,8)^u64$1.shrSL(W15h,W15l,7);const W2h=SHA512_W_H[i-2]|0;const W2l=SHA512_W_L[i-2]|0;const s1h=u64$1.rotrSH(W2h,W2l,19)^u64$1.rotrBH(W2h,W2l,61)^u64$1.shrSH(W2h,W2l,6);const s1l=u64$1.rotrSL(W2h,W2l,19)^u64$1.rotrBL(W2h,W2l,61)^u64$1.shrSL(W2h,W2l,6);const SUMl=u64$1.add4L(s0l,s1l,SHA512_W_L[i-7],SHA512_W_L[i-16]);const SUMh=u64$1.add4H(SUMl,s0h,s1h,SHA512_W_H[i-7],SHA512_W_H[i-16]);SHA512_W_H[i]=SUMh|0;SHA512_W_L[i]=SUMl|0}let{Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl}=this;for(let i=0;i<80;i++){const sigma1h=u64$1.rotrSH(Eh,El,14)^u64$1.rotrSH(Eh,El,18)^u64$1.rotrBH(Eh,El,41);const sigma1l=u64$1.rotrSL(Eh,El,14)^u64$1.rotrSL(Eh,El,18)^u64$1.rotrBL(Eh,El,41);const CHIh=Eh&Fh^~Eh&Gh;const CHIl=El&Fl^~El&Gl;const T1ll=u64$1.add5L(Hl,sigma1l,CHIl,SHA512_Kl[i],SHA512_W_L[i]);const T1h=u64$1.add5H(T1ll,Hh,sigma1h,CHIh,SHA512_Kh[i],SHA512_W_H[i]);const T1l=T1ll|0;const sigma0h=u64$1.rotrSH(Ah,Al,28)^u64$1.rotrBH(Ah,Al,34)^u64$1.rotrBH(Ah,Al,39);const sigma0l=u64$1.rotrSL(Ah,Al,28)^u64$1.rotrBL(Ah,Al,34)^u64$1.rotrBL(Ah,Al,39);const MAJh=Ah&Bh^Ah&Ch^Bh&Ch;const MAJl=Al&Bl^Al&Cl^Bl&Cl;Hh=Gh|0;Hl=Gl|0;Gh=Fh|0;Gl=Fl|0;Fh=Eh|0;Fl=El|0;({h:Eh,l:El}=u64$1.add(Dh|0,Dl|0,T1h|0,T1l|0));Dh=Ch|0;Dl=Cl|0;Ch=Bh|0;Cl=Bl|0;Bh=Ah|0;Bl=Al|0;const All=u64$1.add3L(T1l,sigma0l,MAJl);Ah=u64$1.add3H(All,T1h,sigma0h,MAJh);Al=All|0}({h:Ah,l:Al}=u64$1.add(this.Ah|0,this.Al|0,Ah|0,Al|0));({h:Bh,l:Bl}=u64$1.add(this.Bh|0,this.Bl|0,Bh|0,Bl|0));({h:Ch,l:Cl}=u64$1.add(this.Ch|0,this.Cl|0,Ch|0,Cl|0));({h:Dh,l:Dl}=u64$1.add(this.Dh|0,this.Dl|0,Dh|0,Dl|0));({h:Eh,l:El}=u64$1.add(this.Eh|0,this.El|0,Eh|0,El|0));({h:Fh,l:Fl}=u64$1.add(this.Fh|0,this.Fl|0,Fh|0,Fl|0));({h:Gh,l:Gl}=u64$1.add(this.Gh|0,this.Gl|0,Gh|0,Gl|0));({h:Hh,l:Hl}=u64$1.add(this.Hh|0,this.Hl|0,Hh|0,Hl|0));this.set(Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl)}roundClean(){SHA512_W_H.fill(0);SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0);this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha512$1=wrapConstructor(()=>new SHA512);const[SHA3_PI,SHA3_ROTL,_SHA3_IOTA]=[[],[],[]];const _0n=BigInt(0);const _1n=BigInt(1);const _2n=BigInt(2);const _7n=BigInt(7);const _256n=BigInt(256);const _0x71n=BigInt(113);for(let round=0,R=_1n,x=1,y=0;round<24;round++){[x,y]=[y,(2*x+3*y)%5];SHA3_PI.push(2*(5*y+x));SHA3_ROTL.push((round+1)*(round+2)/2%64);let t=_0n;for(let j=0;j<7;j++){R=(R<<_1n^(R>>_7n)*_0x71n)%_256n;if(R&_2n)t^=_1n<<(_1n<s>32?rotlBH(h,l,s):rotlSH(h,l,s);const rotlL=(h,l,s)=>s>32?rotlBL(h,l,s):rotlSL(h,l,s);function keccakP(s,rounds=24){const B=new Uint32Array(5*2);for(let round=24-rounds;round<24;round++){for(let x=0;x<10;x++)B[x]=s[x]^s[x+10]^s[x+20]^s[x+30]^s[x+40];for(let x=0;x<10;x+=2){const idx1=(x+8)%10;const idx0=(x+2)%10;const B0=B[idx0];const B1=B[idx0+1];const Th=rotlH(B0,B1,1)^B[idx1];const Tl=rotlL(B0,B1,1)^B[idx1+1];for(let y=0;y<50;y+=10){s[x+y]^=Th;s[x+y+1]^=Tl}}let curH=s[2];let curL=s[3];for(let t=0;t<24;t++){const shift=SHA3_ROTL[t];const Th=rotlH(curH,curL,shift);const Tl=rotlL(curH,curL,shift);const PI=SHA3_PI[t];curH=s[PI];curL=s[PI+1];s[PI]=Th;s[PI+1]=Tl}for(let y=0;y<50;y+=10){for(let x=0;x<10;x++)B[x]=s[y+x];for(let x=0;x<10;x++)s[y+x]^=~B[(x+2)%10]&B[(x+4)%10]}s[0]^=SHA3_IOTA_H[round];s[1]^=SHA3_IOTA_L[round]}B.fill(0)}class Keccak extends Hash{constructor(blockLen,suffix,outputLen,enableXOF=false,rounds=24){super();this.blockLen=blockLen;this.suffix=suffix;this.outputLen=outputLen;this.enableXOF=enableXOF;this.rounds=rounds;this.pos=0;this.posOut=0;this.finished=false;this.destroyed=false;number(outputLen);if(0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200);this.state32=u32(this.state)}keccak(){keccakP(this.state32,this.rounds);this.posOut=0;this.pos=0}update(data){exists(this);const{blockLen,state}=this;data=toBytes(data);const len=data.length;for(let pos=0;pos=blockLen)this.keccak();const take=Math.min(blockLen-this.posOut,len-pos);out.set(bufferOut.subarray(this.posOut,this.posOut+take),pos);this.posOut+=take;pos+=take}return out}xofInto(out){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(out)}xof(bytes){number(bytes);return this.xofInto(new Uint8Array(bytes))}digestInto(out){output(out,this);if(this.finished)throw new Error("digest() was already called");this.writeInto(out);this.destroy();return out}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=true;this.state.fill(0)}_cloneInto(to){const{blockLen,suffix,outputLen,rounds,enableXOF}=this;to||(to=new Keccak(blockLen,suffix,outputLen,enableXOF,rounds));to.state32.set(this.state32);to.pos=this.pos;to.posOut=this.posOut;to.finished=this.finished;to.rounds=rounds;to.suffix=suffix;to.outputLen=outputLen;to.enableXOF=enableXOF;to.destroyed=this.destroyed;return to}}const gen=(suffix,blockLen,outputLen)=>wrapConstructor(()=>new Keccak(blockLen,suffix,outputLen));const sha3_256=gen(6,136,256/8);const sha3_512=gen(6,72,512/8);const keccak_256=gen(1,136,256/8);const BN_0$9=BigInt(0);const BN_1$5=BigInt(1);const maxValue=9007199254740991;function fromTwos(_value,_width){const value=getUint(_value,"value");const width=BigInt(getNumber(_width,"width"));assert(value>>width===BN_0$9,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:_value});if(value>>width-BN_1$5){const mask=(BN_1$5<=-maxValue&&value<=maxValue,"overflow",name||"value",value);return BigInt(value);case"string":try{if(value===""){throw new Error("empty string")}if(value[0]==="-"&&value[1]!=="-"){return-BigInt(value.substring(1))}return BigInt(value)}catch(e){assertArgument(false,`invalid BigNumberish string: ${e.message}`,name||"value",value)}}assertArgument(false,"invalid BigNumberish value",name||"value",value)}function getUint(value,name){const result=getBigInt(value,name);assert(result>=BN_0$9,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:value});return result}const Nibbles="0123456789abcdef";function toBigInt(value){if(value instanceof Uint8Array){let result="0x0";for(const v of value){result+=Nibbles[v>>4];result+=Nibbles[v&15]}return BigInt(result)}return getBigInt(value)}function getNumber(value,name){switch(typeof value){case"bigint":assertArgument(value>=-maxValue&&value<=maxValue,"overflow",name||"value",value);return Number(value);case"number":assertArgument(Number.isInteger(value),"underflow",name||"value",value);assertArgument(value>=-maxValue&&value<=maxValue,"overflow",name||"value",value);return value;case"string":try{if(value===""){throw new Error("empty string")}return getNumber(BigInt(value),name)}catch(e){assertArgument(false,`invalid numeric string: ${e.message}`,name||"value",value)}}assertArgument(false,"invalid numeric value",name||"value",value)}function toNumber(value){return getNumber(toBigInt(value))}function toBeHex(_value,_width){const value=getUint(_value,"value");let result=value.toString(16);if(_width==null){if(result.length%2){result="0"+result}}else{const width=getNumber(_width,"width");assert(width*2>=result.length,`value exceeds width (${width} bits)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:_value});while(result.length>6!==2){break}i++}return i}if(reason==="OVERRUN"){return bytes.length-offset-1}return 0}function replaceFunc(reason,offset,bytes,output,badCodepoint){if(reason==="OVERLONG"){assertArgument(typeof badCodepoint==="number","invalid bad code point for replacement","badCodepoint",badCodepoint);output.push(badCodepoint);return 0}output.push(65533);return ignoreFunc(reason,offset,bytes)}const Utf8ErrorFuncs=Object.freeze({error:errorFunc,ignore:ignoreFunc,replace:replaceFunc});function getUtf8CodePoints(_bytes,onError){if(onError==null){onError=Utf8ErrorFuncs.error}const bytes=getBytes(_bytes,"bytes");const result=[];let i=0;while(i>7===0){result.push(c);continue}let extraLength=null;let overlongMask=null;if((c&224)===192){extraLength=1;overlongMask=127}else if((c&240)===224){extraLength=2;overlongMask=2047}else if((c&248)===240){extraLength=3;overlongMask=65535}else{if((c&192)===128){i+=onError("UNEXPECTED_CONTINUE",i-1,bytes,result)}else{i+=onError("BAD_PREFIX",i-1,bytes,result)}continue}if(i-1+extraLength>=bytes.length){i+=onError("OVERRUN",i-1,bytes,result);continue}let res=c&(1<<8-extraLength-1)-1;for(let j=0;j1114111){i+=onError("OUT_OF_RANGE",i-1-extraLength,bytes,result,res);continue}if(res>=55296&&res<=57343){i+=onError("UTF16_SURROGATE",i-1-extraLength,bytes,result,res);continue}if(res<=overlongMask){i+=onError("OVERLONG",i-1-extraLength,bytes,result,res);continue}result.push(res)}return result}function toUtf8Bytes(str,form){if(form!=null){assertNormalize(form);str=str.normalize(form)}let result=[];for(let i=0;i>6|192);result.push(c&63|128)}else if((c&64512)==55296){i++;const c2=str.charCodeAt(i);assertArgument(i>18|240);result.push(pair>>12&63|128);result.push(pair>>6&63|128);result.push(pair&63|128)}else{result.push(c>>12|224);result.push(c>>6&63|128);result.push(c&63|128)}}return new Uint8Array(result)}function _toUtf8String(codePoints){return codePoints.map(codePoint=>{if(codePoint<=65535){return String.fromCharCode(codePoint)}codePoint-=65536;return String.fromCharCode((codePoint>>10&1023)+55296,(codePoint&1023)+56320)}).join("")}function toUtf8String(bytes,onError){return _toUtf8String(getUtf8CodePoints(bytes,onError))}function toUtf8CodePoints(str,form){return getUtf8CodePoints(toUtf8Bytes(str,form))}async function getUrl(req,_signal){const protocol=req.url.split(":")[0].toLowerCase();assert(protocol==="http"||protocol==="https",`unsupported protocol ${protocol}`,"UNSUPPORTED_OPERATION",{info:{protocol:protocol},operation:"request"});assert(protocol==="https"||!req.credentials||req.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let signal=undefined;if(_signal){const controller=new AbortController;signal=controller.signal;_signal.addListener(()=>{controller.abort()})}const init={method:req.method,headers:new Headers(Array.from(req)),body:req.body||undefined,signal:signal};try{const resp=await fetch(req.url,init);const headers={};resp.headers.forEach((value,key)=>{headers[key.toLowerCase()]=value});const respBody=await resp.arrayBuffer();const body=respBody==null?null:new Uint8Array(respBody);return{statusCode:resp.status,statusMessage:resp.statusText,headers:headers,body:body}}catch(error){console.log({error:error});return undefined}}const MAX_ATTEMPTS=12;const SLOT_INTERVAL=250;let getUrlFunc=getUrl;const reData=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i");const reIpfs=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let locked$5=false;async function dataGatewayFunc(url,signal){try{const match=url.match(reData);if(!match){throw new Error("invalid data")}return new FetchResponse(200,"OK",{"content-type":match[1]||"text/plain"},match[2]?decodeBase64(match[3]):unpercent(match[3]))}catch(error){return new FetchResponse(599,"BAD REQUEST (invalid data: URI)",{},null,new FetchRequest(url))}}function getIpfsGatewayFunc(baseUrl){async function gatewayIpfs(url,signal){try{const match=url.match(reIpfs);if(!match){throw new Error("invalid link")}return new FetchRequest(`${baseUrl}${match[2]}`)}catch(error){return new FetchResponse(599,"BAD REQUEST (invalid IPFS URI)",{},null,new FetchRequest(url))}}return gatewayIpfs}const Gateways={data:dataGatewayFunc,ipfs:getIpfsGatewayFunc("https://gateway.ipfs.io/ipfs/")};const fetchSignals=new WeakMap;class FetchCancelSignal{#listeners;#cancelled;constructor(request){this.#listeners=[];this.#cancelled=false;fetchSignals.set(request,()=>{if(this.#cancelled){return}this.#cancelled=true;for(const listener of this.#listeners){setTimeout(()=>{listener()},0)}this.#listeners=[]})}addListener(listener){assert(!this.#cancelled,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"});this.#listeners.push(listener)}get cancelled(){return this.#cancelled}checkSignal(){assert(!this.cancelled,"cancelled","CANCELLED",{})}}function checkSignal(signal){if(signal==null){throw new Error("missing signal; should not happen")}signal.checkSignal();return signal}class FetchRequest{#allowInsecure;#gzip;#headers;#method;#timeout;#url;#body;#bodyType;#creds;#preflight;#process;#retry;#signal;#throttle;get url(){return this.#url}set url(url){this.#url=String(url)}get body(){if(this.#body==null){return null}return new Uint8Array(this.#body)}set body(body){if(body==null){this.#body=undefined;this.#bodyType=undefined}else if(typeof body==="string"){this.#body=toUtf8Bytes(body);this.#bodyType="text/plain"}else if(body instanceof Uint8Array){this.#body=body;this.#bodyType="application/octet-stream"}else if(typeof body==="object"){this.#body=toUtf8Bytes(JSON.stringify(body));this.#bodyType="application/json"}else{throw new Error("invalid body")}}hasBody(){return this.#body!=null}get method(){if(this.#method){return this.#method}if(this.hasBody()){return"POST"}return"GET"}set method(method){if(method==null){method=""}this.#method=String(method).toUpperCase()}get headers(){const headers=Object.assign({},this.#headers);if(this.#creds){headers["authorization"]=`Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`}if(this.allowGzip){headers["accept-encoding"]="gzip"}if(headers["content-type"]==null&&this.#bodyType){headers["content-type"]=this.#bodyType}if(this.body){headers["content-length"]=String(this.body.length)}return headers}getHeader(key){return this.headers[key.toLowerCase()]}setHeader(key,value){this.#headers[String(key).toLowerCase()]=String(value)}clearHeaders(){this.#headers={}}[Symbol.iterator](){const headers=this.headers;const keys=Object.keys(headers);let index=0;return{next:()=>{if(index=0,"timeout must be non-zero","timeout",timeout);this.#timeout=timeout}get preflightFunc(){return this.#preflight||null}set preflightFunc(preflight){this.#preflight=preflight}get processFunc(){return this.#process||null}set processFunc(process){this.#process=process}get retryFunc(){return this.#retry||null}set retryFunc(retry){this.#retry=retry}constructor(url){this.#url=String(url);this.#allowInsecure=false;this.#gzip=true;this.#headers={};this.#method="";this.#timeout=3e5;this.#throttle={slotInterval:SLOT_INTERVAL,maxAttempts:MAX_ATTEMPTS}}toString(){return``}setThrottleParams(params){if(params.slotInterval!=null){this.#throttle.slotInterval=params.slotInterval}if(params.maxAttempts!=null){this.#throttle.maxAttempts=params.maxAttempts}}async#send(attempt,expires,delay,_request,_response){if(attempt>=this.#throttle.maxAttempts){return _response.makeServerError("exceeded maximum retry limit")}assert(getTime$2()<=expires,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:_request});if(delay>0){await wait(delay)}let req=this.clone();const scheme=(req.url.split(":")[0]||"").toLowerCase();if(scheme in Gateways){const result=await Gateways[scheme](req.url,checkSignal(_request.#signal));if(result instanceof FetchResponse){let response=result;if(this.processFunc){checkSignal(_request.#signal);try{response=await this.processFunc(req,response)}catch(error){if(error.throttle==null||typeof error.stall!=="number"){response.makeServerError("error in post-processing function",error).assertOk()}}}return response}req=result}if(this.preflightFunc){req=await this.preflightFunc(req)}const resp=await getUrlFunc(req,checkSignal(_request.#signal));let response=new FetchResponse(resp.statusCode,resp.statusMessage,resp.headers,resp.body,_request);if(response.statusCode===301||response.statusCode===302){try{const location=response.headers.location||"";return req.redirect(location).#send(attempt+1,expires,0,_request,response)}catch(error){}return response}else if(response.statusCode===429){if(this.retryFunc==null||await this.retryFunc(req,response,attempt)){const retryAfter=response.headers["retry-after"];let delay=this.#throttle.slotInterval*Math.trunc(Math.random()*Math.pow(2,attempt));if(typeof retryAfter==="string"&&retryAfter.match(/^[1-9][0-9]*$/)){delay=parseInt(retryAfter)}return req.clone().#send(attempt+1,expires,delay,_request,response)}}if(this.processFunc){checkSignal(_request.#signal);try{response=await this.processFunc(req,response)}catch(error){if(error.throttle==null||typeof error.stall!=="number"){response.makeServerError("error in post-processing function",error).assertOk()}let delay=this.#throttle.slotInterval*Math.trunc(Math.random()*Math.pow(2,attempt));if(error.stall>=0){delay=error.stall}return req.clone().#send(attempt+1,expires,delay,_request,response)}}return response}send(){assert(this.#signal==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"});this.#signal=new FetchCancelSignal(this);return this.#send(0,getTime$2()+this.timeout,0,this,new FetchResponse(0,"",{},null,this))}cancel(){assert(this.#signal!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const signal=fetchSignals.get(this);if(!signal){throw new Error("missing signal; should not happen")}signal()}redirect(location){const current=this.url.split(":")[0].toLowerCase();const target=location.split(":")[0].toLowerCase();assert(this.method==="GET"&&(current!=="https"||target!=="http")&&location.match(/^https?:/),`unsupported redirect`,"UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})`});const req=new FetchRequest(location);req.method="GET";req.allowGzip=this.allowGzip;req.timeout=this.timeout;req.#headers=Object.assign({},this.#headers);if(this.#body){req.#body=new Uint8Array(this.#body)}req.#bodyType=this.#bodyType;return req}clone(){const clone=new FetchRequest(this.url);clone.#method=this.#method;if(this.#body){clone.#body=this.#body}clone.#bodyType=this.#bodyType;clone.#headers=Object.assign({},this.#headers);clone.#creds=this.#creds;if(this.allowGzip){clone.allowGzip=true}clone.timeout=this.timeout;if(this.allowInsecureAuthentication){clone.allowInsecureAuthentication=true}clone.#preflight=this.#preflight;clone.#process=this.#process;clone.#retry=this.#retry;return clone}static lockConfig(){locked$5=true}static getGateway(scheme){return Gateways[scheme.toLowerCase()]||null}static registerGateway(scheme,func){scheme=scheme.toLowerCase();if(scheme==="http"||scheme==="https"){throw new Error(`cannot intercept ${scheme}; use registerGetUrl`)}if(locked$5){throw new Error("gateways locked")}Gateways[scheme]=func}static registerGetUrl(getUrl){if(locked$5){throw new Error("gateways locked")}getUrlFunc=getUrl}static createDataGateway(){return dataGatewayFunc}static createIpfsGatewayFunc(baseUrl){return getIpfsGatewayFunc(baseUrl)}}class FetchResponse{#statusCode;#statusMessage;#headers;#body;#request;#error;toString(){return``}get statusCode(){return this.#statusCode}get statusMessage(){return this.#statusMessage}get headers(){return Object.assign({},this.#headers)}get body(){return this.#body==null?null:new Uint8Array(this.#body)}get bodyText(){try{return this.#body==null?"":toUtf8String(this.#body)}catch(error){assert(false,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch(error){assert(false,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const headers=this.headers;const keys=Object.keys(headers);let index=0;return{next:()=>{if(index{accum[k.toLowerCase()]=String(headers[k]);return accum},{});this.#body=body==null?null:new Uint8Array(body);this.#request=request||null;this.#error={message:""}}makeServerError(message,error){let statusMessage;if(!message){message=`${this.statusCode} ${this.statusMessage}`;statusMessage=`CLIENT ESCALATED SERVER ERROR (${message})`}else{statusMessage=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`}const response=new FetchResponse(599,statusMessage,this.headers,this.body,this.#request||undefined);response.#error={message:message,error:error};return response}throwThrottleError(message,stall){if(stall==null){stall=-1}else{assertArgument(Number.isInteger(stall)&&stall>=0,"invalid stall timeout","stall",stall)}const error=new Error(message||"throttling requests");defineProperties(error,{stall:stall,throttle:true});throw error}getHeader(key){return this.headers[key.toLowerCase()]}hasBody(){return this.#body!=null}get request(){return this.#request}ok(){return this.#error.message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok()){return}let{message,error}=this.#error;if(message===""){message=`server response ${this.statusCode} ${this.statusMessage}`}assert(false,message,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:error})}}function getTime$2(){return(new Date).getTime()}function unpercent(value){return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi,(all,code)=>{return String.fromCharCode(parseInt(code,16))}))}function wait(delay){return new Promise(resolve=>setTimeout(resolve,delay))}var _a$1;const BN_N1=BigInt(-1);const BN_0$7=BigInt(0);const BN_1$4=BigInt(1);const BN_5=BigInt(5);const _guard$5={};let Zeros="0000";while(Zeros.length<80){Zeros+=Zeros}function getTens(decimals){let result=Zeros;while(result.length=-limit&&valBN_0$7){val=fromTwos(mask(val,width),width)}else{val=-fromTwos(mask(-val,width),width)}}else{const limit=BN_1$4<=0&&val{if(v[key]==null){return defaultValue}assertArgument(typeof v[key]===type,"invalid fixed format ("+key+" not "+type+")","format."+key,v[key]);return v[key]};signed=check("signed","boolean",signed);width=check("width","number",width);decimals=check("decimals","number",decimals)}assertArgument(width%8===0,"invalid FixedNumber width (not byte aligned)","format.width",width);assertArgument(decimals<=80,"invalid FixedNumber decimals (too large)","format.decimals",decimals);const name=(signed?"":"u")+"fixed"+String(width)+"x"+String(decimals);return{signed:signed,width:width,decimals:decimals,name:name}}function toString(val,decimals){let negative="";if(val0){b*=getTens(delta)}else if(delta<0){a*=getTens(-delta)}if(ab){return-1}return 0}eq(other){return this.cmp(other)===0}lt(other){return this.cmp(other)<0}lte(other){return this.cmp(other)<=0}gt(other){return this.cmp(other)>0}gte(other){return this.cmp(other)>=0}floor(){let val=this.#val;if(this.#valBN_0$7){val+=this.#tens-BN_1$4}val=this.#val/this.#tens*this.#tens;return this.#checkValue(val,"ceiling")}round(decimals){if(decimals==null){decimals=0}if(decimals>=this.decimals){return this}const delta=this.decimals-decimals;const bump=BN_5*getTens(delta-1);let value=this.value+bump;const tens=getTens(delta);value=value/tens*tens;checkValue(value,this.#format,"round");return new _a$1(_guard$5,value,this.#format)}isZero(){return this.#val===BN_0$7}isNegative(){return this.#val0){const tens=getTens(delta);assert(value%tens===BN_0$7,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:_value});value/=tens}else if(delta<0){value*=getTens(-delta)}checkValue(value,format,"fromValue");return new _a$1(_guard$5,value,format)}static fromString(_value,_format){const match=_value.match(/^(-?)([0-9]*)\.?([0-9]*)$/);assertArgument(match&&match[2].length+match[3].length>0,"invalid FixedNumber string value","value",_value);const format=getFormat(_format);let whole=match[2]||"0",decimal=match[3]||"";while(decimal.length{assert(offset<=data.length,"data short segment too short","BUFFER_OVERRUN",{buffer:data,length:data.length,offset:offset})};if(data[offset]>=248){const lengthLength=data[offset]-247;checkOffset(offset+1+lengthLength);const length=unarrayifyInteger(data,offset+1,lengthLength);checkOffset(offset+1+lengthLength+length);return _decodeChildren(data,offset,offset+1+lengthLength,lengthLength+length)}else if(data[offset]>=192){const length=data[offset]-192;checkOffset(offset+1+length);return _decodeChildren(data,offset,offset+1,length)}else if(data[offset]>=184){const lengthLength=data[offset]-183;checkOffset(offset+1+lengthLength);const length=unarrayifyInteger(data,offset+1,lengthLength);checkOffset(offset+1+lengthLength+length);const result=hexlify(data.slice(offset+1+lengthLength,offset+1+lengthLength+length));return{consumed:1+lengthLength+length,result:result}}else if(data[offset]>=128){const length=data[offset]-128;checkOffset(offset+1+length);const result=hexlify(data.slice(offset+1,offset+1+length));return{consumed:1+length,result:result}}return{consumed:1,result:hexlifyByte(data[offset])}}function decodeRlp(_data){const data=getBytes(_data,"data");const decoded=_decode(data,0);assertArgument(decoded.consumed===data.length,"unexpected junk after rlp payload","data",_data);return decoded.result}function arrayifyInteger(value){const result=[];while(value){result.unshift(value&255);value>>=8}return result}function _encode(object){if(Array.isArray(object)){let payload=[];object.forEach(function(child){payload=payload.concat(_encode(child))});if(payload.length<=55){payload.unshift(192+payload.length);return payload}const length=arrayifyInteger(payload.length);length.unshift(247+length.length);return length.concat(payload)}const data=Array.prototype.slice.call(getBytes(object,"object"));if(data.length===1&&data[0]<=127){return data}else if(data.length<=55){data.unshift(128+data.length);return data}const length=arrayifyInteger(data.length);length.unshift(183+length.length);return length.concat(data)}const nibbles="0123456789abcdef";function encodeRlp(object){let result="0x";for(const v of _encode(object)){result+=nibbles[v>>4];result+=nibbles[v&15]}return result}const names=["ore","fecore","picore","nacore","mcore","micore","core"];function formatUnits(value,unit){let decimals=18;if(typeof unit==="string"){const index=names.indexOf(unit);assertArgument(index>=0,"invalid unit","unit",unit);decimals=3*index}else if(unit!=null){decimals=getNumber(unit,"unit")}return FixedNumber.fromValue(value,decimals,{decimals:decimals}).toString()}const scientificToDecimal=num=>{var nsign=Math.sign(num);num=Math.abs(num);if(/\d+\.?\d*e[\+\-]*\d+/i.test(num)){var zero="0",parts=String(num).toLowerCase().split("e"),e=parts.pop(),l=Math.abs(e),sign=e/l,coeff_array=parts[0].split(".");if(sign===-1){l=l-coeff_array[0].length;if(l<0){num=coeff_array[0].slice(0,l)+"."+coeff_array[0].slice(l)+(coeff_array.length===2?coeff_array[1]:"")}else{num=zero+"."+new Array(l+1).join(zero)+coeff_array.join("")}}else{var dec=coeff_array[1];if(dec)l=l-dec.length;if(l<0){num=coeff_array[0]+dec.slice(0,l)+"."+dec.slice(l)}else{num=coeff_array.join("")+new Array(l+1).join(zero)}}}return nsign<0?"-"+num:num};const trimDecimals=(n,decimals=18)=>{n+="";if(n.indexOf(".")===-1)return n;const arr=n.split(".");const fraction=arr[1].substr(0,decimals);return arr[0]+"."+fraction};function parseUnits(value,unit){assertArgument(typeof value==="string","value must be a string","value",value);if(value.includes("e")){value=scientificToDecimal(value).toString()}let decimals=18;if(typeof unit==="string"){const index=names.indexOf(unit);assertArgument(index>=0,"invalid unit","unit",unit);decimals=3*index;value=trimDecimals(value,decimals)}else if(unit!=null){decimals=getNumber(unit,"unit");value=trimDecimals(value,decimals)}return FixedNumber.fromString(value,{decimals:decimals}).value}function formatXCB(ore){return formatUnits(ore,18)}function parseXCB(xcb){return parseUnits(xcb,18)}function uuidV4(randomBytes){const bytes=getBytes(randomBytes,"randomBytes");bytes[6]=bytes[6]&15|64;bytes[8]=bytes[8]&63|128;const value=hexlify(bytes);return[value.substring(2,10),value.substring(10,14),value.substring(14,18),value.substring(18,22),value.substring(22,34)].join("-")}class Ed448Goldilock{static _channel=ed448;static generatePrivateKey(){var privateKey=ed448.privateKeyGenerate();privateKey[56]&=127;return privateKey}static getPublicKeyFromPrivateKey(privateKey){var secret=Buffer.from(privateKey,"hex");if(secret[56]>127){var scalar=secret.slice(0,56);scalar[0]&=252;scalar[55]|=128;var publicKey=this._channel.publicKeyFromScalar(scalar);return Buffer.from(publicKey).toString("hex")}else{var publicKey=this._channel.publicKeyCreate(secret);return Buffer.from(publicKey).toString("hex")}}static signWithPrivateKey(privateKey,msg){var msgToSign=Buffer.from(msg,"hex");var secret=Buffer.from(privateKey,"hex");if(secret[56]>127){var prefix=secret.slice(0,57);prefix[0]&=252;prefix[56]=0;prefix[55]|=128;var scalar=prefix.slice(0,56);var signedMessage=this._channel.signWithScalar(msgToSign,scalar,prefix);return Buffer.from(signedMessage).toString("hex")}else{var signedMessage=this._channel.sign(msgToSign,secret);return Buffer.from(signedMessage).toString("hex")}}static signWithPrivateKeyNConcatPubkey(privateKey,msg){var signedMessage=Ed448Goldilock.signWithPrivateKey(privateKey,msg);var publicKey=Ed448Goldilock.getPublicKeyFromPrivateKey(privateKey);return signedMessage+publicKey}static verifySignature(msgHash,signedMsg,pubKey){return this._channel.verify(msgHash,signedMsg,pubKey)}static SHA512Hash(password,salt){var p1=Buffer.from(password,"hex");var s1=Buffer.from(salt,"hex");return Buffer.from(pbkdf2$2.derive(SHA3_512,p1,s1,2048,57)).toString("hex")}static concatenateAndHex(prefix,key,index,salt){var ind=Buffer.alloc(4);var p=Buffer.alloc(1);p[0]=prefix%256;var j=index;for(let i=0;i<4;i++){ind[i]=j%256;j=Math.floor(j/256)}var t=p.toString("hex")+key+ind.toString("hex");return Ed448Goldilock.SHA512Hash(t,salt)}static addScalar(a,b){var a1=Buffer.from(a,"hex");var b1=Buffer.from(b.substr(0,106)+"00000000","hex");b1[0]&=252;var c=Buffer.alloc(57);var hold=0;for(let i=0;i<57;i++){hold+=a1[i]+b1[i];c[i]=hold%256;hold=Math.floor(hold/256)}return c.toString("hex")}static seedToExtendedPrivate(seed){var s1=Ed448Goldilock.SHA512Hash(seed,"6d6e656d6f6e6963666f72746865636861696e");var s2=Ed448Goldilock.SHA512Hash(seed,"6d6e656d6f6e6963666f727468656b6579");var b=Buffer.from(s2,"hex");b[56]|=128;b[55]|=128;b[55]&=191;var s3=b.toString("hex");return s1+s3}static childPrivateToPrivate(s,index){var s0=s.substr(0,114);var s1=s.substr(114,228);var r0,r1;if(index>=2147483648){r0=Ed448Goldilock.concatenateAndHex(1,s1,index,s0);r1=Ed448Goldilock.concatenateAndHex(0,s1,index,s0);return r0+Ed448Goldilock.addScalar(s1,r1)}else{var pub=Ed448Goldilock.getPublicKeyFromPrivateKey(s1);r0=Ed448Goldilock.concatenateAndHex(3,pub,index,s0);r1=Ed448Goldilock.concatenateAndHex(2,pub,index,s0);return r0+Ed448Goldilock.addScalar(s1,r1)}}static HDWalletGenerateKeyFromSeed(seed,index){var m=Ed448Goldilock.seedToExtendedPrivate(seed);var k1=Ed448Goldilock.childPrivateToPrivate(m,2147483648+44);var k2=Ed448Goldilock.childPrivateToPrivate(k1,2147483648+654);var k3=Ed448Goldilock.childPrivateToPrivate(k2,2147483648+0);var k4=Ed448Goldilock.childPrivateToPrivate(k3,2147483648+0);var k5=Ed448Goldilock.childPrivateToPrivate(k4,index);return k5.substr(114,228)}}function getGlobal$1(){if(typeof self!=="undefined"){return self}if(typeof window!=="undefined"){return window}if(typeof global!=="undefined"){return global}throw new Error("unable to locate global object")}const anyGlobal=getGlobal$1();const crypto=anyGlobal.crypto||anyGlobal.msCrypto;function createHash(algo){switch(algo){case"sha256":return sha256$1.create();case"sha512":return sha512$1.create();case"sha3-256":return sha3_256.create();case"sha3-512":return sha3_512.create()}assertArgument(false,"invalid hashing algorithm name","algorithm",algo)}function createHmac(_algo,key){const algo={sha256:sha256$1,sha512:sha512$1}[_algo];assertArgument(algo!=null,"invalid hmac algorithm","algorithm",_algo);return hmac.create(algo,key)}function pbkdf2Sync(password,salt,iterations,keylen,_algo){const algo={sha256:sha256$1,sha512:sha512$1}[_algo];assertArgument(algo!=null,"invalid pbkdf2 algorithm","algorithm",_algo);return pbkdf2$1(algo,password,salt,{c:iterations,dkLen:keylen})}function randomBytes$1(length){assert(crypto!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"});assertArgument(Number.isInteger(length)&&length>0&&length<=1024,"invalid length","length",length);const result=new Uint8Array(length);crypto.getRandomValues(result);return result}const _sha256=function(data){let v="0x"+createHash("sha3-256").update(Buffer$1.from(arrayify(data))).digest("hex");return v};const _sha512=function(data){let v="0x"+createHash("sha3-512").update(Buffer$1.from(arrayify(data))).digest("hex");return v};let locked256=false,locked512=false;var SupportedAlgorithm;(function(SupportedAlgorithm){SupportedAlgorithm["sha256"]="sha256";SupportedAlgorithm["sha512"]="sha512"})(SupportedAlgorithm||(SupportedAlgorithm={}));function sha256(data){let createdHash=createHash("sha3-256").update(Buffer$1.from(arrayify(data))).digest("hex");const v="0x"+createdHash;if(typeof createdHash!=="string"){createdHash=hexlify(createdHash);return createdHash}return v}function legacySha256(data){const _data=getBytes(data,"data");const hexlified=hexlify(createHash("sha256").update(_data).digest());return hexlified}sha256._=_sha256;sha256.lock=function(){locked256=true};sha256.register=function(func){if(locked256){throw new Error("sha256 is locked")}};Object.freeze(sha256);function sha512(data){let createdHash=createHash("sha3-512").update(Buffer$1.from(arrayify(data))).digest("hex");const v="0x"+createdHash;if(typeof createdHash!=="string"){createdHash=hexlify(createdHash);return createdHash}return v}sha512._=_sha512;sha512.lock=function(){locked512=true};sha512.register=function(func){if(locked512){throw new Error("sha512 is locked")}};Object.freeze(sha256);const logger$3=new Logger("address/0.0.1");const precompiledAddresses=["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000004","0000000000000000000000000000000000000000000000000000000000000005","0000000000000000000000000000000000000000000000000000000000000006","0000000000000000000000000000000000000000000000000000000000000007","0000000000000000000000000000000000000000000000000000000000000008","0000000000000000000000000000000000000000000000000000000000000009"];function removeHexPrefix$1(val){return val.substring(0,2)==="0x"?val.substring(2):val}function calculateCheckSum(_address,_prefix){const address=getBytes("0x"+_address.replace("0x",""));const prefix=getBytes("0x"+_prefix.replace("0x",""));const tmpConcated=new Uint8Array([...address,...prefix]);const hexedConcat=hexlify(tmpConcated).replace("0x","")+"00";const mods=Array.from(hexedConcat.toUpperCase(),c=>{const charCode=c.charCodeAt(0);return charCode>64&&charCode<91?(charCode-55).toString():(charCode-48).toString()}).join("");const bigVal=BigInt(mods);const val97=BigInt(97);const val98=BigInt(98);const remainder=bigVal%val97;const checkSum=val98-remainder;const result=checkSum>9?checkSum.toString():"0"+checkSum.toString();return result}function getAddress(address){if(typeof address!=="string"){logger$3.throwArgumentError("invalid address","address",address)}if(!address.match(/^(0x)?[0-9a-fA-F]{44}$/)){logger$3.throwArgumentError("invalid address","address",address)}const raw=removeHexPrefix$1(address);if(precompiledAddresses.includes(raw)){return"0x"+raw}const prefix=raw.substring(0,2);const val=raw.substring(4);const checksum=calculateCheckSum(val,prefix);if(checksum!==raw.substring(2,4)){logger$3.throwArgumentError("bad address checksum","address",address)}return"0x"+prefix+checksum+val}function networkIdToPrefix(networkId){if(networkId==1){return"cb"}else if(networkId==3||networkId==4){return"ab"}else if(networkId>10||networkId==0){return"ce"}else{logger$3.throwArgumentError("bad networkId","networkId",networkId);return""}}let locked$4=false;const _computeHmac=function(algorithm,key,data){return createHmac(algorithm,key).update(data).digest()};let __computeHmac=_computeHmac;function computeHmac(algorithm,_key,_data){const key=getBytes(_key,"key");const data=getBytes(_data,"data");return hexlify(__computeHmac(algorithm,key,data))}computeHmac._=_computeHmac;computeHmac.lock=function(){locked$4=true};computeHmac.register=function(func){if(locked$4){throw new Error("computeHmac is locked")}__computeHmac=func};Object.freeze(computeHmac);const Rho=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]);const Id=Uint8Array.from({length:16},(_,i)=>i);const Pi=Id.map(i=>(9*i+5)%16);let idxL=[Id];let idxR=[Pi];for(let i=0;i<4;i++)for(let j of[idxL,idxR])j.push(j[i].map(k=>Rho[k]));const shifts=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(i=>new Uint8Array(i));const shiftsL=idxL.map((idx,i)=>idx.map(j=>shifts[i][j]));const shiftsR=idxR.map((idx,i)=>idx.map(j=>shifts[i][j]));const Kl=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]);const Kr=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);const rotl$1=(word,shift)=>word<>>32-shift;function f(group,x,y,z){if(group===0)return x^y^z;else if(group===1)return x&y|~x&z;else if(group===2)return(x|~y)^z;else if(group===3)return x&z|y&~z;else return x^(y|~z)}const BUF=new Uint32Array(16);class RIPEMD160 extends SHA2{constructor(){super(64,20,8,true);this.h0=1732584193|0;this.h1=4023233417|0;this.h2=2562383102|0;this.h3=271733878|0;this.h4=3285377520|0}get(){const{h0,h1,h2,h3,h4}=this;return[h0,h1,h2,h3,h4]}set(h0,h1,h2,h3,h4){this.h0=h0|0;this.h1=h1|0;this.h2=h2|0;this.h3=h3|0;this.h4=h4|0}process(view,offset){for(let i=0;i<16;i++,offset+=4)BUF[i]=view.getUint32(offset,true);let al=this.h0|0,ar=al,bl=this.h1|0,br=bl,cl=this.h2|0,cr=cl,dl=this.h3|0,dr=dl,el=this.h4|0,er=el;for(let group=0;group<5;group++){const rGroup=4-group;const hbl=Kl[group],hbr=Kr[group];const rl=idxL[group],rr=idxR[group];const sl=shiftsL[group],sr=shiftsR[group];for(let i=0;i<16;i++){const tl=rotl$1(al+f(group,bl,cl,dl)+BUF[rl[i]]+hbl,sl[i])+el|0;al=el,el=dl,dl=rotl$1(cl,10)|0,cl=bl,bl=tl}for(let i=0;i<16;i++){const tr=rotl$1(ar+f(rGroup,br,cr,dr)+BUF[rr[i]]+hbr,sr[i])+er|0;ar=er,er=dr,dr=rotl$1(cr,10)|0,cr=br,br=tr}}this.set(this.h1+cl+dr|0,this.h2+dl+er|0,this.h3+el+ar|0,this.h4+al+br|0,this.h0+bl+cr|0)}roundClean(){BUF.fill(0)}destroy(){this.destroyed=true;this.buffer.fill(0);this.set(0,0,0,0,0)}}const ripemd160$1=wrapConstructor(()=>new RIPEMD160);let locked$3=false;const _ripemd160=function(data){return ripemd160$1(data)};let __ripemd160=_ripemd160;function ripemd160(_data){const data=getBytes(_data,"data");return hexlify(__ripemd160(data))}ripemd160._=_ripemd160;ripemd160.lock=function(){locked$3=true};ripemd160.register=function(func){if(locked$3){throw new TypeError("ripemd160 is locked")}__ripemd160=func};Object.freeze(ripemd160);let locked$2=false;const _pbkdf2=function(password,salt,iterations,keylen,algo){return pbkdf2Sync(password,salt,iterations,keylen,algo)};let __pbkdf2=_pbkdf2;function pbkdf2(_password,_salt,iterations,keylen,algo){const password=getBytes(_password,"password");const salt=getBytes(_salt,"salt");return hexlify(__pbkdf2(password,salt,iterations,keylen,algo))}pbkdf2._=_pbkdf2;pbkdf2.lock=function(){locked$2=true};pbkdf2.register=function(func){if(locked$2){throw new Error("pbkdf2 is locked")}__pbkdf2=func};Object.freeze(pbkdf2);let locked$1=false;const _randomBytes=function(length){return new Uint8Array(randomBytes$1(length))};let __randomBytes=_randomBytes;function randomBytes(length){return __randomBytes(length)}randomBytes._=_randomBytes;randomBytes.lock=function(){locked$1=true};randomBytes.register=function(func){if(locked$1){throw new Error("randomBytes is locked")}__randomBytes=func};Object.freeze(randomBytes);const rotl=(a,b)=>a<>>32-b;function XorAndSalsa(prev,pi,input,ii,out,oi){let y00=prev[pi++]^input[ii++],y01=prev[pi++]^input[ii++];let y02=prev[pi++]^input[ii++],y03=prev[pi++]^input[ii++];let y04=prev[pi++]^input[ii++],y05=prev[pi++]^input[ii++];let y06=prev[pi++]^input[ii++],y07=prev[pi++]^input[ii++];let y08=prev[pi++]^input[ii++],y09=prev[pi++]^input[ii++];let y10=prev[pi++]^input[ii++],y11=prev[pi++]^input[ii++];let y12=prev[pi++]^input[ii++],y13=prev[pi++]^input[ii++];let y14=prev[pi++]^input[ii++],y15=prev[pi++]^input[ii++];let x00=y00,x01=y01,x02=y02,x03=y03,x04=y04,x05=y05,x06=y06,x07=y07,x08=y08,x09=y09,x10=y10,x11=y11,x12=y12,x13=y13,x14=y14,x15=y15;for(let i=0;i<8;i+=2){x04^=rotl(x00+x12|0,7);x08^=rotl(x04+x00|0,9);x12^=rotl(x08+x04|0,13);x00^=rotl(x12+x08|0,18);x09^=rotl(x05+x01|0,7);x13^=rotl(x09+x05|0,9);x01^=rotl(x13+x09|0,13);x05^=rotl(x01+x13|0,18);x14^=rotl(x10+x06|0,7);x02^=rotl(x14+x10|0,9);x06^=rotl(x02+x14|0,13);x10^=rotl(x06+x02|0,18);x03^=rotl(x15+x11|0,7);x07^=rotl(x03+x15|0,9);x11^=rotl(x07+x03|0,13);x15^=rotl(x11+x07|0,18);x01^=rotl(x00+x03|0,7);x02^=rotl(x01+x00|0,9);x03^=rotl(x02+x01|0,13);x00^=rotl(x03+x02|0,18);x06^=rotl(x05+x04|0,7);x07^=rotl(x06+x05|0,9);x04^=rotl(x07+x06|0,13);x05^=rotl(x04+x07|0,18);x11^=rotl(x10+x09|0,7);x08^=rotl(x11+x10|0,9);x09^=rotl(x08+x11|0,13);x10^=rotl(x09+x08|0,18);x12^=rotl(x15+x14|0,7);x13^=rotl(x12+x15|0,9);x14^=rotl(x13+x12|0,13);x15^=rotl(x14+x13|0,18)}out[oi++]=y00+x00|0;out[oi++]=y01+x01|0;out[oi++]=y02+x02|0;out[oi++]=y03+x03|0;out[oi++]=y04+x04|0;out[oi++]=y05+x05|0;out[oi++]=y06+x06|0;out[oi++]=y07+x07|0;out[oi++]=y08+x08|0;out[oi++]=y09+x09|0;out[oi++]=y10+x10|0;out[oi++]=y11+x11|0;out[oi++]=y12+x12|0;out[oi++]=y13+x13|0;out[oi++]=y14+x14|0;out[oi++]=y15+x15|0}function BlockMix(input,ii,out,oi,r){let head=oi+0;let tail=oi+16*r;for(let i=0;i<16;i++)out[tail+i]=input[ii+(2*r-1)*16+i];for(let i=0;i0)tail+=16;XorAndSalsa(out,head,input,ii+=16,out,tail)}}function scryptInit(password,salt,_opts){const opts=checkOpts({dkLen:32,asyncTick:10,maxmem:1024**3+1024},_opts);const{N,r,p,dkLen,asyncTick,maxmem,onProgress}=opts;number(N);number(r);number(p);number(dkLen);number(asyncTick);number(maxmem);if(onProgress!==undefined&&typeof onProgress!=="function")throw new Error("progressCb should be function");const blockSize=128*r;const blockSize32=blockSize/4;if(N<=1||(N&N-1)!==0||N>=2**(blockSize/8)||N>2**32){throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32")}if(p<0||p>(2**32-1)*32/blockSize){throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)")}if(dkLen<0||dkLen>(2**32-1)*32){throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32")}const memUsed=blockSize*(N+p);if(memUsed>maxmem){throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`)}const B=pbkdf2$1(sha256$1,password,salt,{c:1,dkLen:blockSize*p});const B32=u32(B);const V=u32(new Uint8Array(blockSize*N));const tmp=u32(new Uint8Array(blockSize));let blockMixCb=()=>{};if(onProgress){const totalBlockMix=2*N*p;const callbackPer=Math.max(Math.floor(totalBlockMix/1e4),1);let blockMixCnt=0;blockMixCb=()=>{blockMixCnt++;if(onProgress&&(!(blockMixCnt%callbackPer)||blockMixCnt===totalBlockMix))onProgress(blockMixCnt/totalBlockMix)}}return{N:N,r:r,p:p,dkLen:dkLen,blockSize32:blockSize32,V:V,B32:B32,B:B,tmp:tmp,blockMixCb:blockMixCb,asyncTick:asyncTick}}function scryptOutput(password,dkLen,B,V,tmp){const res=pbkdf2$1(sha256$1,password,B,{c:1,dkLen:dkLen});B.fill(0);V.fill(0);tmp.fill(0);return res}function scrypt$1(password,salt,opts){const{N,r,p,dkLen,blockSize32,V,B32,B,tmp,blockMixCb}=scryptInit(password,salt,opts);for(let pi=0;pi{BlockMix(V,pos,V,pos+=blockSize32,r);blockMixCb()});BlockMix(V,(N-1)*blockSize32,B32,Pi,r);blockMixCb();await asyncLoop(N,asyncTick,()=>{const j=B32[Pi+blockSize32-16]%N;for(let k=0;kmod(mod(x*x)*x+CURVE.b);const err=(m="")=>{throw new Error(m)};const big=n=>typeof n==="bigint";const str=s=>typeof s==="string";const fe=n=>big(n)&&0nbig(n)&&0n!(a instanceof Uint8Array)||typeof l==="number"&&l>0&&a.length!==l?err("Uint8Array expected"):a;const u8n=data=>new Uint8Array(data);const toU8=(a,len)=>au8(str(a)?h2b(a):u8n(a),len);const mod=(a,b=P)=>{let r=a%b;return r>=0n?r:b+r};const isPoint=p=>p instanceof Point?p:err("Point expected");let Gpows=undefined;class Point{constructor(px,py,pz){this.px=px;this.py=py;this.pz=pz}static fromAffine(p){return new Point(p.x,p.y,1n)}static fromHex(hex){hex=toU8(hex);let p=undefined;const head=hex[0],tail=hex.subarray(1);const x=slcNum(tail,0,fLen),len=hex.length;if(len===33&&[2,3].includes(head)){if(!fe(x))err("Point hex invalid: x not FE");let y=sqrt(crv(x));const isYOdd=(y&1n)===1n;const headOdd=(head&1)===1;if(headOdd!==isYOdd)y=mod(-y);p=new Point(x,y,1n)}if(len===65&&head===4)p=new Point(x,slcNum(tail,fLen,2*fLen),1n);return p?p.ok():err("Point is not on curve")}static fromPrivateKey(k){return G.mul(toPriv(k))}get x(){return this.aff().x}get y(){return this.aff().y}equals(other){const{px:X1,py:Y1,pz:Z1}=this;const{px:X2,py:Y2,pz:Z2}=isPoint(other);const X1Z2=mod(X1*Z2),X2Z1=mod(X2*Z1);const Y1Z2=mod(Y1*Z2),Y2Z1=mod(Y2*Z1);return X1Z2===X2Z1&&Y1Z2===Y2Z1}negate(){return new Point(this.px,mod(-this.py),this.pz)}double(){return this.add(this)}add(other){const{px:X1,py:Y1,pz:Z1}=this;const{px:X2,py:Y2,pz:Z2}=isPoint(other);const{a,b}=CURVE;let X3=0n,Y3=0n,Z3=0n;const b3=mod(b*3n);let t0=mod(X1*X2),t1=mod(Y1*Y2),t2=mod(Z1*Z2),t3=mod(X1+Y1);let t4=mod(X2+Y2);t3=mod(t3*t4);t4=mod(t0+t1);t3=mod(t3-t4);t4=mod(X1+Z1);let t5=mod(X2+Z2);t4=mod(t4*t5);t5=mod(t0+t2);t4=mod(t4-t5);t5=mod(Y1+Z1);X3=mod(Y2+Z2);t5=mod(t5*X3);X3=mod(t1+t2);t5=mod(t5-X3);Z3=mod(a*t4);X3=mod(b3*t2);Z3=mod(X3+Z3);X3=mod(t1-Z3);Z3=mod(t1+Z3);Y3=mod(X3*Z3);t1=mod(t0+t0);t1=mod(t1+t0);t2=mod(a*t2);t4=mod(b3*t4);t1=mod(t1+t2);t2=mod(t0-t2);t2=mod(a*t2);t4=mod(t4+t2);t0=mod(t1*t4);Y3=mod(Y3+t0);t0=mod(t5*t4);X3=mod(t3*X3);X3=mod(X3-t0);t0=mod(t3*t1);Z3=mod(t5*Z3);Z3=mod(Z3+t0);return new Point(X3,Y3,Z3)}mul(n,safe=true){if(!safe&&n===0n)return I;if(!ge(n))err("invalid scalar");if(this.equals(G))return wNAF(n).p;let p=I,f=G;for(let d=this;n>0n;d=d.double(),n>>=1n){if(n&1n)p=p.add(d);else if(safe)f=f.add(d)}return p}mulAddQUns(R,u1,u2){return this.mul(u1,false).add(R.mul(u2,false)).ok()}toAffine(){const{px:x,py:y,pz:z}=this;if(this.equals(I))return{x:0n,y:0n};if(z===1n)return{x:x,y:y};const iz=inv(z);if(mod(z*iz)!==1n)err("invalid inverse");return{x:mod(x*iz),y:mod(y*iz)}}assertValidity(){const{x,y}=this.aff();if(!fe(x)||!fe(y))err("Point invalid: x or y");return mod(y*y)===crv(x)?this:err("Point invalid: not on curve")}multiply(n){return this.mul(n)}aff(){return this.toAffine()}ok(){return this.assertValidity()}toHex(isCompressed=true){const{x,y}=this.aff();const head=isCompressed?(y&1n)===0n?"02":"03":"04";return head+n2h(x)+(isCompressed?"":n2h(y))}toRawBytes(isCompressed=true){return h2b(this.toHex(isCompressed))}}Point.BASE=new Point(Gx,Gy,1n);Point.ZERO=new Point(0n,1n,0n);const{BASE:G,ZERO:I}=Point;const padh=(n,pad)=>n.toString(16).padStart(pad,"0");const b2h=b=>Array.from(b).map(e=>padh(e,2)).join("");const h2b=hex=>{const l=hex.length;if(!str(hex)||l%2)err("hex invalid 1");const arr=u8n(l/2);for(let i=0;iBigInt("0x"+(b2h(b)||"0"));const slcNum=(b,from,to)=>b2n(b.slice(from,to));const n2b=num=>{return big(num)&&num>=0n&&numb2h(n2b(num));const inv=(num,md=P)=>{if(num===0n||md<=0n)err("no inverse n="+num+" mod="+md);let a=mod(num,md),b=md,x=0n,u=1n;while(a!==0n){const q=b/a,r=b%a;const m=x-u*q;b=a,a=r,x=u,u=m}return b===1n?mod(x,md):err("no inverse")};const sqrt=n=>{let r=1n;for(let num=n,e=(P+1n)/4n;e>0n;e>>=1n){if(e&1n)r=r*num%P;num=num*num%P}return mod(r*r)===n?r:err("sqrt invalid")};const toPriv=p=>{if(!big(p))p=b2n(toU8(p,fLen));return ge(p)?p:err("private key out of range")};function getSharedSecret(privA,pubB,isCompressed=true){return Point.fromHex(pubB).mul(toPriv(privA)).toRawBytes(isCompressed)}const W=8;const precompute=()=>{const points=[];const windows=256/W+1;let p=G,b=p;for(let w=0;w{const comp=Gpows||(Gpows=precompute());const neg=(cnd,p)=>{let n=p.negate();return cnd?n:p};let p=I,f=G;const windows=1+256/W;const wsize=2**(W-1);const mask=BigInt(2**W-1);const maxNum=2**W;const shiftBy=BigInt(W);for(let w=0;w>=shiftBy;if(wbits>wsize){wbits-=maxNum;n+=1n}const off1=off,off2=off+Math.abs(wbits)-1;const cnd1=w%2!==0,cnd2=wbits<0;if(wbits===0){f=f.add(neg(cnd1,comp[off1]))}else{p=p.add(neg(cnd2,comp[off2]))}}return{p:p,f:f}};const logger$2=new Logger("signing-key/0.0.1");class SigningKey{#privateKey;constructor(privateKey){let tmp=privateKey;if(typeof tmp==="string"&&tmp.startsWith("0x")){tmp=tmp.replace("0x","")}assertArgument(dataLength("0x"+tmp)===57,"invalid private key","privateKey","[REDACTED]");this.#privateKey=hexlify("0x"+tmp)}get privateKey(){return this.#privateKey}get publicKey(){return SigningKey.computePublicKey(this.#privateKey)}get compressedPublicKey(){return SigningKey.computePublicKey(this.#privateKey,true)}sign(digest){const key=getBytesCopy(this.#privateKey);assertArgument(dataLength(digest)===32,"invalid digest length","digest",digest);const keyBuffer=new Uint8Array(arrayify(key));if(keyBuffer.length!==57){logger$2.throwArgumentError("invalid private key","key","[REDACTED]")}const digestBuffer=new Uint8Array(arrayify(digest));if(digestBuffer.length!==32){logger$2.throwArgumentError("bad digest length","digest",digest)}if(keyBuffer[56]>127){const prefix=keyBuffer.slice(0,57);prefix[0]&=252;prefix[55]|=128;prefix[56]=0;const scalar=prefix.slice(0,56);const bufferDigest=Buffer$1.from(digestBuffer);const bufferPrfx=Buffer$1.from(prefix);const bufferScalar=Buffer$1.from(scalar);const sig=ed448.signWithScalar(bufferDigest,bufferScalar,bufferPrfx);const hexlified=hexlify(sig);return hexConcat([hexlified,this.publicKey])}const sig=ed448.sign(Buffer$1.from(digestBuffer),Buffer$1.from(keyBuffer));const hexlified=hexlify(sig);return hexConcat([hexlified,this.publicKey])}computeSharedSecret(other){const pubKey=SigningKey.computePublicKey(other);return hexlify(getSharedSecret(getBytesCopy(this.#privateKey),getBytes(pubKey)))}static computePublicKey(key,compressed){const bytes=Buffer$1.from(arrayify(key));if(bytes.length!==57){logger$2.throwArgumentError("invalid private key","key","[REDACTED]")}if(bytes[56]>127){const scalar=bytes.slice(0,56);scalar[0]&=252;scalar[55]|=128;const pub=ed448.publicKeyFromScalar(scalar);return hexlify(pub)}const pub=ed448.publicKeyCreate(bytes);return hexlify(pub)}static recoverPublicKey(digest,signature){assertArgument(dataLength(digest)===32,"invalid digest length","digest",digest);const digestBuffer=Buffer$1.from(arrayify(digest));const sigBuffer=Buffer$1.from(arrayify(signature));if(sigBuffer.length!==171){logger$2.throwArgumentError("invalid signature","signature",signature)}const sig=sigBuffer.slice(0,114);const pub=sigBuffer.slice(114);if(ed448.verify(digestBuffer,sig,pub)){return hexlify(pub)}logger$2.throwArgumentError("invalid signature","signature",signature);return""}static addPoints(p0,p1,compressed){const pub0=Point.fromHex(SigningKey.computePublicKey(p0).substring(2));const pub1=Point.fromHex(SigningKey.computePublicKey(p1).substring(2));return"0x"+pub0.add(pub1).toHex(!!compressed)}}const BN_0$6=BigInt(0);const BN_1$3=BigInt(1);const BN_2$1=BigInt(2);const BN_27=BigInt(27);const BN_28=BigInt(28);const BN_35=BigInt(35);const _guard$4={};class Signature{#r;#s;#v;#networkV;get r(){return this.#r}set r(value){assertArgument(dataLength(value)===32,"invalid r","value",value);this.#r=hexlify(value)}get s(){return this.#s}set s(_value){assertArgument(dataLength(_value)===32,"invalid s","value",_value);const value=hexlify(_value);assertArgument(parseInt(value.substring(0,3))<8,"non-canonical s","value",value);this.#s=value}get v(){return this.#v}set v(value){const v=getNumber(value,"value");assertArgument(v===27||v===28,"invalid v","v",value);this.#v=v}get networkV(){return this.#networkV}get legacynetworkId(){const v=this.networkV;if(v==null){return null}return Signature.getnetworkId(v)}get yParity(){return this.v===27?0:1}get yParityAndS(){const yParityAndS=getBytes(this.s);if(this.yParity){yParityAndS[0]|=128}return hexlify(yParityAndS)}get compactSerialized(){return concat([this.r,this.yParityAndS])}get serialized(){return concat([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(guard,r,s,v){assertPrivate(guard,_guard$4,"Signature");this.#r=r;this.#s=s;this.#v=v;this.#networkV=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const clone=new Signature(_guard$4,this.r,this.s,this.v);if(this.networkV){clone.#networkV=this.networkV}return clone}toJSON(){const networkV=this.networkV;return{_type:"signature",networkV:networkV!=null?networkV.toString():null,r:this.r,s:this.s,v:this.v}}static getnetworkId(v){const bv=getBigInt(v,"v");if(bv==BN_27||bv==BN_28){return BN_0$6}assertArgument(bv>=BN_35,"invalid EIP-155 v","v",v);return(bv-BN_35)/BN_2$1}static getnetworkIdV(networkId,v){return getBigInt(networkId)*BN_2$1+BigInt(35+v-27)}static getNormalizedV(v){const bv=getBigInt(v);if(bv===BN_0$6||bv===BN_27){return 27}if(bv===BN_1$3||bv===BN_28){return 28}assertArgument(bv>=BN_35,"invalid v","v",v);return bv&BN_1$3?27:28}}function lock(){computeHmac.lock();pbkdf2.lock();randomBytes.lock();ripemd160.lock();scrypt.lock();scryptSync.lock();sha256.lock();sha512.lock();randomBytes.lock()}function removeHexPrefix(val){return val.substring(0,2)==="0x"?val.substring(2):val}function publicToAddress(key,prefix){const val=hexDataSlice(sha256(key),12);const checksum=calculateCheckSum(val,prefix);return"0x"+prefix+checksum+removeHexPrefix(val)}function computeAddress(key,prefix){let pubkey;if(typeof key==="string"){pubkey=SigningKey.computePublicKey(key,false)}else{pubkey=key.publicKey}return publicToAddress(pubkey,prefix)}function recoverAddress(digest,signature,prefix){const publicKey=SigningKey.recoverPublicKey(arrayify(digest),signature);return publicToAddress(publicKey,prefix)}function extractPrefix(address){address=getAddress(address);return address.substring(2,4)}const WordSize=32;const Padding=new Uint8Array(WordSize);const passProperties$1=["then"];const _guard$3={};function throwError(name,error){const wrapped=new Error(`deferred error during ABI decoding triggered accessing ${name}`);wrapped.error=error;throw wrapped}class Result extends Array{#names;constructor(...args){const guard=args[0];let items=args[1];let names=(args[2]||[]).slice();let wrap=true;if(guard!==_guard$3){items=args;names=[];wrap=false}super(items.length);items.forEach((item,index)=>{this[index]=item});const nameCounts=names.reduce((accum,name)=>{if(typeof name==="string"){accum.set(name,(accum.get(name)||0)+1)}return accum},new Map);this.#names=Object.freeze(items.map((item,index)=>{const name=names[index];if(name!=null&&nameCounts.get(name)===1){return name}return null}));if(!wrap){return}Object.freeze(this);return new Proxy(this,{get:(target,prop,receiver)=>{if(typeof prop==="string"){if(prop.match(/^[0-9]+$/)){const index=getNumber(prop,"%index");if(index<0||index>=this.length){throw new RangeError("out of result range")}const item=target[index];if(item instanceof Error){throwError(`index ${index}`,item)}return item}if(passProperties$1.indexOf(prop)>=0){return Reflect.get(target,prop,receiver)}const value=target[prop];if(value instanceof Function){return function(...args){return value.apply(this===receiver?target:this,args)}}else if(!(prop in target)){return target.getValue.apply(this===receiver?target:this,[prop])}}return Reflect.get(target,prop,receiver)}})}toArray(){const result=[];this.forEach((item,index)=>{if(item instanceof Error){throwError(`index ${index}`,item)}result.push(item)});return result}toObject(){return this.#names.reduce((accum,name,index)=>{assert(name!=null,"value at index ${ index } unnamed","UNSUPPORTED_OPERATION",{operation:"toObject()"});if(!(name in accum)){accum[name]=this.getValue(name)}return accum},{})}slice(start,end){if(start==null){start=0}if(start<0){start+=this.length;if(start<0){start=0}}if(end==null){end=this.length}if(end<0){end+=this.length;if(end<0){end=0}}if(end>this.length){end=this.length}const result=[],names=[];for(let i=start;i{this.#data[offset]=getValue$1(value)}}}class Reader{allowLoose;#data;#offset;constructor(data,allowLoose){defineProperties(this,{allowLoose:!!allowLoose});this.#data=getBytesCopy(data);this.#offset=0}get data(){return hexlify(this.#data)}get dataLength(){return this.#data.length}get consumed(){return this.#offset}get bytes(){return new Uint8Array(this.#data)}#peekBytes(offset,length,loose){let alignedLength=Math.ceil(length/WordSize)*WordSize;if(this.#offset+alignedLength>this.#data.length){if(this.allowLoose&&loose&&this.#offset+length<=this.#data.length){alignedLength=length}else{assert(false,"data out-of-bounds","BUFFER_OVERRUN",{buffer:getBytesCopy(this.#data),length:this.#data.length,offset:this.#offset+alignedLength})}}return this.#data.slice(this.#offset,this.#offset+alignedLength)}subReader(offset){return new Reader(this.#data.slice(this.#offset+offset),this.allowLoose)}readBytes(length,loose){let bytes=this.#peekBytes(0,length,!!loose);this.#offset+=bytes.length;return bytes.slice(0,length)}readValue(){return toBigInt(this.readBytes(WordSize))}readIndex(){return toNumber(this.readBytes(WordSize))}}const _gaurd={};function n(value,width){let signed=false;if(width<0){signed=true;width*=-1}return new Typed(_gaurd,`${signed?"":"u"}int${width}`,value,{signed:signed,width:width})}function b(value,size){return new Typed(_gaurd,`bytes${size?size:""}`,value,{size:size})}const _typedSymbol=Symbol.for("_corebc_typed");class Typed{type;value;#options;_typedSymbol;constructor(gaurd,type,value,options){if(options==null){options=null}assertPrivate(_gaurd,gaurd,"Typed");defineProperties(this,{_typedSymbol:_typedSymbol,type:type,value:value});this.#options=options;this.format()}format(){if(this.type==="array"){throw new Error("")}else if(this.type==="dynamicArray"){throw new Error("")}else if(this.type==="tuple"){return`tuple(${this.value.map(v=>v.format()).join(",")})`}return this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple"){throw TypeError("not a tuple")}return this.#options}get arrayLength(){if(this.type!=="array"){throw TypeError("not an array")}if(this.#options===true){return-1}if(this.#options===false){return this.value.length}return null}static from(type,value){return new Typed(_gaurd,type,value)}static uint8(v){return n(v,8)}static uint16(v){return n(v,16)}static uint24(v){return n(v,24)}static uint32(v){return n(v,32)}static uint40(v){return n(v,40)}static uint48(v){return n(v,48)}static uint56(v){return n(v,56)}static uint64(v){return n(v,64)}static uint72(v){return n(v,72)}static uint80(v){return n(v,80)}static uint88(v){return n(v,88)}static uint96(v){return n(v,96)}static uint104(v){return n(v,104)}static uint112(v){return n(v,112)}static uint120(v){return n(v,120)}static uint128(v){return n(v,128)}static uint136(v){return n(v,136)}static uint144(v){return n(v,144)}static uint152(v){return n(v,152)}static uint160(v){return n(v,160)}static uint168(v){return n(v,168)}static uint176(v){return n(v,176)}static uint184(v){return n(v,184)}static uint192(v){return n(v,192)}static uint200(v){return n(v,200)}static uint208(v){return n(v,208)}static uint216(v){return n(v,216)}static uint224(v){return n(v,224)}static uint232(v){return n(v,232)}static uint240(v){return n(v,240)}static uint248(v){return n(v,248)}static uint256(v){return n(v,256)}static uint(v){return n(v,256)}static int8(v){return n(v,-8)}static int16(v){return n(v,-16)}static int24(v){return n(v,-24)}static int32(v){return n(v,-32)}static int40(v){return n(v,-40)}static int48(v){return n(v,-48)}static int56(v){return n(v,-56)}static int64(v){return n(v,-64)}static int72(v){return n(v,-72)}static int80(v){return n(v,-80)}static int88(v){return n(v,-88)}static int96(v){return n(v,-96)}static int104(v){return n(v,-104)}static int112(v){return n(v,-112)}static int120(v){return n(v,-120)}static int128(v){return n(v,-128)}static int136(v){return n(v,-136)}static int144(v){return n(v,-144)}static int152(v){return n(v,-152)}static int160(v){return n(v,-160)}static int168(v){return n(v,-168)}static int176(v){return n(v,-176)}static int184(v){return n(v,-184)}static int192(v){return n(v,-192)}static int200(v){return n(v,-200)}static int208(v){return n(v,-208)}static int216(v){return n(v,-216)}static int224(v){return n(v,-224)}static int232(v){return n(v,-232)}static int240(v){return n(v,-240)}static int248(v){return n(v,-248)}static int256(v){return n(v,-256)}static int(v){return n(v,-256)}static bytes1(v){return b(v,1)}static bytes2(v){return b(v,2)}static bytes3(v){return b(v,3)}static bytes4(v){return b(v,4)}static bytes5(v){return b(v,5)}static bytes6(v){return b(v,6)}static bytes7(v){return b(v,7)}static bytes8(v){return b(v,8)}static bytes9(v){return b(v,9)}static bytes10(v){return b(v,10)}static bytes11(v){return b(v,11)}static bytes12(v){return b(v,12)}static bytes13(v){return b(v,13)}static bytes14(v){return b(v,14)}static bytes15(v){return b(v,15)}static bytes16(v){return b(v,16)}static bytes17(v){return b(v,17)}static bytes18(v){return b(v,18)}static bytes19(v){return b(v,19)}static bytes20(v){return b(v,20)}static bytes21(v){return b(v,21)}static bytes22(v){return b(v,22)}static bytes23(v){return b(v,23)}static bytes24(v){return b(v,24)}static bytes25(v){return b(v,25)}static bytes26(v){return b(v,26)}static bytes27(v){return b(v,27)}static bytes28(v){return b(v,28)}static bytes29(v){return b(v,29)}static bytes30(v){return b(v,30)}static bytes31(v){return b(v,31)}static bytes32(v){return b(v,32)}static address(v){return new Typed(_gaurd,"address",v)}static bool(v){return new Typed(_gaurd,"bool",!!v)}static bytes(v){return new Typed(_gaurd,"bytes",v)}static string(v){return new Typed(_gaurd,"string",v)}static array(v,dynamic){throw new Error("not implemented yet")}static tuple(v,name){throw new Error("not implemented yet")}static overrides(v){return new Typed(_gaurd,"overrides",Object.assign({},v))}static isTyped(value){return value&&value._typedSymbol===_typedSymbol}static dereference(value,type){if(Typed.isTyped(value)){if(value.type!==type){throw new Error(`invalid type: expecetd ${type}, got ${value.type}`)}return value.value}return value}}class AddressCoder extends Coder{constructor(localName){super("address","address",localName,false)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(writer,_value){let value=Typed.dereference(_value,"string");try{value=getAddress(value)}catch(error){return this._throwError(error.message,_value)}return writer.writeValue(value)}decode(reader){return getAddress(toBeHex(reader.readValue(),22))}}class AnonymousCoder extends Coder{coder;constructor(coder){super(coder.name,coder.type,"_",coder.dynamic);this.coder=coder}defaultValue(){return this.coder.defaultValue()}encode(writer,value){return this.coder.encode(writer,value)}decode(reader){return this.coder.decode(reader)}}function pack(writer,coders,values){let arrayValues=[];if(Array.isArray(values)){arrayValues=values}else if(values&&typeof values==="object"){let unique={};arrayValues=coders.map(coder=>{const name=coder.localName;assert(name,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:coder},value:values});assert(!unique[name],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:coder},value:values});unique[name]=true;return values[name]})}else{assertArgument(false,"invalid tuple value","tuple",values)}assertArgument(coders.length===arrayValues.length,"types/value length mismatch","tuple",values);let staticWriter=new Writer;let dynamicWriter=new Writer;let updateFuncs=[];coders.forEach((coder,index)=>{let value=arrayValues[index];if(coder.dynamic){let dynamicOffset=dynamicWriter.length;coder.encode(dynamicWriter,value);let updateFunc=staticWriter.writeUpdatableValue();updateFuncs.push(baseOffset=>{updateFunc(baseOffset+dynamicOffset)})}else{coder.encode(staticWriter,value)}});updateFuncs.forEach(func=>{func(staticWriter.length)});let length=writer.appendWriter(staticWriter);length+=writer.appendWriter(dynamicWriter);return length}function unpack(reader,coders){let values=[];let keys=[];let baseReader=reader.subReader(0);coders.forEach(coder=>{let value=null;if(coder.dynamic){let offset=reader.readIndex();let offsetReader=baseReader.subReader(offset);try{value=coder.decode(offsetReader)}catch(error){if(isError(error,"BUFFER_OVERRUN")){throw error}value=error;value.baseType=coder.name;value.name=coder.localName;value.type=coder.type}}else{try{value=coder.decode(reader)}catch(error){if(isError(error,"BUFFER_OVERRUN")){throw error}value=error;value.baseType=coder.name;value.name=coder.localName;value.type=coder.type}}if(value==undefined){throw new Error("investigate")}values.push(value);keys.push(coder.localName||null)});return Result.fromItems(values,keys)}class ArrayCoder extends Coder{coder;length;constructor(coder,length,localName){const type=coder.type+"["+(length>=0?length:"")+"]";const dynamic=length===-1||coder.dynamic;super("array",type,localName,dynamic);defineProperties(this,{coder:coder,length:length})}defaultValue(){const defaultChild=this.coder.defaultValue();const result=[];for(let i=0;ibounds||value<-(bounds+BN_1$2)){this._throwError("value out-of-bounds",_value)}value=toTwos(value,8*WordSize)}else if(valuemask(maxUintValue,this.size*8)){this._throwError("value out-of-bounds",_value)}return writer.writeValue(value)}decode(reader){let value=mask(reader.readValue(),this.size*8);if(this.signed){value=fromTwos(value,this.size*8)}return value}}class StringCoder extends DynamicBytesCoder{constructor(localName){super("string",localName)}defaultValue(){return""}encode(writer,_value){return super.encode(writer,toUtf8Bytes(Typed.dereference(_value,"string")))}decode(reader){return toUtf8String(super.decode(reader))}}class TupleCoder extends Coder{coders;constructor(coders,localName){let dynamic=false;const types=[];coders.forEach(coder=>{if(coder.dynamic){dynamic=true}types.push(coder.type)});const type="tuple("+types.join(",")+")";super("tuple",type,localName,dynamic);defineProperties(this,{coders:Object.freeze(coders.slice())})}defaultValue(){const values=[];this.coders.forEach(coder=>{values.push(coder.defaultValue())});const uniqueNames=this.coders.reduce((accum,coder)=>{const name=coder.localName;if(name){if(!accum[name]){accum[name]=0}accum[name]++}return accum},{});this.coders.forEach((coder,index)=>{let name=coder.localName;if(!name||uniqueNames[name]!==1){return}if(name==="length"){name="_length"}if(values[name]!=null){return}values[name]=values[index]});return Object.freeze(values)}encode(writer,_value){const value=Typed.dereference(_value,"tuple");return pack(writer,this.coders,value)}decode(reader){return unpack(reader,this.coders)}}function id(value,useKeccak){if(useKeccak){return keccak256(toUtf8Bytes(value))}return sha256(toUtf8Bytes(value))}const ZeroAddress="0x0000000000000000000000000000000000000000";const ZeroHash="0x0000000000000000000000000000000000000000000000000000000000000000";const N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");const OrePerXCB=BigInt("1000000000000000000");const MaxUint256=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const MinInt256=BigInt("0x8000000000000000000000000000000000000000000000000000000000000000")*BigInt(-1);const MaxInt256=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const CoreSymbol="Ξ";const MessagePrefix="Core Signed Message:\n";function accessSetify(addr,storageKeys){return{address:getAddress(addr),storageKeys:storageKeys.map((storageKey,index)=>{assertArgument(isHexString(storageKey,32),"invalid slot",`storageKeys[${index}]`,storageKey);return storageKey.toLowerCase()})}}function accessListify(value){if(Array.isArray(value)){return value.map((set,index)=>{if(Array.isArray(set)){assertArgument(set.length===2,"invalid slot set",`value[${index}]`,set);return accessSetify(set[0],set[1])}assertArgument(set!=null&&typeof set==="object","invalid address-slot set","value",value);return accessSetify(set.address,set.storageKeys)})}assertArgument(value!=null&&typeof value==="object","invalid access list","value",value);const result=Object.keys(value).map(addr=>{const storageKeys=value[addr].reduce((accum,storageKey)=>{accum[storageKey]=true;return accum},{});return accessSetify(addr,Object.keys(storageKeys).sort())});result.sort((a,b)=>a.address.localeCompare(b.address));return result}const logger$1=new Logger("transaction/0.0.1");const BN_0$4=BigInt(0);function handleAddress(value){if(value==="0x"){return null}return getAddress(value)}function parse(data){const handleNumber=value=>{if(value==="0x"){return BigNumber.from(0)}return BigNumber.from(value)};const transaction=decode$1(data);if(transaction.length!==7&&transaction.length!==8){logger$1.throwArgumentError("invalid raw transaction","data",data)}const isSigned=transaction.length===8;const tx={nonce:Number(handleNumber(transaction[0])),energyPrice:handleNumber(transaction[1]).toBigInt(),energyLimit:handleNumber(transaction[2]).toBigInt(),networkId:handleNumber(transaction[isSigned?3:6]).toBigInt(),to:handleAddress(transaction[isSigned?4:3]),value:handleNumber(transaction[isSigned?5:4]).toBigInt(),data:transaction[isSigned?6:5]};if(transaction.length===8){const prefix=networkIdToPrefix(Number(tx.networkId));const digest=sha256(serialize(tx));tx.hash=sha256(serialize(tx,transaction[7]));tx.from=recoverAddress(digest,transaction[7],prefix);tx.signature=transaction[7]}return tx}const unsignedTransactionFields=[{name:"nonce",maxLength:32,numeric:true},{name:"energyPrice",maxLength:32,numeric:true},{name:"energyLimit",maxLength:32,numeric:true},{name:"to",length:22},{name:"value",maxLength:32,numeric:true},{name:"data"},{name:"networkId",maxLength:32,numeric:true}];const transactionFields=[{name:"nonce",maxLength:32,numeric:true},{name:"energyPrice",maxLength:32,numeric:true},{name:"energyLimit",maxLength:32,numeric:true},{name:"networkId",maxLength:32,numeric:true},{name:"to",length:22},{name:"value",maxLength:32,numeric:true},{name:"data"}];const allowedTransactionKeys={networkId:true,data:true,energyLimit:true,energyPrice:true,nonce:true,to:true,value:true};function serialize(transaction,signature){checkProperties(transaction,allowedTransactionKeys);const raw=[];(!!signature?transactionFields:unsignedTransactionFields).forEach(function({numeric,maxLength,name,length}){let value=transaction[name]||[];const options={};if(numeric){options.hexPad="left"}const tmpHexlified=hexlify(value,options);value=arrayify(tmpHexlified);if(length&&value.length!==length&&value.length>0){logger$1.throwArgumentError("invalid length for "+name,"transaction:"+name,value)}if(maxLength){value=stripZeros(value);if(value.length>maxLength){logger$1.throwArgumentError("invalid length for "+name,"transaction:"+name,value)}}const hexlified=hexlify(value);raw.push(hexlified)});if(!!signature){raw.push(hexlify(signature))}const finalValue=encode(raw);return finalValue}class Transaction{#to;#data;#nonce;#energyLimit;#energyPrice;#value;#networkId;#sig;get to(){return this.#to}set to(value){this.#to=value==null?null:getAddress(value)}get nonce(){return this.#nonce}set nonce(value){this.#nonce=getNumber(value,"value")}get energyLimit(){return this.#energyLimit}set energyLimit(value){this.#energyLimit=getBigInt(value)}get energyPrice(){const value=this.#energyPrice;if(value==null){return BN_0$4}return value}set energyPrice(value){this.#energyPrice=value==null?null:getBigInt(value,"energyPrice")}get data(){return this.#data}set data(value){this.#data=hexlify(value)}get value(){return this.#value}set value(value){this.#value=getBigInt(value,"value")}get networkId(){return this.#networkId}set networkId(value){this.#networkId=getBigInt(value)}get signature(){return this.#sig||null}set signature(value){this.#sig=value==null?null:value}constructor(){this.#to=null;this.#nonce=0;this.#energyLimit=BigInt(0);this.#energyPrice=null;this.#data="0x";this.#value=BigInt(0);this.#networkId=BigInt(0);this.#sig=null}get hash(){if(this.signature==null){return null}return sha256(this.serialized)}get unsignedHash(){return sha256(this.unsignedSerialized)}get from(){if(this.signature==null){return null}const prefix=networkIdToPrefix(Number(this.#networkId));return recoverAddress(this.unsignedHash,this.signature,prefix)}get fromPublicKey(){if(this.signature==null){return null}return SigningKey.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){assert(this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});return serialize(this,this.signature)}get unsignedSerialized(){return serialize(this)}clone(){return Transaction.from(this)}toJSON(){const s=v=>{if(v==null){return null}return v.toString()};return{to:this.to,data:this.data,nonce:this.nonce,energyLimit:s(this.energyLimit),energyPrice:s(this.energyPrice),value:s(this.value),networkId:s(this.networkId),sig:this.signature?this.signature:null}}static from(tx){if(tx==null){return new Transaction}if(typeof tx==="string"){const payload=getBytes(tx);return Transaction.from(parse(payload))}const result=new Transaction;if(tx.to!=null){result.to=tx.to}if(tx.nonce!=null){result.nonce=tx.nonce}if(tx.energyLimit!=null){result.energyLimit=tx.energyLimit}if(tx.energyPrice!=null){result.energyPrice=tx.energyPrice}if(tx.data!=null){result.data=tx.data}if(tx.value!=null){result.value=tx.value}if(tx.networkId!=null){result.networkId=tx.networkId}if(tx.signature!=null){result.signature=tx.signature}if(tx.hash!=null){assertArgument(result.isSigned(),"unsigned transaction cannot define hash","tx",tx);assertArgument(result.hash===tx.hash,"hash mismatch","tx",tx)}if(tx.from!=null){assertArgument(result.isSigned(),"unsigned transaction cannot define from","tx",tx);assertArgument(result.from.toLowerCase()===(tx.from||"").toLowerCase(),"from mismatch","tx",tx)}return result}}function hashMessage(message){if(typeof message==="string"){message=toUtf8Bytes(message)}return sha256(concat([toUtf8Bytes(MessagePrefix),toUtf8Bytes(String(message.length)),message]))}function verifyMessage(message,sig,prefix){const digest=hashMessage(message);return recoverAddress(digest,sig,prefix)}const regexBytes=new RegExp("^bytes([0-9]+)$");const regexNumber=new RegExp("^(u?int)([0-9]*)$");const regexArray=new RegExp("^(.*)\\[([0-9]*)\\]$");function _pack(type,value,isArray){switch(type){case"address":if(isArray){return getBytes(zeroPadValue(value,32))}return getBytes(getAddress(value));case"string":return toUtf8Bytes(value);case"bytes":return getBytes(value);case"bool":value=!!value?"0x01":"0x00";if(isArray){return getBytes(zeroPadValue(value,32))}return getBytes(value)}let match=type.match(regexNumber);if(match){let signed=match[1]==="int";let size=parseInt(match[2]||"256");assertArgument((!match[2]||match[2]===String(size))&&size%8===0&&size!==0&&size<=256,"invalid number type","type",type);if(isArray){size=256}if(signed){value=toTwos(value,size)}return getBytes(zeroPadValue(toBeArray(value),size/8))}match=type.match(regexBytes);if(match){const size=parseInt(match[1]);assertArgument(String(size)===match[1]&&size!==0&&size<=32,"invalid bytes type","type",type);assertArgument(dataLength(value)===size,`invalid value for ${type}`,"value",value);if(isArray){return getBytes(zeroPadBytes(value,32))}return value}match=type.match(regexArray);if(match&&Array.isArray(value)){const baseType=match[1];const count=parseInt(match[2]||String(value.length));assertArgument(count===value.length,`invalid array length for ${type}`,"value",value);const result=[];value.forEach(function(value){result.push(_pack(baseType,value,true))});return getBytes(concat(result))}assertArgument(false,"invalid type","type",type)}function solidityPacked(types,values){assertArgument(types.length===values.length,"wrong number of values; expected ${ types.length }","values",values);const tight=[];types.forEach(function(type,index){tight.push(_pack(type,values[index]))});return hexlify(concat(tight))}function solidityPackedSha256(types,values){return sha256(solidityPacked(types,values))}const padding=new Uint8Array(32);padding.fill(0);const BN__1=BigInt(-1);const BN_0$3=BigInt(0);const BN_1$1=BigInt(1);const BN_MAX_UINT256=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function hexPadRight(value){const bytes=getBytes(value);const padOffset=bytes.length%32;if(padOffset){return concat([bytes,padding.slice(padOffset)])}return hexlify(bytes)}const hexTrue=toBeHex(BN_1$1,32);const hexFalse=toBeHex(BN_0$3,32);const domainFieldTypes={name:"string",version:"string",networkId:"uint256",verifyingContract:"address",salt:"bytes32"};const domainFieldNames=["name","version","networkId","verifyingContract","salt"];function checkString(key){return function(value){assertArgument(typeof value==="string",`invalid domain value for ${JSON.stringify(key)}`,`domain.${key}`,value);return value}}const domainChecks={name:checkString("name"),version:checkString("version"),networkId:function(_value){const value=getBigInt(_value,"domain.networkId");assertArgument(value>=0,"invalid chain ID","domain.networkId",_value);if(Number.isSafeInteger(value)){return Number(value)}return toQuantity(value)},verifyingContract:function(value){try{return getAddress(value).toLowerCase()}catch(error){}assertArgument(false,`invalid domain value "verifyingContract"`,"domain.verifyingContract",value)},salt:function(value){const bytes=getBytes(value,"domain.salt");assertArgument(bytes.length===32,`invalid domain value "salt"`,"domain.salt",value);return hexlify(bytes)}};function getBaseEncoder(type){{const match=type.match(/^(u?)int(\d*)$/);if(match){const signed=match[1]==="";const width=parseInt(match[2]||"256");assertArgument(width%8===0&&width!==0&&width<=256&&(match[2]==null||match[2]===String(width)),"invalid numeric width","type",type);const boundsUpper=mask(BN_MAX_UINT256,signed?width-1:width);const boundsLower=signed?(boundsUpper+BN_1$1)*BN__1:BN_0$3;return function(_value){const value=getBigInt(_value,"value");assertArgument(value>=boundsLower&&value<=boundsUpper,`value out-of-bounds for ${type}`,"value",value);return toBeHex(signed?toTwos(value,256):value,32)}}}{const match=type.match(/^bytes(\d+)$/);if(match){const width=parseInt(match[1]);assertArgument(width!==0&&width<=32&&match[1]===String(width),"invalid bytes width","type",type);return function(value){const bytes=getBytes(value);assertArgument(bytes.length===width,`invalid length for ${type}`,"value",value);return hexPadRight(value)}}}switch(type){case"address":return function(value){return zeroPadValue(getAddress(value),32)};case"bool":return function(value){return!value?hexFalse:hexTrue};case"bytes":return function(value){return sha256(value)};case"string":return function(value){return id(value)}}return null}function encodeType(name,fields){return`${name}(${fields.map(({name,type})=>type+" "+name).join(",")})`}class TypedDataEncoder{primaryType;#types;get types(){return JSON.parse(this.#types)}#fullTypes;#encoderCache;constructor(types){this.#types=JSON.stringify(types);this.#fullTypes=new Map;this.#encoderCache=new Map;const links=new Map;const parents=new Map;const subtypes=new Map;Object.keys(types).forEach(type=>{links.set(type,new Set);parents.set(type,[]);subtypes.set(type,new Set)});for(const name in types){const uniqueNames=new Set;for(const field of types[name]){assertArgument(!uniqueNames.has(field.name),`duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`,"types",types);uniqueNames.add(field.name);const baseType=field.type.match(/^([^\x5b]*)(\x5b|$)/)[1]||null;assertArgument(baseType!==name,`circular type reference to ${JSON.stringify(baseType)}`,"types",types);const encoder=getBaseEncoder(baseType);if(encoder){continue}assertArgument(parents.has(baseType),`unknown type ${JSON.stringify(baseType)}`,"types",types);parents.get(baseType).push(name);links.get(name).add(baseType)}}const primaryTypes=Array.from(parents.keys()).filter(n=>parents.get(n).length===0);assertArgument(primaryTypes.length!==0,"missing primary type","types",types);assertArgument(primaryTypes.length===1,`ambiguous primary types or unused types: ${primaryTypes.map(t=>JSON.stringify(t)).join(", ")}`,"types",types);defineProperties(this,{primaryType:primaryTypes[0]});function checkCircular(type,found){assertArgument(!found.has(type),`circular type reference to ${JSON.stringify(type)}`,"types",types);found.add(type);for(const child of links.get(type)){if(!parents.has(child)){continue}checkCircular(child,found);for(const subtype of found){subtypes.get(subtype).add(child)}}found.delete(type)}checkCircular(this.primaryType,new Set);for(const[name,set]of subtypes){const st=Array.from(set);st.sort();this.#fullTypes.set(name,encodeType(name,types[name])+st.map(t=>encodeType(t,types[t])).join(""))}}getEncoder(type){let encoder=this.#encoderCache.get(type);if(!encoder){encoder=this.#getEncoder(type);this.#encoderCache.set(type,encoder)}return encoder}#getEncoder(type){{const encoder=getBaseEncoder(type);if(encoder){return encoder}}const match=type.match(/^(.*)(\x5b(\d*)\x5d)$/);if(match){const subtype=match[1];const subEncoder=this.getEncoder(subtype);return value=>{assertArgument(!match[3]||parseInt(match[3])===value.length,`array length mismatch; expected length ${parseInt(match[3])}`,"value",value);let result=value.map(subEncoder);if(this.#fullTypes.has(subtype)){result=result.map(sha256)}return sha256(concat(result))}}const fields=this.types[type];if(fields){const encodedType=id(this.#fullTypes.get(type));return value=>{const values=fields.map(({name,type})=>{const result=this.getEncoder(type)(value[name]);if(this.#fullTypes.has(type)){return sha256(result)}return result});values.unshift(encodedType);return concat(values)}}assertArgument(false,`unknown type: ${type}`,"type",type)}encodeType(name){const result=this.#fullTypes.get(name);assertArgument(result,`unknown type: ${JSON.stringify(name)}`,"name",name);return result}encodeData(type,value){return this.getEncoder(type)(value)}hashStruct(name,value){return sha256(this.encodeData(name,value))}encode(value){return this.encodeData(this.primaryType,value)}hash(value){return this.hashStruct(this.primaryType,value)}_visit(type,value,callback){{const encoder=getBaseEncoder(type);if(encoder){return callback(type,value)}}const match=type.match(/^(.*)(\x5b(\d*)\x5d)$/);if(match){assertArgument(!match[3]||parseInt(match[3])===value.length,`array length mismatch; expected length ${parseInt(match[3])}`,"value",value);return value.map(v=>this._visit(match[1],v,callback))}const fields=this.types[type];if(fields){return fields.reduce((accum,{name,type})=>{accum[name]=this._visit(type,value[name],callback);return accum},{})}assertArgument(false,`unknown type: ${type}`,"type",type)}visit(value,callback){return this._visit(this.primaryType,value,callback)}static from(types){return new TypedDataEncoder(types)}static getPrimaryType(types){return TypedDataEncoder.from(types).primaryType}static hashStruct(name,types,value){return TypedDataEncoder.from(types).hashStruct(name,value)}static hashDomain(domain){const domainFields=[];for(const name in domain){if(domain[name]==null){continue}const type=domainFieldTypes[name];assertArgument(type,`invalid typed-data domain key: ${JSON.stringify(name)}`,"domain",domain);domainFields.push({name:name,type:type})}domainFields.sort((a,b)=>{return domainFieldNames.indexOf(a.name)-domainFieldNames.indexOf(b.name)});return TypedDataEncoder.hashStruct("EIP712Domain",{EIP712Domain:domainFields},domain)}static encode(domain,types,value){return concat(["0x1901",TypedDataEncoder.hashDomain(domain),TypedDataEncoder.from(types).hash(value)])}static hash(domain,types,value){return sha256(TypedDataEncoder.encode(domain,types,value))}static async resolveNames(domain,types,value,resolveName){domain=Object.assign({},domain);for(const key in domain){if(domain[key]==null){delete domain[key]}}const ensCache={};if(domain.verifyingContract&&!isHexString(domain.verifyingContract,20)){ensCache[domain.verifyingContract]="0x"}const encoder=TypedDataEncoder.from(types);encoder.visit(value,(type,value)=>{if(type==="address"&&!isHexString(value,20)){ensCache[value]="0x"}return value});for(const name in ensCache){ensCache[name]=await resolveName(name)}if(domain.verifyingContract&&ensCache[domain.verifyingContract]){domain.verifyingContract=ensCache[domain.verifyingContract]}value=encoder.visit(value,(type,value)=>{if(type==="address"&&ensCache[value]){return ensCache[value]}return value});return{domain:domain,value:value}}static getPayload(domain,types,value){TypedDataEncoder.hashDomain(domain);const domainValues={};const domainTypes=[];domainFieldNames.forEach(name=>{const value=domain[name];if(value==null){return}domainValues[name]=domainChecks[name](value);domainTypes.push({name:name,type:domainFieldTypes[name]})});const encoder=TypedDataEncoder.from(types);const typesWithDomain=Object.assign({},types);assertArgument(typesWithDomain.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",types);typesWithDomain.EIP712Domain=domainTypes;encoder.encode(value);return{types:typesWithDomain,domain:domainValues,primaryType:encoder.primaryType,message:encoder.visit(value,(type,value)=>{if(type.match(/^bytes(\d*)/)){return hexlify(getBytes(value))}if(type.match(/^u?int/)){return getBigInt(value).toString()}switch(type){case"address":return value.toLowerCase();case"bool":return!!value;case"string":assertArgument(typeof value==="string","invalid string","value",value);return value}assertArgument(false,"unsupported type","type",type)})}}}function verifyTypedData(domain,types,value,signature,prefix){return recoverAddress(TypedDataEncoder.hash(domain,types,value),signature,prefix)}var _a;function setify(items){const result=new Set;items.forEach(k=>result.add(k));return Object.freeze(result)}const _kwVisib="constant external internal payable private public pure view";const KwVisib=setify(_kwVisib.split(" "));const _kwTypes="constructor error event fallback function receive struct";const KwTypes=setify(_kwTypes.split(" "));const _kwModifiers="calldata memory storage payable indexed";const KwModifiers=setify(_kwModifiers.split(" "));const _kwOther="tuple returns";const _keywords=[_kwTypes,_kwModifiers,_kwOther,_kwVisib].join(" ");const Keywords=setify(_keywords.split(" "));const SimpleTokens={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"};const regexWhitespacePrefix=new RegExp("^(\\s*)");const regexNumberPrefix=new RegExp("^([0-9]+)");const regexIdPrefix=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)");const regexId=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$");const regexType=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class TokenString{#offset;#tokens;get offset(){return this.#offset}get length(){return this.#tokens.length-this.#offset}constructor(tokens){this.#offset=0;this.#tokens=tokens.slice()}clone(){return new _a(this.#tokens)}reset(){this.#offset=0}#subTokenString(from=0,to=0){return new _a(this.#tokens.slice(from,to).map(t=>{return Object.freeze(Object.assign({},t,{match:t.match-from,linkBack:t.linkBack-from,linkNext:t.linkNext-from}))}))}popKeyword(allowed){const top=this.peek();if(top.type!=="KEYWORD"||!allowed.has(top.text)){throw new Error(`expected keyword ${top.text}`)}return this.pop().text}popType(type){if(this.peek().type!==type){throw new Error(`expected ${type}; got ${JSON.stringify(this.peek())}`)}return this.pop().text}popParen(){const top=this.peek();if(top.type!=="OPEN_PAREN"){throw new Error("bad start")}const result=this.#subTokenString(this.#offset+1,top.match+1);this.#offset=top.match+1;return result}popParams(){const top=this.peek();if(top.type!=="OPEN_PAREN"){throw new Error("bad start")}const result=[];while(this.#offset=this.#tokens.length){throw new Error("out-of-bounds")}return this.#tokens[this.#offset]}peekKeyword(allowed){const top=this.peekType("KEYWORD");return top!=null&&allowed.has(top)?top:null}peekType(type){if(this.length===0){return null}const top=this.peek();return top.type===type?top.text:null}pop(){const result=this.peek();this.#offset++;return result}toString(){const tokens=[];for(let i=this.#offset;i`}}_a=TokenString;function lex(text){const tokens=[];const throwError=message=>{const token=offset0&&tokens[tokens.length-1].type==="NUMBER"){const value=tokens.pop().text;suffix=value+suffix;tokens[tokens.length-1].value=getNumber(value)}if(tokens.length===0||tokens[tokens.length-1].type!=="BRACKET"){throw new Error("missing opening bracket")}tokens[tokens.length-1].text+=suffix}continue}match=cur.match(regexIdPrefix);if(match){token.text=match[1];offset+=token.text.length;if(Keywords.has(token.text)){token.type="KEYWORD";continue}if(token.text.match(regexType)){token.type="TYPE";continue}token.type="ID";continue}match=cur.match(regexNumberPrefix);if(match){token.text=match[1];token.type="NUMBER";offset+=token.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`)}return new TokenString(tokens.map(t=>Object.freeze(t)))}function allowSingle(set,allowed){let included=[];for(const key in allowed.keys()){if(set.has(key)){included.push(key)}}if(included.length>1){throw new Error(`conflicting types: ${included.join(", ")}`)}}function consumeName(type,tokens){if(tokens.peekKeyword(KwTypes)){const keyword=tokens.pop().text;if(keyword!==type){throw new Error(`expected ${type}, got ${keyword}`)}}return tokens.popType("ID")}function consumeKeywords(tokens,allowed){const keywords=new Set;while(true){const keyword=tokens.peekType("KEYWORD");if(keyword==null||allowed&&!allowed.has(keyword)){break}tokens.pop();if(keywords.has(keyword)){throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`)}keywords.add(keyword)}return Object.freeze(keywords)}function consumeMutability(tokens){let modifiers=consumeKeywords(tokens,KwVisib);allowSingle(modifiers,setify("constant payable nonpayable".split(" ")));allowSingle(modifiers,setify("pure view payable nonpayable".split(" ")));if(modifiers.has("view")){return"view"}if(modifiers.has("pure")){return"pure"}if(modifiers.has("payable")){return"payable"}if(modifiers.has("nonpayable")){return"nonpayable"}if(modifiers.has("constant")){return"view"}return"nonpayable"}function consumeParams(tokens,allowIndexed){return tokens.popParams().map(t=>ParamType.from(t,allowIndexed))}function consumeEnergy(tokens){if(tokens.peekType("AT")){tokens.pop();if(tokens.peekType("NUMBER")){return getBigInt(tokens.pop().text)}throw new Error("invalid energy")}return null}function consumeEoi(tokens){if(tokens.length){throw new Error(`unexpected tokens: ${tokens.toString()}`)}}const regexArrayType=new RegExp(/^(.*)\[([0-9]*)\]$/);function verifyBasicType(type){const match=type.match(regexType);assertArgument(match,"invalid type","type",type);if(type==="uint"){return"uint256"}if(type==="int"){return"int256"}if(match[2]){const length=parseInt(match[2]);assertArgument(length!==0&&length<=32,"invalid bytes length","type",type)}else if(match[3]){const size=parseInt(match[3]);assertArgument(size!==0&&size<=256&&size%8===0,"invalid numeric width","type",type)}return type}const _guard$2={};const internal$1=Symbol.for("_corebc_internal");const ParamTypeInternal="_ParamTypeInternal";const ErrorFragmentInternal="_ErrorInternal";const EventFragmentInternal="_EventInternal";const ConstructorFragmentInternal="_ConstructorInternal";const FallbackFragmentInternal="_FallbackInternal";const FunctionFragmentInternal="_FunctionInternal";const StructFragmentInternal="_StructInternal";class ParamType{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(guard,name,type,baseType,indexed,components,arrayLength,arrayChildren){assertPrivate(guard,_guard$2,"ParamType");Object.defineProperty(this,internal$1,{value:ParamTypeInternal});if(components){components=Object.freeze(components.slice())}if(baseType==="array"){if(arrayLength==null||arrayChildren==null){throw new Error("")}}else if(arrayLength!=null||arrayChildren!=null){throw new Error("")}if(baseType==="tuple"){if(components==null){throw new Error("")}}else if(components!=null){throw new Error("")}defineProperties(this,{name:name,type:type,baseType:baseType,indexed:indexed,components:components,arrayLength:arrayLength,arrayChildren:arrayChildren})}format(format){if(format==null){format="sighash"}if(format==="json"){let result={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||undefined};if(typeof this.indexed==="boolean"){result.indexed=this.indexed}if(this.isTuple()){result.components=this.components.map(c=>JSON.parse(c.format(format)))}return JSON.stringify(result)}let result="";if(this.isArray()){result+=this.arrayChildren.format(format);result+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`}else{if(this.isTuple()){if(format!=="sighash"){result+=this.type}result+="("+this.components.map(comp=>comp.format(format)).join(format==="full"?", ":",")+")"}else{result+=this.type}}if(format!=="sighash"){if(this.indexed===true){result+=" indexed"}if(format==="full"&&this.name){result+=" "+this.name}}return result}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(value,process){if(this.isArray()){if(!Array.isArray(value)){throw new Error("invalid array value")}if(this.arrayLength!==-1&&value.length!==this.arrayLength){throw new Error("array is wrong length")}const _this=this;return value.map(v=>_this.arrayChildren.walk(v,process))}if(this.isTuple()){if(!Array.isArray(value)){throw new Error("invalid tuple value")}if(value.length!==this.components.length){throw new Error("array is wrong length")}const _this=this;return value.map((v,i)=>_this.components[i].walk(v,process))}return process(this.type,value)}#walkAsync(promises,value,process,setValue){if(this.isArray()){if(!Array.isArray(value)){throw new Error("invalid array value")}if(this.arrayLength!==-1&&value.length!==this.arrayLength){throw new Error("array is wrong length")}const childType=this.arrayChildren;const result=value.slice();result.forEach((value,index)=>{childType.#walkAsync(promises,value,process,value=>{result[index]=value})});setValue(result);return}if(this.isTuple()){const components=this.components;let result;if(Array.isArray(value)){result=value.slice()}else{if(value==null||typeof value!=="object"){throw new Error("invalid tuple value")}result=components.map(param=>{if(!param.name){throw new Error("cannot use object value with unnamed components")}if(!(param.name in value)){throw new Error(`missing value for component ${param.name}`)}return value[param.name]})}if(result.length!==this.components.length){throw new Error("array is wrong length")}result.forEach((value,index)=>{components[index].#walkAsync(promises,value,process,value=>{result[index]=value})});setValue(result);return}const result=process(this.type,value);if(result.then){promises.push(async function(){setValue(await result)}())}else{setValue(result)}}async walkAsync(value,process){const promises=[];const result=[value];this.#walkAsync(promises,value,process,value=>{result[0]=value});if(promises.length){await Promise.all(promises)}return result[0]}static from(obj,allowIndexed){if(ParamType.isParamType(obj)){return obj}if(typeof obj==="string"){return ParamType.from(lex(obj),allowIndexed)}else if(obj instanceof TokenString){let type="",baseType="";let comps=null;if(consumeKeywords(obj,setify(["tuple"])).has("tuple")||obj.peekType("OPEN_PAREN")){baseType="tuple";comps=obj.popParams().map(t=>ParamType.from(t));type=`tuple(${comps.map(c=>c.format()).join(",")})`}else{type=verifyBasicType(obj.popType("TYPE"));baseType=type}let arrayChildren=null;let arrayLength=null;while(obj.length&&obj.peekType("BRACKET")){const bracket=obj.pop();arrayChildren=new ParamType(_guard$2,"",type,baseType,null,comps,arrayLength,arrayChildren);arrayLength=bracket.value;type+=bracket.text;baseType="array";comps=null}let indexed=null;const keywords=consumeKeywords(obj,KwModifiers);if(keywords.has("indexed")){if(!allowIndexed){throw new Error("")}indexed=true}const name=obj.peekType("ID")?obj.pop().text:"";if(obj.length){throw new Error("leftover tokens")}return new ParamType(_guard$2,name,type,baseType,indexed,comps,arrayLength,arrayChildren)}const name=obj.name;assertArgument(!name||typeof name==="string"&&name.match(regexId),"invalid name","obj.name",name);let indexed=obj.indexed;if(indexed!=null){assertArgument(allowIndexed,"parameter cannot be indexed","obj.indexed",obj.indexed);indexed=!!indexed}let type=obj.type;let arrayMatch=type.match(regexArrayType);if(arrayMatch){const arrayLength=parseInt(arrayMatch[2]||"-1");const arrayChildren=ParamType.from({type:arrayMatch[1],components:obj.components});return new ParamType(_guard$2,name||"",type,"array",indexed,null,arrayLength,arrayChildren)}if(type==="tuple"||type.startsWith("tuple(")||type.startsWith("(")){const comps=obj.components!=null?obj.components.map(c=>ParamType.from(c)):null;const tuple=new ParamType(_guard$2,name||"",type,"tuple",indexed,comps,null,null);return tuple}type=verifyBasicType(obj.type);return new ParamType(_guard$2,name||"",type,type,indexed,null,null,null)}static isParamType(value){return value&&value[internal$1]===ParamTypeInternal}}class Fragment{type;inputs;constructor(guard,type,inputs){assertPrivate(guard,_guard$2,"Fragment");inputs=Object.freeze(inputs.slice());defineProperties(this,{type:type,inputs:inputs})}static from(obj){if(typeof obj==="string"){try{Fragment.from(JSON.parse(obj))}catch(e){}return Fragment.from(lex(obj))}if(obj instanceof TokenString){const type=obj.peekKeyword(KwTypes);switch(type){case"constructor":return ConstructorFragment.from(obj);case"error":return ErrorFragment.from(obj);case"event":return EventFragment.from(obj);case"fallback":case"receive":return FallbackFragment.from(obj);case"function":return FunctionFragment.from(obj);case"struct":return StructFragment.from(obj)}}else if(typeof obj==="object"){switch(obj.type){case"constructor":return ConstructorFragment.from(obj);case"error":return ErrorFragment.from(obj);case"event":return EventFragment.from(obj);case"fallback":case"receive":return FallbackFragment.from(obj);case"function":return FunctionFragment.from(obj);case"struct":return StructFragment.from(obj)}assert(false,`unsupported type: ${obj.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}assertArgument(false,"unsupported frgament object","obj",obj)}static isConstructor(value){return ConstructorFragment.isFragment(value)}static isError(value){return ErrorFragment.isFragment(value)}static isEvent(value){return EventFragment.isFragment(value)}static isFunction(value){return FunctionFragment.isFragment(value)}static isStruct(value){return StructFragment.isFragment(value)}}class NamedFragment extends Fragment{name;constructor(guard,type,name,inputs){super(guard,type,inputs);assertArgument(typeof name==="string"&&name.match(regexId),"invalid identifier","name",name);inputs=Object.freeze(inputs.slice());defineProperties(this,{name:name})}}function joinParams(format,params){return"("+params.map(p=>p.format(format)).join(format==="full"?", ":",")+")"}class ErrorFragment extends NamedFragment{constructor(guard,name,inputs){super(guard,"error",name,inputs);Object.defineProperty(this,internal$1,{value:ErrorFragmentInternal})}get selector(){return id(this.format("sighash")).substring(0,10)}format(format){if(format==null){format="sighash"}if(format==="json"){return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(input=>JSON.parse(input.format(format)))})}const result=[];if(format!=="sighash"){result.push("error")}result.push(this.name+joinParams(format,this.inputs));return result.join(" ")}static from(obj){if(ErrorFragment.isFragment(obj)){return obj}if(typeof obj==="string"){return ErrorFragment.from(lex(obj))}else if(obj instanceof TokenString){const name=consumeName("error",obj);const inputs=consumeParams(obj);consumeEoi(obj);return new ErrorFragment(_guard$2,name,inputs)}return new ErrorFragment(_guard$2,obj.name,obj.inputs?obj.inputs.map(ParamType.from):[])}static isFragment(value){return value&&value[internal$1]===ErrorFragmentInternal}}class EventFragment extends NamedFragment{anonymous;constructor(guard,name,inputs,anonymous){super(guard,"event",name,inputs);Object.defineProperty(this,internal$1,{value:EventFragmentInternal});defineProperties(this,{anonymous:anonymous})}get topicHash(){return id(this.format("sighash"))}format(format){if(format==null){format="sighash"}if(format==="json"){return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(format)))})}const result=[];if(format!=="sighash"){result.push("event")}result.push(this.name+joinParams(format,this.inputs));if(format!=="sighash"&&this.anonymous){result.push("anonymous")}return result.join(" ")}static getTopicHash(name,params){params=(params||[]).map(p=>ParamType.from(p));const fragment=new EventFragment(_guard$2,name,params,false);return fragment.topicHash}static from(obj){if(EventFragment.isFragment(obj)){return obj}if(typeof obj==="string"){return EventFragment.from(lex(obj))}else if(obj instanceof TokenString){const name=consumeName("event",obj);const inputs=consumeParams(obj,true);const anonymous=!!consumeKeywords(obj,setify(["anonymous"])).has("anonymous");consumeEoi(obj);return new EventFragment(_guard$2,name,inputs,anonymous)}return new EventFragment(_guard$2,obj.name,obj.inputs?obj.inputs.map(p=>ParamType.from(p,true)):[],!!obj.anonymous)}static isFragment(value){return value&&value[internal$1]===EventFragmentInternal}}class ConstructorFragment extends Fragment{payable;energy;constructor(guard,type,inputs,payable,energy){super(guard,type,inputs);Object.defineProperty(this,internal$1,{value:ConstructorFragmentInternal});defineProperties(this,{payable:payable,energy:energy})}format(format){assert(format!=null&&format!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"});if(format==="json"){return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,energy:this.energy!=null?this.energy:undefined,inputs:this.inputs.map(i=>JSON.parse(i.format(format)))})}const result=[`constructor${joinParams(format,this.inputs)}`];result.push(this.payable?"payable":"nonpayable");if(this.energy!=null){result.push(`@${this.energy.toString()}`)}return result.join(" ")}static from(obj){if(ConstructorFragment.isFragment(obj)){return obj}if(typeof obj==="string"){return ConstructorFragment.from(lex(obj))}else if(obj instanceof TokenString){consumeKeywords(obj,setify(["constructor"]));const inputs=consumeParams(obj);const payable=!!consumeKeywords(obj,setify(["payable"])).has("payable");const energy=consumeEnergy(obj);consumeEoi(obj);return new ConstructorFragment(_guard$2,"constructor",inputs,payable,energy)}return new ConstructorFragment(_guard$2,"constructor",obj.inputs?obj.inputs.map(ParamType.from):[],!!obj.payable,obj.energy!=null?obj.energy:null)}static isFragment(value){return value&&value[internal$1]===ConstructorFragmentInternal}}class FallbackFragment extends Fragment{payable;constructor(guard,inputs,payable){super(guard,"fallback",inputs);Object.defineProperty(this,internal$1,{value:FallbackFragmentInternal});defineProperties(this,{payable:payable})}format(format){const type=this.inputs.length===0?"receive":"fallback";if(format==="json"){const stateMutability=this.payable?"payable":"nonpayable";return JSON.stringify({type:type,stateMutability:stateMutability})}return`${type}()${this.payable?" payable":""}`}static from(obj){if(FallbackFragment.isFragment(obj)){return obj}if(typeof obj==="string"){return FallbackFragment.from(lex(obj))}else if(obj instanceof TokenString){const errorObj=obj.toString();const topIsValid=obj.peekKeyword(setify(["fallback","receive"]));assertArgument(topIsValid,"type must be fallback or receive","obj",errorObj);const type=obj.popKeyword(setify(["fallback","receive"]));if(type==="receive"){const inputs=consumeParams(obj);assertArgument(inputs.length===0,`receive cannot have arguments`,"obj.inputs",inputs);consumeKeywords(obj,setify(["payable"]));consumeEoi(obj);return new FallbackFragment(_guard$2,[],true)}let inputs=consumeParams(obj);if(inputs.length){assertArgument(inputs.length===1&&inputs[0].type==="bytes","invalid fallback inputs","obj.inputs",inputs.map(i=>i.format("minimal")).join(", "))}else{inputs=[ParamType.from("bytes")]}const mutability=consumeMutability(obj);assertArgument(mutability==="nonpayable"||mutability==="payable","fallback cannot be constants","obj.stateMutability",mutability);if(consumeKeywords(obj,setify(["returns"])).has("returns")){const outputs=consumeParams(obj);assertArgument(outputs.length===1&&outputs[0].type==="bytes","invalid fallback outputs","obj.outputs",outputs.map(i=>i.format("minimal")).join(", "))}consumeEoi(obj);return new FallbackFragment(_guard$2,inputs,mutability==="payable")}if(obj.type==="receive"){return new FallbackFragment(_guard$2,[],true)}if(obj.type==="fallback"){const inputs=[ParamType.from("bytes")];const payable=obj.stateMutability==="payable";return new FallbackFragment(_guard$2,inputs,payable)}assertArgument(false,"invalid fallback description","obj",obj)}static isFragment(value){return value&&value[internal$1]===FallbackFragmentInternal}}class FunctionFragment extends NamedFragment{constant;outputs;stateMutability;payable;energy;constructor(guard,name,stateMutability,inputs,outputs,energy){super(guard,"function",name,inputs);Object.defineProperty(this,internal$1,{value:FunctionFragmentInternal});outputs=Object.freeze(outputs.slice());const constant=stateMutability==="view"||stateMutability==="pure";const payable=stateMutability==="payable";defineProperties(this,{constant:constant,energy:energy,outputs:outputs,payable:payable,stateMutability:stateMutability})}get selector(){return id(this.format("sighash")).substring(0,10)}format(format){if(format==null){format="sighash"}if(format==="json"){return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:undefined,payable:this.payable,energy:this.energy!=null?this.energy:undefined,inputs:this.inputs.map(i=>JSON.parse(i.format(format))),outputs:this.outputs.map(o=>JSON.parse(o.format(format)))})}const result=[];if(format!=="sighash"){result.push("function")}result.push(this.name+joinParams(format,this.inputs));if(format!=="sighash"){if(this.stateMutability!=="nonpayable"){result.push(this.stateMutability)}if(this.outputs&&this.outputs.length){result.push("returns");result.push(joinParams(format,this.outputs))}if(this.energy!=null){result.push(`@${this.energy.toString()}`)}}return result.join(" ")}static getSelector(name,params){params=(params||[]).map(p=>ParamType.from(p));const fragment=new FunctionFragment(_guard$2,name,"view",params,[],null);return fragment.selector}static from(obj){if(FunctionFragment.isFragment(obj)){return obj}if(typeof obj==="string"){return FunctionFragment.from(lex(obj))}else if(obj instanceof TokenString){const name=consumeName("function",obj);const inputs=consumeParams(obj);const mutability=consumeMutability(obj);let outputs=[];if(consumeKeywords(obj,setify(["returns"])).has("returns")){outputs=consumeParams(obj)}const energy=consumeEnergy(obj);consumeEoi(obj);return new FunctionFragment(_guard$2,name,mutability,inputs,outputs,energy)}let stateMutability=obj.stateMutability;if(stateMutability==null){stateMutability="payable";if(typeof obj.constant==="boolean"){stateMutability="view";if(!obj.constant){stateMutability="payable";if(typeof obj.payable==="boolean"&&!obj.payable){stateMutability="nonpayable"}}}else if(typeof obj.payable==="boolean"&&!obj.payable){stateMutability="nonpayable"}}return new FunctionFragment(_guard$2,obj.name,stateMutability,obj.inputs?obj.inputs.map(ParamType.from):[],obj.outputs?obj.outputs.map(ParamType.from):[],obj.energy!=null?obj.energy:null)}static isFragment(value){return value&&value[internal$1]===FunctionFragmentInternal}}class StructFragment extends NamedFragment{constructor(guard,name,inputs){super(guard,"struct",name,inputs);Object.defineProperty(this,internal$1,{value:StructFragmentInternal})}format(){throw new Error("@TODO")}static from(obj){if(typeof obj==="string"){return StructFragment.from(lex(obj))}else if(obj instanceof TokenString){const name=consumeName("struct",obj);const inputs=consumeParams(obj);consumeEoi(obj);return new StructFragment(_guard$2,name,inputs)}return new StructFragment(_guard$2,obj.name,obj.inputs?obj.inputs.map(ParamType.from):[])}static isFragment(value){return value&&value[internal$1]===StructFragmentInternal}}const PanicReasons$1=new Map;PanicReasons$1.set(0,"GENERIC_PANIC");PanicReasons$1.set(1,"ASSERT_FALSE");PanicReasons$1.set(17,"OVERFLOW");PanicReasons$1.set(18,"DIVIDE_BY_ZERO");PanicReasons$1.set(33,"ENUM_RANGE_ERROR");PanicReasons$1.set(34,"BAD_STORAGE_DATA");PanicReasons$1.set(49,"STACK_UNDERFLOW");PanicReasons$1.set(50,"ARRAY_RANGE_ERROR");PanicReasons$1.set(65,"OUT_OF_MEMORY");PanicReasons$1.set(81,"UNINITIALIZED_FUNCTION_CALL");const paramTypeBytes=new RegExp(/^bytes([0-9]*)$/);const paramTypeNumber=new RegExp(/^(u?int)([0-9]*)$/);let defaultCoder=null;function getBuiltinCallException(action,tx,data,abiCoder){let message="missing revert data";let reason=null;const invocation=null;let revert=null;if(data){message="execution reverted";const bytes=getBytes(data);data=hexlify(data);if(bytes.length===0){message+=" (no data present; likely require(false) occurred";reason="require(false)"}else if(bytes.length%32!==4){message+=" (could not decode reason; invalid data length)"}else if(hexlify(bytes.slice(0,4))==="0x08c379a0"){try{reason=abiCoder.decode(["string"],bytes.slice(4))[0];revert={signature:"Error(string)",name:"Error",args:[reason]};message+=`: ${JSON.stringify(reason)}`}catch(error){message+=" (could not decode reason; invalid string data)"}}else if(hexlify(bytes.slice(0,4))==="0x4e487b71"){try{const code=Number(abiCoder.decode(["uint256"],bytes.slice(4))[0]);revert={signature:"Panic(uint256)",name:"Panic",args:[code]};reason=`Panic due to ${PanicReasons$1.get(code)||"UNKNOWN"}(${code})`;message+=`: ${reason}`}catch(error){message+=" (could not decode panic code)"}}else{message+=" (unknown custom error)"}}const transaction={to:tx.to?getAddress(tx.to):null,data:tx.data||"0x"};if(tx.from){transaction.from=getAddress(tx.from)}return makeError(message,"CALL_EXCEPTION",{action:action,data:data,reason:reason,transaction:transaction,invocation:invocation,revert:revert})}class AbiCoder{#getCoder(param){if(param.isArray()){return new ArrayCoder(this.#getCoder(param.arrayChildren),param.arrayLength,param.name)}if(param.isTuple()){return new TupleCoder(param.components.map(c=>this.#getCoder(c)),param.name)}switch(param.baseType){case"address":return new AddressCoder(param.name);case"bool":return new BooleanCoder(param.name);case"string":return new StringCoder(param.name);case"bytes":return new BytesCoder(param.name);case"":return new NullCoder(param.name)}let match=param.type.match(paramTypeNumber);if(match){let size=parseInt(match[2]||"256");assertArgument(size!==0&&size<=256&&size%8===0,"invalid "+match[1]+" bit length","param",param);return new NumberCoder(size/8,match[1]==="int",param.name)}match=param.type.match(paramTypeBytes);if(match){let size=parseInt(match[1]);assertArgument(size!==0&&size<=32,"invalid bytes length","param",param);return new FixedBytesCoder(size,param.name)}assertArgument(false,"invalid type","type",param.type)}getDefaultValue(types){const coders=types.map(type=>this.#getCoder(ParamType.from(type)));const coder=new TupleCoder(coders,"_");return coder.defaultValue()}encode(types,values){assertArgumentCount(values.length,types.length,"types/values length mismatch");const coders=types.map(type=>this.#getCoder(ParamType.from(type)));const coder=new TupleCoder(coders,"_");const writer=new Writer;coder.encode(writer,values);return writer.data}decode(types,data,loose){const coders=types.map(type=>this.#getCoder(ParamType.from(type)));const coder=new TupleCoder(coders,"_");return coder.decode(new Reader(data,loose))}static defaultAbiCoder(){if(defaultCoder==null){defaultCoder=new AbiCoder}return defaultCoder}static getBuiltinCallException(action,tx,data){return getBuiltinCallException(action,tx,data,AbiCoder.defaultAbiCoder())}}function encodeBytes32String(text){const bytes=toUtf8Bytes(text);if(bytes.length>31){throw new Error("bytes32 string must be less than 32 bytes")}return zeroPadBytes(bytes,32)}function decodeBytes32String(_bytes){const data=getBytes(_bytes,"bytes");if(data.length!==32){throw new Error("invalid bytes32 - not 32 bytes long")}if(data[31]!==0){throw new Error("invalid bytes32 string - no null terminator")}let length=31;while(data[length-1]===0){length--}return toUtf8String(data.slice(0,length))}class LogDescription{fragment;name;signature;topic;args;constructor(fragment,topic,args){const name=fragment.name,signature=fragment.format();defineProperties(this,{fragment:fragment,name:name,signature:signature,topic:topic,args:args})}}class TransactionDescription{fragment;name;args;signature;selector;value;constructor(fragment,selector,args,value){const name=fragment.name,signature=fragment.format();defineProperties(this,{fragment:fragment,name:name,args:args,signature:signature,selector:selector,value:value})}}class ErrorDescription{fragment;name;args;signature;selector;constructor(fragment,selector,args){const name=fragment.name,signature=fragment.format();defineProperties(this,{fragment:fragment,name:name,args:args,signature:signature,selector:selector})}}class Indexed{hash;_isIndexed;static isIndexed(value){return!!(value&&value._isIndexed)}constructor(hash){defineProperties(this,{hash:hash,_isIndexed:true})}}const PanicReasons={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"};const BuiltinErrors={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:message=>{return`reverted with reason string ${JSON.stringify(message)}`}},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:code=>{let reason="unknown panic code";if(code>=0&&code<=255&&PanicReasons[code.toString()]){reason=PanicReasons[code.toString()]}return`reverted with panic code 0x${code.toString(16)} (${reason})`}}};class Interface{fragments;deploy;fallback;receive;#errors;#events;#functions;#abiCoder;constructor(fragments){let abi=[];if(typeof fragments==="string"){abi=JSON.parse(fragments)}else{abi=fragments}this.#functions=new Map;this.#errors=new Map;this.#events=new Map;const frags=[];for(const a of abi){try{frags.push(Fragment.from(a))}catch(error){console.log("EE",error)}}defineProperties(this,{fragments:Object.freeze(frags)});let fallback=null;let receive=false;this.#abiCoder=this.getAbiCoder();this.fragments.forEach((fragment,index)=>{let bucket;switch(fragment.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}defineProperties(this,{deploy:fragment});return;case"fallback":if(fragment.inputs.length===0){receive=true}else{assertArgument(!fallback||fragment.payable!==fallback.payable,"conflicting fallback fragments",`fragments[${index}]`,fragment);fallback=fragment;receive=fallback.payable}return;case"function":bucket=this.#functions;break;case"event":bucket=this.#events;break;case"error":bucket=this.#errors;break;default:return}const signature=fragment.format();if(bucket.has(signature)){return}bucket.set(signature,fragment)});if(!this.deploy){defineProperties(this,{deploy:ConstructorFragment.from("constructor()")})}defineProperties(this,{fallback:fallback,receive:receive})}format(minimal){const format=minimal?"minimal":"full";const abi=this.fragments.map(f=>f.format(format));return abi}formatJson(){const abi=this.fragments.map(f=>f.format("json"));return JSON.stringify(abi.map(j=>JSON.parse(j)))}getAbiCoder(){return AbiCoder.defaultAbiCoder()}#getFunction(key,values,forceUnique){if(isHexString(key)){const selector=key.toLowerCase();for(const fragment of this.#functions.values()){if(selector===fragment.selector){return fragment}}return null}if(key.indexOf("(")===-1){const matching=[];for(const[name,fragment]of this.#functions){if(name.split("(")[0]===key){matching.push(fragment)}}if(values){const lastValue=values.length>0?values[values.length-1]:null;let valueLength=values.length;let allowOptions=true;if(Typed.isTyped(lastValue)&&lastValue.type==="overrides"){allowOptions=false;valueLength--}for(let i=matching.length-1;i>=0;i--){const inputs=matching[i].inputs.length;if(inputs!==valueLength&&(!allowOptions||inputs!==valueLength-1)){matching.splice(i,1)}}for(let i=matching.length-1;i>=0;i--){const inputs=matching[i].inputs;for(let j=0;j=inputs.length){if(values[j].type==="overrides"){continue}matching.splice(i,1);break}if(values[j].type!==inputs[j].baseType){matching.splice(i,1);break}}}}if(matching.length===1&&values&&values.length!==matching[0].inputs.length){const lastArg=values[values.length-1];if(lastArg==null||Array.isArray(lastArg)||typeof lastArg!=="object"){matching.splice(0,1)}}if(matching.length===0){return null}if(matching.length>1&&forceUnique){const matchStr=matching.map(m=>JSON.stringify(m.format())).join(", ");assertArgument(false,`ambiguous function description (i.e. matches ${matchStr})`,"key",key)}return matching[0]}const result=this.#functions.get(FunctionFragment.from(key).format());if(result){return result}return null}getFunctionName(key){const fragment=this.#getFunction(key,null,false);assertArgument(fragment,"no matching function","key",key);return fragment.name}hasFunction(key){return!!this.#getFunction(key,null,false)}getFunction(key,values){return this.#getFunction(key,values||null,true)}forEachFunction(callback){const names=Array.from(this.#functions.keys());names.sort((a,b)=>a.localeCompare(b));for(let i=0;i=0;i--){if(matching[i].inputs.length=0;i--){const inputs=matching[i].inputs;for(let j=0;j1&&forceUnique){const matchStr=matching.map(m=>JSON.stringify(m.format())).join(", ");assertArgument(false,`ambiguous event description (i.e. matches ${matchStr})`,"key",key)}return matching[0]}const result=this.#events.get(EventFragment.from(key).format());if(result){return result}return null}getEventName(key){const fragment=this.#getEvent(key,null,false);assertArgument(fragment,"no matching event","key",key);return fragment.name}hasEvent(key){return!!this.#getEvent(key,null,false)}getEvent(key,values){return this.#getEvent(key,values||null,true)}forEachEvent(callback){const names=Array.from(this.#events.keys());names.sort((a,b)=>a.localeCompare(b));for(let i=0;i1){const matchStr=matching.map(m=>JSON.stringify(m.format())).join(", ");assertArgument(false,`ambiguous error description (i.e. ${matchStr})`,"name",key)}return matching[0]}key=ErrorFragment.from(key).format();if(key==="Error(string)"){return ErrorFragment.from("error Error(string)")}if(key==="Panic(uint256)"){return ErrorFragment.from("error Panic(uint256)")}const result=this.#errors.get(key);if(result){return result}return null}forEachError(callback){const names=Array.from(this.#errors.keys());names.sort((a,b)=>a.localeCompare(b));for(let i=0;i{if(param.type==="string"){return id(value)}else if(param.type==="bytes"){return sha256(hexlify(value))}if(param.type==="bool"&&typeof value==="boolean"){value=value?"0x01":"0x00"}if(param.type.match(/^u?int/)){value=toBeHex(value)}if(param.type==="address"){this.#abiCoder.encode(["address"],[value])}return zeroPadValue(hexlify(value),32)};values.forEach((value,index)=>{const param=fragment.inputs[index];if(!param.indexed){assertArgument(value==null,"cannot filter non-indexed parameters; must be null","contract."+param.name,value);return}if(value==null){topics.push(null)}else if(param.baseType==="array"||param.baseType==="tuple"){assertArgument(false,"filtering with tuples or arrays not supported","contract."+param.name,value)}else if(Array.isArray(value)){topics.push(value.map(value=>encodeTopic(param,value)))}else{topics.push(encodeTopic(param,value))}});while(topics.length&&topics[topics.length-1]===null){topics.pop()}return topics}encodeEventLog(fragment,values){if(typeof fragment==="string"){const f=this.getEvent(fragment);assertArgument(f,"unknown event","eventFragment",fragment);fragment=f}const topics=[];const dataTypes=[];const dataValues=[];if(!fragment.anonymous){topics.push(fragment.topicHash)}assertArgument(values.length===fragment.inputs.length,"event arguments/values mismatch","values",values);fragment.inputs.forEach((param,index)=>{const value=values[index];if(param.indexed){if(param.type==="string"){topics.push(id(value))}else if(param.type==="bytes"){topics.push(sha256(value))}else if(param.baseType==="tuple"||param.baseType==="array"){throw new Error("not implemented")}else{topics.push(this.#abiCoder.encode([param.type],[value]))}}else{dataTypes.push(param);dataValues.push(value)}});return{data:this.#abiCoder.encode(dataTypes,dataValues),topics:topics}}decodeEventLog(fragment,data,topics){if(typeof fragment==="string"){const f=this.getEvent(fragment);assertArgument(f,"unknown event","eventFragment",fragment);fragment=f}if(topics!=null&&!fragment.anonymous){const eventTopic=fragment.topicHash;assertArgument(isHexString(topics[0],32)&&topics[0].toLowerCase()===eventTopic,"fragment/topic mismatch","topics[0]",topics[0]);topics=topics.slice(1)}const indexed=[];const nonIndexed=[];const dynamic=[];fragment.inputs.forEach((param,index)=>{if(param.indexed){if(param.type==="string"||param.type==="bytes"||param.baseType==="tuple"||param.baseType==="array"){indexed.push(ParamType.from({type:"bytes32",name:param.name}));dynamic.push(true)}else{indexed.push(param);dynamic.push(false)}}else{nonIndexed.push(param);dynamic.push(false)}});const resultIndexed=topics!=null?this.#abiCoder.decode(indexed,concat(topics)):null;const resultNonIndexed=this.#abiCoder.decode(nonIndexed,data,true);const values=[];const keys=[];let nonIndexedIndex=0,indexedIndex=0;fragment.inputs.forEach((param,index)=>{let value=null;if(param.indexed){if(resultIndexed==null){value=new Indexed(null)}else if(dynamic[index]){value=new Indexed(resultIndexed[indexedIndex++])}else{try{value=resultIndexed[indexedIndex++]}catch(error){value=error}}}else{try{value=resultNonIndexed[nonIndexedIndex++]}catch(error){value=error}}values.push(value);keys.push(param.name||null)});return Result.fromItems(values,keys)}parseTransaction(tx){const data=getBytes(tx.data,"tx.data");const value=getBigInt(tx.value!=null?tx.value:0,"tx.value");const fragment=this.getFunction(hexlify(data.slice(0,4)));if(!fragment){return null}const args=this.#abiCoder.decode(fragment.inputs,data.slice(4));return new TransactionDescription(fragment,fragment.selector,args,value)}parseCallResult(data){throw new Error("@TODO")}parseLog(log){const fragment=this.getEvent(log.topics[0]);if(!fragment||fragment.anonymous){return null}return new LogDescription(fragment,fragment.topicHash,this.decodeEventLog(fragment,log.data,log.topics))}parseError(data){const hexData=hexlify(data);const fragment=this.getError(dataSlice(hexData,0,4));if(!fragment){return null}const args=this.#abiCoder.decode(fragment.inputs,dataSlice(hexData,4));return new ErrorDescription(fragment,fragment.selector,args)}static from(value){if(value instanceof Interface){return value}if(typeof value==="string"){return new Interface(JSON.parse(value))}if(typeof value.format==="function"){return new Interface(value.format("json"))}return new Interface(value)}}const logger=new Logger("contract-address/0.0.1");function getCreateAddress(tx){const from=getAddress(tx.from);const nonce=getBigInt(tx.nonce,"tx.nonce");let nonceHex=nonce.toString(16);if(nonceHex==="0"){nonceHex="0x"}else if(nonceHex.length%2){nonceHex="0x0"+nonceHex}else{nonceHex="0x"+nonceHex}return getAddress(from)}function getCreate2Address(from,salt,initCodeHash){if(hexDataLength(salt)!==32){logger.throwArgumentError("salt must be 32 bytes","salt",salt)}if(hexDataLength(initCodeHash)!==32){logger.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",initCodeHash)}const val=hexDataSlice(sha256(concat(["0xff",getAddress(from),salt,initCodeHash])),12);console.log({"contract-address/74=>should be string":val});const prefix=from.substring(2,4);const checksum=calculateCheckSum(val,prefix);return"0x"+prefix+checksum+removeHexPrefix(val)}function isAddressable(value){return value&&typeof value.getAddress==="function"}function isAddress(value){try{getAddress(value);return true}catch(error){}return false}async function checkAddress(target,promise){const result=await promise;if(result==null||result==="0x0000000000000000000000000000000000000000"){assert(typeof target!=="string","unconfigured name","UNCONFIGURED_NAME",{value:target});assertArgument(false,"invalid AddressLike value; did not resolve to a value address","target",target)}return getAddress(result)}function resolveAddress(target){if(typeof target==="string"){return getAddress(target)}else if(isAddressable(target)){return checkAddress(target,target.getAddress())}else if(target&&typeof target.then==="function"){return checkAddress(target,target)}assertArgument(false,"unsupported addressable value","target",target)}const BN_0$2=BigInt(0);function getValue(value){if(value==null){return null}return value}function toJson(value){if(value==null){return null}return value.toString()}class FeeData{energyPrice;constructor(energyPrice){defineProperties(this,{energyPrice:getValue(energyPrice)})}toJSON(){const{energyPrice}=this;return{_type:"FeeData",energyPrice:toJson(energyPrice)}}}function copyRequest(req){const result={};if(req.to){result.to=req.to}if(req.from){result.from=req.from}if(req.data){result.data=hexlify(req.data)}const bigIntKeys="networkId,energyLimit,energyPrice,value".split(/,/);for(const key of bigIntKeys){if(!(key in req)||req[key]==null){continue}result[key]=getBigInt(req[key],`request.${key}`)}const numberKeys="type,nonce".split(/,/);for(const key of numberKeys){if(!(key in req)||req[key]==null){continue}result[key]=getNumber(req[key],`request.${key}`)}if("blockTag"in req){result.blockTag=req.blockTag}if("enableCcipRead"in req){result.enableCcipReadEnabled=!!req.enableCcipRead}if("customData"in req){result.customData=req.customData}return result}class Block{provider;number;hash;timestamp;parentHash;nonce;difficulty;energyLimit;energyUsed;miner;extraData;baseFeePerEnergy;#transactions;constructor(block,provider){this.#transactions=block.transactions.map(tx=>{if(typeof tx!=="string"){return new TransactionResponse(tx,provider)}return tx});defineProperties(this,{provider:provider,hash:getValue(block.hash),number:block.number,timestamp:block.timestamp,parentHash:block.parentHash,nonce:block.nonce,difficulty:block.difficulty,energyLimit:block.energyLimit,energyUsed:block.energyUsed,miner:block.miner,extraData:block.extraData,baseFeePerEnergy:getValue(block.baseFeePerEnergy)})}get transactions(){return this.#transactions.map(tx=>{if(typeof tx==="string"){return tx}return tx.hash})}get prefetchedTransactions(){const txs=this.#transactions.slice();if(txs.length===0){return[]}assert(typeof txs[0]==="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"});return txs}toJSON(){const{baseFeePerEnergy,difficulty,extraData,energyLimit,energyUsed,hash,miner,nonce,number,parentHash,timestamp,transactions}=this;return{_type:"Block",baseFeePerEnergy:toJson(baseFeePerEnergy),difficulty:toJson(difficulty),extraData:extraData,energyLimit:toJson(energyLimit),energyUsed:toJson(energyUsed),hash:hash,miner:miner,nonce:nonce,number:number,parentHash:parentHash,timestamp:timestamp,transactions:transactions}}[Symbol.iterator](){let index=0;const txs=this.transactions;return{next:()=>{if(index{return new Log(log,provider)}));defineProperties(this,{provider:provider,to:tx.to,from:tx.from,contractAddress:tx.contractAddress,hash:tx.hash,index:tx.index,blockHash:tx.blockHash,blockNumber:tx.blockNumber,logsBloom:tx.logsBloom,energyUsed:tx.energyUsed,cumulativeEnergyUsed:tx.cumulativeEnergyUsed,energyPrice:tx.effectiveEnergyPrice||tx.energyPrice,status:tx.status,root:tx.root})}get logs(){return this.#logs}toJSON(){const{to,from,contractAddress,hash,index,blockHash,blockNumber,logsBloom,logs,status,root}=this;return{_type:"TransactionReceipt",blockHash:blockHash,blockNumber:blockNumber,contractAddress:contractAddress,cumulativeEnergyUsed:toJson(this.cumulativeEnergyUsed),from:from,energyPrice:toJson(this.energyPrice),energyUsed:toJson(this.energyUsed),hash:hash,index:index,logs:logs,logsBloom:logsBloom,root:root,status:status,to:to}}get length(){return this.logs.length}[Symbol.iterator](){let index=0;return{next:()=>{if(index{if(stopScanning){return null}const{blockNumber,nonce}=await resolveProperties({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(nonce=confirms){return receipt}}else{await checkReplacement();if(confirms===0){return null}}const waiter=new Promise((resolve,reject)=>{const cancellers=[];const cancel=()=>{cancellers.forEach(c=>c())};cancellers.push(()=>{stopScanning=true});if(timeout>0){const timer=setTimeout(()=>{cancel();reject(makeError("wait for transaction timeout","TIMEOUT"))},timeout);cancellers.push(()=>{clearTimeout(timer)})}const txListener=async receipt=>{if(await receipt.confirmations()>=confirms){cancel();resolve(receipt)}};cancellers.push(()=>{this.provider.off(this.hash,txListener)});this.provider.on(this.hash,txListener);if(startBlock>=0){const replaceListener=async()=>{try{await checkReplacement()}catch(error){if(isError(error,"TRANSACTION_REPLACED")){cancel();reject(error);return}}if(!stopScanning){this.provider.once("block",replaceListener)}};cancellers.push(()=>{this.provider.off("block",replaceListener)});this.provider.once("block",replaceListener)}});return await waiter}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}removedEvent(){assert(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"});return createRemovedTransactionFilter(this)}reorderedEvent(other){assert(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"});assert(!other||other.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"});return createReorderedTransactionFilter(this,other)}replaceableTransaction(startBlock){assertArgument(Number.isInteger(startBlock)&&startBlock>=0,"invalid startBlock","startBlock",startBlock);const tx=new TransactionResponse(this,this.provider);tx.#startBlock=startBlock;return tx}}function createOrphanedBlockFilter(block){return{orphan:"drop-block",hash:block.hash,number:block.number}}function createReorderedTransactionFilter(tx,other){return{orphan:"reorder-transaction",tx:tx,other:other}}function createRemovedTransactionFilter(tx){return{orphan:"drop-transaction",tx:tx}}function createRemovedLogFilter(log){return{orphan:"drop-log",log:{transactionHash:log.transactionHash,blockHash:log.blockHash,blockNumber:log.blockNumber,address:log.address,data:log.data,topics:Object.freeze(log.topics.slice()),index:log.index}}}class EventLog extends Log{interface;fragment;args;constructor(log,iface,fragment){super(log,log.provider);const args=iface.decodeEventLog(fragment,log.data,log.topics);defineProperties(this,{args:args,fragment:fragment,interface:iface})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class ContractTransactionReceipt extends TransactionReceipt{#iface;constructor(iface,provider,tx){super(tx,provider);this.#iface=iface}get logs(){return super.logs.map(log=>{const fragment=log.topics.length?this.#iface.getEvent(log.topics[0]):null;if(fragment){return new EventLog(log,this.#iface,fragment)}else{return log}})}}class ContractTransactionResponse extends TransactionResponse{#iface;constructor(iface,provider,tx){super(tx,provider);this.#iface=iface}async wait(confirms){const receipt=await super.wait();if(receipt==null){return null}return new ContractTransactionReceipt(this.#iface,this.provider,receipt)}}class ContractUnknownEventPayload extends EventPayload{log;constructor(contract,listener,filter,log){super(contract,listener,filter);defineProperties(this,{log:log})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class ContractEventPayload extends ContractUnknownEventPayload{constructor(contract,listener,filter,fragment,_log){super(contract,listener,filter,new EventLog(_log,contract.interface,fragment));const args=contract.interface.decodeEventLog(fragment,this.log.data,this.log.topics);defineProperties(this,{args:args,fragment:fragment})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const BN_0$1=BigInt(0);function canCall(value){return value&&typeof value.call==="function"}function canEstimate(value){return value&&typeof value.estimateEnergy==="function"}function canResolve(value){return value&&typeof value.resolveName==="function"}function canSend(value){return value&&typeof value.sendTransaction==="function"}class PreparedTopicFilter{#filter;fragment;constructor(contract,fragment,args){defineProperties(this,{fragment:fragment});if(fragment.inputs.length{const arg=args[index];if(arg==null){return null}return param.walkAsync(args[index],(type,value)=>{if(type==="address"){return resolveAddress(value)}return value})}));return contract.interface.encodeFilterTopics(fragment,resolvedArgs)}()}getTopicFilter(){return this.#filter}}function getRunner(value,feature){if(value==null){return null}if(typeof value[feature]==="function"){return value}if(value.provider&&typeof value.provider[feature]==="function"){return value.provider}return null}function getProvider(value){if(value==null){return null}return value.provider||null}async function copyOverrides(arg,allowed){const overrides=copyRequest(Typed.dereference(arg,"overrides"));assertArgument(overrides.to==null||(allowed||[]).indexOf("to")>=0,"cannot override to","overrides.to",overrides.to);assertArgument(overrides.data==null||(allowed||[]).indexOf("data")>=0,"cannot override data","overrides.data",overrides.data);if(overrides.from){overrides.from=await resolveAddress(overrides.from)}return overrides}async function resolveArgs(_runner,inputs,args){return await Promise.all(inputs.map((param,index)=>{return param.walkAsync(args[index],(type,value)=>{value=Typed.dereference(value,type);if(type==="address"){return resolveAddress(value)}return value})}))}function buildWrappedFallback(contract){const populateTransaction=async function(overrides){const tx=await copyOverrides(overrides,["data"]);tx.to=await contract.getAddress();const iface=contract.interface;const payable=iface.receive||iface.fallback&&iface.fallback.payable;assertArgument(payable||(tx.value||BN_0$1)===BN_0$1,"cannot send value to non-payable contract","overrides.value",tx.value);assertArgument(iface.fallback||(tx.data||"0x")==="0x","cannot send data to receive-only contract","overrides.data",tx.data);return tx};const staticCall=async function(overrides){const runner=getRunner(contract.runner,"call");assert(canCall(runner),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const tx=await populateTransaction(overrides);try{return await runner.call(tx)}catch(error){if(isCallException(error)&&error.data){throw contract.interface.makeError(error.data,tx)}throw error}};const send=async function(overrides){const runner=contract.runner;assert(canSend(runner),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const tx=await runner.sendTransaction(await populateTransaction(overrides));const provider=getProvider(contract.runner);return new ContractTransactionResponse(contract.interface,provider,tx)};const estimateEnergy=async function(overrides){const runner=getRunner(contract.runner,"estimateEnergy");assert(canEstimate(runner),"contract runner does not support energy estimation","UNSUPPORTED_OPERATION",{operation:"estimateEnergy"});return await runner.estimateEnergy(await populateTransaction(overrides))};const method=async overrides=>{return await send(overrides)};defineProperties(method,{_contract:contract,estimateEnergy:estimateEnergy,populateTransaction:populateTransaction,send:send,staticCall:staticCall});return method}function buildWrappedMethod(contract,key){const getFragment=function(...args){const fragment=contract.interface.getFunction(key,args);assert(fragment,"no matching fragment in getFragment","UNSUPPORTED_OPERATION",{operation:"fragment"});return fragment};const populateTransaction=async function(...args){const fragment=getFragment(...args);let overrides={};if(fragment.inputs.length+1===args.length){overrides=await copyOverrides(args.pop())}if(fragment.inputs.length!==args.length){throw new Error("internal error: fragment inputs doesn't match arguments; should not happen")}const resolvedArgs=await resolveArgs(contract.runner,fragment.inputs,args);return Object.assign({},overrides,await resolveProperties({to:contract.getAddress(),data:contract.interface.encodeFunctionData(fragment,resolvedArgs)}))};const staticCall=async function(...args){const result=await staticCallResult(...args);if(result.length===1){return result[0]}return result};const send=async function(...args){const runner=contract.runner;assert(canSend(runner),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const tx=await runner.sendTransaction(await populateTransaction(...args));const provider=getProvider(contract.runner);return new ContractTransactionResponse(contract.interface,provider,tx)};const estimateEnergy=async function(...args){const runner=getRunner(contract.runner,"estimateEnergy");assert(canEstimate(runner),"contract runner does not support energy estimation","UNSUPPORTED_OPERATION",{operation:"estimateEnergy"});return await runner.estimateEnergy(await populateTransaction(...args))};const staticCallResult=async function(...args){const runner=getRunner(contract.runner,"call");assert(canCall(runner),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const tx=await populateTransaction(...args);let result="0x";try{result=await runner.call(tx)}catch(error){if(isCallException(error)&&error.data){throw contract.interface.makeError(error.data,tx)}throw error}const fragment=getFragment(...args);return contract.interface.decodeFunctionResult(fragment,result)};const method=async(...args)=>{const fragment=getFragment(...args);if(fragment.constant){return await staticCall(...args)}return await send(...args)};defineProperties(method,{name:contract.interface.getFunctionName(key),_contract:contract,_key:key,getFragment:getFragment,estimateEnergy:estimateEnergy,populateTransaction:populateTransaction,send:send,staticCall:staticCall,staticCallResult:staticCallResult});Object.defineProperty(method,"fragment",{configurable:false,enumerable:true,get:()=>{const fragment=contract.interface.getFunction(key);assert(fragment,"no matching fragment in defineProperty","UNSUPPORTED_OPERATION",{operation:"fragment"});return fragment}});return method}function buildWrappedEvent(contract,key){const getFragment=function(...args){const fragment=contract.interface.getEvent(key,args);assert(fragment,"no matching fragment in","UNSUPPORTED_OPERATION",{operation:"fragment"});return fragment};const method=function(...args){return new PreparedTopicFilter(contract,getFragment(...args),args)};defineProperties(method,{name:contract.interface.getEventName(key),_contract:contract,_key:key,getFragment:getFragment});Object.defineProperty(method,"fragment",{configurable:false,enumerable:true,get:()=>{const fragment=contract.interface.getEvent(key);assert(fragment,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment"});return fragment}});return method}const internal=Symbol.for("_corebcInternal_contract");const internalValues=new WeakMap;function setInternal(contract,values){internalValues.set(contract[internal],values)}function getInternal(contract){return internalValues.get(contract[internal])}function isDeferred(value){return value&&typeof value==="object"&&"getTopicFilter"in value&&typeof value.getTopicFilter==="function"&&value.fragment}async function getSubInfo(contract,event){let topics;let fragment=null;if(Array.isArray(event)){const topicHashify=function(name){if(isHexString(name,32)){return name}const fragment=contract.interface.getEvent(name);assertArgument(fragment,"unknown fragment","name",name);return fragment.topicHash};topics=event.map(e=>{if(e==null){return null}if(Array.isArray(e)){return e.map(topicHashify)}return topicHashify(e)})}else if(event==="*"){topics=[null]}else if(typeof event==="string"){if(isHexString(event,32)){topics=[event]}else{fragment=contract.interface.getEvent(event);assertArgument(fragment,"unknown fragment","event",event);topics=[fragment.topicHash]}}else if(isDeferred(event)){topics=await event.getTopicFilter()}else if("fragment"in event){fragment=event.fragment;topics=[fragment.topicHash]}else{assertArgument(false,"unknown event name","event",event)}topics=topics.map(t=>{if(t==null){return null}if(Array.isArray(t)){const items=Array.from(new Set(t.map(t=>t.toLowerCase())).values());if(items.length===1){return items[0]}items.sort();return items}return t.toLowerCase()});const tag=topics.map(t=>{if(t==null){return"null"}if(Array.isArray(t)){return t.join("|")}return t}).join("&");return{fragment:fragment,tag:tag,topics:topics}}async function hasSub(contract,event){const{subs}=getInternal(contract);return subs.get((await getSubInfo(contract,event)).tag)||null}async function getSub(contract,operation,event){const provider=getProvider(contract.runner);assert(provider,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:operation});const{fragment,tag,topics}=await getSubInfo(contract,event);const{addr,subs}=getInternal(contract);let sub=subs.get(tag);if(!sub){const address=addr?addr:contract;const filter={address:address,topics:topics};const listener=log=>{let foundFragment=fragment;if(foundFragment==null){try{foundFragment=contract.interface.getEvent(log.topics[0])}catch(error){}}if(foundFragment){const _foundFragment=foundFragment;const args=fragment?contract.interface.decodeEventLog(fragment,log.data,log.topics):[];emit(contract,event,args,listener=>{return new ContractEventPayload(contract,listener,event,_foundFragment,log)})}else{emit(contract,event,[],listener=>{return new ContractUnknownEventPayload(contract,listener,event,log)})}};let starting=[];const start=()=>{if(starting.length){return}starting.push(provider.on(filter,listener))};const stop=async()=>{if(starting.length==0){return}let started=starting;starting=[];await Promise.all(started);provider.off(filter,listener)};sub={tag:tag,listeners:[],start:start,stop:stop};subs.set(tag,sub)}return sub}let lastEmit=Promise.resolve();async function _emit(contract,event,args,payloadFunc){await lastEmit;const sub=await hasSub(contract,event);if(!sub){return false}const count=sub.listeners.length;sub.listeners=sub.listeners.filter(({listener,once})=>{const passArgs=Array.from(args);if(payloadFunc){passArgs.push(payloadFunc(once?null:listener))}try{listener.call(contract,...passArgs)}catch(error){}return!once});return count>0}async function emit(contract,event,args,payloadFunc){try{await lastEmit}catch(error){}const resultPromise=_emit(contract,event,args,payloadFunc);lastEmit=resultPromise;return await resultPromise}const passProperties=["then"];class BaseContract{target;interface;runner;filters;[internal];fallback;constructor(target,abi,runner,_deployTx){if(runner==null){runner=null}const iface=Interface.from(abi);defineProperties(this,{target:target,runner:runner,interface:iface});Object.defineProperty(this,internal,{value:{}});let addrPromise;let addr=null;let deployTx=null;if(_deployTx){const provider=getProvider(runner);deployTx=new ContractTransactionResponse(this.interface,provider,_deployTx)}let subs=new Map;if(typeof target==="string"){if(isHexString(target)){addr=target;addrPromise=Promise.resolve(target)}else{const resolver=getRunner(runner,"resolveName");if(!canResolve(resolver)){throw makeError("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"})}addrPromise=resolver.resolveName(target).then(addr=>{if(addr==null){throw new Error("TODO")}getInternal(this).addr=addr;return addr})}}else{addrPromise=target.getAddress().then(addr=>{if(addr==null){throw new Error("TODO")}getInternal(this).addr=addr;return addr})}setInternal(this,{addrPromise:addrPromise,addr:addr,deployTx:deployTx,subs:subs});const filters=new Proxy({},{get:(target,_prop,receiver)=>{if(passProperties.indexOf(_prop)>=0){return Reflect.get(target,_prop,receiver)}const prop=String(_prop);const result=this.getEvent(prop);if(result){return result}throw new Error(`unknown contract event: ${prop}`)},has:(target,prop)=>{if(passProperties.indexOf(prop)>=0){return Reflect.has(target,prop)}return Reflect.has(target,prop)||this.interface.hasEvent(String(prop))}});defineProperties(this,{filters:filters});defineProperties(this,{fallback:iface.receive||iface.fallback?buildWrappedFallback(this):null});return new Proxy(this,{get:(target,_prop,receiver)=>{if(_prop in target||passProperties.indexOf(_prop)>=0){return Reflect.get(target,_prop,receiver)}const prop=String(_prop);const result=target.getFunction(prop);if(result){return result}throw new Error(`unknown contract method: ${prop}`)},has:(target,prop)=>{if(prop in target||passProperties.indexOf(prop)>=0){return Reflect.has(target,prop)}return target.interface.hasFunction(String(prop))}})}connect(runner){return new BaseContract(this.target,this.interface,runner)}async getAddress(){return await getInternal(this).addrPromise}async getDeployedCode(){const provider=getProvider(this.runner);assert(provider,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const code=await provider.getCode(await this.getAddress());if(code==="0x"){return null}return code}async waitForDeployment(){const deployTx=this.deploymentTransaction();if(deployTx){await deployTx.wait();return this}const code=await this.getDeployedCode();if(code!=null){return this}const provider=getProvider(this.runner);assert(provider!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"});return new Promise((resolve,reject)=>{const checkCode=async()=>{try{const code=await this.getDeployedCode();if(code!=null){return resolve(this)}provider.once("block",checkCode)}catch(error){reject(error)}};checkCode()})}deploymentTransaction(){return getInternal(this).deployTx}getFunction(key){if(typeof key!=="string"){key=key.format()}const func=buildWrappedMethod(this,key);return func}getEvent(key){if(typeof key!=="string"){key=key.format()}return buildWrappedEvent(this,key)}async queryTransaction(hash){throw new Error("@TODO")}async queryFilter(event,fromBlock,toBlock){if(fromBlock==null){fromBlock=0}if(toBlock==null){toBlock="latest"}const{addr,addrPromise}=getInternal(this);const address=addr?addr:await addrPromise;const{fragment,topics}=await getSubInfo(this,event);const filter={address:address,topics:topics,fromBlock:fromBlock,toBlock:toBlock};const provider=getProvider(this.runner);assert(provider,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"});return(await provider.getLogs(filter)).map(log=>{let foundFragment=fragment;if(foundFragment==null){try{foundFragment=this.interface.getEvent(log.topics[0])}catch(error){}}if(foundFragment){return new EventLog(log,this.interface,foundFragment)}else{return new Log(log,provider)}})}async on(event,listener){const sub=await getSub(this,"on",event);sub.listeners.push({listener:listener,once:false});sub.start();return this}async once(event,listener){const sub=await getSub(this,"once",event);sub.listeners.push({listener:listener,once:true});sub.start();return this}async emit(event,...args){return await emit(this,event,args,null)}async listenerCount(event){if(event){const sub=await hasSub(this,event);if(!sub){return 0}return sub.listeners.length}const{subs}=getInternal(this);let total=0;for(const{listeners}of subs.values()){total+=listeners.length}return total}async listeners(event){if(event){const sub=await hasSub(this,event);if(!sub){return[]}return sub.listeners.map(({listener})=>listener)}const{subs}=getInternal(this);let result=[];for(const{listeners}of subs.values()){result=result.concat(listeners.map(({listener})=>listener))}return result}async off(event,listener){const sub=await hasSub(this,event);if(!sub){return this}if(listener){const index=sub.listeners.map(({listener})=>listener).indexOf(listener);if(index>=0){sub.listeners.splice(index,1)}}if(listener==null||sub.listeners.length===0){sub.stop();getInternal(this).subs.delete(sub.tag)}return this}async removeAllListeners(event){if(event){const sub=await hasSub(this,event);if(!sub){return this}sub.stop();getInternal(this).subs.delete(sub.tag)}else{const{subs}=getInternal(this);for(const{tag,stop}of subs.values()){stop();subs.delete(tag)}}return this}async addListener(event,listener){return await this.on(event,listener)}async removeListener(event,listener){return await this.off(event,listener)}static buildClass(abi){class CustomContract extends BaseContract{constructor(address,runner=null){super(address,abi,runner)}}return CustomContract}static from(target,abi,runner){if(runner==null){runner=null}const contract=new this(target,abi,runner);return contract}static isIndexed(value){return Indexed.isIndexed(value)}}function _ContractBase(){return BaseContract}class Contract extends _ContractBase(){}class ContractFactory{interface;bytecode;runner;constructor(abi,bytecode,runner){const iface=Interface.from(abi);if(bytecode instanceof Uint8Array){bytecode=hexlify(getBytes(bytecode))}else if(typeof bytecode==="string"){bytecode=bytecode}else if(isBytes(bytecode)){bytecode=hexlify(bytecode)}else if(bytecode&&typeof bytecode.object==="string"){bytecode=bytecode.object}else{bytecode="!"}defineProperties(this,{bytecode:bytecode,interface:iface,runner:runner||null})}async getDeployTransaction(...args){let overrides={};const fragment=this.interface.deploy;if(fragment.inputs.length+1===args.length){overrides=await copyOverrides(args.pop())}if(fragment.inputs.length!==args.length){throw new Error("incorrect number of arguments to constructor")}const resolvedArgs=await resolveArgs(this.runner,fragment.inputs,args);const data=concat([this.bytecode,this.interface.encodeDeploy(resolvedArgs)]);return Object.assign({},overrides,{data:data})}async deploy(...args){const tx=await this.getDeployTransaction(...args);assert(this.runner&&typeof this.runner.sendTransaction==="function","factory runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const sentTx=await this.runner.sendTransaction(tx);const address=getCreateAddress(sentTx);return new BaseContract(address,this.interface,this.runner,sentTx)}connect(runner){return new ContractFactory(this.interface,this.bytecode,runner)}static fromSolidity(output,runner){assertArgument(output!=null,"bad compiler output","output",output);if(typeof output==="string"){output=JSON.parse(output)}const abi=output.abi;let bytecode="";if(output.bytecode){bytecode=output.bytecode}else if(output.evm&&output.evm.bytecode){bytecode=output.evm.bytecode}return new this(abi,bytecode,runner)}}const BN_0=BigInt(0);function allowNull(format,nullValue){return function(value){if(value==null){return nullValue}return format(value)}}function arrayOf(format){return array=>{if(!Array.isArray(array)){throw new Error("not an array")}return array.map(i=>format(i))}}function object(format,altNames){return value=>{const result={};for(const key in format){let srcKey=key;if(altNames&&key in altNames&&!(srcKey in value)){for(const altKey of altNames[key]){if(altKey in value){srcKey=altKey;break}}}try{const nv=format[key](value[srcKey]);if(nv!==undefined){result[key]=nv}}catch(error){const message=error instanceof Error?error.message:"not-an-error";assert(false,`invalid value for value.${key} (${message})`,"BAD_DATA",{value:value})}}return result}}function formatBoolean(value){switch(value){case true:case"true":return true;case false:case"false":return false}assertArgument(false,`invalid boolean; ${JSON.stringify(value)}`,"value",value)}function formatData(value){assertArgument(isHexString(value,true),"invalid data","value",value);return value}function formatHash(value){assertArgument(isHexString(value,32),"invalid hash","value",value);return value}const _formatLog=object({address:getAddress,blockHash:formatHash,blockNumber:getNumber,data:formatData,index:getNumber,removed:allowNull(formatBoolean,false),topics:arrayOf(formatHash),transactionHash:formatHash,transactionIndex:getNumber},{index:["logIndex"]});function formatLog(value){return _formatLog(value)}const _formatBlock=object({hash:allowNull(formatHash),parentHash:formatHash,number:getNumber,timestamp:getNumber,nonce:allowNull(formatData),difficulty:getBigInt,energyLimit:getBigInt,energyUsed:getBigInt,miner:allowNull(getAddress),extraData:formatData,baseFeePerEnergy:allowNull(getBigInt)});function formatBlock(value){const result=_formatBlock(value);result.transactions=value.transactions.map(tx=>{if(typeof tx==="string"){return tx}return formatTransactionResponse(tx)});return result}const _formatReceiptLog=object({transactionIndex:getNumber,blockNumber:getNumber,transactionHash:formatHash,address:getAddress,topics:arrayOf(formatHash),data:formatData,index:getNumber,blockHash:formatHash},{index:["logIndex"]});function formatReceiptLog(value){return _formatReceiptLog(value)}const _formatTransactionReceipt=object({to:allowNull(getAddress,null),from:allowNull(getAddress,null),contractAddress:allowNull(getAddress,null),index:getNumber,root:allowNull(hexlify),energyUsed:getBigInt,logsBloom:allowNull(formatData),blockHash:formatHash,hash:formatHash,logs:arrayOf(formatReceiptLog),blockNumber:getNumber,cumulativeEnergyUsed:getBigInt,effectiveEnergyPrice:allowNull(getBigInt),status:allowNull(getNumber),type:allowNull(getNumber,0)},{effectiveEnergyPrice:["energyPrice"],hash:["transactionHash"],index:["transactionIndex"]});function formatTransactionReceipt(value){return _formatTransactionReceipt(value)}function formatTransactionResponse(value){if(value.to&&!getAddress(value.to)&&getBigInt(value.to)===BN_0){value.to="0x0000000000000000000000000000000000000000"}const result=object({hash:formatHash,type:value=>{if(value==="0x"||value==null){return 0}return getNumber(value)},accessList:allowNull(accessListify,null),blockHash:allowNull(formatHash,null),blockNumber:allowNull(getNumber,null),transactionIndex:allowNull(getNumber,null),from:getAddress,maxFeePerEnergy:allowNull(getBigInt),energyLimit:getBigInt,to:allowNull(getAddress,null),value:getBigInt,nonce:getNumber,data:formatData,creates:allowNull(getAddress,null),networkId:allowNull(getBigInt,null)},{data:["input"],energyLimit:["energy"]})(value);if(result.to==null&&result.creates==null){result.creates=getCreateAddress(result)}if(value.signature){result.signature=value.signature}else{result.signature=value}if(result.networkId==null){const networkId=result.signature.legacynetworkId;if(networkId!=null){result.networkId=networkId}}if(result.blockHash&&getBigInt(result.blockHash)===BN_0){result.blockHash=null}return result}class NetworkPlugin{name;constructor(name){defineProperties(this,{name:name})}clone(){return new NetworkPlugin(this.name)}}class EnergyCostPlugin extends NetworkPlugin{effectiveBlock;txBase;txCreate;txDataZero;txDataNonzero;txAccessListStorageKey;txAccessListAddress;constructor(effectiveBlock,costs){if(effectiveBlock==null){effectiveBlock=0}super(`org.corebc.network.plugins.EnergyCost#${effectiveBlock||0}`);const props={effectiveBlock:effectiveBlock};function set(name,nullish){let value=(costs||{})[name];if(value==null){value=nullish}assertArgument(typeof value==="number",`invalud value for ${name}`,"costs",costs);props[name]=value}set("txBase",21e3);set("txCreate",32e3);set("txDataZero",4);set("txDataNonzero",16);set("txAccessListStorageKey",1900);set("txAccessListAddress",2400);defineProperties(this,props)}clone(){return new EnergyCostPlugin(this.effectiveBlock,this)}}class FeeDataNetworkPlugin extends NetworkPlugin{#feeDataFunc;get feeDataFunc(){return this.#feeDataFunc}constructor(feeDataFunc){super("org.corebc.plugins.network.FeeData");this.#feeDataFunc=feeDataFunc}async getFeeData(provider){return await this.#feeDataFunc(provider)}clone(){return new FeeDataNetworkPlugin(this.#feeDataFunc)}}const Networks=new Map;class Network{#name;#networkId;#plugins;constructor(name,networkId){this.#name=name;this.#networkId=getBigInt(networkId);this.#plugins=new Map}toJSON(){return{name:this.name,networkId:String(this.networkId)}}get name(){return this.#name}set name(value){this.#name=value}get networkId(){return this.#networkId}set networkId(value){this.#networkId=getBigInt(value,"networkId")}matches(other){if(other==null){return false}if(typeof other==="string"){try{return this.networkId===getBigInt(other)}catch(error){}return this.name===other}if(typeof other==="number"||typeof other==="bigint"){try{return this.networkId===getBigInt(other)}catch(error){}return false}if(typeof other==="object"){if(other.networkId!=null){try{return this.networkId===getBigInt(other.networkId)}catch(error){}return false}if(other.name!=null){return this.name===other.name}return false}return false}get plugins(){return Array.from(this.#plugins.values())}attachPlugin(plugin){if(this.#plugins.get(plugin.name)){throw new Error(`cannot replace existing plugin: ${plugin.name} `)}this.#plugins.set(plugin.name,plugin.clone());return this}getPlugin(name){return this.#plugins.get(name)||null}getPlugins(basename){return this.plugins.filter(p=>p.name.split("#")[0]===basename)}clone(){const clone=new Network(this.name,this.networkId);this.plugins.forEach(plugin=>{clone.attachPlugin(plugin.clone())});return clone}computeIntrinsicEnergy(tx){const costs=this.getPlugin("org.corebc.plugins.network.EnergyCost")||new EnergyCostPlugin;let energy=costs.txBase;if(tx.to==null){energy+=costs.txCreate}if(tx.data){for(let i=2;i{Network.register(name,func)})}}registerEth("mainnet",1,{ensNetwork:1,altNames:["homestead"]});registerEth("ropsten",3,{ensNetwork:3});registerEth("rinkeby",4,{ensNetwork:4});registerEth("goerli",5,{ensNetwork:5});registerEth("kovan",42,{ensNetwork:42});registerEth("sepolia",11155111,{});registerEth("classic",61,{});registerEth("classicKotti",6,{});registerEth("xdai",100,{ensNetwork:1})}function copy$2(obj){return JSON.parse(JSON.stringify(obj))}class PollingBlockSubscriber{#provider;#poller;#interval;#blockNumber;constructor(provider){this.#provider=provider;this.#poller=null;this.#interval=4e3;this.#blockNumber=-2}get pollingInterval(){return this.#interval}set pollingInterval(value){this.#interval=value}async#poll(){try{const blockNumber=await this.#provider.getBlockNumber();if(this.#blockNumber===-2){this.#blockNumber=blockNumber;return}if(blockNumber!==this.#blockNumber){for(let b=this.#blockNumber+1;b<=blockNumber;b++){if(this.#poller==null){return}await this.#provider.emit("block",b)}this.#blockNumber=blockNumber}}catch(error){}if(this.#poller==null){return}this.#poller=this.#provider._setTimeout(this.#poll.bind(this),this.#interval)}start(){if(this.#poller){return}this.#poller=this.#provider._setTimeout(this.#poll.bind(this),this.#interval);this.#poll()}stop(){if(!this.#poller){return}this.#provider._clearTimeout(this.#poller);this.#poller=null}pause(dropWhilePaused){this.stop();if(dropWhilePaused){this.#blockNumber=-2}}resume(){this.start()}}class OnBlockSubscriber{#provider;#poll;#running;constructor(provider){this.#provider=provider;this.#running=false;this.#poll=blockNumber=>{this._poll(blockNumber,this.#provider)}}async _poll(blockNumber,provider){throw new Error("sub-classes must override this")}start(){if(this.#running){return}this.#running=true;this.#poll(-2);this.#provider.on("block",this.#poll)}stop(){if(!this.#running){return}this.#running=false;this.#provider.off("block",this.#poll)}pause(dropWhilePaused){this.stop()}resume(){this.start()}}class PollingOrphanSubscriber extends OnBlockSubscriber{#filter;constructor(provider,filter){super(provider);this.#filter=copy$2(filter)}async _poll(blockNumber,provider){throw new Error("@TODO")}}class PollingTransactionSubscriber extends OnBlockSubscriber{#hash;constructor(provider,hash){super(provider);this.#hash=hash}async _poll(blockNumber,provider){const tx=await provider.getTransactionReceipt(this.#hash);if(tx){provider.emit(this.#hash,tx)}}}class PollingEventSubscriber{#provider;#filter;#poller;#running;#blockNumber;constructor(provider,filter){this.#provider=provider;this.#filter=copy$2(filter);this.#poller=this.#poll.bind(this);this.#running=false;this.#blockNumber=-2}async#poll(blockNumber){if(this.#blockNumber===-2){return}const filter=copy$2(this.#filter);filter.fromBlock=this.#blockNumber+1;filter.toBlock=blockNumber;const logs=await this.#provider.getLogs(filter);if(logs.length===0){if(this.#blockNumber{this.#blockNumber=blockNumber})}this.#provider.on("block",this.#poller)}stop(){if(!this.#running){return}this.#running=false;this.#provider.off("block",this.#poller)}pause(dropWhilePaused){this.stop();if(dropWhilePaused){this.#blockNumber=-2}}resume(){this.start()}}const MAX_CCIP_REDIRECTS=10;function isPromise(value){return value&&typeof value.then==="function"}function getTag(prefix,value){return prefix+":"+JSON.stringify(value,(k,v)=>{if(v==null){return"null"}if(typeof v==="bigint"){return`bigint:${v.toString()}`}if(typeof v==="string"){return v.toLowerCase()}if(typeof v==="object"&&!Array.isArray(v)){const keys=Object.keys(v);keys.sort();return keys.reduce((accum,key)=>{accum[key]=v[key];return accum},{})}return v})}class UnmanagedSubscriber{name;constructor(name){defineProperties(this,{name:name})}start(){}stop(){}pause(dropWhilePaused){}resume(){}}function copy$1(value){return JSON.parse(JSON.stringify(value))}function concisify(items){items=Array.from(new Set(items).values());items.sort();return items}async function getSubscription(_event,provider){if(_event==null){throw new Error("invalid event")}if(Array.isArray(_event)){_event={topics:_event}}if(typeof _event==="string"){switch(_event){case"block":case"pending":case"debug":case"error":case"network":{return{type:_event,tag:_event}}}}if(isHexString(_event,32)){const hash=_event.toLowerCase();return{type:"transaction",tag:getTag("tx",{hash:hash}),hash:hash}}if(_event.orphan){const event=_event;return{type:"orphan",tag:getTag("orphan",event),filter:copy$1(event)}}if(_event.address||_event.topics){const event=_event;const filter={topics:(event.topics||[]).map(t=>{if(t==null){return null}if(Array.isArray(t)){return concisify(t.map(t=>t.toLowerCase()))}return t.toLowerCase()})};if(event.address){const addresses=[];const promises=[];const addAddress=addr=>{if(isHexString(addr)){addresses.push(addr)}else{promises.push((async()=>{addresses.push(await resolveAddress(addr))})())}};if(Array.isArray(event.address)){event.address.forEach(addAddress)}else{addAddress(event.address)}if(promises.length){await Promise.all(promises)}filter.address=concisify(addresses.map(a=>a.toLowerCase()))}return{filter:filter,tag:getTag("event",filter),type:"event"}}assertArgument(false,"unknown ProviderEvent","event",_event)}function getTime$1(){return(new Date).getTime()}class AbstractProvider{#subs;#plugins;#pausedState;#networkPromise;#anyNetwork;#performCache;#lastBlockNumber;#nextTimer;#timers;#disableCcipRead;constructor(_network){if(_network==="any"){this.#anyNetwork=true;this.#networkPromise=null}else if(_network){const network=Network.from(_network);this.#anyNetwork=false;this.#networkPromise=Promise.resolve(network);setTimeout(()=>{this.emit("network",network,null)},0)}else{this.#anyNetwork=false;this.#networkPromise=null}this.#lastBlockNumber=-1;this.#performCache=new Map;this.#subs=new Map;this.#plugins=new Map;this.#pausedState=null;this.#nextTimer=1;this.#timers=new Map;this.#disableCcipRead=false}get provider(){return this}get plugins(){return Array.from(this.#plugins.values())}attachPlugin(plugin){if(this.#plugins.get(plugin.name)){throw new Error(`cannot replace existing plugin: ${plugin.name} `)}this.#plugins.set(plugin.name,plugin.connect(this));return this}getPlugin(name){return this.#plugins.get(name)||null}get disableCcipRead(){return this.#disableCcipRead}set disableCcipRead(value){this.#disableCcipRead=!!value}async#perform(req){const tag=getTag(req.method,req);let perform=this.#performCache.get(tag);if(!perform){perform=this._perform(req);this.#performCache.set(tag,perform);setTimeout(()=>{if(this.#performCache.get(tag)===perform){this.#performCache.delete(tag)}},250)}return await perform}async ccipReadFetch(tx,calldata,urls){if(this.disableCcipRead||urls.length===0||tx.to==null){return null}const sender=tx.to.toLowerCase();const data=calldata.toLowerCase();const errorMessages=[];for(let i=0;i=500,`response not found during CCIP fetch: ${errorMessage}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:tx,info:{url:url,errorMessage:errorMessage}});errorMessages.push(errorMessage)}assert(false,`error encountered during CCIP fetch: ${errorMessages.map(m=>JSON.stringify(m)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:tx,info:{urls:urls,errorMessages:errorMessages}})}_wrapBlock(value,network){return new Block(formatBlock(value),this)}_wrapLog(value,network){return new Log(formatLog(value),this)}_wrapTransactionReceipt(value,network){return new TransactionReceipt(formatTransactionReceipt(value),this)}_wrapTransactionResponse(tx,network){return new TransactionResponse(formatTransactionResponse(tx),this)}_detectNetwork(){assert(false,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(req){assert(false,`unsupported method: ${req.method}`,"UNSUPPORTED_OPERATION",{operation:req.method,info:req})}async getBlockNumber(){const blockNumber=getNumber(await this.#perform({method:"getBlockNumber"}),"%response");if(this.#lastBlockNumber>=0){this.#lastBlockNumber=blockNumber}return blockNumber}_getAddress(address){return resolveAddress(address)}_getBlockTag(blockTag){if(blockTag==null){return"latest"}switch(blockTag){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return blockTag}if(isHexString(blockTag)){if(isHexString(blockTag,32)){return blockTag}return toQuantity(blockTag)}if(typeof blockTag==="bigint"){blockTag=getNumber(blockTag,"blockTag")}if(typeof blockTag==="number"){if(blockTag>=0){return toQuantity(blockTag)}if(this.#lastBlockNumber>=0){return toQuantity(this.#lastBlockNumber+blockTag)}return this.getBlockNumber().then(b=>toQuantity(b+blockTag))}assertArgument(false,"invalid blockTag","blockTag",blockTag)}_getFilter(filter){const topics=(filter.topics||[]).map(t=>{if(t==null){return null}if(Array.isArray(t)){return concisify(t.map(t=>t.toLowerCase()))}return t.toLowerCase()});const blockHash="blockHash"in filter?filter.blockHash:undefined;const resolve=(_address,fromBlock,toBlock)=>{let address=undefined;switch(_address.length){case 0:break;case 1:address=_address[0];break;default:_address.sort();address=_address}if(blockHash){if(fromBlock!=null||toBlock!=null){throw new Error("invalid filter")}}const filter={};if(address){filter.address=address}if(topics.length){filter.topics=topics}if(fromBlock){filter.fromBlock=fromBlock}if(toBlock){filter.toBlock=toBlock}if(blockHash){filter.blockHash=blockHash}return filter};let address=[];if(filter.address){if(Array.isArray(filter.address)){for(const addr of filter.address){address.push(this._getAddress(addr))}}else{address.push(this._getAddress(filter.address))}}let fromBlock=undefined;if("fromBlock"in filter){fromBlock=this._getBlockTag(filter.fromBlock)}let toBlock=undefined;if("toBlock"in filter){toBlock=this._getBlockTag(filter.toBlock)}if(address.filter(a=>typeof a!=="string").length||fromBlock!=null&&typeof fromBlock!=="string"||toBlock!=null&&typeof toBlock!=="string"){return Promise.all([Promise.all(address),fromBlock,toBlock]).then(result=>{return resolve(result[0],result[1],result[2])})}return resolve(address,fromBlock,toBlock)}_getTransactionRequest(_request){const request=copyRequest(_request);const promises=[];["to","from"].forEach(key=>{if(request[key]==null){return}const addr=resolveAddress(request[key]);if(isPromise(addr)){promises.push(async function(){request[key]=await addr}())}else{request[key]=addr}});if(request.blockTag!=null){const blockTag=this._getBlockTag(request.blockTag);if(isPromise(blockTag)){promises.push(async function(){request.blockTag=await blockTag}())}else{request.blockTag=blockTag}}if(promises.length){return async function(){await Promise.all(promises);return request}()}return request}async getNetwork(){if(this.#networkPromise==null){const detectNetwork=this._detectNetwork().then(network=>{this.emit("network",network,null);return network},error=>{if(this.#networkPromise===detectNetwork){this.#networkPromise=null}throw error});this.#networkPromise=detectNetwork;return(await detectNetwork).clone()}const networkPromise=this.#networkPromise;const[expected,actual]=await Promise.all([networkPromise,this._detectNetwork()]);if(expected.networkId!==actual.networkId){if(this.#anyNetwork){this.emit("network",actual,expected);if(this.#networkPromise===networkPromise){this.#networkPromise=Promise.resolve(actual)}}else{assert(false,`network changed: ${expected.networkId} => ${actual.networkId} `,"NETWORK_ERROR",{event:"changed"})}}return expected.clone()}async getEnergyPrice(){const{energyPrice}=await resolveProperties({block:this.getBlock("latest"),energyPrice:(async()=>{try{const energyPrice=await this.#perform({method:"getEnergyPrice"});return getBigInt(energyPrice,"%response")}catch(error){}return null})()});return new FeeData(energyPrice)}async getFeeData(){const{energyPrice}=await resolveProperties({block:this.getBlock("latest"),energyPrice:(async()=>{try{const energyPrice=await this.#perform({method:"getEnergyPrice"});return getBigInt(energyPrice,"%response")}catch(error){}return null})()});return new FeeData(energyPrice)}async estimateEnergy(_tx){let tx=this._getTransactionRequest(_tx);if(isPromise(tx)){tx=await tx}return getBigInt(await this.#perform({method:"estimateEnergy",transaction:tx}),"%response")}async#call(tx,blockTag,attempt){assert(attempt=0&&blockTag==="latest"&&transaction.to!=null&&dataSlice(error.data,0,4)==="0x556f1830"){const data=error.data;const txSender=await resolveAddress(transaction.to);let ccipArgs;try{ccipArgs=parseOffchainLookup(dataSlice(error.data,4))}catch(error){assert(false,error.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:transaction,info:{data:data}})}assert(ccipArgs.sender.toLowerCase()===txSender.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:data,reason:"OffchainLookup",transaction:transaction,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:ccipArgs.errorArgs}});const ccipResult=await this.ccipReadFetch(transaction,ccipArgs.calldata,ccipArgs.urls);assert(ccipResult!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:transaction,info:{data:error.data,errorArgs:ccipArgs.errorArgs}});const tx={to:txSender,data:concat([ccipArgs.selector,encodeBytes([ccipResult,ccipArgs.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:tx});try{const result=await this.#call(tx,blockTag,attempt+1);this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},tx),result:result});return result}catch(error){this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},tx),error:error});throw error}}throw error}}async#checkNetwork(promise){const{value}=await resolveProperties({network:this.getNetwork(),value:promise});return value}async call(_tx){const{tx,blockTag}=await resolveProperties({tx:this._getTransactionRequest(_tx),blockTag:this._getBlockTag(_tx.blockTag)});return await this.#checkNetwork(this.#call(tx,blockTag,_tx.enableCcipRead?0:-1))}async#getAccountValue(request,_address,_blockTag){let address=this._getAddress(_address);let blockTag=this._getBlockTag(_blockTag);if(typeof address!=="string"||typeof blockTag!=="string"){[address,blockTag]=await Promise.all([address,blockTag])}return await this.#checkNetwork(this.#perform(Object.assign(request,{address:address,blockTag:blockTag})))}async getBalance(address,blockTag){return getBigInt(await this.#getAccountValue({method:"getBalance"},address,blockTag),"%response")}async getTransactionCount(address,blockTag){return getNumber(await this.#getAccountValue({method:"getTransactionCount"},address,blockTag),"%response")}async getCode(address,blockTag){return hexlify(await this.#getAccountValue({method:"getCode"},address,blockTag))}async getStorage(address,_position,blockTag){const position=getBigInt(_position,"position");return hexlify(await this.#getAccountValue({method:"getStorage",position:position},address,blockTag))}async broadcastTransaction(signedTx){const{blockNumber,hash,network}=await resolveProperties({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:signedTx}),network:this.getNetwork()});const tx=Transaction.from(signedTx);if(tx.hash!==hash){throw new Error("@TODO: the returned hash did not match")}return this._wrapTransactionResponse(tx,network).replaceableTransaction(blockNumber)}async#getBlock(block,includeTransactions){if(isHexString(block,32)){return await this.#perform({method:"getBlock",blockHash:block,includeTransactions:includeTransactions})}let blockTag=this._getBlockTag(block);if(typeof blockTag!=="string"){blockTag=await blockTag}return await this.#perform({method:"getBlock",blockTag:blockTag,includeTransactions:includeTransactions})}async getBlock(block,prefetchTxs){const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#getBlock(block,!!prefetchTxs)});if(params==null){return null}return this._wrapBlock(params,network)}async getTransaction(hash){const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#perform({method:"getTransaction",hash:hash})});if(params==null){return null}return this._wrapTransactionResponse(params,network)}async getTransactionReceipt(hash){const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#perform({method:"getTransactionReceipt",hash:hash})});if(params==null){return null}if(params.energyPrice==null&¶ms.effectiveEnergyPrice==null){const tx=await this.#perform({method:"getTransaction",hash:hash});if(tx==null){throw new Error("report this; could not find tx or effectiveEnergyPrice")}params.effectiveEnergyPrice=tx.energyPrice}return this._wrapTransactionReceipt(params,network)}async getTransactionResult(hash){const{result}=await resolveProperties({network:this.getNetwork(),result:this.#perform({method:"getTransactionResult",hash:hash})});if(result==null){return null}return hexlify(result)}async getLogs(_filter){let filter=this._getFilter(_filter);if(isPromise(filter)){filter=await filter}const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#perform({method:"getLogs",filter:filter})});return params.map(p=>this._wrapLog(p,network))}_getProvider(networkId){assert(false,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async waitForTransaction(hash,_confirms,timeout){const confirms=_confirms!=null?_confirms:1;if(confirms===0){return this.getTransactionReceipt(hash)}return new Promise(async(resolve,reject)=>{let timer=null;const listener=async blockNumber=>{try{const receipt=await this.getTransactionReceipt(hash);if(receipt!=null){if(blockNumber-receipt.blockNumber+1>=confirms){resolve(receipt);if(timer){clearTimeout(timer);timer=null}return}}}catch(error){console.log("EEE",error)}this.once("block",listener)};if(timeout!=null){timer=setTimeout(()=>{if(timer==null){return}timer=null;this.off("block",listener);reject(makeError("timeout","TIMEOUT",{reason:"timeout"}))},timeout)}listener(await this.getBlockNumber())})}async waitForBlock(blockTag){assert(false,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(timerId){const timer=this.#timers.get(timerId);if(!timer){return}if(timer.timer){clearTimeout(timer.timer)}this.#timers.delete(timerId)}_setTimeout(_func,timeout){if(timeout==null){timeout=0}const timerId=this.#nextTimer++;const func=()=>{this.#timers.delete(timerId);_func()};if(this.paused){this.#timers.set(timerId,{timer:null,func:func,time:timeout})}else{const timer=setTimeout(func,timeout);this.#timers.set(timerId,{timer:timer,func:func,time:getTime$1()})}return timerId}_forEachSubscriber(func){for(const sub of this.#subs.values()){func(sub.subscriber)}}_getSubscriber(sub){switch(sub.type){case"debug":case"error":case"network":return new UnmanagedSubscriber(sub.type);case"block":return new PollingBlockSubscriber(this);case"event":return new PollingEventSubscriber(this,sub.filter);case"transaction":return new PollingTransactionSubscriber(this,sub.hash);case"orphan":return new PollingOrphanSubscriber(this,sub.filter)}throw new Error(`unsupported event: ${sub.type}`)}_recoverSubscriber(oldSub,newSub){for(const sub of this.#subs.values()){if(sub.subscriber===oldSub){if(sub.started){sub.subscriber.stop()}sub.subscriber=newSub;if(sub.started){newSub.start()}if(this.#pausedState!=null){newSub.pause(this.#pausedState)}break}}}async#hasSub(event,emitArgs){let sub=await getSubscription(event);if(sub.type==="event"&&emitArgs&&emitArgs.length>0&&emitArgs[0].removed===true){sub=await getSubscription({orphan:"drop-log",log:emitArgs[0]})}return this.#subs.get(sub.tag)||null}async#getSub(event){const subscription=await getSubscription(event);const tag=subscription.tag;let sub=this.#subs.get(tag);if(!sub){const subscriber=this._getSubscriber(subscription);const addressableMap=new WeakMap;const nameMap=new Map;sub={subscriber:subscriber,tag:tag,addressableMap:addressableMap,nameMap:nameMap,started:false,listeners:[]};this.#subs.set(tag,sub)}return sub}async on(event,listener){const sub=await this.#getSub(event);sub.listeners.push({listener:listener,once:false});if(!sub.started){sub.subscriber.start();sub.started=true;if(this.#pausedState!=null){sub.subscriber.pause(this.#pausedState)}}return this}async once(event,listener){const sub=await this.#getSub(event);sub.listeners.push({listener:listener,once:true});if(!sub.started){sub.subscriber.start();sub.started=true;if(this.#pausedState!=null){sub.subscriber.pause(this.#pausedState)}}return this}async emit(event,...args){const sub=await this.#hasSub(event,args);if(!sub||sub.listeners.length===0){return false}const count=sub.listeners.length;sub.listeners=sub.listeners.filter(({listener,once})=>{const payload=new EventPayload(this,once?null:listener,event);try{listener.call(this,...args,payload)}catch(error){}return!once});if(sub.listeners.length===0){if(sub.started){sub.subscriber.stop()}this.#subs.delete(sub.tag)}return count>0}async listenerCount(event){if(event){const sub=await this.#hasSub(event);if(!sub){return 0}return sub.listeners.length}let total=0;for(const{listeners}of this.#subs.values()){total+=listeners.length}return total}async listeners(event){if(event){const sub=await this.#hasSub(event);if(!sub){return[]}return sub.listeners.map(({listener})=>listener)}let result=[];for(const{listeners}of this.#subs.values()){result=result.concat(listeners.map(({listener})=>listener))}return result}async off(event,listener){const sub=await this.#hasSub(event);if(!sub){return this}if(listener){const index=sub.listeners.map(({listener})=>listener).indexOf(listener);if(index>=0){sub.listeners.splice(index,1)}}if(!listener||sub.listeners.length===0){if(sub.started){sub.subscriber.stop()}this.#subs.delete(sub.tag)}return this}async removeAllListeners(event){if(event){const{tag,started,subscriber}=await this.#getSub(event);if(started){subscriber.stop()}this.#subs.delete(tag)}else{for(const[tag,{started,subscriber}]of this.#subs){if(started){subscriber.stop()}this.#subs.delete(tag)}}return this}async addListener(event,listener){return await this.on(event,listener)}async removeListener(event,listener){return this.off(event,listener)}destroy(){this.removeAllListeners();for(const timerId of this.#timers.keys()){this._clearTimeout(timerId)}}get paused(){return this.#pausedState!=null}set paused(pause){if(!!pause===this.paused){return}if(this.paused){this.resume()}else{this.pause(false)}}pause(dropWhilePaused){this.#lastBlockNumber=-1;if(this.#pausedState!=null){if(this.#pausedState==!!dropWhilePaused){return}assert(false,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(s=>s.pause(dropWhilePaused));this.#pausedState=!!dropWhilePaused;for(const timer of this.#timers.values()){if(timer.timer){clearTimeout(timer.timer)}timer.time=getTime$1()-timer.time}}resume(){if(this.#pausedState==null){return}this._forEachSubscriber(s=>s.resume());this.#pausedState=null;for(const timer of this.#timers.values()){let timeout=timer.time;if(timeout<0){timeout=0}timer.time=getTime$1();setTimeout(timer.func,timeout)}}}function _parseString(result,start){try{const bytes=_parseBytes(result,start);if(bytes){return toUtf8String(bytes)}}catch(error){}return null}function _parseBytes(result,start){if(result==="0x"){return null}try{const offset=getNumber(dataSlice(result,start,start+32));const length=getNumber(dataSlice(result,offset,offset+32));return dataSlice(result,offset+32,offset+32+length)}catch(error){}return null}function numPad(value){const result=toBeArray(value);if(result.length>32){throw new Error("internal; should not happen")}const padded=new Uint8Array(32);padded.set(result,32-result.length);return padded}function bytesPad(value){if(value.length%32===0){return value}const result=new Uint8Array(Math.ceil(value.length/32)*32);result.set(value);return result}const empty=new Uint8Array([]);function encodeBytes(datas){const result=[];let byteCount=0;for(let i=0;i=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const sender=dataSlice(data,0,32);assert(dataSlice(sender,0,12)===dataSlice(zeros,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"});result.sender=dataSlice(sender,12);try{const urls=[];const urlsOffset=getNumber(dataSlice(data,32,64));const urlsLength=getNumber(dataSlice(data,urlsOffset,urlsOffset+32));const urlsData=dataSlice(data,urlsOffset+32);for(let u=0;uresult[k]);return result}function checkProvider(signer,operation){if(signer.provider){return signer.provider}assert(false,"missing provider","UNSUPPORTED_OPERATION",{operation:operation})}async function populate(signer,tx){let pop=copyRequest(tx);if(pop.to!=null){pop.to=resolveAddress(pop.to)}if(pop.from!=null){const from=pop.from;pop.from=Promise.all([signer.getAddress(),resolveAddress(from)]).then(([address,from])=>{assertArgument(address.toLowerCase()===from.toLowerCase(),"transaction from mismatch","tx.from",from);return address})}else{pop.from=signer.getAddress()}return await resolveProperties(pop)}class AbstractSigner{provider;constructor(provider){defineProperties(this,{provider:provider||null})}async getNonce(blockTag){return checkProvider(this,"getTransactionCount").getTransactionCount(await this.getAddress(),blockTag)}async populateCall(tx){const pop=await populate(this,tx);return pop}async populateTransaction(tx){const provider=checkProvider(this,"populateTransaction");const pop=await populate(this,tx);if(pop.nonce==null){pop.nonce=await this.getNonce("pending")}if(pop.energyLimit==null){pop.energyLimit=await this.estimateEnergy(pop)}const network=await this.provider.getNetwork();if(pop.networkId!=null){const networkId=getBigInt(pop.networkId);assertArgument(networkId===network.networkId,"transaction networkId mismatch","tx.networkId",tx.networkId)}else{pop.networkId=network.networkId}const feeData=await provider.getFeeData();if(feeData.energyPrice!=null){if(pop.energyPrice==null){pop.energyPrice=feeData.energyPrice}}else{assert(false,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"})}return await resolveProperties(pop)}async estimateEnergy(tx){return checkProvider(this,"estimateEnergy").estimateEnergy(await this.populateCall(tx))}async call(tx){return checkProvider(this,"call").call(await this.populateCall(tx))}async resolveName(name){return getAddress(name)}async sendTransaction(tx){const provider=checkProvider(this,"sendTransaction");const pop=await this.populateTransaction(tx);delete pop.from;const txObj=Transaction.from(pop);return await provider.broadcastTransaction(await this.signTransaction(txObj))}}class VoidSigner extends AbstractSigner{address;constructor(address,provider){super(provider);defineProperties(this,{address:address})}async getAddress(){return this.address}connect(provider){return new VoidSigner(this.address,provider)}#throwUnsupported(suffix,operation){assert(false,`VoidSigner cannot sign ${suffix}`,"UNSUPPORTED_OPERATION",{operation:operation})}async signTransaction(tx){this.#throwUnsupported("transactions","signTransaction")}async signMessage(message){this.#throwUnsupported("messages","signMessage")}async signTypedData(domain,types,value){this.#throwUnsupported("typed-data","signTypedData")}}const shown=new Set;function showThrottleMessage(service){if(shown.has(service)){return}shown.add(service);console.log("========= NOTICE =========");console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`);console.log("");console.log("The default API keys for each service are provided as a highly-throttled,");console.log("community resource for low-traffic projects and early prototyping.");console.log("");console.log("While your application will continue to function, we highly recommended");console.log("signing up for your own API keys to improve performance, increase your");console.log("request rate/limit and enable other perks, such as metrics and advanced APIs.");console.log("")}function copy(obj){return JSON.parse(JSON.stringify(obj))}class FilterIdSubscriber{#provider;#filterIdPromise;#poller;#running;#network;#hault;constructor(provider){this.#provider=provider;this.#filterIdPromise=null;this.#poller=this.#poll.bind(this);this.#running=false;this.#network=null;this.#hault=false}_subscribe(provider){throw new Error("subclasses must override this")}_emitResults(provider,result){throw new Error("subclasses must override this")}_recover(provider){throw new Error("subclasses must override this")}async#poll(blockNumber){try{if(this.#filterIdPromise==null){this.#filterIdPromise=this._subscribe(this.#provider)}let filterId=null;try{filterId=await this.#filterIdPromise}catch(error){if(!isError(error,"UNSUPPORTED_OPERATION")||error.operation!=="xcb_newFilter"){throw error}}if(filterId==null){this.#filterIdPromise=null;this.#provider._recoverSubscriber(this,this._recover(this.#provider));return}const network=await this.#provider.getNetwork();if(!this.#network){this.#network=network}if(this.#network.networkId!==network.networkId){throw new Error("chaid changed")}if(this.#hault){return}const result=await this.#provider.send("xcb_getFilterChanges",[filterId]);await this._emitResults(this.#provider,result)}catch(error){console.log("@TODO",error)}this.#provider.once("block",this.#poller)}#teardown(){const filterIdPromise=this.#filterIdPromise;if(filterIdPromise){this.#filterIdPromise=null;filterIdPromise.then(filterId=>{this.#provider.send("xcb_uninstallFilter",[filterId])})}}start(){if(this.#running){return}this.#running=true;this.#poll(-2)}stop(){if(!this.#running){return}this.#running=false;this.#hault=true;this.#teardown();this.#provider.off("block",this.#poller)}pause(dropWhilePaused){if(dropWhilePaused){this.#teardown()}this.#provider.off("block",this.#poller)}resume(){this.start()}}class FilterIdEventSubscriber extends FilterIdSubscriber{#event;constructor(provider,filter){super(provider);this.#event=copy(filter)}_recover(provider){return new PollingEventSubscriber(provider,this.#event)}async _subscribe(provider){const filterId=await provider.send("xcb_newFilter",[this.#event]);return filterId}async _emitResults(provider,results){for(const result of results){provider.emit(this.#event,provider._wrapLog(result,provider._network))}}}class FilterIdPendingSubscriber extends FilterIdSubscriber{async _subscribe(provider){return await provider.send("xcb_newPendingTransactionFilter",[])}async _emitResults(provider,results){for(const result of results){provider.emit("pending",result)}}}const Primitive="bigint,boolean,function,number,string,symbol".split(/,/g);function deepCopy(value){if(value==null||Primitive.indexOf(typeof value)>=0){return value}if(typeof value.getAddress==="function"){return value}if(Array.isArray(value)){return value.map(deepCopy)}if(typeof value==="object"){return Object.keys(value).reduce((accum,key)=>{accum[key]=value[key];return accum},{})}throw new Error(`should not happen: ${value} (${typeof value})`)}function stall$3(duration){return new Promise(resolve=>{setTimeout(resolve,duration)})}function getLowerCase(value){if(value){return value.toLowerCase()}return value}function isPollable(value){return value&&typeof value.pollingInterval==="number"}const defaultOptions={polling:false,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100};class JsonRpcSigner extends AbstractSigner{address;constructor(provider,address){super(provider);address=getAddress(address);defineProperties(this,{address:address})}connect(provider){assert(false,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(tx){return await this.populateCall(tx)}async sendUncheckedTransaction(_tx){const tx=deepCopy(_tx);const promises=[];if(tx.from){const _from=tx.from;promises.push((async()=>{const from=await resolveAddress(_from);assertArgument(from!=null&&from.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",_tx);tx.from=from})())}else{tx.from=this.address}if(tx.energyLimit==null){promises.push((async()=>{tx.energyLimit=await this.provider.estimateEnergy({...tx,from:this.address})})())}if(tx.to!=null){const _to=tx.to;promises.push((async()=>{tx.to=await resolveAddress(_to)})())}if(promises.length){await Promise.all(promises)}const hexTx=this.provider.getRpcTransaction(tx);return this.provider.send("xcb_sendTransaction",[hexTx])}async sendTransaction(tx){const blockNumber=await this.provider.getBlockNumber();const hash=await this.sendUncheckedTransaction(tx);return await new Promise((resolve,reject)=>{const timeouts=[1e3,100];const checkTx=async()=>{const tx=await this.provider.getTransaction(hash);if(tx!=null){resolve(tx.replaceableTransaction(blockNumber));return}this.provider._setTimeout(()=>{checkTx()},timeouts.pop()||4e3)};checkTx()})}async signTransaction(_tx){const tx=deepCopy(_tx);if(tx.from){const from=await resolveAddress(tx.from);assertArgument(from!=null&&from.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",_tx);tx.from=from}else{tx.from=this.address}const hexTx=this.provider.getRpcTransaction(tx);return await this.provider.send("xcb_signTransaction",[hexTx])}async signMessage(_message){const message=typeof _message==="string"?toUtf8Bytes(_message):_message;return await this.provider.send("personal_sign",[hexlify(message),this.address.toLowerCase()])}async signTypedData(domain,types,_value){const value=deepCopy(_value);const populated=await TypedDataEncoder.resolveNames(domain,types,value,async value=>{const address=await resolveAddress(value);assertArgument(address!=null,"TypedData does not support null address","value",value);return address});return await this.provider.send("xcb_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(TypedDataEncoder.getPayload(populated.domain,types,populated.value))])}async unlock(password){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),password,null])}async _legacySignMessage(_message){const message=typeof _message==="string"?toUtf8Bytes(_message):_message;return await this.provider.send("xcb_sign",[this.address.toLowerCase(),hexlify(message)])}}class JsonRpcApiProvider extends AbstractProvider{#options;#nextId;#payloads;#drainTimer;#notReady;#network;#scheduleDrain(){if(this.#drainTimer){return}const stallTime=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");this.#drainTimer=setTimeout(()=>{this.#drainTimer=null;const payloads=this.#payloads;this.#payloads=[];while(payloads.length){const batch=[payloads.shift()];while(payloads.length){if(batch.length===this.#options.batchMaxCount){break}batch.push(payloads.shift());const bytes=JSON.stringify(batch.map(p=>p.payload));if(bytes.length>this.#options.batchMaxSize){payloads.unshift(batch.pop());break}}(async()=>{const payload=batch.length===1?batch[0].payload:batch.map(p=>p.payload);this.emit("debug",{action:"sendRpcPayload",payload:payload});try{const result=await this._send(payload);this.emit("debug",{action:"receiveRpcResult",result:result});for(const{resolve,reject,payload}of batch){const resp=result.filter(r=>r.id===payload.id)[0];if(resp==null){return reject(makeError("no response from server","BAD_DATA",{value:result,info:{payload:payload}}))}if("error"in resp){return reject(this.getRpcError(payload,resp))}resolve(resp.result)}}catch(error){this.emit("debug",{action:"receiveRpcError",error:error});for(const{reject}of batch){reject(error)}}})()}},stallTime)}constructor(network,options){super(network);this.#nextId=1;this.#options=Object.assign({},defaultOptions,options||{});this.#payloads=[];this.#drainTimer=null;this.#network=null;{let resolve=null;const promise=new Promise(_resolve=>{resolve=_resolve});this.#notReady={promise:promise,resolve:resolve}}const staticNetwork=this._getOption("staticNetwork");if(staticNetwork){assertArgument(network==null||staticNetwork.matches(network),"staticNetwork MUST match network object","options",options);this.#network=staticNetwork}}_getOption(key){return this.#options[key]}get _network(){assert(this.#network,"network is not available yet","NETWORK_ERROR");return this.#network}async _perform(req){const request=this.getRpcRequest(req);if(request!=null){return await this.send(request.method,request.args)}return super._perform(req)}async _detectNetwork(){const network=this._getOption("staticNetwork");if(network){return network}if(this.ready){return Network.from(getBigInt(await this.send("xcb_networkId",[])))}const payload={id:this.#nextId++,method:"xcb_networkId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:payload});let result;try{result=(await this._send(payload))[0]}catch(error){this.emit("debug",{action:"receiveRpcError",error:error});throw error}this.emit("debug",{action:"receiveRpcResult",result:result});if("result"in result){return Network.from(getBigInt(result.result))}throw this.getRpcError(payload,result)}_start(){if(this.#notReady==null||this.#notReady.resolve==null){return}this.#notReady.resolve();this.#notReady=null;(async()=>{while(this.#network==null){try{this.#network=await this._detectNetwork()}catch(error){console.log("JsonRpcProvider failed to startup; retry in 1s");await stall$3(1e3)}}this.#scheduleDrain()})()}async _waitUntilReady(){if(this.#notReady==null){return}return await this.#notReady.promise}_getSubscriber(sub){if(sub.type==="pending"){return new FilterIdPendingSubscriber(this)}if(sub.type==="event"){if(this._getOption("polling")){return new PollingEventSubscriber(this,sub.filter)}return new FilterIdEventSubscriber(this,sub.filter)}if(sub.type==="orphan"&&sub.filter.orphan==="drop-log"){return new UnmanagedSubscriber("orphan")}return super._getSubscriber(sub)}get ready(){return this.#notReady==null}getRpcTransaction(tx){const result={};["networkId","energyLimit","energyPrice","type","nonce","value"].forEach(key=>{if(tx[key]==null){return}let dstKey=key;if(key==="energyLimit"){dstKey="energy"}result[dstKey]=toQuantity(getBigInt(tx[key],`tx.${key}`))});["from","to","data"].forEach(key=>{if(tx[key]==null){return}result[key]=hexlify(tx[key])});return result}getRpcRequest(req){switch(req.method){case"networkId":return{method:"xcb_networkId",args:[]};case"getBlockNumber":return{method:"xcb_blockNumber",args:[]};case"getEnergyPrice":return{method:"xcb_energyPrice",args:[]};case"getBalance":{return{method:"xcb_getBalance",args:[getLowerCase(req.address),req.blockTag]}}case"getTransactionCount":return{method:"xcb_getTransactionCount",args:[getLowerCase(req.address),req.blockTag]};case"getCode":return{method:"xcb_getCode",args:[getLowerCase(req.address),req.blockTag]};case"getStorage":return{method:"xcb_getStorageAt",args:[getLowerCase(req.address),"0x"+req.position.toString(16),req.blockTag]};case"broadcastTransaction":return{method:"xcb_sendRawTransaction",args:[req.signedTransaction]};case"getBlock":if("blockTag"in req){return{method:"xcb_getBlockByNumber",args:[req.blockTag,!!req.includeTransactions]}}else if("blockHash"in req){return{method:"xcb_getBlockByHash",args:[req.blockHash,!!req.includeTransactions]}}break;case"getTransaction":return{method:"xcb_getTransactionByHash",args:[req.hash]};case"getTransactionReceipt":return{method:"xcb_getTransactionReceipt",args:[req.hash]};case"call":return{method:"xcb_call",args:[this.getRpcTransaction(req.transaction),req.blockTag]};case"estimateEnergy":{return{method:"xcb_estimateEnergy",args:[this.getRpcTransaction(req.transaction)]}}case"getLogs":if(req.filter&&req.filter.address!=null){if(Array.isArray(req.filter.address)){req.filter.address=req.filter.address.map(getLowerCase)}else{req.filter.address=getLowerCase(req.filter.address)}}return{method:"xcb_getLogs",args:[req.filter]}}return null}getRpcError(payload,_error){const{method}=payload;const{error}=_error;if(method==="xcb_estimateEnergy"&&error.message){const msg=error.message;if(!msg.match(/revert/i)&&msg.match(/insufficient funds/i)){return makeError("insufficient funds","INSUFFICIENT_FUNDS",{transaction:payload.params[0],info:{payload:payload,error:error}})}}if(method==="xcb_call"||method==="xcb_estimateEnergy"){const result=spelunkData(error);const e=AbiCoder.getBuiltinCallException(method==="xcb_call"?"call":"estimateEnergy",payload.params[0],result?result.data:null);e.info={error:error,payload:payload};return e}const message=JSON.stringify(spelunkMessage(error));if(typeof error.message==="string"&&error.message.match(/user denied|corebc-user-denied/i)){const actionMap={xcb_sign:"signMessage",personal_sign:"signMessage",xcb_signTypedData_v4:"signTypedData",xcb_signTransaction:"signTransaction",xcb_sendTransaction:"sendTransaction",xcb_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"};return makeError(`user rejected action`,"ACTION_REJECTED",{action:actionMap[method]||"unknown",reason:"rejected",info:{payload:payload,error:error}})}if(method==="xcb_sendRawTransaction"||method==="xcb_sendTransaction"){const transaction=payload.params[0];if(message.match(/insufficient funds|base fee exceeds energy limit/i)){return makeError("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:transaction,info:{error:error}})}if(message.match(/nonce/i)&&message.match(/too low/i)){return makeError("nonce has already been used","NONCE_EXPIRED",{transaction:transaction,info:{error:error}})}if(message.match(/replacement transaction/i)&&message.match(/underpriced/i)){return makeError("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:transaction,info:{error:error}})}if(message.match(/only replay-protected/i)){return makeError("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:method,info:{transaction:transaction,info:{error:error}}})}}if(message.match(/the method .* does not exist/i)){return makeError("unsupported operation","UNSUPPORTED_OPERATION",{operation:payload.method,info:{error:error}})}return makeError("could not coalesce error","UNKNOWN_ERROR",{error:error})}send(method,params){const id=this.#nextId++;const promise=new Promise((resolve,reject)=>{this.#payloads.push({resolve:resolve,reject:reject,payload:{method:method,params:params,id:id,jsonrpc:"2.0"}})});this.#scheduleDrain();return promise}async getSigner(address){if(address==null){address=0}const accountsPromise=this.send("xcb_accounts",[]);if(typeof address==="number"){const accounts=await accountsPromise;if(address>=accounts.length){throw new Error("no such account")}return new JsonRpcSigner(this,accounts[address])}const{accounts}=await resolveProperties({network:this.getNetwork(),accounts:accountsPromise});address=getAddress(address);for(const account of accounts){if(getAddress(account)===address){return new JsonRpcSigner(this,address)}}throw new Error("invalid account")}async listAccounts(){const accounts=await this.send("xcb_accounts",[]);return accounts.map(a=>new JsonRpcSigner(this,a))}}class JsonRpcApiPollingProvider extends JsonRpcApiProvider{#pollingInterval;constructor(network,options){super(network,options);this.#pollingInterval=4e3}_getSubscriber(sub){const subscriber=super._getSubscriber(sub);if(isPollable(subscriber)){subscriber.pollingInterval=this.#pollingInterval}return subscriber}get pollingInterval(){return this.#pollingInterval}set pollingInterval(value){if(!Number.isInteger(value)||value<0){throw new Error("invalid interval")}this.#pollingInterval=value;this._forEachSubscriber(sub=>{if(isPollable(sub)){sub.pollingInterval=this.#pollingInterval}})}}class JsonRpcProvider extends JsonRpcApiPollingProvider{#connect;constructor(url,network,options){if(url==null){url="http://localhost:8545"}super(network,options);if(typeof url==="string"){this.#connect=new FetchRequest(url)}else{this.#connect=url.clone()}}_getConnection(){return this.#connect.clone()}async send(method,params){await this._start();return await super.send(method,params)}async _send(payload){const request=this._getConnection();request.body=JSON.stringify(payload);request.setHeader("content-type","application/json");const response=await request.send();response.assertOk();let resp=response.bodyJson;if(!Array.isArray(resp)){resp=[resp]}return resp}}function spelunkData(value){if(value==null){return null}if(typeof value.message==="string"&&value.message.match("reverted")&&isHexString(value.data)){return{message:value.message,data:value.data}}if(typeof value==="object"){for(const key in value){const result=spelunkData(value[key]);if(result){return result}}return null}if(typeof value==="string"){try{return spelunkData(JSON.parse(value))}catch(error){}}return null}function _spelunkMessage(value,result){if(value==null){return}if(typeof value.message==="string"){result.push(value.message)}if(typeof value==="object"){for(const key in value){_spelunkMessage(value[key],result)}}if(typeof value==="string"){try{return _spelunkMessage(JSON.parse(value),result)}catch(error){}}}function spelunkMessage(value){const result=[];_spelunkMessage(value,result);return result}const defaultApiKey$1="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function getHost$4(name){switch(name){case"mainnet":return"rpc.ankr.com/eth";case"goerli":return"rpc.ankr.com/xcb_goerli";case"matic":return"rpc.ankr.com/polygon";case"arbitrum":return"rpc.ankr.com/arbitrum"}assertArgument(false,"unsupported network","network",name)}class AnkrProvider extends JsonRpcProvider{apiKey;constructor(_network,apiKey){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(apiKey==null){apiKey=defaultApiKey$1}const options={polling:true,staticNetwork:network};const request=AnkrProvider.getRequest(network,apiKey);super(request,network,options);defineProperties(this,{apiKey:apiKey})}_getProvider(networkId){try{return new AnkrProvider(networkId,this.apiKey)}catch(error){}return super._getProvider(networkId)}static getRequest(network,apiKey){if(apiKey==null){apiKey=defaultApiKey$1}const request=new FetchRequest(`https:/\/${getHost$4(network.name)}/${apiKey}`);request.allowGzip=true;if(apiKey===defaultApiKey$1){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("AnkrProvider");return true}}return request}getRpcError(payload,error){if(payload.method==="xcb_sendRawTransaction"){if(error&&error.error&&error.error.message==="INTERNAL_ERROR: could not replace existing tx"){error.error.message="replacement transaction underpriced"}}return super.getRpcError(payload,error)}isCommunityResource(){return this.apiKey===defaultApiKey$1}}const defaultApiKey="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function getHost$3(name){switch(name){case"mainnet":return"eth-mainnet.alchemyapi.io";case"goerli":return"eth-goerli.g.alchemy.com";case"sepolia":return"eth-sepolia.g.alchemy.com";case"arbitrum":return"arb-mainnet.g.alchemy.com";case"arbitrum-goerli":return"arb-goerli.g.alchemy.com";case"matic":return"polygon-mainnet.g.alchemy.com";case"matic-mumbai":return"polygon-mumbai.g.alchemy.com";case"optimism":return"opt-mainnet.g.alchemy.com";case"optimism-goerli":return"opt-goerli.g.alchemy.com"}assertArgument(false,"unsupported network","network",name)}class AlchemyProvider extends JsonRpcProvider{apiKey;constructor(_network,apiKey){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(apiKey==null){apiKey=defaultApiKey}const request=AlchemyProvider.getRequest(network,apiKey);super(request,network,{staticNetwork:network});defineProperties(this,{apiKey:apiKey})}_getProvider(networkId){try{return new AlchemyProvider(networkId,this.apiKey)}catch(error){}return super._getProvider(networkId)}async _perform(req){if(req.method==="getTransactionResult"){const{trace,tx}=await resolveProperties({trace:this.send("trace_transaction",[req.hash]),tx:this.getTransaction(req.hash)});if(trace==null||tx==null){return null}let data;let error=false;try{data=trace[0].result.output;error=trace[0].error==="Reverted"}catch(error){}if(data){assert(!error,"an error occurred during transaction executions","CALL_EXCEPTION",{action:"getTransactionResult",data:data,reason:null,transaction:tx,invocation:null,revert:null});return data}assert(false,"could not parse trace result","BAD_DATA",{value:trace})}return await super._perform(req)}isCommunityResource(){return this.apiKey===defaultApiKey}static getRequest(network,apiKey){if(apiKey==null){apiKey=defaultApiKey}const request=new FetchRequest(`https:/\/${getHost$3(network.name)}/v2/${apiKey}`);request.allowGzip=true;if(apiKey===defaultApiKey){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("alchemy");return true}}return request}}class CloudflareProvider extends JsonRpcProvider{constructor(_network){if(_network==null){_network="mainnet"}const network=Network.from(_network);assertArgument(network.name==="mainnet","unsupported network","network",_network);super("https://cloudflare-eth.com/",network,{staticNetwork:network})}}function getGlobal(){if(typeof self!=="undefined"){return self}if(typeof window!=="undefined"){return window}if(typeof global!=="undefined"){return global}throw new Error("unable to locate global object")}const _WebSocket=getGlobal().WebSocket;class SocketSubscriber{#provider;#filter;get filter(){return JSON.parse(this.#filter)}#filterId;#paused;#emitPromise;constructor(provider,filter){this.#provider=provider;this.#filter=JSON.stringify(filter);this.#filterId=null;this.#paused=null;this.#emitPromise=null}start(){this.#filterId=this.#provider.send("xcb_subscribe",this.filter).then(filterId=>{this.#provider._register(filterId,this);return filterId})}stop(){this.#filterId.then(filterId=>{this.#provider.send("xcb_unsubscribe",[filterId])});this.#filterId=null}pause(dropWhilePaused){assert(dropWhilePaused,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"});this.#paused=!!dropWhilePaused}resume(){this.#paused=null}_handleMessage(message){if(this.#filterId==null){return}if(this.#paused===null){let emitPromise=this.#emitPromise;if(emitPromise==null){emitPromise=this._emit(this.#provider,message)}else{emitPromise=emitPromise.then(async()=>{await this._emit(this.#provider,message)})}this.#emitPromise=emitPromise.then(()=>{if(this.#emitPromise===emitPromise){this.#emitPromise=null}})}}async _emit(provider,message){throw new Error("sub-classes must implemente this; _emit")}}class SocketBlockSubscriber extends SocketSubscriber{constructor(provider){super(provider,["newHeads"])}async _emit(provider,message){provider.emit("block",parseInt(message.number))}}class SocketPendingSubscriber extends SocketSubscriber{constructor(provider){super(provider,["newPendingTransactions"])}async _emit(provider,message){provider.emit("pending",message)}}class SocketEventSubscriber extends SocketSubscriber{#logFilter;get logFilter(){return JSON.parse(this.#logFilter)}constructor(provider,filter){super(provider,["logs",filter]);this.#logFilter=JSON.stringify(filter)}async _emit(provider,message){provider.emit(this.logFilter,provider._wrapLog(message,provider._network))}}class SocketProvider extends JsonRpcApiProvider{#callbacks;#subs;#pending;constructor(network){super(network,{batchMaxCount:1});this.#callbacks=new Map;this.#subs=new Map;this.#pending=new Map}_getSubscriber(sub){switch(sub.type){case"close":return new UnmanagedSubscriber("close");case"block":return new SocketBlockSubscriber(this);case"pending":return new SocketPendingSubscriber(this);case"event":return new SocketEventSubscriber(this,sub.filter);case"orphan":if(sub.filter.orphan==="drop-log"){return new UnmanagedSubscriber("drop-log")}}return super._getSubscriber(sub)}_register(filterId,subscriber){this.#subs.set(filterId,subscriber);const pending=this.#pending.get(filterId);if(pending){for(const message of pending){subscriber._handleMessage(message)}this.#pending.delete(filterId)}}async _send(payload){assertArgument(!Array.isArray(payload),"WebSocket does not support batch send","payload",payload);const promise=new Promise((resolve,reject)=>{this.#callbacks.set(payload.id,{payload:payload,resolve:resolve,reject:reject})});await this._waitUntilReady();await this._write(JSON.stringify(payload));return[await promise]}async _processMessage(message){const result=JSON.parse(message);if("id"in result){const callback=this.#callbacks.get(result.id);if(callback==null){this.emit("error",makeError("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:result}));return}this.#callbacks.delete(result.id);callback.resolve(result)}else if(result.method==="xcb_subscription"){const filterId=result.params.subscription;const subscriber=this.#subs.get(filterId);if(subscriber){subscriber._handleMessage(result.params.result)}else{let pending=this.#pending.get(filterId);if(pending==null){pending=[];this.#pending.set(filterId,pending)}pending.push(result.params.result)}}}async _write(message){throw new Error("sub-classes must override this")}}class WebSocketProvider extends SocketProvider{#connect;#websocket;get websocket(){if(this.#websocket==null){throw new Error("websocket closed")}return this.#websocket}constructor(url,network){super(network);if(typeof url==="string"){this.#connect=()=>{return new _WebSocket(url)};this.#websocket=this.#connect()}else if(typeof url==="function"){this.#connect=url;this.#websocket=url()}else{this.#connect=null;this.#websocket=url}this.websocket.onopen=async()=>{try{await this._start();this.resume()}catch(error){console.log("failed to start WebsocketProvider",error)}};this.websocket.onmessage=message=>{this._processMessage(message.data)}}async _write(message){this.websocket.send(message)}async destroy(){if(this.#websocket!=null){this.#websocket.close();this.#websocket=null}super.destroy()}}const defaultProjectId="84842078b09946638c03157f83405213";function getHost$2(name){switch(name){case"mainnet":return"mainnet.infura.io";case"goerli":return"goerli.infura.io";case"sepolia":return"sepolia.infura.io";case"arbitrum":return"arbitrum-mainnet.infura.io";case"arbitrum-goerli":return"arbitrum-goerli.infura.io";case"matic":return"polygon-mainnet.infura.io";case"matic-mumbai":return"polygon-mumbai.infura.io";case"optimism":return"optimism-mainnet.infura.io";case"optimism-goerli":return"optimism-goerli.infura.io"}assertArgument(false,"unsupported network","network",name)}class InfuraWebSocketProvider extends WebSocketProvider{projectId;projectSecret;constructor(network,projectId){const provider=new InfuraProvider(network,projectId);const req=provider._getConnection();assert(!req.credentials,"INFURA WebSocket project secrets unsupported","UNSUPPORTED_OPERATION",{operation:"InfuraProvider.getWebSocketProvider()"});const url=req.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(url,network);defineProperties(this,{projectId:provider.projectId,projectSecret:provider.projectSecret})}isCommunityResource(){return this.projectId===defaultProjectId}}class InfuraProvider extends JsonRpcProvider{projectId;projectSecret;constructor(_network,projectId,projectSecret){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(projectId==null){projectId=defaultProjectId}if(projectSecret==null){projectSecret=null}const request=InfuraProvider.getRequest(network,projectId,projectSecret);super(request,network,{staticNetwork:network});defineProperties(this,{projectId:projectId,projectSecret:projectSecret})}_getProvider(networkId){try{return new InfuraProvider(networkId,this.projectId,this.projectSecret)}catch(error){}return super._getProvider(networkId)}isCommunityResource(){return this.projectId===defaultProjectId}static getWebSocketProvider(network,projectId){return new InfuraWebSocketProvider(network,projectId)}static getRequest(network,projectId,projectSecret){if(projectId==null){projectId=defaultProjectId}if(projectSecret==null){projectSecret=null}const request=new FetchRequest(`https:/\/${getHost$2(network.name)}/v3/${projectId}`);request.allowGzip=true;if(projectSecret){request.setCredentials("",projectSecret)}if(projectId===defaultProjectId){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("InfuraProvider");return true}}return request}}const defaultToken="919b412a057b5e9c9b6dce193c5a60242d6efadb";function getHost$1(name){switch(name){case"mainnet":return"corebc.quiknode.pro";case"arbitrum":return"corebc.arbitrum-mainnet.quiknode.pro";case"arbitrum-goerli":return"corebc.arbitrum-goerli.quiknode.pro";case"matic":return"corebc.matic.quiknode.pro";case"matic-mumbai":return"corebc.matic-testnet.quiknode.pro";case"optimism":return"corebc.optimism.quiknode.pro";case"optimism-goerli":return"corebc.optimism-goerli.quiknode.pro"}assertArgument(false,"unsupported network","network",name)}class QuickNodeProvider extends JsonRpcProvider{token;constructor(_network,token){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(token==null){token=defaultToken}const request=QuickNodeProvider.getRequest(network,token);super(request,network,{staticNetwork:network});defineProperties(this,{token:token})}_getProvider(networkId){try{return new QuickNodeProvider(networkId,this.token)}catch(error){}return super._getProvider(networkId)}isCommunityResource(){return this.token===defaultToken}static getRequest(network,token){if(token==null){token=defaultToken}const request=new FetchRequest(`https:/\/${getHost$1(network.name)}/${token}`);request.allowGzip=true;if(token===defaultToken){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("QuickNodeProvider");return true}}return request}}const BN_1=BigInt("1");const BN_2=BigInt("2");function shuffle(array){for(let i=array.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));const tmp=array[i];array[i]=array[j];array[j]=tmp}}function stall$2(duration){return new Promise(resolve=>{setTimeout(resolve,duration)})}function getTime(){return(new Date).getTime()}function stringify(value){return JSON.stringify(value,(key,value)=>{if(typeof value==="bigint"){return{type:"bigint",value:value.toString()}}return value})}const defaultConfig={stallTimeout:400,priority:1,weight:1};const defaultState={blockNumber:-2,requests:0,lateResponses:0,errorResponses:0,outOfSync:-1,unsupportedEvents:0,rollingDuration:0,score:0,_network:null,_updateNumber:null,_totalTime:0};async function waitForSync(config,blockNumber){while(config.blockNumber<0||config.blockNumber{const blockNumber=await config.provider.getBlockNumber();if(blockNumber>config.blockNumber){config.blockNumber=blockNumber}config._updateNumber=null})()}await config._updateNumber;config.outOfSync++}}function _normalize(value){if(value==null){return"null"}if(Array.isArray(value)){return"["+value.map(_normalize).join(",")+"]"}if(typeof value==="object"&&typeof value.toJSON==="function"){return _normalize(value.toJSON())}switch(typeof value){case"boolean":case"symbol":return value.toString();case"bigint":case"number":return BigInt(value).toString();case"string":return JSON.stringify(value);case"object":{const keys=Object.keys(value);keys.sort();return"{"+keys.map(k=>`${JSON.stringify(k)}:${_normalize(value[k])}`).join(",")+"}"}}console.log("Could not serialize",value);throw new Error("Hmm...")}function normalizeResult(value){if("error"in value){const error=value.error;return{tag:_normalize(error),value:error}}const result=value.result;return{tag:_normalize(result),value:result}}function checkQuorum(quorum,results){const tally=new Map;for(const{value,tag,weight}of results){const t=tally.get(tag)||{value:value,weight:0};t.weight+=weight;tally.set(tag,t)}let best=null;for(const r of tally.values()){if(r.weight>=quorum&&(!best||r.weight>best.weight)){best=r}}if(best){return best.value}return undefined}function getMedian(quorum,results){let resultWeight=0;const errorMap=new Map;let bestError=null;const values=[];for(const{value,tag,weight}of results){if(value instanceof Error){const e=errorMap.get(tag)||{value:value,weight:0};e.weight+=weight;errorMap.set(tag,e);if(bestError==null||e.weight>bestError.weight){bestError=e}}else{values.push(BigInt(value));resultWeight+=weight}}if(resultWeight=quorum){return bestError.value}return undefined}values.sort((a,b)=>aa?1:0);const mid=Math.floor(values.length/2);if(values.length%2){return values[mid]}return(values[mid-1]+values[mid]+BN_1)/BN_2}function getAnyResult(quorum,results){const result=checkQuorum(quorum,results);if(result!==undefined){return result}for(const r of results){if(r.value){return r.value}}return undefined}function getFuzzyMode(quorum,results){if(quorum===1){return getNumber(getMedian(quorum,results),"%internal")}const tally=new Map;const add=(result,weight)=>{const t=tally.get(result)||{result:result,weight:0};t.weight+=weight;tally.set(result,t)};for(const{weight,value}of results){const r=getNumber(value);add(r-1,weight);add(r,weight);add(r+1,weight)}let bestWeight=0;let bestResult=undefined;for(const{weight,result}of tally.values()){if(weight>=quorum&&(weight>bestWeight||bestResult!=null&&weight===bestWeight&&result>bestResult)){bestWeight=weight;bestResult=result}}return bestResult}class FallbackProvider extends AbstractProvider{quorum;eventQuorum;eventWorkers;#configs;#height;#initialSyncPromise;constructor(providers,network){super(network);this.#configs=providers.map(p=>{if(p instanceof AbstractProvider){return Object.assign({provider:p},defaultConfig,defaultState)}else{return Object.assign({},defaultConfig,p,defaultState)}});this.#height=-2;this.#initialSyncPromise=null;this.quorum=2;this.eventQuorum=1;this.eventWorkers=1;assertArgument(this.quorum<=this.#configs.reduce((a,c)=>a+c.weight,0),"quorum exceed provider wieght","quorum",this.quorum)}get providerConfigs(){return this.#configs.map(c=>{const result=Object.assign({},c);for(const key in result){if(key[0]==="_"){delete result[key]}}return result})}async _detectNetwork(){return Network.from(getBigInt(await this._perform({method:"networkId"})))}async _translatePerform(provider,req){switch(req.method){case"broadcastTransaction":return await provider.broadcastTransaction(req.signedTransaction);case"call":return await provider.call(Object.assign({},req.transaction,{blockTag:req.blockTag}));case"networkId":return(await provider.getNetwork()).networkId;case"estimateEnergy":return await provider.estimateEnergy(req.transaction);case"getBalance":return await provider.getBalance(req.address,req.blockTag);case"getBlock":{const block="blockHash"in req?req.blockHash:req.blockTag;return await provider.getBlock(block,req.includeTransactions)}case"getBlockNumber":return await provider.getBlockNumber();case"getCode":return await provider.getCode(req.address,req.blockTag);case"getEnergyPrice":return(await provider.getFeeData()).energyPrice;case"getLogs":return await provider.getLogs(req.filter);case"getStorage":return await provider.getStorage(req.address,req.position,req.blockTag);case"getTransaction":return await provider.getTransaction(req.hash);case"getTransactionCount":return await provider.getTransactionCount(req.address,req.blockTag);case"getTransactionReceipt":return await provider.getTransactionReceipt(req.hash);case"getTransactionResult":return await provider.getTransactionResult(req.hash)}}#getNextConfig(running){const configs=Array.from(running).map(r=>r.config);const allConfigs=this.#configs.slice();shuffle(allConfigs);allConfigs.sort((a,b)=>b.priority-a.priority);for(const config of allConfigs){if(configs.indexOf(config)===-1){return config}}return null}#addRunner(running,req){const config=this.#getNextConfig(running);if(config==null){return null}const runner={config:config,result:null,didBump:false,perform:null,staller:null};const now=getTime();runner.perform=(async()=>{try{config.requests++;const result=await this._translatePerform(config.provider,req);runner.result={result:result}}catch(error){config.errorResponses++;runner.result={error:error}}const dt=getTime()-now;config._totalTime+=dt;config.rollingDuration=.95*config.rollingDuration+.05*dt;runner.perform=null})();runner.staller=(async()=>{await stall$2(config.stallTimeout);runner.staller=null})();running.add(runner);return runner}async#initialSync(){let initialSync=this.#initialSyncPromise;if(!initialSync){const promises=[];this.#configs.forEach(config=>{promises.push(waitForSync(config,0));promises.push((async()=>{config._network=await config.provider.getNetwork()})())});this.#initialSyncPromise=initialSync=(async()=>{await Promise.all(promises);let networkId=null;for(const config of this.#configs){const network=config._network;if(networkId==null){networkId=network.networkId}else if(network.networkId!==networkId){assert(false,"cannot mix providers on different networks","UNSUPPORTED_OPERATION",{operation:"new FallbackProvider"})}}})()}await initialSync}async#checkQuorum(running,req){const results=[];for(const runner of running){if(runner.result!=null){const{tag,value}=normalizeResult(runner.result);results.push({tag:tag,value:value,weight:runner.config.weight})}}if(results.reduce((a,r)=>a+r.weight,0)({value:c.blockNumber,tag:getNumber(c.blockNumber).toString(),weight:c.weight})))))}const mode=getFuzzyMode(this.quorum,results);if(mode===undefined){return undefined}if(mode>this.#height){this.#height=mode}return this.#height}case"getEnergyPrice":case"estimateEnergy":return getMedian(this.quorum,results);case"getBlock":if("blockTag"in req&&req.blockTag==="pending"){return getAnyResult(this.quorum,results)}return checkQuorum(this.quorum,results);case"call":case"networkId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return checkQuorum(this.quorum,results);case"broadcastTransaction":return getAnyResult(this.quorum,results)}assert(false,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${stringify(req.method)})`})}async#waitForQuorum(running,req){if(running.size===0){throw new Error("no runners?!")}const interesting=[];let newRunners=0;for(const runner of running){if(runner.perform){interesting.push(runner.perform)}if(runner.staller){interesting.push(runner.staller);continue}if(runner.didBump){continue}runner.didBump=true;newRunners++}const value=await this.#checkQuorum(running,req);if(value!==undefined){if(value instanceof Error){throw value}return value}for(let i=0;i0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:req,results:Array.from(running).map(r=>stringify(r.result))}});await Promise.race(interesting);return await this.#waitForQuorum(running,req)}async _perform(req){if(req.method==="broadcastTransaction"){const results=await Promise.all(this.#configs.map(async({provider,weight})=>{try{const result=await provider._perform(req);return Object.assign(normalizeResult({result:result}),{weight:weight})}catch(error){return Object.assign(normalizeResult({error:error}),{weight:weight})}}));const result=getAnyResult(this.quorum,results);assert(result!==undefined,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:req,results:results.map(stringify)}});if(result instanceof Error){throw result}return result}await this.#initialSync();const running=new Set;for(let i=0;i{const payload={method:method,params:params};this.emit("debug",{action:"sendEip1193Request",payload:payload});try{const result=await core.request(payload);this.emit("debug",{action:"receiveEip1193Result",result:result});return result}catch(e){const error=new Error(e.message);error.code=e.code;error.data=e.data;error.payload=payload;this.emit("debug",{action:"receiveEip1193Error",error:error});throw error}}}async send(method,params){await this._start();return await super.send(method,params)}async _send(payload){assertArgument(!Array.isArray(payload),"EIP-1193 does not support batch request","payload",payload);try{const result=await this.#request(payload.method,payload.params||[]);return[{id:payload.id,result:result}]}catch(e){return[{id:payload.id,error:{code:e.code,data:e.data,message:e.message}}]}}getRpcError(payload,error){error=JSON.parse(JSON.stringify(error));switch(error.error.code||-1){case 4001:error.error.message=`corebc-user-denied: ${error.error.message}`;break;case 4200:error.error.message=`corebc-unsupported: ${error.error.message}`;break}return super.getRpcError(payload,error)}async hasSigner(address){if(address==null){address=0}const accounts=await this.send("xcb_accounts",[]);if(typeof address==="number"){return accounts.length>address}address=address.toLowerCase();return accounts.filter(a=>a.toLowerCase()===address).length!==0}async getSigner(address){if(address==null){address=0}if(!await this.hasSigner(address)){try{await this.#request("xcb_requestAccounts",[])}catch(error){const payload=error.payload;throw this.getRpcError(payload,{id:payload.id,error:error})}}return await super.getSigner(address)}}const defaultApplicationId="62e1ad51b37b8e00394bda3b";function getHost(name){switch(name){case"mainnet":return"eth-mainnet.gateway.pokt.network";case"goerli":return"eth-goerli.gateway.pokt.network";case"matic":return"poly-mainnet.gateway.pokt.network";case"matic-mumbai":return"polygon-mumbai-rpc.gateway.pokt.network"}assertArgument(false,"unsupported network","network",name)}class PocketProvider extends JsonRpcProvider{applicationId;applicationSecret;constructor(_network,applicationId,applicationSecret){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(applicationId==null){applicationId=defaultApplicationId}if(applicationSecret==null){applicationSecret=null}const options={staticNetwork:network};const request=PocketProvider.getRequest(network,applicationId,applicationSecret);super(request,network,options);defineProperties(this,{applicationId:applicationId,applicationSecret:applicationSecret})}_getProvider(networkId){try{return new PocketProvider(networkId,this.applicationId,this.applicationSecret)}catch(error){}return super._getProvider(networkId)}static getRequest(network,applicationId,applicationSecret){if(applicationId==null){applicationId=defaultApplicationId}const request=new FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`);request.allowGzip=true;if(applicationSecret){request.setCredentials("",applicationSecret)}if(applicationId===defaultApplicationId){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("PocketProvider");return true}}return request}isCommunityResource(){return this.applicationId===defaultApplicationId}}const IpcSocketProvider=undefined;class BaseWallet extends AbstractSigner{address;prefix;#signingKey;constructor({signingKey,prefix,provider}){super(provider);this.prefix=prefix;assertArgument(signingKey&&typeof signingKey.sign==="function","invalid signingKey key","signingKey","[ REDACTED ]");this.#signingKey=signingKey;const address=computeAddress(this.#signingKey,prefix);defineProperties(this,{address:address})}get signingKey(){return this.#signingKey}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(provider){return new BaseWallet({signingKey:this.#signingKey,prefix:this.prefix,provider:provider})}async signTransaction(tx){const{to,from}=await resolveProperties({to:tx.to||undefined,from:tx.from||undefined});if(to!=null){tx.to=to}if(from!=null){tx.from=from}if(tx.from!=null){assertArgument(getAddress(tx.from)===this.address,"transaction from address mismatch","tx.from",tx.from);delete tx.from}const btx=Transaction.from(tx);const unSignedSerialized=btx.unsignedSerialized;const unsignedHash=sha256(unSignedSerialized);btx.signature=this.signingKey.sign(unsignedHash);return btx.serialized}async signMessage(message){return this.signMessageSync(message)}signMessageSync(message){return this.signingKey.sign(hashMessage(message))}async signTypedData(domain,types,value){const populated=await TypedDataEncoder.resolveNames(domain,types,value,async name=>{assert(this.provider!=null,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:name}});const address=getAddress(name);assert(address!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:name});return address});return this.signingKey.sign(TypedDataEncoder.hash(populated.domain,types,populated.value))}}const subsChrs=" !#$%&'()*+,-./<=>?@[]^_`{|}~";const Word=/^[a-z]*$/i;function unfold(words,sep){let initial=97;return words.reduce((accum,word)=>{if(word===sep){initial++}else if(word.match(Word)){accum.push(String.fromCharCode(initial)+word)}else{initial=97;accum.push(word)}return accum},[])}function decode(data,subs){for(let i=subsChrs.length-1;i>=0;i--){data=data.split(subsChrs[i]).join(subs.substring(2*i,2*i+2))}const clumps=[];const leftover=data.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(all,item,semi,word)=>{if(semi){for(let i=parseInt(semi);i>=0;i--){clumps.push(";")}}else{clumps.push(item.toLowerCase())}return""});if(leftover){throw new Error(`leftovers: ${JSON.stringify(leftover)}`)}return unfold(unfold(clumps,";"),":")}function decodeOwl(data){assertArgument(data[0]==="0","unsupported auwl data","data",data);return decode(data.substring(1+2*subsChrs.length),data.substring(1,1+2*subsChrs.length))}class Wordlist{locale;constructor(locale){defineProperties(this,{locale:locale})}split(phrase){return phrase.toLowerCase().split(/\s+/g)}join(words){return words.join(" ")}static check(wordlist){const words=[];for(let i=0;i<2048;i++){const word=wordlist.getWord(i);if(i!==wordlist.getWordIndex(word)){return"0x"}words.push(word)}return id(words.join("\n")+"\n")}}class WordlistOwl extends Wordlist{#data;#checksum;constructor(locale,data,checksum){super(locale);this.#data=data;this.#checksum=checksum;this.#words=null}get _data(){return this.#data}_decodeWords(){return decodeOwl(this.#data)}#words;#loadWords(){if(this.#words==null){const words=this._decodeWords();const checksum=id(words.join("\n")+"\n",true);if(checksum!==this.#checksum){throw new Error(`BIP39 Wordlist for ${this.locale} FffffAILED`)}this.#words=words}return this.#words}getWord(index){const words=this.#loadWords();assertArgument(index>=0&&index{const goldilockSaltPrefix="mnemonic";const aesSaltPrefix="mnemonicfortheAESkey";const goldilockSalt=utf8.encode(goldilockSaltPrefix+password);const aesSalt=utf8.encode(aesSaltPrefix+password);const goldilockKey=pbkdf2Sync(Buffer.from(mnemonic),goldilockSalt,2048,64,"sha512");const aesKeySeed=pbkdf2Sync(Buffer.from(mnemonic),aesSalt,2048,64,"sha512");return{aes:aesKeySeed.toString("hex"),goldilock:goldilockKey.toString("hex")}};function getUpperMask(bits){return(1<=12&&words.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const entropy=new Uint8Array(Math.ceil(11*words.length/8));let offset=0;for(let i=0;i=0,`invalid mnemonic word at index ${i}`,"mnemonic","[ REDACTED ]");for(let bit=0;bit<11;bit++){if(index&1<<10-bit){entropy[offset>>3]|=1<<7-offset%8}offset++}}const entropyBits=32*words.length/3;const checksumBits=words.length/3;const checksumMask=getUpperMask(checksumBits);const checksum=getBytes(legacySha256(entropy.slice(0,entropyBits/8)))[0]&checksumMask;assertArgument(checksum===(entropy[entropy.length-1]&checksumMask),"invalid mnemonic checksum","mnemonic","[ REDACTED ]");return hexlify(entropy.slice(0,entropyBits/8))}function entropyToMnemonic(entropy,wordlist){assertArgument(entropy.length%4===0&&entropy.length>=16&&entropy.length<=32,"invalid entropy size","entropy","[ REDACTED ]");if(wordlist==null){wordlist=LangEn.wordlist()}const indices=[0];let remainingBits=11;for(let i=0;i8){indices[indices.length-1]<<=8;indices[indices.length-1]|=entropy[i];remainingBits-=8}else{indices[indices.length-1]<<=remainingBits;indices[indices.length-1]|=entropy[i]>>8-remainingBits;indices.push(entropy[i]&getLowerMask(8-remainingBits));remainingBits+=3}}const checksumBits=entropy.length/4;const checksum=parseInt(legacySha256(entropy).substring(2,4),16)&getUpperMask(checksumBits);indices[indices.length-1]<<=checksumBits;indices[indices.length-1]|=checksum>>8-checksumBits;return wordlist.join(indices.map(index=>wordlist.getWord(index)))}const _guard$1={};class Mnemonic{phrase;password;wordlist;entropy;constructor(guard,entropy,phrase,password,wordlist){if(password==null){password=""}if(wordlist==null){wordlist=LangEn.wordlist()}assertPrivate(guard,_guard$1,"Mnemonic");defineProperties(this,{phrase:phrase,password:password,wordlist:wordlist,entropy:entropy})}computeSeed(){return mnemonicToSeed(this.phrase,this.password)}static fromPhrase({phrase,password,wordlist}){const entropy=mnemonicToEntropy(phrase,wordlist);phrase=entropyToMnemonic(getBytes(entropy),wordlist);return new Mnemonic(_guard$1,entropy,phrase,password,wordlist)}static fromEntropy(_entropy,password,wordlist){const entropy=getBytes(_entropy,"entropy");const phrase=entropyToMnemonic(entropy,wordlist);return new Mnemonic(_guard$1,hexlify(entropy),phrase,password,wordlist)}static entropyToPhrase(_entropy,wordlist){const entropy=getBytes(_entropy,"entropy");return entropyToMnemonic(entropy,wordlist)}static phraseToEntropy(phrase,wordlist){return mnemonicToEntropy(phrase,wordlist)}static isValidMnemonic(phrase,wordlist){try{mnemonicToEntropy(phrase,wordlist);return true}catch(error){}return false}}function looseArrayify(hexString){if(typeof hexString==="string"&&!hexString.startsWith("0x")){hexString="0x"+hexString}return getBytesCopy(hexString)}function zpad(value,length){value=String(value);while(value.length0&&(N&N-1)===0,"invalid kdf.N","kdf.N",N);assertArgument(r>0&&p>0,"invalid kdf","kdf",kdf);const dkLen=spelunk(data,"crypto.kdfparams.dklen:int!");assertArgument(dkLen===32,"invalid kdf.dklen","kdf.dflen",dkLen);return{name:"scrypt",salt:salt,N:N,r:r,p:p,dkLen:64}}else if(kdf.toLowerCase()==="pbkdf2"){const salt=spelunk(data,"crypto.kdfparams.salt:data!");const prf=spelunk(data,"crypto.kdfparams.prf:string!");const algorithm=prf.split("-").pop();assertArgument(algorithm==="sha256"||algorithm==="sha512","invalid kdf.pdf","kdf.pdf",prf);const count=spelunk(data,"crypto.kdfparams.c:int!");const dkLen=spelunk(data,"crypto.kdfparams.dklen:int!");assertArgument(dkLen===32,"invalid kdf.dklen","kdf.dklen",dkLen);return{name:"pbkdf2",salt:salt,count:count,dkLen:dkLen,algorithm:algorithm}}}assertArgument(false,"unsupported key-derivation function","kdf",kdf)}function decryptKeystoreJsonSync(json,_password){const data=JSON.parse(json);const password=getPassword(_password);const params=getDecryptKdfParams(data);if(params.name==="pbkdf2"){const{salt,count,dkLen,algorithm}=params;const key=pbkdf2(password,salt,count,dkLen,algorithm);return getAccount(data,key)}assert(params.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:params});const{salt,N,r,p,dkLen}=params;const key=scryptSync(password,salt,N,r,p,dkLen);return getAccount(data,key)}function stall$1(duration){return new Promise(resolve=>{setTimeout(()=>{resolve()},duration)})}async function decryptKeystoreJson(json,_password,progress){const data=JSON.parse(json);const password=getPassword(_password);const params=getDecryptKdfParams(data);if(params.name==="pbkdf2"){if(progress){progress(0);await stall$1(0)}const{salt,count,dkLen,algorithm}=params;const key=pbkdf2(password,salt,count,dkLen,algorithm);if(progress){progress(1);await stall$1(0)}return getAccount(data,key)}assert(params.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:params});const{salt,N,r,p,dkLen}=params;const key=await scrypt(password,salt,N,r,p,dkLen,progress);return getAccount(data,key)}function getEncryptKdfParams(options){const salt=options.salt!=null?getBytes(options.salt,"options.salt"):randomBytes(32);let N=1<<17,r=8,p=1;if(options.scrypt){if(options.scrypt.N){N=options.scrypt.N}if(options.scrypt.r){r=options.scrypt.r}if(options.scrypt.p){p=options.scrypt.p}}assertArgument(typeof N==="number"&&N>0&&Number.isSafeInteger(N)&&(BigInt(N)&BigInt(N-1))===BigInt(0),"invalid scrypt N parameter","options.N",N);assertArgument(typeof r==="number"&&r>0&&Number.isSafeInteger(r),"invalid scrypt r parameter","options.r",r);assertArgument(typeof p==="number"&&p>0&&Number.isSafeInteger(p),"invalid scrypt p parameter","options.p",p);return{name:"scrypt",dkLen:32,salt:salt,N:N,r:r,p:p}}function _encryptKeystore(key,kdf,account,options){const privateKey=getBytes(account.privateKey,"privateKey");const iv=options.iv!=null?getBytes(options.iv,"options.iv"):randomBytes(16);assertArgument(iv.length===16,"invalid options.iv length","options.iv",options.iv);const uuidRandom=options.uuid!=null?getBytes(options.uuid,"options.uuid"):randomBytes(16);assertArgument(uuidRandom.length===16,"invalid options.uuid length","options.uuid",options.iv);const derivedKey=key.slice(0,16);const macPrefix=key.slice(16,32);const aesCtr=new CTR(derivedKey,iv);const ciphertext=getBytes(aesCtr.encrypt(privateKey));const mac=sha256(concat([macPrefix,ciphertext]));const data={address:account.address.substring(2).toLowerCase(),id:uuidV4(uuidRandom),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:hexlify(iv).substring(2)},ciphertext:hexlify(ciphertext).substring(2),kdf:"scrypt",kdfparams:{salt:hexlify(kdf.salt).substring(2),n:kdf.N,dklen:32,p:kdf.p,r:kdf.r},mac:mac.substring(2)}};if(account.mnemonic){const client=options.client!=null?options.client:`corebc/${version}`;const path=account.mnemonic.path||defaultPath$1;const locale=account.mnemonic.locale||"en";const mnemonicKey=key.slice(32,64);const entropy=getBytes(account.mnemonic.entropy,"account.mnemonic.entropy");const mnemonicIv=randomBytes(16);const mnemonicAesCtr=new CTR(mnemonicKey,mnemonicIv);const mnemonicCiphertext=getBytes(mnemonicAesCtr.encrypt(entropy));const now=new Date;const timestamp=now.getUTCFullYear()+"-"+zpad(now.getUTCMonth()+1,2)+"-"+zpad(now.getUTCDate(),2)+"T"+zpad(now.getUTCHours(),2)+"-"+zpad(now.getUTCMinutes(),2)+"-"+zpad(now.getUTCSeconds(),2)+".0Z";const gethFilename="UTC--"+timestamp+"--"+data.address;data["x-corebc"]={client:client,gethFilename:gethFilename,path:path,locale:locale,mnemonicCounter:hexlify(mnemonicIv).substring(2),mnemonicCiphertext:hexlify(mnemonicCiphertext).substring(2),version:"0.1"}}return JSON.stringify(data)}function encryptKeystoreJsonSync(account,password,options){if(options==null){options={}}const passwordBytes=getPassword(password);const kdf=getEncryptKdfParams(options);const key=scryptSync(passwordBytes,kdf.salt,kdf.N,kdf.r,kdf.p,64);return _encryptKeystore(getBytes(key),kdf,account,options)}async function encryptKeystoreJson(account,password,options){if(options==null){options={}}const passwordBytes=getPassword(password);const kdf=getEncryptKdfParams(options);const key=await scrypt(passwordBytes,kdf.salt,kdf.N,kdf.r,kdf.p,64,options.progressCallback);return _encryptKeystore(getBytes(key),kdf,account,options)}const defaultPath="m";const HardenedBit=2147483648;const _guard={};function derivePath(node,path){const components=path.split("/");assertArgument(components.length>0&&(components[0]==="m"||node.depth>0),"invalid path","path",path);if(components[0]==="m"){components.shift()}let result=node;for(let i=0;i=0&&index=0&&index{setTimeout(()=>{resolve()},duration)})}class Wallet extends BaseWallet{constructor({key,prefix,provider}){if(typeof key==="string"&&!key.startsWith("0x")){key="0x"+key}let signingKey=typeof key==="string"?new SigningKey(key):key;super({signingKey:signingKey,prefix:prefix,provider:provider})}connect(provider){return new Wallet({key:this.signingKey,prefix:this.prefix,provider:provider})}async encrypt(password,progressCallback){const account={address:this.address,privateKey:this.privateKey};return await encryptKeystoreJson(account,password,{progressCallback:progressCallback})}encryptSync(password){const account={address:this.address,privateKey:this.privateKey};return encryptKeystoreJsonSync(account,password)}static#fromAccount(account){assertArgument(account,"invalid JSON wallet","json","[ REDACTED ]");const address=account.address;const prefix=extractPrefix(address);if("mnemonic"in account&&account.mnemonic&&account.mnemonic.locale==="en"){const mnemonic=Mnemonic.fromEntropy(account.mnemonic.entropy);const wallet=HDNodeWallet.fromMnemonic(mnemonic,prefix,account.mnemonic.path);if(wallet.address===account.address&&wallet.privateKey===account.privateKey){return wallet}console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const wallet=new Wallet({key:account.privateKey,prefix:prefix});assertArgument(wallet.address===account.address,"address/privateKey mismatch","json","[ REDACTED ]");return wallet}static async fromEncryptedJson(json,password,progress){let account=null;if(isKeystoreJson(json)){account=await decryptKeystoreJson(json,password,progress)}else if(isCrowdsaleJson(json)){if(progress){progress(0);await stall(0)}account=decryptCrowdsaleJson(json,password);if(progress){progress(1);await stall(0)}}return Wallet.#fromAccount(account)}static fromEncryptedJsonSync(json,password){let account=null;if(isKeystoreJson(json)){account=decryptKeystoreJsonSync(json,password)}else if(isCrowdsaleJson(json)){account=decryptCrowdsaleJson(json,password)}else{assertArgument(false,"invalid JSON wallet","json","[ REDACTED ]")}return Wallet.#fromAccount(account)}static createRandom(prefix,provider){const wallet=HDNodeWallet.createRandom(prefix,undefined,undefined,undefined);if(provider){return wallet.connect(provider)}return wallet}static fromPhrase({phrase,prefix,provider,password}){const wallet=HDNodeWallet.fromPhrase({phrase:phrase,prefix:prefix,password:password});if(provider){return wallet.connect(provider)}return wallet}static fromSeed({seed,prefix,provider,path}){const wallet=HDNodeWallet.fromSeed({seed:seed,prefix:prefix,path:path||defaultPath});if(provider){return wallet.connect(provider)}return wallet}}const Base64=")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";function decodeBits(width,data){const maxValue=(1<=width){const value=accum>>bits-width;accum&=(1<{const match=accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);assertArgument(match!==null,"internal error parsing accents","accents",accents);let posOffset=0;const positions=decodeBits(parseInt(match[3]),match[4]);const charCode=parseInt(match[2]);const regex=new RegExp(`([${match[1]}])`,"g");words=words.replace(regex,(all,letter)=>{const rem=--positions[posOffset];if(rem===0){letter=String.fromCharCode(letter.charCodeAt(0),charCode);posOffset++}return letter})});return words.split(",")}class WordlistOwlA extends WordlistOwl{#accent;constructor(locale,data,accent,checksum){super(locale,data,checksum);this.#accent=accent}get _accent(){return this.#accent}_decodeWords(){return decodeOwlA(this._data,this._accent)}}const wordlists={en:LangEn.wordlist()};var corebc=Object.freeze({__proto__:null,AbiCoder:AbiCoder,AbstractProvider:AbstractProvider,AbstractSigner:AbstractSigner,AlchemyProvider:AlchemyProvider,AnkrProvider:AnkrProvider,BaseContract:BaseContract,BaseWallet:BaseWallet,BigNumber:BigNumber,Block:Block,BrowserProvider:BrowserProvider,CloudflareProvider:CloudflareProvider,ConstructorFragment:ConstructorFragment,Contract:Contract,ContractEventPayload:ContractEventPayload,ContractFactory:ContractFactory,ContractTransactionReceipt:ContractTransactionReceipt,ContractTransactionResponse:ContractTransactionResponse,ContractUnknownEventPayload:ContractUnknownEventPayload,CoreSymbol:CoreSymbol,Ed448Goldilock:Ed448Goldilock,EnergyCostPlugin:EnergyCostPlugin,ErrorDescription:ErrorDescription,ErrorFragment:ErrorFragment,EventFragment:EventFragment,EventLog:EventLog,EventPayload:EventPayload,FallbackFragment:FallbackFragment,FallbackProvider:FallbackProvider,FeeData:FeeData,FeeDataNetworkPlugin:FeeDataNetworkPlugin,FetchCancelSignal:FetchCancelSignal,FetchRequest:FetchRequest,FetchResponse:FetchResponse,FixedNumber:FixedNumber,Fragment:Fragment,FunctionFragment:FunctionFragment,HDNodeWallet:HDNodeWallet,Indexed:Indexed,InfuraProvider:InfuraProvider,InfuraWebSocketProvider:InfuraWebSocketProvider,Interface:Interface,IpcSocketProvider:IpcSocketProvider,JsonRpcApiProvider:JsonRpcApiProvider,JsonRpcProvider:JsonRpcProvider,JsonRpcSigner:JsonRpcSigner,LangEn:LangEn,Log:Log,LogDescription:LogDescription,MaxInt256:MaxInt256,MaxUint256:MaxUint256,MessagePrefix:MessagePrefix,MinInt256:MinInt256,Mnemonic:Mnemonic,N:N,NamedFragment:NamedFragment,Network:Network,NetworkPlugin:NetworkPlugin,NonceManager:NonceManager,OrePerXCB:OrePerXCB,ParamType:ParamType,PocketProvider:PocketProvider,QuickNodeProvider:QuickNodeProvider,Result:Result,Signature:Signature,SigningKey:SigningKey,SocketBlockSubscriber:SocketBlockSubscriber,SocketEventSubscriber:SocketEventSubscriber,SocketPendingSubscriber:SocketPendingSubscriber,SocketProvider:SocketProvider,SocketSubscriber:SocketSubscriber,StructFragment:StructFragment,Transaction:Transaction,TransactionDescription:TransactionDescription,TransactionReceipt:TransactionReceipt,TransactionResponse:TransactionResponse,Typed:Typed,TypedDataEncoder:TypedDataEncoder,UnmanagedSubscriber:UnmanagedSubscriber,Utf8ErrorFuncs:Utf8ErrorFuncs,VoidSigner:VoidSigner,Wallet:Wallet,WebSocketProvider:WebSocketProvider,Wordlist:Wordlist,WordlistOwl:WordlistOwl,WordlistOwlA:WordlistOwlA,ZeroAddress:ZeroAddress,ZeroHash:ZeroHash,accessListify:accessListify,arrayify:arrayify,assert:assert,assertArgument:assertArgument,assertArgumentCount:assertArgumentCount,assertNormalize:assertNormalize,assertPrivate:assertPrivate,checkResultErrors:checkResultErrors,computeAddress:computeAddress,computeHmac:computeHmac,concat:concat,copyRequest:copyRequest,dataLength:dataLength,dataSlice:dataSlice,decodeBase58:decodeBase58,decodeBase64:decodeBase64,decodeBytes32String:decodeBytes32String,decodeRlp:decodeRlp,decryptCrowdsaleJson:decryptCrowdsaleJson,decryptKeystoreJson:decryptKeystoreJson,decryptKeystoreJsonSync:decryptKeystoreJsonSync,defaultPath:defaultPath,defineProperties:defineProperties,encodeBase58:encodeBase58,encodeBase64:encodeBase64,encodeBytes32String:encodeBytes32String,encodeRlp:encodeRlp,encryptKeystoreJson:encryptKeystoreJson,encryptKeystoreJsonSync:encryptKeystoreJsonSync,formatUnits:formatUnits,formatXCB:formatXCB,fromTwos:fromTwos,getAccountPath:getAccountPath,getAddress:getAddress,getBigInt:getBigInt,getBytes:getBytes,getBytesCopy:getBytesCopy,getCreate2Address:getCreate2Address,getCreateAddress:getCreateAddress,getDefaultProvider:getDefaultProvider,getIndexedAccountPath:getIndexedAccountPath,getNumber:getNumber,getUint:getUint,hashMessage:hashMessage,hexConcat:hexConcat,hexlify:hexlify,id:id,isAddress:isAddress,isAddressable:isAddressable,isBytesLike:isBytesLike,isCallException:isCallException,isCrowdsaleJson:isCrowdsaleJson,isError:isError,isHexString:isHexString,isKeystoreJson:isKeystoreJson,keccak256:keccak256,lock:lock,makeError:makeError,mask:mask,networkIdToPrefix:networkIdToPrefix,parseUnits:parseUnits,parseXCB:parseXCB,pbkdf2:pbkdf2,publicToAddress:publicToAddress,randomBytes:randomBytes,recoverAddress:recoverAddress,resolveAddress:resolveAddress,resolveProperties:resolveProperties,ripemd160:ripemd160,scrypt:scrypt,scryptSync:scryptSync,sha256:sha256,sha512:sha512,showThrottleMessage:showThrottleMessage,solidityPacked:solidityPacked,solidityPackedSha256:solidityPackedSha256,stripZerosLeft:stripZerosLeft,toBeArray:toBeArray,toBeHex:toBeHex,toBigInt:toBigInt,toNumber:toNumber,toQuantity:toQuantity,toTwos:toTwos,toUtf8Bytes:toUtf8Bytes,toUtf8CodePoints:toUtf8CodePoints,toUtf8String:toUtf8String,uuidV4:uuidV4,verifyMessage:verifyMessage,verifyTypedData:verifyTypedData,version:version,wordlists:wordlists,zeroPadBytes:zeroPadBytes,zeroPadValue:zeroPadValue});export{AbiCoder,AbstractProvider,AbstractSigner,AlchemyProvider,AnkrProvider,BaseContract,BaseWallet,BigNumber,Block,BrowserProvider,CloudflareProvider,ConstructorFragment,Contract,ContractEventPayload,ContractFactory,ContractTransactionReceipt,ContractTransactionResponse,ContractUnknownEventPayload,CoreSymbol,Ed448Goldilock,EnergyCostPlugin,ErrorDescription,ErrorFragment,EventFragment,EventLog,EventPayload,FallbackFragment,FallbackProvider,FeeData,FeeDataNetworkPlugin,FetchCancelSignal,FetchRequest,FetchResponse,FixedNumber,Fragment,FunctionFragment,HDNodeWallet,Indexed,InfuraProvider,InfuraWebSocketProvider,Interface,IpcSocketProvider,JsonRpcApiProvider,JsonRpcProvider,JsonRpcSigner,LangEn,Log,LogDescription,MaxInt256,MaxUint256,MessagePrefix,MinInt256,Mnemonic,N,NamedFragment,Network,NetworkPlugin,NonceManager,OrePerXCB,ParamType,PocketProvider,QuickNodeProvider,Result,Signature,SigningKey,SocketBlockSubscriber,SocketEventSubscriber,SocketPendingSubscriber,SocketProvider,SocketSubscriber,StructFragment,Transaction,TransactionDescription,TransactionReceipt,TransactionResponse,Typed,TypedDataEncoder,UnmanagedSubscriber,Utf8ErrorFuncs,VoidSigner,Wallet,WebSocketProvider,Wordlist,WordlistOwl,WordlistOwlA,ZeroAddress,ZeroHash,accessListify,arrayify,assert,assertArgument,assertArgumentCount,assertNormalize,assertPrivate,checkResultErrors,computeAddress,computeHmac,concat,copyRequest,corebc,dataLength,dataSlice,decodeBase58,decodeBase64,decodeBytes32String,decodeRlp,decryptCrowdsaleJson,decryptKeystoreJson,decryptKeystoreJsonSync,defaultPath,defineProperties,encodeBase58,encodeBase64,encodeBytes32String,encodeRlp,encryptKeystoreJson,encryptKeystoreJsonSync,formatUnits,formatXCB,fromTwos,getAccountPath,getAddress,getBigInt,getBytes,getBytesCopy,getCreate2Address,getCreateAddress,getDefaultProvider,getIndexedAccountPath,getNumber,getUint,hashMessage,hexConcat,hexlify,id,isAddress,isAddressable,isBytesLike,isCallException,isCrowdsaleJson,isError,isHexString,isKeystoreJson,keccak256,lock,makeError,mask,networkIdToPrefix,parseUnits,parseXCB,pbkdf2,publicToAddress,randomBytes,recoverAddress,resolveAddress,resolveProperties,ripemd160,scrypt,scryptSync,sha256,sha512,showThrottleMessage,solidityPacked,solidityPackedSha256,stripZerosLeft,toBeArray,toBeHex,toBigInt,toNumber,toQuantity,toTwos,toUtf8Bytes,toUtf8CodePoints,toUtf8String,uuidV4,verifyMessage,verifyTypedData,version,wordlists,zeroPadBytes,zeroPadValue}; \ No newline at end of file diff --git a/dist/corebc.umd.js b/dist/corebc.umd.js deleted file mode 100644 index b17f76aad..000000000 --- a/dist/corebc.umd.js +++ /dev/null @@ -1,19982 +0,0 @@ -const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !== 'undefined' ? window: typeof global !== 'undefined' ? global: typeof self !== 'undefined' ? self: {}); -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('buffer'), require('bcrypto/lib/ed448-browser.js'), require('bn.js'), require('bcrypto/lib/pbkdf2-browser.js'), require('bcrypto/lib/sha3-512.js'), require('utf8'), require('aes-js')) : - typeof define === 'function' && define.amd ? define(['exports', 'buffer', 'bcrypto/lib/ed448-browser.js', 'bn.js', 'bcrypto/lib/pbkdf2-browser.js', 'bcrypto/lib/sha3-512.js', 'utf8', 'aes-js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.corebc = {}, global.buffer, global.ed448, global._BN, global.pbkdf2$2, global.SHA3_512, global.utf8, global.pkg)); -})(this, (function (exports, buffer, ed448, _BN, pbkdf2$2, SHA3_512, utf8, pkg) { 'use strict'; - - /* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ - /** - * The current version of corebc. - */ - const version = "6.4.0"; - - let _permanentCensorErrors = false; - let _censorErrors = false; - const LogLevels = { - debug: 1, - default: 2, - info: 2, - warning: 3, - error: 4, - off: 5, - }; - let _logLevel = LogLevels["default"]; - let _globalLogger = null; - function _checkNormalize() { - try { - const missing = []; - // Make sure all forms of normalization are supported - ["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => { - try { - if ("test".normalize(form) !== "test") { - throw new Error("bad normalize"); - } - } - catch (error) { - missing.push(form); - } - }); - if (missing.length) { - throw new Error("missing " + missing.join(", ")); - } - if (String.fromCharCode(0xe9).normalize("NFD") !== - String.fromCharCode(0x65, 0x0301)) { - throw new Error("broken implementation"); - } - } - catch (error) { - return error.message; - } - return null; - } - const _normalizeError = _checkNormalize(); - var LogLevel; - (function (LogLevel) { - LogLevel["DEBUG"] = "DEBUG"; - LogLevel["INFO"] = "INFO"; - LogLevel["WARNING"] = "WARNING"; - LogLevel["ERROR"] = "ERROR"; - LogLevel["OFF"] = "OFF"; - })(LogLevel || (LogLevel = {})); - var ErrorCode; - (function (ErrorCode) { - /////////////////// - // Generic Errors - // Unknown Error - ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; - // Not Implemented - ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED"; - // Unsupported Operation - // - operation - ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION"; - // Network Error (i.e. Core Network, such as an invalid network ID) - // - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown) - ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR"; - // Some sort of bad response from the server - ErrorCode["SERVER_ERROR"] = "SERVER_ERROR"; - // Timeout - ErrorCode["TIMEOUT"] = "TIMEOUT"; - /////////////////// - // Operational Errors - // Buffer Overrun - ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN"; - // Numeric Fault - // - operation: the operation being executed - // - fault: the reason this faulted - ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT"; - /////////////////// - // Argument Errors - // Missing new operator to an object - // - name: The name of the class - ErrorCode["MISSING_NEW"] = "MISSING_NEW"; - // Invalid argument (e.g. value is incompatible with type) to a function: - // - argument: The argument name that was invalid - // - value: The value of the argument - ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT"; - // Missing argument to a function: - // - count: The number of arguments received - // - expectedCount: The number of arguments expected - ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT"; - // Too many arguments - // - count: The number of arguments received - // - expectedCount: The number of arguments expected - ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT"; - /////////////////// - // Blockchain Errors - // Call exception - // - transaction: the transaction - // - address?: the contract address - // - args?: The arguments passed into the function - // - method?: The Solidity method signature - // - errorSignature?: The EIP848 error signature - // - errorArgs?: The EIP848 error parameters - // - reason: The reason (only for EIP848 "Error(string)") - ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION"; - // Insufficient funds (< value + energyLimit * energyPrice) - // - transaction: the transaction attempted - ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; - // Nonce has already been used - // - transaction: the transaction attempted - ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED"; - // The replacement fee for the transaction is too low - // - transaction: the transaction attempted - ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED"; - // The energy limit could not be estimated - // - transaction: the transaction passed to estimateEnergy - ErrorCode["UNPREDICTABLE_ENERGY_LIMIT"] = "UNPREDICTABLE_ENERGY_LIMIT"; - // The transaction was replaced by one with a higher energy price - // - reason: "cancelled", "replaced" or "repriced" - // - cancelled: true if reason == "cancelled" or reason == "replaced") - // - hash: original transaction hash - // - replacement: the full TransactionsResponse for the replacement - // - receipt: the receipt of the replacement - ErrorCode["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED"; - })(ErrorCode || (ErrorCode = {})); - const HEX = "0123456789abcdef"; - class Logger { - version = "0.0.1"; - static errors = ErrorCode; - static levels = LogLevel; - constructor(version) { - Object.defineProperty(this, "version", { - enumerable: true, - value: version, - writable: false, - }); - } - _log(logLevel, args) { - const level = logLevel.toLowerCase(); - if (LogLevels[level] == null) { - this.throwArgumentError("invalid log level name", "logLevel", logLevel); - } - if (_logLevel > LogLevels[level]) { - return; - } - console.log.apply(console, args); - } - debug(...args) { - this._log(Logger.levels.DEBUG, args); - } - info(...args) { - this._log(Logger.levels.INFO, args); - } - warn(...args) { - this._log(Logger.levels.WARNING, args); - } - makeError(message, code, params) { - // Errors are being censored - if (_censorErrors) { - return this.makeError("censored error", code, {}); - } - if (!code) { - code = Logger.errors.UNKNOWN_ERROR; - } - if (!params) { - params = {}; - } - const messageDetails = []; - Object.keys(params).forEach((key) => { - const value = params[key]; - try { - if (value instanceof Uint8Array) { - let hex = ""; - for (let i = 0; i < value.length; i++) { - hex += HEX[value[i] >> 4]; - hex += HEX[value[i] & 0x0f]; - } - messageDetails.push(key + "=Uint8Array(0x" + hex + ")"); - } - else { - messageDetails.push(key + "=" + JSON.stringify(value)); - } - } - catch (error) { - messageDetails.push(key + "=" + JSON.stringify(params[key].toString())); - } - }); - messageDetails.push(`code=${code}`); - messageDetails.push(`version=${this.version}`); - const reason = message; - if (messageDetails.length) { - message += " (" + messageDetails.join(", ") + ")"; - } - // @TODO: Any?? - const error = new Error(message); - error.reason = reason; - error.code = code; - Object.keys(params).forEach(function (key) { - error[key] = params[key]; - }); - return error; - } - throwError(message, code, params) { - throw this.makeError(message, code, params); - } - throwArgumentError(message, name, value) { - return this.throwError(message, Logger.errors.INVALID_ARGUMENT, { - argument: name, - value: value, - }); - } - assert(condition, message, code, params) { - if (!!condition) { - return; - } - this.throwError(message, code, params); - } - assertArgument(condition, message, name, value) { - if (!!condition) { - return; - } - this.throwArgumentError(message, name, value); - } - checkNormalize(message) { - if (_normalizeError) { - this.throwError("platform missing String.prototype.normalize", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "String.prototype.normalize", - form: _normalizeError, - }); - } - } - checkSafeUint53(value, message) { - if (typeof value !== "number") { - return; - } - if (message == null) { - message = "value not safe"; - } - if (value < 0 || value >= 0x1fffffffffffff) { - this.throwError(message, Logger.errors.NUMERIC_FAULT, { - operation: "checkSafeInteger", - fault: "out-of-safe-range", - value: value, - }); - } - if (value % 1) { - this.throwError(message, Logger.errors.NUMERIC_FAULT, { - operation: "checkSafeInteger", - fault: "non-integer", - value: value, - }); - } - } - checkArgumentCount(count, expectedCount, message) { - if (message) { - message = ": " + message; - } - else { - message = ""; - } - if (count < expectedCount) { - this.throwError("missing argument" + message, Logger.errors.MISSING_ARGUMENT, { - count: count, - expectedCount: expectedCount, - }); - } - if (count > expectedCount) { - this.throwError("too many arguments" + message, Logger.errors.UNEXPECTED_ARGUMENT, { - count: count, - expectedCount: expectedCount, - }); - } - } - checkNew(target, kind) { - if (target === Object || target == null) { - this.throwError("missing new", Logger.errors.MISSING_NEW, { - name: kind.name, - }); - } - } - checkAbstract(target, kind) { - if (target === kind) { - this.throwError("cannot instantiate abstract class " + - JSON.stringify(kind.name) + - " directly; use a sub-class", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" }); - } - else if (target === Object || target == null) { - this.throwError("missing new", Logger.errors.MISSING_NEW, { - name: kind.name, - }); - } - } - static globalLogger() { - if (!_globalLogger) { - _globalLogger = new Logger("logger/0.0.1"); - } - return _globalLogger; - } - static setCensorship(censorship, permanent) { - if (!censorship && permanent) { - this.globalLogger().throwError("cannot permanently disable censorship", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "setCensorship", - }); - } - if (_permanentCensorErrors) { - if (!censorship) { - return; - } - this.globalLogger().throwError("error censorship permanent", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "setCensorship", - }); - } - _censorErrors = !!censorship; - _permanentCensorErrors = !!permanent; - } - static setLogLevel(logLevel) { - const level = LogLevels[logLevel.toLowerCase()]; - if (level == null) { - Logger.globalLogger().warn("invalid log level - " + logLevel); - return; - } - _logLevel = level; - } - static from(version) { - return new Logger(version); - } - } - - /** - * Property helper functions. - * - * @_subsection api/utils:Properties [about-properties] - */ - const logger$7 = new Logger("utils/properties/0.0.1"); - function checkType(value, type, name) { - const types = type.split("|").map((t) => t.trim()); - for (let i = 0; i < types.length; i++) { - switch (type) { - case "any": - return; - case "bigint": - case "boolean": - case "number": - case "string": - if (typeof value === type) { - return; - } - } - } - const error = new Error(`invalid value for type ${type}`); - error.code = "INVALID_ARGUMENT"; - error.argument = `value.${name}`; - error.value = value; - throw error; - } - /** - * Resolves to a new object that is a copy of %%value%%, but with all - * values resolved. - */ - async function resolveProperties(value) { - const keys = Object.keys(value); - const results = await Promise.all(keys.map((k) => Promise.resolve(value[k]))); - return results.reduce((accum, v, index) => { - accum[keys[index]] = v; - return accum; - }, {}); - } - /** - * Assigns the %%values%% to %%target%% as read-only values. - * - * It %%types%% is specified, the values are checked. - */ - function defineProperties(target, values, types) { - for (let key in values) { - let value = values[key]; - const type = types ? types[key] : null; - if (type) { - checkType(value, type, key); - } - Object.defineProperty(target, key, { - enumerable: true, - value, - writable: false, - }); - } - } - function checkProperties(object, properties) { - if (!object || typeof object !== "object") { - logger$7.throwArgumentError("invalid object", "object", object); - } - Object.keys(object).forEach((key) => { - if (!properties[key]) { - logger$7.throwArgumentError("invalid object key - " + key, "transaction:" + key, object); - } - }); - } - - /** - * About Errors. - * - * @_section: api/utils/errors:Errors [about-errors] - */ - function stringify$1(value) { - if (value == null) { - return "null"; - } - if (Array.isArray(value)) { - return "[ " + value.map(stringify$1).join(", ") + " ]"; - } - if (value instanceof Uint8Array) { - const HEX = "0123456789abcdef"; - let result = "0x"; - for (let i = 0; i < value.length; i++) { - result += HEX[value[i] >> 4]; - result += HEX[value[i] & 0xf]; - } - return result; - } - if (typeof value === "object" && typeof value.toJSON === "function") { - return stringify$1(value.toJSON()); - } - switch (typeof value) { - case "boolean": - case "symbol": - return value.toString(); - case "bigint": - return BigInt(value).toString(); - case "number": - return value.toString(); - case "string": - return JSON.stringify(value); - case "object": { - const keys = Object.keys(value); - keys.sort(); - return ("{ " + - keys.map((k) => `${stringify$1(k)}: ${stringify$1(value[k])}`).join(", ") + - " }"); - } - } - return `[ COULD NOT SERIALIZE ]`; - } - /** - * Returns true if the %%error%% matches an error thrown by corebc - * that matches the error %%code%%. - * - * In TypeScript envornoments, this can be used to check that %%error%% - * matches an corebcError type, which means the expected properties will - * be set. - * - * @See [ErrorCodes](api:ErrorCode) - * @example - * try { - * // code.... - * } catch (e) { - * if (isError(e, "CALL_EXCEPTION")) { - * // The Type Guard has validated this object - * console.log(e.data); - * } - * } - */ - function isError(error, code) { - return error && error.code === code; - } - /** - * Returns true if %%error%% is a [[CallExceptionError]. - */ - function isCallException(error) { - return isError(error, "CALL_EXCEPTION"); - } - /** - * Returns a new Error configured to the format corebc emits errors, with - * the %%message%%, [[api:ErrorCode]] %%code%% and additioanl properties - * for the corresponding corebcError. - * - * Each error in corebc includes the version of corebc, a - * machine-readable [[ErrorCode]], and depneding on %%code%%, additional - * required properties. The error message will also include the %%meeage%%, - * corebc version, %%code%% and all aditional properties, serialized. - */ - function makeError(message, code, info) { - { - const details = []; - if (info) { - if ("message" in info || "code" in info || "name" in info) { - throw new Error(`value will overwrite populated values: ${stringify$1(info)}`); - } - for (const key in info) { - const value = info[key]; - // try { - details.push(key + "=" + stringify$1(value)); - // } catch (error: any) { - // console.log("MMM", error.message); - // details.push(key + "=[could not serialize object]"); - // } - } - } - details.push(`code=${code}`); - details.push(`version=${version}`); - if (details.length) { - message += " (" + details.join(", ") + ")"; - } - } - let error; - switch (code) { - case "INVALID_ARGUMENT": - error = new TypeError(message); - break; - case "NUMERIC_FAULT": - case "BUFFER_OVERRUN": - error = new RangeError(message); - break; - default: - error = new Error(message); - } - defineProperties(error, { code }); - if (info) { - Object.assign(error, info); - } - return error; - } - /** - * Throws an corebcError with %%message%%, %%code%% and additional error - * %%info%% when %%check%% is falsish.. - * - * @see [[api:makeError]] - */ - function assert(check, message, code, info) { - if (!check) { - throw makeError(message, code, info); - } - } - /** - * A simple helper to simply ensuring provided arguments match expected - * constraints, throwing if not. - * - * In TypeScript environments, the %%check%% has been asserted true, so - * any further code does not need additional compile-time checks. - */ - function assertArgument(check, message, name, value) { - assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); - } - function assertArgumentCount(count, expectedCount, message) { - if (message == null) { - message = ""; - } - if (message) { - message = ": " + message; - } - assert(count >= expectedCount, "missing arguemnt" + message, "MISSING_ARGUMENT", { - count: count, - expectedCount: expectedCount, - }); - assert(count <= expectedCount, "too many arguemnts" + message, "UNEXPECTED_ARGUMENT", { - count: count, - expectedCount: expectedCount, - }); - } - const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => { - try { - // General test for normalize - /* c8 ignore start */ - if ("test".normalize(form) !== "test") { - throw new Error("bad"); - } - /* c8 ignore stop */ - if (form === "NFD") { - const check = String.fromCharCode(0xe9).normalize("NFD"); - const expected = String.fromCharCode(0x65, 0x0301); - /* c8 ignore start */ - if (check !== expected) { - throw new Error("broken"); - } - /* c8 ignore stop */ - } - accum.push(form); - } - catch (error) { } - return accum; - }, []); - /** - * Throws if the normalization %%form%% is not supported. - */ - function assertNormalize(form) { - assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", { - operation: "String.prototype.normalize", - info: { form }, - }); - } - /** - * Many classes use file-scoped values to guard the constructor, - * making it effectively private. This facilitates that pattern - * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, - * throwing if not, indicating the %%className%% if provided. - */ - function assertPrivate(givenGuard, guard, className) { - if (className == null) { - className = ""; - } - if (givenGuard !== guard) { - let method = className, operation = "new"; - if (className) { - method += "."; - operation += " " + className; - } - assert(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", { - operation, - }); - } - } - - /** - * Some data helpers. - * - * - * @_subsection api/utils:Data Helpers [about-data] - */ - const logger$6 = new Logger("utils/data/0.0.1"); - function isHexable(value) { - return !!value.toHexString; - } - function isInteger(value) { - return typeof value === "number" && value == value && value % 1 === 0; - } - function isBytes(value) { - if (value == null) { - return false; - } - if (value.constructor === Uint8Array) { - return true; - } - if (typeof value === "string") { - return false; - } - if (!isInteger(value.length) || value.length < 0) { - return false; - } - for (let i = 0; i < value.length; i++) { - const v = value[i]; - if (!isInteger(v) || v < 0 || v >= 256) { - return false; - } - } - return true; - } - function _getBytes(value, name, copy) { - if (value instanceof Uint8Array) { - if (copy) { - return new Uint8Array(value); - } - return value; - } - if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) { - const result = new Uint8Array((value.length - 2) / 2); - let offset = 2; - for (let i = 0; i < result.length; i++) { - result[i] = parseInt(value.substring(offset, offset + 2), 16); - offset += 2; - } - return result; - } - assertArgument(false, "invalid BytesLike value", name || "value", value); - } - /** - * Get a typed Uint8Array for %%value%%. If already a Uint8Array - * the original %%value%% is returned; if a copy is required use - * [[getBytesCopy]]. - * - * @see: getBytesCopy - */ - function getBytes(value, name) { - return _getBytes(value, name, false); - } - /** - * Get a typed Uint8Array for %%value%%, creating a copy if necessary - * to prevent any modifications of the returned value from being - * reflected elsewhere. - * - * @see: getBytes - */ - function getBytesCopy(value, name) { - return _getBytes(value, name, true); - } - /** - * Returns true if %%value%% is a valid [[HexString]]. - * - * If %%length%% is ``true`` or a //number//, it also checks that - * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) - * bytes of data (e.g. ``0x1234`` is 2 bytes). - */ - function isHexString(value, length) { - if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { - return false; - } - if (typeof length === "number" && value.length !== 2 + 2 * length) { - return false; - } - if (length === true && value.length % 2 !== 0) { - return false; - } - return true; - } - /** - * Returns true if %%value%% is a valid representation of arbitrary - * data (i.e. a valid [[DataHexString]] or a Uint8Array). - */ - function isBytesLike(value) { - return isHexString(value, true) || value instanceof Uint8Array; - } - const HexCharacters = "0123456789abcdef"; - /** - * Returns a [[DataHexString]] representation of %%data%%. - */ - function hexlify(value, options) { - if (!options) { - options = {}; - } - if (typeof value === "string") { - if (value.includes(",") && value.startsWith("0x")) { - const v = value - .replace("0x", "") - .split(",") - .map((item) => Number(item)); - // @ts-ignore - value = new Uint8Array(v); - } - } - if (typeof value === "number") { - logger$6.checkSafeUint53(value, "invalid hexlify value"); - let hex = ""; - while (value) { - hex = HexCharacters[value & 0xf] + hex; - value = Math.floor(value / 16); - } - if (hex.length) { - if (hex.length % 2) { - hex = "0" + hex; - } - return "0x" + hex; - } - return "0x00"; - } - if (typeof value === "bigint") { - value = value.toString(16); - if (value.length % 2) { - return "0x0" + value; - } - return "0x" + value; - } - if (options.allowMissingPrefix && - typeof value === "string" && - value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - if (isHexable(value)) { - return value.toHexString(); - } - if (isHexString(value)) { - if (value.length % 2) { - if (options.hexPad === "left") { - value = "0x0" + value.substring(2); - } - else if (options.hexPad === "right") { - value += "0"; - } - else { - logger$6.throwArgumentError("hex data is odd-length", "value", value); - } - } - return value.toLowerCase(); - } - if (isBytes(value)) { - let result = "0x"; - for (let i = 0; i < value.length; i++) { - let v = value[i]; - result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; - } - return result; - } - return logger$6.throwArgumentError("invalid hexlify value", "value", value); - } - /** - * Returns a [[DataHexString]] by concatenating all values - * within %%data%%. - */ - function concat(items) { - return "0x" + items.map((d) => hexlify(d).substring(2)).join(""); - } - function hexDataSlice(data, offset, endOffset) { - if (typeof data !== "string") { - data = hexlify(data); - } - else if (!isHexString(data) || data.length % 2) { - logger$6.throwArgumentError("invalid hexData", "value", data); - } - offset = 2 + 2 * offset; - if (endOffset != null) { - return "0x" + data.substring(offset, 2 + 2 * endOffset); - } - return "0x" + data.substring(offset); - } - function hexDataLength(data) { - if (typeof data !== "string") { - data = hexlify(data); - } - else if (!isHexString(data) || data.length % 2) { - return null; - } - return (data.length - 2) / 2; - } - /** - * Returns the length of %%data%%, in bytes. - */ - function dataLength(data) { - if (isHexString(data, true)) { - return (data.length - 2) / 2; - } - return getBytes(data).length; - } - /** - * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% - * offset to the %%end%% offset. - * - * By default %%start%% is 0 and %%end%% is the length of %%data%%. - */ - function dataSlice(data, start, end) { - const bytes = getBytes(data); - if (end != null && end > bytes.length) { - assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { - buffer: bytes, - length: bytes.length, - offset: end, - }); - } - return hexlify(bytes.slice(start == null ? 0 : start, end == null ? bytes.length : end)); - } - /** - * Return the [[DataHexString]] result by stripping all **leading** - ** zero bytes from %%data%%. - */ - function stripZerosLeft(data) { - let bytes = hexlify(data).substring(2); - while (bytes.startsWith("00")) { - bytes = bytes.substring(2); - } - return "0x" + bytes; - } - function zeroPad(data, length, left) { - const bytes = getBytes(data); - assert(length >= bytes.length, "padding exceeds data length", "BUFFER_OVERRUN", { - buffer: new Uint8Array(bytes), - length: length, - offset: length + 1, - }); - const result = new Uint8Array(length); - result.fill(0); - if (left) { - result.set(bytes, length - bytes.length); - } - else { - result.set(bytes, 0); - } - return hexlify(result); - } - /** - * Return the [[DataHexString]] of %%data%% padded on the **left** - * to %%length%% bytes. - * - * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is - * thrown. - * - * This pads data the same as **values** are in Solidity - * (e.g. ``uint128``). - */ - function zeroPadValue(data, length) { - return zeroPad(data, length, true); - } - /** - * Return the [[DataHexString]] of %%data%% padded on the **right** - * to %%length%% bytes. - * - * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is - * thrown. - * - * This pads data the same as **bytes** are in Solidity - * (e.g. ``bytes16``). - */ - function zeroPadBytes(data, length) { - return zeroPad(data, length, false); - } - function stripZeros(value) { - let result = arrayify(value); - if (result.length === 0) { - return result; - } - // Find the first non-zero entry - let start = 0; - while (start < result.length && result[start] === 0) { - start++; - } - // If we started with zeros, strip them - if (start) { - result = result.slice(start); - } - return result; - } - function arrayify(value, options) { - if (!options) { - options = {}; - } - if (typeof value === "number") { - logger$6.checkSafeUint53(value, "invalid arrayify value"); - const result = []; - while (value) { - // @ts-ignore - result.unshift(value & 0xff); - value = parseInt(String(value / 256)); - } - if (result.length === 0) { - result.push(0); - } - return addSlice(new Uint8Array(result)); - } - if (options.allowMissingPrefix && - typeof value === "string" && - value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - if (isHexable(value)) { - value = value.toHexString(); - } - if (isHexString(value)) { - let hex = value.substring(2); - if (hex.length % 2) { - if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); - } - else if (options.hexPad === "right") { - hex += "0"; - } - else { - logger$6.throwArgumentError("hex data is odd-length", "value", value); - } - } - const result = []; - for (let i = 0; i < hex.length; i += 2) { - // @ts-ignore - result.push(parseInt(hex.substring(i, i + 2), 16)); - } - return addSlice(new Uint8Array(result)); - } - if (isBytes(value)) { - return addSlice(new Uint8Array(value)); - } - return logger$6.throwArgumentError("invalid arrayify value", "value", value); - } - function addSlice(array) { - // @ts-ignore - if (array.slice) { - return array; - } - array.slice = function () { - const args = Array.prototype.slice.call(arguments); - return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args))); - }; - return array; - } - function hexConcat(items) { - let result = "0x"; - items.forEach((item) => { - result += hexlify(item).substring(2); - }); - return result; - } - - var BN = _BN.BN; - const logger$5 = new Logger("bigNumber/0.0.1"); - const _constructorGuard = {}; - const MAX_SAFE = 0x1fffffffffffff; - // Only warn about passing 10 into radix once - let _warnedToStringRadix = false; - class BigNumber { - _hex; - _isBigNumber; - constructor(constructorGuard, hex) { - logger$5.checkNew(new.target, BigNumber); - if (constructorGuard !== _constructorGuard) { - logger$5.throwError("cannot call constructor directly; use BigNumber.from", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "new (BigNumber)", - }); - } - this._hex = hex; - this._isBigNumber = true; - Object.freeze(this); - } - fromTwos(value) { - return toBigNumber(toBN(this).fromTwos(value)); - } - toTwos(value) { - return toBigNumber(toBN(this).toTwos(value)); - } - abs() { - if (this._hex[0] === "-") { - return BigNumber.from(this._hex.substring(1)); - } - return this; - } - add(other) { - return toBigNumber(toBN(this).add(toBN(other))); - } - sub(other) { - return toBigNumber(toBN(this).sub(toBN(other))); - } - div(other) { - const o = BigNumber.from(other); - if (o.isZero()) { - throwFault("division by zero", "div"); - } - return toBigNumber(toBN(this).div(toBN(other))); - } - mul(other) { - return toBigNumber(toBN(this).mul(toBN(other))); - } - mod(other) { - const value = toBN(other); - if (value.isNeg()) { - throwFault("cannot modulo negative values", "mod"); - } - return toBigNumber(toBN(this).umod(value)); - } - pow(other) { - const value = toBN(other); - if (value.isNeg()) { - throwFault("cannot raise to negative values", "pow"); - } - return toBigNumber(toBN(this).pow(value)); - } - and(other) { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'and' negative values", "and"); - } - return toBigNumber(toBN(this).and(value)); - } - or(other) { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'or' negative values", "or"); - } - return toBigNumber(toBN(this).or(value)); - } - xor(other) { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'xor' negative values", "xor"); - } - return toBigNumber(toBN(this).xor(value)); - } - mask(value) { - if (this.isNegative() || value < 0) { - throwFault("cannot mask negative values", "mask"); - } - return toBigNumber(toBN(this).maskn(value)); - } - shl(value) { - if (this.isNegative() || value < 0) { - throwFault("cannot shift negative values", "shl"); - } - return toBigNumber(toBN(this).shln(value)); - } - shr(value) { - if (this.isNegative() || value < 0) { - throwFault("cannot shift negative values", "shr"); - } - return toBigNumber(toBN(this).shrn(value)); - } - eq(other) { - return toBN(this).eq(toBN(other)); - } - lt(other) { - return toBN(this).lt(toBN(other)); - } - lte(other) { - return toBN(this).lte(toBN(other)); - } - gt(other) { - return toBN(this).gt(toBN(other)); - } - gte(other) { - return toBN(this).gte(toBN(other)); - } - isNegative() { - return this._hex[0] === "-"; - } - isZero() { - return toBN(this).isZero(); - } - toNumber() { - try { - return toBN(this).toNumber(); - } - catch (error) { - throwFault("overflow", "toNumber", this.toString()); - } - // @ts-ignore - return null; - } - toBigInt() { - try { - return BigInt(this.toString()); - } - catch (e) { } - return logger$5.throwError("this platform does not support BigInt", Logger.errors.UNSUPPORTED_OPERATION, { - value: this.toString(), - }); - } - toString() { - // Lots of people expect this, which we do not support, so check (See: #889) - if (arguments.length > 0) { - if (arguments[0] === 10) { - if (!_warnedToStringRadix) { - _warnedToStringRadix = true; - logger$5.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); - } - } - else if (arguments[0] === 16) { - logger$5.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger.errors.UNEXPECTED_ARGUMENT, {}); - } - else { - logger$5.throwError("BigNumber.toString does not accept parameters", Logger.errors.UNEXPECTED_ARGUMENT, {}); - } - } - return toBN(this).toString(10); - } - toHexString() { - return this._hex; - } - toJSON(key) { - return { type: "BigNumber", hex: this.toHexString() }; - } - static from(value) { - if (value instanceof BigNumber) { - return value; - } - if (typeof value === "string") { - if (value.match(/^-?0x[0-9a-f]+$/i)) { - return new BigNumber(_constructorGuard, toHex(value)); - } - if (value.match(/^-?[0-9]+$/)) { - return new BigNumber(_constructorGuard, toHex(new BN(value))); - } - return logger$5.throwArgumentError("invalid BigNumber string", "value", value); - } - if (typeof value === "number") { - if (value % 1) { - throwFault("underflow", "BigNumber.from", value); - } - if (value >= MAX_SAFE || value <= -MAX_SAFE) { - throwFault("overflow", "BigNumber.from", value); - } - return BigNumber.from(String(value)); - } - const anyValue = value; - if (typeof anyValue === "bigint") { - return BigNumber.from(anyValue.toString()); - } - if (isBytes(anyValue)) { - return BigNumber.from(hexlify(anyValue)); - } - if (anyValue) { - // Hexable interface (takes priority) - if (anyValue.toHexString) { - const hex = anyValue.toHexString(); - if (typeof hex === "string") { - return BigNumber.from(hex); - } - } - else { - // For now, handle legacy JSON-ified values (goes away in v6) - let hex = anyValue._hex; - // New-form JSON - if (hex == null && anyValue.type === "BigNumber") { - hex = anyValue.hex; - } - if (typeof hex === "string") { - if (isHexString(hex) || - (hex[0] === "-" && isHexString(hex.substring(1)))) { - return BigNumber.from(hex); - } - } - } - } - return logger$5.throwArgumentError("invalid BigNumber value", "value", value); - } - static isBigNumber(value) { - return !!(value && value._isBigNumber); - } - } - // Normalize the hex string - // @ts-ignore - function toHex(value) { - // For BN, call on the hex string - if (typeof value !== "string") { - return toHex(value.toString(16)); - } - // If negative, prepend the negative sign to the normalized positive value - if (value[0] === "-") { - // Strip off the negative sign - value = value.substring(1); - // Cannot have multiple negative signs (e.g. "--0x04") - if (value[0] === "-") { - logger$5.throwArgumentError("invalid hex", "value", value); - } - // Call toHex on the positive component - value = toHex(value); - // Do not allow "-0x00" - if (value === "0x00") { - return value; - } - // Negate the value - return "-" + value; - } - // Add a "0x" prefix if missing - if (value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - // Normalize zero - if (value === "0x") { - return "0x00"; - } - // Make the string even length - if (value.length % 2) { - value = "0x0" + value.substring(2); - } - // Trim to smallest even-length string - while (value.length > 4 && value.substring(0, 4) === "0x00") { - value = "0x" + value.substring(4); - } - return value; - } - // @ts-ignore - function toBigNumber(value) { - return BigNumber.from(toHex(value)); - } - // @ts-ignore - function toBN(value) { - const hex = BigNumber.from(value).toHexString(); - if (hex[0] === "-") { - return new BN("-" + hex.substring(3), 16); - } - return new BN(hex.substring(2), 16); - } - function throwFault(fault, operation, value) { - const params = { fault: fault, operation: operation }; - if (value != null) { - params.value = value; - } - return logger$5.throwError(fault, Logger.errors.NUMERIC_FAULT, params); - } - - const logger$4 = new Logger("rlp/0.0.1"); - function arrayifyInteger$1(value) { - const result = []; - while (value) { - // @ts-ignore - result.unshift(value & 0xff); - value >>= 8; - } - return result; - } - function unarrayifyInteger$1(data, offset, length) { - let result = 0; - for (let i = 0; i < length; i++) { - result = result * 256 + data[offset + i]; - } - return result; - } - function _encode$1(object) { - if (Array.isArray(object)) { - let payload = []; - object.forEach(function (child) { - payload = payload.concat(_encode$1(child)); - }); - if (payload.length <= 55) { - payload.unshift(0xc0 + payload.length); - return payload; - } - const length = arrayifyInteger$1(payload.length); - length.unshift(0xf7 + length.length); - return length.concat(payload); - } - if (!isBytesLike(object)) { - logger$4.throwArgumentError("RLP object must be BytesLike", "object", object); - } - const data = Array.prototype.slice.call(arrayify(object)); - if (data.length === 1 && data[0] <= 0x7f) { - return data; - } - else if (data.length <= 55) { - data.unshift(0x80 + data.length); - return data; - } - const length = arrayifyInteger$1(data.length); - length.unshift(0xb7 + length.length); - return length.concat(data); - } - function encode(object) { - return hexlify(_encode$1(object)); - } - function _decodeChildren$1(data, offset, childOffset, length) { - const result = []; - while (childOffset < offset + 1 + length) { - const decoded = _decode$1(data, childOffset); - result.push(decoded.result); - childOffset += decoded.consumed; - if (childOffset > offset + 1 + length) { - logger$4.throwError("child data too short", Logger.errors.BUFFER_OVERRUN, {}); - } - } - return { consumed: 1 + length, result: result }; - } - // returns { consumed: number, result: Object } - function _decode$1(data, offset) { - if (data.length === 0) { - logger$4.throwError("data too short", Logger.errors.BUFFER_OVERRUN, {}); - } - // Array with extra length prefix - if (data[offset] >= 0xf8) { - const lengthLength = data[offset] - 0xf7; - if (offset + 1 + lengthLength > data.length) { - logger$4.throwError("data short segment too short", Logger.errors.BUFFER_OVERRUN, {}); - } - const length = unarrayifyInteger$1(data, offset + 1, lengthLength); - if (offset + 1 + lengthLength + length > data.length) { - logger$4.throwError("data long segment too short", Logger.errors.BUFFER_OVERRUN, {}); - } - return _decodeChildren$1(data, offset, offset + 1 + lengthLength, lengthLength + length); - } - else if (data[offset] >= 0xc0) { - const length = data[offset] - 0xc0; - if (offset + 1 + length > data.length) { - logger$4.throwError("data array too short", Logger.errors.BUFFER_OVERRUN, {}); - } - return _decodeChildren$1(data, offset, offset + 1, length); - } - else if (data[offset] >= 0xb8) { - const lengthLength = data[offset] - 0xb7; - if (offset + 1 + lengthLength > data.length) { - logger$4.throwError("data array too short", Logger.errors.BUFFER_OVERRUN, {}); - } - const length = unarrayifyInteger$1(data, offset + 1, lengthLength); - if (offset + 1 + lengthLength + length > data.length) { - logger$4.throwError("data array too short", Logger.errors.BUFFER_OVERRUN, {}); - } - const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); - return { consumed: 1 + lengthLength + length, result: result }; - } - else if (data[offset] >= 0x80) { - const length = data[offset] - 0x80; - if (offset + 1 + length > data.length) { - logger$4.throwError("data too short", Logger.errors.BUFFER_OVERRUN, {}); - } - const result = hexlify(data.slice(offset + 1, offset + 1 + length)); - return { consumed: 1 + length, result: result }; - } - return { consumed: 1, result: hexlify(data[offset]) }; - } - function decode$1(data) { - const bytes = arrayify(data); - const decoded = _decode$1(bytes, 0); - if (decoded.consumed !== bytes.length) { - logger$4.throwArgumentError("invalid rlp data", "data", data); - } - return decoded.result; - } - - function number(n) { - if (!Number.isSafeInteger(n) || n < 0) - throw new Error(`Wrong positive integer: ${n}`); - } - function bytes(b, ...lengths) { - if (!(b instanceof Uint8Array)) - throw new Error('Expected Uint8Array'); - if (lengths.length > 0 && !lengths.includes(b.length)) - throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); - } - function hash(hash) { - if (typeof hash !== 'function' || typeof hash.create !== 'function') - throw new Error('Hash should be wrapped by utils.wrapConstructor'); - number(hash.outputLen); - number(hash.blockLen); - } - function exists(instance, checkFinished = true) { - if (instance.destroyed) - throw new Error('Hash instance has been destroyed'); - if (checkFinished && instance.finished) - throw new Error('Hash#digest() has already been called'); - } - function output(out, instance) { - bytes(out); - const min = instance.outputLen; - if (out.length < min) { - throw new Error(`digestInto() expects output buffer of length at least ${min}`); - } - } - - /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ - // We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. - // node.js versions earlier than v19 don't declare it in global scope. - // For node.js, package.json#exports field mapping rewrites import - // from `crypto` to `cryptoNode`, which imports native module. - // Makes the utils un-importable in browsers without a bundler. - // Once node.js 18 is deprecated, we can just drop the import. - const u8a = (a) => a instanceof Uint8Array; - const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); - // Cast array to view - const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); - // The rotate right (circular right shift) operation for uint32 - const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift); - // big-endian hardware is rare. Just in case someone still decides to run hashes: - // early-throw an error because we don't support BE yet. - const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; - if (!isLE) - throw new Error('Non little-endian hardware is not supported'); - // There is no setImmediate in browser and setTimeout is slow. - // call of async fn will return Promise, which will be fullfiled only on - // next scheduler queue processing step and this is exactly what we need. - const nextTick = async () => { }; - // Returns control to thread each 'tick' ms to avoid blocking - async function asyncLoop(iters, tick, cb) { - let ts = Date.now(); - for (let i = 0; i < iters; i++) { - cb(i); - // Date.now() is not monotonic, so in case if clock goes backwards we return return control too - const diff = Date.now() - ts; - if (diff >= 0 && diff < tick) - continue; - await nextTick(); - ts += diff; - } - } - /** - * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) - */ - function utf8ToBytes(str) { - if (typeof str !== 'string') - throw new Error(`utf8ToBytes expected string, got ${typeof str}`); - return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 - } - /** - * Normalizes (non-hex) string or Uint8Array to Uint8Array. - * Warning: when Uint8Array is passed, it would NOT get copied. - * Keep in mind for future mutable operations. - */ - function toBytes(data) { - if (typeof data === 'string') - data = utf8ToBytes(data); - if (!u8a(data)) - throw new Error(`expected Uint8Array, got ${typeof data}`); - return data; - } - // For runtime check if class implements interface - class Hash { - // Safe version that clones internal state - clone() { - return this._cloneInto(); - } - } - const toStr = {}.toString; - function checkOpts(defaults, opts) { - if (opts !== undefined && toStr.call(opts) !== '[object Object]') - throw new Error('Options should be object or undefined'); - const merged = Object.assign(defaults, opts); - return merged; - } - function wrapConstructor(hashCons) { - const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); - const tmp = hashCons(); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = () => hashCons(); - return hashC; - } - - // HMAC (RFC 2104) - class HMAC extends Hash { - constructor(hash$1, _key) { - super(); - this.finished = false; - this.destroyed = false; - hash(hash$1); - const key = toBytes(_key); - this.iHash = hash$1.create(); - if (typeof this.iHash.update !== 'function') - throw new Error('Expected instance of class which extends utils.Hash'); - this.blockLen = this.iHash.blockLen; - this.outputLen = this.iHash.outputLen; - const blockLen = this.blockLen; - const pad = new Uint8Array(blockLen); - // blockLen can be bigger than outputLen - pad.set(key.length > blockLen ? hash$1.create().update(key).digest() : key); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 0x36; - this.iHash.update(pad); - // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone - this.oHash = hash$1.create(); - // Undo internal XOR && apply outer XOR - for (let i = 0; i < pad.length; i++) - pad[i] ^= 0x36 ^ 0x5c; - this.oHash.update(pad); - pad.fill(0); - } - update(buf) { - exists(this); - this.iHash.update(buf); - return this; - } - digestInto(out) { - exists(this); - bytes(out, this.outputLen); - this.finished = true; - this.iHash.digestInto(out); - this.oHash.update(out); - this.oHash.digestInto(out); - this.destroy(); - } - digest() { - const out = new Uint8Array(this.oHash.outputLen); - this.digestInto(out); - return out; - } - _cloneInto(to) { - // Create new instance without calling constructor since key already in state and we don't know it. - to || (to = Object.create(Object.getPrototypeOf(this), {})); - const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; - to = to; - to.finished = finished; - to.destroyed = destroyed; - to.blockLen = blockLen; - to.outputLen = outputLen; - to.oHash = oHash._cloneInto(to.oHash); - to.iHash = iHash._cloneInto(to.iHash); - return to; - } - destroy() { - this.destroyed = true; - this.oHash.destroy(); - this.iHash.destroy(); - } - } - /** - * HMAC: RFC2104 message authentication code. - * @param hash - function that would be used e.g. sha256 - * @param key - message key - * @param message - message data - */ - const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest(); - hmac.create = (hash, key) => new HMAC(hash, key); - - // Common prologue and epilogue for sync/async functions - function pbkdf2Init(hash$1, _password, _salt, _opts) { - hash(hash$1); - const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts); - const { c, dkLen, asyncTick } = opts; - number(c); - number(dkLen); - number(asyncTick); - if (c < 1) - throw new Error('PBKDF2: iterations (c) should be >= 1'); - const password = toBytes(_password); - const salt = toBytes(_salt); - // DK = PBKDF2(PRF, Password, Salt, c, dkLen); - const DK = new Uint8Array(dkLen); - // U1 = PRF(Password, Salt + INT_32_BE(i)) - const PRF = hmac.create(hash$1, password); - const PRFSalt = PRF._cloneInto().update(salt); - return { c, dkLen, asyncTick, DK, PRF, PRFSalt }; - } - function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) { - PRF.destroy(); - PRFSalt.destroy(); - if (prfW) - prfW.destroy(); - u.fill(0); - return DK; - } - /** - * PBKDF2-HMAC: RFC 2898 key derivation function - * @param hash - hash function that would be used e.g. sha256 - * @param password - password from which a derived key is generated - * @param salt - cryptographic salt - * @param opts - {c, dkLen} where c is work factor and dkLen is output message size - */ - function pbkdf2$1(hash, password, salt, opts) { - const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); - let prfW; // Working copy - const arr = new Uint8Array(4); - const view = createView(arr); - const u = new Uint8Array(PRF.outputLen); - // DK = T1 + T2 + ⋯ + Tdklen/hlen - for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { - // Ti = F(Password, Salt, c, i) - const Ti = DK.subarray(pos, pos + PRF.outputLen); - view.setInt32(0, ti, false); - // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc - // U1 = PRF(Password, Salt + INT_32_BE(i)) - (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); - Ti.set(u.subarray(0, Ti.length)); - for (let ui = 1; ui < c; ui++) { - // Uc = PRF(Password, Uc−1) - PRF._cloneInto(prfW).update(u).digestInto(u); - for (let i = 0; i < Ti.length; i++) - Ti[i] ^= u[i]; - } - } - return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); - } - - // Polyfill for Safari 14 - function setBigUint64(view, byteOffset, value, isLE) { - if (typeof view.setBigUint64 === 'function') - return view.setBigUint64(byteOffset, value, isLE); - const _32n = BigInt(32); - const _u32_max = BigInt(0xffffffff); - const wh = Number((value >> _32n) & _u32_max); - const wl = Number(value & _u32_max); - const h = isLE ? 4 : 0; - const l = isLE ? 0 : 4; - view.setUint32(byteOffset + h, wh, isLE); - view.setUint32(byteOffset + l, wl, isLE); - } - // Base SHA2 class (RFC 6234) - class SHA2 extends Hash { - constructor(blockLen, outputLen, padOffset, isLE) { - super(); - this.blockLen = blockLen; - this.outputLen = outputLen; - this.padOffset = padOffset; - this.isLE = isLE; - this.finished = false; - this.length = 0; - this.pos = 0; - this.destroyed = false; - this.buffer = new Uint8Array(blockLen); - this.view = createView(this.buffer); - } - update(data) { - exists(this); - const { view, buffer, blockLen } = this; - data = toBytes(data); - const len = data.length; - for (let pos = 0; pos < len;) { - const take = Math.min(blockLen - this.pos, len - pos); - // Fast path: we have at least one block in input, cast it to view and process - if (take === blockLen) { - const dataView = createView(data); - for (; blockLen <= len - pos; pos += blockLen) - this.process(dataView, pos); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - pos += take; - if (this.pos === blockLen) { - this.process(view, 0); - this.pos = 0; - } - } - this.length += data.length; - this.roundClean(); - return this; - } - digestInto(out) { - exists(this); - output(out, this); - this.finished = true; - // Padding - // We can avoid allocation of buffer for padding completely if it - // was previously not allocated here. But it won't change performance. - const { buffer, view, blockLen, isLE } = this; - let { pos } = this; - // append the bit '1' to the message - buffer[pos++] = 0b10000000; - this.buffer.subarray(pos).fill(0); - // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again - if (this.padOffset > blockLen - pos) { - this.process(view, 0); - pos = 0; - } - // Pad until full block byte with zeros - for (let i = pos; i < blockLen; i++) - buffer[i] = 0; - // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that - // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen. - // So we just write lowest 64 bits of that value. - setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE); - this.process(view, 0); - const oview = createView(out); - const len = this.outputLen; - // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT - if (len % 4) - throw new Error('_sha2: outputLen should be aligned to 32bit'); - const outLen = len / 4; - const state = this.get(); - if (outLen > state.length) - throw new Error('_sha2: outputLen bigger than state'); - for (let i = 0; i < outLen; i++) - oview.setUint32(4 * i, state[i], isLE); - } - digest() { - const { buffer, outputLen } = this; - this.digestInto(buffer); - const res = buffer.slice(0, outputLen); - this.destroy(); - return res; - } - _cloneInto(to) { - to || (to = new this.constructor()); - to.set(...this.get()); - const { blockLen, buffer, length, finished, destroyed, pos } = this; - to.length = length; - to.pos = pos; - to.finished = finished; - to.destroyed = destroyed; - if (length % blockLen) - to.buffer.set(buffer); - return to; - } - } - - // SHA2-256 need to try 2^128 hashes to execute birthday attack. - // BTC network is doing 2^67 hashes/sec as per early 2023. - // Choice: a ? b : c - const Chi = (a, b, c) => (a & b) ^ (~a & c); - // Majority function, true if any two inpust is true - const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c); - // Round constants: - // first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311) - // prettier-ignore - const SHA256_K = /* @__PURE__ */ new Uint32Array([ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 - ]); - // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): - // prettier-ignore - const IV = /* @__PURE__ */ new Uint32Array([ - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 - ]); - // Temporary buffer, not used to store anything between runs - // Named this way because it matches specification. - const SHA256_W = /* @__PURE__ */ new Uint32Array(64); - class SHA256 extends SHA2 { - constructor() { - super(64, 32, 8, false); - // We cannot use array here since array allows indexing by variable - // which means optimizer/compiler cannot use registers. - this.A = IV[0] | 0; - this.B = IV[1] | 0; - this.C = IV[2] | 0; - this.D = IV[3] | 0; - this.E = IV[4] | 0; - this.F = IV[5] | 0; - this.G = IV[6] | 0; - this.H = IV[7] | 0; - } - get() { - const { A, B, C, D, E, F, G, H } = this; - return [A, B, C, D, E, F, G, H]; - } - // prettier-ignore - set(A, B, C, D, E, F, G, H) { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - this.F = F | 0; - this.G = G | 0; - this.H = H | 0; - } - process(view, offset) { - // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array - for (let i = 0; i < 16; i++, offset += 4) - SHA256_W[i] = view.getUint32(offset, false); - for (let i = 16; i < 64; i++) { - const W15 = SHA256_W[i - 15]; - const W2 = SHA256_W[i - 2]; - const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3); - const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10); - SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; - } - // Compression function main loop, 64 rounds - let { A, B, C, D, E, F, G, H } = this; - for (let i = 0; i < 64; i++) { - const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); - const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; - const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); - const T2 = (sigma0 + Maj(A, B, C)) | 0; - H = G; - G = F; - F = E; - E = (D + T1) | 0; - D = C; - C = B; - B = A; - A = (T1 + T2) | 0; - } - // Add the compressed chunk to the current hash value - A = (A + this.A) | 0; - B = (B + this.B) | 0; - C = (C + this.C) | 0; - D = (D + this.D) | 0; - E = (E + this.E) | 0; - F = (F + this.F) | 0; - G = (G + this.G) | 0; - H = (H + this.H) | 0; - this.set(A, B, C, D, E, F, G, H); - } - roundClean() { - SHA256_W.fill(0); - } - destroy() { - this.set(0, 0, 0, 0, 0, 0, 0, 0); - this.buffer.fill(0); - } - } - /** - * SHA2-256 hash function - * @param message - data that would be hashed - */ - const sha256$1 = /* @__PURE__ */ wrapConstructor(() => new SHA256()); - - const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); - const _32n = /* @__PURE__ */ BigInt(32); - // We are not using BigUint64Array, because they are extremely slow as per 2022 - function fromBig(n, le = false) { - if (le) - return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) }; - return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; - } - function split(lst, le = false) { - let Ah = new Uint32Array(lst.length); - let Al = new Uint32Array(lst.length); - for (let i = 0; i < lst.length; i++) { - const { h, l } = fromBig(lst[i], le); - [Ah[i], Al[i]] = [h, l]; - } - return [Ah, Al]; - } - const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); - // for Shift in [0, 32) - const shrSH = (h, _l, s) => h >>> s; - const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); - // Right rotate for Shift in [1, 32) - const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s)); - const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); - // Right rotate for Shift in (32, 64), NOTE: 32 is special case. - const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32)); - const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s)); - // Right rotate for shift===32 (just swaps l&h) - const rotr32H = (_h, l) => l; - const rotr32L = (h, _l) => h; - // Left rotate for Shift in [1, 32) - const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s)); - const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s)); - // Left rotate for Shift in (32, 64), NOTE: 32 is special case. - const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s)); - const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s)); - // JS uses 32-bit signed integers for bitwise operations which means we cannot - // simple take carry out of low bit sum by shift, we need to use division. - function add(Ah, Al, Bh, Bl) { - const l = (Al >>> 0) + (Bl >>> 0); - return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; - } - // Addition with more than 2 elements - const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); - const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0; - const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); - const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0; - const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); - const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0; - // prettier-ignore - const u64 = { - fromBig, split, toBig, - shrSH, shrSL, - rotrSH, rotrSL, rotrBH, rotrBL, - rotr32H, rotr32L, - rotlSH, rotlSL, rotlBH, rotlBL, - add, add3L, add3H, add4L, add4H, add5H, add5L, - }; - var u64$1 = u64; - - // Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409): - // prettier-ignore - const [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64$1.split([ - '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc', - '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118', - '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2', - '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694', - '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65', - '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5', - '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4', - '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70', - '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df', - '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b', - '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30', - '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8', - '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8', - '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3', - '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec', - '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b', - '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178', - '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b', - '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c', - '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817' - ].map(n => BigInt(n))))(); - // Temporary buffer, not used to store anything between runs - const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80); - const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80); - class SHA512 extends SHA2 { - constructor() { - super(128, 64, 16, false); - // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers. - // Also looks cleaner and easier to verify with spec. - // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): - // h -- high 32 bits, l -- low 32 bits - this.Ah = 0x6a09e667 | 0; - this.Al = 0xf3bcc908 | 0; - this.Bh = 0xbb67ae85 | 0; - this.Bl = 0x84caa73b | 0; - this.Ch = 0x3c6ef372 | 0; - this.Cl = 0xfe94f82b | 0; - this.Dh = 0xa54ff53a | 0; - this.Dl = 0x5f1d36f1 | 0; - this.Eh = 0x510e527f | 0; - this.El = 0xade682d1 | 0; - this.Fh = 0x9b05688c | 0; - this.Fl = 0x2b3e6c1f | 0; - this.Gh = 0x1f83d9ab | 0; - this.Gl = 0xfb41bd6b | 0; - this.Hh = 0x5be0cd19 | 0; - this.Hl = 0x137e2179 | 0; - } - // prettier-ignore - get() { - const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; - } - // prettier-ignore - set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { - this.Ah = Ah | 0; - this.Al = Al | 0; - this.Bh = Bh | 0; - this.Bl = Bl | 0; - this.Ch = Ch | 0; - this.Cl = Cl | 0; - this.Dh = Dh | 0; - this.Dl = Dl | 0; - this.Eh = Eh | 0; - this.El = El | 0; - this.Fh = Fh | 0; - this.Fl = Fl | 0; - this.Gh = Gh | 0; - this.Gl = Gl | 0; - this.Hh = Hh | 0; - this.Hl = Hl | 0; - } - process(view, offset) { - // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array - for (let i = 0; i < 16; i++, offset += 4) { - SHA512_W_H[i] = view.getUint32(offset); - SHA512_W_L[i] = view.getUint32((offset += 4)); - } - for (let i = 16; i < 80; i++) { - // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7) - const W15h = SHA512_W_H[i - 15] | 0; - const W15l = SHA512_W_L[i - 15] | 0; - const s0h = u64$1.rotrSH(W15h, W15l, 1) ^ u64$1.rotrSH(W15h, W15l, 8) ^ u64$1.shrSH(W15h, W15l, 7); - const s0l = u64$1.rotrSL(W15h, W15l, 1) ^ u64$1.rotrSL(W15h, W15l, 8) ^ u64$1.shrSL(W15h, W15l, 7); - // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6) - const W2h = SHA512_W_H[i - 2] | 0; - const W2l = SHA512_W_L[i - 2] | 0; - const s1h = u64$1.rotrSH(W2h, W2l, 19) ^ u64$1.rotrBH(W2h, W2l, 61) ^ u64$1.shrSH(W2h, W2l, 6); - const s1l = u64$1.rotrSL(W2h, W2l, 19) ^ u64$1.rotrBL(W2h, W2l, 61) ^ u64$1.shrSL(W2h, W2l, 6); - // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16]; - const SUMl = u64$1.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); - const SUMh = u64$1.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); - SHA512_W_H[i] = SUMh | 0; - SHA512_W_L[i] = SUMl | 0; - } - let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - // Compression function main loop, 80 rounds - for (let i = 0; i < 80; i++) { - // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41) - const sigma1h = u64$1.rotrSH(Eh, El, 14) ^ u64$1.rotrSH(Eh, El, 18) ^ u64$1.rotrBH(Eh, El, 41); - const sigma1l = u64$1.rotrSL(Eh, El, 14) ^ u64$1.rotrSL(Eh, El, 18) ^ u64$1.rotrBL(Eh, El, 41); - //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; - const CHIh = (Eh & Fh) ^ (~Eh & Gh); - const CHIl = (El & Fl) ^ (~El & Gl); - // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i] - // prettier-ignore - const T1ll = u64$1.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); - const T1h = u64$1.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); - const T1l = T1ll | 0; - // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39) - const sigma0h = u64$1.rotrSH(Ah, Al, 28) ^ u64$1.rotrBH(Ah, Al, 34) ^ u64$1.rotrBH(Ah, Al, 39); - const sigma0l = u64$1.rotrSL(Ah, Al, 28) ^ u64$1.rotrBL(Ah, Al, 34) ^ u64$1.rotrBL(Ah, Al, 39); - const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch); - const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl); - Hh = Gh | 0; - Hl = Gl | 0; - Gh = Fh | 0; - Gl = Fl | 0; - Fh = Eh | 0; - Fl = El | 0; - ({ h: Eh, l: El } = u64$1.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); - Dh = Ch | 0; - Dl = Cl | 0; - Ch = Bh | 0; - Cl = Bl | 0; - Bh = Ah | 0; - Bl = Al | 0; - const All = u64$1.add3L(T1l, sigma0l, MAJl); - Ah = u64$1.add3H(All, T1h, sigma0h, MAJh); - Al = All | 0; - } - // Add the compressed chunk to the current hash value - ({ h: Ah, l: Al } = u64$1.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); - ({ h: Bh, l: Bl } = u64$1.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); - ({ h: Ch, l: Cl } = u64$1.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); - ({ h: Dh, l: Dl } = u64$1.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); - ({ h: Eh, l: El } = u64$1.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); - ({ h: Fh, l: Fl } = u64$1.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); - ({ h: Gh, l: Gl } = u64$1.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); - ({ h: Hh, l: Hl } = u64$1.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); - this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); - } - roundClean() { - SHA512_W_H.fill(0); - SHA512_W_L.fill(0); - } - destroy() { - this.buffer.fill(0); - this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } - } - const sha512$1 = /* @__PURE__ */ wrapConstructor(() => new SHA512()); - - // SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size. - // It's called a sponge function. - // Various per round constants calculations - const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []]; - const _0n = /* @__PURE__ */ BigInt(0); - const _1n = /* @__PURE__ */ BigInt(1); - const _2n = /* @__PURE__ */ BigInt(2); - const _7n = /* @__PURE__ */ BigInt(7); - const _256n = /* @__PURE__ */ BigInt(256); - const _0x71n = /* @__PURE__ */ BigInt(0x71); - for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { - // Pi - [x, y] = [y, (2 * x + 3 * y) % 5]; - SHA3_PI.push(2 * (5 * y + x)); - // Rotational - SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64); - // Iota - let t = _0n; - for (let j = 0; j < 7; j++) { - R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n; - if (R & _2n) - t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n); - } - _SHA3_IOTA.push(t); - } - const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true); - // Left rotation (without 0, 32, 64) - const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s)); - const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s)); - // Same as keccakf1600, but allows to skip some rounds - function keccakP(s, rounds = 24) { - const B = new Uint32Array(5 * 2); - // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js) - for (let round = 24 - rounds; round < 24; round++) { - // Theta θ - for (let x = 0; x < 10; x++) - B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; - for (let x = 0; x < 10; x += 2) { - const idx1 = (x + 8) % 10; - const idx0 = (x + 2) % 10; - const B0 = B[idx0]; - const B1 = B[idx0 + 1]; - const Th = rotlH(B0, B1, 1) ^ B[idx1]; - const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; - for (let y = 0; y < 50; y += 10) { - s[x + y] ^= Th; - s[x + y + 1] ^= Tl; - } - } - // Rho (ρ) and Pi (π) - let curH = s[2]; - let curL = s[3]; - for (let t = 0; t < 24; t++) { - const shift = SHA3_ROTL[t]; - const Th = rotlH(curH, curL, shift); - const Tl = rotlL(curH, curL, shift); - const PI = SHA3_PI[t]; - curH = s[PI]; - curL = s[PI + 1]; - s[PI] = Th; - s[PI + 1] = Tl; - } - // Chi (χ) - for (let y = 0; y < 50; y += 10) { - for (let x = 0; x < 10; x++) - B[x] = s[y + x]; - for (let x = 0; x < 10; x++) - s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; - } - // Iota (ι) - s[0] ^= SHA3_IOTA_H[round]; - s[1] ^= SHA3_IOTA_L[round]; - } - B.fill(0); - } - class Keccak extends Hash { - // NOTE: we accept arguments in bytes instead of bits here. - constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { - super(); - this.blockLen = blockLen; - this.suffix = suffix; - this.outputLen = outputLen; - this.enableXOF = enableXOF; - this.rounds = rounds; - this.pos = 0; - this.posOut = 0; - this.finished = false; - this.destroyed = false; - // Can be passed from user as dkLen - number(outputLen); - // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes - if (0 >= this.blockLen || this.blockLen >= 200) - throw new Error('Sha3 supports only keccak-f1600 function'); - this.state = new Uint8Array(200); - this.state32 = u32(this.state); - } - keccak() { - keccakP(this.state32, this.rounds); - this.posOut = 0; - this.pos = 0; - } - update(data) { - exists(this); - const { blockLen, state } = this; - data = toBytes(data); - const len = data.length; - for (let pos = 0; pos < len;) { - const take = Math.min(blockLen - this.pos, len - pos); - for (let i = 0; i < take; i++) - state[this.pos++] ^= data[pos++]; - if (this.pos === blockLen) - this.keccak(); - } - return this; - } - finish() { - if (this.finished) - return; - this.finished = true; - const { state, suffix, pos, blockLen } = this; - // Do the padding - state[pos] ^= suffix; - if ((suffix & 0x80) !== 0 && pos === blockLen - 1) - this.keccak(); - state[blockLen - 1] ^= 0x80; - this.keccak(); - } - writeInto(out) { - exists(this, false); - bytes(out); - this.finish(); - const bufferOut = this.state; - const { blockLen } = this; - for (let pos = 0, len = out.length; pos < len;) { - if (this.posOut >= blockLen) - this.keccak(); - const take = Math.min(blockLen - this.posOut, len - pos); - out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); - this.posOut += take; - pos += take; - } - return out; - } - xofInto(out) { - // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF - if (!this.enableXOF) - throw new Error('XOF is not possible for this instance'); - return this.writeInto(out); - } - xof(bytes) { - number(bytes); - return this.xofInto(new Uint8Array(bytes)); - } - digestInto(out) { - output(out, this); - if (this.finished) - throw new Error('digest() was already called'); - this.writeInto(out); - this.destroy(); - return out; - } - digest() { - return this.digestInto(new Uint8Array(this.outputLen)); - } - destroy() { - this.destroyed = true; - this.state.fill(0); - } - _cloneInto(to) { - const { blockLen, suffix, outputLen, rounds, enableXOF } = this; - to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); - to.state32.set(this.state32); - to.pos = this.pos; - to.posOut = this.posOut; - to.finished = this.finished; - to.rounds = rounds; - // Suffix can change in cSHAKE - to.suffix = suffix; - to.outputLen = outputLen; - to.enableXOF = enableXOF; - to.destroyed = this.destroyed; - return to; - } - } - const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)); - /** - * SHA3-256 hash function - * @param message - that would be hashed - */ - const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8); - const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8); - /** - * keccak-256 hash function. Different from SHA3-256. - * @param message - that would be hashed - */ - const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8); - - /** - * Some mathematic operations. - * - * @_subsection: api/utils:Math Helpers [about-maths] - */ - const BN_0$9 = BigInt(0); - const BN_1$5 = BigInt(1); - //const BN_Max256 = (BN_1 << BigInt(256)) - BN_1; - // IEEE 754 support 53-bits of mantissa - const maxValue = 0x1fffffffffffff; - /** - * Convert %%value%% from a twos-compliment representation of %%width%% - * bits to its value. - * - * If the highest bit is ``1``, the result will be negative. - */ - function fromTwos(_value, _width) { - const value = getUint(_value, "value"); - const width = BigInt(getNumber(_width, "width")); - assert(value >> width === BN_0$9, "overflow", "NUMERIC_FAULT", { - operation: "fromTwos", - fault: "overflow", - value: _value, - }); - // Top bit set; treat as a negative value - if (value >> (width - BN_1$5)) { - const mask = (BN_1$5 << width) - BN_1$5; - return -((~value & mask) + BN_1$5); - } - return value; - } - /** - * Convert %%value%% to a twos-compliment representation of - * %%width%% bits. - * - * The result will always be positive. - */ - function toTwos(_value, _width) { - let value = getBigInt(_value, "value"); - const width = BigInt(getNumber(_width, "width")); - const limit = BN_1$5 << (width - BN_1$5); - if (value < BN_0$9) { - value = -value; - assert(value <= limit, "too low", "NUMERIC_FAULT", { - operation: "toTwos", - fault: "overflow", - value: _value, - }); - const mask = (BN_1$5 << width) - BN_1$5; - return (~value & mask) + BN_1$5; - } - else { - assert(value < limit, "too high", "NUMERIC_FAULT", { - operation: "toTwos", - fault: "overflow", - value: _value, - }); - } - return value; - } - /** - * Mask %%value%% with a bitmask of %%bits%% ones. - */ - function mask(_value, _bits) { - const value = getUint(_value, "value"); - const bits = BigInt(getNumber(_bits, "bits")); - return value & ((BN_1$5 << bits) - BN_1$5); - } - /** - * Gets a BigInt from %%value%%. If it is an invalid value for - * a BigInt, then an ArgumentError will be thrown for %%name%%. - */ - function getBigInt(value, name) { - switch (typeof value) { - case "bigint": - return value; - case "number": - assertArgument(Number.isInteger(value), "underflow", name || "value", value); - assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return BigInt(value); - case "string": - try { - if (value === "") { - throw new Error("empty string"); - } - if (value[0] === "-" && value[1] !== "-") { - return -BigInt(value.substring(1)); - } - return BigInt(value); - } - catch (e) { - assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || "value", value); - } - } - assertArgument(false, "invalid BigNumberish value", name || "value", value); - } - function getUint(value, name) { - const result = getBigInt(value, name); - assert(result >= BN_0$9, "unsigned value cannot be negative", "NUMERIC_FAULT", { - fault: "overflow", - operation: "getUint", - value, - }); - return result; - } - const Nibbles = "0123456789abcdef"; - /* - * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it - * is treated as Big Endian data. - */ - function toBigInt(value) { - if (value instanceof Uint8Array) { - let result = "0x0"; - for (const v of value) { - result += Nibbles[v >> 4]; - result += Nibbles[v & 0x0f]; - } - return BigInt(result); - } - return getBigInt(value); - } - /** - * Gets a //number// from %%value%%. If it is an invalid value for - * a //number//, then an ArgumentError will be thrown for %%name%%. - */ - function getNumber(value, name) { - switch (typeof value) { - case "bigint": - assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return Number(value); - case "number": - assertArgument(Number.isInteger(value), "underflow", name || "value", value); - assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return value; - case "string": - try { - if (value === "") { - throw new Error("empty string"); - } - return getNumber(BigInt(value), name); - } - catch (e) { - assertArgument(false, `invalid numeric string: ${e.message}`, name || "value", value); - } - } - assertArgument(false, "invalid numeric value", name || "value", value); - } - /** - * Converts %%value%% to a number. If %%value%% is a Uint8Array, it - * is treated as Big Endian data. Throws if the value is not safe. - */ - function toNumber(value) { - return getNumber(toBigInt(value)); - } - /** - * Converts %%value%% to a Big Endian hexstring, optionally padded to - * %%width%% bytes. - */ - function toBeHex(_value, _width) { - const value = getUint(_value, "value"); - let result = value.toString(16); - if (_width == null) { - // Ensure the value is of even length - if (result.length % 2) { - result = "0" + result; - } - } - else { - const width = getNumber(_width, "width"); - assert(width * 2 >= result.length, `value exceeds width (${width} bits)`, "NUMERIC_FAULT", { - operation: "toBeHex", - fault: "overflow", - value: _value, - }); - // Pad the value to the required width - while (result.length < width * 2) { - result = "0" + result; - } - } - return "0x" + result; - } - /** - * Converts %%value%% to a Big Endian Uint8Array. - */ - function toBeArray(_value) { - const value = getUint(_value, "value"); - if (value === BN_0$9) { - return new Uint8Array([]); - } - let hex = value.toString(16); - if (hex.length % 2) { - hex = "0" + hex; - } - const result = new Uint8Array(hex.length / 2); - for (let i = 0; i < result.length; i++) { - const offset = i * 2; - result[i] = parseInt(hex.substring(offset, offset + 2), 16); - } - return result; - } - /** - * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. - * - * A //Quantity// does not have and leading 0 values unless the value is - * the literal value `0x0`. This is most commonly used for JSSON-RPC - * numeric values. - */ - function toQuantity(value) { - let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring(2); - while (result.startsWith("0")) { - result = result.substring(1); - } - if (result === "") { - result = "0"; - } - return "0x" + result; - } - - /** - * The [Base58 Encoding](link-base58) scheme allows a **numeric** value - * to be encoded as a compact string using a radix of 58 using only - * alpha-numeric characters. Confusingly similar characters are omitted - * (i.e. ``"l0O"``). - * - * Note that Base58 encodes a **numeric** value, not arbitrary bytes, - * since any zero-bytes on the left would get removed. To mitigate this - * issue most schemes that use Base58 choose specific high-order values - * to ensure non-zero prefixes. - * - * @_subsection: api/utils:Base58 Encoding [about-base58] - */ - const Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; - let Lookup = null; - function getAlpha(letter) { - if (Lookup == null) { - Lookup = {}; - for (let i = 0; i < Alphabet.length; i++) { - Lookup[Alphabet[i]] = BigInt(i); - } - } - const result = Lookup[letter]; - assertArgument(result != null, `invalid base58 value`, "letter", letter); - return result; - } - const BN_0$8 = BigInt(0); - const BN_58 = BigInt(58); - /** - * Encode %%value%% as a Base58-encoded string. - */ - function encodeBase58(_value) { - let value = toBigInt(getBytes(_value)); - let result = ""; - while (value) { - result = Alphabet[Number(value % BN_58)] + result; - value /= BN_58; - } - return result; - } - /** - * Decode the Base58-encoded %%value%%. - */ - function decodeBase58(value) { - let result = BN_0$8; - for (let i = 0; i < value.length; i++) { - result *= BN_58; - result += getAlpha(value[i]); - } - return result; - } - - // utils/base64-browser - function decodeBase64(textData) { - textData = atob(textData); - const data = new Uint8Array(textData.length); - for (let i = 0; i < textData.length; i++) { - data[i] = textData.charCodeAt(i); - } - return getBytes(data); - } - function encodeBase64(_data) { - const data = getBytes(_data); - let textData = ""; - for (let i = 0; i < data.length; i++) { - textData += String.fromCharCode(data[i]); - } - return btoa(textData); - } - - /** - * Explain events... - * - * @_section api/utils/events:Events [about-events] - */ - /** - * When an [[EventEmitterable]] triggers a [[Listener]], the - * callback always ahas one additional argument passed, which is - * an **EventPayload**. - */ - class EventPayload { - /** - * The event filter. - */ - filter; - /** - * The **EventEmitterable**. - */ - emitter; - #listener; - /** - * Create a new **EventPayload** for %%emitter%% with - * the %%listener%% and for %%filter%%. - */ - constructor(emitter, listener, filter) { - this.#listener = listener; - defineProperties(this, { emitter, filter }); - } - /** - * Unregister the triggered listener for future events. - */ - async removeListener() { - if (this.#listener == null) { - return; - } - await this.emitter.off(this.filter, this.#listener); - } - } - - /** - * Using strings in Core (or any security-basd system) requires - * additional care. These utilities attempt to mitigate some of the - * safety issues as well as provide the ability to recover and analyse - * strings. - * - * @_subsection api/utils:Strings and UTF-8 [about-strings] - */ - function errorFunc(reason, offset, bytes, output, badCodepoint) { - assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); - } - function ignoreFunc(reason, offset, bytes, output, badCodepoint) { - // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes - if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { - let i = 0; - for (let o = offset + 1; o < bytes.length; o++) { - if (bytes[o] >> 6 !== 0x02) { - break; - } - i++; - } - return i; - } - // This byte runs us past the end of the string, so just jump to the end - // (but the first byte was read already read and therefore skipped) - if (reason === "OVERRUN") { - return bytes.length - offset - 1; - } - // Nothing to skip - return 0; - } - function replaceFunc(reason, offset, bytes, output, badCodepoint) { - // Overlong representations are otherwise "valid" code points; just non-deistingtished - if (reason === "OVERLONG") { - assertArgument(typeof badCodepoint === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint); - output.push(badCodepoint); - return 0; - } - // Put the replacement character into the output - output.push(0xfffd); - // Otherwise, process as if ignoring errors - return ignoreFunc(reason, offset, bytes); - } - /** - * A handful of popular, built-in UTF-8 error handling strategies. - * - * **``"error"``** - throws on ANY illegal UTF-8 sequence or - * non-canonical (overlong) codepoints (this is the default) - * - * **``"ignore"``** - silently drops any illegal UTF-8 sequence - * and accepts non-canonical (overlong) codepoints - * - * **``"replace"``** - replace any illegal UTF-8 sequence with the - * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts - * non-canonical (overlong) codepoints - * - * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> - */ - const Utf8ErrorFuncs = Object.freeze({ - error: errorFunc, - ignore: ignoreFunc, - replace: replaceFunc, - }); - // http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 - function getUtf8CodePoints(_bytes, onError) { - if (onError == null) { - onError = Utf8ErrorFuncs.error; - } - const bytes = getBytes(_bytes, "bytes"); - const result = []; - let i = 0; - // Invalid bytes are ignored - while (i < bytes.length) { - const c = bytes[i++]; - // 0xxx xxxx - if (c >> 7 === 0) { - result.push(c); - continue; - } - // Multibyte; how many bytes left for this character? - let extraLength = null; - let overlongMask = null; - // 110x xxxx 10xx xxxx - if ((c & 0xe0) === 0xc0) { - extraLength = 1; - overlongMask = 0x7f; - // 1110 xxxx 10xx xxxx 10xx xxxx - } - else if ((c & 0xf0) === 0xe0) { - extraLength = 2; - overlongMask = 0x7ff; - // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx - } - else if ((c & 0xf8) === 0xf0) { - extraLength = 3; - overlongMask = 0xffff; - } - else { - if ((c & 0xc0) === 0x80) { - i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); - } - else { - i += onError("BAD_PREFIX", i - 1, bytes, result); - } - continue; - } - // Do we have enough bytes in our data? - if (i - 1 + extraLength >= bytes.length) { - i += onError("OVERRUN", i - 1, bytes, result); - continue; - } - // Remove the length prefix from the char - let res = c & ((1 << (8 - extraLength - 1)) - 1); - for (let j = 0; j < extraLength; j++) { - let nextChar = bytes[i]; - // Invalid continuation byte - if ((nextChar & 0xc0) != 0x80) { - i += onError("MISSING_CONTINUE", i, bytes, result); - res = null; - break; - } - res = (res << 6) | (nextChar & 0x3f); - i++; - } - // See above loop for invalid continuation byte - if (res === null) { - continue; - } - // Maximum code point - if (res > 0x10ffff) { - i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); - continue; - } - // Reserved for UTF-16 surrogate halves - if (res >= 0xd800 && res <= 0xdfff) { - i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); - continue; - } - // Check for overlong sequences (more bytes than needed) - if (res <= overlongMask) { - i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); - continue; - } - result.push(res); - } - return result; - } - // http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array - /** - * Returns the UTF-8 byte representation of %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ - function toUtf8Bytes(str, form) { - if (form != null) { - assertNormalize(form); - str = str.normalize(form); - } - let result = []; - for (let i = 0; i < str.length; i++) { - const c = str.charCodeAt(i); - if (c < 0x80) { - result.push(c); - } - else if (c < 0x800) { - result.push((c >> 6) | 0xc0); - result.push((c & 0x3f) | 0x80); - } - else if ((c & 0xfc00) == 0xd800) { - i++; - const c2 = str.charCodeAt(i); - assertArgument(i < str.length && (c2 & 0xfc00) === 0xdc00, "invalid surrogate pair", "str", str); - // Surrogate Pair - const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); - result.push((pair >> 18) | 0xf0); - result.push(((pair >> 12) & 0x3f) | 0x80); - result.push(((pair >> 6) & 0x3f) | 0x80); - result.push((pair & 0x3f) | 0x80); - } - else { - result.push((c >> 12) | 0xe0); - result.push(((c >> 6) & 0x3f) | 0x80); - result.push((c & 0x3f) | 0x80); - } - } - return new Uint8Array(result); - } - //export - function _toUtf8String(codePoints) { - return codePoints - .map((codePoint) => { - if (codePoint <= 0xffff) { - return String.fromCharCode(codePoint); - } - codePoint -= 0x10000; - return String.fromCharCode(((codePoint >> 10) & 0x3ff) + 0xd800, (codePoint & 0x3ff) + 0xdc00); - }) - .join(""); - } - /** - * Returns the string represented by the UTF-8 data %%bytes%%. - * - * When %%onError%% function is specified, it is called on UTF-8 - * errors allowing recovery using the [[Utf8ErrorFunc]] API. - * (default: [error](Utf8ErrorFuncs)) - */ - function toUtf8String(bytes, onError) { - return _toUtf8String(getUtf8CodePoints(bytes, onError)); - } - /** - * Returns the UTF-8 code-points for %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ - function toUtf8CodePoints(str, form) { - return getUtf8CodePoints(toUtf8Bytes(str, form)); - } - - // @TODO: timeout is completely ignored; start a Promise.any with a reject? - // @ts-ignore - async function getUrl(req, _signal) { - const protocol = req.url.split(":")[0].toLowerCase(); - assert(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { - info: { protocol }, - operation: "request", - }); - assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { - operation: "request", - }); - let signal = undefined; - if (_signal) { - const controller = new AbortController(); - signal = controller.signal; - _signal.addListener(() => { - controller.abort(); - }); - } - const init = { - method: req.method, - headers: new Headers(Array.from(req)), - body: req.body || undefined, - signal, - }; - try { - const resp = await fetch(req.url, init); - const headers = {}; - resp.headers.forEach((value, key) => { - headers[key.toLowerCase()] = value; - }); - const respBody = await resp.arrayBuffer(); - const body = respBody == null ? null : new Uint8Array(respBody); - return { - statusCode: resp.status, - statusMessage: resp.statusText, - headers, - body, - }; - } - catch (error) { - console.log({ error }); - return undefined; - } - } - - /** - * Explain fetching here... - * - * @_section api/utils/fetching:Fetching Web Content [about-fetch] - */ - const MAX_ATTEMPTS = 12; - const SLOT_INTERVAL = 250; - // The global FetchGetUrlFunc implementation. - let getUrlFunc = getUrl; - const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); - const reIpfs = new RegExp("^ipfs://(ipfs/)?(.*)$", "i"); - // If locked, new Gateways cannot be added - let locked$5 = false; - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs - async function dataGatewayFunc(url, signal) { - try { - const match = url.match(reData); - if (!match) { - throw new Error("invalid data"); - } - return new FetchResponse(200, "OK", { - "content-type": match[1] || "text/plain", - }, match[2] ? decodeBase64(match[3]) : unpercent(match[3])); - } - catch (error) { - return new FetchResponse(599, "BAD REQUEST (invalid data: URI)", {}, null, new FetchRequest(url)); - } - } - /** - * Returns a [[FetchGatewayFunc]] for fetching content from a standard - * IPFS gateway hosted at %%baseUrl%%. - */ - function getIpfsGatewayFunc(baseUrl) { - async function gatewayIpfs(url, signal) { - try { - const match = url.match(reIpfs); - if (!match) { - throw new Error("invalid link"); - } - return new FetchRequest(`${baseUrl}${match[2]}`); - } - catch (error) { - return new FetchResponse(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new FetchRequest(url)); - } - } - return gatewayIpfs; - } - const Gateways = { - data: dataGatewayFunc, - ipfs: getIpfsGatewayFunc("https://gateway.ipfs.io/ipfs/"), - }; - const fetchSignals = new WeakMap(); - /** - * @_ignore - */ - class FetchCancelSignal { - #listeners; - #cancelled; - constructor(request) { - this.#listeners = []; - this.#cancelled = false; - fetchSignals.set(request, () => { - if (this.#cancelled) { - return; - } - this.#cancelled = true; - for (const listener of this.#listeners) { - setTimeout(() => { - listener(); - }, 0); - } - this.#listeners = []; - }); - } - addListener(listener) { - assert(!this.#cancelled, "singal already cancelled", "UNSUPPORTED_OPERATION", { - operation: "fetchCancelSignal.addCancelListener", - }); - this.#listeners.push(listener); - } - get cancelled() { - return this.#cancelled; - } - checkSignal() { - assert(!this.cancelled, "cancelled", "CANCELLED", {}); - } - } - // Check the signal, throwing if it is cancelled - function checkSignal(signal) { - if (signal == null) { - throw new Error("missing signal; should not happen"); - } - signal.checkSignal(); - return signal; - } - /** - * Represents a request for a resource using a URI. - * - * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, - * and ``IPFS:``. - * - * Additional schemes can be added globally using [[registerGateway]]. - * - * @example: - * req = new FetchRequest("https://www.ricmoo.com") - * resp = await req.send() - * resp.body.length - * //_result: - */ - class FetchRequest { - #allowInsecure; - #gzip; - #headers; - #method; - #timeout; - #url; - #body; - #bodyType; - #creds; - // Hooks - #preflight; - #process; - #retry; - #signal; - #throttle; - /** - * The fetch URI to requrest. - */ - get url() { - return this.#url; - } - set url(url) { - this.#url = String(url); - } - /** - * The fetch body, if any, to send as the request body. //(default: null)// - * - * When setting a body, the intrinsic ``Content-Type`` is automatically - * set and will be used if **not overridden** by setting a custom - * header. - * - * If %%body%% is null, the body is cleared (along with the - * intrinsic ``Content-Type``) and the . - * - * If %%body%% is a string, the intrincis ``Content-Type`` is set to - * ``text/plain``. - * - * If %%body%% is a Uint8Array, the intrincis ``Content-Type`` is set to - * ``application/octet-stream``. - * - * If %%body%% is any other object, the intrincis ``Content-Type`` is - * set to ``application/json``. - */ - get body() { - if (this.#body == null) { - return null; - } - return new Uint8Array(this.#body); - } - set body(body) { - if (body == null) { - this.#body = undefined; - this.#bodyType = undefined; - } - else if (typeof body === "string") { - this.#body = toUtf8Bytes(body); - this.#bodyType = "text/plain"; - } - else if (body instanceof Uint8Array) { - this.#body = body; - this.#bodyType = "application/octet-stream"; - } - else if (typeof body === "object") { - this.#body = toUtf8Bytes(JSON.stringify(body)); - this.#bodyType = "application/json"; - } - else { - throw new Error("invalid body"); - } - } - /** - * Returns true if the request has a body. - */ - hasBody() { - return this.#body != null; - } - /** - * The HTTP method to use when requesting the URI. If no method - * has been explicitly set, then ``GET`` is used if the body is - * null and ``POST`` otherwise. - */ - get method() { - if (this.#method) { - return this.#method; - } - if (this.hasBody()) { - return "POST"; - } - return "GET"; - } - set method(method) { - if (method == null) { - method = ""; - } - this.#method = String(method).toUpperCase(); - } - /** - * The headers that will be used when requesting the URI. All - * keys are lower-case. - * - * This object is a copy, so any chnages will **NOT** be reflected - * in the ``FetchRequest``. - * - * To set a header entry, use the ``setHeader`` method. - */ - get headers() { - const headers = Object.assign({}, this.#headers); - if (this.#creds) { - headers["authorization"] = `Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`; - } - if (this.allowGzip) { - headers["accept-encoding"] = "gzip"; - } - if (headers["content-type"] == null && this.#bodyType) { - headers["content-type"] = this.#bodyType; - } - if (this.body) { - headers["content-length"] = String(this.body.length); - } - return headers; - } - /** - * Get the header for %%key%%, ignoring case. - */ - getHeader(key) { - return this.headers[key.toLowerCase()]; - } - /** - * Set the header for %%key%% to %%value%%. All values are coerced - * to a string. - */ - setHeader(key, value) { - this.#headers[String(key).toLowerCase()] = String(value); - } - /** - * Clear all headers, resetting all intrinsic headers. - */ - clearHeaders() { - this.#headers = {}; - } - [Symbol.iterator]() { - const headers = this.headers; - const keys = Object.keys(headers); - let index = 0; - return { - next: () => { - if (index < keys.length) { - const key = keys[index++]; - return { - value: [key, headers[key]], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - /** - * The value that will be sent for the ``Authorization`` header. - * - * To set the credentials, use the ``setCredentials`` method. - */ - get credentials() { - return this.#creds || null; - } - /** - * Sets an ``Authorization`` for %%username%% with %%password%%. - */ - setCredentials(username, password) { - assertArgument(!username.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"); - this.#creds = `${username}:${password}`; - } - /** - * Enable and request gzip-encoded responses. The response will - * automatically be decompressed. //(default: true)// - */ - get allowGzip() { - return this.#gzip; - } - set allowGzip(value) { - this.#gzip = !!value; - } - /** - * Allow ``Authentication`` credentials to be sent over insecure - * channels. //(default: false)// - */ - get allowInsecureAuthentication() { - return !!this.#allowInsecure; - } - set allowInsecureAuthentication(value) { - this.#allowInsecure = !!value; - } - /** - * The timeout (in milliseconds) to wait for a complere response. - * //(default: 5 minutes)// - */ - get timeout() { - return this.#timeout; - } - set timeout(timeout) { - assertArgument(timeout >= 0, "timeout must be non-zero", "timeout", timeout); - this.#timeout = timeout; - } - /** - * This function is called prior to each request, for example - * during a redirection or retry in case of server throttling. - * - * This offers an opportunity to populate headers or update - * content before sending a request. - */ - get preflightFunc() { - return this.#preflight || null; - } - set preflightFunc(preflight) { - this.#preflight = preflight; - } - /** - * This function is called after each response, offering an - * opportunity to provide client-level throttling or updating - * response data. - * - * Any error thrown in this causes the ``send()`` to throw. - * - * To schedule a retry attempt (assuming the maximum retry limit - * has not been reached), use [[response.throwThrottleError]]. - */ - get processFunc() { - return this.#process || null; - } - set processFunc(process) { - this.#process = process; - } - /** - * This function is called on each retry attempt. - */ - get retryFunc() { - return this.#retry || null; - } - set retryFunc(retry) { - this.#retry = retry; - } - /** - * Create a new FetchRequest instance with default values. - * - * Once created, each property may be set before issuing a - * ``.send()`` to make the request. - */ - constructor(url) { - this.#url = String(url); - this.#allowInsecure = false; - this.#gzip = true; - this.#headers = {}; - this.#method = ""; - this.#timeout = 300000; - this.#throttle = { - slotInterval: SLOT_INTERVAL, - maxAttempts: MAX_ATTEMPTS, - }; - } - toString() { - return ``; - } - /** - * Update the throttle parameters used to determine maximum - * attempts and exponential-backoff properties. - */ - setThrottleParams(params) { - if (params.slotInterval != null) { - this.#throttle.slotInterval = params.slotInterval; - } - if (params.maxAttempts != null) { - this.#throttle.maxAttempts = params.maxAttempts; - } - } - async #send(attempt, expires, delay, _request, _response) { - if (attempt >= this.#throttle.maxAttempts) { - return _response.makeServerError("exceeded maximum retry limit"); - } - assert(getTime$2() <= expires, "timeout", "TIMEOUT", { - operation: "request.send", - reason: "timeout", - request: _request, - }); - if (delay > 0) { - await wait(delay); - } - let req = this.clone(); - const scheme = (req.url.split(":")[0] || "").toLowerCase(); - // Process any Gateways - if (scheme in Gateways) { - const result = await Gateways[scheme](req.url, checkSignal(_request.#signal)); - if (result instanceof FetchResponse) { - let response = result; - if (this.processFunc) { - checkSignal(_request.#signal); - try { - response = await this.processFunc(req, response); - } - catch (error) { - // Something went wrong during processing; throw a 5xx server error - if (error.throttle == null || typeof error.stall !== "number") { - response - .makeServerError("error in post-processing function", error) - .assertOk(); - } - // Ignore throttling - } - } - return response; - } - req = result; - } - // We have a preflight function; update the request - if (this.preflightFunc) { - req = await this.preflightFunc(req); - } - const resp = await getUrlFunc(req, checkSignal(_request.#signal)); - let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); - if (response.statusCode === 301 || response.statusCode === 302) { - // Redirect - try { - const location = response.headers.location || ""; - return req - .redirect(location) - .#send(attempt + 1, expires, 0, _request, response); - } - catch (error) { } - // Things won't get any better on another attempt; abort - return response; - } - else if (response.statusCode === 429) { - // Throttle - if (this.retryFunc == null || - (await this.retryFunc(req, response, attempt))) { - const retryAfter = response.headers["retry-after"]; - let delay = this.#throttle.slotInterval * - Math.trunc(Math.random() * Math.pow(2, attempt)); - if (typeof retryAfter === "string" && - retryAfter.match(/^[1-9][0-9]*$/)) { - delay = parseInt(retryAfter); - } - return req - .clone() - .#send(attempt + 1, expires, delay, _request, response); - } - } - if (this.processFunc) { - checkSignal(_request.#signal); - try { - response = await this.processFunc(req, response); - } - catch (error) { - // Something went wrong during processing; throw a 5xx server error - if (error.throttle == null || typeof error.stall !== "number") { - response - .makeServerError("error in post-processing function", error) - .assertOk(); - } - // Throttle - let delay = this.#throttle.slotInterval * - Math.trunc(Math.random() * Math.pow(2, attempt)); - if (error.stall >= 0) { - delay = error.stall; - } - return req - .clone() - .#send(attempt + 1, expires, delay, _request, response); - } - } - return response; - } - /** - * Resolves to the response by sending the request. - */ - send() { - assert(this.#signal == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); - this.#signal = new FetchCancelSignal(this); - return this.#send(0, getTime$2() + this.timeout, 0, this, new FetchResponse(0, "", {}, null, this)); - } - /** - * Cancels the inflight response, causing a ``CANCELLED`` - * error to be rejected from the [[send]]. - */ - cancel() { - assert(this.#signal != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); - const signal = fetchSignals.get(this); - if (!signal) { - throw new Error("missing signal; should not happen"); - } - signal(); - } - /** - * Returns a new [[FetchRequest]] that represents the redirection - * to %%location%%. - */ - redirect(location) { - // Redirection; for now we only support absolute locataions - const current = this.url.split(":")[0].toLowerCase(); - const target = location.split(":")[0].toLowerCase(); - // Don't allow redirecting: - // - non-GET requests - // - downgrading the security (e.g. https => http) - // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?] - assert(this.method === "GET" && - (current !== "https" || target !== "http") && - location.match(/^https?:/), `unsupported redirect`, "UNSUPPORTED_OPERATION", { - operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})`, - }); - // Create a copy of this request, with a new URL - const req = new FetchRequest(location); - req.method = "GET"; - req.allowGzip = this.allowGzip; - req.timeout = this.timeout; - req.#headers = Object.assign({}, this.#headers); - if (this.#body) { - req.#body = new Uint8Array(this.#body); - } - req.#bodyType = this.#bodyType; - // Do not forward credentials unless on the same domain; only absolute - //req.allowInsecure = false; - // paths are currently supported; may want a way to specify to forward? - //setStore(req.#props, "creds", getStore(this.#pros, "creds")); - return req; - } - /** - * Create a new copy of this request. - */ - clone() { - const clone = new FetchRequest(this.url); - // Preserve "default method" (i.e. null) - clone.#method = this.#method; - // Preserve "default body" with type, copying the Uint8Array is present - if (this.#body) { - clone.#body = this.#body; - } - clone.#bodyType = this.#bodyType; - // Preserve "default headers" - clone.#headers = Object.assign({}, this.#headers); - // Credentials is readonly, so we copy internally - clone.#creds = this.#creds; - if (this.allowGzip) { - clone.allowGzip = true; - } - clone.timeout = this.timeout; - if (this.allowInsecureAuthentication) { - clone.allowInsecureAuthentication = true; - } - clone.#preflight = this.#preflight; - clone.#process = this.#process; - clone.#retry = this.#retry; - return clone; - } - /** - * Locks all static configuration for gateways and FetchGetUrlFunc - * registration. - */ - static lockConfig() { - locked$5 = true; - } - /** - * Get the current Gateway function for %%scheme%%. - */ - static getGateway(scheme) { - return Gateways[scheme.toLowerCase()] || null; - } - /** - * Use the %%func%% when fetching URIs using %%scheme%%. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGateway(scheme, func) { - scheme = scheme.toLowerCase(); - if (scheme === "http" || scheme === "https") { - throw new Error(`cannot intercept ${scheme}; use registerGetUrl`); - } - if (locked$5) { - throw new Error("gateways locked"); - } - Gateways[scheme] = func; - } - /** - * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGetUrl(getUrl) { - if (locked$5) { - throw new Error("gateways locked"); - } - getUrlFunc = getUrl; - } - /** - * Creates a function that can "fetch" data URIs. - * - * Note that this is automatically done internally to support - * data URIs, so it is not necessary to register it. - * - * This is not generally something that is needed, but may - * be useful in a wrapper to perfom custom data URI functionality. - */ - static createDataGateway() { - return dataGatewayFunc; - } - /** - * Creates a function that will fetch IPFS (unvalidated) from - * a custom gateway baseUrl. - * - * The default IPFS gateway used internally is - * ``"https:/\/gateway.ipfs.io/ipfs/"``. - */ - static createIpfsGatewayFunc(baseUrl) { - return getIpfsGatewayFunc(baseUrl); - } - } - /** - * The response for a FetchREquest. - */ - class FetchResponse { - #statusCode; - #statusMessage; - #headers; - #body; - #request; - #error; - toString() { - return ``; - } - /** - * The response status code. - */ - get statusCode() { - return this.#statusCode; - } - /** - * The response status message. - */ - get statusMessage() { - return this.#statusMessage; - } - /** - * The response headers. All keys are lower-case. - */ - get headers() { - return Object.assign({}, this.#headers); - } - /** - * The response body, or ``null`` if there was no body. - */ - get body() { - return this.#body == null ? null : new Uint8Array(this.#body); - } - /** - * The response body as a UTF-8 encoded string, or the empty - * string (i.e. ``""``) if there was no body. - * - * An error is thrown if the body is invalid UTF-8 data. - */ - get bodyText() { - try { - return this.#body == null ? "" : toUtf8String(this.#body); - } - catch (error) { - assert(false, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { - operation: "bodyText", - info: { response: this }, - }); - } - } - /** - * The response body, decoded as JSON. - * - * An error is thrown if the body is invalid JSON-encoded data - * or if there was no body. - */ - get bodyJson() { - try { - return JSON.parse(this.bodyText); - } - catch (error) { - assert(false, "response body is not valid JSON", "UNSUPPORTED_OPERATION", { - operation: "bodyJson", - info: { response: this }, - }); - } - } - [Symbol.iterator]() { - const headers = this.headers; - const keys = Object.keys(headers); - let index = 0; - return { - next: () => { - if (index < keys.length) { - const key = keys[index++]; - return { - value: [key, headers[key]], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - constructor(statusCode, statusMessage, headers, body, request) { - this.#statusCode = statusCode; - this.#statusMessage = statusMessage; - this.#headers = Object.keys(headers).reduce((accum, k) => { - accum[k.toLowerCase()] = String(headers[k]); - return accum; - }, {}); - this.#body = body == null ? null : new Uint8Array(body); - this.#request = request || null; - this.#error = { message: "" }; - } - /** - * Return a Response with matching headers and body, but with - * an error status code (i.e. 599) and %%message%% with an - * optional %%error%%. - */ - makeServerError(message, error) { - let statusMessage; - if (!message) { - message = `${this.statusCode} ${this.statusMessage}`; - statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`; - } - else { - statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; - } - const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined); - response.#error = { message, error }; - return response; - } - /** - * If called within a [request.processFunc](FetchRequest-processFunc) - * call, causes the request to retry as if throttled for %%stall%% - * milliseconds. - */ - throwThrottleError(message, stall) { - if (stall == null) { - stall = -1; - } - else { - assertArgument(Number.isInteger(stall) && stall >= 0, "invalid stall timeout", "stall", stall); - } - const error = new Error(message || "throttling requests"); - defineProperties(error, { stall, throttle: true }); - throw error; - } - /** - * Get the header value for %%key%%, ignoring case. - */ - getHeader(key) { - return this.headers[key.toLowerCase()]; - } - /** - * Returns true of the response has a body. - */ - hasBody() { - return this.#body != null; - } - /** - * The request made for this response. - */ - get request() { - return this.#request; - } - /** - * Returns true if this response was a success statusCode. - */ - ok() { - return (this.#error.message === "" && - this.statusCode >= 200 && - this.statusCode < 300); - } - /** - * Throws a ``SERVER_ERROR`` if this response is not ok. - */ - assertOk() { - if (this.ok()) { - return; - } - let { message, error } = this.#error; - if (message === "") { - message = `server response ${this.statusCode} ${this.statusMessage}`; - } - assert(false, message, "SERVER_ERROR", { - request: this.request || "unknown request", - response: this, - error, - }); - } - } - function getTime$2() { - return new Date().getTime(); - } - function unpercent(value) { - return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { - return String.fromCharCode(parseInt(code, 16)); - })); - } - function wait(delay) { - return new Promise((resolve) => setTimeout(resolve, delay)); - } - - var _a$1; - const BN_N1 = BigInt(-1); - const BN_0$7 = BigInt(0); - const BN_1$4 = BigInt(1); - const BN_5 = BigInt(5); - const _guard$5 = {}; - // Constant to pull zeros from for multipliers - let Zeros = "0000"; - while (Zeros.length < 80) { - Zeros += Zeros; - } - // Returns a string "1" followed by decimal "0"s - function getTens(decimals) { - let result = Zeros; - while (result.length < decimals) { - result += result; - } - return BigInt("1" + result.substring(0, decimals)); - } - function checkValue(val, format, safeOp) { - const width = BigInt(format.width); - if (format.signed) { - const limit = BN_1$4 << (width - BN_1$4); - assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { - operation: safeOp, - fault: "overflow", - value: val, - }); - if (val > BN_0$7) { - val = fromTwos(mask(val, width), width); - } - else { - val = -fromTwos(mask(-val, width), width); - } - } - else { - const limit = BN_1$4 << width; - assert(safeOp == null || (val >= 0 && val < limit), "overflow", "NUMERIC_FAULT", { - operation: safeOp, - fault: "overflow", - value: val, - }); - val = ((val % limit) + limit) % limit & (limit - BN_1$4); - } - return val; - } - function getFormat(value) { - if (typeof value === "number") { - value = `fixed128x${value}`; - } - let signed = true; - let width = 128; - let decimals = 18; - if (typeof value === "string") { - // Parse the format string - if (value === "fixed") ; - else if (value === "ufixed") { - signed = false; - } - else { - const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); - assertArgument(match, "invalid fixed format", "format", value); - signed = match[1] !== "u"; - width = parseInt(match[2]); - decimals = parseInt(match[3]); - } - } - else if (value) { - // Extract the values from the object - const v = value; - const check = (key, type, defaultValue) => { - if (v[key] == null) { - return defaultValue; - } - assertArgument(typeof v[key] === type, "invalid fixed format (" + key + " not " + type + ")", "format." + key, v[key]); - return v[key]; - }; - signed = check("signed", "boolean", signed); - width = check("width", "number", width); - decimals = check("decimals", "number", decimals); - } - assertArgument(width % 8 === 0, "invalid FixedNumber width (not byte aligned)", "format.width", width); - assertArgument(decimals <= 80, "invalid FixedNumber decimals (too large)", "format.decimals", decimals); - const name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); - return { signed, width, decimals, name }; - } - function toString(val, decimals) { - let negative = ""; - if (val < BN_0$7) { - negative = "-"; - val *= BN_N1; - } - let str = val.toString(); - // No decimal point for whole values - if (decimals === 0) { - return negative + str; - } - // Pad out to the whole component (including a whole digit) - while (str.length <= decimals) { - str = Zeros + str; - } - // Insert the decimal point - const index = str.length - decimals; - str = str.substring(0, index) + "." + str.substring(index); - // Trim the whole component (leaving at least one 0) - while (str[0] === "0" && str[1] !== ".") { - str = str.substring(1); - } - // Trim the decimal component (leaving at least one 0) - while (str[str.length - 1] === "0" && str[str.length - 2] !== ".") { - str = str.substring(0, str.length - 1); - } - return negative + str; - } - /** - * A FixedNumber represents a value over its [[FixedFormat]] - * arithmetic field. - * - * A FixedNumber can be used to perform math, losslessly, on - * values which have decmial places. - * - * A FixedNumber has a fixed bit-width to store values in, and stores all - * values internally by multiplying the value by 10 raised to the power of - * %%decimals%%. - * - * If operations are performed that cause a value to grow too high (close to - * positive infinity) or too low (close to negative infinity), the value - * is said to //overflow//. - * - * For example, an 8-bit signed value, with 0 decimals may only be within - * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become - * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. - * - * Many operation have a normal and //unsafe// variant. The normal variant - * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// - * variant will silently allow overflow, corrupting its value value. - * - * If operations are performed that cause a value to become too small - * (close to zero), the value loses precison and is said to //underflow//. - * - * For example, an value with 1 decimal place may store a number as small - * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit - * into 1 decimal place, so underflow occurs which means precision is lost - * and the value becomes ``0``. - * - * Some operations have a normal and //signalling// variant. The normal - * variant will silently ignore underflow, while the //signalling// variant - * will thow a [[NumericFaultError]] on underflow. - */ - class FixedNumber { - /** - * The specific fixed-point arithmetic field for this value. - */ - format; - #format; - // The actual value (accounting for decimals) - #val; - // A base-10 value to multiple values by to maintain the magnitude - #tens; - /** - * This is a property so console.log shows a human-meaningful value. - * - * @private - */ - _value; - // Use this when changing this file to get some typing info, - // but then switch to any to mask the internal type - //constructor(guard: any, value: bigint, format: _FixedFormat) { - /** - * @private - */ - constructor(guard, value, format) { - assertPrivate(guard, _guard$5, "FixedNumber"); - this.#val = value; - this.#format = format; - const _value = toString(value, format.decimals); - defineProperties(this, { format: format.name, _value }); - this.#tens = getTens(format.decimals); - } - /** - * If true, negative values are permitted, otherwise only - * positive values and zero are allowed. - */ - get signed() { - return this.#format.signed; - } - /** - * The number of bits available to store the value. - */ - get width() { - return this.#format.width; - } - /** - * The number of decimal places in the fixed-point arithment field. - */ - get decimals() { - return this.#format.decimals; - } - /** - * The value as an integer, based on the smallest unit the - * [[decimals]] allow. - */ - get value() { - return this.#val; - } - #checkFormat(other) { - assertArgument(this.format === other.format, "incompatible format; use fixedNumber.toFormat", "other", other); - } - #checkValue(val, safeOp) { - /* - const width = BigInt(this.width); - if (this.signed) { - const limit = (BN_1 << (width - BN_1)); - assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { - operation: safeOp, fault: "overflow", value: val - }); - - if (val > BN_0) { - val = fromTwos(mask(val, width), width); - } else { - val = -fromTwos(mask(-val, width), width); - } - - } else { - const masked = mask(val, width); - assert(safeOp == null || (val >= 0 && val === masked), "overflow", "NUMERIC_FAULT", { - operation: safeOp, fault: "overflow", value: val - }); - val = masked; - } - */ - val = checkValue(val, this.#format, safeOp); - return new _a$1(_guard$5, val, this.#format); - } - #add(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue(this.#val + o.#val, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%, ignoring overflow. - */ - addUnsafe(other) { - return this.#add(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - add(other) { - return this.#add(other, "add"); - } - #sub(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue(this.#val - o.#val, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%, ignoring overflow. - */ - subUnsafe(other) { - return this.#sub(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - sub(other) { - return this.#sub(other, "sub"); - } - #mul(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%, ignoring overflow and underflow (precision loss). - */ - mulUnsafe(other) { - return this.#mul(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - mul(other) { - return this.#mul(other, "mul"); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs or if underflow (precision loss) occurs. - */ - mulSignal(other) { - this.#checkFormat(other); - const value = this.#val * other.#val; - assert(value % this.#tens === BN_0$7, "precision lost during signalling mul", "NUMERIC_FAULT", { - operation: "mulSignal", - fault: "underflow", - value: this, - }); - return this.#checkValue(value / this.#tens, "mulSignal"); - } - #div(o, safeOp) { - assert(o.#val !== BN_0$7, "division by zero", "NUMERIC_FAULT", { - operation: "div", - fault: "divide-by-zero", - value: this, - }); - this.#checkFormat(o); - return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - divUnsafe(other) { - return this.#div(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - div(other) { - return this.#div(other, "div"); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%. A [[NumericFaultError]] is thrown if underflow - * (precision loss) occurs. - */ - divSignal(other) { - assert(other.#val !== BN_0$7, "division by zero", "NUMERIC_FAULT", { - operation: "div", - fault: "divide-by-zero", - value: this, - }); - this.#checkFormat(other); - const value = this.#val * this.#tens; - assert(value % other.#val === BN_0$7, "precision lost during signalling div", "NUMERIC_FAULT", { - operation: "divSignal", - fault: "underflow", - value: this, - }); - return this.#checkValue(value / other.#val, "divSignal"); - } - /** - * Returns a comparison result between %%this%% and %%other%%. - * - * This is suitable for use in sorting, where ``-1`` implies %%this%% - * is smaller, ``1`` implies %%other%% is larger and ``0`` implies - * both are equal. - */ - cmp(other) { - let a = this.value, b = other.value; - // Coerce a and b to the same magnitude - const delta = this.decimals - other.decimals; - if (delta > 0) { - b *= getTens(delta); - } - else if (delta < 0) { - a *= getTens(-delta); - } - // Comnpare - if (a < b) { - return -1; - } - if (a > b) { - return -1; - } - return 0; - } - /** - * Returns true if %%other%% is equal to %%this%%. - */ - eq(other) { - return this.cmp(other) === 0; - } - /** - * Returns true if %%other%% is less than to %%this%%. - */ - lt(other) { - return this.cmp(other) < 0; - } - /** - * Returns true if %%other%% is less than or equal to %%this%%. - */ - lte(other) { - return this.cmp(other) <= 0; - } - /** - * Returns true if %%other%% is greater than to %%this%%. - */ - gt(other) { - return this.cmp(other) > 0; - } - /** - * Returns true if %%other%% is greater than or equal to %%this%%. - */ - gte(other) { - return this.cmp(other) >= 0; - } - /** - * Returns a new [[FixedNumber]] which is the largest **integer** - * that is less than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - floor() { - let val = this.#val; - if (this.#val < BN_0$7) { - val -= this.#tens - BN_1$4; - } - val = (this.#val / this.#tens) * this.#tens; - return this.#checkValue(val, "floor"); - } - /** - * Returns a new [[FixedNumber]] which is the smallest **integer** - * that is greater than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - ceiling() { - let val = this.#val; - if (this.#val > BN_0$7) { - val += this.#tens - BN_1$4; - } - val = (this.#val / this.#tens) * this.#tens; - return this.#checkValue(val, "ceiling"); - } - /** - * Returns a new [[FixedNumber]] with the decimal component - * rounded up on ties at %%decimals%% places. - */ - round(decimals) { - if (decimals == null) { - decimals = 0; - } - // Not enough precision to not already be rounded - if (decimals >= this.decimals) { - return this; - } - const delta = this.decimals - decimals; - const bump = BN_5 * getTens(delta - 1); - let value = this.value + bump; - const tens = getTens(delta); - value = (value / tens) * tens; - checkValue(value, this.#format, "round"); - return new _a$1(_guard$5, value, this.#format); - } - /** - * Returns true if %%this%% is equal to ``0``. - */ - isZero() { - return this.#val === BN_0$7; - } - /** - * Returns true if %%this%% is less than ``0``. - */ - isNegative() { - return this.#val < BN_0$7; - } - /** - * Returns the string representation of %%this%%. - */ - toString() { - return this._value; - } - /** - * Returns a float approximation. - * - * Due to IEEE 754 precission (or lack thereof), this function - * can only return an approximation and most values will contain - * rounding errors. - */ - toUnsafeFloat() { - return parseFloat(this.toString()); - } - /** - * Return a new [[FixedNumber]] with the same value but has had - * its field set to %%format%%. - * - * This will throw if the value cannot fit into %%format%%. - */ - toFormat(format) { - return _a$1.fromString(this.toString(), format); - } - /** - * Creates a new [[FixedNumber]] for %%value%% divided by - * %%decimal%% places with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% (once adjusted - * for %%decimals%%) cannot fit in %%format%%, either due to overflow - * or underflow (precision loss). - */ - static fromValue(_value, decimals, _format) { - if (decimals == null) { - decimals = 0; - } - const format = getFormat(_format); - let value = getBigInt(_value, "value"); - const delta = decimals - format.decimals; - if (delta > 0) { - const tens = getTens(delta); - assert(value % tens === BN_0$7, "value loses precision for format", "NUMERIC_FAULT", { - operation: "fromValue", - fault: "underflow", - value: _value, - }); - value /= tens; - } - else if (delta < 0) { - value *= getTens(-delta); - } - checkValue(value, format, "fromValue"); - return new _a$1(_guard$5, value, format); - } - /** - * Creates a new [[FixedNumber]] for %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%%, either due to overflow or underflow (precision loss). - */ - static fromString(_value, _format) { - const match = _value.match(/^(-?)([0-9]*)\.?([0-9]*)$/); - assertArgument(match && match[2].length + match[3].length > 0, "invalid FixedNumber string value", "value", _value); - const format = getFormat(_format); - let whole = match[2] || "0", decimal = match[3] || ""; - // Pad out the decimals - while (decimal.length < format.decimals) { - decimal += Zeros; - } - // Check precision is safe - assert(decimal.substring(format.decimals).match(/^0*$/), "too many decimals for format", "NUMERIC_FAULT", { - operation: "fromString", - fault: "underflow", - value: _value, - }); - // Remove extra padding - decimal = decimal.substring(0, format.decimals); - const value = BigInt(match[1] + whole + decimal); - checkValue(value, format, "fromString"); - return new _a$1(_guard$5, value, format); - } - /** - * Creates a new [[FixedNumber]] with the big-endian representation - * %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%% due to overflow. - */ - static fromBytes(_value, _format) { - let value = toBigInt(getBytes(_value, "value")); - const format = getFormat(_format); - if (format.signed) { - value = fromTwos(value, format.width); - } - checkValue(value, format, "fromBytes"); - return new _a$1(_guard$5, value, format); - } - } - _a$1 = FixedNumber; - //const f1 = FixedNumber.fromString("12.56", "fixed16x2"); - //const f2 = FixedNumber.fromString("0.3", "fixed16x2"); - //console.log(f1.divSignal(f2)); - //const BUMP = FixedNumber.from("0.5"); - - function hexlifyByte(value) { - let result = value.toString(16); - while (result.length < 2) { - result = "0" + result; - } - return "0x" + result; - } - function unarrayifyInteger(data, offset, length) { - let result = 0; - for (let i = 0; i < length; i++) { - result = result * 256 + data[offset + i]; - } - return result; - } - function _decodeChildren(data, offset, childOffset, length) { - const result = []; - while (childOffset < offset + 1 + length) { - const decoded = _decode(data, childOffset); - result.push(decoded.result); - childOffset += decoded.consumed; - assert(childOffset <= offset + 1 + length, "child data too short", "BUFFER_OVERRUN", { - buffer: data, - length, - offset, - }); - } - return { consumed: 1 + length, result: result }; - } - // returns { consumed: number, result: Object } - function _decode(data, offset) { - assert(data.length !== 0, "data too short", "BUFFER_OVERRUN", { - buffer: data, - length: 0, - offset: 1, - }); - const checkOffset = (offset) => { - assert(offset <= data.length, "data short segment too short", "BUFFER_OVERRUN", { - buffer: data, - length: data.length, - offset, - }); - }; - // Array with extra length prefix - if (data[offset] >= 0xf8) { - const lengthLength = data[offset] - 0xf7; - checkOffset(offset + 1 + lengthLength); - const length = unarrayifyInteger(data, offset + 1, lengthLength); - checkOffset(offset + 1 + lengthLength + length); - return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); - } - else if (data[offset] >= 0xc0) { - const length = data[offset] - 0xc0; - checkOffset(offset + 1 + length); - return _decodeChildren(data, offset, offset + 1, length); - } - else if (data[offset] >= 0xb8) { - const lengthLength = data[offset] - 0xb7; - checkOffset(offset + 1 + lengthLength); - const length = unarrayifyInteger(data, offset + 1, lengthLength); - checkOffset(offset + 1 + lengthLength + length); - const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); - return { consumed: 1 + lengthLength + length, result: result }; - } - else if (data[offset] >= 0x80) { - const length = data[offset] - 0x80; - checkOffset(offset + 1 + length); - const result = hexlify(data.slice(offset + 1, offset + 1 + length)); - return { consumed: 1 + length, result: result }; - } - return { consumed: 1, result: hexlifyByte(data[offset]) }; - } - /** - * Decodes %%data%% into the structured data it represents. - */ - function decodeRlp(_data) { - const data = getBytes(_data, "data"); - const decoded = _decode(data, 0); - assertArgument(decoded.consumed === data.length, "unexpected junk after rlp payload", "data", _data); - return decoded.result; - } - - function arrayifyInteger(value) { - const result = []; - while (value) { - result.unshift(value & 0xff); - value >>= 8; - } - return result; - } - function _encode(object) { - if (Array.isArray(object)) { - let payload = []; - object.forEach(function (child) { - payload = payload.concat(_encode(child)); - }); - if (payload.length <= 55) { - payload.unshift(0xc0 + payload.length); - return payload; - } - const length = arrayifyInteger(payload.length); - length.unshift(0xf7 + length.length); - return length.concat(payload); - } - const data = Array.prototype.slice.call(getBytes(object, "object")); - if (data.length === 1 && data[0] <= 0x7f) { - return data; - } - else if (data.length <= 55) { - data.unshift(0x80 + data.length); - return data; - } - const length = arrayifyInteger(data.length); - length.unshift(0xb7 + length.length); - return length.concat(data); - } - const nibbles = "0123456789abcdef"; - /** - * Encodes %%object%% as an RLP-encoded [[DataHexString]]. - */ - function encodeRlp(object) { - let result = "0x"; - for (const v of _encode(object)) { - result += nibbles[v >> 4]; - result += nibbles[v & 0xf]; - } - return result; - } - - /** - * Most interactions with Core requires integer values, which use - * the smallest magnitude unit. - * - * For example, imagine dealing with dollars and cents. Since dollars - * are divisible, non-integer values are possible, such as ``$10.77``. - * By using the smallest indivisible unit (i.e. cents), the value can - * be kept as the integer ``1077``. - * - * When receiving decimal input from the user (as a decimal string), - * the value should be converted to an integer and when showing a user - * a value, the integer value should be converted to a decimal string. - * - * This creates a clear distinction, between values to be used by code - * (integers) and values used for display logic to users (decimals). - * - * The native unit in Core, //Core// is divisible to 18 decimal places, - * where each individual unit is called a //ore//. - * - * @_subsection api/utils:Unit Conversion [about-units] - */ - const names = [ - ///Ore, the smallest and atomic amount of Core - "ore", - ///fecore, 1000 ore - "fecore", - ///Picore, one million ore - "picore", - ///Nacore, one billion ore. Typically a reasonable unit to measure energy prices. - "nacore", - ///Μcore, 10^12 ore or 1 μCore - "mcore", - ///micore, 10^15 ore or 1 mcore - "micore", - "core", - ]; - /** - * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal - * places. The %%unit%% may be the number of decimal places or the name of - * a unit - * - */ - function formatUnits(value, unit) { - let decimals = 18; - if (typeof unit === "string") { - const index = names.indexOf(unit); - assertArgument(index >= 0, "invalid unit", "unit", unit); - decimals = 3 * index; - } - else if (unit != null) { - decimals = getNumber(unit, "unit"); - } - return FixedNumber.fromValue(value, decimals, { decimals }).toString(); - } - /** - * Converts the //decimal string// %%value%% to a BigInt, assuming - * %%unit%% decimal places. The %%unit%% may the number of decimal places - * or the name of a unit. - */ - const scientificToDecimal = (num) => { - // @ts-ignore - var nsign = Math.sign(num); - //remove the sign - // @ts-ignore - num = Math.abs(num); - //if the number is in scientific notation remove it - // @ts-ignore - if (/\d+\.?\d*e[\+\-]*\d+/i.test(num)) { - var zero = "0", - // @ts-ignore - parts = String(num).toLowerCase().split("e"), //split into coeff and exponent - e = parts.pop(), //store the exponential part - // @ts-ignore - l = Math.abs(e), //get the number of zeros - // @ts-ignore - sign = e / l, coeff_array = parts[0].split("."); - if (sign === -1) { - l = l - coeff_array[0].length; - if (l < 0) { - // @ts-ignore - num = - coeff_array[0].slice(0, l) + - "." + - coeff_array[0].slice(l) + - (coeff_array.length === 2 ? coeff_array[1] : ""); - } - else { - // @ts-ignore - num = zero + "." + new Array(l + 1).join(zero) + coeff_array.join(""); - } - } - else { - var dec = coeff_array[1]; - if (dec) - l = l - dec.length; - if (l < 0) { - // @ts-ignore - num = coeff_array[0] + dec.slice(0, l) + "." + dec.slice(l); - } - else { - // @ts-ignore - num = coeff_array.join("") + new Array(l + 1).join(zero); - } - } - } - // @ts-ignore - return nsign < 0 ? "-" + num : num; - }; - const trimDecimals = (n, decimals = 18) => { - n += ""; - if (n.indexOf(".") === -1) - return n; - const arr = n.split("."); - const fraction = arr[1].substr(0, decimals); - return arr[0] + "." + fraction; - }; - function parseUnits(value, unit) { - assertArgument(typeof value === "string", "value must be a string", "value", value); - if (value.includes("e")) { - value = scientificToDecimal(value).toString(); - } - let decimals = 18; - if (typeof unit === "string") { - const index = names.indexOf(unit); - assertArgument(index >= 0, "invalid unit", "unit", unit); - decimals = 3 * index; - value = trimDecimals(value, decimals); - } - else if (unit != null) { - decimals = getNumber(unit, "unit"); - value = trimDecimals(value, decimals); - } - return FixedNumber.fromString(value, { decimals }).value; - } - /** - * Converts %%value%% into a //decimal string// using 18 decimal places. - */ - function formatXCB(ore) { - return formatUnits(ore, 18); - } - /** - * Converts the //decimal string// %%xcb%% to a BigInt, using 18 - * decimal places. - */ - function parseXCB(xcb) { - return parseUnits(xcb, 18); - } - - /** - * Explain UUID and link to RFC here. - * - * @_subsection: api/utils:UUID [about-uuid] - */ - /** - * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. - * - * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) - */ - function uuidV4(randomBytes) { - const bytes = getBytes(randomBytes, "randomBytes"); - // Section: 4.1.3: - // - time_hi_and_version[12:16] = 0b0100 - bytes[6] = (bytes[6] & 0x0f) | 0x40; - // Section 4.4 - // - clock_seq_hi_and_reserved[6] = 0b0 - // - clock_seq_hi_and_reserved[7] = 0b1 - bytes[8] = (bytes[8] & 0x3f) | 0x80; - const value = hexlify(bytes); - return [ - value.substring(2, 10), - value.substring(10, 14), - value.substring(14, 18), - value.substring(18, 22), - value.substring(22, 34), - ].join("-"); - } - - // @ts-ignore - class Ed448Goldilock { - static _channel = ed448; - static generatePrivateKey() { - var privateKey = ed448.privateKeyGenerate(); - privateKey[56] &= 0x7f; - return privateKey; - } - static getPublicKeyFromPrivateKey(privateKey) { - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var scalar = secret.slice(0, 56); - scalar[0] &= 0xfc; - scalar[55] |= 0x80; - var publicKey = this._channel.publicKeyFromScalar(scalar); - return Buffer.from(publicKey).toString("hex"); - } - else { - var publicKey = this._channel.publicKeyCreate(secret); - return Buffer.from(publicKey).toString("hex"); - } - } - static signWithPrivateKey(privateKey, msg) { - var msgToSign = Buffer.from(msg, "hex"); - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var prefix = secret.slice(0, 57); - prefix[0] &= 0xfc; - prefix[56] = 0; - prefix[55] |= 0x80; - var scalar = prefix.slice(0, 56); - var signedMessage = this._channel.signWithScalar(msgToSign, scalar, prefix); - return Buffer.from(signedMessage).toString("hex"); - } - else { - var signedMessage = this._channel.sign(msgToSign, secret); - return Buffer.from(signedMessage).toString("hex"); - } - } - static signWithPrivateKeyNConcatPubkey(privateKey, msg) { - var signedMessage = Ed448Goldilock.signWithPrivateKey(privateKey, msg); - var publicKey = Ed448Goldilock.getPublicKeyFromPrivateKey(privateKey); - return signedMessage + publicKey; - } - static verifySignature(msgHash, signedMsg, pubKey) { - return this._channel.verify(msgHash, signedMsg, pubKey); - } - static SHA512Hash(password, salt) { - var p1 = Buffer.from(password, "hex"); - var s1 = Buffer.from(salt, "hex"); - return Buffer.from(pbkdf2$2.derive(SHA3_512, p1, s1, 2048, 57)).toString("hex"); - } - static concatenateAndHex(prefix, key, index, salt) { - var ind = Buffer.alloc(4); - var p = Buffer.alloc(1); - p[0] = prefix % 256; - var j = index; - for (let i = 0; i < 4; i++) { - ind[i] = j % 256; - j = Math.floor(j / 256); - } - var t = p.toString("hex") + key + ind.toString("hex"); - return Ed448Goldilock.SHA512Hash(t, salt); - } - static addScalar(a, b) { - var a1 = Buffer.from(a, "hex"); - var b1 = Buffer.from(b.substr(0, 106) + "00000000", "hex"); - b1[0] &= 0xfc; - var c = Buffer.alloc(57); - var hold = 0; - for (let i = 0; i < 57; i++) { - hold += a1[i] + b1[i]; - c[i] = hold % 256; - hold = Math.floor(hold / 256); - } - return c.toString("hex"); - } - static seedToExtendedPrivate(seed) { - var s1 = Ed448Goldilock.SHA512Hash(seed, "6d6e656d6f6e6963666f72746865636861696e"); - var s2 = Ed448Goldilock.SHA512Hash(seed, "6d6e656d6f6e6963666f727468656b6579"); - var b = Buffer.from(s2, "hex"); - b[56] |= 0x80; - b[55] |= 0x80; - b[55] &= 0xbf; - var s3 = b.toString("hex"); - return s1 + s3; - } - static childPrivateToPrivate(s, index) { - var s0 = s.substr(0, 114); - var s1 = s.substr(114, 228); - var r0, r1; - if (index >= 0x80000000) { - r0 = Ed448Goldilock.concatenateAndHex(1, s1, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(0, s1, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } - else { - var pub = Ed448Goldilock.getPublicKeyFromPrivateKey(s1); - r0 = Ed448Goldilock.concatenateAndHex(3, pub, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(2, pub, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } - } - static HDWalletGenerateKeyFromSeed(seed, index) { - var m = Ed448Goldilock.seedToExtendedPrivate(seed); - var k1 = Ed448Goldilock.childPrivateToPrivate(m, 0x80000000 + 44); - var k2 = Ed448Goldilock.childPrivateToPrivate(k1, 0x80000000 + 654); - var k3 = Ed448Goldilock.childPrivateToPrivate(k2, 0x80000000 + 0); - var k4 = Ed448Goldilock.childPrivateToPrivate(k3, 0x80000000 + 0); - var k5 = Ed448Goldilock.childPrivateToPrivate(k4, index); - return k5.substr(114, 228); - } - } - - /* Browser Crypto Shims */ - function getGlobal$1() { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw new Error("unable to locate global object"); - } - const anyGlobal = getGlobal$1(); - const crypto = anyGlobal.crypto || anyGlobal.msCrypto; - function createHash(algo) { - switch (algo) { - case "sha256": - return sha256$1.create(); - case "sha512": - return sha512$1.create(); - case "sha3-256": - return sha3_256.create(); - case "sha3-512": - return sha3_512.create(); - } - assertArgument(false, "invalid hashing algorithm name", "algorithm", algo); - } - function createHmac(_algo, key) { - const algo = { sha256: sha256$1, sha512: sha512$1 }[_algo]; - assertArgument(algo != null, "invalid hmac algorithm", "algorithm", _algo); - return hmac.create(algo, key); - } - function pbkdf2Sync(password, salt, iterations, keylen, _algo) { - const algo = { sha256: sha256$1, sha512: sha512$1 }[_algo]; - assertArgument(algo != null, "invalid pbkdf2 algorithm", "algorithm", _algo); - return pbkdf2$1(algo, password, salt, { c: iterations, dkLen: keylen }); - } - function randomBytes$1(length) { - assert(crypto != null, "platform does not support secure random numbers", "UNSUPPORTED_OPERATION", { - operation: "randomBytes", - }); - assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, "invalid length", "length", length); - const result = new Uint8Array(length); - crypto.getRandomValues(result); - return result; - } - - const _sha256 = function (data) { - let v = "0x" + - createHash("sha3-256") - .update(buffer.Buffer.from(arrayify(data))) - .digest("hex"); - return v; - }; - const _sha512 = function (data) { - let v = "0x" + - createHash("sha3-512") - .update(buffer.Buffer.from(arrayify(data))) - .digest("hex"); - return v; - }; - let locked256 = false, locked512 = false; - /** - * Compute the cryptographic SHA2-256 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha256("0x") - * //_result: - * - * sha256("0x1337") - * //_result: - * - * sha256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ - var SupportedAlgorithm; - (function (SupportedAlgorithm) { - SupportedAlgorithm["sha256"] = "sha256"; - SupportedAlgorithm["sha512"] = "sha512"; - })(SupportedAlgorithm || (SupportedAlgorithm = {})); - function sha256(data) { - let createdHash = createHash("sha3-256") - .update(buffer.Buffer.from(arrayify(data))) - .digest("hex"); - const v = "0x" + createdHash; - if (typeof createdHash !== "string") { - createdHash = hexlify(createdHash); - return createdHash; - } - return v; - } - function legacySha256(data) { - const _data = getBytes(data, "data"); - const hexlified = hexlify(createHash("sha256").update(_data).digest()); - return hexlified; - } - sha256._ = _sha256; - sha256.lock = function () { - locked256 = true; - }; - sha256.register = function (func) { - if (locked256) { - throw new Error("sha256 is locked"); - } - }; - Object.freeze(sha256); - /** - * Compute the cryptographic SHA2-512 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha512("0x") - * //_result: - * - * sha512("0x1337") - * //_result: - * - * sha512(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - */ - function sha512(data) { - let createdHash = createHash("sha3-512") - .update(buffer.Buffer.from(arrayify(data))) - .digest("hex"); - const v = "0x" + createdHash; - if (typeof createdHash !== "string") { - createdHash = hexlify(createdHash); - return createdHash; - } - return v; - } - sha512._ = _sha512; - sha512.lock = function () { - locked512 = true; - }; - sha512.register = function (func) { - if (locked512) { - throw new Error("sha512 is locked"); - } - }; - Object.freeze(sha256); - - /** - * Addresses are a fundamental part of interacting with Core. They - * represent the gloabal identity of Externally Owned Accounts (accounts - * backed by a private key) and contracts. - * - * The Core Naming Service (CNS) provides an interconnected ecosystem - * of contracts, standards and libraries which enable looking up an - * address for an ENS name. - * - * These functions help convert between various formats, validate - * addresses and safely resolve ENS names. - * - * @_section: api/address:Addresses [about-addresses] - */ - const logger$3 = new Logger("address/0.0.1"); - const precompiledAddresses = [ - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000001", - "0000000000000000000000000000000000000000000000000000000000000002", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000005", - "0000000000000000000000000000000000000000000000000000000000000006", - "0000000000000000000000000000000000000000000000000000000000000007", - "0000000000000000000000000000000000000000000000000000000000000008", - "0000000000000000000000000000000000000000000000000000000000000009", - ]; - function removeHexPrefix$1(val) { - return val.substring(0, 2) === "0x" ? val.substring(2) : val; - } - function calculateCheckSum(_address, _prefix) { - const address = getBytes("0x" + _address.replace("0x", "")); - const prefix = getBytes("0x" + _prefix.replace("0x", "")); - const tmpConcated = new Uint8Array([...address, ...prefix]); - const hexedConcat = hexlify(tmpConcated).replace("0x", "") + "00"; - const mods = Array.from(hexedConcat.toUpperCase(), (c) => { - const charCode = c.charCodeAt(0); - return charCode > 64 && charCode < 91 - ? (charCode - 55).toString() - : (charCode - 48).toString(); - }).join(""); - const bigVal = BigInt(mods); - const val97 = BigInt(97); - const val98 = BigInt(98); - const remainder = bigVal % val97; - const checkSum = val98 - remainder; - const result = checkSum > 9 ? checkSum.toString() : "0" + checkSum.toString(); - return result; - } - /** - * Returns a normalized and checksumed address for %%address%%. - * This accepts non-checksum addresses, checksum addresses and - * [[getIcapAddress]] formats. - * - * The checksum in Core uses the capitalization (upper-case - * vs lower-case) of the characters within an address to encode - * its checksum, which offers, on average, a checksum of 15-bits. - * - * If %%address%% contains both upper-case and lower-case, it is - * assumed to already be a checksum address and its checksum is - * validated, and if the address fails its expected checksum an - * error is thrown. - * - * If you wish the checksum of %%address%% to be ignore, it should - * be converted to lower-case (i.e. ``.toLowercase()``) before - * being passed in. This should be a very rare situation though, - * that you wish to bypass the safegaurds in place to protect - * against an address that has been incorrectly copied from another - * source. - * - * @example: - * // Adds the checksum (via upper-casing specific letters) - * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") - * //_result: - * - * // Converts ICAP address and adds checksum - * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); - * //_result: - * - * // Throws an error if an address contains mixed case, - * // but the checksum fails - * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") - * //_error: - */ - function getAddress(address) { - if (typeof address !== "string") { - logger$3.throwArgumentError("invalid address", "address", address); - } - if (!address.match(/^(0x)?[0-9a-fA-F]{44}$/)) { - logger$3.throwArgumentError("invalid address", "address", address); - } - const raw = removeHexPrefix$1(address); - if (precompiledAddresses.includes(raw)) { - return "0x" + raw; - } - const prefix = raw.substring(0, 2); - const val = raw.substring(4); - const checksum = calculateCheckSum(val, prefix); - if (checksum !== raw.substring(2, 4)) { - logger$3.throwArgumentError("bad address checksum", "address", address); - } - return "0x" + prefix + checksum + val; - } - function networkIdToPrefix(networkId) { - if (networkId == 1) { - return "cb"; - } - else if (networkId == 3 || networkId == 4) { - return "ab"; - } - else if (networkId > 10 || networkId == 0) { - return "ce"; - } - else { - logger$3.throwArgumentError("bad networkId", "networkId", networkId); - return ""; - } - } - - /** - * An **HMAC** enables verification that a given key was used - * to authenticate a payload. - * - * See: [[link-wiki-hmac]] - * - * @_subsection: api/crypto:HMAC [about-hmac] - */ - let locked$4 = false; - const _computeHmac = function (algorithm, key, data) { - return createHmac(algorithm, key).update(data).digest(); - }; - let __computeHmac = _computeHmac; - /** - * Return the HMAC for %%data%% using the %%key%% key with the underlying - * %%algo%% used for compression. - * - * @example: - * key = id("some-secret") - * - * // Compute the HMAC - * computeHmac("sha256", key, "0x1337") - * //_result: - * - * // To compute the HMAC of UTF-8 data, the data must be - * // converted to UTF-8 bytes - * computeHmac("sha256", key, toUtf8Bytes("Hello World")) - * //_result: - * - */ - function computeHmac(algorithm, _key, _data) { - const key = getBytes(_key, "key"); - const data = getBytes(_data, "data"); - return hexlify(__computeHmac(algorithm, key, data)); - } - computeHmac._ = _computeHmac; - computeHmac.lock = function () { - locked$4 = true; - }; - computeHmac.register = function (func) { - if (locked$4) { - throw new Error("computeHmac is locked"); - } - __computeHmac = func; - }; - Object.freeze(computeHmac); - - // https://homes.esat.kuleuven.be/~bosselae/ripemd160.html - // https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf - const Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]); - const Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i); - const Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16); - let idxL = [Id]; - let idxR = [Pi]; - for (let i = 0; i < 4; i++) - for (let j of [idxL, idxR]) - j.push(j[i].map((k) => Rho[k])); - const shifts = /* @__PURE__ */ [ - [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8], - [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7], - [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9], - [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6], - [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5], - ].map((i) => new Uint8Array(i)); - const shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j])); - const shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j])); - const Kl = /* @__PURE__ */ new Uint32Array([ - 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e, - ]); - const Kr = /* @__PURE__ */ new Uint32Array([ - 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000, - ]); - // The rotate left (circular left shift) operation for uint32 - const rotl$1 = (word, shift) => (word << shift) | (word >>> (32 - shift)); - // It's called f() in spec. - function f(group, x, y, z) { - if (group === 0) - return x ^ y ^ z; - else if (group === 1) - return (x & y) | (~x & z); - else if (group === 2) - return (x | ~y) ^ z; - else if (group === 3) - return (x & z) | (y & ~z); - else - return x ^ (y | ~z); - } - // Temporary buffer, not used to store anything between runs - const BUF = /* @__PURE__ */ new Uint32Array(16); - class RIPEMD160 extends SHA2 { - constructor() { - super(64, 20, 8, true); - this.h0 = 0x67452301 | 0; - this.h1 = 0xefcdab89 | 0; - this.h2 = 0x98badcfe | 0; - this.h3 = 0x10325476 | 0; - this.h4 = 0xc3d2e1f0 | 0; - } - get() { - const { h0, h1, h2, h3, h4 } = this; - return [h0, h1, h2, h3, h4]; - } - set(h0, h1, h2, h3, h4) { - this.h0 = h0 | 0; - this.h1 = h1 | 0; - this.h2 = h2 | 0; - this.h3 = h3 | 0; - this.h4 = h4 | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - BUF[i] = view.getUint32(offset, true); - // prettier-ignore - let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el; - // Instead of iterating 0 to 80, we split it into 5 groups - // And use the groups in constants, functions, etc. Much simpler - for (let group = 0; group < 5; group++) { - const rGroup = 4 - group; - const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore - const rl = idxL[group], rr = idxR[group]; // prettier-ignore - const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore - for (let i = 0; i < 16; i++) { - const tl = (rotl$1(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0; - al = el, el = dl, dl = rotl$1(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore - } - // 2 loops are 10% faster - for (let i = 0; i < 16; i++) { - const tr = (rotl$1(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0; - ar = er, er = dr, dr = rotl$1(cr, 10) | 0, cr = br, br = tr; // prettier-ignore - } - } - // Add the compressed chunk to the current hash value - this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0); - } - roundClean() { - BUF.fill(0); - } - destroy() { - this.destroyed = true; - this.buffer.fill(0); - this.set(0, 0, 0, 0, 0); - } - } - /** - * RIPEMD-160 - a hash function from 1990s. - * @param message - msg that would be hashed - */ - const ripemd160$1 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160()); - - let locked$3 = false; - const _ripemd160 = function (data) { - return ripemd160$1(data); - }; - let __ripemd160 = _ripemd160; - /** - * Compute the cryptographic RIPEMD-160 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * ripemd160("0x") - * //_result: - * - * ripemd160("0x1337") - * //_result: - * - * ripemd160(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ - function ripemd160(_data) { - const data = getBytes(_data, "data"); - return hexlify(__ripemd160(data)); - } - ripemd160._ = _ripemd160; - ripemd160.lock = function () { - locked$3 = true; - }; - ripemd160.register = function (func) { - if (locked$3) { - throw new TypeError("ripemd160 is locked"); - } - __ripemd160 = func; - }; - Object.freeze(ripemd160); - - /** - * A **Password-Based Key-Derivation Function** is designed to create - * a sequence of bytes suitible as a **key** from a human-rememberable - * password. - * - * @_subsection: api/crypto:Passwords [about-pbkdf] - */ - let locked$2 = false; - const _pbkdf2 = function (password, salt, iterations, keylen, algo) { - return pbkdf2Sync(password, salt, iterations, keylen, algo); - }; - let __pbkdf2 = _pbkdf2; - /** - * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using - * the %%salt%% and using %%iterations%% of %%algo%%. - * - * This PBKDF is outdated and should not be used in new projects, but is - * required to decrypt older files. - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the PBKDF2 - * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") - * //_result: - */ - function pbkdf2(_password, _salt, iterations, keylen, algo) { - const password = getBytes(_password, "password"); - const salt = getBytes(_salt, "salt"); - return hexlify(__pbkdf2(password, salt, iterations, keylen, algo)); - } - pbkdf2._ = _pbkdf2; - pbkdf2.lock = function () { - locked$2 = true; - }; - pbkdf2.register = function (func) { - if (locked$2) { - throw new Error("pbkdf2 is locked"); - } - __pbkdf2 = func; - }; - Object.freeze(pbkdf2); - - /** - * A **Cryptographically Secure Random Value** is one that has been - * generated with additional care take to prevent side-channels - * from allowing others to detect it and prevent others from through - * coincidence generate the same values. - * - * @_subsection: api/crypto:Random Values [about-crypto-random] - */ - let locked$1 = false; - const _randomBytes = function (length) { - return new Uint8Array(randomBytes$1(length)); - }; - let __randomBytes = _randomBytes; - /** - * Return %%length%% bytes of cryptographically secure random data. - * - * @example: - * randomBytes(8) - * //_result: - */ - function randomBytes(length) { - return __randomBytes(length); - } - randomBytes._ = _randomBytes; - randomBytes.lock = function () { - locked$1 = true; - }; - randomBytes.register = function (func) { - if (locked$1) { - throw new Error("randomBytes is locked"); - } - __randomBytes = func; - }; - Object.freeze(randomBytes); - - // RFC 7914 Scrypt KDF - // Left rotate for uint32 - const rotl = (a, b) => (a << b) | (a >>> (32 - b)); - // The main Scrypt loop: uses Salsa extensively. - // Six versions of the function were tried, this is the fastest one. - // prettier-ignore - function XorAndSalsa(prev, pi, input, ii, out, oi) { - // Based on https://cr.yp.to/salsa20.html - // Xor blocks - let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++]; - let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++]; - let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++]; - let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++]; - let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++]; - let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++]; - let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++]; - let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++]; - // Save state to temporary variables (salsa) - let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15; - // Main loop (salsa) - for (let i = 0; i < 8; i += 2) { - x04 ^= rotl(x00 + x12 | 0, 7); - x08 ^= rotl(x04 + x00 | 0, 9); - x12 ^= rotl(x08 + x04 | 0, 13); - x00 ^= rotl(x12 + x08 | 0, 18); - x09 ^= rotl(x05 + x01 | 0, 7); - x13 ^= rotl(x09 + x05 | 0, 9); - x01 ^= rotl(x13 + x09 | 0, 13); - x05 ^= rotl(x01 + x13 | 0, 18); - x14 ^= rotl(x10 + x06 | 0, 7); - x02 ^= rotl(x14 + x10 | 0, 9); - x06 ^= rotl(x02 + x14 | 0, 13); - x10 ^= rotl(x06 + x02 | 0, 18); - x03 ^= rotl(x15 + x11 | 0, 7); - x07 ^= rotl(x03 + x15 | 0, 9); - x11 ^= rotl(x07 + x03 | 0, 13); - x15 ^= rotl(x11 + x07 | 0, 18); - x01 ^= rotl(x00 + x03 | 0, 7); - x02 ^= rotl(x01 + x00 | 0, 9); - x03 ^= rotl(x02 + x01 | 0, 13); - x00 ^= rotl(x03 + x02 | 0, 18); - x06 ^= rotl(x05 + x04 | 0, 7); - x07 ^= rotl(x06 + x05 | 0, 9); - x04 ^= rotl(x07 + x06 | 0, 13); - x05 ^= rotl(x04 + x07 | 0, 18); - x11 ^= rotl(x10 + x09 | 0, 7); - x08 ^= rotl(x11 + x10 | 0, 9); - x09 ^= rotl(x08 + x11 | 0, 13); - x10 ^= rotl(x09 + x08 | 0, 18); - x12 ^= rotl(x15 + x14 | 0, 7); - x13 ^= rotl(x12 + x15 | 0, 9); - x14 ^= rotl(x13 + x12 | 0, 13); - x15 ^= rotl(x14 + x13 | 0, 18); - } - // Write output (salsa) - out[oi++] = (y00 + x00) | 0; - out[oi++] = (y01 + x01) | 0; - out[oi++] = (y02 + x02) | 0; - out[oi++] = (y03 + x03) | 0; - out[oi++] = (y04 + x04) | 0; - out[oi++] = (y05 + x05) | 0; - out[oi++] = (y06 + x06) | 0; - out[oi++] = (y07 + x07) | 0; - out[oi++] = (y08 + x08) | 0; - out[oi++] = (y09 + x09) | 0; - out[oi++] = (y10 + x10) | 0; - out[oi++] = (y11 + x11) | 0; - out[oi++] = (y12 + x12) | 0; - out[oi++] = (y13 + x13) | 0; - out[oi++] = (y14 + x14) | 0; - out[oi++] = (y15 + x15) | 0; - } - function BlockMix(input, ii, out, oi, r) { - // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks) - let head = oi + 0; - let tail = oi + 16 * r; - for (let i = 0; i < 16; i++) - out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1] - for (let i = 0; i < r; i++, head += 16, ii += 16) { - // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1 - XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1]) - if (i > 0) - tail += 16; // First iteration overwrites tmp value in tail - XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i]) - } - } - // Common prologue and epilogue for sync/async functions - function scryptInit(password, salt, _opts) { - // Maxmem - 1GB+1KB by default - const opts = checkOpts({ - dkLen: 32, - asyncTick: 10, - maxmem: 1024 ** 3 + 1024, - }, _opts); - const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts; - number(N); - number(r); - number(p); - number(dkLen); - number(asyncTick); - number(maxmem); - if (onProgress !== undefined && typeof onProgress !== 'function') - throw new Error('progressCb should be function'); - const blockSize = 128 * r; - const blockSize32 = blockSize / 4; - if (N <= 1 || (N & (N - 1)) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) { - // NOTE: we limit N to be less than 2**32 because of 32 bit variant of Integrify function - // There is no JS engines that allows alocate more than 4GB per single Uint8Array for now, but can change in future. - throw new Error('Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32'); - } - if (p < 0 || p > ((2 ** 32 - 1) * 32) / blockSize) { - throw new Error('Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)'); - } - if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) { - throw new Error('Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32'); - } - const memUsed = blockSize * (N + p); - if (memUsed > maxmem) { - throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`); - } - // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor) - // Since it has only one iteration there is no reason to use async variant - const B = pbkdf2$1(sha256$1, password, salt, { c: 1, dkLen: blockSize * p }); - const B32 = u32(B); - // Re-used between parallel iterations. Array(iterations) of B - const V = u32(new Uint8Array(blockSize * N)); - const tmp = u32(new Uint8Array(blockSize)); - let blockMixCb = () => { }; - if (onProgress) { - const totalBlockMix = 2 * N * p; - // Invoke callback if progress changes from 10.01 to 10.02 - // Allows to draw smooth progress bar on up to 8K screen - const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1); - let blockMixCnt = 0; - blockMixCb = () => { - blockMixCnt++; - if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix)) - onProgress(blockMixCnt / totalBlockMix); - }; - } - return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick }; - } - function scryptOutput(password, dkLen, B, V, tmp) { - const res = pbkdf2$1(sha256$1, password, B, { c: 1, dkLen }); - B.fill(0); - V.fill(0); - tmp.fill(0); - return res; - } - /** - * Scrypt KDF from RFC 7914. - * @param password - pass - * @param salt - salt - * @param opts - parameters - * - `N` is cpu/mem work factor (power of 2 e.g. 2**18) - * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance - * - `p` is parallelization factor (1 is common) - * - `dkLen` is output key length in bytes e.g. 32. - * - `asyncTick` - (default: 10) max time in ms for which async function can block execution - * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt - * - `onProgress` - callback function that would be executed for progress report - * @returns Derived key - */ - function scrypt$1(password, salt, opts) { - const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts); - for (let pi = 0; pi < p; pi++) { - const Pi = blockSize32 * pi; - for (let i = 0; i < blockSize32; i++) - V[i] = B32[Pi + i]; // V[0] = B[i] - for (let i = 0, pos = 0; i < N - 1; i++) { - BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); - blockMixCb(); - } - BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element - blockMixCb(); - for (let i = 0; i < N; i++) { - // First u32 of the last 64-byte block (u32 is LE) - const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations - for (let k = 0; k < blockSize32; k++) - tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j] - BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) - blockMixCb(); - } - } - return scryptOutput(password, dkLen, B, V, tmp); - } - /** - * Scrypt KDF from RFC 7914. - */ - async function scryptAsync(password, salt, opts) { - const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts); - for (let pi = 0; pi < p; pi++) { - const Pi = blockSize32 * pi; - for (let i = 0; i < blockSize32; i++) - V[i] = B32[Pi + i]; // V[0] = B[i] - let pos = 0; - await asyncLoop(N - 1, asyncTick, () => { - BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); - blockMixCb(); - }); - BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element - blockMixCb(); - await asyncLoop(N, asyncTick, () => { - // First u32 of the last 64-byte block (u32 is LE) - const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations - for (let k = 0; k < blockSize32; k++) - tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j] - BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) - blockMixCb(); - }); - } - return scryptOutput(password, dkLen, B, V, tmp); - } - - let lockedSync = false, lockedAsync = false; - const _scryptAsync = async function (passwd, salt, N, r, p, dkLen, onProgress) { - return await scryptAsync(passwd, salt, { N, r, p, dkLen, onProgress }); - }; - const _scryptSync = function (passwd, salt, N, r, p, dkLen) { - return scrypt$1(passwd, salt, { N, r, p, dkLen }); - }; - let __scryptAsync = _scryptAsync; - let __scryptSync = _scryptSync; - /** - * The [[link-wiki-scrypt]] uses a memory and cpu hard method of - * derivation to increase the resource cost to brute-force a password - * for a given key. - * - * This means this algorithm is intentionally slow, and can be tuned to - * become slower. As computation and memory speed improve over time, - * increasing the difficulty maintains the cost of an attacker. - * - * For example, if a target time of 5 seconds is used, a legitimate user - * which knows their password requires only 5 seconds to unlock their - * account. A 6 character password has 68 billion possibilities, which - * would require an attacker to invest over 10,000 years of CPU time. This - * is of course a crude example (as password generally aren't random), - * but demonstrates to value of imposing large costs to decryption. - * - * For this reason, if building a UI which involved decrypting or - * encrypting datsa using scrypt, it is recommended to use a - * [[ProgressCallback]] (as event short periods can seem lik an eternity - * if the UI freezes). Including the phrase //"decrypting"// in the UI - * can also help, assuring the user their waiting is for a good reason. - * - * @_docloc: api/crypto:Passwords - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the scrypt - * scrypt(passwordBytes, salt, 1024, 8, 1, 16) - * //_result: - */ - async function scrypt(_passwd, _salt, N, r, p, dkLen, progress) { - const passwd = getBytes(_passwd, "passwd"); - const salt = getBytes(_salt, "salt"); - return hexlify(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress)); - } - scrypt._ = _scryptAsync; - scrypt.lock = function () { - lockedAsync = true; - }; - scrypt.register = function (func) { - if (lockedAsync) { - throw new Error("scrypt is locked"); - } - __scryptAsync = func; - }; - Object.freeze(scrypt); - /** - * Provides a synchronous variant of [[scrypt]]. - * - * This will completely lock up and freeze the UI in a browser and will - * prevent any event loop from progressing. For this reason, it is - * preferred to use the [async variant](scrypt). - * - * @_docloc: api/crypto:Passwords - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the scrypt - * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) - * //_result: - */ - function scryptSync(_passwd, _salt, N, r, p, dkLen) { - const passwd = getBytes(_passwd, "passwd"); - const salt = getBytes(_salt, "salt"); - return hexlify(__scryptSync(passwd, salt, N, r, p, dkLen)); - } - scryptSync._ = _scryptSync; - scryptSync.lock = function () { - lockedSync = true; - }; - scryptSync.register = function (func) { - if (lockedSync) { - throw new Error("scryptSync is locked"); - } - __scryptSync = func; - }; - Object.freeze(scryptSync); - - /** - * Cryptographic hashing functions - * - * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] - */ - let locked = false; - const _keccak256 = function (data) { - return keccak_256(data); - }; - let __keccak256 = _keccak256; - /** - * Compute the cryptographic KECCAK256 hash of %%data%%. - * - * The %%data%% **must** be a data representation, to compute the - * hash of UTF-8 data use the [[id]] function. - * - * @returns DataHexstring - * @example: - * keccak256("0x") - * //_result: - * - * keccak256("0x1337") - * //_result: - * - * keccak256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - * // Strings are assumed to be DataHexString, otherwise it will - * // throw. To hash UTF-8 data, see the note above. - * keccak256("Hello World") - * //_error: - */ - function keccak256(_data) { - const data = getBytes(_data, "data"); - return hexlify(__keccak256(data)); - } - keccak256._ = _keccak256; - keccak256.lock = function () { - locked = true; - }; - keccak256.register = function (func) { - if (locked) { - throw new TypeError("keccak256 is locked"); - } - __keccak256 = func; - }; - Object.freeze(keccak256); - - /*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */ - const B256 = 2n ** 256n; // secp256k1 is short weierstrass curve - const P = B256 - 0x1000003d1n; // curve's field prime - const N$1 = B256 - 0x14551231950b75fc4402da1732fc9bebfn; // curve (group) order - const Gx = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n; // base point x - const Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n; // base point y - const CURVE = { p: P, n: N$1, a: 0n, b: 7n, Gx, Gy }; // exported variables incl. a, b - const fLen = 32; // field / group byte length - const crv = (x) => mod(mod(x * x) * x + CURVE.b); // x³ + ax + b weierstrass formula; no a - const err = (m = '') => { throw new Error(m); }; // error helper, messes-up stack trace - const big = (n) => typeof n === 'bigint'; // is big integer - const str = (s) => typeof s === 'string'; // is string - const fe = (n) => big(n) && 0n < n && n < P; // is field element (invertible) - const ge = (n) => big(n) && 0n < n && n < N$1; // is group element - const au8 = (a, l) => // is Uint8Array (of specific length) - !(a instanceof Uint8Array) || (typeof l === 'number' && l > 0 && a.length !== l) ? - err('Uint8Array expected') : a; - const u8n = (data) => new Uint8Array(data); // creates Uint8Array - const toU8 = (a, len) => au8(str(a) ? h2b(a) : u8n(a), len); // norm(hex/u8a) to u8a - const mod = (a, b = P) => { let r = a % b; return r >= 0n ? r : b + r; }; // mod division - const isPoint = (p) => (p instanceof Point ? p : err('Point expected')); // is 3d point - let Gpows = undefined; // precomputes for base point G - class Point { - constructor(px, py, pz) { - this.px = px; - this.py = py; - this.pz = pz; - } //3d=less inversions - static fromAffine(p) { return new Point(p.x, p.y, 1n); } - static fromHex(hex) { - hex = toU8(hex); // convert hex string to Uint8Array - let p = undefined; - const head = hex[0], tail = hex.subarray(1); // first byte is prefix, rest is data - const x = slcNum(tail, 0, fLen), len = hex.length; // next 32 bytes are x coordinate - if (len === 33 && [0x02, 0x03].includes(head)) { // compressed points: 33b, start - if (!fe(x)) - err('Point hex invalid: x not FE'); // with byte 0x02 or 0x03. Check if 0 0n; d = d.double(), n >>= 1n) { // double-and-add ladder - if (n & 1n) - p = p.add(d); // if bit is present, add to point - else if (safe) - f = f.add(d); // if not, add to fake for timing safety - } - return p; - } - mulAddQUns(R, u1, u2) { - return this.mul(u1, false).add(R.mul(u2, false)).ok(); // Unsafe: do NOT use for stuff related - } // to private keys. Doesn't use Shamir trick - toAffine() { - const { px: x, py: y, pz: z } = this; // (x, y, z) ∋ (x=x/z, y=y/z) - if (this.equals(I)) - return { x: 0n, y: 0n }; // fast-path for zero point - if (z === 1n) - return { x, y }; // if z is 1, pass affine coordinates as-is - const iz = inv(z); // z^-1: invert z - if (mod(z * iz) !== 1n) - err('invalid inverse'); // (z * z^-1) must be 1, otherwise bad math - return { x: mod(x * iz), y: mod(y * iz) }; // x = x*z^-1; y = y*z^-1 - } - assertValidity() { - const { x, y } = this.aff(); // convert to 2d xy affine point. - if (!fe(x) || !fe(y)) - err('Point invalid: x or y'); // x and y must be in range 0 < n < P - return mod(y * y) === crv(x) ? // y² = x³ + ax + b, must be equal - this : err('Point invalid: not on curve'); - } - multiply(n) { return this.mul(n); } // Aliases to compress code - aff() { return this.toAffine(); } - ok() { return this.assertValidity(); } - toHex(isCompressed = true) { - const { x, y } = this.aff(); // convert to 2d xy affine point - const head = isCompressed ? ((y & 1n) === 0n ? '02' : '03') : '04'; // 0x02, 0x03, 0x04 prefix - return head + n2h(x) + (isCompressed ? '' : n2h(y)); // prefix||x and ||y - } - toRawBytes(isCompressed = true) { - return h2b(this.toHex(isCompressed)); // re-use toHex(), convert hex to bytes - } - } - Point.BASE = new Point(Gx, Gy, 1n); // Generator / base point - Point.ZERO = new Point(0n, 1n, 0n); // Identity / zero point - const { BASE: G, ZERO: I } = Point; // Generator, identity points - const padh = (n, pad) => n.toString(16).padStart(pad, '0'); - const b2h = (b) => Array.from(b).map(e => padh(e, 2)).join(''); // bytes to hex - const h2b = (hex) => { - const l = hex.length; // error if not string, - if (!str(hex) || l % 2) - err('hex invalid 1'); // or has odd length like 3, 5. - const arr = u8n(l / 2); // create result array - for (let i = 0; i < arr.length; i++) { - const j = i * 2; - const h = hex.slice(j, j + 2); // hexByte. slice is faster than substr - const b = Number.parseInt(h, 16); // byte, created from string part - if (Number.isNaN(b) || b < 0) - err('hex invalid 2'); // byte must be valid 0 <= byte < 256 - arr[i] = b; - } - return arr; - }; - const b2n = (b) => BigInt('0x' + (b2h(b) || '0')); // bytes to number - const slcNum = (b, from, to) => b2n(b.slice(from, to)); // slice bytes num - const n2b = (num) => { - return big(num) && num >= 0n && num < B256 ? h2b(padh(num, 2 * fLen)) : err('bigint expected'); - }; - const n2h = (num) => b2h(n2b(num)); // number to 32b hex - const inv = (num, md = P) => { - if (num === 0n || md <= 0n) - err('no inverse n=' + num + ' mod=' + md); // no neg exponent for now - let a = mod(num, md), b = md, x = 0n, u = 1n; - while (a !== 0n) { // uses euclidean gcd algorithm - const q = b / a, r = b % a; // not constant-time - const m = x - u * q; - b = a, a = r, x = u, u = m; - } - return b === 1n ? mod(x, md) : err('no inverse'); // b is gcd at this point - }; - const sqrt = (n) => { - let r = 1n; // So, a special, fast case. Paper: "Square Roots from 1;24,51,10 to Dan Shanks". - for (let num = n, e = (P + 1n) / 4n; e > 0n; e >>= 1n) { // powMod: modular exponentiation. - if (e & 1n) - r = (r * num) % P; // Uses exponentiation by squaring. - num = (num * num) % P; // Not constant-time. - } - return mod(r * r) === n ? r : err('sqrt invalid'); // check if result is valid - }; - const toPriv = (p) => { - if (!big(p)) - p = b2n(toU8(p, fLen)); // convert to bigint when bytes - return ge(p) ? p : err('private key out of range'); // check if bigint is in range - }; - function getSharedSecret(privA, pubB, isCompressed = true) { - return Point.fromHex(pubB).mul(toPriv(privA)).toRawBytes(isCompressed); // ECDH - } - const W = 8; // Precomputes-related code. W = window size - const precompute = () => { - const points = []; // 10x sign(), 2x verify(). To achieve this, - const windows = 256 / W + 1; // app needs to spend 40ms+ to calculate - let p = G, b = p; // a lot of points related to base point G. - for (let w = 0; w < windows; w++) { // Points are stored in array and used - b = p; // any time Gx multiplication is done. - points.push(b); // They consume 16-32 MiB of RAM. - for (let i = 1; i < 2 ** (W - 1); i++) { - b = b.add(p); - points.push(b); - } - p = b.double(); // Precomputes don't speed-up getSharedKey, - } // which multiplies user point by scalar, - return points; // when precomputes are using base point - }; - const wNAF = (n) => { - // Compared to other point mult methods, - const comp = Gpows || (Gpows = precompute()); // stores 2x less points using subtraction - const neg = (cnd, p) => { let n = p.negate(); return cnd ? n : p; }; // negate - let p = I, f = G; // f must be G, or could become I in the end - const windows = 1 + 256 / W; // W=8 17 windows - const wsize = 2 ** (W - 1); // W=8 128 window size - const mask = BigInt(2 ** W - 1); // W=8 will create mask 0b11111111 - const maxNum = 2 ** W; // W=8 256 - const shiftBy = BigInt(W); // W=8 8 - for (let w = 0; w < windows; w++) { - const off = w * wsize; - let wbits = Number(n & mask); // extract W bits. - n >>= shiftBy; // shift number by W bits. - if (wbits > wsize) { - wbits -= maxNum; - n += 1n; - } // split if bits > max: +224 => 256-32 - const off1 = off, off2 = off + Math.abs(wbits) - 1; // offsets, evaluate both - const cnd1 = w % 2 !== 0, cnd2 = wbits < 0; // conditions, evaluate both - if (wbits === 0) { - f = f.add(neg(cnd1, comp[off1])); // bits are 0: add garbage to fake point - } - else { // ^ can't add off2, off2 = I - p = p.add(neg(cnd2, comp[off2])); // bits are 1: add to result point - } - } - return { p, f }; // return both real and fake points for JIT - }; // !! you can disable precomputes by commenting-out call of the wNAF() inside Point#mul() - - /** - * Add details about signing here. - * - * @_subsection: api/crypto:Signing [about-signing] - */ - const logger$2 = new Logger("signing-key/0.0.1"); - //const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); - // Make noble-secp256k1 sync - /** - * A **SigningKey** provides high-level access to the elliptic curve - * cryptography (ECC) operations and key management. - */ - class SigningKey { - #privateKey; - /** - * Creates a new **SigningKey** for %%privateKey%%. - */ - constructor(privateKey) { - let tmp = privateKey; - if (typeof tmp === "string" && tmp.startsWith("0x")) { - tmp = tmp.replace("0x", ""); - } - assertArgument(dataLength("0x" + tmp) === 57, "invalid private key", "privateKey", "[REDACTED]"); - this.#privateKey = hexlify("0x" + tmp); - } - /** - * The private key. - */ - get privateKey() { - return this.#privateKey; - } - /** - * The uncompressed public key. - * - * This will always begin with the prefix ``0x04`` and be 132 - * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). - */ - get publicKey() { - return SigningKey.computePublicKey(this.#privateKey); - } - /** - * The compressed public key. - * - * This will always begin with either the prefix ``0x02`` or ``0x03`` - * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal - * nibbles) - */ - get compressedPublicKey() { - return SigningKey.computePublicKey(this.#privateKey, true); - } - /** - * Return the signature of the signed %%digest%%. - */ - sign(digest) { - const key = getBytesCopy(this.#privateKey); - assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); - const keyBuffer = new Uint8Array(arrayify(key)); - if (keyBuffer.length !== 57) { - logger$2.throwArgumentError("invalid private key", "key", "[REDACTED]"); - } - const digestBuffer = new Uint8Array(arrayify(digest)); - if (digestBuffer.length !== 32) { - logger$2.throwArgumentError("bad digest length", "digest", digest); - } - if (keyBuffer[56] > 127) { - const prefix = keyBuffer.slice(0, 57); - prefix[0] &= 0xfc; - prefix[55] |= 0x80; - prefix[56] = 0; - const scalar = prefix.slice(0, 56); - const bufferDigest = buffer.Buffer.from(digestBuffer); - const bufferPrfx = buffer.Buffer.from(prefix); - const bufferScalar = buffer.Buffer.from(scalar); - const sig = ed448.signWithScalar(bufferDigest, bufferScalar, bufferPrfx); - const hexlified = hexlify(sig); - return hexConcat([hexlified, this.publicKey]); - } - const sig = ed448.sign(buffer.Buffer.from(digestBuffer), buffer.Buffer.from(keyBuffer)); - const hexlified = hexlify(sig); - return hexConcat([hexlified, this.publicKey]); - } - /** - * Returns the [[link-wiki-ecdh]] shared secret between this - * private key and the %%other%% key. - * - * The %%other%% key may be any type of key, a raw public key, - * a compressed/uncompressed pubic key or aprivate key. - * - * Best practice is usually to use a cryptographic hash on the - * returned value before using it as a symetric secret. - * - * @example: - * sign1 = new SigningKey(id("some-secret-1")) - * sign2 = new SigningKey(id("some-secret-2")) - * - * // Notice that privA.computeSharedSecret(pubB)... - * sign1.computeSharedSecret(sign2.publicKey) - * //_result: - * - * // ...is equal to privB.computeSharedSecret(pubA). - * sign2.computeSharedSecret(sign1.publicKey) - * //_result: - */ - computeSharedSecret(other) { - const pubKey = SigningKey.computePublicKey(other); - return hexlify(getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey))); - } - /** - * Compute the public key for %%key%%, optionally %%compressed%%. - * - * The %%key%% may be any type of key, a raw public key, a - * compressed/uncompressed public key or private key. - * - * @example: - * sign = new SigningKey(id("some-secret")); - * - * // Compute the uncompressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey) - * //_result: - * - * // Compute the compressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey, true) - * //_result: - * - * // Compute the uncompressed public key - * SigningKey.computePublicKey(sign.publicKey, false); - * //_result: - * - * // Compute the Compressed a public key - * SigningKey.computePublicKey(sign.publicKey, true); - * //_result: - */ - static computePublicKey(key, compressed) { - const bytes = buffer.Buffer.from(arrayify(key)); - if (bytes.length !== 57) { - logger$2.throwArgumentError("invalid private key", "key", "[REDACTED]"); - } - if (bytes[56] > 127) { - const scalar = bytes.slice(0, 56); - scalar[0] &= 0xfc; - scalar[55] |= 0x80; - const pub = ed448.publicKeyFromScalar(scalar); - return hexlify(pub); - } - const pub = ed448.publicKeyCreate(bytes); - return hexlify(pub); - } - /** - * Returns the public key for the private key which produced the - * %%signature%% for the given %%digest%%. - * - * @example: - * key = new SigningKey(id("some-secret")) - * digest = id("hello world") - * sig = key.sign(digest) - * - * // Notice the signer public key... - * key.publicKey - * //_result: - * - * // ...is equal to the recovered public key - * SigningKey.recoverPublicKey(digest, sig) - * //_result: - * - */ - static recoverPublicKey(digest, signature) { - assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); - const digestBuffer = buffer.Buffer.from(arrayify(digest)); - const sigBuffer = buffer.Buffer.from(arrayify(signature)); - if (sigBuffer.length !== 171) { - logger$2.throwArgumentError("invalid signature", "signature", signature); - } - const sig = sigBuffer.slice(0, 114); - const pub = sigBuffer.slice(114); - if (ed448.verify(digestBuffer, sig, pub)) { - return hexlify(pub); - } - logger$2.throwArgumentError("invalid signature", "signature", signature); - return ""; - } - /** - * Returns the point resulting from adding the ellipic curve points - * %%p0%% and %%p1%%. - * - * This is not a common function most developers should require, but - * can be useful for certain privacy-specific techniques. - * - * For example, it is used by [[HDNodeWallet]] to compute child - * addresses from parent public keys and chain codes. - */ - static addPoints(p0, p1, compressed) { - const pub0 = Point.fromHex(SigningKey.computePublicKey(p0).substring(2)); - const pub1 = Point.fromHex(SigningKey.computePublicKey(p1).substring(2)); - return "0x" + pub0.add(pub1).toHex(!!compressed); - } - } - - // Constants - const BN_0$6 = BigInt(0); - const BN_1$3 = BigInt(1); - const BN_2$1 = BigInt(2); - const BN_27 = BigInt(27); - const BN_28 = BigInt(28); - const BN_35 = BigInt(35); - const _guard$4 = {}; - /** - * A Signature @TODO - * - * - * @_docloc: api/crypto:Signing - */ - class Signature { - #r; - #s; - #v; - #networkV; - /** - * The ``r`` value for a signautre. - * - * This represents the ``x`` coordinate of a "reference" or - * challenge point, from which the ``y`` can be computed. - */ - get r() { - return this.#r; - } - set r(value) { - assertArgument(dataLength(value) === 32, "invalid r", "value", value); - this.#r = hexlify(value); - } - /** - * The ``s`` value for a signature. - */ - get s() { - return this.#s; - } - set s(_value) { - assertArgument(dataLength(_value) === 32, "invalid s", "value", _value); - const value = hexlify(_value); - assertArgument(parseInt(value.substring(0, 3)) < 8, "non-canonical s", "value", value); - this.#s = value; - } - /** - * The ``v`` value for a signature. - * - * Since a given ``x`` value for ``r`` has two possible values for - * its correspondin ``y``, the ``v`` indicates which of the two ``y`` - * values to use. - * - * It is normalized to the values ``27`` or ``28`` for legacy - * purposes. - */ - get v() { - return this.#v; - } - set v(value) { - const v = getNumber(value, "value"); - assertArgument(v === 27 || v === 28, "invalid v", "v", value); - this.#v = v; - } - /** - * The EIP-155 ``v`` for legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get networkV() { - return this.#networkV; - } - /** - * The chain ID for EIP-155 legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get legacynetworkId() { - const v = this.networkV; - if (v == null) { - return null; - } - return Signature.getnetworkId(v); - } - /** - * The ``yParity`` for the signature. - * - * See ``v`` for more details on how this value is used. - */ - get yParity() { - return this.v === 27 ? 0 : 1; - } - /** - * The [[link-eip-2098]] compact representation of the ``yParity`` - * and ``s`` compacted into a single ``bytes32``. - */ - get yParityAndS() { - // The EIP-2098 compact representation - const yParityAndS = getBytes(this.s); - if (this.yParity) { - yParityAndS[0] |= 0x80; - } - return hexlify(yParityAndS); - } - /** - * The [[link-eip-2098]] compact representation. - */ - get compactSerialized() { - return concat([this.r, this.yParityAndS]); - } - /** - * The serialized representation. - */ - get serialized() { - return concat([this.r, this.s, this.yParity ? "0x1c" : "0x1b"]); - } - /** - * @private - */ - constructor(guard, r, s, v) { - assertPrivate(guard, _guard$4, "Signature"); - this.#r = r; - this.#s = s; - this.#v = v; - this.#networkV = null; - } - [Symbol.for("nodejs.util.inspect.custom")]() { - return `Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`; - } - /** - * Returns a new identical [[Signature]]. - */ - clone() { - const clone = new Signature(_guard$4, this.r, this.s, this.v); - if (this.networkV) { - clone.#networkV = this.networkV; - } - return clone; - } - /** - * Returns a representation that is compatible with ``JSON.stringify``. - */ - toJSON() { - const networkV = this.networkV; - return { - _type: "signature", - networkV: networkV != null ? networkV.toString() : null, - r: this.r, - s: this.s, - v: this.v, - }; - } - /** - * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. - * - * @example: - * Signature.getnetworkId(45) - * //_result: - * - * Signature.getnetworkId(46) - * //_result: - */ - static getnetworkId(v) { - const bv = getBigInt(v, "v"); - // The v is not an EIP-155 v, so it is the unspecified chain ID - if (bv == BN_27 || bv == BN_28) { - return BN_0$6; - } - // Bad value for an EIP-155 v - assertArgument(bv >= BN_35, "invalid EIP-155 v", "v", v); - return (bv - BN_35) / BN_2$1; - } - /** - * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. - * - * Legacy transactions which use [[link-eip-155]] hijack the ``v`` - * property to include the chain ID. - * - * @example: - * Signature.getnetworkIdV(5, 27) - * //_result: - * - * Signature.getnetworkIdV(5, 28) - * //_result: - * - */ - static getnetworkIdV(networkId, v) { - return getBigInt(networkId) * BN_2$1 + BigInt(35 + v - 27); - } - /** - * Compute the normalized legacy transaction ``v`` from a ``yParirty``, - * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. - * - * @example: - * // The values 0 and 1 imply v is actually yParity - * Signature.getNormalizedV(0) - * //_result: - * - * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) - * Signature.getNormalizedV(27) - * //_result: - * - * // Legacy EIP-155 transaction (i.e. >= 35) - * Signature.getNormalizedV(46) - * //_result: - * - * // Invalid values throw - * Signature.getNormalizedV(5) - * //_error: - */ - static getNormalizedV(v) { - const bv = getBigInt(v); - if (bv === BN_0$6 || bv === BN_27) { - return 27; - } - if (bv === BN_1$3 || bv === BN_28) { - return 28; - } - assertArgument(bv >= BN_35, "invalid v", "v", v); - // Otherwise, EIP-155 v means odd is 27 and even is 28 - return bv & BN_1$3 ? 27 : 28; - } - } - - /** - * A fundamental building block of Core is the underlying - * cryptographic primitives. - * - * @_section: api/crypto:Cryptographic Functions [about-crypto] - */ - function lock() { - computeHmac.lock(); - pbkdf2.lock(); - randomBytes.lock(); - ripemd160.lock(); - scrypt.lock(); - scryptSync.lock(); - sha256.lock(); - sha512.lock(); - randomBytes.lock(); - } - - /** - * Returns the address for the %%key%%. - * - * The key may be any standard form of public key or a private key. - */ - function removeHexPrefix(val) { - return val.substring(0, 2) === "0x" ? val.substring(2) : val; - } - function publicToAddress(key, prefix) { - const val = hexDataSlice(sha256(key), 12); - const checksum = calculateCheckSum(val, prefix); - return "0x" + prefix + checksum + removeHexPrefix(val); - } - function computeAddress(key, prefix) { - let pubkey; - if (typeof key === "string") { - pubkey = SigningKey.computePublicKey(key, false); - } - else { - pubkey = key.publicKey; - } - return publicToAddress(pubkey, prefix); // getAddress(sha256("0x" + pubkey.substring(4)).substring(26)); - } - /** - * Returns the recovered address for the private key that was - * used to sign %%digest%% that resulted in %%signature%%. - */ - function recoverAddress(digest, signature, prefix) { - // return computeAddress(SigningKey.recoverPublicKey(digest, signature)); - const publicKey = SigningKey.recoverPublicKey(arrayify(digest), signature); - return publicToAddress(publicKey, prefix); - } - function extractPrefix(address) { - address = getAddress(address); - return address.substring(2, 4); - } - - /** - * @_ignore: - */ - const WordSize = 32; - const Padding = new Uint8Array(WordSize); - // Properties used to immediate pass through to the underlying object - // - `then` is used to detect if an object is a Promise for await - const passProperties$1 = ["then"]; - const _guard$3 = {}; - function throwError(name, error) { - const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`); - wrapped.error = error; - throw wrapped; - } - /** - * A [[Result]] is a sub-class of Array, which allows accessing any - * of its values either positionally by its index or, if keys are - * provided by its name. - * - * @_docloc: api/abi - */ - class Result extends Array { - #names; - /** - * @private - */ - constructor(...args) { - // To properly sub-class Array so the other built-in - // functions work, the constructor has to behave fairly - // well. So, in the event we are created via fromItems() - // we build the read-only Result object we want, but on - // any other input, we use the default constructor - // constructor(guard: any, items: Array, keys?: Array); - const guard = args[0]; - let items = args[1]; - let names = (args[2] || []).slice(); - let wrap = true; - if (guard !== _guard$3) { - items = args; - names = []; - wrap = false; - } - // Can't just pass in ...items since an array of length 1 - // is a special case in the super. - super(items.length); - items.forEach((item, index) => { - this[index] = item; - }); - // Find all unique keys - const nameCounts = names.reduce((accum, name) => { - if (typeof name === "string") { - accum.set(name, (accum.get(name) || 0) + 1); - } - return accum; - }, new Map()); - // Remove any key thats not unique - this.#names = Object.freeze(items.map((item, index) => { - const name = names[index]; - if (name != null && nameCounts.get(name) === 1) { - return name; - } - return null; - })); - if (!wrap) { - return; - } - // A wrapped Result is immutable - Object.freeze(this); - // Proxy indices and names so we can trap deferred errors - return new Proxy(this, { - get: (target, prop, receiver) => { - if (typeof prop === "string") { - // Index accessor - if (prop.match(/^[0-9]+$/)) { - const index = getNumber(prop, "%index"); - if (index < 0 || index >= this.length) { - throw new RangeError("out of result range"); - } - const item = target[index]; - if (item instanceof Error) { - throwError(`index ${index}`, item); - } - return item; - } - // Pass important checks (like `then` for Promise) through - if (passProperties$1.indexOf(prop) >= 0) { - return Reflect.get(target, prop, receiver); - } - const value = target[prop]; - if (value instanceof Function) { - // Make sure functions work with private variables - // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding - return function (...args) { - return value.apply(this === receiver ? target : this, args); - }; - } - else if (!(prop in target)) { - // Possible name accessor - return target.getValue.apply(this === receiver ? target : this, [ - prop, - ]); - } - } - return Reflect.get(target, prop, receiver); - }, - }); - } - /** - * Returns the Result as a normal Array. - * - * This will throw if there are any outstanding deferred - * errors. - */ - toArray() { - const result = []; - this.forEach((item, index) => { - if (item instanceof Error) { - throwError(`index ${index}`, item); - } - result.push(item); - }); - return result; - } - /** - * Returns the Result as an Object with each name-value pair. - * - * This will throw if any value is unnamed, or if there are - * any outstanding deferred errors. - */ - toObject() { - return this.#names.reduce((accum, name, index) => { - assert(name != null, "value at index ${ index } unnamed", "UNSUPPORTED_OPERATION", { - operation: "toObject()", - }); - // Add values for names that don't conflict - if (!(name in accum)) { - accum[name] = this.getValue(name); - } - return accum; - }, {}); - } - /** - * @_ignore - */ - slice(start, end) { - if (start == null) { - start = 0; - } - if (start < 0) { - start += this.length; - if (start < 0) { - start = 0; - } - } - if (end == null) { - end = this.length; - } - if (end < 0) { - end += this.length; - if (end < 0) { - end = 0; - } - } - if (end > this.length) { - end = this.length; - } - const result = [], names = []; - for (let i = start; i < end; i++) { - result.push(this[i]); - names.push(this.#names[i]); - } - return new Result(_guard$3, result, names); - } - /** - * @_ignore - */ - filter(callback, thisArg) { - const result = [], names = []; - for (let i = 0; i < this.length; i++) { - const item = this[i]; - if (item instanceof Error) { - throwError(`index ${i}`, item); - } - if (callback.call(thisArg, item, i, this)) { - result.push(item); - names.push(this.#names[i]); - } - } - return new Result(_guard$3, result, names); - } - /** - * Returns the value for %%name%%. - * - * Since it is possible to have a key whose name conflicts with - * a method on a [[Result]] or its superclass Array, or any - * JavaScript keyword, this ensures all named values are still - * accessible by name. - */ - getValue(name) { - const index = this.#names.indexOf(name); - if (index === -1) { - return undefined; - } - const value = this[index]; - if (value instanceof Error) { - throwError(`property ${JSON.stringify(name)}`, value.error); - } - return value; - } - /** - * Creates a new [[Result]] for %%items%% with each entry - * also accessible by its corresponding name in %%keys%%. - */ - static fromItems(items, keys) { - return new Result(_guard$3, items, keys); - } - } - /** - * Returns all errors found in a [[Result]]. - * - * Since certain errors encountered when creating a [[Result]] do - * not impact the ability to continue parsing data, they are - * deferred until they are actually accessed. Hence a faulty string - * in an Event that is never used does not impact the program flow. - * - * However, sometimes it may be useful to access, identify or - * validate correctness of a [[Result]]. - * - * @_docloc api/abi - */ - function checkResultErrors(result) { - // Find the first error (if any) - const errors = []; - const checkErrors = function (path, object) { - if (!Array.isArray(object)) { - return; - } - for (let key in object) { - const childPath = path.slice(); - childPath.push(key); - try { - checkErrors(childPath, object[key]); - } - catch (error) { - errors.push({ path: childPath, error: error }); - } - } - }; - checkErrors([], result); - return errors; - } - function getValue$1(value) { - let bytes = toBeArray(value); - assert(bytes.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { - buffer: bytes, - length: WordSize, - offset: bytes.length, - }); - if (bytes.length !== WordSize) { - bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes])); - } - return bytes; - } - /** - * @_ignore - */ - class Coder { - // The coder name: - // - address, uint256, tuple, array, etc. - name; - // The fully expanded type, including composite types: - // - address, uint256, tuple(address,bytes), uint256[3][4][], etc. - type; - // The localName bound in the signature, in this example it is "baz": - // - tuple(address foo, uint bar) baz - localName; - // Whether this type is dynamic: - // - Dynamic: bytes, string, address[], tuple(boolean[]), etc. - // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8) - dynamic; - constructor(name, type, localName, dynamic) { - defineProperties(this, { name, type, localName, dynamic }, { - name: "string", - type: "string", - localName: "string", - dynamic: "boolean", - }); - } - _throwError(message, value) { - assertArgument(false, message, this.localName, value); - } - } - /** - * @_ignore - */ - class Writer { - // An array of WordSize lengthed objects to concatenation - #data; - #dataLength; - constructor() { - this.#data = []; - this.#dataLength = 0; - } - get data() { - return concat(this.#data); - } - get length() { - return this.#dataLength; - } - #writeData(data) { - this.#data.push(data); - this.#dataLength += data.length; - return data.length; - } - appendWriter(writer) { - return this.#writeData(getBytesCopy(writer.data)); - } - // Arrayish item; pad on the right to *nearest* WordSize - writeBytes(value) { - let bytes = getBytesCopy(value); - const paddingOffset = bytes.length % WordSize; - if (paddingOffset) { - bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)])); - } - return this.#writeData(bytes); - } - // Numeric item; pad on the left *to* WordSize - writeValue(value) { - return this.#writeData(getValue$1(value)); - } - // Inserts a numeric place-holder, returning a callback that can - // be used to asjust the value later - writeUpdatableValue() { - const offset = this.#data.length; - this.#data.push(Padding); - this.#dataLength += WordSize; - return (value) => { - this.#data[offset] = getValue$1(value); - }; - } - } - /** - * @_ignore - */ - class Reader { - // Allows incomplete unpadded data to be read; otherwise an error - // is raised if attempting to overrun the buffer. This is required - // to deal with an old Solidity bug, in which event data for - // external (not public thoguh) was tightly packed. - allowLoose; - #data; - #offset; - constructor(data, allowLoose) { - defineProperties(this, { allowLoose: !!allowLoose }); - this.#data = getBytesCopy(data); - this.#offset = 0; - } - get data() { - return hexlify(this.#data); - } - get dataLength() { - return this.#data.length; - } - get consumed() { - return this.#offset; - } - get bytes() { - return new Uint8Array(this.#data); - } - #peekBytes(offset, length, loose) { - let alignedLength = Math.ceil(length / WordSize) * WordSize; - if (this.#offset + alignedLength > this.#data.length) { - if (this.allowLoose && - loose && - this.#offset + length <= this.#data.length) { - alignedLength = length; - } - else { - assert(false, "data out-of-bounds", "BUFFER_OVERRUN", { - buffer: getBytesCopy(this.#data), - length: this.#data.length, - offset: this.#offset + alignedLength, - }); - } - } - return this.#data.slice(this.#offset, this.#offset + alignedLength); - } - // Create a sub-reader with the same underlying data, but offset - subReader(offset) { - return new Reader(this.#data.slice(this.#offset + offset), this.allowLoose); - } - // Read bytes - readBytes(length, loose) { - let bytes = this.#peekBytes(0, length, !!loose); - this.#offset += bytes.length; - // @TODO: Make sure the length..end bytes are all 0? - return bytes.slice(0, length); - } - // Read a numeric values - readValue() { - return toBigInt(this.readBytes(WordSize)); - } - readIndex() { - return toNumber(this.readBytes(WordSize)); - } - } - - /** - * A Typed object allows a value to have its type explicitly - * specified. - * - * For example, in Solidity, the value ``45`` could represent a - * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent - * a ``bytes2`` or ``bytes``. - * - * Since JavaScript has no meaningful way to explicitly inform any - * APIs which what the type is, this allows transparent interoperation - * with Soldity. - * - * @_subsection: api/abi:Typed Values - */ - const _gaurd = {}; - function n(value, width) { - let signed = false; - if (width < 0) { - signed = true; - width *= -1; - } - // @TODO: Check range is valid for value - return new Typed(_gaurd, `${signed ? "" : "u"}int${width}`, value, { - signed, - width, - }); - } - function b(value, size) { - // @TODO: Check range is valid for value - return new Typed(_gaurd, `bytes${size ? size : ""}`, value, { size }); - } - const _typedSymbol = Symbol.for("_corebc_typed"); - class Typed { - type; - value; - #options; - _typedSymbol; - constructor(gaurd, type, value, options) { - if (options == null) { - options = null; - } - assertPrivate(_gaurd, gaurd, "Typed"); - defineProperties(this, { _typedSymbol, type, value }); - this.#options = options; - // Check the value is valid - this.format(); - } - format() { - if (this.type === "array") { - throw new Error(""); - } - else if (this.type === "dynamicArray") { - throw new Error(""); - } - else if (this.type === "tuple") { - return `tuple(${this.value.map((v) => v.format()).join(",")})`; - } - return this.type; - } - defaultValue() { - return 0; - } - minValue() { - return 0; - } - maxValue() { - return 0; - } - isBigInt() { - return !!this.type.match(/^u?int[0-9]+$/); - } - isData() { - return this.type.startsWith("bytes"); - } - isString() { - return this.type === "string"; - } - get tupleName() { - if (this.type !== "tuple") { - throw TypeError("not a tuple"); - } - return this.#options; - } - // Returns the length of this type as an array - // - `null` indicates the length is unforced, it could be dynamic - // - `-1` indicates the length is dynamic - // - any other value indicates it is a static array and is its length - get arrayLength() { - if (this.type !== "array") { - throw TypeError("not an array"); - } - if (this.#options === true) { - return -1; - } - if (this.#options === false) { - return this.value.length; - } - return null; - } - static from(type, value) { - return new Typed(_gaurd, type, value); - } - static uint8(v) { - return n(v, 8); - } - static uint16(v) { - return n(v, 16); - } - static uint24(v) { - return n(v, 24); - } - static uint32(v) { - return n(v, 32); - } - static uint40(v) { - return n(v, 40); - } - static uint48(v) { - return n(v, 48); - } - static uint56(v) { - return n(v, 56); - } - static uint64(v) { - return n(v, 64); - } - static uint72(v) { - return n(v, 72); - } - static uint80(v) { - return n(v, 80); - } - static uint88(v) { - return n(v, 88); - } - static uint96(v) { - return n(v, 96); - } - static uint104(v) { - return n(v, 104); - } - static uint112(v) { - return n(v, 112); - } - static uint120(v) { - return n(v, 120); - } - static uint128(v) { - return n(v, 128); - } - static uint136(v) { - return n(v, 136); - } - static uint144(v) { - return n(v, 144); - } - static uint152(v) { - return n(v, 152); - } - static uint160(v) { - return n(v, 160); - } - static uint168(v) { - return n(v, 168); - } - static uint176(v) { - return n(v, 176); - } - static uint184(v) { - return n(v, 184); - } - static uint192(v) { - return n(v, 192); - } - static uint200(v) { - return n(v, 200); - } - static uint208(v) { - return n(v, 208); - } - static uint216(v) { - return n(v, 216); - } - static uint224(v) { - return n(v, 224); - } - static uint232(v) { - return n(v, 232); - } - static uint240(v) { - return n(v, 240); - } - static uint248(v) { - return n(v, 248); - } - static uint256(v) { - return n(v, 256); - } - static uint(v) { - return n(v, 256); - } - static int8(v) { - return n(v, -8); - } - static int16(v) { - return n(v, -16); - } - static int24(v) { - return n(v, -24); - } - static int32(v) { - return n(v, -32); - } - static int40(v) { - return n(v, -40); - } - static int48(v) { - return n(v, -48); - } - static int56(v) { - return n(v, -56); - } - static int64(v) { - return n(v, -64); - } - static int72(v) { - return n(v, -72); - } - static int80(v) { - return n(v, -80); - } - static int88(v) { - return n(v, -88); - } - static int96(v) { - return n(v, -96); - } - static int104(v) { - return n(v, -104); - } - static int112(v) { - return n(v, -112); - } - static int120(v) { - return n(v, -120); - } - static int128(v) { - return n(v, -128); - } - static int136(v) { - return n(v, -136); - } - static int144(v) { - return n(v, -144); - } - static int152(v) { - return n(v, -152); - } - static int160(v) { - return n(v, -160); - } - static int168(v) { - return n(v, -168); - } - static int176(v) { - return n(v, -176); - } - static int184(v) { - return n(v, -184); - } - static int192(v) { - return n(v, -192); - } - static int200(v) { - return n(v, -200); - } - static int208(v) { - return n(v, -208); - } - static int216(v) { - return n(v, -216); - } - static int224(v) { - return n(v, -224); - } - static int232(v) { - return n(v, -232); - } - static int240(v) { - return n(v, -240); - } - static int248(v) { - return n(v, -248); - } - static int256(v) { - return n(v, -256); - } - static int(v) { - return n(v, -256); - } - static bytes1(v) { - return b(v, 1); - } - static bytes2(v) { - return b(v, 2); - } - static bytes3(v) { - return b(v, 3); - } - static bytes4(v) { - return b(v, 4); - } - static bytes5(v) { - return b(v, 5); - } - static bytes6(v) { - return b(v, 6); - } - static bytes7(v) { - return b(v, 7); - } - static bytes8(v) { - return b(v, 8); - } - static bytes9(v) { - return b(v, 9); - } - static bytes10(v) { - return b(v, 10); - } - static bytes11(v) { - return b(v, 11); - } - static bytes12(v) { - return b(v, 12); - } - static bytes13(v) { - return b(v, 13); - } - static bytes14(v) { - return b(v, 14); - } - static bytes15(v) { - return b(v, 15); - } - static bytes16(v) { - return b(v, 16); - } - static bytes17(v) { - return b(v, 17); - } - static bytes18(v) { - return b(v, 18); - } - static bytes19(v) { - return b(v, 19); - } - static bytes20(v) { - return b(v, 20); - } - static bytes21(v) { - return b(v, 21); - } - static bytes22(v) { - return b(v, 22); - } - static bytes23(v) { - return b(v, 23); - } - static bytes24(v) { - return b(v, 24); - } - static bytes25(v) { - return b(v, 25); - } - static bytes26(v) { - return b(v, 26); - } - static bytes27(v) { - return b(v, 27); - } - static bytes28(v) { - return b(v, 28); - } - static bytes29(v) { - return b(v, 29); - } - static bytes30(v) { - return b(v, 30); - } - static bytes31(v) { - return b(v, 31); - } - static bytes32(v) { - return b(v, 32); - } - static address(v) { - return new Typed(_gaurd, "address", v); - } - static bool(v) { - return new Typed(_gaurd, "bool", !!v); - } - static bytes(v) { - return new Typed(_gaurd, "bytes", v); - } - static string(v) { - return new Typed(_gaurd, "string", v); - } - static array(v, dynamic) { - throw new Error("not implemented yet"); - } - static tuple(v, name) { - throw new Error("not implemented yet"); - } - static overrides(v) { - return new Typed(_gaurd, "overrides", Object.assign({}, v)); - } - /** - * Returns true only if %%value%% is a [[Typed]] instance. - */ - static isTyped(value) { - return value && value._typedSymbol === _typedSymbol; - } - /** - * If the value is a [[Typed]] instance, validates the underlying value - * and returns it, otherwise returns value directly. - * - * This is useful for functions that with to accept either a [[Typed]] - * object or values. - */ - static dereference(value, type) { - if (Typed.isTyped(value)) { - if (value.type !== type) { - throw new Error(`invalid type: expecetd ${type}, got ${value.type}`); - } - return value.value; - } - return value; - } - } - - /** - * @_ignore - */ - class AddressCoder extends Coder { - constructor(localName) { - super("address", "address", localName, false); - } - defaultValue() { - return "0x0000000000000000000000000000000000000000"; - } - encode(writer, _value) { - let value = Typed.dereference(_value, "string"); - try { - value = getAddress(value); - } - catch (error) { - return this._throwError(error.message, _value); - } - return writer.writeValue(value); - } - decode(reader) { - return getAddress(toBeHex(reader.readValue(), 22)); - } - } - - /** - * Clones the functionality of an existing Coder, but without a localName - * - * @_ignore - */ - class AnonymousCoder extends Coder { - coder; - constructor(coder) { - super(coder.name, coder.type, "_", coder.dynamic); - this.coder = coder; - } - defaultValue() { - return this.coder.defaultValue(); - } - encode(writer, value) { - return this.coder.encode(writer, value); - } - decode(reader) { - return this.coder.decode(reader); - } - } - - /** - * @_ignore - */ - function pack(writer, coders, values) { - let arrayValues = []; - if (Array.isArray(values)) { - arrayValues = values; - } - else if (values && typeof values === "object") { - let unique = {}; - arrayValues = coders.map((coder) => { - const name = coder.localName; - assert(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); - assert(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); - unique[name] = true; - return values[name]; - }); - } - else { - assertArgument(false, "invalid tuple value", "tuple", values); - } - assertArgument(coders.length === arrayValues.length, "types/value length mismatch", "tuple", values); - let staticWriter = new Writer(); - let dynamicWriter = new Writer(); - let updateFuncs = []; - coders.forEach((coder, index) => { - let value = arrayValues[index]; - if (coder.dynamic) { - // Get current dynamic offset (for the future pointer) - let dynamicOffset = dynamicWriter.length; - // Encode the dynamic value into the dynamicWriter - coder.encode(dynamicWriter, value); - // Prepare to populate the correct offset once we are done - let updateFunc = staticWriter.writeUpdatableValue(); - updateFuncs.push((baseOffset) => { - updateFunc(baseOffset + dynamicOffset); - }); - } - else { - coder.encode(staticWriter, value); - } - }); - // Backfill all the dynamic offsets, now that we know the static length - updateFuncs.forEach((func) => { - func(staticWriter.length); - }); - let length = writer.appendWriter(staticWriter); - length += writer.appendWriter(dynamicWriter); - return length; - } - /** - * @_ignore - */ - function unpack(reader, coders) { - let values = []; - let keys = []; - // A reader anchored to this base - let baseReader = reader.subReader(0); - coders.forEach((coder) => { - let value = null; - if (coder.dynamic) { - let offset = reader.readIndex(); - let offsetReader = baseReader.subReader(offset); - try { - value = coder.decode(offsetReader); - } - catch (error) { - // Cannot recover from this - if (isError(error, "BUFFER_OVERRUN")) { - throw error; - } - value = error; - value.baseType = coder.name; - value.name = coder.localName; - value.type = coder.type; - } - } - else { - try { - value = coder.decode(reader); - } - catch (error) { - // Cannot recover from this - if (isError(error, "BUFFER_OVERRUN")) { - throw error; - } - value = error; - value.baseType = coder.name; - value.name = coder.localName; - value.type = coder.type; - } - } - if (value == undefined) { - throw new Error("investigate"); - } - values.push(value); - keys.push(coder.localName || null); - }); - return Result.fromItems(values, keys); - } - /** - * @_ignore - */ - class ArrayCoder extends Coder { - coder; - length; - constructor(coder, length, localName) { - const type = coder.type + "[" + (length >= 0 ? length : "") + "]"; - const dynamic = length === -1 || coder.dynamic; - super("array", type, localName, dynamic); - defineProperties(this, { coder, length }); - } - defaultValue() { - // Verifies the child coder is valid (even if the array is dynamic or 0-length) - const defaultChild = this.coder.defaultValue(); - const result = []; - for (let i = 0; i < this.length; i++) { - result.push(defaultChild); - } - return result; - } - encode(writer, _value) { - const value = Typed.dereference(_value, "array"); - if (!Array.isArray(value)) { - this._throwError("expected array value", value); - } - let count = this.length; - if (count === -1) { - count = value.length; - writer.writeValue(value.length); - } - assertArgumentCount(value.length, count, "coder array" + (this.localName ? " " + this.localName : "")); - let coders = []; - for (let i = 0; i < value.length; i++) { - coders.push(this.coder); - } - return pack(writer, coders, value); - } - decode(reader) { - let count = this.length; - if (count === -1) { - count = reader.readIndex(); - // Check that there is *roughly* enough data to ensure - // stray random data is not being read as a length. Each - // slot requires at least 32 bytes for their value (or 32 - // bytes as a link to the data). This could use a much - // tighter bound, but we are erroring on the side of safety. - assert(count * WordSize <= reader.dataLength, "insufficient data length", "BUFFER_OVERRUN", { - buffer: reader.bytes, - offset: count * WordSize, - length: reader.dataLength, - }); - } - let coders = []; - for (let i = 0; i < count; i++) { - coders.push(new AnonymousCoder(this.coder)); - } - return unpack(reader, coders); - } - } - - /** - * @_ignore - */ - class BooleanCoder extends Coder { - constructor(localName) { - super("bool", "bool", localName, false); - } - defaultValue() { - return false; - } - encode(writer, _value) { - const value = Typed.dereference(_value, "bool"); - return writer.writeValue(value ? 1 : 0); - } - decode(reader) { - return !!reader.readValue(); - } - } - - /** - * @_ignore - */ - class DynamicBytesCoder extends Coder { - constructor(type, localName) { - super(type, type, localName, true); - } - defaultValue() { - return "0x"; - } - encode(writer, value) { - value = getBytesCopy(value); - let length = writer.writeValue(value.length); - length += writer.writeBytes(value); - return length; - } - decode(reader) { - return reader.readBytes(reader.readIndex(), true); - } - } - /** - * @_ignore - */ - class BytesCoder extends DynamicBytesCoder { - constructor(localName) { - super("bytes", localName); - } - decode(reader) { - return hexlify(super.decode(reader)); - } - } - - /** - * @_ignore - */ - class FixedBytesCoder extends Coder { - size; - constructor(size, localName) { - let name = "bytes" + String(size); - super(name, name, localName, false); - defineProperties(this, { size }, { size: "number" }); - } - defaultValue() { - return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0, 2 + this.size * 2); - } - encode(writer, _value) { - let data = getBytesCopy(Typed.dereference(_value, this.type)); - if (data.length !== this.size) { - this._throwError("incorrect data length", _value); - } - return writer.writeBytes(data); - } - decode(reader) { - return hexlify(reader.readBytes(this.size)); - } - } - - const Empty = new Uint8Array([]); - /** - * @_ignore - */ - class NullCoder extends Coder { - constructor(localName) { - super("null", "", localName, false); - } - defaultValue() { - return null; - } - encode(writer, value) { - if (value != null) { - this._throwError("not null", value); - } - return writer.writeBytes(Empty); - } - decode(reader) { - reader.readBytes(0); - return null; - } - } - - const BN_0$5 = BigInt(0); - const BN_1$2 = BigInt(1); - const BN_MAX_UINT256$1 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); - /** - * @_ignore - */ - class NumberCoder extends Coder { - size; - signed; - constructor(size, signed, localName) { - const name = (signed ? "int" : "uint") + size * 8; - super(name, name, localName, false); - defineProperties(this, { size, signed }, { size: "number", signed: "boolean" }); - } - defaultValue() { - return 0; - } - encode(writer, _value) { - let value = getBigInt(Typed.dereference(_value, this.type)); - // Check bounds are safe for encoding - let maxUintValue = mask(BN_MAX_UINT256$1, WordSize * 8); - if (this.signed) { - let bounds = mask(maxUintValue, this.size * 8 - 1); - if (value > bounds || value < -(bounds + BN_1$2)) { - this._throwError("value out-of-bounds", _value); - } - value = toTwos(value, 8 * WordSize); - } - else if (value < BN_0$5 || value > mask(maxUintValue, this.size * 8)) { - this._throwError("value out-of-bounds", _value); - } - return writer.writeValue(value); - } - decode(reader) { - let value = mask(reader.readValue(), this.size * 8); - if (this.signed) { - value = fromTwos(value, this.size * 8); - } - return value; - } - } - - /** - * @_ignore - */ - class StringCoder extends DynamicBytesCoder { - constructor(localName) { - super("string", localName); - } - defaultValue() { - return ""; - } - encode(writer, _value) { - return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, "string"))); - } - decode(reader) { - return toUtf8String(super.decode(reader)); - } - } - - /** - * @_ignore - */ - class TupleCoder extends Coder { - coders; - constructor(coders, localName) { - let dynamic = false; - const types = []; - coders.forEach((coder) => { - if (coder.dynamic) { - dynamic = true; - } - types.push(coder.type); - }); - const type = "tuple(" + types.join(",") + ")"; - super("tuple", type, localName, dynamic); - defineProperties(this, { - coders: Object.freeze(coders.slice()), - }); - } - defaultValue() { - const values = []; - this.coders.forEach((coder) => { - values.push(coder.defaultValue()); - }); - // We only output named properties for uniquely named coders - const uniqueNames = this.coders.reduce((accum, coder) => { - const name = coder.localName; - if (name) { - if (!accum[name]) { - accum[name] = 0; - } - accum[name]++; - } - return accum; - }, {}); - // Add named values - this.coders.forEach((coder, index) => { - let name = coder.localName; - if (!name || uniqueNames[name] !== 1) { - return; - } - if (name === "length") { - name = "_length"; - } - if (values[name] != null) { - return; - } - values[name] = values[index]; - }); - return Object.freeze(values); - } - encode(writer, _value) { - const value = Typed.dereference(_value, "tuple"); - return pack(writer, this.coders, value); - } - decode(reader) { - return unpack(reader, this.coders); - } - } - - /** - * A simple hashing function which operates on UTF-8 strings to - * compute an 32-byte identifier. - * - * - * @example: - * id("hello world") - * //_result: - */ - function id(value, useKeccak) { - if (useKeccak) { - return keccak256(toUtf8Bytes(value)); - } - return sha256(toUtf8Bytes(value)); - } - - /** - * A constant for the zero address. - * - * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) - */ - const ZeroAddress = "0x0000000000000000000000000000000000000000"; - - /** - * A constant for the zero hash. - * - * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) - */ - const ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000"; - - /** - * A constant for the order N for the secp256k1 curve. - * - * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) - */ - const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); - /** - * A constant for the number of ore in a single xcb. - * - * (**i.e.** ``1000000000000000000n``) - */ - const OrePerXCB = BigInt("1000000000000000000"); - /** - * A constant for the maximum value for a ``uint256``. - * - * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) - */ - const MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); - /** - * A constant for the minimum value for an ``int256``. - * - * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) - */ - const MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * - BigInt(-1); - /** - * A constant for the maximum value for an ``int256``. - * - * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) - */ - const MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); - - // NFKC (composed) // (decomposed) - /** - * A constant for the core symbol (normalized using NFKC). - * - * (**i.e.** ``"\\u039e"``) - */ - const CoreSymbol = "\u039e"; // "\uD835\uDF63"; - /** - * A constant for the [[link-eip-191]] personal message prefix. - * - * (**i.e.** ``"\\x19Core Signed Message:\\n"``) - */ - const MessagePrefix = "\x19Core Signed Message:\n"; - - function accessSetify(addr, storageKeys) { - return { - address: getAddress(addr), - storageKeys: storageKeys.map((storageKey, index) => { - assertArgument(isHexString(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey); - return storageKey.toLowerCase(); - }), - }; - } - /** - * Returns a [[AccessList]] from any corebcsupported access-list structure. - */ - function accessListify(value) { - if (Array.isArray(value)) { - return value.map((set, index) => { - if (Array.isArray(set)) { - assertArgument(set.length === 2, "invalid slot set", `value[${index}]`, set); - return accessSetify(set[0], set[1]); - } - assertArgument(set != null && typeof set === "object", "invalid address-slot set", "value", value); - return accessSetify(set.address, set.storageKeys); - }); - } - assertArgument(value != null && typeof value === "object", "invalid access list", "value", value); - const result = Object.keys(value).map((addr) => { - const storageKeys = value[addr].reduce((accum, storageKey) => { - accum[storageKey] = true; - return accum; - }, {}); - return accessSetify(addr, Object.keys(storageKeys).sort()); - }); - result.sort((a, b) => a.address.localeCompare(b.address)); - return result; - } - - const logger$1 = new Logger("transaction/0.0.1"); - const BN_0$4 = BigInt(0); - function handleAddress(value) { - if (value === "0x") { - return null; - } - return getAddress(value); - } - function parse(data) { - const handleNumber = (value) => { - // @ts-ignore - if (value === "0x") { - return BigNumber.from(0); - } - return BigNumber.from(value); - }; - const transaction = decode$1(data); - if (transaction.length !== 7 && transaction.length !== 8) { - logger$1.throwArgumentError("invalid raw transaction", "data", data); - } - const isSigned = transaction.length === 8; - const tx = { - nonce: Number(handleNumber(transaction[0])), - energyPrice: handleNumber(transaction[1]).toBigInt(), - energyLimit: handleNumber(transaction[2]).toBigInt(), - networkId: handleNumber(transaction[isSigned ? 3 : 6]).toBigInt(), - to: handleAddress(transaction[isSigned ? 4 : 3]), - value: handleNumber(transaction[isSigned ? 5 : 4]).toBigInt(), - data: transaction[isSigned ? 6 : 5], - }; - if (transaction.length === 8) { - const prefix = networkIdToPrefix(Number(tx.networkId)); - const digest = sha256(serialize(tx)); - tx.hash = sha256(serialize(tx, transaction[7])); - tx.from = recoverAddress(digest, transaction[7], prefix); - tx.signature = transaction[7]; - } - return tx; - } - const unsignedTransactionFields = [ - { name: "nonce", maxLength: 32, numeric: true }, - { name: "energyPrice", maxLength: 32, numeric: true }, - { name: "energyLimit", maxLength: 32, numeric: true }, - { name: "to", length: 22 }, - { name: "value", maxLength: 32, numeric: true }, - { name: "data" }, - { name: "networkId", maxLength: 32, numeric: true }, - ]; - const transactionFields = [ - { name: "nonce", maxLength: 32, numeric: true }, - { name: "energyPrice", maxLength: 32, numeric: true }, - { name: "energyLimit", maxLength: 32, numeric: true }, - { name: "networkId", maxLength: 32, numeric: true }, - { name: "to", length: 22 }, - { name: "value", maxLength: 32, numeric: true }, - { name: "data" }, - ]; - const allowedTransactionKeys = { - networkId: true, - data: true, - energyLimit: true, - energyPrice: true, - nonce: true, - to: true, - value: true, - }; - function serialize(transaction, signature) { - checkProperties(transaction, allowedTransactionKeys); - const raw = []; - (!!signature ? transactionFields : unsignedTransactionFields).forEach(function ({ numeric, maxLength, name, length }) { - let value = transaction[name] || []; - const options = {}; - if (numeric) { - options.hexPad = "left"; - } - const tmpHexlified = hexlify(value, options); - value = arrayify(tmpHexlified); - // Fixed-width field - if (length && value.length !== length && value.length > 0) { - logger$1.throwArgumentError("invalid length for " + name, "transaction:" + name, value); - } - // Variable-width (with a maximum) - if (maxLength) { - value = stripZeros(value); - if (value.length > maxLength) { - logger$1.throwArgumentError("invalid length for " + name, "transaction:" + name, value); - } - } - const hexlified = hexlify(value); - raw.push(hexlified); - }); - if (!!signature) { - raw.push(hexlify(signature)); - } - const finalValue = encode(raw); - return finalValue; - } - /** - * A **Transaction** describes an operation to be executed on - * Core by an Externally Owned Account (EOA). It includes - * who (the [[to]] address), what (the [[data]]) and how much (the - * [[value]] in corebc) the operation should entail. - * - * @example: - * tx = new Transaction() - * //_result: - * - * tx.data = "0x1234"; - * //_result: - */ - class Transaction { - #to; - #data; - #nonce; - #energyLimit; - #energyPrice; - #value; - #networkId; - #sig; - /** - * The ``to`` address for the transaction or ``null`` if the - * transaction is an ``init`` transaction. - */ - get to() { - return this.#to; - } - set to(value) { - this.#to = value == null ? null : getAddress(value); - } - /** - * The transaction nonce. - */ - get nonce() { - return this.#nonce; - } - set nonce(value) { - this.#nonce = getNumber(value, "value"); - } - /** - * The energy limit. - */ - get energyLimit() { - return this.#energyLimit; - } - set energyLimit(value) { - this.#energyLimit = getBigInt(value); - } - /** - * The energy price. - * - * On legacy networks this defines the fee that will be paid. On - * EIP-1559 networks, this should be ``null``. - */ - get energyPrice() { - const value = this.#energyPrice; - if (value == null) { - return BN_0$4; - } - return value; - } - set energyPrice(value) { - this.#energyPrice = value == null ? null : getBigInt(value, "energyPrice"); - } - /** - * The transaction data. For ``init`` transactions this is the - * deployment code. - */ - get data() { - return this.#data; - } - set data(value) { - this.#data = hexlify(value); - } - /** - * The amount of xcb (in ore) to send in this transactions. - */ - get value() { - return this.#value; - } - set value(value) { - this.#value = getBigInt(value, "value"); - } - /** - * The chain ID this transaction is valid on. - */ - get networkId() { - return this.#networkId; - } - set networkId(value) { - this.#networkId = getBigInt(value); - } - /** - * If signed, the signature for this transaction. - */ - get signature() { - return this.#sig || null; - } - set signature(value) { - this.#sig = value == null ? null : value; - } - /** - * Creates a new Transaction with default values. - */ - constructor() { - this.#to = null; - this.#nonce = 0; - this.#energyLimit = BigInt(0); - this.#energyPrice = null; - this.#data = "0x"; - this.#value = BigInt(0); - this.#networkId = BigInt(0); - this.#sig = null; - } - /** - * The transaction hash, if signed. Otherwise, ``null``. - */ - get hash() { - if (this.signature == null) { - return null; - } - return sha256(this.serialized); - } - /** - * The pre-image hash of this transaction. - * - * This is the digest that a [[Signer]] must sign to authorize - * this transaction. - */ - get unsignedHash() { - return sha256(this.unsignedSerialized); - } - /** - * The sending address, if signed. Otherwise, ``null``. - */ - get from() { - if (this.signature == null) { - return null; - } - const prefix = networkIdToPrefix(Number(this.#networkId)); - return recoverAddress(this.unsignedHash, this.signature, prefix); - } - /** - * The public key of the sender, if signed. Otherwise, ``null``. - */ - get fromPublicKey() { - if (this.signature == null) { - return null; - } - return SigningKey.recoverPublicKey(this.unsignedHash, this.signature); - } - /** - * Returns true if signed. - * - * This provides a Type Guard that properties requiring a signed - * transaction are non-null. - */ - isSigned() { - //isSigned(): this is SignedTransaction { - return this.signature != null; - } - /** - * The serialized transaction. - * - * This throws if the transaction is unsigned. For the pre-image, - * use [[unsignedSerialized]]. - */ - get serialized() { - assert(this.signature != null, "cannot serialize unsigned transaction; maybe you meant .unsignedSerialized", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); - return serialize(this, this.signature); - } - /** - * The transaction pre-image. - * - * The hash of this is the digest which needs to be signed to - * authorize this transaction. - */ - get unsignedSerialized() { - return serialize(this); - } - /** - * Create a copy of this transaciton. - */ - clone() { - return Transaction.from(this); - } - /** - * Return a JSON-friendly object. - */ - toJSON() { - const s = (v) => { - if (v == null) { - return null; - } - return v.toString(); - }; - return { - to: this.to, - data: this.data, - nonce: this.nonce, - energyLimit: s(this.energyLimit), - energyPrice: s(this.energyPrice), - value: s(this.value), - networkId: s(this.networkId), - sig: this.signature ? this.signature : null, - }; - } - /** - * Create a **Transaction** from a serialized transaction or a - * Transaction-like object. - */ - static from(tx) { - if (tx == null) { - return new Transaction(); - } - if (typeof tx === "string") { - const payload = getBytes(tx); - return Transaction.from(parse(payload)); - } - const result = new Transaction(); - if (tx.to != null) { - result.to = tx.to; - } - if (tx.nonce != null) { - result.nonce = tx.nonce; - } - if (tx.energyLimit != null) { - result.energyLimit = tx.energyLimit; - } - if (tx.energyPrice != null) { - result.energyPrice = tx.energyPrice; - } - if (tx.data != null) { - result.data = tx.data; - } - if (tx.value != null) { - result.value = tx.value; - } - if (tx.networkId != null) { - result.networkId = tx.networkId; - } - if (tx.signature != null) { - result.signature = tx.signature; - } - if (tx.hash != null) { - assertArgument(result.isSigned(), "unsigned transaction cannot define hash", "tx", tx); - assertArgument(result.hash === tx.hash, "hash mismatch", "tx", tx); - } - if (tx.from != null) { - assertArgument(result.isSigned(), "unsigned transaction cannot define from", "tx", tx); - assertArgument(result.from.toLowerCase() === (tx.from || "").toLowerCase(), "from mismatch", "tx", tx); - } - return result; - } - } - - /** - * Computes the [[link-eip-191]] personal-sign message digest to sign. - * - * - * If %%message%% is a string, it is converted to its UTF-8 bytes - * first. To compute the digest of a [[DataHexString]], it must be converted - * to [bytes](getBytes). - * - * @example: - * hashMessage("Hello World") - * //_result: - * - * // Hashes the SIX (6) string characters, i.e. - * // [ "0", "x", "4", "2", "4", "3" ] - * hashMessage("0x4243") - * //_result: - * - * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... - * hashMessage(getBytes("0x4243")) - * //_result: - * - * // ...which is equal to using data - * hashMessage(new Uint8Array([ 0x42, 0x43 ])) - * //_result: - * - */ - function hashMessage(message) { - if (typeof message === "string") { - message = toUtf8Bytes(message); - } - return sha256(concat([ - toUtf8Bytes(MessagePrefix), - toUtf8Bytes(String(message.length)), - message, - ])); - } - /** - * Return the address of the private key that produced - * the signature %%sig%% during signing for %%message%%. - */ - function verifyMessage(message, sig, prefix) { - const digest = hashMessage(message); - return recoverAddress(digest, sig, prefix); - } - - const regexBytes = new RegExp("^bytes([0-9]+)$"); - const regexNumber = new RegExp("^(u?int)([0-9]*)$"); - const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); - function _pack(type, value, isArray) { - switch (type) { - case "address": - if (isArray) { - return getBytes(zeroPadValue(value, 32)); - } - return getBytes(getAddress(value)); - case "string": - return toUtf8Bytes(value); - case "bytes": - return getBytes(value); - case "bool": - value = !!value ? "0x01" : "0x00"; - if (isArray) { - return getBytes(zeroPadValue(value, 32)); - } - return getBytes(value); - } - let match = type.match(regexNumber); - if (match) { - let signed = match[1] === "int"; - let size = parseInt(match[2] || "256"); - assertArgument((!match[2] || match[2] === String(size)) && - size % 8 === 0 && - size !== 0 && - size <= 256, "invalid number type", "type", type); - if (isArray) { - size = 256; - } - if (signed) { - value = toTwos(value, size); - } - return getBytes(zeroPadValue(toBeArray(value), size / 8)); - } - match = type.match(regexBytes); - if (match) { - const size = parseInt(match[1]); - assertArgument(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type); - assertArgument(dataLength(value) === size, `invalid value for ${type}`, "value", value); - if (isArray) { - return getBytes(zeroPadBytes(value, 32)); - } - return value; - } - match = type.match(regexArray); - if (match && Array.isArray(value)) { - const baseType = match[1]; - const count = parseInt(match[2] || String(value.length)); - assertArgument(count === value.length, `invalid array length for ${type}`, "value", value); - const result = []; - value.forEach(function (value) { - result.push(_pack(baseType, value, true)); - }); - return getBytes(concat(result)); - } - assertArgument(false, "invalid type", "type", type); - } - // @TODO: Array Enum - /** - * Computes the [[link-solc-packed]] representation of %%values%% - * respectively to their %%types%%. - * - * @example: - * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" - * solidityPacked([ "address", "uint" ], [ addr, 45 ]); - * //_result: - */ - function solidityPacked(types, values) { - assertArgument(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values); - const tight = []; - types.forEach(function (type, index) { - tight.push(_pack(type, values[index])); - }); - return hexlify(concat(tight)); - } - /** - * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% - * respectively to their %%types%%. - * - * @example: - * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" - * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); - * //_result: - */ - function solidityPackedSha256(types, values) { - return sha256(solidityPacked(types, values)); - } - - const padding = new Uint8Array(32); - padding.fill(0); - const BN__1 = BigInt(-1); - const BN_0$3 = BigInt(0); - const BN_1$1 = BigInt(1); - const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); - function hexPadRight(value) { - const bytes = getBytes(value); - const padOffset = bytes.length % 32; - if (padOffset) { - return concat([bytes, padding.slice(padOffset)]); - } - return hexlify(bytes); - } - const hexTrue = toBeHex(BN_1$1, 32); - const hexFalse = toBeHex(BN_0$3, 32); - const domainFieldTypes = { - name: "string", - version: "string", - networkId: "uint256", - verifyingContract: "address", - salt: "bytes32", - }; - const domainFieldNames = [ - "name", - "version", - "networkId", - "verifyingContract", - "salt", - ]; - function checkString(key) { - return function (value) { - assertArgument(typeof value === "string", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); - return value; - }; - } - const domainChecks = { - name: checkString("name"), - version: checkString("version"), - networkId: function (_value) { - const value = getBigInt(_value, "domain.networkId"); - assertArgument(value >= 0, "invalid chain ID", "domain.networkId", _value); - if (Number.isSafeInteger(value)) { - return Number(value); - } - return toQuantity(value); - }, - verifyingContract: function (value) { - try { - return getAddress(value).toLowerCase(); - } - catch (error) { } - assertArgument(false, `invalid domain value "verifyingContract"`, "domain.verifyingContract", value); - }, - salt: function (value) { - const bytes = getBytes(value, "domain.salt"); - assertArgument(bytes.length === 32, `invalid domain value "salt"`, "domain.salt", value); - return hexlify(bytes); - }, - }; - function getBaseEncoder(type) { - // intXX and uintXX - { - const match = type.match(/^(u?)int(\d*)$/); - if (match) { - const signed = match[1] === ""; - const width = parseInt(match[2] || "256"); - assertArgument(width % 8 === 0 && - width !== 0 && - width <= 256 && - (match[2] == null || match[2] === String(width)), "invalid numeric width", "type", type); - const boundsUpper = mask(BN_MAX_UINT256, signed ? width - 1 : width); - const boundsLower = signed ? (boundsUpper + BN_1$1) * BN__1 : BN_0$3; - return function (_value) { - const value = getBigInt(_value, "value"); - assertArgument(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, "value", value); - return toBeHex(signed ? toTwos(value, 256) : value, 32); - }; - } - } - // bytesXX - { - const match = type.match(/^bytes(\d+)$/); - if (match) { - const width = parseInt(match[1]); - assertArgument(width !== 0 && width <= 32 && match[1] === String(width), "invalid bytes width", "type", type); - return function (value) { - const bytes = getBytes(value); - assertArgument(bytes.length === width, `invalid length for ${type}`, "value", value); - return hexPadRight(value); - }; - } - } - switch (type) { - case "address": - return function (value) { - return zeroPadValue(getAddress(value), 32); - }; - case "bool": - return function (value) { - return !value ? hexFalse : hexTrue; - }; - case "bytes": - return function (value) { - return sha256(value); - }; - case "string": - return function (value) { - return id(value); - }; - } - return null; - } - function encodeType(name, fields) { - return `${name}(${fields - .map(({ name, type }) => type + " " + name) - .join(",")})`; - } - class TypedDataEncoder { - primaryType; - #types; - get types() { - return JSON.parse(this.#types); - } - #fullTypes; - #encoderCache; - constructor(types) { - this.#types = JSON.stringify(types); - this.#fullTypes = new Map(); - this.#encoderCache = new Map(); - // Link struct types to their direct child structs - const links = new Map(); - // Link structs to structs which contain them as a child - const parents = new Map(); - // Link all subtypes within a given struct - const subtypes = new Map(); - Object.keys(types).forEach((type) => { - links.set(type, new Set()); - parents.set(type, []); - subtypes.set(type, new Set()); - }); - for (const name in types) { - const uniqueNames = new Set(); - for (const field of types[name]) { - // Check each field has a unique name - assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types); - uniqueNames.add(field.name); - // Get the base type (drop any array specifiers) - const baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1] || null; - assertArgument(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", types); - // Is this a base encoding type? - const encoder = getBaseEncoder(baseType); - if (encoder) { - continue; - } - assertArgument(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", types); - // Add linkage - parents.get(baseType).push(name); - links.get(name).add(baseType); - } - } - // Deduce the primary type - const primaryTypes = Array.from(parents.keys()).filter((n) => parents.get(n).length === 0); - assertArgument(primaryTypes.length !== 0, "missing primary type", "types", types); - assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes - .map((t) => JSON.stringify(t)) - .join(", ")}`, "types", types); - defineProperties(this, { primaryType: primaryTypes[0] }); - // Check for circular type references - function checkCircular(type, found) { - assertArgument(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", types); - found.add(type); - for (const child of links.get(type)) { - if (!parents.has(child)) { - continue; - } - // Recursively check children - checkCircular(child, found); - // Mark all ancestors as having this decendant - for (const subtype of found) { - subtypes.get(subtype).add(child); - } - } - found.delete(type); - } - checkCircular(this.primaryType, new Set()); - // Compute each fully describe type - for (const [name, set] of subtypes) { - const st = Array.from(set); - st.sort(); - this.#fullTypes.set(name, encodeType(name, types[name]) + - st.map((t) => encodeType(t, types[t])).join("")); - } - } - getEncoder(type) { - let encoder = this.#encoderCache.get(type); - if (!encoder) { - encoder = this.#getEncoder(type); - this.#encoderCache.set(type, encoder); - } - return encoder; - } - #getEncoder(type) { - // Basic encoder type (address, bool, uint256, etc) - { - const encoder = getBaseEncoder(type); - if (encoder) { - return encoder; - } - } - // Array - const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); - if (match) { - const subtype = match[1]; - const subEncoder = this.getEncoder(subtype); - return (value) => { - assertArgument(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value); - let result = value.map(subEncoder); - if (this.#fullTypes.has(subtype)) { - result = result.map(sha256); - } - return sha256(concat(result)); - }; - } - // Struct - const fields = this.types[type]; - if (fields) { - const encodedType = id(this.#fullTypes.get(type)); - return (value) => { - const values = fields.map(({ name, type }) => { - const result = this.getEncoder(type)(value[name]); - if (this.#fullTypes.has(type)) { - return sha256(result); - } - return result; - }); - values.unshift(encodedType); - return concat(values); - }; - } - assertArgument(false, `unknown type: ${type}`, "type", type); - } - encodeType(name) { - const result = this.#fullTypes.get(name); - assertArgument(result, `unknown type: ${JSON.stringify(name)}`, "name", name); - return result; - } - encodeData(type, value) { - return this.getEncoder(type)(value); - } - hashStruct(name, value) { - return sha256(this.encodeData(name, value)); - } - encode(value) { - return this.encodeData(this.primaryType, value); - } - hash(value) { - return this.hashStruct(this.primaryType, value); - } - _visit(type, value, callback) { - // Basic encoder type (address, bool, uint256, etc) - { - const encoder = getBaseEncoder(type); - if (encoder) { - return callback(type, value); - } - } - // Array - const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); - if (match) { - assertArgument(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value); - return value.map((v) => this._visit(match[1], v, callback)); - } - // Struct - const fields = this.types[type]; - if (fields) { - return fields.reduce((accum, { name, type }) => { - accum[name] = this._visit(type, value[name], callback); - return accum; - }, {}); - } - assertArgument(false, `unknown type: ${type}`, "type", type); - } - visit(value, callback) { - return this._visit(this.primaryType, value, callback); - } - static from(types) { - return new TypedDataEncoder(types); - } - static getPrimaryType(types) { - return TypedDataEncoder.from(types).primaryType; - } - static hashStruct(name, types, value) { - return TypedDataEncoder.from(types).hashStruct(name, value); - } - static hashDomain(domain) { - const domainFields = []; - for (const name in domain) { - if (domain[name] == null) { - continue; - } - const type = domainFieldTypes[name]; - assertArgument(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); - domainFields.push({ name, type }); - } - domainFields.sort((a, b) => { - return (domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name)); - }); - return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); - } - static encode(domain, types, value) { - return concat([ - "0x1901", - TypedDataEncoder.hashDomain(domain), - TypedDataEncoder.from(types).hash(value), - ]); - } - static hash(domain, types, value) { - return sha256(TypedDataEncoder.encode(domain, types, value)); - } - // Replaces all address types with ENS names with their looked up address - static async resolveNames(domain, types, value, resolveName) { - // Make a copy to isolate it from the object passed in - domain = Object.assign({}, domain); - // Allow passing null to ignore value - for (const key in domain) { - if (domain[key] == null) { - delete domain[key]; - } - } - // Look up all ENS names - const ensCache = {}; - // Do we need to look up the domain's verifyingContract? - if (domain.verifyingContract && - !isHexString(domain.verifyingContract, 20)) { - ensCache[domain.verifyingContract] = "0x"; - } - // We are going to use the encoder to visit all the base values - const encoder = TypedDataEncoder.from(types); - // Get a list of all the addresses - encoder.visit(value, (type, value) => { - if (type === "address" && !isHexString(value, 20)) { - ensCache[value] = "0x"; - } - return value; - }); - // Lookup each name - for (const name in ensCache) { - ensCache[name] = await resolveName(name); - } - // Replace the domain verifyingContract if needed - if (domain.verifyingContract && ensCache[domain.verifyingContract]) { - domain.verifyingContract = ensCache[domain.verifyingContract]; - } - // Replace all ENS names with their address - value = encoder.visit(value, (type, value) => { - if (type === "address" && ensCache[value]) { - return ensCache[value]; - } - return value; - }); - return { domain, value }; - } - static getPayload(domain, types, value) { - // Validate the domain fields - TypedDataEncoder.hashDomain(domain); - // Derive the EIP712Domain Struct reference type - const domainValues = {}; - const domainTypes = []; - domainFieldNames.forEach((name) => { - const value = domain[name]; - if (value == null) { - return; - } - domainValues[name] = domainChecks[name](value); - domainTypes.push({ name, type: domainFieldTypes[name] }); - }); - const encoder = TypedDataEncoder.from(types); - const typesWithDomain = Object.assign({}, types); - assertArgument(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types); - typesWithDomain.EIP712Domain = domainTypes; - // Validate the data structures and types - encoder.encode(value); - return { - types: typesWithDomain, - domain: domainValues, - primaryType: encoder.primaryType, - message: encoder.visit(value, (type, value) => { - // bytes - if (type.match(/^bytes(\d*)/)) { - return hexlify(getBytes(value)); - } - // uint or int - if (type.match(/^u?int/)) { - return getBigInt(value).toString(); - } - switch (type) { - case "address": - return value.toLowerCase(); - case "bool": - return !!value; - case "string": - assertArgument(typeof value === "string", "invalid string", "value", value); - return value; - } - assertArgument(false, "unsupported type", "type", type); - }), - }; - } - } - /** - * Compute the address used to sign the typed data for the %%signature%%. - */ - function verifyTypedData(domain, types, value, signature, prefix) { - return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature, prefix); - } - - /** - * About frgaments... - * - * @_subsection api/abi/abi-coder:Fragments [about-fragments] - */ - var _a; - // [ "a", "b" ] => { "a": 1, "b": 1 } - function setify(items) { - const result = new Set(); - items.forEach((k) => result.add(k)); - return Object.freeze(result); - } - // Visibility Keywords - const _kwVisib = "constant external internal payable private public pure view"; - const KwVisib = setify(_kwVisib.split(" ")); - const _kwTypes = "constructor error event fallback function receive struct"; - const KwTypes = setify(_kwTypes.split(" ")); - const _kwModifiers = "calldata memory storage payable indexed"; - const KwModifiers = setify(_kwModifiers.split(" ")); - const _kwOther = "tuple returns"; - // All Keywords - const _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(" "); - const Keywords = setify(_keywords.split(" ")); - // Single character tokens - const SimpleTokens = { - "(": "OPEN_PAREN", - ")": "CLOSE_PAREN", - "[": "OPEN_BRACKET", - "]": "CLOSE_BRACKET", - ",": "COMMA", - "@": "AT", - }; - // Parser regexes to consume the next token - const regexWhitespacePrefix = new RegExp("^(\\s*)"); - const regexNumberPrefix = new RegExp("^([0-9]+)"); - const regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"); - // Parser regexs to check validity - const regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"); - const regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"); - class TokenString { - #offset; - #tokens; - get offset() { - return this.#offset; - } - get length() { - return this.#tokens.length - this.#offset; - } - constructor(tokens) { - this.#offset = 0; - this.#tokens = tokens.slice(); - } - clone() { - return new _a(this.#tokens); - } - reset() { - this.#offset = 0; - } - #subTokenString(from = 0, to = 0) { - return new _a(this.#tokens.slice(from, to).map((t) => { - return Object.freeze(Object.assign({}, t, { - match: t.match - from, - linkBack: t.linkBack - from, - linkNext: t.linkNext - from, - })); - })); - } - // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens - popKeyword(allowed) { - const top = this.peek(); - if (top.type !== "KEYWORD" || !allowed.has(top.text)) { - throw new Error(`expected keyword ${top.text}`); - } - return this.pop().text; - } - // Pops and returns the value of the next token if it is `type`; throws if out of tokens - popType(type) { - if (this.peek().type !== type) { - throw new Error(`expected ${type}; got ${JSON.stringify(this.peek())}`); - } - return this.pop().text; - } - // Pops and returns a "(" TOKENS ")" - popParen() { - const top = this.peek(); - if (top.type !== "OPEN_PAREN") { - throw new Error("bad start"); - } - const result = this.#subTokenString(this.#offset + 1, top.match + 1); - this.#offset = top.match + 1; - return result; - } - // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" - popParams() { - const top = this.peek(); - if (top.type !== "OPEN_PAREN") { - throw new Error("bad start"); - } - const result = []; - while (this.#offset < top.match - 1) { - const link = this.peek().linkNext; - result.push(this.#subTokenString(this.#offset + 1, link)); - this.#offset = link; - } - this.#offset = top.match + 1; - return result; - } - // Returns the top Token, throwing if out of tokens - peek() { - if (this.#offset >= this.#tokens.length) { - throw new Error("out-of-bounds"); - } - return this.#tokens[this.#offset]; - } - // Returns the next value, if it is a keyword in `allowed` - peekKeyword(allowed) { - const top = this.peekType("KEYWORD"); - return top != null && allowed.has(top) ? top : null; - } - // Returns the value of the next token if it is `type` - peekType(type) { - if (this.length === 0) { - return null; - } - const top = this.peek(); - return top.type === type ? top.text : null; - } - // Returns the next token; throws if out of tokens - pop() { - const result = this.peek(); - this.#offset++; - return result; - } - toString() { - const tokens = []; - for (let i = this.#offset; i < this.#tokens.length; i++) { - const token = this.#tokens[i]; - tokens.push(`${token.type}:${token.text}`); - } - return ``; - } - } - _a = TokenString; - function lex(text) { - const tokens = []; - const throwError = (message) => { - const token = offset < text.length ? JSON.stringify(text[offset]) : "$EOI"; - throw new Error(`invalid token ${token} at ${offset}: ${message}`); - }; - let brackets = []; - let commas = []; - let offset = 0; - while (offset < text.length) { - // Strip off any leading whitespace - let cur = text.substring(offset); - let match = cur.match(regexWhitespacePrefix); - if (match) { - offset += match[1].length; - cur = text.substring(offset); - } - const token = { - depth: brackets.length, - linkBack: -1, - linkNext: -1, - match: -1, - type: "", - text: "", - offset, - value: -1, - }; - tokens.push(token); - let type = SimpleTokens[cur[0]] || ""; - if (type) { - token.type = type; - token.text = cur[0]; - offset++; - if (type === "OPEN_PAREN") { - brackets.push(tokens.length - 1); - commas.push(tokens.length - 1); - } - else if (type == "CLOSE_PAREN") { - if (brackets.length === 0) { - throwError("no matching open bracket"); - } - token.match = brackets.pop(); - tokens[token.match].match = tokens.length - 1; - token.depth--; - token.linkBack = commas.pop(); - tokens[token.linkBack].linkNext = tokens.length - 1; - } - else if (type === "COMMA") { - token.linkBack = commas.pop(); - tokens[token.linkBack].linkNext = tokens.length - 1; - commas.push(tokens.length - 1); - } - else if (type === "OPEN_BRACKET") { - token.type = "BRACKET"; - } - else if (type === "CLOSE_BRACKET") { - // Remove the CLOSE_BRACKET - let suffix = tokens.pop().text; - if (tokens.length > 0 && tokens[tokens.length - 1].type === "NUMBER") { - const value = tokens.pop().text; - suffix = value + suffix; - tokens[tokens.length - 1].value = - getNumber(value); - } - if (tokens.length === 0 || - tokens[tokens.length - 1].type !== "BRACKET") { - throw new Error("missing opening bracket"); - } - tokens[tokens.length - 1].text += suffix; - } - continue; - } - match = cur.match(regexIdPrefix); - if (match) { - token.text = match[1]; - offset += token.text.length; - if (Keywords.has(token.text)) { - token.type = "KEYWORD"; - continue; - } - if (token.text.match(regexType)) { - token.type = "TYPE"; - continue; - } - token.type = "ID"; - continue; - } - match = cur.match(regexNumberPrefix); - if (match) { - token.text = match[1]; - token.type = "NUMBER"; - offset += token.text.length; - continue; - } - throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`); - } - return new TokenString(tokens.map((t) => Object.freeze(t))); - } - // Check only one of `allowed` is in `set` - function allowSingle(set, allowed) { - let included = []; - for (const key in allowed.keys()) { - if (set.has(key)) { - included.push(key); - } - } - if (included.length > 1) { - throw new Error(`conflicting types: ${included.join(", ")}`); - } - } - // Functions to process a Solidity Signature TokenString from left-to-right for... - // ...the name with an optional type, returning the name - function consumeName(type, tokens) { - if (tokens.peekKeyword(KwTypes)) { - const keyword = tokens.pop().text; - if (keyword !== type) { - throw new Error(`expected ${type}, got ${keyword}`); - } - } - return tokens.popType("ID"); - } - // ...all keywords matching allowed, returning the keywords - function consumeKeywords(tokens, allowed) { - const keywords = new Set(); - while (true) { - const keyword = tokens.peekType("KEYWORD"); - if (keyword == null || (allowed && !allowed.has(keyword))) { - break; - } - tokens.pop(); - if (keywords.has(keyword)) { - throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`); - } - keywords.add(keyword); - } - return Object.freeze(keywords); - } - // ...all visibility keywords, returning the coalesced mutability - function consumeMutability(tokens) { - let modifiers = consumeKeywords(tokens, KwVisib); - // Detect conflicting modifiers - allowSingle(modifiers, setify("constant payable nonpayable".split(" "))); - allowSingle(modifiers, setify("pure view payable nonpayable".split(" "))); - // Process mutability states - if (modifiers.has("view")) { - return "view"; - } - if (modifiers.has("pure")) { - return "pure"; - } - if (modifiers.has("payable")) { - return "payable"; - } - if (modifiers.has("nonpayable")) { - return "nonpayable"; - } - // Process legacy `constant` last - if (modifiers.has("constant")) { - return "view"; - } - return "nonpayable"; - } - // ...a parameter list, returning the ParamType list - function consumeParams(tokens, allowIndexed) { - return tokens.popParams().map((t) => ParamType.from(t, allowIndexed)); - } - // ...a energy limit, returning a BigNumber or null if none - function consumeEnergy(tokens) { - if (tokens.peekType("AT")) { - tokens.pop(); - if (tokens.peekType("NUMBER")) { - return getBigInt(tokens.pop().text); - } - throw new Error("invalid energy"); - } - return null; - } - function consumeEoi(tokens) { - if (tokens.length) { - throw new Error(`unexpected tokens: ${tokens.toString()}`); - } - } - const regexArrayType = new RegExp(/^(.*)\[([0-9]*)\]$/); - function verifyBasicType(type) { - const match = type.match(regexType); - assertArgument(match, "invalid type", "type", type); - if (type === "uint") { - return "uint256"; - } - if (type === "int") { - return "int256"; - } - if (match[2]) { - // bytesXX - const length = parseInt(match[2]); - assertArgument(length !== 0 && length <= 32, "invalid bytes length", "type", type); - } - else if (match[3]) { - // intXX or uintXX - const size = parseInt(match[3]); - assertArgument(size !== 0 && size <= 256 && size % 8 === 0, "invalid numeric width", "type", type); - } - return type; - } - // Make the Fragment constructors effectively private - const _guard$2 = {}; - const internal$1 = Symbol.for("_corebc_internal"); - const ParamTypeInternal = "_ParamTypeInternal"; - const ErrorFragmentInternal = "_ErrorInternal"; - const EventFragmentInternal = "_EventInternal"; - const ConstructorFragmentInternal = "_ConstructorInternal"; - const FallbackFragmentInternal = "_FallbackInternal"; - const FunctionFragmentInternal = "_FunctionInternal"; - const StructFragmentInternal = "_StructInternal"; - /** - * Each input and output of a [[Fragment]] is an Array of **PAramType**. - */ - class ParamType { - /** - * The local name of the parameter (or ``""`` if unbound) - */ - name; - /** - * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, - * ``"uint256[3][]"``) - */ - type; - /** - * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) - */ - baseType; - /** - * True if the parameters is indexed. - * - * For non-indexable types this is ``null``. - */ - indexed; - /** - * The components for the tuple. - * - * For non-tuple types this is ``null``. - */ - components; - /** - * The array length, or ``-1`` for dynamic-lengthed arrays. - * - * For non-array types this is ``null``. - */ - arrayLength; - /** - * The type of each child in the array. - * - * For non-array types this is ``null``. - */ - arrayChildren; - /** - * @private - */ - constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) { - assertPrivate(guard, _guard$2, "ParamType"); - Object.defineProperty(this, internal$1, { value: ParamTypeInternal }); - if (components) { - components = Object.freeze(components.slice()); - } - if (baseType === "array") { - if (arrayLength == null || arrayChildren == null) { - throw new Error(""); - } - } - else if (arrayLength != null || arrayChildren != null) { - throw new Error(""); - } - if (baseType === "tuple") { - if (components == null) { - throw new Error(""); - } - } - else if (components != null) { - throw new Error(""); - } - defineProperties(this, { - name, - type, - baseType, - indexed, - components, - arrayLength, - arrayChildren, - }); - } - /** - * Return a string representation of this type. - * - * For example, - * - * ``sighash" => "(uint256,address)"`` - * - * ``"minimal" => "tuple(uint256,address) indexed"`` - * - * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` - */ - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - let result = { - type: this.baseType === "tuple" ? "tuple" : this.type, - name: this.name || undefined, - }; - if (typeof this.indexed === "boolean") { - result.indexed = this.indexed; - } - if (this.isTuple()) { - result.components = this.components.map((c) => JSON.parse(c.format(format))); - } - return JSON.stringify(result); - } - let result = ""; - // Array - if (this.isArray()) { - result += this.arrayChildren.format(format); - result += `[${this.arrayLength < 0 ? "" : String(this.arrayLength)}]`; - } - else { - if (this.isTuple()) { - if (format !== "sighash") { - result += this.type; - } - result += - "(" + - this.components - .map((comp) => comp.format(format)) - .join(format === "full" ? ", " : ",") + - ")"; - } - else { - result += this.type; - } - } - if (format !== "sighash") { - if (this.indexed === true) { - result += " indexed"; - } - if (format === "full" && this.name) { - result += " " + this.name; - } - } - return result; - } - /* - * Returns true if %%value%% is an Array type. - * - * This provides a type gaurd ensuring that the - * [[arrayChildren]] and [[arrayLength]] are non-null. - */ - //static isArray(value: any): value is { arrayChildren: ParamType, arrayLength: number } { - // return value && (value.baseType === "array") - //} - /** - * Returns true if %%this%% is an Array type. - * - * This provides a type gaurd ensuring that [[arrayChildren]] - * and [[arrayLength]] are non-null. - */ - isArray() { - return this.baseType === "array"; - } - /** - * Returns true if %%this%% is a Tuple type. - * - * This provides a type gaurd ensuring that [[components]] - * is non-null. - */ - isTuple() { - return this.baseType === "tuple"; - } - /** - * Returns true if %%this%% is an Indexable type. - * - * This provides a type gaurd ensuring that [[indexed]] - * is non-null. - */ - isIndexable() { - return this.indexed != null; - } - /** - * Walks the **ParamType** with %%value%%, calling %%process%% - * on each type, destructing the %%value%% recursively. - */ - walk(value, process) { - if (this.isArray()) { - if (!Array.isArray(value)) { - throw new Error("invalid array value"); - } - if (this.arrayLength !== -1 && value.length !== this.arrayLength) { - throw new Error("array is wrong length"); - } - const _this = this; - return value.map((v) => _this.arrayChildren.walk(v, process)); - } - if (this.isTuple()) { - if (!Array.isArray(value)) { - throw new Error("invalid tuple value"); - } - if (value.length !== this.components.length) { - throw new Error("array is wrong length"); - } - const _this = this; - return value.map((v, i) => _this.components[i].walk(v, process)); - } - return process(this.type, value); - } - #walkAsync(promises, value, process, setValue) { - if (this.isArray()) { - if (!Array.isArray(value)) { - throw new Error("invalid array value"); - } - if (this.arrayLength !== -1 && value.length !== this.arrayLength) { - throw new Error("array is wrong length"); - } - const childType = this.arrayChildren; - const result = value.slice(); - result.forEach((value, index) => { - childType.#walkAsync(promises, value, process, (value) => { - result[index] = value; - }); - }); - setValue(result); - return; - } - if (this.isTuple()) { - const components = this.components; - // Convert the object into an array - let result; - if (Array.isArray(value)) { - result = value.slice(); - } - else { - if (value == null || typeof value !== "object") { - throw new Error("invalid tuple value"); - } - result = components.map((param) => { - if (!param.name) { - throw new Error("cannot use object value with unnamed components"); - } - if (!(param.name in value)) { - throw new Error(`missing value for component ${param.name}`); - } - return value[param.name]; - }); - } - if (result.length !== this.components.length) { - throw new Error("array is wrong length"); - } - result.forEach((value, index) => { - components[index].#walkAsync(promises, value, process, (value) => { - result[index] = value; - }); - }); - setValue(result); - return; - } - const result = process(this.type, value); - if (result.then) { - promises.push((async function () { - setValue(await result); - })()); - } - else { - setValue(result); - } - } - /** - * Walks the **ParamType** with %%value%%, asynchronously calling - * %%process%% on each type, destructing the %%value%% recursively. - * - * This can be used to resolve ENS naes by walking and resolving each - * ``"address"`` type. - */ - async walkAsync(value, process) { - const promises = []; - const result = [value]; - this.#walkAsync(promises, value, process, (value) => { - result[0] = value; - }); - if (promises.length) { - await Promise.all(promises); - } - return result[0]; - } - /** - * Creates a new **ParamType** for %%obj%%. - * - * If %%allowIndexed%% then the ``indexed`` keyword is permitted, - * otherwise the ``indexed`` keyword will throw an error. - */ - static from(obj, allowIndexed) { - if (ParamType.isParamType(obj)) { - return obj; - } - if (typeof obj === "string") { - return ParamType.from(lex(obj), allowIndexed); - } - else if (obj instanceof TokenString) { - let type = "", baseType = ""; - let comps = null; - if (consumeKeywords(obj, setify(["tuple"])).has("tuple") || - obj.peekType("OPEN_PAREN")) { - // Tuple - baseType = "tuple"; - comps = obj.popParams().map((t) => ParamType.from(t)); - type = `tuple(${comps.map((c) => c.format()).join(",")})`; - } - else { - // Normal - type = verifyBasicType(obj.popType("TYPE")); - baseType = type; - } - // Check for Array - let arrayChildren = null; - let arrayLength = null; - while (obj.length && obj.peekType("BRACKET")) { - const bracket = obj.pop(); //arrays[i]; - arrayChildren = new ParamType(_guard$2, "", type, baseType, null, comps, arrayLength, arrayChildren); - arrayLength = bracket.value; - type += bracket.text; - baseType = "array"; - comps = null; - } - let indexed = null; - const keywords = consumeKeywords(obj, KwModifiers); - if (keywords.has("indexed")) { - if (!allowIndexed) { - throw new Error(""); - } - indexed = true; - } - const name = obj.peekType("ID") ? obj.pop().text : ""; - if (obj.length) { - throw new Error("leftover tokens"); - } - return new ParamType(_guard$2, name, type, baseType, indexed, comps, arrayLength, arrayChildren); - } - const name = obj.name; - assertArgument(!name || (typeof name === "string" && name.match(regexId)), "invalid name", "obj.name", name); - let indexed = obj.indexed; - if (indexed != null) { - assertArgument(allowIndexed, "parameter cannot be indexed", "obj.indexed", obj.indexed); - indexed = !!indexed; - } - let type = obj.type; - let arrayMatch = type.match(regexArrayType); - if (arrayMatch) { - const arrayLength = parseInt(arrayMatch[2] || "-1"); - const arrayChildren = ParamType.from({ - type: arrayMatch[1], - components: obj.components, - }); - return new ParamType(_guard$2, name || "", type, "array", indexed, null, arrayLength, arrayChildren); - } - if (type === "tuple" || - type.startsWith("tuple(" /* fix: ) */) || - type.startsWith("(" /* fix: ) */)) { - const comps = obj.components != null - ? obj.components.map((c) => ParamType.from(c)) - : null; - const tuple = new ParamType(_guard$2, name || "", type, "tuple", indexed, comps, null, null); - // @TODO: use lexer to validate and normalize type - return tuple; - } - type = verifyBasicType(obj.type); - return new ParamType(_guard$2, name || "", type, type, indexed, null, null, null); - } - /** - * Returns true if %%value%% is a **ParamType**. - */ - static isParamType(value) { - return value && value[internal$1] === ParamTypeInternal; - } - } - /** - * An abstract class to represent An individual fragment from a parse ABI. - */ - class Fragment { - /** - * The type of the fragment. - */ - type; - /** - * The inputs for the fragment. - */ - inputs; - /** - * @private - */ - constructor(guard, type, inputs) { - assertPrivate(guard, _guard$2, "Fragment"); - inputs = Object.freeze(inputs.slice()); - defineProperties(this, { type, inputs }); - } - /** - * Creates a new **Fragment** for %%obj%%, wich can be any supported - * ABI frgament type. - */ - static from(obj) { - if (typeof obj === "string") { - // Try parsing JSON... - try { - Fragment.from(JSON.parse(obj)); - } - catch (e) { } - // ...otherwise, use the human-readable lexer - return Fragment.from(lex(obj)); - } - if (obj instanceof TokenString) { - // Human-readable ABI (already lexed) - const type = obj.peekKeyword(KwTypes); - switch (type) { - case "constructor": - return ConstructorFragment.from(obj); - case "error": - return ErrorFragment.from(obj); - case "event": - return EventFragment.from(obj); - case "fallback": - case "receive": - return FallbackFragment.from(obj); - case "function": - return FunctionFragment.from(obj); - case "struct": - return StructFragment.from(obj); - } - } - else if (typeof obj === "object") { - // JSON ABI - switch (obj.type) { - case "constructor": - return ConstructorFragment.from(obj); - case "error": - return ErrorFragment.from(obj); - case "event": - return EventFragment.from(obj); - case "fallback": - case "receive": - return FallbackFragment.from(obj); - case "function": - return FunctionFragment.from(obj); - case "struct": - return StructFragment.from(obj); - } - assert(false, `unsupported type: ${obj.type}`, "UNSUPPORTED_OPERATION", { - operation: "Fragment.from", - }); - } - assertArgument(false, "unsupported frgament object", "obj", obj); - } - /** - * Returns true if %%value%% is a [[ConstructorFragment]]. - */ - static isConstructor(value) { - return ConstructorFragment.isFragment(value); - } - /** - * Returns true if %%value%% is an [[ErrorFragment]]. - */ - static isError(value) { - return ErrorFragment.isFragment(value); - } - /** - * Returns true if %%value%% is an [[EventFragment]]. - */ - static isEvent(value) { - return EventFragment.isFragment(value); - } - /** - * Returns true if %%value%% is a [[FunctionFragment]]. - */ - static isFunction(value) { - return FunctionFragment.isFragment(value); - } - /** - * Returns true if %%value%% is a [[StructFragment]]. - */ - static isStruct(value) { - return StructFragment.isFragment(value); - } - } - /** - * An abstract class to represent An individual fragment - * which has a name from a parse ABI. - */ - class NamedFragment extends Fragment { - /** - * The name of the fragment. - */ - name; - /** - * @private - */ - constructor(guard, type, name, inputs) { - super(guard, type, inputs); - assertArgument(typeof name === "string" && name.match(regexId), "invalid identifier", "name", name); - inputs = Object.freeze(inputs.slice()); - defineProperties(this, { name }); - } - } - function joinParams(format, params) { - return ("(" + - params.map((p) => p.format(format)).join(format === "full" ? ", " : ",") + - ")"); - } - /** - * A Fragment which represents a //Custom Error//. - */ - class ErrorFragment extends NamedFragment { - /** - * @private - */ - constructor(guard, name, inputs) { - super(guard, "error", name, inputs); - Object.defineProperty(this, internal$1, { value: ErrorFragmentInternal }); - } - /** - * The Custom Error selector. - */ - get selector() { - return id(this.format("sighash")).substring(0, 10); - } - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "error", - name: this.name, - inputs: this.inputs.map((input) => JSON.parse(input.format(format))), - }); - } - const result = []; - if (format !== "sighash") { - result.push("error"); - } - result.push(this.name + joinParams(format, this.inputs)); - return result.join(" "); - } - static from(obj) { - if (ErrorFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return ErrorFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("error", obj); - const inputs = consumeParams(obj); - consumeEoi(obj); - return new ErrorFragment(_guard$2, name, inputs); - } - return new ErrorFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); - } - static isFragment(value) { - return value && value[internal$1] === ErrorFragmentInternal; - } - } - /** - * A Fragment which represents an Event. - */ - class EventFragment extends NamedFragment { - anonymous; - /** - * @private - */ - constructor(guard, name, inputs, anonymous) { - super(guard, "event", name, inputs); - Object.defineProperty(this, internal$1, { value: EventFragmentInternal }); - defineProperties(this, { anonymous }); - } - /** - * The Event topic hash. - */ - get topicHash() { - return id(this.format("sighash")); - } - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "event", - anonymous: this.anonymous, - name: this.name, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - }); - } - const result = []; - if (format !== "sighash") { - result.push("event"); - } - result.push(this.name + joinParams(format, this.inputs)); - if (format !== "sighash" && this.anonymous) { - result.push("anonymous"); - } - return result.join(" "); - } - static getTopicHash(name, params) { - params = (params || []).map((p) => ParamType.from(p)); - const fragment = new EventFragment(_guard$2, name, params, false); - return fragment.topicHash; - } - static from(obj) { - if (EventFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return EventFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("event", obj); - const inputs = consumeParams(obj, true); - const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has("anonymous"); - consumeEoi(obj); - return new EventFragment(_guard$2, name, inputs, anonymous); - } - return new EventFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous); - } - static isFragment(value) { - return value && value[internal$1] === EventFragmentInternal; - } - } - /** - * A Fragment which represents a constructor. - */ - class ConstructorFragment extends Fragment { - payable; - energy; - /** - * @private - */ - constructor(guard, type, inputs, payable, energy) { - super(guard, type, inputs); - Object.defineProperty(this, internal$1, { - value: ConstructorFragmentInternal, - }); - defineProperties(this, { payable, energy }); - } - format(format) { - assert(format != null && format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" }); - if (format === "json") { - return JSON.stringify({ - type: "constructor", - stateMutability: this.payable ? "payable" : "undefined", - payable: this.payable, - energy: this.energy != null ? this.energy : undefined, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - }); - } - const result = [`constructor${joinParams(format, this.inputs)}`]; - result.push(this.payable ? "payable" : "nonpayable"); - if (this.energy != null) { - result.push(`@${this.energy.toString()}`); - } - return result.join(" "); - } - static from(obj) { - if (ConstructorFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return ConstructorFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - consumeKeywords(obj, setify(["constructor"])); - const inputs = consumeParams(obj); - const payable = !!consumeKeywords(obj, setify(["payable"])).has("payable"); - const energy = consumeEnergy(obj); - consumeEoi(obj); - return new ConstructorFragment(_guard$2, "constructor", inputs, payable, energy); - } - return new ConstructorFragment(_guard$2, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, obj.energy != null ? obj.energy : null); - } - static isFragment(value) { - return value && value[internal$1] === ConstructorFragmentInternal; - } - } - /** - * A Fragment which represents a method. - */ - class FallbackFragment extends Fragment { - /** - * If the function can be sent value during invocation. - */ - payable; - constructor(guard, inputs, payable) { - super(guard, "fallback", inputs); - Object.defineProperty(this, internal$1, { value: FallbackFragmentInternal }); - defineProperties(this, { payable }); - } - format(format) { - const type = this.inputs.length === 0 ? "receive" : "fallback"; - if (format === "json") { - const stateMutability = this.payable ? "payable" : "nonpayable"; - return JSON.stringify({ type, stateMutability }); - } - return `${type}()${this.payable ? " payable" : ""}`; - } - static from(obj) { - if (FallbackFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return FallbackFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const errorObj = obj.toString(); - const topIsValid = obj.peekKeyword(setify(["fallback", "receive"])); - assertArgument(topIsValid, "type must be fallback or receive", "obj", errorObj); - const type = obj.popKeyword(setify(["fallback", "receive"])); - // receive() - if (type === "receive") { - const inputs = consumeParams(obj); - assertArgument(inputs.length === 0, `receive cannot have arguments`, "obj.inputs", inputs); - consumeKeywords(obj, setify(["payable"])); - consumeEoi(obj); - return new FallbackFragment(_guard$2, [], true); - } - // fallback() [payable] - // fallback(bytes) [payable] returns (bytes) - let inputs = consumeParams(obj); - if (inputs.length) { - assertArgument(inputs.length === 1 && inputs[0].type === "bytes", "invalid fallback inputs", "obj.inputs", inputs.map((i) => i.format("minimal")).join(", ")); - } - else { - inputs = [ParamType.from("bytes")]; - } - const mutability = consumeMutability(obj); - assertArgument(mutability === "nonpayable" || mutability === "payable", "fallback cannot be constants", "obj.stateMutability", mutability); - if (consumeKeywords(obj, setify(["returns"])).has("returns")) { - const outputs = consumeParams(obj); - assertArgument(outputs.length === 1 && outputs[0].type === "bytes", "invalid fallback outputs", "obj.outputs", outputs.map((i) => i.format("minimal")).join(", ")); - } - consumeEoi(obj); - return new FallbackFragment(_guard$2, inputs, mutability === "payable"); - } - if (obj.type === "receive") { - return new FallbackFragment(_guard$2, [], true); - } - if (obj.type === "fallback") { - const inputs = [ParamType.from("bytes")]; - const payable = obj.stateMutability === "payable"; - return new FallbackFragment(_guard$2, inputs, payable); - } - assertArgument(false, "invalid fallback description", "obj", obj); - } - static isFragment(value) { - return value && value[internal$1] === FallbackFragmentInternal; - } - } - /** - * A Fragment which represents a method. - */ - class FunctionFragment extends NamedFragment { - /** - * If the function is constant (e.g. ``pure`` or ``view`` functions). - */ - constant; - /** - * The returned types for the result of calling this function. - */ - outputs; - /** - * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` - * or ``pure``) - */ - stateMutability; - /** - * If the function can be sent value during invocation. - */ - payable; - /** - * The amount of energy to send when calling this function - */ - energy; - /** - * @private - */ - constructor(guard, name, stateMutability, inputs, outputs, energy) { - super(guard, "function", name, inputs); - Object.defineProperty(this, internal$1, { value: FunctionFragmentInternal }); - outputs = Object.freeze(outputs.slice()); - const constant = stateMutability === "view" || stateMutability === "pure"; - const payable = stateMutability === "payable"; - defineProperties(this, { - constant, - energy, - outputs, - payable, - stateMutability, - }); - } - /** - * The Function selector. - */ - get selector() { - return id(this.format("sighash")).substring(0, 10); - } - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "function", - name: this.name, - constant: this.constant, - stateMutability: this.stateMutability !== "nonpayable" - ? this.stateMutability - : undefined, - payable: this.payable, - energy: this.energy != null ? this.energy : undefined, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - outputs: this.outputs.map((o) => JSON.parse(o.format(format))), - }); - } - const result = []; - if (format !== "sighash") { - result.push("function"); - } - result.push(this.name + joinParams(format, this.inputs)); - if (format !== "sighash") { - if (this.stateMutability !== "nonpayable") { - result.push(this.stateMutability); - } - if (this.outputs && this.outputs.length) { - result.push("returns"); - result.push(joinParams(format, this.outputs)); - } - if (this.energy != null) { - result.push(`@${this.energy.toString()}`); - } - } - return result.join(" "); - } - static getSelector(name, params) { - params = (params || []).map((p) => ParamType.from(p)); - const fragment = new FunctionFragment(_guard$2, name, "view", params, [], null); - return fragment.selector; - } - static from(obj) { - if (FunctionFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return FunctionFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("function", obj); - const inputs = consumeParams(obj); - const mutability = consumeMutability(obj); - let outputs = []; - if (consumeKeywords(obj, setify(["returns"])).has("returns")) { - outputs = consumeParams(obj); - } - const energy = consumeEnergy(obj); - consumeEoi(obj); - return new FunctionFragment(_guard$2, name, mutability, inputs, outputs, energy); - } - let stateMutability = obj.stateMutability; - // Use legacy Solidity ABI logic if stateMutability is missing - if (stateMutability == null) { - stateMutability = "payable"; - if (typeof obj.constant === "boolean") { - stateMutability = "view"; - if (!obj.constant) { - stateMutability = "payable"; - if (typeof obj.payable === "boolean" && !obj.payable) { - stateMutability = "nonpayable"; - } - } - } - else if (typeof obj.payable === "boolean" && !obj.payable) { - stateMutability = "nonpayable"; - } - } - // @TODO: verifyState for stateMutability (e.g. throw if - // payable: false but stateMutability is "nonpayable") - return new FunctionFragment(_guard$2, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], obj.energy != null ? obj.energy : null); - } - static isFragment(value) { - return value && value[internal$1] === FunctionFragmentInternal; - } - } - /** - * A Fragment which represents a structure. - */ - class StructFragment extends NamedFragment { - /** - * @private - */ - constructor(guard, name, inputs) { - super(guard, "struct", name, inputs); - Object.defineProperty(this, internal$1, { value: StructFragmentInternal }); - } - format() { - throw new Error("@TODO"); - } - static from(obj) { - if (typeof obj === "string") { - return StructFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("struct", obj); - const inputs = consumeParams(obj); - consumeEoi(obj); - return new StructFragment(_guard$2, name, inputs); - } - return new StructFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); - } - static isFragment(value) { - return value && value[internal$1] === StructFragmentInternal; - } - } - - /** - * When sending values to or receiving values from a [[Contract]], the - * data is generally encoded using the [ABI standard](link-solc-abi). - * - * The AbiCoder provides a utility to encode values to ABI data and - * decode values from ABI data. - * - * Most of the time, developers should favour the [[Contract]] class, - * which further abstracts a lot of the finer details of ABI data. - * - * @_section api/abi/abi-coder:ABI Encoding - */ - // https://docs.soliditylang.org/en/v0.8.17/control-structures.html - const PanicReasons$1 = new Map(); - PanicReasons$1.set(0x00, "GENERIC_PANIC"); - PanicReasons$1.set(0x01, "ASSERT_FALSE"); - PanicReasons$1.set(0x11, "OVERFLOW"); - PanicReasons$1.set(0x12, "DIVIDE_BY_ZERO"); - PanicReasons$1.set(0x21, "ENUM_RANGE_ERROR"); - PanicReasons$1.set(0x22, "BAD_STORAGE_DATA"); - PanicReasons$1.set(0x31, "STACK_UNDERFLOW"); - PanicReasons$1.set(0x32, "ARRAY_RANGE_ERROR"); - PanicReasons$1.set(0x41, "OUT_OF_MEMORY"); - PanicReasons$1.set(0x51, "UNINITIALIZED_FUNCTION_CALL"); - const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); - const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); - let defaultCoder = null; - function getBuiltinCallException(action, tx, data, abiCoder) { - let message = "missing revert data"; - let reason = null; - const invocation = null; - let revert = null; - if (data) { - message = "execution reverted"; - const bytes = getBytes(data); - data = hexlify(data); - if (bytes.length === 0) { - message += " (no data present; likely require(false) occurred"; - reason = "require(false)"; - } - else if (bytes.length % 32 !== 4) { - message += " (could not decode reason; invalid data length)"; - } - else if (hexlify(bytes.slice(0, 4)) === "0x08c379a0") { - // Error(string) - try { - reason = abiCoder.decode(["string"], bytes.slice(4))[0]; - revert = { - signature: "Error(string)", - name: "Error", - args: [reason], - }; - message += `: ${JSON.stringify(reason)}`; - } - catch (error) { - message += " (could not decode reason; invalid string data)"; - } - } - else if (hexlify(bytes.slice(0, 4)) === "0x4e487b71") { - // Panic(uint256) - try { - const code = Number(abiCoder.decode(["uint256"], bytes.slice(4))[0]); - revert = { - signature: "Panic(uint256)", - name: "Panic", - args: [code], - }; - reason = `Panic due to ${PanicReasons$1.get(code) || "UNKNOWN"}(${code})`; - message += `: ${reason}`; - } - catch (error) { - message += " (could not decode panic code)"; - } - } - else { - message += " (unknown custom error)"; - } - } - const transaction = { - to: tx.to ? getAddress(tx.to) : null, - data: tx.data || "0x", - }; - if (tx.from) { - transaction.from = getAddress(tx.from); - } - return makeError(message, "CALL_EXCEPTION", { - action, - data, - reason, - transaction, - invocation, - revert, - }); - } - /** - * About AbiCoder - */ - class AbiCoder { - #getCoder(param) { - if (param.isArray()) { - return new ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name); - } - if (param.isTuple()) { - return new TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name); - } - switch (param.baseType) { - case "address": - return new AddressCoder(param.name); - case "bool": - return new BooleanCoder(param.name); - case "string": - return new StringCoder(param.name); - case "bytes": - return new BytesCoder(param.name); - case "": - return new NullCoder(param.name); - } - // u?int[0-9]* - let match = param.type.match(paramTypeNumber); - if (match) { - let size = parseInt(match[2] || "256"); - assertArgument(size !== 0 && size <= 256 && size % 8 === 0, "invalid " + match[1] + " bit length", "param", param); - return new NumberCoder(size / 8, match[1] === "int", param.name); - } - // bytes[0-9]+ - match = param.type.match(paramTypeBytes); - if (match) { - let size = parseInt(match[1]); - assertArgument(size !== 0 && size <= 32, "invalid bytes length", "param", param); - return new FixedBytesCoder(size, param.name); - } - assertArgument(false, "invalid type", "type", param.type); - } - /** - * Get the default values for the given %%types%%. - * - * For example, a ``uint`` is by default ``0`` and ``bool`` - * is by default ``false``. - */ - getDefaultValue(types) { - const coders = types.map((type) => this.#getCoder(ParamType.from(type))); - const coder = new TupleCoder(coders, "_"); - return coder.defaultValue(); - } - /** - * Encode the %%values%% as the %%types%% into ABI data. - * - * @returns DataHexstring - */ - encode(types, values) { - assertArgumentCount(values.length, types.length, "types/values length mismatch"); - const coders = types.map((type) => this.#getCoder(ParamType.from(type))); - const coder = new TupleCoder(coders, "_"); - const writer = new Writer(); - coder.encode(writer, values); - return writer.data; - } - /** - * Decode the ABI %%data%% as the %%types%% into values. - * - * If %%loose%% decoding is enabled, then strict padding is - * not enforced. Some older versions of Solidity incorrectly - * padded event data emitted from ``external`` functions. - */ - decode(types, data, loose) { - const coders = types.map((type) => this.#getCoder(ParamType.from(type))); - const coder = new TupleCoder(coders, "_"); - return coder.decode(new Reader(data, loose)); - } - /** - * Returns the shared singleton instance of a default [[AbiCoder]]. - * - * On the first call, the instance is created internally. - */ - static defaultAbiCoder() { - if (defaultCoder == null) { - defaultCoder = new AbiCoder(); - } - return defaultCoder; - } - /** - * Returns an corebc-compatible [[CallExceptionError]] Error for the given - * result %%data%% for the [[CallExceptionAction]] %%action%% against - * the Transaction %%tx%%. - */ - static getBuiltinCallException(action, tx, data) { - return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder()); - } - } - - /** - * About bytes32 strings... - * - * @_docloc: api/utils:Bytes32 Strings - */ - /** - * Encodes %%text%% as a Bytes32 string. - */ - function encodeBytes32String(text) { - // Get the bytes - const bytes = toUtf8Bytes(text); - // Check we have room for null-termination - if (bytes.length > 31) { - throw new Error("bytes32 string must be less than 32 bytes"); - } - // Zero-pad (implicitly null-terminates) - return zeroPadBytes(bytes, 32); - } - /** - * Encodes the Bytes32-encoded %%bytes%% into a string. - */ - function decodeBytes32String(_bytes) { - const data = getBytes(_bytes, "bytes"); - // Must be 32 bytes with a null-termination - if (data.length !== 32) { - throw new Error("invalid bytes32 - not 32 bytes long"); - } - if (data[31] !== 0) { - throw new Error("invalid bytes32 string - no null terminator"); - } - // Find the null termination - let length = 31; - while (data[length - 1] === 0) { - length--; - } - // Determine the string value - return toUtf8String(data.slice(0, length)); - } - - /** - * About Interface - * - * @_subsection api/abi:Interfaces [interfaces] - */ - class LogDescription { - fragment; - name; - signature; - topic; - args; - constructor(fragment, topic, args) { - const name = fragment.name, signature = fragment.format(); - defineProperties(this, { - fragment, - name, - signature, - topic, - args, - }); - } - } - class TransactionDescription { - fragment; - name; - args; - signature; - selector; - value; - constructor(fragment, selector, args, value) { - const name = fragment.name, signature = fragment.format(); - defineProperties(this, { - fragment, - name, - args, - signature, - selector, - value, - }); - } - } - class ErrorDescription { - fragment; - name; - args; - signature; - selector; - constructor(fragment, selector, args) { - const name = fragment.name, signature = fragment.format(); - defineProperties(this, { - fragment, - name, - args, - signature, - selector, - }); - } - } - class Indexed { - hash; - _isIndexed; - static isIndexed(value) { - return !!(value && value._isIndexed); - } - constructor(hash) { - defineProperties(this, { hash, _isIndexed: true }); - } - } - // https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require - const PanicReasons = { - "0": "generic panic", - "1": "assert(false)", - "17": "arithmetic overflow", - "18": "division or modulo by zero", - "33": "enum overflow", - "34": "invalid encoded storage byte array accessed", - "49": "out-of-bounds array access; popping on an empty array", - "50": "out-of-bounds access of an array or bytesN", - "65": "out of memory", - "81": "uninitialized function", - }; - const BuiltinErrors = { - "0x08c379a0": { - signature: "Error(string)", - name: "Error", - inputs: ["string"], - reason: (message) => { - return `reverted with reason string ${JSON.stringify(message)}`; - }, - }, - "0x4e487b71": { - signature: "Panic(uint256)", - name: "Panic", - inputs: ["uint256"], - reason: (code) => { - let reason = "unknown panic code"; - if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) { - reason = PanicReasons[code.toString()]; - } - return `reverted with panic code 0x${code.toString(16)} (${reason})`; - }, - }, - }; - /** - * An Interface abstracts many of the low-level details for - * encoding and decoding the data on the blockchain. - * - * An ABI provides information on how to encode data to send to - * a Contract, how to decode the results and events and how to - * interpret revert errors. - * - * The ABI can be specified by [any supported format](InterfaceAbi). - */ - class Interface { - /** - * All the Contract ABI members (i.e. methods, events, errors, etc). - */ - fragments; - /** - * The Contract constructor. - */ - deploy; - /** - * The Fallback method, if any. - */ - fallback; - /** - * If receiving xcb is supported. - */ - receive; - #errors; - #events; - #functions; - // #structs: Map; - #abiCoder; - /** - * Create a new Interface for the %%fragments%%. - */ - constructor(fragments) { - let abi = []; - if (typeof fragments === "string") { - abi = JSON.parse(fragments); - } - else { - abi = fragments; - } - this.#functions = new Map(); - this.#errors = new Map(); - this.#events = new Map(); - // this.#structs = new Map(); - const frags = []; - for (const a of abi) { - try { - frags.push(Fragment.from(a)); - } - catch (error) { - console.log("EE", error); - } - } - defineProperties(this, { - fragments: Object.freeze(frags), - }); - let fallback = null; - let receive = false; - this.#abiCoder = this.getAbiCoder(); - // Add all fragments by their signature - this.fragments.forEach((fragment, index) => { - let bucket; - switch (fragment.type) { - case "constructor": - if (this.deploy) { - console.log("duplicate definition - constructor"); - return; - } - //checkNames(fragment, "input", fragment.inputs); - defineProperties(this, { - deploy: fragment, - }); - return; - case "fallback": - if (fragment.inputs.length === 0) { - receive = true; - } - else { - assertArgument(!fallback || - fragment.payable !== fallback.payable, "conflicting fallback fragments", `fragments[${index}]`, fragment); - fallback = fragment; - receive = fallback.payable; - } - return; - case "function": - //checkNames(fragment, "input", fragment.inputs); - //checkNames(fragment, "output", (fragment).outputs); - bucket = this.#functions; - break; - case "event": - //checkNames(fragment, "input", fragment.inputs); - bucket = this.#events; - break; - case "error": - bucket = this.#errors; - break; - default: - return; - } - // Two identical entries; ignore it - const signature = fragment.format(); - if (bucket.has(signature)) { - return; - } - bucket.set(signature, fragment); - }); - // If we do not have a constructor add a default - if (!this.deploy) { - defineProperties(this, { - deploy: ConstructorFragment.from("constructor()"), - }); - } - defineProperties(this, { fallback, receive }); - } - /** - * Returns the entire Human-Readable ABI, as an array of - * signatures, optionally as %%minimal%% strings, which - * removes parameter names and unneceesary spaces. - */ - format(minimal) { - const format = minimal ? "minimal" : "full"; - const abi = this.fragments.map((f) => f.format(format)); - return abi; - } - /** - * Return the JSON-encoded ABI. This is the format Solidiy - * returns. - */ - formatJson() { - const abi = this.fragments.map((f) => f.format("json")); - // We need to re-bundle the JSON fragments a bit - return JSON.stringify(abi.map((j) => JSON.parse(j))); - } - /** - * The ABI coder that will be used to encode and decode binary - * data. - */ - getAbiCoder() { - return AbiCoder.defaultAbiCoder(); - } - // Find a function definition by any means necessary (unless it is ambiguous) - #getFunction(key, values, forceUnique) { - // Selector - if (isHexString(key)) { - const selector = key.toLowerCase(); - for (const fragment of this.#functions.values()) { - if (selector === fragment.selector) { - return fragment; - } - } - return null; - } - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of this.#functions) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - if (values) { - const lastValue = values.length > 0 ? values[values.length - 1] : null; - let valueLength = values.length; - let allowOptions = true; - if (Typed.isTyped(lastValue) && lastValue.type === "overrides") { - allowOptions = false; - valueLength--; - } - // Remove all matches that don't have a compatible length. The args - // may contain an overrides, so the match may have n or n - 1 parameters - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs.length; - if (inputs !== valueLength && - (!allowOptions || inputs !== valueLength - 1)) { - matching.splice(i, 1); - } - } - // Remove all matches that don't match the Typed signature - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs; - for (let j = 0; j < values.length; j++) { - // Not a typed value - if (!Typed.isTyped(values[j])) { - continue; - } - // We are past the inputs - if (j >= inputs.length) { - if (values[j].type === "overrides") { - continue; - } - matching.splice(i, 1); - break; - } - // Make sure the value type matches the input type - if (values[j].type !== inputs[j].baseType) { - matching.splice(i, 1); - break; - } - } - } - } - // We found a single matching signature with an overrides, but the - // last value is something that cannot possibly be an options - if (matching.length === 1 && - values && - values.length !== matching[0].inputs.length) { - const lastArg = values[values.length - 1]; - if (lastArg == null || - Array.isArray(lastArg) || - typeof lastArg !== "object") { - matching.splice(0, 1); - } - } - if (matching.length === 0) { - return null; - } - if (matching.length > 1 && forceUnique) { - const matchStr = matching - .map((m) => JSON.stringify(m.format())) - .join(", "); - assertArgument(false, `ambiguous function description (i.e. matches ${matchStr})`, "key", key); - } - return matching[0]; - } - // Normalize the signature and lookup the function - const result = this.#functions.get(FunctionFragment.from(key).format()); - if (result) { - return result; - } - return null; - } - /** - * Get the function name for %%key%%, which may be a function selector, - * function name or function signature that belongs to the ABI. - */ - getFunctionName(key) { - const fragment = this.#getFunction(key, null, false); - assertArgument(fragment, "no matching function", "key", key); - return fragment.name; - } - /** - * Returns true if %%key%% (a function selector, function name or - * function signature) is present in the ABI. - * - * In the case of a function name, the name may be ambiguous, so - * accessing the [[FunctionFragment]] may require refinement. - */ - hasFunction(key) { - return !!this.#getFunction(key, null, false); - } - /** - * Get the [[FunctionFragment]] for %%key%%, which may be a function - * selector, function name or function signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple functions match by name. - * - * If the %%key%% and %%values%% do not refine to a single function in - * the ABI, this will throw. - */ - getFunction(key, values) { - return this.#getFunction(key, values || null, true); - } - /** - * Iterate over all functions, calling %%callback%%, sorted by their name. - */ - forEachFunction(callback) { - const names = Array.from(this.#functions.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#functions.get(name), i); - } - } - // Find an event definition by any means necessary (unless it is ambiguous) - #getEvent(key, values, forceUnique) { - // EventTopic - if (isHexString(key)) { - const eventTopic = key.toLowerCase(); - for (const fragment of this.#events.values()) { - if (eventTopic === fragment.topicHash) { - return fragment; - } - } - return null; - } - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of this.#events) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - if (values) { - // Remove all matches that don't have a compatible length. - for (let i = matching.length - 1; i >= 0; i--) { - if (matching[i].inputs.length < values.length) { - matching.splice(i, 1); - } - } - // Remove all matches that don't match the Typed signature - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs; - for (let j = 0; j < values.length; j++) { - // Not a typed value - if (!Typed.isTyped(values[j])) { - continue; - } - // Make sure the value type matches the input type - if (values[j].type !== inputs[j].baseType) { - matching.splice(i, 1); - break; - } - } - } - } - if (matching.length === 0) { - return null; - } - if (matching.length > 1 && forceUnique) { - const matchStr = matching - .map((m) => JSON.stringify(m.format())) - .join(", "); - assertArgument(false, `ambiguous event description (i.e. matches ${matchStr})`, "key", key); - } - return matching[0]; - } - // Normalize the signature and lookup the function - const result = this.#events.get(EventFragment.from(key).format()); - if (result) { - return result; - } - return null; - } - /** - * Get the event name for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - */ - getEventName(key) { - const fragment = this.#getEvent(key, null, false); - assertArgument(fragment, "no matching event", "key", key); - return fragment.name; - } - /** - * Returns true if %%key%% (an event topic hash, event name or - * event signature) is present in the ABI. - * - * In the case of an event name, the name may be ambiguous, so - * accessing the [[EventFragment]] may require refinement. - */ - hasEvent(key) { - return !!this.#getEvent(key, null, false); - } - /** - * Get the [[EventFragment]] for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple events match by name. - * - * If the %%key%% and %%values%% do not refine to a single event in - * the ABI, this will throw. - */ - getEvent(key, values) { - return this.#getEvent(key, values || null, true); - } - /** - * Iterate over all events, calling %%callback%%, sorted by their name. - */ - forEachEvent(callback) { - const names = Array.from(this.#events.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#events.get(name), i); - } - } - /** - * Get the [[ErrorFragment]] for %%key%%, which may be an error - * selector, error name or error signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple errors match by name. - * - * If the %%key%% and %%values%% do not refine to a single error in - * the ABI, this will throw. - */ - getError(key, values) { - if (isHexString(key)) { - const selector = key.toLowerCase(); - if (BuiltinErrors[selector]) { - return ErrorFragment.from(BuiltinErrors[selector].signature); - } - for (const fragment of this.#errors.values()) { - if (selector === fragment.selector) { - return fragment; - } - } - return null; - } - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of this.#errors) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - if (matching.length === 0) { - if (key === "Error") { - return ErrorFragment.from("error Error(string)"); - } - if (key === "Panic") { - return ErrorFragment.from("error Panic(uint256)"); - } - return null; - } - else if (matching.length > 1) { - const matchStr = matching - .map((m) => JSON.stringify(m.format())) - .join(", "); - assertArgument(false, `ambiguous error description (i.e. ${matchStr})`, "name", key); - } - return matching[0]; - } - // Normalize the signature and lookup the function - key = ErrorFragment.from(key).format(); - if (key === "Error(string)") { - return ErrorFragment.from("error Error(string)"); - } - if (key === "Panic(uint256)") { - return ErrorFragment.from("error Panic(uint256)"); - } - const result = this.#errors.get(key); - if (result) { - return result; - } - return null; - } - /** - * Iterate over all errors, calling %%callback%%, sorted by their name. - */ - forEachError(callback) { - const names = Array.from(this.#errors.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#errors.get(name), i); - } - } - // Get the 4-byte selector used by Solidity to identify a function - /* - getSelector(fragment: ErrorFragment | FunctionFragment): string { - if (typeof(fragment) === "string") { - const matches: Array = [ ]; - - try { matches.push(this.getFunction(fragment)); } catch (error) { } - try { matches.push(this.getError(fragment)); } catch (_) { } - - if (matches.length === 0) { - logger.throwArgumentError("unknown fragment", "key", fragment); - } else if (matches.length > 1) { - logger.throwArgumentError("ambiguous fragment matches function and error", "key", fragment); - } - - fragment = matches[0]; - } - - return dataSlice(id(fragment.format()), 0, 4); - } - */ - // Get the 32-byte topic hash used by Solidity to identify an event - /* - getEventTopic(fragment: EventFragment): string { - //if (typeof(fragment) === "string") { fragment = this.getEvent(eventFragment); } - return id(fragment.format()); - } - */ - _decodeParams(params, data) { - return this.#abiCoder.decode(params, data); - } - _encodeParams(params, values) { - return this.#abiCoder.encode(params, values); - } - /** - * Encodes a ``tx.data`` object for deploying the Contract with - * the %%values%% as the constructor arguments. - */ - encodeDeploy(values) { - return this._encodeParams(this.deploy.inputs, values || []); - } - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified error (see [[getError]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeErrorResult(fragment, data) { - if (typeof fragment === "string") { - const f = this.getError(fragment); - assertArgument(f, "unknown error", "fragment", fragment); - fragment = f; - } - assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, "data", data); - return this._decodeParams(fragment.inputs, dataSlice(data, 4)); - } - /** - * Encodes the transaction revert data for a call result that - * reverted from the the Contract with the sepcified %%error%% - * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeErrorResult(fragment, values) { - if (typeof fragment === "string") { - const f = this.getError(fragment); - assertArgument(f, "unknown error", "fragment", fragment); - fragment = f; - } - return concat([ - fragment.selector, - this._encodeParams(fragment.inputs, values || []), - ]); - } - /** - * Decodes the %%data%% from a transaction ``tx.data`` for - * the function specified (see [[getFunction]] for valid values - * for %%fragment%%). - * - * Most developers should prefer the [[parseTransaction]] method - * instead, which will automatically detect the fragment. - */ - decodeFunctionData(fragment, data) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, "data", data); - return this._decodeParams(fragment.inputs, dataSlice(data, 4)); - } - /** - * Encodes the ``tx.data`` for a transaction that calls the function - * specified (see [[getFunction]] for valid values for %%fragment%%) with - * the %%values%%. - */ - encodeFunctionData(fragment, values) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - return concat([ - fragment.selector, - this._encodeParams(fragment.inputs, values || []), - ]); - } - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeFunctionResult(fragment, data) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - let message = "invalid length for result data"; - const bytes = getBytesCopy(data); - if (bytes.length % 32 === 0) { - try { - return this.#abiCoder.decode(fragment.outputs, bytes); - } - catch (error) { - message = "could not decode result data"; - } - } - // Call returned data with no error, but the data is junk - assert(false, message, "BAD_DATA", { - value: hexlify(bytes), - info: { method: fragment.name, signature: fragment.format() }, - }); - } - makeError(_data, tx) { - const data = getBytes(_data, "data"); - const error = AbiCoder.getBuiltinCallException("call", tx, data); - // Not a built-in error; try finding a custom error - const customPrefix = "execution reverted (unknown custom error)"; - if (error.message.startsWith(customPrefix)) { - const selector = hexlify(data.slice(0, 4)); - const ef = this.getError(selector); - if (ef) { - try { - const args = this.#abiCoder.decode(ef.inputs, data.slice(4)); - error.revert = { - name: ef.name, - signature: ef.format(), - args, - }; - error.reason = error.revert.signature; - error.message = `execution reverted: ${error.reason}`; - } - catch (e) { - error.message = `execution reverted (coult not decode custom error)`; - } - } - } - // Add the invocation, if available - const parsed = this.parseTransaction(tx); - if (parsed) { - error.invocation = { - method: parsed.name, - signature: parsed.signature, - args: parsed.args, - }; - } - return error; - } - /** - * Encodes the result data (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values - * for %%fragment%%) with %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeFunctionResult(fragment, values) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - return hexlify(this.#abiCoder.encode(fragment.outputs, values || [])); - } - /* - spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> { - const promises: Array> = [ ]; - const process = function(type: ParamType, value: any): any { - if (type.baseType === "array") { - return descend(type.child - } - if (type. === "address") { - } - }; - - const descend = function (inputs: Array, values: ReadonlyArray) { - if (inputs.length !== values.length) { throw new Error("length mismatch"); } - }; - - const result: Array = [ ]; - values.forEach((value, index) => { - if (value == null) { - topics.push(null); - } else if (param.baseType === "array" || param.baseType === "tuple") { - logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); - } else if (Array.isArray(value)) { - topics.push(value.map((value) => encodeTopic(param, value))); - } else { - topics.push(encodeTopic(param, value)); - } - }); - } - */ - // Create the filter for the event with search criteria (e.g. for xcb_filterLog) - encodeFilterTopics(fragment, values) { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - assertArgument(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - assert(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, "UNEXPECTED_ARGUMENT", { count: values.length, expectedCount: fragment.inputs.length }); - const topics = []; - if (!fragment.anonymous) { - topics.push(fragment.topicHash); - } - // @TODO: Use the coders for this; to properly support tuples, etc. - const encodeTopic = (param, value) => { - if (param.type === "string") { - return id(value); - } - else if (param.type === "bytes") { - return sha256(hexlify(value)); - } - if (param.type === "bool" && typeof value === "boolean") { - value = value ? "0x01" : "0x00"; - } - if (param.type.match(/^u?int/)) { - value = toBeHex(value); - } - // Check addresses are valid - if (param.type === "address") { - this.#abiCoder.encode(["address"], [value]); - } - return zeroPadValue(hexlify(value), 32); - //@TOOD should probably be return toHex(value, 32) - }; - values.forEach((value, index) => { - const param = fragment.inputs[index]; - if (!param.indexed) { - assertArgument(value == null, "cannot filter non-indexed parameters; must be null", "contract." + param.name, value); - return; - } - if (value == null) { - topics.push(null); - } - else if (param.baseType === "array" || param.baseType === "tuple") { - assertArgument(false, "filtering with tuples or arrays not supported", "contract." + param.name, value); - } - else if (Array.isArray(value)) { - topics.push(value.map((value) => encodeTopic(param, value))); - } - else { - topics.push(encodeTopic(param, value)); - } - }); - // Trim off trailing nulls - while (topics.length && topics[topics.length - 1] === null) { - topics.pop(); - } - return topics; - } - encodeEventLog(fragment, values) { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - assertArgument(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - const topics = []; - const dataTypes = []; - const dataValues = []; - if (!fragment.anonymous) { - topics.push(fragment.topicHash); - } - assertArgument(values.length === fragment.inputs.length, "event arguments/values mismatch", "values", values); - fragment.inputs.forEach((param, index) => { - const value = values[index]; - if (param.indexed) { - if (param.type === "string") { - topics.push(id(value)); - } - else if (param.type === "bytes") { - topics.push(sha256(value)); - } - else if (param.baseType === "tuple" || param.baseType === "array") { - // @TODO - throw new Error("not implemented"); - } - else { - topics.push(this.#abiCoder.encode([param.type], [value])); - } - } - else { - dataTypes.push(param); - dataValues.push(value); - } - }); - return { - data: this.#abiCoder.encode(dataTypes, dataValues), - topics: topics, - }; - } - // Decode a filter for the event and the search criteria - decodeEventLog(fragment, data, topics) { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - assertArgument(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - if (topics != null && !fragment.anonymous) { - const eventTopic = fragment.topicHash; - assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, "fragment/topic mismatch", "topics[0]", topics[0]); - topics = topics.slice(1); - } - const indexed = []; - const nonIndexed = []; - const dynamic = []; - fragment.inputs.forEach((param, index) => { - if (param.indexed) { - if (param.type === "string" || - param.type === "bytes" || - param.baseType === "tuple" || - param.baseType === "array") { - indexed.push(ParamType.from({ type: "bytes32", name: param.name })); - dynamic.push(true); - } - else { - indexed.push(param); - dynamic.push(false); - } - } - else { - nonIndexed.push(param); - dynamic.push(false); - } - }); - const resultIndexed = topics != null ? this.#abiCoder.decode(indexed, concat(topics)) : null; - const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true); - //const result: (Array & { [ key: string ]: any }) = [ ]; - const values = []; - const keys = []; - let nonIndexedIndex = 0, indexedIndex = 0; - fragment.inputs.forEach((param, index) => { - let value = null; - if (param.indexed) { - if (resultIndexed == null) { - value = new Indexed(null); - } - else if (dynamic[index]) { - value = new Indexed(resultIndexed[indexedIndex++]); - } - else { - try { - value = resultIndexed[indexedIndex++]; - } - catch (error) { - value = error; - } - } - } - else { - try { - value = resultNonIndexed[nonIndexedIndex++]; - } - catch (error) { - value = error; - } - } - values.push(value); - keys.push(param.name || null); - }); - return Result.fromItems(values, keys); - } - /** - * Parses a transaction, finding the matching function and extracts - * the parameter values along with other useful function details. - * - * If the matching function cannot be found, return null. - */ - parseTransaction(tx) { - const data = getBytes(tx.data, "tx.data"); - const value = getBigInt(tx.value != null ? tx.value : 0, "tx.value"); - const fragment = this.getFunction(hexlify(data.slice(0, 4))); - if (!fragment) { - return null; - } - const args = this.#abiCoder.decode(fragment.inputs, data.slice(4)); - return new TransactionDescription(fragment, fragment.selector, args, value); - } - parseCallResult(data) { - throw new Error("@TODO"); - } - /** - * Parses a receipt log, finding the matching event and extracts - * the parameter values along with other useful event details. - * - * If the matching event cannot be found, returns null. - */ - parseLog(log) { - const fragment = this.getEvent(log.topics[0]); - if (!fragment || fragment.anonymous) { - return null; - } - // @TODO: If anonymous, and the only method, and the input count matches, should we parse? - // Probably not, because just because it is the only event in the ABI does - // not mean we have the full ABI; maybe just a fragment? - return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics)); - } - /** - * Parses a revert data, finding the matching error and extracts - * the parameter values along with other useful error details. - * - * If the matching event cannot be found, returns null. - */ - parseError(data) { - const hexData = hexlify(data); - const fragment = this.getError(dataSlice(hexData, 0, 4)); - if (!fragment) { - return null; - } - const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4)); - return new ErrorDescription(fragment, fragment.selector, args); - } - /** - * Creates a new [[Interface]] from the ABI %%value%%. - * - * The %%value%% may be provided as an existing [[Interface]] object, - * a JSON-encoded ABI or any Human-Readable ABI format. - */ - static from(value) { - // Already an Interface, which is immutable - if (value instanceof Interface) { - return value; - } - // JSON - if (typeof value === "string") { - return new Interface(JSON.parse(value)); - } - // Maybe an interface from an older version, or from a symlinked copy - if (typeof value.format === "function") { - return new Interface(value.format("json")); - } - // Array of fragments - return new Interface(value); - } - } - - const logger = new Logger("contract-address/0.0.1"); - /** - * Returns the address that would result from a ``CREATE`` for %%tx%%. - * - * This can be used to compute the address a contract will be - * deployed to by an EOA when sending a deployment transaction (i.e. - * when the ``to`` address is ``null``). - * - * This can also be used to compute the address a contract will be - * deployed to by a contract, by using the contract's address as the - * ``to`` and the contract's nonce. - * - * @example - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; - * nonce = 5; - * - * getCreateAddress({ from, nonce }); - * //_result: - */ - function getCreateAddress(tx) { - const from = getAddress(tx.from); - const nonce = getBigInt(tx.nonce, "tx.nonce"); - let nonceHex = nonce.toString(16); - if (nonceHex === "0") { - nonceHex = "0x"; - } - else if (nonceHex.length % 2) { - nonceHex = "0x0" + nonceHex; - } - else { - nonceHex = "0x" + nonceHex; - } - return getAddress(from); - } - /** - * Returns the address that would result from a ``CREATE2`` operation - * with the given %%from%%, %%salt%% and %%initCodeHash%%. - - * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. - * - * @example - * // The address of the contract - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" - * - * // The salt - * salt = id("HelloWorld") - * - * getCreate2Address(from, salt, initCodeHash) - * //_result: - */ - function getCreate2Address(from, salt, initCodeHash) { - if (hexDataLength(salt) !== 32) { - logger.throwArgumentError("salt must be 32 bytes", "salt", salt); - } - if (hexDataLength(initCodeHash) !== 32) { - logger.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash); - } - const val = hexDataSlice(sha256(concat(["0xff", getAddress(from), salt, initCodeHash])), 12); - console.log({ "contract-address/74=>should be string": val }); - const prefix = from.substring(2, 4); - const checksum = calculateCheckSum(val, prefix); - return "0x" + prefix + checksum + removeHexPrefix(val); - } - - /** - * Returns true if %%value%% is an object which implements the - * [[Addressable]] interface. - * - * @example: - * // Wallets and AbstractSigner sub-classes - * isAddressable(Wallet.createRandom()) - * //_result: - * - * // Contracts - * contract = new Contract("dai.tokens.corebc.eth", [ ], provider) - * isAddressable(contract) - * //_result: - */ - function isAddressable(value) { - return value && typeof value.getAddress === "function"; - } - /** - * Returns true if %%value%% is a valid address. - * - * @example: - * // Valid address - * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") - * //_result: - * - * // Valid ICAP address - * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") - * //_result: - * - * // Invalid checksum - * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") - * //_result: - * - * // Invalid ICAP checksum - * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") - * //_result: - * - * // Not an address (an ENS name requires a provided and an - * // asynchronous API to access) - * isAddress("ricmoo.eth") - * //_result: - */ - function isAddress(value) { - try { - getAddress(value); - return true; - } - catch (error) { } - return false; - } - async function checkAddress(target, promise) { - const result = await promise; - if (result == null || - result === "0x0000000000000000000000000000000000000000") { - assert(typeof target !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target }); - assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target); - } - return getAddress(result); - } - /** - * Resolves to an address for the %%target%%, which may be any - * supported address type, an [[Addressable]] or a Promise which - * resolves to an address. - * - * If an ENS name is provided, but that name has not been correctly - * configured a [[UnconfiguredNameError]] is thrown. - * - * @example: - * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" - * - * // Addresses are return synchronously - * resolveAddress(addr, provider) - * //_result: - * - * // Address promises are resolved asynchronously - * resolveAddress(Promise.resolve(addr)) - * //_result: - * - * - * // Addressable objects are resolved asynchronously - * contract = new Contract(addr, [ ]) - * resolveAddress(contract, provider) - * //_result: - * - * // Unconfigured ENS names reject - * resolveAddress("nothing-here.ricmoo.eth", provider) - * //_error: - * - * // ENS names require a NameResolver object passed in - * // (notice the provider was omitted) - * resolveAddress("nothing-here.ricmoo.eth") - * //_error: - */ - function resolveAddress(target) { - if (typeof target === "string") { - return getAddress(target); - // assert(resolver != null, "ENS resolution requires a provider", - // "UNSUPPORTED_OPERATION", { operation: "resolveName" }); - // return checkAddress(target, resolver.resolveName(target)); - } - else if (isAddressable(target)) { - return checkAddress(target, target.getAddress()); - } - else if (target && typeof target.then === "function") { - return checkAddress(target, target); - } - assertArgument(false, "unsupported addressable value", "target", target); - } - - const BN_0$2 = BigInt(0); - // ----------------------- - function getValue(value) { - if (value == null) { - return null; - } - return value; - } - function toJson(value) { - if (value == null) { - return null; - } - return value.toString(); - } - // @TODO? implements Required - /** - * A **FeeData** wraps all the fee-related values associated with - * the network. - */ - class FeeData { - /** - * The energy price for legacy networks. - */ - energyPrice; - constructor(energyPrice) { - defineProperties(this, { - energyPrice: getValue(energyPrice), - }); - } - /** - * Returns a JSON-friendly value. - */ - toJSON() { - const { energyPrice } = this; - return { - _type: "FeeData", - energyPrice: toJson(energyPrice), - }; - } - } - function copyRequest(req) { - const result = {}; - // These could be addresses, ENS names or Addressables - if (req.to) { - result.to = req.to; - } - if (req.from) { - result.from = req.from; - } - if (req.data) { - result.data = hexlify(req.data); - } - const bigIntKeys = "networkId,energyLimit,energyPrice,value".split(/,/); - for (const key of bigIntKeys) { - if (!(key in req) || req[key] == null) { - continue; - } - result[key] = getBigInt(req[key], `request.${key}`); - } - const numberKeys = "type,nonce".split(/,/); - for (const key of numberKeys) { - if (!(key in req) || req[key] == null) { - continue; - } - result[key] = getNumber(req[key], `request.${key}`); - } - if ("blockTag" in req) { - result.blockTag = req.blockTag; - } - if ("enableCcipRead" in req) { - result.enableCcipReadEnabled = !!req.enableCcipRead; - } - if ("customData" in req) { - result.customData = req.customData; - } - return result; - } - /** - * A **Block** represents the data associated with a full block on - * Core. - */ - class Block { - /** - * The provider connected to the block used to fetch additional details - * if necessary. - */ - provider; - /** - * The block number, sometimes called the block height. This is a - * sequential number that is one higher than the parent block. - */ - number; - /** - * The block hash. - */ - hash; - /** - * The timestamp for this block, which is the number of seconds since - * epoch that this block was included. - */ - timestamp; - /** - * The block hash of the parent block. - */ - parentHash; - /** - * The nonce. - * - * On legacy networks, this is the random number inserted which - * permitted the difficulty target to be reached. - */ - nonce; - /** - * The difficulty target. - * - * On legacy networks, this is the proof-of-work target required - * for a block to meet the protocol rules to be included. - * - * On modern networks, this is a random number arrived at using - * randao. @TODO: Find links? - */ - difficulty; - /** - * The total energy limit for this block. - */ - energyLimit; - /** - * The total energy used in this block. - */ - energyUsed; - /** - * The miner coinbase address, wihch receives any subsidies for - * including this block. - */ - miner; - /** - * Any extra data the validator wished to include. - */ - extraData; - /** - * The base fee per energy that all transactions in this block were - * charged. - * - * This adjusts after each block, depending on how congested the network - * is. - */ - baseFeePerEnergy; - #transactions; - /** - * Create a new **Block** object. - * - * This should generally not be necessary as the unless implementing a - * low-level library. - */ - constructor(block, provider) { - this.#transactions = block.transactions.map((tx) => { - if (typeof tx !== "string") { - return new TransactionResponse(tx, provider); - } - return tx; - }); - defineProperties(this, { - provider, - hash: getValue(block.hash), - number: block.number, - timestamp: block.timestamp, - parentHash: block.parentHash, - nonce: block.nonce, - difficulty: block.difficulty, - energyLimit: block.energyLimit, - energyUsed: block.energyUsed, - miner: block.miner, - extraData: block.extraData, - baseFeePerEnergy: getValue(block.baseFeePerEnergy), - }); - } - /** - * Returns the list of transaction hashes. - */ - get transactions() { - return this.#transactions.map((tx) => { - if (typeof tx === "string") { - return tx; - } - return tx.hash; - }); - } - /** - * Returns the complete transactions for blocks which - * prefetched them, by passing ``true`` to %%prefetchTxs%% - * into [[provider_getBlock]]. - */ - get prefetchedTransactions() { - const txs = this.#transactions.slice(); - // Doesn't matter... - if (txs.length === 0) { - return []; - } - // Make sure we prefetched the transactions - assert(typeof txs[0] === "object", "transactions were not prefetched with block request", "UNSUPPORTED_OPERATION", { - operation: "transactionResponses()", - }); - return txs; - } - /** - * Returns a JSON-friendly value. - */ - toJSON() { - const { baseFeePerEnergy, difficulty, extraData, energyLimit, energyUsed, hash, miner, nonce, number, parentHash, timestamp, transactions, } = this; - return { - _type: "Block", - baseFeePerEnergy: toJson(baseFeePerEnergy), - difficulty: toJson(difficulty), - extraData, - energyLimit: toJson(energyLimit), - energyUsed: toJson(energyUsed), - hash, - miner, - nonce, - number, - parentHash, - timestamp, - transactions, - }; - } - [Symbol.iterator]() { - let index = 0; - const txs = this.transactions; - return { - next: () => { - if (index < this.length) { - return { - value: txs[index++], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - /** - * The number of transactions in this block. - */ - get length() { - return this.#transactions.length; - } - /** - * The [[link-js-date]] this block was included at. - */ - get date() { - if (this.timestamp == null) { - return null; - } - return new Date(this.timestamp * 1000); - } - /** - * Get the transaction at %%indexe%% within this block. - */ - async getTransaction(indexOrHash) { - // Find the internal value by its index or hash - let tx = undefined; - if (typeof indexOrHash === "number") { - tx = this.#transactions[indexOrHash]; - } - else { - const hash = indexOrHash.toLowerCase(); - for (const v of this.#transactions) { - if (typeof v === "string") { - if (v !== hash) { - continue; - } - tx = v; - break; - } - else { - if (v.hash === hash) { - continue; - } - tx = v; - break; - } - } - } - if (tx == null) { - throw new Error("no such tx"); - } - if (typeof tx === "string") { - return await this.provider.getTransaction(tx); - } - else { - return tx; - } - } - getPrefetchedTransaction(indexOrHash) { - const txs = this.prefetchedTransactions; - if (typeof indexOrHash === "number") { - return txs[indexOrHash]; - } - indexOrHash = indexOrHash.toLowerCase(); - for (const tx of txs) { - if (tx.hash === indexOrHash) { - return tx; - } - } - assertArgument(false, "no matching transaction", "indexOrHash", indexOrHash); - } - /** - * Has this block been mined. - * - * If true, the block has been typed-gaurded that all mined - * properties are non-null. - */ - isMined() { - return !!this.hash; - } - /** - * - */ - isLondon() { - return !!this.baseFeePerEnergy; - } - orphanedEvent() { - if (!this.isMined()) { - throw new Error(""); - } - return createOrphanedBlockFilter(this); - } - } - ////////////////////// - // Log - class Log { - provider; - transactionHash; - blockHash; - blockNumber; - removed; - address; - data; - topics; - index; - transactionIndex; - constructor(log, provider) { - this.provider = provider; - const topics = Object.freeze(log.topics.slice()); - defineProperties(this, { - transactionHash: log.transactionHash, - blockHash: log.blockHash, - blockNumber: log.blockNumber, - removed: log.removed, - address: log.address, - data: log.data, - topics, - index: log.index, - transactionIndex: log.transactionIndex, - }); - } - toJSON() { - const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex, } = this; - return { - _type: "log", - address, - blockHash, - blockNumber, - data, - index, - removed, - topics, - transactionHash, - transactionIndex, - }; - } - async getBlock() { - const block = await this.provider.getBlock(this.blockHash); - assert(!!block, "failed to find transaction", "UNKNOWN_ERROR", {}); - return block; - } - async getTransaction() { - const tx = await this.provider.getTransaction(this.transactionHash); - assert(!!tx, "failed to find transaction", "UNKNOWN_ERROR", {}); - return tx; - } - async getTransactionReceipt() { - const receipt = await this.provider.getTransactionReceipt(this.transactionHash); - assert(!!receipt, "failed to find transaction receipt", "UNKNOWN_ERROR", {}); - return receipt; - } - removedEvent() { - return createRemovedLogFilter(this); - } - } - ////////////////////// - // Transaction Receipt - /* - export interface LegacyTransactionReceipt { - byzantium: false; - status: null; - root: string; - } - - export interface ByzantiumTransactionReceipt { - byzantium: true; - status: number; - root: null; - } - */ - class TransactionReceipt { - provider; - to; - from; - contractAddress; - hash; - index; - blockHash; - blockNumber; - logsBloom; - energyUsed; - cumulativeEnergyUsed; - energyPrice; - type; - //readonly byzantium!: boolean; - status; - root; - #logs; - constructor(tx, provider) { - this.#logs = Object.freeze(tx.logs.map((log) => { - return new Log(log, provider); - })); - defineProperties(this, { - provider, - to: tx.to, - from: tx.from, - contractAddress: tx.contractAddress, - hash: tx.hash, - index: tx.index, - blockHash: tx.blockHash, - blockNumber: tx.blockNumber, - logsBloom: tx.logsBloom, - energyUsed: tx.energyUsed, - cumulativeEnergyUsed: tx.cumulativeEnergyUsed, - energyPrice: (tx.effectiveEnergyPrice || tx.energyPrice), - //byzantium: tx.byzantium, - status: tx.status, - root: tx.root, - }); - } - get logs() { - return this.#logs; - } - toJSON() { - const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium, - status, root, } = this; - return { - _type: "TransactionReceipt", - blockHash, - blockNumber, - //byzantium, - contractAddress, - cumulativeEnergyUsed: toJson(this.cumulativeEnergyUsed), - from, - energyPrice: toJson(this.energyPrice), - energyUsed: toJson(this.energyUsed), - hash, - index, - logs, - logsBloom, - root, - status, - to, - }; - } - get length() { - return this.logs.length; - } - [Symbol.iterator]() { - let index = 0; - return { - next: () => { - if (index < this.length) { - return { value: this.logs[index++], done: false }; - } - return { value: undefined, done: true }; - }, - }; - } - get fee() { - return this.energyUsed * this.energyPrice; - } - async getBlock() { - const block = await this.provider.getBlock(this.blockHash); - if (block == null) { - throw new Error("TODO"); - } - return block; - } - async getTransaction() { - const tx = await this.provider.getTransaction(this.hash); - if (tx == null) { - throw new Error("TODO"); - } - return tx; - } - async getResult() { - return await this.provider.getTransactionResult(this.hash); - } - async confirmations() { - return (await this.provider.getBlockNumber()) - this.blockNumber + 1; - } - removedEvent() { - return createRemovedTransactionFilter(this); - } - reorderedEvent(other) { - assert(!other || other.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }); - return createReorderedTransactionFilter(this, other); - } - } - /* - export type ReplacementDetectionSetup = { - to: string; - from: string; - value: bigint; - data: string; - nonce: number; - block: number; - }; - */ - class TransactionResponse { - /** - * The provider this is connected to, which will influence how its - * methods will resolve its async inspection methods. - */ - provider; - /** - * The block number of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - blockNumber; - /** - * The blockHash of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - blockHash; - /** - * The index within the block that this transaction resides at. - */ - index; - /** - * The transaction hash. - */ - hash; - /** - * The [[link-eip-2718]] transaction envelope type. This is - * ``0`` for legacy transactions types. - */ - type; - /** - * The receiver of this transaction. - * - * If ``null``, then the transaction is an initcode transaction. - * This means the result of executing the [[data]] will be deployed - * as a new contract on chain (assuming it does not revert) and the - * address may be computed using [[getCreateAddress]]. - */ - to; - /** - * The sender of this transaction. It is implicitly computed - * from the transaction pre-image hash (as the digest) and the - * [[signature]] using ecrecover. - */ - from; - /** - * The nonce, which is used to prevent replay attacks and offer - * a method to ensure transactions from a given sender are explicitly - * ordered. - * - * When sending a transaction, this must be equal to the number of - * transactions ever sent by [[from]]. - */ - nonce; - /** - * The maximum units of energy this transaction can consume. If execution - * exceeds this, the entries transaction is reverted and the sender - * is charged for the full amount, despite not state changes being made. - */ - energyLimit; - /** - * The energy price can have various values, depending on the network. - * - * In modern networks, for transactions that are included this is - * the //effective energy price// (the fee per energy that was actually - * charged), while for transactions that have not been included yet - * is the [[maxFeePerEnergy]]. - * - * For legacy transactions, or transactions on legacy networks, this - * is the fee that will be charged per unit of energy the transaction - * consumes. - */ - energyPrice; - /** - * The data. - */ - data; - /** - * The value, in ore. Use [[formatXCB]] to format this value - * as xcb. - */ - value; - /** - * The chain ID. - */ - networkId; - /** - * The signature. - */ - signature; - #startBlock; - /** - * Create a new TransactionResponse with %%tx%% parameters - * connected to %%provider%%. - */ - constructor(tx, provider) { - this.provider = provider; - this.blockNumber = tx.blockNumber != null ? tx.blockNumber : null; - this.blockHash = tx.blockHash != null ? tx.blockHash : null; - this.hash = tx.hash; - this.index = tx.index; - this.from = tx.from; - this.to = tx.to || null; - this.energyLimit = tx.energyLimit; - this.nonce = tx.nonce; - this.data = tx.data; - this.value = tx.value; - this.energyPrice = tx.energyPrice; - this.networkId = tx.networkId; - this.signature = tx.signature; - this.#startBlock = -1; - } - /** - * Returns a JSON representation of this transaction. - */ - toJSON() { - const { index, hash, type, to, from, nonce, data, signature } = this; - return { - _type: "TransactionReceipt", - networkId: toJson(this.networkId), - data, - from, - energyLimit: toJson(this.energyLimit), - energyPrice: toJson(this.energyPrice), - hash, - nonce, - signature, - to, - index, - type, - value: toJson(this.value), - }; - } - /** - * Resolves to the Block that this transaction was included in. - * - * This will return null if the transaction has not been included yet. - */ - async getBlock() { - let blockNumber = this.blockNumber; - if (blockNumber == null) { - const tx = await this.getTransaction(); - if (tx) { - blockNumber = tx.blockNumber; - } - } - if (blockNumber == null) { - return null; - } - const block = this.provider.getBlock(blockNumber); - if (block == null) { - throw new Error("TODO"); - } - return block; - } - /** - * Resolves to this transaction being re-requested from the - * provider. This can be used if you have an unmined transaction - * and wish to get an up-to-date populated instance. - */ - async getTransaction() { - return this.provider.getTransaction(this.hash); - } - /** - * Resolves once this transaction has been mined and has - * %%confirms%% blocks including it (default: ``1``) with an - * optional %%timeout%%. - * - * This can resolve to ``null`` only if %%confirms%% is ``0`` - * and the transaction has not been mined, otherwise this will - * wait until enough confirmations have completed. - */ - async wait(_confirms, _timeout) { - const confirms = _confirms == null ? 1 : _confirms; - const timeout = _timeout == null ? 0 : _timeout; - let startBlock = this.#startBlock; - let nextScan = -1; - let stopScanning = startBlock === -1 ? true : false; - const checkReplacement = async () => { - // Get the current transaction count for this sender - if (stopScanning) { - return null; - } - const { blockNumber, nonce } = await resolveProperties({ - blockNumber: this.provider.getBlockNumber(), - nonce: this.provider.getTransactionCount(this.from), - }); - // No transaction or our nonce has not been mined yet; but we - // can start scanning later when we do start - if (nonce < this.nonce) { - startBlock = blockNumber; - return; - } - // We were mined; no replacement - if (stopScanning) { - return null; - } - const mined = await this.getTransaction(); - if (mined && mined.blockNumber != null) { - return; - } - // We were replaced; start scanning for that transaction - // Starting to scan; look back a few extra blocks for safety - if (nextScan === -1) { - nextScan = startBlock - 3; - if (nextScan < this.#startBlock) { - nextScan = this.#startBlock; - } - } - while (nextScan <= blockNumber) { - // Get the next block to scan - if (stopScanning) { - return null; - } - const block = await this.provider.getBlock(nextScan, true); - // This should not happen; but we'll try again shortly - if (block == null) { - return; - } - // We were mined; no replacement - for (const hash of block) { - if (hash === this.hash) { - return; - } - } - // Search for the transaction that replaced us - for (let i = 0; i < block.length; i++) { - const tx = await block.getTransaction(i); - if (tx.from === this.from && tx.nonce === this.nonce) { - // Get the receipt - if (stopScanning) { - return null; - } - const receipt = await this.provider.getTransactionReceipt(tx.hash); - // This should not happen; but we'll try again shortly - if (receipt == null) { - return; - } - // We will retry this on the next block (this case could be optimized) - if (blockNumber - receipt.blockNumber + 1 < confirms) { - return; - } - // The reason we were replaced - let reason = "replaced"; - if (tx.data === this.data && - tx.to === this.to && - tx.value === this.value) { - reason = "repriced"; - } - else if (tx.data === "0x" && - tx.from === tx.to && - tx.value === BN_0$2) { - reason = "cancelled"; - } - assert(false, "transaction was replaced", "TRANSACTION_REPLACED", { - cancelled: reason === "replaced" || reason === "cancelled", - reason, - replacement: tx.replaceableTransaction(startBlock), - hash: tx.hash, - receipt, - }); - } - } - nextScan++; - } - return; - }; - const receipt = await this.provider.getTransactionReceipt(this.hash); - if (receipt) { - if ((await receipt.confirmations()) >= confirms) { - return receipt; - } - } - else { - // Check for a replacement; throws if a replacement was found - await checkReplacement(); - // Allow null only when the confirms is 0 - if (confirms === 0) { - return null; - } - } - const waiter = new Promise((resolve, reject) => { - // List of things to cancel when we have a result (one way or the other) - const cancellers = []; - const cancel = () => { - cancellers.forEach((c) => c()); - }; - // On cancel, stop scanning for replacements - cancellers.push(() => { - stopScanning = true; - }); - // Set up any timeout requested - if (timeout > 0) { - const timer = setTimeout(() => { - cancel(); - reject(makeError("wait for transaction timeout", "TIMEOUT")); - }, timeout); - cancellers.push(() => { - clearTimeout(timer); - }); - } - const txListener = async (receipt) => { - // Done; return it! - if ((await receipt.confirmations()) >= confirms) { - cancel(); - resolve(receipt); - } - }; - cancellers.push(() => { - this.provider.off(this.hash, txListener); - }); - this.provider.on(this.hash, txListener); - // We support replacement detection; start checking - if (startBlock >= 0) { - const replaceListener = async () => { - try { - // Check for a replacement; this throws only if one is found - await checkReplacement(); - } - catch (error) { - // We were replaced (with enough confirms); re-throw the error - if (isError(error, "TRANSACTION_REPLACED")) { - cancel(); - reject(error); - return; - } - } - // Rescheudle a check on the next block - if (!stopScanning) { - this.provider.once("block", replaceListener); - } - }; - cancellers.push(() => { - this.provider.off("block", replaceListener); - }); - this.provider.once("block", replaceListener); - } - }); - return await waiter; - } - /** - * Returns ``true`` if this transaction has been included. - * - * This is effective only as of the time the TransactionResponse - * was instantiated. To get up-to-date information, use - * [[getTransaction]]. - * - * This provides a Type Guard that this transaction will have - * non-null property values for properties that are null for - * unmined transactions. - */ - isMined() { - return this.blockHash != null; - } - /** - * Returns true if the transaction is a legacy (i.e. ``type == 0``) - * transaction. - * - * This provides a Type Guard that this transaction will have - * the ``null``-ness for hardfork-specific properties set correctly. - */ - isLegacy() { - return this.type === 0; - } - /** - * Returns a filter which can be used to listen for orphan events - * that evict this transaction. - */ - removedEvent() { - assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - return createRemovedTransactionFilter(this); - } - /** - * Returns a filter which can be used to listen for orphan events - * that re-order this event against %%other%%. - */ - reorderedEvent(other) { - assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - assert(!other || other.isMined(), "unmined 'other' transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - return createReorderedTransactionFilter(this, other); - } - /** - * Returns a new TransactionResponse instance which has the ability to - * detect (and throw an error) if the transaction is replaced, which - * will begin scanning at %%startBlock%%. - * - * This should generally not be used by developers and is intended - * primarily for internal use. Setting an incorrect %%startBlock%% can - * have devastating performance consequences if used incorrectly. - */ - replaceableTransaction(startBlock) { - assertArgument(Number.isInteger(startBlock) && startBlock >= 0, "invalid startBlock", "startBlock", startBlock); - const tx = new TransactionResponse(this, this.provider); - tx.#startBlock = startBlock; - return tx; - } - } - function createOrphanedBlockFilter(block) { - return { orphan: "drop-block", hash: block.hash, number: block.number }; - } - function createReorderedTransactionFilter(tx, other) { - return { orphan: "reorder-transaction", tx, other }; - } - function createRemovedTransactionFilter(tx) { - return { orphan: "drop-transaction", tx }; - } - function createRemovedLogFilter(log) { - return { - orphan: "drop-log", - log: { - transactionHash: log.transactionHash, - blockHash: log.blockHash, - blockNumber: log.blockNumber, - address: log.address, - data: log.data, - topics: Object.freeze(log.topics.slice()), - index: log.index, - }, - }; - } - - class EventLog extends Log { - interface; - fragment; - args; - constructor(log, iface, fragment) { - super(log, log.provider); - const args = iface.decodeEventLog(fragment, log.data, log.topics); - defineProperties(this, { args, fragment, interface: iface }); - } - get eventName() { - return this.fragment.name; - } - get eventSignature() { - return this.fragment.format(); - } - } - class ContractTransactionReceipt extends TransactionReceipt { - #iface; - constructor(iface, provider, tx) { - super(tx, provider); - this.#iface = iface; - } - get logs() { - return super.logs.map((log) => { - const fragment = log.topics.length - ? this.#iface.getEvent(log.topics[0]) - : null; - if (fragment) { - return new EventLog(log, this.#iface, fragment); - } - else { - return log; - } - }); - } - } - class ContractTransactionResponse extends TransactionResponse { - #iface; - constructor(iface, provider, tx) { - super(tx, provider); - this.#iface = iface; - } - async wait(confirms) { - const receipt = await super.wait(); - if (receipt == null) { - return null; - } - return new ContractTransactionReceipt(this.#iface, this.provider, receipt); - } - } - class ContractUnknownEventPayload extends EventPayload { - log; - constructor(contract, listener, filter, log) { - super(contract, listener, filter); - defineProperties(this, { log }); - } - async getBlock() { - return await this.log.getBlock(); - } - async getTransaction() { - return await this.log.getTransaction(); - } - async getTransactionReceipt() { - return await this.log.getTransactionReceipt(); - } - } - class ContractEventPayload extends ContractUnknownEventPayload { - constructor(contract, listener, filter, fragment, _log) { - super(contract, listener, filter, new EventLog(_log, contract.interface, fragment)); - const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics); - defineProperties(this, { args, fragment }); - } - get eventName() { - return this.fragment.name; - } - get eventSignature() { - return this.fragment.format(); - } - } - - const BN_0$1 = BigInt(0); - function canCall(value) { - return value && typeof value.call === "function"; - } - function canEstimate(value) { - return value && typeof value.estimateEnergy === "function"; - } - function canResolve(value) { - return value && typeof value.resolveName === "function"; - } - function canSend(value) { - return value && typeof value.sendTransaction === "function"; - } - class PreparedTopicFilter { - #filter; - fragment; - constructor(contract, fragment, args) { - defineProperties(this, { fragment }); - if (fragment.inputs.length < args.length) { - throw new Error("too many arguments"); - } - // Recursively descend into args and resolve any addresses - this.#filter = (async function () { - const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => { - const arg = args[index]; - if (arg == null) { - return null; - } - return param.walkAsync(args[index], (type, value) => { - if (type === "address") { - return resolveAddress(value); - } - return value; - }); - })); - return contract.interface.encodeFilterTopics(fragment, resolvedArgs); - })(); - } - getTopicFilter() { - return this.#filter; - } - } - // A = Arguments passed in as a tuple - // R = The result type of the call (i.e. if only one return type, - // the qualified type, otherwise Result) - // D = The type the default call will return (i.e. R for view/pure, - // TransactionResponse otherwise) - //export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> { - function getRunner(value, feature) { - if (value == null) { - return null; - } - if (typeof value[feature] === "function") { - return value; - } - if (value.provider && typeof value.provider[feature] === "function") { - return value.provider; - } - return null; - } - function getProvider(value) { - if (value == null) { - return null; - } - return value.provider || null; - } - /** - * @_ignore: - */ - async function copyOverrides(arg, allowed) { - // Create a shallow copy (we'll deep-ify anything needed during normalizing) - const overrides = copyRequest(Typed.dereference(arg, "overrides")); - assertArgument(overrides.to == null || (allowed || []).indexOf("to") >= 0, "cannot override to", "overrides.to", overrides.to); - assertArgument(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); - // Resolve any from - if (overrides.from) { - overrides.from = await resolveAddress(overrides.from); - } - return overrides; - } - /** - * @_ignore: - */ - async function resolveArgs(_runner, inputs, args) { - // Recursively descend into args and resolve any addresses - return await Promise.all(inputs.map((param, index) => { - return param.walkAsync(args[index], (type, value) => { - value = Typed.dereference(value, type); - if (type === "address") { - return resolveAddress(value); - } - return value; - }); - })); - } - function buildWrappedFallback(contract) { - const populateTransaction = async function (overrides) { - // If an overrides was passed in, copy it and normalize the values - const tx = (await copyOverrides(overrides, ["data"])); - tx.to = await contract.getAddress(); - const iface = contract.interface; - // Only allow payable contracts to set non-zero value - const payable = iface.receive || (iface.fallback && iface.fallback.payable); - assertArgument(payable || (tx.value || BN_0$1) === BN_0$1, "cannot send value to non-payable contract", "overrides.value", tx.value); - // Only allow fallback contracts to set non-empty data - assertArgument(iface.fallback || (tx.data || "0x") === "0x", "cannot send data to receive-only contract", "overrides.data", tx.data); - return tx; - }; - const staticCall = async function (overrides) { - const runner = getRunner(contract.runner, "call"); - assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); - const tx = await populateTransaction(overrides); - try { - return await runner.call(tx); - } - catch (error) { - if (isCallException(error) && error.data) { - throw contract.interface.makeError(error.data, tx); - } - throw error; - } - }; - const send = async function (overrides) { - const runner = contract.runner; - assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); - const tx = await runner.sendTransaction(await populateTransaction(overrides)); - const provider = getProvider(contract.runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - return new ContractTransactionResponse(contract.interface, provider, tx); - }; - const estimateEnergy = async function (overrides) { - const runner = getRunner(contract.runner, "estimateEnergy"); - assert(canEstimate(runner), "contract runner does not support energy estimation", "UNSUPPORTED_OPERATION", { operation: "estimateEnergy" }); - return await runner.estimateEnergy(await populateTransaction(overrides)); - }; - const method = async (overrides) => { - return await send(overrides); - }; - defineProperties(method, { - _contract: contract, - estimateEnergy, - populateTransaction, - send, - staticCall, - }); - return method; - } - function buildWrappedMethod(contract, key) { - const getFragment = function (...args) { - const fragment = contract.interface.getFunction(key, args); - assert(fragment, "no matching fragment in getFragment", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }; - const populateTransaction = async function (...args) { - const fragment = getFragment(...args); - // If an overrides was passed in, copy it and normalize the values - let overrides = {}; - if (fragment.inputs.length + 1 === args.length) { - overrides = await copyOverrides(args.pop()); - } - if (fragment.inputs.length !== args.length) { - throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); - } - const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args); - return Object.assign({}, overrides, await resolveProperties({ - to: contract.getAddress(), - data: contract.interface.encodeFunctionData(fragment, resolvedArgs), - })); - }; - const staticCall = async function (...args) { - const result = await staticCallResult(...args); - if (result.length === 1) { - return result[0]; - } - return result; - }; - const send = async function (...args) { - const runner = contract.runner; - assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); - const tx = await runner.sendTransaction(await populateTransaction(...args)); - const provider = getProvider(contract.runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - return new ContractTransactionResponse(contract.interface, provider, tx); - }; - const estimateEnergy = async function (...args) { - const runner = getRunner(contract.runner, "estimateEnergy"); - assert(canEstimate(runner), "contract runner does not support energy estimation", "UNSUPPORTED_OPERATION", { operation: "estimateEnergy" }); - return await runner.estimateEnergy(await populateTransaction(...args)); - }; - const staticCallResult = async function (...args) { - const runner = getRunner(contract.runner, "call"); - assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); - const tx = await populateTransaction(...args); - let result = "0x"; - try { - result = await runner.call(tx); - } - catch (error) { - if (isCallException(error) && error.data) { - throw contract.interface.makeError(error.data, tx); - } - throw error; - } - const fragment = getFragment(...args); - return contract.interface.decodeFunctionResult(fragment, result); - }; - const method = async (...args) => { - const fragment = getFragment(...args); - if (fragment.constant) { - return await staticCall(...args); - } - return await send(...args); - }; - defineProperties(method, { - name: contract.interface.getFunctionName(key), - _contract: contract, - _key: key, - getFragment, - estimateEnergy, - populateTransaction, - send, - staticCall, - staticCallResult, - }); - // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) - Object.defineProperty(method, "fragment", { - configurable: false, - enumerable: true, - get: () => { - const fragment = contract.interface.getFunction(key); - assert(fragment, "no matching fragment in defineProperty", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }, - }); - return method; - } - function buildWrappedEvent(contract, key) { - const getFragment = function (...args) { - const fragment = contract.interface.getEvent(key, args); - assert(fragment, "no matching fragment in", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }; - const method = function (...args) { - return new PreparedTopicFilter(contract, getFragment(...args), args); - }; - defineProperties(method, { - name: contract.interface.getEventName(key), - _contract: contract, - _key: key, - getFragment, - }); - // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) - Object.defineProperty(method, "fragment", { - configurable: false, - enumerable: true, - get: () => { - const fragment = contract.interface.getEvent(key); - assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }, - }); - return method; - } - // The combination of TypeScrype, Private Fields and Proxies makes - // the world go boom; so we hide variables with some trickery keeping - // a symbol attached to each BaseContract which its sub-class (even - // via a Proxy) can reach and use to look up its internal values. - const internal = Symbol.for("_corebcInternal_contract"); - const internalValues = new WeakMap(); - function setInternal(contract, values) { - internalValues.set(contract[internal], values); - } - function getInternal(contract) { - return internalValues.get(contract[internal]); - } - function isDeferred(value) { - return (value && - typeof value === "object" && - "getTopicFilter" in value && - typeof value.getTopicFilter === "function" && - value.fragment); - } - async function getSubInfo(contract, event) { - let topics; - let fragment = null; - // Convert named events to topicHash and get the fragment for - // events which need deconstructing. - if (Array.isArray(event)) { - const topicHashify = function (name) { - if (isHexString(name, 32)) { - return name; - } - const fragment = contract.interface.getEvent(name); - assertArgument(fragment, "unknown fragment", "name", name); - return fragment.topicHash; - }; - // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` - topics = event.map((e) => { - if (e == null) { - return null; - } - if (Array.isArray(e)) { - return e.map(topicHashify); - } - return topicHashify(e); - }); - } - else if (event === "*") { - topics = [null]; - } - else if (typeof event === "string") { - if (isHexString(event, 32)) { - // Topic Hash - topics = [event]; - } - else { - // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` - fragment = contract.interface.getEvent(event); - assertArgument(fragment, "unknown fragment", "event", event); - topics = [fragment.topicHash]; - } - } - else if (isDeferred(event)) { - // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)` - topics = await event.getTopicFilter(); - } - else if ("fragment" in event) { - // ContractEvent; e.g. `contract.filter.Transfer` - fragment = event.fragment; - topics = [fragment.topicHash]; - } - else { - assertArgument(false, "unknown event name", "event", event); - } - // Normalize topics and sort TopicSets - topics = topics.map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values()); - if (items.length === 1) { - return items[0]; - } - items.sort(); - return items; - } - return t.toLowerCase(); - }); - const tag = topics - .map((t) => { - if (t == null) { - return "null"; - } - if (Array.isArray(t)) { - return t.join("|"); - } - return t; - }) - .join("&"); - return { fragment, tag, topics }; - } - async function hasSub(contract, event) { - const { subs } = getInternal(contract); - return subs.get((await getSubInfo(contract, event)).tag) || null; - } - async function getSub(contract, operation, event) { - // Make sure our runner can actually subscribe to events - const provider = getProvider(contract.runner); - assert(provider, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation }); - const { fragment, tag, topics } = await getSubInfo(contract, event); - const { addr, subs } = getInternal(contract); - let sub = subs.get(tag); - if (!sub) { - const address = addr ? addr : contract; - const filter = { address, topics }; - const listener = (log) => { - let foundFragment = fragment; - if (foundFragment == null) { - try { - foundFragment = contract.interface.getEvent(log.topics[0]); - } - catch (error) { } - } - // If fragment is null, we do not deconstruct the args to emit - if (foundFragment) { - const _foundFragment = foundFragment; - const args = fragment - ? contract.interface.decodeEventLog(fragment, log.data, log.topics) - : []; - emit(contract, event, args, (listener) => { - return new ContractEventPayload(contract, listener, event, _foundFragment, log); - }); - } - else { - emit(contract, event, [], (listener) => { - return new ContractUnknownEventPayload(contract, listener, event, log); - }); - } - }; - let starting = []; - const start = () => { - if (starting.length) { - return; - } - starting.push(provider.on(filter, listener)); - }; - const stop = async () => { - if (starting.length == 0) { - return; - } - let started = starting; - starting = []; - await Promise.all(started); - provider.off(filter, listener); - }; - sub = { tag, listeners: [], start, stop }; - subs.set(tag, sub); - } - return sub; - } - // We use this to ensure one emit resolves before firing the next to - // ensure correct ordering (note this cannot throw and just adds the - // notice to the event queu using setTimeout). - let lastEmit = Promise.resolve(); - async function _emit(contract, event, args, payloadFunc) { - await lastEmit; - const sub = await hasSub(contract, event); - if (!sub) { - return false; - } - const count = sub.listeners.length; - sub.listeners = sub.listeners.filter(({ listener, once }) => { - const passArgs = Array.from(args); - if (payloadFunc) { - passArgs.push(payloadFunc(once ? null : listener)); - } - try { - listener.call(contract, ...passArgs); - } - catch (error) { } - return !once; - }); - return count > 0; - } - async function emit(contract, event, args, payloadFunc) { - try { - await lastEmit; - } - catch (error) { } - const resultPromise = _emit(contract, event, args, payloadFunc); - lastEmit = resultPromise; - return await resultPromise; - } - const passProperties = ["then"]; - class BaseContract { - target; - interface; - runner; - filters; - [internal]; - fallback; - constructor(target, abi, runner, _deployTx) { - if (runner == null) { - runner = null; - } - const iface = Interface.from(abi); - defineProperties(this, { target, runner, interface: iface }); - Object.defineProperty(this, internal, { value: {} }); - let addrPromise; - let addr = null; - let deployTx = null; - if (_deployTx) { - const provider = getProvider(runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx); - } - let subs = new Map(); - // Resolve the target as the address - if (typeof target === "string") { - if (isHexString(target)) { - addr = target; - addrPromise = Promise.resolve(target); - } - else { - const resolver = getRunner(runner, "resolveName"); - if (!canResolve(resolver)) { - throw makeError("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", { - operation: "resolveName", - }); - } - addrPromise = resolver.resolveName(target).then((addr) => { - if (addr == null) { - throw new Error("TODO"); - } - getInternal(this).addr = addr; - return addr; - }); - } - } - else { - addrPromise = target.getAddress().then((addr) => { - if (addr == null) { - throw new Error("TODO"); - } - getInternal(this).addr = addr; - return addr; - }); - } - // Set our private values - setInternal(this, { addrPromise, addr, deployTx, subs }); - // Add the event filters - const filters = new Proxy({}, { - get: (target, _prop, receiver) => { - // Pass important checks (like `then` for Promise) through - if (passProperties.indexOf(_prop) >= 0) { - return Reflect.get(target, _prop, receiver); - } - const prop = String(_prop); - const result = this.getEvent(prop); - if (result) { - return result; - } - throw new Error(`unknown contract event: ${prop}`); - }, - has: (target, prop) => { - // Pass important checks (like `then` for Promise) through - if (passProperties.indexOf(prop) >= 0) { - return Reflect.has(target, prop); - } - return (Reflect.has(target, prop) || this.interface.hasEvent(String(prop))); - }, - }); - defineProperties(this, { filters }); - defineProperties(this, { - fallback: iface.receive || iface.fallback ? buildWrappedFallback(this) : null, - }); - // Return a Proxy that will respond to functions - return new Proxy(this, { - get: (target, _prop, receiver) => { - if (_prop in target || passProperties.indexOf(_prop) >= 0) { - return Reflect.get(target, _prop, receiver); - } - const prop = String(_prop); - const result = target.getFunction(prop); - if (result) { - return result; - } - throw new Error(`unknown contract method: ${prop}`); - }, - has: (target, prop) => { - if (prop in target || passProperties.indexOf(prop) >= 0) { - return Reflect.has(target, prop); - } - return target.interface.hasFunction(String(prop)); - }, - }); - } - connect(runner) { - return new BaseContract(this.target, this.interface, runner); - } - async getAddress() { - return await getInternal(this).addrPromise; - } - async getDeployedCode() { - const provider = getProvider(this.runner); - assert(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" }); - const code = await provider.getCode(await this.getAddress()); - if (code === "0x") { - return null; - } - return code; - } - async waitForDeployment() { - // We have the deployement transaction; just use that (throws if deployement fails) - const deployTx = this.deploymentTransaction(); - if (deployTx) { - await deployTx.wait(); - return this; - } - // Check for code - const code = await this.getDeployedCode(); - if (code != null) { - return this; - } - // Make sure we can subscribe to a provider event - const provider = getProvider(this.runner); - assert(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }); - return new Promise((resolve, reject) => { - const checkCode = async () => { - try { - const code = await this.getDeployedCode(); - if (code != null) { - return resolve(this); - } - provider.once("block", checkCode); - } - catch (error) { - reject(error); - } - }; - checkCode(); - }); - } - deploymentTransaction() { - return getInternal(this).deployTx; - } - getFunction(key) { - if (typeof key !== "string") { - key = key.format(); - } - const func = buildWrappedMethod(this, key); - return func; - } - getEvent(key) { - if (typeof key !== "string") { - key = key.format(); - } - return buildWrappedEvent(this, key); - } - async queryTransaction(hash) { - // Is this useful? - throw new Error("@TODO"); - } - async queryFilter(event, fromBlock, toBlock) { - if (fromBlock == null) { - fromBlock = 0; - } - if (toBlock == null) { - toBlock = "latest"; - } - const { addr, addrPromise } = getInternal(this); - const address = addr ? addr : await addrPromise; - const { fragment, topics } = await getSubInfo(this, event); - const filter = { address, topics, fromBlock, toBlock }; - const provider = getProvider(this.runner); - assert(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); - return (await provider.getLogs(filter)).map((log) => { - let foundFragment = fragment; - if (foundFragment == null) { - try { - foundFragment = this.interface.getEvent(log.topics[0]); - } - catch (error) { } - } - if (foundFragment) { - return new EventLog(log, this.interface, foundFragment); - } - else { - return new Log(log, provider); - } - }); - } - async on(event, listener) { - const sub = await getSub(this, "on", event); - sub.listeners.push({ listener, once: false }); - sub.start(); - return this; - } - async once(event, listener) { - const sub = await getSub(this, "once", event); - sub.listeners.push({ listener, once: true }); - sub.start(); - return this; - } - async emit(event, ...args) { - return await emit(this, event, args, null); - } - async listenerCount(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return 0; - } - return sub.listeners.length; - } - const { subs } = getInternal(this); - let total = 0; - for (const { listeners } of subs.values()) { - total += listeners.length; - } - return total; - } - async listeners(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return []; - } - return sub.listeners.map(({ listener }) => listener); - } - const { subs } = getInternal(this); - let result = []; - for (const { listeners } of subs.values()) { - result = result.concat(listeners.map(({ listener }) => listener)); - } - return result; - } - async off(event, listener) { - const sub = await hasSub(this, event); - if (!sub) { - return this; - } - if (listener) { - const index = sub.listeners - .map(({ listener }) => listener) - .indexOf(listener); - if (index >= 0) { - sub.listeners.splice(index, 1); - } - } - if (listener == null || sub.listeners.length === 0) { - sub.stop(); - getInternal(this).subs.delete(sub.tag); - } - return this; - } - async removeAllListeners(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return this; - } - sub.stop(); - getInternal(this).subs.delete(sub.tag); - } - else { - const { subs } = getInternal(this); - for (const { tag, stop } of subs.values()) { - stop(); - subs.delete(tag); - } - } - return this; - } - // Alias for "on" - async addListener(event, listener) { - return await this.on(event, listener); - } - // Alias for "off" - async removeListener(event, listener) { - return await this.off(event, listener); - } - static buildClass(abi) { - class CustomContract extends BaseContract { - constructor(address, runner = null) { - super(address, abi, runner); - } - } - return CustomContract; - } - static from(target, abi, runner) { - if (runner == null) { - runner = null; - } - const contract = new this(target, abi, runner); - return contract; - } - static isIndexed(value) { - return Indexed.isIndexed(value); - } - } - function _ContractBase() { - return BaseContract; - } - class Contract extends _ContractBase() { - } - - // A = Arguments to the constructor - // I = Interface of deployed contracts - class ContractFactory { - interface; - bytecode; - runner; - constructor(abi, bytecode, runner) { - const iface = Interface.from(abi); - // Dereference Solidity bytecode objects and allow a missing `0x`-prefix - if (bytecode instanceof Uint8Array) { - bytecode = hexlify(getBytes(bytecode)); - } - else if (typeof bytecode === "string") { - bytecode = bytecode; - } - else if (isBytes(bytecode)) { - bytecode = hexlify(bytecode); - } - else if (bytecode && typeof bytecode.object === "string") { - // Allow the bytecode object from the Solidity compiler - bytecode = bytecode.object; - } - else { - // Crash in the next verification step - bytecode = "!"; - } - defineProperties(this, { - // @ts-ignore - bytecode, - interface: iface, - runner: runner || null, - }); - } - async getDeployTransaction(...args) { - let overrides = {}; - const fragment = this.interface.deploy; - if (fragment.inputs.length + 1 === args.length) { - overrides = await copyOverrides(args.pop()); - } - if (fragment.inputs.length !== args.length) { - throw new Error("incorrect number of arguments to constructor"); - } - const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args); - const data = concat([ - this.bytecode, - this.interface.encodeDeploy(resolvedArgs), - ]); - return Object.assign({}, overrides, { data }); - } - async deploy(...args) { - const tx = await this.getDeployTransaction(...args); - assert(this.runner && typeof this.runner.sendTransaction === "function", "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", { - operation: "sendTransaction", - }); - const sentTx = await this.runner.sendTransaction(tx); - const address = getCreateAddress(sentTx); - return new BaseContract(address, this.interface, this.runner, sentTx); - } - connect(runner) { - return new ContractFactory(this.interface, this.bytecode, runner); - } - static fromSolidity(output, runner) { - assertArgument(output != null, "bad compiler output", "output", output); - if (typeof output === "string") { - output = JSON.parse(output); - } - const abi = output.abi; - let bytecode = ""; - if (output.bytecode) { - bytecode = output.bytecode; - } - else if (output.evm && output.evm.bytecode) { - bytecode = output.evm.bytecode; - } - return new this(abi, bytecode, runner); - } - } - - /** - * @_ignore - */ - const BN_0 = BigInt(0); - function allowNull(format, nullValue) { - return function (value) { - if (value == null) { - return nullValue; - } - return format(value); - }; - } - function arrayOf(format) { - return (array) => { - if (!Array.isArray(array)) { - throw new Error("not an array"); - } - return array.map((i) => format(i)); - }; - } - // Requires an object which matches a fleet of other formatters - // Any FormatFunc may return `undefined` to have the value omitted - // from the result object. Calls preserve `this`. - function object(format, altNames) { - return (value) => { - const result = {}; - for (const key in format) { - let srcKey = key; - if (altNames && key in altNames && !(srcKey in value)) { - for (const altKey of altNames[key]) { - if (altKey in value) { - srcKey = altKey; - break; - } - } - } - try { - const nv = format[key](value[srcKey]); - if (nv !== undefined) { - result[key] = nv; - } - } - catch (error) { - const message = error instanceof Error ? error.message : "not-an-error"; - assert(false, `invalid value for value.${key} (${message})`, "BAD_DATA", { value }); - } - } - return result; - }; - } - function formatBoolean(value) { - switch (value) { - case true: - case "true": - return true; - case false: - case "false": - return false; - } - assertArgument(false, `invalid boolean; ${JSON.stringify(value)}`, "value", value); - } - function formatData(value) { - assertArgument(isHexString(value, true), "invalid data", "value", value); - return value; - } - function formatHash(value) { - assertArgument(isHexString(value, 32), "invalid hash", "value", value); - return value; - } - const _formatLog = object({ - address: getAddress, - blockHash: formatHash, - blockNumber: getNumber, - data: formatData, - index: getNumber, - removed: allowNull(formatBoolean, false), - topics: arrayOf(formatHash), - transactionHash: formatHash, - transactionIndex: getNumber, - }, { - index: ["logIndex"], - }); - function formatLog(value) { - return _formatLog(value); - } - const _formatBlock = object({ - hash: allowNull(formatHash), - parentHash: formatHash, - number: getNumber, - timestamp: getNumber, - nonce: allowNull(formatData), - difficulty: getBigInt, - energyLimit: getBigInt, - energyUsed: getBigInt, - miner: allowNull(getAddress), - extraData: formatData, - baseFeePerEnergy: allowNull(getBigInt), - }); - function formatBlock(value) { - const result = _formatBlock(value); - result.transactions = value.transactions.map((tx) => { - if (typeof tx === "string") { - return tx; - } - return formatTransactionResponse(tx); - }); - return result; - } - const _formatReceiptLog = object({ - transactionIndex: getNumber, - blockNumber: getNumber, - transactionHash: formatHash, - address: getAddress, - topics: arrayOf(formatHash), - data: formatData, - index: getNumber, - blockHash: formatHash, - }, { - index: ["logIndex"], - }); - function formatReceiptLog(value) { - return _formatReceiptLog(value); - } - const _formatTransactionReceipt = object({ - to: allowNull(getAddress, null), - from: allowNull(getAddress, null), - contractAddress: allowNull(getAddress, null), - // should be allowNull(hash), but broken-EIP-658 support is handled in receipt - index: getNumber, - root: allowNull(hexlify), - energyUsed: getBigInt, - logsBloom: allowNull(formatData), - blockHash: formatHash, - hash: formatHash, - logs: arrayOf(formatReceiptLog), - blockNumber: getNumber, - //confirmations: allowNull(getNumber, null), - cumulativeEnergyUsed: getBigInt, - effectiveEnergyPrice: allowNull(getBigInt), - status: allowNull(getNumber), - type: allowNull(getNumber, 0), - }, { - effectiveEnergyPrice: ["energyPrice"], - hash: ["transactionHash"], - index: ["transactionIndex"], - }); - function formatTransactionReceipt(value) { - return _formatTransactionReceipt(value); - } - function formatTransactionResponse(value) { - // Some clients (TestRPC) do strange things like return 0x0 for the - // 0 address; correct this to be a real address - if (value.to && !getAddress(value.to) && getBigInt(value.to) === BN_0) { - value.to = "0x0000000000000000000000000000000000000000"; - } - const result = object({ - hash: formatHash, - type: (value) => { - if (value === "0x" || value == null) { - return 0; - } - return getNumber(value); - }, - accessList: allowNull(accessListify, null), - blockHash: allowNull(formatHash, null), - blockNumber: allowNull(getNumber, null), - transactionIndex: allowNull(getNumber, null), - //confirmations: allowNull(getNumber, null), - from: getAddress, - maxFeePerEnergy: allowNull(getBigInt), - energyLimit: getBigInt, - to: allowNull(getAddress, null), - value: getBigInt, - nonce: getNumber, - data: formatData, - creates: allowNull(getAddress, null), - networkId: allowNull(getBigInt, null), - }, { - data: ["input"], - energyLimit: ["energy"], - })(value); - // If to and creates are empty, populate the creates from the value - if (result.to == null && result.creates == null) { - result.creates = getCreateAddress(result); - } - // Compute the signature - if (value.signature) { - result.signature = value.signature; - } - else { - result.signature = value; - } - // Some backends omit networkId on legacy transactions, but we can compute it - if (result.networkId == null) { - const networkId = result.signature.legacynetworkId; - if (networkId != null) { - result.networkId = networkId; - } - } - // @TODO: check networkId - /* - if (value.networkId != null) { - let networkId = value.networkId; - - if (isHexString(networkId)) { - networkId = BigNumber.from(networkId).toNumber(); - } - - result.networkId = networkId; - - } else { - let networkId = value.networkId; - - // geth-etc returns networkId - if (networkId == null && result.v == null) { - networkId = value.networkId; - } - - if (isHexString(networkId)) { - networkId = BigNumber.from(networkId).toNumber(); - } - - if (typeof(networkId) !== "number" && result.v != null) { - networkId = (result.v - 35) / 2; - if (networkId < 0) { networkId = 0; } - networkId = parseInt(networkId); - } - - if (typeof(networkId) !== "number") { networkId = 0; } - - result.networkId = networkId; - } - */ - // 0x0000... should actually be null - if (result.blockHash && getBigInt(result.blockHash) === BN_0) { - result.blockHash = null; - } - return result; - } - - class NetworkPlugin { - name; - constructor(name) { - defineProperties(this, { name }); - } - clone() { - return new NetworkPlugin(this.name); - } - } - class EnergyCostPlugin extends NetworkPlugin { - effectiveBlock; - txBase; - txCreate; - txDataZero; - txDataNonzero; - txAccessListStorageKey; - txAccessListAddress; - constructor(effectiveBlock, costs) { - if (effectiveBlock == null) { - effectiveBlock = 0; - } - super(`org.corebc.network.plugins.EnergyCost#${effectiveBlock || 0}`); - const props = { effectiveBlock }; - function set(name, nullish) { - let value = (costs || {})[name]; - if (value == null) { - value = nullish; - } - assertArgument(typeof value === "number", `invalud value for ${name}`, "costs", costs); - props[name] = value; - } - set("txBase", 21000); - set("txCreate", 32000); - set("txDataZero", 4); - set("txDataNonzero", 16); - set("txAccessListStorageKey", 1900); - set("txAccessListAddress", 2400); - defineProperties(this, props); - } - clone() { - return new EnergyCostPlugin(this.effectiveBlock, this); - } - } - class FeeDataNetworkPlugin extends NetworkPlugin { - #feeDataFunc; - get feeDataFunc() { - return this.#feeDataFunc; - } - constructor(feeDataFunc) { - super("org.corebc.plugins.network.FeeData"); - this.#feeDataFunc = feeDataFunc; - } - async getFeeData(provider) { - return await this.#feeDataFunc(provider); - } - clone() { - return new FeeDataNetworkPlugin(this.#feeDataFunc); - } - } - /* - export class CustomBlockNetworkPlugin extends NetworkPlugin { - readonly #blockFunc: (provider: Provider, block: BlockParams) => Block; - readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block; - - async getBlock(provider: Provider, block: BlockParams): Promise> { - return await this.#blockFunc(provider, block); - } - - async getBlockions(provider: Provider, block: BlockParams): Promise> { - return await this.#blockWithTxsFunc(provider, block); - } - - clone(): CustomBlockNetworkPlugin { - return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc); - } - } - */ - - /** - * About networks - * - * @_subsection: api/providers:Networks [networks] - */ - /* * * * - // Networks which operation against an L2 can use this plugin to - // specify how to access L1, for the purpose of resolving ENS, - // for example. - export class LayerOneConnectionPlugin extends NetworkPlugin { - readonly provider!: Provider; - */ - // Networks or clients with a higher need for security (such as clients - // that may automatically make CCIP requests without user interaction) - // can use this plugin to anonymize requests or intercept CCIP requests - // to notify and/or receive authorization from the user - const Networks = new Map(); - class Network { - #name; - #networkId; - #plugins; - constructor(name, networkId) { - this.#name = name; - this.#networkId = getBigInt(networkId); - this.#plugins = new Map(); - } - toJSON() { - return { name: this.name, networkId: String(this.networkId) }; - } - /** - * The network common name. - * - * This is the canonical name, as networks migh have multiple - * names. - */ - get name() { - return this.#name; - } - set name(value) { - this.#name = value; - } - /** - * The network chain ID. - */ - get networkId() { - return this.#networkId; - } - set networkId(value) { - this.#networkId = getBigInt(value, "networkId"); - } - /** - * Returns true if %%other%% matches this network. Any chain ID - * must match, and if no chain ID is present, the name must match. - * - * This method does not currently check for additional properties, - * such as ENS address or plug-in compatibility. - */ - matches(other) { - if (other == null) { - return false; - } - if (typeof other === "string") { - try { - return this.networkId === getBigInt(other); - } - catch (error) { } - return this.name === other; - } - if (typeof other === "number" || typeof other === "bigint") { - try { - return this.networkId === getBigInt(other); - } - catch (error) { } - return false; - } - if (typeof other === "object") { - if (other.networkId != null) { - try { - return this.networkId === getBigInt(other.networkId); - } - catch (error) { } - return false; - } - if (other.name != null) { - return this.name === other.name; - } - return false; - } - return false; - } - /** - * Returns the list of plugins currently attached to this Network. - */ - get plugins() { - return Array.from(this.#plugins.values()); - } - /** - * Attach a new %%plugin%% to this Network. The network name - * must be unique, excluding any fragment. - */ - attachPlugin(plugin) { - if (this.#plugins.get(plugin.name)) { - throw new Error(`cannot replace existing plugin: ${plugin.name} `); - } - this.#plugins.set(plugin.name, plugin.clone()); - return this; - } - /** - * Return the plugin, if any, matching %%name%% exactly. Plugins - * with fragments will not be returned unless %%name%% includes - * a fragment. - */ - getPlugin(name) { - return this.#plugins.get(name) || null; - } - /** - * Gets a list of all plugins that match %%name%%, with otr without - * a fragment. - */ - getPlugins(basename) { - return (this.plugins.filter((p) => p.name.split("#")[0] === basename)); - } - /** - * Create a copy of this Network. - */ - clone() { - const clone = new Network(this.name, this.networkId); - this.plugins.forEach((plugin) => { - clone.attachPlugin(plugin.clone()); - }); - return clone; - } - /** - * Compute the intrinsic energy required for a transaction. - * - * A EnergyCostPlugin can be attached to override the default - * values. - */ - computeIntrinsicEnergy(tx) { - const costs = this.getPlugin("org.corebc.plugins.network.EnergyCost") || new EnergyCostPlugin(); - let energy = costs.txBase; - if (tx.to == null) { - energy += costs.txCreate; - } - if (tx.data) { - for (let i = 2; i < tx.data.length; i += 2) { - if (tx.data.substring(i, i + 2) === "00") { - energy += costs.txDataZero; - } - else { - energy += costs.txDataNonzero; - } - } - } - return energy; - } - /** - * Returns a new Network for the %%network%% name or networkId. - */ - static from(network) { - injectCommonNetworks(); - // Default network - if (network == null) { - return Network.from("mainnet"); - } - // Canonical name or chain ID - if (typeof network === "number") { - network = BigInt(network); - } - if (typeof network === "string" || typeof network === "bigint") { - const networkFunc = Networks.get(network); - if (networkFunc) { - return networkFunc(); - } - if (typeof network === "bigint") { - return new Network("unknown", network); - } - assertArgument(false, "unknown network", "network", network); - } - // Clonable with network-like abilities - if (typeof network.clone === "function") { - const clone = network.clone(); - //if (typeof(network.name) !== "string" || typeof(network.networkId) !== "number") { - //} - return clone; - } - // Networkish - if (typeof network === "object") { - assertArgument(typeof network.name === "string" && - typeof network.networkId === "number", "invalid network object name or networkId", "network", network); - const custom = new Network(network.name, network.networkId); - //if ((network).layerOneConnection) { - // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection)); - //} - return custom; - } - assertArgument(false, "invalid network", "network", network); - } - /** - * Register %%nameOrnetworkId%% with a function which returns - * an instance of a Network representing that chain. - */ - static register(nameOrnetworkId, networkFunc) { - if (typeof nameOrnetworkId === "number") { - nameOrnetworkId = BigInt(nameOrnetworkId); - } - const existing = Networks.get(nameOrnetworkId); - if (existing) { - assertArgument(false, `conflicting network for ${JSON.stringify(existing.name)}`, "nameOrnetworkId", nameOrnetworkId); - } - Networks.set(nameOrnetworkId, networkFunc); - } - } - // See: https://chainlist.org - let injected = false; - function injectCommonNetworks() { - if (injected) { - return; - } - injected = true; - /// Register popular Core networks - function registerEth(name, networkId, options) { - const func = function () { - const network = new Network(name, networkId); - network.attachPlugin(new EnergyCostPlugin()); - return network; - }; - // Register the network by name and chain ID - Network.register(name, func); - Network.register(networkId, func); - if (options.altNames) { - options.altNames.forEach((name) => { - Network.register(name, func); - }); - } - } - registerEth("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] }); - registerEth("ropsten", 3, { ensNetwork: 3 }); - registerEth("rinkeby", 4, { ensNetwork: 4 }); - registerEth("goerli", 5, { ensNetwork: 5 }); - registerEth("kovan", 42, { ensNetwork: 42 }); - registerEth("sepolia", 11155111, {}); - registerEth("classic", 61, {}); - registerEth("classicKotti", 6, {}); - registerEth("xdai", 100, { ensNetwork: 1 }); - } - - function copy$2(obj) { - return JSON.parse(JSON.stringify(obj)); - } - // @TODO: refactor this - /** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ - class PollingBlockSubscriber { - #provider; - #poller; - #interval; - // The most recent block we have scanned for events. The value -2 - // indicates we still need to fetch an initial block number - #blockNumber; - constructor(provider) { - this.#provider = provider; - this.#poller = null; - this.#interval = 4000; - this.#blockNumber = -2; - } - get pollingInterval() { - return this.#interval; - } - set pollingInterval(value) { - this.#interval = value; - } - async #poll() { - try { - const blockNumber = await this.#provider.getBlockNumber(); - // Bootstrap poll to setup our initial block number - if (this.#blockNumber === -2) { - this.#blockNumber = blockNumber; - return; - } - // @TODO: Put a cap on the maximum number of events per loop? - if (blockNumber !== this.#blockNumber) { - for (let b = this.#blockNumber + 1; b <= blockNumber; b++) { - // We have been stopped - if (this.#poller == null) { - return; - } - await this.#provider.emit("block", b); - } - this.#blockNumber = blockNumber; - } - } - catch (error) { - // @TODO: Minor bump, add an "error" event to let subscribers - // know things went awry. - //console.log(error); - } - // We have been stopped - if (this.#poller == null) { - return; - } - this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); - } - start() { - if (this.#poller) { - return; - } - this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); - this.#poll(); - } - stop() { - if (!this.#poller) { - return; - } - this.#provider._clearTimeout(this.#poller); - this.#poller = null; - } - pause(dropWhilePaused) { - this.stop(); - if (dropWhilePaused) { - this.#blockNumber = -2; - } - } - resume() { - this.start(); - } - } - /** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ - class OnBlockSubscriber { - #provider; - #poll; - #running; - constructor(provider) { - this.#provider = provider; - this.#running = false; - this.#poll = (blockNumber) => { - this._poll(blockNumber, this.#provider); - }; - } - async _poll(blockNumber, provider) { - throw new Error("sub-classes must override this"); - } - start() { - if (this.#running) { - return; - } - this.#running = true; - this.#poll(-2); - this.#provider.on("block", this.#poll); - } - stop() { - if (!this.#running) { - return; - } - this.#running = false; - this.#provider.off("block", this.#poll); - } - pause(dropWhilePaused) { - this.stop(); - } - resume() { - this.start(); - } - } - /** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ - class PollingOrphanSubscriber extends OnBlockSubscriber { - #filter; - constructor(provider, filter) { - super(provider); - this.#filter = copy$2(filter); - } - async _poll(blockNumber, provider) { - throw new Error("@TODO"); - } - } - /** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ - class PollingTransactionSubscriber extends OnBlockSubscriber { - #hash; - constructor(provider, hash) { - super(provider); - this.#hash = hash; - } - async _poll(blockNumber, provider) { - const tx = await provider.getTransactionReceipt(this.#hash); - if (tx) { - provider.emit(this.#hash, tx); - } - } - } - /** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ - class PollingEventSubscriber { - #provider; - #filter; - #poller; - #running; - // The most recent block we have scanned for events. The value -2 - // indicates we still need to fetch an initial block number - #blockNumber; - constructor(provider, filter) { - this.#provider = provider; - this.#filter = copy$2(filter); - this.#poller = this.#poll.bind(this); - this.#running = false; - this.#blockNumber = -2; - } - async #poll(blockNumber) { - // The initial block hasn't been determined yet - if (this.#blockNumber === -2) { - return; - } - const filter = copy$2(this.#filter); - filter.fromBlock = this.#blockNumber + 1; - filter.toBlock = blockNumber; - const logs = await this.#provider.getLogs(filter); - // No logs could just mean the node has not indexed them yet, - // so we keep a sliding window of 60 blocks to keep scanning - if (logs.length === 0) { - if (this.#blockNumber < blockNumber - 60) { - this.#blockNumber = blockNumber - 60; - } - return; - } - this.#blockNumber = blockNumber; - for (const log of logs) { - this.#provider.emit(this.#filter, log); - } - } - start() { - if (this.#running) { - return; - } - this.#running = true; - if (this.#blockNumber === -2) { - this.#provider.getBlockNumber().then((blockNumber) => { - this.#blockNumber = blockNumber; - }); - } - this.#provider.on("block", this.#poller); - } - stop() { - if (!this.#running) { - return; - } - this.#running = false; - this.#provider.off("block", this.#poller); - } - pause(dropWhilePaused) { - this.stop(); - if (dropWhilePaused) { - this.#blockNumber = -2; - } - } - resume() { - this.start(); - } - } - - /** - * About Subclassing the Provider... - * - * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] - */ - // @TODO - // Event coalescence - // When we register an event with an async value (e.g. address is a Signer - // or ENS name), we need to add it immeidately for the Event API, but also - // need time to resolve the address. Upon resolving the address, we need to - // migrate the listener to the static event. We also need to maintain a map - // of Signer/ENS name to address so we can sync respond to listenerCount. - const MAX_CCIP_REDIRECTS = 10; - function isPromise(value) { - return value && typeof value.then === "function"; - } - function getTag(prefix, value) { - return (prefix + - ":" + - JSON.stringify(value, (k, v) => { - if (v == null) { - return "null"; - } - if (typeof v === "bigint") { - return `bigint:${v.toString()}`; - } - if (typeof v === "string") { - return v.toLowerCase(); - } - // Sort object keys - if (typeof v === "object" && !Array.isArray(v)) { - const keys = Object.keys(v); - keys.sort(); - return keys.reduce((accum, key) => { - accum[key] = v[key]; - return accum; - }, {}); - } - return v; - })); - } - class UnmanagedSubscriber { - name; - constructor(name) { - defineProperties(this, { name }); - } - start() { } - stop() { } - pause(dropWhilePaused) { } - resume() { } - } - function copy$1(value) { - return JSON.parse(JSON.stringify(value)); - } - function concisify(items) { - items = Array.from(new Set(items).values()); - items.sort(); - return items; - } - async function getSubscription(_event, provider) { - if (_event == null) { - throw new Error("invalid event"); - } - // Normalize topic array info an EventFilter - if (Array.isArray(_event)) { - _event = { topics: _event }; - } - if (typeof _event === "string") { - switch (_event) { - case "block": - case "pending": - case "debug": - case "error": - case "network": { - return { type: _event, tag: _event }; - } - } - } - if (isHexString(_event, 32)) { - const hash = _event.toLowerCase(); - return { type: "transaction", tag: getTag("tx", { hash }), hash }; - } - if (_event.orphan) { - const event = _event; - // @TODO: Should lowercase and whatnot things here instead of copy... - return { - type: "orphan", - tag: getTag("orphan", event), - filter: copy$1(event), - }; - } - if (_event.address || _event.topics) { - const event = _event; - const filter = { - topics: (event.topics || []).map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - return concisify(t.map((t) => t.toLowerCase())); - } - return t.toLowerCase(); - }), - }; - if (event.address) { - const addresses = []; - const promises = []; - const addAddress = (addr) => { - if (isHexString(addr)) { - addresses.push(addr); - } - else { - promises.push((async () => { - addresses.push(await resolveAddress(addr)); - })()); - } - }; - if (Array.isArray(event.address)) { - event.address.forEach(addAddress); - } - else { - addAddress(event.address); - } - if (promises.length) { - await Promise.all(promises); - } - filter.address = concisify(addresses.map((a) => a.toLowerCase())); - } - return { filter, tag: getTag("event", filter), type: "event" }; - } - assertArgument(false, "unknown ProviderEvent", "event", _event); - } - function getTime$1() { - return new Date().getTime(); - } - class AbstractProvider { - #subs; - #plugins; - // null=unpaused, true=paused+dropWhilePaused, false=paused - #pausedState; - #networkPromise; - #anyNetwork; - #performCache; - // The most recent block number if running an event or -1 if no "block" event - #lastBlockNumber; - #nextTimer; - #timers; - #disableCcipRead; - // @TODO: This should be a () => Promise so network can be - // done when needed; or rely entirely on _detectNetwork? - constructor(_network) { - if (_network === "any") { - this.#anyNetwork = true; - this.#networkPromise = null; - } - else if (_network) { - const network = Network.from(_network); - this.#anyNetwork = false; - this.#networkPromise = Promise.resolve(network); - setTimeout(() => { - this.emit("network", network, null); - }, 0); - } - else { - this.#anyNetwork = false; - this.#networkPromise = null; - } - this.#lastBlockNumber = -1; - this.#performCache = new Map(); - this.#subs = new Map(); - this.#plugins = new Map(); - this.#pausedState = null; - this.#nextTimer = 1; - this.#timers = new Map(); - this.#disableCcipRead = false; - } - get provider() { - return this; - } - get plugins() { - return Array.from(this.#plugins.values()); - } - attachPlugin(plugin) { - if (this.#plugins.get(plugin.name)) { - throw new Error(`cannot replace existing plugin: ${plugin.name} `); - } - this.#plugins.set(plugin.name, plugin.connect(this)); - return this; - } - getPlugin(name) { - return this.#plugins.get(name) || null; - } - get disableCcipRead() { - return this.#disableCcipRead; - } - set disableCcipRead(value) { - this.#disableCcipRead = !!value; - } - // Shares multiple identical requests made during the same 250ms - async #perform(req) { - // Create a tag - const tag = getTag(req.method, req); - let perform = this.#performCache.get(tag); - if (!perform) { - perform = this._perform(req); - this.#performCache.set(tag, perform); - setTimeout(() => { - if (this.#performCache.get(tag) === perform) { - this.#performCache.delete(tag); - } - }, 250); - } - return await perform; - } - async ccipReadFetch(tx, calldata, urls) { - if (this.disableCcipRead || urls.length === 0 || tx.to == null) { - return null; - } - const sender = tx.to.toLowerCase(); - const data = calldata.toLowerCase(); - const errorMessages = []; - for (let i = 0; i < urls.length; i++) { - const url = urls[i]; - // URL expansion - const href = url.replace("{sender}", sender).replace("{data}", data); - // If no {data} is present, use POST; otherwise GET - //const json: string | null = (url.indexOf("{data}") >= 0) ? null: JSON.stringify({ data, sender }); - //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { - // value.status = response.statusCode; - // return value; - //}); - const request = new FetchRequest(href); - if (url.indexOf("{data}") === -1) { - request.body = { data, sender }; - } - this.emit("debug", { - action: "sendCcipReadFetchRequest", - request, - index: i, - urls, - }); - let errorMessage = "unknown error"; - const resp = await request.send(); - try { - const result = resp.bodyJson; - if (result.data) { - this.emit("debug", { - action: "receiveCcipReadFetchResult", - request, - result, - }); - return result.data; - } - if (result.message) { - errorMessage = result.message; - } - this.emit("debug", { - action: "receiveCcipReadFetchError", - request, - result, - }); - } - catch (error) { } - // 4xx indicates the result is not present; stop - assert(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, "OFFCHAIN_FAULT", { - reason: "404_MISSING_RESOURCE", - transaction: tx, - info: { url, errorMessage }, - }); - // 5xx indicates server issue; try the next url - errorMessages.push(errorMessage); - } - assert(false, `error encountered during CCIP fetch: ${errorMessages - .map((m) => JSON.stringify(m)) - .join(", ")}`, "OFFCHAIN_FAULT", { - reason: "500_SERVER_ERROR", - transaction: tx, - info: { urls, errorMessages }, - }); - } - _wrapBlock(value, network) { - return new Block(formatBlock(value), this); - } - _wrapLog(value, network) { - return new Log(formatLog(value), this); - } - _wrapTransactionReceipt(value, network) { - return new TransactionReceipt(formatTransactionReceipt(value), this); - } - _wrapTransactionResponse(tx, network) { - return new TransactionResponse(formatTransactionResponse(tx), this); - } - _detectNetwork() { - assert(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", { - operation: "_detectNetwork", - }); - } - // Sub-classes should override this and handle PerformActionRequest requests, calling - // the super for any unhandled actions. - async _perform(req) { - assert(false, `unsupported method: ${req.method}`, "UNSUPPORTED_OPERATION", { - operation: req.method, - info: req, - }); - } - // State - async getBlockNumber() { - const blockNumber = getNumber(await this.#perform({ method: "getBlockNumber" }), "%response"); - if (this.#lastBlockNumber >= 0) { - this.#lastBlockNumber = blockNumber; - } - return blockNumber; - } - _getAddress(address) { - return resolveAddress(address); - } - _getBlockTag(blockTag) { - if (blockTag == null) { - return "latest"; - } - switch (blockTag) { - case "earliest": - return "0x0"; - case "latest": - case "pending": - case "safe": - case "finalized": - return blockTag; - } - if (isHexString(blockTag)) { - if (isHexString(blockTag, 32)) { - return blockTag; - } - return toQuantity(blockTag); - } - if (typeof blockTag === "bigint") { - blockTag = getNumber(blockTag, "blockTag"); - } - if (typeof blockTag === "number") { - if (blockTag >= 0) { - return toQuantity(blockTag); - } - if (this.#lastBlockNumber >= 0) { - return toQuantity(this.#lastBlockNumber + blockTag); - } - return this.getBlockNumber().then((b) => toQuantity(b + blockTag)); - } - assertArgument(false, "invalid blockTag", "blockTag", blockTag); - } - _getFilter(filter) { - // Create a canonical representation of the topics - const topics = (filter.topics || []).map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - return concisify(t.map((t) => t.toLowerCase())); - } - return t.toLowerCase(); - }); - const blockHash = "blockHash" in filter ? filter.blockHash : undefined; - const resolve = (_address, fromBlock, toBlock) => { - let address = undefined; - switch (_address.length) { - case 0: - break; - case 1: - address = _address[0]; - break; - default: - _address.sort(); - address = _address; - } - if (blockHash) { - if (fromBlock != null || toBlock != null) { - throw new Error("invalid filter"); - } - } - const filter = {}; - if (address) { - filter.address = address; - } - if (topics.length) { - filter.topics = topics; - } - if (fromBlock) { - filter.fromBlock = fromBlock; - } - if (toBlock) { - filter.toBlock = toBlock; - } - if (blockHash) { - filter.blockHash = blockHash; - } - return filter; - }; - // Addresses could be async (ENS names or Addressables) - let address = []; - if (filter.address) { - if (Array.isArray(filter.address)) { - for (const addr of filter.address) { - address.push(this._getAddress(addr)); - } - } - else { - address.push(this._getAddress(filter.address)); - } - } - let fromBlock = undefined; - if ("fromBlock" in filter) { - fromBlock = this._getBlockTag(filter.fromBlock); - } - let toBlock = undefined; - if ("toBlock" in filter) { - toBlock = this._getBlockTag(filter.toBlock); - } - if (address.filter((a) => typeof a !== "string").length || - (fromBlock != null && typeof fromBlock !== "string") || - (toBlock != null && typeof toBlock !== "string")) { - return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result) => { - return resolve(result[0], result[1], result[2]); - }); - } - return resolve(address, fromBlock, toBlock); - } - _getTransactionRequest(_request) { - const request = copyRequest(_request); - const promises = []; - ["to", "from"].forEach((key) => { - if (request[key] == null) { - return; - } - const addr = resolveAddress(request[key]); - if (isPromise(addr)) { - promises.push((async function () { - request[key] = await addr; - })()); - } - else { - request[key] = addr; - } - }); - if (request.blockTag != null) { - const blockTag = this._getBlockTag(request.blockTag); - if (isPromise(blockTag)) { - promises.push((async function () { - request.blockTag = await blockTag; - })()); - } - else { - request.blockTag = blockTag; - } - } - if (promises.length) { - return (async function () { - await Promise.all(promises); - return request; - })(); - } - return request; - } - async getNetwork() { - // No explicit network was set and this is our first time - if (this.#networkPromise == null) { - // Detect the current network (shared with all calls) - const detectNetwork = this._detectNetwork().then((network) => { - this.emit("network", network, null); - return network; - }, (error) => { - // Reset the networkPromise on failure, so we will try again - if (this.#networkPromise === detectNetwork) { - this.#networkPromise = null; - } - throw error; - }); - this.#networkPromise = detectNetwork; - return (await detectNetwork).clone(); - } - const networkPromise = this.#networkPromise; - const [expected, actual] = await Promise.all([ - networkPromise, - this._detectNetwork(), // The actual connected network - ]); - if (expected.networkId !== actual.networkId) { - if (this.#anyNetwork) { - // The "any" network can change, so notify listeners - this.emit("network", actual, expected); - // Update the network if something else hasn't already changed it - if (this.#networkPromise === networkPromise) { - this.#networkPromise = Promise.resolve(actual); - } - } - else { - // Otherwise, we do not allow changes to the underlying network - assert(false, `network changed: ${expected.networkId} => ${actual.networkId} `, "NETWORK_ERROR", { - event: "changed", - }); - } - } - return expected.clone(); - } - async getEnergyPrice() { - const { energyPrice } = await resolveProperties({ - block: this.getBlock("latest"), - energyPrice: (async () => { - try { - const energyPrice = await this.#perform({ method: "getEnergyPrice" }); - return getBigInt(energyPrice, "%response"); - } - catch (error) { } - return null; - })(), - }); - return new FeeData(energyPrice); - } - async getFeeData() { - const { energyPrice } = await resolveProperties({ - block: this.getBlock("latest"), - energyPrice: (async () => { - try { - const energyPrice = await this.#perform({ method: "getEnergyPrice" }); - return getBigInt(energyPrice, "%response"); - } - catch (error) { } - return null; - })(), - }); - return new FeeData(energyPrice); - } - async estimateEnergy(_tx) { - let tx = this._getTransactionRequest(_tx); - if (isPromise(tx)) { - tx = await tx; - } - return getBigInt(await this.#perform({ - method: "estimateEnergy", - transaction: tx, - }), "%response"); - } - async #call(tx, blockTag, attempt) { - assert(attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", { - reason: "TOO_MANY_REDIRECTS", - transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }), - }); - // This came in as a PerformActionTransaction, so to/from are safe; we can cast - const transaction = copyRequest(tx); - try { - return hexlify(await this._perform({ method: "call", transaction, blockTag })); - } - catch (error) { - // CCIP Read OffchainLookup - if (!this.disableCcipRead && - isCallException(error) && - error.data && - attempt >= 0 && - blockTag === "latest" && - transaction.to != null && - dataSlice(error.data, 0, 4) === "0x556f1830") { - const data = error.data; - const txSender = await resolveAddress(transaction.to); - // Parse the CCIP Read Arguments - let ccipArgs; - try { - ccipArgs = parseOffchainLookup(dataSlice(error.data, 4)); - } - catch (error) { - assert(false, error.message, "OFFCHAIN_FAULT", { - reason: "BAD_DATA", - transaction, - info: { data }, - }); - } - // Check the sender of the OffchainLookup matches the transaction - assert(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), "CCIP Read sender mismatch", "CALL_EXCEPTION", { - action: "call", - data, - reason: "OffchainLookup", - transaction: transaction, - invocation: null, - revert: { - signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", - name: "OffchainLookup", - args: ccipArgs.errorArgs, - }, - }); - const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls); - assert(ccipResult != null, "CCIP Read failed to fetch data", "OFFCHAIN_FAULT", { - reason: "FETCH_FAILED", - transaction, - info: { data: error.data, errorArgs: ccipArgs.errorArgs }, - }); - const tx = { - to: txSender, - data: concat([ - ccipArgs.selector, - encodeBytes([ccipResult, ccipArgs.extraData]), - ]), - }; - this.emit("debug", { action: "sendCcipReadCall", transaction: tx }); - try { - const result = await this.#call(tx, blockTag, attempt + 1); - this.emit("debug", { - action: "receiveCcipReadCallResult", - transaction: Object.assign({}, tx), - result, - }); - return result; - } - catch (error) { - this.emit("debug", { - action: "receiveCcipReadCallError", - transaction: Object.assign({}, tx), - error, - }); - throw error; - } - } - throw error; - } - } - async #checkNetwork(promise) { - const { value } = await resolveProperties({ - network: this.getNetwork(), - value: promise, - }); - return value; - } - async call(_tx) { - const { tx, blockTag } = await resolveProperties({ - tx: this._getTransactionRequest(_tx), - blockTag: this._getBlockTag(_tx.blockTag), - }); - return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1)); - } - // Account - async #getAccountValue(request, _address, _blockTag) { - let address = this._getAddress(_address); - let blockTag = this._getBlockTag(_blockTag); - if (typeof address !== "string" || typeof blockTag !== "string") { - [address, blockTag] = await Promise.all([address, blockTag]); - } - return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag }))); - } - async getBalance(address, blockTag) { - return getBigInt(await this.#getAccountValue({ method: "getBalance" }, address, blockTag), "%response"); - } - async getTransactionCount(address, blockTag) { - return getNumber(await this.#getAccountValue({ method: "getTransactionCount" }, address, blockTag), "%response"); - } - async getCode(address, blockTag) { - return hexlify(await this.#getAccountValue({ method: "getCode" }, address, blockTag)); - } - async getStorage(address, _position, blockTag) { - const position = getBigInt(_position, "position"); - return hexlify(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag)); - } - // Write - async broadcastTransaction(signedTx) { - const { blockNumber, hash, network } = await resolveProperties({ - blockNumber: this.getBlockNumber(), - hash: this._perform({ - method: "broadcastTransaction", - signedTransaction: signedTx, - }), - network: this.getNetwork(), - }); - const tx = Transaction.from(signedTx); - if (tx.hash !== hash) { - throw new Error("@TODO: the returned hash did not match"); - } - return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber); - } - async #getBlock(block, includeTransactions) { - // @TODO: Add CustomBlockPlugin check - if (isHexString(block, 32)) { - return await this.#perform({ - method: "getBlock", - blockHash: block, - includeTransactions, - }); - } - let blockTag = this._getBlockTag(block); - if (typeof blockTag !== "string") { - blockTag = await blockTag; - } - return await this.#perform({ - method: "getBlock", - blockTag, - includeTransactions, - }); - } - // Queries - async getBlock(block, prefetchTxs) { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#getBlock(block, !!prefetchTxs), - }); - if (params == null) { - return null; - } - return this._wrapBlock(params, network); - } - async getTransaction(hash) { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#perform({ method: "getTransaction", hash }), - }); - if (params == null) { - return null; - } - return this._wrapTransactionResponse(params, network); - } - async getTransactionReceipt(hash) { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#perform({ method: "getTransactionReceipt", hash }), - }); - if (params == null) { - return null; - } - // Some backends did not backfill the effectiveEnergyPrice into old transactions - // in the receipt, so we look it up manually and inject it. - if (params.energyPrice == null && params.effectiveEnergyPrice == null) { - const tx = await this.#perform({ method: "getTransaction", hash }); - if (tx == null) { - throw new Error("report this; could not find tx or effectiveEnergyPrice"); - } - params.effectiveEnergyPrice = tx.energyPrice; - } - return this._wrapTransactionReceipt(params, network); - } - async getTransactionResult(hash) { - const { result } = await resolveProperties({ - network: this.getNetwork(), - result: this.#perform({ method: "getTransactionResult", hash }), - }); - if (result == null) { - return null; - } - return hexlify(result); - } - // Bloom-filter Queries - async getLogs(_filter) { - let filter = this._getFilter(_filter); - if (isPromise(filter)) { - filter = await filter; - } - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#perform({ method: "getLogs", filter }), - }); - return params.map((p) => this._wrapLog(p, network)); - } - // ENS - _getProvider(networkId) { - assert(false, "provider cannot connect to target network", "UNSUPPORTED_OPERATION", { - operation: "_getProvider()", - }); - } - async waitForTransaction(hash, _confirms, timeout) { - const confirms = _confirms != null ? _confirms : 1; - if (confirms === 0) { - return this.getTransactionReceipt(hash); - } - return new Promise(async (resolve, reject) => { - let timer = null; - const listener = async (blockNumber) => { - try { - const receipt = await this.getTransactionReceipt(hash); - if (receipt != null) { - if (blockNumber - receipt.blockNumber + 1 >= confirms) { - resolve(receipt); - //this.off("block", listener); - if (timer) { - clearTimeout(timer); - timer = null; - } - return; - } - } - } - catch (error) { - console.log("EEE", error); - } - this.once("block", listener); - }; - if (timeout != null) { - timer = setTimeout(() => { - if (timer == null) { - return; - } - timer = null; - this.off("block", listener); - reject(makeError("timeout", "TIMEOUT", { reason: "timeout" })); - }, timeout); - } - listener(await this.getBlockNumber()); - }); - } - async waitForBlock(blockTag) { - assert(false, "not implemented yet", "NOT_IMPLEMENTED", { - operation: "waitForBlock", - }); - } - _clearTimeout(timerId) { - const timer = this.#timers.get(timerId); - if (!timer) { - return; - } - if (timer.timer) { - clearTimeout(timer.timer); - } - this.#timers.delete(timerId); - } - _setTimeout(_func, timeout) { - if (timeout == null) { - timeout = 0; - } - const timerId = this.#nextTimer++; - const func = () => { - this.#timers.delete(timerId); - _func(); - }; - if (this.paused) { - this.#timers.set(timerId, { timer: null, func, time: timeout }); - } - else { - const timer = setTimeout(func, timeout); - this.#timers.set(timerId, { timer, func, time: getTime$1() }); - } - return timerId; - } - _forEachSubscriber(func) { - for (const sub of this.#subs.values()) { - func(sub.subscriber); - } - } - // Event API; sub-classes should override this; any supported - // event filter will have been munged into an EventFilter - _getSubscriber(sub) { - switch (sub.type) { - case "debug": - case "error": - case "network": - return new UnmanagedSubscriber(sub.type); - case "block": - return new PollingBlockSubscriber(this); - case "event": - return new PollingEventSubscriber(this, sub.filter); - case "transaction": - return new PollingTransactionSubscriber(this, sub.hash); - case "orphan": - return new PollingOrphanSubscriber(this, sub.filter); - } - throw new Error(`unsupported event: ${sub.type}`); - } - _recoverSubscriber(oldSub, newSub) { - for (const sub of this.#subs.values()) { - if (sub.subscriber === oldSub) { - if (sub.started) { - sub.subscriber.stop(); - } - sub.subscriber = newSub; - if (sub.started) { - newSub.start(); - } - if (this.#pausedState != null) { - newSub.pause(this.#pausedState); - } - break; - } - } - } - async #hasSub(event, emitArgs) { - let sub = await getSubscription(event); - // This is a log that is removing an existing log; we actually want - // to emit an orphan event for the removed log - if (sub.type === "event" && - emitArgs && - emitArgs.length > 0 && - emitArgs[0].removed === true) { - sub = await getSubscription({ orphan: "drop-log", log: emitArgs[0] }); - } - return this.#subs.get(sub.tag) || null; - } - async #getSub(event) { - const subscription = await getSubscription(event); - // Prevent tampering with our tag in any subclass' _getSubscriber - const tag = subscription.tag; - let sub = this.#subs.get(tag); - if (!sub) { - const subscriber = this._getSubscriber(subscription); - const addressableMap = new WeakMap(); - const nameMap = new Map(); - sub = { - subscriber, - tag, - addressableMap, - nameMap, - started: false, - listeners: [], - }; - this.#subs.set(tag, sub); - } - return sub; - } - async on(event, listener) { - const sub = await this.#getSub(event); - sub.listeners.push({ listener, once: false }); - if (!sub.started) { - sub.subscriber.start(); - sub.started = true; - if (this.#pausedState != null) { - sub.subscriber.pause(this.#pausedState); - } - } - return this; - } - async once(event, listener) { - const sub = await this.#getSub(event); - sub.listeners.push({ listener, once: true }); - if (!sub.started) { - sub.subscriber.start(); - sub.started = true; - if (this.#pausedState != null) { - sub.subscriber.pause(this.#pausedState); - } - } - return this; - } - async emit(event, ...args) { - const sub = await this.#hasSub(event, args); - // If there is not subscription or if a recent emit removed - // the last of them (which also deleted the sub) do nothing - if (!sub || sub.listeners.length === 0) { - return false; - } - const count = sub.listeners.length; - sub.listeners = sub.listeners.filter(({ listener, once }) => { - const payload = new EventPayload(this, once ? null : listener, event); - try { - listener.call(this, ...args, payload); - } - catch (error) { } - return !once; - }); - if (sub.listeners.length === 0) { - if (sub.started) { - sub.subscriber.stop(); - } - this.#subs.delete(sub.tag); - } - return count > 0; - } - async listenerCount(event) { - if (event) { - const sub = await this.#hasSub(event); - if (!sub) { - return 0; - } - return sub.listeners.length; - } - let total = 0; - for (const { listeners } of this.#subs.values()) { - total += listeners.length; - } - return total; - } - async listeners(event) { - if (event) { - const sub = await this.#hasSub(event); - if (!sub) { - return []; - } - return sub.listeners.map(({ listener }) => listener); - } - let result = []; - for (const { listeners } of this.#subs.values()) { - result = result.concat(listeners.map(({ listener }) => listener)); - } - return result; - } - async off(event, listener) { - const sub = await this.#hasSub(event); - if (!sub) { - return this; - } - if (listener) { - const index = sub.listeners - .map(({ listener }) => listener) - .indexOf(listener); - if (index >= 0) { - sub.listeners.splice(index, 1); - } - } - if (!listener || sub.listeners.length === 0) { - if (sub.started) { - sub.subscriber.stop(); - } - this.#subs.delete(sub.tag); - } - return this; - } - async removeAllListeners(event) { - if (event) { - const { tag, started, subscriber } = await this.#getSub(event); - if (started) { - subscriber.stop(); - } - this.#subs.delete(tag); - } - else { - for (const [tag, { started, subscriber }] of this.#subs) { - if (started) { - subscriber.stop(); - } - this.#subs.delete(tag); - } - } - return this; - } - // Alias for "on" - async addListener(event, listener) { - return await this.on(event, listener); - } - // Alias for "off" - async removeListener(event, listener) { - return this.off(event, listener); - } - // Sub-classes should override this to shutdown any sockets, etc. - // but MUST call this super.shutdown. - destroy() { - // Stop all listeners - this.removeAllListeners(); - // Shut down all tiemrs - for (const timerId of this.#timers.keys()) { - this._clearTimeout(timerId); - } - } - get paused() { - return this.#pausedState != null; - } - set paused(pause) { - if (!!pause === this.paused) { - return; - } - if (this.paused) { - this.resume(); - } - else { - this.pause(false); - } - } - pause(dropWhilePaused) { - this.#lastBlockNumber = -1; - if (this.#pausedState != null) { - if (this.#pausedState == !!dropWhilePaused) { - return; - } - assert(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", { - operation: "pause", - }); - } - this._forEachSubscriber((s) => s.pause(dropWhilePaused)); - this.#pausedState = !!dropWhilePaused; - for (const timer of this.#timers.values()) { - // Clear the timer - if (timer.timer) { - clearTimeout(timer.timer); - } - // Remaining time needed for when we become unpaused - timer.time = getTime$1() - timer.time; - } - } - resume() { - if (this.#pausedState == null) { - return; - } - this._forEachSubscriber((s) => s.resume()); - this.#pausedState = null; - for (const timer of this.#timers.values()) { - // Remaining time when we were paused - let timeout = timer.time; - if (timeout < 0) { - timeout = 0; - } - // Start time (in cause paused, so we con compute remaininf time) - timer.time = getTime$1(); - // Start the timer - setTimeout(timer.func, timeout); - } - } - } - function _parseString(result, start) { - try { - const bytes = _parseBytes(result, start); - if (bytes) { - return toUtf8String(bytes); - } - } - catch (error) { } - return null; - } - function _parseBytes(result, start) { - if (result === "0x") { - return null; - } - try { - const offset = getNumber(dataSlice(result, start, start + 32)); - const length = getNumber(dataSlice(result, offset, offset + 32)); - return dataSlice(result, offset + 32, offset + 32 + length); - } - catch (error) { } - return null; - } - function numPad(value) { - const result = toBeArray(value); - if (result.length > 32) { - throw new Error("internal; should not happen"); - } - const padded = new Uint8Array(32); - padded.set(result, 32 - result.length); - return padded; - } - function bytesPad(value) { - if (value.length % 32 === 0) { - return value; - } - const result = new Uint8Array(Math.ceil(value.length / 32) * 32); - result.set(value); - return result; - } - const empty = new Uint8Array([]); - // ABI Encodes a series of (bytes, bytes, ...) - function encodeBytes(datas) { - const result = []; - let byteCount = 0; - // Add place-holders for pointers as we add items - for (let i = 0; i < datas.length; i++) { - result.push(empty); - byteCount += 32; - } - for (let i = 0; i < datas.length; i++) { - const data = getBytes(datas[i]); - // Update the bytes offset - result[i] = numPad(byteCount); - // The length and padded value of data - result.push(numPad(data.length)); - result.push(bytesPad(data)); - byteCount += 32 + Math.ceil(data.length / 32) * 32; - } - return concat(result); - } - const zeros = "0x0000000000000000000000000000000000000000000000000000000000000000"; - function parseOffchainLookup(data) { - const result = { - sender: "", - urls: [], - calldata: "", - selector: "", - extraData: "", - errorArgs: [], - }; - assert(dataLength(data) >= 5 * 32, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", { - reason: "insufficient OffchainLookup data", - }); - const sender = dataSlice(data, 0, 32); - assert(dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup sender", - }); - result.sender = dataSlice(sender, 12); - // Read the URLs from the response - try { - const urls = []; - const urlsOffset = getNumber(dataSlice(data, 32, 64)); - const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32)); - const urlsData = dataSlice(data, urlsOffset + 32); - for (let u = 0; u < urlsLength; u++) { - const url = _parseString(urlsData, u * 32); - if (url == null) { - throw new Error("abort"); - } - urls.push(url); - } - result.urls = urls; - } - catch (error) { - assert(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup urls", - }); - } - // Get the CCIP calldata to forward - try { - const calldata = _parseBytes(data, 64); - if (calldata == null) { - throw new Error("abort"); - } - result.calldata = calldata; - } - catch (error) { - assert(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup calldata", - }); - } - // Get the callbackSelector (bytes4) - assert(dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup callbaackSelector", - }); - result.selector = dataSlice(data, 96, 100); - // Get the extra data to send back to the contract as context - try { - const extraData = _parseBytes(data, 128); - if (extraData == null) { - throw new Error("abort"); - } - result.extraData = extraData; - } - catch (error) { - assert(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup extraData", - }); - } - result.errorArgs = "sender,urls,calldata,selector,extraData" - .split(/,/) - .map((k) => result[k]); - return result; - } - - /** - * About Abstract Signer and subclassing - * - * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer] - */ - function checkProvider(signer, operation) { - if (signer.provider) { - return signer.provider; - } - assert(false, "missing provider", "UNSUPPORTED_OPERATION", { operation }); - } - async function populate(signer, tx) { - let pop = copyRequest(tx); - if (pop.to != null) { - pop.to = resolveAddress(pop.to); - } - if (pop.from != null) { - const from = pop.from; - pop.from = Promise.all([signer.getAddress(), resolveAddress(from)]).then(([address, from]) => { - assertArgument(address.toLowerCase() === from.toLowerCase(), "transaction from mismatch", "tx.from", from); - return address; - }); - } - else { - pop.from = signer.getAddress(); - } - return await resolveProperties(pop); - } - class AbstractSigner { - provider; - constructor(provider) { - defineProperties(this, { provider: provider || null }); - } - async getNonce(blockTag) { - return checkProvider(this, "getTransactionCount").getTransactionCount(await this.getAddress(), blockTag); - } - async populateCall(tx) { - const pop = await populate(this, tx); - return pop; - } - async populateTransaction(tx) { - const provider = checkProvider(this, "populateTransaction"); - const pop = await populate(this, tx); - if (pop.nonce == null) { - pop.nonce = await this.getNonce("pending"); - } - if (pop.energyLimit == null) { - pop.energyLimit = await this.estimateEnergy(pop); - } - // Populate the chain ID - const network = await this.provider.getNetwork(); - if (pop.networkId != null) { - const networkId = getBigInt(pop.networkId); - assertArgument(networkId === network.networkId, "transaction networkId mismatch", "tx.networkId", tx.networkId); - } - else { - pop.networkId = network.networkId; - } - // We need to get fee data to determine things - const feeData = await provider.getFeeData(); - // We need to auto-detect the intended type of this transaction... - if (feeData.energyPrice != null) { - // Network doesn't support EIP-1559... - // Populate missing fee data - if (pop.energyPrice == null) { - pop.energyPrice = feeData.energyPrice; - } - } - else { - // getFeeData has failed us. - assert(false, "failed to get consistent fee data", "UNSUPPORTED_OPERATION", { - operation: "signer.getFeeData", - }); - } - //@TOOD: Don't await all over the place; save them up for - // the end for better batching - return await resolveProperties(pop); - } - async estimateEnergy(tx) { - return checkProvider(this, "estimateEnergy").estimateEnergy(await this.populateCall(tx)); - } - async call(tx) { - return checkProvider(this, "call").call(await this.populateCall(tx)); - } - async resolveName(name) { - return getAddress(name); - } - async sendTransaction(tx) { - const provider = checkProvider(this, "sendTransaction"); - const pop = await this.populateTransaction(tx); - delete pop.from; - const txObj = Transaction.from(pop); - return await provider.broadcastTransaction(await this.signTransaction(txObj)); - } - } - class VoidSigner extends AbstractSigner { - address; - constructor(address, provider) { - super(provider); - defineProperties(this, { address }); - } - async getAddress() { - return this.address; - } - connect(provider) { - return new VoidSigner(this.address, provider); - } - #throwUnsupported(suffix, operation) { - assert(false, `VoidSigner cannot sign ${suffix}`, "UNSUPPORTED_OPERATION", { - operation, - }); - } - async signTransaction(tx) { - this.#throwUnsupported("transactions", "signTransaction"); - } - async signMessage(message) { - this.#throwUnsupported("messages", "signMessage"); - } - async signTypedData(domain, types, value) { - this.#throwUnsupported("typed-data", "signTypedData"); - } - } - - /** - * There are many awesome community services that provide Core - * nodes both for developers just starting out and for large-scale - * communities. - * - * @_section: api/providers/thirdparty: Community Providers [thirdparty] - */ - // Show the throttle message only once per service - const shown = new Set(); - /** - * Displays a warning in tht console when the community resource is - * being used too heavily by the app, recommending the developer - * acquire their own credentials instead of using the community - * credentials. - * - * The notification will only occur once per service. - */ - function showThrottleMessage(service) { - if (shown.has(service)) { - return; - } - shown.add(service); - console.log("========= NOTICE ========="); - console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`); - console.log(""); - console.log("The default API keys for each service are provided as a highly-throttled,"); - console.log("community resource for low-traffic projects and early prototyping."); - console.log(""); - console.log("While your application will continue to function, we highly recommended"); - console.log("signing up for your own API keys to improve performance, increase your"); - console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."); - console.log(""); - } - - function copy(obj) { - return JSON.parse(JSON.stringify(obj)); - } - /** - * Some backends support subscribing to events using a Filter ID. - * - * When subscribing with this technique, the node issues a unique - * //Filter ID//. At this point the node dedicates resources to - * the filter, so that periodic calls to follow up on the //Filter ID// - * will receive any events since the last call. - * - * @_docloc: api/providers/abstract-provider - */ - class FilterIdSubscriber { - #provider; - #filterIdPromise; - #poller; - #running; - #network; - #hault; - constructor(provider) { - this.#provider = provider; - this.#filterIdPromise = null; - this.#poller = this.#poll.bind(this); - this.#running = false; - this.#network = null; - this.#hault = false; - } - _subscribe(provider) { - throw new Error("subclasses must override this"); - } - _emitResults(provider, result) { - throw new Error("subclasses must override this"); - } - _recover(provider) { - throw new Error("subclasses must override this"); - } - async #poll(blockNumber) { - try { - // Subscribe if necessary - if (this.#filterIdPromise == null) { - this.#filterIdPromise = this._subscribe(this.#provider); - } - // Get the Filter ID - let filterId = null; - try { - filterId = await this.#filterIdPromise; - } - catch (error) { - if (!isError(error, "UNSUPPORTED_OPERATION") || - error.operation !== "xcb_newFilter") { - throw error; - } - } - // The backend does not support Filter ID; downgrade to - // polling - if (filterId == null) { - this.#filterIdPromise = null; - this.#provider._recoverSubscriber(this, this._recover(this.#provider)); - return; - } - const network = await this.#provider.getNetwork(); - if (!this.#network) { - this.#network = network; - } - if (this.#network.networkId !== network.networkId) { - throw new Error("chaid changed"); - } - if (this.#hault) { - return; - } - const result = await this.#provider.send("xcb_getFilterChanges", [ - filterId, - ]); - await this._emitResults(this.#provider, result); - } - catch (error) { - console.log("@TODO", error); - } - this.#provider.once("block", this.#poller); - } - #teardown() { - const filterIdPromise = this.#filterIdPromise; - if (filterIdPromise) { - this.#filterIdPromise = null; - filterIdPromise.then((filterId) => { - this.#provider.send("xcb_uninstallFilter", [filterId]); - }); - } - } - start() { - if (this.#running) { - return; - } - this.#running = true; - this.#poll(-2); - } - stop() { - if (!this.#running) { - return; - } - this.#running = false; - this.#hault = true; - this.#teardown(); - this.#provider.off("block", this.#poller); - } - pause(dropWhilePaused) { - if (dropWhilePaused) { - this.#teardown(); - } - this.#provider.off("block", this.#poller); - } - resume() { - this.start(); - } - } - /** - * A **FilterIdSubscriber** for receiving contract events. - * - * @_docloc: api/providers/abstract-provider - */ - class FilterIdEventSubscriber extends FilterIdSubscriber { - #event; - constructor(provider, filter) { - super(provider); - this.#event = copy(filter); - } - _recover(provider) { - return new PollingEventSubscriber(provider, this.#event); - } - async _subscribe(provider) { - const filterId = await provider.send("xcb_newFilter", [this.#event]); - return filterId; - } - async _emitResults(provider, results) { - for (const result of results) { - provider.emit(this.#event, provider._wrapLog(result, provider._network)); - } - } - } - /** - * A **FilterIdSubscriber** for receiving pending transactions events. - * - * @_docloc: api/providers/abstract-provider - */ - class FilterIdPendingSubscriber extends FilterIdSubscriber { - async _subscribe(provider) { - return await provider.send("xcb_newPendingTransactionFilter", []); - } - async _emitResults(provider, results) { - for (const result of results) { - provider.emit("pending", result); - } - } - } - - /** - * About JSON-RPC... - * - * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] - */ - // @TODO: - // - Add the batching API - const Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g); - //const Methods = "getAddress,then".split(/,/g); - function deepCopy(value) { - if (value == null || Primitive.indexOf(typeof value) >= 0) { - return value; - } - // Keep any Addressable - if (typeof value.getAddress === "function") { - return value; - } - if (Array.isArray(value)) { - return value.map(deepCopy); - } - if (typeof value === "object") { - return Object.keys(value).reduce((accum, key) => { - accum[key] = value[key]; - return accum; - }, {}); - } - throw new Error(`should not happen: ${value} (${typeof value})`); - } - function stall$3(duration) { - return new Promise((resolve) => { - setTimeout(resolve, duration); - }); - } - function getLowerCase(value) { - if (value) { - return value.toLowerCase(); - } - return value; - } - function isPollable(value) { - return value && typeof value.pollingInterval === "number"; - } - const defaultOptions = { - polling: false, - staticNetwork: null, - batchStallTime: 10, - batchMaxSize: 1 << 20, - batchMaxCount: 100, // 100 requests - }; - // @TODO: Unchecked Signers - class JsonRpcSigner extends AbstractSigner { - address; - constructor(provider, address) { - super(provider); - address = getAddress(address); - defineProperties(this, { address }); - } - connect(provider) { - assert(false, "cannot reconnect JsonRpcSigner", "UNSUPPORTED_OPERATION", { - operation: "signer.connect", - }); - } - async getAddress() { - return this.address; - } - // JSON-RPC will automatially fill in nonce, etc. so we just check from - async populateTransaction(tx) { - return await this.populateCall(tx); - } - // Returns just the hash of the transaction after sent, which is what - // the bare JSON-RPC API does; - async sendUncheckedTransaction(_tx) { - const tx = deepCopy(_tx); - const promises = []; - // Make sure the from matches the sender - if (tx.from) { - const _from = tx.from; - promises.push((async () => { - const from = await resolveAddress(_from); - assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); - tx.from = from; - })()); - } - else { - tx.from = this.address; - } - // The JSON-RPC for xcb_sendTransaction uses 90000 energy; if the user - // wishes to use this, it is easy to specify explicitly, otherwise - // we look it up for them. - if (tx.energyLimit == null) { - promises.push((async () => { - tx.energyLimit = await this.provider.estimateEnergy({ - ...tx, - from: this.address, - }); - })()); - } - // The address may be an ENS name or Addressable - if (tx.to != null) { - const _to = tx.to; - promises.push((async () => { - tx.to = await resolveAddress(_to); - })()); - } - // Wait until all of our properties are filled in - if (promises.length) { - await Promise.all(promises); - } - const hexTx = this.provider.getRpcTransaction(tx); - return this.provider.send("xcb_sendTransaction", [hexTx]); - } - async sendTransaction(tx) { - // This cannot be mined any earlier than any recent block - const blockNumber = await this.provider.getBlockNumber(); - // Send the transaction - const hash = await this.sendUncheckedTransaction(tx); - // Unfortunately, JSON-RPC only provides and opaque transaction hash - // for a response, and we need the actual transaction, so we poll - // for it; it should show up very quickly - return await new Promise((resolve, reject) => { - const timeouts = [1000, 100]; - const checkTx = async () => { - // Try getting the transaction - const tx = await this.provider.getTransaction(hash); - if (tx != null) { - resolve(tx.replaceableTransaction(blockNumber)); - return; - } - // Wait another 4 seconds - this.provider._setTimeout(() => { - checkTx(); - }, timeouts.pop() || 4000); - }; - checkTx(); - }); - } - async signTransaction(_tx) { - const tx = deepCopy(_tx); - // Make sure the from matches the sender - if (tx.from) { - const from = await resolveAddress(tx.from); - assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); - tx.from = from; - } - else { - tx.from = this.address; - } - const hexTx = this.provider.getRpcTransaction(tx); - return await this.provider.send("xcb_signTransaction", [hexTx]); - } - async signMessage(_message) { - const message = typeof _message === "string" ? toUtf8Bytes(_message) : _message; - return await this.provider.send("personal_sign", [ - hexlify(message), - this.address.toLowerCase(), - ]); - } - async signTypedData(domain, types, _value) { - const value = deepCopy(_value); - // Populate any ENS names (in-place) - const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (value) => { - const address = await resolveAddress(value); - assertArgument(address != null, "TypedData does not support null address", "value", value); - return address; - }); - return await this.provider.send("xcb_signTypedData_v4", [ - this.address.toLowerCase(), - JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value)), - ]); - } - async unlock(password) { - return this.provider.send("personal_unlockAccount", [ - this.address.toLowerCase(), - password, - null, - ]); - } - async _legacySignMessage(_message) { - const message = typeof _message === "string" ? toUtf8Bytes(_message) : _message; - return await this.provider.send("xcb_sign", [ - this.address.toLowerCase(), - hexlify(message), - ]); - } - } - /** - * The JsonRpcApiProvider is an abstract class and **MUST** be - * sub-classed. - * - * It provides the base for all JSON-RPC-based Provider interaction. - * - * Sub-classing Notes: - * - a sub-class MUST override _send - * - a sub-class MUST call the `_start()` method once connected - */ - class JsonRpcApiProvider extends AbstractProvider { - #options; - // The next ID to use for the JSON-RPC ID field - #nextId; - // Payloads are queued and triggered in batches using the drainTimer - #payloads; - #drainTimer; - #notReady; - #network; - #scheduleDrain() { - if (this.#drainTimer) { - return; - } - // If we aren't using batching, no hard in sending it immeidately - const stallTime = this._getOption("batchMaxCount") === 1 - ? 0 - : this._getOption("batchStallTime"); - this.#drainTimer = setTimeout(() => { - this.#drainTimer = null; - const payloads = this.#payloads; - this.#payloads = []; - while (payloads.length) { - // Create payload batches that satisfy our batch constraints - const batch = [payloads.shift()]; - while (payloads.length) { - if (batch.length === this.#options.batchMaxCount) { - break; - } - batch.push(payloads.shift()); - const bytes = JSON.stringify(batch.map((p) => p.payload)); - if (bytes.length > this.#options.batchMaxSize) { - payloads.unshift(batch.pop()); - break; - } - } - // Process the result to each payload - (async () => { - const payload = batch.length === 1 ? batch[0].payload : batch.map((p) => p.payload); - this.emit("debug", { action: "sendRpcPayload", payload }); - try { - // console.log({payload}) - const result = await this._send(payload); - // console.log({result}) - this.emit("debug", { action: "receiveRpcResult", result }); - // Process results in batch order - for (const { resolve, reject, payload } of batch) { - // Find the matching result - const resp = result.filter((r) => r.id === payload.id)[0]; - // No result; the node failed us in unexpected ways - if (resp == null) { - return reject(makeError("no response from server", "BAD_DATA", { - value: result, - info: { payload }, - })); - } - // The response is an error - if ("error" in resp) { - return reject(this.getRpcError(payload, resp)); - } - // All good; send the result - resolve(resp.result); - } - } - catch (error) { - this.emit("debug", { action: "receiveRpcError", error }); - for (const { reject } of batch) { - // @TODO: augment the error with the payload - reject(error); - } - } - })(); - } - }, stallTime); - } - constructor(network, options) { - super(network); - this.#nextId = 1; - this.#options = Object.assign({}, defaultOptions, options || {}); - this.#payloads = []; - this.#drainTimer = null; - this.#network = null; - { - let resolve = null; - const promise = new Promise((_resolve) => { - resolve = _resolve; - }); - this.#notReady = { promise, resolve }; - } - // Make sure any static network is compatbile with the provided netwrok - const staticNetwork = this._getOption("staticNetwork"); - if (staticNetwork) { - assertArgument(network == null || staticNetwork.matches(network), "staticNetwork MUST match network object", "options", options); - this.#network = staticNetwork; - } - } - /** - * Returns the value associated with the option %%key%%. - * - * Sub-classes can use this to inquire about configuration options. - */ - _getOption(key) { - return this.#options[key]; - } - /** - * Gets the [[Network]] this provider has committed to. On each call, the network - * is detected, and if it has changed, the call will reject. - */ - get _network() { - assert(this.#network, "network is not available yet", "NETWORK_ERROR"); - return this.#network; - } - /* - { - assert(false, "sub-classes must override _send", "UNSUPPORTED_OPERATION", { - operation: "jsonRpcApiProvider._send" - }); - } - */ - /** - * Resolves to the non-normalized value by performing %%req%%. - * - * Sub-classes may override this to modify behavior of actions, - * and should generally call ``super._perform`` as a fallback. - */ - async _perform(req) { - const request = this.getRpcRequest(req); - if (request != null) { - return await this.send(request.method, request.args); - } - return super._perform(req); - } - /** - * Sub-classes may override this; it detects the *actual* network that - * we are **currently** connected to. - * - * Keep in mind that [[send]] may only be used once [[ready]], otherwise the - * _send primitive must be used instead. - */ - async _detectNetwork() { - const network = this._getOption("staticNetwork"); - if (network) { - return network; - } - // If we are ready, use ``send``, which enabled requests to be batched - if (this.ready) { - return Network.from(getBigInt(await this.send("xcb_networkId", []))); - } - // We are not ready yet; use the primitive _send - const payload = { - id: this.#nextId++, - method: "xcb_networkId", - params: [], - jsonrpc: "2.0", - }; - this.emit("debug", { action: "sendRpcPayload", payload }); - let result; - try { - result = (await this._send(payload))[0]; - } - catch (error) { - this.emit("debug", { action: "receiveRpcError", error }); - throw error; - } - this.emit("debug", { action: "receiveRpcResult", result }); - if ("result" in result) { - return Network.from(getBigInt(result.result)); - } - throw this.getRpcError(payload, result); - } - /** - * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls - * will be passed to [[_send]] from [[send]]. If it is overridden, then - * ``super._start()`` **MUST** be called. - * - * Calling it multiple times is safe and has no effect. - */ - _start() { - if (this.#notReady == null || this.#notReady.resolve == null) { - return; - } - this.#notReady.resolve(); - this.#notReady = null; - (async () => { - // Bootstrap the network - while (this.#network == null) { - try { - this.#network = await this._detectNetwork(); - } - catch (error) { - console.log("JsonRpcProvider failed to startup; retry in 1s"); - await stall$3(1000); - } - } - // Start dispatching requests - this.#scheduleDrain(); - })(); - } - /** - * Resolves once the [[_start]] has been called. This can be used in - * sub-classes to defer sending data until the connection has been - * established. - */ - async _waitUntilReady() { - if (this.#notReady == null) { - return; - } - return await this.#notReady.promise; - } - /** - * Return a Subscriber that will manage the %%sub%%. - * - * Sub-classes may override this to modify the behavior of - * subscription management. - */ - _getSubscriber(sub) { - // Pending Filters aren't availble via polling - if (sub.type === "pending") { - return new FilterIdPendingSubscriber(this); - } - if (sub.type === "event") { - if (this._getOption("polling")) { - return new PollingEventSubscriber(this, sub.filter); - } - return new FilterIdEventSubscriber(this, sub.filter); - } - // Orphaned Logs are handled automatically, by the filter, since - // logs with removed are emitted by it - if (sub.type === "orphan" && sub.filter.orphan === "drop-log") { - return new UnmanagedSubscriber("orphan"); - } - return super._getSubscriber(sub); - } - /** - * Returns true only if the [[_start]] has been called. - */ - get ready() { - return this.#notReady == null; - } - /** - * Returns %%tx%% as a normalized JSON-RPC transaction request, - * which has all values hexlified and any numeric values converted - * to Quantity values. - */ - getRpcTransaction(tx) { - const result = {}; - // JSON-RPC now requires numeric values to be "quantity" values - [ - "networkId", - "energyLimit", - "energyPrice", - "type", - "nonce", - "value", - ].forEach((key) => { - if (tx[key] == null) { - return; - } - let dstKey = key; - if (key === "energyLimit") { - dstKey = "energy"; - } - result[dstKey] = toQuantity(getBigInt(tx[key], `tx.${key}`)); - }); - // Make sure addresses and data are lowercase - ["from", "to", "data"].forEach((key) => { - if (tx[key] == null) { - return; - } - result[key] = hexlify(tx[key]); - }); - return result; - } - /** - * Returns the request method and arguments required to perform - * %%req%%. - */ - getRpcRequest(req) { - switch (req.method) { - case "networkId": - return { method: "xcb_networkId", args: [] }; - case "getBlockNumber": - return { method: "xcb_blockNumber", args: [] }; - case "getEnergyPrice": - return { method: "xcb_energyPrice", args: [] }; - case "getBalance": { - return { - method: "xcb_getBalance", - args: [getLowerCase(req.address), req.blockTag], - }; - } - case "getTransactionCount": - return { - method: "xcb_getTransactionCount", - args: [getLowerCase(req.address), req.blockTag], - }; - case "getCode": - return { - method: "xcb_getCode", - args: [getLowerCase(req.address), req.blockTag], - }; - case "getStorage": - return { - method: "xcb_getStorageAt", - args: [ - getLowerCase(req.address), - "0x" + req.position.toString(16), - req.blockTag, - ], - }; - case "broadcastTransaction": - return { - method: "xcb_sendRawTransaction", - args: [req.signedTransaction], - }; - case "getBlock": - if ("blockTag" in req) { - return { - method: "xcb_getBlockByNumber", - args: [req.blockTag, !!req.includeTransactions], - }; - } - else if ("blockHash" in req) { - return { - method: "xcb_getBlockByHash", - args: [req.blockHash, !!req.includeTransactions], - }; - } - break; - case "getTransaction": - return { - method: "xcb_getTransactionByHash", - args: [req.hash], - }; - case "getTransactionReceipt": - return { - method: "xcb_getTransactionReceipt", - args: [req.hash], - }; - case "call": - return { - method: "xcb_call", - args: [this.getRpcTransaction(req.transaction), req.blockTag], - }; - case "estimateEnergy": { - return { - method: "xcb_estimateEnergy", - args: [this.getRpcTransaction(req.transaction)], - }; - } - case "getLogs": - if (req.filter && req.filter.address != null) { - if (Array.isArray(req.filter.address)) { - req.filter.address = req.filter.address.map(getLowerCase); - } - else { - req.filter.address = getLowerCase(req.filter.address); - } - } - return { method: "xcb_getLogs", args: [req.filter] }; - } - return null; - } - /** - * Returns an CoreBC-style Error for the given JSON-RPC error - * %%payload%%, coalescing the various strings and error shapes - * that different nodes return, coercing them into a machine-readable - * standardized error. - */ - getRpcError(payload, _error) { - const { method } = payload; - const { error } = _error; - if (method === "xcb_estimateEnergy" && error.message) { - const msg = error.message; - if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) { - return makeError("insufficient funds", "INSUFFICIENT_FUNDS", { - transaction: payload.params[0], - info: { payload, error }, - }); - } - } - if (method === "xcb_call" || method === "xcb_estimateEnergy") { - const result = spelunkData(error); - const e = AbiCoder.getBuiltinCallException(method === "xcb_call" ? "call" : "estimateEnergy", payload.params[0], result ? result.data : null); - e.info = { error, payload }; - return e; - } - // Only estimateEnergy and call can return arbitrary contract-defined text, so now we - // we can process text safely. - const message = JSON.stringify(spelunkMessage(error)); - if (typeof error.message === "string" && - error.message.match(/user denied|corebc-user-denied/i)) { - const actionMap = { - xcb_sign: "signMessage", - personal_sign: "signMessage", - xcb_signTypedData_v4: "signTypedData", - xcb_signTransaction: "signTransaction", - xcb_sendTransaction: "sendTransaction", - xcb_requestAccounts: "requestAccess", - wallet_requestAccounts: "requestAccess", - }; - return makeError(`user rejected action`, "ACTION_REJECTED", { - action: actionMap[method] || "unknown", - reason: "rejected", - info: { payload, error }, - }); - } - if (method === "xcb_sendRawTransaction" || - method === "xcb_sendTransaction") { - const transaction = payload.params[0]; - if (message.match(/insufficient funds|base fee exceeds energy limit/i)) { - return makeError("insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { - transaction, - info: { error }, - }); - } - if (message.match(/nonce/i) && message.match(/too low/i)) { - return makeError("nonce has already been used", "NONCE_EXPIRED", { - transaction, - info: { error }, - }); - } - // "replacement transaction underpriced" - if (message.match(/replacement transaction/i) && - message.match(/underpriced/i)) { - return makeError("replacement fee too low", "REPLACEMENT_UNDERPRICED", { - transaction, - info: { error }, - }); - } - if (message.match(/only replay-protected/i)) { - return makeError("legacy pre-eip-155 transactions not supported", "UNSUPPORTED_OPERATION", { - operation: method, - info: { transaction, info: { error } }, - }); - } - } - if (message.match(/the method .* does not exist/i)) { - return makeError("unsupported operation", "UNSUPPORTED_OPERATION", { - operation: payload.method, - info: { error }, - }); - } - return makeError("could not coalesce error", "UNKNOWN_ERROR", { error }); - } - /** - * Requests the %%method%% with %%params%% via the JSON-RPC protocol - * over the underlying channel. This can be used to call methods - * on the backend that do not have a high-level API within the Provider - * API. - * - * This method queues requests according to the batch constraints - * in the options, assigns the request a unique ID. - * - * **Do NOT override** this method in sub-classes; instead - * override [[_send]] or force the options values in the - * call to the constructor to modify this method's behavior. - */ - send(method, params) { - // @TODO: cache networkId?? purge on switch_networks - const id = this.#nextId++; - const promise = new Promise((resolve, reject) => { - this.#payloads.push({ - resolve, - reject, - payload: { method, params, id, jsonrpc: "2.0" }, - }); - }); - // If there is not a pending drainTimer, set one - this.#scheduleDrain(); - return promise; - } - /** - * Resolves to the [[Signer]] account for %%address%% managed by - * the client. - * - * If the %%address%% is a number, it is used as an index in the - * the accounts from [[listAccounts]]. - * - * This can only be used on clients which manage accounts (such as - * Geth with imported account or MetaMask). - * - * Throws if the account doesn't exist. - */ - async getSigner(address) { - if (address == null) { - address = 0; - } - const accountsPromise = this.send("xcb_accounts", []); - // Account index - if (typeof address === "number") { - const accounts = await accountsPromise; - if (address >= accounts.length) { - throw new Error("no such account"); - } - return new JsonRpcSigner(this, accounts[address]); - } - const { accounts } = await resolveProperties({ - network: this.getNetwork(), - accounts: accountsPromise, - }); - // Account address - address = getAddress(address); - for (const account of accounts) { - if (getAddress(account) === address) { - return new JsonRpcSigner(this, address); - } - } - throw new Error("invalid account"); - } - async listAccounts() { - const accounts = await this.send("xcb_accounts", []); - return accounts.map((a) => new JsonRpcSigner(this, a)); - } - } - class JsonRpcApiPollingProvider extends JsonRpcApiProvider { - #pollingInterval; - constructor(network, options) { - super(network, options); - this.#pollingInterval = 4000; - } - _getSubscriber(sub) { - const subscriber = super._getSubscriber(sub); - if (isPollable(subscriber)) { - subscriber.pollingInterval = this.#pollingInterval; - } - return subscriber; - } - /** - * The polling interval (default: 4000 ms) - */ - get pollingInterval() { - return this.#pollingInterval; - } - set pollingInterval(value) { - if (!Number.isInteger(value) || value < 0) { - throw new Error("invalid interval"); - } - this.#pollingInterval = value; - this._forEachSubscriber((sub) => { - if (isPollable(sub)) { - sub.pollingInterval = this.#pollingInterval; - } - }); - } - } - /** - * The JsonRpcProvider is one of the most common Providers, - * which performs all operations over HTTP (or HTTPS) requests. - * - * Events are processed by polling the backend for the current block - * number; when it advances, all block-base events are then checked - * for updates. - */ - class JsonRpcProvider extends JsonRpcApiPollingProvider { - #connect; - constructor(url, network, options) { - if (url == null) { - url = "http://localhost:8545"; - } - super(network, options); - if (typeof url === "string") { - this.#connect = new FetchRequest(url); - } - else { - this.#connect = url.clone(); - } - } - _getConnection() { - return this.#connect.clone(); - } - async send(method, params) { - // All requests are over HTTP, so we can just start handling requests - // We do this here rather than the constructor so that we don't send any - // requests to the network (i.e. xcb_networkId) until we absolutely have to. - await this._start(); - return await super.send(method, params); - } - async _send(payload) { - // Configure a POST connection for the requested method - const request = this._getConnection(); - request.body = JSON.stringify(payload); - request.setHeader("content-type", "application/json"); - const response = await request.send(); - response.assertOk(); - let resp = response.bodyJson; - if (!Array.isArray(resp)) { - resp = [resp]; - } - return resp; - } - } - function spelunkData(value) { - if (value == null) { - return null; - } - // These *are* the droids we're looking for. - if (typeof value.message === "string" && - value.message.match("reverted") && - isHexString(value.data)) { - return { message: value.message, data: value.data }; - } - // Spelunk further... - if (typeof value === "object") { - for (const key in value) { - const result = spelunkData(value[key]); - if (result) { - return result; - } - } - return null; - } - // Might be a JSON string we can further descend... - if (typeof value === "string") { - try { - return spelunkData(JSON.parse(value)); - } - catch (error) { } - } - return null; - } - function _spelunkMessage(value, result) { - if (value == null) { - return; - } - // These *are* the droids we're looking for. - if (typeof value.message === "string") { - result.push(value.message); - } - // Spelunk further... - if (typeof value === "object") { - for (const key in value) { - _spelunkMessage(value[key], result); - } - } - // Might be a JSON string we can further descend... - if (typeof value === "string") { - try { - return _spelunkMessage(JSON.parse(value), result); - } - catch (error) { } - } - } - function spelunkMessage(value) { - const result = []; - _spelunkMessage(value, result); - return result; - } - - /** - * [[link-ankr]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Polygon (``matic``) - * - Arbitrum (``arbitrum``) - * - * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] - */ - const defaultApiKey$1 = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; - function getHost$4(name) { - switch (name) { - case "mainnet": - return "rpc.ankr.com/eth"; - case "goerli": - return "rpc.ankr.com/xcb_goerli"; - case "matic": - return "rpc.ankr.com/polygon"; - case "arbitrum": - return "rpc.ankr.com/arbitrum"; - } - assertArgument(false, "unsupported network", "network", name); - } - /** - * The **AnkrProvider** connects to the [[link-ankr]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-ankr-signup). - */ - class AnkrProvider extends JsonRpcProvider { - /** - * The API key for the Ankr connection. - */ - apiKey; - /** - * Create a new **AnkrProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network, apiKey) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (apiKey == null) { - apiKey = defaultApiKey$1; - } - // Ankr does not support filterId, so we force polling - const options = { polling: true, staticNetwork: network }; - const request = AnkrProvider.getRequest(network, apiKey); - super(request, network, options); - defineProperties(this, { apiKey }); - } - _getProvider(networkId) { - try { - return new AnkrProvider(networkId, this.apiKey); - } - catch (error) { } - return super._getProvider(networkId); - } - /** - * Returns a prepared request for connecting to %%network%% with - * %%apiKey%%. - */ - static getRequest(network, apiKey) { - if (apiKey == null) { - apiKey = defaultApiKey$1; - } - const request = new FetchRequest(`https:/\/${getHost$4(network.name)}/${apiKey}`); - request.allowGzip = true; - if (apiKey === defaultApiKey$1) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("AnkrProvider"); - return true; - }; - } - return request; - } - getRpcError(payload, error) { - if (payload.method === "xcb_sendRawTransaction") { - if (error && - error.error && - error.error.message === "INTERNAL_ERROR: could not replace existing tx") { - error.error.message = "replacement transaction underpriced"; - } - } - return super.getRpcError(payload, error); - } - isCommunityResource() { - return this.apiKey === defaultApiKey$1; - } - } - - /** - * About Alchemy - * - * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] - */ - const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; - function getHost$3(name) { - switch (name) { - case "mainnet": - return "eth-mainnet.alchemyapi.io"; - case "goerli": - return "eth-goerli.g.alchemy.com"; - case "sepolia": - return "eth-sepolia.g.alchemy.com"; - case "arbitrum": - return "arb-mainnet.g.alchemy.com"; - case "arbitrum-goerli": - return "arb-goerli.g.alchemy.com"; - case "matic": - return "polygon-mainnet.g.alchemy.com"; - case "matic-mumbai": - return "polygon-mumbai.g.alchemy.com"; - case "optimism": - return "opt-mainnet.g.alchemy.com"; - case "optimism-goerli": - return "opt-goerli.g.alchemy.com"; - } - assertArgument(false, "unsupported network", "network", name); - } - /** - * The **AlchemyProvider** connects to the [[link-alchemy]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-alchemy-signup). - * - * @_docloc: api/providers/thirdparty - */ - class AlchemyProvider extends JsonRpcProvider { - apiKey; - constructor(_network, apiKey) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (apiKey == null) { - apiKey = defaultApiKey; - } - const request = AlchemyProvider.getRequest(network, apiKey); - super(request, network, { staticNetwork: network }); - defineProperties(this, { apiKey }); - } - _getProvider(networkId) { - try { - return new AlchemyProvider(networkId, this.apiKey); - } - catch (error) { } - return super._getProvider(networkId); - } - async _perform(req) { - // https://docs.alchemy.com/reference/trace-transaction - if (req.method === "getTransactionResult") { - const { trace, tx } = await resolveProperties({ - trace: this.send("trace_transaction", [req.hash]), - tx: this.getTransaction(req.hash), - }); - if (trace == null || tx == null) { - return null; - } - let data; - let error = false; - try { - data = trace[0].result.output; - error = trace[0].error === "Reverted"; - } - catch (error) { } - if (data) { - assert(!error, "an error occurred during transaction executions", "CALL_EXCEPTION", { - action: "getTransactionResult", - data, - reason: null, - transaction: tx, - invocation: null, - revert: null, // @TODO - }); - return data; - } - assert(false, "could not parse trace result", "BAD_DATA", { - value: trace, - }); - } - return await super._perform(req); - } - isCommunityResource() { - return this.apiKey === defaultApiKey; - } - static getRequest(network, apiKey) { - if (apiKey == null) { - apiKey = defaultApiKey; - } - const request = new FetchRequest(`https:/\/${getHost$3(network.name)}/v2/${apiKey}`); - request.allowGzip = true; - if (apiKey === defaultApiKey) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("alchemy"); - return true; - }; - } - return request; - } - } - - /** - * About Cloudflare - * - * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] - */ - /** - * About Cloudflare... - */ - class CloudflareProvider extends JsonRpcProvider { - constructor(_network) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - assertArgument(network.name === "mainnet", "unsupported network", "network", _network); - super("https://cloudflare-eth.com/", network, { staticNetwork: network }); - } - } - - function getGlobal() { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw new Error("unable to locate global object"); - } - const _WebSocket = getGlobal().WebSocket; - - /** - * Generic long-lived socket provider. - * - * Sub-classing notes - * - a sub-class MUST call the `_start()` method once connected - * - a sub-class MUST override the `_write(string)` method - * - a sub-class MUST call `_processMessage(string)` for each message - * - * @_subsection: api/providers/abstract-provider - */ - class SocketSubscriber { - #provider; - #filter; - get filter() { - return JSON.parse(this.#filter); - } - #filterId; - #paused; - #emitPromise; - constructor(provider, filter) { - this.#provider = provider; - this.#filter = JSON.stringify(filter); - this.#filterId = null; - this.#paused = null; - this.#emitPromise = null; - } - start() { - this.#filterId = this.#provider - .send("xcb_subscribe", this.filter) - .then((filterId) => { - this.#provider._register(filterId, this); - return filterId; - }); - } - stop() { - this.#filterId.then((filterId) => { - this.#provider.send("xcb_unsubscribe", [filterId]); - }); - this.#filterId = null; - } - // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs - // and resume - pause(dropWhilePaused) { - assert(dropWhilePaused, "preserve logs while paused not supported by SocketSubscriber yet", "UNSUPPORTED_OPERATION", { operation: "pause(false)" }); - this.#paused = !!dropWhilePaused; - } - resume() { - this.#paused = null; - } - _handleMessage(message) { - if (this.#filterId == null) { - return; - } - if (this.#paused === null) { - let emitPromise = this.#emitPromise; - if (emitPromise == null) { - emitPromise = this._emit(this.#provider, message); - } - else { - emitPromise = emitPromise.then(async () => { - await this._emit(this.#provider, message); - }); - } - this.#emitPromise = emitPromise.then(() => { - if (this.#emitPromise === emitPromise) { - this.#emitPromise = null; - } - }); - } - } - async _emit(provider, message) { - throw new Error("sub-classes must implemente this; _emit"); - } - } - class SocketBlockSubscriber extends SocketSubscriber { - constructor(provider) { - super(provider, ["newHeads"]); - } - async _emit(provider, message) { - provider.emit("block", parseInt(message.number)); - } - } - class SocketPendingSubscriber extends SocketSubscriber { - constructor(provider) { - super(provider, ["newPendingTransactions"]); - } - async _emit(provider, message) { - provider.emit("pending", message); - } - } - class SocketEventSubscriber extends SocketSubscriber { - #logFilter; - get logFilter() { - return JSON.parse(this.#logFilter); - } - constructor(provider, filter) { - super(provider, ["logs", filter]); - this.#logFilter = JSON.stringify(filter); - } - async _emit(provider, message) { - provider.emit(this.logFilter, provider._wrapLog(message, provider._network)); - } - } - /** - * SocketProvider... - * - */ - class SocketProvider extends JsonRpcApiProvider { - #callbacks; - // Maps each filterId to its subscriber - #subs; - // If any events come in before a subscriber has finished - // registering, queue them - #pending; - constructor(network) { - super(network, { batchMaxCount: 1 }); - this.#callbacks = new Map(); - this.#subs = new Map(); - this.#pending = new Map(); - } - // This value is only valid after _start has been called - /* - get _network(): Network { - if (this.#network == null) { - throw new Error("this shouldn't happen"); - } - return this.#network.clone(); - } - */ - _getSubscriber(sub) { - switch (sub.type) { - case "close": - return new UnmanagedSubscriber("close"); - case "block": - return new SocketBlockSubscriber(this); - case "pending": - return new SocketPendingSubscriber(this); - case "event": - return new SocketEventSubscriber(this, sub.filter); - case "orphan": - // Handled auto-matically within AbstractProvider - // when the log.removed = true - if (sub.filter.orphan === "drop-log") { - return new UnmanagedSubscriber("drop-log"); - } - } - return super._getSubscriber(sub); - } - _register(filterId, subscriber) { - this.#subs.set(filterId, subscriber); - const pending = this.#pending.get(filterId); - if (pending) { - for (const message of pending) { - subscriber._handleMessage(message); - } - this.#pending.delete(filterId); - } - } - async _send(payload) { - // WebSocket provider doesn't accept batches - assertArgument(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload); - // @TODO: stringify payloads here and store to prevent mutations - // Prepare a promise to respond to - const promise = new Promise((resolve, reject) => { - this.#callbacks.set(payload.id, { payload, resolve, reject }); - }); - // Wait until the socket is connected before writing to it - await this._waitUntilReady(); - // Write the request to the socket - await this._write(JSON.stringify(payload)); - return [await promise]; - } - // Sub-classes must call this once they are connected - /* - async _start(): Promise { - if (this.#ready) { return; } - - for (const { payload } of this.#callbacks.values()) { - await this._write(JSON.stringify(payload)); - } - - this.#ready = (async function() { - await super._start(); - })(); - } - */ - // Sub-classes must call this for each message - async _processMessage(message) { - const result = (JSON.parse(message)); - if ("id" in result) { - const callback = this.#callbacks.get(result.id); - if (callback == null) { - this.emit("error", makeError("received result for unknown id", "UNKNOWN_ERROR", { - reasonCode: "UNKNOWN_ID", - result, - })); - return; - } - this.#callbacks.delete(result.id); - callback.resolve(result); - } - else if (result.method === "xcb_subscription") { - const filterId = result.params.subscription; - const subscriber = this.#subs.get(filterId); - if (subscriber) { - subscriber._handleMessage(result.params.result); - } - else { - let pending = this.#pending.get(filterId); - if (pending == null) { - pending = []; - this.#pending.set(filterId, pending); - } - pending.push(result.params.result); - } - } - } - async _write(message) { - throw new Error("sub-classes must override this"); - } - } - - class WebSocketProvider extends SocketProvider { - #connect; - #websocket; - get websocket() { - if (this.#websocket == null) { - throw new Error("websocket closed"); - } - return this.#websocket; - } - constructor(url, network) { - super(network); - if (typeof url === "string") { - this.#connect = () => { - return new _WebSocket(url); - }; - this.#websocket = this.#connect(); - } - else if (typeof url === "function") { - this.#connect = url; - this.#websocket = url(); - } - else { - this.#connect = null; - this.#websocket = url; - } - this.websocket.onopen = async () => { - try { - await this._start(); - this.resume(); - } - catch (error) { - console.log("failed to start WebsocketProvider", error); - // @TODO: now what? Attempt reconnect? - } - }; - this.websocket.onmessage = (message) => { - this._processMessage(message.data); - }; - /* - this.websocket.onclose = (event) => { - // @TODO: What event.code should we reconnect on? - const reconnect = false; - if (reconnect) { - this.pause(true); - if (this.#connect) { - this.#websocket = this.#connect(); - this.#websocket.onopen = ... - // @TODO: this requires the super class to rebroadcast; move it there - } - this._reconnect(); - } - }; - */ - } - async _write(message) { - this.websocket.send(message); - } - async destroy() { - if (this.#websocket != null) { - this.#websocket.close(); - this.#websocket = null; - } - super.destroy(); - } - } - - /** - * [[link-infura]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Sepolia Testnet (``sepolia``) - * - Arbitrum (``arbitrum``) - * - Arbitrum Goerli Testnet (``arbitrum-goerli``) - * - Optimism (``optimism``) - * - Optimism Goerli Testnet (``optimism-goerli``) - * - Polygon (``matic``) - * - Polygon Mumbai Testnet (``matic-mumbai``) - * - * @_subsection: api/providers/thirdparty:INFURA [providers-infura] - */ - const defaultProjectId = "84842078b09946638c03157f83405213"; - function getHost$2(name) { - switch (name) { - case "mainnet": - return "mainnet.infura.io"; - case "goerli": - return "goerli.infura.io"; - case "sepolia": - return "sepolia.infura.io"; - case "arbitrum": - return "arbitrum-mainnet.infura.io"; - case "arbitrum-goerli": - return "arbitrum-goerli.infura.io"; - case "matic": - return "polygon-mainnet.infura.io"; - case "matic-mumbai": - return "polygon-mumbai.infura.io"; - case "optimism": - return "optimism-mainnet.infura.io"; - case "optimism-goerli": - return "optimism-goerli.infura.io"; - } - assertArgument(false, "unsupported network", "network", name); - } - /** - * The **InfuraWebSocketProvider** connects to the [[link-infura]] - * WebSocket end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-infura-signup). - */ - class InfuraWebSocketProvider extends WebSocketProvider { - /** - * The Project ID for the INFURA connection. - */ - projectId; - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - projectSecret; - /** - * Creates a new **InfuraWebSocketProvider**. - */ - constructor(network, projectId) { - const provider = new InfuraProvider(network, projectId); - const req = provider._getConnection(); - assert(!req.credentials, "INFURA WebSocket project secrets unsupported", "UNSUPPORTED_OPERATION", { operation: "InfuraProvider.getWebSocketProvider()" }); - const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); - super(url, network); - defineProperties(this, { - projectId: provider.projectId, - projectSecret: provider.projectSecret, - }); - } - isCommunityResource() { - return this.projectId === defaultProjectId; - } - } - /** - * The **InfuraProvider** connects to the [[link-infura]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-infura-signup). - */ - class InfuraProvider extends JsonRpcProvider { - /** - * The Project ID for the INFURA connection. - */ - projectId; - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - projectSecret; - /** - * Creates a new **InfuraProvider**. - */ - constructor(_network, projectId, projectSecret) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (projectId == null) { - projectId = defaultProjectId; - } - if (projectSecret == null) { - projectSecret = null; - } - const request = InfuraProvider.getRequest(network, projectId, projectSecret); - super(request, network, { staticNetwork: network }); - defineProperties(this, { projectId, projectSecret }); - } - _getProvider(networkId) { - try { - return new InfuraProvider(networkId, this.projectId, this.projectSecret); - } - catch (error) { } - return super._getProvider(networkId); - } - isCommunityResource() { - return this.projectId === defaultProjectId; - } - /** - * Creates a new **InfuraWebSocketProvider**. - */ - static getWebSocketProvider(network, projectId) { - return new InfuraWebSocketProvider(network, projectId); - } - /** - * Returns a prepared request for connecting to %%network%% - * with %%projectId%% and %%projectSecret%%. - */ - static getRequest(network, projectId, projectSecret) { - if (projectId == null) { - projectId = defaultProjectId; - } - if (projectSecret == null) { - projectSecret = null; - } - const request = new FetchRequest(`https:/\/${getHost$2(network.name)}/v3/${projectId}`); - request.allowGzip = true; - if (projectSecret) { - request.setCredentials("", projectSecret); - } - if (projectId === defaultProjectId) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("InfuraProvider"); - return true; - }; - } - return request; - } - } - - /** - * [[link-quicknode]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Arbitrum (``arbitrum``) - * - Arbitrum Goerli Testnet (``arbitrum-goerli``) - * - Optimism (``optimism``) - * - Optimism Goerli Testnet (``optimism-goerli``) - * - Polygon (``matic``) - * - Polygon Mumbai Testnet (``matic-mumbai``) - * - * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] - */ - const defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb"; - function getHost$1(name) { - switch (name) { - case "mainnet": - return "corebc.quiknode.pro"; - case "arbitrum": - return "corebc.arbitrum-mainnet.quiknode.pro"; - case "arbitrum-goerli": - return "corebc.arbitrum-goerli.quiknode.pro"; - case "matic": - return "corebc.matic.quiknode.pro"; - case "matic-mumbai": - return "corebc.matic-testnet.quiknode.pro"; - case "optimism": - return "corebc.optimism.quiknode.pro"; - case "optimism-goerli": - return "corebc.optimism-goerli.quiknode.pro"; - } - assertArgument(false, "unsupported network", "network", name); - } - /** - * The **QuickNodeProvider** connects to the [[link-quicknode]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API token is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-quicknode). - */ - class QuickNodeProvider extends JsonRpcProvider { - /** - * The API token. - */ - token; - /** - * Creates a new **QuickNodeProvider**. - */ - constructor(_network, token) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (token == null) { - token = defaultToken; - } - const request = QuickNodeProvider.getRequest(network, token); - super(request, network, { staticNetwork: network }); - defineProperties(this, { token }); - } - _getProvider(networkId) { - try { - return new QuickNodeProvider(networkId, this.token); - } - catch (error) { } - return super._getProvider(networkId); - } - isCommunityResource() { - return this.token === defaultToken; - } - /** - * Returns a new request prepared for %%network%% and the - * %%token%%. - */ - static getRequest(network, token) { - if (token == null) { - token = defaultToken; - } - const request = new FetchRequest(`https:/\/${getHost$1(network.name)}/${token}`); - request.allowGzip = true; - //if (projectSecret) { request.setCredentials("", projectSecret); } - if (token === defaultToken) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("QuickNodeProvider"); - return true; - }; - } - return request; - } - } - - /** - * Explain all the nitty-gritty about the **FallbackProvider**. - * - * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider] - */ - const BN_1 = BigInt("1"); - const BN_2 = BigInt("2"); - function shuffle(array) { - for (let i = array.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - const tmp = array[i]; - array[i] = array[j]; - array[j] = tmp; - } - } - function stall$2(duration) { - return new Promise((resolve) => { - setTimeout(resolve, duration); - }); - } - function getTime() { - return new Date().getTime(); - } - function stringify(value) { - return JSON.stringify(value, (key, value) => { - if (typeof value === "bigint") { - return { type: "bigint", value: value.toString() }; - } - return value; - }); - } - const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 }; - const defaultState = { - blockNumber: -2, - requests: 0, - lateResponses: 0, - errorResponses: 0, - outOfSync: -1, - unsupportedEvents: 0, - rollingDuration: 0, - score: 0, - _network: null, - _updateNumber: null, - _totalTime: 0, - }; - async function waitForSync(config, blockNumber) { - while (config.blockNumber < 0 || config.blockNumber < blockNumber) { - if (!config._updateNumber) { - config._updateNumber = (async () => { - const blockNumber = await config.provider.getBlockNumber(); - if (blockNumber > config.blockNumber) { - config.blockNumber = blockNumber; - } - config._updateNumber = null; - })(); - } - await config._updateNumber; - config.outOfSync++; - } - } - function _normalize(value) { - if (value == null) { - return "null"; - } - if (Array.isArray(value)) { - return "[" + value.map(_normalize).join(",") + "]"; - } - if (typeof value === "object" && typeof value.toJSON === "function") { - return _normalize(value.toJSON()); - } - switch (typeof value) { - case "boolean": - case "symbol": - return value.toString(); - case "bigint": - case "number": - return BigInt(value).toString(); - case "string": - return JSON.stringify(value); - case "object": { - const keys = Object.keys(value); - keys.sort(); - return ("{" + - keys - .map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`) - .join(",") + - "}"); - } - } - console.log("Could not serialize", value); - throw new Error("Hmm..."); - } - function normalizeResult(value) { - if ("error" in value) { - const error = value.error; - return { tag: _normalize(error), value: error }; - } - const result = value.result; - return { tag: _normalize(result), value: result }; - } - // This strategy picks the highest weight result, as long as the weight is - // equal to or greater than quorum - function checkQuorum(quorum, results) { - const tally = new Map(); - for (const { value, tag, weight } of results) { - const t = tally.get(tag) || { value, weight: 0 }; - t.weight += weight; - tally.set(tag, t); - } - let best = null; - for (const r of tally.values()) { - if (r.weight >= quorum && (!best || r.weight > best.weight)) { - best = r; - } - } - if (best) { - return best.value; - } - return undefined; - } - function getMedian(quorum, results) { - let resultWeight = 0; - const errorMap = new Map(); - let bestError = null; - const values = []; - for (const { value, tag, weight } of results) { - if (value instanceof Error) { - const e = errorMap.get(tag) || { value, weight: 0 }; - e.weight += weight; - errorMap.set(tag, e); - if (bestError == null || e.weight > bestError.weight) { - bestError = e; - } - } - else { - values.push(BigInt(value)); - resultWeight += weight; - } - } - if (resultWeight < quorum) { - // We have quorum for an error - if (bestError && bestError.weight >= quorum) { - return bestError.value; - } - // We do not have quorum for a result - return undefined; - } - // Get the sorted values - values.sort((a, b) => (a < b ? -1 : b > a ? 1 : 0)); - const mid = Math.floor(values.length / 2); - // Odd-length; take the middle value - if (values.length % 2) { - return values[mid]; - } - // Even length; take the ceiling of the mean of the center two values - return (values[mid - 1] + values[mid] + BN_1) / BN_2; - } - function getAnyResult(quorum, results) { - // If any value or error meets quorum, that is our preferred result - const result = checkQuorum(quorum, results); - if (result !== undefined) { - return result; - } - // Otherwise, do we have any result? - for (const r of results) { - if (r.value) { - return r.value; - } - } - // Nope! - return undefined; - } - function getFuzzyMode(quorum, results) { - if (quorum === 1) { - return getNumber(getMedian(quorum, results), "%internal"); - } - const tally = new Map(); - const add = (result, weight) => { - const t = tally.get(result) || { result, weight: 0 }; - t.weight += weight; - tally.set(result, t); - }; - for (const { weight, value } of results) { - const r = getNumber(value); - add(r - 1, weight); - add(r, weight); - add(r + 1, weight); - } - let bestWeight = 0; - let bestResult = undefined; - for (const { weight, result } of tally.values()) { - // Use this result, if this result meets quorum and has either: - // - a better weight - // - or equal weight, but the result is larger - if (weight >= quorum && - (weight > bestWeight || - (bestResult != null && weight === bestWeight && result > bestResult))) { - bestWeight = weight; - bestResult = result; - } - } - return bestResult; - } - /** - * A Fallback Provider. - * - */ - class FallbackProvider extends AbstractProvider { - quorum; - eventQuorum; - eventWorkers; - #configs; - #height; - #initialSyncPromise; - constructor(providers, network) { - super(network); - this.#configs = providers.map((p) => { - if (p instanceof AbstractProvider) { - return Object.assign({ provider: p }, defaultConfig, defaultState); - } - else { - return Object.assign({}, defaultConfig, p, defaultState); - } - }); - this.#height = -2; - this.#initialSyncPromise = null; - this.quorum = 2; //Math.ceil(providers.length / 2); - this.eventQuorum = 1; - this.eventWorkers = 1; - assertArgument(this.quorum <= this.#configs.reduce((a, c) => a + c.weight, 0), "quorum exceed provider wieght", "quorum", this.quorum); - } - get providerConfigs() { - return this.#configs.map((c) => { - const result = Object.assign({}, c); - for (const key in result) { - if (key[0] === "_") { - delete result[key]; - } - } - return result; - }); - } - async _detectNetwork() { - return Network.from(getBigInt(await this._perform({ method: "networkId" }))); - } - // @TODO: Add support to select providers to be the event subscriber - //_getSubscriber(sub: Subscription): Subscriber { - // throw new Error("@TODO"); - //} - async _translatePerform(provider, req) { - switch (req.method) { - case "broadcastTransaction": - return await provider.broadcastTransaction(req.signedTransaction); - case "call": - return await provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag })); - case "networkId": - return (await provider.getNetwork()).networkId; - case "estimateEnergy": - return await provider.estimateEnergy(req.transaction); - case "getBalance": - return await provider.getBalance(req.address, req.blockTag); - case "getBlock": { - const block = "blockHash" in req ? req.blockHash : req.blockTag; - return await provider.getBlock(block, req.includeTransactions); - } - case "getBlockNumber": - return await provider.getBlockNumber(); - case "getCode": - return await provider.getCode(req.address, req.blockTag); - case "getEnergyPrice": - return (await provider.getFeeData()).energyPrice; - case "getLogs": - return await provider.getLogs(req.filter); - case "getStorage": - return await provider.getStorage(req.address, req.position, req.blockTag); - case "getTransaction": - return await provider.getTransaction(req.hash); - case "getTransactionCount": - return await provider.getTransactionCount(req.address, req.blockTag); - case "getTransactionReceipt": - return await provider.getTransactionReceipt(req.hash); - case "getTransactionResult": - return await provider.getTransactionResult(req.hash); - } - } - // Grab the next (random) config that is not already part of - // the running set - #getNextConfig(running) { - // @TODO: Maybe do a check here to favour (heavily) providers that - // do not require waitForSync and disfavour providers that - // seem down-ish or are behaving slowly - const configs = Array.from(running).map((r) => r.config); - // Shuffle the states, sorted by priority - const allConfigs = this.#configs.slice(); - shuffle(allConfigs); - allConfigs.sort((a, b) => b.priority - a.priority); - for (const config of allConfigs) { - if (configs.indexOf(config) === -1) { - return config; - } - } - return null; - } - // Adds a new runner (if available) to running. - #addRunner(running, req) { - const config = this.#getNextConfig(running); - // No runners available - if (config == null) { - return null; - } - // Create a new runner - const runner = { - config, - result: null, - didBump: false, - perform: null, - staller: null, - }; - const now = getTime(); - // Start performing this operation - runner.perform = (async () => { - try { - config.requests++; - const result = await this._translatePerform(config.provider, req); - runner.result = { result }; - } - catch (error) { - config.errorResponses++; - runner.result = { error }; - } - const dt = getTime() - now; - config._totalTime += dt; - config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt; - runner.perform = null; - })(); - // Start a staller; when this times out, it's time to force - // kicking off another runner because we are taking too long - runner.staller = (async () => { - await stall$2(config.stallTimeout); - runner.staller = null; - })(); - running.add(runner); - return runner; - } - // Initializes the blockNumber and network for each runner and - // blocks until initialized - async #initialSync() { - let initialSync = this.#initialSyncPromise; - if (!initialSync) { - const promises = []; - this.#configs.forEach((config) => { - promises.push(waitForSync(config, 0)); - promises.push((async () => { - config._network = await config.provider.getNetwork(); - })()); - }); - this.#initialSyncPromise = initialSync = (async () => { - // Wait for all providers to have a block number and network - await Promise.all(promises); - // Check all the networks match - let networkId = null; - for (const config of this.#configs) { - const network = config._network; - if (networkId == null) { - networkId = network.networkId; - } - else if (network.networkId !== networkId) { - assert(false, "cannot mix providers on different networks", "UNSUPPORTED_OPERATION", { - operation: "new FallbackProvider", - }); - } - } - })(); - } - await initialSync; - } - async #checkQuorum(running, req) { - // Get all the result objects - const results = []; - for (const runner of running) { - if (runner.result != null) { - const { tag, value } = normalizeResult(runner.result); - results.push({ tag, value, weight: runner.config.weight }); - } - } - // Are there enough results to event meet quorum? - if (results.reduce((a, r) => a + r.weight, 0) < this.quorum) { - return undefined; - } - switch (req.method) { - case "getBlockNumber": { - // We need to get the bootstrap block height - if (this.#height === -2) { - this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.map((c) => ({ - value: c.blockNumber, - tag: getNumber(c.blockNumber).toString(), - weight: c.weight, - }))))); - } - // Find the mode across all the providers, allowing for - // a little drift between block heights - const mode = getFuzzyMode(this.quorum, results); - if (mode === undefined) { - return undefined; - } - if (mode > this.#height) { - this.#height = mode; - } - return this.#height; - } - case "getEnergyPrice": - case "estimateEnergy": - return getMedian(this.quorum, results); - case "getBlock": - // Pending blocks are in the mempool and already - // quite untrustworthy; just grab anything - if ("blockTag" in req && req.blockTag === "pending") { - return getAnyResult(this.quorum, results); - } - return checkQuorum(this.quorum, results); - case "call": - case "networkId": - case "getBalance": - case "getTransactionCount": - case "getCode": - case "getStorage": - case "getTransaction": - case "getTransactionReceipt": - case "getLogs": - return checkQuorum(this.quorum, results); - case "broadcastTransaction": - return getAnyResult(this.quorum, results); - } - assert(false, "unsupported method", "UNSUPPORTED_OPERATION", { - operation: `_perform(${stringify(req.method)})`, - }); - } - async #waitForQuorum(running, req) { - if (running.size === 0) { - throw new Error("no runners?!"); - } - // Any promises that are interesting to watch for; an expired stall - // or a successful perform - const interesting = []; - let newRunners = 0; - for (const runner of running) { - // No responses, yet; keep an eye on it - if (runner.perform) { - interesting.push(runner.perform); - } - // Still stalling... - if (runner.staller) { - interesting.push(runner.staller); - continue; - } - // This runner has already triggered another runner - if (runner.didBump) { - continue; - } - // Got a response (result or error) or stalled; kick off another runner - runner.didBump = true; - newRunners++; - } - // Check if we have reached quorum on a result (or error) - const value = await this.#checkQuorum(running, req); - if (value !== undefined) { - if (value instanceof Error) { - throw value; - } - return value; - } - // Add any new runners, because a staller timed out or a result - // or error response came in. - for (let i = 0; i < newRunners; i++) { - this.#addRunner(running, req); - } - // All providers have returned, and we have no result - assert(interesting.length > 0, "quorum not met", "SERVER_ERROR", { - request: "%sub-requests", - info: { - request: req, - results: Array.from(running).map((r) => stringify(r.result)), - }, - }); - // Wait for someone to either complete its perform or stall out - await Promise.race(interesting); - // This is recursive, but at worst case the depth is 2x the - // number of providers (each has a perform and a staller) - return await this.#waitForQuorum(running, req); - } - async _perform(req) { - // Broadcasting a transaction is rare (ish) and already incurs - // a cost on the user, so spamming is safe-ish. Just send it to - // every backend. - if (req.method === "broadcastTransaction") { - const results = await Promise.all(this.#configs.map(async ({ provider, weight }) => { - try { - const result = await provider._perform(req); - return Object.assign(normalizeResult({ result }), { weight }); - } - catch (error) { - return Object.assign(normalizeResult({ error }), { weight }); - } - })); - const result = getAnyResult(this.quorum, results); - assert(result !== undefined, "problem multi-broadcasting", "SERVER_ERROR", { - request: "%sub-requests", - info: { request: req, results: results.map(stringify) }, - }); - if (result instanceof Error) { - throw result; - } - return result; - } - await this.#initialSync(); - // Bootstrap enough runners to meet quorum - const running = new Set(); - for (let i = 0; i < this.quorum; i++) { - this.#addRunner(running, req); - } - const result = await this.#waitForQuorum(running, req); - // Track requests sent to a provider that are still - // outstanding after quorum has been otherwise found - for (const runner of running) { - if (runner.perform && runner.result == null) { - runner.config.lateResponses++; - } - } - return result; - } - async destroy() { - for (const { provider } of this.#configs) { - provider.destroy(); - } - super.destroy(); - } - } - - function isWebSocketLike(value) { - return (value && - typeof value.send === "function" && - typeof value.close === "function"); - } - function getDefaultProvider(network, options) { - if (options == null) { - options = {}; - } - if (typeof network === "string" && network.match(/^https?:/)) { - return new JsonRpcProvider(network); - } - if ((typeof network === "string" && network.match(/^wss?:/)) || - isWebSocketLike(network)) { - return new WebSocketProvider(network); - } - const providers = []; - if (options.alchemy !== "-") { - try { - providers.push(new AlchemyProvider(network, options.alchemy)); - } - catch (error) { - console.log(error); - } - } - if (options.ankr !== "-" && options.ankr != null) { - try { - providers.push(new AnkrProvider(network, options.ankr)); - } - catch (error) { - console.log(error); - } - } - if (options.cloudflare !== "-") { - try { - providers.push(new CloudflareProvider(network)); - } - catch (error) { - console.log(error); - } - } - if (options.infura !== "-") { - try { - let projectId = options.infura; - let projectSecret = undefined; - if (typeof projectId === "object") { - projectSecret = projectId.projectSecret; - projectId = projectId.projectId; - } - providers.push(new InfuraProvider(network, projectId, projectSecret)); - } - catch (error) { - console.log(error); - } - } - /* - if (options.pocket !== "-") { - try { - let appId = options.pocket; - let secretKey: undefined | string = undefined; - let loadBalancer: undefined | boolean = undefined; - if (typeof(appId) === "object") { - loadBalancer = !!appId.loadBalancer; - secretKey = appId.secretKey; - appId = appId.appId; - } - providers.push(new PocketProvider(network, appId, secretKey, loadBalancer)); - } catch (error) { console.log(error); } - } - */ - if (options.quicknode !== "-") { - try { - let token = options.quicknode; - providers.push(new QuickNodeProvider(network, token)); - } - catch (error) { - console.log(error); - } - } - assert(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", { - operation: "getDefaultProvider", - }); - if (providers.length === 1) { - return providers[0]; - } - return new FallbackProvider(providers); - } - - class NonceManager extends AbstractSigner { - signer; - #noncePromise; - #delta; - constructor(signer) { - super(signer.provider); - defineProperties(this, { signer }); - this.#noncePromise = null; - this.#delta = 0; - } - async getAddress() { - return this.signer.getAddress(); - } - connect(provider) { - return new NonceManager(this.signer.connect(provider)); - } - async getNonce(blockTag) { - if (blockTag === "pending") { - if (this.#noncePromise == null) { - this.#noncePromise = super.getNonce("pending"); - } - const delta = this.#delta; - return (await this.#noncePromise) + delta; - } - return super.getNonce(blockTag); - } - increment() { - this.#delta++; - } - reset() { - this.#delta = 0; - this.#noncePromise = null; - } - async sendTransaction(tx) { - const noncePromise = this.getNonce("pending"); - this.increment(); - tx = await this.signer.populateTransaction(tx); - tx.nonce = await noncePromise; - // @TODO: Maybe handle interesting/recoverable errors? - // Like don't increment if the tx was certainly not sent - return await this.signer.sendTransaction(tx); - } - signTransaction(tx) { - return this.signer.signTransaction(tx); - } - signMessage(message) { - return this.signer.signMessage(message); - } - signTypedData(domain, types, value) { - return this.signer.signTypedData(domain, types, value); - } - } - - class BrowserProvider extends JsonRpcApiPollingProvider { - #request; - constructor(core, network) { - super(network, { batchMaxCount: 1 }); - this.#request = async (method, params) => { - const payload = { method, params }; - this.emit("debug", { action: "sendEip1193Request", payload }); - try { - const result = await core.request(payload); - this.emit("debug", { action: "receiveEip1193Result", result }); - return result; - } - catch (e) { - const error = new Error(e.message); - error.code = e.code; - error.data = e.data; - error.payload = payload; - this.emit("debug", { action: "receiveEip1193Error", error }); - throw error; - } - }; - } - async send(method, params) { - await this._start(); - return await super.send(method, params); - } - async _send(payload) { - assertArgument(!Array.isArray(payload), "EIP-1193 does not support batch request", "payload", payload); - try { - const result = await this.#request(payload.method, payload.params || []); - return [{ id: payload.id, result }]; - } - catch (e) { - return [ - { - id: payload.id, - error: { code: e.code, data: e.data, message: e.message }, - }, - ]; - } - } - getRpcError(payload, error) { - error = JSON.parse(JSON.stringify(error)); - // EIP-1193 gives us some machine-readable error codes, so rewrite - // them into - switch (error.error.code || -1) { - case 4001: - error.error.message = `corebc-user-denied: ${error.error.message}`; - break; - case 4200: - error.error.message = `corebc-unsupported: ${error.error.message}`; - break; - } - return super.getRpcError(payload, error); - } - async hasSigner(address) { - if (address == null) { - address = 0; - } - const accounts = await this.send("xcb_accounts", []); - if (typeof address === "number") { - return accounts.length > address; - } - address = address.toLowerCase(); - return (accounts.filter((a) => a.toLowerCase() === address).length !== 0); - } - async getSigner(address) { - if (address == null) { - address = 0; - } - if (!(await this.hasSigner(address))) { - try { - //const resp = - await this.#request("xcb_requestAccounts", []); - //console.log("RESP", resp); - } - catch (error) { - const payload = error.payload; - throw this.getRpcError(payload, { id: payload.id, error }); - } - } - return await super.getSigner(address); - } - } - - /** - * [[link-pocket]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Polygon (``matic``) - * - Arbitrum (``arbitrum``) - * - * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] - */ - const defaultApplicationId = "62e1ad51b37b8e00394bda3b"; - function getHost(name) { - switch (name) { - case "mainnet": - return "eth-mainnet.gateway.pokt.network"; - case "goerli": - return "eth-goerli.gateway.pokt.network"; - case "matic": - return "poly-mainnet.gateway.pokt.network"; - case "matic-mumbai": - return "polygon-mumbai-rpc.gateway.pokt.network"; - } - assertArgument(false, "unsupported network", "network", name); - } - /** - * The **PocketProvider** connects to the [[link-pocket]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-pocket-signup). - */ - class PocketProvider extends JsonRpcProvider { - /** - * The Application ID for the Pocket connection. - */ - applicationId; - /** - * The Application Secret for making authenticated requests - * to the Pocket connection. - */ - applicationSecret; - /** - * Create a new **PocketProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network, applicationId, applicationSecret) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (applicationId == null) { - applicationId = defaultApplicationId; - } - if (applicationSecret == null) { - applicationSecret = null; - } - const options = { staticNetwork: network }; - const request = PocketProvider.getRequest(network, applicationId, applicationSecret); - super(request, network, options); - defineProperties(this, { - applicationId, - applicationSecret, - }); - } - _getProvider(networkId) { - try { - return new PocketProvider(networkId, this.applicationId, this.applicationSecret); - } - catch (error) { } - return super._getProvider(networkId); - } - /** - * Returns a prepared request for connecting to %%network%% with - * %%applicationId%%. - */ - static getRequest(network, applicationId, applicationSecret) { - if (applicationId == null) { - applicationId = defaultApplicationId; - } - const request = new FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`); - request.allowGzip = true; - if (applicationSecret) { - request.setCredentials("", applicationSecret); - } - if (applicationId === defaultApplicationId) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("PocketProvider"); - return true; - }; - } - return request; - } - isCommunityResource() { - return this.applicationId === defaultApplicationId; - } - } - - const IpcSocketProvider = undefined; - - /** - * The **BaseWallet** is a stream-lined implementation of a - * [[Signer]] that operates with a private key. - * - * It is preferred to use the [[Wallet]] class, as it offers - * additional functionality and simplifies loading a variety - * of JSON formats, Mnemonic Phrases, etc. - * - * This class may be of use for those attempting to implement - * a minimal Signer. - */ - class BaseWallet extends AbstractSigner { - /** - * The wallet address. - */ - address; - prefix; - #signingKey; - /** - * Creates a new BaseWallet for %%privateKey%%, optionally - * connected to %%provider%%. - * - * If %%provider%% is not specified, only offline methods can - * be used. - */ - constructor({ signingKey, prefix, provider, }) { - super(provider); - this.prefix = prefix; - assertArgument(signingKey && typeof signingKey.sign === "function", "invalid signingKey key", "signingKey", "[ REDACTED ]"); - this.#signingKey = signingKey; - const address = computeAddress(this.#signingKey, prefix); - defineProperties(this, { address }); - } - // Store private values behind getters to reduce visibility - // in console.log - /** - * The [[SigningKey]] used for signing payloads. - */ - get signingKey() { - return this.#signingKey; - } - /** - * The private key for this wallet. - */ - get privateKey() { - return this.signingKey.privateKey; - } - async getAddress() { - return this.address; - } - connect(provider) { - return new BaseWallet({ - signingKey: this.#signingKey, - prefix: this.prefix, - provider, - }); - } - async signTransaction(tx) { - // Replace any Addressable or ENS name with an address - const { to, from } = await resolveProperties({ - to: tx.to || undefined, - from: tx.from || undefined, - }); - if (to != null) { - tx.to = to; - } - if (from != null) { - tx.from = from; - } - if (tx.from != null) { - assertArgument(getAddress(tx.from) === this.address, "transaction from address mismatch", "tx.from", tx.from); - delete tx.from; - } - // Build the transaction - const btx = Transaction.from(tx); - const unSignedSerialized = btx.unsignedSerialized; - const unsignedHash = sha256(unSignedSerialized); - // sha256(btx.unsignedSerialized) - btx.signature = this.signingKey.sign(unsignedHash); - return btx.serialized; - } - async signMessage(message) { - return this.signMessageSync(message); - } - // @TODO: Add a secialized signTx and signTyped sync that enforces - // all parameters are known? - /** - * Returns the signature for %%message%% signed with this wallet. - */ - signMessageSync(message) { - return this.signingKey.sign(hashMessage(message)); - } - async signTypedData(domain, types, value) { - // Populate any ENS names - const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (name) => { - // @TODO: this should use resolveName; addresses don't - // need a provider - assert(this.provider != null, "cannot resolve ENS names without a provider", "UNSUPPORTED_OPERATION", { - operation: "resolveName", - info: { name }, - }); - const address = getAddress(name); - assert(address != null, "unconfigured ENS name", "UNCONFIGURED_NAME", { - value: name, - }); - return address; - }); - return this.signingKey.sign(TypedDataEncoder.hash(populated.domain, types, populated.value)); - } - } - - const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; - const Word = /^[a-z]*$/i; - function unfold(words, sep) { - let initial = 97; - return words.reduce((accum, word) => { - if (word === sep) { - initial++; - } - else if (word.match(Word)) { - accum.push(String.fromCharCode(initial) + word); - } - else { - initial = 97; - accum.push(word); - } - return accum; - }, []); - } - /** - * @_ignore - */ - function decode(data, subs) { - // Replace all the substitutions with their expanded form - for (let i = subsChrs.length - 1; i >= 0; i--) { - data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); - } - // Get all tle clumps; each suffix, first-increment and second-increment - const clumps = []; - const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => { - if (semi) { - for (let i = parseInt(semi); i >= 0; i--) { - clumps.push(";"); - } - } - else { - clumps.push(item.toLowerCase()); - } - return ""; - }); - /* c8 ignore start */ - if (leftover) { - throw new Error(`leftovers: ${JSON.stringify(leftover)}`); - } - /* c8 ignore stop */ - return unfold(unfold(clumps, ";"), ":"); - } - /** - * @_ignore - */ - function decodeOwl(data) { - assertArgument(data[0] === "0", "unsupported auwl data", "data", data); - return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length)); - } - - /** - * A Wordlist represents a collection of language-specific - * words used to encode and devoce [[link-bip-39]] encoded data - * by mapping words to 11-bit values and vice versa. - */ - class Wordlist { - locale; - /** - * Creates a new Wordlist instance. - * - * Sub-classes MUST call this if they provide their own constructor, - * passing in the locale string of the language. - * - * Generally there is no need to create instances of a Wordlist, - * since each language-specific Wordlist creates an instance and - * there is no state kept internally, so they are safe to share. - */ - constructor(locale) { - defineProperties(this, { locale }); - } - /** - * Sub-classes may override this to provide a language-specific - * method for spliting %%phrase%% into individual words. - * - * By default, %%phrase%% is split using any sequences of - * white-space as defined by regular expressions (i.e. ``/\s+/``). - */ - split(phrase) { - return phrase.toLowerCase().split(/\s+/g); - } - /** - * Sub-classes may override this to provider a language-specific - * method for joining %%words%% into a phrase. - * - * By default, %%words%% are joined by a single space. - */ - join(words) { - return words.join(" "); - } - static check(wordlist) { - const words = []; - for (let i = 0; i < 2048; i++) { - const word = wordlist.getWord(i); - /* istanbul ignore if */ - if (i !== wordlist.getWordIndex(word)) { - return "0x"; - } - words.push(word); - } - return id(words.join("\n") + "\n"); - } - } - - // Use the encode-latin.js script to create the necessary - // data files to be consumed by this class - /** - * An OWL format Wordlist is an encoding method that exploits - * the general locality of alphabetically sorted words to - * achieve a simple but effective means of compression. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on ASCII-7 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ - class WordlistOwl extends Wordlist { - #data; - #checksum; - /** - * Creates a new Wordlist for %%locale%% using the OWL %%data%% - * and validated against the %%checksum%%. - */ - constructor(locale, data, checksum) { - super(locale); - this.#data = data; - this.#checksum = checksum; - this.#words = null; - } - get _data() { - return this.#data; - } - _decodeWords() { - return decodeOwl(this.#data); - } - #words; - #loadWords() { - if (this.#words == null) { - const words = this._decodeWords(); - // Verify the computed list matches the official list - const checksum = id(words.join("\n") + "\n", true); - /* c8 ignore start */ - if (checksum !== this.#checksum) { - throw new Error(`BIP39 Wordlist for ${this.locale} FffffAILED`); - } - /* c8 ignore stop */ - this.#words = words; - } - return this.#words; - } - getWord(index) { - const words = this.#loadWords(); - assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); - return words[index]; - } - getWordIndex(word) { - return this.#loadWords().indexOf(word); - } - } - - const words = "0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-Aw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Th(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurEAyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO"; - const checksum = "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"; - let wordlist = null; - /** - * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ - class LangEn extends WordlistOwl { - /** - * Creates a new instance of the English language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langEn]] should suffice. - * - * @_ignore: - */ - constructor() { - super("en", words, checksum); - } - /** - * Returns a singleton instance of a ``LangEn``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist == null) { - wordlist = new LangEn(); - } - return wordlist; - } - } - - function mnemonicToSeed(mnemonic, password) { - if (!password) { - password = ""; - } - const t = generateSeed(mnemonic, password); - return t.goldilock; - } - const generateSeed = (mnemonic, password) => { - const goldilockSaltPrefix = "mnemonic"; - const aesSaltPrefix = "mnemonicfortheAESkey"; - const goldilockSalt = utf8.encode(goldilockSaltPrefix + password); - const aesSalt = utf8.encode(aesSaltPrefix + password); - const goldilockKey = pbkdf2Sync(Buffer.from(mnemonic), goldilockSalt, 2048, 64, "sha512"); - const aesKeySeed = pbkdf2Sync(Buffer.from(mnemonic), aesSalt, 2048, 64, "sha512"); - return { - aes: aesKeySeed.toString("hex"), - goldilock: goldilockKey.toString("hex"), - }; - }; - - // Returns a byte with the MSB bits set - function getUpperMask(bits) { - return (((1 << bits) - 1) << (8 - bits)) & 0xff; - } - // Returns a byte with the LSB bits set - function getLowerMask(bits) { - return ((1 << bits) - 1) & 0xff; - } - function mnemonicToEntropy(mnemonic, wordlist) { - assertNormalize("NFKD"); - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - const words = wordlist.split(mnemonic); - assertArgument(words.length % 3 === 0 && words.length >= 12 && words.length <= 24, "invalid mnemonic length", "mnemonic", "[ REDACTED ]"); - const entropy = new Uint8Array(Math.ceil((11 * words.length) / 8)); - let offset = 0; - for (let i = 0; i < words.length; i++) { - let index = wordlist.getWordIndex(words[i].normalize("NFKD")); - assertArgument(index >= 0, `invalid mnemonic word at index ${i}`, "mnemonic", "[ REDACTED ]"); - for (let bit = 0; bit < 11; bit++) { - if (index & (1 << (10 - bit))) { - entropy[offset >> 3] |= 1 << (7 - (offset % 8)); - } - offset++; - } - } - const entropyBits = (32 * words.length) / 3; - const checksumBits = words.length / 3; - const checksumMask = getUpperMask(checksumBits); - const checksum = getBytes(legacySha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; - assertArgument(checksum === (entropy[entropy.length - 1] & checksumMask), "invalid mnemonic checksum", "mnemonic", "[ REDACTED ]"); - return hexlify(entropy.slice(0, entropyBits / 8)); - } - function entropyToMnemonic(entropy, wordlist) { - assertArgument(entropy.length % 4 === 0 && entropy.length >= 16 && entropy.length <= 32, "invalid entropy size", "entropy", "[ REDACTED ]"); - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - const indices = [0]; - let remainingBits = 11; - for (let i = 0; i < entropy.length; i++) { - // Consume the whole byte (with still more to go) - if (remainingBits > 8) { - indices[indices.length - 1] <<= 8; - indices[indices.length - 1] |= entropy[i]; - remainingBits -= 8; - // This byte will complete an 11-bit index - } - else { - indices[indices.length - 1] <<= remainingBits; - indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); - // Start the next word - indices.push(entropy[i] & getLowerMask(8 - remainingBits)); - remainingBits += 3; - } - } - // Compute the checksum bits - const checksumBits = entropy.length / 4; - const checksum = parseInt(legacySha256(entropy).substring(2, 4), 16) & - getUpperMask(checksumBits); - // Shift the checksum into the word indices - indices[indices.length - 1] <<= checksumBits; - indices[indices.length - 1] |= checksum >> (8 - checksumBits); - return wordlist.join(indices.map((index) => wordlist.getWord(index))); - } - const _guard$1 = {}; - /** - * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] - * seeds and convert between phrases and entropy. - */ - class Mnemonic { - /** - * The mnemonic phrase of 12, 15, 18, 21 or 24 words. - * - * Use the [[wordlist]] ``split`` method to get the individual words. - */ - phrase; - /** - * The password used for this mnemonic. If no password is used this - * is the empty string (i.e. ``""``) as per the specification. - */ - password; - /** - * The wordlist for this mnemonic. - */ - wordlist; - /** - * The underlying entropy which the mnemonic encodes. - */ - entropy; - /** - * @private - */ - constructor(guard, entropy, phrase, password, wordlist) { - if (password == null) { - password = ""; - } - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - assertPrivate(guard, _guard$1, "Mnemonic"); - defineProperties(this, { phrase, password, wordlist, entropy }); - } - /** - * Returns the seed for the mnemonic. - */ - computeSeed() { - return mnemonicToSeed(this.phrase, this.password); - } - /** - * Creates a new Mnemonic for the %%phrase%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromPhrase({ phrase, password, wordlist, }) { - // Normalize the case and space; throws if invalid - const entropy = mnemonicToEntropy(phrase, wordlist); - phrase = entropyToMnemonic(getBytes(entropy), wordlist); - return new Mnemonic(_guard$1, entropy, phrase, password, wordlist); - } - /** - * Create a new **Mnemonic** from the %%entropy%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromEntropy(_entropy, password, wordlist) { - const entropy = getBytes(_entropy, "entropy"); - const phrase = entropyToMnemonic(entropy, wordlist); - return new Mnemonic(_guard$1, hexlify(entropy), phrase, password, wordlist); - } - /** - * Returns the phrase for %%mnemonic%%. - */ - static entropyToPhrase(_entropy, wordlist) { - const entropy = getBytes(_entropy, "entropy"); - return entropyToMnemonic(entropy, wordlist); - } - /** - * Returns the entropy for %%phrase%%. - */ - static phraseToEntropy(phrase, wordlist) { - return mnemonicToEntropy(phrase, wordlist); - } - /** - * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. - * - * This checks all the provided words belong to the %%wordlist%%, - * that the length is valid and the checksum is correct. - */ - static isValidMnemonic(phrase, wordlist) { - try { - mnemonicToEntropy(phrase, wordlist); - return true; - } - catch (error) { } - return false; - } - } - - /** - * @_ignore - */ - function looseArrayify(hexString) { - if (typeof hexString === "string" && !hexString.startsWith("0x")) { - hexString = "0x" + hexString; - } - return getBytesCopy(hexString); - } - function zpad(value, length) { - value = String(value); - while (value.length < length) { - value = "0" + value; - } - return value; - } - function getPassword(password) { - if (typeof password === "string") { - return toUtf8Bytes(password, "NFKC"); - } - return getBytesCopy(password); - } - function spelunk(object, _path) { - const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i); - assertArgument(match != null, "invalid path", "path", _path); - const path = match[1]; - const type = match[3]; - const reqd = match[4] === "!"; - let cur = object; - for (const comp of path.toLowerCase().split(".")) { - // Search for a child object with a case-insensitive matching key - if (Array.isArray(cur)) { - if (!comp.match(/^[0-9]+$/)) { - break; - } - cur = cur[parseInt(comp)]; - } - else if (typeof cur === "object") { - let found = null; - for (const key in cur) { - if (key.toLowerCase() === comp) { - found = cur[key]; - break; - } - } - cur = found; - } - else { - cur = null; - } - if (cur == null) { - break; - } - } - assertArgument(!reqd || cur != null, "missing required value", "path", path); - if (type && cur != null) { - if (type === "int") { - if (typeof cur === "string" && cur.match(/^-?[0-9]+$/)) { - return parseInt(cur); - } - else if (Number.isSafeInteger(cur)) { - return cur; - } - } - if (type === "number") { - if (typeof cur === "string" && cur.match(/^-?[0-9.]*$/)) { - return parseFloat(cur); - } - } - if (type === "data") { - if (typeof cur === "string") { - return looseArrayify(cur); - } - } - if (type === "array" && Array.isArray(cur)) { - return cur; - } - if (type === typeof cur) { - return cur; - } - assertArgument(false, `wrong type found for ${type} `, "path", path); - } - return cur; - } - /* - export function follow(object: any, path: string): null | string { - let currentChild = object; - - for (const comp of path.toLowerCase().split('/')) { - - // Search for a child object with a case-insensitive matching key - let matchingChild = null; - for (const key in currentChild) { - if (key.toLowerCase() === comp) { - matchingChild = currentChild[key]; - break; - } - } - - if (matchingChild === null) { return null; } - - currentChild = matchingChild; - } - - return currentChild; - } - - // "path/to/something:type!" - export function followRequired(data: any, path: string): string { - const value = follow(data, path); - if (value != null) { return value; } - return logger.throwArgumentError("invalid value", `data:${ path }`, - JSON.stringify(data)); - } - */ - // See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) - /* - export function uuidV4(randomBytes: BytesLike): string { - const bytes = getBytes(randomBytes, "randomBytes"); - - // Section: 4.1.3: - // - time_hi_and_version[12:16] = 0b0100 - bytes[6] = (bytes[6] & 0x0f) | 0x40; - - // Section 4.4 - // - clock_seq_hi_and_reserved[6] = 0b0 - // - clock_seq_hi_and_reserved[7] = 0b1 - bytes[8] = (bytes[8] & 0x3f) | 0x80; - - const value = hexlify(bytes); - - return [ - value.substring(2, 10), - value.substring(10, 14), - value.substring(14, 18), - value.substring(18, 22), - value.substring(22, 34), - ].join("-"); - } - */ - - /** - * The JSON Wallet formats allow a simple way to store the private - * keys needed in Core along with related information and allows - * for extensible forms of encryption. - * - * These utilities facilitate decrypting and encrypting the most common - * JSON Wallet formats. - * - * @_subsection: api/wallet:JSON Wallets [json-wallets] - */ - // @ts-ignore - const { CTR } = pkg; - const defaultPath$1 = "m/44'/60'/0'/0/0"; - /** - * Returns true if %%json%% is a valid JSON Keystore Wallet. - */ - function isKeystoreJson(json) { - try { - const data = JSON.parse(json); - const version = data.version != null ? parseInt(data.version) : 0; - if (version === 3) { - return true; - } - } - catch (error) { } - return false; - } - function decrypt(data, key, ciphertext) { - const cipher = spelunk(data, "crypto.cipher:string"); - if (cipher === "aes-128-ctr") { - const iv = spelunk(data, "crypto.cipherparams.iv:data!"); - const aesCtr = new CTR(key, iv); - return hexlify(aesCtr.decrypt(ciphertext)); - } - assert(false, "unsupported cipher", "UNSUPPORTED_OPERATION", { - operation: "decrypt", - }); - } - function getAccount(data, _key) { - const key = getBytes(_key); - const ciphertext = spelunk(data, "crypto.ciphertext:data!"); - const computedMAC = hexlify(sha256(concat([key.slice(16, 32), ciphertext]))).substring(2); - assertArgument(computedMAC === spelunk(data, "crypto.mac:string!").toLowerCase(), "incorrect password", "password", "[ REDACTED ]"); - const privateKey = decrypt(data, key.slice(0, 16), ciphertext); - const address = getAddress(data.address); - const prefix = extractPrefix(address); - if (computeAddress(privateKey, prefix) !== address) { - throw new Error("address mismatch"); - } - if (data.address) { - let check = data.address.toLowerCase(); - if (!check.startsWith("0x")) { - check = "0x" + check; - } - assertArgument(getAddress(check) === address, "keystore address/privateKey mismatch", "address", data.address); - } - const account = { address, privateKey }; - // Version 0.1 x-corebc metadata must contain an encrypted mnemonic phrase - const version = spelunk(data, "x-corebc.version:string"); - if (version === "0.1") { - const mnemonicKey = key.slice(32, 64); - const mnemonicCiphertext = spelunk(data, "x-corebc.mnemonicCiphertext:data!"); - const mnemonicIv = spelunk(data, "x-corebc.mnemonicCounter:data!"); - const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); - account.mnemonic = { - path: spelunk(data, "x-corebc.path:string") || defaultPath$1, - locale: spelunk(data, "x-corebc.locale:string") || "en", - entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext))), - }; - } - return account; - } - function getDecryptKdfParams(data) { - const kdf = spelunk(data, "crypto.kdf:string"); - if (kdf && typeof kdf === "string") { - if (kdf.toLowerCase() === "scrypt") { - const salt = spelunk(data, "crypto.kdfparams.salt:data!"); - const N = spelunk(data, "crypto.kdfparams.n:int!"); - const r = spelunk(data, "crypto.kdfparams.r:int!"); - const p = spelunk(data, "crypto.kdfparams.p:int!"); - // Make sure N is a power of 2 - assertArgument(N > 0 && (N & (N - 1)) === 0, "invalid kdf.N", "kdf.N", N); - assertArgument(r > 0 && p > 0, "invalid kdf", "kdf", kdf); - const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); - assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dflen", dkLen); - return { name: "scrypt", salt, N, r, p, dkLen: 64 }; - } - else if (kdf.toLowerCase() === "pbkdf2") { - const salt = spelunk(data, "crypto.kdfparams.salt:data!"); - const prf = spelunk(data, "crypto.kdfparams.prf:string!"); - const algorithm = prf.split("-").pop(); - assertArgument(algorithm === "sha256" || algorithm === "sha512", "invalid kdf.pdf", "kdf.pdf", prf); - const count = spelunk(data, "crypto.kdfparams.c:int!"); - const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); - assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dklen", dkLen); - return { name: "pbkdf2", salt, count, dkLen, algorithm }; - } - } - assertArgument(false, "unsupported key-derivation function", "kdf", kdf); - } - /** - * Returns the account details for the JSON Keystore Wallet %%json%% - * using %%password%%. - * - * It is preferred to use the [async version](decryptKeystoreJson) - * instead, which allows a [[ProgressCallback]] to keep the user informed - * as to the decryption status. - * - * This method will block the event loop (freezing all UI) until decryption - * is complete, which can take quite some time, depending on the wallet - * paramters and platform. - */ - function decryptKeystoreJsonSync(json, _password) { - const data = JSON.parse(json); - const password = getPassword(_password); - const params = getDecryptKdfParams(data); - if (params.name === "pbkdf2") { - const { salt, count, dkLen, algorithm } = params; - const key = pbkdf2(password, salt, count, dkLen, algorithm); - return getAccount(data, key); - } - assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { - params, - }); - const { salt, N, r, p, dkLen } = params; - const key = scryptSync(password, salt, N, r, p, dkLen); - return getAccount(data, key); - } - function stall$1(duration) { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, duration); - }); - } - /** - * Resolves to the decrypted JSON Keystore Wallet %%json%% using the - * %%password%%. - * - * If provided, %%progress%% will be called periodically during the - * decrpytion to provide feedback, and if the function returns - * ``false`` will halt decryption. - * - * The %%progressCallback%% will **always** receive ``0`` before - * decryption begins and ``1`` when complete. - */ - async function decryptKeystoreJson(json, _password, progress) { - const data = JSON.parse(json); - const password = getPassword(_password); - const params = getDecryptKdfParams(data); - if (params.name === "pbkdf2") { - if (progress) { - progress(0); - await stall$1(0); - } - const { salt, count, dkLen, algorithm } = params; - const key = pbkdf2(password, salt, count, dkLen, algorithm); - if (progress) { - progress(1); - await stall$1(0); - } - return getAccount(data, key); - } - assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { - params, - }); - const { salt, N, r, p, dkLen } = params; - const key = await scrypt(password, salt, N, r, p, dkLen, progress); - return getAccount(data, key); - } - function getEncryptKdfParams(options) { - // Check/generate the salt - const salt = options.salt != null - ? getBytes(options.salt, "options.salt") - : randomBytes(32); - // Override the scrypt password-based key derivation function parameters - let N = 1 << 17, r = 8, p = 1; - if (options.scrypt) { - if (options.scrypt.N) { - N = options.scrypt.N; - } - if (options.scrypt.r) { - r = options.scrypt.r; - } - if (options.scrypt.p) { - p = options.scrypt.p; - } - } - assertArgument(typeof N === "number" && - N > 0 && - Number.isSafeInteger(N) && - (BigInt(N) & BigInt(N - 1)) === BigInt(0), "invalid scrypt N parameter", "options.N", N); - assertArgument(typeof r === "number" && r > 0 && Number.isSafeInteger(r), "invalid scrypt r parameter", "options.r", r); - assertArgument(typeof p === "number" && p > 0 && Number.isSafeInteger(p), "invalid scrypt p parameter", "options.p", p); - return { name: "scrypt", dkLen: 32, salt, N, r, p }; - } - function _encryptKeystore(key, kdf, account, options) { - const privateKey = getBytes(account.privateKey, "privateKey"); - // Override initialization vector - const iv = options.iv != null ? getBytes(options.iv, "options.iv") : randomBytes(16); - assertArgument(iv.length === 16, "invalid options.iv length", "options.iv", options.iv); - // Override the uuid - const uuidRandom = options.uuid != null - ? getBytes(options.uuid, "options.uuid") - : randomBytes(16); - assertArgument(uuidRandom.length === 16, "invalid options.uuid length", "options.uuid", options.iv); - // This will be used to encrypt the wallet (as per Web3 secret storage) - // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) - // - 32 bytes AES key to encrypt mnemonic with (required here to be corebc Wallet) - const derivedKey = key.slice(0, 16); - const macPrefix = key.slice(16, 32); - // Encrypt the private key - const aesCtr = new CTR(derivedKey, iv); - const ciphertext = getBytes(aesCtr.encrypt(privateKey)); - // Compute the message authentication code, used to check the password - const mac = sha256(concat([macPrefix, ciphertext])); - const data = { - address: account.address.substring(2).toLowerCase(), - id: uuidV4(uuidRandom), - version: 3, - Crypto: { - cipher: "aes-128-ctr", - cipherparams: { - iv: hexlify(iv).substring(2), - }, - ciphertext: hexlify(ciphertext).substring(2), - kdf: "scrypt", - kdfparams: { - salt: hexlify(kdf.salt).substring(2), - n: kdf.N, - dklen: 32, - p: kdf.p, - r: kdf.r, - }, - mac: mac.substring(2), - }, - }; - // If we have a mnemonic, encrypt it into the JSON wallet - if (account.mnemonic) { - const client = options.client != null ? options.client : `corebc/${version}`; - const path = account.mnemonic.path || defaultPath$1; - const locale = account.mnemonic.locale || "en"; - const mnemonicKey = key.slice(32, 64); - const entropy = getBytes(account.mnemonic.entropy, "account.mnemonic.entropy"); - const mnemonicIv = randomBytes(16); - const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); - const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy)); - const now = new Date(); - const timestamp = now.getUTCFullYear() + - "-" + - zpad(now.getUTCMonth() + 1, 2) + - "-" + - zpad(now.getUTCDate(), 2) + - "T" + - zpad(now.getUTCHours(), 2) + - "-" + - zpad(now.getUTCMinutes(), 2) + - "-" + - zpad(now.getUTCSeconds(), 2) + - ".0Z"; - const gethFilename = "UTC--" + timestamp + "--" + data.address; - data["x-corebc"] = { - client, - gethFilename, - path, - locale, - mnemonicCounter: hexlify(mnemonicIv).substring(2), - mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2), - version: "0.1", - }; - } - return JSON.stringify(data); - } - /** - * Return the JSON Keystore Wallet for %%account%% encrypted with - * %%password%%. - * - * The %%options%% can be used to tune the password-based key - * derivation function parameters, explicitly set the random values - * used. Any provided [[ProgressCallback]] is ignord. - */ - function encryptKeystoreJsonSync(account, password, options) { - if (options == null) { - options = {}; - } - const passwordBytes = getPassword(password); - const kdf = getEncryptKdfParams(options); - const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64); - return _encryptKeystore(getBytes(key), kdf, account, options); - } - /** - * Resolved to the JSON Keystore Wallet for %%account%% encrypted - * with %%password%%. - * - * The %%options%% can be used to tune the password-based key - * derivation function parameters, explicitly set the random values - * used and provide a [[ProgressCallback]] to receive periodic updates - * on the completion status.. - */ - async function encryptKeystoreJson(account, password, options) { - if (options == null) { - options = {}; - } - const passwordBytes = getPassword(password); - const kdf = getEncryptKdfParams(options); - const key = await scrypt(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback); - return _encryptKeystore(getBytes(key), kdf, account, options); - } - - /** - * Explain HD Wallets.. - * - * @_subsection: api/wallet:HD Wallets [hd-wallets] - */ - // import { arrayify, - // // hexDataSlice - // } from "../utils/data.js"; - // function sha512Hash(password: BytesLike, salt: BytesLike): Uint8Array { - // const p = getBytes(password); - // const s = getBytes(salt); - // return getBytes(pbkdf2(p, s, 2048, 57, "sha512")); - // } - /** - * The default derivation path for Core HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) - */ - const defaultPath = "m"; - // "Bitcoin seed" - // const MasterSecret = new Uint8Array([66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100]); - const HardenedBit = 0x80000000; - // function addScalar(a: Uint8Array, b: Uint8Array): Uint8Array { - // b = getBytes(concat([b.slice(0, 53), "0x00000000"])); - // b[0] &= 0xfc; - // const c = new Uint8Array(57); - // let hold = 0; - // for (let i = 0; i < 57; i++) { - // hold += a[i] + b[i]; - // c[i] = hold % 256; - // hold = Math.floor(hold / 256); - // } - // return c; - // }; - const _guard = {}; - function derivePath(node, path) { - const components = path.split("/"); - assertArgument(components.length > 0 && (components[0] === "m" || node.depth > 0), "invalid path", "path", path); - if (components[0] === "m") { - components.shift(); - } - let result = node; - for (let i = 0; i < components.length; i++) { - const component = components[i]; - if (component.match(/^[0-9]+'$/)) { - const index = parseInt(component.substring(0, component.length - 1)); - assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component); - result = result.deriveChild(HardenedBit + index); - } - else if (component.match(/^[0-9]+$/)) { - const index = parseInt(component); - assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component); - result = result.deriveChild(index); - } - else { - assertArgument(false, "invalid path component", `path[${i}]`, component); - } - } - return result; - } - /** - * An **HDNodeWallet** is a [[Signer]] backed by the private key derived - * from an HD Node using the [[link-bip-32]] stantard. - * - * An HD Node forms a hierarchal structure with each HD Node having a - * private key and the ability to derive child HD Nodes, defined by - * a path indicating the index of each child. - */ - class HDNodeWallet extends BaseWallet { - /** - * The compressed public key. - */ - publicKey; - prefix; - /** - * The fingerprint. - * - * A fingerprint allows quick qay to detect parent and child nodes, - * but developers should be prepared to deal with collisions as it - * is only 4 bytes. - */ - fingerprint; - /** - * The parent fingerprint. - */ - parentFingerprint; - /** - * The mnemonic used to create this HD Node, if available. - * - * Sources such as extended keys do not encode the mnemonic, in - * which case this will be ``null``. - */ - mnemonic; - #seed; - /** - * The derivation path of this wallet. - * - * Since extended keys do not provider full path details, this - * may be ``null``, if instantiated from a source that does not - * enocde it. - */ - path; - /** - * The child index of this wallet. Values over ``2 *\* 31`` indicate - * the node is hardened. - */ - index; - /** - * The depth of this wallet, which is the number of components - * in its path. - */ - depth; - /** - * @private - */ - constructor({ guard, seed, signingKey, parentFingerprint, path, index, depth, mnemonic, provider, prefix, }) { - super({ - signingKey, - prefix, - provider, - }); - assertPrivate(guard, _guard, "HDNodeWallet"); - defineProperties(this, { publicKey: signingKey.publicKey }); - this.prefix = prefix; - this.#seed = seed; - const fingerprint = dataSlice(ripemd160(sha256(this.publicKey)), 0, 4); - defineProperties(this, { - parentFingerprint, - fingerprint, - path, - index, - depth, - }); - defineProperties(this, { mnemonic }); - } - connect(provider) { - return new HDNodeWallet({ - guard: _guard, - signingKey: this.signingKey, - parentFingerprint: this.parentFingerprint, - path: this.path, - index: this.index, - depth: this.depth, - seed: this.#seed, - mnemonic: this.mnemonic, - provider, - prefix: this.prefix, - }); - } - #account() { - const account = { - address: this.address, - privateKey: this.privateKey, - }; - const m = this.mnemonic; - if (this.path && m && m.wordlist.locale === "en" && m.password === "") { - account.mnemonic = { - path: this.path, - locale: "en", - entropy: m.entropy, - }; - } - return account; - } - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - async encrypt(password, progressCallback) { - return await encryptKeystoreJson(this.#account(), password, { - progressCallback, - }); - } - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password) { - return encryptKeystoreJsonSync(this.#account(), password); - } - /** - * Returns true if this wallet has a path, providing a Type Guard - * that the path is non-null. - */ - hasPath() { - return this.path != null; - } - /** - * Return the child for %%index%%. - */ - deriveChild(_index) { - const newPrivateKey = Ed448Goldilock.HDWalletGenerateKeyFromSeed(this.#seed, Number(_index)); - const newSigningKey = new SigningKey(newPrivateKey); - // Base path - let path = this.path; - if (path) { - path += "/" + (_index & ~HardenedBit); - if (_index & HardenedBit) { - path += "'"; - } - } - return new HDNodeWallet({ - guard: _guard, - signingKey: newSigningKey, - parentFingerprint: this.fingerprint, - path, - index: _index, - seed: this.#seed, - depth: this.depth + 1, - mnemonic: this.mnemonic, - provider: this.provider, - prefix: this.prefix, - }); - } - /** - * Return the HDNode for %%path%% from this node. - */ - derivePath(path) { - return derivePath(this, path); - } - static #fromSeed({ _seed, mnemonic, prefix, path, }) { - const extendetPrivateKey = Ed448Goldilock.HDWalletGenerateKeyFromSeed(_seed, 0); - const signingKey = new SigningKey(extendetPrivateKey); - // console.log({ privateKey, thisKey: signingKey.privateKey,len:tmp.privateKey.length }) - return new HDNodeWallet({ - seed: _seed, - guard: _guard, - signingKey, - parentFingerprint: "0x00000000", - path: path || defaultPath, - index: 0, - depth: 0, - mnemonic, - provider: null, - prefix, - }); - } - /** - * Creates a new random HDNode. - */ - static createRandom(prefix, password, path, wordlist) { - if (password == null) { - password = ""; - } - if (path == null) { - path = defaultPath; - } - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - const mnemonic = Mnemonic.fromEntropy(randomBytes(32), password, wordlist); - return HDNodeWallet.#fromSeed({ - _seed: mnemonic.computeSeed(), - mnemonic, - prefix, - }).derivePath(path); - } - /** - * Create am HD Node from %%mnemonic%%. - */ - static fromMnemonic(mnemonic, prefix, path) { - if (!path) { - path = defaultPath; - } - return HDNodeWallet.#fromSeed({ - _seed: mnemonic.computeSeed(), - mnemonic, - prefix, - }).derivePath(path); - } - static mnemonicToSeed(mnemonic, password) { - const seed = mnemonicToSeed(mnemonic, password); - return seed; - } - /** - * Creates an HD Node from a mnemonic %%phrase%%. - */ - static fromPhrase({ phrase, prefix, password, path, wordlist, }) { - if (!password) { - password = ""; - } - if (!path) { - path = defaultPath; - } - if (!wordlist) { - wordlist = LangEn.wordlist(); - } - const mnemonic = Mnemonic.fromPhrase({ phrase, password, wordlist }); - const _seed = mnemonic.computeSeed(); - return HDNodeWallet.#fromSeed({ - _seed, - mnemonic, - prefix, - }).derivePath(path); - } - /** - * Creates an HD Node from a %%seed%%. - */ - static fromSeed({ seed, prefix, path, }) { - return HDNodeWallet.#fromSeed({ - _seed: seed, - mnemonic: null, - path: path || defaultPath, - prefix, - }); - } - } - /* - export class HDNodeWalletManager { - #root: HDNodeWallet; - - constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) { - if (password == null) { password = ""; } - if (path == null) { path = "m/44'/60'/0'/0"; } - if (locale == null) { locale = LangEn.wordlist(); } - this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale); - } - - getSigner(index?: number): HDNodeWallet { - return this.#root.deriveChild((index == null) ? 0: index); - } - } - */ - /** - * Returns the [[link-bip-32]] path for the acount at %%index%%. - * - * This is the pattern used by wallets like Ledger. - * - * There is also an [alternate pattern](getIndexedAccountPath) used by - * some software. - */ - function getAccountPath(_index) { - const index = getNumber(_index, "index"); - assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); - return `m/44'/60'/${index}'/0/0`; - } - /** - * Returns the path using an alternative pattern for deriving accounts, - * at %%index%%. - * - * This derivation path uses the //index// component rather than the - * //account// component to derive sequential accounts. - * - * This is the pattern used by wallets like MetaMask. - */ - function getIndexedAccountPath(_index) { - const index = getNumber(_index, "index"); - assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); - return `m/44'/60'/0'/0/${index}`; - } - - /** - * @_subsection: api/wallet:JSON Wallets [json-wallets] - */ - // @ts-ignore - const { CBC, pkcs7Strip } = pkg; - /** - * Returns true if %%json%% is a valid JSON Crowdsale wallet. - */ - function isCrowdsaleJson(json) { - try { - const data = JSON.parse(json); - if (data.encseed) { - return true; - } - } - catch (error) { } - return false; - } - /** - * Before Core launched, it was necessary to create a wallet - * format for backers to use, which would be used to receive xcb - * as a reward for contributing to the project. - * - * The [[link-crowdsale]] format is now obsolete, but it is still - * useful to support and the additional code is fairly trivial as - * all the primitives required are used through core portions of - * the library. - */ - function decryptCrowdsaleJson(json, _password) { - const data = JSON.parse(json); - const password = getPassword(_password); - // Core Address - const address = getAddress(spelunk(data, "ethaddr:string!")); - // Encrypted Seed - const encseed = looseArrayify(spelunk(data, "encseed:string!")); - assertArgument(encseed && encseed.length % 16 === 0, "invalid encseed", "json", json); - const key = getBytes(pbkdf2(password, password, 2000, 32, "sha256")).slice(0, 16); - const iv = encseed.slice(0, 16); - const encryptedSeed = encseed.slice(16); - // Decrypt the seed - const aesCbc = new CBC(key, iv); - const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed))); - // This wallet format is weird... Convert the binary encoded hex to a string. - let seedHex = ""; - for (let i = 0; i < seed.length; i++) { - seedHex += String.fromCharCode(seed[i]); - } - return { address, privateKey: id(seedHex) }; - } - - function stall(duration) { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, duration); - }); - } - /** - * A **Wallet** manages a single private key which is used to sign - * transactions, messages and other common payloads. - * - * This class is generally the main entry point for developers - * that wish to use a private key directly, as it can create - * instances from a large variety of common sources, including - * raw private key, [[link-bip-39]] mnemonics and encrypte JSON - * wallets. - */ - class Wallet extends BaseWallet { - /** - * Create a new wallet for the %%privateKey%% or %%signingKey%%, optionally connected - * to %%provider%%. - */ - constructor({ key, prefix, provider, }) { - if (typeof key === "string" && !key.startsWith("0x")) { - key = "0x" + key; - } - let signingKey = typeof key === "string" ? new SigningKey(key) : key; - super({ - signingKey, - prefix, - provider, - }); - } - connect(provider) { - return new Wallet({ - key: this.signingKey, - prefix: this.prefix, - provider, - }); - } - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - async encrypt(password, progressCallback) { - const account = { address: this.address, privateKey: this.privateKey }; - return await encryptKeystoreJson(account, password, { progressCallback }); - } - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password) { - const account = { address: this.address, privateKey: this.privateKey }; - return encryptKeystoreJsonSync(account, password); - } - static #fromAccount(account) { - assertArgument(account, "invalid JSON wallet", "json", "[ REDACTED ]"); - const address = account.address; - const prefix = extractPrefix(address); - if ("mnemonic" in account && - account.mnemonic && - account.mnemonic.locale === "en") { - const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy); - const wallet = HDNodeWallet.fromMnemonic(mnemonic, prefix, account.mnemonic.path); - if (wallet.address === account.address && - wallet.privateKey === account.privateKey) { - return wallet; - } - console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key"); - } - const wallet = new Wallet({ - key: account.privateKey, - prefix, - }); - assertArgument(wallet.address === account.address, "address/privateKey mismatch", "json", "[ REDACTED ]"); - return wallet; - } - /** - * Creates (asynchronously) a **Wallet** by decrypting the %%json%% - * with %%password%%. - * - * If %%progress%% is provided, it is called periodically during - * decryption so that any UI can be updated. - */ - static async fromEncryptedJson(json, password, progress) { - let account = null; - if (isKeystoreJson(json)) { - account = await decryptKeystoreJson(json, password, progress); - } - else if (isCrowdsaleJson(json)) { - if (progress) { - progress(0); - await stall(0); - } - account = decryptCrowdsaleJson(json, password); - if (progress) { - progress(1); - await stall(0); - } - } - return Wallet.#fromAccount(account); - } - /** - * Creates a **Wallet** by decrypting the %%json%% with %%password%%. - * - * The [[fromEncryptedJson]] method is preferred, as this method - * will lock up and freeze the UI during decryption, which may take - * some time. - */ - static fromEncryptedJsonSync(json, password) { - let account = null; - if (isKeystoreJson(json)) { - account = decryptKeystoreJsonSync(json, password); - } - else if (isCrowdsaleJson(json)) { - account = decryptCrowdsaleJson(json, password); - } - else { - assertArgument(false, "invalid JSON wallet", "json", "[ REDACTED ]"); - } - return Wallet.#fromAccount(account); - } - /** - * Creates a new random [[HDNodeWallet]] using the avavilable - * [cryptographic random source](randomBytes). - * - * If there is no crytographic random source, this will throw. - */ - static createRandom(prefix, provider) { - const wallet = HDNodeWallet.createRandom(prefix, undefined, undefined, undefined); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } - /** - * Creates a [[HDNodeWallet]] for %%phrase%%. - */ - static fromPhrase({ phrase, prefix, provider, password, }) { - const wallet = HDNodeWallet.fromPhrase({ - phrase, - prefix, - password, - }); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } - static fromSeed({ seed, prefix, provider, path, }) { - const wallet = HDNodeWallet.fromSeed({ - seed, - prefix, - path: path || defaultPath, - }); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } - } - - const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; - /** - * @_ignore - */ - function decodeBits(width, data) { - const maxValue = (1 << width) - 1; - const result = []; - let accum = 0, bits = 0, flood = 0; - for (let i = 0; i < data.length; i++) { - // Accumulate 6 bits of data - accum = (accum << 6) | Base64.indexOf(data[i]); - bits += 6; - // While we have enough for a word... - while (bits >= width) { - // ...read the word - const value = accum >> (bits - width); - accum &= (1 << (bits - width)) - 1; - bits -= width; - // A value of 0 indicates we exceeded maxValue, it - // floods over into the next value - if (value === 0) { - flood += maxValue; - } - else { - result.push(value + flood); - flood = 0; - } - } - } - return result; - } - - /** - * @_ignore - */ - function decodeOwlA(data, accents) { - let words = decodeOwl(data).join(","); - // Inject the accents - accents.split(/,/g).forEach((accent) => { - const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); - assertArgument(match !== null, "internal error parsing accents", "accents", accents); - let posOffset = 0; - const positions = decodeBits(parseInt(match[3]), match[4]); - const charCode = parseInt(match[2]); - const regex = new RegExp(`([${match[1]}])`, "g"); - words = words.replace(regex, (all, letter) => { - const rem = --positions[posOffset]; - if (rem === 0) { - letter = String.fromCharCode(letter.charCodeAt(0), charCode); - posOffset++; - } - return letter; - }); - }); - return words.split(","); - } - - /** - * An OWL-A format Wordlist extends the OWL format to add an - * overlay onto an OWL format Wordlist to support diacritic - * marks. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on latin-1 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ - class WordlistOwlA extends WordlistOwl { - #accent; - constructor(locale, data, accent, checksum) { - super(locale, data, checksum); - this.#accent = accent; - } - get _accent() { - return this.#accent; - } - _decodeWords() { - return decodeOwlA(this._data, this._accent); - } - } - - const wordlists = { - en: LangEn.wordlist(), - }; - - var corebc = /*#__PURE__*/Object.freeze({ - __proto__: null, - AbiCoder: AbiCoder, - AbstractProvider: AbstractProvider, - AbstractSigner: AbstractSigner, - AlchemyProvider: AlchemyProvider, - AnkrProvider: AnkrProvider, - BaseContract: BaseContract, - BaseWallet: BaseWallet, - BigNumber: BigNumber, - Block: Block, - BrowserProvider: BrowserProvider, - CloudflareProvider: CloudflareProvider, - ConstructorFragment: ConstructorFragment, - Contract: Contract, - ContractEventPayload: ContractEventPayload, - ContractFactory: ContractFactory, - ContractTransactionReceipt: ContractTransactionReceipt, - ContractTransactionResponse: ContractTransactionResponse, - ContractUnknownEventPayload: ContractUnknownEventPayload, - CoreSymbol: CoreSymbol, - Ed448Goldilock: Ed448Goldilock, - EnergyCostPlugin: EnergyCostPlugin, - ErrorDescription: ErrorDescription, - ErrorFragment: ErrorFragment, - EventFragment: EventFragment, - EventLog: EventLog, - EventPayload: EventPayload, - FallbackFragment: FallbackFragment, - FallbackProvider: FallbackProvider, - FeeData: FeeData, - FeeDataNetworkPlugin: FeeDataNetworkPlugin, - FetchCancelSignal: FetchCancelSignal, - FetchRequest: FetchRequest, - FetchResponse: FetchResponse, - FixedNumber: FixedNumber, - Fragment: Fragment, - FunctionFragment: FunctionFragment, - HDNodeWallet: HDNodeWallet, - Indexed: Indexed, - InfuraProvider: InfuraProvider, - InfuraWebSocketProvider: InfuraWebSocketProvider, - Interface: Interface, - IpcSocketProvider: IpcSocketProvider, - JsonRpcApiProvider: JsonRpcApiProvider, - JsonRpcProvider: JsonRpcProvider, - JsonRpcSigner: JsonRpcSigner, - LangEn: LangEn, - Log: Log, - LogDescription: LogDescription, - MaxInt256: MaxInt256, - MaxUint256: MaxUint256, - MessagePrefix: MessagePrefix, - MinInt256: MinInt256, - Mnemonic: Mnemonic, - N: N, - NamedFragment: NamedFragment, - Network: Network, - NetworkPlugin: NetworkPlugin, - NonceManager: NonceManager, - OrePerXCB: OrePerXCB, - ParamType: ParamType, - PocketProvider: PocketProvider, - QuickNodeProvider: QuickNodeProvider, - Result: Result, - Signature: Signature, - SigningKey: SigningKey, - SocketBlockSubscriber: SocketBlockSubscriber, - SocketEventSubscriber: SocketEventSubscriber, - SocketPendingSubscriber: SocketPendingSubscriber, - SocketProvider: SocketProvider, - SocketSubscriber: SocketSubscriber, - StructFragment: StructFragment, - Transaction: Transaction, - TransactionDescription: TransactionDescription, - TransactionReceipt: TransactionReceipt, - TransactionResponse: TransactionResponse, - Typed: Typed, - TypedDataEncoder: TypedDataEncoder, - UnmanagedSubscriber: UnmanagedSubscriber, - Utf8ErrorFuncs: Utf8ErrorFuncs, - VoidSigner: VoidSigner, - Wallet: Wallet, - WebSocketProvider: WebSocketProvider, - Wordlist: Wordlist, - WordlistOwl: WordlistOwl, - WordlistOwlA: WordlistOwlA, - ZeroAddress: ZeroAddress, - ZeroHash: ZeroHash, - accessListify: accessListify, - arrayify: arrayify, - assert: assert, - assertArgument: assertArgument, - assertArgumentCount: assertArgumentCount, - assertNormalize: assertNormalize, - assertPrivate: assertPrivate, - checkResultErrors: checkResultErrors, - computeAddress: computeAddress, - computeHmac: computeHmac, - concat: concat, - copyRequest: copyRequest, - dataLength: dataLength, - dataSlice: dataSlice, - decodeBase58: decodeBase58, - decodeBase64: decodeBase64, - decodeBytes32String: decodeBytes32String, - decodeRlp: decodeRlp, - decryptCrowdsaleJson: decryptCrowdsaleJson, - decryptKeystoreJson: decryptKeystoreJson, - decryptKeystoreJsonSync: decryptKeystoreJsonSync, - defaultPath: defaultPath, - defineProperties: defineProperties, - encodeBase58: encodeBase58, - encodeBase64: encodeBase64, - encodeBytes32String: encodeBytes32String, - encodeRlp: encodeRlp, - encryptKeystoreJson: encryptKeystoreJson, - encryptKeystoreJsonSync: encryptKeystoreJsonSync, - formatUnits: formatUnits, - formatXCB: formatXCB, - fromTwos: fromTwos, - getAccountPath: getAccountPath, - getAddress: getAddress, - getBigInt: getBigInt, - getBytes: getBytes, - getBytesCopy: getBytesCopy, - getCreate2Address: getCreate2Address, - getCreateAddress: getCreateAddress, - getDefaultProvider: getDefaultProvider, - getIndexedAccountPath: getIndexedAccountPath, - getNumber: getNumber, - getUint: getUint, - hashMessage: hashMessage, - hexConcat: hexConcat, - hexlify: hexlify, - id: id, - isAddress: isAddress, - isAddressable: isAddressable, - isBytesLike: isBytesLike, - isCallException: isCallException, - isCrowdsaleJson: isCrowdsaleJson, - isError: isError, - isHexString: isHexString, - isKeystoreJson: isKeystoreJson, - keccak256: keccak256, - lock: lock, - makeError: makeError, - mask: mask, - networkIdToPrefix: networkIdToPrefix, - parseUnits: parseUnits, - parseXCB: parseXCB, - pbkdf2: pbkdf2, - publicToAddress: publicToAddress, - randomBytes: randomBytes, - recoverAddress: recoverAddress, - resolveAddress: resolveAddress, - resolveProperties: resolveProperties, - ripemd160: ripemd160, - scrypt: scrypt, - scryptSync: scryptSync, - sha256: sha256, - sha512: sha512, - showThrottleMessage: showThrottleMessage, - solidityPacked: solidityPacked, - solidityPackedSha256: solidityPackedSha256, - stripZerosLeft: stripZerosLeft, - toBeArray: toBeArray, - toBeHex: toBeHex, - toBigInt: toBigInt, - toNumber: toNumber, - toQuantity: toQuantity, - toTwos: toTwos, - toUtf8Bytes: toUtf8Bytes, - toUtf8CodePoints: toUtf8CodePoints, - toUtf8String: toUtf8String, - uuidV4: uuidV4, - verifyMessage: verifyMessage, - verifyTypedData: verifyTypedData, - version: version, - wordlists: wordlists, - zeroPadBytes: zeroPadBytes, - zeroPadValue: zeroPadValue - }); - - Object.defineProperty(exports, 'Buffer', { - enumerable: true, - get: function () { return buffer.Buffer; } - }); - exports.AbiCoder = AbiCoder; - exports.AbstractProvider = AbstractProvider; - exports.AbstractSigner = AbstractSigner; - exports.AlchemyProvider = AlchemyProvider; - exports.AnkrProvider = AnkrProvider; - exports.BaseContract = BaseContract; - exports.BaseWallet = BaseWallet; - exports.BigNumber = BigNumber; - exports.Block = Block; - exports.BrowserProvider = BrowserProvider; - exports.CloudflareProvider = CloudflareProvider; - exports.ConstructorFragment = ConstructorFragment; - exports.Contract = Contract; - exports.ContractEventPayload = ContractEventPayload; - exports.ContractFactory = ContractFactory; - exports.ContractTransactionReceipt = ContractTransactionReceipt; - exports.ContractTransactionResponse = ContractTransactionResponse; - exports.ContractUnknownEventPayload = ContractUnknownEventPayload; - exports.CoreSymbol = CoreSymbol; - exports.Ed448Goldilock = Ed448Goldilock; - exports.EnergyCostPlugin = EnergyCostPlugin; - exports.ErrorDescription = ErrorDescription; - exports.ErrorFragment = ErrorFragment; - exports.EventFragment = EventFragment; - exports.EventLog = EventLog; - exports.EventPayload = EventPayload; - exports.FallbackFragment = FallbackFragment; - exports.FallbackProvider = FallbackProvider; - exports.FeeData = FeeData; - exports.FeeDataNetworkPlugin = FeeDataNetworkPlugin; - exports.FetchCancelSignal = FetchCancelSignal; - exports.FetchRequest = FetchRequest; - exports.FetchResponse = FetchResponse; - exports.FixedNumber = FixedNumber; - exports.Fragment = Fragment; - exports.FunctionFragment = FunctionFragment; - exports.HDNodeWallet = HDNodeWallet; - exports.Indexed = Indexed; - exports.InfuraProvider = InfuraProvider; - exports.InfuraWebSocketProvider = InfuraWebSocketProvider; - exports.Interface = Interface; - exports.IpcSocketProvider = IpcSocketProvider; - exports.JsonRpcApiProvider = JsonRpcApiProvider; - exports.JsonRpcProvider = JsonRpcProvider; - exports.JsonRpcSigner = JsonRpcSigner; - exports.LangEn = LangEn; - exports.Log = Log; - exports.LogDescription = LogDescription; - exports.MaxInt256 = MaxInt256; - exports.MaxUint256 = MaxUint256; - exports.MessagePrefix = MessagePrefix; - exports.MinInt256 = MinInt256; - exports.Mnemonic = Mnemonic; - exports.N = N; - exports.NamedFragment = NamedFragment; - exports.Network = Network; - exports.NetworkPlugin = NetworkPlugin; - exports.NonceManager = NonceManager; - exports.OrePerXCB = OrePerXCB; - exports.ParamType = ParamType; - exports.PocketProvider = PocketProvider; - exports.QuickNodeProvider = QuickNodeProvider; - exports.Result = Result; - exports.Signature = Signature; - exports.SigningKey = SigningKey; - exports.SocketBlockSubscriber = SocketBlockSubscriber; - exports.SocketEventSubscriber = SocketEventSubscriber; - exports.SocketPendingSubscriber = SocketPendingSubscriber; - exports.SocketProvider = SocketProvider; - exports.SocketSubscriber = SocketSubscriber; - exports.StructFragment = StructFragment; - exports.Transaction = Transaction; - exports.TransactionDescription = TransactionDescription; - exports.TransactionReceipt = TransactionReceipt; - exports.TransactionResponse = TransactionResponse; - exports.Typed = Typed; - exports.TypedDataEncoder = TypedDataEncoder; - exports.UnmanagedSubscriber = UnmanagedSubscriber; - exports.Utf8ErrorFuncs = Utf8ErrorFuncs; - exports.VoidSigner = VoidSigner; - exports.Wallet = Wallet; - exports.WebSocketProvider = WebSocketProvider; - exports.Wordlist = Wordlist; - exports.WordlistOwl = WordlistOwl; - exports.WordlistOwlA = WordlistOwlA; - exports.ZeroAddress = ZeroAddress; - exports.ZeroHash = ZeroHash; - exports.accessListify = accessListify; - exports.arrayify = arrayify; - exports.assert = assert; - exports.assertArgument = assertArgument; - exports.assertArgumentCount = assertArgumentCount; - exports.assertNormalize = assertNormalize; - exports.assertPrivate = assertPrivate; - exports.checkResultErrors = checkResultErrors; - exports.computeAddress = computeAddress; - exports.computeHmac = computeHmac; - exports.concat = concat; - exports.copyRequest = copyRequest; - exports.corebc = corebc; - exports.dataLength = dataLength; - exports.dataSlice = dataSlice; - exports.decodeBase58 = decodeBase58; - exports.decodeBase64 = decodeBase64; - exports.decodeBytes32String = decodeBytes32String; - exports.decodeRlp = decodeRlp; - exports.decryptCrowdsaleJson = decryptCrowdsaleJson; - exports.decryptKeystoreJson = decryptKeystoreJson; - exports.decryptKeystoreJsonSync = decryptKeystoreJsonSync; - exports.defaultPath = defaultPath; - exports.defineProperties = defineProperties; - exports.encodeBase58 = encodeBase58; - exports.encodeBase64 = encodeBase64; - exports.encodeBytes32String = encodeBytes32String; - exports.encodeRlp = encodeRlp; - exports.encryptKeystoreJson = encryptKeystoreJson; - exports.encryptKeystoreJsonSync = encryptKeystoreJsonSync; - exports.formatUnits = formatUnits; - exports.formatXCB = formatXCB; - exports.fromTwos = fromTwos; - exports.getAccountPath = getAccountPath; - exports.getAddress = getAddress; - exports.getBigInt = getBigInt; - exports.getBytes = getBytes; - exports.getBytesCopy = getBytesCopy; - exports.getCreate2Address = getCreate2Address; - exports.getCreateAddress = getCreateAddress; - exports.getDefaultProvider = getDefaultProvider; - exports.getIndexedAccountPath = getIndexedAccountPath; - exports.getNumber = getNumber; - exports.getUint = getUint; - exports.hashMessage = hashMessage; - exports.hexConcat = hexConcat; - exports.hexlify = hexlify; - exports.id = id; - exports.isAddress = isAddress; - exports.isAddressable = isAddressable; - exports.isBytesLike = isBytesLike; - exports.isCallException = isCallException; - exports.isCrowdsaleJson = isCrowdsaleJson; - exports.isError = isError; - exports.isHexString = isHexString; - exports.isKeystoreJson = isKeystoreJson; - exports.keccak256 = keccak256; - exports.lock = lock; - exports.makeError = makeError; - exports.mask = mask; - exports.networkIdToPrefix = networkIdToPrefix; - exports.parseUnits = parseUnits; - exports.parseXCB = parseXCB; - exports.pbkdf2 = pbkdf2; - exports.publicToAddress = publicToAddress; - exports.randomBytes = randomBytes; - exports.recoverAddress = recoverAddress; - exports.resolveAddress = resolveAddress; - exports.resolveProperties = resolveProperties; - exports.ripemd160 = ripemd160; - exports.scrypt = scrypt; - exports.scryptSync = scryptSync; - exports.sha256 = sha256; - exports.sha512 = sha512; - exports.showThrottleMessage = showThrottleMessage; - exports.solidityPacked = solidityPacked; - exports.solidityPackedSha256 = solidityPackedSha256; - exports.stripZerosLeft = stripZerosLeft; - exports.toBeArray = toBeArray; - exports.toBeHex = toBeHex; - exports.toBigInt = toBigInt; - exports.toNumber = toNumber; - exports.toQuantity = toQuantity; - exports.toTwos = toTwos; - exports.toUtf8Bytes = toUtf8Bytes; - exports.toUtf8CodePoints = toUtf8CodePoints; - exports.toUtf8String = toUtf8String; - exports.uuidV4 = uuidV4; - exports.verifyMessage = verifyMessage; - exports.verifyTypedData = verifyTypedData; - exports.version = version; - exports.wordlists = wordlists; - exports.zeroPadBytes = zeroPadBytes; - exports.zeroPadValue = zeroPadValue; - -})); -//# sourceMappingURL=corebc.umd.js.map diff --git a/dist/corebc.umd.js.map b/dist/corebc.umd.js.map deleted file mode 100644 index 3f31b9535..000000000 --- a/dist/corebc.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"corebc.umd.js","sources":["../lib.esm/_version.js","../lib.esm/logger/logger.js","../lib.esm/utils/properties.js","../lib.esm/utils/errors.js","../lib.esm/utils/data.js","../lib.esm/bigNumber/bigNumber.js","../lib.esm/crypto/rlp.js","../node_modules/@noble/hashes/esm/_assert.js","../node_modules/@noble/hashes/esm/utils.js","../node_modules/@noble/hashes/esm/hmac.js","../node_modules/@noble/hashes/esm/pbkdf2.js","../node_modules/@noble/hashes/esm/_sha2.js","../node_modules/@noble/hashes/esm/sha256.js","../node_modules/@noble/hashes/esm/_u64.js","../node_modules/@noble/hashes/esm/sha512.js","../node_modules/@noble/hashes/esm/sha3.js","../lib.esm/utils/maths.js","../lib.esm/utils/base58.js","../lib.esm/utils/base64-browser.js","../lib.esm/utils/events.js","../lib.esm/utils/utf8.js","../lib.esm/utils/geturl-browser.js","../lib.esm/utils/fetch.js","../lib.esm/utils/fixednumber.js","../lib.esm/utils/rlp-decode.js","../lib.esm/utils/rlp-encode.js","../lib.esm/utils/units.js","../lib.esm/utils/uuid.js","../lib.esm/crypto/ed448goldilock-browser.js","../lib.esm/crypto/crypto-browser.js","../lib.esm/crypto/sha3.js","../lib.esm/address/index.js","../lib.esm/crypto/hmac.js","../node_modules/@noble/hashes/esm/ripemd160.js","../lib.esm/crypto/ripemd160.js","../lib.esm/crypto/pbkdf2.js","../lib.esm/crypto/random.js","../node_modules/@noble/hashes/esm/scrypt.js","../lib.esm/crypto/scrypt.js","../lib.esm/crypto/keccak.js","../node_modules/@noble/secp256k1/index.js","../lib.esm/crypto/signing-key.js","../lib.esm/crypto/signature.js","../lib.esm/crypto/index.js","../lib.esm/transaction/address.js","../lib.esm/abi/coders/abstract-coder.js","../lib.esm/abi/typed.js","../lib.esm/abi/coders/address.js","../lib.esm/abi/coders/anonymous.js","../lib.esm/abi/coders/array.js","../lib.esm/abi/coders/boolean.js","../lib.esm/abi/coders/bytes.js","../lib.esm/abi/coders/fixed-bytes.js","../lib.esm/abi/coders/null.js","../lib.esm/abi/coders/number.js","../lib.esm/abi/coders/string.js","../lib.esm/abi/coders/tuple.js","../lib.esm/hash/id.js","../lib.esm/constants/addresses.js","../lib.esm/constants/hashes.js","../lib.esm/constants/numbers.js","../lib.esm/constants/strings.js","../lib.esm/transaction/accesslist.js","../lib.esm/transaction/transaction.js","../lib.esm/hash/message.js","../lib.esm/hash/solidity.js","../lib.esm/hash/typed-data.js","../lib.esm/abi/fragments.js","../lib.esm/abi/abi-coder.js","../lib.esm/abi/bytes32.js","../lib.esm/abi/interface.js","../lib.esm/address/contract-address.js","../lib.esm/address/checks.js","../lib.esm/providers/provider.js","../lib.esm/contract/wrappers.js","../lib.esm/contract/contract.js","../lib.esm/contract/factory.js","../lib.esm/providers/format.js","../lib.esm/providers/plugins-network.js","../lib.esm/providers/network.js","../lib.esm/providers/subscriber-polling.js","../lib.esm/providers/abstract-provider.js","../lib.esm/providers/abstract-signer.js","../lib.esm/providers/community.js","../lib.esm/providers/subscriber-filterid.js","../lib.esm/providers/provider-jsonrpc.js","../lib.esm/providers/provider-ankr.js","../lib.esm/providers/provider-alchemy.js","../lib.esm/providers/provider-cloudflare.js","../lib.esm/providers/ws-browser.js","../lib.esm/providers/provider-socket.js","../lib.esm/providers/provider-websocket.js","../lib.esm/providers/provider-infura.js","../lib.esm/providers/provider-quicknode.js","../lib.esm/providers/provider-fallback.js","../lib.esm/providers/default-provider.js","../lib.esm/providers/signer-noncemanager.js","../lib.esm/providers/provider-browser.js","../lib.esm/providers/provider-pocket.js","../lib.esm/providers/provider-ipcsocket-browser.js","../lib.esm/wallet/base-wallet.js","../lib.esm/wordlists/decode-owl.js","../lib.esm/wordlists/wordlist.js","../lib.esm/wordlists/wordlist-owl.js","../lib.esm/wordlists/lang-en.js","../lib.esm/wallet/mnemonicToSeed.js","../lib.esm/wallet/mnemonic.js","../lib.esm/wallet/utils.js","../lib.esm/wallet/json-keystore.js","../lib.esm/wallet/hdwallet.js","../lib.esm/wallet/json-crowdsale.js","../lib.esm/wallet/wallet.js","../lib.esm/wordlists/bit-reader.js","../lib.esm/wordlists/decode-owla.js","../lib.esm/wordlists/wordlist-owla.js","../lib.esm/wordlists/wordlists-browser.js"],"sourcesContent":["/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */\n/**\n * The current version of corebc.\n */\nexport const version = \"6.4.0\";\n//# sourceMappingURL=_version.js.map","\"use strict\";\nlet _permanentCensorErrors = false;\nlet _censorErrors = false;\nconst LogLevels = {\n debug: 1,\n default: 2,\n info: 2,\n warning: 3,\n error: 4,\n off: 5,\n};\nlet _logLevel = LogLevels[\"default\"];\nlet _globalLogger = null;\nfunction _checkNormalize() {\n try {\n const missing = [];\n // Make sure all forms of normalization are supported\n [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].forEach((form) => {\n try {\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad normalize\");\n }\n }\n catch (error) {\n missing.push(form);\n }\n });\n if (missing.length) {\n throw new Error(\"missing \" + missing.join(\", \"));\n }\n if (String.fromCharCode(0xe9).normalize(\"NFD\") !==\n String.fromCharCode(0x65, 0x0301)) {\n throw new Error(\"broken implementation\");\n }\n }\n catch (error) {\n return error.message;\n }\n return null;\n}\nconst _normalizeError = _checkNormalize();\nexport var LogLevel;\n(function (LogLevel) {\n LogLevel[\"DEBUG\"] = \"DEBUG\";\n LogLevel[\"INFO\"] = \"INFO\";\n LogLevel[\"WARNING\"] = \"WARNING\";\n LogLevel[\"ERROR\"] = \"ERROR\";\n LogLevel[\"OFF\"] = \"OFF\";\n})(LogLevel || (LogLevel = {}));\nexport var ErrorCode;\n(function (ErrorCode) {\n ///////////////////\n // Generic Errors\n // Unknown Error\n ErrorCode[\"UNKNOWN_ERROR\"] = \"UNKNOWN_ERROR\";\n // Not Implemented\n ErrorCode[\"NOT_IMPLEMENTED\"] = \"NOT_IMPLEMENTED\";\n // Unsupported Operation\n // - operation\n ErrorCode[\"UNSUPPORTED_OPERATION\"] = \"UNSUPPORTED_OPERATION\";\n // Network Error (i.e. Core Network, such as an invalid network ID)\n // - event (\"noNetwork\" is not re-thrown in provider.ready; otherwise thrown)\n ErrorCode[\"NETWORK_ERROR\"] = \"NETWORK_ERROR\";\n // Some sort of bad response from the server\n ErrorCode[\"SERVER_ERROR\"] = \"SERVER_ERROR\";\n // Timeout\n ErrorCode[\"TIMEOUT\"] = \"TIMEOUT\";\n ///////////////////\n // Operational Errors\n // Buffer Overrun\n ErrorCode[\"BUFFER_OVERRUN\"] = \"BUFFER_OVERRUN\";\n // Numeric Fault\n // - operation: the operation being executed\n // - fault: the reason this faulted\n ErrorCode[\"NUMERIC_FAULT\"] = \"NUMERIC_FAULT\";\n ///////////////////\n // Argument Errors\n // Missing new operator to an object\n // - name: The name of the class\n ErrorCode[\"MISSING_NEW\"] = \"MISSING_NEW\";\n // Invalid argument (e.g. value is incompatible with type) to a function:\n // - argument: The argument name that was invalid\n // - value: The value of the argument\n ErrorCode[\"INVALID_ARGUMENT\"] = \"INVALID_ARGUMENT\";\n // Missing argument to a function:\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"MISSING_ARGUMENT\"] = \"MISSING_ARGUMENT\";\n // Too many arguments\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"UNEXPECTED_ARGUMENT\"] = \"UNEXPECTED_ARGUMENT\";\n ///////////////////\n // Blockchain Errors\n // Call exception\n // - transaction: the transaction\n // - address?: the contract address\n // - args?: The arguments passed into the function\n // - method?: The Solidity method signature\n // - errorSignature?: The EIP848 error signature\n // - errorArgs?: The EIP848 error parameters\n // - reason: The reason (only for EIP848 \"Error(string)\")\n ErrorCode[\"CALL_EXCEPTION\"] = \"CALL_EXCEPTION\";\n // Insufficient funds (< value + energyLimit * energyPrice)\n // - transaction: the transaction attempted\n ErrorCode[\"INSUFFICIENT_FUNDS\"] = \"INSUFFICIENT_FUNDS\";\n // Nonce has already been used\n // - transaction: the transaction attempted\n ErrorCode[\"NONCE_EXPIRED\"] = \"NONCE_EXPIRED\";\n // The replacement fee for the transaction is too low\n // - transaction: the transaction attempted\n ErrorCode[\"REPLACEMENT_UNDERPRICED\"] = \"REPLACEMENT_UNDERPRICED\";\n // The energy limit could not be estimated\n // - transaction: the transaction passed to estimateEnergy\n ErrorCode[\"UNPREDICTABLE_ENERGY_LIMIT\"] = \"UNPREDICTABLE_ENERGY_LIMIT\";\n // The transaction was replaced by one with a higher energy price\n // - reason: \"cancelled\", \"replaced\" or \"repriced\"\n // - cancelled: true if reason == \"cancelled\" or reason == \"replaced\")\n // - hash: original transaction hash\n // - replacement: the full TransactionsResponse for the replacement\n // - receipt: the receipt of the replacement\n ErrorCode[\"TRANSACTION_REPLACED\"] = \"TRANSACTION_REPLACED\";\n})(ErrorCode || (ErrorCode = {}));\nconst HEX = \"0123456789abcdef\";\nexport class Logger {\n version = \"0.0.1\";\n static errors = ErrorCode;\n static levels = LogLevel;\n constructor(version) {\n Object.defineProperty(this, \"version\", {\n enumerable: true,\n value: version,\n writable: false,\n });\n }\n _log(logLevel, args) {\n const level = logLevel.toLowerCase();\n if (LogLevels[level] == null) {\n this.throwArgumentError(\"invalid log level name\", \"logLevel\", logLevel);\n }\n if (_logLevel > LogLevels[level]) {\n return;\n }\n console.log.apply(console, args);\n }\n debug(...args) {\n this._log(Logger.levels.DEBUG, args);\n }\n info(...args) {\n this._log(Logger.levels.INFO, args);\n }\n warn(...args) {\n this._log(Logger.levels.WARNING, args);\n }\n makeError(message, code, params) {\n // Errors are being censored\n if (_censorErrors) {\n return this.makeError(\"censored error\", code, {});\n }\n if (!code) {\n code = Logger.errors.UNKNOWN_ERROR;\n }\n if (!params) {\n params = {};\n }\n const messageDetails = [];\n Object.keys(params).forEach((key) => {\n const value = params[key];\n try {\n if (value instanceof Uint8Array) {\n let hex = \"\";\n for (let i = 0; i < value.length; i++) {\n hex += HEX[value[i] >> 4];\n hex += HEX[value[i] & 0x0f];\n }\n messageDetails.push(key + \"=Uint8Array(0x\" + hex + \")\");\n }\n else {\n messageDetails.push(key + \"=\" + JSON.stringify(value));\n }\n }\n catch (error) {\n messageDetails.push(key + \"=\" + JSON.stringify(params[key].toString()));\n }\n });\n messageDetails.push(`code=${code}`);\n messageDetails.push(`version=${this.version}`);\n const reason = message;\n if (messageDetails.length) {\n message += \" (\" + messageDetails.join(\", \") + \")\";\n }\n // @TODO: Any??\n const error = new Error(message);\n error.reason = reason;\n error.code = code;\n Object.keys(params).forEach(function (key) {\n error[key] = params[key];\n });\n return error;\n }\n throwError(message, code, params) {\n throw this.makeError(message, code, params);\n }\n throwArgumentError(message, name, value) {\n return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {\n argument: name,\n value: value,\n });\n }\n assert(condition, message, code, params) {\n if (!!condition) {\n return;\n }\n this.throwError(message, code, params);\n }\n assertArgument(condition, message, name, value) {\n if (!!condition) {\n return;\n }\n this.throwArgumentError(message, name, value);\n }\n checkNormalize(message) {\n if (message == null) {\n message = \"platform missing String.prototype.normalize\";\n }\n if (_normalizeError) {\n this.throwError(\"platform missing String.prototype.normalize\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"String.prototype.normalize\",\n form: _normalizeError,\n });\n }\n }\n checkSafeUint53(value, message) {\n if (typeof value !== \"number\") {\n return;\n }\n if (message == null) {\n message = \"value not safe\";\n }\n if (value < 0 || value >= 0x1fffffffffffff) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"out-of-safe-range\",\n value: value,\n });\n }\n if (value % 1) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"non-integer\",\n value: value,\n });\n }\n }\n checkArgumentCount(count, expectedCount, message) {\n if (message) {\n message = \": \" + message;\n }\n else {\n message = \"\";\n }\n if (count < expectedCount) {\n this.throwError(\"missing argument\" + message, Logger.errors.MISSING_ARGUMENT, {\n count: count,\n expectedCount: expectedCount,\n });\n }\n if (count > expectedCount) {\n this.throwError(\"too many arguments\" + message, Logger.errors.UNEXPECTED_ARGUMENT, {\n count: count,\n expectedCount: expectedCount,\n });\n }\n }\n checkNew(target, kind) {\n if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, {\n name: kind.name,\n });\n }\n }\n checkAbstract(target, kind) {\n if (target === kind) {\n this.throwError(\"cannot instantiate abstract class \" +\n JSON.stringify(kind.name) +\n \" directly; use a sub-class\", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: \"new\" });\n }\n else if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, {\n name: kind.name,\n });\n }\n }\n static globalLogger() {\n if (!_globalLogger) {\n _globalLogger = new Logger(\"logger/0.0.1\");\n }\n return _globalLogger;\n }\n static setCensorship(censorship, permanent) {\n if (!censorship && permanent) {\n this.globalLogger().throwError(\"cannot permanently disable censorship\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\",\n });\n }\n if (_permanentCensorErrors) {\n if (!censorship) {\n return;\n }\n this.globalLogger().throwError(\"error censorship permanent\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\",\n });\n }\n _censorErrors = !!censorship;\n _permanentCensorErrors = !!permanent;\n }\n static setLogLevel(logLevel) {\n const level = LogLevels[logLevel.toLowerCase()];\n if (level == null) {\n Logger.globalLogger().warn(\"invalid log level - \" + logLevel);\n return;\n }\n _logLevel = level;\n }\n static from(version) {\n return new Logger(version);\n }\n}\n//# sourceMappingURL=logger.js.map","import { Logger } from \"../logger/logger.js\";\n/**\n * Property helper functions.\n *\n * @_subsection api/utils:Properties [about-properties]\n */\nconst logger = new Logger(\"utils/properties/0.0.1\");\nfunction checkType(value, type, name) {\n const types = type.split(\"|\").map((t) => t.trim());\n for (let i = 0; i < types.length; i++) {\n switch (type) {\n case \"any\":\n return;\n case \"bigint\":\n case \"boolean\":\n case \"number\":\n case \"string\":\n if (typeof value === type) {\n return;\n }\n }\n }\n const error = new Error(`invalid value for type ${type}`);\n error.code = \"INVALID_ARGUMENT\";\n error.argument = `value.${name}`;\n error.value = value;\n throw error;\n}\n/**\n * Resolves to a new object that is a copy of %%value%%, but with all\n * values resolved.\n */\nexport async function resolveProperties(value) {\n const keys = Object.keys(value);\n const results = await Promise.all(keys.map((k) => Promise.resolve(value[k])));\n return results.reduce((accum, v, index) => {\n accum[keys[index]] = v;\n return accum;\n }, {});\n}\n/**\n * Assigns the %%values%% to %%target%% as read-only values.\n *\n * It %%types%% is specified, the values are checked.\n */\nexport function defineProperties(target, values, types) {\n for (let key in values) {\n let value = values[key];\n const type = types ? types[key] : null;\n if (type) {\n checkType(value, type, key);\n }\n Object.defineProperty(target, key, {\n enumerable: true,\n value,\n writable: false,\n });\n }\n}\nexport function checkProperties(object, properties) {\n if (!object || typeof object !== \"object\") {\n logger.throwArgumentError(\"invalid object\", \"object\", object);\n }\n Object.keys(object).forEach((key) => {\n if (!properties[key]) {\n logger.throwArgumentError(\"invalid object key - \" + key, \"transaction:\" + key, object);\n }\n });\n}\n//# sourceMappingURL=properties.js.map","/**\n * About Errors.\n *\n * @_section: api/utils/errors:Errors [about-errors]\n */\nimport { version } from \"../_version.js\";\nimport { defineProperties } from \"./properties.js\";\nfunction stringify(value) {\n if (value == null) {\n return \"null\";\n }\n if (Array.isArray(value)) {\n return \"[ \" + value.map(stringify).join(\", \") + \" ]\";\n }\n if (value instanceof Uint8Array) {\n const HEX = \"0123456789abcdef\";\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n result += HEX[value[i] >> 4];\n result += HEX[value[i] & 0xf];\n }\n return result;\n }\n if (typeof value === \"object\" && typeof value.toJSON === \"function\") {\n return stringify(value.toJSON());\n }\n switch (typeof value) {\n case \"boolean\":\n case \"symbol\":\n return value.toString();\n case \"bigint\":\n return BigInt(value).toString();\n case \"number\":\n return value.toString();\n case \"string\":\n return JSON.stringify(value);\n case \"object\": {\n const keys = Object.keys(value);\n keys.sort();\n return (\"{ \" +\n keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(\", \") +\n \" }\");\n }\n }\n return `[ COULD NOT SERIALIZE ]`;\n}\n/**\n * Returns true if the %%error%% matches an error thrown by corebc\n * that matches the error %%code%%.\n *\n * In TypeScript envornoments, this can be used to check that %%error%%\n * matches an corebcError type, which means the expected properties will\n * be set.\n *\n * @See [ErrorCodes](api:ErrorCode)\n * @example\n * try {\n * // code....\n * } catch (e) {\n * if (isError(e, \"CALL_EXCEPTION\")) {\n * // The Type Guard has validated this object\n * console.log(e.data);\n * }\n * }\n */\nexport function isError(error, code) {\n return error && error.code === code;\n}\n/**\n * Returns true if %%error%% is a [[CallExceptionError].\n */\nexport function isCallException(error) {\n return isError(error, \"CALL_EXCEPTION\");\n}\n/**\n * Returns a new Error configured to the format corebc emits errors, with\n * the %%message%%, [[api:ErrorCode]] %%code%% and additioanl properties\n * for the corresponding corebcError.\n *\n * Each error in corebc includes the version of corebc, a\n * machine-readable [[ErrorCode]], and depneding on %%code%%, additional\n * required properties. The error message will also include the %%meeage%%,\n * corebc version, %%code%% and all aditional properties, serialized.\n */\nexport function makeError(message, code, info) {\n {\n const details = [];\n if (info) {\n if (\"message\" in info || \"code\" in info || \"name\" in info) {\n throw new Error(`value will overwrite populated values: ${stringify(info)}`);\n }\n for (const key in info) {\n const value = info[key];\n // try {\n details.push(key + \"=\" + stringify(value));\n // } catch (error: any) {\n // console.log(\"MMM\", error.message);\n // details.push(key + \"=[could not serialize object]\");\n // }\n }\n }\n details.push(`code=${code}`);\n details.push(`version=${version}`);\n if (details.length) {\n message += \" (\" + details.join(\", \") + \")\";\n }\n }\n let error;\n switch (code) {\n case \"INVALID_ARGUMENT\":\n error = new TypeError(message);\n break;\n case \"NUMERIC_FAULT\":\n case \"BUFFER_OVERRUN\":\n error = new RangeError(message);\n break;\n default:\n error = new Error(message);\n }\n defineProperties(error, { code });\n if (info) {\n Object.assign(error, info);\n }\n return error;\n}\n/**\n * Throws an corebcError with %%message%%, %%code%% and additional error\n * %%info%% when %%check%% is falsish..\n *\n * @see [[api:makeError]]\n */\nexport function assert(check, message, code, info) {\n if (!check) {\n throw makeError(message, code, info);\n }\n}\n/**\n * A simple helper to simply ensuring provided arguments match expected\n * constraints, throwing if not.\n *\n * In TypeScript environments, the %%check%% has been asserted true, so\n * any further code does not need additional compile-time checks.\n */\nexport function assertArgument(check, message, name, value) {\n assert(check, message, \"INVALID_ARGUMENT\", { argument: name, value: value });\n}\nexport function assertArgumentCount(count, expectedCount, message) {\n if (message == null) {\n message = \"\";\n }\n if (message) {\n message = \": \" + message;\n }\n assert(count >= expectedCount, \"missing arguemnt\" + message, \"MISSING_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount,\n });\n assert(count <= expectedCount, \"too many arguemnts\" + message, \"UNEXPECTED_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount,\n });\n}\nconst _normalizeForms = [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].reduce((accum, form) => {\n try {\n // General test for normalize\n /* c8 ignore start */\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad\");\n }\n /* c8 ignore stop */\n if (form === \"NFD\") {\n const check = String.fromCharCode(0xe9).normalize(\"NFD\");\n const expected = String.fromCharCode(0x65, 0x0301);\n /* c8 ignore start */\n if (check !== expected) {\n throw new Error(\"broken\");\n }\n /* c8 ignore stop */\n }\n accum.push(form);\n }\n catch (error) { }\n return accum;\n}, []);\n/**\n * Throws if the normalization %%form%% is not supported.\n */\nexport function assertNormalize(form) {\n assert(_normalizeForms.indexOf(form) >= 0, \"platform missing String.prototype.normalize\", \"UNSUPPORTED_OPERATION\", {\n operation: \"String.prototype.normalize\",\n info: { form },\n });\n}\n/**\n * Many classes use file-scoped values to guard the constructor,\n * making it effectively private. This facilitates that pattern\n * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%,\n * throwing if not, indicating the %%className%% if provided.\n */\nexport function assertPrivate(givenGuard, guard, className) {\n if (className == null) {\n className = \"\";\n }\n if (givenGuard !== guard) {\n let method = className, operation = \"new\";\n if (className) {\n method += \".\";\n operation += \" \" + className;\n }\n assert(false, `private constructor; use ${method}from* methods`, \"UNSUPPORTED_OPERATION\", {\n operation,\n });\n }\n}\n//# sourceMappingURL=errors.js.map","/**\n * Some data helpers.\n *\n *\n * @_subsection api/utils:Data Helpers [about-data]\n */\nimport { Logger } from \"../logger/logger.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nconst logger = new Logger(\"utils/data/0.0.1\");\nfunction isHexable(value) {\n return !!value.toHexString;\n}\nfunction isInteger(value) {\n return typeof value === \"number\" && value == value && value % 1 === 0;\n}\nexport function isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof value === \"string\") {\n return false;\n }\n if (!isInteger(value.length) || value.length < 0) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n}\nfunction _getBytes(value, name, copy) {\n if (value instanceof Uint8Array) {\n if (copy) {\n return new Uint8Array(value);\n }\n return value;\n }\n if (typeof value === \"string\" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {\n const result = new Uint8Array((value.length - 2) / 2);\n let offset = 2;\n for (let i = 0; i < result.length; i++) {\n result[i] = parseInt(value.substring(offset, offset + 2), 16);\n offset += 2;\n }\n return result;\n }\n assertArgument(false, \"invalid BytesLike value\", name || \"value\", value);\n}\n/**\n * Get a typed Uint8Array for %%value%%. If already a Uint8Array\n * the original %%value%% is returned; if a copy is required use\n * [[getBytesCopy]].\n *\n * @see: getBytesCopy\n */\nexport function getBytes(value, name) {\n return _getBytes(value, name, false);\n}\n/**\n * Get a typed Uint8Array for %%value%%, creating a copy if necessary\n * to prevent any modifications of the returned value from being\n * reflected elsewhere.\n *\n * @see: getBytes\n */\nexport function getBytesCopy(value, name) {\n return _getBytes(value, name, true);\n}\n/**\n * Returns true if %%value%% is a valid [[HexString]].\n *\n * If %%length%% is ``true`` or a //number//, it also checks that\n * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//)\n * bytes of data (e.g. ``0x1234`` is 2 bytes).\n */\nexport function isHexString(value, length) {\n if (typeof value !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (typeof length === \"number\" && value.length !== 2 + 2 * length) {\n return false;\n }\n if (length === true && value.length % 2 !== 0) {\n return false;\n }\n return true;\n}\n/**\n * Returns true if %%value%% is a valid representation of arbitrary\n * data (i.e. a valid [[DataHexString]] or a Uint8Array).\n */\nexport function isBytesLike(value) {\n return isHexString(value, true) || value instanceof Uint8Array;\n}\nconst HexCharacters = \"0123456789abcdef\";\n/**\n * Returns a [[DataHexString]] representation of %%data%%.\n */\nexport function hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof value === \"string\") {\n if (value.includes(\",\") && value.startsWith(\"0x\")) {\n const v = value\n .replace(\"0x\", \"\")\n .split(\",\")\n .map((item) => Number(item));\n // @ts-ignore\n value = new Uint8Array(v);\n }\n }\n if (typeof value === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (typeof value === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) {\n return \"0x0\" + value;\n }\n return \"0x\" + value;\n }\n if (options.allowMissingPrefix &&\n typeof value === \"string\" &&\n value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/**\n * Returns a [[DataHexString]] by concatenating all values\n * within %%data%%.\n */\nexport function concat(items) {\n return \"0x\" + items.map((d) => hexlify(d).substring(2)).join(\"\");\n}\nexport function hexDataSlice(data, offset, endOffset) {\n if (typeof data !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || data.length % 2) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nexport function hexDataLength(data) {\n if (typeof data !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || data.length % 2) {\n return null;\n }\n return (data.length - 2) / 2;\n}\n/**\n * Returns the length of %%data%%, in bytes.\n */\nexport function dataLength(data) {\n if (isHexString(data, true)) {\n return (data.length - 2) / 2;\n }\n return getBytes(data).length;\n}\n/**\n * Returns a [[DataHexString]] by slicing %%data%% from the %%start%%\n * offset to the %%end%% offset.\n *\n * By default %%start%% is 0 and %%end%% is the length of %%data%%.\n */\nexport function dataSlice(data, start, end) {\n const bytes = getBytes(data);\n if (end != null && end > bytes.length) {\n assert(false, \"cannot slice beyond data bounds\", \"BUFFER_OVERRUN\", {\n buffer: bytes,\n length: bytes.length,\n offset: end,\n });\n }\n return hexlify(bytes.slice(start == null ? 0 : start, end == null ? bytes.length : end));\n}\n/**\n * Return the [[DataHexString]] result by stripping all **leading**\n ** zero bytes from %%data%%.\n */\nexport function stripZerosLeft(data) {\n let bytes = hexlify(data).substring(2);\n while (bytes.startsWith(\"00\")) {\n bytes = bytes.substring(2);\n }\n return \"0x\" + bytes;\n}\nfunction zeroPad(data, length, left) {\n const bytes = getBytes(data);\n assert(length >= bytes.length, \"padding exceeds data length\", \"BUFFER_OVERRUN\", {\n buffer: new Uint8Array(bytes),\n length: length,\n offset: length + 1,\n });\n const result = new Uint8Array(length);\n result.fill(0);\n if (left) {\n result.set(bytes, length - bytes.length);\n }\n else {\n result.set(bytes, 0);\n }\n return hexlify(result);\n}\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **left**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **values** are in Solidity\n * (e.g. ``uint128``).\n */\nexport function zeroPadValue(data, length) {\n return zeroPad(data, length, true);\n}\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **right**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **bytes** are in Solidity\n * (e.g. ``bytes16``).\n */\nexport function zeroPadBytes(data, length) {\n return zeroPad(data, length, false);\n}\nexport function stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nexport function arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof value === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n // @ts-ignore\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix &&\n typeof value === \"string\" &&\n value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0x0\" + hex.substring(2);\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n // @ts-ignore\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nfunction addSlice(array) {\n // @ts-ignore\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nexport function hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\n//# sourceMappingURL=data.js.map","\"use strict\";\n/**\n * BigNumber\n *\n * A wrapper around the BN.js object. We use the BN.js library\n * because it is used by elliptic, so it is required regardless.\n *\n */\nimport _BN from \"bn.js\";\nimport { Logger } from \"../logger/logger.js\";\nimport { isBytes, hexlify, isHexString, } from \"../utils/data.js\";\nvar BN = _BN.BN;\nconst logger = new Logger(\"bigNumber/0.0.1\");\nconst _constructorGuard = {};\nconst MAX_SAFE = 0x1fffffffffffff;\nexport function isBigNumberish(value) {\n return (value != null &&\n (BigNumber.isBigNumber(value) ||\n (typeof value === \"number\" && value % 1 === 0) ||\n (typeof value === \"string\" && !!value.match(/^-?[0-9]+$/)) ||\n isHexString(value) ||\n typeof value === \"bigint\" ||\n isBytes(value)));\n}\n// Only warn about passing 10 into radix once\nlet _warnedToStringRadix = false;\nexport class BigNumber {\n _hex;\n _isBigNumber;\n constructor(constructorGuard, hex) {\n logger.checkNew(new.target, BigNumber);\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"cannot call constructor directly; use BigNumber.from\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new (BigNumber)\",\n });\n }\n this._hex = hex;\n this._isBigNumber = true;\n Object.freeze(this);\n }\n fromTwos(value) {\n return toBigNumber(toBN(this).fromTwos(value));\n }\n toTwos(value) {\n return toBigNumber(toBN(this).toTwos(value));\n }\n abs() {\n if (this._hex[0] === \"-\") {\n return BigNumber.from(this._hex.substring(1));\n }\n return this;\n }\n add(other) {\n return toBigNumber(toBN(this).add(toBN(other)));\n }\n sub(other) {\n return toBigNumber(toBN(this).sub(toBN(other)));\n }\n div(other) {\n const o = BigNumber.from(other);\n if (o.isZero()) {\n throwFault(\"division by zero\", \"div\");\n }\n return toBigNumber(toBN(this).div(toBN(other)));\n }\n mul(other) {\n return toBigNumber(toBN(this).mul(toBN(other)));\n }\n mod(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"cannot modulo negative values\", \"mod\");\n }\n return toBigNumber(toBN(this).umod(value));\n }\n pow(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"cannot raise to negative values\", \"pow\");\n }\n return toBigNumber(toBN(this).pow(value));\n }\n and(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'and' negative values\", \"and\");\n }\n return toBigNumber(toBN(this).and(value));\n }\n or(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'or' negative values\", \"or\");\n }\n return toBigNumber(toBN(this).or(value));\n }\n xor(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'xor' negative values\", \"xor\");\n }\n return toBigNumber(toBN(this).xor(value));\n }\n mask(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot mask negative values\", \"mask\");\n }\n return toBigNumber(toBN(this).maskn(value));\n }\n shl(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot shift negative values\", \"shl\");\n }\n return toBigNumber(toBN(this).shln(value));\n }\n shr(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot shift negative values\", \"shr\");\n }\n return toBigNumber(toBN(this).shrn(value));\n }\n eq(other) {\n return toBN(this).eq(toBN(other));\n }\n lt(other) {\n return toBN(this).lt(toBN(other));\n }\n lte(other) {\n return toBN(this).lte(toBN(other));\n }\n gt(other) {\n return toBN(this).gt(toBN(other));\n }\n gte(other) {\n return toBN(this).gte(toBN(other));\n }\n isNegative() {\n return this._hex[0] === \"-\";\n }\n isZero() {\n return toBN(this).isZero();\n }\n toNumber() {\n try {\n return toBN(this).toNumber();\n }\n catch (error) {\n throwFault(\"overflow\", \"toNumber\", this.toString());\n }\n // @ts-ignore\n return null;\n }\n toBigInt() {\n try {\n return BigInt(this.toString());\n }\n catch (e) { }\n return logger.throwError(\"this platform does not support BigInt\", Logger.errors.UNSUPPORTED_OPERATION, {\n value: this.toString(),\n });\n }\n toString() {\n // Lots of people expect this, which we do not support, so check (See: #889)\n if (arguments.length > 0) {\n if (arguments[0] === 10) {\n if (!_warnedToStringRadix) {\n _warnedToStringRadix = true;\n logger.warn(\"BigNumber.toString does not accept any parameters; base-10 is assumed\");\n }\n }\n else if (arguments[0] === 16) {\n logger.throwError(\"BigNumber.toString does not accept any parameters; use bigNumber.toHexString()\", Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n else {\n logger.throwError(\"BigNumber.toString does not accept parameters\", Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n }\n return toBN(this).toString(10);\n }\n toHexString() {\n return this._hex;\n }\n toJSON(key) {\n return { type: \"BigNumber\", hex: this.toHexString() };\n }\n static from(value) {\n if (value instanceof BigNumber) {\n return value;\n }\n if (typeof value === \"string\") {\n if (value.match(/^-?0x[0-9a-f]+$/i)) {\n return new BigNumber(_constructorGuard, toHex(value));\n }\n if (value.match(/^-?[0-9]+$/)) {\n return new BigNumber(_constructorGuard, toHex(new BN(value)));\n }\n return logger.throwArgumentError(\"invalid BigNumber string\", \"value\", value);\n }\n if (typeof value === \"number\") {\n if (value % 1) {\n throwFault(\"underflow\", \"BigNumber.from\", value);\n }\n if (value >= MAX_SAFE || value <= -MAX_SAFE) {\n throwFault(\"overflow\", \"BigNumber.from\", value);\n }\n return BigNumber.from(String(value));\n }\n const anyValue = value;\n if (typeof anyValue === \"bigint\") {\n return BigNumber.from(anyValue.toString());\n }\n if (isBytes(anyValue)) {\n return BigNumber.from(hexlify(anyValue));\n }\n if (anyValue) {\n // Hexable interface (takes priority)\n if (anyValue.toHexString) {\n const hex = anyValue.toHexString();\n if (typeof hex === \"string\") {\n return BigNumber.from(hex);\n }\n }\n else {\n // For now, handle legacy JSON-ified values (goes away in v6)\n let hex = anyValue._hex;\n // New-form JSON\n if (hex == null && anyValue.type === \"BigNumber\") {\n hex = anyValue.hex;\n }\n if (typeof hex === \"string\") {\n if (isHexString(hex) ||\n (hex[0] === \"-\" && isHexString(hex.substring(1)))) {\n return BigNumber.from(hex);\n }\n }\n }\n }\n return logger.throwArgumentError(\"invalid BigNumber value\", \"value\", value);\n }\n static isBigNumber(value) {\n return !!(value && value._isBigNumber);\n }\n}\n// Normalize the hex string\n// @ts-ignore\nfunction toHex(value) {\n // For BN, call on the hex string\n if (typeof value !== \"string\") {\n return toHex(value.toString(16));\n }\n // If negative, prepend the negative sign to the normalized positive value\n if (value[0] === \"-\") {\n // Strip off the negative sign\n value = value.substring(1);\n // Cannot have multiple negative signs (e.g. \"--0x04\")\n if (value[0] === \"-\") {\n logger.throwArgumentError(\"invalid hex\", \"value\", value);\n }\n // Call toHex on the positive component\n value = toHex(value);\n // Do not allow \"-0x00\"\n if (value === \"0x00\") {\n return value;\n }\n // Negate the value\n return \"-\" + value;\n }\n // Add a \"0x\" prefix if missing\n if (value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n // Normalize zero\n if (value === \"0x\") {\n return \"0x00\";\n }\n // Make the string even length\n if (value.length % 2) {\n value = \"0x0\" + value.substring(2);\n }\n // Trim to smallest even-length string\n while (value.length > 4 && value.substring(0, 4) === \"0x00\") {\n value = \"0x\" + value.substring(4);\n }\n return value;\n}\n// @ts-ignore\nfunction toBigNumber(value) {\n return BigNumber.from(toHex(value));\n}\n// @ts-ignore\nfunction toBN(value) {\n const hex = BigNumber.from(value).toHexString();\n if (hex[0] === \"-\") {\n return new BN(\"-\" + hex.substring(3), 16);\n }\n return new BN(hex.substring(2), 16);\n}\nfunction throwFault(fault, operation, value) {\n const params = { fault: fault, operation: operation };\n if (value != null) {\n params.value = value;\n }\n return logger.throwError(fault, Logger.errors.NUMERIC_FAULT, params);\n}\n// value should have no prefix\nexport function _base36To16(value) {\n return new BN(value, 36).toString(16);\n}\n// value should have no prefix\nexport function _base16To36(value) {\n return new BN(value, 16).toString(36);\n}\n//# sourceMappingURL=bigNumber.js.map","\"use strict\";\nimport { Logger } from \"../logger/logger.js\";\nimport { arrayify, hexlify, isBytesLike } from \"../utils/data.js\";\nconst logger = new Logger(\"rlp/0.0.1\");\nfunction arrayifyInteger(value) {\n const result = [];\n while (value) {\n // @ts-ignore\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\nfunction unarrayifyInteger(data, offset, length) {\n let result = 0;\n for (let i = 0; i < length; i++) {\n result = result * 256 + data[offset + i];\n }\n return result;\n}\nfunction _encode(object) {\n if (Array.isArray(object)) {\n let payload = [];\n object.forEach(function (child) {\n payload = payload.concat(_encode(child));\n });\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length);\n return payload;\n }\n const length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n return length.concat(payload);\n }\n if (!isBytesLike(object)) {\n logger.throwArgumentError(\"RLP object must be BytesLike\", \"object\", object);\n }\n const data = Array.prototype.slice.call(arrayify(object));\n if (data.length === 1 && data[0] <= 0x7f) {\n return data;\n }\n else if (data.length <= 55) {\n data.unshift(0x80 + data.length);\n return data;\n }\n const length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n return length.concat(data);\n}\nexport function encode(object) {\n return hexlify(_encode(object));\n}\nfunction _decodeChildren(data, offset, childOffset, length) {\n const result = [];\n while (childOffset < offset + 1 + length) {\n const decoded = _decode(data, childOffset);\n result.push(decoded.result);\n childOffset += decoded.consumed;\n if (childOffset > offset + 1 + length) {\n logger.throwError(\"child data too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n }\n return { consumed: 1 + length, result: result };\n}\n// returns { consumed: number, result: Object }\nfunction _decode(data, offset) {\n if (data.length === 0) {\n logger.throwError(\"data too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n // Array with extra length prefix\n if (data[offset] >= 0xf8) {\n const lengthLength = data[offset] - 0xf7;\n if (offset + 1 + lengthLength > data.length) {\n logger.throwError(\"data short segment too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n logger.throwError(\"data long segment too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);\n }\n else if (data[offset] >= 0xc0) {\n const length = data[offset] - 0xc0;\n if (offset + 1 + length > data.length) {\n logger.throwError(\"data array too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n return _decodeChildren(data, offset, offset + 1, length);\n }\n else if (data[offset] >= 0xb8) {\n const lengthLength = data[offset] - 0xb7;\n if (offset + 1 + lengthLength > data.length) {\n logger.throwError(\"data array too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n logger.throwError(\"data array too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length));\n return { consumed: 1 + lengthLength + length, result: result };\n }\n else if (data[offset] >= 0x80) {\n const length = data[offset] - 0x80;\n if (offset + 1 + length > data.length) {\n logger.throwError(\"data too short\", Logger.errors.BUFFER_OVERRUN, {});\n }\n const result = hexlify(data.slice(offset + 1, offset + 1 + length));\n return { consumed: 1 + length, result: result };\n }\n return { consumed: 1, result: hexlify(data[offset]) };\n}\nexport function decode(data) {\n const bytes = arrayify(data);\n const decoded = _decode(bytes, 0);\n if (decoded.consumed !== bytes.length) {\n logger.throwArgumentError(\"invalid rlp data\", \"data\", data);\n }\n return decoded.result;\n}\n//# sourceMappingURL=rlp.js.map","function number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`Wrong positive integer: ${n}`);\n}\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`Expected boolean, not ${b}`);\n}\nfunction bytes(b, ...lengths) {\n if (!(b instanceof Uint8Array))\n throw new Error('Expected Uint8Array');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\nexport { number, bool, bytes, hash, exists, output };\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n//# sourceMappingURL=_assert.js.map","/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated, we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\nconst u8a = (a) => a instanceof Uint8Array;\n// Cast array to different type\nexport const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n// Cast array to view\nexport const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\n// big-endian hardware is rare. Just in case someone still decides to run hashes:\n// early-throw an error because we don't support BE yet.\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!isLE)\n throw new Error('Non little-endian hardware is not supported');\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n if (!u8a(data))\n throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\n// For runtime check if class implements interface\nexport class Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\nconst toStr = {}.toString;\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nexport function wrapConstructor(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nexport function wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nexport function wrapXOFConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32) {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map","import { hash as assertHash, bytes as assertBytes, exists as assertExists } from './_assert.js';\nimport { Hash, toBytes } from './utils.js';\n// HMAC (RFC 2104)\nexport class HMAC extends Hash {\n constructor(hash, _key) {\n super();\n this.finished = false;\n this.destroyed = false;\n assertHash(hash);\n const key = toBytes(_key);\n this.iHash = hash.create();\n if (typeof this.iHash.update !== 'function')\n throw new Error('Expected instance of class which extends utils.Hash');\n this.blockLen = this.iHash.blockLen;\n this.outputLen = this.iHash.outputLen;\n const blockLen = this.blockLen;\n const pad = new Uint8Array(blockLen);\n // blockLen can be bigger than outputLen\n pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36;\n this.iHash.update(pad);\n // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone\n this.oHash = hash.create();\n // Undo internal XOR && apply outer XOR\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36 ^ 0x5c;\n this.oHash.update(pad);\n pad.fill(0);\n }\n update(buf) {\n assertExists(this);\n this.iHash.update(buf);\n return this;\n }\n digestInto(out) {\n assertExists(this);\n assertBytes(out, this.outputLen);\n this.finished = true;\n this.iHash.digestInto(out);\n this.oHash.update(out);\n this.oHash.digestInto(out);\n this.destroy();\n }\n digest() {\n const out = new Uint8Array(this.oHash.outputLen);\n this.digestInto(out);\n return out;\n }\n _cloneInto(to) {\n // Create new instance without calling constructor since key already in state and we don't know it.\n to || (to = Object.create(Object.getPrototypeOf(this), {}));\n const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;\n to = to;\n to.finished = finished;\n to.destroyed = destroyed;\n to.blockLen = blockLen;\n to.outputLen = outputLen;\n to.oHash = oHash._cloneInto(to.oHash);\n to.iHash = iHash._cloneInto(to.iHash);\n return to;\n }\n destroy() {\n this.destroyed = true;\n this.oHash.destroy();\n this.iHash.destroy();\n }\n}\n/**\n * HMAC: RFC2104 message authentication code.\n * @param hash - function that would be used e.g. sha256\n * @param key - message key\n * @param message - message data\n */\nexport const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();\nhmac.create = (hash, key) => new HMAC(hash, key);\n//# sourceMappingURL=hmac.js.map","import { hash as assertHash, number as assertNumber } from './_assert.js';\nimport { hmac } from './hmac.js';\nimport { createView, toBytes, checkOpts, asyncLoop } from './utils.js';\n// Common prologue and epilogue for sync/async functions\nfunction pbkdf2Init(hash, _password, _salt, _opts) {\n assertHash(hash);\n const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);\n const { c, dkLen, asyncTick } = opts;\n assertNumber(c);\n assertNumber(dkLen);\n assertNumber(asyncTick);\n if (c < 1)\n throw new Error('PBKDF2: iterations (c) should be >= 1');\n const password = toBytes(_password);\n const salt = toBytes(_salt);\n // DK = PBKDF2(PRF, Password, Salt, c, dkLen);\n const DK = new Uint8Array(dkLen);\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n const PRF = hmac.create(hash, password);\n const PRFSalt = PRF._cloneInto().update(salt);\n return { c, dkLen, asyncTick, DK, PRF, PRFSalt };\n}\nfunction pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {\n PRF.destroy();\n PRFSalt.destroy();\n if (prfW)\n prfW.destroy();\n u.fill(0);\n return DK;\n}\n/**\n * PBKDF2-HMAC: RFC 2898 key derivation function\n * @param hash - hash function that would be used e.g. sha256\n * @param password - password from which a derived key is generated\n * @param salt - cryptographic salt\n * @param opts - {c, dkLen} where c is work factor and dkLen is output message size\n */\nexport function pbkdf2(hash, password, salt, opts) {\n const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);\n let prfW; // Working copy\n const arr = new Uint8Array(4);\n const view = createView(arr);\n const u = new Uint8Array(PRF.outputLen);\n // DK = T1 + T2 + ⋯ + Tdklen/hlen\n for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {\n // Ti = F(Password, Salt, c, i)\n const Ti = DK.subarray(pos, pos + PRF.outputLen);\n view.setInt32(0, ti, false);\n // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);\n Ti.set(u.subarray(0, Ti.length));\n for (let ui = 1; ui < c; ui++) {\n // Uc = PRF(Password, Uc−1)\n PRF._cloneInto(prfW).update(u).digestInto(u);\n for (let i = 0; i < Ti.length; i++)\n Ti[i] ^= u[i];\n }\n }\n return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);\n}\nexport async function pbkdf2Async(hash, password, salt, opts) {\n const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);\n let prfW; // Working copy\n const arr = new Uint8Array(4);\n const view = createView(arr);\n const u = new Uint8Array(PRF.outputLen);\n // DK = T1 + T2 + ⋯ + Tdklen/hlen\n for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {\n // Ti = F(Password, Salt, c, i)\n const Ti = DK.subarray(pos, pos + PRF.outputLen);\n view.setInt32(0, ti, false);\n // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);\n Ti.set(u.subarray(0, Ti.length));\n await asyncLoop(c - 1, asyncTick, () => {\n // Uc = PRF(Password, Uc−1)\n PRF._cloneInto(prfW).update(u).digestInto(u);\n for (let i = 0; i < Ti.length; i++)\n Ti[i] ^= u[i];\n });\n }\n return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);\n}\n//# sourceMappingURL=pbkdf2.js.map","import { exists, output } from './_assert.js';\nimport { Hash, createView, toBytes } from './utils.js';\n// Polyfill for Safari 14\nfunction setBigUint64(view, byteOffset, value, isLE) {\n if (typeof view.setBigUint64 === 'function')\n return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n// Base SHA2 class (RFC 6234)\nexport class SHA2 extends Hash {\n constructor(blockLen, outputLen, padOffset, isLE) {\n super();\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.finished = false;\n this.length = 0;\n this.pos = 0;\n this.destroyed = false;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data) {\n exists(this);\n const { view, buffer, blockLen } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n exists(this);\n output(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n this.buffer.subarray(pos).fill(0);\n // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to || (to = new this.constructor());\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.length = length;\n to.pos = pos;\n to.finished = finished;\n to.destroyed = destroyed;\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n}\n//# sourceMappingURL=_sha2.js.map","import { SHA2 } from './_sha2.js';\nimport { rotr, wrapConstructor } from './utils.js';\n// SHA2-256 need to try 2^128 hashes to execute birthday attack.\n// BTC network is doing 2^67 hashes/sec as per early 2023.\n// Choice: a ? b : c\nconst Chi = (a, b, c) => (a & b) ^ (~a & c);\n// Majority function, true if any two inpust is true\nconst Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);\n// Round constants:\n// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n// prettier-ignore\nconst IV = /* @__PURE__ */ new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n]);\n// Temporary buffer, not used to store anything between runs\n// Named this way because it matches specification.\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nclass SHA256 extends SHA2 {\n constructor() {\n super(64, 32, 8, false);\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n this.A = IV[0] | 0;\n this.B = IV[1] | 0;\n this.C = IV[2] | 0;\n this.D = IV[3] | 0;\n this.E = IV[4] | 0;\n this.F = IV[5] | 0;\n this.G = IV[6] | 0;\n this.H = IV[7] | 0;\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n SHA256_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\n// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf\nclass SHA224 extends SHA256 {\n constructor() {\n super();\n this.A = 0xc1059ed8 | 0;\n this.B = 0x367cd507 | 0;\n this.C = 0x3070dd17 | 0;\n this.D = 0xf70e5939 | 0;\n this.E = 0xffc00b31 | 0;\n this.F = 0x68581511 | 0;\n this.G = 0x64f98fa7 | 0;\n this.H = 0xbefa4fa4 | 0;\n this.outputLen = 28;\n }\n}\n/**\n * SHA2-256 hash function\n * @param message - data that would be hashed\n */\nexport const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());\nexport const sha224 = /* @__PURE__ */ wrapConstructor(() => new SHA224());\n//# sourceMappingURL=sha256.js.map","const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nconst rotr32L = (h, _l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add, add3L, add3H, add4L, add4H, add5H, add5L, };\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n//# sourceMappingURL=_u64.js.map","import { SHA2 } from './_sha2.js';\nimport u64 from './_u64.js';\nimport { wrapConstructor } from './utils.js';\n// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):\n// prettier-ignore\nconst [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\n// Temporary buffer, not used to store anything between runs\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\nexport class SHA512 extends SHA2 {\n constructor() {\n super(128, 64, 16, false);\n // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.\n // Also looks cleaner and easier to verify with spec.\n // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x6a09e667 | 0;\n this.Al = 0xf3bcc908 | 0;\n this.Bh = 0xbb67ae85 | 0;\n this.Bl = 0x84caa73b | 0;\n this.Ch = 0x3c6ef372 | 0;\n this.Cl = 0xfe94f82b | 0;\n this.Dh = 0xa54ff53a | 0;\n this.Dl = 0x5f1d36f1 | 0;\n this.Eh = 0x510e527f | 0;\n this.El = 0xade682d1 | 0;\n this.Fh = 0x9b05688c | 0;\n this.Fl = 0x2b3e6c1f | 0;\n this.Gh = 0x1f83d9ab | 0;\n this.Gl = 0xfb41bd6b | 0;\n this.Hh = 0x5be0cd19 | 0;\n this.Hl = 0x137e2179 | 0;\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n SHA512_W_H.fill(0);\n SHA512_W_L.fill(0);\n }\n destroy() {\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\nclass SHA512_224 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x8c3d37c8 | 0;\n this.Al = 0x19544da2 | 0;\n this.Bh = 0x73e19966 | 0;\n this.Bl = 0x89dcd4d6 | 0;\n this.Ch = 0x1dfab7ae | 0;\n this.Cl = 0x32ff9c82 | 0;\n this.Dh = 0x679dd514 | 0;\n this.Dl = 0x582f9fcf | 0;\n this.Eh = 0x0f6d2b69 | 0;\n this.El = 0x7bd44da8 | 0;\n this.Fh = 0x77e36f73 | 0;\n this.Fl = 0x04c48942 | 0;\n this.Gh = 0x3f9d85a8 | 0;\n this.Gl = 0x6a1d36c8 | 0;\n this.Hh = 0x1112e6ad | 0;\n this.Hl = 0x91d692a1 | 0;\n this.outputLen = 28;\n }\n}\nclass SHA512_256 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x22312194 | 0;\n this.Al = 0xfc2bf72c | 0;\n this.Bh = 0x9f555fa3 | 0;\n this.Bl = 0xc84c64c2 | 0;\n this.Ch = 0x2393b86b | 0;\n this.Cl = 0x6f53b151 | 0;\n this.Dh = 0x96387719 | 0;\n this.Dl = 0x5940eabd | 0;\n this.Eh = 0x96283ee2 | 0;\n this.El = 0xa88effe3 | 0;\n this.Fh = 0xbe5e1e25 | 0;\n this.Fl = 0x53863992 | 0;\n this.Gh = 0x2b0199fc | 0;\n this.Gl = 0x2c85b8aa | 0;\n this.Hh = 0x0eb72ddc | 0;\n this.Hl = 0x81c52ca2 | 0;\n this.outputLen = 32;\n }\n}\nclass SHA384 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0xcbbb9d5d | 0;\n this.Al = 0xc1059ed8 | 0;\n this.Bh = 0x629a292a | 0;\n this.Bl = 0x367cd507 | 0;\n this.Ch = 0x9159015a | 0;\n this.Cl = 0x3070dd17 | 0;\n this.Dh = 0x152fecd8 | 0;\n this.Dl = 0xf70e5939 | 0;\n this.Eh = 0x67332667 | 0;\n this.El = 0xffc00b31 | 0;\n this.Fh = 0x8eb44a87 | 0;\n this.Fl = 0x68581511 | 0;\n this.Gh = 0xdb0c2e0d | 0;\n this.Gl = 0x64f98fa7 | 0;\n this.Hh = 0x47b5481d | 0;\n this.Hl = 0xbefa4fa4 | 0;\n this.outputLen = 48;\n }\n}\nexport const sha512 = /* @__PURE__ */ wrapConstructor(() => new SHA512());\nexport const sha512_224 = /* @__PURE__ */ wrapConstructor(() => new SHA512_224());\nexport const sha512_256 = /* @__PURE__ */ wrapConstructor(() => new SHA512_256());\nexport const sha384 = /* @__PURE__ */ wrapConstructor(() => new SHA384());\n//# sourceMappingURL=sha512.js.map","import { bytes, exists, number, output } from './_assert.js';\nimport { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.js';\nimport { Hash, u32, toBytes, wrapConstructor, wrapXOFConstructorWithOpts, } from './utils.js';\n// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.\n// It's called a sponge function.\n// Various per round constants calculations\nconst [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nconst _2n = /* @__PURE__ */ BigInt(2);\nconst _7n = /* @__PURE__ */ BigInt(7);\nconst _256n = /* @__PURE__ */ BigInt(256);\nconst _0x71n = /* @__PURE__ */ BigInt(0x71);\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n)\n t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n// Same as keccakf1600, but allows to skip some rounds\nexport function keccakP(s, rounds = 24) {\n const B = new Uint32Array(5 * 2);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++)\n B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n for (let x = 0; x < 10; x += 2) {\n const idx1 = (x + 8) % 10;\n const idx0 = (x + 2) % 10;\n const B0 = B[idx0];\n const B1 = B[idx0 + 1];\n const Th = rotlH(B0, B1, 1) ^ B[idx1];\n const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n for (let y = 0; y < 50; y += 10) {\n s[x + y] ^= Th;\n s[x + y + 1] ^= Tl;\n }\n }\n // Rho (ρ) and Pi (π)\n let curH = s[2];\n let curL = s[3];\n for (let t = 0; t < 24; t++) {\n const shift = SHA3_ROTL[t];\n const Th = rotlH(curH, curL, shift);\n const Tl = rotlL(curH, curL, shift);\n const PI = SHA3_PI[t];\n curH = s[PI];\n curL = s[PI + 1];\n s[PI] = Th;\n s[PI + 1] = Tl;\n }\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n for (let x = 0; x < 10; x++)\n B[x] = s[y + x];\n for (let x = 0; x < 10; x++)\n s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n B.fill(0);\n}\nexport class Keccak extends Hash {\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n super();\n this.blockLen = blockLen;\n this.suffix = suffix;\n this.outputLen = outputLen;\n this.enableXOF = enableXOF;\n this.rounds = rounds;\n this.pos = 0;\n this.posOut = 0;\n this.finished = false;\n this.destroyed = false;\n // Can be passed from user as dkLen\n number(outputLen);\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n if (0 >= this.blockLen || this.blockLen >= 200)\n throw new Error('Sha3 supports only keccak-f1600 function');\n this.state = new Uint8Array(200);\n this.state32 = u32(this.state);\n }\n keccak() {\n keccakP(this.state32, this.rounds);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data) {\n exists(this);\n const { blockLen, state } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++)\n state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen)\n this.keccak();\n }\n return this;\n }\n finish() {\n if (this.finished)\n return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n writeInto(out) {\n exists(this, false);\n bytes(out);\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len;) {\n if (this.posOut >= blockLen)\n this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out) {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF)\n throw new Error('XOF is not possible for this instance');\n return this.writeInto(out);\n }\n xof(bytes) {\n number(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out) {\n output(out, this);\n if (this.finished)\n throw new Error('digest() was already called');\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n this.state.fill(0);\n }\n _cloneInto(to) {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\nconst gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));\nexport const sha3_224 = /* @__PURE__ */ gen(0x06, 144, 224 / 8);\n/**\n * SHA3-256 hash function\n * @param message - that would be hashed\n */\nexport const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8);\nexport const sha3_384 = /* @__PURE__ */ gen(0x06, 104, 384 / 8);\nexport const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);\nexport const keccak_224 = /* @__PURE__ */ gen(0x01, 144, 224 / 8);\n/**\n * keccak-256 hash function. Different from SHA3-256.\n * @param message - that would be hashed\n */\nexport const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);\nexport const keccak_384 = /* @__PURE__ */ gen(0x01, 104, 384 / 8);\nexport const keccak_512 = /* @__PURE__ */ gen(0x01, 72, 512 / 8);\nconst genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));\nexport const shake128 = /* @__PURE__ */ genShake(0x1f, 168, 128 / 8);\nexport const shake256 = /* @__PURE__ */ genShake(0x1f, 136, 256 / 8);\n//# sourceMappingURL=sha3.js.map","/**\n * Some mathematic operations.\n *\n * @_subsection: api/utils:Math Helpers [about-maths]\n */\nimport { hexlify, isBytesLike } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\n//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1;\n// IEEE 754 support 53-bits of mantissa\nconst maxValue = 0x1fffffffffffff;\n/**\n * Convert %%value%% from a twos-compliment representation of %%width%%\n * bits to its value.\n *\n * If the highest bit is ``1``, the result will be negative.\n */\nexport function fromTwos(_value, _width) {\n const value = getUint(_value, \"value\");\n const width = BigInt(getNumber(_width, \"width\"));\n assert(value >> width === BN_0, \"overflow\", \"NUMERIC_FAULT\", {\n operation: \"fromTwos\",\n fault: \"overflow\",\n value: _value,\n });\n // Top bit set; treat as a negative value\n if (value >> (width - BN_1)) {\n const mask = (BN_1 << width) - BN_1;\n return -((~value & mask) + BN_1);\n }\n return value;\n}\n/**\n * Convert %%value%% to a twos-compliment representation of\n * %%width%% bits.\n *\n * The result will always be positive.\n */\nexport function toTwos(_value, _width) {\n let value = getBigInt(_value, \"value\");\n const width = BigInt(getNumber(_width, \"width\"));\n const limit = BN_1 << (width - BN_1);\n if (value < BN_0) {\n value = -value;\n assert(value <= limit, \"too low\", \"NUMERIC_FAULT\", {\n operation: \"toTwos\",\n fault: \"overflow\",\n value: _value,\n });\n const mask = (BN_1 << width) - BN_1;\n return (~value & mask) + BN_1;\n }\n else {\n assert(value < limit, \"too high\", \"NUMERIC_FAULT\", {\n operation: \"toTwos\",\n fault: \"overflow\",\n value: _value,\n });\n }\n return value;\n}\n/**\n * Mask %%value%% with a bitmask of %%bits%% ones.\n */\nexport function mask(_value, _bits) {\n const value = getUint(_value, \"value\");\n const bits = BigInt(getNumber(_bits, \"bits\"));\n return value & ((BN_1 << bits) - BN_1);\n}\n/**\n * Gets a BigInt from %%value%%. If it is an invalid value for\n * a BigInt, then an ArgumentError will be thrown for %%name%%.\n */\nexport function getBigInt(value, name) {\n switch (typeof value) {\n case \"bigint\":\n return value;\n case \"number\":\n assertArgument(Number.isInteger(value), \"underflow\", name || \"value\", value);\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return BigInt(value);\n case \"string\":\n try {\n if (value === \"\") {\n throw new Error(\"empty string\");\n }\n if (value[0] === \"-\" && value[1] !== \"-\") {\n return -BigInt(value.substring(1));\n }\n return BigInt(value);\n }\n catch (e) {\n assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || \"value\", value);\n }\n }\n assertArgument(false, \"invalid BigNumberish value\", name || \"value\", value);\n}\nexport function getUint(value, name) {\n const result = getBigInt(value, name);\n assert(result >= BN_0, \"unsigned value cannot be negative\", \"NUMERIC_FAULT\", {\n fault: \"overflow\",\n operation: \"getUint\",\n value,\n });\n return result;\n}\nconst Nibbles = \"0123456789abcdef\";\n/*\n * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it\n * is treated as Big Endian data.\n */\nexport function toBigInt(value) {\n if (value instanceof Uint8Array) {\n let result = \"0x0\";\n for (const v of value) {\n result += Nibbles[v >> 4];\n result += Nibbles[v & 0x0f];\n }\n return BigInt(result);\n }\n return getBigInt(value);\n}\n/**\n * Gets a //number// from %%value%%. If it is an invalid value for\n * a //number//, then an ArgumentError will be thrown for %%name%%.\n */\nexport function getNumber(value, name) {\n switch (typeof value) {\n case \"bigint\":\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return Number(value);\n case \"number\":\n assertArgument(Number.isInteger(value), \"underflow\", name || \"value\", value);\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return value;\n case \"string\":\n try {\n if (value === \"\") {\n throw new Error(\"empty string\");\n }\n return getNumber(BigInt(value), name);\n }\n catch (e) {\n assertArgument(false, `invalid numeric string: ${e.message}`, name || \"value\", value);\n }\n }\n assertArgument(false, \"invalid numeric value\", name || \"value\", value);\n}\n/**\n * Converts %%value%% to a number. If %%value%% is a Uint8Array, it\n * is treated as Big Endian data. Throws if the value is not safe.\n */\nexport function toNumber(value) {\n return getNumber(toBigInt(value));\n}\n/**\n * Converts %%value%% to a Big Endian hexstring, optionally padded to\n * %%width%% bytes.\n */\nexport function toBeHex(_value, _width) {\n const value = getUint(_value, \"value\");\n let result = value.toString(16);\n if (_width == null) {\n // Ensure the value is of even length\n if (result.length % 2) {\n result = \"0\" + result;\n }\n }\n else {\n const width = getNumber(_width, \"width\");\n assert(width * 2 >= result.length, `value exceeds width (${width} bits)`, \"NUMERIC_FAULT\", {\n operation: \"toBeHex\",\n fault: \"overflow\",\n value: _value,\n });\n // Pad the value to the required width\n while (result.length < width * 2) {\n result = \"0\" + result;\n }\n }\n return \"0x\" + result;\n}\n/**\n * Converts %%value%% to a Big Endian Uint8Array.\n */\nexport function toBeArray(_value) {\n const value = getUint(_value, \"value\");\n if (value === BN_0) {\n return new Uint8Array([]);\n }\n let hex = value.toString(16);\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n const result = new Uint8Array(hex.length / 2);\n for (let i = 0; i < result.length; i++) {\n const offset = i * 2;\n result[i] = parseInt(hex.substring(offset, offset + 2), 16);\n }\n return result;\n}\n/**\n * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//.\n *\n * A //Quantity// does not have and leading 0 values unless the value is\n * the literal value `0x0`. This is most commonly used for JSSON-RPC\n * numeric values.\n */\nexport function toQuantity(value) {\n let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring(2);\n while (result.startsWith(\"0\")) {\n result = result.substring(1);\n }\n if (result === \"\") {\n result = \"0\";\n }\n return \"0x\" + result;\n}\n//# sourceMappingURL=maths.js.map","/**\n * The [Base58 Encoding](link-base58) scheme allows a **numeric** value\n * to be encoded as a compact string using a radix of 58 using only\n * alpha-numeric characters. Confusingly similar characters are omitted\n * (i.e. ``\"l0O\"``).\n *\n * Note that Base58 encodes a **numeric** value, not arbitrary bytes,\n * since any zero-bytes on the left would get removed. To mitigate this\n * issue most schemes that use Base58 choose specific high-order values\n * to ensure non-zero prefixes.\n *\n * @_subsection: api/utils:Base58 Encoding [about-base58]\n */\nimport { getBytes } from \"./data.js\";\nimport { assertArgument } from \"./errors.js\";\nimport { toBigInt } from \"./maths.js\";\nconst Alphabet = \"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";\nlet Lookup = null;\nfunction getAlpha(letter) {\n if (Lookup == null) {\n Lookup = {};\n for (let i = 0; i < Alphabet.length; i++) {\n Lookup[Alphabet[i]] = BigInt(i);\n }\n }\n const result = Lookup[letter];\n assertArgument(result != null, `invalid base58 value`, \"letter\", letter);\n return result;\n}\nconst BN_0 = BigInt(0);\nconst BN_58 = BigInt(58);\n/**\n * Encode %%value%% as a Base58-encoded string.\n */\nexport function encodeBase58(_value) {\n let value = toBigInt(getBytes(_value));\n let result = \"\";\n while (value) {\n result = Alphabet[Number(value % BN_58)] + result;\n value /= BN_58;\n }\n return result;\n}\n/**\n * Decode the Base58-encoded %%value%%.\n */\nexport function decodeBase58(value) {\n let result = BN_0;\n for (let i = 0; i < value.length; i++) {\n result *= BN_58;\n result += getAlpha(value[i]);\n }\n return result;\n}\n//# sourceMappingURL=base58.js.map","// utils/base64-browser\nimport { getBytes } from \"./data.js\";\nexport function decodeBase64(textData) {\n textData = atob(textData);\n const data = new Uint8Array(textData.length);\n for (let i = 0; i < textData.length; i++) {\n data[i] = textData.charCodeAt(i);\n }\n return getBytes(data);\n}\nexport function encodeBase64(_data) {\n const data = getBytes(_data);\n let textData = \"\";\n for (let i = 0; i < data.length; i++) {\n textData += String.fromCharCode(data[i]);\n }\n return btoa(textData);\n}\n//# sourceMappingURL=base64-browser.js.map","/**\n * Explain events...\n *\n * @_section api/utils/events:Events [about-events]\n */\nimport { defineProperties } from \"./properties.js\";\n/**\n * When an [[EventEmitterable]] triggers a [[Listener]], the\n * callback always ahas one additional argument passed, which is\n * an **EventPayload**.\n */\nexport class EventPayload {\n /**\n * The event filter.\n */\n filter;\n /**\n * The **EventEmitterable**.\n */\n emitter;\n #listener;\n /**\n * Create a new **EventPayload** for %%emitter%% with\n * the %%listener%% and for %%filter%%.\n */\n constructor(emitter, listener, filter) {\n this.#listener = listener;\n defineProperties(this, { emitter, filter });\n }\n /**\n * Unregister the triggered listener for future events.\n */\n async removeListener() {\n if (this.#listener == null) {\n return;\n }\n await this.emitter.off(this.filter, this.#listener);\n }\n}\n//# sourceMappingURL=events.js.map","/**\n * Using strings in Core (or any security-basd system) requires\n * additional care. These utilities attempt to mitigate some of the\n * safety issues as well as provide the ability to recover and analyse\n * strings.\n *\n * @_subsection api/utils:Strings and UTF-8 [about-strings]\n */\nimport { getBytes } from \"./data.js\";\nimport { assertArgument, assertNormalize } from \"./errors.js\";\nfunction errorFunc(reason, offset, bytes, output, badCodepoint) {\n assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, \"bytes\", bytes);\n}\nfunction ignoreFunc(reason, offset, bytes, output, badCodepoint) {\n // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes\n if (reason === \"BAD_PREFIX\" || reason === \"UNEXPECTED_CONTINUE\") {\n let i = 0;\n for (let o = offset + 1; o < bytes.length; o++) {\n if (bytes[o] >> 6 !== 0x02) {\n break;\n }\n i++;\n }\n return i;\n }\n // This byte runs us past the end of the string, so just jump to the end\n // (but the first byte was read already read and therefore skipped)\n if (reason === \"OVERRUN\") {\n return bytes.length - offset - 1;\n }\n // Nothing to skip\n return 0;\n}\nfunction replaceFunc(reason, offset, bytes, output, badCodepoint) {\n // Overlong representations are otherwise \"valid\" code points; just non-deistingtished\n if (reason === \"OVERLONG\") {\n assertArgument(typeof badCodepoint === \"number\", \"invalid bad code point for replacement\", \"badCodepoint\", badCodepoint);\n output.push(badCodepoint);\n return 0;\n }\n // Put the replacement character into the output\n output.push(0xfffd);\n // Otherwise, process as if ignoring errors\n return ignoreFunc(reason, offset, bytes, output, badCodepoint);\n}\n/**\n * A handful of popular, built-in UTF-8 error handling strategies.\n *\n * **``\"error\"``** - throws on ANY illegal UTF-8 sequence or\n * non-canonical (overlong) codepoints (this is the default)\n *\n * **``\"ignore\"``** - silently drops any illegal UTF-8 sequence\n * and accepts non-canonical (overlong) codepoints\n *\n * **``\"replace\"``** - replace any illegal UTF-8 sequence with the\n * UTF-8 replacement character (i.e. ``\"\\\\ufffd\"``) and accepts\n * non-canonical (overlong) codepoints\n *\n * @returns: Record<\"error\" | \"ignore\" | \"replace\", Utf8ErrorFunc>\n */\nexport const Utf8ErrorFuncs = Object.freeze({\n error: errorFunc,\n ignore: ignoreFunc,\n replace: replaceFunc,\n});\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction getUtf8CodePoints(_bytes, onError) {\n if (onError == null) {\n onError = Utf8ErrorFuncs.error;\n }\n const bytes = getBytes(_bytes, \"bytes\");\n const result = [];\n let i = 0;\n // Invalid bytes are ignored\n while (i < bytes.length) {\n const c = bytes[i++];\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result.push(c);\n continue;\n }\n // Multibyte; how many bytes left for this character?\n let extraLength = null;\n let overlongMask = null;\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n // 1110 xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n }\n else {\n if ((c & 0xc0) === 0x80) {\n i += onError(\"UNEXPECTED_CONTINUE\", i - 1, bytes, result);\n }\n else {\n i += onError(\"BAD_PREFIX\", i - 1, bytes, result);\n }\n continue;\n }\n // Do we have enough bytes in our data?\n if (i - 1 + extraLength >= bytes.length) {\n i += onError(\"OVERRUN\", i - 1, bytes, result);\n continue;\n }\n // Remove the length prefix from the char\n let res = c & ((1 << (8 - extraLength - 1)) - 1);\n for (let j = 0; j < extraLength; j++) {\n let nextChar = bytes[i];\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n i += onError(\"MISSING_CONTINUE\", i, bytes, result);\n res = null;\n break;\n }\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n // See above loop for invalid continuation byte\n if (res === null) {\n continue;\n }\n // Maximum code point\n if (res > 0x10ffff) {\n i += onError(\"OUT_OF_RANGE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n i += onError(\"UTF16_SURROGATE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Check for overlong sequences (more bytes than needed)\n if (res <= overlongMask) {\n i += onError(\"OVERLONG\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n result.push(res);\n }\n return result;\n}\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\n/**\n * Returns the UTF-8 byte representation of %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8Bytes(str, form) {\n if (form != null) {\n assertNormalize(form);\n str = str.normalize(form);\n }\n let result = [];\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i);\n if (c < 0x80) {\n result.push(c);\n }\n else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n }\n else if ((c & 0xfc00) == 0xd800) {\n i++;\n const c2 = str.charCodeAt(i);\n assertArgument(i < str.length && (c2 & 0xfc00) === 0xdc00, \"invalid surrogate pair\", \"str\", str);\n // Surrogate Pair\n const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((pair >> 18) | 0xf0);\n result.push(((pair >> 12) & 0x3f) | 0x80);\n result.push(((pair >> 6) & 0x3f) | 0x80);\n result.push((pair & 0x3f) | 0x80);\n }\n else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n return new Uint8Array(result);\n}\n//export\nfunction _toUtf8String(codePoints) {\n return codePoints\n .map((codePoint) => {\n if (codePoint <= 0xffff) {\n return String.fromCharCode(codePoint);\n }\n codePoint -= 0x10000;\n return String.fromCharCode(((codePoint >> 10) & 0x3ff) + 0xd800, (codePoint & 0x3ff) + 0xdc00);\n })\n .join(\"\");\n}\n/**\n * Returns the string represented by the UTF-8 data %%bytes%%.\n *\n * When %%onError%% function is specified, it is called on UTF-8\n * errors allowing recovery using the [[Utf8ErrorFunc]] API.\n * (default: [error](Utf8ErrorFuncs))\n */\nexport function toUtf8String(bytes, onError) {\n return _toUtf8String(getUtf8CodePoints(bytes, onError));\n}\n/**\n * Returns the UTF-8 code-points for %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8CodePoints(str, form) {\n return getUtf8CodePoints(toUtf8Bytes(str, form));\n}\n//# sourceMappingURL=utf8.js.map","import { assert } from \"./errors.js\";\n// @TODO: timeout is completely ignored; start a Promise.any with a reject?\n// @ts-ignore\nexport async function getUrl(req, _signal) {\n const protocol = req.url.split(\":\")[0].toLowerCase();\n assert(protocol === \"http\" || protocol === \"https\", `unsupported protocol ${protocol}`, \"UNSUPPORTED_OPERATION\", {\n info: { protocol },\n operation: \"request\",\n });\n assert(protocol === \"https\" || !req.credentials || req.allowInsecureAuthentication, \"insecure authorized connections unsupported\", \"UNSUPPORTED_OPERATION\", {\n operation: \"request\",\n });\n let signal = undefined;\n if (_signal) {\n const controller = new AbortController();\n signal = controller.signal;\n _signal.addListener(() => {\n controller.abort();\n });\n }\n const init = {\n method: req.method,\n headers: new Headers(Array.from(req)),\n body: req.body || undefined,\n signal,\n };\n try {\n const resp = await fetch(req.url, init);\n const headers = {};\n resp.headers.forEach((value, key) => {\n headers[key.toLowerCase()] = value;\n });\n const respBody = await resp.arrayBuffer();\n const body = respBody == null ? null : new Uint8Array(respBody);\n return {\n statusCode: resp.status,\n statusMessage: resp.statusText,\n headers,\n body,\n };\n }\n catch (error) {\n console.log({ error });\n return undefined;\n }\n}\n//# sourceMappingURL=geturl-browser.js.map","/**\n * Explain fetching here...\n *\n * @_section api/utils/fetching:Fetching Web Content [about-fetch]\n */\nimport { decodeBase64, encodeBase64 } from \"./base64.js\";\nimport { hexlify } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nimport { defineProperties } from \"./properties.js\";\nimport { toUtf8Bytes, toUtf8String } from \"./utf8.js\";\nimport { getUrl } from \"./geturl.js\";\nconst MAX_ATTEMPTS = 12;\nconst SLOT_INTERVAL = 250;\n// The global FetchGetUrlFunc implementation.\nlet getUrlFunc = getUrl;\nconst reData = new RegExp(\"^data:([^;:]*)?(;base64)?,(.*)$\", \"i\");\nconst reIpfs = new RegExp(\"^ipfs://(ipfs/)?(.*)$\", \"i\");\n// If locked, new Gateways cannot be added\nlet locked = false;\n// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs\nasync function dataGatewayFunc(url, signal) {\n try {\n const match = url.match(reData);\n if (!match) {\n throw new Error(\"invalid data\");\n }\n return new FetchResponse(200, \"OK\", {\n \"content-type\": match[1] || \"text/plain\",\n }, match[2] ? decodeBase64(match[3]) : unpercent(match[3]));\n }\n catch (error) {\n return new FetchResponse(599, \"BAD REQUEST (invalid data: URI)\", {}, null, new FetchRequest(url));\n }\n}\n/**\n * Returns a [[FetchGatewayFunc]] for fetching content from a standard\n * IPFS gateway hosted at %%baseUrl%%.\n */\nfunction getIpfsGatewayFunc(baseUrl) {\n async function gatewayIpfs(url, signal) {\n try {\n const match = url.match(reIpfs);\n if (!match) {\n throw new Error(\"invalid link\");\n }\n return new FetchRequest(`${baseUrl}${match[2]}`);\n }\n catch (error) {\n return new FetchResponse(599, \"BAD REQUEST (invalid IPFS URI)\", {}, null, new FetchRequest(url));\n }\n }\n return gatewayIpfs;\n}\nconst Gateways = {\n data: dataGatewayFunc,\n ipfs: getIpfsGatewayFunc(\"https://gateway.ipfs.io/ipfs/\"),\n};\nconst fetchSignals = new WeakMap();\n/**\n * @_ignore\n */\nexport class FetchCancelSignal {\n #listeners;\n #cancelled;\n constructor(request) {\n this.#listeners = [];\n this.#cancelled = false;\n fetchSignals.set(request, () => {\n if (this.#cancelled) {\n return;\n }\n this.#cancelled = true;\n for (const listener of this.#listeners) {\n setTimeout(() => {\n listener();\n }, 0);\n }\n this.#listeners = [];\n });\n }\n addListener(listener) {\n assert(!this.#cancelled, \"singal already cancelled\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fetchCancelSignal.addCancelListener\",\n });\n this.#listeners.push(listener);\n }\n get cancelled() {\n return this.#cancelled;\n }\n checkSignal() {\n assert(!this.cancelled, \"cancelled\", \"CANCELLED\", {});\n }\n}\n// Check the signal, throwing if it is cancelled\nfunction checkSignal(signal) {\n if (signal == null) {\n throw new Error(\"missing signal; should not happen\");\n }\n signal.checkSignal();\n return signal;\n}\n/**\n * Represents a request for a resource using a URI.\n *\n * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``,\n * and ``IPFS:``.\n *\n * Additional schemes can be added globally using [[registerGateway]].\n *\n * @example:\n * req = new FetchRequest(\"https://www.ricmoo.com\")\n * resp = await req.send()\n * resp.body.length\n * //_result:\n */\nexport class FetchRequest {\n #allowInsecure;\n #gzip;\n #headers;\n #method;\n #timeout;\n #url;\n #body;\n #bodyType;\n #creds;\n // Hooks\n #preflight;\n #process;\n #retry;\n #signal;\n #throttle;\n /**\n * The fetch URI to requrest.\n */\n get url() {\n return this.#url;\n }\n set url(url) {\n this.#url = String(url);\n }\n /**\n * The fetch body, if any, to send as the request body. //(default: null)//\n *\n * When setting a body, the intrinsic ``Content-Type`` is automatically\n * set and will be used if **not overridden** by setting a custom\n * header.\n *\n * If %%body%% is null, the body is cleared (along with the\n * intrinsic ``Content-Type``) and the .\n *\n * If %%body%% is a string, the intrincis ``Content-Type`` is set to\n * ``text/plain``.\n *\n * If %%body%% is a Uint8Array, the intrincis ``Content-Type`` is set to\n * ``application/octet-stream``.\n *\n * If %%body%% is any other object, the intrincis ``Content-Type`` is\n * set to ``application/json``.\n */\n get body() {\n if (this.#body == null) {\n return null;\n }\n return new Uint8Array(this.#body);\n }\n set body(body) {\n if (body == null) {\n this.#body = undefined;\n this.#bodyType = undefined;\n }\n else if (typeof body === \"string\") {\n this.#body = toUtf8Bytes(body);\n this.#bodyType = \"text/plain\";\n }\n else if (body instanceof Uint8Array) {\n this.#body = body;\n this.#bodyType = \"application/octet-stream\";\n }\n else if (typeof body === \"object\") {\n this.#body = toUtf8Bytes(JSON.stringify(body));\n this.#bodyType = \"application/json\";\n }\n else {\n throw new Error(\"invalid body\");\n }\n }\n /**\n * Returns true if the request has a body.\n */\n hasBody() {\n return this.#body != null;\n }\n /**\n * The HTTP method to use when requesting the URI. If no method\n * has been explicitly set, then ``GET`` is used if the body is\n * null and ``POST`` otherwise.\n */\n get method() {\n if (this.#method) {\n return this.#method;\n }\n if (this.hasBody()) {\n return \"POST\";\n }\n return \"GET\";\n }\n set method(method) {\n if (method == null) {\n method = \"\";\n }\n this.#method = String(method).toUpperCase();\n }\n /**\n * The headers that will be used when requesting the URI. All\n * keys are lower-case.\n *\n * This object is a copy, so any chnages will **NOT** be reflected\n * in the ``FetchRequest``.\n *\n * To set a header entry, use the ``setHeader`` method.\n */\n get headers() {\n const headers = Object.assign({}, this.#headers);\n if (this.#creds) {\n headers[\"authorization\"] = `Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`;\n }\n if (this.allowGzip) {\n headers[\"accept-encoding\"] = \"gzip\";\n }\n if (headers[\"content-type\"] == null && this.#bodyType) {\n headers[\"content-type\"] = this.#bodyType;\n }\n if (this.body) {\n headers[\"content-length\"] = String(this.body.length);\n }\n return headers;\n }\n /**\n * Get the header for %%key%%, ignoring case.\n */\n getHeader(key) {\n return this.headers[key.toLowerCase()];\n }\n /**\n * Set the header for %%key%% to %%value%%. All values are coerced\n * to a string.\n */\n setHeader(key, value) {\n this.#headers[String(key).toLowerCase()] = String(value);\n }\n /**\n * Clear all headers, resetting all intrinsic headers.\n */\n clearHeaders() {\n this.#headers = {};\n }\n [Symbol.iterator]() {\n const headers = this.headers;\n const keys = Object.keys(headers);\n let index = 0;\n return {\n next: () => {\n if (index < keys.length) {\n const key = keys[index++];\n return {\n value: [key, headers[key]],\n done: false,\n };\n }\n return { value: undefined, done: true };\n },\n };\n }\n /**\n * The value that will be sent for the ``Authorization`` header.\n *\n * To set the credentials, use the ``setCredentials`` method.\n */\n get credentials() {\n return this.#creds || null;\n }\n /**\n * Sets an ``Authorization`` for %%username%% with %%password%%.\n */\n setCredentials(username, password) {\n assertArgument(!username.match(/:/), \"invalid basic authentication username\", \"username\", \"[REDACTED]\");\n this.#creds = `${username}:${password}`;\n }\n /**\n * Enable and request gzip-encoded responses. The response will\n * automatically be decompressed. //(default: true)//\n */\n get allowGzip() {\n return this.#gzip;\n }\n set allowGzip(value) {\n this.#gzip = !!value;\n }\n /**\n * Allow ``Authentication`` credentials to be sent over insecure\n * channels. //(default: false)//\n */\n get allowInsecureAuthentication() {\n return !!this.#allowInsecure;\n }\n set allowInsecureAuthentication(value) {\n this.#allowInsecure = !!value;\n }\n /**\n * The timeout (in milliseconds) to wait for a complere response.\n * //(default: 5 minutes)//\n */\n get timeout() {\n return this.#timeout;\n }\n set timeout(timeout) {\n assertArgument(timeout >= 0, \"timeout must be non-zero\", \"timeout\", timeout);\n this.#timeout = timeout;\n }\n /**\n * This function is called prior to each request, for example\n * during a redirection or retry in case of server throttling.\n *\n * This offers an opportunity to populate headers or update\n * content before sending a request.\n */\n get preflightFunc() {\n return this.#preflight || null;\n }\n set preflightFunc(preflight) {\n this.#preflight = preflight;\n }\n /**\n * This function is called after each response, offering an\n * opportunity to provide client-level throttling or updating\n * response data.\n *\n * Any error thrown in this causes the ``send()`` to throw.\n *\n * To schedule a retry attempt (assuming the maximum retry limit\n * has not been reached), use [[response.throwThrottleError]].\n */\n get processFunc() {\n return this.#process || null;\n }\n set processFunc(process) {\n this.#process = process;\n }\n /**\n * This function is called on each retry attempt.\n */\n get retryFunc() {\n return this.#retry || null;\n }\n set retryFunc(retry) {\n this.#retry = retry;\n }\n /**\n * Create a new FetchRequest instance with default values.\n *\n * Once created, each property may be set before issuing a\n * ``.send()`` to make the request.\n */\n constructor(url) {\n this.#url = String(url);\n this.#allowInsecure = false;\n this.#gzip = true;\n this.#headers = {};\n this.#method = \"\";\n this.#timeout = 300000;\n this.#throttle = {\n slotInterval: SLOT_INTERVAL,\n maxAttempts: MAX_ATTEMPTS,\n };\n }\n toString() {\n return ``;\n }\n /**\n * Update the throttle parameters used to determine maximum\n * attempts and exponential-backoff properties.\n */\n setThrottleParams(params) {\n if (params.slotInterval != null) {\n this.#throttle.slotInterval = params.slotInterval;\n }\n if (params.maxAttempts != null) {\n this.#throttle.maxAttempts = params.maxAttempts;\n }\n }\n async #send(attempt, expires, delay, _request, _response) {\n if (attempt >= this.#throttle.maxAttempts) {\n return _response.makeServerError(\"exceeded maximum retry limit\");\n }\n assert(getTime() <= expires, \"timeout\", \"TIMEOUT\", {\n operation: \"request.send\",\n reason: \"timeout\",\n request: _request,\n });\n if (delay > 0) {\n await wait(delay);\n }\n let req = this.clone();\n const scheme = (req.url.split(\":\")[0] || \"\").toLowerCase();\n // Process any Gateways\n if (scheme in Gateways) {\n const result = await Gateways[scheme](req.url, checkSignal(_request.#signal));\n if (result instanceof FetchResponse) {\n let response = result;\n if (this.processFunc) {\n checkSignal(_request.#signal);\n try {\n response = await this.processFunc(req, response);\n }\n catch (error) {\n // Something went wrong during processing; throw a 5xx server error\n if (error.throttle == null || typeof error.stall !== \"number\") {\n response\n .makeServerError(\"error in post-processing function\", error)\n .assertOk();\n }\n // Ignore throttling\n }\n }\n return response;\n }\n req = result;\n }\n // We have a preflight function; update the request\n if (this.preflightFunc) {\n req = await this.preflightFunc(req);\n }\n const resp = await getUrlFunc(req, checkSignal(_request.#signal));\n let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request);\n if (response.statusCode === 301 || response.statusCode === 302) {\n // Redirect\n try {\n const location = response.headers.location || \"\";\n return req\n .redirect(location)\n .#send(attempt + 1, expires, 0, _request, response);\n }\n catch (error) { }\n // Things won't get any better on another attempt; abort\n return response;\n }\n else if (response.statusCode === 429) {\n // Throttle\n if (this.retryFunc == null ||\n (await this.retryFunc(req, response, attempt))) {\n const retryAfter = response.headers[\"retry-after\"];\n let delay = this.#throttle.slotInterval *\n Math.trunc(Math.random() * Math.pow(2, attempt));\n if (typeof retryAfter === \"string\" &&\n retryAfter.match(/^[1-9][0-9]*$/)) {\n delay = parseInt(retryAfter);\n }\n return req\n .clone()\n .#send(attempt + 1, expires, delay, _request, response);\n }\n }\n if (this.processFunc) {\n checkSignal(_request.#signal);\n try {\n response = await this.processFunc(req, response);\n }\n catch (error) {\n // Something went wrong during processing; throw a 5xx server error\n if (error.throttle == null || typeof error.stall !== \"number\") {\n response\n .makeServerError(\"error in post-processing function\", error)\n .assertOk();\n }\n // Throttle\n let delay = this.#throttle.slotInterval *\n Math.trunc(Math.random() * Math.pow(2, attempt));\n if (error.stall >= 0) {\n delay = error.stall;\n }\n return req\n .clone()\n .#send(attempt + 1, expires, delay, _request, response);\n }\n }\n return response;\n }\n /**\n * Resolves to the response by sending the request.\n */\n send() {\n assert(this.#signal == null, \"request already sent\", \"UNSUPPORTED_OPERATION\", { operation: \"fetchRequest.send\" });\n this.#signal = new FetchCancelSignal(this);\n return this.#send(0, getTime() + this.timeout, 0, this, new FetchResponse(0, \"\", {}, null, this));\n }\n /**\n * Cancels the inflight response, causing a ``CANCELLED``\n * error to be rejected from the [[send]].\n */\n cancel() {\n assert(this.#signal != null, \"request has not been sent\", \"UNSUPPORTED_OPERATION\", { operation: \"fetchRequest.cancel\" });\n const signal = fetchSignals.get(this);\n if (!signal) {\n throw new Error(\"missing signal; should not happen\");\n }\n signal();\n }\n /**\n * Returns a new [[FetchRequest]] that represents the redirection\n * to %%location%%.\n */\n redirect(location) {\n // Redirection; for now we only support absolute locataions\n const current = this.url.split(\":\")[0].toLowerCase();\n const target = location.split(\":\")[0].toLowerCase();\n // Don't allow redirecting:\n // - non-GET requests\n // - downgrading the security (e.g. https => http)\n // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?]\n assert(this.method === \"GET\" &&\n (current !== \"https\" || target !== \"http\") &&\n location.match(/^https?:/), `unsupported redirect`, \"UNSUPPORTED_OPERATION\", {\n operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})`,\n });\n // Create a copy of this request, with a new URL\n const req = new FetchRequest(location);\n req.method = \"GET\";\n req.allowGzip = this.allowGzip;\n req.timeout = this.timeout;\n req.#headers = Object.assign({}, this.#headers);\n if (this.#body) {\n req.#body = new Uint8Array(this.#body);\n }\n req.#bodyType = this.#bodyType;\n // Do not forward credentials unless on the same domain; only absolute\n //req.allowInsecure = false;\n // paths are currently supported; may want a way to specify to forward?\n //setStore(req.#props, \"creds\", getStore(this.#pros, \"creds\"));\n return req;\n }\n /**\n * Create a new copy of this request.\n */\n clone() {\n const clone = new FetchRequest(this.url);\n // Preserve \"default method\" (i.e. null)\n clone.#method = this.#method;\n // Preserve \"default body\" with type, copying the Uint8Array is present\n if (this.#body) {\n clone.#body = this.#body;\n }\n clone.#bodyType = this.#bodyType;\n // Preserve \"default headers\"\n clone.#headers = Object.assign({}, this.#headers);\n // Credentials is readonly, so we copy internally\n clone.#creds = this.#creds;\n if (this.allowGzip) {\n clone.allowGzip = true;\n }\n clone.timeout = this.timeout;\n if (this.allowInsecureAuthentication) {\n clone.allowInsecureAuthentication = true;\n }\n clone.#preflight = this.#preflight;\n clone.#process = this.#process;\n clone.#retry = this.#retry;\n return clone;\n }\n /**\n * Locks all static configuration for gateways and FetchGetUrlFunc\n * registration.\n */\n static lockConfig() {\n locked = true;\n }\n /**\n * Get the current Gateway function for %%scheme%%.\n */\n static getGateway(scheme) {\n return Gateways[scheme.toLowerCase()] || null;\n }\n /**\n * Use the %%func%% when fetching URIs using %%scheme%%.\n *\n * This method affects all requests globally.\n *\n * If [[lockConfig]] has been called, no change is made and this\n * throws.\n */\n static registerGateway(scheme, func) {\n scheme = scheme.toLowerCase();\n if (scheme === \"http\" || scheme === \"https\") {\n throw new Error(`cannot intercept ${scheme}; use registerGetUrl`);\n }\n if (locked) {\n throw new Error(\"gateways locked\");\n }\n Gateways[scheme] = func;\n }\n /**\n * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests.\n *\n * This method affects all requests globally.\n *\n * If [[lockConfig]] has been called, no change is made and this\n * throws.\n */\n static registerGetUrl(getUrl) {\n if (locked) {\n throw new Error(\"gateways locked\");\n }\n getUrlFunc = getUrl;\n }\n /**\n * Creates a function that can \"fetch\" data URIs.\n *\n * Note that this is automatically done internally to support\n * data URIs, so it is not necessary to register it.\n *\n * This is not generally something that is needed, but may\n * be useful in a wrapper to perfom custom data URI functionality.\n */\n static createDataGateway() {\n return dataGatewayFunc;\n }\n /**\n * Creates a function that will fetch IPFS (unvalidated) from\n * a custom gateway baseUrl.\n *\n * The default IPFS gateway used internally is\n * ``\"https:/\\/gateway.ipfs.io/ipfs/\"``.\n */\n static createIpfsGatewayFunc(baseUrl) {\n return getIpfsGatewayFunc(baseUrl);\n }\n}\n/**\n * The response for a FetchREquest.\n */\nexport class FetchResponse {\n #statusCode;\n #statusMessage;\n #headers;\n #body;\n #request;\n #error;\n toString() {\n return ``;\n }\n /**\n * The response status code.\n */\n get statusCode() {\n return this.#statusCode;\n }\n /**\n * The response status message.\n */\n get statusMessage() {\n return this.#statusMessage;\n }\n /**\n * The response headers. All keys are lower-case.\n */\n get headers() {\n return Object.assign({}, this.#headers);\n }\n /**\n * The response body, or ``null`` if there was no body.\n */\n get body() {\n return this.#body == null ? null : new Uint8Array(this.#body);\n }\n /**\n * The response body as a UTF-8 encoded string, or the empty\n * string (i.e. ``\"\"``) if there was no body.\n *\n * An error is thrown if the body is invalid UTF-8 data.\n */\n get bodyText() {\n try {\n return this.#body == null ? \"\" : toUtf8String(this.#body);\n }\n catch (error) {\n assert(false, \"response body is not valid UTF-8 data\", \"UNSUPPORTED_OPERATION\", {\n operation: \"bodyText\",\n info: { response: this },\n });\n }\n }\n /**\n * The response body, decoded as JSON.\n *\n * An error is thrown if the body is invalid JSON-encoded data\n * or if there was no body.\n */\n get bodyJson() {\n try {\n return JSON.parse(this.bodyText);\n }\n catch (error) {\n assert(false, \"response body is not valid JSON\", \"UNSUPPORTED_OPERATION\", {\n operation: \"bodyJson\",\n info: { response: this },\n });\n }\n }\n [Symbol.iterator]() {\n const headers = this.headers;\n const keys = Object.keys(headers);\n let index = 0;\n return {\n next: () => {\n if (index < keys.length) {\n const key = keys[index++];\n return {\n value: [key, headers[key]],\n done: false,\n };\n }\n return { value: undefined, done: true };\n },\n };\n }\n constructor(statusCode, statusMessage, headers, body, request) {\n this.#statusCode = statusCode;\n this.#statusMessage = statusMessage;\n this.#headers = Object.keys(headers).reduce((accum, k) => {\n accum[k.toLowerCase()] = String(headers[k]);\n return accum;\n }, {});\n this.#body = body == null ? null : new Uint8Array(body);\n this.#request = request || null;\n this.#error = { message: \"\" };\n }\n /**\n * Return a Response with matching headers and body, but with\n * an error status code (i.e. 599) and %%message%% with an\n * optional %%error%%.\n */\n makeServerError(message, error) {\n let statusMessage;\n if (!message) {\n message = `${this.statusCode} ${this.statusMessage}`;\n statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`;\n }\n else {\n statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`;\n }\n const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined);\n response.#error = { message, error };\n return response;\n }\n /**\n * If called within a [request.processFunc](FetchRequest-processFunc)\n * call, causes the request to retry as if throttled for %%stall%%\n * milliseconds.\n */\n throwThrottleError(message, stall) {\n if (stall == null) {\n stall = -1;\n }\n else {\n assertArgument(Number.isInteger(stall) && stall >= 0, \"invalid stall timeout\", \"stall\", stall);\n }\n const error = new Error(message || \"throttling requests\");\n defineProperties(error, { stall, throttle: true });\n throw error;\n }\n /**\n * Get the header value for %%key%%, ignoring case.\n */\n getHeader(key) {\n return this.headers[key.toLowerCase()];\n }\n /**\n * Returns true of the response has a body.\n */\n hasBody() {\n return this.#body != null;\n }\n /**\n * The request made for this response.\n */\n get request() {\n return this.#request;\n }\n /**\n * Returns true if this response was a success statusCode.\n */\n ok() {\n return (this.#error.message === \"\" &&\n this.statusCode >= 200 &&\n this.statusCode < 300);\n }\n /**\n * Throws a ``SERVER_ERROR`` if this response is not ok.\n */\n assertOk() {\n if (this.ok()) {\n return;\n }\n let { message, error } = this.#error;\n if (message === \"\") {\n message = `server response ${this.statusCode} ${this.statusMessage}`;\n }\n assert(false, message, \"SERVER_ERROR\", {\n request: this.request || \"unknown request\",\n response: this,\n error,\n });\n }\n}\nfunction getTime() {\n return new Date().getTime();\n}\nfunction unpercent(value) {\n return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => {\n return String.fromCharCode(parseInt(code, 16));\n }));\n}\nfunction wait(delay) {\n return new Promise((resolve) => setTimeout(resolve, delay));\n}\n//# sourceMappingURL=fetch.js.map","var _a;\n/**\n * About fixed-point math...\n *\n * @_section: api/utils/fixed-point-math:Fixed-Point Maths [about-fixed-point-math]\n */\nimport { getBytes } from \"./data.js\";\nimport { assert, assertArgument, assertPrivate } from \"./errors.js\";\nimport { getBigInt, fromTwos, mask, toBigInt } from \"./maths.js\";\nimport { defineProperties } from \"./properties.js\";\nconst BN_N1 = BigInt(-1);\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_5 = BigInt(5);\nconst _guard = {};\n// Constant to pull zeros from for multipliers\nlet Zeros = \"0000\";\nwhile (Zeros.length < 80) {\n Zeros += Zeros;\n}\n// Returns a string \"1\" followed by decimal \"0\"s\nfunction getTens(decimals) {\n let result = Zeros;\n while (result.length < decimals) {\n result += result;\n }\n return BigInt(\"1\" + result.substring(0, decimals));\n}\nfunction checkValue(val, format, safeOp) {\n const width = BigInt(format.width);\n if (format.signed) {\n const limit = BN_1 << (width - BN_1);\n assert(safeOp == null || (val >= -limit && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp,\n fault: \"overflow\",\n value: val,\n });\n if (val > BN_0) {\n val = fromTwos(mask(val, width), width);\n }\n else {\n val = -fromTwos(mask(-val, width), width);\n }\n }\n else {\n const limit = BN_1 << width;\n assert(safeOp == null || (val >= 0 && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp,\n fault: \"overflow\",\n value: val,\n });\n val = ((val % limit) + limit) % limit & (limit - BN_1);\n }\n return val;\n}\nfunction getFormat(value) {\n if (typeof value === \"number\") {\n value = `fixed128x${value}`;\n }\n let signed = true;\n let width = 128;\n let decimals = 18;\n if (typeof value === \"string\") {\n // Parse the format string\n if (value === \"fixed\") {\n // defaults...\n }\n else if (value === \"ufixed\") {\n signed = false;\n }\n else {\n const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);\n assertArgument(match, \"invalid fixed format\", \"format\", value);\n signed = match[1] !== \"u\";\n width = parseInt(match[2]);\n decimals = parseInt(match[3]);\n }\n }\n else if (value) {\n // Extract the values from the object\n const v = value;\n const check = (key, type, defaultValue) => {\n if (v[key] == null) {\n return defaultValue;\n }\n assertArgument(typeof v[key] === type, \"invalid fixed format (\" + key + \" not \" + type + \")\", \"format.\" + key, v[key]);\n return v[key];\n };\n signed = check(\"signed\", \"boolean\", signed);\n width = check(\"width\", \"number\", width);\n decimals = check(\"decimals\", \"number\", decimals);\n }\n assertArgument(width % 8 === 0, \"invalid FixedNumber width (not byte aligned)\", \"format.width\", width);\n assertArgument(decimals <= 80, \"invalid FixedNumber decimals (too large)\", \"format.decimals\", decimals);\n const name = (signed ? \"\" : \"u\") + \"fixed\" + String(width) + \"x\" + String(decimals);\n return { signed, width, decimals, name };\n}\nfunction toString(val, decimals) {\n let negative = \"\";\n if (val < BN_0) {\n negative = \"-\";\n val *= BN_N1;\n }\n let str = val.toString();\n // No decimal point for whole values\n if (decimals === 0) {\n return negative + str;\n }\n // Pad out to the whole component (including a whole digit)\n while (str.length <= decimals) {\n str = Zeros + str;\n }\n // Insert the decimal point\n const index = str.length - decimals;\n str = str.substring(0, index) + \".\" + str.substring(index);\n // Trim the whole component (leaving at least one 0)\n while (str[0] === \"0\" && str[1] !== \".\") {\n str = str.substring(1);\n }\n // Trim the decimal component (leaving at least one 0)\n while (str[str.length - 1] === \"0\" && str[str.length - 2] !== \".\") {\n str = str.substring(0, str.length - 1);\n }\n return negative + str;\n}\n/**\n * A FixedNumber represents a value over its [[FixedFormat]]\n * arithmetic field.\n *\n * A FixedNumber can be used to perform math, losslessly, on\n * values which have decmial places.\n *\n * A FixedNumber has a fixed bit-width to store values in, and stores all\n * values internally by multiplying the value by 10 raised to the power of\n * %%decimals%%.\n *\n * If operations are performed that cause a value to grow too high (close to\n * positive infinity) or too low (close to negative infinity), the value\n * is said to //overflow//.\n *\n * For example, an 8-bit signed value, with 0 decimals may only be within\n * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become\n * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``.\n *\n * Many operation have a normal and //unsafe// variant. The normal variant\n * will throw a [[NumericFaultError]] on any overflow, while the //unsafe//\n * variant will silently allow overflow, corrupting its value value.\n *\n * If operations are performed that cause a value to become too small\n * (close to zero), the value loses precison and is said to //underflow//.\n *\n * For example, an value with 1 decimal place may store a number as small\n * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit\n * into 1 decimal place, so underflow occurs which means precision is lost\n * and the value becomes ``0``.\n *\n * Some operations have a normal and //signalling// variant. The normal\n * variant will silently ignore underflow, while the //signalling// variant\n * will thow a [[NumericFaultError]] on underflow.\n */\nexport class FixedNumber {\n /**\n * The specific fixed-point arithmetic field for this value.\n */\n format;\n #format;\n // The actual value (accounting for decimals)\n #val;\n // A base-10 value to multiple values by to maintain the magnitude\n #tens;\n /**\n * This is a property so console.log shows a human-meaningful value.\n *\n * @private\n */\n _value;\n // Use this when changing this file to get some typing info,\n // but then switch to any to mask the internal type\n //constructor(guard: any, value: bigint, format: _FixedFormat) {\n /**\n * @private\n */\n constructor(guard, value, format) {\n assertPrivate(guard, _guard, \"FixedNumber\");\n this.#val = value;\n this.#format = format;\n const _value = toString(value, format.decimals);\n defineProperties(this, { format: format.name, _value });\n this.#tens = getTens(format.decimals);\n }\n /**\n * If true, negative values are permitted, otherwise only\n * positive values and zero are allowed.\n */\n get signed() {\n return this.#format.signed;\n }\n /**\n * The number of bits available to store the value.\n */\n get width() {\n return this.#format.width;\n }\n /**\n * The number of decimal places in the fixed-point arithment field.\n */\n get decimals() {\n return this.#format.decimals;\n }\n /**\n * The value as an integer, based on the smallest unit the\n * [[decimals]] allow.\n */\n get value() {\n return this.#val;\n }\n #checkFormat(other) {\n assertArgument(this.format === other.format, \"incompatible format; use fixedNumber.toFormat\", \"other\", other);\n }\n #checkValue(val, safeOp) {\n /*\n const width = BigInt(this.width);\n if (this.signed) {\n const limit = (BN_1 << (width - BN_1));\n assert(safeOp == null || (val >= -limit && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n \n if (val > BN_0) {\n val = fromTwos(mask(val, width), width);\n } else {\n val = -fromTwos(mask(-val, width), width);\n }\n \n } else {\n const masked = mask(val, width);\n assert(safeOp == null || (val >= 0 && val === masked), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n val = masked;\n }\n */\n val = checkValue(val, this.#format, safeOp);\n return new _a(_guard, val, this.#format);\n }\n #add(o, safeOp) {\n this.#checkFormat(o);\n return this.#checkValue(this.#val + o.#val, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% added\n * to %%other%%, ignoring overflow.\n */\n addUnsafe(other) {\n return this.#add(other);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% added\n * to %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n add(other) {\n return this.#add(other, \"add\");\n }\n #sub(o, safeOp) {\n this.#checkFormat(o);\n return this.#checkValue(this.#val - o.#val, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%other%% subtracted\n * from %%this%%, ignoring overflow.\n */\n subUnsafe(other) {\n return this.#sub(other);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%other%% subtracted\n * from %%this%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n sub(other) {\n return this.#sub(other, \"sub\");\n }\n #mul(o, safeOp) {\n this.#checkFormat(o);\n return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%, ignoring overflow and underflow (precision loss).\n */\n mulUnsafe(other) {\n return this.#mul(other);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n mul(other) {\n return this.#mul(other, \"mul\");\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs or if underflow (precision loss) occurs.\n */\n mulSignal(other) {\n this.#checkFormat(other);\n const value = this.#val * other.#val;\n assert(value % this.#tens === BN_0, \"precision lost during signalling mul\", \"NUMERIC_FAULT\", {\n operation: \"mulSignal\",\n fault: \"underflow\",\n value: this,\n });\n return this.#checkValue(value / this.#tens, \"mulSignal\");\n }\n #div(o, safeOp) {\n assert(o.#val !== BN_0, \"division by zero\", \"NUMERIC_FAULT\", {\n operation: \"div\",\n fault: \"divide-by-zero\",\n value: this,\n });\n this.#checkFormat(o);\n return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%, ignoring underflow (precision loss). A\n * [[NumericFaultError]] is thrown if overflow occurs.\n */\n divUnsafe(other) {\n return this.#div(other);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%, ignoring underflow (precision loss). A\n * [[NumericFaultError]] is thrown if overflow occurs.\n */\n div(other) {\n return this.#div(other, \"div\");\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%. A [[NumericFaultError]] is thrown if underflow\n * (precision loss) occurs.\n */\n divSignal(other) {\n assert(other.#val !== BN_0, \"division by zero\", \"NUMERIC_FAULT\", {\n operation: \"div\",\n fault: \"divide-by-zero\",\n value: this,\n });\n this.#checkFormat(other);\n const value = this.#val * this.#tens;\n assert(value % other.#val === BN_0, \"precision lost during signalling div\", \"NUMERIC_FAULT\", {\n operation: \"divSignal\",\n fault: \"underflow\",\n value: this,\n });\n return this.#checkValue(value / other.#val, \"divSignal\");\n }\n /**\n * Returns a comparison result between %%this%% and %%other%%.\n *\n * This is suitable for use in sorting, where ``-1`` implies %%this%%\n * is smaller, ``1`` implies %%other%% is larger and ``0`` implies\n * both are equal.\n */\n cmp(other) {\n let a = this.value, b = other.value;\n // Coerce a and b to the same magnitude\n const delta = this.decimals - other.decimals;\n if (delta > 0) {\n b *= getTens(delta);\n }\n else if (delta < 0) {\n a *= getTens(-delta);\n }\n // Comnpare\n if (a < b) {\n return -1;\n }\n if (a > b) {\n return -1;\n }\n return 0;\n }\n /**\n * Returns true if %%other%% is equal to %%this%%.\n */\n eq(other) {\n return this.cmp(other) === 0;\n }\n /**\n * Returns true if %%other%% is less than to %%this%%.\n */\n lt(other) {\n return this.cmp(other) < 0;\n }\n /**\n * Returns true if %%other%% is less than or equal to %%this%%.\n */\n lte(other) {\n return this.cmp(other) <= 0;\n }\n /**\n * Returns true if %%other%% is greater than to %%this%%.\n */\n gt(other) {\n return this.cmp(other) > 0;\n }\n /**\n * Returns true if %%other%% is greater than or equal to %%this%%.\n */\n gte(other) {\n return this.cmp(other) >= 0;\n }\n /**\n * Returns a new [[FixedNumber]] which is the largest **integer**\n * that is less than or equal to %%this%%.\n *\n * The decimal component of the result will always be ``0``.\n */\n floor() {\n let val = this.#val;\n if (this.#val < BN_0) {\n val -= this.#tens - BN_1;\n }\n val = (this.#val / this.#tens) * this.#tens;\n return this.#checkValue(val, \"floor\");\n }\n /**\n * Returns a new [[FixedNumber]] which is the smallest **integer**\n * that is greater than or equal to %%this%%.\n *\n * The decimal component of the result will always be ``0``.\n */\n ceiling() {\n let val = this.#val;\n if (this.#val > BN_0) {\n val += this.#tens - BN_1;\n }\n val = (this.#val / this.#tens) * this.#tens;\n return this.#checkValue(val, \"ceiling\");\n }\n /**\n * Returns a new [[FixedNumber]] with the decimal component\n * rounded up on ties at %%decimals%% places.\n */\n round(decimals) {\n if (decimals == null) {\n decimals = 0;\n }\n // Not enough precision to not already be rounded\n if (decimals >= this.decimals) {\n return this;\n }\n const delta = this.decimals - decimals;\n const bump = BN_5 * getTens(delta - 1);\n let value = this.value + bump;\n const tens = getTens(delta);\n value = (value / tens) * tens;\n checkValue(value, this.#format, \"round\");\n return new _a(_guard, value, this.#format);\n }\n /**\n * Returns true if %%this%% is equal to ``0``.\n */\n isZero() {\n return this.#val === BN_0;\n }\n /**\n * Returns true if %%this%% is less than ``0``.\n */\n isNegative() {\n return this.#val < BN_0;\n }\n /**\n * Returns the string representation of %%this%%.\n */\n toString() {\n return this._value;\n }\n /**\n * Returns a float approximation.\n *\n * Due to IEEE 754 precission (or lack thereof), this function\n * can only return an approximation and most values will contain\n * rounding errors.\n */\n toUnsafeFloat() {\n return parseFloat(this.toString());\n }\n /**\n * Return a new [[FixedNumber]] with the same value but has had\n * its field set to %%format%%.\n *\n * This will throw if the value cannot fit into %%format%%.\n */\n toFormat(format) {\n return _a.fromString(this.toString(), format);\n }\n /**\n * Creates a new [[FixedNumber]] for %%value%% divided by\n * %%decimal%% places with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% (once adjusted\n * for %%decimals%%) cannot fit in %%format%%, either due to overflow\n * or underflow (precision loss).\n */\n static fromValue(_value, decimals, _format) {\n if (decimals == null) {\n decimals = 0;\n }\n const format = getFormat(_format);\n let value = getBigInt(_value, \"value\");\n const delta = decimals - format.decimals;\n if (delta > 0) {\n const tens = getTens(delta);\n assert(value % tens === BN_0, \"value loses precision for format\", \"NUMERIC_FAULT\", {\n operation: \"fromValue\",\n fault: \"underflow\",\n value: _value,\n });\n value /= tens;\n }\n else if (delta < 0) {\n value *= getTens(-delta);\n }\n checkValue(value, format, \"fromValue\");\n return new _a(_guard, value, format);\n }\n /**\n * Creates a new [[FixedNumber]] for %%value%% with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% cannot fit\n * in %%format%%, either due to overflow or underflow (precision loss).\n */\n static fromString(_value, _format) {\n const match = _value.match(/^(-?)([0-9]*)\\.?([0-9]*)$/);\n assertArgument(match && match[2].length + match[3].length > 0, \"invalid FixedNumber string value\", \"value\", _value);\n const format = getFormat(_format);\n let whole = match[2] || \"0\", decimal = match[3] || \"\";\n // Pad out the decimals\n while (decimal.length < format.decimals) {\n decimal += Zeros;\n }\n // Check precision is safe\n assert(decimal.substring(format.decimals).match(/^0*$/), \"too many decimals for format\", \"NUMERIC_FAULT\", {\n operation: \"fromString\",\n fault: \"underflow\",\n value: _value,\n });\n // Remove extra padding\n decimal = decimal.substring(0, format.decimals);\n const value = BigInt(match[1] + whole + decimal);\n checkValue(value, format, \"fromString\");\n return new _a(_guard, value, format);\n }\n /**\n * Creates a new [[FixedNumber]] with the big-endian representation\n * %%value%% with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% cannot fit\n * in %%format%% due to overflow.\n */\n static fromBytes(_value, _format) {\n let value = toBigInt(getBytes(_value, \"value\"));\n const format = getFormat(_format);\n if (format.signed) {\n value = fromTwos(value, format.width);\n }\n checkValue(value, format, \"fromBytes\");\n return new _a(_guard, value, format);\n }\n}\n_a = FixedNumber;\n//const f1 = FixedNumber.fromString(\"12.56\", \"fixed16x2\");\n//const f2 = FixedNumber.fromString(\"0.3\", \"fixed16x2\");\n//console.log(f1.divSignal(f2));\n//const BUMP = FixedNumber.from(\"0.5\");\n//# sourceMappingURL=fixednumber.js.map","import { hexlify } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nimport { getBytes } from \"./data.js\";\nfunction hexlifyByte(value) {\n let result = value.toString(16);\n while (result.length < 2) {\n result = \"0\" + result;\n }\n return \"0x\" + result;\n}\nfunction unarrayifyInteger(data, offset, length) {\n let result = 0;\n for (let i = 0; i < length; i++) {\n result = result * 256 + data[offset + i];\n }\n return result;\n}\nfunction _decodeChildren(data, offset, childOffset, length) {\n const result = [];\n while (childOffset < offset + 1 + length) {\n const decoded = _decode(data, childOffset);\n result.push(decoded.result);\n childOffset += decoded.consumed;\n assert(childOffset <= offset + 1 + length, \"child data too short\", \"BUFFER_OVERRUN\", {\n buffer: data,\n length,\n offset,\n });\n }\n return { consumed: 1 + length, result: result };\n}\n// returns { consumed: number, result: Object }\nfunction _decode(data, offset) {\n assert(data.length !== 0, \"data too short\", \"BUFFER_OVERRUN\", {\n buffer: data,\n length: 0,\n offset: 1,\n });\n const checkOffset = (offset) => {\n assert(offset <= data.length, \"data short segment too short\", \"BUFFER_OVERRUN\", {\n buffer: data,\n length: data.length,\n offset,\n });\n };\n // Array with extra length prefix\n if (data[offset] >= 0xf8) {\n const lengthLength = data[offset] - 0xf7;\n checkOffset(offset + 1 + lengthLength);\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n checkOffset(offset + 1 + lengthLength + length);\n return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);\n }\n else if (data[offset] >= 0xc0) {\n const length = data[offset] - 0xc0;\n checkOffset(offset + 1 + length);\n return _decodeChildren(data, offset, offset + 1, length);\n }\n else if (data[offset] >= 0xb8) {\n const lengthLength = data[offset] - 0xb7;\n checkOffset(offset + 1 + lengthLength);\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n checkOffset(offset + 1 + lengthLength + length);\n const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length));\n return { consumed: 1 + lengthLength + length, result: result };\n }\n else if (data[offset] >= 0x80) {\n const length = data[offset] - 0x80;\n checkOffset(offset + 1 + length);\n const result = hexlify(data.slice(offset + 1, offset + 1 + length));\n return { consumed: 1 + length, result: result };\n }\n return { consumed: 1, result: hexlifyByte(data[offset]) };\n}\n/**\n * Decodes %%data%% into the structured data it represents.\n */\nexport function decodeRlp(_data) {\n const data = getBytes(_data, \"data\");\n const decoded = _decode(data, 0);\n assertArgument(decoded.consumed === data.length, \"unexpected junk after rlp payload\", \"data\", _data);\n return decoded.result;\n}\n//# sourceMappingURL=rlp-decode.js.map","import { getBytes } from \"./data.js\";\nfunction arrayifyInteger(value) {\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\nfunction _encode(object) {\n if (Array.isArray(object)) {\n let payload = [];\n object.forEach(function (child) {\n payload = payload.concat(_encode(child));\n });\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length);\n return payload;\n }\n const length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n return length.concat(payload);\n }\n const data = Array.prototype.slice.call(getBytes(object, \"object\"));\n if (data.length === 1 && data[0] <= 0x7f) {\n return data;\n }\n else if (data.length <= 55) {\n data.unshift(0x80 + data.length);\n return data;\n }\n const length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n return length.concat(data);\n}\nconst nibbles = \"0123456789abcdef\";\n/**\n * Encodes %%object%% as an RLP-encoded [[DataHexString]].\n */\nexport function encodeRlp(object) {\n let result = \"0x\";\n for (const v of _encode(object)) {\n result += nibbles[v >> 4];\n result += nibbles[v & 0xf];\n }\n return result;\n}\n//# sourceMappingURL=rlp-encode.js.map","/**\n * Most interactions with Core requires integer values, which use\n * the smallest magnitude unit.\n *\n * For example, imagine dealing with dollars and cents. Since dollars\n * are divisible, non-integer values are possible, such as ``$10.77``.\n * By using the smallest indivisible unit (i.e. cents), the value can\n * be kept as the integer ``1077``.\n *\n * When receiving decimal input from the user (as a decimal string),\n * the value should be converted to an integer and when showing a user\n * a value, the integer value should be converted to a decimal string.\n *\n * This creates a clear distinction, between values to be used by code\n * (integers) and values used for display logic to users (decimals).\n *\n * The native unit in Core, //Core// is divisible to 18 decimal places,\n * where each individual unit is called a //ore//.\n *\n * @_subsection api/utils:Unit Conversion [about-units]\n */\nimport { assertArgument } from \"./errors.js\";\nimport { FixedNumber } from \"./fixednumber.js\";\nimport { getNumber } from \"./maths.js\";\nconst names = [\n ///Ore, the smallest and atomic amount of Core\n \"ore\",\n ///fecore, 1000 ore\n \"fecore\",\n ///Picore, one million ore\n \"picore\",\n ///Nacore, one billion ore. Typically a reasonable unit to measure energy prices.\n \"nacore\",\n ///Μcore, 10^12 ore or 1 μCore\n \"mcore\",\n ///micore, 10^15 ore or 1 mcore\n \"micore\",\n \"core\",\n];\n/**\n * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal\n * places. The %%unit%% may be the number of decimal places or the name of\n * a unit\n *\n */\nexport function formatUnits(value, unit) {\n let decimals = 18;\n if (typeof unit === \"string\") {\n const index = names.indexOf(unit);\n assertArgument(index >= 0, \"invalid unit\", \"unit\", unit);\n decimals = 3 * index;\n }\n else if (unit != null) {\n decimals = getNumber(unit, \"unit\");\n }\n return FixedNumber.fromValue(value, decimals, { decimals }).toString();\n}\n/**\n * Converts the //decimal string// %%value%% to a BigInt, assuming\n * %%unit%% decimal places. The %%unit%% may the number of decimal places\n * or the name of a unit.\n */\nexport const scientificToDecimal = (num) => {\n // @ts-ignore\n var nsign = Math.sign(num);\n //remove the sign\n // @ts-ignore\n num = Math.abs(num);\n //if the number is in scientific notation remove it\n // @ts-ignore\n if (/\\d+\\.?\\d*e[\\+\\-]*\\d+/i.test(num)) {\n var zero = \"0\", \n // @ts-ignore\n parts = String(num).toLowerCase().split(\"e\"), //split into coeff and exponent\n e = parts.pop(), //store the exponential part\n // @ts-ignore\n l = Math.abs(e), //get the number of zeros\n // @ts-ignore\n sign = e / l, coeff_array = parts[0].split(\".\");\n if (sign === -1) {\n l = l - coeff_array[0].length;\n if (l < 0) {\n // @ts-ignore\n num =\n coeff_array[0].slice(0, l) +\n \".\" +\n coeff_array[0].slice(l) +\n (coeff_array.length === 2 ? coeff_array[1] : \"\");\n }\n else {\n // @ts-ignore\n num = zero + \".\" + new Array(l + 1).join(zero) + coeff_array.join(\"\");\n }\n }\n else {\n var dec = coeff_array[1];\n if (dec)\n l = l - dec.length;\n if (l < 0) {\n // @ts-ignore\n num = coeff_array[0] + dec.slice(0, l) + \".\" + dec.slice(l);\n }\n else {\n // @ts-ignore\n num = coeff_array.join(\"\") + new Array(l + 1).join(zero);\n }\n }\n }\n // @ts-ignore\n return nsign < 0 ? \"-\" + num : num;\n};\nexport const trimDecimals = (n, decimals = 18) => {\n n += \"\";\n if (n.indexOf(\".\") === -1)\n return n;\n const arr = n.split(\".\");\n const fraction = arr[1].substr(0, decimals);\n return arr[0] + \".\" + fraction;\n};\nexport function parseUnits(value, unit) {\n assertArgument(typeof value === \"string\", \"value must be a string\", \"value\", value);\n if (value.includes(\"e\")) {\n value = scientificToDecimal(value).toString();\n }\n let decimals = 18;\n if (typeof unit === \"string\") {\n const index = names.indexOf(unit);\n assertArgument(index >= 0, \"invalid unit\", \"unit\", unit);\n decimals = 3 * index;\n value = trimDecimals(value, decimals);\n }\n else if (unit != null) {\n decimals = getNumber(unit, \"unit\");\n value = trimDecimals(value, decimals);\n }\n return FixedNumber.fromString(value, { decimals }).value;\n}\n/**\n * Converts %%value%% into a //decimal string// using 18 decimal places.\n */\nexport function formatXCB(ore) {\n return formatUnits(ore, 18);\n}\n/**\n * Converts the //decimal string// %%xcb%% to a BigInt, using 18\n * decimal places.\n */\nexport function parseXCB(xcb) {\n return parseUnits(xcb, 18);\n}\n//# sourceMappingURL=units.js.map","/**\n * Explain UUID and link to RFC here.\n *\n * @_subsection: api/utils:UUID [about-uuid]\n */\nimport { getBytes, hexlify } from \"./data.js\";\n/**\n * Returns the version 4 [[link-uuid]] for the %%randomBytes%%.\n *\n * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4)\n */\nexport function uuidV4(randomBytes) {\n const bytes = getBytes(randomBytes, \"randomBytes\");\n // Section: 4.1.3:\n // - time_hi_and_version[12:16] = 0b0100\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n // Section 4.4\n // - clock_seq_hi_and_reserved[6] = 0b0\n // - clock_seq_hi_and_reserved[7] = 0b1\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n const value = hexlify(bytes);\n return [\n value.substring(2, 10),\n value.substring(10, 14),\n value.substring(14, 18),\n value.substring(18, 22),\n value.substring(22, 34),\n ].join(\"-\");\n}\n//# sourceMappingURL=uuid.js.map","// @ts-ignore\nimport ed448 from \"./browser-ed448.js\";\n// @ts-ignore\nimport pbkdf2 from \"./pbkdf2-browser.js\";\n// @ts-ignore\nimport SHA3_512 from \"bcrypto/lib/sha3-512.js\";\nexport class Ed448Goldilock {\n static _channel = ed448;\n static generatePrivateKey() {\n var privateKey = ed448.privateKeyGenerate();\n privateKey[56] &= 0x7f;\n return privateKey;\n }\n static getPublicKeyFromPrivateKey(privateKey) {\n var secret = Buffer.from(privateKey, \"hex\");\n if (secret[56] > 127) {\n var scalar = secret.slice(0, 56);\n scalar[0] &= 0xfc;\n scalar[55] |= 0x80;\n var publicKey = this._channel.publicKeyFromScalar(scalar);\n return Buffer.from(publicKey).toString(\"hex\");\n }\n else {\n var publicKey = this._channel.publicKeyCreate(secret);\n return Buffer.from(publicKey).toString(\"hex\");\n }\n }\n static signWithPrivateKey(privateKey, msg) {\n var msgToSign = Buffer.from(msg, \"hex\");\n var secret = Buffer.from(privateKey, \"hex\");\n if (secret[56] > 127) {\n var prefix = secret.slice(0, 57);\n prefix[0] &= 0xfc;\n prefix[56] = 0;\n prefix[55] |= 0x80;\n var scalar = prefix.slice(0, 56);\n var signedMessage = this._channel.signWithScalar(msgToSign, scalar, prefix);\n return Buffer.from(signedMessage).toString(\"hex\");\n }\n else {\n var signedMessage = this._channel.sign(msgToSign, secret);\n return Buffer.from(signedMessage).toString(\"hex\");\n }\n }\n static signWithPrivateKeyNConcatPubkey(privateKey, msg) {\n var signedMessage = Ed448Goldilock.signWithPrivateKey(privateKey, msg);\n var publicKey = Ed448Goldilock.getPublicKeyFromPrivateKey(privateKey);\n return signedMessage + publicKey;\n }\n static verifySignature(msgHash, signedMsg, pubKey) {\n return this._channel.verify(msgHash, signedMsg, pubKey);\n }\n static SHA512Hash(password, salt) {\n var p1 = Buffer.from(password, \"hex\");\n var s1 = Buffer.from(salt, \"hex\");\n return Buffer.from(pbkdf2.derive(SHA3_512, p1, s1, 2048, 57)).toString(\"hex\");\n }\n static concatenateAndHex(prefix, key, index, salt) {\n var ind = Buffer.alloc(4);\n var p = Buffer.alloc(1);\n p[0] = prefix % 256;\n var j = index;\n for (let i = 0; i < 4; i++) {\n ind[i] = j % 256;\n j = Math.floor(j / 256);\n }\n var t = p.toString(\"hex\") + key + ind.toString(\"hex\");\n return Ed448Goldilock.SHA512Hash(t, salt);\n }\n static addScalar(a, b) {\n var a1 = Buffer.from(a, \"hex\");\n var b1 = Buffer.from(b.substr(0, 106) + \"00000000\", \"hex\");\n b1[0] &= 0xfc;\n var c = Buffer.alloc(57);\n var hold = 0;\n for (let i = 0; i < 57; i++) {\n hold += a1[i] + b1[i];\n c[i] = hold % 256;\n hold = Math.floor(hold / 256);\n }\n return c.toString(\"hex\");\n }\n static seedToExtendedPrivate(seed) {\n var s1 = Ed448Goldilock.SHA512Hash(seed, \"6d6e656d6f6e6963666f72746865636861696e\");\n var s2 = Ed448Goldilock.SHA512Hash(seed, \"6d6e656d6f6e6963666f727468656b6579\");\n var b = Buffer.from(s2, \"hex\");\n b[56] |= 0x80;\n b[55] |= 0x80;\n b[55] &= 0xbf;\n var s3 = b.toString(\"hex\");\n return s1 + s3;\n }\n static childPrivateToPrivate(s, index) {\n var s0 = s.substr(0, 114);\n var s1 = s.substr(114, 228);\n var r0, r1;\n if (index >= 0x80000000) {\n r0 = Ed448Goldilock.concatenateAndHex(1, s1, index, s0);\n r1 = Ed448Goldilock.concatenateAndHex(0, s1, index, s0);\n return r0 + Ed448Goldilock.addScalar(s1, r1);\n }\n else {\n var pub = Ed448Goldilock.getPublicKeyFromPrivateKey(s1);\n r0 = Ed448Goldilock.concatenateAndHex(3, pub, index, s0);\n r1 = Ed448Goldilock.concatenateAndHex(2, pub, index, s0);\n return r0 + Ed448Goldilock.addScalar(s1, r1);\n }\n }\n static HDWalletGenerateKeyFromSeed(seed, index) {\n var m = Ed448Goldilock.seedToExtendedPrivate(seed);\n var k1 = Ed448Goldilock.childPrivateToPrivate(m, 0x80000000 + 44);\n var k2 = Ed448Goldilock.childPrivateToPrivate(k1, 0x80000000 + 654);\n var k3 = Ed448Goldilock.childPrivateToPrivate(k2, 0x80000000 + 0);\n var k4 = Ed448Goldilock.childPrivateToPrivate(k3, 0x80000000 + 0);\n var k5 = Ed448Goldilock.childPrivateToPrivate(k4, index);\n return k5.substr(114, 228);\n }\n}\n//# sourceMappingURL=ed448goldilock-browser.js.map","/* Browser Crypto Shims */\nimport { hmac } from \"@noble/hashes/hmac\";\nimport { pbkdf2 } from \"@noble/hashes/pbkdf2\";\nimport { sha256 } from \"@noble/hashes/sha256\";\nimport { sha512 } from \"@noble/hashes/sha512\";\nimport { sha3_256, sha3_512 } from \"@noble/hashes/sha3\";\nimport ed448 from \"./browser-ed448.js\";\nimport { assert, assertArgument } from \"../utils/index.js\";\nexport { ed448 };\nexport { Ed448Goldilock } from \"./ed448goldilock-browser.js\";\nfunction getGlobal() {\n if (typeof self !== \"undefined\") {\n return self;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof global !== \"undefined\") {\n return global;\n }\n throw new Error(\"unable to locate global object\");\n}\nconst anyGlobal = getGlobal();\nconst crypto = anyGlobal.crypto || anyGlobal.msCrypto;\nexport function createHash(algo) {\n switch (algo) {\n case \"sha256\":\n return sha256.create();\n case \"sha512\":\n return sha512.create();\n case \"sha3-256\":\n return sha3_256.create();\n case \"sha3-512\":\n return sha3_512.create();\n }\n assertArgument(false, \"invalid hashing algorithm name\", \"algorithm\", algo);\n}\nexport function createHmac(_algo, key) {\n const algo = { sha256, sha512 }[_algo];\n assertArgument(algo != null, \"invalid hmac algorithm\", \"algorithm\", _algo);\n return hmac.create(algo, key);\n}\nexport function pbkdf2Sync(password, salt, iterations, keylen, _algo) {\n const algo = { sha256, sha512 }[_algo];\n assertArgument(algo != null, \"invalid pbkdf2 algorithm\", \"algorithm\", _algo);\n return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen });\n}\nexport function randomBytes(length) {\n assert(crypto != null, \"platform does not support secure random numbers\", \"UNSUPPORTED_OPERATION\", {\n operation: \"randomBytes\",\n });\n assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, \"invalid length\", \"length\", length);\n const result = new Uint8Array(length);\n crypto.getRandomValues(result);\n return result;\n}\n//# sourceMappingURL=crypto-browser.js.map","import { Logger } from \"../logger/logger.js\";\nimport { arrayify, getBytes, hexlify } from \"../utils/data.js\";\nimport { createHash, createHmac } from \"./crypto.js\";\nimport { Buffer } from \"buffer\";\nconst logger = new Logger(\"sha3/0.0.1\");\nconst _sha256 = function (data) {\n let v = \"0x\" +\n createHash(\"sha3-256\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n return v;\n};\nconst _sha512 = function (data) {\n let v = \"0x\" +\n createHash(\"sha3-512\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n return v;\n};\n// @ts-ignore\nlet __sha256 = _sha256;\n// @ts-ignore\nlet __sha512 = _sha512;\nlet locked256 = false, locked512 = false;\n/**\n * Compute the cryptographic SHA2-256 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * sha256(\"0x\")\n * //_result:\n *\n * sha256(\"0x1337\")\n * //_result:\n *\n * sha256(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n */\nexport var SupportedAlgorithm;\n(function (SupportedAlgorithm) {\n SupportedAlgorithm[\"sha256\"] = \"sha256\";\n SupportedAlgorithm[\"sha512\"] = \"sha512\";\n})(SupportedAlgorithm || (SupportedAlgorithm = {}));\nexport function ripemd160(data) {\n let createdHash = \"0x\" +\n createHash(\"ripemd160\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n const v = \"0x\" + createdHash;\n if (typeof createdHash !== \"string\") {\n createdHash = hexlify(createdHash);\n return createdHash;\n }\n return v;\n}\nexport function sha256(data) {\n let createdHash = createHash(\"sha3-256\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n const v = \"0x\" + createdHash;\n if (typeof createdHash !== \"string\") {\n createdHash = hexlify(createdHash);\n return createdHash;\n }\n return v;\n}\nexport function legacySha256(data) {\n const _data = getBytes(data, \"data\");\n const hexlified = hexlify(createHash(\"sha256\").update(_data).digest());\n return hexlified;\n}\nexport function computeHmac(algorithm, key, data) {\n const d = Buffer.from(arrayify(data));\n const k = Buffer.from(arrayify(key));\n if (algorithm === SupportedAlgorithm.sha256) {\n return \"0x\" + createHmac(\"sha3-256\", k).update(d).digest(\"hex\");\n }\n else if (algorithm === SupportedAlgorithm.sha512) {\n return \"0x\" + createHmac(\"sha3-512\", k).update(d).digest(\"hex\");\n }\n logger.throwError(\"unsupported algorithm - \" + algorithm, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"computeHmac\",\n algorithm: algorithm,\n });\n return \"\";\n}\nsha256._ = _sha256;\nsha256.lock = function () {\n locked256 = true;\n};\nsha256.register = function (func) {\n if (locked256) {\n throw new Error(\"sha256 is locked\");\n }\n __sha256 = func;\n};\nObject.freeze(sha256);\n/**\n * Compute the cryptographic SHA2-512 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * sha512(\"0x\")\n * //_result:\n *\n * sha512(\"0x1337\")\n * //_result:\n *\n * sha512(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n */\nexport function sha512(data) {\n let createdHash = createHash(\"sha3-512\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n const v = \"0x\" + createdHash;\n if (typeof createdHash !== \"string\") {\n createdHash = hexlify(createdHash);\n return createdHash;\n }\n return v;\n}\nsha512._ = _sha512;\nsha512.lock = function () {\n locked512 = true;\n};\nsha512.register = function (func) {\n if (locked512) {\n throw new Error(\"sha512 is locked\");\n }\n __sha512 = func;\n};\nObject.freeze(sha256);\n//# sourceMappingURL=sha3.js.map","/**\n * Addresses are a fundamental part of interacting with Core. They\n * represent the gloabal identity of Externally Owned Accounts (accounts\n * backed by a private key) and contracts.\n *\n * The Core Naming Service (CNS) provides an interconnected ecosystem\n * of contracts, standards and libraries which enable looking up an\n * address for an ENS name.\n *\n * These functions help convert between various formats, validate\n * addresses and safely resolve ENS names.\n *\n * @_section: api/address:Addresses [about-addresses]\n */\nnull;\nimport { BigNumber } from \"../bigNumber/bigNumber.js\";\nimport { encode } from \"../crypto/rlp.js\";\nimport { sha256 } from \"../crypto/sha3.js\";\nimport { Logger } from \"../logger/logger.js\";\nimport { arrayify, getBytes, hexDataSlice, hexlify, stripZeros, } from \"../utils/data.js\";\nconst logger = new Logger(\"address/0.0.1\");\nconst precompiledAddresses = [\n \"0000000000000000000000000000000000000000000000000000000000000000\",\n \"0000000000000000000000000000000000000000000000000000000000000001\",\n \"0000000000000000000000000000000000000000000000000000000000000002\",\n \"0000000000000000000000000000000000000000000000000000000000000003\",\n \"0000000000000000000000000000000000000000000000000000000000000004\",\n \"0000000000000000000000000000000000000000000000000000000000000005\",\n \"0000000000000000000000000000000000000000000000000000000000000006\",\n \"0000000000000000000000000000000000000000000000000000000000000007\",\n \"0000000000000000000000000000000000000000000000000000000000000008\",\n \"0000000000000000000000000000000000000000000000000000000000000009\",\n];\nfunction removeHexPrefix(val) {\n return val.substring(0, 2) === \"0x\" ? val.substring(2) : val;\n}\nfunction calculateCheckSum(_address, _prefix) {\n const address = getBytes(\"0x\" + _address.replace(\"0x\", \"\"));\n const prefix = getBytes(\"0x\" + _prefix.replace(\"0x\", \"\"));\n const tmpConcated = new Uint8Array([...address, ...prefix]);\n const hexedConcat = hexlify(tmpConcated).replace(\"0x\", \"\") + \"00\";\n const mods = Array.from(hexedConcat.toUpperCase(), (c) => {\n const charCode = c.charCodeAt(0);\n return charCode > 64 && charCode < 91\n ? (charCode - 55).toString()\n : (charCode - 48).toString();\n }).join(\"\");\n const bigVal = BigInt(mods);\n const val97 = BigInt(97);\n const val98 = BigInt(98);\n const remainder = bigVal % val97;\n const checkSum = val98 - remainder;\n const result = checkSum > 9 ? checkSum.toString() : \"0\" + checkSum.toString();\n return result;\n}\n// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number\n// Create lookup table\nconst ibanLookup = {};\nfor (let i = 0; i < 10; i++) {\n ibanLookup[String(i)] = String(i);\n}\nfor (let i = 0; i < 26; i++) {\n ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);\n}\n// How many decimal digits can we process? (for 64-bit float, this is 15)\n// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER));\nconst safeDigits = 15;\nfunction ibanChecksum(address) {\n address = address.toUpperCase();\n address = address.substring(4) + address.substring(0, 2) + \"00\";\n let expanded = address\n .split(\"\")\n .map((c) => {\n return ibanLookup[c];\n })\n .join(\"\");\n // Javascript can handle integers safely up to 15 (decimal) digits\n while (expanded.length >= safeDigits) {\n let block = expanded.substring(0, safeDigits);\n expanded = (parseInt(block, 10) % 97) + expanded.substring(block.length);\n }\n let checksum = String(98 - (parseInt(expanded, 10) % 97));\n while (checksum.length < 2) {\n checksum = \"0\" + checksum;\n }\n return checksum;\n}\n/**\n * Returns a normalized and checksumed address for %%address%%.\n * This accepts non-checksum addresses, checksum addresses and\n * [[getIcapAddress]] formats.\n *\n * The checksum in Core uses the capitalization (upper-case\n * vs lower-case) of the characters within an address to encode\n * its checksum, which offers, on average, a checksum of 15-bits.\n *\n * If %%address%% contains both upper-case and lower-case, it is\n * assumed to already be a checksum address and its checksum is\n * validated, and if the address fails its expected checksum an\n * error is thrown.\n *\n * If you wish the checksum of %%address%% to be ignore, it should\n * be converted to lower-case (i.e. ``.toLowercase()``) before\n * being passed in. This should be a very rare situation though,\n * that you wish to bypass the safegaurds in place to protect\n * against an address that has been incorrectly copied from another\n * source.\n *\n * @example:\n * // Adds the checksum (via upper-casing specific letters)\n * getAddress(\"0x8ba1f109551bd432803012645ac136ddd64dba72\")\n * //_result:\n *\n * // Converts ICAP address and adds checksum\n * getAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\");\n * //_result:\n *\n * // Throws an error if an address contains mixed case,\n * // but the checksum fails\n * getAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_error:\n */\nfunction getAddress(address) {\n if (typeof address !== \"string\") {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n if (!address.match(/^(0x)?[0-9a-fA-F]{44}$/)) {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n const raw = removeHexPrefix(address);\n if (precompiledAddresses.includes(raw)) {\n return \"0x\" + raw;\n }\n const prefix = raw.substring(0, 2);\n const val = raw.substring(4);\n const checksum = calculateCheckSum(val, prefix);\n if (checksum !== raw.substring(2, 4)) {\n logger.throwArgumentError(\"bad address checksum\", \"address\", address);\n }\n return \"0x\" + prefix + checksum + val;\n}\n/**\n * The [ICAP Address format](link-icap) format is an early checksum\n * format which attempts to be compatible with the banking\n * industry [IBAN format](link-wiki-iban) for bank accounts.\n *\n * It is no longer common or a recommended format.\n *\n * @example:\n * getIcapAddress(\"0x8ba1f109551bd432803012645ac136ddd64dba72\");\n * //_result:\n *\n * getIcapAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\");\n * //_result:\n *\n * // Throws an error if the ICAP checksum is wrong\n * getIcapAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37\");\n * //_error:\n */\nfunction getIcapAddress(address) {\n //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase();\n let base36 = BigInt(getAddress(address)).toString(36).toUpperCase();\n while (base36.length < 30) {\n base36 = \"0\" + base36;\n }\n return \"XE\" + ibanChecksum(\"XE00\" + base36) + base36;\n}\nfunction networkIdToPrefix(networkId) {\n if (networkId == 1) {\n return \"cb\";\n }\n else if (networkId == 3 || networkId == 4) {\n return \"ab\";\n }\n else if (networkId > 10 || networkId == 0) {\n return \"ce\";\n }\n else {\n logger.throwArgumentError(\"bad networkId\", \"networkId\", networkId);\n return \"\";\n }\n}\nfunction getContractAddress(transaction) {\n let from = null;\n try {\n from = getAddress(transaction.from);\n }\n catch (error) {\n logger.throwArgumentError(\"missing from address\", \"transaction\", transaction);\n }\n const nonce = stripZeros(arrayify(BigNumber.from(transaction.nonce).toHexString()));\n const val = hexDataSlice(sha256(encode([from, nonce])), 12);\n const prefix = from.substring(2, 4);\n const checksum = calculateCheckSum(val, prefix);\n return \"0x\" + prefix + checksum + removeHexPrefix(val);\n}\nexport { getAddress, getIcapAddress, calculateCheckSum, networkIdToPrefix, getContractAddress, };\n//# sourceMappingURL=index.js.map","/**\n * An **HMAC** enables verification that a given key was used\n * to authenticate a payload.\n *\n * See: [[link-wiki-hmac]]\n *\n * @_subsection: api/crypto:HMAC [about-hmac]\n */\nimport { createHmac } from \"./crypto.js\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _computeHmac = function (algorithm, key, data) {\n return createHmac(algorithm, key).update(data).digest();\n};\nlet __computeHmac = _computeHmac;\n/**\n * Return the HMAC for %%data%% using the %%key%% key with the underlying\n * %%algo%% used for compression.\n *\n * @example:\n * key = id(\"some-secret\")\n *\n * // Compute the HMAC\n * computeHmac(\"sha256\", key, \"0x1337\")\n * //_result:\n *\n * // To compute the HMAC of UTF-8 data, the data must be\n * // converted to UTF-8 bytes\n * computeHmac(\"sha256\", key, toUtf8Bytes(\"Hello World\"))\n * //_result:\n *\n */\nexport function computeHmac(algorithm, _key, _data) {\n const key = getBytes(_key, \"key\");\n const data = getBytes(_data, \"data\");\n return hexlify(__computeHmac(algorithm, key, data));\n}\ncomputeHmac._ = _computeHmac;\ncomputeHmac.lock = function () {\n locked = true;\n};\ncomputeHmac.register = function (func) {\n if (locked) {\n throw new Error(\"computeHmac is locked\");\n }\n __computeHmac = func;\n};\nObject.freeze(computeHmac);\n//# sourceMappingURL=hmac.js.map","import { SHA2 } from './_sha2.js';\nimport { wrapConstructor } from './utils.js';\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf\nconst Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);\nconst Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i);\nconst Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);\nlet idxL = [Id];\nlet idxR = [Pi];\nfor (let i = 0; i < 4; i++)\n for (let j of [idxL, idxR])\n j.push(j[i].map((k) => Rho[k]));\nconst shifts = /* @__PURE__ */ [\n [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],\n [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],\n [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],\n [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],\n [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5],\n].map((i) => new Uint8Array(i));\nconst shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst Kl = /* @__PURE__ */ new Uint32Array([\n 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e,\n]);\nconst Kr = /* @__PURE__ */ new Uint32Array([\n 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000,\n]);\n// The rotate left (circular left shift) operation for uint32\nconst rotl = (word, shift) => (word << shift) | (word >>> (32 - shift));\n// It's called f() in spec.\nfunction f(group, x, y, z) {\n if (group === 0)\n return x ^ y ^ z;\n else if (group === 1)\n return (x & y) | (~x & z);\n else if (group === 2)\n return (x | ~y) ^ z;\n else if (group === 3)\n return (x & z) | (y & ~z);\n else\n return x ^ (y | ~z);\n}\n// Temporary buffer, not used to store anything between runs\nconst BUF = /* @__PURE__ */ new Uint32Array(16);\nexport class RIPEMD160 extends SHA2 {\n constructor() {\n super(64, 20, 8, true);\n this.h0 = 0x67452301 | 0;\n this.h1 = 0xefcdab89 | 0;\n this.h2 = 0x98badcfe | 0;\n this.h3 = 0x10325476 | 0;\n this.h4 = 0xc3d2e1f0 | 0;\n }\n get() {\n const { h0, h1, h2, h3, h4 } = this;\n return [h0, h1, h2, h3, h4];\n }\n set(h0, h1, h2, h3, h4) {\n this.h0 = h0 | 0;\n this.h1 = h1 | 0;\n this.h2 = h2 | 0;\n this.h3 = h3 | 0;\n this.h4 = h4 | 0;\n }\n process(view, offset) {\n for (let i = 0; i < 16; i++, offset += 4)\n BUF[i] = view.getUint32(offset, true);\n // prettier-ignore\n let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;\n // Instead of iterating 0 to 80, we split it into 5 groups\n // And use the groups in constants, functions, etc. Much simpler\n for (let group = 0; group < 5; group++) {\n const rGroup = 4 - group;\n const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore\n const rl = idxL[group], rr = idxR[group]; // prettier-ignore\n const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore\n for (let i = 0; i < 16; i++) {\n const tl = (rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0;\n al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore\n }\n // 2 loops are 10% faster\n for (let i = 0; i < 16; i++) {\n const tr = (rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0;\n ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore\n }\n }\n // Add the compressed chunk to the current hash value\n this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0);\n }\n roundClean() {\n BUF.fill(0);\n }\n destroy() {\n this.destroyed = true;\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0);\n }\n}\n/**\n * RIPEMD-160 - a hash function from 1990s.\n * @param message - msg that would be hashed\n */\nexport const ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());\n//# sourceMappingURL=ripemd160.js.map","import { ripemd160 as noble_ripemd160 } from \"@noble/hashes/ripemd160\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _ripemd160 = function (data) {\n return noble_ripemd160(data);\n};\nlet __ripemd160 = _ripemd160;\n/**\n * Compute the cryptographic RIPEMD-160 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * ripemd160(\"0x\")\n * //_result:\n *\n * ripemd160(\"0x1337\")\n * //_result:\n *\n * ripemd160(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n */\nexport function ripemd160(_data) {\n const data = getBytes(_data, \"data\");\n return hexlify(__ripemd160(data));\n}\nripemd160._ = _ripemd160;\nripemd160.lock = function () {\n locked = true;\n};\nripemd160.register = function (func) {\n if (locked) {\n throw new TypeError(\"ripemd160 is locked\");\n }\n __ripemd160 = func;\n};\nObject.freeze(ripemd160);\n//# sourceMappingURL=ripemd160.js.map","/**\n * A **Password-Based Key-Derivation Function** is designed to create\n * a sequence of bytes suitible as a **key** from a human-rememberable\n * password.\n *\n * @_subsection: api/crypto:Passwords [about-pbkdf]\n */\nimport { pbkdf2Sync } from \"./crypto.js\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _pbkdf2 = function (password, salt, iterations, keylen, algo) {\n return pbkdf2Sync(password, salt, iterations, keylen, algo);\n};\nlet __pbkdf2 = _pbkdf2;\n/**\n * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using\n * the %%salt%% and using %%iterations%% of %%algo%%.\n *\n * This PBKDF is outdated and should not be used in new projects, but is\n * required to decrypt older files.\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the PBKDF2\n * pbkdf2(passwordBytes, salt, 1024, 16, \"sha256\")\n * //_result:\n */\nexport function pbkdf2(_password, _salt, iterations, keylen, algo) {\n const password = getBytes(_password, \"password\");\n const salt = getBytes(_salt, \"salt\");\n return hexlify(__pbkdf2(password, salt, iterations, keylen, algo));\n}\npbkdf2._ = _pbkdf2;\npbkdf2.lock = function () {\n locked = true;\n};\npbkdf2.register = function (func) {\n if (locked) {\n throw new Error(\"pbkdf2 is locked\");\n }\n __pbkdf2 = func;\n};\nObject.freeze(pbkdf2);\n//# sourceMappingURL=pbkdf2.js.map","/**\n * A **Cryptographically Secure Random Value** is one that has been\n * generated with additional care take to prevent side-channels\n * from allowing others to detect it and prevent others from through\n * coincidence generate the same values.\n *\n * @_subsection: api/crypto:Random Values [about-crypto-random]\n */\nimport { randomBytes as crypto_random } from \"./crypto.js\";\nlet locked = false;\nconst _randomBytes = function (length) {\n return new Uint8Array(crypto_random(length));\n};\nlet __randomBytes = _randomBytes;\n/**\n * Return %%length%% bytes of cryptographically secure random data.\n *\n * @example:\n * randomBytes(8)\n * //_result:\n */\nexport function randomBytes(length) {\n return __randomBytes(length);\n}\nrandomBytes._ = _randomBytes;\nrandomBytes.lock = function () {\n locked = true;\n};\nrandomBytes.register = function (func) {\n if (locked) {\n throw new Error(\"randomBytes is locked\");\n }\n __randomBytes = func;\n};\nObject.freeze(randomBytes);\n//# sourceMappingURL=random.js.map","import { number as assertNumber } from './_assert.js';\nimport { sha256 } from './sha256.js';\nimport { pbkdf2 } from './pbkdf2.js';\nimport { asyncLoop, checkOpts, u32 } from './utils.js';\n// RFC 7914 Scrypt KDF\n// Left rotate for uint32\nconst rotl = (a, b) => (a << b) | (a >>> (32 - b));\n// The main Scrypt loop: uses Salsa extensively.\n// Six versions of the function were tried, this is the fastest one.\n// prettier-ignore\nfunction XorAndSalsa(prev, pi, input, ii, out, oi) {\n // Based on https://cr.yp.to/salsa20.html\n // Xor blocks\n let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++];\n let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++];\n let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++];\n let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++];\n let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++];\n let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++];\n let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++];\n let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++];\n // Save state to temporary variables (salsa)\n let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15;\n // Main loop (salsa)\n for (let i = 0; i < 8; i += 2) {\n x04 ^= rotl(x00 + x12 | 0, 7);\n x08 ^= rotl(x04 + x00 | 0, 9);\n x12 ^= rotl(x08 + x04 | 0, 13);\n x00 ^= rotl(x12 + x08 | 0, 18);\n x09 ^= rotl(x05 + x01 | 0, 7);\n x13 ^= rotl(x09 + x05 | 0, 9);\n x01 ^= rotl(x13 + x09 | 0, 13);\n x05 ^= rotl(x01 + x13 | 0, 18);\n x14 ^= rotl(x10 + x06 | 0, 7);\n x02 ^= rotl(x14 + x10 | 0, 9);\n x06 ^= rotl(x02 + x14 | 0, 13);\n x10 ^= rotl(x06 + x02 | 0, 18);\n x03 ^= rotl(x15 + x11 | 0, 7);\n x07 ^= rotl(x03 + x15 | 0, 9);\n x11 ^= rotl(x07 + x03 | 0, 13);\n x15 ^= rotl(x11 + x07 | 0, 18);\n x01 ^= rotl(x00 + x03 | 0, 7);\n x02 ^= rotl(x01 + x00 | 0, 9);\n x03 ^= rotl(x02 + x01 | 0, 13);\n x00 ^= rotl(x03 + x02 | 0, 18);\n x06 ^= rotl(x05 + x04 | 0, 7);\n x07 ^= rotl(x06 + x05 | 0, 9);\n x04 ^= rotl(x07 + x06 | 0, 13);\n x05 ^= rotl(x04 + x07 | 0, 18);\n x11 ^= rotl(x10 + x09 | 0, 7);\n x08 ^= rotl(x11 + x10 | 0, 9);\n x09 ^= rotl(x08 + x11 | 0, 13);\n x10 ^= rotl(x09 + x08 | 0, 18);\n x12 ^= rotl(x15 + x14 | 0, 7);\n x13 ^= rotl(x12 + x15 | 0, 9);\n x14 ^= rotl(x13 + x12 | 0, 13);\n x15 ^= rotl(x14 + x13 | 0, 18);\n }\n // Write output (salsa)\n out[oi++] = (y00 + x00) | 0;\n out[oi++] = (y01 + x01) | 0;\n out[oi++] = (y02 + x02) | 0;\n out[oi++] = (y03 + x03) | 0;\n out[oi++] = (y04 + x04) | 0;\n out[oi++] = (y05 + x05) | 0;\n out[oi++] = (y06 + x06) | 0;\n out[oi++] = (y07 + x07) | 0;\n out[oi++] = (y08 + x08) | 0;\n out[oi++] = (y09 + x09) | 0;\n out[oi++] = (y10 + x10) | 0;\n out[oi++] = (y11 + x11) | 0;\n out[oi++] = (y12 + x12) | 0;\n out[oi++] = (y13 + x13) | 0;\n out[oi++] = (y14 + x14) | 0;\n out[oi++] = (y15 + x15) | 0;\n}\nfunction BlockMix(input, ii, out, oi, r) {\n // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks)\n let head = oi + 0;\n let tail = oi + 16 * r;\n for (let i = 0; i < 16; i++)\n out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1]\n for (let i = 0; i < r; i++, head += 16, ii += 16) {\n // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1\n XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1])\n if (i > 0)\n tail += 16; // First iteration overwrites tmp value in tail\n XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i])\n }\n}\n// Common prologue and epilogue for sync/async functions\nfunction scryptInit(password, salt, _opts) {\n // Maxmem - 1GB+1KB by default\n const opts = checkOpts({\n dkLen: 32,\n asyncTick: 10,\n maxmem: 1024 ** 3 + 1024,\n }, _opts);\n const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts;\n assertNumber(N);\n assertNumber(r);\n assertNumber(p);\n assertNumber(dkLen);\n assertNumber(asyncTick);\n assertNumber(maxmem);\n if (onProgress !== undefined && typeof onProgress !== 'function')\n throw new Error('progressCb should be function');\n const blockSize = 128 * r;\n const blockSize32 = blockSize / 4;\n if (N <= 1 || (N & (N - 1)) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) {\n // NOTE: we limit N to be less than 2**32 because of 32 bit variant of Integrify function\n // There is no JS engines that allows alocate more than 4GB per single Uint8Array for now, but can change in future.\n throw new Error('Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32');\n }\n if (p < 0 || p > ((2 ** 32 - 1) * 32) / blockSize) {\n throw new Error('Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)');\n }\n if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) {\n throw new Error('Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32');\n }\n const memUsed = blockSize * (N + p);\n if (memUsed > maxmem) {\n throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`);\n }\n // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor)\n // Since it has only one iteration there is no reason to use async variant\n const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p });\n const B32 = u32(B);\n // Re-used between parallel iterations. Array(iterations) of B\n const V = u32(new Uint8Array(blockSize * N));\n const tmp = u32(new Uint8Array(blockSize));\n let blockMixCb = () => { };\n if (onProgress) {\n const totalBlockMix = 2 * N * p;\n // Invoke callback if progress changes from 10.01 to 10.02\n // Allows to draw smooth progress bar on up to 8K screen\n const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1);\n let blockMixCnt = 0;\n blockMixCb = () => {\n blockMixCnt++;\n if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix))\n onProgress(blockMixCnt / totalBlockMix);\n };\n }\n return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick };\n}\nfunction scryptOutput(password, dkLen, B, V, tmp) {\n const res = pbkdf2(sha256, password, B, { c: 1, dkLen });\n B.fill(0);\n V.fill(0);\n tmp.fill(0);\n return res;\n}\n/**\n * Scrypt KDF from RFC 7914.\n * @param password - pass\n * @param salt - salt\n * @param opts - parameters\n * - `N` is cpu/mem work factor (power of 2 e.g. 2**18)\n * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance\n * - `p` is parallelization factor (1 is common)\n * - `dkLen` is output key length in bytes e.g. 32.\n * - `asyncTick` - (default: 10) max time in ms for which async function can block execution\n * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt\n * - `onProgress` - callback function that would be executed for progress report\n * @returns Derived key\n */\nexport function scrypt(password, salt, opts) {\n const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts);\n for (let pi = 0; pi < p; pi++) {\n const Pi = blockSize32 * pi;\n for (let i = 0; i < blockSize32; i++)\n V[i] = B32[Pi + i]; // V[0] = B[i]\n for (let i = 0, pos = 0; i < N - 1; i++) {\n BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);\n blockMixCb();\n }\n BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element\n blockMixCb();\n for (let i = 0; i < N; i++) {\n // First u32 of the last 64-byte block (u32 is LE)\n const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations\n for (let k = 0; k < blockSize32; k++)\n tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]\n BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])\n blockMixCb();\n }\n }\n return scryptOutput(password, dkLen, B, V, tmp);\n}\n/**\n * Scrypt KDF from RFC 7914.\n */\nexport async function scryptAsync(password, salt, opts) {\n const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts);\n for (let pi = 0; pi < p; pi++) {\n const Pi = blockSize32 * pi;\n for (let i = 0; i < blockSize32; i++)\n V[i] = B32[Pi + i]; // V[0] = B[i]\n let pos = 0;\n await asyncLoop(N - 1, asyncTick, () => {\n BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);\n blockMixCb();\n });\n BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element\n blockMixCb();\n await asyncLoop(N, asyncTick, () => {\n // First u32 of the last 64-byte block (u32 is LE)\n const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations\n for (let k = 0; k < blockSize32; k++)\n tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]\n BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])\n blockMixCb();\n });\n }\n return scryptOutput(password, dkLen, B, V, tmp);\n}\n//# sourceMappingURL=scrypt.js.map","import { scrypt as _nobleSync, scryptAsync as _nobleAsync, } from \"@noble/hashes/scrypt\";\nimport { getBytes, hexlify as H } from \"../utils/index.js\";\nlet lockedSync = false, lockedAsync = false;\nconst _scryptAsync = async function (passwd, salt, N, r, p, dkLen, onProgress) {\n return await _nobleAsync(passwd, salt, { N, r, p, dkLen, onProgress });\n};\nconst _scryptSync = function (passwd, salt, N, r, p, dkLen) {\n return _nobleSync(passwd, salt, { N, r, p, dkLen });\n};\nlet __scryptAsync = _scryptAsync;\nlet __scryptSync = _scryptSync;\n/**\n * The [[link-wiki-scrypt]] uses a memory and cpu hard method of\n * derivation to increase the resource cost to brute-force a password\n * for a given key.\n *\n * This means this algorithm is intentionally slow, and can be tuned to\n * become slower. As computation and memory speed improve over time,\n * increasing the difficulty maintains the cost of an attacker.\n *\n * For example, if a target time of 5 seconds is used, a legitimate user\n * which knows their password requires only 5 seconds to unlock their\n * account. A 6 character password has 68 billion possibilities, which\n * would require an attacker to invest over 10,000 years of CPU time. This\n * is of course a crude example (as password generally aren't random),\n * but demonstrates to value of imposing large costs to decryption.\n *\n * For this reason, if building a UI which involved decrypting or\n * encrypting datsa using scrypt, it is recommended to use a\n * [[ProgressCallback]] (as event short periods can seem lik an eternity\n * if the UI freezes). Including the phrase //\"decrypting\"// in the UI\n * can also help, assuring the user their waiting is for a good reason.\n *\n * @_docloc: api/crypto:Passwords\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the scrypt\n * scrypt(passwordBytes, salt, 1024, 8, 1, 16)\n * //_result:\n */\nexport async function scrypt(_passwd, _salt, N, r, p, dkLen, progress) {\n const passwd = getBytes(_passwd, \"passwd\");\n const salt = getBytes(_salt, \"salt\");\n return H(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress));\n}\nscrypt._ = _scryptAsync;\nscrypt.lock = function () {\n lockedAsync = true;\n};\nscrypt.register = function (func) {\n if (lockedAsync) {\n throw new Error(\"scrypt is locked\");\n }\n __scryptAsync = func;\n};\nObject.freeze(scrypt);\n/**\n * Provides a synchronous variant of [[scrypt]].\n *\n * This will completely lock up and freeze the UI in a browser and will\n * prevent any event loop from progressing. For this reason, it is\n * preferred to use the [async variant](scrypt).\n *\n * @_docloc: api/crypto:Passwords\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the scrypt\n * scryptSync(passwordBytes, salt, 1024, 8, 1, 16)\n * //_result:\n */\nexport function scryptSync(_passwd, _salt, N, r, p, dkLen) {\n const passwd = getBytes(_passwd, \"passwd\");\n const salt = getBytes(_salt, \"salt\");\n return H(__scryptSync(passwd, salt, N, r, p, dkLen));\n}\nscryptSync._ = _scryptSync;\nscryptSync.lock = function () {\n lockedSync = true;\n};\nscryptSync.register = function (func) {\n if (lockedSync) {\n throw new Error(\"scryptSync is locked\");\n }\n __scryptSync = func;\n};\nObject.freeze(scryptSync);\n//# sourceMappingURL=scrypt.js.map","/**\n * Cryptographic hashing functions\n *\n * @_subsection: api/crypto:Hash Functions [about-crypto-hashing]\n */\nimport { keccak_256 } from \"@noble/hashes/sha3\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _keccak256 = function (data) {\n return keccak_256(data);\n};\nlet __keccak256 = _keccak256;\n/**\n * Compute the cryptographic KECCAK256 hash of %%data%%.\n *\n * The %%data%% **must** be a data representation, to compute the\n * hash of UTF-8 data use the [[id]] function.\n *\n * @returns DataHexstring\n * @example:\n * keccak256(\"0x\")\n * //_result:\n *\n * keccak256(\"0x1337\")\n * //_result:\n *\n * keccak256(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n * // Strings are assumed to be DataHexString, otherwise it will\n * // throw. To hash UTF-8 data, see the note above.\n * keccak256(\"Hello World\")\n * //_error:\n */\nexport function keccak256(_data) {\n const data = getBytes(_data, \"data\");\n return hexlify(__keccak256(data));\n}\nkeccak256._ = _keccak256;\nkeccak256.lock = function () {\n locked = true;\n};\nkeccak256.register = function (func) {\n if (locked) {\n throw new TypeError(\"keccak256 is locked\");\n }\n __keccak256 = func;\n};\nObject.freeze(keccak256);\n//# sourceMappingURL=keccak.js.map","/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */\nconst B256 = 2n ** 256n; // secp256k1 is short weierstrass curve\nconst P = B256 - 0x1000003d1n; // curve's field prime\nconst N = B256 - 0x14551231950b75fc4402da1732fc9bebfn; // curve (group) order\nconst Gx = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n; // base point x\nconst Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n; // base point y\nconst CURVE = { p: P, n: N, a: 0n, b: 7n, Gx, Gy }; // exported variables incl. a, b\nconst fLen = 32; // field / group byte length\nconst crv = (x) => mod(mod(x * x) * x + CURVE.b); // x³ + ax + b weierstrass formula; no a\nconst err = (m = '') => { throw new Error(m); }; // error helper, messes-up stack trace\nconst big = (n) => typeof n === 'bigint'; // is big integer\nconst str = (s) => typeof s === 'string'; // is string\nconst fe = (n) => big(n) && 0n < n && n < P; // is field element (invertible)\nconst ge = (n) => big(n) && 0n < n && n < N; // is group element\nconst au8 = (a, l) => // is Uint8Array (of specific length)\n !(a instanceof Uint8Array) || (typeof l === 'number' && l > 0 && a.length !== l) ?\n err('Uint8Array expected') : a;\nconst u8n = (data) => new Uint8Array(data); // creates Uint8Array\nconst toU8 = (a, len) => au8(str(a) ? h2b(a) : u8n(a), len); // norm(hex/u8a) to u8a\nconst mod = (a, b = P) => { let r = a % b; return r >= 0n ? r : b + r; }; // mod division\nconst isPoint = (p) => (p instanceof Point ? p : err('Point expected')); // is 3d point\nlet Gpows = undefined; // precomputes for base point G\nclass Point {\n constructor(px, py, pz) {\n this.px = px;\n this.py = py;\n this.pz = pz;\n } //3d=less inversions\n static fromAffine(p) { return new Point(p.x, p.y, 1n); }\n static fromHex(hex) {\n hex = toU8(hex); // convert hex string to Uint8Array\n let p = undefined;\n const head = hex[0], tail = hex.subarray(1); // first byte is prefix, rest is data\n const x = slcNum(tail, 0, fLen), len = hex.length; // next 32 bytes are x coordinate\n if (len === 33 && [0x02, 0x03].includes(head)) { // compressed points: 33b, start\n if (!fe(x))\n err('Point hex invalid: x not FE'); // with byte 0x02 or 0x03. Check if 0 0n; d = d.double(), n >>= 1n) { // double-and-add ladder\n if (n & 1n)\n p = p.add(d); // if bit is present, add to point\n else if (safe)\n f = f.add(d); // if not, add to fake for timing safety\n }\n return p;\n }\n mulAddQUns(R, u1, u2) {\n return this.mul(u1, false).add(R.mul(u2, false)).ok(); // Unsafe: do NOT use for stuff related\n } // to private keys. Doesn't use Shamir trick\n toAffine() {\n const { px: x, py: y, pz: z } = this; // (x, y, z) ∋ (x=x/z, y=y/z)\n if (this.equals(I))\n return { x: 0n, y: 0n }; // fast-path for zero point\n if (z === 1n)\n return { x, y }; // if z is 1, pass affine coordinates as-is\n const iz = inv(z); // z^-1: invert z\n if (mod(z * iz) !== 1n)\n err('invalid inverse'); // (z * z^-1) must be 1, otherwise bad math\n return { x: mod(x * iz), y: mod(y * iz) }; // x = x*z^-1; y = y*z^-1\n }\n assertValidity() {\n const { x, y } = this.aff(); // convert to 2d xy affine point.\n if (!fe(x) || !fe(y))\n err('Point invalid: x or y'); // x and y must be in range 0 < n < P\n return mod(y * y) === crv(x) ? // y² = x³ + ax + b, must be equal\n this : err('Point invalid: not on curve');\n }\n multiply(n) { return this.mul(n); } // Aliases to compress code\n aff() { return this.toAffine(); }\n ok() { return this.assertValidity(); }\n toHex(isCompressed = true) {\n const { x, y } = this.aff(); // convert to 2d xy affine point\n const head = isCompressed ? ((y & 1n) === 0n ? '02' : '03') : '04'; // 0x02, 0x03, 0x04 prefix\n return head + n2h(x) + (isCompressed ? '' : n2h(y)); // prefix||x and ||y\n }\n toRawBytes(isCompressed = true) {\n return h2b(this.toHex(isCompressed)); // re-use toHex(), convert hex to bytes\n }\n}\nPoint.BASE = new Point(Gx, Gy, 1n); // Generator / base point\nPoint.ZERO = new Point(0n, 1n, 0n); // Identity / zero point\nconst { BASE: G, ZERO: I } = Point; // Generator, identity points\nconst padh = (n, pad) => n.toString(16).padStart(pad, '0');\nconst b2h = (b) => Array.from(b).map(e => padh(e, 2)).join(''); // bytes to hex\nconst h2b = (hex) => {\n const l = hex.length; // error if not string,\n if (!str(hex) || l % 2)\n err('hex invalid 1'); // or has odd length like 3, 5.\n const arr = u8n(l / 2); // create result array\n for (let i = 0; i < arr.length; i++) {\n const j = i * 2;\n const h = hex.slice(j, j + 2); // hexByte. slice is faster than substr\n const b = Number.parseInt(h, 16); // byte, created from string part\n if (Number.isNaN(b) || b < 0)\n err('hex invalid 2'); // byte must be valid 0 <= byte < 256\n arr[i] = b;\n }\n return arr;\n};\nconst b2n = (b) => BigInt('0x' + (b2h(b) || '0')); // bytes to number\nconst slcNum = (b, from, to) => b2n(b.slice(from, to)); // slice bytes num\nconst n2b = (num) => {\n return big(num) && num >= 0n && num < B256 ? h2b(padh(num, 2 * fLen)) : err('bigint expected');\n};\nconst n2h = (num) => b2h(n2b(num)); // number to 32b hex\nconst concatB = (...arrs) => {\n const r = u8n(arrs.reduce((sum, a) => sum + au8(a).length, 0)); // create u8a of summed length\n let pad = 0; // walk through each array,\n arrs.forEach(a => { r.set(a, pad); pad += a.length; }); // ensure they have proper type\n return r;\n};\nconst inv = (num, md = P) => {\n if (num === 0n || md <= 0n)\n err('no inverse n=' + num + ' mod=' + md); // no neg exponent for now\n let a = mod(num, md), b = md, x = 0n, y = 1n, u = 1n, v = 0n;\n while (a !== 0n) { // uses euclidean gcd algorithm\n const q = b / a, r = b % a; // not constant-time\n const m = x - u * q, n = y - v * q;\n b = a, a = r, x = u, y = v, u = m, v = n;\n }\n return b === 1n ? mod(x, md) : err('no inverse'); // b is gcd at this point\n};\nconst sqrt = (n) => {\n let r = 1n; // So, a special, fast case. Paper: \"Square Roots from 1;24,51,10 to Dan Shanks\".\n for (let num = n, e = (P + 1n) / 4n; e > 0n; e >>= 1n) { // powMod: modular exponentiation.\n if (e & 1n)\n r = (r * num) % P; // Uses exponentiation by squaring.\n num = (num * num) % P; // Not constant-time.\n }\n return mod(r * r) === n ? r : err('sqrt invalid'); // check if result is valid\n};\nconst toPriv = (p) => {\n if (!big(p))\n p = b2n(toU8(p, fLen)); // convert to bigint when bytes\n return ge(p) ? p : err('private key out of range'); // check if bigint is in range\n};\nconst moreThanHalfN = (n) => n > (N >> 1n); // if a number is bigger than CURVE.n/2\nfunction getPublicKey(privKey, isCompressed = true) {\n return Point.fromPrivateKey(privKey).toRawBytes(isCompressed); // 33b or 65b output\n}\nclass Signature {\n constructor(r, s, recovery) {\n this.r = r;\n this.s = s;\n this.recovery = recovery;\n this.assertValidity(); // recovery bit is optional when\n } // constructed outside.\n static fromCompact(hex) {\n hex = toU8(hex, 64); // compact repr is (32b r)||(32b s)\n return new Signature(slcNum(hex, 0, fLen), slcNum(hex, fLen, 2 * fLen));\n }\n assertValidity() { return ge(this.r) && ge(this.s) ? this : err(); } // 0 < r or s < CURVE.n\n addRecoveryBit(rec) { return new Signature(this.r, this.s, rec); }\n hasHighS() { return moreThanHalfN(this.s); }\n recoverPublicKey(msgh) {\n const { r, s, recovery: rec } = this; // secg.org/sec1-v2.pdf 4.1.6\n if (![0, 1, 2, 3].includes(rec))\n err('recovery id invalid'); // check recovery id\n const h = bits2int_modN(toU8(msgh, 32)); // Truncate hash\n const radj = rec === 2 || rec === 3 ? r + N : r; // If rec was 2 or 3, q.x is bigger than n\n if (radj >= P)\n err('q.x invalid'); // ensure q.x is still a field element\n const head = (rec & 1) === 0 ? '02' : '03'; // head is 0x02 or 0x03\n const R = Point.fromHex(head + n2h(radj)); // concat head + hex repr of r\n const ir = inv(radj, N); // r^-1\n const u1 = mod(-h * ir, N); // -hr^-1\n const u2 = mod(s * ir, N); // sr^-1\n return G.mulAddQUns(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1)\n }\n toCompactRawBytes() { return h2b(this.toCompactHex()); } // Uint8Array 64b compact repr\n toCompactHex() { return n2h(this.r) + n2h(this.s); } // hex 64b compact repr\n}\nconst bits2int = (bytes) => {\n const delta = bytes.length * 8 - 256; // RFC suggests optional truncating via bits2octets\n const num = b2n(bytes); // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which\n return delta > 0 ? num >> BigInt(delta) : num; // matches bits2int. bits2int can produce res>N.\n};\nconst bits2int_modN = (bytes) => {\n return mod(bits2int(bytes), N); // with 0: BAD for trunc as per RFC vectors\n};\nconst i2o = (num) => n2b(num); // int to octets\nconst cr = () => // We support: 1) browsers 2) node.js 19+ 3) deno, other envs with crypto\n typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;\nlet _hmacSync; // Can be redefined by use in utils; built-ins don't provide it\nconst optS = { lowS: true }; // opts for sign()\nconst optV = { lowS: true }; // standard opts for verify()\nfunction prepSig(msgh, priv, opts = optS) {\n if (['der', 'recovered', 'canonical'].some(k => k in opts)) // Ban legacy options\n err('sign() legacy options not supported');\n let { lowS } = opts; // generates low-s sigs by default\n if (lowS == null)\n lowS = true; // RFC6979 3.2: we skip step A\n const h1i = bits2int_modN(toU8(msgh)); // msg bigint\n const h1o = i2o(h1i); // msg octets\n const d = toPriv(priv); // validate private key, convert to bigint\n const seed = [i2o(d), h1o]; // Step D of RFC6979 3.2\n let ent = opts.extraEntropy; // RFC6979 3.6: additional k' (optional)\n if (ent) { // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k')\n if (ent === true)\n ent = etc.randomBytes(fLen); // if true, use CSPRNG to generate data\n const e = toU8(ent); // convert Hex|Bytes to Bytes\n if (e.length !== fLen)\n err(); // Expected 32 bytes of extra data\n seed.push(e);\n }\n const m = h1i; // convert msg to bigint\n const k2sig = (kBytes) => {\n const k = bits2int(kBytes); // RFC6979 method.\n if (!ge(k))\n return; // Check 0 < k < CURVE.n\n const ik = inv(k, N); // k^-1 mod n, NOT mod P\n const q = G.mul(k).aff(); // q = Gk\n const r = mod(q.x, N); // r = q.x mod n\n if (r === 0n)\n return; // r=0 invalid\n const s = mod(ik * mod(m + mod(d * r, N), N), N); // s = k^-1(m + rd) mod n\n if (s === 0n)\n return; // s=0 invalid\n let normS = s; // normalized S\n let rec = (q.x === r ? 0 : 2) | Number(q.y & 1n); // recovery bit\n if (lowS && moreThanHalfN(s)) { // if lowS was passed, ensure s is always\n normS = mod(-s, N); // in the bottom half of CURVE.n\n rec ^= 1;\n }\n return new Signature(r, normS, rec); // use normS, not s\n };\n return { seed: concatB(...seed), k2sig };\n}\nfunction hmacDrbg(asynchronous) {\n let v = u8n(fLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n let k = u8n(fLen); // Steps B, C of RFC6979 3.2: set hashLen, in our case always same\n let i = 0; // Iterations counter, will throw when over 1000\n const reset = () => { v.fill(1); k.fill(0); i = 0; };\n const _e = 'drbg: tried 1000 values';\n if (asynchronous) { // asynchronous=true\n const h = (...b) => etc.hmacSha256Async(k, v, ...b); // hmac(k)(v, ...values)\n const reseed = async (seed = u8n()) => {\n k = await h(u8n([0x00]), seed); // k = hmac(K || V || 0x00 || seed)\n v = await h(); // v = hmac(K || V)\n if (seed.length === 0)\n return;\n k = await h(u8n([0x01]), seed); // k = hmac(K || V || 0x01 || seed)\n v = await h(); // v = hmac(K || V)\n };\n const gen = async () => {\n if (i++ >= 1000)\n err(_e);\n v = await h(); // v = hmac(K || V)\n return v;\n };\n return async (seed, pred) => {\n reset(); // the returned fn, don't, it's: 1. slower (JIT). 2. unsafe (async race conditions)\n await reseed(seed); // Steps D-G\n let res = undefined; // Step H: grind until k is in [1..n-1]\n while (!(res = pred(await gen())))\n await reseed(); // test predicate until it returns ok\n reset();\n return res;\n };\n }\n else {\n const h = (...b) => {\n const f = _hmacSync;\n if (!f)\n err('etc.hmacSha256Sync not set');\n return f(k, v, ...b); // hmac(k)(v, ...values)\n };\n const reseed = (seed = u8n()) => {\n k = h(u8n([0x00]), seed); // k = hmac(k || v || 0x00 || seed)\n v = h(); // v = hmac(k || v)\n if (seed.length === 0)\n return;\n k = h(u8n([0x01]), seed); // k = hmac(k || v || 0x01 || seed)\n v = h(); // v = hmac(k || v)\n };\n const gen = () => {\n if (i++ >= 1000)\n err(_e);\n v = h(); // v = hmac(k || v)\n return v;\n };\n return (seed, pred) => {\n reset();\n reseed(seed); // Steps D-G\n let res = undefined; // Step H: grind until k is in [1..n-1]\n while (!(res = pred(gen())))\n reseed(); // test predicate until it returns ok\n reset();\n return res;\n };\n }\n}\n// ECDSA signature generation. via secg.org/sec1-v2.pdf 4.1.2 + RFC6979 deterministic k\nasync function signAsync(msgh, priv, opts = optS) {\n const { seed, k2sig } = prepSig(msgh, priv, opts); // Extract arguments for hmac-drbg\n return hmacDrbg(true)(seed, k2sig); // Re-run hmac-drbg until k2sig returns ok\n}\nfunction sign(msgh, priv, opts = optS) {\n const { seed, k2sig } = prepSig(msgh, priv, opts); // Extract arguments for hmac-drbg\n return hmacDrbg(false)(seed, k2sig); // Re-run hmac-drbg until k2sig returns ok\n}\nfunction verify(sig, msgh, pub, opts = optV) {\n let { lowS } = opts; // ECDSA signature verification\n if (lowS == null)\n lowS = true; // Default lowS=true\n if ('strict' in opts)\n err('verify() legacy options not supported'); // legacy param\n let sig_, h, P; // secg.org/sec1-v2.pdf 4.1.4\n const rs = sig && typeof sig === 'object' && 'r' in sig; // Previous ver supported DER sigs. We\n if (!rs && (toU8(sig).length !== 2 * fLen)) // throw error when DER is suspected now.\n err('signature must be 64 bytes');\n try {\n sig_ = rs ? new Signature(sig.r, sig.s).assertValidity() : Signature.fromCompact(sig);\n h = bits2int_modN(toU8(msgh, fLen)); // Truncate hash\n P = pub instanceof Point ? pub.ok() : Point.fromHex(pub); // Validate public key\n }\n catch (e) {\n return false;\n } // Check sig for validity in both cases\n if (!sig_)\n return false;\n const { r, s } = sig_;\n if (lowS && moreThanHalfN(s))\n return false; // lowS bans sig.s >= CURVE.n/2\n let R;\n try {\n const is = inv(s, N); // s^-1\n const u1 = mod(h * is, N); // u1 = hs^-1 mod n\n const u2 = mod(r * is, N); // u2 = rs^-1 mod n\n R = G.mulAddQUns(P, u1, u2).aff(); // R = u1⋅G + u2⋅P\n }\n catch (error) {\n return false;\n }\n if (!R)\n return false; // stop if R is identity / zero point\n const v = mod(R.x, N); // <== The weird ECDSA part. R.x must be in N's field, not P's\n return v === r; // mod(R.x, n) == r\n}\nfunction getSharedSecret(privA, pubB, isCompressed = true) {\n return Point.fromHex(pubB).mul(toPriv(privA)).toRawBytes(isCompressed); // ECDH\n}\nfunction hashToPrivateKey(hash) {\n hash = toU8(hash); // produces private keys with modulo bias\n const minLen = fLen + 8; // being neglible.\n if (hash.length < minLen || hash.length > 1024)\n err('expected proper params');\n const num = mod(b2n(hash), N - 1n) + 1n; // takes at least n+8 bytes\n return n2b(num);\n}\nconst etc = {\n hexToBytes: h2b, bytesToHex: b2h,\n concatBytes: concatB, bytesToNumberBE: b2n, numberToBytesBE: n2b,\n mod, invert: inv,\n hmacSha256Async: async (key, ...msgs) => {\n const crypto = cr(); // HMAC-SHA256 async. No sync built-in!\n if (!crypto)\n return err('etc.hmacSha256Async not set'); // Uses webcrypto: native cryptography.\n const s = crypto.subtle;\n const k = await s.importKey('raw', key, { name: 'HMAC', hash: { name: 'SHA-256' } }, false, ['sign']);\n return u8n(await s.sign('HMAC', k, concatB(...msgs)));\n },\n hmacSha256Sync: _hmacSync,\n hashToPrivateKey,\n randomBytes: (len) => {\n const crypto = cr(); // Can be shimmed in node.js <= 18 to prevent error:\n // import { webcrypto } from 'node:crypto';\n // if (!globalThis.crypto) globalThis.crypto = webcrypto;\n if (!crypto)\n err('crypto.getRandomValues must be defined');\n return crypto.getRandomValues(u8n(len));\n },\n};\nconst utils = {\n normPrivateKeyToScalar: toPriv,\n isValidPrivateKey: (key) => { try {\n return !!toPriv(key);\n }\n catch (e) {\n return false;\n } },\n randomPrivateKey: () => hashToPrivateKey(etc.randomBytes(fLen + 8)),\n precompute(w = 8, p = G) { p.multiply(3n); return p; }, // no-op\n};\nObject.defineProperties(etc, { hmacSha256Sync: {\n configurable: false, get() { return _hmacSync; }, set(f) { if (!_hmacSync)\n _hmacSync = f; },\n } });\nconst W = 8; // Precomputes-related code. W = window size\nconst precompute = () => {\n const points = []; // 10x sign(), 2x verify(). To achieve this,\n const windows = 256 / W + 1; // app needs to spend 40ms+ to calculate\n let p = G, b = p; // a lot of points related to base point G.\n for (let w = 0; w < windows; w++) { // Points are stored in array and used\n b = p; // any time Gx multiplication is done.\n points.push(b); // They consume 16-32 MiB of RAM.\n for (let i = 1; i < 2 ** (W - 1); i++) {\n b = b.add(p);\n points.push(b);\n }\n p = b.double(); // Precomputes don't speed-up getSharedKey,\n } // which multiplies user point by scalar,\n return points; // when precomputes are using base point\n};\nconst wNAF = (n) => {\n // Compared to other point mult methods,\n const comp = Gpows || (Gpows = precompute()); // stores 2x less points using subtraction\n const neg = (cnd, p) => { let n = p.negate(); return cnd ? n : p; }; // negate\n let p = I, f = G; // f must be G, or could become I in the end\n const windows = 1 + 256 / W; // W=8 17 windows\n const wsize = 2 ** (W - 1); // W=8 128 window size\n const mask = BigInt(2 ** W - 1); // W=8 will create mask 0b11111111\n const maxNum = 2 ** W; // W=8 256\n const shiftBy = BigInt(W); // W=8 8\n for (let w = 0; w < windows; w++) {\n const off = w * wsize;\n let wbits = Number(n & mask); // extract W bits.\n n >>= shiftBy; // shift number by W bits.\n if (wbits > wsize) {\n wbits -= maxNum;\n n += 1n;\n } // split if bits > max: +224 => 256-32\n const off1 = off, off2 = off + Math.abs(wbits) - 1; // offsets, evaluate both\n const cnd1 = w % 2 !== 0, cnd2 = wbits < 0; // conditions, evaluate both\n if (wbits === 0) {\n f = f.add(neg(cnd1, comp[off1])); // bits are 0: add garbage to fake point\n }\n else { // ^ can't add off2, off2 = I\n p = p.add(neg(cnd2, comp[off2])); // bits are 1: add to result point\n }\n }\n return { p, f }; // return both real and fake points for JIT\n}; // !! you can disable precomputes by commenting-out call of the wNAF() inside Point#mul()\nexport { getPublicKey, sign, signAsync, verify, CURVE, // Remove the export to easily use in REPL\ngetSharedSecret, etc, utils, Point as ProjectivePoint, Signature }; // envs like browser console\n","/**\n * Add details about signing here.\n *\n * @_subsection: api/crypto:Signing [about-signing]\n */\nimport * as secp256k1 from \"@noble/secp256k1\";\nimport { dataLength, getBytes, getBytesCopy, hexlify, assertArgument, } from \"../utils/index.js\";\nimport { arrayify, hexConcat } from \"../utils/data.js\";\nimport { Logger } from \"../logger/logger.js\";\nimport { ed448 } from \"./crypto.js\";\nimport { Buffer } from \"buffer\";\nconst logger = new Logger(\"signing-key/0.0.1\");\n//const N = BigInt(\"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\");\n// Make noble-secp256k1 sync\n/**\n * A **SigningKey** provides high-level access to the elliptic curve\n * cryptography (ECC) operations and key management.\n */\nexport class SigningKey {\n #privateKey;\n /**\n * Creates a new **SigningKey** for %%privateKey%%.\n */\n constructor(privateKey) {\n let tmp = privateKey;\n if (typeof tmp === \"string\" && tmp.startsWith(\"0x\")) {\n tmp = tmp.replace(\"0x\", \"\");\n }\n assertArgument(dataLength(\"0x\" + tmp) === 57, \"invalid private key\", \"privateKey\", \"[REDACTED]\");\n this.#privateKey = hexlify(\"0x\" + tmp);\n }\n /**\n * The private key.\n */\n get privateKey() {\n return this.#privateKey;\n }\n /**\n * The uncompressed public key.\n *\n * This will always begin with the prefix ``0x04`` and be 132\n * characters long (the ``0x`` prefix and 130 hexadecimal nibbles).\n */\n get publicKey() {\n return SigningKey.computePublicKey(this.#privateKey);\n }\n /**\n * The compressed public key.\n *\n * This will always begin with either the prefix ``0x02`` or ``0x03``\n * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal\n * nibbles)\n */\n get compressedPublicKey() {\n return SigningKey.computePublicKey(this.#privateKey, true);\n }\n /**\n * Return the signature of the signed %%digest%%.\n */\n sign(digest) {\n const key = getBytesCopy(this.#privateKey);\n assertArgument(dataLength(digest) === 32, \"invalid digest length\", \"digest\", digest);\n const keyBuffer = new Uint8Array(arrayify(key));\n if (keyBuffer.length !== 57) {\n logger.throwArgumentError(\"invalid private key\", \"key\", \"[REDACTED]\");\n }\n const digestBuffer = new Uint8Array(arrayify(digest));\n if (digestBuffer.length !== 32) {\n logger.throwArgumentError(\"bad digest length\", \"digest\", digest);\n }\n if (keyBuffer[56] > 127) {\n const prefix = keyBuffer.slice(0, 57);\n prefix[0] &= 0xfc;\n prefix[55] |= 0x80;\n prefix[56] = 0;\n const scalar = prefix.slice(0, 56);\n const bufferDigest = Buffer.from(digestBuffer);\n const bufferPrfx = Buffer.from(prefix);\n const bufferScalar = Buffer.from(scalar);\n const sig = ed448.signWithScalar(bufferDigest, bufferScalar, bufferPrfx);\n const hexlified = hexlify(sig);\n return hexConcat([hexlified, this.publicKey]);\n }\n const sig = ed448.sign(Buffer.from(digestBuffer), Buffer.from(keyBuffer));\n const hexlified = hexlify(sig);\n return hexConcat([hexlified, this.publicKey]);\n }\n /**\n * Returns the [[link-wiki-ecdh]] shared secret between this\n * private key and the %%other%% key.\n *\n * The %%other%% key may be any type of key, a raw public key,\n * a compressed/uncompressed pubic key or aprivate key.\n *\n * Best practice is usually to use a cryptographic hash on the\n * returned value before using it as a symetric secret.\n *\n * @example:\n * sign1 = new SigningKey(id(\"some-secret-1\"))\n * sign2 = new SigningKey(id(\"some-secret-2\"))\n *\n * // Notice that privA.computeSharedSecret(pubB)...\n * sign1.computeSharedSecret(sign2.publicKey)\n * //_result:\n *\n * // ...is equal to privB.computeSharedSecret(pubA).\n * sign2.computeSharedSecret(sign1.publicKey)\n * //_result:\n */\n computeSharedSecret(other) {\n const pubKey = SigningKey.computePublicKey(other);\n return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey)));\n }\n /**\n * Compute the public key for %%key%%, optionally %%compressed%%.\n *\n * The %%key%% may be any type of key, a raw public key, a\n * compressed/uncompressed public key or private key.\n *\n * @example:\n * sign = new SigningKey(id(\"some-secret\"));\n *\n * // Compute the uncompressed public key for a private key\n * SigningKey.computePublicKey(sign.privateKey)\n * //_result:\n *\n * // Compute the compressed public key for a private key\n * SigningKey.computePublicKey(sign.privateKey, true)\n * //_result:\n *\n * // Compute the uncompressed public key\n * SigningKey.computePublicKey(sign.publicKey, false);\n * //_result:\n *\n * // Compute the Compressed a public key\n * SigningKey.computePublicKey(sign.publicKey, true);\n * //_result:\n */\n static computePublicKey(key, compressed) {\n const bytes = Buffer.from(arrayify(key));\n if (bytes.length !== 57) {\n logger.throwArgumentError(\"invalid private key\", \"key\", \"[REDACTED]\");\n }\n if (bytes[56] > 127) {\n const scalar = bytes.slice(0, 56);\n scalar[0] &= 0xfc;\n scalar[55] |= 0x80;\n const pub = ed448.publicKeyFromScalar(scalar);\n return hexlify(pub);\n }\n const pub = ed448.publicKeyCreate(bytes);\n return hexlify(pub);\n }\n /**\n * Returns the public key for the private key which produced the\n * %%signature%% for the given %%digest%%.\n *\n * @example:\n * key = new SigningKey(id(\"some-secret\"))\n * digest = id(\"hello world\")\n * sig = key.sign(digest)\n *\n * // Notice the signer public key...\n * key.publicKey\n * //_result:\n *\n * // ...is equal to the recovered public key\n * SigningKey.recoverPublicKey(digest, sig)\n * //_result:\n *\n */\n static recoverPublicKey(digest, signature) {\n assertArgument(dataLength(digest) === 32, \"invalid digest length\", \"digest\", digest);\n const digestBuffer = Buffer.from(arrayify(digest));\n const sigBuffer = Buffer.from(arrayify(signature));\n if (sigBuffer.length !== 171) {\n logger.throwArgumentError(\"invalid signature\", \"signature\", signature);\n }\n const sig = sigBuffer.slice(0, 114);\n const pub = sigBuffer.slice(114);\n if (ed448.verify(digestBuffer, sig, pub)) {\n return hexlify(pub);\n }\n logger.throwArgumentError(\"invalid signature\", \"signature\", signature);\n return \"\";\n }\n /**\n * Returns the point resulting from adding the ellipic curve points\n * %%p0%% and %%p1%%.\n *\n * This is not a common function most developers should require, but\n * can be useful for certain privacy-specific techniques.\n *\n * For example, it is used by [[HDNodeWallet]] to compute child\n * addresses from parent public keys and chain codes.\n */\n static addPoints(p0, p1, compressed) {\n const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2));\n const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2));\n return \"0x\" + pub0.add(pub1).toHex(!!compressed);\n }\n}\n//# sourceMappingURL=signing-key.js.map","import { concat, dataLength, getBigInt, getBytes, getNumber, hexlify, assertArgument, assertPrivate, } from \"../utils/index.js\";\n// Constants\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_2 = BigInt(2);\nconst BN_27 = BigInt(27);\nconst BN_28 = BigInt(28);\nconst BN_35 = BigInt(35);\nconst _guard = {};\n/**\n * A Signature @TODO\n *\n *\n * @_docloc: api/crypto:Signing\n */\nexport class Signature {\n #r;\n #s;\n #v;\n #networkV;\n /**\n * The ``r`` value for a signautre.\n *\n * This represents the ``x`` coordinate of a \"reference\" or\n * challenge point, from which the ``y`` can be computed.\n */\n get r() {\n return this.#r;\n }\n set r(value) {\n assertArgument(dataLength(value) === 32, \"invalid r\", \"value\", value);\n this.#r = hexlify(value);\n }\n /**\n * The ``s`` value for a signature.\n */\n get s() {\n return this.#s;\n }\n set s(_value) {\n assertArgument(dataLength(_value) === 32, \"invalid s\", \"value\", _value);\n const value = hexlify(_value);\n assertArgument(parseInt(value.substring(0, 3)) < 8, \"non-canonical s\", \"value\", value);\n this.#s = value;\n }\n /**\n * The ``v`` value for a signature.\n *\n * Since a given ``x`` value for ``r`` has two possible values for\n * its correspondin ``y``, the ``v`` indicates which of the two ``y``\n * values to use.\n *\n * It is normalized to the values ``27`` or ``28`` for legacy\n * purposes.\n */\n get v() {\n return this.#v;\n }\n set v(value) {\n const v = getNumber(value, \"value\");\n assertArgument(v === 27 || v === 28, \"invalid v\", \"v\", value);\n this.#v = v;\n }\n /**\n * The EIP-155 ``v`` for legacy transactions. For non-legacy\n * transactions, this value is ``null``.\n */\n get networkV() {\n return this.#networkV;\n }\n /**\n * The chain ID for EIP-155 legacy transactions. For non-legacy\n * transactions, this value is ``null``.\n */\n get legacynetworkId() {\n const v = this.networkV;\n if (v == null) {\n return null;\n }\n return Signature.getnetworkId(v);\n }\n /**\n * The ``yParity`` for the signature.\n *\n * See ``v`` for more details on how this value is used.\n */\n get yParity() {\n return this.v === 27 ? 0 : 1;\n }\n /**\n * The [[link-eip-2098]] compact representation of the ``yParity``\n * and ``s`` compacted into a single ``bytes32``.\n */\n get yParityAndS() {\n // The EIP-2098 compact representation\n const yParityAndS = getBytes(this.s);\n if (this.yParity) {\n yParityAndS[0] |= 0x80;\n }\n return hexlify(yParityAndS);\n }\n /**\n * The [[link-eip-2098]] compact representation.\n */\n get compactSerialized() {\n return concat([this.r, this.yParityAndS]);\n }\n /**\n * The serialized representation.\n */\n get serialized() {\n return concat([this.r, this.s, this.yParity ? \"0x1c\" : \"0x1b\"]);\n }\n /**\n * @private\n */\n constructor(guard, r, s, v) {\n assertPrivate(guard, _guard, \"Signature\");\n this.#r = r;\n this.#s = s;\n this.#v = v;\n this.#networkV = null;\n }\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n return `Signature { r: \"${this.r}\", s: \"${this.s}\", yParity: ${this.yParity}, networkV: ${this.networkV} }`;\n }\n /**\n * Returns a new identical [[Signature]].\n */\n clone() {\n const clone = new Signature(_guard, this.r, this.s, this.v);\n if (this.networkV) {\n clone.#networkV = this.networkV;\n }\n return clone;\n }\n /**\n * Returns a representation that is compatible with ``JSON.stringify``.\n */\n toJSON() {\n const networkV = this.networkV;\n return {\n _type: \"signature\",\n networkV: networkV != null ? networkV.toString() : null,\n r: this.r,\n s: this.s,\n v: this.v,\n };\n }\n /**\n * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions.\n *\n * @example:\n * Signature.getnetworkId(45)\n * //_result:\n *\n * Signature.getnetworkId(46)\n * //_result:\n */\n static getnetworkId(v) {\n const bv = getBigInt(v, \"v\");\n // The v is not an EIP-155 v, so it is the unspecified chain ID\n if (bv == BN_27 || bv == BN_28) {\n return BN_0;\n }\n // Bad value for an EIP-155 v\n assertArgument(bv >= BN_35, \"invalid EIP-155 v\", \"v\", v);\n return (bv - BN_35) / BN_2;\n }\n /**\n * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.\n *\n * Legacy transactions which use [[link-eip-155]] hijack the ``v``\n * property to include the chain ID.\n *\n * @example:\n * Signature.getnetworkIdV(5, 27)\n * //_result:\n *\n * Signature.getnetworkIdV(5, 28)\n * //_result:\n *\n */\n static getnetworkIdV(networkId, v) {\n return getBigInt(networkId) * BN_2 + BigInt(35 + v - 27);\n }\n /**\n * Compute the normalized legacy transaction ``v`` from a ``yParirty``,\n * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.\n *\n * @example:\n * // The values 0 and 1 imply v is actually yParity\n * Signature.getNormalizedV(0)\n * //_result:\n *\n * // Legacy non-EIP-1559 transaction (i.e. 27 or 28)\n * Signature.getNormalizedV(27)\n * //_result:\n *\n * // Legacy EIP-155 transaction (i.e. >= 35)\n * Signature.getNormalizedV(46)\n * //_result:\n *\n * // Invalid values throw\n * Signature.getNormalizedV(5)\n * //_error:\n */\n static getNormalizedV(v) {\n const bv = getBigInt(v);\n if (bv === BN_0 || bv === BN_27) {\n return 27;\n }\n if (bv === BN_1 || bv === BN_28) {\n return 28;\n }\n assertArgument(bv >= BN_35, \"invalid v\", \"v\", v);\n // Otherwise, EIP-155 v means odd is 27 and even is 28\n return bv & BN_1 ? 27 : 28;\n }\n}\n//# sourceMappingURL=signature.js.map","/**\n * A fundamental building block of Core is the underlying\n * cryptographic primitives.\n *\n * @_section: api/crypto:Cryptographic Functions [about-crypto]\n */\nnull;\n// We import all these so we can export lock()\nimport { computeHmac } from \"./hmac.js\";\nimport { ripemd160 } from \"./ripemd160.js\";\nimport { pbkdf2 } from \"./pbkdf2.js\";\nimport { randomBytes } from \"./random.js\";\nimport { scrypt, scryptSync } from \"./scrypt.js\";\nimport { sha256, sha512 } from \"./sha3.js\";\nimport { Ed448Goldilock } from \"./crypto.js\";\nimport { keccak256 } from \"./keccak.js\";\nexport { computeHmac, randomBytes, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, keccak256, Ed448Goldilock, };\nexport { SigningKey } from \"./signing-key.js\";\nexport { Signature } from \"./signature.js\";\nfunction lock() {\n computeHmac.lock();\n pbkdf2.lock();\n randomBytes.lock();\n ripemd160.lock();\n scrypt.lock();\n scryptSync.lock();\n sha256.lock();\n sha512.lock();\n randomBytes.lock();\n}\nexport { lock };\n//# sourceMappingURL=index.js.map","import { getAddress } from \"../address/index.js\";\nimport { sha256, SigningKey } from \"../crypto/index.js\";\nimport { arrayify, hexDataSlice } from \"../utils/data.js\";\nimport { calculateCheckSum } from \"../address/index.js\";\n/**\n * Returns the address for the %%key%%.\n *\n * The key may be any standard form of public key or a private key.\n */\nexport function removeHexPrefix(val) {\n return val.substring(0, 2) === \"0x\" ? val.substring(2) : val;\n}\nexport function publicToAddress(key, prefix) {\n const val = hexDataSlice(sha256(key), 12);\n const checksum = calculateCheckSum(val, prefix);\n return \"0x\" + prefix + checksum + removeHexPrefix(val);\n}\nexport function computeAddress(key, prefix) {\n let pubkey;\n if (typeof key === \"string\") {\n pubkey = SigningKey.computePublicKey(key, false);\n }\n else {\n pubkey = key.publicKey;\n }\n return publicToAddress(pubkey, prefix); // getAddress(sha256(\"0x\" + pubkey.substring(4)).substring(26));\n}\n/**\n * Returns the recovered address for the private key that was\n * used to sign %%digest%% that resulted in %%signature%%.\n */\nexport function recoverAddress(digest, signature, prefix) {\n // return computeAddress(SigningKey.recoverPublicKey(digest, signature));\n const publicKey = SigningKey.recoverPublicKey(arrayify(digest), signature);\n return publicToAddress(publicKey, prefix);\n}\nexport function extractPrefix(address) {\n address = getAddress(address);\n return address.substring(2, 4);\n}\n//# sourceMappingURL=address.js.map","import { defineProperties, concat, getBytesCopy, getNumber, hexlify, toBeArray, toBigInt, toNumber, assert, assertArgument, } from \"../../utils/index.js\";\n/**\n * @_ignore:\n */\nexport const WordSize = 32;\nconst Padding = new Uint8Array(WordSize);\n// Properties used to immediate pass through to the underlying object\n// - `then` is used to detect if an object is a Promise for await\nconst passProperties = [\"then\"];\nconst _guard = {};\nfunction throwError(name, error) {\n const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`);\n wrapped.error = error;\n throw wrapped;\n}\n/**\n * A [[Result]] is a sub-class of Array, which allows accessing any\n * of its values either positionally by its index or, if keys are\n * provided by its name.\n *\n * @_docloc: api/abi\n */\nexport class Result extends Array {\n #names;\n /**\n * @private\n */\n constructor(...args) {\n // To properly sub-class Array so the other built-in\n // functions work, the constructor has to behave fairly\n // well. So, in the event we are created via fromItems()\n // we build the read-only Result object we want, but on\n // any other input, we use the default constructor\n // constructor(guard: any, items: Array, keys?: Array);\n const guard = args[0];\n let items = args[1];\n let names = (args[2] || []).slice();\n let wrap = true;\n if (guard !== _guard) {\n items = args;\n names = [];\n wrap = false;\n }\n // Can't just pass in ...items since an array of length 1\n // is a special case in the super.\n super(items.length);\n items.forEach((item, index) => {\n this[index] = item;\n });\n // Find all unique keys\n const nameCounts = names.reduce((accum, name) => {\n if (typeof name === \"string\") {\n accum.set(name, (accum.get(name) || 0) + 1);\n }\n return accum;\n }, new Map());\n // Remove any key thats not unique\n this.#names = Object.freeze(items.map((item, index) => {\n const name = names[index];\n if (name != null && nameCounts.get(name) === 1) {\n return name;\n }\n return null;\n }));\n if (!wrap) {\n return;\n }\n // A wrapped Result is immutable\n Object.freeze(this);\n // Proxy indices and names so we can trap deferred errors\n return new Proxy(this, {\n get: (target, prop, receiver) => {\n if (typeof prop === \"string\") {\n // Index accessor\n if (prop.match(/^[0-9]+$/)) {\n const index = getNumber(prop, \"%index\");\n if (index < 0 || index >= this.length) {\n throw new RangeError(\"out of result range\");\n }\n const item = target[index];\n if (item instanceof Error) {\n throwError(`index ${index}`, item);\n }\n return item;\n }\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n const value = target[prop];\n if (value instanceof Function) {\n // Make sure functions work with private variables\n // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding\n return function (...args) {\n return value.apply(this === receiver ? target : this, args);\n };\n }\n else if (!(prop in target)) {\n // Possible name accessor\n return target.getValue.apply(this === receiver ? target : this, [\n prop,\n ]);\n }\n }\n return Reflect.get(target, prop, receiver);\n },\n });\n }\n /**\n * Returns the Result as a normal Array.\n *\n * This will throw if there are any outstanding deferred\n * errors.\n */\n toArray() {\n const result = [];\n this.forEach((item, index) => {\n if (item instanceof Error) {\n throwError(`index ${index}`, item);\n }\n result.push(item);\n });\n return result;\n }\n /**\n * Returns the Result as an Object with each name-value pair.\n *\n * This will throw if any value is unnamed, or if there are\n * any outstanding deferred errors.\n */\n toObject() {\n return this.#names.reduce((accum, name, index) => {\n assert(name != null, \"value at index ${ index } unnamed\", \"UNSUPPORTED_OPERATION\", {\n operation: \"toObject()\",\n });\n // Add values for names that don't conflict\n if (!(name in accum)) {\n accum[name] = this.getValue(name);\n }\n return accum;\n }, {});\n }\n /**\n * @_ignore\n */\n slice(start, end) {\n if (start == null) {\n start = 0;\n }\n if (start < 0) {\n start += this.length;\n if (start < 0) {\n start = 0;\n }\n }\n if (end == null) {\n end = this.length;\n }\n if (end < 0) {\n end += this.length;\n if (end < 0) {\n end = 0;\n }\n }\n if (end > this.length) {\n end = this.length;\n }\n const result = [], names = [];\n for (let i = start; i < end; i++) {\n result.push(this[i]);\n names.push(this.#names[i]);\n }\n return new Result(_guard, result, names);\n }\n /**\n * @_ignore\n */\n filter(callback, thisArg) {\n const result = [], names = [];\n for (let i = 0; i < this.length; i++) {\n const item = this[i];\n if (item instanceof Error) {\n throwError(`index ${i}`, item);\n }\n if (callback.call(thisArg, item, i, this)) {\n result.push(item);\n names.push(this.#names[i]);\n }\n }\n return new Result(_guard, result, names);\n }\n /**\n * Returns the value for %%name%%.\n *\n * Since it is possible to have a key whose name conflicts with\n * a method on a [[Result]] or its superclass Array, or any\n * JavaScript keyword, this ensures all named values are still\n * accessible by name.\n */\n getValue(name) {\n const index = this.#names.indexOf(name);\n if (index === -1) {\n return undefined;\n }\n const value = this[index];\n if (value instanceof Error) {\n throwError(`property ${JSON.stringify(name)}`, value.error);\n }\n return value;\n }\n /**\n * Creates a new [[Result]] for %%items%% with each entry\n * also accessible by its corresponding name in %%keys%%.\n */\n static fromItems(items, keys) {\n return new Result(_guard, items, keys);\n }\n}\n/**\n * Returns all errors found in a [[Result]].\n *\n * Since certain errors encountered when creating a [[Result]] do\n * not impact the ability to continue parsing data, they are\n * deferred until they are actually accessed. Hence a faulty string\n * in an Event that is never used does not impact the program flow.\n *\n * However, sometimes it may be useful to access, identify or\n * validate correctness of a [[Result]].\n *\n * @_docloc api/abi\n */\nexport function checkResultErrors(result) {\n // Find the first error (if any)\n const errors = [];\n const checkErrors = function (path, object) {\n if (!Array.isArray(object)) {\n return;\n }\n for (let key in object) {\n const childPath = path.slice();\n childPath.push(key);\n try {\n checkErrors(childPath, object[key]);\n }\n catch (error) {\n errors.push({ path: childPath, error: error });\n }\n }\n };\n checkErrors([], result);\n return errors;\n}\nfunction getValue(value) {\n let bytes = toBeArray(value);\n assert(bytes.length <= WordSize, \"value out-of-bounds\", \"BUFFER_OVERRUN\", {\n buffer: bytes,\n length: WordSize,\n offset: bytes.length,\n });\n if (bytes.length !== WordSize) {\n bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes]));\n }\n return bytes;\n}\n/**\n * @_ignore\n */\nexport class Coder {\n // The coder name:\n // - address, uint256, tuple, array, etc.\n name;\n // The fully expanded type, including composite types:\n // - address, uint256, tuple(address,bytes), uint256[3][4][], etc.\n type;\n // The localName bound in the signature, in this example it is \"baz\":\n // - tuple(address foo, uint bar) baz\n localName;\n // Whether this type is dynamic:\n // - Dynamic: bytes, string, address[], tuple(boolean[]), etc.\n // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8)\n dynamic;\n constructor(name, type, localName, dynamic) {\n defineProperties(this, { name, type, localName, dynamic }, {\n name: \"string\",\n type: \"string\",\n localName: \"string\",\n dynamic: \"boolean\",\n });\n }\n _throwError(message, value) {\n assertArgument(false, message, this.localName, value);\n }\n}\n/**\n * @_ignore\n */\nexport class Writer {\n // An array of WordSize lengthed objects to concatenation\n #data;\n #dataLength;\n constructor() {\n this.#data = [];\n this.#dataLength = 0;\n }\n get data() {\n return concat(this.#data);\n }\n get length() {\n return this.#dataLength;\n }\n #writeData(data) {\n this.#data.push(data);\n this.#dataLength += data.length;\n return data.length;\n }\n appendWriter(writer) {\n return this.#writeData(getBytesCopy(writer.data));\n }\n // Arrayish item; pad on the right to *nearest* WordSize\n writeBytes(value) {\n let bytes = getBytesCopy(value);\n const paddingOffset = bytes.length % WordSize;\n if (paddingOffset) {\n bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)]));\n }\n return this.#writeData(bytes);\n }\n // Numeric item; pad on the left *to* WordSize\n writeValue(value) {\n return this.#writeData(getValue(value));\n }\n // Inserts a numeric place-holder, returning a callback that can\n // be used to asjust the value later\n writeUpdatableValue() {\n const offset = this.#data.length;\n this.#data.push(Padding);\n this.#dataLength += WordSize;\n return (value) => {\n this.#data[offset] = getValue(value);\n };\n }\n}\n/**\n * @_ignore\n */\nexport class Reader {\n // Allows incomplete unpadded data to be read; otherwise an error\n // is raised if attempting to overrun the buffer. This is required\n // to deal with an old Solidity bug, in which event data for\n // external (not public thoguh) was tightly packed.\n allowLoose;\n #data;\n #offset;\n constructor(data, allowLoose) {\n defineProperties(this, { allowLoose: !!allowLoose });\n this.#data = getBytesCopy(data);\n this.#offset = 0;\n }\n get data() {\n return hexlify(this.#data);\n }\n get dataLength() {\n return this.#data.length;\n }\n get consumed() {\n return this.#offset;\n }\n get bytes() {\n return new Uint8Array(this.#data);\n }\n #peekBytes(offset, length, loose) {\n let alignedLength = Math.ceil(length / WordSize) * WordSize;\n if (this.#offset + alignedLength > this.#data.length) {\n if (this.allowLoose &&\n loose &&\n this.#offset + length <= this.#data.length) {\n alignedLength = length;\n }\n else {\n assert(false, \"data out-of-bounds\", \"BUFFER_OVERRUN\", {\n buffer: getBytesCopy(this.#data),\n length: this.#data.length,\n offset: this.#offset + alignedLength,\n });\n }\n }\n return this.#data.slice(this.#offset, this.#offset + alignedLength);\n }\n // Create a sub-reader with the same underlying data, but offset\n subReader(offset) {\n return new Reader(this.#data.slice(this.#offset + offset), this.allowLoose);\n }\n // Read bytes\n readBytes(length, loose) {\n let bytes = this.#peekBytes(0, length, !!loose);\n this.#offset += bytes.length;\n // @TODO: Make sure the length..end bytes are all 0?\n return bytes.slice(0, length);\n }\n // Read a numeric values\n readValue() {\n return toBigInt(this.readBytes(WordSize));\n }\n readIndex() {\n return toNumber(this.readBytes(WordSize));\n }\n}\n//# sourceMappingURL=abstract-coder.js.map","/**\n * A Typed object allows a value to have its type explicitly\n * specified.\n *\n * For example, in Solidity, the value ``45`` could represent a\n * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent\n * a ``bytes2`` or ``bytes``.\n *\n * Since JavaScript has no meaningful way to explicitly inform any\n * APIs which what the type is, this allows transparent interoperation\n * with Soldity.\n *\n * @_subsection: api/abi:Typed Values\n */\nimport { assertPrivate, defineProperties } from \"../utils/index.js\";\nconst _gaurd = {};\nfunction n(value, width) {\n let signed = false;\n if (width < 0) {\n signed = true;\n width *= -1;\n }\n // @TODO: Check range is valid for value\n return new Typed(_gaurd, `${signed ? \"\" : \"u\"}int${width}`, value, {\n signed,\n width,\n });\n}\nfunction b(value, size) {\n // @TODO: Check range is valid for value\n return new Typed(_gaurd, `bytes${size ? size : \"\"}`, value, { size });\n}\nconst _typedSymbol = Symbol.for(\"_corebc_typed\");\nexport class Typed {\n type;\n value;\n #options;\n _typedSymbol;\n constructor(gaurd, type, value, options) {\n if (options == null) {\n options = null;\n }\n assertPrivate(_gaurd, gaurd, \"Typed\");\n defineProperties(this, { _typedSymbol, type, value });\n this.#options = options;\n // Check the value is valid\n this.format();\n }\n format() {\n if (this.type === \"array\") {\n throw new Error(\"\");\n }\n else if (this.type === \"dynamicArray\") {\n throw new Error(\"\");\n }\n else if (this.type === \"tuple\") {\n return `tuple(${this.value.map((v) => v.format()).join(\",\")})`;\n }\n return this.type;\n }\n defaultValue() {\n return 0;\n }\n minValue() {\n return 0;\n }\n maxValue() {\n return 0;\n }\n isBigInt() {\n return !!this.type.match(/^u?int[0-9]+$/);\n }\n isData() {\n return this.type.startsWith(\"bytes\");\n }\n isString() {\n return this.type === \"string\";\n }\n get tupleName() {\n if (this.type !== \"tuple\") {\n throw TypeError(\"not a tuple\");\n }\n return this.#options;\n }\n // Returns the length of this type as an array\n // - `null` indicates the length is unforced, it could be dynamic\n // - `-1` indicates the length is dynamic\n // - any other value indicates it is a static array and is its length\n get arrayLength() {\n if (this.type !== \"array\") {\n throw TypeError(\"not an array\");\n }\n if (this.#options === true) {\n return -1;\n }\n if (this.#options === false) {\n return this.value.length;\n }\n return null;\n }\n static from(type, value) {\n return new Typed(_gaurd, type, value);\n }\n static uint8(v) {\n return n(v, 8);\n }\n static uint16(v) {\n return n(v, 16);\n }\n static uint24(v) {\n return n(v, 24);\n }\n static uint32(v) {\n return n(v, 32);\n }\n static uint40(v) {\n return n(v, 40);\n }\n static uint48(v) {\n return n(v, 48);\n }\n static uint56(v) {\n return n(v, 56);\n }\n static uint64(v) {\n return n(v, 64);\n }\n static uint72(v) {\n return n(v, 72);\n }\n static uint80(v) {\n return n(v, 80);\n }\n static uint88(v) {\n return n(v, 88);\n }\n static uint96(v) {\n return n(v, 96);\n }\n static uint104(v) {\n return n(v, 104);\n }\n static uint112(v) {\n return n(v, 112);\n }\n static uint120(v) {\n return n(v, 120);\n }\n static uint128(v) {\n return n(v, 128);\n }\n static uint136(v) {\n return n(v, 136);\n }\n static uint144(v) {\n return n(v, 144);\n }\n static uint152(v) {\n return n(v, 152);\n }\n static uint160(v) {\n return n(v, 160);\n }\n static uint168(v) {\n return n(v, 168);\n }\n static uint176(v) {\n return n(v, 176);\n }\n static uint184(v) {\n return n(v, 184);\n }\n static uint192(v) {\n return n(v, 192);\n }\n static uint200(v) {\n return n(v, 200);\n }\n static uint208(v) {\n return n(v, 208);\n }\n static uint216(v) {\n return n(v, 216);\n }\n static uint224(v) {\n return n(v, 224);\n }\n static uint232(v) {\n return n(v, 232);\n }\n static uint240(v) {\n return n(v, 240);\n }\n static uint248(v) {\n return n(v, 248);\n }\n static uint256(v) {\n return n(v, 256);\n }\n static uint(v) {\n return n(v, 256);\n }\n static int8(v) {\n return n(v, -8);\n }\n static int16(v) {\n return n(v, -16);\n }\n static int24(v) {\n return n(v, -24);\n }\n static int32(v) {\n return n(v, -32);\n }\n static int40(v) {\n return n(v, -40);\n }\n static int48(v) {\n return n(v, -48);\n }\n static int56(v) {\n return n(v, -56);\n }\n static int64(v) {\n return n(v, -64);\n }\n static int72(v) {\n return n(v, -72);\n }\n static int80(v) {\n return n(v, -80);\n }\n static int88(v) {\n return n(v, -88);\n }\n static int96(v) {\n return n(v, -96);\n }\n static int104(v) {\n return n(v, -104);\n }\n static int112(v) {\n return n(v, -112);\n }\n static int120(v) {\n return n(v, -120);\n }\n static int128(v) {\n return n(v, -128);\n }\n static int136(v) {\n return n(v, -136);\n }\n static int144(v) {\n return n(v, -144);\n }\n static int152(v) {\n return n(v, -152);\n }\n static int160(v) {\n return n(v, -160);\n }\n static int168(v) {\n return n(v, -168);\n }\n static int176(v) {\n return n(v, -176);\n }\n static int184(v) {\n return n(v, -184);\n }\n static int192(v) {\n return n(v, -192);\n }\n static int200(v) {\n return n(v, -200);\n }\n static int208(v) {\n return n(v, -208);\n }\n static int216(v) {\n return n(v, -216);\n }\n static int224(v) {\n return n(v, -224);\n }\n static int232(v) {\n return n(v, -232);\n }\n static int240(v) {\n return n(v, -240);\n }\n static int248(v) {\n return n(v, -248);\n }\n static int256(v) {\n return n(v, -256);\n }\n static int(v) {\n return n(v, -256);\n }\n static bytes1(v) {\n return b(v, 1);\n }\n static bytes2(v) {\n return b(v, 2);\n }\n static bytes3(v) {\n return b(v, 3);\n }\n static bytes4(v) {\n return b(v, 4);\n }\n static bytes5(v) {\n return b(v, 5);\n }\n static bytes6(v) {\n return b(v, 6);\n }\n static bytes7(v) {\n return b(v, 7);\n }\n static bytes8(v) {\n return b(v, 8);\n }\n static bytes9(v) {\n return b(v, 9);\n }\n static bytes10(v) {\n return b(v, 10);\n }\n static bytes11(v) {\n return b(v, 11);\n }\n static bytes12(v) {\n return b(v, 12);\n }\n static bytes13(v) {\n return b(v, 13);\n }\n static bytes14(v) {\n return b(v, 14);\n }\n static bytes15(v) {\n return b(v, 15);\n }\n static bytes16(v) {\n return b(v, 16);\n }\n static bytes17(v) {\n return b(v, 17);\n }\n static bytes18(v) {\n return b(v, 18);\n }\n static bytes19(v) {\n return b(v, 19);\n }\n static bytes20(v) {\n return b(v, 20);\n }\n static bytes21(v) {\n return b(v, 21);\n }\n static bytes22(v) {\n return b(v, 22);\n }\n static bytes23(v) {\n return b(v, 23);\n }\n static bytes24(v) {\n return b(v, 24);\n }\n static bytes25(v) {\n return b(v, 25);\n }\n static bytes26(v) {\n return b(v, 26);\n }\n static bytes27(v) {\n return b(v, 27);\n }\n static bytes28(v) {\n return b(v, 28);\n }\n static bytes29(v) {\n return b(v, 29);\n }\n static bytes30(v) {\n return b(v, 30);\n }\n static bytes31(v) {\n return b(v, 31);\n }\n static bytes32(v) {\n return b(v, 32);\n }\n static address(v) {\n return new Typed(_gaurd, \"address\", v);\n }\n static bool(v) {\n return new Typed(_gaurd, \"bool\", !!v);\n }\n static bytes(v) {\n return new Typed(_gaurd, \"bytes\", v);\n }\n static string(v) {\n return new Typed(_gaurd, \"string\", v);\n }\n static array(v, dynamic) {\n throw new Error(\"not implemented yet\");\n return new Typed(_gaurd, \"array\", v, dynamic);\n }\n static tuple(v, name) {\n throw new Error(\"not implemented yet\");\n return new Typed(_gaurd, \"tuple\", v, name);\n }\n static overrides(v) {\n return new Typed(_gaurd, \"overrides\", Object.assign({}, v));\n }\n /**\n * Returns true only if %%value%% is a [[Typed]] instance.\n */\n static isTyped(value) {\n return value && value._typedSymbol === _typedSymbol;\n }\n /**\n * If the value is a [[Typed]] instance, validates the underlying value\n * and returns it, otherwise returns value directly.\n *\n * This is useful for functions that with to accept either a [[Typed]]\n * object or values.\n */\n static dereference(value, type) {\n if (Typed.isTyped(value)) {\n if (value.type !== type) {\n throw new Error(`invalid type: expecetd ${type}, got ${value.type}`);\n }\n return value.value;\n }\n return value;\n }\n}\n//# sourceMappingURL=typed.js.map","import { getAddress } from \"../../address/index.js\";\nimport { toBeHex } from \"../../utils/maths.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class AddressCoder extends Coder {\n constructor(localName) {\n super(\"address\", \"address\", localName, false);\n }\n defaultValue() {\n return \"0x0000000000000000000000000000000000000000\";\n }\n encode(writer, _value) {\n let value = Typed.dereference(_value, \"string\");\n try {\n value = getAddress(value);\n }\n catch (error) {\n return this._throwError(error.message, _value);\n }\n return writer.writeValue(value);\n }\n decode(reader) {\n return getAddress(toBeHex(reader.readValue(), 22));\n }\n}\n//# sourceMappingURL=address.js.map","import { Coder } from \"./abstract-coder.js\";\n/**\n * Clones the functionality of an existing Coder, but without a localName\n *\n * @_ignore\n */\nexport class AnonymousCoder extends Coder {\n coder;\n constructor(coder) {\n super(coder.name, coder.type, \"_\", coder.dynamic);\n this.coder = coder;\n }\n defaultValue() {\n return this.coder.defaultValue();\n }\n encode(writer, value) {\n return this.coder.encode(writer, value);\n }\n decode(reader) {\n return this.coder.decode(reader);\n }\n}\n//# sourceMappingURL=anonymous.js.map","import { defineProperties, isError, assert, assertArgument, assertArgumentCount, } from \"../../utils/index.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder, Result, WordSize, Writer } from \"./abstract-coder.js\";\nimport { AnonymousCoder } from \"./anonymous.js\";\n/**\n * @_ignore\n */\nexport function pack(writer, coders, values) {\n let arrayValues = [];\n if (Array.isArray(values)) {\n arrayValues = values;\n }\n else if (values && typeof values === \"object\") {\n let unique = {};\n arrayValues = coders.map((coder) => {\n const name = coder.localName;\n assert(name, \"cannot encode object for signature with missing names\", \"INVALID_ARGUMENT\", { argument: \"values\", info: { coder }, value: values });\n assert(!unique[name], \"cannot encode object for signature with duplicate names\", \"INVALID_ARGUMENT\", { argument: \"values\", info: { coder }, value: values });\n unique[name] = true;\n return values[name];\n });\n }\n else {\n assertArgument(false, \"invalid tuple value\", \"tuple\", values);\n }\n assertArgument(coders.length === arrayValues.length, \"types/value length mismatch\", \"tuple\", values);\n let staticWriter = new Writer();\n let dynamicWriter = new Writer();\n let updateFuncs = [];\n coders.forEach((coder, index) => {\n let value = arrayValues[index];\n if (coder.dynamic) {\n // Get current dynamic offset (for the future pointer)\n let dynamicOffset = dynamicWriter.length;\n // Encode the dynamic value into the dynamicWriter\n coder.encode(dynamicWriter, value);\n // Prepare to populate the correct offset once we are done\n let updateFunc = staticWriter.writeUpdatableValue();\n updateFuncs.push((baseOffset) => {\n updateFunc(baseOffset + dynamicOffset);\n });\n }\n else {\n coder.encode(staticWriter, value);\n }\n });\n // Backfill all the dynamic offsets, now that we know the static length\n updateFuncs.forEach((func) => {\n func(staticWriter.length);\n });\n let length = writer.appendWriter(staticWriter);\n length += writer.appendWriter(dynamicWriter);\n return length;\n}\n/**\n * @_ignore\n */\nexport function unpack(reader, coders) {\n let values = [];\n let keys = [];\n // A reader anchored to this base\n let baseReader = reader.subReader(0);\n coders.forEach((coder) => {\n let value = null;\n if (coder.dynamic) {\n let offset = reader.readIndex();\n let offsetReader = baseReader.subReader(offset);\n try {\n value = coder.decode(offsetReader);\n }\n catch (error) {\n // Cannot recover from this\n if (isError(error, \"BUFFER_OVERRUN\")) {\n throw error;\n }\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n }\n else {\n try {\n value = coder.decode(reader);\n }\n catch (error) {\n // Cannot recover from this\n if (isError(error, \"BUFFER_OVERRUN\")) {\n throw error;\n }\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n }\n if (value == undefined) {\n throw new Error(\"investigate\");\n }\n values.push(value);\n keys.push(coder.localName || null);\n });\n return Result.fromItems(values, keys);\n}\n/**\n * @_ignore\n */\nexport class ArrayCoder extends Coder {\n coder;\n length;\n constructor(coder, length, localName) {\n const type = coder.type + \"[\" + (length >= 0 ? length : \"\") + \"]\";\n const dynamic = length === -1 || coder.dynamic;\n super(\"array\", type, localName, dynamic);\n defineProperties(this, { coder, length });\n }\n defaultValue() {\n // Verifies the child coder is valid (even if the array is dynamic or 0-length)\n const defaultChild = this.coder.defaultValue();\n const result = [];\n for (let i = 0; i < this.length; i++) {\n result.push(defaultChild);\n }\n return result;\n }\n encode(writer, _value) {\n const value = Typed.dereference(_value, \"array\");\n if (!Array.isArray(value)) {\n this._throwError(\"expected array value\", value);\n }\n let count = this.length;\n if (count === -1) {\n count = value.length;\n writer.writeValue(value.length);\n }\n assertArgumentCount(value.length, count, \"coder array\" + (this.localName ? \" \" + this.localName : \"\"));\n let coders = [];\n for (let i = 0; i < value.length; i++) {\n coders.push(this.coder);\n }\n return pack(writer, coders, value);\n }\n decode(reader) {\n let count = this.length;\n if (count === -1) {\n count = reader.readIndex();\n // Check that there is *roughly* enough data to ensure\n // stray random data is not being read as a length. Each\n // slot requires at least 32 bytes for their value (or 32\n // bytes as a link to the data). This could use a much\n // tighter bound, but we are erroring on the side of safety.\n assert(count * WordSize <= reader.dataLength, \"insufficient data length\", \"BUFFER_OVERRUN\", {\n buffer: reader.bytes,\n offset: count * WordSize,\n length: reader.dataLength,\n });\n }\n let coders = [];\n for (let i = 0; i < count; i++) {\n coders.push(new AnonymousCoder(this.coder));\n }\n return unpack(reader, coders);\n }\n}\n//# sourceMappingURL=array.js.map","import { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class BooleanCoder extends Coder {\n constructor(localName) {\n super(\"bool\", \"bool\", localName, false);\n }\n defaultValue() {\n return false;\n }\n encode(writer, _value) {\n const value = Typed.dereference(_value, \"bool\");\n return writer.writeValue(value ? 1 : 0);\n }\n decode(reader) {\n return !!reader.readValue();\n }\n}\n//# sourceMappingURL=boolean.js.map","import { getBytesCopy, hexlify } from \"../../utils/index.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class DynamicBytesCoder extends Coder {\n constructor(type, localName) {\n super(type, type, localName, true);\n }\n defaultValue() {\n return \"0x\";\n }\n encode(writer, value) {\n value = getBytesCopy(value);\n let length = writer.writeValue(value.length);\n length += writer.writeBytes(value);\n return length;\n }\n decode(reader) {\n return reader.readBytes(reader.readIndex(), true);\n }\n}\n/**\n * @_ignore\n */\nexport class BytesCoder extends DynamicBytesCoder {\n constructor(localName) {\n super(\"bytes\", localName);\n }\n decode(reader) {\n return hexlify(super.decode(reader));\n }\n}\n//# sourceMappingURL=bytes.js.map","import { defineProperties, getBytesCopy, hexlify } from \"../../utils/index.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class FixedBytesCoder extends Coder {\n size;\n constructor(size, localName) {\n let name = \"bytes\" + String(size);\n super(name, name, localName, false);\n defineProperties(this, { size }, { size: \"number\" });\n }\n defaultValue() {\n return \"0x0000000000000000000000000000000000000000000000000000000000000000\".substring(0, 2 + this.size * 2);\n }\n encode(writer, _value) {\n let data = getBytesCopy(Typed.dereference(_value, this.type));\n if (data.length !== this.size) {\n this._throwError(\"incorrect data length\", _value);\n }\n return writer.writeBytes(data);\n }\n decode(reader) {\n return hexlify(reader.readBytes(this.size));\n }\n}\n//# sourceMappingURL=fixed-bytes.js.map","import { Coder } from \"./abstract-coder.js\";\nconst Empty = new Uint8Array([]);\n/**\n * @_ignore\n */\nexport class NullCoder extends Coder {\n constructor(localName) {\n super(\"null\", \"\", localName, false);\n }\n defaultValue() {\n return null;\n }\n encode(writer, value) {\n if (value != null) {\n this._throwError(\"not null\", value);\n }\n return writer.writeBytes(Empty);\n }\n decode(reader) {\n reader.readBytes(0);\n return null;\n }\n}\n//# sourceMappingURL=null.js.map","import { defineProperties, fromTwos, getBigInt, mask, toTwos, } from \"../../utils/index.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder, WordSize } from \"./abstract-coder.js\";\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_MAX_UINT256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n/**\n * @_ignore\n */\nexport class NumberCoder extends Coder {\n size;\n signed;\n constructor(size, signed, localName) {\n const name = (signed ? \"int\" : \"uint\") + size * 8;\n super(name, name, localName, false);\n defineProperties(this, { size, signed }, { size: \"number\", signed: \"boolean\" });\n }\n defaultValue() {\n return 0;\n }\n encode(writer, _value) {\n let value = getBigInt(Typed.dereference(_value, this.type));\n // Check bounds are safe for encoding\n let maxUintValue = mask(BN_MAX_UINT256, WordSize * 8);\n if (this.signed) {\n let bounds = mask(maxUintValue, this.size * 8 - 1);\n if (value > bounds || value < -(bounds + BN_1)) {\n this._throwError(\"value out-of-bounds\", _value);\n }\n value = toTwos(value, 8 * WordSize);\n }\n else if (value < BN_0 || value > mask(maxUintValue, this.size * 8)) {\n this._throwError(\"value out-of-bounds\", _value);\n }\n return writer.writeValue(value);\n }\n decode(reader) {\n let value = mask(reader.readValue(), this.size * 8);\n if (this.signed) {\n value = fromTwos(value, this.size * 8);\n }\n return value;\n }\n}\n//# sourceMappingURL=number.js.map","import { toUtf8Bytes, toUtf8String } from \"../../utils/utf8.js\";\nimport { Typed } from \"../typed.js\";\nimport { DynamicBytesCoder } from \"./bytes.js\";\n/**\n * @_ignore\n */\nexport class StringCoder extends DynamicBytesCoder {\n constructor(localName) {\n super(\"string\", localName);\n }\n defaultValue() {\n return \"\";\n }\n encode(writer, _value) {\n return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, \"string\")));\n }\n decode(reader) {\n return toUtf8String(super.decode(reader));\n }\n}\n//# sourceMappingURL=string.js.map","import { defineProperties } from \"../../utils/properties.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\nimport { pack, unpack } from \"./array.js\";\n/**\n * @_ignore\n */\nexport class TupleCoder extends Coder {\n coders;\n constructor(coders, localName) {\n let dynamic = false;\n const types = [];\n coders.forEach((coder) => {\n if (coder.dynamic) {\n dynamic = true;\n }\n types.push(coder.type);\n });\n const type = \"tuple(\" + types.join(\",\") + \")\";\n super(\"tuple\", type, localName, dynamic);\n defineProperties(this, {\n coders: Object.freeze(coders.slice()),\n });\n }\n defaultValue() {\n const values = [];\n this.coders.forEach((coder) => {\n values.push(coder.defaultValue());\n });\n // We only output named properties for uniquely named coders\n const uniqueNames = this.coders.reduce((accum, coder) => {\n const name = coder.localName;\n if (name) {\n if (!accum[name]) {\n accum[name] = 0;\n }\n accum[name]++;\n }\n return accum;\n }, {});\n // Add named values\n this.coders.forEach((coder, index) => {\n let name = coder.localName;\n if (!name || uniqueNames[name] !== 1) {\n return;\n }\n if (name === \"length\") {\n name = \"_length\";\n }\n if (values[name] != null) {\n return;\n }\n values[name] = values[index];\n });\n return Object.freeze(values);\n }\n encode(writer, _value) {\n const value = Typed.dereference(_value, \"tuple\");\n return pack(writer, this.coders, value);\n }\n decode(reader) {\n return unpack(reader, this.coders);\n }\n}\n//# sourceMappingURL=tuple.js.map","import { keccak256 } from \"../crypto/keccak.js\";\nimport { sha256 } from \"../crypto/sha3.js\";\nimport { toUtf8Bytes } from \"../utils/index.js\";\n/**\n * A simple hashing function which operates on UTF-8 strings to\n * compute an 32-byte identifier.\n *\n *\n * @example:\n * id(\"hello world\")\n * //_result:\n */\nexport function id(value, useKeccak) {\n if (useKeccak) {\n return keccak256(toUtf8Bytes(value));\n }\n return sha256(toUtf8Bytes(value));\n}\n//# sourceMappingURL=id.js.map","/**\n * A constant for the zero address.\n *\n * (**i.e.** ``\"0x0000000000000000000000000000000000000000\"``)\n */\nexport const ZeroAddress = \"0x0000000000000000000000000000000000000000\";\n//# sourceMappingURL=addresses.js.map","/**\n * A constant for the zero hash.\n *\n * (**i.e.** ``\"0x0000000000000000000000000000000000000000000000000000000000000000\"``)\n */\nexport const ZeroHash = \"0x0000000000000000000000000000000000000000000000000000000000000000\";\n//# sourceMappingURL=hashes.js.map","/**\n * A constant for the order N for the secp256k1 curve.\n *\n * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``)\n */\nexport const N = BigInt(\"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\");\n/**\n * A constant for the number of ore in a single xcb.\n *\n * (**i.e.** ``1000000000000000000n``)\n */\nexport const OrePerXCB = BigInt(\"1000000000000000000\");\n/**\n * A constant for the maximum value for a ``uint256``.\n *\n * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)\n */\nexport const MaxUint256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n/**\n * A constant for the minimum value for an ``int256``.\n *\n * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``)\n */\nexport const MinInt256 = BigInt(\"0x8000000000000000000000000000000000000000000000000000000000000000\") *\n BigInt(-1);\n/**\n * A constant for the maximum value for an ``int256``.\n *\n * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)\n */\nexport const MaxInt256 = BigInt(\"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\nexport const NegativeOne = /*#__PURE__*/ BigInt(-1);\nexport const Zero = /*#__PURE__*/ BigInt(0);\nexport const One = /*#__PURE__*/ BigInt(1);\nexport const Two = /*#__PURE__*/ BigInt(2);\n//# sourceMappingURL=numbers.js.map","// NFKC (composed) // (decomposed)\n/**\n * A constant for the core symbol (normalized using NFKC).\n *\n * (**i.e.** ``\"\\\\u039e\"``)\n */\nexport const CoreSymbol = \"\\u039e\"; // \"\\uD835\\uDF63\";\n/**\n * A constant for the [[link-eip-191]] personal message prefix.\n *\n * (**i.e.** ``\"\\\\x19Core Signed Message:\\\\n\"``)\n */\nexport const MessagePrefix = \"\\x19Core Signed Message:\\n\";\n//# sourceMappingURL=strings.js.map","import { getAddress } from \"../address/index.js\";\nimport { assertArgument, isHexString } from \"../utils/index.js\";\nfunction accessSetify(addr, storageKeys) {\n return {\n address: getAddress(addr),\n storageKeys: storageKeys.map((storageKey, index) => {\n assertArgument(isHexString(storageKey, 32), \"invalid slot\", `storageKeys[${index}]`, storageKey);\n return storageKey.toLowerCase();\n }),\n };\n}\n/**\n * Returns a [[AccessList]] from any corebcsupported access-list structure.\n */\nexport function accessListify(value) {\n if (Array.isArray(value)) {\n return value.map((set, index) => {\n if (Array.isArray(set)) {\n assertArgument(set.length === 2, \"invalid slot set\", `value[${index}]`, set);\n return accessSetify(set[0], set[1]);\n }\n assertArgument(set != null && typeof set === \"object\", \"invalid address-slot set\", \"value\", value);\n return accessSetify(set.address, set.storageKeys);\n });\n }\n assertArgument(value != null && typeof value === \"object\", \"invalid access list\", \"value\", value);\n const result = Object.keys(value).map((addr) => {\n const storageKeys = value[addr].reduce((accum, storageKey) => {\n accum[storageKey] = true;\n return accum;\n }, {});\n return accessSetify(addr, Object.keys(storageKeys).sort());\n });\n result.sort((a, b) => a.address.localeCompare(b.address));\n return result;\n}\n//# sourceMappingURL=accesslist.js.map","import { getAddress } from \"../address/index.js\";\nimport { sha256, SigningKey } from \"../crypto/index.js\";\nimport { getBytes, getBigInt, getNumber, hexlify, assert, assertArgument, } from \"../utils/index.js\";\nimport { recoverAddress } from \"./address.js\";\nimport { checkProperties } from \"../utils/properties.js\";\nimport { arrayify, stripZeros } from \"../utils/data.js\";\nimport { Logger } from \"../logger/logger.js\";\nimport * as RLP from \"../crypto/rlp.js\";\nimport { BigNumber } from \"../bigNumber/bigNumber.js\";\nimport { networkIdToPrefix } from \"../address/index.js\";\nconst logger = new Logger(\"transaction/0.0.1\");\nconst BN_0 = BigInt(0);\nfunction handleAddress(value) {\n if (value === \"0x\") {\n return null;\n }\n return getAddress(value);\n}\nfunction parse(data) {\n const handleNumber = (value) => {\n // @ts-ignore\n if (value === \"0x\") {\n return BigNumber.from(0);\n }\n return BigNumber.from(value);\n };\n const transaction = RLP.decode(data);\n if (transaction.length !== 7 && transaction.length !== 8) {\n logger.throwArgumentError(\"invalid raw transaction\", \"data\", data);\n }\n const isSigned = transaction.length === 8;\n const tx = {\n nonce: Number(handleNumber(transaction[0])),\n energyPrice: handleNumber(transaction[1]).toBigInt(),\n energyLimit: handleNumber(transaction[2]).toBigInt(),\n networkId: handleNumber(transaction[isSigned ? 3 : 6]).toBigInt(),\n to: handleAddress(transaction[isSigned ? 4 : 3]),\n value: handleNumber(transaction[isSigned ? 5 : 4]).toBigInt(),\n data: transaction[isSigned ? 6 : 5],\n };\n if (transaction.length === 8) {\n const prefix = networkIdToPrefix(Number(tx.networkId));\n const digest = sha256(serialize(tx));\n tx.hash = sha256(serialize(tx, transaction[7]));\n tx.from = recoverAddress(digest, transaction[7], prefix);\n tx.signature = transaction[7];\n }\n return tx;\n}\nconst unsignedTransactionFields = [\n { name: \"nonce\", maxLength: 32, numeric: true },\n { name: \"energyPrice\", maxLength: 32, numeric: true },\n { name: \"energyLimit\", maxLength: 32, numeric: true },\n { name: \"to\", length: 22 },\n { name: \"value\", maxLength: 32, numeric: true },\n { name: \"data\" },\n { name: \"networkId\", maxLength: 32, numeric: true },\n];\nconst transactionFields = [\n { name: \"nonce\", maxLength: 32, numeric: true },\n { name: \"energyPrice\", maxLength: 32, numeric: true },\n { name: \"energyLimit\", maxLength: 32, numeric: true },\n { name: \"networkId\", maxLength: 32, numeric: true },\n { name: \"to\", length: 22 },\n { name: \"value\", maxLength: 32, numeric: true },\n { name: \"data\" },\n];\nconst allowedTransactionKeys = {\n networkId: true,\n data: true,\n energyLimit: true,\n energyPrice: true,\n nonce: true,\n to: true,\n value: true,\n};\nfunction serialize(transaction, signature) {\n checkProperties(transaction, allowedTransactionKeys);\n const raw = [];\n (!!signature ? transactionFields : unsignedTransactionFields).forEach(function ({ numeric, maxLength, name, length }) {\n let value = transaction[name] || [];\n const options = {};\n if (numeric) {\n options.hexPad = \"left\";\n }\n const tmpHexlified = hexlify(value, options);\n value = arrayify(tmpHexlified);\n // Fixed-width field\n if (length && value.length !== length && value.length > 0) {\n logger.throwArgumentError(\"invalid length for \" + name, \"transaction:\" + name, value);\n }\n // Variable-width (with a maximum)\n if (maxLength) {\n value = stripZeros(value);\n if (value.length > maxLength) {\n logger.throwArgumentError(\"invalid length for \" + name, \"transaction:\" + name, value);\n }\n }\n const hexlified = hexlify(value);\n raw.push(hexlified);\n });\n if (!!signature) {\n raw.push(hexlify(signature));\n }\n const finalValue = RLP.encode(raw);\n return finalValue;\n}\n/**\n * A **Transaction** describes an operation to be executed on\n * Core by an Externally Owned Account (EOA). It includes\n * who (the [[to]] address), what (the [[data]]) and how much (the\n * [[value]] in corebc) the operation should entail.\n *\n * @example:\n * tx = new Transaction()\n * //_result:\n *\n * tx.data = \"0x1234\";\n * //_result:\n */\nexport class Transaction {\n #to;\n #data;\n #nonce;\n #energyLimit;\n #energyPrice;\n #value;\n #networkId;\n #sig;\n /**\n * The ``to`` address for the transaction or ``null`` if the\n * transaction is an ``init`` transaction.\n */\n get to() {\n return this.#to;\n }\n set to(value) {\n this.#to = value == null ? null : getAddress(value);\n }\n /**\n * The transaction nonce.\n */\n get nonce() {\n return this.#nonce;\n }\n set nonce(value) {\n this.#nonce = getNumber(value, \"value\");\n }\n /**\n * The energy limit.\n */\n get energyLimit() {\n return this.#energyLimit;\n }\n set energyLimit(value) {\n this.#energyLimit = getBigInt(value);\n }\n /**\n * The energy price.\n *\n * On legacy networks this defines the fee that will be paid. On\n * EIP-1559 networks, this should be ``null``.\n */\n get energyPrice() {\n const value = this.#energyPrice;\n if (value == null) {\n return BN_0;\n }\n return value;\n }\n set energyPrice(value) {\n this.#energyPrice = value == null ? null : getBigInt(value, \"energyPrice\");\n }\n /**\n * The transaction data. For ``init`` transactions this is the\n * deployment code.\n */\n get data() {\n return this.#data;\n }\n set data(value) {\n this.#data = hexlify(value);\n }\n /**\n * The amount of xcb (in ore) to send in this transactions.\n */\n get value() {\n return this.#value;\n }\n set value(value) {\n this.#value = getBigInt(value, \"value\");\n }\n /**\n * The chain ID this transaction is valid on.\n */\n get networkId() {\n return this.#networkId;\n }\n set networkId(value) {\n this.#networkId = getBigInt(value);\n }\n /**\n * If signed, the signature for this transaction.\n */\n get signature() {\n return this.#sig || null;\n }\n set signature(value) {\n this.#sig = value == null ? null : value;\n }\n /**\n * Creates a new Transaction with default values.\n */\n constructor() {\n this.#to = null;\n this.#nonce = 0;\n this.#energyLimit = BigInt(0);\n this.#energyPrice = null;\n this.#data = \"0x\";\n this.#value = BigInt(0);\n this.#networkId = BigInt(0);\n this.#sig = null;\n }\n /**\n * The transaction hash, if signed. Otherwise, ``null``.\n */\n get hash() {\n if (this.signature == null) {\n return null;\n }\n return sha256(this.serialized);\n }\n /**\n * The pre-image hash of this transaction.\n *\n * This is the digest that a [[Signer]] must sign to authorize\n * this transaction.\n */\n get unsignedHash() {\n return sha256(this.unsignedSerialized);\n }\n /**\n * The sending address, if signed. Otherwise, ``null``.\n */\n get from() {\n if (this.signature == null) {\n return null;\n }\n const prefix = networkIdToPrefix(Number(this.#networkId));\n return recoverAddress(this.unsignedHash, this.signature, prefix);\n }\n /**\n * The public key of the sender, if signed. Otherwise, ``null``.\n */\n get fromPublicKey() {\n if (this.signature == null) {\n return null;\n }\n return SigningKey.recoverPublicKey(this.unsignedHash, this.signature);\n }\n /**\n * Returns true if signed.\n *\n * This provides a Type Guard that properties requiring a signed\n * transaction are non-null.\n */\n isSigned() {\n //isSigned(): this is SignedTransaction {\n return this.signature != null;\n }\n /**\n * The serialized transaction.\n *\n * This throws if the transaction is unsigned. For the pre-image,\n * use [[unsignedSerialized]].\n */\n get serialized() {\n assert(this.signature != null, \"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized\", \"UNSUPPORTED_OPERATION\", { operation: \".serialized\" });\n return serialize(this, this.signature);\n }\n /**\n * The transaction pre-image.\n *\n * The hash of this is the digest which needs to be signed to\n * authorize this transaction.\n */\n get unsignedSerialized() {\n return serialize(this);\n }\n /**\n * Create a copy of this transaciton.\n */\n clone() {\n return Transaction.from(this);\n }\n /**\n * Return a JSON-friendly object.\n */\n toJSON() {\n const s = (v) => {\n if (v == null) {\n return null;\n }\n return v.toString();\n };\n return {\n to: this.to,\n data: this.data,\n nonce: this.nonce,\n energyLimit: s(this.energyLimit),\n energyPrice: s(this.energyPrice),\n value: s(this.value),\n networkId: s(this.networkId),\n sig: this.signature ? this.signature : null,\n };\n }\n /**\n * Create a **Transaction** from a serialized transaction or a\n * Transaction-like object.\n */\n static from(tx) {\n if (tx == null) {\n return new Transaction();\n }\n if (typeof tx === \"string\") {\n const payload = getBytes(tx);\n return Transaction.from(parse(payload));\n }\n const result = new Transaction();\n if (tx.to != null) {\n result.to = tx.to;\n }\n if (tx.nonce != null) {\n result.nonce = tx.nonce;\n }\n if (tx.energyLimit != null) {\n result.energyLimit = tx.energyLimit;\n }\n if (tx.energyPrice != null) {\n result.energyPrice = tx.energyPrice;\n }\n if (tx.data != null) {\n result.data = tx.data;\n }\n if (tx.value != null) {\n result.value = tx.value;\n }\n if (tx.networkId != null) {\n result.networkId = tx.networkId;\n }\n if (tx.signature != null) {\n result.signature = tx.signature;\n }\n if (tx.hash != null) {\n assertArgument(result.isSigned(), \"unsigned transaction cannot define hash\", \"tx\", tx);\n assertArgument(result.hash === tx.hash, \"hash mismatch\", \"tx\", tx);\n }\n if (tx.from != null) {\n assertArgument(result.isSigned(), \"unsigned transaction cannot define from\", \"tx\", tx);\n assertArgument(result.from.toLowerCase() === (tx.from || \"\").toLowerCase(), \"from mismatch\", \"tx\", tx);\n }\n return result;\n }\n}\n//# sourceMappingURL=transaction.js.map","import { MessagePrefix } from \"../constants/index.js\";\nimport { recoverAddress } from \"../transaction/index.js\";\nimport { concat, toUtf8Bytes } from \"../utils/index.js\";\nimport { sha256 } from \"../crypto/index.js\";\n/**\n * Computes the [[link-eip-191]] personal-sign message digest to sign.\n *\n *\n * If %%message%% is a string, it is converted to its UTF-8 bytes\n * first. To compute the digest of a [[DataHexString]], it must be converted\n * to [bytes](getBytes).\n *\n * @example:\n * hashMessage(\"Hello World\")\n * //_result:\n *\n * // Hashes the SIX (6) string characters, i.e.\n * // [ \"0\", \"x\", \"4\", \"2\", \"4\", \"3\" ]\n * hashMessage(\"0x4243\")\n * //_result:\n *\n * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]...\n * hashMessage(getBytes(\"0x4243\"))\n * //_result:\n *\n * // ...which is equal to using data\n * hashMessage(new Uint8Array([ 0x42, 0x43 ]))\n * //_result:\n *\n */\nexport function hashMessage(message) {\n if (typeof message === \"string\") {\n message = toUtf8Bytes(message);\n }\n return sha256(concat([\n toUtf8Bytes(MessagePrefix),\n toUtf8Bytes(String(message.length)),\n message,\n ]));\n}\n/**\n * Return the address of the private key that produced\n * the signature %%sig%% during signing for %%message%%.\n */\nexport function verifyMessage(message, sig, prefix) {\n const digest = hashMessage(message);\n return recoverAddress(digest, sig, prefix);\n}\n//# sourceMappingURL=message.js.map","import { getAddress } from \"../address/index.js\";\nimport { sha256 as _sha256 } from \"../crypto/index.js\";\nimport { concat, dataLength, getBytes, hexlify, toBeArray, toTwos, toUtf8Bytes, zeroPadBytes, zeroPadValue, assertArgument, } from \"../utils/index.js\";\nconst regexBytes = new RegExp(\"^bytes([0-9]+)$\");\nconst regexNumber = new RegExp(\"^(u?int)([0-9]*)$\");\nconst regexArray = new RegExp(\"^(.*)\\\\[([0-9]*)\\\\]$\");\nfunction _pack(type, value, isArray) {\n switch (type) {\n case \"address\":\n if (isArray) {\n return getBytes(zeroPadValue(value, 32));\n }\n return getBytes(getAddress(value));\n case \"string\":\n return toUtf8Bytes(value);\n case \"bytes\":\n return getBytes(value);\n case \"bool\":\n value = !!value ? \"0x01\" : \"0x00\";\n if (isArray) {\n return getBytes(zeroPadValue(value, 32));\n }\n return getBytes(value);\n }\n let match = type.match(regexNumber);\n if (match) {\n let signed = match[1] === \"int\";\n let size = parseInt(match[2] || \"256\");\n assertArgument((!match[2] || match[2] === String(size)) &&\n size % 8 === 0 &&\n size !== 0 &&\n size <= 256, \"invalid number type\", \"type\", type);\n if (isArray) {\n size = 256;\n }\n if (signed) {\n value = toTwos(value, size);\n }\n return getBytes(zeroPadValue(toBeArray(value), size / 8));\n }\n match = type.match(regexBytes);\n if (match) {\n const size = parseInt(match[1]);\n assertArgument(String(size) === match[1] && size !== 0 && size <= 32, \"invalid bytes type\", \"type\", type);\n assertArgument(dataLength(value) === size, `invalid value for ${type}`, \"value\", value);\n if (isArray) {\n return getBytes(zeroPadBytes(value, 32));\n }\n return value;\n }\n match = type.match(regexArray);\n if (match && Array.isArray(value)) {\n const baseType = match[1];\n const count = parseInt(match[2] || String(value.length));\n assertArgument(count === value.length, `invalid array length for ${type}`, \"value\", value);\n const result = [];\n value.forEach(function (value) {\n result.push(_pack(baseType, value, true));\n });\n return getBytes(concat(result));\n }\n assertArgument(false, \"invalid type\", \"type\", type);\n}\n// @TODO: Array Enum\n/**\n * Computes the [[link-solc-packed]] representation of %%values%%\n * respectively to their %%types%%.\n *\n * @example:\n * addr = \"0x8ba1f109551bd432803012645ac136ddd64dba72\"\n * solidityPacked([ \"address\", \"uint\" ], [ addr, 45 ]);\n * //_result:\n */\nexport function solidityPacked(types, values) {\n assertArgument(types.length === values.length, \"wrong number of values; expected ${ types.length }\", \"values\", values);\n const tight = [];\n types.forEach(function (type, index) {\n tight.push(_pack(type, values[index]));\n });\n return hexlify(concat(tight));\n}\n/**\n * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%%\n * respectively to their %%types%%.\n *\n * @example:\n * addr = \"0x8ba1f109551bd432803012645ac136ddd64dba72\"\n * solidityPackedSha256([ \"address\", \"uint\" ], [ addr, 45 ]);\n * //_result:\n */\nexport function solidityPackedSha256(types, values) {\n return _sha256(solidityPacked(types, values));\n}\n//# sourceMappingURL=solidity.js.map","import { getAddress } from \"../address/index.js\";\nimport { recoverAddress } from \"../transaction/index.js\";\nimport { concat, defineProperties, getBigInt, getBytes, hexlify, isHexString, mask, toBeHex, toQuantity, toTwos, zeroPadValue, assertArgument, } from \"../utils/index.js\";\nimport { id } from \"./id.js\";\nimport { sha256 } from \"../crypto/index.js\";\nconst padding = new Uint8Array(32);\npadding.fill(0);\nconst BN__1 = BigInt(-1);\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_MAX_UINT256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\nfunction hexPadRight(value) {\n const bytes = getBytes(value);\n const padOffset = bytes.length % 32;\n if (padOffset) {\n return concat([bytes, padding.slice(padOffset)]);\n }\n return hexlify(bytes);\n}\nconst hexTrue = toBeHex(BN_1, 32);\nconst hexFalse = toBeHex(BN_0, 32);\nconst domainFieldTypes = {\n name: \"string\",\n version: \"string\",\n networkId: \"uint256\",\n verifyingContract: \"address\",\n salt: \"bytes32\",\n};\nconst domainFieldNames = [\n \"name\",\n \"version\",\n \"networkId\",\n \"verifyingContract\",\n \"salt\",\n];\nfunction checkString(key) {\n return function (value) {\n assertArgument(typeof value === \"string\", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value);\n return value;\n };\n}\nconst domainChecks = {\n name: checkString(\"name\"),\n version: checkString(\"version\"),\n networkId: function (_value) {\n const value = getBigInt(_value, \"domain.networkId\");\n assertArgument(value >= 0, \"invalid chain ID\", \"domain.networkId\", _value);\n if (Number.isSafeInteger(value)) {\n return Number(value);\n }\n return toQuantity(value);\n },\n verifyingContract: function (value) {\n try {\n return getAddress(value).toLowerCase();\n }\n catch (error) { }\n assertArgument(false, `invalid domain value \"verifyingContract\"`, \"domain.verifyingContract\", value);\n },\n salt: function (value) {\n const bytes = getBytes(value, \"domain.salt\");\n assertArgument(bytes.length === 32, `invalid domain value \"salt\"`, \"domain.salt\", value);\n return hexlify(bytes);\n },\n};\nfunction getBaseEncoder(type) {\n // intXX and uintXX\n {\n const match = type.match(/^(u?)int(\\d*)$/);\n if (match) {\n const signed = match[1] === \"\";\n const width = parseInt(match[2] || \"256\");\n assertArgument(width % 8 === 0 &&\n width !== 0 &&\n width <= 256 &&\n (match[2] == null || match[2] === String(width)), \"invalid numeric width\", \"type\", type);\n const boundsUpper = mask(BN_MAX_UINT256, signed ? width - 1 : width);\n const boundsLower = signed ? (boundsUpper + BN_1) * BN__1 : BN_0;\n return function (_value) {\n const value = getBigInt(_value, \"value\");\n assertArgument(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, \"value\", value);\n return toBeHex(signed ? toTwos(value, 256) : value, 32);\n };\n }\n }\n // bytesXX\n {\n const match = type.match(/^bytes(\\d+)$/);\n if (match) {\n const width = parseInt(match[1]);\n assertArgument(width !== 0 && width <= 32 && match[1] === String(width), \"invalid bytes width\", \"type\", type);\n return function (value) {\n const bytes = getBytes(value);\n assertArgument(bytes.length === width, `invalid length for ${type}`, \"value\", value);\n return hexPadRight(value);\n };\n }\n }\n switch (type) {\n case \"address\":\n return function (value) {\n return zeroPadValue(getAddress(value), 32);\n };\n case \"bool\":\n return function (value) {\n return !value ? hexFalse : hexTrue;\n };\n case \"bytes\":\n return function (value) {\n return sha256(value);\n };\n case \"string\":\n return function (value) {\n return id(value);\n };\n }\n return null;\n}\nfunction encodeType(name, fields) {\n return `${name}(${fields\n .map(({ name, type }) => type + \" \" + name)\n .join(\",\")})`;\n}\nexport class TypedDataEncoder {\n primaryType;\n #types;\n get types() {\n return JSON.parse(this.#types);\n }\n #fullTypes;\n #encoderCache;\n constructor(types) {\n this.#types = JSON.stringify(types);\n this.#fullTypes = new Map();\n this.#encoderCache = new Map();\n // Link struct types to their direct child structs\n const links = new Map();\n // Link structs to structs which contain them as a child\n const parents = new Map();\n // Link all subtypes within a given struct\n const subtypes = new Map();\n Object.keys(types).forEach((type) => {\n links.set(type, new Set());\n parents.set(type, []);\n subtypes.set(type, new Set());\n });\n for (const name in types) {\n const uniqueNames = new Set();\n for (const field of types[name]) {\n // Check each field has a unique name\n assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, \"types\", types);\n uniqueNames.add(field.name);\n // Get the base type (drop any array specifiers)\n const baseType = field.type.match(/^([^\\x5b]*)(\\x5b|$)/)[1] || null;\n assertArgument(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, \"types\", types);\n // Is this a base encoding type?\n const encoder = getBaseEncoder(baseType);\n if (encoder) {\n continue;\n }\n assertArgument(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, \"types\", types);\n // Add linkage\n parents.get(baseType).push(name);\n links.get(name).add(baseType);\n }\n }\n // Deduce the primary type\n const primaryTypes = Array.from(parents.keys()).filter((n) => parents.get(n).length === 0);\n assertArgument(primaryTypes.length !== 0, \"missing primary type\", \"types\", types);\n assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes\n .map((t) => JSON.stringify(t))\n .join(\", \")}`, \"types\", types);\n defineProperties(this, { primaryType: primaryTypes[0] });\n // Check for circular type references\n function checkCircular(type, found) {\n assertArgument(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, \"types\", types);\n found.add(type);\n for (const child of links.get(type)) {\n if (!parents.has(child)) {\n continue;\n }\n // Recursively check children\n checkCircular(child, found);\n // Mark all ancestors as having this decendant\n for (const subtype of found) {\n subtypes.get(subtype).add(child);\n }\n }\n found.delete(type);\n }\n checkCircular(this.primaryType, new Set());\n // Compute each fully describe type\n for (const [name, set] of subtypes) {\n const st = Array.from(set);\n st.sort();\n this.#fullTypes.set(name, encodeType(name, types[name]) +\n st.map((t) => encodeType(t, types[t])).join(\"\"));\n }\n }\n getEncoder(type) {\n let encoder = this.#encoderCache.get(type);\n if (!encoder) {\n encoder = this.#getEncoder(type);\n this.#encoderCache.set(type, encoder);\n }\n return encoder;\n }\n #getEncoder(type) {\n // Basic encoder type (address, bool, uint256, etc)\n {\n const encoder = getBaseEncoder(type);\n if (encoder) {\n return encoder;\n }\n }\n // Array\n const match = type.match(/^(.*)(\\x5b(\\d*)\\x5d)$/);\n if (match) {\n const subtype = match[1];\n const subEncoder = this.getEncoder(subtype);\n return (value) => {\n assertArgument(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, \"value\", value);\n let result = value.map(subEncoder);\n if (this.#fullTypes.has(subtype)) {\n result = result.map(sha256);\n }\n return sha256(concat(result));\n };\n }\n // Struct\n const fields = this.types[type];\n if (fields) {\n const encodedType = id(this.#fullTypes.get(type));\n return (value) => {\n const values = fields.map(({ name, type }) => {\n const result = this.getEncoder(type)(value[name]);\n if (this.#fullTypes.has(type)) {\n return sha256(result);\n }\n return result;\n });\n values.unshift(encodedType);\n return concat(values);\n };\n }\n assertArgument(false, `unknown type: ${type}`, \"type\", type);\n }\n encodeType(name) {\n const result = this.#fullTypes.get(name);\n assertArgument(result, `unknown type: ${JSON.stringify(name)}`, \"name\", name);\n return result;\n }\n encodeData(type, value) {\n return this.getEncoder(type)(value);\n }\n hashStruct(name, value) {\n return sha256(this.encodeData(name, value));\n }\n encode(value) {\n return this.encodeData(this.primaryType, value);\n }\n hash(value) {\n return this.hashStruct(this.primaryType, value);\n }\n _visit(type, value, callback) {\n // Basic encoder type (address, bool, uint256, etc)\n {\n const encoder = getBaseEncoder(type);\n if (encoder) {\n return callback(type, value);\n }\n }\n // Array\n const match = type.match(/^(.*)(\\x5b(\\d*)\\x5d)$/);\n if (match) {\n assertArgument(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, \"value\", value);\n return value.map((v) => this._visit(match[1], v, callback));\n }\n // Struct\n const fields = this.types[type];\n if (fields) {\n return fields.reduce((accum, { name, type }) => {\n accum[name] = this._visit(type, value[name], callback);\n return accum;\n }, {});\n }\n assertArgument(false, `unknown type: ${type}`, \"type\", type);\n }\n visit(value, callback) {\n return this._visit(this.primaryType, value, callback);\n }\n static from(types) {\n return new TypedDataEncoder(types);\n }\n static getPrimaryType(types) {\n return TypedDataEncoder.from(types).primaryType;\n }\n static hashStruct(name, types, value) {\n return TypedDataEncoder.from(types).hashStruct(name, value);\n }\n static hashDomain(domain) {\n const domainFields = [];\n for (const name in domain) {\n if (domain[name] == null) {\n continue;\n }\n const type = domainFieldTypes[name];\n assertArgument(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, \"domain\", domain);\n domainFields.push({ name, type });\n }\n domainFields.sort((a, b) => {\n return (domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name));\n });\n return TypedDataEncoder.hashStruct(\"EIP712Domain\", { EIP712Domain: domainFields }, domain);\n }\n static encode(domain, types, value) {\n return concat([\n \"0x1901\",\n TypedDataEncoder.hashDomain(domain),\n TypedDataEncoder.from(types).hash(value),\n ]);\n }\n static hash(domain, types, value) {\n return sha256(TypedDataEncoder.encode(domain, types, value));\n }\n // Replaces all address types with ENS names with their looked up address\n static async resolveNames(domain, types, value, resolveName) {\n // Make a copy to isolate it from the object passed in\n domain = Object.assign({}, domain);\n // Allow passing null to ignore value\n for (const key in domain) {\n if (domain[key] == null) {\n delete domain[key];\n }\n }\n // Look up all ENS names\n const ensCache = {};\n // Do we need to look up the domain's verifyingContract?\n if (domain.verifyingContract &&\n !isHexString(domain.verifyingContract, 20)) {\n ensCache[domain.verifyingContract] = \"0x\";\n }\n // We are going to use the encoder to visit all the base values\n const encoder = TypedDataEncoder.from(types);\n // Get a list of all the addresses\n encoder.visit(value, (type, value) => {\n if (type === \"address\" && !isHexString(value, 20)) {\n ensCache[value] = \"0x\";\n }\n return value;\n });\n // Lookup each name\n for (const name in ensCache) {\n ensCache[name] = await resolveName(name);\n }\n // Replace the domain verifyingContract if needed\n if (domain.verifyingContract && ensCache[domain.verifyingContract]) {\n domain.verifyingContract = ensCache[domain.verifyingContract];\n }\n // Replace all ENS names with their address\n value = encoder.visit(value, (type, value) => {\n if (type === \"address\" && ensCache[value]) {\n return ensCache[value];\n }\n return value;\n });\n return { domain, value };\n }\n static getPayload(domain, types, value) {\n // Validate the domain fields\n TypedDataEncoder.hashDomain(domain);\n // Derive the EIP712Domain Struct reference type\n const domainValues = {};\n const domainTypes = [];\n domainFieldNames.forEach((name) => {\n const value = domain[name];\n if (value == null) {\n return;\n }\n domainValues[name] = domainChecks[name](value);\n domainTypes.push({ name, type: domainFieldTypes[name] });\n });\n const encoder = TypedDataEncoder.from(types);\n const typesWithDomain = Object.assign({}, types);\n assertArgument(typesWithDomain.EIP712Domain == null, \"types must not contain EIP712Domain type\", \"types.EIP712Domain\", types);\n typesWithDomain.EIP712Domain = domainTypes;\n // Validate the data structures and types\n encoder.encode(value);\n return {\n types: typesWithDomain,\n domain: domainValues,\n primaryType: encoder.primaryType,\n message: encoder.visit(value, (type, value) => {\n // bytes\n if (type.match(/^bytes(\\d*)/)) {\n return hexlify(getBytes(value));\n }\n // uint or int\n if (type.match(/^u?int/)) {\n return getBigInt(value).toString();\n }\n switch (type) {\n case \"address\":\n return value.toLowerCase();\n case \"bool\":\n return !!value;\n case \"string\":\n assertArgument(typeof value === \"string\", \"invalid string\", \"value\", value);\n return value;\n }\n assertArgument(false, \"unsupported type\", \"type\", type);\n }),\n };\n }\n}\n/**\n * Compute the address used to sign the typed data for the %%signature%%.\n */\nexport function verifyTypedData(domain, types, value, signature, prefix) {\n return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature, prefix);\n}\n//# sourceMappingURL=typed-data.js.map","/**\n * About frgaments...\n *\n * @_subsection api/abi/abi-coder:Fragments [about-fragments]\n */\nvar _a;\nimport { defineProperties, getBigInt, getNumber, assert, assertPrivate, assertArgument, } from \"../utils/index.js\";\nimport { id } from \"../hash/index.js\";\n// [ \"a\", \"b\" ] => { \"a\": 1, \"b\": 1 }\nfunction setify(items) {\n const result = new Set();\n items.forEach((k) => result.add(k));\n return Object.freeze(result);\n}\n// Visibility Keywords\nconst _kwVisib = \"constant external internal payable private public pure view\";\nconst KwVisib = setify(_kwVisib.split(\" \"));\nconst _kwTypes = \"constructor error event fallback function receive struct\";\nconst KwTypes = setify(_kwTypes.split(\" \"));\nconst _kwModifiers = \"calldata memory storage payable indexed\";\nconst KwModifiers = setify(_kwModifiers.split(\" \"));\nconst _kwOther = \"tuple returns\";\n// All Keywords\nconst _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(\" \");\nconst Keywords = setify(_keywords.split(\" \"));\n// Single character tokens\nconst SimpleTokens = {\n \"(\": \"OPEN_PAREN\",\n \")\": \"CLOSE_PAREN\",\n \"[\": \"OPEN_BRACKET\",\n \"]\": \"CLOSE_BRACKET\",\n \",\": \"COMMA\",\n \"@\": \"AT\",\n};\n// Parser regexes to consume the next token\nconst regexWhitespacePrefix = new RegExp(\"^(\\\\s*)\");\nconst regexNumberPrefix = new RegExp(\"^([0-9]+)\");\nconst regexIdPrefix = new RegExp(\"^([a-zA-Z$_][a-zA-Z0-9$_]*)\");\n// Parser regexs to check validity\nconst regexId = new RegExp(\"^([a-zA-Z$_][a-zA-Z0-9$_]*)$\");\nconst regexType = new RegExp(\"^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$\");\nclass TokenString {\n #offset;\n #tokens;\n get offset() {\n return this.#offset;\n }\n get length() {\n return this.#tokens.length - this.#offset;\n }\n constructor(tokens) {\n this.#offset = 0;\n this.#tokens = tokens.slice();\n }\n clone() {\n return new _a(this.#tokens);\n }\n reset() {\n this.#offset = 0;\n }\n #subTokenString(from = 0, to = 0) {\n return new _a(this.#tokens.slice(from, to).map((t) => {\n return Object.freeze(Object.assign({}, t, {\n match: t.match - from,\n linkBack: t.linkBack - from,\n linkNext: t.linkNext - from,\n }));\n }));\n }\n // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens\n popKeyword(allowed) {\n const top = this.peek();\n if (top.type !== \"KEYWORD\" || !allowed.has(top.text)) {\n throw new Error(`expected keyword ${top.text}`);\n }\n return this.pop().text;\n }\n // Pops and returns the value of the next token if it is `type`; throws if out of tokens\n popType(type) {\n if (this.peek().type !== type) {\n throw new Error(`expected ${type}; got ${JSON.stringify(this.peek())}`);\n }\n return this.pop().text;\n }\n // Pops and returns a \"(\" TOKENS \")\"\n popParen() {\n const top = this.peek();\n if (top.type !== \"OPEN_PAREN\") {\n throw new Error(\"bad start\");\n }\n const result = this.#subTokenString(this.#offset + 1, top.match + 1);\n this.#offset = top.match + 1;\n return result;\n }\n // Pops and returns the items within \"(\" ITEM1 \",\" ITEM2 \",\" ... \")\"\n popParams() {\n const top = this.peek();\n if (top.type !== \"OPEN_PAREN\") {\n throw new Error(\"bad start\");\n }\n const result = [];\n while (this.#offset < top.match - 1) {\n const link = this.peek().linkNext;\n result.push(this.#subTokenString(this.#offset + 1, link));\n this.#offset = link;\n }\n this.#offset = top.match + 1;\n return result;\n }\n // Returns the top Token, throwing if out of tokens\n peek() {\n if (this.#offset >= this.#tokens.length) {\n throw new Error(\"out-of-bounds\");\n }\n return this.#tokens[this.#offset];\n }\n // Returns the next value, if it is a keyword in `allowed`\n peekKeyword(allowed) {\n const top = this.peekType(\"KEYWORD\");\n return top != null && allowed.has(top) ? top : null;\n }\n // Returns the value of the next token if it is `type`\n peekType(type) {\n if (this.length === 0) {\n return null;\n }\n const top = this.peek();\n return top.type === type ? top.text : null;\n }\n // Returns the next token; throws if out of tokens\n pop() {\n const result = this.peek();\n this.#offset++;\n return result;\n }\n toString() {\n const tokens = [];\n for (let i = this.#offset; i < this.#tokens.length; i++) {\n const token = this.#tokens[i];\n tokens.push(`${token.type}:${token.text}`);\n }\n return ``;\n }\n}\n_a = TokenString;\nfunction lex(text) {\n const tokens = [];\n const throwError = (message) => {\n const token = offset < text.length ? JSON.stringify(text[offset]) : \"$EOI\";\n throw new Error(`invalid token ${token} at ${offset}: ${message}`);\n };\n let brackets = [];\n let commas = [];\n let offset = 0;\n while (offset < text.length) {\n // Strip off any leading whitespace\n let cur = text.substring(offset);\n let match = cur.match(regexWhitespacePrefix);\n if (match) {\n offset += match[1].length;\n cur = text.substring(offset);\n }\n const token = {\n depth: brackets.length,\n linkBack: -1,\n linkNext: -1,\n match: -1,\n type: \"\",\n text: \"\",\n offset,\n value: -1,\n };\n tokens.push(token);\n let type = SimpleTokens[cur[0]] || \"\";\n if (type) {\n token.type = type;\n token.text = cur[0];\n offset++;\n if (type === \"OPEN_PAREN\") {\n brackets.push(tokens.length - 1);\n commas.push(tokens.length - 1);\n }\n else if (type == \"CLOSE_PAREN\") {\n if (brackets.length === 0) {\n throwError(\"no matching open bracket\");\n }\n token.match = brackets.pop();\n tokens[token.match].match = tokens.length - 1;\n token.depth--;\n token.linkBack = commas.pop();\n tokens[token.linkBack].linkNext = tokens.length - 1;\n }\n else if (type === \"COMMA\") {\n token.linkBack = commas.pop();\n tokens[token.linkBack].linkNext = tokens.length - 1;\n commas.push(tokens.length - 1);\n }\n else if (type === \"OPEN_BRACKET\") {\n token.type = \"BRACKET\";\n }\n else if (type === \"CLOSE_BRACKET\") {\n // Remove the CLOSE_BRACKET\n let suffix = tokens.pop().text;\n if (tokens.length > 0 && tokens[tokens.length - 1].type === \"NUMBER\") {\n const value = tokens.pop().text;\n suffix = value + suffix;\n tokens[tokens.length - 1].value =\n getNumber(value);\n }\n if (tokens.length === 0 ||\n tokens[tokens.length - 1].type !== \"BRACKET\") {\n throw new Error(\"missing opening bracket\");\n }\n tokens[tokens.length - 1].text += suffix;\n }\n continue;\n }\n match = cur.match(regexIdPrefix);\n if (match) {\n token.text = match[1];\n offset += token.text.length;\n if (Keywords.has(token.text)) {\n token.type = \"KEYWORD\";\n continue;\n }\n if (token.text.match(regexType)) {\n token.type = \"TYPE\";\n continue;\n }\n token.type = \"ID\";\n continue;\n }\n match = cur.match(regexNumberPrefix);\n if (match) {\n token.text = match[1];\n token.type = \"NUMBER\";\n offset += token.text.length;\n continue;\n }\n throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`);\n }\n return new TokenString(tokens.map((t) => Object.freeze(t)));\n}\n// Check only one of `allowed` is in `set`\nfunction allowSingle(set, allowed) {\n let included = [];\n for (const key in allowed.keys()) {\n if (set.has(key)) {\n included.push(key);\n }\n }\n if (included.length > 1) {\n throw new Error(`conflicting types: ${included.join(\", \")}`);\n }\n}\n// Functions to process a Solidity Signature TokenString from left-to-right for...\n// ...the name with an optional type, returning the name\nfunction consumeName(type, tokens) {\n if (tokens.peekKeyword(KwTypes)) {\n const keyword = tokens.pop().text;\n if (keyword !== type) {\n throw new Error(`expected ${type}, got ${keyword}`);\n }\n }\n return tokens.popType(\"ID\");\n}\n// ...all keywords matching allowed, returning the keywords\nfunction consumeKeywords(tokens, allowed) {\n const keywords = new Set();\n while (true) {\n const keyword = tokens.peekType(\"KEYWORD\");\n if (keyword == null || (allowed && !allowed.has(keyword))) {\n break;\n }\n tokens.pop();\n if (keywords.has(keyword)) {\n throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`);\n }\n keywords.add(keyword);\n }\n return Object.freeze(keywords);\n}\n// ...all visibility keywords, returning the coalesced mutability\nfunction consumeMutability(tokens) {\n let modifiers = consumeKeywords(tokens, KwVisib);\n // Detect conflicting modifiers\n allowSingle(modifiers, setify(\"constant payable nonpayable\".split(\" \")));\n allowSingle(modifiers, setify(\"pure view payable nonpayable\".split(\" \")));\n // Process mutability states\n if (modifiers.has(\"view\")) {\n return \"view\";\n }\n if (modifiers.has(\"pure\")) {\n return \"pure\";\n }\n if (modifiers.has(\"payable\")) {\n return \"payable\";\n }\n if (modifiers.has(\"nonpayable\")) {\n return \"nonpayable\";\n }\n // Process legacy `constant` last\n if (modifiers.has(\"constant\")) {\n return \"view\";\n }\n return \"nonpayable\";\n}\n// ...a parameter list, returning the ParamType list\nfunction consumeParams(tokens, allowIndexed) {\n return tokens.popParams().map((t) => ParamType.from(t, allowIndexed));\n}\n// ...a energy limit, returning a BigNumber or null if none\nfunction consumeEnergy(tokens) {\n if (tokens.peekType(\"AT\")) {\n tokens.pop();\n if (tokens.peekType(\"NUMBER\")) {\n return getBigInt(tokens.pop().text);\n }\n throw new Error(\"invalid energy\");\n }\n return null;\n}\nfunction consumeEoi(tokens) {\n if (tokens.length) {\n throw new Error(`unexpected tokens: ${tokens.toString()}`);\n }\n}\nconst regexArrayType = new RegExp(/^(.*)\\[([0-9]*)\\]$/);\nfunction verifyBasicType(type) {\n const match = type.match(regexType);\n assertArgument(match, \"invalid type\", \"type\", type);\n if (type === \"uint\") {\n return \"uint256\";\n }\n if (type === \"int\") {\n return \"int256\";\n }\n if (match[2]) {\n // bytesXX\n const length = parseInt(match[2]);\n assertArgument(length !== 0 && length <= 32, \"invalid bytes length\", \"type\", type);\n }\n else if (match[3]) {\n // intXX or uintXX\n const size = parseInt(match[3]);\n assertArgument(size !== 0 && size <= 256 && size % 8 === 0, \"invalid numeric width\", \"type\", type);\n }\n return type;\n}\n// Make the Fragment constructors effectively private\nconst _guard = {};\nconst internal = Symbol.for(\"_corebc_internal\");\nconst ParamTypeInternal = \"_ParamTypeInternal\";\nconst ErrorFragmentInternal = \"_ErrorInternal\";\nconst EventFragmentInternal = \"_EventInternal\";\nconst ConstructorFragmentInternal = \"_ConstructorInternal\";\nconst FallbackFragmentInternal = \"_FallbackInternal\";\nconst FunctionFragmentInternal = \"_FunctionInternal\";\nconst StructFragmentInternal = \"_StructInternal\";\n/**\n * Each input and output of a [[Fragment]] is an Array of **PAramType**.\n */\nexport class ParamType {\n /**\n * The local name of the parameter (or ``\"\"`` if unbound)\n */\n name;\n /**\n * The fully qualified type (e.g. ``\"address\"``, ``\"tuple(address)\"``,\n * ``\"uint256[3][]\"``)\n */\n type;\n /**\n * The base type (e.g. ``\"address\"``, ``\"tuple\"``, ``\"array\"``)\n */\n baseType;\n /**\n * True if the parameters is indexed.\n *\n * For non-indexable types this is ``null``.\n */\n indexed;\n /**\n * The components for the tuple.\n *\n * For non-tuple types this is ``null``.\n */\n components;\n /**\n * The array length, or ``-1`` for dynamic-lengthed arrays.\n *\n * For non-array types this is ``null``.\n */\n arrayLength;\n /**\n * The type of each child in the array.\n *\n * For non-array types this is ``null``.\n */\n arrayChildren;\n /**\n * @private\n */\n constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) {\n assertPrivate(guard, _guard, \"ParamType\");\n Object.defineProperty(this, internal, { value: ParamTypeInternal });\n if (components) {\n components = Object.freeze(components.slice());\n }\n if (baseType === \"array\") {\n if (arrayLength == null || arrayChildren == null) {\n throw new Error(\"\");\n }\n }\n else if (arrayLength != null || arrayChildren != null) {\n throw new Error(\"\");\n }\n if (baseType === \"tuple\") {\n if (components == null) {\n throw new Error(\"\");\n }\n }\n else if (components != null) {\n throw new Error(\"\");\n }\n defineProperties(this, {\n name,\n type,\n baseType,\n indexed,\n components,\n arrayLength,\n arrayChildren,\n });\n }\n /**\n * Return a string representation of this type.\n *\n * For example,\n *\n * ``sighash\" => \"(uint256,address)\"``\n *\n * ``\"minimal\" => \"tuple(uint256,address) indexed\"``\n *\n * ``\"full\" => \"tuple(uint256 foo, address bar) indexed baz\"``\n */\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n let result = {\n type: this.baseType === \"tuple\" ? \"tuple\" : this.type,\n name: this.name || undefined,\n };\n if (typeof this.indexed === \"boolean\") {\n result.indexed = this.indexed;\n }\n if (this.isTuple()) {\n result.components = this.components.map((c) => JSON.parse(c.format(format)));\n }\n return JSON.stringify(result);\n }\n let result = \"\";\n // Array\n if (this.isArray()) {\n result += this.arrayChildren.format(format);\n result += `[${this.arrayLength < 0 ? \"\" : String(this.arrayLength)}]`;\n }\n else {\n if (this.isTuple()) {\n if (format !== \"sighash\") {\n result += this.type;\n }\n result +=\n \"(\" +\n this.components\n .map((comp) => comp.format(format))\n .join(format === \"full\" ? \", \" : \",\") +\n \")\";\n }\n else {\n result += this.type;\n }\n }\n if (format !== \"sighash\") {\n if (this.indexed === true) {\n result += \" indexed\";\n }\n if (format === \"full\" && this.name) {\n result += \" \" + this.name;\n }\n }\n return result;\n }\n /*\n * Returns true if %%value%% is an Array type.\n *\n * This provides a type gaurd ensuring that the\n * [[arrayChildren]] and [[arrayLength]] are non-null.\n */\n //static isArray(value: any): value is { arrayChildren: ParamType, arrayLength: number } {\n // return value && (value.baseType === \"array\")\n //}\n /**\n * Returns true if %%this%% is an Array type.\n *\n * This provides a type gaurd ensuring that [[arrayChildren]]\n * and [[arrayLength]] are non-null.\n */\n isArray() {\n return this.baseType === \"array\";\n }\n /**\n * Returns true if %%this%% is a Tuple type.\n *\n * This provides a type gaurd ensuring that [[components]]\n * is non-null.\n */\n isTuple() {\n return this.baseType === \"tuple\";\n }\n /**\n * Returns true if %%this%% is an Indexable type.\n *\n * This provides a type gaurd ensuring that [[indexed]]\n * is non-null.\n */\n isIndexable() {\n return this.indexed != null;\n }\n /**\n * Walks the **ParamType** with %%value%%, calling %%process%%\n * on each type, destructing the %%value%% recursively.\n */\n walk(value, process) {\n if (this.isArray()) {\n if (!Array.isArray(value)) {\n throw new Error(\"invalid array value\");\n }\n if (this.arrayLength !== -1 && value.length !== this.arrayLength) {\n throw new Error(\"array is wrong length\");\n }\n const _this = this;\n return value.map((v) => _this.arrayChildren.walk(v, process));\n }\n if (this.isTuple()) {\n if (!Array.isArray(value)) {\n throw new Error(\"invalid tuple value\");\n }\n if (value.length !== this.components.length) {\n throw new Error(\"array is wrong length\");\n }\n const _this = this;\n return value.map((v, i) => _this.components[i].walk(v, process));\n }\n return process(this.type, value);\n }\n #walkAsync(promises, value, process, setValue) {\n if (this.isArray()) {\n if (!Array.isArray(value)) {\n throw new Error(\"invalid array value\");\n }\n if (this.arrayLength !== -1 && value.length !== this.arrayLength) {\n throw new Error(\"array is wrong length\");\n }\n const childType = this.arrayChildren;\n const result = value.slice();\n result.forEach((value, index) => {\n childType.#walkAsync(promises, value, process, (value) => {\n result[index] = value;\n });\n });\n setValue(result);\n return;\n }\n if (this.isTuple()) {\n const components = this.components;\n // Convert the object into an array\n let result;\n if (Array.isArray(value)) {\n result = value.slice();\n }\n else {\n if (value == null || typeof value !== \"object\") {\n throw new Error(\"invalid tuple value\");\n }\n result = components.map((param) => {\n if (!param.name) {\n throw new Error(\"cannot use object value with unnamed components\");\n }\n if (!(param.name in value)) {\n throw new Error(`missing value for component ${param.name}`);\n }\n return value[param.name];\n });\n }\n if (result.length !== this.components.length) {\n throw new Error(\"array is wrong length\");\n }\n result.forEach((value, index) => {\n components[index].#walkAsync(promises, value, process, (value) => {\n result[index] = value;\n });\n });\n setValue(result);\n return;\n }\n const result = process(this.type, value);\n if (result.then) {\n promises.push((async function () {\n setValue(await result);\n })());\n }\n else {\n setValue(result);\n }\n }\n /**\n * Walks the **ParamType** with %%value%%, asynchronously calling\n * %%process%% on each type, destructing the %%value%% recursively.\n *\n * This can be used to resolve ENS naes by walking and resolving each\n * ``\"address\"`` type.\n */\n async walkAsync(value, process) {\n const promises = [];\n const result = [value];\n this.#walkAsync(promises, value, process, (value) => {\n result[0] = value;\n });\n if (promises.length) {\n await Promise.all(promises);\n }\n return result[0];\n }\n /**\n * Creates a new **ParamType** for %%obj%%.\n *\n * If %%allowIndexed%% then the ``indexed`` keyword is permitted,\n * otherwise the ``indexed`` keyword will throw an error.\n */\n static from(obj, allowIndexed) {\n if (ParamType.isParamType(obj)) {\n return obj;\n }\n if (typeof obj === \"string\") {\n return ParamType.from(lex(obj), allowIndexed);\n }\n else if (obj instanceof TokenString) {\n let type = \"\", baseType = \"\";\n let comps = null;\n if (consumeKeywords(obj, setify([\"tuple\"])).has(\"tuple\") ||\n obj.peekType(\"OPEN_PAREN\")) {\n // Tuple\n baseType = \"tuple\";\n comps = obj.popParams().map((t) => ParamType.from(t));\n type = `tuple(${comps.map((c) => c.format()).join(\",\")})`;\n }\n else {\n // Normal\n type = verifyBasicType(obj.popType(\"TYPE\"));\n baseType = type;\n }\n // Check for Array\n let arrayChildren = null;\n let arrayLength = null;\n while (obj.length && obj.peekType(\"BRACKET\")) {\n const bracket = obj.pop(); //arrays[i];\n arrayChildren = new ParamType(_guard, \"\", type, baseType, null, comps, arrayLength, arrayChildren);\n arrayLength = bracket.value;\n type += bracket.text;\n baseType = \"array\";\n comps = null;\n }\n let indexed = null;\n const keywords = consumeKeywords(obj, KwModifiers);\n if (keywords.has(\"indexed\")) {\n if (!allowIndexed) {\n throw new Error(\"\");\n }\n indexed = true;\n }\n const name = obj.peekType(\"ID\") ? obj.pop().text : \"\";\n if (obj.length) {\n throw new Error(\"leftover tokens\");\n }\n return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren);\n }\n const name = obj.name;\n assertArgument(!name || (typeof name === \"string\" && name.match(regexId)), \"invalid name\", \"obj.name\", name);\n let indexed = obj.indexed;\n if (indexed != null) {\n assertArgument(allowIndexed, \"parameter cannot be indexed\", \"obj.indexed\", obj.indexed);\n indexed = !!indexed;\n }\n let type = obj.type;\n let arrayMatch = type.match(regexArrayType);\n if (arrayMatch) {\n const arrayLength = parseInt(arrayMatch[2] || \"-1\");\n const arrayChildren = ParamType.from({\n type: arrayMatch[1],\n components: obj.components,\n });\n return new ParamType(_guard, name || \"\", type, \"array\", indexed, null, arrayLength, arrayChildren);\n }\n if (type === \"tuple\" ||\n type.startsWith(\"tuple(\" /* fix: ) */) ||\n type.startsWith(\"(\" /* fix: ) */)) {\n const comps = obj.components != null\n ? obj.components.map((c) => ParamType.from(c))\n : null;\n const tuple = new ParamType(_guard, name || \"\", type, \"tuple\", indexed, comps, null, null);\n // @TODO: use lexer to validate and normalize type\n return tuple;\n }\n type = verifyBasicType(obj.type);\n return new ParamType(_guard, name || \"\", type, type, indexed, null, null, null);\n }\n /**\n * Returns true if %%value%% is a **ParamType**.\n */\n static isParamType(value) {\n return value && value[internal] === ParamTypeInternal;\n }\n}\n/**\n * An abstract class to represent An individual fragment from a parse ABI.\n */\nexport class Fragment {\n /**\n * The type of the fragment.\n */\n type;\n /**\n * The inputs for the fragment.\n */\n inputs;\n /**\n * @private\n */\n constructor(guard, type, inputs) {\n assertPrivate(guard, _guard, \"Fragment\");\n inputs = Object.freeze(inputs.slice());\n defineProperties(this, { type, inputs });\n }\n /**\n * Creates a new **Fragment** for %%obj%%, wich can be any supported\n * ABI frgament type.\n */\n static from(obj) {\n if (typeof obj === \"string\") {\n // Try parsing JSON...\n try {\n Fragment.from(JSON.parse(obj));\n }\n catch (e) { }\n // ...otherwise, use the human-readable lexer\n return Fragment.from(lex(obj));\n }\n if (obj instanceof TokenString) {\n // Human-readable ABI (already lexed)\n const type = obj.peekKeyword(KwTypes);\n switch (type) {\n case \"constructor\":\n return ConstructorFragment.from(obj);\n case \"error\":\n return ErrorFragment.from(obj);\n case \"event\":\n return EventFragment.from(obj);\n case \"fallback\":\n case \"receive\":\n return FallbackFragment.from(obj);\n case \"function\":\n return FunctionFragment.from(obj);\n case \"struct\":\n return StructFragment.from(obj);\n }\n }\n else if (typeof obj === \"object\") {\n // JSON ABI\n switch (obj.type) {\n case \"constructor\":\n return ConstructorFragment.from(obj);\n case \"error\":\n return ErrorFragment.from(obj);\n case \"event\":\n return EventFragment.from(obj);\n case \"fallback\":\n case \"receive\":\n return FallbackFragment.from(obj);\n case \"function\":\n return FunctionFragment.from(obj);\n case \"struct\":\n return StructFragment.from(obj);\n }\n assert(false, `unsupported type: ${obj.type}`, \"UNSUPPORTED_OPERATION\", {\n operation: \"Fragment.from\",\n });\n }\n assertArgument(false, \"unsupported frgament object\", \"obj\", obj);\n }\n /**\n * Returns true if %%value%% is a [[ConstructorFragment]].\n */\n static isConstructor(value) {\n return ConstructorFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is an [[ErrorFragment]].\n */\n static isError(value) {\n return ErrorFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is an [[EventFragment]].\n */\n static isEvent(value) {\n return EventFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is a [[FunctionFragment]].\n */\n static isFunction(value) {\n return FunctionFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is a [[StructFragment]].\n */\n static isStruct(value) {\n return StructFragment.isFragment(value);\n }\n}\n/**\n * An abstract class to represent An individual fragment\n * which has a name from a parse ABI.\n */\nexport class NamedFragment extends Fragment {\n /**\n * The name of the fragment.\n */\n name;\n /**\n * @private\n */\n constructor(guard, type, name, inputs) {\n super(guard, type, inputs);\n assertArgument(typeof name === \"string\" && name.match(regexId), \"invalid identifier\", \"name\", name);\n inputs = Object.freeze(inputs.slice());\n defineProperties(this, { name });\n }\n}\nfunction joinParams(format, params) {\n return (\"(\" +\n params.map((p) => p.format(format)).join(format === \"full\" ? \", \" : \",\") +\n \")\");\n}\n/**\n * A Fragment which represents a //Custom Error//.\n */\nexport class ErrorFragment extends NamedFragment {\n /**\n * @private\n */\n constructor(guard, name, inputs) {\n super(guard, \"error\", name, inputs);\n Object.defineProperty(this, internal, { value: ErrorFragmentInternal });\n }\n /**\n * The Custom Error selector.\n */\n get selector() {\n return id(this.format(\"sighash\")).substring(0, 10);\n }\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"error\",\n name: this.name,\n inputs: this.inputs.map((input) => JSON.parse(input.format(format))),\n });\n }\n const result = [];\n if (format !== \"sighash\") {\n result.push(\"error\");\n }\n result.push(this.name + joinParams(format, this.inputs));\n return result.join(\" \");\n }\n static from(obj) {\n if (ErrorFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof obj === \"string\") {\n return ErrorFragment.from(lex(obj));\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"error\", obj);\n const inputs = consumeParams(obj);\n consumeEoi(obj);\n return new ErrorFragment(_guard, name, inputs);\n }\n return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);\n }\n static isFragment(value) {\n return value && value[internal] === ErrorFragmentInternal;\n }\n}\n/**\n * A Fragment which represents an Event.\n */\nexport class EventFragment extends NamedFragment {\n anonymous;\n /**\n * @private\n */\n constructor(guard, name, inputs, anonymous) {\n super(guard, \"event\", name, inputs);\n Object.defineProperty(this, internal, { value: EventFragmentInternal });\n defineProperties(this, { anonymous });\n }\n /**\n * The Event topic hash.\n */\n get topicHash() {\n return id(this.format(\"sighash\"));\n }\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"event\",\n anonymous: this.anonymous,\n name: this.name,\n inputs: this.inputs.map((i) => JSON.parse(i.format(format))),\n });\n }\n const result = [];\n if (format !== \"sighash\") {\n result.push(\"event\");\n }\n result.push(this.name + joinParams(format, this.inputs));\n if (format !== \"sighash\" && this.anonymous) {\n result.push(\"anonymous\");\n }\n return result.join(\" \");\n }\n static getTopicHash(name, params) {\n params = (params || []).map((p) => ParamType.from(p));\n const fragment = new EventFragment(_guard, name, params, false);\n return fragment.topicHash;\n }\n static from(obj) {\n if (EventFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof obj === \"string\") {\n return EventFragment.from(lex(obj));\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"event\", obj);\n const inputs = consumeParams(obj, true);\n const anonymous = !!consumeKeywords(obj, setify([\"anonymous\"])).has(\"anonymous\");\n consumeEoi(obj);\n return new EventFragment(_guard, name, inputs, anonymous);\n }\n return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous);\n }\n static isFragment(value) {\n return value && value[internal] === EventFragmentInternal;\n }\n}\n/**\n * A Fragment which represents a constructor.\n */\nexport class ConstructorFragment extends Fragment {\n payable;\n energy;\n /**\n * @private\n */\n constructor(guard, type, inputs, payable, energy) {\n super(guard, type, inputs);\n Object.defineProperty(this, internal, {\n value: ConstructorFragmentInternal,\n });\n defineProperties(this, { payable, energy });\n }\n format(format) {\n assert(format != null && format !== \"sighash\", \"cannot format a constructor for sighash\", \"UNSUPPORTED_OPERATION\", { operation: \"format(sighash)\" });\n if (format === \"json\") {\n return JSON.stringify({\n type: \"constructor\",\n stateMutability: this.payable ? \"payable\" : \"undefined\",\n payable: this.payable,\n energy: this.energy != null ? this.energy : undefined,\n inputs: this.inputs.map((i) => JSON.parse(i.format(format))),\n });\n }\n const result = [`constructor${joinParams(format, this.inputs)}`];\n result.push(this.payable ? \"payable\" : \"nonpayable\");\n if (this.energy != null) {\n result.push(`@${this.energy.toString()}`);\n }\n return result.join(\" \");\n }\n static from(obj) {\n if (ConstructorFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof obj === \"string\") {\n return ConstructorFragment.from(lex(obj));\n }\n else if (obj instanceof TokenString) {\n consumeKeywords(obj, setify([\"constructor\"]));\n const inputs = consumeParams(obj);\n const payable = !!consumeKeywords(obj, setify([\"payable\"])).has(\"payable\");\n const energy = consumeEnergy(obj);\n consumeEoi(obj);\n return new ConstructorFragment(_guard, \"constructor\", inputs, payable, energy);\n }\n return new ConstructorFragment(_guard, \"constructor\", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, obj.energy != null ? obj.energy : null);\n }\n static isFragment(value) {\n return value && value[internal] === ConstructorFragmentInternal;\n }\n}\n/**\n * A Fragment which represents a method.\n */\nexport class FallbackFragment extends Fragment {\n /**\n * If the function can be sent value during invocation.\n */\n payable;\n constructor(guard, inputs, payable) {\n super(guard, \"fallback\", inputs);\n Object.defineProperty(this, internal, { value: FallbackFragmentInternal });\n defineProperties(this, { payable });\n }\n format(format) {\n const type = this.inputs.length === 0 ? \"receive\" : \"fallback\";\n if (format === \"json\") {\n const stateMutability = this.payable ? \"payable\" : \"nonpayable\";\n return JSON.stringify({ type, stateMutability });\n }\n return `${type}()${this.payable ? \" payable\" : \"\"}`;\n }\n static from(obj) {\n if (FallbackFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof obj === \"string\") {\n return FallbackFragment.from(lex(obj));\n }\n else if (obj instanceof TokenString) {\n const errorObj = obj.toString();\n const topIsValid = obj.peekKeyword(setify([\"fallback\", \"receive\"]));\n assertArgument(topIsValid, \"type must be fallback or receive\", \"obj\", errorObj);\n const type = obj.popKeyword(setify([\"fallback\", \"receive\"]));\n // receive()\n if (type === \"receive\") {\n const inputs = consumeParams(obj);\n assertArgument(inputs.length === 0, `receive cannot have arguments`, \"obj.inputs\", inputs);\n consumeKeywords(obj, setify([\"payable\"]));\n consumeEoi(obj);\n return new FallbackFragment(_guard, [], true);\n }\n // fallback() [payable]\n // fallback(bytes) [payable] returns (bytes)\n let inputs = consumeParams(obj);\n if (inputs.length) {\n assertArgument(inputs.length === 1 && inputs[0].type === \"bytes\", \"invalid fallback inputs\", \"obj.inputs\", inputs.map((i) => i.format(\"minimal\")).join(\", \"));\n }\n else {\n inputs = [ParamType.from(\"bytes\")];\n }\n const mutability = consumeMutability(obj);\n assertArgument(mutability === \"nonpayable\" || mutability === \"payable\", \"fallback cannot be constants\", \"obj.stateMutability\", mutability);\n if (consumeKeywords(obj, setify([\"returns\"])).has(\"returns\")) {\n const outputs = consumeParams(obj);\n assertArgument(outputs.length === 1 && outputs[0].type === \"bytes\", \"invalid fallback outputs\", \"obj.outputs\", outputs.map((i) => i.format(\"minimal\")).join(\", \"));\n }\n consumeEoi(obj);\n return new FallbackFragment(_guard, inputs, mutability === \"payable\");\n }\n if (obj.type === \"receive\") {\n return new FallbackFragment(_guard, [], true);\n }\n if (obj.type === \"fallback\") {\n const inputs = [ParamType.from(\"bytes\")];\n const payable = obj.stateMutability === \"payable\";\n return new FallbackFragment(_guard, inputs, payable);\n }\n assertArgument(false, \"invalid fallback description\", \"obj\", obj);\n }\n static isFragment(value) {\n return value && value[internal] === FallbackFragmentInternal;\n }\n}\n/**\n * A Fragment which represents a method.\n */\nexport class FunctionFragment extends NamedFragment {\n /**\n * If the function is constant (e.g. ``pure`` or ``view`` functions).\n */\n constant;\n /**\n * The returned types for the result of calling this function.\n */\n outputs;\n /**\n * The state mutability (e.g. ``payable``, ``nonpayable``, ``view``\n * or ``pure``)\n */\n stateMutability;\n /**\n * If the function can be sent value during invocation.\n */\n payable;\n /**\n * The amount of energy to send when calling this function\n */\n energy;\n /**\n * @private\n */\n constructor(guard, name, stateMutability, inputs, outputs, energy) {\n super(guard, \"function\", name, inputs);\n Object.defineProperty(this, internal, { value: FunctionFragmentInternal });\n outputs = Object.freeze(outputs.slice());\n const constant = stateMutability === \"view\" || stateMutability === \"pure\";\n const payable = stateMutability === \"payable\";\n defineProperties(this, {\n constant,\n energy,\n outputs,\n payable,\n stateMutability,\n });\n }\n /**\n * The Function selector.\n */\n get selector() {\n return id(this.format(\"sighash\")).substring(0, 10);\n }\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"function\",\n name: this.name,\n constant: this.constant,\n stateMutability: this.stateMutability !== \"nonpayable\"\n ? this.stateMutability\n : undefined,\n payable: this.payable,\n energy: this.energy != null ? this.energy : undefined,\n inputs: this.inputs.map((i) => JSON.parse(i.format(format))),\n outputs: this.outputs.map((o) => JSON.parse(o.format(format))),\n });\n }\n const result = [];\n if (format !== \"sighash\") {\n result.push(\"function\");\n }\n result.push(this.name + joinParams(format, this.inputs));\n if (format !== \"sighash\") {\n if (this.stateMutability !== \"nonpayable\") {\n result.push(this.stateMutability);\n }\n if (this.outputs && this.outputs.length) {\n result.push(\"returns\");\n result.push(joinParams(format, this.outputs));\n }\n if (this.energy != null) {\n result.push(`@${this.energy.toString()}`);\n }\n }\n return result.join(\" \");\n }\n static getSelector(name, params) {\n params = (params || []).map((p) => ParamType.from(p));\n const fragment = new FunctionFragment(_guard, name, \"view\", params, [], null);\n return fragment.selector;\n }\n static from(obj) {\n if (FunctionFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof obj === \"string\") {\n return FunctionFragment.from(lex(obj));\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"function\", obj);\n const inputs = consumeParams(obj);\n const mutability = consumeMutability(obj);\n let outputs = [];\n if (consumeKeywords(obj, setify([\"returns\"])).has(\"returns\")) {\n outputs = consumeParams(obj);\n }\n const energy = consumeEnergy(obj);\n consumeEoi(obj);\n return new FunctionFragment(_guard, name, mutability, inputs, outputs, energy);\n }\n let stateMutability = obj.stateMutability;\n // Use legacy Solidity ABI logic if stateMutability is missing\n if (stateMutability == null) {\n stateMutability = \"payable\";\n if (typeof obj.constant === \"boolean\") {\n stateMutability = \"view\";\n if (!obj.constant) {\n stateMutability = \"payable\";\n if (typeof obj.payable === \"boolean\" && !obj.payable) {\n stateMutability = \"nonpayable\";\n }\n }\n }\n else if (typeof obj.payable === \"boolean\" && !obj.payable) {\n stateMutability = \"nonpayable\";\n }\n }\n // @TODO: verifyState for stateMutability (e.g. throw if\n // payable: false but stateMutability is \"nonpayable\")\n return new FunctionFragment(_guard, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], obj.energy != null ? obj.energy : null);\n }\n static isFragment(value) {\n return value && value[internal] === FunctionFragmentInternal;\n }\n}\n/**\n * A Fragment which represents a structure.\n */\nexport class StructFragment extends NamedFragment {\n /**\n * @private\n */\n constructor(guard, name, inputs) {\n super(guard, \"struct\", name, inputs);\n Object.defineProperty(this, internal, { value: StructFragmentInternal });\n }\n format() {\n throw new Error(\"@TODO\");\n }\n static from(obj) {\n if (typeof obj === \"string\") {\n return StructFragment.from(lex(obj));\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"struct\", obj);\n const inputs = consumeParams(obj);\n consumeEoi(obj);\n return new StructFragment(_guard, name, inputs);\n }\n return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);\n }\n static isFragment(value) {\n return value && value[internal] === StructFragmentInternal;\n }\n}\n//# sourceMappingURL=fragments.js.map","/**\n * When sending values to or receiving values from a [[Contract]], the\n * data is generally encoded using the [ABI standard](link-solc-abi).\n *\n * The AbiCoder provides a utility to encode values to ABI data and\n * decode values from ABI data.\n *\n * Most of the time, developers should favour the [[Contract]] class,\n * which further abstracts a lot of the finer details of ABI data.\n *\n * @_section api/abi/abi-coder:ABI Encoding\n */\nimport { assertArgumentCount, assertArgument } from \"../utils/index.js\";\nimport { Reader, Writer } from \"./coders/abstract-coder.js\";\nimport { AddressCoder } from \"./coders/address.js\";\nimport { ArrayCoder } from \"./coders/array.js\";\nimport { BooleanCoder } from \"./coders/boolean.js\";\nimport { BytesCoder } from \"./coders/bytes.js\";\nimport { FixedBytesCoder } from \"./coders/fixed-bytes.js\";\nimport { NullCoder } from \"./coders/null.js\";\nimport { NumberCoder } from \"./coders/number.js\";\nimport { StringCoder } from \"./coders/string.js\";\nimport { TupleCoder } from \"./coders/tuple.js\";\nimport { ParamType } from \"./fragments.js\";\nimport { getAddress } from \"../address/index.js\";\nimport { getBytes, hexlify, makeError } from \"../utils/index.js\";\n// https://docs.soliditylang.org/en/v0.8.17/control-structures.html\nconst PanicReasons = new Map();\nPanicReasons.set(0x00, \"GENERIC_PANIC\");\nPanicReasons.set(0x01, \"ASSERT_FALSE\");\nPanicReasons.set(0x11, \"OVERFLOW\");\nPanicReasons.set(0x12, \"DIVIDE_BY_ZERO\");\nPanicReasons.set(0x21, \"ENUM_RANGE_ERROR\");\nPanicReasons.set(0x22, \"BAD_STORAGE_DATA\");\nPanicReasons.set(0x31, \"STACK_UNDERFLOW\");\nPanicReasons.set(0x32, \"ARRAY_RANGE_ERROR\");\nPanicReasons.set(0x41, \"OUT_OF_MEMORY\");\nPanicReasons.set(0x51, \"UNINITIALIZED_FUNCTION_CALL\");\nconst paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);\nconst paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);\nlet defaultCoder = null;\nfunction getBuiltinCallException(action, tx, data, abiCoder) {\n let message = \"missing revert data\";\n let reason = null;\n const invocation = null;\n let revert = null;\n if (data) {\n message = \"execution reverted\";\n const bytes = getBytes(data);\n data = hexlify(data);\n if (bytes.length === 0) {\n message += \" (no data present; likely require(false) occurred\";\n reason = \"require(false)\";\n }\n else if (bytes.length % 32 !== 4) {\n message += \" (could not decode reason; invalid data length)\";\n }\n else if (hexlify(bytes.slice(0, 4)) === \"0x08c379a0\") {\n // Error(string)\n try {\n reason = abiCoder.decode([\"string\"], bytes.slice(4))[0];\n revert = {\n signature: \"Error(string)\",\n name: \"Error\",\n args: [reason],\n };\n message += `: ${JSON.stringify(reason)}`;\n }\n catch (error) {\n message += \" (could not decode reason; invalid string data)\";\n }\n }\n else if (hexlify(bytes.slice(0, 4)) === \"0x4e487b71\") {\n // Panic(uint256)\n try {\n const code = Number(abiCoder.decode([\"uint256\"], bytes.slice(4))[0]);\n revert = {\n signature: \"Panic(uint256)\",\n name: \"Panic\",\n args: [code],\n };\n reason = `Panic due to ${PanicReasons.get(code) || \"UNKNOWN\"}(${code})`;\n message += `: ${reason}`;\n }\n catch (error) {\n message += \" (could not decode panic code)\";\n }\n }\n else {\n message += \" (unknown custom error)\";\n }\n }\n const transaction = {\n to: tx.to ? getAddress(tx.to) : null,\n data: tx.data || \"0x\",\n };\n if (tx.from) {\n transaction.from = getAddress(tx.from);\n }\n return makeError(message, \"CALL_EXCEPTION\", {\n action,\n data,\n reason,\n transaction,\n invocation,\n revert,\n });\n}\n/**\n * About AbiCoder\n */\nexport class AbiCoder {\n #getCoder(param) {\n if (param.isArray()) {\n return new ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name);\n }\n if (param.isTuple()) {\n return new TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name);\n }\n switch (param.baseType) {\n case \"address\":\n return new AddressCoder(param.name);\n case \"bool\":\n return new BooleanCoder(param.name);\n case \"string\":\n return new StringCoder(param.name);\n case \"bytes\":\n return new BytesCoder(param.name);\n case \"\":\n return new NullCoder(param.name);\n }\n // u?int[0-9]*\n let match = param.type.match(paramTypeNumber);\n if (match) {\n let size = parseInt(match[2] || \"256\");\n assertArgument(size !== 0 && size <= 256 && size % 8 === 0, \"invalid \" + match[1] + \" bit length\", \"param\", param);\n return new NumberCoder(size / 8, match[1] === \"int\", param.name);\n }\n // bytes[0-9]+\n match = param.type.match(paramTypeBytes);\n if (match) {\n let size = parseInt(match[1]);\n assertArgument(size !== 0 && size <= 32, \"invalid bytes length\", \"param\", param);\n return new FixedBytesCoder(size, param.name);\n }\n assertArgument(false, \"invalid type\", \"type\", param.type);\n }\n /**\n * Get the default values for the given %%types%%.\n *\n * For example, a ``uint`` is by default ``0`` and ``bool``\n * is by default ``false``.\n */\n getDefaultValue(types) {\n const coders = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n return coder.defaultValue();\n }\n /**\n * Encode the %%values%% as the %%types%% into ABI data.\n *\n * @returns DataHexstring\n */\n encode(types, values) {\n assertArgumentCount(values.length, types.length, \"types/values length mismatch\");\n const coders = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n const writer = new Writer();\n coder.encode(writer, values);\n return writer.data;\n }\n /**\n * Decode the ABI %%data%% as the %%types%% into values.\n *\n * If %%loose%% decoding is enabled, then strict padding is\n * not enforced. Some older versions of Solidity incorrectly\n * padded event data emitted from ``external`` functions.\n */\n decode(types, data, loose) {\n const coders = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n return coder.decode(new Reader(data, loose));\n }\n /**\n * Returns the shared singleton instance of a default [[AbiCoder]].\n *\n * On the first call, the instance is created internally.\n */\n static defaultAbiCoder() {\n if (defaultCoder == null) {\n defaultCoder = new AbiCoder();\n }\n return defaultCoder;\n }\n /**\n * Returns an corebc-compatible [[CallExceptionError]] Error for the given\n * result %%data%% for the [[CallExceptionAction]] %%action%% against\n * the Transaction %%tx%%.\n */\n static getBuiltinCallException(action, tx, data) {\n return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder());\n }\n}\n//# sourceMappingURL=abi-coder.js.map","/**\n * About bytes32 strings...\n *\n * @_docloc: api/utils:Bytes32 Strings\n */\nimport { getBytes, toUtf8Bytes, toUtf8String, zeroPadBytes, } from \"../utils/index.js\";\n/**\n * Encodes %%text%% as a Bytes32 string.\n */\nexport function encodeBytes32String(text) {\n // Get the bytes\n const bytes = toUtf8Bytes(text);\n // Check we have room for null-termination\n if (bytes.length > 31) {\n throw new Error(\"bytes32 string must be less than 32 bytes\");\n }\n // Zero-pad (implicitly null-terminates)\n return zeroPadBytes(bytes, 32);\n}\n/**\n * Encodes the Bytes32-encoded %%bytes%% into a string.\n */\nexport function decodeBytes32String(_bytes) {\n const data = getBytes(_bytes, \"bytes\");\n // Must be 32 bytes with a null-termination\n if (data.length !== 32) {\n throw new Error(\"invalid bytes32 - not 32 bytes long\");\n }\n if (data[31] !== 0) {\n throw new Error(\"invalid bytes32 string - no null terminator\");\n }\n // Find the null termination\n let length = 31;\n while (data[length - 1] === 0) {\n length--;\n }\n // Determine the string value\n return toUtf8String(data.slice(0, length));\n}\n//# sourceMappingURL=bytes32.js.map","/**\n * About Interface\n *\n * @_subsection api/abi:Interfaces [interfaces]\n */\nimport { id } from \"../hash/index.js\";\nimport { concat, dataSlice, getBigInt, getBytes, getBytesCopy, hexlify, zeroPadValue, isHexString, defineProperties, assertArgument, toBeHex, assert, } from \"../utils/index.js\";\nimport { AbiCoder } from \"./abi-coder.js\";\nimport { checkResultErrors, Result } from \"./coders/abstract-coder.js\";\nimport { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, } from \"./fragments.js\";\nimport { Typed } from \"./typed.js\";\nimport { sha256 } from \"../crypto/sha3.js\";\nexport { checkResultErrors, Result };\nexport class LogDescription {\n fragment;\n name;\n signature;\n topic;\n args;\n constructor(fragment, topic, args) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment,\n name,\n signature,\n topic,\n args,\n });\n }\n}\nexport class TransactionDescription {\n fragment;\n name;\n args;\n signature;\n selector;\n value;\n constructor(fragment, selector, args, value) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment,\n name,\n args,\n signature,\n selector,\n value,\n });\n }\n}\nexport class ErrorDescription {\n fragment;\n name;\n args;\n signature;\n selector;\n constructor(fragment, selector, args) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment,\n name,\n args,\n signature,\n selector,\n });\n }\n}\nexport class Indexed {\n hash;\n _isIndexed;\n static isIndexed(value) {\n return !!(value && value._isIndexed);\n }\n constructor(hash) {\n defineProperties(this, { hash, _isIndexed: true });\n }\n}\n// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require\nconst PanicReasons = {\n \"0\": \"generic panic\",\n \"1\": \"assert(false)\",\n \"17\": \"arithmetic overflow\",\n \"18\": \"division or modulo by zero\",\n \"33\": \"enum overflow\",\n \"34\": \"invalid encoded storage byte array accessed\",\n \"49\": \"out-of-bounds array access; popping on an empty array\",\n \"50\": \"out-of-bounds access of an array or bytesN\",\n \"65\": \"out of memory\",\n \"81\": \"uninitialized function\",\n};\nconst BuiltinErrors = {\n \"0x08c379a0\": {\n signature: \"Error(string)\",\n name: \"Error\",\n inputs: [\"string\"],\n reason: (message) => {\n return `reverted with reason string ${JSON.stringify(message)}`;\n },\n },\n \"0x4e487b71\": {\n signature: \"Panic(uint256)\",\n name: \"Panic\",\n inputs: [\"uint256\"],\n reason: (code) => {\n let reason = \"unknown panic code\";\n if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) {\n reason = PanicReasons[code.toString()];\n }\n return `reverted with panic code 0x${code.toString(16)} (${reason})`;\n },\n },\n};\n/**\n * An Interface abstracts many of the low-level details for\n * encoding and decoding the data on the blockchain.\n *\n * An ABI provides information on how to encode data to send to\n * a Contract, how to decode the results and events and how to\n * interpret revert errors.\n *\n * The ABI can be specified by [any supported format](InterfaceAbi).\n */\nexport class Interface {\n /**\n * All the Contract ABI members (i.e. methods, events, errors, etc).\n */\n fragments;\n /**\n * The Contract constructor.\n */\n deploy;\n /**\n * The Fallback method, if any.\n */\n fallback;\n /**\n * If receiving xcb is supported.\n */\n receive;\n #errors;\n #events;\n #functions;\n // #structs: Map;\n #abiCoder;\n /**\n * Create a new Interface for the %%fragments%%.\n */\n constructor(fragments) {\n let abi = [];\n if (typeof fragments === \"string\") {\n abi = JSON.parse(fragments);\n }\n else {\n abi = fragments;\n }\n this.#functions = new Map();\n this.#errors = new Map();\n this.#events = new Map();\n // this.#structs = new Map();\n const frags = [];\n for (const a of abi) {\n try {\n frags.push(Fragment.from(a));\n }\n catch (error) {\n console.log(\"EE\", error);\n }\n }\n defineProperties(this, {\n fragments: Object.freeze(frags),\n });\n let fallback = null;\n let receive = false;\n this.#abiCoder = this.getAbiCoder();\n // Add all fragments by their signature\n this.fragments.forEach((fragment, index) => {\n let bucket;\n switch (fragment.type) {\n case \"constructor\":\n if (this.deploy) {\n console.log(\"duplicate definition - constructor\");\n return;\n }\n //checkNames(fragment, \"input\", fragment.inputs);\n defineProperties(this, {\n deploy: fragment,\n });\n return;\n case \"fallback\":\n if (fragment.inputs.length === 0) {\n receive = true;\n }\n else {\n assertArgument(!fallback ||\n fragment.payable !== fallback.payable, \"conflicting fallback fragments\", `fragments[${index}]`, fragment);\n fallback = fragment;\n receive = fallback.payable;\n }\n return;\n case \"function\":\n //checkNames(fragment, \"input\", fragment.inputs);\n //checkNames(fragment, \"output\", (fragment).outputs);\n bucket = this.#functions;\n break;\n case \"event\":\n //checkNames(fragment, \"input\", fragment.inputs);\n bucket = this.#events;\n break;\n case \"error\":\n bucket = this.#errors;\n break;\n default:\n return;\n }\n // Two identical entries; ignore it\n const signature = fragment.format();\n if (bucket.has(signature)) {\n return;\n }\n bucket.set(signature, fragment);\n });\n // If we do not have a constructor add a default\n if (!this.deploy) {\n defineProperties(this, {\n deploy: ConstructorFragment.from(\"constructor()\"),\n });\n }\n defineProperties(this, { fallback, receive });\n }\n /**\n * Returns the entire Human-Readable ABI, as an array of\n * signatures, optionally as %%minimal%% strings, which\n * removes parameter names and unneceesary spaces.\n */\n format(minimal) {\n const format = minimal ? \"minimal\" : \"full\";\n const abi = this.fragments.map((f) => f.format(format));\n return abi;\n }\n /**\n * Return the JSON-encoded ABI. This is the format Solidiy\n * returns.\n */\n formatJson() {\n const abi = this.fragments.map((f) => f.format(\"json\"));\n // We need to re-bundle the JSON fragments a bit\n return JSON.stringify(abi.map((j) => JSON.parse(j)));\n }\n /**\n * The ABI coder that will be used to encode and decode binary\n * data.\n */\n getAbiCoder() {\n return AbiCoder.defaultAbiCoder();\n }\n // Find a function definition by any means necessary (unless it is ambiguous)\n #getFunction(key, values, forceUnique) {\n // Selector\n if (isHexString(key)) {\n const selector = key.toLowerCase();\n for (const fragment of this.#functions.values()) {\n if (selector === fragment.selector) {\n return fragment;\n }\n }\n return null;\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching = [];\n for (const [name, fragment] of this.#functions) {\n if (name.split(\"(\" /* fix:) */)[0] === key) {\n matching.push(fragment);\n }\n }\n if (values) {\n const lastValue = values.length > 0 ? values[values.length - 1] : null;\n let valueLength = values.length;\n let allowOptions = true;\n if (Typed.isTyped(lastValue) && lastValue.type === \"overrides\") {\n allowOptions = false;\n valueLength--;\n }\n // Remove all matches that don't have a compatible length. The args\n // may contain an overrides, so the match may have n or n - 1 parameters\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs.length;\n if (inputs !== valueLength &&\n (!allowOptions || inputs !== valueLength - 1)) {\n matching.splice(i, 1);\n }\n }\n // Remove all matches that don't match the Typed signature\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs;\n for (let j = 0; j < values.length; j++) {\n // Not a typed value\n if (!Typed.isTyped(values[j])) {\n continue;\n }\n // We are past the inputs\n if (j >= inputs.length) {\n if (values[j].type === \"overrides\") {\n continue;\n }\n matching.splice(i, 1);\n break;\n }\n // Make sure the value type matches the input type\n if (values[j].type !== inputs[j].baseType) {\n matching.splice(i, 1);\n break;\n }\n }\n }\n }\n // We found a single matching signature with an overrides, but the\n // last value is something that cannot possibly be an options\n if (matching.length === 1 &&\n values &&\n values.length !== matching[0].inputs.length) {\n const lastArg = values[values.length - 1];\n if (lastArg == null ||\n Array.isArray(lastArg) ||\n typeof lastArg !== \"object\") {\n matching.splice(0, 1);\n }\n }\n if (matching.length === 0) {\n return null;\n }\n if (matching.length > 1 && forceUnique) {\n const matchStr = matching\n .map((m) => JSON.stringify(m.format()))\n .join(\", \");\n assertArgument(false, `ambiguous function description (i.e. matches ${matchStr})`, \"key\", key);\n }\n return matching[0];\n }\n // Normalize the signature and lookup the function\n const result = this.#functions.get(FunctionFragment.from(key).format());\n if (result) {\n return result;\n }\n return null;\n }\n /**\n * Get the function name for %%key%%, which may be a function selector,\n * function name or function signature that belongs to the ABI.\n */\n getFunctionName(key) {\n const fragment = this.#getFunction(key, null, false);\n assertArgument(fragment, \"no matching function\", \"key\", key);\n return fragment.name;\n }\n /**\n * Returns true if %%key%% (a function selector, function name or\n * function signature) is present in the ABI.\n *\n * In the case of a function name, the name may be ambiguous, so\n * accessing the [[FunctionFragment]] may require refinement.\n */\n hasFunction(key) {\n return !!this.#getFunction(key, null, false);\n }\n /**\n * Get the [[FunctionFragment]] for %%key%%, which may be a function\n * selector, function name or function signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple functions match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single function in\n * the ABI, this will throw.\n */\n getFunction(key, values) {\n return this.#getFunction(key, values || null, true);\n }\n /**\n * Iterate over all functions, calling %%callback%%, sorted by their name.\n */\n forEachFunction(callback) {\n const names = Array.from(this.#functions.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback(this.#functions.get(name), i);\n }\n }\n // Find an event definition by any means necessary (unless it is ambiguous)\n #getEvent(key, values, forceUnique) {\n // EventTopic\n if (isHexString(key)) {\n const eventTopic = key.toLowerCase();\n for (const fragment of this.#events.values()) {\n if (eventTopic === fragment.topicHash) {\n return fragment;\n }\n }\n return null;\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching = [];\n for (const [name, fragment] of this.#events) {\n if (name.split(\"(\" /* fix:) */)[0] === key) {\n matching.push(fragment);\n }\n }\n if (values) {\n // Remove all matches that don't have a compatible length.\n for (let i = matching.length - 1; i >= 0; i--) {\n if (matching[i].inputs.length < values.length) {\n matching.splice(i, 1);\n }\n }\n // Remove all matches that don't match the Typed signature\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs;\n for (let j = 0; j < values.length; j++) {\n // Not a typed value\n if (!Typed.isTyped(values[j])) {\n continue;\n }\n // Make sure the value type matches the input type\n if (values[j].type !== inputs[j].baseType) {\n matching.splice(i, 1);\n break;\n }\n }\n }\n }\n if (matching.length === 0) {\n return null;\n }\n if (matching.length > 1 && forceUnique) {\n const matchStr = matching\n .map((m) => JSON.stringify(m.format()))\n .join(\", \");\n assertArgument(false, `ambiguous event description (i.e. matches ${matchStr})`, \"key\", key);\n }\n return matching[0];\n }\n // Normalize the signature and lookup the function\n const result = this.#events.get(EventFragment.from(key).format());\n if (result) {\n return result;\n }\n return null;\n }\n /**\n * Get the event name for %%key%%, which may be a topic hash,\n * event name or event signature that belongs to the ABI.\n */\n getEventName(key) {\n const fragment = this.#getEvent(key, null, false);\n assertArgument(fragment, \"no matching event\", \"key\", key);\n return fragment.name;\n }\n /**\n * Returns true if %%key%% (an event topic hash, event name or\n * event signature) is present in the ABI.\n *\n * In the case of an event name, the name may be ambiguous, so\n * accessing the [[EventFragment]] may require refinement.\n */\n hasEvent(key) {\n return !!this.#getEvent(key, null, false);\n }\n /**\n * Get the [[EventFragment]] for %%key%%, which may be a topic hash,\n * event name or event signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple events match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single event in\n * the ABI, this will throw.\n */\n getEvent(key, values) {\n return this.#getEvent(key, values || null, true);\n }\n /**\n * Iterate over all events, calling %%callback%%, sorted by their name.\n */\n forEachEvent(callback) {\n const names = Array.from(this.#events.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback(this.#events.get(name), i);\n }\n }\n /**\n * Get the [[ErrorFragment]] for %%key%%, which may be an error\n * selector, error name or error signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple errors match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single error in\n * the ABI, this will throw.\n */\n getError(key, values) {\n if (isHexString(key)) {\n const selector = key.toLowerCase();\n if (BuiltinErrors[selector]) {\n return ErrorFragment.from(BuiltinErrors[selector].signature);\n }\n for (const fragment of this.#errors.values()) {\n if (selector === fragment.selector) {\n return fragment;\n }\n }\n return null;\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching = [];\n for (const [name, fragment] of this.#errors) {\n if (name.split(\"(\" /* fix:) */)[0] === key) {\n matching.push(fragment);\n }\n }\n if (matching.length === 0) {\n if (key === \"Error\") {\n return ErrorFragment.from(\"error Error(string)\");\n }\n if (key === \"Panic\") {\n return ErrorFragment.from(\"error Panic(uint256)\");\n }\n return null;\n }\n else if (matching.length > 1) {\n const matchStr = matching\n .map((m) => JSON.stringify(m.format()))\n .join(\", \");\n assertArgument(false, `ambiguous error description (i.e. ${matchStr})`, \"name\", key);\n }\n return matching[0];\n }\n // Normalize the signature and lookup the function\n key = ErrorFragment.from(key).format();\n if (key === \"Error(string)\") {\n return ErrorFragment.from(\"error Error(string)\");\n }\n if (key === \"Panic(uint256)\") {\n return ErrorFragment.from(\"error Panic(uint256)\");\n }\n const result = this.#errors.get(key);\n if (result) {\n return result;\n }\n return null;\n }\n /**\n * Iterate over all errors, calling %%callback%%, sorted by their name.\n */\n forEachError(callback) {\n const names = Array.from(this.#errors.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback(this.#errors.get(name), i);\n }\n }\n // Get the 4-byte selector used by Solidity to identify a function\n /*\n getSelector(fragment: ErrorFragment | FunctionFragment): string {\n if (typeof(fragment) === \"string\") {\n const matches: Array = [ ];\n \n try { matches.push(this.getFunction(fragment)); } catch (error) { }\n try { matches.push(this.getError(fragment)); } catch (_) { }\n \n if (matches.length === 0) {\n logger.throwArgumentError(\"unknown fragment\", \"key\", fragment);\n } else if (matches.length > 1) {\n logger.throwArgumentError(\"ambiguous fragment matches function and error\", \"key\", fragment);\n }\n \n fragment = matches[0];\n }\n \n return dataSlice(id(fragment.format()), 0, 4);\n }\n */\n // Get the 32-byte topic hash used by Solidity to identify an event\n /*\n getEventTopic(fragment: EventFragment): string {\n //if (typeof(fragment) === \"string\") { fragment = this.getEvent(eventFragment); }\n return id(fragment.format());\n }\n */\n _decodeParams(params, data) {\n return this.#abiCoder.decode(params, data);\n }\n _encodeParams(params, values) {\n return this.#abiCoder.encode(params, values);\n }\n /**\n * Encodes a ``tx.data`` object for deploying the Contract with\n * the %%values%% as the constructor arguments.\n */\n encodeDeploy(values) {\n return this._encodeParams(this.deploy.inputs, values || []);\n }\n /**\n * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the\n * specified error (see [[getError]] for valid values for\n * %%key%%).\n *\n * Most developers should prefer the [[parseCallResult]] method instead,\n * which will automatically detect a ``CALL_EXCEPTION`` and throw the\n * corresponding error.\n */\n decodeErrorResult(fragment, data) {\n if (typeof fragment === \"string\") {\n const f = this.getError(fragment);\n assertArgument(f, \"unknown error\", \"fragment\", fragment);\n fragment = f;\n }\n assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, \"data\", data);\n return this._decodeParams(fragment.inputs, dataSlice(data, 4));\n }\n /**\n * Encodes the transaction revert data for a call result that\n * reverted from the the Contract with the sepcified %%error%%\n * (see [[getError]] for valid values for %%fragment%%) with the %%values%%.\n *\n * This is generally not used by most developers, unless trying to mock\n * a result from a Contract.\n */\n encodeErrorResult(fragment, values) {\n if (typeof fragment === \"string\") {\n const f = this.getError(fragment);\n assertArgument(f, \"unknown error\", \"fragment\", fragment);\n fragment = f;\n }\n return concat([\n fragment.selector,\n this._encodeParams(fragment.inputs, values || []),\n ]);\n }\n /**\n * Decodes the %%data%% from a transaction ``tx.data`` for\n * the function specified (see [[getFunction]] for valid values\n * for %%fragment%%).\n *\n * Most developers should prefer the [[parseTransaction]] method\n * instead, which will automatically detect the fragment.\n */\n decodeFunctionData(fragment, data) {\n if (typeof fragment === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, \"data\", data);\n return this._decodeParams(fragment.inputs, dataSlice(data, 4));\n }\n /**\n * Encodes the ``tx.data`` for a transaction that calls the function\n * specified (see [[getFunction]] for valid values for %%fragment%%) with\n * the %%values%%.\n */\n encodeFunctionData(fragment, values) {\n if (typeof fragment === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n return concat([\n fragment.selector,\n this._encodeParams(fragment.inputs, values || []),\n ]);\n }\n /**\n * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the\n * specified function (see [[getFunction]] for valid values for\n * %%key%%).\n *\n * Most developers should prefer the [[parseCallResult]] method instead,\n * which will automatically detect a ``CALL_EXCEPTION`` and throw the\n * corresponding error.\n */\n decodeFunctionResult(fragment, data) {\n if (typeof fragment === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n let message = \"invalid length for result data\";\n const bytes = getBytesCopy(data);\n if (bytes.length % 32 === 0) {\n try {\n return this.#abiCoder.decode(fragment.outputs, bytes);\n }\n catch (error) {\n message = \"could not decode result data\";\n }\n }\n // Call returned data with no error, but the data is junk\n assert(false, message, \"BAD_DATA\", {\n value: hexlify(bytes),\n info: { method: fragment.name, signature: fragment.format() },\n });\n }\n makeError(_data, tx) {\n const data = getBytes(_data, \"data\");\n const error = AbiCoder.getBuiltinCallException(\"call\", tx, data);\n // Not a built-in error; try finding a custom error\n const customPrefix = \"execution reverted (unknown custom error)\";\n if (error.message.startsWith(customPrefix)) {\n const selector = hexlify(data.slice(0, 4));\n const ef = this.getError(selector);\n if (ef) {\n try {\n const args = this.#abiCoder.decode(ef.inputs, data.slice(4));\n error.revert = {\n name: ef.name,\n signature: ef.format(),\n args,\n };\n error.reason = error.revert.signature;\n error.message = `execution reverted: ${error.reason}`;\n }\n catch (e) {\n error.message = `execution reverted (coult not decode custom error)`;\n }\n }\n }\n // Add the invocation, if available\n const parsed = this.parseTransaction(tx);\n if (parsed) {\n error.invocation = {\n method: parsed.name,\n signature: parsed.signature,\n args: parsed.args,\n };\n }\n return error;\n }\n /**\n * Encodes the result data (e.g. from an ``xcb_call``) for the\n * specified function (see [[getFunction]] for valid values\n * for %%fragment%%) with %%values%%.\n *\n * This is generally not used by most developers, unless trying to mock\n * a result from a Contract.\n */\n encodeFunctionResult(fragment, values) {\n if (typeof fragment === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n return hexlify(this.#abiCoder.encode(fragment.outputs, values || []));\n }\n /*\n spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> {\n const promises: Array> = [ ];\n const process = function(type: ParamType, value: any): any {\n if (type.baseType === \"array\") {\n return descend(type.child\n }\n if (type. === \"address\") {\n }\n };\n \n const descend = function (inputs: Array, values: ReadonlyArray) {\n if (inputs.length !== values.length) { throw new Error(\"length mismatch\"); }\n };\n \n const result: Array = [ ];\n values.forEach((value, index) => {\n if (value == null) {\n topics.push(null);\n } else if (param.baseType === \"array\" || param.baseType === \"tuple\") {\n logger.throwArgumentError(\"filtering with tuples or arrays not supported\", (\"contract.\" + param.name), value);\n } else if (Array.isArray(value)) {\n topics.push(value.map((value) => encodeTopic(param, value)));\n } else {\n topics.push(encodeTopic(param, value));\n }\n });\n }\n */\n // Create the filter for the event with search criteria (e.g. for xcb_filterLog)\n encodeFilterTopics(fragment, values) {\n if (typeof fragment === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n assert(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, \"UNEXPECTED_ARGUMENT\", { count: values.length, expectedCount: fragment.inputs.length });\n const topics = [];\n if (!fragment.anonymous) {\n topics.push(fragment.topicHash);\n }\n // @TODO: Use the coders for this; to properly support tuples, etc.\n const encodeTopic = (param, value) => {\n if (param.type === \"string\") {\n return id(value);\n }\n else if (param.type === \"bytes\") {\n return sha256(hexlify(value));\n }\n if (param.type === \"bool\" && typeof value === \"boolean\") {\n value = value ? \"0x01\" : \"0x00\";\n }\n if (param.type.match(/^u?int/)) {\n value = toBeHex(value);\n }\n // Check addresses are valid\n if (param.type === \"address\") {\n this.#abiCoder.encode([\"address\"], [value]);\n }\n return zeroPadValue(hexlify(value), 32);\n //@TOOD should probably be return toHex(value, 32)\n };\n values.forEach((value, index) => {\n const param = fragment.inputs[index];\n if (!param.indexed) {\n assertArgument(value == null, \"cannot filter non-indexed parameters; must be null\", \"contract.\" + param.name, value);\n return;\n }\n if (value == null) {\n topics.push(null);\n }\n else if (param.baseType === \"array\" || param.baseType === \"tuple\") {\n assertArgument(false, \"filtering with tuples or arrays not supported\", \"contract.\" + param.name, value);\n }\n else if (Array.isArray(value)) {\n topics.push(value.map((value) => encodeTopic(param, value)));\n }\n else {\n topics.push(encodeTopic(param, value));\n }\n });\n // Trim off trailing nulls\n while (topics.length && topics[topics.length - 1] === null) {\n topics.pop();\n }\n return topics;\n }\n encodeEventLog(fragment, values) {\n if (typeof fragment === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n const topics = [];\n const dataTypes = [];\n const dataValues = [];\n if (!fragment.anonymous) {\n topics.push(fragment.topicHash);\n }\n assertArgument(values.length === fragment.inputs.length, \"event arguments/values mismatch\", \"values\", values);\n fragment.inputs.forEach((param, index) => {\n const value = values[index];\n if (param.indexed) {\n if (param.type === \"string\") {\n topics.push(id(value));\n }\n else if (param.type === \"bytes\") {\n topics.push(sha256(value));\n }\n else if (param.baseType === \"tuple\" || param.baseType === \"array\") {\n // @TODO\n throw new Error(\"not implemented\");\n }\n else {\n topics.push(this.#abiCoder.encode([param.type], [value]));\n }\n }\n else {\n dataTypes.push(param);\n dataValues.push(value);\n }\n });\n return {\n data: this.#abiCoder.encode(dataTypes, dataValues),\n topics: topics,\n };\n }\n // Decode a filter for the event and the search criteria\n decodeEventLog(fragment, data, topics) {\n if (typeof fragment === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n if (topics != null && !fragment.anonymous) {\n const eventTopic = fragment.topicHash;\n assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, \"fragment/topic mismatch\", \"topics[0]\", topics[0]);\n topics = topics.slice(1);\n }\n const indexed = [];\n const nonIndexed = [];\n const dynamic = [];\n fragment.inputs.forEach((param, index) => {\n if (param.indexed) {\n if (param.type === \"string\" ||\n param.type === \"bytes\" ||\n param.baseType === \"tuple\" ||\n param.baseType === \"array\") {\n indexed.push(ParamType.from({ type: \"bytes32\", name: param.name }));\n dynamic.push(true);\n }\n else {\n indexed.push(param);\n dynamic.push(false);\n }\n }\n else {\n nonIndexed.push(param);\n dynamic.push(false);\n }\n });\n const resultIndexed = topics != null ? this.#abiCoder.decode(indexed, concat(topics)) : null;\n const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true);\n //const result: (Array & { [ key: string ]: any }) = [ ];\n const values = [];\n const keys = [];\n let nonIndexedIndex = 0, indexedIndex = 0;\n fragment.inputs.forEach((param, index) => {\n let value = null;\n if (param.indexed) {\n if (resultIndexed == null) {\n value = new Indexed(null);\n }\n else if (dynamic[index]) {\n value = new Indexed(resultIndexed[indexedIndex++]);\n }\n else {\n try {\n value = resultIndexed[indexedIndex++];\n }\n catch (error) {\n value = error;\n }\n }\n }\n else {\n try {\n value = resultNonIndexed[nonIndexedIndex++];\n }\n catch (error) {\n value = error;\n }\n }\n values.push(value);\n keys.push(param.name || null);\n });\n return Result.fromItems(values, keys);\n }\n /**\n * Parses a transaction, finding the matching function and extracts\n * the parameter values along with other useful function details.\n *\n * If the matching function cannot be found, return null.\n */\n parseTransaction(tx) {\n const data = getBytes(tx.data, \"tx.data\");\n const value = getBigInt(tx.value != null ? tx.value : 0, \"tx.value\");\n const fragment = this.getFunction(hexlify(data.slice(0, 4)));\n if (!fragment) {\n return null;\n }\n const args = this.#abiCoder.decode(fragment.inputs, data.slice(4));\n return new TransactionDescription(fragment, fragment.selector, args, value);\n }\n parseCallResult(data) {\n throw new Error(\"@TODO\");\n }\n /**\n * Parses a receipt log, finding the matching event and extracts\n * the parameter values along with other useful event details.\n *\n * If the matching event cannot be found, returns null.\n */\n parseLog(log) {\n const fragment = this.getEvent(log.topics[0]);\n if (!fragment || fragment.anonymous) {\n return null;\n }\n // @TODO: If anonymous, and the only method, and the input count matches, should we parse?\n // Probably not, because just because it is the only event in the ABI does\n // not mean we have the full ABI; maybe just a fragment?\n return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics));\n }\n /**\n * Parses a revert data, finding the matching error and extracts\n * the parameter values along with other useful error details.\n *\n * If the matching event cannot be found, returns null.\n */\n parseError(data) {\n const hexData = hexlify(data);\n const fragment = this.getError(dataSlice(hexData, 0, 4));\n if (!fragment) {\n return null;\n }\n const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4));\n return new ErrorDescription(fragment, fragment.selector, args);\n }\n /**\n * Creates a new [[Interface]] from the ABI %%value%%.\n *\n * The %%value%% may be provided as an existing [[Interface]] object,\n * a JSON-encoded ABI or any Human-Readable ABI format.\n */\n static from(value) {\n // Already an Interface, which is immutable\n if (value instanceof Interface) {\n return value;\n }\n // JSON\n if (typeof value === \"string\") {\n return new Interface(JSON.parse(value));\n }\n // Maybe an interface from an older version, or from a symlinked copy\n if (typeof value.format === \"function\") {\n return new Interface(value.format(\"json\"));\n }\n // Array of fragments\n return new Interface(value);\n }\n}\n//# sourceMappingURL=interface.js.map","import { concat, \n// dataSlice,\ngetBigInt,\n// encodeRlp\n } from \"../utils/index.js\";\nimport { getAddress } from \"./index.js\";\nimport { sha256 } from \"../crypto/sha3.js\";\nimport { hexDataLength, hexDataSlice } from \"../utils/data.js\";\nimport { Logger } from \"../logger/logger.js\";\nimport { removeHexPrefix } from \"../transaction/address.js\";\nimport { calculateCheckSum } from \"./index.js\";\nconst logger = new Logger(\"contract-address/0.0.1\");\n/**\n * Returns the address that would result from a ``CREATE`` for %%tx%%.\n *\n * This can be used to compute the address a contract will be\n * deployed to by an EOA when sending a deployment transaction (i.e.\n * when the ``to`` address is ``null``).\n *\n * This can also be used to compute the address a contract will be\n * deployed to by a contract, by using the contract's address as the\n * ``to`` and the contract's nonce.\n *\n * @example\n * from = \"0x8ba1f109551bD432803012645Ac136ddd64DBA72\";\n * nonce = 5;\n *\n * getCreateAddress({ from, nonce });\n * //_result:\n */\nexport function getCreateAddress(tx) {\n const from = getAddress(tx.from);\n const nonce = getBigInt(tx.nonce, \"tx.nonce\");\n let nonceHex = nonce.toString(16);\n if (nonceHex === \"0\") {\n nonceHex = \"0x\";\n }\n else if (nonceHex.length % 2) {\n nonceHex = \"0x0\" + nonceHex;\n }\n else {\n nonceHex = \"0x\" + nonceHex;\n }\n return getAddress(from);\n}\n/**\n * Returns the address that would result from a ``CREATE2`` operation\n * with the given %%from%%, %%salt%% and %%initCodeHash%%.\n\n * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]].\n *\n * @example\n * // The address of the contract\n * from = \"0x8ba1f109551bD432803012645Ac136ddd64DBA72\"\n *\n * // The salt\n * salt = id(\"HelloWorld\")\n *\n * getCreate2Address(from, salt, initCodeHash)\n * //_result:\n */\nexport function getCreate2Address(from, salt, initCodeHash) {\n if (hexDataLength(salt) !== 32) {\n logger.throwArgumentError(\"salt must be 32 bytes\", \"salt\", salt);\n }\n if (hexDataLength(initCodeHash) !== 32) {\n logger.throwArgumentError(\"initCodeHash must be 32 bytes\", \"initCodeHash\", initCodeHash);\n }\n const val = hexDataSlice(sha256(concat([\"0xff\", getAddress(from), salt, initCodeHash])), 12);\n console.log({ \"contract-address/74=>should be string\": val });\n const prefix = from.substring(2, 4);\n const checksum = calculateCheckSum(val, prefix);\n return \"0x\" + prefix + checksum + removeHexPrefix(val);\n}\n//# sourceMappingURL=contract-address.js.map","import { assert, assertArgument } from \"../utils/index.js\";\nimport { getAddress } from \"./index.js\";\n/**\n * Returns true if %%value%% is an object which implements the\n * [[Addressable]] interface.\n *\n * @example:\n * // Wallets and AbstractSigner sub-classes\n * isAddressable(Wallet.createRandom())\n * //_result:\n *\n * // Contracts\n * contract = new Contract(\"dai.tokens.corebc.eth\", [ ], provider)\n * isAddressable(contract)\n * //_result:\n */\nexport function isAddressable(value) {\n return value && typeof value.getAddress === \"function\";\n}\n/**\n * Returns true if %%value%% is a valid address.\n *\n * @example:\n * // Valid address\n * isAddress(\"0x8ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_result:\n *\n * // Valid ICAP address\n * isAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\")\n * //_result:\n *\n * // Invalid checksum\n * isAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBa72\")\n * //_result:\n *\n * // Invalid ICAP checksum\n * isAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_result:\n *\n * // Not an address (an ENS name requires a provided and an\n * // asynchronous API to access)\n * isAddress(\"ricmoo.eth\")\n * //_result:\n */\nexport function isAddress(value) {\n try {\n getAddress(value);\n return true;\n }\n catch (error) { }\n return false;\n}\nasync function checkAddress(target, promise) {\n const result = await promise;\n if (result == null ||\n result === \"0x0000000000000000000000000000000000000000\") {\n assert(typeof target !== \"string\", \"unconfigured name\", \"UNCONFIGURED_NAME\", { value: target });\n assertArgument(false, \"invalid AddressLike value; did not resolve to a value address\", \"target\", target);\n }\n return getAddress(result);\n}\n/**\n * Resolves to an address for the %%target%%, which may be any\n * supported address type, an [[Addressable]] or a Promise which\n * resolves to an address.\n *\n * If an ENS name is provided, but that name has not been correctly\n * configured a [[UnconfiguredNameError]] is thrown.\n *\n * @example:\n * addr = \"0x6B175474E89094C44Da98b954EedeAC495271d0F\"\n *\n * // Addresses are return synchronously\n * resolveAddress(addr, provider)\n * //_result:\n *\n * // Address promises are resolved asynchronously\n * resolveAddress(Promise.resolve(addr))\n * //_result:\n *\n *\n * // Addressable objects are resolved asynchronously\n * contract = new Contract(addr, [ ])\n * resolveAddress(contract, provider)\n * //_result:\n *\n * // Unconfigured ENS names reject\n * resolveAddress(\"nothing-here.ricmoo.eth\", provider)\n * //_error:\n *\n * // ENS names require a NameResolver object passed in\n * // (notice the provider was omitted)\n * resolveAddress(\"nothing-here.ricmoo.eth\")\n * //_error:\n */\nexport function resolveAddress(target) {\n if (typeof target === \"string\") {\n return getAddress(target);\n // assert(resolver != null, \"ENS resolution requires a provider\",\n // \"UNSUPPORTED_OPERATION\", { operation: \"resolveName\" });\n // return checkAddress(target, resolver.resolveName(target));\n }\n else if (isAddressable(target)) {\n return checkAddress(target, target.getAddress());\n }\n else if (target && typeof target.then === \"function\") {\n return checkAddress(target, target);\n }\n assertArgument(false, \"unsupported addressable value\", \"target\", target);\n}\n//# sourceMappingURL=checks.js.map","import { defineProperties, getBigInt, getNumber, hexlify, resolveProperties, assert, assertArgument, isError, makeError, } from \"../utils/index.js\";\nconst BN_0 = BigInt(0);\n// -----------------------\nfunction getValue(value) {\n if (value == null) {\n return null;\n }\n return value;\n}\nfunction toJson(value) {\n if (value == null) {\n return null;\n }\n return value.toString();\n}\n// @TODO? implements Required\n/**\n * A **FeeData** wraps all the fee-related values associated with\n * the network.\n */\nexport class FeeData {\n /**\n * The energy price for legacy networks.\n */\n energyPrice;\n constructor(energyPrice) {\n defineProperties(this, {\n energyPrice: getValue(energyPrice),\n });\n }\n /**\n * Returns a JSON-friendly value.\n */\n toJSON() {\n const { energyPrice } = this;\n return {\n _type: \"FeeData\",\n energyPrice: toJson(energyPrice),\n };\n }\n}\nexport function copyRequest(req) {\n const result = {};\n // These could be addresses, ENS names or Addressables\n if (req.to) {\n result.to = req.to;\n }\n if (req.from) {\n result.from = req.from;\n }\n if (req.data) {\n result.data = hexlify(req.data);\n }\n const bigIntKeys = \"networkId,energyLimit,energyPrice,value\".split(/,/);\n for (const key of bigIntKeys) {\n if (!(key in req) || req[key] == null) {\n continue;\n }\n result[key] = getBigInt(req[key], `request.${key}`);\n }\n const numberKeys = \"type,nonce\".split(/,/);\n for (const key of numberKeys) {\n if (!(key in req) || req[key] == null) {\n continue;\n }\n result[key] = getNumber(req[key], `request.${key}`);\n }\n if (\"blockTag\" in req) {\n result.blockTag = req.blockTag;\n }\n if (\"enableCcipRead\" in req) {\n result.enableCcipReadEnabled = !!req.enableCcipRead;\n }\n if (\"customData\" in req) {\n result.customData = req.customData;\n }\n return result;\n}\n/**\n * A **Block** represents the data associated with a full block on\n * Core.\n */\nexport class Block {\n /**\n * The provider connected to the block used to fetch additional details\n * if necessary.\n */\n provider;\n /**\n * The block number, sometimes called the block height. This is a\n * sequential number that is one higher than the parent block.\n */\n number;\n /**\n * The block hash.\n */\n hash;\n /**\n * The timestamp for this block, which is the number of seconds since\n * epoch that this block was included.\n */\n timestamp;\n /**\n * The block hash of the parent block.\n */\n parentHash;\n /**\n * The nonce.\n *\n * On legacy networks, this is the random number inserted which\n * permitted the difficulty target to be reached.\n */\n nonce;\n /**\n * The difficulty target.\n *\n * On legacy networks, this is the proof-of-work target required\n * for a block to meet the protocol rules to be included.\n *\n * On modern networks, this is a random number arrived at using\n * randao. @TODO: Find links?\n */\n difficulty;\n /**\n * The total energy limit for this block.\n */\n energyLimit;\n /**\n * The total energy used in this block.\n */\n energyUsed;\n /**\n * The miner coinbase address, wihch receives any subsidies for\n * including this block.\n */\n miner;\n /**\n * Any extra data the validator wished to include.\n */\n extraData;\n /**\n * The base fee per energy that all transactions in this block were\n * charged.\n *\n * This adjusts after each block, depending on how congested the network\n * is.\n */\n baseFeePerEnergy;\n #transactions;\n /**\n * Create a new **Block** object.\n *\n * This should generally not be necessary as the unless implementing a\n * low-level library.\n */\n constructor(block, provider) {\n this.#transactions = block.transactions.map((tx) => {\n if (typeof tx !== \"string\") {\n return new TransactionResponse(tx, provider);\n }\n return tx;\n });\n defineProperties(this, {\n provider,\n hash: getValue(block.hash),\n number: block.number,\n timestamp: block.timestamp,\n parentHash: block.parentHash,\n nonce: block.nonce,\n difficulty: block.difficulty,\n energyLimit: block.energyLimit,\n energyUsed: block.energyUsed,\n miner: block.miner,\n extraData: block.extraData,\n baseFeePerEnergy: getValue(block.baseFeePerEnergy),\n });\n }\n /**\n * Returns the list of transaction hashes.\n */\n get transactions() {\n return this.#transactions.map((tx) => {\n if (typeof tx === \"string\") {\n return tx;\n }\n return tx.hash;\n });\n }\n /**\n * Returns the complete transactions for blocks which\n * prefetched them, by passing ``true`` to %%prefetchTxs%%\n * into [[provider_getBlock]].\n */\n get prefetchedTransactions() {\n const txs = this.#transactions.slice();\n // Doesn't matter...\n if (txs.length === 0) {\n return [];\n }\n // Make sure we prefetched the transactions\n assert(typeof txs[0] === \"object\", \"transactions were not prefetched with block request\", \"UNSUPPORTED_OPERATION\", {\n operation: \"transactionResponses()\",\n });\n return txs;\n }\n /**\n * Returns a JSON-friendly value.\n */\n toJSON() {\n const { baseFeePerEnergy, difficulty, extraData, energyLimit, energyUsed, hash, miner, nonce, number, parentHash, timestamp, transactions, } = this;\n return {\n _type: \"Block\",\n baseFeePerEnergy: toJson(baseFeePerEnergy),\n difficulty: toJson(difficulty),\n extraData,\n energyLimit: toJson(energyLimit),\n energyUsed: toJson(energyUsed),\n hash,\n miner,\n nonce,\n number,\n parentHash,\n timestamp,\n transactions,\n };\n }\n [Symbol.iterator]() {\n let index = 0;\n const txs = this.transactions;\n return {\n next: () => {\n if (index < this.length) {\n return {\n value: txs[index++],\n done: false,\n };\n }\n return { value: undefined, done: true };\n },\n };\n }\n /**\n * The number of transactions in this block.\n */\n get length() {\n return this.#transactions.length;\n }\n /**\n * The [[link-js-date]] this block was included at.\n */\n get date() {\n if (this.timestamp == null) {\n return null;\n }\n return new Date(this.timestamp * 1000);\n }\n /**\n * Get the transaction at %%indexe%% within this block.\n */\n async getTransaction(indexOrHash) {\n // Find the internal value by its index or hash\n let tx = undefined;\n if (typeof indexOrHash === \"number\") {\n tx = this.#transactions[indexOrHash];\n }\n else {\n const hash = indexOrHash.toLowerCase();\n for (const v of this.#transactions) {\n if (typeof v === \"string\") {\n if (v !== hash) {\n continue;\n }\n tx = v;\n break;\n }\n else {\n if (v.hash === hash) {\n continue;\n }\n tx = v;\n break;\n }\n }\n }\n if (tx == null) {\n throw new Error(\"no such tx\");\n }\n if (typeof tx === \"string\") {\n return await this.provider.getTransaction(tx);\n }\n else {\n return tx;\n }\n }\n getPrefetchedTransaction(indexOrHash) {\n const txs = this.prefetchedTransactions;\n if (typeof indexOrHash === \"number\") {\n return txs[indexOrHash];\n }\n indexOrHash = indexOrHash.toLowerCase();\n for (const tx of txs) {\n if (tx.hash === indexOrHash) {\n return tx;\n }\n }\n assertArgument(false, \"no matching transaction\", \"indexOrHash\", indexOrHash);\n }\n /**\n * Has this block been mined.\n *\n * If true, the block has been typed-gaurded that all mined\n * properties are non-null.\n */\n isMined() {\n return !!this.hash;\n }\n /**\n *\n */\n isLondon() {\n return !!this.baseFeePerEnergy;\n }\n orphanedEvent() {\n if (!this.isMined()) {\n throw new Error(\"\");\n }\n return createOrphanedBlockFilter(this);\n }\n}\n//////////////////////\n// Log\nexport class Log {\n provider;\n transactionHash;\n blockHash;\n blockNumber;\n removed;\n address;\n data;\n topics;\n index;\n transactionIndex;\n constructor(log, provider) {\n this.provider = provider;\n const topics = Object.freeze(log.topics.slice());\n defineProperties(this, {\n transactionHash: log.transactionHash,\n blockHash: log.blockHash,\n blockNumber: log.blockNumber,\n removed: log.removed,\n address: log.address,\n data: log.data,\n topics,\n index: log.index,\n transactionIndex: log.transactionIndex,\n });\n }\n toJSON() {\n const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex, } = this;\n return {\n _type: \"log\",\n address,\n blockHash,\n blockNumber,\n data,\n index,\n removed,\n topics,\n transactionHash,\n transactionIndex,\n };\n }\n async getBlock() {\n const block = await this.provider.getBlock(this.blockHash);\n assert(!!block, \"failed to find transaction\", \"UNKNOWN_ERROR\", {});\n return block;\n }\n async getTransaction() {\n const tx = await this.provider.getTransaction(this.transactionHash);\n assert(!!tx, \"failed to find transaction\", \"UNKNOWN_ERROR\", {});\n return tx;\n }\n async getTransactionReceipt() {\n const receipt = await this.provider.getTransactionReceipt(this.transactionHash);\n assert(!!receipt, \"failed to find transaction receipt\", \"UNKNOWN_ERROR\", {});\n return receipt;\n }\n removedEvent() {\n return createRemovedLogFilter(this);\n }\n}\n//////////////////////\n// Transaction Receipt\n/*\nexport interface LegacyTransactionReceipt {\n byzantium: false;\n status: null;\n root: string;\n}\n\nexport interface ByzantiumTransactionReceipt {\n byzantium: true;\n status: number;\n root: null;\n}\n*/\nexport class TransactionReceipt {\n provider;\n to;\n from;\n contractAddress;\n hash;\n index;\n blockHash;\n blockNumber;\n logsBloom;\n energyUsed;\n cumulativeEnergyUsed;\n energyPrice;\n type;\n //readonly byzantium!: boolean;\n status;\n root;\n #logs;\n constructor(tx, provider) {\n this.#logs = Object.freeze(tx.logs.map((log) => {\n return new Log(log, provider);\n }));\n defineProperties(this, {\n provider,\n to: tx.to,\n from: tx.from,\n contractAddress: tx.contractAddress,\n hash: tx.hash,\n index: tx.index,\n blockHash: tx.blockHash,\n blockNumber: tx.blockNumber,\n logsBloom: tx.logsBloom,\n energyUsed: tx.energyUsed,\n cumulativeEnergyUsed: tx.cumulativeEnergyUsed,\n energyPrice: (tx.effectiveEnergyPrice || tx.energyPrice),\n //byzantium: tx.byzantium,\n status: tx.status,\n root: tx.root,\n });\n }\n get logs() {\n return this.#logs;\n }\n toJSON() {\n const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium,\n status, root, } = this;\n return {\n _type: \"TransactionReceipt\",\n blockHash,\n blockNumber,\n //byzantium,\n contractAddress,\n cumulativeEnergyUsed: toJson(this.cumulativeEnergyUsed),\n from,\n energyPrice: toJson(this.energyPrice),\n energyUsed: toJson(this.energyUsed),\n hash,\n index,\n logs,\n logsBloom,\n root,\n status,\n to,\n };\n }\n get length() {\n return this.logs.length;\n }\n [Symbol.iterator]() {\n let index = 0;\n return {\n next: () => {\n if (index < this.length) {\n return { value: this.logs[index++], done: false };\n }\n return { value: undefined, done: true };\n },\n };\n }\n get fee() {\n return this.energyUsed * this.energyPrice;\n }\n async getBlock() {\n const block = await this.provider.getBlock(this.blockHash);\n if (block == null) {\n throw new Error(\"TODO\");\n }\n return block;\n }\n async getTransaction() {\n const tx = await this.provider.getTransaction(this.hash);\n if (tx == null) {\n throw new Error(\"TODO\");\n }\n return tx;\n }\n async getResult() {\n return await this.provider.getTransactionResult(this.hash);\n }\n async confirmations() {\n return (await this.provider.getBlockNumber()) - this.blockNumber + 1;\n }\n removedEvent() {\n return createRemovedTransactionFilter(this);\n }\n reorderedEvent(other) {\n assert(!other || other.isMined(), \"unmined 'other' transction cannot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"reorderedEvent(other)\" });\n return createReorderedTransactionFilter(this, other);\n }\n}\n/*\nexport type ReplacementDetectionSetup = {\n to: string;\n from: string;\n value: bigint;\n data: string;\n nonce: number;\n block: number;\n};\n*/\nexport class TransactionResponse {\n /**\n * The provider this is connected to, which will influence how its\n * methods will resolve its async inspection methods.\n */\n provider;\n /**\n * The block number of the block that this transaction was included in.\n *\n * This is ``null`` for pending transactions.\n */\n blockNumber;\n /**\n * The blockHash of the block that this transaction was included in.\n *\n * This is ``null`` for pending transactions.\n */\n blockHash;\n /**\n * The index within the block that this transaction resides at.\n */\n index;\n /**\n * The transaction hash.\n */\n hash;\n /**\n * The [[link-eip-2718]] transaction envelope type. This is\n * ``0`` for legacy transactions types.\n */\n type;\n /**\n * The receiver of this transaction.\n *\n * If ``null``, then the transaction is an initcode transaction.\n * This means the result of executing the [[data]] will be deployed\n * as a new contract on chain (assuming it does not revert) and the\n * address may be computed using [[getCreateAddress]].\n */\n to;\n /**\n * The sender of this transaction. It is implicitly computed\n * from the transaction pre-image hash (as the digest) and the\n * [[signature]] using ecrecover.\n */\n from;\n /**\n * The nonce, which is used to prevent replay attacks and offer\n * a method to ensure transactions from a given sender are explicitly\n * ordered.\n *\n * When sending a transaction, this must be equal to the number of\n * transactions ever sent by [[from]].\n */\n nonce;\n /**\n * The maximum units of energy this transaction can consume. If execution\n * exceeds this, the entries transaction is reverted and the sender\n * is charged for the full amount, despite not state changes being made.\n */\n energyLimit;\n /**\n * The energy price can have various values, depending on the network.\n *\n * In modern networks, for transactions that are included this is\n * the //effective energy price// (the fee per energy that was actually\n * charged), while for transactions that have not been included yet\n * is the [[maxFeePerEnergy]].\n *\n * For legacy transactions, or transactions on legacy networks, this\n * is the fee that will be charged per unit of energy the transaction\n * consumes.\n */\n energyPrice;\n /**\n * The data.\n */\n data;\n /**\n * The value, in ore. Use [[formatXCB]] to format this value\n * as xcb.\n */\n value;\n /**\n * The chain ID.\n */\n networkId;\n /**\n * The signature.\n */\n signature;\n #startBlock;\n /**\n * Create a new TransactionResponse with %%tx%% parameters\n * connected to %%provider%%.\n */\n constructor(tx, provider) {\n this.provider = provider;\n this.blockNumber = tx.blockNumber != null ? tx.blockNumber : null;\n this.blockHash = tx.blockHash != null ? tx.blockHash : null;\n this.hash = tx.hash;\n this.index = tx.index;\n this.from = tx.from;\n this.to = tx.to || null;\n this.energyLimit = tx.energyLimit;\n this.nonce = tx.nonce;\n this.data = tx.data;\n this.value = tx.value;\n this.energyPrice = tx.energyPrice;\n this.networkId = tx.networkId;\n this.signature = tx.signature;\n this.#startBlock = -1;\n }\n /**\n * Returns a JSON representation of this transaction.\n */\n toJSON() {\n const { index, hash, type, to, from, nonce, data, signature } = this;\n return {\n _type: \"TransactionReceipt\",\n networkId: toJson(this.networkId),\n data,\n from,\n energyLimit: toJson(this.energyLimit),\n energyPrice: toJson(this.energyPrice),\n hash,\n nonce,\n signature,\n to,\n index,\n type,\n value: toJson(this.value),\n };\n }\n /**\n * Resolves to the Block that this transaction was included in.\n *\n * This will return null if the transaction has not been included yet.\n */\n async getBlock() {\n let blockNumber = this.blockNumber;\n if (blockNumber == null) {\n const tx = await this.getTransaction();\n if (tx) {\n blockNumber = tx.blockNumber;\n }\n }\n if (blockNumber == null) {\n return null;\n }\n const block = this.provider.getBlock(blockNumber);\n if (block == null) {\n throw new Error(\"TODO\");\n }\n return block;\n }\n /**\n * Resolves to this transaction being re-requested from the\n * provider. This can be used if you have an unmined transaction\n * and wish to get an up-to-date populated instance.\n */\n async getTransaction() {\n return this.provider.getTransaction(this.hash);\n }\n /**\n * Resolves once this transaction has been mined and has\n * %%confirms%% blocks including it (default: ``1``) with an\n * optional %%timeout%%.\n *\n * This can resolve to ``null`` only if %%confirms%% is ``0``\n * and the transaction has not been mined, otherwise this will\n * wait until enough confirmations have completed.\n */\n async wait(_confirms, _timeout) {\n const confirms = _confirms == null ? 1 : _confirms;\n const timeout = _timeout == null ? 0 : _timeout;\n let startBlock = this.#startBlock;\n let nextScan = -1;\n let stopScanning = startBlock === -1 ? true : false;\n const checkReplacement = async () => {\n // Get the current transaction count for this sender\n if (stopScanning) {\n return null;\n }\n const { blockNumber, nonce } = await resolveProperties({\n blockNumber: this.provider.getBlockNumber(),\n nonce: this.provider.getTransactionCount(this.from),\n });\n // No transaction or our nonce has not been mined yet; but we\n // can start scanning later when we do start\n if (nonce < this.nonce) {\n startBlock = blockNumber;\n return;\n }\n // We were mined; no replacement\n if (stopScanning) {\n return null;\n }\n const mined = await this.getTransaction();\n if (mined && mined.blockNumber != null) {\n return;\n }\n // We were replaced; start scanning for that transaction\n // Starting to scan; look back a few extra blocks for safety\n if (nextScan === -1) {\n nextScan = startBlock - 3;\n if (nextScan < this.#startBlock) {\n nextScan = this.#startBlock;\n }\n }\n while (nextScan <= blockNumber) {\n // Get the next block to scan\n if (stopScanning) {\n return null;\n }\n const block = await this.provider.getBlock(nextScan, true);\n // This should not happen; but we'll try again shortly\n if (block == null) {\n return;\n }\n // We were mined; no replacement\n for (const hash of block) {\n if (hash === this.hash) {\n return;\n }\n }\n // Search for the transaction that replaced us\n for (let i = 0; i < block.length; i++) {\n const tx = await block.getTransaction(i);\n if (tx.from === this.from && tx.nonce === this.nonce) {\n // Get the receipt\n if (stopScanning) {\n return null;\n }\n const receipt = await this.provider.getTransactionReceipt(tx.hash);\n // This should not happen; but we'll try again shortly\n if (receipt == null) {\n return;\n }\n // We will retry this on the next block (this case could be optimized)\n if (blockNumber - receipt.blockNumber + 1 < confirms) {\n return;\n }\n // The reason we were replaced\n let reason = \"replaced\";\n if (tx.data === this.data &&\n tx.to === this.to &&\n tx.value === this.value) {\n reason = \"repriced\";\n }\n else if (tx.data === \"0x\" &&\n tx.from === tx.to &&\n tx.value === BN_0) {\n reason = \"cancelled\";\n }\n assert(false, \"transaction was replaced\", \"TRANSACTION_REPLACED\", {\n cancelled: reason === \"replaced\" || reason === \"cancelled\",\n reason,\n replacement: tx.replaceableTransaction(startBlock),\n hash: tx.hash,\n receipt,\n });\n }\n }\n nextScan++;\n }\n return;\n };\n const receipt = await this.provider.getTransactionReceipt(this.hash);\n if (receipt) {\n if ((await receipt.confirmations()) >= confirms) {\n return receipt;\n }\n }\n else {\n // Check for a replacement; throws if a replacement was found\n await checkReplacement();\n // Allow null only when the confirms is 0\n if (confirms === 0) {\n return null;\n }\n }\n const waiter = new Promise((resolve, reject) => {\n // List of things to cancel when we have a result (one way or the other)\n const cancellers = [];\n const cancel = () => {\n cancellers.forEach((c) => c());\n };\n // On cancel, stop scanning for replacements\n cancellers.push(() => {\n stopScanning = true;\n });\n // Set up any timeout requested\n if (timeout > 0) {\n const timer = setTimeout(() => {\n cancel();\n reject(makeError(\"wait for transaction timeout\", \"TIMEOUT\"));\n }, timeout);\n cancellers.push(() => {\n clearTimeout(timer);\n });\n }\n const txListener = async (receipt) => {\n // Done; return it!\n if ((await receipt.confirmations()) >= confirms) {\n cancel();\n resolve(receipt);\n }\n };\n cancellers.push(() => {\n this.provider.off(this.hash, txListener);\n });\n this.provider.on(this.hash, txListener);\n // We support replacement detection; start checking\n if (startBlock >= 0) {\n const replaceListener = async () => {\n try {\n // Check for a replacement; this throws only if one is found\n await checkReplacement();\n }\n catch (error) {\n // We were replaced (with enough confirms); re-throw the error\n if (isError(error, \"TRANSACTION_REPLACED\")) {\n cancel();\n reject(error);\n return;\n }\n }\n // Rescheudle a check on the next block\n if (!stopScanning) {\n this.provider.once(\"block\", replaceListener);\n }\n };\n cancellers.push(() => {\n this.provider.off(\"block\", replaceListener);\n });\n this.provider.once(\"block\", replaceListener);\n }\n });\n return await waiter;\n }\n /**\n * Returns ``true`` if this transaction has been included.\n *\n * This is effective only as of the time the TransactionResponse\n * was instantiated. To get up-to-date information, use\n * [[getTransaction]].\n *\n * This provides a Type Guard that this transaction will have\n * non-null property values for properties that are null for\n * unmined transactions.\n */\n isMined() {\n return this.blockHash != null;\n }\n /**\n * Returns true if the transaction is a legacy (i.e. ``type == 0``)\n * transaction.\n *\n * This provides a Type Guard that this transaction will have\n * the ``null``-ness for hardfork-specific properties set correctly.\n */\n isLegacy() {\n return this.type === 0;\n }\n /**\n * Returns a filter which can be used to listen for orphan events\n * that evict this transaction.\n */\n removedEvent() {\n assert(this.isMined(), \"unmined transaction canot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n return createRemovedTransactionFilter(this);\n }\n /**\n * Returns a filter which can be used to listen for orphan events\n * that re-order this event against %%other%%.\n */\n reorderedEvent(other) {\n assert(this.isMined(), \"unmined transaction canot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n assert(!other || other.isMined(), \"unmined 'other' transaction canot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n return createReorderedTransactionFilter(this, other);\n }\n /**\n * Returns a new TransactionResponse instance which has the ability to\n * detect (and throw an error) if the transaction is replaced, which\n * will begin scanning at %%startBlock%%.\n *\n * This should generally not be used by developers and is intended\n * primarily for internal use. Setting an incorrect %%startBlock%% can\n * have devastating performance consequences if used incorrectly.\n */\n replaceableTransaction(startBlock) {\n assertArgument(Number.isInteger(startBlock) && startBlock >= 0, \"invalid startBlock\", \"startBlock\", startBlock);\n const tx = new TransactionResponse(this, this.provider);\n tx.#startBlock = startBlock;\n return tx;\n }\n}\nfunction createOrphanedBlockFilter(block) {\n return { orphan: \"drop-block\", hash: block.hash, number: block.number };\n}\nfunction createReorderedTransactionFilter(tx, other) {\n return { orphan: \"reorder-transaction\", tx, other };\n}\nfunction createRemovedTransactionFilter(tx) {\n return { orphan: \"drop-transaction\", tx };\n}\nfunction createRemovedLogFilter(log) {\n return {\n orphan: \"drop-log\",\n log: {\n transactionHash: log.transactionHash,\n blockHash: log.blockHash,\n blockNumber: log.blockNumber,\n address: log.address,\n data: log.data,\n topics: Object.freeze(log.topics.slice()),\n index: log.index,\n },\n };\n}\n//# sourceMappingURL=provider.js.map","import { Log, TransactionReceipt, TransactionResponse, } from \"../providers/provider.js\";\nimport { defineProperties, EventPayload } from \"../utils/index.js\";\nexport class EventLog extends Log {\n interface;\n fragment;\n args;\n constructor(log, iface, fragment) {\n super(log, log.provider);\n const args = iface.decodeEventLog(fragment, log.data, log.topics);\n defineProperties(this, { args, fragment, interface: iface });\n }\n get eventName() {\n return this.fragment.name;\n }\n get eventSignature() {\n return this.fragment.format();\n }\n}\nexport class ContractTransactionReceipt extends TransactionReceipt {\n #iface;\n constructor(iface, provider, tx) {\n super(tx, provider);\n this.#iface = iface;\n }\n get logs() {\n return super.logs.map((log) => {\n const fragment = log.topics.length\n ? this.#iface.getEvent(log.topics[0])\n : null;\n if (fragment) {\n return new EventLog(log, this.#iface, fragment);\n }\n else {\n return log;\n }\n });\n }\n}\nexport class ContractTransactionResponse extends TransactionResponse {\n #iface;\n constructor(iface, provider, tx) {\n super(tx, provider);\n this.#iface = iface;\n }\n async wait(confirms) {\n const receipt = await super.wait();\n if (receipt == null) {\n return null;\n }\n return new ContractTransactionReceipt(this.#iface, this.provider, receipt);\n }\n}\nexport class ContractUnknownEventPayload extends EventPayload {\n log;\n constructor(contract, listener, filter, log) {\n super(contract, listener, filter);\n defineProperties(this, { log });\n }\n async getBlock() {\n return await this.log.getBlock();\n }\n async getTransaction() {\n return await this.log.getTransaction();\n }\n async getTransactionReceipt() {\n return await this.log.getTransactionReceipt();\n }\n}\nexport class ContractEventPayload extends ContractUnknownEventPayload {\n constructor(contract, listener, filter, fragment, _log) {\n super(contract, listener, filter, new EventLog(_log, contract.interface, fragment));\n const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics);\n defineProperties(this, { args, fragment });\n }\n get eventName() {\n return this.fragment.name;\n }\n get eventSignature() {\n return this.fragment.format();\n }\n}\n//# sourceMappingURL=wrappers.js.map","import { Indexed, Interface, Typed } from \"../abi/index.js\";\nimport { resolveAddress } from \"../address/checks.js\";\nimport { copyRequest, Log, } from \"../providers/provider.js\";\nimport { defineProperties, isCallException, isHexString, resolveProperties, makeError, assert, assertArgument, } from \"../utils/index.js\";\nimport { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionResponse, EventLog, } from \"./wrappers.js\";\nconst BN_0 = BigInt(0);\nfunction canCall(value) {\n return value && typeof value.call === \"function\";\n}\nfunction canEstimate(value) {\n return value && typeof value.estimateEnergy === \"function\";\n}\nfunction canResolve(value) {\n return value && typeof value.resolveName === \"function\";\n}\nfunction canSend(value) {\n return value && typeof value.sendTransaction === \"function\";\n}\nclass PreparedTopicFilter {\n #filter;\n fragment;\n constructor(contract, fragment, args) {\n defineProperties(this, { fragment });\n if (fragment.inputs.length < args.length) {\n throw new Error(\"too many arguments\");\n }\n // Recursively descend into args and resolve any addresses\n this.#filter = (async function () {\n const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => {\n const arg = args[index];\n if (arg == null) {\n return null;\n }\n return param.walkAsync(args[index], (type, value) => {\n if (type === \"address\") {\n return resolveAddress(value);\n }\n return value;\n });\n }));\n return contract.interface.encodeFilterTopics(fragment, resolvedArgs);\n })();\n }\n getTopicFilter() {\n return this.#filter;\n }\n}\n// A = Arguments passed in as a tuple\n// R = The result type of the call (i.e. if only one return type,\n// the qualified type, otherwise Result)\n// D = The type the default call will return (i.e. R for view/pure,\n// TransactionResponse otherwise)\n//export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> {\nfunction getRunner(value, feature) {\n if (value == null) {\n return null;\n }\n if (typeof value[feature] === \"function\") {\n return value;\n }\n if (value.provider && typeof value.provider[feature] === \"function\") {\n return value.provider;\n }\n return null;\n}\nfunction getProvider(value) {\n if (value == null) {\n return null;\n }\n return value.provider || null;\n}\n/**\n * @_ignore:\n */\nexport async function copyOverrides(arg, allowed) {\n // Create a shallow copy (we'll deep-ify anything needed during normalizing)\n const overrides = copyRequest(Typed.dereference(arg, \"overrides\"));\n assertArgument(overrides.to == null || (allowed || []).indexOf(\"to\") >= 0, \"cannot override to\", \"overrides.to\", overrides.to);\n assertArgument(overrides.data == null || (allowed || []).indexOf(\"data\") >= 0, \"cannot override data\", \"overrides.data\", overrides.data);\n // Resolve any from\n if (overrides.from) {\n overrides.from = await resolveAddress(overrides.from);\n }\n return overrides;\n}\n/**\n * @_ignore:\n */\nexport async function resolveArgs(_runner, inputs, args) {\n // Recursively descend into args and resolve any addresses\n return await Promise.all(inputs.map((param, index) => {\n return param.walkAsync(args[index], (type, value) => {\n value = Typed.dereference(value, type);\n if (type === \"address\") {\n return resolveAddress(value);\n }\n return value;\n });\n }));\n}\nfunction buildWrappedFallback(contract) {\n const populateTransaction = async function (overrides) {\n // If an overrides was passed in, copy it and normalize the values\n const tx = (await copyOverrides(overrides, [\"data\"]));\n tx.to = await contract.getAddress();\n const iface = contract.interface;\n // Only allow payable contracts to set non-zero value\n const payable = iface.receive || (iface.fallback && iface.fallback.payable);\n assertArgument(payable || (tx.value || BN_0) === BN_0, \"cannot send value to non-payable contract\", \"overrides.value\", tx.value);\n // Only allow fallback contracts to set non-empty data\n assertArgument(iface.fallback || (tx.data || \"0x\") === \"0x\", \"cannot send data to receive-only contract\", \"overrides.data\", tx.data);\n return tx;\n };\n const staticCall = async function (overrides) {\n const runner = getRunner(contract.runner, \"call\");\n assert(canCall(runner), \"contract runner does not support calling\", \"UNSUPPORTED_OPERATION\", { operation: \"call\" });\n const tx = await populateTransaction(overrides);\n try {\n return await runner.call(tx);\n }\n catch (error) {\n if (isCallException(error) && error.data) {\n throw contract.interface.makeError(error.data, tx);\n }\n throw error;\n }\n };\n const send = async function (overrides) {\n const runner = contract.runner;\n assert(canSend(runner), \"contract runner does not support sending transactions\", \"UNSUPPORTED_OPERATION\", { operation: \"sendTransaction\" });\n const tx = await runner.sendTransaction(await populateTransaction(overrides));\n const provider = getProvider(contract.runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n return new ContractTransactionResponse(contract.interface, provider, tx);\n };\n const estimateEnergy = async function (overrides) {\n const runner = getRunner(contract.runner, \"estimateEnergy\");\n assert(canEstimate(runner), \"contract runner does not support energy estimation\", \"UNSUPPORTED_OPERATION\", { operation: \"estimateEnergy\" });\n return await runner.estimateEnergy(await populateTransaction(overrides));\n };\n const method = async (overrides) => {\n return await send(overrides);\n };\n defineProperties(method, {\n _contract: contract,\n estimateEnergy,\n populateTransaction,\n send,\n staticCall,\n });\n return method;\n}\nfunction buildWrappedMethod(contract, key) {\n const getFragment = function (...args) {\n const fragment = contract.interface.getFunction(key, args);\n assert(fragment, \"no matching fragment in getFragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n });\n return fragment;\n };\n const populateTransaction = async function (...args) {\n const fragment = getFragment(...args);\n // If an overrides was passed in, copy it and normalize the values\n let overrides = {};\n if (fragment.inputs.length + 1 === args.length) {\n overrides = await copyOverrides(args.pop());\n }\n if (fragment.inputs.length !== args.length) {\n throw new Error(\"internal error: fragment inputs doesn't match arguments; should not happen\");\n }\n const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args);\n return Object.assign({}, overrides, await resolveProperties({\n to: contract.getAddress(),\n data: contract.interface.encodeFunctionData(fragment, resolvedArgs),\n }));\n };\n const staticCall = async function (...args) {\n const result = await staticCallResult(...args);\n if (result.length === 1) {\n return result[0];\n }\n return result;\n };\n const send = async function (...args) {\n const runner = contract.runner;\n assert(canSend(runner), \"contract runner does not support sending transactions\", \"UNSUPPORTED_OPERATION\", { operation: \"sendTransaction\" });\n const tx = await runner.sendTransaction(await populateTransaction(...args));\n const provider = getProvider(contract.runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n return new ContractTransactionResponse(contract.interface, provider, tx);\n };\n const estimateEnergy = async function (...args) {\n const runner = getRunner(contract.runner, \"estimateEnergy\");\n assert(canEstimate(runner), \"contract runner does not support energy estimation\", \"UNSUPPORTED_OPERATION\", { operation: \"estimateEnergy\" });\n return await runner.estimateEnergy(await populateTransaction(...args));\n };\n const staticCallResult = async function (...args) {\n const runner = getRunner(contract.runner, \"call\");\n assert(canCall(runner), \"contract runner does not support calling\", \"UNSUPPORTED_OPERATION\", { operation: \"call\" });\n const tx = await populateTransaction(...args);\n let result = \"0x\";\n try {\n result = await runner.call(tx);\n }\n catch (error) {\n if (isCallException(error) && error.data) {\n throw contract.interface.makeError(error.data, tx);\n }\n throw error;\n }\n const fragment = getFragment(...args);\n return contract.interface.decodeFunctionResult(fragment, result);\n };\n const method = async (...args) => {\n const fragment = getFragment(...args);\n if (fragment.constant) {\n return await staticCall(...args);\n }\n return await send(...args);\n };\n defineProperties(method, {\n name: contract.interface.getFunctionName(key),\n _contract: contract,\n _key: key,\n getFragment,\n estimateEnergy,\n populateTransaction,\n send,\n staticCall,\n staticCallResult,\n });\n // Only works on non-ambiguous keys (refined fragment is always non-ambiguous)\n Object.defineProperty(method, \"fragment\", {\n configurable: false,\n enumerable: true,\n get: () => {\n const fragment = contract.interface.getFunction(key);\n assert(fragment, \"no matching fragment in defineProperty\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n });\n return fragment;\n },\n });\n return method;\n}\nfunction buildWrappedEvent(contract, key) {\n const getFragment = function (...args) {\n const fragment = contract.interface.getEvent(key, args);\n assert(fragment, \"no matching fragment in\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n });\n return fragment;\n };\n const method = function (...args) {\n return new PreparedTopicFilter(contract, getFragment(...args), args);\n };\n defineProperties(method, {\n name: contract.interface.getEventName(key),\n _contract: contract,\n _key: key,\n getFragment,\n });\n // Only works on non-ambiguous keys (refined fragment is always non-ambiguous)\n Object.defineProperty(method, \"fragment\", {\n configurable: false,\n enumerable: true,\n get: () => {\n const fragment = contract.interface.getEvent(key);\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n });\n return fragment;\n },\n });\n return method;\n}\n// The combination of TypeScrype, Private Fields and Proxies makes\n// the world go boom; so we hide variables with some trickery keeping\n// a symbol attached to each BaseContract which its sub-class (even\n// via a Proxy) can reach and use to look up its internal values.\nconst internal = Symbol.for(\"_corebcInternal_contract\");\nconst internalValues = new WeakMap();\nfunction setInternal(contract, values) {\n internalValues.set(contract[internal], values);\n}\nfunction getInternal(contract) {\n return internalValues.get(contract[internal]);\n}\nfunction isDeferred(value) {\n return (value &&\n typeof value === \"object\" &&\n \"getTopicFilter\" in value &&\n typeof value.getTopicFilter === \"function\" &&\n value.fragment);\n}\nasync function getSubInfo(contract, event) {\n let topics;\n let fragment = null;\n // Convert named events to topicHash and get the fragment for\n // events which need deconstructing.\n if (Array.isArray(event)) {\n const topicHashify = function (name) {\n if (isHexString(name, 32)) {\n return name;\n }\n const fragment = contract.interface.getEvent(name);\n assertArgument(fragment, \"unknown fragment\", \"name\", name);\n return fragment.topicHash;\n };\n // Array of Topics and Names; e.g. `[ \"0x1234...89ab\", \"Transfer(address)\" ]`\n topics = event.map((e) => {\n if (e == null) {\n return null;\n }\n if (Array.isArray(e)) {\n return e.map(topicHashify);\n }\n return topicHashify(e);\n });\n }\n else if (event === \"*\") {\n topics = [null];\n }\n else if (typeof event === \"string\") {\n if (isHexString(event, 32)) {\n // Topic Hash\n topics = [event];\n }\n else {\n // Name or Signature; e.g. `\"Transfer\", `\"Transfer(address)\"`\n fragment = contract.interface.getEvent(event);\n assertArgument(fragment, \"unknown fragment\", \"event\", event);\n topics = [fragment.topicHash];\n }\n }\n else if (isDeferred(event)) {\n // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)`\n topics = await event.getTopicFilter();\n }\n else if (\"fragment\" in event) {\n // ContractEvent; e.g. `contract.filter.Transfer`\n fragment = event.fragment;\n topics = [fragment.topicHash];\n }\n else {\n assertArgument(false, \"unknown event name\", \"event\", event);\n }\n // Normalize topics and sort TopicSets\n topics = topics.map((t) => {\n if (t == null) {\n return null;\n }\n if (Array.isArray(t)) {\n const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values());\n if (items.length === 1) {\n return items[0];\n }\n items.sort();\n return items;\n }\n return t.toLowerCase();\n });\n const tag = topics\n .map((t) => {\n if (t == null) {\n return \"null\";\n }\n if (Array.isArray(t)) {\n return t.join(\"|\");\n }\n return t;\n })\n .join(\"&\");\n return { fragment, tag, topics };\n}\nasync function hasSub(contract, event) {\n const { subs } = getInternal(contract);\n return subs.get((await getSubInfo(contract, event)).tag) || null;\n}\nasync function getSub(contract, operation, event) {\n // Make sure our runner can actually subscribe to events\n const provider = getProvider(contract.runner);\n assert(provider, \"contract runner does not support subscribing\", \"UNSUPPORTED_OPERATION\", { operation });\n const { fragment, tag, topics } = await getSubInfo(contract, event);\n const { addr, subs } = getInternal(contract);\n let sub = subs.get(tag);\n if (!sub) {\n const address = addr ? addr : contract;\n const filter = { address, topics };\n const listener = (log) => {\n let foundFragment = fragment;\n if (foundFragment == null) {\n try {\n foundFragment = contract.interface.getEvent(log.topics[0]);\n }\n catch (error) { }\n }\n // If fragment is null, we do not deconstruct the args to emit\n if (foundFragment) {\n const _foundFragment = foundFragment;\n const args = fragment\n ? contract.interface.decodeEventLog(fragment, log.data, log.topics)\n : [];\n emit(contract, event, args, (listener) => {\n return new ContractEventPayload(contract, listener, event, _foundFragment, log);\n });\n }\n else {\n emit(contract, event, [], (listener) => {\n return new ContractUnknownEventPayload(contract, listener, event, log);\n });\n }\n };\n let starting = [];\n const start = () => {\n if (starting.length) {\n return;\n }\n starting.push(provider.on(filter, listener));\n };\n const stop = async () => {\n if (starting.length == 0) {\n return;\n }\n let started = starting;\n starting = [];\n await Promise.all(started);\n provider.off(filter, listener);\n };\n sub = { tag, listeners: [], start, stop };\n subs.set(tag, sub);\n }\n return sub;\n}\n// We use this to ensure one emit resolves before firing the next to\n// ensure correct ordering (note this cannot throw and just adds the\n// notice to the event queu using setTimeout).\nlet lastEmit = Promise.resolve();\nasync function _emit(contract, event, args, payloadFunc) {\n await lastEmit;\n const sub = await hasSub(contract, event);\n if (!sub) {\n return false;\n }\n const count = sub.listeners.length;\n sub.listeners = sub.listeners.filter(({ listener, once }) => {\n const passArgs = Array.from(args);\n if (payloadFunc) {\n passArgs.push(payloadFunc(once ? null : listener));\n }\n try {\n listener.call(contract, ...passArgs);\n }\n catch (error) { }\n return !once;\n });\n return count > 0;\n}\nasync function emit(contract, event, args, payloadFunc) {\n try {\n await lastEmit;\n }\n catch (error) { }\n const resultPromise = _emit(contract, event, args, payloadFunc);\n lastEmit = resultPromise;\n return await resultPromise;\n}\nconst passProperties = [\"then\"];\nexport class BaseContract {\n target;\n interface;\n runner;\n filters;\n [internal];\n fallback;\n constructor(target, abi, runner, _deployTx) {\n if (runner == null) {\n runner = null;\n }\n const iface = Interface.from(abi);\n defineProperties(this, { target, runner, interface: iface });\n Object.defineProperty(this, internal, { value: {} });\n let addrPromise;\n let addr = null;\n let deployTx = null;\n if (_deployTx) {\n const provider = getProvider(runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx);\n }\n let subs = new Map();\n // Resolve the target as the address\n if (typeof target === \"string\") {\n if (isHexString(target)) {\n addr = target;\n addrPromise = Promise.resolve(target);\n }\n else {\n const resolver = getRunner(runner, \"resolveName\");\n if (!canResolve(resolver)) {\n throw makeError(\"contract runner does not support name resolution\", \"UNSUPPORTED_OPERATION\", {\n operation: \"resolveName\",\n });\n }\n addrPromise = resolver.resolveName(target).then((addr) => {\n if (addr == null) {\n throw new Error(\"TODO\");\n }\n getInternal(this).addr = addr;\n return addr;\n });\n }\n }\n else {\n addrPromise = target.getAddress().then((addr) => {\n if (addr == null) {\n throw new Error(\"TODO\");\n }\n getInternal(this).addr = addr;\n return addr;\n });\n }\n // Set our private values\n setInternal(this, { addrPromise, addr, deployTx, subs });\n // Add the event filters\n const filters = new Proxy({}, {\n get: (target, _prop, receiver) => {\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(_prop) >= 0) {\n return Reflect.get(target, _prop, receiver);\n }\n const prop = String(_prop);\n const result = this.getEvent(prop);\n if (result) {\n return result;\n }\n throw new Error(`unknown contract event: ${prop}`);\n },\n has: (target, prop) => {\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(prop) >= 0) {\n return Reflect.has(target, prop);\n }\n return (Reflect.has(target, prop) || this.interface.hasEvent(String(prop)));\n },\n });\n defineProperties(this, { filters });\n defineProperties(this, {\n fallback: iface.receive || iface.fallback ? buildWrappedFallback(this) : null,\n });\n // Return a Proxy that will respond to functions\n return new Proxy(this, {\n get: (target, _prop, receiver) => {\n if (_prop in target || passProperties.indexOf(_prop) >= 0) {\n return Reflect.get(target, _prop, receiver);\n }\n const prop = String(_prop);\n const result = target.getFunction(prop);\n if (result) {\n return result;\n }\n throw new Error(`unknown contract method: ${prop}`);\n },\n has: (target, prop) => {\n if (prop in target || passProperties.indexOf(prop) >= 0) {\n return Reflect.has(target, prop);\n }\n return target.interface.hasFunction(String(prop));\n },\n });\n }\n connect(runner) {\n return new BaseContract(this.target, this.interface, runner);\n }\n async getAddress() {\n return await getInternal(this).addrPromise;\n }\n async getDeployedCode() {\n const provider = getProvider(this.runner);\n assert(provider, \"runner does not support .provider\", \"UNSUPPORTED_OPERATION\", { operation: \"getDeployedCode\" });\n const code = await provider.getCode(await this.getAddress());\n if (code === \"0x\") {\n return null;\n }\n return code;\n }\n async waitForDeployment() {\n // We have the deployement transaction; just use that (throws if deployement fails)\n const deployTx = this.deploymentTransaction();\n if (deployTx) {\n await deployTx.wait();\n return this;\n }\n // Check for code\n const code = await this.getDeployedCode();\n if (code != null) {\n return this;\n }\n // Make sure we can subscribe to a provider event\n const provider = getProvider(this.runner);\n assert(provider != null, \"contract runner does not support .provider\", \"UNSUPPORTED_OPERATION\", { operation: \"waitForDeployment\" });\n return new Promise((resolve, reject) => {\n const checkCode = async () => {\n try {\n const code = await this.getDeployedCode();\n if (code != null) {\n return resolve(this);\n }\n provider.once(\"block\", checkCode);\n }\n catch (error) {\n reject(error);\n }\n };\n checkCode();\n });\n }\n deploymentTransaction() {\n return getInternal(this).deployTx;\n }\n getFunction(key) {\n if (typeof key !== \"string\") {\n key = key.format();\n }\n const func = buildWrappedMethod(this, key);\n return func;\n }\n getEvent(key) {\n if (typeof key !== \"string\") {\n key = key.format();\n }\n return buildWrappedEvent(this, key);\n }\n async queryTransaction(hash) {\n // Is this useful?\n throw new Error(\"@TODO\");\n }\n async queryFilter(event, fromBlock, toBlock) {\n if (fromBlock == null) {\n fromBlock = 0;\n }\n if (toBlock == null) {\n toBlock = \"latest\";\n }\n const { addr, addrPromise } = getInternal(this);\n const address = addr ? addr : await addrPromise;\n const { fragment, topics } = await getSubInfo(this, event);\n const filter = { address, topics, fromBlock, toBlock };\n const provider = getProvider(this.runner);\n assert(provider, \"contract runner does not have a provider\", \"UNSUPPORTED_OPERATION\", { operation: \"queryFilter\" });\n return (await provider.getLogs(filter)).map((log) => {\n let foundFragment = fragment;\n if (foundFragment == null) {\n try {\n foundFragment = this.interface.getEvent(log.topics[0]);\n }\n catch (error) { }\n }\n if (foundFragment) {\n return new EventLog(log, this.interface, foundFragment);\n }\n else {\n return new Log(log, provider);\n }\n });\n }\n async on(event, listener) {\n const sub = await getSub(this, \"on\", event);\n sub.listeners.push({ listener, once: false });\n sub.start();\n return this;\n }\n async once(event, listener) {\n const sub = await getSub(this, \"once\", event);\n sub.listeners.push({ listener, once: true });\n sub.start();\n return this;\n }\n async emit(event, ...args) {\n return await emit(this, event, args, null);\n }\n async listenerCount(event) {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return 0;\n }\n return sub.listeners.length;\n }\n const { subs } = getInternal(this);\n let total = 0;\n for (const { listeners } of subs.values()) {\n total += listeners.length;\n }\n return total;\n }\n async listeners(event) {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return [];\n }\n return sub.listeners.map(({ listener }) => listener);\n }\n const { subs } = getInternal(this);\n let result = [];\n for (const { listeners } of subs.values()) {\n result = result.concat(listeners.map(({ listener }) => listener));\n }\n return result;\n }\n async off(event, listener) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return this;\n }\n if (listener) {\n const index = sub.listeners\n .map(({ listener }) => listener)\n .indexOf(listener);\n if (index >= 0) {\n sub.listeners.splice(index, 1);\n }\n }\n if (listener == null || sub.listeners.length === 0) {\n sub.stop();\n getInternal(this).subs.delete(sub.tag);\n }\n return this;\n }\n async removeAllListeners(event) {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return this;\n }\n sub.stop();\n getInternal(this).subs.delete(sub.tag);\n }\n else {\n const { subs } = getInternal(this);\n for (const { tag, stop } of subs.values()) {\n stop();\n subs.delete(tag);\n }\n }\n return this;\n }\n // Alias for \"on\"\n async addListener(event, listener) {\n return await this.on(event, listener);\n }\n // Alias for \"off\"\n async removeListener(event, listener) {\n return await this.off(event, listener);\n }\n static buildClass(abi) {\n class CustomContract extends BaseContract {\n constructor(address, runner = null) {\n super(address, abi, runner);\n }\n }\n return CustomContract;\n }\n static from(target, abi, runner) {\n if (runner == null) {\n runner = null;\n }\n const contract = new this(target, abi, runner);\n return contract;\n }\n static isIndexed(value) {\n return Indexed.isIndexed(value);\n }\n}\nfunction _ContractBase() {\n return BaseContract;\n}\nexport class Contract extends _ContractBase() {\n}\n//# sourceMappingURL=contract.js.map","import { Interface } from \"../abi/index.js\";\nimport { getCreateAddress } from \"../address/contract-address.js\";\nimport { concat, defineProperties, getBytes, hexlify, assert, assertArgument, } from \"../utils/index.js\";\nimport { BaseContract, copyOverrides, resolveArgs } from \"./contract.js\";\nimport { isBytes } from \"../utils/data.js\";\n// A = Arguments to the constructor\n// I = Interface of deployed contracts\nexport class ContractFactory {\n interface;\n bytecode;\n runner;\n constructor(abi, bytecode, runner) {\n const iface = Interface.from(abi);\n // Dereference Solidity bytecode objects and allow a missing `0x`-prefix\n if (bytecode instanceof Uint8Array) {\n bytecode = hexlify(getBytes(bytecode));\n }\n else if (typeof bytecode === \"string\") {\n bytecode = bytecode;\n }\n else if (isBytes(bytecode)) {\n bytecode = hexlify(bytecode);\n }\n else if (bytecode && typeof bytecode.object === \"string\") {\n // Allow the bytecode object from the Solidity compiler\n bytecode = bytecode.object;\n }\n else {\n // Crash in the next verification step\n bytecode = \"!\";\n }\n defineProperties(this, {\n // @ts-ignore\n bytecode,\n interface: iface,\n runner: runner || null,\n });\n }\n async getDeployTransaction(...args) {\n let overrides = {};\n const fragment = this.interface.deploy;\n if (fragment.inputs.length + 1 === args.length) {\n overrides = await copyOverrides(args.pop());\n }\n if (fragment.inputs.length !== args.length) {\n throw new Error(\"incorrect number of arguments to constructor\");\n }\n const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args);\n const data = concat([\n this.bytecode,\n this.interface.encodeDeploy(resolvedArgs),\n ]);\n return Object.assign({}, overrides, { data });\n }\n async deploy(...args) {\n const tx = await this.getDeployTransaction(...args);\n assert(this.runner && typeof this.runner.sendTransaction === \"function\", \"factory runner does not support sending transactions\", \"UNSUPPORTED_OPERATION\", {\n operation: \"sendTransaction\",\n });\n const sentTx = await this.runner.sendTransaction(tx);\n const address = getCreateAddress(sentTx);\n return new BaseContract(address, this.interface, this.runner, sentTx);\n }\n connect(runner) {\n return new ContractFactory(this.interface, this.bytecode, runner);\n }\n static fromSolidity(output, runner) {\n assertArgument(output != null, \"bad compiler output\", \"output\", output);\n if (typeof output === \"string\") {\n output = JSON.parse(output);\n }\n const abi = output.abi;\n let bytecode = \"\";\n if (output.bytecode) {\n bytecode = output.bytecode;\n }\n else if (output.evm && output.evm.bytecode) {\n bytecode = output.evm.bytecode;\n }\n return new this(abi, bytecode, runner);\n }\n}\n//# sourceMappingURL=factory.js.map","/**\n * @_ignore\n */\nimport { getAddress } from \"../address/index.js\";\nimport { getCreateAddress } from \"../address/contract-address.js\";\nimport { accessListify } from \"../transaction/index.js\";\nimport { getBigInt, getNumber, hexlify, isHexString, zeroPadValue, assert, assertArgument, } from \"../utils/index.js\";\nconst BN_0 = BigInt(0);\nexport function allowNull(format, nullValue) {\n return function (value) {\n if (value == null) {\n return nullValue;\n }\n return format(value);\n };\n}\nexport function arrayOf(format) {\n return (array) => {\n if (!Array.isArray(array)) {\n throw new Error(\"not an array\");\n }\n return array.map((i) => format(i));\n };\n}\n// Requires an object which matches a fleet of other formatters\n// Any FormatFunc may return `undefined` to have the value omitted\n// from the result object. Calls preserve `this`.\nexport function object(format, altNames) {\n return (value) => {\n const result = {};\n for (const key in format) {\n let srcKey = key;\n if (altNames && key in altNames && !(srcKey in value)) {\n for (const altKey of altNames[key]) {\n if (altKey in value) {\n srcKey = altKey;\n break;\n }\n }\n }\n try {\n const nv = format[key](value[srcKey]);\n if (nv !== undefined) {\n result[key] = nv;\n }\n }\n catch (error) {\n const message = error instanceof Error ? error.message : \"not-an-error\";\n assert(false, `invalid value for value.${key} (${message})`, \"BAD_DATA\", { value });\n }\n }\n return result;\n };\n}\nexport function formatBoolean(value) {\n switch (value) {\n case true:\n case \"true\":\n return true;\n case false:\n case \"false\":\n return false;\n }\n assertArgument(false, `invalid boolean; ${JSON.stringify(value)}`, \"value\", value);\n}\nexport function formatData(value) {\n assertArgument(isHexString(value, true), \"invalid data\", \"value\", value);\n return value;\n}\nexport function formatHash(value) {\n assertArgument(isHexString(value, 32), \"invalid hash\", \"value\", value);\n return value;\n}\nexport function formatUint256(value) {\n if (!isHexString(value)) {\n throw new Error(\"invalid uint256\");\n }\n return zeroPadValue(value, 32);\n}\nconst _formatLog = object({\n address: getAddress,\n blockHash: formatHash,\n blockNumber: getNumber,\n data: formatData,\n index: getNumber,\n removed: allowNull(formatBoolean, false),\n topics: arrayOf(formatHash),\n transactionHash: formatHash,\n transactionIndex: getNumber,\n}, {\n index: [\"logIndex\"],\n});\nexport function formatLog(value) {\n return _formatLog(value);\n}\nconst _formatBlock = object({\n hash: allowNull(formatHash),\n parentHash: formatHash,\n number: getNumber,\n timestamp: getNumber,\n nonce: allowNull(formatData),\n difficulty: getBigInt,\n energyLimit: getBigInt,\n energyUsed: getBigInt,\n miner: allowNull(getAddress),\n extraData: formatData,\n baseFeePerEnergy: allowNull(getBigInt),\n});\nexport function formatBlock(value) {\n const result = _formatBlock(value);\n result.transactions = value.transactions.map((tx) => {\n if (typeof tx === \"string\") {\n return tx;\n }\n return formatTransactionResponse(tx);\n });\n return result;\n}\nconst _formatReceiptLog = object({\n transactionIndex: getNumber,\n blockNumber: getNumber,\n transactionHash: formatHash,\n address: getAddress,\n topics: arrayOf(formatHash),\n data: formatData,\n index: getNumber,\n blockHash: formatHash,\n}, {\n index: [\"logIndex\"],\n});\nexport function formatReceiptLog(value) {\n return _formatReceiptLog(value);\n}\nconst _formatTransactionReceipt = object({\n to: allowNull(getAddress, null),\n from: allowNull(getAddress, null),\n contractAddress: allowNull(getAddress, null),\n // should be allowNull(hash), but broken-EIP-658 support is handled in receipt\n index: getNumber,\n root: allowNull(hexlify),\n energyUsed: getBigInt,\n logsBloom: allowNull(formatData),\n blockHash: formatHash,\n hash: formatHash,\n logs: arrayOf(formatReceiptLog),\n blockNumber: getNumber,\n //confirmations: allowNull(getNumber, null),\n cumulativeEnergyUsed: getBigInt,\n effectiveEnergyPrice: allowNull(getBigInt),\n status: allowNull(getNumber),\n type: allowNull(getNumber, 0),\n}, {\n effectiveEnergyPrice: [\"energyPrice\"],\n hash: [\"transactionHash\"],\n index: [\"transactionIndex\"],\n});\nexport function formatTransactionReceipt(value) {\n return _formatTransactionReceipt(value);\n}\nexport function formatTransactionResponse(value) {\n // Some clients (TestRPC) do strange things like return 0x0 for the\n // 0 address; correct this to be a real address\n if (value.to && !getAddress(value.to) && getBigInt(value.to) === BN_0) {\n value.to = \"0x0000000000000000000000000000000000000000\";\n }\n const result = object({\n hash: formatHash,\n type: (value) => {\n if (value === \"0x\" || value == null) {\n return 0;\n }\n return getNumber(value);\n },\n accessList: allowNull(accessListify, null),\n blockHash: allowNull(formatHash, null),\n blockNumber: allowNull(getNumber, null),\n transactionIndex: allowNull(getNumber, null),\n //confirmations: allowNull(getNumber, null),\n from: getAddress,\n maxFeePerEnergy: allowNull(getBigInt),\n energyLimit: getBigInt,\n to: allowNull(getAddress, null),\n value: getBigInt,\n nonce: getNumber,\n data: formatData,\n creates: allowNull(getAddress, null),\n networkId: allowNull(getBigInt, null),\n }, {\n data: [\"input\"],\n energyLimit: [\"energy\"],\n })(value);\n // If to and creates are empty, populate the creates from the value\n if (result.to == null && result.creates == null) {\n result.creates = getCreateAddress(result);\n }\n // Compute the signature\n if (value.signature) {\n result.signature = value.signature;\n }\n else {\n result.signature = value;\n }\n // Some backends omit networkId on legacy transactions, but we can compute it\n if (result.networkId == null) {\n const networkId = result.signature.legacynetworkId;\n if (networkId != null) {\n result.networkId = networkId;\n }\n }\n // @TODO: check networkId\n /*\n if (value.networkId != null) {\n let networkId = value.networkId;\n \n if (isHexString(networkId)) {\n networkId = BigNumber.from(networkId).toNumber();\n }\n \n result.networkId = networkId;\n \n } else {\n let networkId = value.networkId;\n \n // geth-etc returns networkId\n if (networkId == null && result.v == null) {\n networkId = value.networkId;\n }\n \n if (isHexString(networkId)) {\n networkId = BigNumber.from(networkId).toNumber();\n }\n \n if (typeof(networkId) !== \"number\" && result.v != null) {\n networkId = (result.v - 35) / 2;\n if (networkId < 0) { networkId = 0; }\n networkId = parseInt(networkId);\n }\n \n if (typeof(networkId) !== \"number\") { networkId = 0; }\n \n result.networkId = networkId;\n }\n */\n // 0x0000... should actually be null\n if (result.blockHash && getBigInt(result.blockHash) === BN_0) {\n result.blockHash = null;\n }\n return result;\n}\n//# sourceMappingURL=format.js.map","import { defineProperties } from \"../utils/properties.js\";\nimport { assertArgument } from \"../utils/index.js\";\nexport class NetworkPlugin {\n name;\n constructor(name) {\n defineProperties(this, { name });\n }\n clone() {\n return new NetworkPlugin(this.name);\n }\n}\nexport class EnergyCostPlugin extends NetworkPlugin {\n effectiveBlock;\n txBase;\n txCreate;\n txDataZero;\n txDataNonzero;\n txAccessListStorageKey;\n txAccessListAddress;\n constructor(effectiveBlock, costs) {\n if (effectiveBlock == null) {\n effectiveBlock = 0;\n }\n super(`org.corebc.network.plugins.EnergyCost#${effectiveBlock || 0}`);\n const props = { effectiveBlock };\n function set(name, nullish) {\n let value = (costs || {})[name];\n if (value == null) {\n value = nullish;\n }\n assertArgument(typeof value === \"number\", `invalud value for ${name}`, \"costs\", costs);\n props[name] = value;\n }\n set(\"txBase\", 21000);\n set(\"txCreate\", 32000);\n set(\"txDataZero\", 4);\n set(\"txDataNonzero\", 16);\n set(\"txAccessListStorageKey\", 1900);\n set(\"txAccessListAddress\", 2400);\n defineProperties(this, props);\n }\n clone() {\n return new EnergyCostPlugin(this.effectiveBlock, this);\n }\n}\nexport class FeeDataNetworkPlugin extends NetworkPlugin {\n #feeDataFunc;\n get feeDataFunc() {\n return this.#feeDataFunc;\n }\n constructor(feeDataFunc) {\n super(\"org.corebc.plugins.network.FeeData\");\n this.#feeDataFunc = feeDataFunc;\n }\n async getFeeData(provider) {\n return await this.#feeDataFunc(provider);\n }\n clone() {\n return new FeeDataNetworkPlugin(this.#feeDataFunc);\n }\n}\n/*\nexport class CustomBlockNetworkPlugin extends NetworkPlugin {\n readonly #blockFunc: (provider: Provider, block: BlockParams) => Block;\n readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block;\n\n async getBlock(provider: Provider, block: BlockParams): Promise> {\n return await this.#blockFunc(provider, block);\n }\n\n async getBlockions(provider: Provider, block: BlockParams): Promise> {\n return await this.#blockWithTxsFunc(provider, block);\n }\n\n clone(): CustomBlockNetworkPlugin {\n return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc);\n }\n}\n*/\n//# sourceMappingURL=plugins-network.js.map","/**\n * About networks\n *\n * @_subsection: api/providers:Networks [networks]\n */\nimport { getBigInt, assertArgument } from \"../utils/index.js\";\nimport { EnergyCostPlugin } from \"./plugins-network.js\";\n/* * * *\n// Networks which operation against an L2 can use this plugin to\n// specify how to access L1, for the purpose of resolving ENS,\n// for example.\nexport class LayerOneConnectionPlugin extends NetworkPlugin {\n readonly provider!: Provider;\n*/\n// Networks or clients with a higher need for security (such as clients\n// that may automatically make CCIP requests without user interaction)\n// can use this plugin to anonymize requests or intercept CCIP requests\n// to notify and/or receive authorization from the user\nconst Networks = new Map();\nexport class Network {\n #name;\n #networkId;\n #plugins;\n constructor(name, networkId) {\n this.#name = name;\n this.#networkId = getBigInt(networkId);\n this.#plugins = new Map();\n }\n toJSON() {\n return { name: this.name, networkId: String(this.networkId) };\n }\n /**\n * The network common name.\n *\n * This is the canonical name, as networks migh have multiple\n * names.\n */\n get name() {\n return this.#name;\n }\n set name(value) {\n this.#name = value;\n }\n /**\n * The network chain ID.\n */\n get networkId() {\n return this.#networkId;\n }\n set networkId(value) {\n this.#networkId = getBigInt(value, \"networkId\");\n }\n /**\n * Returns true if %%other%% matches this network. Any chain ID\n * must match, and if no chain ID is present, the name must match.\n *\n * This method does not currently check for additional properties,\n * such as ENS address or plug-in compatibility.\n */\n matches(other) {\n if (other == null) {\n return false;\n }\n if (typeof other === \"string\") {\n try {\n return this.networkId === getBigInt(other);\n }\n catch (error) { }\n return this.name === other;\n }\n if (typeof other === \"number\" || typeof other === \"bigint\") {\n try {\n return this.networkId === getBigInt(other);\n }\n catch (error) { }\n return false;\n }\n if (typeof other === \"object\") {\n if (other.networkId != null) {\n try {\n return this.networkId === getBigInt(other.networkId);\n }\n catch (error) { }\n return false;\n }\n if (other.name != null) {\n return this.name === other.name;\n }\n return false;\n }\n return false;\n }\n /**\n * Returns the list of plugins currently attached to this Network.\n */\n get plugins() {\n return Array.from(this.#plugins.values());\n }\n /**\n * Attach a new %%plugin%% to this Network. The network name\n * must be unique, excluding any fragment.\n */\n attachPlugin(plugin) {\n if (this.#plugins.get(plugin.name)) {\n throw new Error(`cannot replace existing plugin: ${plugin.name} `);\n }\n this.#plugins.set(plugin.name, plugin.clone());\n return this;\n }\n /**\n * Return the plugin, if any, matching %%name%% exactly. Plugins\n * with fragments will not be returned unless %%name%% includes\n * a fragment.\n */\n getPlugin(name) {\n return this.#plugins.get(name) || null;\n }\n /**\n * Gets a list of all plugins that match %%name%%, with otr without\n * a fragment.\n */\n getPlugins(basename) {\n return (this.plugins.filter((p) => p.name.split(\"#\")[0] === basename));\n }\n /**\n * Create a copy of this Network.\n */\n clone() {\n const clone = new Network(this.name, this.networkId);\n this.plugins.forEach((plugin) => {\n clone.attachPlugin(plugin.clone());\n });\n return clone;\n }\n /**\n * Compute the intrinsic energy required for a transaction.\n *\n * A EnergyCostPlugin can be attached to override the default\n * values.\n */\n computeIntrinsicEnergy(tx) {\n const costs = this.getPlugin(\"org.corebc.plugins.network.EnergyCost\") || new EnergyCostPlugin();\n let energy = costs.txBase;\n if (tx.to == null) {\n energy += costs.txCreate;\n }\n if (tx.data) {\n for (let i = 2; i < tx.data.length; i += 2) {\n if (tx.data.substring(i, i + 2) === \"00\") {\n energy += costs.txDataZero;\n }\n else {\n energy += costs.txDataNonzero;\n }\n }\n }\n return energy;\n }\n /**\n * Returns a new Network for the %%network%% name or networkId.\n */\n static from(network) {\n injectCommonNetworks();\n // Default network\n if (network == null) {\n return Network.from(\"mainnet\");\n }\n // Canonical name or chain ID\n if (typeof network === \"number\") {\n network = BigInt(network);\n }\n if (typeof network === \"string\" || typeof network === \"bigint\") {\n const networkFunc = Networks.get(network);\n if (networkFunc) {\n return networkFunc();\n }\n if (typeof network === \"bigint\") {\n return new Network(\"unknown\", network);\n }\n assertArgument(false, \"unknown network\", \"network\", network);\n }\n // Clonable with network-like abilities\n if (typeof network.clone === \"function\") {\n const clone = network.clone();\n //if (typeof(network.name) !== \"string\" || typeof(network.networkId) !== \"number\") {\n //}\n return clone;\n }\n // Networkish\n if (typeof network === \"object\") {\n assertArgument(typeof network.name === \"string\" &&\n typeof network.networkId === \"number\", \"invalid network object name or networkId\", \"network\", network);\n const custom = new Network(network.name, network.networkId);\n //if ((network).layerOneConnection) {\n // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection));\n //}\n return custom;\n }\n assertArgument(false, \"invalid network\", \"network\", network);\n }\n /**\n * Register %%nameOrnetworkId%% with a function which returns\n * an instance of a Network representing that chain.\n */\n static register(nameOrnetworkId, networkFunc) {\n if (typeof nameOrnetworkId === \"number\") {\n nameOrnetworkId = BigInt(nameOrnetworkId);\n }\n const existing = Networks.get(nameOrnetworkId);\n if (existing) {\n assertArgument(false, `conflicting network for ${JSON.stringify(existing.name)}`, \"nameOrnetworkId\", nameOrnetworkId);\n }\n Networks.set(nameOrnetworkId, networkFunc);\n }\n}\n// See: https://chainlist.org\nlet injected = false;\nfunction injectCommonNetworks() {\n if (injected) {\n return;\n }\n injected = true;\n /// Register popular Core networks\n function registerEth(name, networkId, options) {\n const func = function () {\n const network = new Network(name, networkId);\n network.attachPlugin(new EnergyCostPlugin());\n return network;\n };\n // Register the network by name and chain ID\n Network.register(name, func);\n Network.register(networkId, func);\n if (options.altNames) {\n options.altNames.forEach((name) => {\n Network.register(name, func);\n });\n }\n }\n registerEth(\"mainnet\", 1, { ensNetwork: 1, altNames: [\"homestead\"] });\n registerEth(\"ropsten\", 3, { ensNetwork: 3 });\n registerEth(\"rinkeby\", 4, { ensNetwork: 4 });\n registerEth(\"goerli\", 5, { ensNetwork: 5 });\n registerEth(\"kovan\", 42, { ensNetwork: 42 });\n registerEth(\"sepolia\", 11155111, {});\n registerEth(\"classic\", 61, {});\n registerEth(\"classicKotti\", 6, {});\n registerEth(\"xdai\", 100, { ensNetwork: 1 });\n}\n//# sourceMappingURL=network.js.map","import { assert, isHexString } from \"../utils/index.js\";\nfunction copy(obj) {\n return JSON.parse(JSON.stringify(obj));\n}\n/**\n * @TODO\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport function getPollingSubscriber(provider, event) {\n if (event === \"block\") {\n return new PollingBlockSubscriber(provider);\n }\n if (isHexString(event, 32)) {\n return new PollingTransactionSubscriber(provider, event);\n }\n assert(false, \"unsupported polling event\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getPollingSubscriber\",\n info: { event },\n });\n}\n// @TODO: refactor this\n/**\n * @TODO\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingBlockSubscriber {\n #provider;\n #poller;\n #interval;\n // The most recent block we have scanned for events. The value -2\n // indicates we still need to fetch an initial block number\n #blockNumber;\n constructor(provider) {\n this.#provider = provider;\n this.#poller = null;\n this.#interval = 4000;\n this.#blockNumber = -2;\n }\n get pollingInterval() {\n return this.#interval;\n }\n set pollingInterval(value) {\n this.#interval = value;\n }\n async #poll() {\n try {\n const blockNumber = await this.#provider.getBlockNumber();\n // Bootstrap poll to setup our initial block number\n if (this.#blockNumber === -2) {\n this.#blockNumber = blockNumber;\n return;\n }\n // @TODO: Put a cap on the maximum number of events per loop?\n if (blockNumber !== this.#blockNumber) {\n for (let b = this.#blockNumber + 1; b <= blockNumber; b++) {\n // We have been stopped\n if (this.#poller == null) {\n return;\n }\n await this.#provider.emit(\"block\", b);\n }\n this.#blockNumber = blockNumber;\n }\n }\n catch (error) {\n // @TODO: Minor bump, add an \"error\" event to let subscribers\n // know things went awry.\n //console.log(error);\n }\n // We have been stopped\n if (this.#poller == null) {\n return;\n }\n this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval);\n }\n start() {\n if (this.#poller) {\n return;\n }\n this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval);\n this.#poll();\n }\n stop() {\n if (!this.#poller) {\n return;\n }\n this.#provider._clearTimeout(this.#poller);\n this.#poller = null;\n }\n pause(dropWhilePaused) {\n this.stop();\n if (dropWhilePaused) {\n this.#blockNumber = -2;\n }\n }\n resume() {\n this.start();\n }\n}\n/**\n * @TODO\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class OnBlockSubscriber {\n #provider;\n #poll;\n #running;\n constructor(provider) {\n this.#provider = provider;\n this.#running = false;\n this.#poll = (blockNumber) => {\n this._poll(blockNumber, this.#provider);\n };\n }\n async _poll(blockNumber, provider) {\n throw new Error(\"sub-classes must override this\");\n }\n start() {\n if (this.#running) {\n return;\n }\n this.#running = true;\n this.#poll(-2);\n this.#provider.on(\"block\", this.#poll);\n }\n stop() {\n if (!this.#running) {\n return;\n }\n this.#running = false;\n this.#provider.off(\"block\", this.#poll);\n }\n pause(dropWhilePaused) {\n this.stop();\n }\n resume() {\n this.start();\n }\n}\n/**\n * @TODO\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingOrphanSubscriber extends OnBlockSubscriber {\n #filter;\n constructor(provider, filter) {\n super(provider);\n this.#filter = copy(filter);\n }\n async _poll(blockNumber, provider) {\n throw new Error(\"@TODO\");\n console.log(this.#filter);\n }\n}\n/**\n * @TODO\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingTransactionSubscriber extends OnBlockSubscriber {\n #hash;\n constructor(provider, hash) {\n super(provider);\n this.#hash = hash;\n }\n async _poll(blockNumber, provider) {\n const tx = await provider.getTransactionReceipt(this.#hash);\n if (tx) {\n provider.emit(this.#hash, tx);\n }\n }\n}\n/**\n * @TODO\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingEventSubscriber {\n #provider;\n #filter;\n #poller;\n #running;\n // The most recent block we have scanned for events. The value -2\n // indicates we still need to fetch an initial block number\n #blockNumber;\n constructor(provider, filter) {\n this.#provider = provider;\n this.#filter = copy(filter);\n this.#poller = this.#poll.bind(this);\n this.#running = false;\n this.#blockNumber = -2;\n }\n async #poll(blockNumber) {\n // The initial block hasn't been determined yet\n if (this.#blockNumber === -2) {\n return;\n }\n const filter = copy(this.#filter);\n filter.fromBlock = this.#blockNumber + 1;\n filter.toBlock = blockNumber;\n const logs = await this.#provider.getLogs(filter);\n // No logs could just mean the node has not indexed them yet,\n // so we keep a sliding window of 60 blocks to keep scanning\n if (logs.length === 0) {\n if (this.#blockNumber < blockNumber - 60) {\n this.#blockNumber = blockNumber - 60;\n }\n return;\n }\n this.#blockNumber = blockNumber;\n for (const log of logs) {\n this.#provider.emit(this.#filter, log);\n }\n }\n start() {\n if (this.#running) {\n return;\n }\n this.#running = true;\n if (this.#blockNumber === -2) {\n this.#provider.getBlockNumber().then((blockNumber) => {\n this.#blockNumber = blockNumber;\n });\n }\n this.#provider.on(\"block\", this.#poller);\n }\n stop() {\n if (!this.#running) {\n return;\n }\n this.#running = false;\n this.#provider.off(\"block\", this.#poller);\n }\n pause(dropWhilePaused) {\n this.stop();\n if (dropWhilePaused) {\n this.#blockNumber = -2;\n }\n }\n resume() {\n this.start();\n }\n}\n//# sourceMappingURL=subscriber-polling.js.map","/**\n * About Subclassing the Provider...\n *\n * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider]\n */\n// @TODO\n// Event coalescence\n// When we register an event with an async value (e.g. address is a Signer\n// or ENS name), we need to add it immeidately for the Event API, but also\n// need time to resolve the address. Upon resolving the address, we need to\n// migrate the listener to the static event. We also need to maintain a map\n// of Signer/ENS name to address so we can sync respond to listenerCount.\nimport { resolveAddress } from \"../address/checks.js\";\nimport { Transaction } from \"../transaction/index.js\";\nimport { concat, dataLength, dataSlice, hexlify, isHexString, getBigInt, getBytes, getNumber, isCallException, makeError, assert, assertArgument, FetchRequest, toBeArray, toQuantity, defineProperties, EventPayload, resolveProperties, toUtf8String, } from \"../utils/index.js\";\nimport { formatBlock, formatLog, formatTransactionReceipt, formatTransactionResponse, } from \"./format.js\";\nimport { Network } from \"./network.js\";\nimport { copyRequest, Block, FeeData, Log, TransactionReceipt, TransactionResponse, } from \"./provider.js\";\nimport { PollingBlockSubscriber, PollingEventSubscriber, PollingOrphanSubscriber, PollingTransactionSubscriber, } from \"./subscriber-polling.js\";\nconst MAX_CCIP_REDIRECTS = 10;\nfunction isPromise(value) {\n return value && typeof value.then === \"function\";\n}\nfunction getTag(prefix, value) {\n return (prefix +\n \":\" +\n JSON.stringify(value, (k, v) => {\n if (v == null) {\n return \"null\";\n }\n if (typeof v === \"bigint\") {\n return `bigint:${v.toString()}`;\n }\n if (typeof v === \"string\") {\n return v.toLowerCase();\n }\n // Sort object keys\n if (typeof v === \"object\" && !Array.isArray(v)) {\n const keys = Object.keys(v);\n keys.sort();\n return keys.reduce((accum, key) => {\n accum[key] = v[key];\n return accum;\n }, {});\n }\n return v;\n }));\n}\nexport class UnmanagedSubscriber {\n name;\n constructor(name) {\n defineProperties(this, { name });\n }\n start() { }\n stop() { }\n pause(dropWhilePaused) { }\n resume() { }\n}\nfunction copy(value) {\n return JSON.parse(JSON.stringify(value));\n}\nfunction concisify(items) {\n items = Array.from(new Set(items).values());\n items.sort();\n return items;\n}\nasync function getSubscription(_event, provider) {\n if (_event == null) {\n throw new Error(\"invalid event\");\n }\n // Normalize topic array info an EventFilter\n if (Array.isArray(_event)) {\n _event = { topics: _event };\n }\n if (typeof _event === \"string\") {\n switch (_event) {\n case \"block\":\n case \"pending\":\n case \"debug\":\n case \"error\":\n case \"network\": {\n return { type: _event, tag: _event };\n }\n }\n }\n if (isHexString(_event, 32)) {\n const hash = _event.toLowerCase();\n return { type: \"transaction\", tag: getTag(\"tx\", { hash }), hash };\n }\n if (_event.orphan) {\n const event = _event;\n // @TODO: Should lowercase and whatnot things here instead of copy...\n return {\n type: \"orphan\",\n tag: getTag(\"orphan\", event),\n filter: copy(event),\n };\n }\n if (_event.address || _event.topics) {\n const event = _event;\n const filter = {\n topics: (event.topics || []).map((t) => {\n if (t == null) {\n return null;\n }\n if (Array.isArray(t)) {\n return concisify(t.map((t) => t.toLowerCase()));\n }\n return t.toLowerCase();\n }),\n };\n if (event.address) {\n const addresses = [];\n const promises = [];\n const addAddress = (addr) => {\n if (isHexString(addr)) {\n addresses.push(addr);\n }\n else {\n promises.push((async () => {\n addresses.push(await resolveAddress(addr));\n })());\n }\n };\n if (Array.isArray(event.address)) {\n event.address.forEach(addAddress);\n }\n else {\n addAddress(event.address);\n }\n if (promises.length) {\n await Promise.all(promises);\n }\n filter.address = concisify(addresses.map((a) => a.toLowerCase()));\n }\n return { filter, tag: getTag(\"event\", filter), type: \"event\" };\n }\n assertArgument(false, \"unknown ProviderEvent\", \"event\", _event);\n}\nfunction getTime() {\n return new Date().getTime();\n}\nexport class AbstractProvider {\n #subs;\n #plugins;\n // null=unpaused, true=paused+dropWhilePaused, false=paused\n #pausedState;\n #networkPromise;\n #anyNetwork;\n #performCache;\n // The most recent block number if running an event or -1 if no \"block\" event\n #lastBlockNumber;\n #nextTimer;\n #timers;\n #disableCcipRead;\n // @TODO: This should be a () => Promise so network can be\n // done when needed; or rely entirely on _detectNetwork?\n constructor(_network) {\n if (_network === \"any\") {\n this.#anyNetwork = true;\n this.#networkPromise = null;\n }\n else if (_network) {\n const network = Network.from(_network);\n this.#anyNetwork = false;\n this.#networkPromise = Promise.resolve(network);\n setTimeout(() => {\n this.emit(\"network\", network, null);\n }, 0);\n }\n else {\n this.#anyNetwork = false;\n this.#networkPromise = null;\n }\n this.#lastBlockNumber = -1;\n this.#performCache = new Map();\n this.#subs = new Map();\n this.#plugins = new Map();\n this.#pausedState = null;\n this.#nextTimer = 1;\n this.#timers = new Map();\n this.#disableCcipRead = false;\n }\n get provider() {\n return this;\n }\n get plugins() {\n return Array.from(this.#plugins.values());\n }\n attachPlugin(plugin) {\n if (this.#plugins.get(plugin.name)) {\n throw new Error(`cannot replace existing plugin: ${plugin.name} `);\n }\n this.#plugins.set(plugin.name, plugin.connect(this));\n return this;\n }\n getPlugin(name) {\n return this.#plugins.get(name) || null;\n }\n get disableCcipRead() {\n return this.#disableCcipRead;\n }\n set disableCcipRead(value) {\n this.#disableCcipRead = !!value;\n }\n // Shares multiple identical requests made during the same 250ms\n async #perform(req) {\n // Create a tag\n const tag = getTag(req.method, req);\n let perform = this.#performCache.get(tag);\n if (!perform) {\n perform = this._perform(req);\n this.#performCache.set(tag, perform);\n setTimeout(() => {\n if (this.#performCache.get(tag) === perform) {\n this.#performCache.delete(tag);\n }\n }, 250);\n }\n return await perform;\n }\n async ccipReadFetch(tx, calldata, urls) {\n if (this.disableCcipRead || urls.length === 0 || tx.to == null) {\n return null;\n }\n const sender = tx.to.toLowerCase();\n const data = calldata.toLowerCase();\n const errorMessages = [];\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n // URL expansion\n const href = url.replace(\"{sender}\", sender).replace(\"{data}\", data);\n // If no {data} is present, use POST; otherwise GET\n //const json: string | null = (url.indexOf(\"{data}\") >= 0) ? null: JSON.stringify({ data, sender });\n //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => {\n // value.status = response.statusCode;\n // return value;\n //});\n const request = new FetchRequest(href);\n if (url.indexOf(\"{data}\") === -1) {\n request.body = { data, sender };\n }\n this.emit(\"debug\", {\n action: \"sendCcipReadFetchRequest\",\n request,\n index: i,\n urls,\n });\n let errorMessage = \"unknown error\";\n const resp = await request.send();\n try {\n const result = resp.bodyJson;\n if (result.data) {\n this.emit(\"debug\", {\n action: \"receiveCcipReadFetchResult\",\n request,\n result,\n });\n return result.data;\n }\n if (result.message) {\n errorMessage = result.message;\n }\n this.emit(\"debug\", {\n action: \"receiveCcipReadFetchError\",\n request,\n result,\n });\n }\n catch (error) { }\n // 4xx indicates the result is not present; stop\n assert(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, \"OFFCHAIN_FAULT\", {\n reason: \"404_MISSING_RESOURCE\",\n transaction: tx,\n info: { url, errorMessage },\n });\n // 5xx indicates server issue; try the next url\n errorMessages.push(errorMessage);\n }\n assert(false, `error encountered during CCIP fetch: ${errorMessages\n .map((m) => JSON.stringify(m))\n .join(\", \")}`, \"OFFCHAIN_FAULT\", {\n reason: \"500_SERVER_ERROR\",\n transaction: tx,\n info: { urls, errorMessages },\n });\n }\n _wrapBlock(value, network) {\n return new Block(formatBlock(value), this);\n }\n _wrapLog(value, network) {\n return new Log(formatLog(value), this);\n }\n _wrapTransactionReceipt(value, network) {\n return new TransactionReceipt(formatTransactionReceipt(value), this);\n }\n _wrapTransactionResponse(tx, network) {\n return new TransactionResponse(formatTransactionResponse(tx), this);\n }\n _detectNetwork() {\n assert(false, \"sub-classes must implement this\", \"UNSUPPORTED_OPERATION\", {\n operation: \"_detectNetwork\",\n });\n }\n // Sub-classes should override this and handle PerformActionRequest requests, calling\n // the super for any unhandled actions.\n async _perform(req) {\n assert(false, `unsupported method: ${req.method}`, \"UNSUPPORTED_OPERATION\", {\n operation: req.method,\n info: req,\n });\n }\n // State\n async getBlockNumber() {\n const blockNumber = getNumber(await this.#perform({ method: \"getBlockNumber\" }), \"%response\");\n if (this.#lastBlockNumber >= 0) {\n this.#lastBlockNumber = blockNumber;\n }\n return blockNumber;\n }\n _getAddress(address) {\n return resolveAddress(address);\n }\n _getBlockTag(blockTag) {\n if (blockTag == null) {\n return \"latest\";\n }\n switch (blockTag) {\n case \"earliest\":\n return \"0x0\";\n case \"latest\":\n case \"pending\":\n case \"safe\":\n case \"finalized\":\n return blockTag;\n }\n if (isHexString(blockTag)) {\n if (isHexString(blockTag, 32)) {\n return blockTag;\n }\n return toQuantity(blockTag);\n }\n if (typeof blockTag === \"bigint\") {\n blockTag = getNumber(blockTag, \"blockTag\");\n }\n if (typeof blockTag === \"number\") {\n if (blockTag >= 0) {\n return toQuantity(blockTag);\n }\n if (this.#lastBlockNumber >= 0) {\n return toQuantity(this.#lastBlockNumber + blockTag);\n }\n return this.getBlockNumber().then((b) => toQuantity(b + blockTag));\n }\n assertArgument(false, \"invalid blockTag\", \"blockTag\", blockTag);\n }\n _getFilter(filter) {\n // Create a canonical representation of the topics\n const topics = (filter.topics || []).map((t) => {\n if (t == null) {\n return null;\n }\n if (Array.isArray(t)) {\n return concisify(t.map((t) => t.toLowerCase()));\n }\n return t.toLowerCase();\n });\n const blockHash = \"blockHash\" in filter ? filter.blockHash : undefined;\n const resolve = (_address, fromBlock, toBlock) => {\n let address = undefined;\n switch (_address.length) {\n case 0:\n break;\n case 1:\n address = _address[0];\n break;\n default:\n _address.sort();\n address = _address;\n }\n if (blockHash) {\n if (fromBlock != null || toBlock != null) {\n throw new Error(\"invalid filter\");\n }\n }\n const filter = {};\n if (address) {\n filter.address = address;\n }\n if (topics.length) {\n filter.topics = topics;\n }\n if (fromBlock) {\n filter.fromBlock = fromBlock;\n }\n if (toBlock) {\n filter.toBlock = toBlock;\n }\n if (blockHash) {\n filter.blockHash = blockHash;\n }\n return filter;\n };\n // Addresses could be async (ENS names or Addressables)\n let address = [];\n if (filter.address) {\n if (Array.isArray(filter.address)) {\n for (const addr of filter.address) {\n address.push(this._getAddress(addr));\n }\n }\n else {\n address.push(this._getAddress(filter.address));\n }\n }\n let fromBlock = undefined;\n if (\"fromBlock\" in filter) {\n fromBlock = this._getBlockTag(filter.fromBlock);\n }\n let toBlock = undefined;\n if (\"toBlock\" in filter) {\n toBlock = this._getBlockTag(filter.toBlock);\n }\n if (address.filter((a) => typeof a !== \"string\").length ||\n (fromBlock != null && typeof fromBlock !== \"string\") ||\n (toBlock != null && typeof toBlock !== \"string\")) {\n return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result) => {\n return resolve(result[0], result[1], result[2]);\n });\n }\n return resolve(address, fromBlock, toBlock);\n }\n _getTransactionRequest(_request) {\n const request = copyRequest(_request);\n const promises = [];\n [\"to\", \"from\"].forEach((key) => {\n if (request[key] == null) {\n return;\n }\n const addr = resolveAddress(request[key]);\n if (isPromise(addr)) {\n promises.push((async function () {\n request[key] = await addr;\n })());\n }\n else {\n request[key] = addr;\n }\n });\n if (request.blockTag != null) {\n const blockTag = this._getBlockTag(request.blockTag);\n if (isPromise(blockTag)) {\n promises.push((async function () {\n request.blockTag = await blockTag;\n })());\n }\n else {\n request.blockTag = blockTag;\n }\n }\n if (promises.length) {\n return (async function () {\n await Promise.all(promises);\n return request;\n })();\n }\n return request;\n }\n async getNetwork() {\n // No explicit network was set and this is our first time\n if (this.#networkPromise == null) {\n // Detect the current network (shared with all calls)\n const detectNetwork = this._detectNetwork().then((network) => {\n this.emit(\"network\", network, null);\n return network;\n }, (error) => {\n // Reset the networkPromise on failure, so we will try again\n if (this.#networkPromise === detectNetwork) {\n this.#networkPromise = null;\n }\n throw error;\n });\n this.#networkPromise = detectNetwork;\n return (await detectNetwork).clone();\n }\n const networkPromise = this.#networkPromise;\n const [expected, actual] = await Promise.all([\n networkPromise,\n this._detectNetwork(), // The actual connected network\n ]);\n if (expected.networkId !== actual.networkId) {\n if (this.#anyNetwork) {\n // The \"any\" network can change, so notify listeners\n this.emit(\"network\", actual, expected);\n // Update the network if something else hasn't already changed it\n if (this.#networkPromise === networkPromise) {\n this.#networkPromise = Promise.resolve(actual);\n }\n }\n else {\n // Otherwise, we do not allow changes to the underlying network\n assert(false, `network changed: ${expected.networkId} => ${actual.networkId} `, \"NETWORK_ERROR\", {\n event: \"changed\",\n });\n }\n }\n return expected.clone();\n }\n async getEnergyPrice() {\n const { energyPrice } = await resolveProperties({\n block: this.getBlock(\"latest\"),\n energyPrice: (async () => {\n try {\n const energyPrice = await this.#perform({ method: \"getEnergyPrice\" });\n return getBigInt(energyPrice, \"%response\");\n }\n catch (error) { }\n return null;\n })(),\n });\n return new FeeData(energyPrice);\n }\n async getFeeData() {\n const { energyPrice } = await resolveProperties({\n block: this.getBlock(\"latest\"),\n energyPrice: (async () => {\n try {\n const energyPrice = await this.#perform({ method: \"getEnergyPrice\" });\n return getBigInt(energyPrice, \"%response\");\n }\n catch (error) { }\n return null;\n })(),\n });\n return new FeeData(energyPrice);\n }\n async estimateEnergy(_tx) {\n let tx = this._getTransactionRequest(_tx);\n if (isPromise(tx)) {\n tx = await tx;\n }\n return getBigInt(await this.#perform({\n method: \"estimateEnergy\",\n transaction: tx,\n }), \"%response\");\n }\n async #call(tx, blockTag, attempt) {\n assert(attempt < MAX_CCIP_REDIRECTS, \"CCIP read exceeded maximum redirections\", \"OFFCHAIN_FAULT\", {\n reason: \"TOO_MANY_REDIRECTS\",\n transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }),\n });\n // This came in as a PerformActionTransaction, so to/from are safe; we can cast\n const transaction = copyRequest(tx);\n try {\n return hexlify(await this._perform({ method: \"call\", transaction, blockTag }));\n }\n catch (error) {\n // CCIP Read OffchainLookup\n if (!this.disableCcipRead &&\n isCallException(error) &&\n error.data &&\n attempt >= 0 &&\n blockTag === \"latest\" &&\n transaction.to != null &&\n dataSlice(error.data, 0, 4) === \"0x556f1830\") {\n const data = error.data;\n const txSender = await resolveAddress(transaction.to);\n // Parse the CCIP Read Arguments\n let ccipArgs;\n try {\n ccipArgs = parseOffchainLookup(dataSlice(error.data, 4));\n }\n catch (error) {\n assert(false, error.message, \"OFFCHAIN_FAULT\", {\n reason: \"BAD_DATA\",\n transaction,\n info: { data },\n });\n }\n // Check the sender of the OffchainLookup matches the transaction\n assert(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), \"CCIP Read sender mismatch\", \"CALL_EXCEPTION\", {\n action: \"call\",\n data,\n reason: \"OffchainLookup\",\n transaction: transaction,\n invocation: null,\n revert: {\n signature: \"OffchainLookup(address,string[],bytes,bytes4,bytes)\",\n name: \"OffchainLookup\",\n args: ccipArgs.errorArgs,\n },\n });\n const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls);\n assert(ccipResult != null, \"CCIP Read failed to fetch data\", \"OFFCHAIN_FAULT\", {\n reason: \"FETCH_FAILED\",\n transaction,\n info: { data: error.data, errorArgs: ccipArgs.errorArgs },\n });\n const tx = {\n to: txSender,\n data: concat([\n ccipArgs.selector,\n encodeBytes([ccipResult, ccipArgs.extraData]),\n ]),\n };\n this.emit(\"debug\", { action: \"sendCcipReadCall\", transaction: tx });\n try {\n const result = await this.#call(tx, blockTag, attempt + 1);\n this.emit(\"debug\", {\n action: \"receiveCcipReadCallResult\",\n transaction: Object.assign({}, tx),\n result,\n });\n return result;\n }\n catch (error) {\n this.emit(\"debug\", {\n action: \"receiveCcipReadCallError\",\n transaction: Object.assign({}, tx),\n error,\n });\n throw error;\n }\n }\n throw error;\n }\n }\n async #checkNetwork(promise) {\n const { value } = await resolveProperties({\n network: this.getNetwork(),\n value: promise,\n });\n return value;\n }\n async call(_tx) {\n const { tx, blockTag } = await resolveProperties({\n tx: this._getTransactionRequest(_tx),\n blockTag: this._getBlockTag(_tx.blockTag),\n });\n return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1));\n }\n // Account\n async #getAccountValue(request, _address, _blockTag) {\n let address = this._getAddress(_address);\n let blockTag = this._getBlockTag(_blockTag);\n if (typeof address !== \"string\" || typeof blockTag !== \"string\") {\n [address, blockTag] = await Promise.all([address, blockTag]);\n }\n return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag })));\n }\n async getBalance(address, blockTag) {\n return getBigInt(await this.#getAccountValue({ method: \"getBalance\" }, address, blockTag), \"%response\");\n }\n async getTransactionCount(address, blockTag) {\n return getNumber(await this.#getAccountValue({ method: \"getTransactionCount\" }, address, blockTag), \"%response\");\n }\n async getCode(address, blockTag) {\n return hexlify(await this.#getAccountValue({ method: \"getCode\" }, address, blockTag));\n }\n async getStorage(address, _position, blockTag) {\n const position = getBigInt(_position, \"position\");\n return hexlify(await this.#getAccountValue({ method: \"getStorage\", position }, address, blockTag));\n }\n // Write\n async broadcastTransaction(signedTx) {\n const { blockNumber, hash, network } = await resolveProperties({\n blockNumber: this.getBlockNumber(),\n hash: this._perform({\n method: \"broadcastTransaction\",\n signedTransaction: signedTx,\n }),\n network: this.getNetwork(),\n });\n const tx = Transaction.from(signedTx);\n if (tx.hash !== hash) {\n throw new Error(\"@TODO: the returned hash did not match\");\n }\n return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber);\n }\n async #getBlock(block, includeTransactions) {\n // @TODO: Add CustomBlockPlugin check\n if (isHexString(block, 32)) {\n return await this.#perform({\n method: \"getBlock\",\n blockHash: block,\n includeTransactions,\n });\n }\n let blockTag = this._getBlockTag(block);\n if (typeof blockTag !== \"string\") {\n blockTag = await blockTag;\n }\n return await this.#perform({\n method: \"getBlock\",\n blockTag,\n includeTransactions,\n });\n }\n // Queries\n async getBlock(block, prefetchTxs) {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#getBlock(block, !!prefetchTxs),\n });\n if (params == null) {\n return null;\n }\n return this._wrapBlock(params, network);\n }\n async getTransaction(hash) {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform({ method: \"getTransaction\", hash }),\n });\n if (params == null) {\n return null;\n }\n return this._wrapTransactionResponse(params, network);\n }\n async getTransactionReceipt(hash) {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform({ method: \"getTransactionReceipt\", hash }),\n });\n if (params == null) {\n return null;\n }\n // Some backends did not backfill the effectiveEnergyPrice into old transactions\n // in the receipt, so we look it up manually and inject it.\n if (params.energyPrice == null && params.effectiveEnergyPrice == null) {\n const tx = await this.#perform({ method: \"getTransaction\", hash });\n if (tx == null) {\n throw new Error(\"report this; could not find tx or effectiveEnergyPrice\");\n }\n params.effectiveEnergyPrice = tx.energyPrice;\n }\n return this._wrapTransactionReceipt(params, network);\n }\n async getTransactionResult(hash) {\n const { result } = await resolveProperties({\n network: this.getNetwork(),\n result: this.#perform({ method: \"getTransactionResult\", hash }),\n });\n if (result == null) {\n return null;\n }\n return hexlify(result);\n }\n // Bloom-filter Queries\n async getLogs(_filter) {\n let filter = this._getFilter(_filter);\n if (isPromise(filter)) {\n filter = await filter;\n }\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform({ method: \"getLogs\", filter }),\n });\n return params.map((p) => this._wrapLog(p, network));\n }\n // ENS\n _getProvider(networkId) {\n assert(false, \"provider cannot connect to target network\", \"UNSUPPORTED_OPERATION\", {\n operation: \"_getProvider()\",\n });\n }\n async waitForTransaction(hash, _confirms, timeout) {\n const confirms = _confirms != null ? _confirms : 1;\n if (confirms === 0) {\n return this.getTransactionReceipt(hash);\n }\n return new Promise(async (resolve, reject) => {\n let timer = null;\n const listener = async (blockNumber) => {\n try {\n const receipt = await this.getTransactionReceipt(hash);\n if (receipt != null) {\n if (blockNumber - receipt.blockNumber + 1 >= confirms) {\n resolve(receipt);\n //this.off(\"block\", listener);\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n return;\n }\n }\n }\n catch (error) {\n console.log(\"EEE\", error);\n }\n this.once(\"block\", listener);\n };\n if (timeout != null) {\n timer = setTimeout(() => {\n if (timer == null) {\n return;\n }\n timer = null;\n this.off(\"block\", listener);\n reject(makeError(\"timeout\", \"TIMEOUT\", { reason: \"timeout\" }));\n }, timeout);\n }\n listener(await this.getBlockNumber());\n });\n }\n async waitForBlock(blockTag) {\n assert(false, \"not implemented yet\", \"NOT_IMPLEMENTED\", {\n operation: \"waitForBlock\",\n });\n }\n _clearTimeout(timerId) {\n const timer = this.#timers.get(timerId);\n if (!timer) {\n return;\n }\n if (timer.timer) {\n clearTimeout(timer.timer);\n }\n this.#timers.delete(timerId);\n }\n _setTimeout(_func, timeout) {\n if (timeout == null) {\n timeout = 0;\n }\n const timerId = this.#nextTimer++;\n const func = () => {\n this.#timers.delete(timerId);\n _func();\n };\n if (this.paused) {\n this.#timers.set(timerId, { timer: null, func, time: timeout });\n }\n else {\n const timer = setTimeout(func, timeout);\n this.#timers.set(timerId, { timer, func, time: getTime() });\n }\n return timerId;\n }\n _forEachSubscriber(func) {\n for (const sub of this.#subs.values()) {\n func(sub.subscriber);\n }\n }\n // Event API; sub-classes should override this; any supported\n // event filter will have been munged into an EventFilter\n _getSubscriber(sub) {\n switch (sub.type) {\n case \"debug\":\n case \"error\":\n case \"network\":\n return new UnmanagedSubscriber(sub.type);\n case \"block\":\n return new PollingBlockSubscriber(this);\n case \"event\":\n return new PollingEventSubscriber(this, sub.filter);\n case \"transaction\":\n return new PollingTransactionSubscriber(this, sub.hash);\n case \"orphan\":\n return new PollingOrphanSubscriber(this, sub.filter);\n }\n throw new Error(`unsupported event: ${sub.type}`);\n }\n _recoverSubscriber(oldSub, newSub) {\n for (const sub of this.#subs.values()) {\n if (sub.subscriber === oldSub) {\n if (sub.started) {\n sub.subscriber.stop();\n }\n sub.subscriber = newSub;\n if (sub.started) {\n newSub.start();\n }\n if (this.#pausedState != null) {\n newSub.pause(this.#pausedState);\n }\n break;\n }\n }\n }\n async #hasSub(event, emitArgs) {\n let sub = await getSubscription(event, this);\n // This is a log that is removing an existing log; we actually want\n // to emit an orphan event for the removed log\n if (sub.type === \"event\" &&\n emitArgs &&\n emitArgs.length > 0 &&\n emitArgs[0].removed === true) {\n sub = await getSubscription({ orphan: \"drop-log\", log: emitArgs[0] }, this);\n }\n return this.#subs.get(sub.tag) || null;\n }\n async #getSub(event) {\n const subscription = await getSubscription(event, this);\n // Prevent tampering with our tag in any subclass' _getSubscriber\n const tag = subscription.tag;\n let sub = this.#subs.get(tag);\n if (!sub) {\n const subscriber = this._getSubscriber(subscription);\n const addressableMap = new WeakMap();\n const nameMap = new Map();\n sub = {\n subscriber,\n tag,\n addressableMap,\n nameMap,\n started: false,\n listeners: [],\n };\n this.#subs.set(tag, sub);\n }\n return sub;\n }\n async on(event, listener) {\n const sub = await this.#getSub(event);\n sub.listeners.push({ listener, once: false });\n if (!sub.started) {\n sub.subscriber.start();\n sub.started = true;\n if (this.#pausedState != null) {\n sub.subscriber.pause(this.#pausedState);\n }\n }\n return this;\n }\n async once(event, listener) {\n const sub = await this.#getSub(event);\n sub.listeners.push({ listener, once: true });\n if (!sub.started) {\n sub.subscriber.start();\n sub.started = true;\n if (this.#pausedState != null) {\n sub.subscriber.pause(this.#pausedState);\n }\n }\n return this;\n }\n async emit(event, ...args) {\n const sub = await this.#hasSub(event, args);\n // If there is not subscription or if a recent emit removed\n // the last of them (which also deleted the sub) do nothing\n if (!sub || sub.listeners.length === 0) {\n return false;\n }\n const count = sub.listeners.length;\n sub.listeners = sub.listeners.filter(({ listener, once }) => {\n const payload = new EventPayload(this, once ? null : listener, event);\n try {\n listener.call(this, ...args, payload);\n }\n catch (error) { }\n return !once;\n });\n if (sub.listeners.length === 0) {\n if (sub.started) {\n sub.subscriber.stop();\n }\n this.#subs.delete(sub.tag);\n }\n return count > 0;\n }\n async listenerCount(event) {\n if (event) {\n const sub = await this.#hasSub(event);\n if (!sub) {\n return 0;\n }\n return sub.listeners.length;\n }\n let total = 0;\n for (const { listeners } of this.#subs.values()) {\n total += listeners.length;\n }\n return total;\n }\n async listeners(event) {\n if (event) {\n const sub = await this.#hasSub(event);\n if (!sub) {\n return [];\n }\n return sub.listeners.map(({ listener }) => listener);\n }\n let result = [];\n for (const { listeners } of this.#subs.values()) {\n result = result.concat(listeners.map(({ listener }) => listener));\n }\n return result;\n }\n async off(event, listener) {\n const sub = await this.#hasSub(event);\n if (!sub) {\n return this;\n }\n if (listener) {\n const index = sub.listeners\n .map(({ listener }) => listener)\n .indexOf(listener);\n if (index >= 0) {\n sub.listeners.splice(index, 1);\n }\n }\n if (!listener || sub.listeners.length === 0) {\n if (sub.started) {\n sub.subscriber.stop();\n }\n this.#subs.delete(sub.tag);\n }\n return this;\n }\n async removeAllListeners(event) {\n if (event) {\n const { tag, started, subscriber } = await this.#getSub(event);\n if (started) {\n subscriber.stop();\n }\n this.#subs.delete(tag);\n }\n else {\n for (const [tag, { started, subscriber }] of this.#subs) {\n if (started) {\n subscriber.stop();\n }\n this.#subs.delete(tag);\n }\n }\n return this;\n }\n // Alias for \"on\"\n async addListener(event, listener) {\n return await this.on(event, listener);\n }\n // Alias for \"off\"\n async removeListener(event, listener) {\n return this.off(event, listener);\n }\n // Sub-classes should override this to shutdown any sockets, etc.\n // but MUST call this super.shutdown.\n destroy() {\n // Stop all listeners\n this.removeAllListeners();\n // Shut down all tiemrs\n for (const timerId of this.#timers.keys()) {\n this._clearTimeout(timerId);\n }\n }\n get paused() {\n return this.#pausedState != null;\n }\n set paused(pause) {\n if (!!pause === this.paused) {\n return;\n }\n if (this.paused) {\n this.resume();\n }\n else {\n this.pause(false);\n }\n }\n pause(dropWhilePaused) {\n this.#lastBlockNumber = -1;\n if (this.#pausedState != null) {\n if (this.#pausedState == !!dropWhilePaused) {\n return;\n }\n assert(false, \"cannot change pause type; resume first\", \"UNSUPPORTED_OPERATION\", {\n operation: \"pause\",\n });\n }\n this._forEachSubscriber((s) => s.pause(dropWhilePaused));\n this.#pausedState = !!dropWhilePaused;\n for (const timer of this.#timers.values()) {\n // Clear the timer\n if (timer.timer) {\n clearTimeout(timer.timer);\n }\n // Remaining time needed for when we become unpaused\n timer.time = getTime() - timer.time;\n }\n }\n resume() {\n if (this.#pausedState == null) {\n return;\n }\n this._forEachSubscriber((s) => s.resume());\n this.#pausedState = null;\n for (const timer of this.#timers.values()) {\n // Remaining time when we were paused\n let timeout = timer.time;\n if (timeout < 0) {\n timeout = 0;\n }\n // Start time (in cause paused, so we con compute remaininf time)\n timer.time = getTime();\n // Start the timer\n setTimeout(timer.func, timeout);\n }\n }\n}\nfunction _parseString(result, start) {\n try {\n const bytes = _parseBytes(result, start);\n if (bytes) {\n return toUtf8String(bytes);\n }\n }\n catch (error) { }\n return null;\n}\nfunction _parseBytes(result, start) {\n if (result === \"0x\") {\n return null;\n }\n try {\n const offset = getNumber(dataSlice(result, start, start + 32));\n const length = getNumber(dataSlice(result, offset, offset + 32));\n return dataSlice(result, offset + 32, offset + 32 + length);\n }\n catch (error) { }\n return null;\n}\nfunction numPad(value) {\n const result = toBeArray(value);\n if (result.length > 32) {\n throw new Error(\"internal; should not happen\");\n }\n const padded = new Uint8Array(32);\n padded.set(result, 32 - result.length);\n return padded;\n}\nfunction bytesPad(value) {\n if (value.length % 32 === 0) {\n return value;\n }\n const result = new Uint8Array(Math.ceil(value.length / 32) * 32);\n result.set(value);\n return result;\n}\nconst empty = new Uint8Array([]);\n// ABI Encodes a series of (bytes, bytes, ...)\nfunction encodeBytes(datas) {\n const result = [];\n let byteCount = 0;\n // Add place-holders for pointers as we add items\n for (let i = 0; i < datas.length; i++) {\n result.push(empty);\n byteCount += 32;\n }\n for (let i = 0; i < datas.length; i++) {\n const data = getBytes(datas[i]);\n // Update the bytes offset\n result[i] = numPad(byteCount);\n // The length and padded value of data\n result.push(numPad(data.length));\n result.push(bytesPad(data));\n byteCount += 32 + Math.ceil(data.length / 32) * 32;\n }\n return concat(result);\n}\nconst zeros = \"0x0000000000000000000000000000000000000000000000000000000000000000\";\nfunction parseOffchainLookup(data) {\n const result = {\n sender: \"\",\n urls: [],\n calldata: \"\",\n selector: \"\",\n extraData: \"\",\n errorArgs: [],\n };\n assert(dataLength(data) >= 5 * 32, \"insufficient OffchainLookup data\", \"OFFCHAIN_FAULT\", {\n reason: \"insufficient OffchainLookup data\",\n });\n const sender = dataSlice(data, 0, 32);\n assert(dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), \"corrupt OffchainLookup sender\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup sender\",\n });\n result.sender = dataSlice(sender, 12);\n // Read the URLs from the response\n try {\n const urls = [];\n const urlsOffset = getNumber(dataSlice(data, 32, 64));\n const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32));\n const urlsData = dataSlice(data, urlsOffset + 32);\n for (let u = 0; u < urlsLength; u++) {\n const url = _parseString(urlsData, u * 32);\n if (url == null) {\n throw new Error(\"abort\");\n }\n urls.push(url);\n }\n result.urls = urls;\n }\n catch (error) {\n assert(false, \"corrupt OffchainLookup urls\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup urls\",\n });\n }\n // Get the CCIP calldata to forward\n try {\n const calldata = _parseBytes(data, 64);\n if (calldata == null) {\n throw new Error(\"abort\");\n }\n result.calldata = calldata;\n }\n catch (error) {\n assert(false, \"corrupt OffchainLookup calldata\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup calldata\",\n });\n }\n // Get the callbackSelector (bytes4)\n assert(dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), \"corrupt OffchainLookup callbaackSelector\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup callbaackSelector\",\n });\n result.selector = dataSlice(data, 96, 100);\n // Get the extra data to send back to the contract as context\n try {\n const extraData = _parseBytes(data, 128);\n if (extraData == null) {\n throw new Error(\"abort\");\n }\n result.extraData = extraData;\n }\n catch (error) {\n assert(false, \"corrupt OffchainLookup extraData\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup extraData\",\n });\n }\n result.errorArgs = \"sender,urls,calldata,selector,extraData\"\n .split(/,/)\n .map((k) => result[k]);\n return result;\n}\n//# sourceMappingURL=abstract-provider.js.map","/**\n * About Abstract Signer and subclassing\n *\n * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer]\n */\nimport { resolveAddress } from \"../address/checks.js\";\nimport { getAddress } from \"../address/index.js\";\nimport { Transaction } from \"../transaction/index.js\";\nimport { defineProperties, getBigInt, resolveProperties, assert, assertArgument, } from \"../utils/index.js\";\nimport { copyRequest } from \"./provider.js\";\nfunction checkProvider(signer, operation) {\n if (signer.provider) {\n return signer.provider;\n }\n assert(false, \"missing provider\", \"UNSUPPORTED_OPERATION\", { operation });\n}\nasync function populate(signer, tx) {\n let pop = copyRequest(tx);\n if (pop.to != null) {\n pop.to = resolveAddress(pop.to);\n }\n if (pop.from != null) {\n const from = pop.from;\n pop.from = Promise.all([signer.getAddress(), resolveAddress(from)]).then(([address, from]) => {\n assertArgument(address.toLowerCase() === from.toLowerCase(), \"transaction from mismatch\", \"tx.from\", from);\n return address;\n });\n }\n else {\n pop.from = signer.getAddress();\n }\n return await resolveProperties(pop);\n}\nexport class AbstractSigner {\n provider;\n constructor(provider) {\n defineProperties(this, { provider: provider || null });\n }\n async getNonce(blockTag) {\n return checkProvider(this, \"getTransactionCount\").getTransactionCount(await this.getAddress(), blockTag);\n }\n async populateCall(tx) {\n const pop = await populate(this, tx);\n return pop;\n }\n async populateTransaction(tx) {\n const provider = checkProvider(this, \"populateTransaction\");\n const pop = await populate(this, tx);\n if (pop.nonce == null) {\n pop.nonce = await this.getNonce(\"pending\");\n }\n if (pop.energyLimit == null) {\n pop.energyLimit = await this.estimateEnergy(pop);\n }\n // Populate the chain ID\n const network = await this.provider.getNetwork();\n if (pop.networkId != null) {\n const networkId = getBigInt(pop.networkId);\n assertArgument(networkId === network.networkId, \"transaction networkId mismatch\", \"tx.networkId\", tx.networkId);\n }\n else {\n pop.networkId = network.networkId;\n }\n // We need to get fee data to determine things\n const feeData = await provider.getFeeData();\n // We need to auto-detect the intended type of this transaction...\n if (feeData.energyPrice != null) {\n // Network doesn't support EIP-1559...\n // Populate missing fee data\n if (pop.energyPrice == null) {\n pop.energyPrice = feeData.energyPrice;\n }\n }\n else {\n // getFeeData has failed us.\n assert(false, \"failed to get consistent fee data\", \"UNSUPPORTED_OPERATION\", {\n operation: \"signer.getFeeData\",\n });\n }\n //@TOOD: Don't await all over the place; save them up for\n // the end for better batching\n return await resolveProperties(pop);\n }\n async estimateEnergy(tx) {\n return checkProvider(this, \"estimateEnergy\").estimateEnergy(await this.populateCall(tx));\n }\n async call(tx) {\n return checkProvider(this, \"call\").call(await this.populateCall(tx));\n }\n async resolveName(name) {\n return getAddress(name);\n }\n async sendTransaction(tx) {\n const provider = checkProvider(this, \"sendTransaction\");\n const pop = await this.populateTransaction(tx);\n delete pop.from;\n const txObj = Transaction.from(pop);\n return await provider.broadcastTransaction(await this.signTransaction(txObj));\n }\n}\nexport class VoidSigner extends AbstractSigner {\n address;\n constructor(address, provider) {\n super(provider);\n defineProperties(this, { address });\n }\n async getAddress() {\n return this.address;\n }\n connect(provider) {\n return new VoidSigner(this.address, provider);\n }\n #throwUnsupported(suffix, operation) {\n assert(false, `VoidSigner cannot sign ${suffix}`, \"UNSUPPORTED_OPERATION\", {\n operation,\n });\n }\n async signTransaction(tx) {\n this.#throwUnsupported(\"transactions\", \"signTransaction\");\n }\n async signMessage(message) {\n this.#throwUnsupported(\"messages\", \"signMessage\");\n }\n async signTypedData(domain, types, value) {\n this.#throwUnsupported(\"typed-data\", \"signTypedData\");\n }\n}\n//# sourceMappingURL=abstract-signer.js.map","/**\n * There are many awesome community services that provide Core\n * nodes both for developers just starting out and for large-scale\n * communities.\n *\n * @_section: api/providers/thirdparty: Community Providers [thirdparty]\n */\n// Show the throttle message only once per service\nconst shown = new Set();\n/**\n * Displays a warning in tht console when the community resource is\n * being used too heavily by the app, recommending the developer\n * acquire their own credentials instead of using the community\n * credentials.\n *\n * The notification will only occur once per service.\n */\nexport function showThrottleMessage(service) {\n if (shown.has(service)) {\n return;\n }\n shown.add(service);\n console.log(\"========= NOTICE =========\");\n console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`);\n console.log(\"\");\n console.log(\"The default API keys for each service are provided as a highly-throttled,\");\n console.log(\"community resource for low-traffic projects and early prototyping.\");\n console.log(\"\");\n console.log(\"While your application will continue to function, we highly recommended\");\n console.log(\"signing up for your own API keys to improve performance, increase your\");\n console.log(\"request rate/limit and enable other perks, such as metrics and advanced APIs.\");\n console.log(\"\");\n}\n//# sourceMappingURL=community.js.map","import { isError } from \"../utils/index.js\";\nimport { PollingEventSubscriber } from \"./subscriber-polling.js\";\nfunction copy(obj) {\n return JSON.parse(JSON.stringify(obj));\n}\n/**\n * Some backends support subscribing to events using a Filter ID.\n *\n * When subscribing with this technique, the node issues a unique\n * //Filter ID//. At this point the node dedicates resources to\n * the filter, so that periodic calls to follow up on the //Filter ID//\n * will receive any events since the last call.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdSubscriber {\n #provider;\n #filterIdPromise;\n #poller;\n #running;\n #network;\n #hault;\n constructor(provider) {\n this.#provider = provider;\n this.#filterIdPromise = null;\n this.#poller = this.#poll.bind(this);\n this.#running = false;\n this.#network = null;\n this.#hault = false;\n }\n _subscribe(provider) {\n throw new Error(\"subclasses must override this\");\n }\n _emitResults(provider, result) {\n throw new Error(\"subclasses must override this\");\n }\n _recover(provider) {\n throw new Error(\"subclasses must override this\");\n }\n async #poll(blockNumber) {\n try {\n // Subscribe if necessary\n if (this.#filterIdPromise == null) {\n this.#filterIdPromise = this._subscribe(this.#provider);\n }\n // Get the Filter ID\n let filterId = null;\n try {\n filterId = await this.#filterIdPromise;\n }\n catch (error) {\n if (!isError(error, \"UNSUPPORTED_OPERATION\") ||\n error.operation !== \"xcb_newFilter\") {\n throw error;\n }\n }\n // The backend does not support Filter ID; downgrade to\n // polling\n if (filterId == null) {\n this.#filterIdPromise = null;\n this.#provider._recoverSubscriber(this, this._recover(this.#provider));\n return;\n }\n const network = await this.#provider.getNetwork();\n if (!this.#network) {\n this.#network = network;\n }\n if (this.#network.networkId !== network.networkId) {\n throw new Error(\"chaid changed\");\n }\n if (this.#hault) {\n return;\n }\n const result = await this.#provider.send(\"xcb_getFilterChanges\", [\n filterId,\n ]);\n await this._emitResults(this.#provider, result);\n }\n catch (error) {\n console.log(\"@TODO\", error);\n }\n this.#provider.once(\"block\", this.#poller);\n }\n #teardown() {\n const filterIdPromise = this.#filterIdPromise;\n if (filterIdPromise) {\n this.#filterIdPromise = null;\n filterIdPromise.then((filterId) => {\n this.#provider.send(\"xcb_uninstallFilter\", [filterId]);\n });\n }\n }\n start() {\n if (this.#running) {\n return;\n }\n this.#running = true;\n this.#poll(-2);\n }\n stop() {\n if (!this.#running) {\n return;\n }\n this.#running = false;\n this.#hault = true;\n this.#teardown();\n this.#provider.off(\"block\", this.#poller);\n }\n pause(dropWhilePaused) {\n if (dropWhilePaused) {\n this.#teardown();\n }\n this.#provider.off(\"block\", this.#poller);\n }\n resume() {\n this.start();\n }\n}\n/**\n * A **FilterIdSubscriber** for receiving contract events.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdEventSubscriber extends FilterIdSubscriber {\n #event;\n constructor(provider, filter) {\n super(provider);\n this.#event = copy(filter);\n }\n _recover(provider) {\n return new PollingEventSubscriber(provider, this.#event);\n }\n async _subscribe(provider) {\n const filterId = await provider.send(\"xcb_newFilter\", [this.#event]);\n return filterId;\n }\n async _emitResults(provider, results) {\n for (const result of results) {\n provider.emit(this.#event, provider._wrapLog(result, provider._network));\n }\n }\n}\n/**\n * A **FilterIdSubscriber** for receiving pending transactions events.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdPendingSubscriber extends FilterIdSubscriber {\n async _subscribe(provider) {\n return await provider.send(\"xcb_newPendingTransactionFilter\", []);\n }\n async _emitResults(provider, results) {\n for (const result of results) {\n provider.emit(\"pending\", result);\n }\n }\n}\n//# sourceMappingURL=subscriber-filterid.js.map","/**\n * About JSON-RPC...\n *\n * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider]\n */\n// @TODO:\n// - Add the batching API\nimport { AbiCoder } from \"../abi/index.js\";\nimport { getAddress } from \"../address/index.js\";\nimport { TypedDataEncoder } from \"../hash/index.js\";\nimport { defineProperties, getBigInt, hexlify, isHexString, toQuantity, toUtf8Bytes, makeError, assert, assertArgument, FetchRequest, resolveProperties, } from \"../utils/index.js\";\nimport { AbstractProvider, UnmanagedSubscriber } from \"./abstract-provider.js\";\nimport { AbstractSigner } from \"./abstract-signer.js\";\nimport { Network } from \"./network.js\";\nimport { FilterIdEventSubscriber, FilterIdPendingSubscriber, } from \"./subscriber-filterid.js\";\nimport { PollingEventSubscriber } from \"./subscriber-polling.js\";\nimport { resolveAddress } from \"../address/checks.js\";\nconst Primitive = \"bigint,boolean,function,number,string,symbol\".split(/,/g);\n//const Methods = \"getAddress,then\".split(/,/g);\nfunction deepCopy(value) {\n if (value == null || Primitive.indexOf(typeof value) >= 0) {\n return value;\n }\n // Keep any Addressable\n if (typeof value.getAddress === \"function\") {\n return value;\n }\n if (Array.isArray(value)) {\n return value.map(deepCopy);\n }\n if (typeof value === \"object\") {\n return Object.keys(value).reduce((accum, key) => {\n accum[key] = value[key];\n return accum;\n }, {});\n }\n throw new Error(`should not happen: ${value} (${typeof value})`);\n}\nfunction stall(duration) {\n return new Promise((resolve) => {\n setTimeout(resolve, duration);\n });\n}\nfunction getLowerCase(value) {\n if (value) {\n return value.toLowerCase();\n }\n return value;\n}\nfunction isPollable(value) {\n return value && typeof value.pollingInterval === \"number\";\n}\nconst defaultOptions = {\n polling: false,\n staticNetwork: null,\n batchStallTime: 10,\n batchMaxSize: 1 << 20,\n batchMaxCount: 100, // 100 requests\n};\n// @TODO: Unchecked Signers\nexport class JsonRpcSigner extends AbstractSigner {\n address;\n constructor(provider, address) {\n super(provider);\n address = getAddress(address);\n defineProperties(this, { address });\n }\n connect(provider) {\n assert(false, \"cannot reconnect JsonRpcSigner\", \"UNSUPPORTED_OPERATION\", {\n operation: \"signer.connect\",\n });\n }\n async getAddress() {\n return this.address;\n }\n // JSON-RPC will automatially fill in nonce, etc. so we just check from\n async populateTransaction(tx) {\n return await this.populateCall(tx);\n }\n // Returns just the hash of the transaction after sent, which is what\n // the bare JSON-RPC API does;\n async sendUncheckedTransaction(_tx) {\n const tx = deepCopy(_tx);\n const promises = [];\n // Make sure the from matches the sender\n if (tx.from) {\n const _from = tx.from;\n promises.push((async () => {\n const from = await resolveAddress(_from);\n assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), \"from address mismatch\", \"transaction\", _tx);\n tx.from = from;\n })());\n }\n else {\n tx.from = this.address;\n }\n // The JSON-RPC for xcb_sendTransaction uses 90000 energy; if the user\n // wishes to use this, it is easy to specify explicitly, otherwise\n // we look it up for them.\n if (tx.energyLimit == null) {\n promises.push((async () => {\n tx.energyLimit = await this.provider.estimateEnergy({\n ...tx,\n from: this.address,\n });\n })());\n }\n // The address may be an ENS name or Addressable\n if (tx.to != null) {\n const _to = tx.to;\n promises.push((async () => {\n tx.to = await resolveAddress(_to);\n })());\n }\n // Wait until all of our properties are filled in\n if (promises.length) {\n await Promise.all(promises);\n }\n const hexTx = this.provider.getRpcTransaction(tx);\n return this.provider.send(\"xcb_sendTransaction\", [hexTx]);\n }\n async sendTransaction(tx) {\n // This cannot be mined any earlier than any recent block\n const blockNumber = await this.provider.getBlockNumber();\n // Send the transaction\n const hash = await this.sendUncheckedTransaction(tx);\n // Unfortunately, JSON-RPC only provides and opaque transaction hash\n // for a response, and we need the actual transaction, so we poll\n // for it; it should show up very quickly\n return await new Promise((resolve, reject) => {\n const timeouts = [1000, 100];\n const checkTx = async () => {\n // Try getting the transaction\n const tx = await this.provider.getTransaction(hash);\n if (tx != null) {\n resolve(tx.replaceableTransaction(blockNumber));\n return;\n }\n // Wait another 4 seconds\n this.provider._setTimeout(() => {\n checkTx();\n }, timeouts.pop() || 4000);\n };\n checkTx();\n });\n }\n async signTransaction(_tx) {\n const tx = deepCopy(_tx);\n // Make sure the from matches the sender\n if (tx.from) {\n const from = await resolveAddress(tx.from);\n assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), \"from address mismatch\", \"transaction\", _tx);\n tx.from = from;\n }\n else {\n tx.from = this.address;\n }\n const hexTx = this.provider.getRpcTransaction(tx);\n return await this.provider.send(\"xcb_signTransaction\", [hexTx]);\n }\n async signMessage(_message) {\n const message = typeof _message === \"string\" ? toUtf8Bytes(_message) : _message;\n return await this.provider.send(\"personal_sign\", [\n hexlify(message),\n this.address.toLowerCase(),\n ]);\n }\n async signTypedData(domain, types, _value) {\n const value = deepCopy(_value);\n // Populate any ENS names (in-place)\n const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (value) => {\n const address = await resolveAddress(value);\n assertArgument(address != null, \"TypedData does not support null address\", \"value\", value);\n return address;\n });\n return await this.provider.send(\"xcb_signTypedData_v4\", [\n this.address.toLowerCase(),\n JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value)),\n ]);\n }\n async unlock(password) {\n return this.provider.send(\"personal_unlockAccount\", [\n this.address.toLowerCase(),\n password,\n null,\n ]);\n }\n async _legacySignMessage(_message) {\n const message = typeof _message === \"string\" ? toUtf8Bytes(_message) : _message;\n return await this.provider.send(\"xcb_sign\", [\n this.address.toLowerCase(),\n hexlify(message),\n ]);\n }\n}\n/**\n * The JsonRpcApiProvider is an abstract class and **MUST** be\n * sub-classed.\n *\n * It provides the base for all JSON-RPC-based Provider interaction.\n *\n * Sub-classing Notes:\n * - a sub-class MUST override _send\n * - a sub-class MUST call the `_start()` method once connected\n */\nexport class JsonRpcApiProvider extends AbstractProvider {\n #options;\n // The next ID to use for the JSON-RPC ID field\n #nextId;\n // Payloads are queued and triggered in batches using the drainTimer\n #payloads;\n #drainTimer;\n #notReady;\n #network;\n #scheduleDrain() {\n if (this.#drainTimer) {\n return;\n }\n // If we aren't using batching, no hard in sending it immeidately\n const stallTime = this._getOption(\"batchMaxCount\") === 1\n ? 0\n : this._getOption(\"batchStallTime\");\n this.#drainTimer = setTimeout(() => {\n this.#drainTimer = null;\n const payloads = this.#payloads;\n this.#payloads = [];\n while (payloads.length) {\n // Create payload batches that satisfy our batch constraints\n const batch = [payloads.shift()];\n while (payloads.length) {\n if (batch.length === this.#options.batchMaxCount) {\n break;\n }\n batch.push(payloads.shift());\n const bytes = JSON.stringify(batch.map((p) => p.payload));\n if (bytes.length > this.#options.batchMaxSize) {\n payloads.unshift(batch.pop());\n break;\n }\n }\n // Process the result to each payload\n (async () => {\n const payload = batch.length === 1 ? batch[0].payload : batch.map((p) => p.payload);\n this.emit(\"debug\", { action: \"sendRpcPayload\", payload });\n try {\n // console.log({payload})\n const result = await this._send(payload);\n // console.log({result})\n this.emit(\"debug\", { action: \"receiveRpcResult\", result });\n // Process results in batch order\n for (const { resolve, reject, payload } of batch) {\n // Find the matching result\n const resp = result.filter((r) => r.id === payload.id)[0];\n // No result; the node failed us in unexpected ways\n if (resp == null) {\n return reject(makeError(\"no response from server\", \"BAD_DATA\", {\n value: result,\n info: { payload },\n }));\n }\n // The response is an error\n if (\"error\" in resp) {\n return reject(this.getRpcError(payload, resp));\n }\n // All good; send the result\n resolve(resp.result);\n }\n }\n catch (error) {\n this.emit(\"debug\", { action: \"receiveRpcError\", error });\n for (const { reject } of batch) {\n // @TODO: augment the error with the payload\n reject(error);\n }\n }\n })();\n }\n }, stallTime);\n }\n constructor(network, options) {\n super(network);\n this.#nextId = 1;\n this.#options = Object.assign({}, defaultOptions, options || {});\n this.#payloads = [];\n this.#drainTimer = null;\n this.#network = null;\n {\n let resolve = null;\n const promise = new Promise((_resolve) => {\n resolve = _resolve;\n });\n this.#notReady = { promise, resolve };\n }\n // Make sure any static network is compatbile with the provided netwrok\n const staticNetwork = this._getOption(\"staticNetwork\");\n if (staticNetwork) {\n assertArgument(network == null || staticNetwork.matches(network), \"staticNetwork MUST match network object\", \"options\", options);\n this.#network = staticNetwork;\n }\n }\n /**\n * Returns the value associated with the option %%key%%.\n *\n * Sub-classes can use this to inquire about configuration options.\n */\n _getOption(key) {\n return this.#options[key];\n }\n /**\n * Gets the [[Network]] this provider has committed to. On each call, the network\n * is detected, and if it has changed, the call will reject.\n */\n get _network() {\n assert(this.#network, \"network is not available yet\", \"NETWORK_ERROR\");\n return this.#network;\n }\n /*\n {\n assert(false, \"sub-classes must override _send\", \"UNSUPPORTED_OPERATION\", {\n operation: \"jsonRpcApiProvider._send\"\n });\n }\n */\n /**\n * Resolves to the non-normalized value by performing %%req%%.\n *\n * Sub-classes may override this to modify behavior of actions,\n * and should generally call ``super._perform`` as a fallback.\n */\n async _perform(req) {\n const request = this.getRpcRequest(req);\n if (request != null) {\n return await this.send(request.method, request.args);\n }\n return super._perform(req);\n }\n /**\n * Sub-classes may override this; it detects the *actual* network that\n * we are **currently** connected to.\n *\n * Keep in mind that [[send]] may only be used once [[ready]], otherwise the\n * _send primitive must be used instead.\n */\n async _detectNetwork() {\n const network = this._getOption(\"staticNetwork\");\n if (network) {\n return network;\n }\n // If we are ready, use ``send``, which enabled requests to be batched\n if (this.ready) {\n return Network.from(getBigInt(await this.send(\"xcb_networkId\", [])));\n }\n // We are not ready yet; use the primitive _send\n const payload = {\n id: this.#nextId++,\n method: \"xcb_networkId\",\n params: [],\n jsonrpc: \"2.0\",\n };\n this.emit(\"debug\", { action: \"sendRpcPayload\", payload });\n let result;\n try {\n result = (await this._send(payload))[0];\n }\n catch (error) {\n this.emit(\"debug\", { action: \"receiveRpcError\", error });\n throw error;\n }\n this.emit(\"debug\", { action: \"receiveRpcResult\", result });\n if (\"result\" in result) {\n return Network.from(getBigInt(result.result));\n }\n throw this.getRpcError(payload, result);\n }\n /**\n * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls\n * will be passed to [[_send]] from [[send]]. If it is overridden, then\n * ``super._start()`` **MUST** be called.\n *\n * Calling it multiple times is safe and has no effect.\n */\n _start() {\n if (this.#notReady == null || this.#notReady.resolve == null) {\n return;\n }\n this.#notReady.resolve();\n this.#notReady = null;\n (async () => {\n // Bootstrap the network\n while (this.#network == null) {\n try {\n this.#network = await this._detectNetwork();\n }\n catch (error) {\n console.log(\"JsonRpcProvider failed to startup; retry in 1s\");\n await stall(1000);\n }\n }\n // Start dispatching requests\n this.#scheduleDrain();\n })();\n }\n /**\n * Resolves once the [[_start]] has been called. This can be used in\n * sub-classes to defer sending data until the connection has been\n * established.\n */\n async _waitUntilReady() {\n if (this.#notReady == null) {\n return;\n }\n return await this.#notReady.promise;\n }\n /**\n * Return a Subscriber that will manage the %%sub%%.\n *\n * Sub-classes may override this to modify the behavior of\n * subscription management.\n */\n _getSubscriber(sub) {\n // Pending Filters aren't availble via polling\n if (sub.type === \"pending\") {\n return new FilterIdPendingSubscriber(this);\n }\n if (sub.type === \"event\") {\n if (this._getOption(\"polling\")) {\n return new PollingEventSubscriber(this, sub.filter);\n }\n return new FilterIdEventSubscriber(this, sub.filter);\n }\n // Orphaned Logs are handled automatically, by the filter, since\n // logs with removed are emitted by it\n if (sub.type === \"orphan\" && sub.filter.orphan === \"drop-log\") {\n return new UnmanagedSubscriber(\"orphan\");\n }\n return super._getSubscriber(sub);\n }\n /**\n * Returns true only if the [[_start]] has been called.\n */\n get ready() {\n return this.#notReady == null;\n }\n /**\n * Returns %%tx%% as a normalized JSON-RPC transaction request,\n * which has all values hexlified and any numeric values converted\n * to Quantity values.\n */\n getRpcTransaction(tx) {\n const result = {};\n // JSON-RPC now requires numeric values to be \"quantity\" values\n [\n \"networkId\",\n \"energyLimit\",\n \"energyPrice\",\n \"type\",\n \"nonce\",\n \"value\",\n ].forEach((key) => {\n if (tx[key] == null) {\n return;\n }\n let dstKey = key;\n if (key === \"energyLimit\") {\n dstKey = \"energy\";\n }\n result[dstKey] = toQuantity(getBigInt(tx[key], `tx.${key}`));\n });\n // Make sure addresses and data are lowercase\n [\"from\", \"to\", \"data\"].forEach((key) => {\n if (tx[key] == null) {\n return;\n }\n result[key] = hexlify(tx[key]);\n });\n return result;\n }\n /**\n * Returns the request method and arguments required to perform\n * %%req%%.\n */\n getRpcRequest(req) {\n switch (req.method) {\n case \"networkId\":\n return { method: \"xcb_networkId\", args: [] };\n case \"getBlockNumber\":\n return { method: \"xcb_blockNumber\", args: [] };\n case \"getEnergyPrice\":\n return { method: \"xcb_energyPrice\", args: [] };\n case \"getBalance\": {\n return {\n method: \"xcb_getBalance\",\n args: [getLowerCase(req.address), req.blockTag],\n };\n }\n case \"getTransactionCount\":\n return {\n method: \"xcb_getTransactionCount\",\n args: [getLowerCase(req.address), req.blockTag],\n };\n case \"getCode\":\n return {\n method: \"xcb_getCode\",\n args: [getLowerCase(req.address), req.blockTag],\n };\n case \"getStorage\":\n return {\n method: \"xcb_getStorageAt\",\n args: [\n getLowerCase(req.address),\n \"0x\" + req.position.toString(16),\n req.blockTag,\n ],\n };\n case \"broadcastTransaction\":\n return {\n method: \"xcb_sendRawTransaction\",\n args: [req.signedTransaction],\n };\n case \"getBlock\":\n if (\"blockTag\" in req) {\n return {\n method: \"xcb_getBlockByNumber\",\n args: [req.blockTag, !!req.includeTransactions],\n };\n }\n else if (\"blockHash\" in req) {\n return {\n method: \"xcb_getBlockByHash\",\n args: [req.blockHash, !!req.includeTransactions],\n };\n }\n break;\n case \"getTransaction\":\n return {\n method: \"xcb_getTransactionByHash\",\n args: [req.hash],\n };\n case \"getTransactionReceipt\":\n return {\n method: \"xcb_getTransactionReceipt\",\n args: [req.hash],\n };\n case \"call\":\n return {\n method: \"xcb_call\",\n args: [this.getRpcTransaction(req.transaction), req.blockTag],\n };\n case \"estimateEnergy\": {\n return {\n method: \"xcb_estimateEnergy\",\n args: [this.getRpcTransaction(req.transaction)],\n };\n }\n case \"getLogs\":\n if (req.filter && req.filter.address != null) {\n if (Array.isArray(req.filter.address)) {\n req.filter.address = req.filter.address.map(getLowerCase);\n }\n else {\n req.filter.address = getLowerCase(req.filter.address);\n }\n }\n return { method: \"xcb_getLogs\", args: [req.filter] };\n }\n return null;\n }\n /**\n * Returns an CoreBC-style Error for the given JSON-RPC error\n * %%payload%%, coalescing the various strings and error shapes\n * that different nodes return, coercing them into a machine-readable\n * standardized error.\n */\n getRpcError(payload, _error) {\n const { method } = payload;\n const { error } = _error;\n if (method === \"xcb_estimateEnergy\" && error.message) {\n const msg = error.message;\n if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) {\n return makeError(\"insufficient funds\", \"INSUFFICIENT_FUNDS\", {\n transaction: payload.params[0],\n info: { payload, error },\n });\n }\n }\n if (method === \"xcb_call\" || method === \"xcb_estimateEnergy\") {\n const result = spelunkData(error);\n const e = AbiCoder.getBuiltinCallException(method === \"xcb_call\" ? \"call\" : \"estimateEnergy\", payload.params[0], result ? result.data : null);\n e.info = { error, payload };\n return e;\n }\n // Only estimateEnergy and call can return arbitrary contract-defined text, so now we\n // we can process text safely.\n const message = JSON.stringify(spelunkMessage(error));\n if (typeof error.message === \"string\" &&\n error.message.match(/user denied|corebc-user-denied/i)) {\n const actionMap = {\n xcb_sign: \"signMessage\",\n personal_sign: \"signMessage\",\n xcb_signTypedData_v4: \"signTypedData\",\n xcb_signTransaction: \"signTransaction\",\n xcb_sendTransaction: \"sendTransaction\",\n xcb_requestAccounts: \"requestAccess\",\n wallet_requestAccounts: \"requestAccess\",\n };\n return makeError(`user rejected action`, \"ACTION_REJECTED\", {\n action: actionMap[method] || \"unknown\",\n reason: \"rejected\",\n info: { payload, error },\n });\n }\n if (method === \"xcb_sendRawTransaction\" ||\n method === \"xcb_sendTransaction\") {\n const transaction = payload.params[0];\n if (message.match(/insufficient funds|base fee exceeds energy limit/i)) {\n return makeError(\"insufficient funds for intrinsic transaction cost\", \"INSUFFICIENT_FUNDS\", {\n transaction,\n info: { error },\n });\n }\n if (message.match(/nonce/i) && message.match(/too low/i)) {\n return makeError(\"nonce has already been used\", \"NONCE_EXPIRED\", {\n transaction,\n info: { error },\n });\n }\n // \"replacement transaction underpriced\"\n if (message.match(/replacement transaction/i) &&\n message.match(/underpriced/i)) {\n return makeError(\"replacement fee too low\", \"REPLACEMENT_UNDERPRICED\", {\n transaction,\n info: { error },\n });\n }\n if (message.match(/only replay-protected/i)) {\n return makeError(\"legacy pre-eip-155 transactions not supported\", \"UNSUPPORTED_OPERATION\", {\n operation: method,\n info: { transaction, info: { error } },\n });\n }\n }\n if (message.match(/the method .* does not exist/i)) {\n return makeError(\"unsupported operation\", \"UNSUPPORTED_OPERATION\", {\n operation: payload.method,\n info: { error },\n });\n }\n return makeError(\"could not coalesce error\", \"UNKNOWN_ERROR\", { error });\n }\n /**\n * Requests the %%method%% with %%params%% via the JSON-RPC protocol\n * over the underlying channel. This can be used to call methods\n * on the backend that do not have a high-level API within the Provider\n * API.\n *\n * This method queues requests according to the batch constraints\n * in the options, assigns the request a unique ID.\n *\n * **Do NOT override** this method in sub-classes; instead\n * override [[_send]] or force the options values in the\n * call to the constructor to modify this method's behavior.\n */\n send(method, params) {\n // @TODO: cache networkId?? purge on switch_networks\n const id = this.#nextId++;\n const promise = new Promise((resolve, reject) => {\n this.#payloads.push({\n resolve,\n reject,\n payload: { method, params, id, jsonrpc: \"2.0\" },\n });\n });\n // If there is not a pending drainTimer, set one\n this.#scheduleDrain();\n return promise;\n }\n /**\n * Resolves to the [[Signer]] account for %%address%% managed by\n * the client.\n *\n * If the %%address%% is a number, it is used as an index in the\n * the accounts from [[listAccounts]].\n *\n * This can only be used on clients which manage accounts (such as\n * Geth with imported account or MetaMask).\n *\n * Throws if the account doesn't exist.\n */\n async getSigner(address) {\n if (address == null) {\n address = 0;\n }\n const accountsPromise = this.send(\"xcb_accounts\", []);\n // Account index\n if (typeof address === \"number\") {\n const accounts = await accountsPromise;\n if (address >= accounts.length) {\n throw new Error(\"no such account\");\n }\n return new JsonRpcSigner(this, accounts[address]);\n }\n const { accounts } = await resolveProperties({\n network: this.getNetwork(),\n accounts: accountsPromise,\n });\n // Account address\n address = getAddress(address);\n for (const account of accounts) {\n if (getAddress(account) === address) {\n return new JsonRpcSigner(this, address);\n }\n }\n throw new Error(\"invalid account\");\n }\n async listAccounts() {\n const accounts = await this.send(\"xcb_accounts\", []);\n return accounts.map((a) => new JsonRpcSigner(this, a));\n }\n}\nexport class JsonRpcApiPollingProvider extends JsonRpcApiProvider {\n #pollingInterval;\n constructor(network, options) {\n super(network, options);\n this.#pollingInterval = 4000;\n }\n _getSubscriber(sub) {\n const subscriber = super._getSubscriber(sub);\n if (isPollable(subscriber)) {\n subscriber.pollingInterval = this.#pollingInterval;\n }\n return subscriber;\n }\n /**\n * The polling interval (default: 4000 ms)\n */\n get pollingInterval() {\n return this.#pollingInterval;\n }\n set pollingInterval(value) {\n if (!Number.isInteger(value) || value < 0) {\n throw new Error(\"invalid interval\");\n }\n this.#pollingInterval = value;\n this._forEachSubscriber((sub) => {\n if (isPollable(sub)) {\n sub.pollingInterval = this.#pollingInterval;\n }\n });\n }\n}\n/**\n * The JsonRpcProvider is one of the most common Providers,\n * which performs all operations over HTTP (or HTTPS) requests.\n *\n * Events are processed by polling the backend for the current block\n * number; when it advances, all block-base events are then checked\n * for updates.\n */\nexport class JsonRpcProvider extends JsonRpcApiPollingProvider {\n #connect;\n constructor(url, network, options) {\n if (url == null) {\n url = \"http://localhost:8545\";\n }\n super(network, options);\n if (typeof url === \"string\") {\n this.#connect = new FetchRequest(url);\n }\n else {\n this.#connect = url.clone();\n }\n }\n _getConnection() {\n return this.#connect.clone();\n }\n async send(method, params) {\n // All requests are over HTTP, so we can just start handling requests\n // We do this here rather than the constructor so that we don't send any\n // requests to the network (i.e. xcb_networkId) until we absolutely have to.\n await this._start();\n return await super.send(method, params);\n }\n async _send(payload) {\n // Configure a POST connection for the requested method\n const request = this._getConnection();\n request.body = JSON.stringify(payload);\n request.setHeader(\"content-type\", \"application/json\");\n const response = await request.send();\n response.assertOk();\n let resp = response.bodyJson;\n if (!Array.isArray(resp)) {\n resp = [resp];\n }\n return resp;\n }\n}\nfunction spelunkData(value) {\n if (value == null) {\n return null;\n }\n // These *are* the droids we're looking for.\n if (typeof value.message === \"string\" &&\n value.message.match(\"reverted\") &&\n isHexString(value.data)) {\n return { message: value.message, data: value.data };\n }\n // Spelunk further...\n if (typeof value === \"object\") {\n for (const key in value) {\n const result = spelunkData(value[key]);\n if (result) {\n return result;\n }\n }\n return null;\n }\n // Might be a JSON string we can further descend...\n if (typeof value === \"string\") {\n try {\n return spelunkData(JSON.parse(value));\n }\n catch (error) { }\n }\n return null;\n}\nfunction _spelunkMessage(value, result) {\n if (value == null) {\n return;\n }\n // These *are* the droids we're looking for.\n if (typeof value.message === \"string\") {\n result.push(value.message);\n }\n // Spelunk further...\n if (typeof value === \"object\") {\n for (const key in value) {\n _spelunkMessage(value[key], result);\n }\n }\n // Might be a JSON string we can further descend...\n if (typeof value === \"string\") {\n try {\n return _spelunkMessage(JSON.parse(value), result);\n }\n catch (error) { }\n }\n}\nfunction spelunkMessage(value) {\n const result = [];\n _spelunkMessage(value, result);\n return result;\n}\n//# sourceMappingURL=provider-jsonrpc.js.map","/**\n * [[link-ankr]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Core Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Polygon (``matic``)\n * - Arbitrum (``arbitrum``)\n *\n * @_subsection: api/providers/thirdparty:Ankr [providers-ankr]\n */\nimport { defineProperties, FetchRequest, assertArgument, } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultApiKey = \"9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"rpc.ankr.com/eth\";\n case \"goerli\":\n return \"rpc.ankr.com/xcb_goerli\";\n case \"matic\":\n return \"rpc.ankr.com/polygon\";\n case \"arbitrum\":\n return \"rpc.ankr.com/arbitrum\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **AnkrProvider** connects to the [[link-ankr]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-ankr-signup).\n */\nexport class AnkrProvider extends JsonRpcProvider {\n /**\n * The API key for the Ankr connection.\n */\n apiKey;\n /**\n * Create a new **AnkrProvider**.\n *\n * By default connecting to ``mainnet`` with a highly throttled\n * API key.\n */\n constructor(_network, apiKey) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n // Ankr does not support filterId, so we force polling\n const options = { polling: true, staticNetwork: network };\n const request = AnkrProvider.getRequest(network, apiKey);\n super(request, network, options);\n defineProperties(this, { apiKey });\n }\n _getProvider(networkId) {\n try {\n return new AnkrProvider(networkId, this.apiKey);\n }\n catch (error) { }\n return super._getProvider(networkId);\n }\n /**\n * Returns a prepared request for connecting to %%network%% with\n * %%apiKey%%.\n */\n static getRequest(network, apiKey) {\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/${apiKey}`);\n request.allowGzip = true;\n if (apiKey === defaultApiKey) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"AnkrProvider\");\n return true;\n };\n }\n return request;\n }\n getRpcError(payload, error) {\n if (payload.method === \"xcb_sendRawTransaction\") {\n if (error &&\n error.error &&\n error.error.message === \"INTERNAL_ERROR: could not replace existing tx\") {\n error.error.message = \"replacement transaction underpriced\";\n }\n }\n return super.getRpcError(payload, error);\n }\n isCommunityResource() {\n return this.apiKey === defaultApiKey;\n }\n}\n//# sourceMappingURL=provider-ankr.js.map","/**\n * About Alchemy\n *\n * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy]\n */\nimport { defineProperties, resolveProperties, assert, assertArgument, FetchRequest, } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultApiKey = \"_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"eth-mainnet.alchemyapi.io\";\n case \"goerli\":\n return \"eth-goerli.g.alchemy.com\";\n case \"sepolia\":\n return \"eth-sepolia.g.alchemy.com\";\n case \"arbitrum\":\n return \"arb-mainnet.g.alchemy.com\";\n case \"arbitrum-goerli\":\n return \"arb-goerli.g.alchemy.com\";\n case \"matic\":\n return \"polygon-mainnet.g.alchemy.com\";\n case \"matic-mumbai\":\n return \"polygon-mumbai.g.alchemy.com\";\n case \"optimism\":\n return \"opt-mainnet.g.alchemy.com\";\n case \"optimism-goerli\":\n return \"opt-goerli.g.alchemy.com\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **AlchemyProvider** connects to the [[link-alchemy]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-alchemy-signup).\n *\n * @_docloc: api/providers/thirdparty\n */\nexport class AlchemyProvider extends JsonRpcProvider {\n apiKey;\n constructor(_network, apiKey) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n const request = AlchemyProvider.getRequest(network, apiKey);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { apiKey });\n }\n _getProvider(networkId) {\n try {\n return new AlchemyProvider(networkId, this.apiKey);\n }\n catch (error) { }\n return super._getProvider(networkId);\n }\n async _perform(req) {\n // https://docs.alchemy.com/reference/trace-transaction\n if (req.method === \"getTransactionResult\") {\n const { trace, tx } = await resolveProperties({\n trace: this.send(\"trace_transaction\", [req.hash]),\n tx: this.getTransaction(req.hash),\n });\n if (trace == null || tx == null) {\n return null;\n }\n let data;\n let error = false;\n try {\n data = trace[0].result.output;\n error = trace[0].error === \"Reverted\";\n }\n catch (error) { }\n if (data) {\n assert(!error, \"an error occurred during transaction executions\", \"CALL_EXCEPTION\", {\n action: \"getTransactionResult\",\n data,\n reason: null,\n transaction: tx,\n invocation: null,\n revert: null, // @TODO\n });\n return data;\n }\n assert(false, \"could not parse trace result\", \"BAD_DATA\", {\n value: trace,\n });\n }\n return await super._perform(req);\n }\n isCommunityResource() {\n return this.apiKey === defaultApiKey;\n }\n static getRequest(network, apiKey) {\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/v2/${apiKey}`);\n request.allowGzip = true;\n if (apiKey === defaultApiKey) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"alchemy\");\n return true;\n };\n }\n return request;\n }\n}\n//# sourceMappingURL=provider-alchemy.js.map","/**\n * About Cloudflare\n *\n * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare]\n */\nimport { assertArgument } from \"../utils/index.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\n/**\n * About Cloudflare...\n */\nexport class CloudflareProvider extends JsonRpcProvider {\n constructor(_network) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n assertArgument(network.name === \"mainnet\", \"unsupported network\", \"network\", _network);\n super(\"https://cloudflare-eth.com/\", network, { staticNetwork: network });\n }\n}\n//# sourceMappingURL=provider-cloudflare.js.map","function getGlobal() {\n if (typeof self !== \"undefined\") {\n return self;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof global !== \"undefined\") {\n return global;\n }\n throw new Error(\"unable to locate global object\");\n}\nconst _WebSocket = getGlobal().WebSocket;\nexport { _WebSocket as WebSocket };\n//# sourceMappingURL=ws-browser.js.map","/**\n * Generic long-lived socket provider.\n *\n * Sub-classing notes\n * - a sub-class MUST call the `_start()` method once connected\n * - a sub-class MUST override the `_write(string)` method\n * - a sub-class MUST call `_processMessage(string)` for each message\n *\n * @_subsection: api/providers/abstract-provider\n */\nimport { UnmanagedSubscriber } from \"./abstract-provider.js\";\nimport { assert, assertArgument, makeError } from \"../utils/index.js\";\nimport { JsonRpcApiProvider } from \"./provider-jsonrpc.js\";\nexport class SocketSubscriber {\n #provider;\n #filter;\n get filter() {\n return JSON.parse(this.#filter);\n }\n #filterId;\n #paused;\n #emitPromise;\n constructor(provider, filter) {\n this.#provider = provider;\n this.#filter = JSON.stringify(filter);\n this.#filterId = null;\n this.#paused = null;\n this.#emitPromise = null;\n }\n start() {\n this.#filterId = this.#provider\n .send(\"xcb_subscribe\", this.filter)\n .then((filterId) => {\n this.#provider._register(filterId, this);\n return filterId;\n });\n }\n stop() {\n this.#filterId.then((filterId) => {\n this.#provider.send(\"xcb_unsubscribe\", [filterId]);\n });\n this.#filterId = null;\n }\n // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs\n // and resume\n pause(dropWhilePaused) {\n assert(dropWhilePaused, \"preserve logs while paused not supported by SocketSubscriber yet\", \"UNSUPPORTED_OPERATION\", { operation: \"pause(false)\" });\n this.#paused = !!dropWhilePaused;\n }\n resume() {\n this.#paused = null;\n }\n _handleMessage(message) {\n if (this.#filterId == null) {\n return;\n }\n if (this.#paused === null) {\n let emitPromise = this.#emitPromise;\n if (emitPromise == null) {\n emitPromise = this._emit(this.#provider, message);\n }\n else {\n emitPromise = emitPromise.then(async () => {\n await this._emit(this.#provider, message);\n });\n }\n this.#emitPromise = emitPromise.then(() => {\n if (this.#emitPromise === emitPromise) {\n this.#emitPromise = null;\n }\n });\n }\n }\n async _emit(provider, message) {\n throw new Error(\"sub-classes must implemente this; _emit\");\n }\n}\nexport class SocketBlockSubscriber extends SocketSubscriber {\n constructor(provider) {\n super(provider, [\"newHeads\"]);\n }\n async _emit(provider, message) {\n provider.emit(\"block\", parseInt(message.number));\n }\n}\nexport class SocketPendingSubscriber extends SocketSubscriber {\n constructor(provider) {\n super(provider, [\"newPendingTransactions\"]);\n }\n async _emit(provider, message) {\n provider.emit(\"pending\", message);\n }\n}\nexport class SocketEventSubscriber extends SocketSubscriber {\n #logFilter;\n get logFilter() {\n return JSON.parse(this.#logFilter);\n }\n constructor(provider, filter) {\n super(provider, [\"logs\", filter]);\n this.#logFilter = JSON.stringify(filter);\n }\n async _emit(provider, message) {\n provider.emit(this.logFilter, provider._wrapLog(message, provider._network));\n }\n}\n/**\n * SocketProvider...\n *\n */\nexport class SocketProvider extends JsonRpcApiProvider {\n #callbacks;\n // Maps each filterId to its subscriber\n #subs;\n // If any events come in before a subscriber has finished\n // registering, queue them\n #pending;\n constructor(network) {\n super(network, { batchMaxCount: 1 });\n this.#callbacks = new Map();\n this.#subs = new Map();\n this.#pending = new Map();\n }\n // This value is only valid after _start has been called\n /*\n get _network(): Network {\n if (this.#network == null) {\n throw new Error(\"this shouldn't happen\");\n }\n return this.#network.clone();\n }\n */\n _getSubscriber(sub) {\n switch (sub.type) {\n case \"close\":\n return new UnmanagedSubscriber(\"close\");\n case \"block\":\n return new SocketBlockSubscriber(this);\n case \"pending\":\n return new SocketPendingSubscriber(this);\n case \"event\":\n return new SocketEventSubscriber(this, sub.filter);\n case \"orphan\":\n // Handled auto-matically within AbstractProvider\n // when the log.removed = true\n if (sub.filter.orphan === \"drop-log\") {\n return new UnmanagedSubscriber(\"drop-log\");\n }\n }\n return super._getSubscriber(sub);\n }\n _register(filterId, subscriber) {\n this.#subs.set(filterId, subscriber);\n const pending = this.#pending.get(filterId);\n if (pending) {\n for (const message of pending) {\n subscriber._handleMessage(message);\n }\n this.#pending.delete(filterId);\n }\n }\n async _send(payload) {\n // WebSocket provider doesn't accept batches\n assertArgument(!Array.isArray(payload), \"WebSocket does not support batch send\", \"payload\", payload);\n // @TODO: stringify payloads here and store to prevent mutations\n // Prepare a promise to respond to\n const promise = new Promise((resolve, reject) => {\n this.#callbacks.set(payload.id, { payload, resolve, reject });\n });\n // Wait until the socket is connected before writing to it\n await this._waitUntilReady();\n // Write the request to the socket\n await this._write(JSON.stringify(payload));\n return [await promise];\n }\n // Sub-classes must call this once they are connected\n /*\n async _start(): Promise {\n if (this.#ready) { return; }\n \n for (const { payload } of this.#callbacks.values()) {\n await this._write(JSON.stringify(payload));\n }\n \n this.#ready = (async function() {\n await super._start();\n })();\n }\n */\n // Sub-classes must call this for each message\n async _processMessage(message) {\n const result = (JSON.parse(message));\n if (\"id\" in result) {\n const callback = this.#callbacks.get(result.id);\n if (callback == null) {\n this.emit(\"error\", makeError(\"received result for unknown id\", \"UNKNOWN_ERROR\", {\n reasonCode: \"UNKNOWN_ID\",\n result,\n }));\n return;\n }\n this.#callbacks.delete(result.id);\n callback.resolve(result);\n }\n else if (result.method === \"xcb_subscription\") {\n const filterId = result.params.subscription;\n const subscriber = this.#subs.get(filterId);\n if (subscriber) {\n subscriber._handleMessage(result.params.result);\n }\n else {\n let pending = this.#pending.get(filterId);\n if (pending == null) {\n pending = [];\n this.#pending.set(filterId, pending);\n }\n pending.push(result.params.result);\n }\n }\n }\n async _write(message) {\n throw new Error(\"sub-classes must override this\");\n }\n}\n//# sourceMappingURL=provider-socket.js.map","import { WebSocket as _WebSocket } from \"./ws.js\"; /*-browser*/\nimport { SocketProvider } from \"./provider-socket.js\";\nexport class WebSocketProvider extends SocketProvider {\n #connect;\n #websocket;\n get websocket() {\n if (this.#websocket == null) {\n throw new Error(\"websocket closed\");\n }\n return this.#websocket;\n }\n constructor(url, network) {\n super(network);\n if (typeof url === \"string\") {\n this.#connect = () => {\n return new _WebSocket(url);\n };\n this.#websocket = this.#connect();\n }\n else if (typeof url === \"function\") {\n this.#connect = url;\n this.#websocket = url();\n }\n else {\n this.#connect = null;\n this.#websocket = url;\n }\n this.websocket.onopen = async () => {\n try {\n await this._start();\n this.resume();\n }\n catch (error) {\n console.log(\"failed to start WebsocketProvider\", error);\n // @TODO: now what? Attempt reconnect?\n }\n };\n this.websocket.onmessage = (message) => {\n this._processMessage(message.data);\n };\n /*\n this.websocket.onclose = (event) => {\n // @TODO: What event.code should we reconnect on?\n const reconnect = false;\n if (reconnect) {\n this.pause(true);\n if (this.#connect) {\n this.#websocket = this.#connect();\n this.#websocket.onopen = ...\n // @TODO: this requires the super class to rebroadcast; move it there\n }\n this._reconnect();\n }\n };\n */\n }\n async _write(message) {\n this.websocket.send(message);\n }\n async destroy() {\n if (this.#websocket != null) {\n this.#websocket.close();\n this.#websocket = null;\n }\n super.destroy();\n }\n}\n//# sourceMappingURL=provider-websocket.js.map","/**\n * [[link-infura]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Core Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:INFURA [providers-infura]\n */\nimport { defineProperties, FetchRequest, assert, assertArgument, } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nimport { WebSocketProvider } from \"./provider-websocket.js\";\nconst defaultProjectId = \"84842078b09946638c03157f83405213\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"mainnet.infura.io\";\n case \"goerli\":\n return \"goerli.infura.io\";\n case \"sepolia\":\n return \"sepolia.infura.io\";\n case \"arbitrum\":\n return \"arbitrum-mainnet.infura.io\";\n case \"arbitrum-goerli\":\n return \"arbitrum-goerli.infura.io\";\n case \"matic\":\n return \"polygon-mainnet.infura.io\";\n case \"matic-mumbai\":\n return \"polygon-mumbai.infura.io\";\n case \"optimism\":\n return \"optimism-mainnet.infura.io\";\n case \"optimism-goerli\":\n return \"optimism-goerli.infura.io\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **InfuraWebSocketProvider** connects to the [[link-infura]]\n * WebSocket end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-infura-signup).\n */\nexport class InfuraWebSocketProvider extends WebSocketProvider {\n /**\n * The Project ID for the INFURA connection.\n */\n projectId;\n /**\n * The Project Secret.\n *\n * If null, no authenticated requests are made. This should not\n * be used outside of private contexts.\n */\n projectSecret;\n /**\n * Creates a new **InfuraWebSocketProvider**.\n */\n constructor(network, projectId) {\n const provider = new InfuraProvider(network, projectId);\n const req = provider._getConnection();\n assert(!req.credentials, \"INFURA WebSocket project secrets unsupported\", \"UNSUPPORTED_OPERATION\", { operation: \"InfuraProvider.getWebSocketProvider()\" });\n const url = req.url.replace(/^http/i, \"ws\").replace(\"/v3/\", \"/ws/v3/\");\n super(url, network);\n defineProperties(this, {\n projectId: provider.projectId,\n projectSecret: provider.projectSecret,\n });\n }\n isCommunityResource() {\n return this.projectId === defaultProjectId;\n }\n}\n/**\n * The **InfuraProvider** connects to the [[link-infura]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-infura-signup).\n */\nexport class InfuraProvider extends JsonRpcProvider {\n /**\n * The Project ID for the INFURA connection.\n */\n projectId;\n /**\n * The Project Secret.\n *\n * If null, no authenticated requests are made. This should not\n * be used outside of private contexts.\n */\n projectSecret;\n /**\n * Creates a new **InfuraProvider**.\n */\n constructor(_network, projectId, projectSecret) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (projectId == null) {\n projectId = defaultProjectId;\n }\n if (projectSecret == null) {\n projectSecret = null;\n }\n const request = InfuraProvider.getRequest(network, projectId, projectSecret);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { projectId, projectSecret });\n }\n _getProvider(networkId) {\n try {\n return new InfuraProvider(networkId, this.projectId, this.projectSecret);\n }\n catch (error) { }\n return super._getProvider(networkId);\n }\n isCommunityResource() {\n return this.projectId === defaultProjectId;\n }\n /**\n * Creates a new **InfuraWebSocketProvider**.\n */\n static getWebSocketProvider(network, projectId) {\n return new InfuraWebSocketProvider(network, projectId);\n }\n /**\n * Returns a prepared request for connecting to %%network%%\n * with %%projectId%% and %%projectSecret%%.\n */\n static getRequest(network, projectId, projectSecret) {\n if (projectId == null) {\n projectId = defaultProjectId;\n }\n if (projectSecret == null) {\n projectSecret = null;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/v3/${projectId}`);\n request.allowGzip = true;\n if (projectSecret) {\n request.setCredentials(\"\", projectSecret);\n }\n if (projectId === defaultProjectId) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"InfuraProvider\");\n return true;\n };\n }\n return request;\n }\n}\n//# sourceMappingURL=provider-infura.js.map","/**\n * [[link-quicknode]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Core Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode]\n */\nimport { defineProperties, FetchRequest, assertArgument, } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultToken = \"919b412a057b5e9c9b6dce193c5a60242d6efadb\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"corebc.quiknode.pro\";\n case \"arbitrum\":\n return \"corebc.arbitrum-mainnet.quiknode.pro\";\n case \"arbitrum-goerli\":\n return \"corebc.arbitrum-goerli.quiknode.pro\";\n case \"matic\":\n return \"corebc.matic.quiknode.pro\";\n case \"matic-mumbai\":\n return \"corebc.matic-testnet.quiknode.pro\";\n case \"optimism\":\n return \"corebc.optimism.quiknode.pro\";\n case \"optimism-goerli\":\n return \"corebc.optimism-goerli.quiknode.pro\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **QuickNodeProvider** connects to the [[link-quicknode]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API token is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-quicknode).\n */\nexport class QuickNodeProvider extends JsonRpcProvider {\n /**\n * The API token.\n */\n token;\n /**\n * Creates a new **QuickNodeProvider**.\n */\n constructor(_network, token) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (token == null) {\n token = defaultToken;\n }\n const request = QuickNodeProvider.getRequest(network, token);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { token });\n }\n _getProvider(networkId) {\n try {\n return new QuickNodeProvider(networkId, this.token);\n }\n catch (error) { }\n return super._getProvider(networkId);\n }\n isCommunityResource() {\n return this.token === defaultToken;\n }\n /**\n * Returns a new request prepared for %%network%% and the\n * %%token%%.\n */\n static getRequest(network, token) {\n if (token == null) {\n token = defaultToken;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/${token}`);\n request.allowGzip = true;\n //if (projectSecret) { request.setCredentials(\"\", projectSecret); }\n if (token === defaultToken) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"QuickNodeProvider\");\n return true;\n };\n }\n return request;\n }\n}\n//# sourceMappingURL=provider-quicknode.js.map","/**\n * Explain all the nitty-gritty about the **FallbackProvider**.\n *\n * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider]\n */\nimport { getBigInt, getNumber, assert, assertArgument, } from \"../utils/index.js\";\nimport { AbstractProvider } from \"./abstract-provider.js\";\nimport { Network } from \"./network.js\";\nconst BN_1 = BigInt(\"1\");\nconst BN_2 = BigInt(\"2\");\nfunction shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n const tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n }\n}\nfunction stall(duration) {\n return new Promise((resolve) => {\n setTimeout(resolve, duration);\n });\n}\nfunction getTime() {\n return new Date().getTime();\n}\nfunction stringify(value) {\n return JSON.stringify(value, (key, value) => {\n if (typeof value === \"bigint\") {\n return { type: \"bigint\", value: value.toString() };\n }\n return value;\n });\n}\nconst defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 };\nconst defaultState = {\n blockNumber: -2,\n requests: 0,\n lateResponses: 0,\n errorResponses: 0,\n outOfSync: -1,\n unsupportedEvents: 0,\n rollingDuration: 0,\n score: 0,\n _network: null,\n _updateNumber: null,\n _totalTime: 0,\n};\nasync function waitForSync(config, blockNumber) {\n while (config.blockNumber < 0 || config.blockNumber < blockNumber) {\n if (!config._updateNumber) {\n config._updateNumber = (async () => {\n const blockNumber = await config.provider.getBlockNumber();\n if (blockNumber > config.blockNumber) {\n config.blockNumber = blockNumber;\n }\n config._updateNumber = null;\n })();\n }\n await config._updateNumber;\n config.outOfSync++;\n }\n}\nfunction _normalize(value) {\n if (value == null) {\n return \"null\";\n }\n if (Array.isArray(value)) {\n return \"[\" + value.map(_normalize).join(\",\") + \"]\";\n }\n if (typeof value === \"object\" && typeof value.toJSON === \"function\") {\n return _normalize(value.toJSON());\n }\n switch (typeof value) {\n case \"boolean\":\n case \"symbol\":\n return value.toString();\n case \"bigint\":\n case \"number\":\n return BigInt(value).toString();\n case \"string\":\n return JSON.stringify(value);\n case \"object\": {\n const keys = Object.keys(value);\n keys.sort();\n return (\"{\" +\n keys\n .map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`)\n .join(\",\") +\n \"}\");\n }\n }\n console.log(\"Could not serialize\", value);\n throw new Error(\"Hmm...\");\n}\nfunction normalizeResult(value) {\n if (\"error\" in value) {\n const error = value.error;\n return { tag: _normalize(error), value: error };\n }\n const result = value.result;\n return { tag: _normalize(result), value: result };\n}\n// This strategy picks the highest weight result, as long as the weight is\n// equal to or greater than quorum\nfunction checkQuorum(quorum, results) {\n const tally = new Map();\n for (const { value, tag, weight } of results) {\n const t = tally.get(tag) || { value, weight: 0 };\n t.weight += weight;\n tally.set(tag, t);\n }\n let best = null;\n for (const r of tally.values()) {\n if (r.weight >= quorum && (!best || r.weight > best.weight)) {\n best = r;\n }\n }\n if (best) {\n return best.value;\n }\n return undefined;\n}\nfunction getMedian(quorum, results) {\n let resultWeight = 0;\n const errorMap = new Map();\n let bestError = null;\n const values = [];\n for (const { value, tag, weight } of results) {\n if (value instanceof Error) {\n const e = errorMap.get(tag) || { value, weight: 0 };\n e.weight += weight;\n errorMap.set(tag, e);\n if (bestError == null || e.weight > bestError.weight) {\n bestError = e;\n }\n }\n else {\n values.push(BigInt(value));\n resultWeight += weight;\n }\n }\n if (resultWeight < quorum) {\n // We have quorum for an error\n if (bestError && bestError.weight >= quorum) {\n return bestError.value;\n }\n // We do not have quorum for a result\n return undefined;\n }\n // Get the sorted values\n values.sort((a, b) => (a < b ? -1 : b > a ? 1 : 0));\n const mid = Math.floor(values.length / 2);\n // Odd-length; take the middle value\n if (values.length % 2) {\n return values[mid];\n }\n // Even length; take the ceiling of the mean of the center two values\n return (values[mid - 1] + values[mid] + BN_1) / BN_2;\n}\nfunction getAnyResult(quorum, results) {\n // If any value or error meets quorum, that is our preferred result\n const result = checkQuorum(quorum, results);\n if (result !== undefined) {\n return result;\n }\n // Otherwise, do we have any result?\n for (const r of results) {\n if (r.value) {\n return r.value;\n }\n }\n // Nope!\n return undefined;\n}\nfunction getFuzzyMode(quorum, results) {\n if (quorum === 1) {\n return getNumber(getMedian(quorum, results), \"%internal\");\n }\n const tally = new Map();\n const add = (result, weight) => {\n const t = tally.get(result) || { result, weight: 0 };\n t.weight += weight;\n tally.set(result, t);\n };\n for (const { weight, value } of results) {\n const r = getNumber(value);\n add(r - 1, weight);\n add(r, weight);\n add(r + 1, weight);\n }\n let bestWeight = 0;\n let bestResult = undefined;\n for (const { weight, result } of tally.values()) {\n // Use this result, if this result meets quorum and has either:\n // - a better weight\n // - or equal weight, but the result is larger\n if (weight >= quorum &&\n (weight > bestWeight ||\n (bestResult != null && weight === bestWeight && result > bestResult))) {\n bestWeight = weight;\n bestResult = result;\n }\n }\n return bestResult;\n}\n/**\n * A Fallback Provider.\n *\n */\nexport class FallbackProvider extends AbstractProvider {\n quorum;\n eventQuorum;\n eventWorkers;\n #configs;\n #height;\n #initialSyncPromise;\n constructor(providers, network) {\n super(network);\n this.#configs = providers.map((p) => {\n if (p instanceof AbstractProvider) {\n return Object.assign({ provider: p }, defaultConfig, defaultState);\n }\n else {\n return Object.assign({}, defaultConfig, p, defaultState);\n }\n });\n this.#height = -2;\n this.#initialSyncPromise = null;\n this.quorum = 2; //Math.ceil(providers.length / 2);\n this.eventQuorum = 1;\n this.eventWorkers = 1;\n assertArgument(this.quorum <= this.#configs.reduce((a, c) => a + c.weight, 0), \"quorum exceed provider wieght\", \"quorum\", this.quorum);\n }\n get providerConfigs() {\n return this.#configs.map((c) => {\n const result = Object.assign({}, c);\n for (const key in result) {\n if (key[0] === \"_\") {\n delete result[key];\n }\n }\n return result;\n });\n }\n async _detectNetwork() {\n return Network.from(getBigInt(await this._perform({ method: \"networkId\" })));\n }\n // @TODO: Add support to select providers to be the event subscriber\n //_getSubscriber(sub: Subscription): Subscriber {\n // throw new Error(\"@TODO\");\n //}\n async _translatePerform(provider, req) {\n switch (req.method) {\n case \"broadcastTransaction\":\n return await provider.broadcastTransaction(req.signedTransaction);\n case \"call\":\n return await provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag }));\n case \"networkId\":\n return (await provider.getNetwork()).networkId;\n case \"estimateEnergy\":\n return await provider.estimateEnergy(req.transaction);\n case \"getBalance\":\n return await provider.getBalance(req.address, req.blockTag);\n case \"getBlock\": {\n const block = \"blockHash\" in req ? req.blockHash : req.blockTag;\n return await provider.getBlock(block, req.includeTransactions);\n }\n case \"getBlockNumber\":\n return await provider.getBlockNumber();\n case \"getCode\":\n return await provider.getCode(req.address, req.blockTag);\n case \"getEnergyPrice\":\n return (await provider.getFeeData()).energyPrice;\n case \"getLogs\":\n return await provider.getLogs(req.filter);\n case \"getStorage\":\n return await provider.getStorage(req.address, req.position, req.blockTag);\n case \"getTransaction\":\n return await provider.getTransaction(req.hash);\n case \"getTransactionCount\":\n return await provider.getTransactionCount(req.address, req.blockTag);\n case \"getTransactionReceipt\":\n return await provider.getTransactionReceipt(req.hash);\n case \"getTransactionResult\":\n return await provider.getTransactionResult(req.hash);\n }\n }\n // Grab the next (random) config that is not already part of\n // the running set\n #getNextConfig(running) {\n // @TODO: Maybe do a check here to favour (heavily) providers that\n // do not require waitForSync and disfavour providers that\n // seem down-ish or are behaving slowly\n const configs = Array.from(running).map((r) => r.config);\n // Shuffle the states, sorted by priority\n const allConfigs = this.#configs.slice();\n shuffle(allConfigs);\n allConfigs.sort((a, b) => b.priority - a.priority);\n for (const config of allConfigs) {\n if (configs.indexOf(config) === -1) {\n return config;\n }\n }\n return null;\n }\n // Adds a new runner (if available) to running.\n #addRunner(running, req) {\n const config = this.#getNextConfig(running);\n // No runners available\n if (config == null) {\n return null;\n }\n // Create a new runner\n const runner = {\n config,\n result: null,\n didBump: false,\n perform: null,\n staller: null,\n };\n const now = getTime();\n // Start performing this operation\n runner.perform = (async () => {\n try {\n config.requests++;\n const result = await this._translatePerform(config.provider, req);\n runner.result = { result };\n }\n catch (error) {\n config.errorResponses++;\n runner.result = { error };\n }\n const dt = getTime() - now;\n config._totalTime += dt;\n config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt;\n runner.perform = null;\n })();\n // Start a staller; when this times out, it's time to force\n // kicking off another runner because we are taking too long\n runner.staller = (async () => {\n await stall(config.stallTimeout);\n runner.staller = null;\n })();\n running.add(runner);\n return runner;\n }\n // Initializes the blockNumber and network for each runner and\n // blocks until initialized\n async #initialSync() {\n let initialSync = this.#initialSyncPromise;\n if (!initialSync) {\n const promises = [];\n this.#configs.forEach((config) => {\n promises.push(waitForSync(config, 0));\n promises.push((async () => {\n config._network = await config.provider.getNetwork();\n })());\n });\n this.#initialSyncPromise = initialSync = (async () => {\n // Wait for all providers to have a block number and network\n await Promise.all(promises);\n // Check all the networks match\n let networkId = null;\n for (const config of this.#configs) {\n const network = config._network;\n if (networkId == null) {\n networkId = network.networkId;\n }\n else if (network.networkId !== networkId) {\n assert(false, \"cannot mix providers on different networks\", \"UNSUPPORTED_OPERATION\", {\n operation: \"new FallbackProvider\",\n });\n }\n }\n })();\n }\n await initialSync;\n }\n async #checkQuorum(running, req) {\n // Get all the result objects\n const results = [];\n for (const runner of running) {\n if (runner.result != null) {\n const { tag, value } = normalizeResult(runner.result);\n results.push({ tag, value, weight: runner.config.weight });\n }\n }\n // Are there enough results to event meet quorum?\n if (results.reduce((a, r) => a + r.weight, 0) < this.quorum) {\n return undefined;\n }\n switch (req.method) {\n case \"getBlockNumber\": {\n // We need to get the bootstrap block height\n if (this.#height === -2) {\n this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.map((c) => ({\n value: c.blockNumber,\n tag: getNumber(c.blockNumber).toString(),\n weight: c.weight,\n })))));\n }\n // Find the mode across all the providers, allowing for\n // a little drift between block heights\n const mode = getFuzzyMode(this.quorum, results);\n if (mode === undefined) {\n return undefined;\n }\n if (mode > this.#height) {\n this.#height = mode;\n }\n return this.#height;\n }\n case \"getEnergyPrice\":\n case \"estimateEnergy\":\n return getMedian(this.quorum, results);\n case \"getBlock\":\n // Pending blocks are in the mempool and already\n // quite untrustworthy; just grab anything\n if (\"blockTag\" in req && req.blockTag === \"pending\") {\n return getAnyResult(this.quorum, results);\n }\n return checkQuorum(this.quorum, results);\n case \"call\":\n case \"networkId\":\n case \"getBalance\":\n case \"getTransactionCount\":\n case \"getCode\":\n case \"getStorage\":\n case \"getTransaction\":\n case \"getTransactionReceipt\":\n case \"getLogs\":\n return checkQuorum(this.quorum, results);\n case \"broadcastTransaction\":\n return getAnyResult(this.quorum, results);\n }\n assert(false, \"unsupported method\", \"UNSUPPORTED_OPERATION\", {\n operation: `_perform(${stringify(req.method)})`,\n });\n }\n async #waitForQuorum(running, req) {\n if (running.size === 0) {\n throw new Error(\"no runners?!\");\n }\n // Any promises that are interesting to watch for; an expired stall\n // or a successful perform\n const interesting = [];\n let newRunners = 0;\n for (const runner of running) {\n // No responses, yet; keep an eye on it\n if (runner.perform) {\n interesting.push(runner.perform);\n }\n // Still stalling...\n if (runner.staller) {\n interesting.push(runner.staller);\n continue;\n }\n // This runner has already triggered another runner\n if (runner.didBump) {\n continue;\n }\n // Got a response (result or error) or stalled; kick off another runner\n runner.didBump = true;\n newRunners++;\n }\n // Check if we have reached quorum on a result (or error)\n const value = await this.#checkQuorum(running, req);\n if (value !== undefined) {\n if (value instanceof Error) {\n throw value;\n }\n return value;\n }\n // Add any new runners, because a staller timed out or a result\n // or error response came in.\n for (let i = 0; i < newRunners; i++) {\n this.#addRunner(running, req);\n }\n // All providers have returned, and we have no result\n assert(interesting.length > 0, \"quorum not met\", \"SERVER_ERROR\", {\n request: \"%sub-requests\",\n info: {\n request: req,\n results: Array.from(running).map((r) => stringify(r.result)),\n },\n });\n // Wait for someone to either complete its perform or stall out\n await Promise.race(interesting);\n // This is recursive, but at worst case the depth is 2x the\n // number of providers (each has a perform and a staller)\n return await this.#waitForQuorum(running, req);\n }\n async _perform(req) {\n // Broadcasting a transaction is rare (ish) and already incurs\n // a cost on the user, so spamming is safe-ish. Just send it to\n // every backend.\n if (req.method === \"broadcastTransaction\") {\n const results = await Promise.all(this.#configs.map(async ({ provider, weight }) => {\n try {\n const result = await provider._perform(req);\n return Object.assign(normalizeResult({ result }), { weight });\n }\n catch (error) {\n return Object.assign(normalizeResult({ error }), { weight });\n }\n }));\n const result = getAnyResult(this.quorum, results);\n assert(result !== undefined, \"problem multi-broadcasting\", \"SERVER_ERROR\", {\n request: \"%sub-requests\",\n info: { request: req, results: results.map(stringify) },\n });\n if (result instanceof Error) {\n throw result;\n }\n return result;\n }\n await this.#initialSync();\n // Bootstrap enough runners to meet quorum\n const running = new Set();\n for (let i = 0; i < this.quorum; i++) {\n this.#addRunner(running, req);\n }\n const result = await this.#waitForQuorum(running, req);\n // Track requests sent to a provider that are still\n // outstanding after quorum has been otherwise found\n for (const runner of running) {\n if (runner.perform && runner.result == null) {\n runner.config.lateResponses++;\n }\n }\n return result;\n }\n async destroy() {\n for (const { provider } of this.#configs) {\n provider.destroy();\n }\n super.destroy();\n }\n}\n//# sourceMappingURL=provider-fallback.js.map","import { assert } from \"../utils/index.js\";\nimport { AnkrProvider } from \"./provider-ankr.js\";\nimport { AlchemyProvider } from \"./provider-alchemy.js\";\nimport { CloudflareProvider } from \"./provider-cloudflare.js\";\nimport { InfuraProvider } from \"./provider-infura.js\";\n//import { PocketProvider } from \"./provider-pocket.js\";\nimport { QuickNodeProvider } from \"./provider-quicknode.js\";\nimport { FallbackProvider } from \"./provider-fallback.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nimport { WebSocketProvider } from \"./provider-websocket.js\";\nfunction isWebSocketLike(value) {\n return (value &&\n typeof value.send === \"function\" &&\n typeof value.close === \"function\");\n}\nexport function getDefaultProvider(network, options) {\n if (options == null) {\n options = {};\n }\n if (typeof network === \"string\" && network.match(/^https?:/)) {\n return new JsonRpcProvider(network);\n }\n if ((typeof network === \"string\" && network.match(/^wss?:/)) ||\n isWebSocketLike(network)) {\n return new WebSocketProvider(network);\n }\n const providers = [];\n if (options.alchemy !== \"-\") {\n try {\n providers.push(new AlchemyProvider(network, options.alchemy));\n }\n catch (error) {\n console.log(error);\n }\n }\n if (options.ankr !== \"-\" && options.ankr != null) {\n try {\n providers.push(new AnkrProvider(network, options.ankr));\n }\n catch (error) {\n console.log(error);\n }\n }\n if (options.cloudflare !== \"-\") {\n try {\n providers.push(new CloudflareProvider(network));\n }\n catch (error) {\n console.log(error);\n }\n }\n if (options.infura !== \"-\") {\n try {\n let projectId = options.infura;\n let projectSecret = undefined;\n if (typeof projectId === \"object\") {\n projectSecret = projectId.projectSecret;\n projectId = projectId.projectId;\n }\n providers.push(new InfuraProvider(network, projectId, projectSecret));\n }\n catch (error) {\n console.log(error);\n }\n }\n /*\n if (options.pocket !== \"-\") {\n try {\n let appId = options.pocket;\n let secretKey: undefined | string = undefined;\n let loadBalancer: undefined | boolean = undefined;\n if (typeof(appId) === \"object\") {\n loadBalancer = !!appId.loadBalancer;\n secretKey = appId.secretKey;\n appId = appId.appId;\n }\n providers.push(new PocketProvider(network, appId, secretKey, loadBalancer));\n } catch (error) { console.log(error); }\n }\n */\n if (options.quicknode !== \"-\") {\n try {\n let token = options.quicknode;\n providers.push(new QuickNodeProvider(network, token));\n }\n catch (error) {\n console.log(error);\n }\n }\n assert(providers.length, \"unsupported default network\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getDefaultProvider\",\n });\n if (providers.length === 1) {\n return providers[0];\n }\n return new FallbackProvider(providers);\n}\n//# sourceMappingURL=default-provider.js.map","import { defineProperties } from \"../utils/index.js\";\nimport { AbstractSigner } from \"./abstract-signer.js\";\nexport class NonceManager extends AbstractSigner {\n signer;\n #noncePromise;\n #delta;\n constructor(signer) {\n super(signer.provider);\n defineProperties(this, { signer });\n this.#noncePromise = null;\n this.#delta = 0;\n }\n async getAddress() {\n return this.signer.getAddress();\n }\n connect(provider) {\n return new NonceManager(this.signer.connect(provider));\n }\n async getNonce(blockTag) {\n if (blockTag === \"pending\") {\n if (this.#noncePromise == null) {\n this.#noncePromise = super.getNonce(\"pending\");\n }\n const delta = this.#delta;\n return (await this.#noncePromise) + delta;\n }\n return super.getNonce(blockTag);\n }\n increment() {\n this.#delta++;\n }\n reset() {\n this.#delta = 0;\n this.#noncePromise = null;\n }\n async sendTransaction(tx) {\n const noncePromise = this.getNonce(\"pending\");\n this.increment();\n tx = await this.signer.populateTransaction(tx);\n tx.nonce = await noncePromise;\n // @TODO: Maybe handle interesting/recoverable errors?\n // Like don't increment if the tx was certainly not sent\n return await this.signer.sendTransaction(tx);\n }\n signTransaction(tx) {\n return this.signer.signTransaction(tx);\n }\n signMessage(message) {\n return this.signer.signMessage(message);\n }\n signTypedData(domain, types, value) {\n return this.signer.signTypedData(domain, types, value);\n }\n}\n//# sourceMappingURL=signer-noncemanager.js.map","import { assertArgument } from \"../utils/index.js\";\nimport { JsonRpcApiPollingProvider } from \"./provider-jsonrpc.js\";\nexport class BrowserProvider extends JsonRpcApiPollingProvider {\n #request;\n constructor(core, network) {\n super(network, { batchMaxCount: 1 });\n this.#request = async (method, params) => {\n const payload = { method, params };\n this.emit(\"debug\", { action: \"sendEip1193Request\", payload });\n try {\n const result = await core.request(payload);\n this.emit(\"debug\", { action: \"receiveEip1193Result\", result });\n return result;\n }\n catch (e) {\n const error = new Error(e.message);\n error.code = e.code;\n error.data = e.data;\n error.payload = payload;\n this.emit(\"debug\", { action: \"receiveEip1193Error\", error });\n throw error;\n }\n };\n }\n async send(method, params) {\n await this._start();\n return await super.send(method, params);\n }\n async _send(payload) {\n assertArgument(!Array.isArray(payload), \"EIP-1193 does not support batch request\", \"payload\", payload);\n try {\n const result = await this.#request(payload.method, payload.params || []);\n return [{ id: payload.id, result }];\n }\n catch (e) {\n return [\n {\n id: payload.id,\n error: { code: e.code, data: e.data, message: e.message },\n },\n ];\n }\n }\n getRpcError(payload, error) {\n error = JSON.parse(JSON.stringify(error));\n // EIP-1193 gives us some machine-readable error codes, so rewrite\n // them into\n switch (error.error.code || -1) {\n case 4001:\n error.error.message = `corebc-user-denied: ${error.error.message}`;\n break;\n case 4200:\n error.error.message = `corebc-unsupported: ${error.error.message}`;\n break;\n }\n return super.getRpcError(payload, error);\n }\n async hasSigner(address) {\n if (address == null) {\n address = 0;\n }\n const accounts = await this.send(\"xcb_accounts\", []);\n if (typeof address === \"number\") {\n return accounts.length > address;\n }\n address = address.toLowerCase();\n return (accounts.filter((a) => a.toLowerCase() === address).length !== 0);\n }\n async getSigner(address) {\n if (address == null) {\n address = 0;\n }\n if (!(await this.hasSigner(address))) {\n try {\n //const resp =\n await this.#request(\"xcb_requestAccounts\", []);\n //console.log(\"RESP\", resp);\n }\n catch (error) {\n const payload = error.payload;\n throw this.getRpcError(payload, { id: payload.id, error });\n }\n }\n return await super.getSigner(address);\n }\n}\n//# sourceMappingURL=provider-browser.js.map","/**\n * [[link-pocket]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Core Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Polygon (``matic``)\n * - Arbitrum (``arbitrum``)\n *\n * @_subsection: api/providers/thirdparty:Pocket [providers-pocket]\n */\nimport { defineProperties, FetchRequest, assertArgument, } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultApplicationId = \"62e1ad51b37b8e00394bda3b\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"eth-mainnet.gateway.pokt.network\";\n case \"goerli\":\n return \"eth-goerli.gateway.pokt.network\";\n case \"matic\":\n return \"poly-mainnet.gateway.pokt.network\";\n case \"matic-mumbai\":\n return \"polygon-mumbai-rpc.gateway.pokt.network\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **PocketProvider** connects to the [[link-pocket]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-pocket-signup).\n */\nexport class PocketProvider extends JsonRpcProvider {\n /**\n * The Application ID for the Pocket connection.\n */\n applicationId;\n /**\n * The Application Secret for making authenticated requests\n * to the Pocket connection.\n */\n applicationSecret;\n /**\n * Create a new **PocketProvider**.\n *\n * By default connecting to ``mainnet`` with a highly throttled\n * API key.\n */\n constructor(_network, applicationId, applicationSecret) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (applicationId == null) {\n applicationId = defaultApplicationId;\n }\n if (applicationSecret == null) {\n applicationSecret = null;\n }\n const options = { staticNetwork: network };\n const request = PocketProvider.getRequest(network, applicationId, applicationSecret);\n super(request, network, options);\n defineProperties(this, {\n applicationId,\n applicationSecret,\n });\n }\n _getProvider(networkId) {\n try {\n return new PocketProvider(networkId, this.applicationId, this.applicationSecret);\n }\n catch (error) { }\n return super._getProvider(networkId);\n }\n /**\n * Returns a prepared request for connecting to %%network%% with\n * %%applicationId%%.\n */\n static getRequest(network, applicationId, applicationSecret) {\n if (applicationId == null) {\n applicationId = defaultApplicationId;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/v1/lb/${applicationId}`);\n request.allowGzip = true;\n if (applicationSecret) {\n request.setCredentials(\"\", applicationSecret);\n }\n if (applicationId === defaultApplicationId) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"PocketProvider\");\n return true;\n };\n }\n return request;\n }\n isCommunityResource() {\n return this.applicationId === defaultApplicationId;\n }\n}\n//# sourceMappingURL=provider-pocket.js.map","const IpcSocketProvider = undefined;\nexport { IpcSocketProvider };\n//# sourceMappingURL=provider-ipcsocket-browser.js.map","import { getAddress } from \"../address/index.js\";\nimport { hashMessage, TypedDataEncoder } from \"../hash/index.js\";\nimport { AbstractSigner } from \"../providers/index.js\";\nimport { computeAddress, Transaction } from \"../transaction/index.js\";\nimport { defineProperties, resolveProperties, assert, assertArgument, } from \"../utils/index.js\";\nimport { sha256 } from \"../crypto/index.js\";\n/**\n * The **BaseWallet** is a stream-lined implementation of a\n * [[Signer]] that operates with a private key.\n *\n * It is preferred to use the [[Wallet]] class, as it offers\n * additional functionality and simplifies loading a variety\n * of JSON formats, Mnemonic Phrases, etc.\n *\n * This class may be of use for those attempting to implement\n * a minimal Signer.\n */\nexport class BaseWallet extends AbstractSigner {\n /**\n * The wallet address.\n */\n address;\n prefix;\n #signingKey;\n /**\n * Creates a new BaseWallet for %%privateKey%%, optionally\n * connected to %%provider%%.\n *\n * If %%provider%% is not specified, only offline methods can\n * be used.\n */\n constructor({ signingKey, prefix, provider, }) {\n super(provider);\n this.prefix = prefix;\n assertArgument(signingKey && typeof signingKey.sign === \"function\", \"invalid signingKey key\", \"signingKey\", \"[ REDACTED ]\");\n this.#signingKey = signingKey;\n const address = computeAddress(this.#signingKey, prefix);\n defineProperties(this, { address });\n }\n // Store private values behind getters to reduce visibility\n // in console.log\n /**\n * The [[SigningKey]] used for signing payloads.\n */\n get signingKey() {\n return this.#signingKey;\n }\n /**\n * The private key for this wallet.\n */\n get privateKey() {\n return this.signingKey.privateKey;\n }\n async getAddress() {\n return this.address;\n }\n connect(provider) {\n return new BaseWallet({\n signingKey: this.#signingKey,\n prefix: this.prefix,\n provider,\n });\n }\n async signTransaction(tx) {\n // Replace any Addressable or ENS name with an address\n const { to, from } = await resolveProperties({\n to: tx.to || undefined,\n from: tx.from || undefined,\n });\n if (to != null) {\n tx.to = to;\n }\n if (from != null) {\n tx.from = from;\n }\n if (tx.from != null) {\n assertArgument(getAddress(tx.from) === this.address, \"transaction from address mismatch\", \"tx.from\", tx.from);\n delete tx.from;\n }\n // Build the transaction\n const btx = Transaction.from(tx);\n const unSignedSerialized = btx.unsignedSerialized;\n const unsignedHash = sha256(unSignedSerialized);\n // sha256(btx.unsignedSerialized)\n btx.signature = this.signingKey.sign(unsignedHash);\n return btx.serialized;\n }\n async signMessage(message) {\n return this.signMessageSync(message);\n }\n // @TODO: Add a secialized signTx and signTyped sync that enforces\n // all parameters are known?\n /**\n * Returns the signature for %%message%% signed with this wallet.\n */\n signMessageSync(message) {\n return this.signingKey.sign(hashMessage(message));\n }\n async signTypedData(domain, types, value) {\n // Populate any ENS names\n const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (name) => {\n // @TODO: this should use resolveName; addresses don't\n // need a provider\n assert(this.provider != null, \"cannot resolve ENS names without a provider\", \"UNSUPPORTED_OPERATION\", {\n operation: \"resolveName\",\n info: { name },\n });\n const address = getAddress(name);\n assert(address != null, \"unconfigured ENS name\", \"UNCONFIGURED_NAME\", {\n value: name,\n });\n return address;\n });\n return this.signingKey.sign(TypedDataEncoder.hash(populated.domain, types, populated.value));\n }\n}\n//# sourceMappingURL=base-wallet.js.map","import { assertArgument } from \"../utils/index.js\";\nconst subsChrs = \" !#$%&'()*+,-./<=>?@[]^_`{|}~\";\nconst Word = /^[a-z]*$/i;\nfunction unfold(words, sep) {\n let initial = 97;\n return words.reduce((accum, word) => {\n if (word === sep) {\n initial++;\n }\n else if (word.match(Word)) {\n accum.push(String.fromCharCode(initial) + word);\n }\n else {\n initial = 97;\n accum.push(word);\n }\n return accum;\n }, []);\n}\n/**\n * @_ignore\n */\nexport function decode(data, subs) {\n // Replace all the substitutions with their expanded form\n for (let i = subsChrs.length - 1; i >= 0; i--) {\n data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2));\n }\n // Get all tle clumps; each suffix, first-increment and second-increment\n const clumps = [];\n const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => {\n if (semi) {\n for (let i = parseInt(semi); i >= 0; i--) {\n clumps.push(\";\");\n }\n }\n else {\n clumps.push(item.toLowerCase());\n }\n return \"\";\n });\n /* c8 ignore start */\n if (leftover) {\n throw new Error(`leftovers: ${JSON.stringify(leftover)}`);\n }\n /* c8 ignore stop */\n return unfold(unfold(clumps, \";\"), \":\");\n}\n/**\n * @_ignore\n */\nexport function decodeOwl(data) {\n assertArgument(data[0] === \"0\", \"unsupported auwl data\", \"data\", data);\n return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length));\n}\n//# sourceMappingURL=decode-owl.js.map","import { id } from \"../hash/id.js\";\nimport { defineProperties } from \"../utils/index.js\";\n/**\n * A Wordlist represents a collection of language-specific\n * words used to encode and devoce [[link-bip-39]] encoded data\n * by mapping words to 11-bit values and vice versa.\n */\nexport class Wordlist {\n locale;\n /**\n * Creates a new Wordlist instance.\n *\n * Sub-classes MUST call this if they provide their own constructor,\n * passing in the locale string of the language.\n *\n * Generally there is no need to create instances of a Wordlist,\n * since each language-specific Wordlist creates an instance and\n * there is no state kept internally, so they are safe to share.\n */\n constructor(locale) {\n defineProperties(this, { locale });\n }\n /**\n * Sub-classes may override this to provide a language-specific\n * method for spliting %%phrase%% into individual words.\n *\n * By default, %%phrase%% is split using any sequences of\n * white-space as defined by regular expressions (i.e. ``/\\s+/``).\n */\n split(phrase) {\n return phrase.toLowerCase().split(/\\s+/g);\n }\n /**\n * Sub-classes may override this to provider a language-specific\n * method for joining %%words%% into a phrase.\n *\n * By default, %%words%% are joined by a single space.\n */\n join(words) {\n return words.join(\" \");\n }\n static check(wordlist) {\n const words = [];\n for (let i = 0; i < 2048; i++) {\n const word = wordlist.getWord(i);\n /* istanbul ignore if */\n if (i !== wordlist.getWordIndex(word)) {\n return \"0x\";\n }\n words.push(word);\n }\n return id(words.join(\"\\n\") + \"\\n\");\n }\n}\n//# sourceMappingURL=wordlist.js.map","// Use the encode-latin.js script to create the necessary\n// data files to be consumed by this class\nimport { id } from \"../hash/index.js\";\nimport { assertArgument } from \"../utils/index.js\";\nimport { decodeOwl } from \"./decode-owl.js\";\nimport { Wordlist } from \"./wordlist.js\";\n/**\n * An OWL format Wordlist is an encoding method that exploits\n * the general locality of alphabetically sorted words to\n * achieve a simple but effective means of compression.\n *\n * This class is generally not useful to most developers as\n * it is used mainly internally to keep Wordlists for languages\n * based on ASCII-7 small.\n *\n * If necessary, there are tools within the ``generation/`` folder\n * to create these necessary data.\n */\nexport class WordlistOwl extends Wordlist {\n #data;\n #checksum;\n /**\n * Creates a new Wordlist for %%locale%% using the OWL %%data%%\n * and validated against the %%checksum%%.\n */\n constructor(locale, data, checksum) {\n super(locale);\n this.#data = data;\n this.#checksum = checksum;\n this.#words = null;\n }\n get _data() {\n return this.#data;\n }\n _decodeWords() {\n return decodeOwl(this.#data);\n }\n #words;\n #loadWords() {\n if (this.#words == null) {\n const words = this._decodeWords();\n // Verify the computed list matches the official list\n const checksum = id(words.join(\"\\n\") + \"\\n\", true);\n /* c8 ignore start */\n if (checksum !== this.#checksum) {\n throw new Error(`BIP39 Wordlist for ${this.locale} FffffAILED`);\n }\n /* c8 ignore stop */\n this.#words = words;\n }\n return this.#words;\n }\n getWord(index) {\n const words = this.#loadWords();\n assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, \"index\", index);\n return words[index];\n }\n getWordIndex(word) {\n return this.#loadWords().indexOf(word);\n }\n}\n//# sourceMappingURL=wordlist-owl.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nconst words = \"0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOn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L?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO\";\nconst checksum = \"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60\";\nlet wordlist = null;\n/**\n * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangEn extends WordlistOwl {\n /**\n * Creates a new instance of the English language Wordlist.\n *\n * This should be unnecessary most of the time as the exported\n * [[langEn]] should suffice.\n *\n * @_ignore:\n */\n constructor() {\n super(\"en\", words, checksum);\n }\n /**\n * Returns a singleton instance of a ``LangEn``, creating it\n * if this is the first time being called.\n */\n static wordlist() {\n if (wordlist == null) {\n wordlist = new LangEn();\n }\n return wordlist;\n }\n}\n//# sourceMappingURL=lang-en.js.map","import { pbkdf2Sync } from \"../crypto/crypto.js\";\nimport utf8 from \"utf8\";\nexport function mnemonicToSeed(mnemonic, password) {\n if (!password) {\n password = \"\";\n }\n const t = generateSeed(mnemonic, password);\n return t.goldilock;\n}\nconst generateSeed = (mnemonic, password) => {\n const goldilockSaltPrefix = \"mnemonic\";\n const aesSaltPrefix = \"mnemonicfortheAESkey\";\n const goldilockSalt = utf8.encode(goldilockSaltPrefix + password);\n const aesSalt = utf8.encode(aesSaltPrefix + password);\n const goldilockKey = pbkdf2Sync(Buffer.from(mnemonic), goldilockSalt, 2048, 64, \"sha512\");\n const aesKeySeed = pbkdf2Sync(Buffer.from(mnemonic), aesSalt, 2048, 64, \"sha512\");\n return {\n aes: aesKeySeed.toString(\"hex\"),\n goldilock: goldilockKey.toString(\"hex\"),\n };\n};\n//# sourceMappingURL=mnemonicToSeed.js.map","import { defineProperties, getBytes, hexlify, assertNormalize, assertPrivate, assertArgument, } from \"../utils/index.js\";\nimport { LangEn } from \"../wordlists/lang-en.js\";\nimport { legacySha256 } from \"../crypto/sha3.js\";\nimport { mnemonicToSeed } from \"./mnemonicToSeed.js\";\n// Returns a byte with the MSB bits set\nfunction getUpperMask(bits) {\n return (((1 << bits) - 1) << (8 - bits)) & 0xff;\n}\n// Returns a byte with the LSB bits set\nfunction getLowerMask(bits) {\n return ((1 << bits) - 1) & 0xff;\n}\nfunction mnemonicToEntropy(mnemonic, wordlist) {\n assertNormalize(\"NFKD\");\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n const words = wordlist.split(mnemonic);\n assertArgument(words.length % 3 === 0 && words.length >= 12 && words.length <= 24, \"invalid mnemonic length\", \"mnemonic\", \"[ REDACTED ]\");\n const entropy = new Uint8Array(Math.ceil((11 * words.length) / 8));\n let offset = 0;\n for (let i = 0; i < words.length; i++) {\n let index = wordlist.getWordIndex(words[i].normalize(\"NFKD\"));\n assertArgument(index >= 0, `invalid mnemonic word at index ${i}`, \"mnemonic\", \"[ REDACTED ]\");\n for (let bit = 0; bit < 11; bit++) {\n if (index & (1 << (10 - bit))) {\n entropy[offset >> 3] |= 1 << (7 - (offset % 8));\n }\n offset++;\n }\n }\n const entropyBits = (32 * words.length) / 3;\n const checksumBits = words.length / 3;\n const checksumMask = getUpperMask(checksumBits);\n const checksum = getBytes(legacySha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;\n assertArgument(checksum === (entropy[entropy.length - 1] & checksumMask), \"invalid mnemonic checksum\", \"mnemonic\", \"[ REDACTED ]\");\n return hexlify(entropy.slice(0, entropyBits / 8));\n}\nfunction entropyToMnemonic(entropy, wordlist) {\n assertArgument(entropy.length % 4 === 0 && entropy.length >= 16 && entropy.length <= 32, \"invalid entropy size\", \"entropy\", \"[ REDACTED ]\");\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n const indices = [0];\n let remainingBits = 11;\n for (let i = 0; i < entropy.length; i++) {\n // Consume the whole byte (with still more to go)\n if (remainingBits > 8) {\n indices[indices.length - 1] <<= 8;\n indices[indices.length - 1] |= entropy[i];\n remainingBits -= 8;\n // This byte will complete an 11-bit index\n }\n else {\n indices[indices.length - 1] <<= remainingBits;\n indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits);\n // Start the next word\n indices.push(entropy[i] & getLowerMask(8 - remainingBits));\n remainingBits += 3;\n }\n }\n // Compute the checksum bits\n const checksumBits = entropy.length / 4;\n const checksum = parseInt(legacySha256(entropy).substring(2, 4), 16) &\n getUpperMask(checksumBits);\n // Shift the checksum into the word indices\n indices[indices.length - 1] <<= checksumBits;\n indices[indices.length - 1] |= checksum >> (8 - checksumBits);\n return wordlist.join(indices.map((index) => wordlist.getWord(index)));\n}\nconst _guard = {};\n/**\n * A **Mnemonic** wraps all properties required to compute [[link-bip-39]]\n * seeds and convert between phrases and entropy.\n */\nexport class Mnemonic {\n /**\n * The mnemonic phrase of 12, 15, 18, 21 or 24 words.\n *\n * Use the [[wordlist]] ``split`` method to get the individual words.\n */\n phrase;\n /**\n * The password used for this mnemonic. If no password is used this\n * is the empty string (i.e. ``\"\"``) as per the specification.\n */\n password;\n /**\n * The wordlist for this mnemonic.\n */\n wordlist;\n /**\n * The underlying entropy which the mnemonic encodes.\n */\n entropy;\n /**\n * @private\n */\n constructor(guard, entropy, phrase, password, wordlist) {\n if (password == null) {\n password = \"\";\n }\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n assertPrivate(guard, _guard, \"Mnemonic\");\n defineProperties(this, { phrase, password, wordlist, entropy });\n }\n /**\n * Returns the seed for the mnemonic.\n */\n computeSeed() {\n return mnemonicToSeed(this.phrase, this.password);\n }\n /**\n * Creates a new Mnemonic for the %%phrase%%.\n *\n * The default %%password%% is the empty string and the default\n * wordlist is the [English wordlists](LangEn).\n */\n static fromPhrase({ phrase, password, wordlist, }) {\n // Normalize the case and space; throws if invalid\n const entropy = mnemonicToEntropy(phrase, wordlist);\n phrase = entropyToMnemonic(getBytes(entropy), wordlist);\n return new Mnemonic(_guard, entropy, phrase, password, wordlist);\n }\n /**\n * Create a new **Mnemonic** from the %%entropy%%.\n *\n * The default %%password%% is the empty string and the default\n * wordlist is the [English wordlists](LangEn).\n */\n static fromEntropy(_entropy, password, wordlist) {\n const entropy = getBytes(_entropy, \"entropy\");\n const phrase = entropyToMnemonic(entropy, wordlist);\n return new Mnemonic(_guard, hexlify(entropy), phrase, password, wordlist);\n }\n /**\n * Returns the phrase for %%mnemonic%%.\n */\n static entropyToPhrase(_entropy, wordlist) {\n const entropy = getBytes(_entropy, \"entropy\");\n return entropyToMnemonic(entropy, wordlist);\n }\n /**\n * Returns the entropy for %%phrase%%.\n */\n static phraseToEntropy(phrase, wordlist) {\n return mnemonicToEntropy(phrase, wordlist);\n }\n /**\n * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase.\n *\n * This checks all the provided words belong to the %%wordlist%%,\n * that the length is valid and the checksum is correct.\n */\n static isValidMnemonic(phrase, wordlist) {\n try {\n mnemonicToEntropy(phrase, wordlist);\n return true;\n }\n catch (error) { }\n return false;\n }\n}\n//# sourceMappingURL=mnemonic.js.map","/**\n * @_ignore\n */\nimport { getBytesCopy, assertArgument, toUtf8Bytes } from \"../utils/index.js\";\nexport function looseArrayify(hexString) {\n if (typeof hexString === \"string\" && !hexString.startsWith(\"0x\")) {\n hexString = \"0x\" + hexString;\n }\n return getBytesCopy(hexString);\n}\nexport function zpad(value, length) {\n value = String(value);\n while (value.length < length) {\n value = \"0\" + value;\n }\n return value;\n}\nexport function getPassword(password) {\n if (typeof password === \"string\") {\n return toUtf8Bytes(password, \"NFKC\");\n }\n return getBytesCopy(password);\n}\nexport function spelunk(object, _path) {\n const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);\n assertArgument(match != null, \"invalid path\", \"path\", _path);\n const path = match[1];\n const type = match[3];\n const reqd = match[4] === \"!\";\n let cur = object;\n for (const comp of path.toLowerCase().split(\".\")) {\n // Search for a child object with a case-insensitive matching key\n if (Array.isArray(cur)) {\n if (!comp.match(/^[0-9]+$/)) {\n break;\n }\n cur = cur[parseInt(comp)];\n }\n else if (typeof cur === \"object\") {\n let found = null;\n for (const key in cur) {\n if (key.toLowerCase() === comp) {\n found = cur[key];\n break;\n }\n }\n cur = found;\n }\n else {\n cur = null;\n }\n if (cur == null) {\n break;\n }\n }\n assertArgument(!reqd || cur != null, \"missing required value\", \"path\", path);\n if (type && cur != null) {\n if (type === \"int\") {\n if (typeof cur === \"string\" && cur.match(/^-?[0-9]+$/)) {\n return parseInt(cur);\n }\n else if (Number.isSafeInteger(cur)) {\n return cur;\n }\n }\n if (type === \"number\") {\n if (typeof cur === \"string\" && cur.match(/^-?[0-9.]*$/)) {\n return parseFloat(cur);\n }\n }\n if (type === \"data\") {\n if (typeof cur === \"string\") {\n return looseArrayify(cur);\n }\n }\n if (type === \"array\" && Array.isArray(cur)) {\n return cur;\n }\n if (type === typeof cur) {\n return cur;\n }\n assertArgument(false, `wrong type found for ${type} `, \"path\", path);\n }\n return cur;\n}\n/*\nexport function follow(object: any, path: string): null | string {\n let currentChild = object;\n\n for (const comp of path.toLowerCase().split('/')) {\n\n // Search for a child object with a case-insensitive matching key\n let matchingChild = null;\n for (const key in currentChild) {\n if (key.toLowerCase() === comp) {\n matchingChild = currentChild[key];\n break;\n }\n }\n\n if (matchingChild === null) { return null; }\n\n currentChild = matchingChild;\n }\n\n return currentChild;\n}\n\n// \"path/to/something:type!\"\nexport function followRequired(data: any, path: string): string {\n const value = follow(data, path);\n if (value != null) { return value; }\n return logger.throwArgumentError(\"invalid value\", `data:${ path }`,\n JSON.stringify(data));\n}\n*/\n// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4)\n/*\nexport function uuidV4(randomBytes: BytesLike): string {\n const bytes = getBytes(randomBytes, \"randomBytes\");\n\n // Section: 4.1.3:\n // - time_hi_and_version[12:16] = 0b0100\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n\n // Section 4.4\n // - clock_seq_hi_and_reserved[6] = 0b0\n // - clock_seq_hi_and_reserved[7] = 0b1\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n\n const value = hexlify(bytes);\n\n return [\n value.substring(2, 10),\n value.substring(10, 14),\n value.substring(14, 18),\n value.substring(18, 22),\n value.substring(22, 34),\n ].join(\"-\");\n}\n*/\n//# sourceMappingURL=utils.js.map","/**\n * The JSON Wallet formats allow a simple way to store the private\n * keys needed in Core along with related information and allows\n * for extensible forms of encryption.\n *\n * These utilities facilitate decrypting and encrypting the most common\n * JSON Wallet formats.\n *\n * @_subsection: api/wallet:JSON Wallets [json-wallets]\n */\n// @ts-ignore\nimport pkg from \"aes-js\";\nconst { CTR } = pkg;\nimport { getAddress } from \"../address/index.js\";\nimport { pbkdf2, randomBytes, scrypt, scryptSync, sha256, } from \"../crypto/index.js\";\nimport { concat, getBytes, hexlify, uuidV4, assert, assertArgument, } from \"../utils/index.js\";\nimport { getPassword, spelunk, zpad } from \"./utils.js\";\nimport { version } from \"../_version.js\";\nimport { computeAddress, extractPrefix } from \"../transaction/address.js\";\nconst defaultPath = \"m/44'/60'/0'/0/0\";\n/**\n * Returns true if %%json%% is a valid JSON Keystore Wallet.\n */\nexport function isKeystoreJson(json) {\n try {\n const data = JSON.parse(json);\n const version = data.version != null ? parseInt(data.version) : 0;\n if (version === 3) {\n return true;\n }\n }\n catch (error) { }\n return false;\n}\nfunction decrypt(data, key, ciphertext) {\n const cipher = spelunk(data, \"crypto.cipher:string\");\n if (cipher === \"aes-128-ctr\") {\n const iv = spelunk(data, \"crypto.cipherparams.iv:data!\");\n const aesCtr = new CTR(key, iv);\n return hexlify(aesCtr.decrypt(ciphertext));\n }\n assert(false, \"unsupported cipher\", \"UNSUPPORTED_OPERATION\", {\n operation: \"decrypt\",\n });\n}\nfunction getAccount(data, _key) {\n const key = getBytes(_key);\n const ciphertext = spelunk(data, \"crypto.ciphertext:data!\");\n const computedMAC = hexlify(sha256(concat([key.slice(16, 32), ciphertext]))).substring(2);\n assertArgument(computedMAC === spelunk(data, \"crypto.mac:string!\").toLowerCase(), \"incorrect password\", \"password\", \"[ REDACTED ]\");\n const privateKey = decrypt(data, key.slice(0, 16), ciphertext);\n const address = getAddress(data.address);\n const prefix = extractPrefix(address);\n if (computeAddress(privateKey, prefix) !== address) {\n throw new Error(\"address mismatch\");\n }\n if (data.address) {\n let check = data.address.toLowerCase();\n if (!check.startsWith(\"0x\")) {\n check = \"0x\" + check;\n }\n assertArgument(getAddress(check) === address, \"keystore address/privateKey mismatch\", \"address\", data.address);\n }\n const account = { address, privateKey };\n // Version 0.1 x-corebc metadata must contain an encrypted mnemonic phrase\n const version = spelunk(data, \"x-corebc.version:string\");\n if (version === \"0.1\") {\n const mnemonicKey = key.slice(32, 64);\n const mnemonicCiphertext = spelunk(data, \"x-corebc.mnemonicCiphertext:data!\");\n const mnemonicIv = spelunk(data, \"x-corebc.mnemonicCounter:data!\");\n const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv);\n account.mnemonic = {\n path: spelunk(data, \"x-corebc.path:string\") || defaultPath,\n locale: spelunk(data, \"x-corebc.locale:string\") || \"en\",\n entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext))),\n };\n }\n return account;\n}\nfunction getDecryptKdfParams(data) {\n const kdf = spelunk(data, \"crypto.kdf:string\");\n if (kdf && typeof kdf === \"string\") {\n if (kdf.toLowerCase() === \"scrypt\") {\n const salt = spelunk(data, \"crypto.kdfparams.salt:data!\");\n const N = spelunk(data, \"crypto.kdfparams.n:int!\");\n const r = spelunk(data, \"crypto.kdfparams.r:int!\");\n const p = spelunk(data, \"crypto.kdfparams.p:int!\");\n // Make sure N is a power of 2\n assertArgument(N > 0 && (N & (N - 1)) === 0, \"invalid kdf.N\", \"kdf.N\", N);\n assertArgument(r > 0 && p > 0, \"invalid kdf\", \"kdf\", kdf);\n const dkLen = spelunk(data, \"crypto.kdfparams.dklen:int!\");\n assertArgument(dkLen === 32, \"invalid kdf.dklen\", \"kdf.dflen\", dkLen);\n return { name: \"scrypt\", salt, N, r, p, dkLen: 64 };\n }\n else if (kdf.toLowerCase() === \"pbkdf2\") {\n const salt = spelunk(data, \"crypto.kdfparams.salt:data!\");\n const prf = spelunk(data, \"crypto.kdfparams.prf:string!\");\n const algorithm = prf.split(\"-\").pop();\n assertArgument(algorithm === \"sha256\" || algorithm === \"sha512\", \"invalid kdf.pdf\", \"kdf.pdf\", prf);\n const count = spelunk(data, \"crypto.kdfparams.c:int!\");\n const dkLen = spelunk(data, \"crypto.kdfparams.dklen:int!\");\n assertArgument(dkLen === 32, \"invalid kdf.dklen\", \"kdf.dklen\", dkLen);\n return { name: \"pbkdf2\", salt, count, dkLen, algorithm };\n }\n }\n assertArgument(false, \"unsupported key-derivation function\", \"kdf\", kdf);\n}\n/**\n * Returns the account details for the JSON Keystore Wallet %%json%%\n * using %%password%%.\n *\n * It is preferred to use the [async version](decryptKeystoreJson)\n * instead, which allows a [[ProgressCallback]] to keep the user informed\n * as to the decryption status.\n *\n * This method will block the event loop (freezing all UI) until decryption\n * is complete, which can take quite some time, depending on the wallet\n * paramters and platform.\n */\nexport function decryptKeystoreJsonSync(json, _password) {\n const data = JSON.parse(json);\n const password = getPassword(_password);\n const params = getDecryptKdfParams(data);\n if (params.name === \"pbkdf2\") {\n const { salt, count, dkLen, algorithm } = params;\n const key = pbkdf2(password, salt, count, dkLen, algorithm);\n return getAccount(data, key);\n }\n assert(params.name === \"scrypt\", \"cannot be reached\", \"UNKNOWN_ERROR\", {\n params,\n });\n const { salt, N, r, p, dkLen } = params;\n const key = scryptSync(password, salt, N, r, p, dkLen);\n return getAccount(data, key);\n}\nfunction stall(duration) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve();\n }, duration);\n });\n}\n/**\n * Resolves to the decrypted JSON Keystore Wallet %%json%% using the\n * %%password%%.\n *\n * If provided, %%progress%% will be called periodically during the\n * decrpytion to provide feedback, and if the function returns\n * ``false`` will halt decryption.\n *\n * The %%progressCallback%% will **always** receive ``0`` before\n * decryption begins and ``1`` when complete.\n */\nexport async function decryptKeystoreJson(json, _password, progress) {\n const data = JSON.parse(json);\n const password = getPassword(_password);\n const params = getDecryptKdfParams(data);\n if (params.name === \"pbkdf2\") {\n if (progress) {\n progress(0);\n await stall(0);\n }\n const { salt, count, dkLen, algorithm } = params;\n const key = pbkdf2(password, salt, count, dkLen, algorithm);\n if (progress) {\n progress(1);\n await stall(0);\n }\n return getAccount(data, key);\n }\n assert(params.name === \"scrypt\", \"cannot be reached\", \"UNKNOWN_ERROR\", {\n params,\n });\n const { salt, N, r, p, dkLen } = params;\n const key = await scrypt(password, salt, N, r, p, dkLen, progress);\n return getAccount(data, key);\n}\nfunction getEncryptKdfParams(options) {\n // Check/generate the salt\n const salt = options.salt != null\n ? getBytes(options.salt, \"options.salt\")\n : randomBytes(32);\n // Override the scrypt password-based key derivation function parameters\n let N = 1 << 17, r = 8, p = 1;\n if (options.scrypt) {\n if (options.scrypt.N) {\n N = options.scrypt.N;\n }\n if (options.scrypt.r) {\n r = options.scrypt.r;\n }\n if (options.scrypt.p) {\n p = options.scrypt.p;\n }\n }\n assertArgument(typeof N === \"number\" &&\n N > 0 &&\n Number.isSafeInteger(N) &&\n (BigInt(N) & BigInt(N - 1)) === BigInt(0), \"invalid scrypt N parameter\", \"options.N\", N);\n assertArgument(typeof r === \"number\" && r > 0 && Number.isSafeInteger(r), \"invalid scrypt r parameter\", \"options.r\", r);\n assertArgument(typeof p === \"number\" && p > 0 && Number.isSafeInteger(p), \"invalid scrypt p parameter\", \"options.p\", p);\n return { name: \"scrypt\", dkLen: 32, salt, N, r, p };\n}\nfunction _encryptKeystore(key, kdf, account, options) {\n const privateKey = getBytes(account.privateKey, \"privateKey\");\n // Override initialization vector\n const iv = options.iv != null ? getBytes(options.iv, \"options.iv\") : randomBytes(16);\n assertArgument(iv.length === 16, \"invalid options.iv length\", \"options.iv\", options.iv);\n // Override the uuid\n const uuidRandom = options.uuid != null\n ? getBytes(options.uuid, \"options.uuid\")\n : randomBytes(16);\n assertArgument(uuidRandom.length === 16, \"invalid options.uuid length\", \"options.uuid\", options.iv);\n // This will be used to encrypt the wallet (as per Web3 secret storage)\n // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix)\n // - 32 bytes AES key to encrypt mnemonic with (required here to be corebc Wallet)\n const derivedKey = key.slice(0, 16);\n const macPrefix = key.slice(16, 32);\n // Encrypt the private key\n const aesCtr = new CTR(derivedKey, iv);\n const ciphertext = getBytes(aesCtr.encrypt(privateKey));\n // Compute the message authentication code, used to check the password\n const mac = sha256(concat([macPrefix, ciphertext]));\n const data = {\n address: account.address.substring(2).toLowerCase(),\n id: uuidV4(uuidRandom),\n version: 3,\n Crypto: {\n cipher: \"aes-128-ctr\",\n cipherparams: {\n iv: hexlify(iv).substring(2),\n },\n ciphertext: hexlify(ciphertext).substring(2),\n kdf: \"scrypt\",\n kdfparams: {\n salt: hexlify(kdf.salt).substring(2),\n n: kdf.N,\n dklen: 32,\n p: kdf.p,\n r: kdf.r,\n },\n mac: mac.substring(2),\n },\n };\n // If we have a mnemonic, encrypt it into the JSON wallet\n if (account.mnemonic) {\n const client = options.client != null ? options.client : `corebc/${version}`;\n const path = account.mnemonic.path || defaultPath;\n const locale = account.mnemonic.locale || \"en\";\n const mnemonicKey = key.slice(32, 64);\n const entropy = getBytes(account.mnemonic.entropy, \"account.mnemonic.entropy\");\n const mnemonicIv = randomBytes(16);\n const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv);\n const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy));\n const now = new Date();\n const timestamp = now.getUTCFullYear() +\n \"-\" +\n zpad(now.getUTCMonth() + 1, 2) +\n \"-\" +\n zpad(now.getUTCDate(), 2) +\n \"T\" +\n zpad(now.getUTCHours(), 2) +\n \"-\" +\n zpad(now.getUTCMinutes(), 2) +\n \"-\" +\n zpad(now.getUTCSeconds(), 2) +\n \".0Z\";\n const gethFilename = \"UTC--\" + timestamp + \"--\" + data.address;\n data[\"x-corebc\"] = {\n client,\n gethFilename,\n path,\n locale,\n mnemonicCounter: hexlify(mnemonicIv).substring(2),\n mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2),\n version: \"0.1\",\n };\n }\n return JSON.stringify(data);\n}\n/**\n * Return the JSON Keystore Wallet for %%account%% encrypted with\n * %%password%%.\n *\n * The %%options%% can be used to tune the password-based key\n * derivation function parameters, explicitly set the random values\n * used. Any provided [[ProgressCallback]] is ignord.\n */\nexport function encryptKeystoreJsonSync(account, password, options) {\n if (options == null) {\n options = {};\n }\n const passwordBytes = getPassword(password);\n const kdf = getEncryptKdfParams(options);\n const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64);\n return _encryptKeystore(getBytes(key), kdf, account, options);\n}\n/**\n * Resolved to the JSON Keystore Wallet for %%account%% encrypted\n * with %%password%%.\n *\n * The %%options%% can be used to tune the password-based key\n * derivation function parameters, explicitly set the random values\n * used and provide a [[ProgressCallback]] to receive periodic updates\n * on the completion status..\n */\nexport async function encryptKeystoreJson(account, password, options) {\n if (options == null) {\n options = {};\n }\n const passwordBytes = getPassword(password);\n const kdf = getEncryptKdfParams(options);\n const key = await scrypt(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback);\n return _encryptKeystore(getBytes(key), kdf, account, options);\n}\n//# sourceMappingURL=json-keystore.js.map","/**\n * Explain HD Wallets..\n *\n * @_subsection: api/wallet:HD Wallets [hd-wallets]\n */\nimport { randomBytes, ripemd160, SigningKey, sha256 } from \"../crypto/index.js\";\nimport { dataSlice, defineProperties, getNumber, assertPrivate, assertArgument, } from \"../utils/index.js\";\nimport { LangEn } from \"../wordlists/lang-en.js\";\nimport { BaseWallet } from \"./base-wallet.js\";\nimport { Mnemonic } from \"./mnemonic.js\";\nimport { encryptKeystoreJson, encryptKeystoreJsonSync, } from \"./json-keystore.js\";\nimport { Ed448Goldilock } from \"../crypto/crypto.js\";\nimport { mnemonicToSeed } from \"./mnemonicToSeed.js\";\n// import { arrayify,\n// // hexDataSlice\n// } from \"../utils/data.js\";\n// function sha512Hash(password: BytesLike, salt: BytesLike): Uint8Array {\n// const p = getBytes(password);\n// const s = getBytes(salt);\n// return getBytes(pbkdf2(p, s, 2048, 57, \"sha512\"));\n// }\n/**\n * The default derivation path for Core HD Nodes. (i.e. ``\"m/44'/60'/0'/0/0\"``)\n */\nexport const defaultPath = \"m\";\n// \"Bitcoin seed\"\n// const MasterSecret = new Uint8Array([66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100]);\nconst HardenedBit = 0x80000000;\n// function addScalar(a: Uint8Array, b: Uint8Array): Uint8Array {\n// b = getBytes(concat([b.slice(0, 53), \"0x00000000\"]));\n// b[0] &= 0xfc;\n// const c = new Uint8Array(57);\n// let hold = 0;\n// for (let i = 0; i < 57; i++) {\n// hold += a[i] + b[i];\n// c[i] = hold % 256;\n// hold = Math.floor(hold / 256);\n// }\n// return c;\n// };\nconst _guard = {};\nfunction derivePath(node, path) {\n const components = path.split(\"/\");\n assertArgument(components.length > 0 && (components[0] === \"m\" || node.depth > 0), \"invalid path\", \"path\", path);\n if (components[0] === \"m\") {\n components.shift();\n }\n let result = node;\n for (let i = 0; i < components.length; i++) {\n const component = components[i];\n if (component.match(/^[0-9]+'$/)) {\n const index = parseInt(component.substring(0, component.length - 1));\n assertArgument(index < HardenedBit, \"invalid path index\", `path[${i}]`, component);\n result = result.deriveChild(HardenedBit + index);\n }\n else if (component.match(/^[0-9]+$/)) {\n const index = parseInt(component);\n assertArgument(index < HardenedBit, \"invalid path index\", `path[${i}]`, component);\n result = result.deriveChild(index);\n }\n else {\n assertArgument(false, \"invalid path component\", `path[${i}]`, component);\n }\n }\n return result;\n}\n/**\n * An **HDNodeWallet** is a [[Signer]] backed by the private key derived\n * from an HD Node using the [[link-bip-32]] stantard.\n *\n * An HD Node forms a hierarchal structure with each HD Node having a\n * private key and the ability to derive child HD Nodes, defined by\n * a path indicating the index of each child.\n */\nexport class HDNodeWallet extends BaseWallet {\n /**\n * The compressed public key.\n */\n publicKey;\n prefix;\n /**\n * The fingerprint.\n *\n * A fingerprint allows quick qay to detect parent and child nodes,\n * but developers should be prepared to deal with collisions as it\n * is only 4 bytes.\n */\n fingerprint;\n /**\n * The parent fingerprint.\n */\n parentFingerprint;\n /**\n * The mnemonic used to create this HD Node, if available.\n *\n * Sources such as extended keys do not encode the mnemonic, in\n * which case this will be ``null``.\n */\n mnemonic;\n #seed;\n /**\n * The derivation path of this wallet.\n *\n * Since extended keys do not provider full path details, this\n * may be ``null``, if instantiated from a source that does not\n * enocde it.\n */\n path;\n /**\n * The child index of this wallet. Values over ``2 *\\* 31`` indicate\n * the node is hardened.\n */\n index;\n /**\n * The depth of this wallet, which is the number of components\n * in its path.\n */\n depth;\n /**\n * @private\n */\n constructor({ guard, seed, signingKey, parentFingerprint, path, index, depth, mnemonic, provider, prefix, }) {\n super({\n signingKey,\n prefix,\n provider,\n });\n assertPrivate(guard, _guard, \"HDNodeWallet\");\n defineProperties(this, { publicKey: signingKey.publicKey });\n this.prefix = prefix;\n this.#seed = seed;\n const fingerprint = dataSlice(ripemd160(sha256(this.publicKey)), 0, 4);\n defineProperties(this, {\n parentFingerprint,\n fingerprint,\n path,\n index,\n depth,\n });\n defineProperties(this, { mnemonic });\n }\n connect(provider) {\n return new HDNodeWallet({\n guard: _guard,\n signingKey: this.signingKey,\n parentFingerprint: this.parentFingerprint,\n path: this.path,\n index: this.index,\n depth: this.depth,\n seed: this.#seed,\n mnemonic: this.mnemonic,\n provider,\n prefix: this.prefix,\n });\n }\n #account() {\n const account = {\n address: this.address,\n privateKey: this.privateKey,\n };\n const m = this.mnemonic;\n if (this.path && m && m.wordlist.locale === \"en\" && m.password === \"\") {\n account.mnemonic = {\n path: this.path,\n locale: \"en\",\n entropy: m.entropy,\n };\n }\n return account;\n }\n /**\n * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with\n * %%password%%.\n *\n * If %%progressCallback%% is specified, it will receive periodic\n * updates as the encryption process progreses.\n */\n async encrypt(password, progressCallback) {\n return await encryptKeystoreJson(this.#account(), password, {\n progressCallback,\n });\n }\n /**\n * Returns a [JSON Keystore Wallet](json-wallets) encryped with\n * %%password%%.\n *\n * It is preferred to use the [async version](encrypt) instead,\n * which allows a [[ProgressCallback]] to keep the user informed.\n *\n * This method will block the event loop (freezing all UI) until\n * it is complete, which may be a non-trivial duration.\n */\n encryptSync(password) {\n return encryptKeystoreJsonSync(this.#account(), password);\n }\n /**\n * Returns true if this wallet has a path, providing a Type Guard\n * that the path is non-null.\n */\n hasPath() {\n return this.path != null;\n }\n /**\n * Return the child for %%index%%.\n */\n deriveChild(_index) {\n const newPrivateKey = Ed448Goldilock.HDWalletGenerateKeyFromSeed(this.#seed, Number(_index));\n const newSigningKey = new SigningKey(newPrivateKey);\n // Base path\n let path = this.path;\n if (path) {\n path += \"/\" + (_index & ~HardenedBit);\n if (_index & HardenedBit) {\n path += \"'\";\n }\n }\n return new HDNodeWallet({\n guard: _guard,\n signingKey: newSigningKey,\n parentFingerprint: this.fingerprint,\n path,\n index: _index,\n seed: this.#seed,\n depth: this.depth + 1,\n mnemonic: this.mnemonic,\n provider: this.provider,\n prefix: this.prefix,\n });\n }\n /**\n * Return the HDNode for %%path%% from this node.\n */\n derivePath(path) {\n return derivePath(this, path);\n }\n static #fromSeed({ _seed, mnemonic, prefix, path, }) {\n const extendetPrivateKey = Ed448Goldilock.HDWalletGenerateKeyFromSeed(_seed, 0);\n const signingKey = new SigningKey(extendetPrivateKey);\n // console.log({ privateKey, thisKey: signingKey.privateKey,len:tmp.privateKey.length })\n return new HDNodeWallet({\n seed: _seed,\n guard: _guard,\n signingKey,\n parentFingerprint: \"0x00000000\",\n path: path || defaultPath,\n index: 0,\n depth: 0,\n mnemonic,\n provider: null,\n prefix,\n });\n }\n /**\n * Creates a new random HDNode.\n */\n static createRandom(prefix, password, path, wordlist) {\n if (password == null) {\n password = \"\";\n }\n if (path == null) {\n path = defaultPath;\n }\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n const mnemonic = Mnemonic.fromEntropy(randomBytes(32), password, wordlist);\n return HDNodeWallet.#fromSeed({\n _seed: mnemonic.computeSeed(),\n mnemonic,\n prefix,\n }).derivePath(path);\n }\n /**\n * Create am HD Node from %%mnemonic%%.\n */\n static fromMnemonic(mnemonic, prefix, path) {\n if (!path) {\n path = defaultPath;\n }\n return HDNodeWallet.#fromSeed({\n _seed: mnemonic.computeSeed(),\n mnemonic,\n prefix,\n }).derivePath(path);\n }\n static mnemonicToSeed(mnemonic, password) {\n const seed = mnemonicToSeed(mnemonic, password);\n return seed;\n }\n /**\n * Creates an HD Node from a mnemonic %%phrase%%.\n */\n static fromPhrase({ phrase, prefix, password, path, wordlist, }) {\n if (!password) {\n password = \"\";\n }\n if (!path) {\n path = defaultPath;\n }\n if (!wordlist) {\n wordlist = LangEn.wordlist();\n }\n const mnemonic = Mnemonic.fromPhrase({ phrase, password, wordlist });\n const _seed = mnemonic.computeSeed();\n return HDNodeWallet.#fromSeed({\n _seed,\n mnemonic,\n prefix,\n }).derivePath(path);\n }\n /**\n * Creates an HD Node from a %%seed%%.\n */\n static fromSeed({ seed, prefix, path, }) {\n return HDNodeWallet.#fromSeed({\n _seed: seed,\n mnemonic: null,\n path: path || defaultPath,\n prefix,\n });\n }\n}\n/*\nexport class HDNodeWalletManager {\n #root: HDNodeWallet;\n\n constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) {\n if (password == null) { password = \"\"; }\n if (path == null) { path = \"m/44'/60'/0'/0\"; }\n if (locale == null) { locale = LangEn.wordlist(); }\n this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale);\n }\n\n getSigner(index?: number): HDNodeWallet {\n return this.#root.deriveChild((index == null) ? 0: index);\n }\n}\n*/\n/**\n * Returns the [[link-bip-32]] path for the acount at %%index%%.\n *\n * This is the pattern used by wallets like Ledger.\n *\n * There is also an [alternate pattern](getIndexedAccountPath) used by\n * some software.\n */\nexport function getAccountPath(_index) {\n const index = getNumber(_index, \"index\");\n assertArgument(index >= 0 && index < HardenedBit, \"invalid account index\", \"index\", index);\n return `m/44'/60'/${index}'/0/0`;\n}\n/**\n * Returns the path using an alternative pattern for deriving accounts,\n * at %%index%%.\n *\n * This derivation path uses the //index// component rather than the\n * //account// component to derive sequential accounts.\n *\n * This is the pattern used by wallets like MetaMask.\n */\nexport function getIndexedAccountPath(_index) {\n const index = getNumber(_index, \"index\");\n assertArgument(index >= 0 && index < HardenedBit, \"invalid account index\", \"index\", index);\n return `m/44'/60'/0'/0/${index}`;\n}\n//# sourceMappingURL=hdwallet.js.map","/**\n * @_subsection: api/wallet:JSON Wallets [json-wallets]\n */\n// @ts-ignore\nimport pkg from \"aes-js\";\nconst { CBC, pkcs7Strip } = pkg;\nimport { getAddress } from \"../address/index.js\";\nimport { pbkdf2 } from \"../crypto/index.js\";\nimport { id } from \"../hash/index.js\";\nimport { getBytes, assertArgument } from \"../utils/index.js\";\nimport { getPassword, looseArrayify, spelunk } from \"./utils.js\";\n/**\n * Returns true if %%json%% is a valid JSON Crowdsale wallet.\n */\nexport function isCrowdsaleJson(json) {\n try {\n const data = JSON.parse(json);\n if (data.encseed) {\n return true;\n }\n }\n catch (error) { }\n return false;\n}\n/**\n * Before Core launched, it was necessary to create a wallet\n * format for backers to use, which would be used to receive xcb\n * as a reward for contributing to the project.\n *\n * The [[link-crowdsale]] format is now obsolete, but it is still\n * useful to support and the additional code is fairly trivial as\n * all the primitives required are used through core portions of\n * the library.\n */\nexport function decryptCrowdsaleJson(json, _password) {\n const data = JSON.parse(json);\n const password = getPassword(_password);\n // Core Address\n const address = getAddress(spelunk(data, \"ethaddr:string!\"));\n // Encrypted Seed\n const encseed = looseArrayify(spelunk(data, \"encseed:string!\"));\n assertArgument(encseed && encseed.length % 16 === 0, \"invalid encseed\", \"json\", json);\n const key = getBytes(pbkdf2(password, password, 2000, 32, \"sha256\")).slice(0, 16);\n const iv = encseed.slice(0, 16);\n const encryptedSeed = encseed.slice(16);\n // Decrypt the seed\n const aesCbc = new CBC(key, iv);\n const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed)));\n // This wallet format is weird... Convert the binary encoded hex to a string.\n let seedHex = \"\";\n for (let i = 0; i < seed.length; i++) {\n seedHex += String.fromCharCode(seed[i]);\n }\n return { address, privateKey: id(seedHex) };\n}\n//# sourceMappingURL=json-crowdsale.js.map","import { SigningKey } from \"../crypto/index.js\";\nimport { assertArgument } from \"../utils/index.js\";\nimport { BaseWallet } from \"./base-wallet.js\";\nimport { defaultPath, HDNodeWallet } from \"./hdwallet.js\";\nimport { decryptCrowdsaleJson, isCrowdsaleJson } from \"./json-crowdsale.js\";\nimport { decryptKeystoreJson, decryptKeystoreJsonSync, encryptKeystoreJson, encryptKeystoreJsonSync, isKeystoreJson, } from \"./json-keystore.js\";\nimport { Mnemonic } from \"./mnemonic.js\";\nimport { extractPrefix } from \"../transaction/address.js\";\nfunction stall(duration) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve();\n }, duration);\n });\n}\n/**\n * A **Wallet** manages a single private key which is used to sign\n * transactions, messages and other common payloads.\n *\n * This class is generally the main entry point for developers\n * that wish to use a private key directly, as it can create\n * instances from a large variety of common sources, including\n * raw private key, [[link-bip-39]] mnemonics and encrypte JSON\n * wallets.\n */\nexport class Wallet extends BaseWallet {\n /**\n * Create a new wallet for the %%privateKey%% or %%signingKey%%, optionally connected\n * to %%provider%%.\n */\n constructor({ key, prefix, provider, }) {\n if (typeof key === \"string\" && !key.startsWith(\"0x\")) {\n key = \"0x\" + key;\n }\n let signingKey = typeof key === \"string\" ? new SigningKey(key) : key;\n super({\n signingKey,\n prefix,\n provider,\n });\n }\n connect(provider) {\n return new Wallet({\n key: this.signingKey,\n prefix: this.prefix,\n provider,\n });\n }\n /**\n * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with\n * %%password%%.\n *\n * If %%progressCallback%% is specified, it will receive periodic\n * updates as the encryption process progreses.\n */\n async encrypt(password, progressCallback) {\n const account = { address: this.address, privateKey: this.privateKey };\n return await encryptKeystoreJson(account, password, { progressCallback });\n }\n /**\n * Returns a [JSON Keystore Wallet](json-wallets) encryped with\n * %%password%%.\n *\n * It is preferred to use the [async version](encrypt) instead,\n * which allows a [[ProgressCallback]] to keep the user informed.\n *\n * This method will block the event loop (freezing all UI) until\n * it is complete, which may be a non-trivial duration.\n */\n encryptSync(password) {\n const account = { address: this.address, privateKey: this.privateKey };\n return encryptKeystoreJsonSync(account, password);\n }\n static #fromAccount(account) {\n assertArgument(account, \"invalid JSON wallet\", \"json\", \"[ REDACTED ]\");\n const address = account.address;\n const prefix = extractPrefix(address);\n if (\"mnemonic\" in account &&\n account.mnemonic &&\n account.mnemonic.locale === \"en\") {\n const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy);\n const wallet = HDNodeWallet.fromMnemonic(mnemonic, prefix, account.mnemonic.path);\n if (wallet.address === account.address &&\n wallet.privateKey === account.privateKey) {\n return wallet;\n }\n console.log(\"WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key\");\n }\n const wallet = new Wallet({\n key: account.privateKey,\n prefix,\n });\n assertArgument(wallet.address === account.address, \"address/privateKey mismatch\", \"json\", \"[ REDACTED ]\");\n return wallet;\n }\n /**\n * Creates (asynchronously) a **Wallet** by decrypting the %%json%%\n * with %%password%%.\n *\n * If %%progress%% is provided, it is called periodically during\n * decryption so that any UI can be updated.\n */\n static async fromEncryptedJson(json, password, progress) {\n let account = null;\n if (isKeystoreJson(json)) {\n account = await decryptKeystoreJson(json, password, progress);\n }\n else if (isCrowdsaleJson(json)) {\n if (progress) {\n progress(0);\n await stall(0);\n }\n account = decryptCrowdsaleJson(json, password);\n if (progress) {\n progress(1);\n await stall(0);\n }\n }\n return Wallet.#fromAccount(account);\n }\n /**\n * Creates a **Wallet** by decrypting the %%json%% with %%password%%.\n *\n * The [[fromEncryptedJson]] method is preferred, as this method\n * will lock up and freeze the UI during decryption, which may take\n * some time.\n */\n static fromEncryptedJsonSync(json, password) {\n let account = null;\n if (isKeystoreJson(json)) {\n account = decryptKeystoreJsonSync(json, password);\n }\n else if (isCrowdsaleJson(json)) {\n account = decryptCrowdsaleJson(json, password);\n }\n else {\n assertArgument(false, \"invalid JSON wallet\", \"json\", \"[ REDACTED ]\");\n }\n return Wallet.#fromAccount(account);\n }\n /**\n * Creates a new random [[HDNodeWallet]] using the avavilable\n * [cryptographic random source](randomBytes).\n *\n * If there is no crytographic random source, this will throw.\n */\n static createRandom(prefix, provider) {\n const wallet = HDNodeWallet.createRandom(prefix, undefined, undefined, undefined);\n if (provider) {\n return wallet.connect(provider);\n }\n return wallet;\n }\n /**\n * Creates a [[HDNodeWallet]] for %%phrase%%.\n */\n static fromPhrase({ phrase, prefix, provider, password, }) {\n const wallet = HDNodeWallet.fromPhrase({\n phrase,\n prefix,\n password,\n });\n if (provider) {\n return wallet.connect(provider);\n }\n return wallet;\n }\n static fromSeed({ seed, prefix, provider, path, }) {\n const wallet = HDNodeWallet.fromSeed({\n seed,\n prefix,\n path: path || defaultPath,\n });\n if (provider) {\n return wallet.connect(provider);\n }\n return wallet;\n }\n}\n//# sourceMappingURL=wallet.js.map","const Base64 = \")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_\";\n/**\n * @_ignore\n */\nexport function decodeBits(width, data) {\n const maxValue = (1 << width) - 1;\n const result = [];\n let accum = 0, bits = 0, flood = 0;\n for (let i = 0; i < data.length; i++) {\n // Accumulate 6 bits of data\n accum = (accum << 6) | Base64.indexOf(data[i]);\n bits += 6;\n // While we have enough for a word...\n while (bits >= width) {\n // ...read the word\n const value = accum >> (bits - width);\n accum &= (1 << (bits - width)) - 1;\n bits -= width;\n // A value of 0 indicates we exceeded maxValue, it\n // floods over into the next value\n if (value === 0) {\n flood += maxValue;\n }\n else {\n result.push(value + flood);\n flood = 0;\n }\n }\n }\n return result;\n}\n//# sourceMappingURL=bit-reader.js.map","import { assertArgument } from \"../utils/index.js\";\nimport { decodeBits } from \"./bit-reader.js\";\nimport { decodeOwl } from \"./decode-owl.js\";\n/**\n * @_ignore\n */\nexport function decodeOwlA(data, accents) {\n let words = decodeOwl(data).join(\",\");\n // Inject the accents\n accents.split(/,/g).forEach((accent) => {\n const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);\n assertArgument(match !== null, \"internal error parsing accents\", \"accents\", accents);\n let posOffset = 0;\n const positions = decodeBits(parseInt(match[3]), match[4]);\n const charCode = parseInt(match[2]);\n const regex = new RegExp(`([${match[1]}])`, \"g\");\n words = words.replace(regex, (all, letter) => {\n const rem = --positions[posOffset];\n if (rem === 0) {\n letter = String.fromCharCode(letter.charCodeAt(0), charCode);\n posOffset++;\n }\n return letter;\n });\n });\n return words.split(\",\");\n}\n//# sourceMappingURL=decode-owla.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nimport { decodeOwlA } from \"./decode-owla.js\";\n/**\n * An OWL-A format Wordlist extends the OWL format to add an\n * overlay onto an OWL format Wordlist to support diacritic\n * marks.\n *\n * This class is generally not useful to most developers as\n * it is used mainly internally to keep Wordlists for languages\n * based on latin-1 small.\n *\n * If necessary, there are tools within the ``generation/`` folder\n * to create these necessary data.\n */\nexport class WordlistOwlA extends WordlistOwl {\n #accent;\n constructor(locale, data, accent, checksum) {\n super(locale, data, checksum);\n this.#accent = accent;\n }\n get _accent() {\n return this.#accent;\n }\n _decodeWords() {\n return decodeOwlA(this._data, this._accent);\n }\n}\n//# sourceMappingURL=wordlist-owla.js.map","import { LangEn } from \"./lang-en.js\";\nexport const wordlists = {\n en: LangEn.wordlist(),\n};\n//# sourceMappingURL=wordlists-browser.js.map"],"names":["logger","stringify","arrayifyInteger","unarrayifyInteger","_encode","_decodeChildren","_decode","decode","hash","assertHash","assertExists","assertBytes","assertNumber","pbkdf2","sha256","u64","sha512","BN_0","BN_1","locked","getTime","_a","_guard","getGlobal","randomBytes","Buffer","removeHexPrefix","rotl","ripemd160","noble_ripemd160","crypto_random","scrypt","_nobleAsync","_nobleSync","H","N","secp256k1.getSharedSecret","secp256k1.ProjectivePoint","BN_2","passProperties","getValue","BN_MAX_UINT256","RLP.decode","RLP.encode","_sha256","internal","PanicReasons","copy","stall","defaultApiKey","getHost","defaultPath"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,11,12,13,14,15,33,37,40]} \ No newline at end of file diff --git a/dist/corebc.umd.min.js b/dist/corebc.umd.min.js deleted file mode 100644 index fd906cc57..000000000 --- a/dist/corebc.umd.min.js +++ /dev/null @@ -1 +0,0 @@ -const __$G=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports,require("buffer"),require("bcrypto/lib/ed448-browser.js"),require("bn.js"),require("bcrypto/lib/pbkdf2-browser.js"),require("bcrypto/lib/sha3-512.js"),require("utf8"),require("aes-js")):typeof define==="function"&&define.amd?define(["exports","buffer","bcrypto/lib/ed448-browser.js","bn.js","bcrypto/lib/pbkdf2-browser.js","bcrypto/lib/sha3-512.js","utf8","aes-js"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,factory(global.corebc={},global.buffer,global.ed448,global._BN,global.pbkdf2$2,global.SHA3_512,global.utf8,global.pkg))})(this,function(exports,buffer,ed448,_BN,pbkdf2$2,SHA3_512,utf8,pkg){"use strict";const version="6.4.0";let _permanentCensorErrors=false;let _censorErrors=false;const LogLevels={debug:1,default:2,info:2,warning:3,error:4,off:5};let _logLevel=LogLevels["default"];let _globalLogger=null;function _checkNormalize(){try{const missing=[];["NFD","NFC","NFKD","NFKC"].forEach(form=>{try{if("test".normalize(form)!=="test"){throw new Error("bad normalize")}}catch(error){missing.push(form)}});if(missing.length){throw new Error("missing "+missing.join(", "))}if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769)){throw new Error("broken implementation")}}catch(error){return error.message}return null}const _normalizeError=_checkNormalize();var LogLevel;(function(LogLevel){LogLevel["DEBUG"]="DEBUG";LogLevel["INFO"]="INFO";LogLevel["WARNING"]="WARNING";LogLevel["ERROR"]="ERROR";LogLevel["OFF"]="OFF"})(LogLevel||(LogLevel={}));var ErrorCode;(function(ErrorCode){ErrorCode["UNKNOWN_ERROR"]="UNKNOWN_ERROR";ErrorCode["NOT_IMPLEMENTED"]="NOT_IMPLEMENTED";ErrorCode["UNSUPPORTED_OPERATION"]="UNSUPPORTED_OPERATION";ErrorCode["NETWORK_ERROR"]="NETWORK_ERROR";ErrorCode["SERVER_ERROR"]="SERVER_ERROR";ErrorCode["TIMEOUT"]="TIMEOUT";ErrorCode["BUFFER_OVERRUN"]="BUFFER_OVERRUN";ErrorCode["NUMERIC_FAULT"]="NUMERIC_FAULT";ErrorCode["MISSING_NEW"]="MISSING_NEW";ErrorCode["INVALID_ARGUMENT"]="INVALID_ARGUMENT";ErrorCode["MISSING_ARGUMENT"]="MISSING_ARGUMENT";ErrorCode["UNEXPECTED_ARGUMENT"]="UNEXPECTED_ARGUMENT";ErrorCode["CALL_EXCEPTION"]="CALL_EXCEPTION";ErrorCode["INSUFFICIENT_FUNDS"]="INSUFFICIENT_FUNDS";ErrorCode["NONCE_EXPIRED"]="NONCE_EXPIRED";ErrorCode["REPLACEMENT_UNDERPRICED"]="REPLACEMENT_UNDERPRICED";ErrorCode["UNPREDICTABLE_ENERGY_LIMIT"]="UNPREDICTABLE_ENERGY_LIMIT";ErrorCode["TRANSACTION_REPLACED"]="TRANSACTION_REPLACED"})(ErrorCode||(ErrorCode={}));const HEX="0123456789abcdef";class Logger{version="0.0.1";static errors=ErrorCode;static levels=LogLevel;constructor(version){Object.defineProperty(this,"version",{enumerable:true,value:version,writable:false})}_log(logLevel,args){const level=logLevel.toLowerCase();if(LogLevels[level]==null){this.throwArgumentError("invalid log level name","logLevel",logLevel)}if(_logLevel>LogLevels[level]){return}console.log.apply(console,args)}debug(...args){this._log(Logger.levels.DEBUG,args)}info(...args){this._log(Logger.levels.INFO,args)}warn(...args){this._log(Logger.levels.WARNING,args)}makeError(message,code,params){if(_censorErrors){return this.makeError("censored error",code,{})}if(!code){code=Logger.errors.UNKNOWN_ERROR}if(!params){params={}}const messageDetails=[];Object.keys(params).forEach(key=>{const value=params[key];try{if(value instanceof Uint8Array){let hex="";for(let i=0;i>4];hex+=HEX[value[i]&15]}messageDetails.push(key+"=Uint8Array(0x"+hex+")")}else{messageDetails.push(key+"="+JSON.stringify(value))}}catch(error){messageDetails.push(key+"="+JSON.stringify(params[key].toString()))}});messageDetails.push(`code=${code}`);messageDetails.push(`version=${this.version}`);const reason=message;if(messageDetails.length){message+=" ("+messageDetails.join(", ")+")"}const error=new Error(message);error.reason=reason;error.code=code;Object.keys(params).forEach(function(key){error[key]=params[key]});return error}throwError(message,code,params){throw this.makeError(message,code,params)}throwArgumentError(message,name,value){return this.throwError(message,Logger.errors.INVALID_ARGUMENT,{argument:name,value:value})}assert(condition,message,code,params){if(!!condition){return}this.throwError(message,code,params)}assertArgument(condition,message,name,value){if(!!condition){return}this.throwArgumentError(message,name,value)}checkNormalize(message){if(_normalizeError){this.throwError("platform missing String.prototype.normalize",Logger.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_normalizeError})}}checkSafeUint53(value,message){if(typeof value!=="number"){return}if(message==null){message="value not safe"}if(value<0||value>=9007199254740991){this.throwError(message,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:value})}if(value%1){this.throwError(message,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:value})}}checkArgumentCount(count,expectedCount,message){if(message){message=": "+message}else{message=""}if(countexpectedCount){this.throwError("too many arguments"+message,Logger.errors.UNEXPECTED_ARGUMENT,{count:count,expectedCount:expectedCount})}}checkNew(target,kind){if(target===Object||target==null){this.throwError("missing new",Logger.errors.MISSING_NEW,{name:kind.name})}}checkAbstract(target,kind){if(target===kind){this.throwError("cannot instantiate abstract class "+JSON.stringify(kind.name)+" directly; use a sub-class",Logger.errors.UNSUPPORTED_OPERATION,{name:target.name,operation:"new"})}else if(target===Object||target==null){this.throwError("missing new",Logger.errors.MISSING_NEW,{name:kind.name})}}static globalLogger(){if(!_globalLogger){_globalLogger=new Logger("logger/0.0.1")}return _globalLogger}static setCensorship(censorship,permanent){if(!censorship&&permanent){this.globalLogger().throwError("cannot permanently disable censorship",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}if(_permanentCensorErrors){if(!censorship){return}this.globalLogger().throwError("error censorship permanent",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_censorErrors=!!censorship;_permanentCensorErrors=!!permanent}static setLogLevel(logLevel){const level=LogLevels[logLevel.toLowerCase()];if(level==null){Logger.globalLogger().warn("invalid log level - "+logLevel);return}_logLevel=level}static from(version){return new Logger(version)}}const logger$7=new Logger("utils/properties/0.0.1");function checkType(value,type,name){const types=type.split("|").map(t=>t.trim());for(let i=0;iPromise.resolve(value[k])));return results.reduce((accum,v,index)=>{accum[keys[index]]=v;return accum},{})}function defineProperties(target,values,types){for(let key in values){let value=values[key];const type=types?types[key]:null;if(type){checkType(value,type,key)}Object.defineProperty(target,key,{enumerable:true,value:value,writable:false})}}function checkProperties(object,properties){if(!object||typeof object!=="object"){logger$7.throwArgumentError("invalid object","object",object)}Object.keys(object).forEach(key=>{if(!properties[key]){logger$7.throwArgumentError("invalid object key - "+key,"transaction:"+key,object)}})}function stringify$1(value){if(value==null){return"null"}if(Array.isArray(value)){return"[ "+value.map(stringify$1).join(", ")+" ]"}if(value instanceof Uint8Array){const HEX="0123456789abcdef";let result="0x";for(let i=0;i>4];result+=HEX[value[i]&15]}return result}if(typeof value==="object"&&typeof value.toJSON==="function"){return stringify$1(value.toJSON())}switch(typeof value){case"boolean":case"symbol":return value.toString();case"bigint":return BigInt(value).toString();case"number":return value.toString();case"string":return JSON.stringify(value);case"object":{const keys=Object.keys(value);keys.sort();return"{ "+keys.map(k=>`${stringify$1(k)}: ${stringify$1(value[k])}`).join(", ")+" }"}}return`[ COULD NOT SERIALIZE ]`}function isError(error,code){return error&&error.code===code}function isCallException(error){return isError(error,"CALL_EXCEPTION")}function makeError(message,code,info){{const details=[];if(info){if("message"in info||"code"in info||"name"in info){throw new Error(`value will overwrite populated values: ${stringify$1(info)}`)}for(const key in info){const value=info[key];details.push(key+"="+stringify$1(value))}}details.push(`code=${code}`);details.push(`version=${version}`);if(details.length){message+=" ("+details.join(", ")+")"}}let error;switch(code){case"INVALID_ARGUMENT":error=new TypeError(message);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":error=new RangeError(message);break;default:error=new Error(message)}defineProperties(error,{code:code});if(info){Object.assign(error,info)}return error}function assert(check,message,code,info){if(!check){throw makeError(message,code,info)}}function assertArgument(check,message,name,value){assert(check,message,"INVALID_ARGUMENT",{argument:name,value:value})}function assertArgumentCount(count,expectedCount,message){if(message==null){message=""}if(message){message=": "+message}assert(count>=expectedCount,"missing arguemnt"+message,"MISSING_ARGUMENT",{count:count,expectedCount:expectedCount});assert(count<=expectedCount,"too many arguemnts"+message,"UNEXPECTED_ARGUMENT",{count:count,expectedCount:expectedCount})}const _normalizeForms=["NFD","NFC","NFKD","NFKC"].reduce((accum,form)=>{try{if("test".normalize(form)!=="test"){throw new Error("bad")}if(form==="NFD"){const check=String.fromCharCode(233).normalize("NFD");const expected=String.fromCharCode(101,769);if(check!==expected){throw new Error("broken")}}accum.push(form)}catch(error){}return accum},[]);function assertNormalize(form){assert(_normalizeForms.indexOf(form)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:form}})}function assertPrivate(givenGuard,guard,className){if(className==null){className=""}if(givenGuard!==guard){let method=className,operation="new";if(className){method+=".";operation+=" "+className}assert(false,`private constructor; use ${method}from* methods`,"UNSUPPORTED_OPERATION",{operation:operation})}}const logger$6=new Logger("utils/data/0.0.1");function isHexable(value){return!!value.toHexString}function isInteger(value){return typeof value==="number"&&value==value&&value%1===0}function isBytes(value){if(value==null){return false}if(value.constructor===Uint8Array){return true}if(typeof value==="string"){return false}if(!isInteger(value.length)||value.length<0){return false}for(let i=0;i=256){return false}}return true}function _getBytes(value,name,copy){if(value instanceof Uint8Array){if(copy){return new Uint8Array(value)}return value}if(typeof value==="string"&&value.match(/^0x([0-9a-f][0-9a-f])*$/i)){const result=new Uint8Array((value.length-2)/2);let offset=2;for(let i=0;iNumber(item));value=new Uint8Array(v)}}if(typeof value==="number"){logger$6.checkSafeUint53(value,"invalid hexlify value");let hex="";while(value){hex=HexCharacters[value&15]+hex;value=Math.floor(value/16)}if(hex.length){if(hex.length%2){hex="0"+hex}return"0x"+hex}return"0x00"}if(typeof value==="bigint"){value=value.toString(16);if(value.length%2){return"0x0"+value}return"0x"+value}if(options.allowMissingPrefix&&typeof value==="string"&&value.substring(0,2)!=="0x"){value="0x"+value}if(isHexable(value)){return value.toHexString()}if(isHexString(value)){if(value.length%2){if(options.hexPad==="left"){value="0x0"+value.substring(2)}else if(options.hexPad==="right"){value+="0"}else{logger$6.throwArgumentError("hex data is odd-length","value",value)}}return value.toLowerCase()}if(isBytes(value)){let result="0x";for(let i=0;i>4]+HexCharacters[v&15]}return result}return logger$6.throwArgumentError("invalid hexlify value","value",value)}function concat(items){return"0x"+items.map(d=>hexlify(d).substring(2)).join("")}function hexDataSlice(data,offset,endOffset){if(typeof data!=="string"){data=hexlify(data)}else if(!isHexString(data)||data.length%2){logger$6.throwArgumentError("invalid hexData","value",data)}offset=2+2*offset;if(endOffset!=null){return"0x"+data.substring(offset,2+2*endOffset)}return"0x"+data.substring(offset)}function hexDataLength(data){if(typeof data!=="string"){data=hexlify(data)}else if(!isHexString(data)||data.length%2){return null}return(data.length-2)/2}function dataLength(data){if(isHexString(data,true)){return(data.length-2)/2}return getBytes(data).length}function dataSlice(data,start,end){const bytes=getBytes(data);if(end!=null&&end>bytes.length){assert(false,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:bytes,length:bytes.length,offset:end})}return hexlify(bytes.slice(start==null?0:start,end==null?bytes.length:end))}function stripZerosLeft(data){let bytes=hexlify(data).substring(2);while(bytes.startsWith("00")){bytes=bytes.substring(2)}return"0x"+bytes}function zeroPad(data,length,left){const bytes=getBytes(data);assert(length>=bytes.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(bytes),length:length,offset:length+1});const result=new Uint8Array(length);result.fill(0);if(left){result.set(bytes,length-bytes.length)}else{result.set(bytes,0)}return hexlify(result)}function zeroPadValue(data,length){return zeroPad(data,length,true)}function zeroPadBytes(data,length){return zeroPad(data,length,false)}function stripZeros(value){let result=arrayify(value);if(result.length===0){return result}let start=0;while(start{result+=hexlify(item).substring(2)});return result}var BN=_BN.BN;const logger$5=new Logger("bigNumber/0.0.1");const _constructorGuard={};const MAX_SAFE=9007199254740991;let _warnedToStringRadix=false;class BigNumber{_hex;_isBigNumber;constructor(constructorGuard,hex){logger$5.checkNew(new.target,BigNumber);if(constructorGuard!==_constructorGuard){logger$5.throwError("cannot call constructor directly; use BigNumber.from",Logger.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"})}this._hex=hex;this._isBigNumber=true;Object.freeze(this)}fromTwos(value){return toBigNumber(toBN(this).fromTwos(value))}toTwos(value){return toBigNumber(toBN(this).toTwos(value))}abs(){if(this._hex[0]==="-"){return BigNumber.from(this._hex.substring(1))}return this}add(other){return toBigNumber(toBN(this).add(toBN(other)))}sub(other){return toBigNumber(toBN(this).sub(toBN(other)))}div(other){const o=BigNumber.from(other);if(o.isZero()){throwFault("division by zero","div")}return toBigNumber(toBN(this).div(toBN(other)))}mul(other){return toBigNumber(toBN(this).mul(toBN(other)))}mod(other){const value=toBN(other);if(value.isNeg()){throwFault("cannot modulo negative values","mod")}return toBigNumber(toBN(this).umod(value))}pow(other){const value=toBN(other);if(value.isNeg()){throwFault("cannot raise to negative values","pow")}return toBigNumber(toBN(this).pow(value))}and(other){const value=toBN(other);if(this.isNegative()||value.isNeg()){throwFault("cannot 'and' negative values","and")}return toBigNumber(toBN(this).and(value))}or(other){const value=toBN(other);if(this.isNegative()||value.isNeg()){throwFault("cannot 'or' negative values","or")}return toBigNumber(toBN(this).or(value))}xor(other){const value=toBN(other);if(this.isNegative()||value.isNeg()){throwFault("cannot 'xor' negative values","xor")}return toBigNumber(toBN(this).xor(value))}mask(value){if(this.isNegative()||value<0){throwFault("cannot mask negative values","mask")}return toBigNumber(toBN(this).maskn(value))}shl(value){if(this.isNegative()||value<0){throwFault("cannot shift negative values","shl")}return toBigNumber(toBN(this).shln(value))}shr(value){if(this.isNegative()||value<0){throwFault("cannot shift negative values","shr")}return toBigNumber(toBN(this).shrn(value))}eq(other){return toBN(this).eq(toBN(other))}lt(other){return toBN(this).lt(toBN(other))}lte(other){return toBN(this).lte(toBN(other))}gt(other){return toBN(this).gt(toBN(other))}gte(other){return toBN(this).gte(toBN(other))}isNegative(){return this._hex[0]==="-"}isZero(){return toBN(this).isZero()}toNumber(){try{return toBN(this).toNumber()}catch(error){throwFault("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return logger$5.throwError("this platform does not support BigInt",Logger.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){if(arguments.length>0){if(arguments[0]===10){if(!_warnedToStringRadix){_warnedToStringRadix=true;logger$5.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")}}else if(arguments[0]===16){logger$5.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Logger.errors.UNEXPECTED_ARGUMENT,{})}else{logger$5.throwError("BigNumber.toString does not accept parameters",Logger.errors.UNEXPECTED_ARGUMENT,{})}}return toBN(this).toString(10)}toHexString(){return this._hex}toJSON(key){return{type:"BigNumber",hex:this.toHexString()}}static from(value){if(value instanceof BigNumber){return value}if(typeof value==="string"){if(value.match(/^-?0x[0-9a-f]+$/i)){return new BigNumber(_constructorGuard,toHex(value))}if(value.match(/^-?[0-9]+$/)){return new BigNumber(_constructorGuard,toHex(new BN(value)))}return logger$5.throwArgumentError("invalid BigNumber string","value",value)}if(typeof value==="number"){if(value%1){throwFault("underflow","BigNumber.from",value)}if(value>=MAX_SAFE||value<=-MAX_SAFE){throwFault("overflow","BigNumber.from",value)}return BigNumber.from(String(value))}const anyValue=value;if(typeof anyValue==="bigint"){return BigNumber.from(anyValue.toString())}if(isBytes(anyValue)){return BigNumber.from(hexlify(anyValue))}if(anyValue){if(anyValue.toHexString){const hex=anyValue.toHexString();if(typeof hex==="string"){return BigNumber.from(hex)}}else{let hex=anyValue._hex;if(hex==null&&anyValue.type==="BigNumber"){hex=anyValue.hex}if(typeof hex==="string"){if(isHexString(hex)||hex[0]==="-"&&isHexString(hex.substring(1))){return BigNumber.from(hex)}}}}return logger$5.throwArgumentError("invalid BigNumber value","value",value)}static isBigNumber(value){return!!(value&&value._isBigNumber)}}function toHex(value){if(typeof value!=="string"){return toHex(value.toString(16))}if(value[0]==="-"){value=value.substring(1);if(value[0]==="-"){logger$5.throwArgumentError("invalid hex","value",value)}value=toHex(value);if(value==="0x00"){return value}return"-"+value}if(value.substring(0,2)!=="0x"){value="0x"+value}if(value==="0x"){return"0x00"}if(value.length%2){value="0x0"+value.substring(2)}while(value.length>4&&value.substring(0,4)==="0x00"){value="0x"+value.substring(4)}return value}function toBigNumber(value){return BigNumber.from(toHex(value))}function toBN(value){const hex=BigNumber.from(value).toHexString();if(hex[0]==="-"){return new BN("-"+hex.substring(3),16)}return new BN(hex.substring(2),16)}function throwFault(fault,operation,value){const params={fault:fault,operation:operation};if(value!=null){params.value=value}return logger$5.throwError(fault,Logger.errors.NUMERIC_FAULT,params)}const logger$4=new Logger("rlp/0.0.1");function arrayifyInteger$1(value){const result=[];while(value){result.unshift(value&255);value>>=8}return result}function unarrayifyInteger$1(data,offset,length){let result=0;for(let i=0;ioffset+1+length){logger$4.throwError("child data too short",Logger.errors.BUFFER_OVERRUN,{})}}return{consumed:1+length,result:result}}function _decode$1(data,offset){if(data.length===0){logger$4.throwError("data too short",Logger.errors.BUFFER_OVERRUN,{})}if(data[offset]>=248){const lengthLength=data[offset]-247;if(offset+1+lengthLength>data.length){logger$4.throwError("data short segment too short",Logger.errors.BUFFER_OVERRUN,{})}const length=unarrayifyInteger$1(data,offset+1,lengthLength);if(offset+1+lengthLength+length>data.length){logger$4.throwError("data long segment too short",Logger.errors.BUFFER_OVERRUN,{})}return _decodeChildren$1(data,offset,offset+1+lengthLength,lengthLength+length)}else if(data[offset]>=192){const length=data[offset]-192;if(offset+1+length>data.length){logger$4.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{})}return _decodeChildren$1(data,offset,offset+1,length)}else if(data[offset]>=184){const lengthLength=data[offset]-183;if(offset+1+lengthLength>data.length){logger$4.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{})}const length=unarrayifyInteger$1(data,offset+1,lengthLength);if(offset+1+lengthLength+length>data.length){logger$4.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{})}const result=hexlify(data.slice(offset+1+lengthLength,offset+1+lengthLength+length));return{consumed:1+lengthLength+length,result:result}}else if(data[offset]>=128){const length=data[offset]-128;if(offset+1+length>data.length){logger$4.throwError("data too short",Logger.errors.BUFFER_OVERRUN,{})}const result=hexlify(data.slice(offset+1,offset+1+length));return{consumed:1+length,result:result}}return{consumed:1,result:hexlify(data[offset])}}function decode$1(data){const bytes=arrayify(data);const decoded=_decode$1(bytes,0);if(decoded.consumed!==bytes.length){logger$4.throwArgumentError("invalid rlp data","data",data)}return decoded.result}function number(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function bytes(b,...lengths){if(!(b instanceof Uint8Array))throw new Error("Expected Uint8Array");if(lengths.length>0&&!lengths.includes(b.length))throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`)}function hash(hash){if(typeof hash!=="function"||typeof hash.create!=="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number(hash.outputLen);number(hash.blockLen)}function exists(instance,checkFinished=true){if(instance.destroyed)throw new Error("Hash instance has been destroyed");if(checkFinished&&instance.finished)throw new Error("Hash#digest() has already been called")}function output(out,instance){bytes(out);const min=instance.outputLen;if(out.lengtha instanceof Uint8Array;const u32=arr=>new Uint32Array(arr.buffer,arr.byteOffset,Math.floor(arr.byteLength/4));const createView=arr=>new DataView(arr.buffer,arr.byteOffset,arr.byteLength);const rotr=(word,shift)=>word<<32-shift|word>>>shift;const isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");const nextTick=async()=>{};async function asyncLoop(iters,tick,cb){let ts=Date.now();for(let i=0;i=0&&diffhashCons().update(toBytes(msg)).digest();const tmp=hashCons();hashC.outputLen=tmp.outputLen;hashC.blockLen=tmp.blockLen;hashC.create=()=>hashCons();return hashC}class HMAC extends Hash{constructor(hash$1,_key){super();this.finished=false;this.destroyed=false;hash(hash$1);const key=toBytes(_key);this.iHash=hash$1.create();if(typeof this.iHash.update!=="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen;this.outputLen=this.iHash.outputLen;const blockLen=this.blockLen;const pad=new Uint8Array(blockLen);pad.set(key.length>blockLen?hash$1.create().update(key).digest():key);for(let i=0;inew HMAC(hash,key).update(message).digest();hmac.create=(hash,key)=>new HMAC(hash,key);function pbkdf2Init(hash$1,_password,_salt,_opts){hash(hash$1);const opts=checkOpts({dkLen:32,asyncTick:10},_opts);const{c,dkLen,asyncTick}=opts;number(c);number(dkLen);number(asyncTick);if(c<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const password=toBytes(_password);const salt=toBytes(_salt);const DK=new Uint8Array(dkLen);const PRF=hmac.create(hash$1,password);const PRFSalt=PRF._cloneInto().update(salt);return{c:c,dkLen:dkLen,asyncTick:asyncTick,DK:DK,PRF:PRF,PRFSalt:PRFSalt}}function pbkdf2Output(PRF,PRFSalt,DK,prfW,u){PRF.destroy();PRFSalt.destroy();if(prfW)prfW.destroy();u.fill(0);return DK}function pbkdf2$1(hash,password,salt,opts){const{c,dkLen,DK,PRF,PRFSalt}=pbkdf2Init(hash,password,salt,opts);let prfW;const arr=new Uint8Array(4);const view=createView(arr);const u=new Uint8Array(PRF.outputLen);for(let ti=1,pos=0;pos>_32n&_u32_max);const wl=Number(value&_u32_max);const h=isLE?4:0;const l=isLE?0:4;view.setUint32(byteOffset+h,wh,isLE);view.setUint32(byteOffset+l,wl,isLE)}class SHA2 extends Hash{constructor(blockLen,outputLen,padOffset,isLE){super();this.blockLen=blockLen;this.outputLen=outputLen;this.padOffset=padOffset;this.isLE=isLE;this.finished=false;this.length=0;this.pos=0;this.destroyed=false;this.buffer=new Uint8Array(blockLen);this.view=createView(this.buffer)}update(data){exists(this);const{view,buffer,blockLen}=this;data=toBytes(data);const len=data.length;for(let pos=0;posblockLen-pos){this.process(view,0);pos=0}for(let i=pos;istate.length)throw new Error("_sha2: outputLen bigger than state");for(let i=0;ia&b^~a&c;const Maj=(a,b,c)=>a&b^a&c^b&c;const SHA256_K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);const IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);const SHA256_W=new Uint32Array(64);class SHA256 extends SHA2{constructor(){super(64,32,8,false);this.A=IV[0]|0;this.B=IV[1]|0;this.C=IV[2]|0;this.D=IV[3]|0;this.E=IV[4]|0;this.F=IV[5]|0;this.G=IV[6]|0;this.H=IV[7]|0}get(){const{A,B,C,D,E,F,G,H}=this;return[A,B,C,D,E,F,G,H]}set(A,B,C,D,E,F,G,H){this.A=A|0;this.B=B|0;this.C=C|0;this.D=D|0;this.E=E|0;this.F=F|0;this.G=G|0;this.H=H|0}process(view,offset){for(let i=0;i<16;i++,offset+=4)SHA256_W[i]=view.getUint32(offset,false);for(let i=16;i<64;i++){const W15=SHA256_W[i-15];const W2=SHA256_W[i-2];const s0=rotr(W15,7)^rotr(W15,18)^W15>>>3;const s1=rotr(W2,17)^rotr(W2,19)^W2>>>10;SHA256_W[i]=s1+SHA256_W[i-7]+s0+SHA256_W[i-16]|0}let{A,B,C,D,E,F,G,H}=this;for(let i=0;i<64;i++){const sigma1=rotr(E,6)^rotr(E,11)^rotr(E,25);const T1=H+sigma1+Chi(E,F,G)+SHA256_K[i]+SHA256_W[i]|0;const sigma0=rotr(A,2)^rotr(A,13)^rotr(A,22);const T2=sigma0+Maj(A,B,C)|0;H=G;G=F;F=E;E=D+T1|0;D=C;C=B;B=A;A=T1+T2|0}A=A+this.A|0;B=B+this.B|0;C=C+this.C|0;D=D+this.D|0;E=E+this.E|0;F=F+this.F|0;G=G+this.G|0;H=H+this.H|0;this.set(A,B,C,D,E,F,G,H)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0);this.buffer.fill(0)}}const sha256$1=wrapConstructor(()=>new SHA256);const U32_MASK64=BigInt(2**32-1);const _32n=BigInt(32);function fromBig(n,le=false){if(le)return{h:Number(n&U32_MASK64),l:Number(n>>_32n&U32_MASK64)};return{h:Number(n>>_32n&U32_MASK64)|0,l:Number(n&U32_MASK64)|0}}function split(lst,le=false){let Ah=new Uint32Array(lst.length);let Al=new Uint32Array(lst.length);for(let i=0;iBigInt(h>>>0)<<_32n|BigInt(l>>>0);const shrSH=(h,_l,s)=>h>>>s;const shrSL=(h,l,s)=>h<<32-s|l>>>s;const rotrSH=(h,l,s)=>h>>>s|l<<32-s;const rotrSL=(h,l,s)=>h<<32-s|l>>>s;const rotrBH=(h,l,s)=>h<<64-s|l>>>s-32;const rotrBL=(h,l,s)=>h>>>s-32|l<<64-s;const rotr32H=(_h,l)=>l;const rotr32L=(h,_l)=>h;const rotlSH=(h,l,s)=>h<>>32-s;const rotlSL=(h,l,s)=>l<>>32-s;const rotlBH=(h,l,s)=>l<>>64-s;const rotlBL=(h,l,s)=>h<>>64-s;function add(Ah,Al,Bh,Bl){const l=(Al>>>0)+(Bl>>>0);return{h:Ah+Bh+(l/2**32|0)|0,l:l|0}}const add3L=(Al,Bl,Cl)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0);const add3H=(low,Ah,Bh,Ch)=>Ah+Bh+Ch+(low/2**32|0)|0;const add4L=(Al,Bl,Cl,Dl)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0)+(Dl>>>0);const add4H=(low,Ah,Bh,Ch,Dh)=>Ah+Bh+Ch+Dh+(low/2**32|0)|0;const add5L=(Al,Bl,Cl,Dl,El)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0)+(Dl>>>0)+(El>>>0);const add5H=(low,Ah,Bh,Ch,Dh,Eh)=>Ah+Bh+Ch+Dh+Eh+(low/2**32|0)|0;const u64={fromBig:fromBig,split:split,toBig:toBig,shrSH:shrSH,shrSL:shrSL,rotrSH:rotrSH,rotrSL:rotrSL,rotrBH:rotrBH,rotrBL:rotrBL,rotr32H:rotr32H,rotr32L:rotr32L,rotlSH:rotlSH,rotlSL:rotlSL,rotlBH:rotlBH,rotlBL:rotlBL,add:add,add3L:add3L,add3H:add3H,add4L:add4L,add4H:add4H,add5H:add5H,add5L:add5L};var u64$1=u64;const[SHA512_Kh,SHA512_Kl]=(()=>u64$1.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))))();const SHA512_W_H=new Uint32Array(80);const SHA512_W_L=new Uint32Array(80);class SHA512 extends SHA2{constructor(){super(128,64,16,false);this.Ah=1779033703|0;this.Al=4089235720|0;this.Bh=3144134277|0;this.Bl=2227873595|0;this.Ch=1013904242|0;this.Cl=4271175723|0;this.Dh=2773480762|0;this.Dl=1595750129|0;this.Eh=1359893119|0;this.El=2917565137|0;this.Fh=2600822924|0;this.Fl=725511199|0;this.Gh=528734635|0;this.Gl=4215389547|0;this.Hh=1541459225|0;this.Hl=327033209|0}get(){const{Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl}=this;return[Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl]}set(Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl){this.Ah=Ah|0;this.Al=Al|0;this.Bh=Bh|0;this.Bl=Bl|0;this.Ch=Ch|0;this.Cl=Cl|0;this.Dh=Dh|0;this.Dl=Dl|0;this.Eh=Eh|0;this.El=El|0;this.Fh=Fh|0;this.Fl=Fl|0;this.Gh=Gh|0;this.Gl=Gl|0;this.Hh=Hh|0;this.Hl=Hl|0}process(view,offset){for(let i=0;i<16;i++,offset+=4){SHA512_W_H[i]=view.getUint32(offset);SHA512_W_L[i]=view.getUint32(offset+=4)}for(let i=16;i<80;i++){const W15h=SHA512_W_H[i-15]|0;const W15l=SHA512_W_L[i-15]|0;const s0h=u64$1.rotrSH(W15h,W15l,1)^u64$1.rotrSH(W15h,W15l,8)^u64$1.shrSH(W15h,W15l,7);const s0l=u64$1.rotrSL(W15h,W15l,1)^u64$1.rotrSL(W15h,W15l,8)^u64$1.shrSL(W15h,W15l,7);const W2h=SHA512_W_H[i-2]|0;const W2l=SHA512_W_L[i-2]|0;const s1h=u64$1.rotrSH(W2h,W2l,19)^u64$1.rotrBH(W2h,W2l,61)^u64$1.shrSH(W2h,W2l,6);const s1l=u64$1.rotrSL(W2h,W2l,19)^u64$1.rotrBL(W2h,W2l,61)^u64$1.shrSL(W2h,W2l,6);const SUMl=u64$1.add4L(s0l,s1l,SHA512_W_L[i-7],SHA512_W_L[i-16]);const SUMh=u64$1.add4H(SUMl,s0h,s1h,SHA512_W_H[i-7],SHA512_W_H[i-16]);SHA512_W_H[i]=SUMh|0;SHA512_W_L[i]=SUMl|0}let{Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl}=this;for(let i=0;i<80;i++){const sigma1h=u64$1.rotrSH(Eh,El,14)^u64$1.rotrSH(Eh,El,18)^u64$1.rotrBH(Eh,El,41);const sigma1l=u64$1.rotrSL(Eh,El,14)^u64$1.rotrSL(Eh,El,18)^u64$1.rotrBL(Eh,El,41);const CHIh=Eh&Fh^~Eh&Gh;const CHIl=El&Fl^~El&Gl;const T1ll=u64$1.add5L(Hl,sigma1l,CHIl,SHA512_Kl[i],SHA512_W_L[i]);const T1h=u64$1.add5H(T1ll,Hh,sigma1h,CHIh,SHA512_Kh[i],SHA512_W_H[i]);const T1l=T1ll|0;const sigma0h=u64$1.rotrSH(Ah,Al,28)^u64$1.rotrBH(Ah,Al,34)^u64$1.rotrBH(Ah,Al,39);const sigma0l=u64$1.rotrSL(Ah,Al,28)^u64$1.rotrBL(Ah,Al,34)^u64$1.rotrBL(Ah,Al,39);const MAJh=Ah&Bh^Ah&Ch^Bh&Ch;const MAJl=Al&Bl^Al&Cl^Bl&Cl;Hh=Gh|0;Hl=Gl|0;Gh=Fh|0;Gl=Fl|0;Fh=Eh|0;Fl=El|0;({h:Eh,l:El}=u64$1.add(Dh|0,Dl|0,T1h|0,T1l|0));Dh=Ch|0;Dl=Cl|0;Ch=Bh|0;Cl=Bl|0;Bh=Ah|0;Bl=Al|0;const All=u64$1.add3L(T1l,sigma0l,MAJl);Ah=u64$1.add3H(All,T1h,sigma0h,MAJh);Al=All|0}({h:Ah,l:Al}=u64$1.add(this.Ah|0,this.Al|0,Ah|0,Al|0));({h:Bh,l:Bl}=u64$1.add(this.Bh|0,this.Bl|0,Bh|0,Bl|0));({h:Ch,l:Cl}=u64$1.add(this.Ch|0,this.Cl|0,Ch|0,Cl|0));({h:Dh,l:Dl}=u64$1.add(this.Dh|0,this.Dl|0,Dh|0,Dl|0));({h:Eh,l:El}=u64$1.add(this.Eh|0,this.El|0,Eh|0,El|0));({h:Fh,l:Fl}=u64$1.add(this.Fh|0,this.Fl|0,Fh|0,Fl|0));({h:Gh,l:Gl}=u64$1.add(this.Gh|0,this.Gl|0,Gh|0,Gl|0));({h:Hh,l:Hl}=u64$1.add(this.Hh|0,this.Hl|0,Hh|0,Hl|0));this.set(Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl)}roundClean(){SHA512_W_H.fill(0);SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0);this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha512$1=wrapConstructor(()=>new SHA512);const[SHA3_PI,SHA3_ROTL,_SHA3_IOTA]=[[],[],[]];const _0n=BigInt(0);const _1n=BigInt(1);const _2n=BigInt(2);const _7n=BigInt(7);const _256n=BigInt(256);const _0x71n=BigInt(113);for(let round=0,R=_1n,x=1,y=0;round<24;round++){[x,y]=[y,(2*x+3*y)%5];SHA3_PI.push(2*(5*y+x));SHA3_ROTL.push((round+1)*(round+2)/2%64);let t=_0n;for(let j=0;j<7;j++){R=(R<<_1n^(R>>_7n)*_0x71n)%_256n;if(R&_2n)t^=_1n<<(_1n<s>32?rotlBH(h,l,s):rotlSH(h,l,s);const rotlL=(h,l,s)=>s>32?rotlBL(h,l,s):rotlSL(h,l,s);function keccakP(s,rounds=24){const B=new Uint32Array(5*2);for(let round=24-rounds;round<24;round++){for(let x=0;x<10;x++)B[x]=s[x]^s[x+10]^s[x+20]^s[x+30]^s[x+40];for(let x=0;x<10;x+=2){const idx1=(x+8)%10;const idx0=(x+2)%10;const B0=B[idx0];const B1=B[idx0+1];const Th=rotlH(B0,B1,1)^B[idx1];const Tl=rotlL(B0,B1,1)^B[idx1+1];for(let y=0;y<50;y+=10){s[x+y]^=Th;s[x+y+1]^=Tl}}let curH=s[2];let curL=s[3];for(let t=0;t<24;t++){const shift=SHA3_ROTL[t];const Th=rotlH(curH,curL,shift);const Tl=rotlL(curH,curL,shift);const PI=SHA3_PI[t];curH=s[PI];curL=s[PI+1];s[PI]=Th;s[PI+1]=Tl}for(let y=0;y<50;y+=10){for(let x=0;x<10;x++)B[x]=s[y+x];for(let x=0;x<10;x++)s[y+x]^=~B[(x+2)%10]&B[(x+4)%10]}s[0]^=SHA3_IOTA_H[round];s[1]^=SHA3_IOTA_L[round]}B.fill(0)}class Keccak extends Hash{constructor(blockLen,suffix,outputLen,enableXOF=false,rounds=24){super();this.blockLen=blockLen;this.suffix=suffix;this.outputLen=outputLen;this.enableXOF=enableXOF;this.rounds=rounds;this.pos=0;this.posOut=0;this.finished=false;this.destroyed=false;number(outputLen);if(0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200);this.state32=u32(this.state)}keccak(){keccakP(this.state32,this.rounds);this.posOut=0;this.pos=0}update(data){exists(this);const{blockLen,state}=this;data=toBytes(data);const len=data.length;for(let pos=0;pos=blockLen)this.keccak();const take=Math.min(blockLen-this.posOut,len-pos);out.set(bufferOut.subarray(this.posOut,this.posOut+take),pos);this.posOut+=take;pos+=take}return out}xofInto(out){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(out)}xof(bytes){number(bytes);return this.xofInto(new Uint8Array(bytes))}digestInto(out){output(out,this);if(this.finished)throw new Error("digest() was already called");this.writeInto(out);this.destroy();return out}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=true;this.state.fill(0)}_cloneInto(to){const{blockLen,suffix,outputLen,rounds,enableXOF}=this;to||(to=new Keccak(blockLen,suffix,outputLen,enableXOF,rounds));to.state32.set(this.state32);to.pos=this.pos;to.posOut=this.posOut;to.finished=this.finished;to.rounds=rounds;to.suffix=suffix;to.outputLen=outputLen;to.enableXOF=enableXOF;to.destroyed=this.destroyed;return to}}const gen=(suffix,blockLen,outputLen)=>wrapConstructor(()=>new Keccak(blockLen,suffix,outputLen));const sha3_256=gen(6,136,256/8);const sha3_512=gen(6,72,512/8);const keccak_256=gen(1,136,256/8);const BN_0$9=BigInt(0);const BN_1$5=BigInt(1);const maxValue=9007199254740991;function fromTwos(_value,_width){const value=getUint(_value,"value");const width=BigInt(getNumber(_width,"width"));assert(value>>width===BN_0$9,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:_value});if(value>>width-BN_1$5){const mask=(BN_1$5<=-maxValue&&value<=maxValue,"overflow",name||"value",value);return BigInt(value);case"string":try{if(value===""){throw new Error("empty string")}if(value[0]==="-"&&value[1]!=="-"){return-BigInt(value.substring(1))}return BigInt(value)}catch(e){assertArgument(false,`invalid BigNumberish string: ${e.message}`,name||"value",value)}}assertArgument(false,"invalid BigNumberish value",name||"value",value)}function getUint(value,name){const result=getBigInt(value,name);assert(result>=BN_0$9,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:value});return result}const Nibbles="0123456789abcdef";function toBigInt(value){if(value instanceof Uint8Array){let result="0x0";for(const v of value){result+=Nibbles[v>>4];result+=Nibbles[v&15]}return BigInt(result)}return getBigInt(value)}function getNumber(value,name){switch(typeof value){case"bigint":assertArgument(value>=-maxValue&&value<=maxValue,"overflow",name||"value",value);return Number(value);case"number":assertArgument(Number.isInteger(value),"underflow",name||"value",value);assertArgument(value>=-maxValue&&value<=maxValue,"overflow",name||"value",value);return value;case"string":try{if(value===""){throw new Error("empty string")}return getNumber(BigInt(value),name)}catch(e){assertArgument(false,`invalid numeric string: ${e.message}`,name||"value",value)}}assertArgument(false,"invalid numeric value",name||"value",value)}function toNumber(value){return getNumber(toBigInt(value))}function toBeHex(_value,_width){const value=getUint(_value,"value");let result=value.toString(16);if(_width==null){if(result.length%2){result="0"+result}}else{const width=getNumber(_width,"width");assert(width*2>=result.length,`value exceeds width (${width} bits)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:_value});while(result.length>6!==2){break}i++}return i}if(reason==="OVERRUN"){return bytes.length-offset-1}return 0}function replaceFunc(reason,offset,bytes,output,badCodepoint){if(reason==="OVERLONG"){assertArgument(typeof badCodepoint==="number","invalid bad code point for replacement","badCodepoint",badCodepoint);output.push(badCodepoint);return 0}output.push(65533);return ignoreFunc(reason,offset,bytes)}const Utf8ErrorFuncs=Object.freeze({error:errorFunc,ignore:ignoreFunc,replace:replaceFunc});function getUtf8CodePoints(_bytes,onError){if(onError==null){onError=Utf8ErrorFuncs.error}const bytes=getBytes(_bytes,"bytes");const result=[];let i=0;while(i>7===0){result.push(c);continue}let extraLength=null;let overlongMask=null;if((c&224)===192){extraLength=1;overlongMask=127}else if((c&240)===224){extraLength=2;overlongMask=2047}else if((c&248)===240){extraLength=3;overlongMask=65535}else{if((c&192)===128){i+=onError("UNEXPECTED_CONTINUE",i-1,bytes,result)}else{i+=onError("BAD_PREFIX",i-1,bytes,result)}continue}if(i-1+extraLength>=bytes.length){i+=onError("OVERRUN",i-1,bytes,result);continue}let res=c&(1<<8-extraLength-1)-1;for(let j=0;j1114111){i+=onError("OUT_OF_RANGE",i-1-extraLength,bytes,result,res);continue}if(res>=55296&&res<=57343){i+=onError("UTF16_SURROGATE",i-1-extraLength,bytes,result,res);continue}if(res<=overlongMask){i+=onError("OVERLONG",i-1-extraLength,bytes,result,res);continue}result.push(res)}return result}function toUtf8Bytes(str,form){if(form!=null){assertNormalize(form);str=str.normalize(form)}let result=[];for(let i=0;i>6|192);result.push(c&63|128)}else if((c&64512)==55296){i++;const c2=str.charCodeAt(i);assertArgument(i>18|240);result.push(pair>>12&63|128);result.push(pair>>6&63|128);result.push(pair&63|128)}else{result.push(c>>12|224);result.push(c>>6&63|128);result.push(c&63|128)}}return new Uint8Array(result)}function _toUtf8String(codePoints){return codePoints.map(codePoint=>{if(codePoint<=65535){return String.fromCharCode(codePoint)}codePoint-=65536;return String.fromCharCode((codePoint>>10&1023)+55296,(codePoint&1023)+56320)}).join("")}function toUtf8String(bytes,onError){return _toUtf8String(getUtf8CodePoints(bytes,onError))}function toUtf8CodePoints(str,form){return getUtf8CodePoints(toUtf8Bytes(str,form))}async function getUrl(req,_signal){const protocol=req.url.split(":")[0].toLowerCase();assert(protocol==="http"||protocol==="https",`unsupported protocol ${protocol}`,"UNSUPPORTED_OPERATION",{info:{protocol:protocol},operation:"request"});assert(protocol==="https"||!req.credentials||req.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let signal=undefined;if(_signal){const controller=new AbortController;signal=controller.signal;_signal.addListener(()=>{controller.abort()})}const init={method:req.method,headers:new Headers(Array.from(req)),body:req.body||undefined,signal:signal};try{const resp=await fetch(req.url,init);const headers={};resp.headers.forEach((value,key)=>{headers[key.toLowerCase()]=value});const respBody=await resp.arrayBuffer();const body=respBody==null?null:new Uint8Array(respBody);return{statusCode:resp.status,statusMessage:resp.statusText,headers:headers,body:body}}catch(error){console.log({error:error});return undefined}}const MAX_ATTEMPTS=12;const SLOT_INTERVAL=250;let getUrlFunc=getUrl;const reData=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i");const reIpfs=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let locked$5=false;async function dataGatewayFunc(url,signal){try{const match=url.match(reData);if(!match){throw new Error("invalid data")}return new FetchResponse(200,"OK",{"content-type":match[1]||"text/plain"},match[2]?decodeBase64(match[3]):unpercent(match[3]))}catch(error){return new FetchResponse(599,"BAD REQUEST (invalid data: URI)",{},null,new FetchRequest(url))}}function getIpfsGatewayFunc(baseUrl){async function gatewayIpfs(url,signal){try{const match=url.match(reIpfs);if(!match){throw new Error("invalid link")}return new FetchRequest(`${baseUrl}${match[2]}`)}catch(error){return new FetchResponse(599,"BAD REQUEST (invalid IPFS URI)",{},null,new FetchRequest(url))}}return gatewayIpfs}const Gateways={data:dataGatewayFunc,ipfs:getIpfsGatewayFunc("https://gateway.ipfs.io/ipfs/")};const fetchSignals=new WeakMap;class FetchCancelSignal{#listeners;#cancelled;constructor(request){this.#listeners=[];this.#cancelled=false;fetchSignals.set(request,()=>{if(this.#cancelled){return}this.#cancelled=true;for(const listener of this.#listeners){setTimeout(()=>{listener()},0)}this.#listeners=[]})}addListener(listener){assert(!this.#cancelled,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"});this.#listeners.push(listener)}get cancelled(){return this.#cancelled}checkSignal(){assert(!this.cancelled,"cancelled","CANCELLED",{})}}function checkSignal(signal){if(signal==null){throw new Error("missing signal; should not happen")}signal.checkSignal();return signal}class FetchRequest{#allowInsecure;#gzip;#headers;#method;#timeout;#url;#body;#bodyType;#creds;#preflight;#process;#retry;#signal;#throttle;get url(){return this.#url}set url(url){this.#url=String(url)}get body(){if(this.#body==null){return null}return new Uint8Array(this.#body)}set body(body){if(body==null){this.#body=undefined;this.#bodyType=undefined}else if(typeof body==="string"){this.#body=toUtf8Bytes(body);this.#bodyType="text/plain"}else if(body instanceof Uint8Array){this.#body=body;this.#bodyType="application/octet-stream"}else if(typeof body==="object"){this.#body=toUtf8Bytes(JSON.stringify(body));this.#bodyType="application/json"}else{throw new Error("invalid body")}}hasBody(){return this.#body!=null}get method(){if(this.#method){return this.#method}if(this.hasBody()){return"POST"}return"GET"}set method(method){if(method==null){method=""}this.#method=String(method).toUpperCase()}get headers(){const headers=Object.assign({},this.#headers);if(this.#creds){headers["authorization"]=`Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`}if(this.allowGzip){headers["accept-encoding"]="gzip"}if(headers["content-type"]==null&&this.#bodyType){headers["content-type"]=this.#bodyType}if(this.body){headers["content-length"]=String(this.body.length)}return headers}getHeader(key){return this.headers[key.toLowerCase()]}setHeader(key,value){this.#headers[String(key).toLowerCase()]=String(value)}clearHeaders(){this.#headers={}}[Symbol.iterator](){const headers=this.headers;const keys=Object.keys(headers);let index=0;return{next:()=>{if(index=0,"timeout must be non-zero","timeout",timeout);this.#timeout=timeout}get preflightFunc(){return this.#preflight||null}set preflightFunc(preflight){this.#preflight=preflight}get processFunc(){return this.#process||null}set processFunc(process){this.#process=process}get retryFunc(){return this.#retry||null}set retryFunc(retry){this.#retry=retry}constructor(url){this.#url=String(url);this.#allowInsecure=false;this.#gzip=true;this.#headers={};this.#method="";this.#timeout=3e5;this.#throttle={slotInterval:SLOT_INTERVAL,maxAttempts:MAX_ATTEMPTS}}toString(){return``}setThrottleParams(params){if(params.slotInterval!=null){this.#throttle.slotInterval=params.slotInterval}if(params.maxAttempts!=null){this.#throttle.maxAttempts=params.maxAttempts}}async#send(attempt,expires,delay,_request,_response){if(attempt>=this.#throttle.maxAttempts){return _response.makeServerError("exceeded maximum retry limit")}assert(getTime$2()<=expires,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:_request});if(delay>0){await wait(delay)}let req=this.clone();const scheme=(req.url.split(":")[0]||"").toLowerCase();if(scheme in Gateways){const result=await Gateways[scheme](req.url,checkSignal(_request.#signal));if(result instanceof FetchResponse){let response=result;if(this.processFunc){checkSignal(_request.#signal);try{response=await this.processFunc(req,response)}catch(error){if(error.throttle==null||typeof error.stall!=="number"){response.makeServerError("error in post-processing function",error).assertOk()}}}return response}req=result}if(this.preflightFunc){req=await this.preflightFunc(req)}const resp=await getUrlFunc(req,checkSignal(_request.#signal));let response=new FetchResponse(resp.statusCode,resp.statusMessage,resp.headers,resp.body,_request);if(response.statusCode===301||response.statusCode===302){try{const location=response.headers.location||"";return req.redirect(location).#send(attempt+1,expires,0,_request,response)}catch(error){}return response}else if(response.statusCode===429){if(this.retryFunc==null||await this.retryFunc(req,response,attempt)){const retryAfter=response.headers["retry-after"];let delay=this.#throttle.slotInterval*Math.trunc(Math.random()*Math.pow(2,attempt));if(typeof retryAfter==="string"&&retryAfter.match(/^[1-9][0-9]*$/)){delay=parseInt(retryAfter)}return req.clone().#send(attempt+1,expires,delay,_request,response)}}if(this.processFunc){checkSignal(_request.#signal);try{response=await this.processFunc(req,response)}catch(error){if(error.throttle==null||typeof error.stall!=="number"){response.makeServerError("error in post-processing function",error).assertOk()}let delay=this.#throttle.slotInterval*Math.trunc(Math.random()*Math.pow(2,attempt));if(error.stall>=0){delay=error.stall}return req.clone().#send(attempt+1,expires,delay,_request,response)}}return response}send(){assert(this.#signal==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"});this.#signal=new FetchCancelSignal(this);return this.#send(0,getTime$2()+this.timeout,0,this,new FetchResponse(0,"",{},null,this))}cancel(){assert(this.#signal!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const signal=fetchSignals.get(this);if(!signal){throw new Error("missing signal; should not happen")}signal()}redirect(location){const current=this.url.split(":")[0].toLowerCase();const target=location.split(":")[0].toLowerCase();assert(this.method==="GET"&&(current!=="https"||target!=="http")&&location.match(/^https?:/),`unsupported redirect`,"UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})`});const req=new FetchRequest(location);req.method="GET";req.allowGzip=this.allowGzip;req.timeout=this.timeout;req.#headers=Object.assign({},this.#headers);if(this.#body){req.#body=new Uint8Array(this.#body)}req.#bodyType=this.#bodyType;return req}clone(){const clone=new FetchRequest(this.url);clone.#method=this.#method;if(this.#body){clone.#body=this.#body}clone.#bodyType=this.#bodyType;clone.#headers=Object.assign({},this.#headers);clone.#creds=this.#creds;if(this.allowGzip){clone.allowGzip=true}clone.timeout=this.timeout;if(this.allowInsecureAuthentication){clone.allowInsecureAuthentication=true}clone.#preflight=this.#preflight;clone.#process=this.#process;clone.#retry=this.#retry;return clone}static lockConfig(){locked$5=true}static getGateway(scheme){return Gateways[scheme.toLowerCase()]||null}static registerGateway(scheme,func){scheme=scheme.toLowerCase();if(scheme==="http"||scheme==="https"){throw new Error(`cannot intercept ${scheme}; use registerGetUrl`)}if(locked$5){throw new Error("gateways locked")}Gateways[scheme]=func}static registerGetUrl(getUrl){if(locked$5){throw new Error("gateways locked")}getUrlFunc=getUrl}static createDataGateway(){return dataGatewayFunc}static createIpfsGatewayFunc(baseUrl){return getIpfsGatewayFunc(baseUrl)}}class FetchResponse{#statusCode;#statusMessage;#headers;#body;#request;#error;toString(){return``}get statusCode(){return this.#statusCode}get statusMessage(){return this.#statusMessage}get headers(){return Object.assign({},this.#headers)}get body(){return this.#body==null?null:new Uint8Array(this.#body)}get bodyText(){try{return this.#body==null?"":toUtf8String(this.#body)}catch(error){assert(false,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch(error){assert(false,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const headers=this.headers;const keys=Object.keys(headers);let index=0;return{next:()=>{if(index{accum[k.toLowerCase()]=String(headers[k]);return accum},{});this.#body=body==null?null:new Uint8Array(body);this.#request=request||null;this.#error={message:""}}makeServerError(message,error){let statusMessage;if(!message){message=`${this.statusCode} ${this.statusMessage}`;statusMessage=`CLIENT ESCALATED SERVER ERROR (${message})`}else{statusMessage=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`}const response=new FetchResponse(599,statusMessage,this.headers,this.body,this.#request||undefined);response.#error={message:message,error:error};return response}throwThrottleError(message,stall){if(stall==null){stall=-1}else{assertArgument(Number.isInteger(stall)&&stall>=0,"invalid stall timeout","stall",stall)}const error=new Error(message||"throttling requests");defineProperties(error,{stall:stall,throttle:true});throw error}getHeader(key){return this.headers[key.toLowerCase()]}hasBody(){return this.#body!=null}get request(){return this.#request}ok(){return this.#error.message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok()){return}let{message,error}=this.#error;if(message===""){message=`server response ${this.statusCode} ${this.statusMessage}`}assert(false,message,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:error})}}function getTime$2(){return(new Date).getTime()}function unpercent(value){return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi,(all,code)=>{return String.fromCharCode(parseInt(code,16))}))}function wait(delay){return new Promise(resolve=>setTimeout(resolve,delay))}var _a$1;const BN_N1=BigInt(-1);const BN_0$7=BigInt(0);const BN_1$4=BigInt(1);const BN_5=BigInt(5);const _guard$5={};let Zeros="0000";while(Zeros.length<80){Zeros+=Zeros}function getTens(decimals){let result=Zeros;while(result.length=-limit&&valBN_0$7){val=fromTwos(mask(val,width),width)}else{val=-fromTwos(mask(-val,width),width)}}else{const limit=BN_1$4<=0&&val{if(v[key]==null){return defaultValue}assertArgument(typeof v[key]===type,"invalid fixed format ("+key+" not "+type+")","format."+key,v[key]);return v[key]};signed=check("signed","boolean",signed);width=check("width","number",width);decimals=check("decimals","number",decimals)}assertArgument(width%8===0,"invalid FixedNumber width (not byte aligned)","format.width",width);assertArgument(decimals<=80,"invalid FixedNumber decimals (too large)","format.decimals",decimals);const name=(signed?"":"u")+"fixed"+String(width)+"x"+String(decimals);return{signed:signed,width:width,decimals:decimals,name:name}}function toString(val,decimals){let negative="";if(val0){b*=getTens(delta)}else if(delta<0){a*=getTens(-delta)}if(ab){return-1}return 0}eq(other){return this.cmp(other)===0}lt(other){return this.cmp(other)<0}lte(other){return this.cmp(other)<=0}gt(other){return this.cmp(other)>0}gte(other){return this.cmp(other)>=0}floor(){let val=this.#val;if(this.#valBN_0$7){val+=this.#tens-BN_1$4}val=this.#val/this.#tens*this.#tens;return this.#checkValue(val,"ceiling")}round(decimals){if(decimals==null){decimals=0}if(decimals>=this.decimals){return this}const delta=this.decimals-decimals;const bump=BN_5*getTens(delta-1);let value=this.value+bump;const tens=getTens(delta);value=value/tens*tens;checkValue(value,this.#format,"round");return new _a$1(_guard$5,value,this.#format)}isZero(){return this.#val===BN_0$7}isNegative(){return this.#val0){const tens=getTens(delta);assert(value%tens===BN_0$7,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:_value});value/=tens}else if(delta<0){value*=getTens(-delta)}checkValue(value,format,"fromValue");return new _a$1(_guard$5,value,format)}static fromString(_value,_format){const match=_value.match(/^(-?)([0-9]*)\.?([0-9]*)$/);assertArgument(match&&match[2].length+match[3].length>0,"invalid FixedNumber string value","value",_value);const format=getFormat(_format);let whole=match[2]||"0",decimal=match[3]||"";while(decimal.length{assert(offset<=data.length,"data short segment too short","BUFFER_OVERRUN",{buffer:data,length:data.length,offset:offset})};if(data[offset]>=248){const lengthLength=data[offset]-247;checkOffset(offset+1+lengthLength);const length=unarrayifyInteger(data,offset+1,lengthLength);checkOffset(offset+1+lengthLength+length);return _decodeChildren(data,offset,offset+1+lengthLength,lengthLength+length)}else if(data[offset]>=192){const length=data[offset]-192;checkOffset(offset+1+length);return _decodeChildren(data,offset,offset+1,length)}else if(data[offset]>=184){const lengthLength=data[offset]-183;checkOffset(offset+1+lengthLength);const length=unarrayifyInteger(data,offset+1,lengthLength);checkOffset(offset+1+lengthLength+length);const result=hexlify(data.slice(offset+1+lengthLength,offset+1+lengthLength+length));return{consumed:1+lengthLength+length,result:result}}else if(data[offset]>=128){const length=data[offset]-128;checkOffset(offset+1+length);const result=hexlify(data.slice(offset+1,offset+1+length));return{consumed:1+length,result:result}}return{consumed:1,result:hexlifyByte(data[offset])}}function decodeRlp(_data){const data=getBytes(_data,"data");const decoded=_decode(data,0);assertArgument(decoded.consumed===data.length,"unexpected junk after rlp payload","data",_data);return decoded.result}function arrayifyInteger(value){const result=[];while(value){result.unshift(value&255);value>>=8}return result}function _encode(object){if(Array.isArray(object)){let payload=[];object.forEach(function(child){payload=payload.concat(_encode(child))});if(payload.length<=55){payload.unshift(192+payload.length);return payload}const length=arrayifyInteger(payload.length);length.unshift(247+length.length);return length.concat(payload)}const data=Array.prototype.slice.call(getBytes(object,"object"));if(data.length===1&&data[0]<=127){return data}else if(data.length<=55){data.unshift(128+data.length);return data}const length=arrayifyInteger(data.length);length.unshift(183+length.length);return length.concat(data)}const nibbles="0123456789abcdef";function encodeRlp(object){let result="0x";for(const v of _encode(object)){result+=nibbles[v>>4];result+=nibbles[v&15]}return result}const names=["ore","fecore","picore","nacore","mcore","micore","core"];function formatUnits(value,unit){let decimals=18;if(typeof unit==="string"){const index=names.indexOf(unit);assertArgument(index>=0,"invalid unit","unit",unit);decimals=3*index}else if(unit!=null){decimals=getNumber(unit,"unit")}return FixedNumber.fromValue(value,decimals,{decimals:decimals}).toString()}const scientificToDecimal=num=>{var nsign=Math.sign(num);num=Math.abs(num);if(/\d+\.?\d*e[\+\-]*\d+/i.test(num)){var zero="0",parts=String(num).toLowerCase().split("e"),e=parts.pop(),l=Math.abs(e),sign=e/l,coeff_array=parts[0].split(".");if(sign===-1){l=l-coeff_array[0].length;if(l<0){num=coeff_array[0].slice(0,l)+"."+coeff_array[0].slice(l)+(coeff_array.length===2?coeff_array[1]:"")}else{num=zero+"."+new Array(l+1).join(zero)+coeff_array.join("")}}else{var dec=coeff_array[1];if(dec)l=l-dec.length;if(l<0){num=coeff_array[0]+dec.slice(0,l)+"."+dec.slice(l)}else{num=coeff_array.join("")+new Array(l+1).join(zero)}}}return nsign<0?"-"+num:num};const trimDecimals=(n,decimals=18)=>{n+="";if(n.indexOf(".")===-1)return n;const arr=n.split(".");const fraction=arr[1].substr(0,decimals);return arr[0]+"."+fraction};function parseUnits(value,unit){assertArgument(typeof value==="string","value must be a string","value",value);if(value.includes("e")){value=scientificToDecimal(value).toString()}let decimals=18;if(typeof unit==="string"){const index=names.indexOf(unit);assertArgument(index>=0,"invalid unit","unit",unit);decimals=3*index;value=trimDecimals(value,decimals)}else if(unit!=null){decimals=getNumber(unit,"unit");value=trimDecimals(value,decimals)}return FixedNumber.fromString(value,{decimals:decimals}).value}function formatXCB(ore){return formatUnits(ore,18)}function parseXCB(xcb){return parseUnits(xcb,18)}function uuidV4(randomBytes){const bytes=getBytes(randomBytes,"randomBytes");bytes[6]=bytes[6]&15|64;bytes[8]=bytes[8]&63|128;const value=hexlify(bytes);return[value.substring(2,10),value.substring(10,14),value.substring(14,18),value.substring(18,22),value.substring(22,34)].join("-")}class Ed448Goldilock{static _channel=ed448;static generatePrivateKey(){var privateKey=ed448.privateKeyGenerate();privateKey[56]&=127;return privateKey}static getPublicKeyFromPrivateKey(privateKey){var secret=Buffer.from(privateKey,"hex");if(secret[56]>127){var scalar=secret.slice(0,56);scalar[0]&=252;scalar[55]|=128;var publicKey=this._channel.publicKeyFromScalar(scalar);return Buffer.from(publicKey).toString("hex")}else{var publicKey=this._channel.publicKeyCreate(secret);return Buffer.from(publicKey).toString("hex")}}static signWithPrivateKey(privateKey,msg){var msgToSign=Buffer.from(msg,"hex");var secret=Buffer.from(privateKey,"hex");if(secret[56]>127){var prefix=secret.slice(0,57);prefix[0]&=252;prefix[56]=0;prefix[55]|=128;var scalar=prefix.slice(0,56);var signedMessage=this._channel.signWithScalar(msgToSign,scalar,prefix);return Buffer.from(signedMessage).toString("hex")}else{var signedMessage=this._channel.sign(msgToSign,secret);return Buffer.from(signedMessage).toString("hex")}}static signWithPrivateKeyNConcatPubkey(privateKey,msg){var signedMessage=Ed448Goldilock.signWithPrivateKey(privateKey,msg);var publicKey=Ed448Goldilock.getPublicKeyFromPrivateKey(privateKey);return signedMessage+publicKey}static verifySignature(msgHash,signedMsg,pubKey){return this._channel.verify(msgHash,signedMsg,pubKey)}static SHA512Hash(password,salt){var p1=Buffer.from(password,"hex");var s1=Buffer.from(salt,"hex");return Buffer.from(pbkdf2$2.derive(SHA3_512,p1,s1,2048,57)).toString("hex")}static concatenateAndHex(prefix,key,index,salt){var ind=Buffer.alloc(4);var p=Buffer.alloc(1);p[0]=prefix%256;var j=index;for(let i=0;i<4;i++){ind[i]=j%256;j=Math.floor(j/256)}var t=p.toString("hex")+key+ind.toString("hex");return Ed448Goldilock.SHA512Hash(t,salt)}static addScalar(a,b){var a1=Buffer.from(a,"hex");var b1=Buffer.from(b.substr(0,106)+"00000000","hex");b1[0]&=252;var c=Buffer.alloc(57);var hold=0;for(let i=0;i<57;i++){hold+=a1[i]+b1[i];c[i]=hold%256;hold=Math.floor(hold/256)}return c.toString("hex")}static seedToExtendedPrivate(seed){var s1=Ed448Goldilock.SHA512Hash(seed,"6d6e656d6f6e6963666f72746865636861696e");var s2=Ed448Goldilock.SHA512Hash(seed,"6d6e656d6f6e6963666f727468656b6579");var b=Buffer.from(s2,"hex");b[56]|=128;b[55]|=128;b[55]&=191;var s3=b.toString("hex");return s1+s3}static childPrivateToPrivate(s,index){var s0=s.substr(0,114);var s1=s.substr(114,228);var r0,r1;if(index>=2147483648){r0=Ed448Goldilock.concatenateAndHex(1,s1,index,s0);r1=Ed448Goldilock.concatenateAndHex(0,s1,index,s0);return r0+Ed448Goldilock.addScalar(s1,r1)}else{var pub=Ed448Goldilock.getPublicKeyFromPrivateKey(s1);r0=Ed448Goldilock.concatenateAndHex(3,pub,index,s0);r1=Ed448Goldilock.concatenateAndHex(2,pub,index,s0);return r0+Ed448Goldilock.addScalar(s1,r1)}}static HDWalletGenerateKeyFromSeed(seed,index){var m=Ed448Goldilock.seedToExtendedPrivate(seed);var k1=Ed448Goldilock.childPrivateToPrivate(m,2147483648+44);var k2=Ed448Goldilock.childPrivateToPrivate(k1,2147483648+654);var k3=Ed448Goldilock.childPrivateToPrivate(k2,2147483648+0);var k4=Ed448Goldilock.childPrivateToPrivate(k3,2147483648+0);var k5=Ed448Goldilock.childPrivateToPrivate(k4,index);return k5.substr(114,228)}}function getGlobal$1(){if(typeof self!=="undefined"){return self}if(typeof window!=="undefined"){return window}if(typeof global!=="undefined"){return global}throw new Error("unable to locate global object")}const anyGlobal=getGlobal$1();const crypto=anyGlobal.crypto||anyGlobal.msCrypto;function createHash(algo){switch(algo){case"sha256":return sha256$1.create();case"sha512":return sha512$1.create();case"sha3-256":return sha3_256.create();case"sha3-512":return sha3_512.create()}assertArgument(false,"invalid hashing algorithm name","algorithm",algo)}function createHmac(_algo,key){const algo={sha256:sha256$1,sha512:sha512$1}[_algo];assertArgument(algo!=null,"invalid hmac algorithm","algorithm",_algo);return hmac.create(algo,key)}function pbkdf2Sync(password,salt,iterations,keylen,_algo){const algo={sha256:sha256$1,sha512:sha512$1}[_algo];assertArgument(algo!=null,"invalid pbkdf2 algorithm","algorithm",_algo);return pbkdf2$1(algo,password,salt,{c:iterations,dkLen:keylen})}function randomBytes$1(length){assert(crypto!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"});assertArgument(Number.isInteger(length)&&length>0&&length<=1024,"invalid length","length",length);const result=new Uint8Array(length);crypto.getRandomValues(result);return result}const _sha256=function(data){let v="0x"+createHash("sha3-256").update(buffer.Buffer.from(arrayify(data))).digest("hex");return v};const _sha512=function(data){let v="0x"+createHash("sha3-512").update(buffer.Buffer.from(arrayify(data))).digest("hex");return v};let locked256=false,locked512=false;var SupportedAlgorithm;(function(SupportedAlgorithm){SupportedAlgorithm["sha256"]="sha256";SupportedAlgorithm["sha512"]="sha512"})(SupportedAlgorithm||(SupportedAlgorithm={}));function sha256(data){let createdHash=createHash("sha3-256").update(buffer.Buffer.from(arrayify(data))).digest("hex");const v="0x"+createdHash;if(typeof createdHash!=="string"){createdHash=hexlify(createdHash);return createdHash}return v}function legacySha256(data){const _data=getBytes(data,"data");const hexlified=hexlify(createHash("sha256").update(_data).digest());return hexlified}sha256._=_sha256;sha256.lock=function(){locked256=true};sha256.register=function(func){if(locked256){throw new Error("sha256 is locked")}};Object.freeze(sha256);function sha512(data){let createdHash=createHash("sha3-512").update(buffer.Buffer.from(arrayify(data))).digest("hex");const v="0x"+createdHash;if(typeof createdHash!=="string"){createdHash=hexlify(createdHash);return createdHash}return v}sha512._=_sha512;sha512.lock=function(){locked512=true};sha512.register=function(func){if(locked512){throw new Error("sha512 is locked")}};Object.freeze(sha256);const logger$3=new Logger("address/0.0.1");const precompiledAddresses=["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000004","0000000000000000000000000000000000000000000000000000000000000005","0000000000000000000000000000000000000000000000000000000000000006","0000000000000000000000000000000000000000000000000000000000000007","0000000000000000000000000000000000000000000000000000000000000008","0000000000000000000000000000000000000000000000000000000000000009"];function removeHexPrefix$1(val){return val.substring(0,2)==="0x"?val.substring(2):val}function calculateCheckSum(_address,_prefix){const address=getBytes("0x"+_address.replace("0x",""));const prefix=getBytes("0x"+_prefix.replace("0x",""));const tmpConcated=new Uint8Array([...address,...prefix]);const hexedConcat=hexlify(tmpConcated).replace("0x","")+"00";const mods=Array.from(hexedConcat.toUpperCase(),c=>{const charCode=c.charCodeAt(0);return charCode>64&&charCode<91?(charCode-55).toString():(charCode-48).toString()}).join("");const bigVal=BigInt(mods);const val97=BigInt(97);const val98=BigInt(98);const remainder=bigVal%val97;const checkSum=val98-remainder;const result=checkSum>9?checkSum.toString():"0"+checkSum.toString();return result}function getAddress(address){if(typeof address!=="string"){logger$3.throwArgumentError("invalid address","address",address)}if(!address.match(/^(0x)?[0-9a-fA-F]{44}$/)){logger$3.throwArgumentError("invalid address","address",address)}const raw=removeHexPrefix$1(address);if(precompiledAddresses.includes(raw)){return"0x"+raw}const prefix=raw.substring(0,2);const val=raw.substring(4);const checksum=calculateCheckSum(val,prefix);if(checksum!==raw.substring(2,4)){logger$3.throwArgumentError("bad address checksum","address",address)}return"0x"+prefix+checksum+val}function networkIdToPrefix(networkId){if(networkId==1){return"cb"}else if(networkId==3||networkId==4){return"ab"}else if(networkId>10||networkId==0){return"ce"}else{logger$3.throwArgumentError("bad networkId","networkId",networkId);return""}}let locked$4=false;const _computeHmac=function(algorithm,key,data){return createHmac(algorithm,key).update(data).digest()};let __computeHmac=_computeHmac;function computeHmac(algorithm,_key,_data){const key=getBytes(_key,"key");const data=getBytes(_data,"data");return hexlify(__computeHmac(algorithm,key,data))}computeHmac._=_computeHmac;computeHmac.lock=function(){locked$4=true};computeHmac.register=function(func){if(locked$4){throw new Error("computeHmac is locked")}__computeHmac=func};Object.freeze(computeHmac);const Rho=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]);const Id=Uint8Array.from({length:16},(_,i)=>i);const Pi=Id.map(i=>(9*i+5)%16);let idxL=[Id];let idxR=[Pi];for(let i=0;i<4;i++)for(let j of[idxL,idxR])j.push(j[i].map(k=>Rho[k]));const shifts=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(i=>new Uint8Array(i));const shiftsL=idxL.map((idx,i)=>idx.map(j=>shifts[i][j]));const shiftsR=idxR.map((idx,i)=>idx.map(j=>shifts[i][j]));const Kl=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]);const Kr=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);const rotl$1=(word,shift)=>word<>>32-shift;function f(group,x,y,z){if(group===0)return x^y^z;else if(group===1)return x&y|~x&z;else if(group===2)return(x|~y)^z;else if(group===3)return x&z|y&~z;else return x^(y|~z)}const BUF=new Uint32Array(16);class RIPEMD160 extends SHA2{constructor(){super(64,20,8,true);this.h0=1732584193|0;this.h1=4023233417|0;this.h2=2562383102|0;this.h3=271733878|0;this.h4=3285377520|0}get(){const{h0,h1,h2,h3,h4}=this;return[h0,h1,h2,h3,h4]}set(h0,h1,h2,h3,h4){this.h0=h0|0;this.h1=h1|0;this.h2=h2|0;this.h3=h3|0;this.h4=h4|0}process(view,offset){for(let i=0;i<16;i++,offset+=4)BUF[i]=view.getUint32(offset,true);let al=this.h0|0,ar=al,bl=this.h1|0,br=bl,cl=this.h2|0,cr=cl,dl=this.h3|0,dr=dl,el=this.h4|0,er=el;for(let group=0;group<5;group++){const rGroup=4-group;const hbl=Kl[group],hbr=Kr[group];const rl=idxL[group],rr=idxR[group];const sl=shiftsL[group],sr=shiftsR[group];for(let i=0;i<16;i++){const tl=rotl$1(al+f(group,bl,cl,dl)+BUF[rl[i]]+hbl,sl[i])+el|0;al=el,el=dl,dl=rotl$1(cl,10)|0,cl=bl,bl=tl}for(let i=0;i<16;i++){const tr=rotl$1(ar+f(rGroup,br,cr,dr)+BUF[rr[i]]+hbr,sr[i])+er|0;ar=er,er=dr,dr=rotl$1(cr,10)|0,cr=br,br=tr}}this.set(this.h1+cl+dr|0,this.h2+dl+er|0,this.h3+el+ar|0,this.h4+al+br|0,this.h0+bl+cr|0)}roundClean(){BUF.fill(0)}destroy(){this.destroyed=true;this.buffer.fill(0);this.set(0,0,0,0,0)}}const ripemd160$1=wrapConstructor(()=>new RIPEMD160);let locked$3=false;const _ripemd160=function(data){return ripemd160$1(data)};let __ripemd160=_ripemd160;function ripemd160(_data){const data=getBytes(_data,"data");return hexlify(__ripemd160(data))}ripemd160._=_ripemd160;ripemd160.lock=function(){locked$3=true};ripemd160.register=function(func){if(locked$3){throw new TypeError("ripemd160 is locked")}__ripemd160=func};Object.freeze(ripemd160);let locked$2=false;const _pbkdf2=function(password,salt,iterations,keylen,algo){return pbkdf2Sync(password,salt,iterations,keylen,algo)};let __pbkdf2=_pbkdf2;function pbkdf2(_password,_salt,iterations,keylen,algo){const password=getBytes(_password,"password");const salt=getBytes(_salt,"salt");return hexlify(__pbkdf2(password,salt,iterations,keylen,algo))}pbkdf2._=_pbkdf2;pbkdf2.lock=function(){locked$2=true};pbkdf2.register=function(func){if(locked$2){throw new Error("pbkdf2 is locked")}__pbkdf2=func};Object.freeze(pbkdf2);let locked$1=false;const _randomBytes=function(length){return new Uint8Array(randomBytes$1(length))};let __randomBytes=_randomBytes;function randomBytes(length){return __randomBytes(length)}randomBytes._=_randomBytes;randomBytes.lock=function(){locked$1=true};randomBytes.register=function(func){if(locked$1){throw new Error("randomBytes is locked")}__randomBytes=func};Object.freeze(randomBytes);const rotl=(a,b)=>a<>>32-b;function XorAndSalsa(prev,pi,input,ii,out,oi){let y00=prev[pi++]^input[ii++],y01=prev[pi++]^input[ii++];let y02=prev[pi++]^input[ii++],y03=prev[pi++]^input[ii++];let y04=prev[pi++]^input[ii++],y05=prev[pi++]^input[ii++];let y06=prev[pi++]^input[ii++],y07=prev[pi++]^input[ii++];let y08=prev[pi++]^input[ii++],y09=prev[pi++]^input[ii++];let y10=prev[pi++]^input[ii++],y11=prev[pi++]^input[ii++];let y12=prev[pi++]^input[ii++],y13=prev[pi++]^input[ii++];let y14=prev[pi++]^input[ii++],y15=prev[pi++]^input[ii++];let x00=y00,x01=y01,x02=y02,x03=y03,x04=y04,x05=y05,x06=y06,x07=y07,x08=y08,x09=y09,x10=y10,x11=y11,x12=y12,x13=y13,x14=y14,x15=y15;for(let i=0;i<8;i+=2){x04^=rotl(x00+x12|0,7);x08^=rotl(x04+x00|0,9);x12^=rotl(x08+x04|0,13);x00^=rotl(x12+x08|0,18);x09^=rotl(x05+x01|0,7);x13^=rotl(x09+x05|0,9);x01^=rotl(x13+x09|0,13);x05^=rotl(x01+x13|0,18);x14^=rotl(x10+x06|0,7);x02^=rotl(x14+x10|0,9);x06^=rotl(x02+x14|0,13);x10^=rotl(x06+x02|0,18);x03^=rotl(x15+x11|0,7);x07^=rotl(x03+x15|0,9);x11^=rotl(x07+x03|0,13);x15^=rotl(x11+x07|0,18);x01^=rotl(x00+x03|0,7);x02^=rotl(x01+x00|0,9);x03^=rotl(x02+x01|0,13);x00^=rotl(x03+x02|0,18);x06^=rotl(x05+x04|0,7);x07^=rotl(x06+x05|0,9);x04^=rotl(x07+x06|0,13);x05^=rotl(x04+x07|0,18);x11^=rotl(x10+x09|0,7);x08^=rotl(x11+x10|0,9);x09^=rotl(x08+x11|0,13);x10^=rotl(x09+x08|0,18);x12^=rotl(x15+x14|0,7);x13^=rotl(x12+x15|0,9);x14^=rotl(x13+x12|0,13);x15^=rotl(x14+x13|0,18)}out[oi++]=y00+x00|0;out[oi++]=y01+x01|0;out[oi++]=y02+x02|0;out[oi++]=y03+x03|0;out[oi++]=y04+x04|0;out[oi++]=y05+x05|0;out[oi++]=y06+x06|0;out[oi++]=y07+x07|0;out[oi++]=y08+x08|0;out[oi++]=y09+x09|0;out[oi++]=y10+x10|0;out[oi++]=y11+x11|0;out[oi++]=y12+x12|0;out[oi++]=y13+x13|0;out[oi++]=y14+x14|0;out[oi++]=y15+x15|0}function BlockMix(input,ii,out,oi,r){let head=oi+0;let tail=oi+16*r;for(let i=0;i<16;i++)out[tail+i]=input[ii+(2*r-1)*16+i];for(let i=0;i0)tail+=16;XorAndSalsa(out,head,input,ii+=16,out,tail)}}function scryptInit(password,salt,_opts){const opts=checkOpts({dkLen:32,asyncTick:10,maxmem:1024**3+1024},_opts);const{N,r,p,dkLen,asyncTick,maxmem,onProgress}=opts;number(N);number(r);number(p);number(dkLen);number(asyncTick);number(maxmem);if(onProgress!==undefined&&typeof onProgress!=="function")throw new Error("progressCb should be function");const blockSize=128*r;const blockSize32=blockSize/4;if(N<=1||(N&N-1)!==0||N>=2**(blockSize/8)||N>2**32){throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32")}if(p<0||p>(2**32-1)*32/blockSize){throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)")}if(dkLen<0||dkLen>(2**32-1)*32){throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32")}const memUsed=blockSize*(N+p);if(memUsed>maxmem){throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`)}const B=pbkdf2$1(sha256$1,password,salt,{c:1,dkLen:blockSize*p});const B32=u32(B);const V=u32(new Uint8Array(blockSize*N));const tmp=u32(new Uint8Array(blockSize));let blockMixCb=()=>{};if(onProgress){const totalBlockMix=2*N*p;const callbackPer=Math.max(Math.floor(totalBlockMix/1e4),1);let blockMixCnt=0;blockMixCb=()=>{blockMixCnt++;if(onProgress&&(!(blockMixCnt%callbackPer)||blockMixCnt===totalBlockMix))onProgress(blockMixCnt/totalBlockMix)}}return{N:N,r:r,p:p,dkLen:dkLen,blockSize32:blockSize32,V:V,B32:B32,B:B,tmp:tmp,blockMixCb:blockMixCb,asyncTick:asyncTick}}function scryptOutput(password,dkLen,B,V,tmp){const res=pbkdf2$1(sha256$1,password,B,{c:1,dkLen:dkLen});B.fill(0);V.fill(0);tmp.fill(0);return res}function scrypt$1(password,salt,opts){const{N,r,p,dkLen,blockSize32,V,B32,B,tmp,blockMixCb}=scryptInit(password,salt,opts);for(let pi=0;pi{BlockMix(V,pos,V,pos+=blockSize32,r);blockMixCb()});BlockMix(V,(N-1)*blockSize32,B32,Pi,r);blockMixCb();await asyncLoop(N,asyncTick,()=>{const j=B32[Pi+blockSize32-16]%N;for(let k=0;kmod(mod(x*x)*x+CURVE.b);const err=(m="")=>{throw new Error(m)};const big=n=>typeof n==="bigint";const str=s=>typeof s==="string";const fe=n=>big(n)&&0nbig(n)&&0n!(a instanceof Uint8Array)||typeof l==="number"&&l>0&&a.length!==l?err("Uint8Array expected"):a;const u8n=data=>new Uint8Array(data);const toU8=(a,len)=>au8(str(a)?h2b(a):u8n(a),len);const mod=(a,b=P)=>{let r=a%b;return r>=0n?r:b+r};const isPoint=p=>p instanceof Point?p:err("Point expected");let Gpows=undefined;class Point{constructor(px,py,pz){this.px=px;this.py=py;this.pz=pz}static fromAffine(p){return new Point(p.x,p.y,1n)}static fromHex(hex){hex=toU8(hex);let p=undefined;const head=hex[0],tail=hex.subarray(1);const x=slcNum(tail,0,fLen),len=hex.length;if(len===33&&[2,3].includes(head)){if(!fe(x))err("Point hex invalid: x not FE");let y=sqrt(crv(x));const isYOdd=(y&1n)===1n;const headOdd=(head&1)===1;if(headOdd!==isYOdd)y=mod(-y);p=new Point(x,y,1n)}if(len===65&&head===4)p=new Point(x,slcNum(tail,fLen,2*fLen),1n);return p?p.ok():err("Point is not on curve")}static fromPrivateKey(k){return G.mul(toPriv(k))}get x(){return this.aff().x}get y(){return this.aff().y}equals(other){const{px:X1,py:Y1,pz:Z1}=this;const{px:X2,py:Y2,pz:Z2}=isPoint(other);const X1Z2=mod(X1*Z2),X2Z1=mod(X2*Z1);const Y1Z2=mod(Y1*Z2),Y2Z1=mod(Y2*Z1);return X1Z2===X2Z1&&Y1Z2===Y2Z1}negate(){return new Point(this.px,mod(-this.py),this.pz)}double(){return this.add(this)}add(other){const{px:X1,py:Y1,pz:Z1}=this;const{px:X2,py:Y2,pz:Z2}=isPoint(other);const{a,b}=CURVE;let X3=0n,Y3=0n,Z3=0n;const b3=mod(b*3n);let t0=mod(X1*X2),t1=mod(Y1*Y2),t2=mod(Z1*Z2),t3=mod(X1+Y1);let t4=mod(X2+Y2);t3=mod(t3*t4);t4=mod(t0+t1);t3=mod(t3-t4);t4=mod(X1+Z1);let t5=mod(X2+Z2);t4=mod(t4*t5);t5=mod(t0+t2);t4=mod(t4-t5);t5=mod(Y1+Z1);X3=mod(Y2+Z2);t5=mod(t5*X3);X3=mod(t1+t2);t5=mod(t5-X3);Z3=mod(a*t4);X3=mod(b3*t2);Z3=mod(X3+Z3);X3=mod(t1-Z3);Z3=mod(t1+Z3);Y3=mod(X3*Z3);t1=mod(t0+t0);t1=mod(t1+t0);t2=mod(a*t2);t4=mod(b3*t4);t1=mod(t1+t2);t2=mod(t0-t2);t2=mod(a*t2);t4=mod(t4+t2);t0=mod(t1*t4);Y3=mod(Y3+t0);t0=mod(t5*t4);X3=mod(t3*X3);X3=mod(X3-t0);t0=mod(t3*t1);Z3=mod(t5*Z3);Z3=mod(Z3+t0);return new Point(X3,Y3,Z3)}mul(n,safe=true){if(!safe&&n===0n)return I;if(!ge(n))err("invalid scalar");if(this.equals(G))return wNAF(n).p;let p=I,f=G;for(let d=this;n>0n;d=d.double(),n>>=1n){if(n&1n)p=p.add(d);else if(safe)f=f.add(d)}return p}mulAddQUns(R,u1,u2){return this.mul(u1,false).add(R.mul(u2,false)).ok()}toAffine(){const{px:x,py:y,pz:z}=this;if(this.equals(I))return{x:0n,y:0n};if(z===1n)return{x:x,y:y};const iz=inv(z);if(mod(z*iz)!==1n)err("invalid inverse");return{x:mod(x*iz),y:mod(y*iz)}}assertValidity(){const{x,y}=this.aff();if(!fe(x)||!fe(y))err("Point invalid: x or y");return mod(y*y)===crv(x)?this:err("Point invalid: not on curve")}multiply(n){return this.mul(n)}aff(){return this.toAffine()}ok(){return this.assertValidity()}toHex(isCompressed=true){const{x,y}=this.aff();const head=isCompressed?(y&1n)===0n?"02":"03":"04";return head+n2h(x)+(isCompressed?"":n2h(y))}toRawBytes(isCompressed=true){return h2b(this.toHex(isCompressed))}}Point.BASE=new Point(Gx,Gy,1n);Point.ZERO=new Point(0n,1n,0n);const{BASE:G,ZERO:I}=Point;const padh=(n,pad)=>n.toString(16).padStart(pad,"0");const b2h=b=>Array.from(b).map(e=>padh(e,2)).join("");const h2b=hex=>{const l=hex.length;if(!str(hex)||l%2)err("hex invalid 1");const arr=u8n(l/2);for(let i=0;iBigInt("0x"+(b2h(b)||"0"));const slcNum=(b,from,to)=>b2n(b.slice(from,to));const n2b=num=>{return big(num)&&num>=0n&&numb2h(n2b(num));const inv=(num,md=P)=>{if(num===0n||md<=0n)err("no inverse n="+num+" mod="+md);let a=mod(num,md),b=md,x=0n,u=1n;while(a!==0n){const q=b/a,r=b%a;const m=x-u*q;b=a,a=r,x=u,u=m}return b===1n?mod(x,md):err("no inverse")};const sqrt=n=>{let r=1n;for(let num=n,e=(P+1n)/4n;e>0n;e>>=1n){if(e&1n)r=r*num%P;num=num*num%P}return mod(r*r)===n?r:err("sqrt invalid")};const toPriv=p=>{if(!big(p))p=b2n(toU8(p,fLen));return ge(p)?p:err("private key out of range")};function getSharedSecret(privA,pubB,isCompressed=true){return Point.fromHex(pubB).mul(toPriv(privA)).toRawBytes(isCompressed)}const W=8;const precompute=()=>{const points=[];const windows=256/W+1;let p=G,b=p;for(let w=0;w{const comp=Gpows||(Gpows=precompute());const neg=(cnd,p)=>{let n=p.negate();return cnd?n:p};let p=I,f=G;const windows=1+256/W;const wsize=2**(W-1);const mask=BigInt(2**W-1);const maxNum=2**W;const shiftBy=BigInt(W);for(let w=0;w>=shiftBy;if(wbits>wsize){wbits-=maxNum;n+=1n}const off1=off,off2=off+Math.abs(wbits)-1;const cnd1=w%2!==0,cnd2=wbits<0;if(wbits===0){f=f.add(neg(cnd1,comp[off1]))}else{p=p.add(neg(cnd2,comp[off2]))}}return{p:p,f:f}};const logger$2=new Logger("signing-key/0.0.1");class SigningKey{#privateKey;constructor(privateKey){let tmp=privateKey;if(typeof tmp==="string"&&tmp.startsWith("0x")){tmp=tmp.replace("0x","")}assertArgument(dataLength("0x"+tmp)===57,"invalid private key","privateKey","[REDACTED]");this.#privateKey=hexlify("0x"+tmp)}get privateKey(){return this.#privateKey}get publicKey(){return SigningKey.computePublicKey(this.#privateKey)}get compressedPublicKey(){return SigningKey.computePublicKey(this.#privateKey,true)}sign(digest){const key=getBytesCopy(this.#privateKey);assertArgument(dataLength(digest)===32,"invalid digest length","digest",digest);const keyBuffer=new Uint8Array(arrayify(key));if(keyBuffer.length!==57){logger$2.throwArgumentError("invalid private key","key","[REDACTED]")}const digestBuffer=new Uint8Array(arrayify(digest));if(digestBuffer.length!==32){logger$2.throwArgumentError("bad digest length","digest",digest)}if(keyBuffer[56]>127){const prefix=keyBuffer.slice(0,57);prefix[0]&=252;prefix[55]|=128;prefix[56]=0;const scalar=prefix.slice(0,56);const bufferDigest=buffer.Buffer.from(digestBuffer);const bufferPrfx=buffer.Buffer.from(prefix);const bufferScalar=buffer.Buffer.from(scalar);const sig=ed448.signWithScalar(bufferDigest,bufferScalar,bufferPrfx);const hexlified=hexlify(sig);return hexConcat([hexlified,this.publicKey])}const sig=ed448.sign(buffer.Buffer.from(digestBuffer),buffer.Buffer.from(keyBuffer));const hexlified=hexlify(sig);return hexConcat([hexlified,this.publicKey])}computeSharedSecret(other){const pubKey=SigningKey.computePublicKey(other);return hexlify(getSharedSecret(getBytesCopy(this.#privateKey),getBytes(pubKey)))}static computePublicKey(key,compressed){const bytes=buffer.Buffer.from(arrayify(key));if(bytes.length!==57){logger$2.throwArgumentError("invalid private key","key","[REDACTED]")}if(bytes[56]>127){const scalar=bytes.slice(0,56);scalar[0]&=252;scalar[55]|=128;const pub=ed448.publicKeyFromScalar(scalar);return hexlify(pub)}const pub=ed448.publicKeyCreate(bytes);return hexlify(pub)}static recoverPublicKey(digest,signature){assertArgument(dataLength(digest)===32,"invalid digest length","digest",digest);const digestBuffer=buffer.Buffer.from(arrayify(digest));const sigBuffer=buffer.Buffer.from(arrayify(signature));if(sigBuffer.length!==171){logger$2.throwArgumentError("invalid signature","signature",signature)}const sig=sigBuffer.slice(0,114);const pub=sigBuffer.slice(114);if(ed448.verify(digestBuffer,sig,pub)){return hexlify(pub)}logger$2.throwArgumentError("invalid signature","signature",signature);return""}static addPoints(p0,p1,compressed){const pub0=Point.fromHex(SigningKey.computePublicKey(p0).substring(2));const pub1=Point.fromHex(SigningKey.computePublicKey(p1).substring(2));return"0x"+pub0.add(pub1).toHex(!!compressed)}}const BN_0$6=BigInt(0);const BN_1$3=BigInt(1);const BN_2$1=BigInt(2);const BN_27=BigInt(27);const BN_28=BigInt(28);const BN_35=BigInt(35);const _guard$4={};class Signature{#r;#s;#v;#networkV;get r(){return this.#r}set r(value){assertArgument(dataLength(value)===32,"invalid r","value",value);this.#r=hexlify(value)}get s(){return this.#s}set s(_value){assertArgument(dataLength(_value)===32,"invalid s","value",_value);const value=hexlify(_value);assertArgument(parseInt(value.substring(0,3))<8,"non-canonical s","value",value);this.#s=value}get v(){return this.#v}set v(value){const v=getNumber(value,"value");assertArgument(v===27||v===28,"invalid v","v",value);this.#v=v}get networkV(){return this.#networkV}get legacynetworkId(){const v=this.networkV;if(v==null){return null}return Signature.getnetworkId(v)}get yParity(){return this.v===27?0:1}get yParityAndS(){const yParityAndS=getBytes(this.s);if(this.yParity){yParityAndS[0]|=128}return hexlify(yParityAndS)}get compactSerialized(){return concat([this.r,this.yParityAndS])}get serialized(){return concat([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(guard,r,s,v){assertPrivate(guard,_guard$4,"Signature");this.#r=r;this.#s=s;this.#v=v;this.#networkV=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const clone=new Signature(_guard$4,this.r,this.s,this.v);if(this.networkV){clone.#networkV=this.networkV}return clone}toJSON(){const networkV=this.networkV;return{_type:"signature",networkV:networkV!=null?networkV.toString():null,r:this.r,s:this.s,v:this.v}}static getnetworkId(v){const bv=getBigInt(v,"v");if(bv==BN_27||bv==BN_28){return BN_0$6}assertArgument(bv>=BN_35,"invalid EIP-155 v","v",v);return(bv-BN_35)/BN_2$1}static getnetworkIdV(networkId,v){return getBigInt(networkId)*BN_2$1+BigInt(35+v-27)}static getNormalizedV(v){const bv=getBigInt(v);if(bv===BN_0$6||bv===BN_27){return 27}if(bv===BN_1$3||bv===BN_28){return 28}assertArgument(bv>=BN_35,"invalid v","v",v);return bv&BN_1$3?27:28}}function lock(){computeHmac.lock();pbkdf2.lock();randomBytes.lock();ripemd160.lock();scrypt.lock();scryptSync.lock();sha256.lock();sha512.lock();randomBytes.lock()}function removeHexPrefix(val){return val.substring(0,2)==="0x"?val.substring(2):val}function publicToAddress(key,prefix){const val=hexDataSlice(sha256(key),12);const checksum=calculateCheckSum(val,prefix);return"0x"+prefix+checksum+removeHexPrefix(val)}function computeAddress(key,prefix){let pubkey;if(typeof key==="string"){pubkey=SigningKey.computePublicKey(key,false)}else{pubkey=key.publicKey}return publicToAddress(pubkey,prefix)}function recoverAddress(digest,signature,prefix){const publicKey=SigningKey.recoverPublicKey(arrayify(digest),signature);return publicToAddress(publicKey,prefix)}function extractPrefix(address){address=getAddress(address);return address.substring(2,4)}const WordSize=32;const Padding=new Uint8Array(WordSize);const passProperties$1=["then"];const _guard$3={};function throwError(name,error){const wrapped=new Error(`deferred error during ABI decoding triggered accessing ${name}`);wrapped.error=error;throw wrapped}class Result extends Array{#names;constructor(...args){const guard=args[0];let items=args[1];let names=(args[2]||[]).slice();let wrap=true;if(guard!==_guard$3){items=args;names=[];wrap=false}super(items.length);items.forEach((item,index)=>{this[index]=item});const nameCounts=names.reduce((accum,name)=>{if(typeof name==="string"){accum.set(name,(accum.get(name)||0)+1)}return accum},new Map);this.#names=Object.freeze(items.map((item,index)=>{const name=names[index];if(name!=null&&nameCounts.get(name)===1){return name}return null}));if(!wrap){return}Object.freeze(this);return new Proxy(this,{get:(target,prop,receiver)=>{if(typeof prop==="string"){if(prop.match(/^[0-9]+$/)){const index=getNumber(prop,"%index");if(index<0||index>=this.length){throw new RangeError("out of result range")}const item=target[index];if(item instanceof Error){throwError(`index ${index}`,item)}return item}if(passProperties$1.indexOf(prop)>=0){return Reflect.get(target,prop,receiver)}const value=target[prop];if(value instanceof Function){return function(...args){return value.apply(this===receiver?target:this,args)}}else if(!(prop in target)){return target.getValue.apply(this===receiver?target:this,[prop])}}return Reflect.get(target,prop,receiver)}})}toArray(){const result=[];this.forEach((item,index)=>{if(item instanceof Error){throwError(`index ${index}`,item)}result.push(item)});return result}toObject(){return this.#names.reduce((accum,name,index)=>{assert(name!=null,"value at index ${ index } unnamed","UNSUPPORTED_OPERATION",{operation:"toObject()"});if(!(name in accum)){accum[name]=this.getValue(name)}return accum},{})}slice(start,end){if(start==null){start=0}if(start<0){start+=this.length;if(start<0){start=0}}if(end==null){end=this.length}if(end<0){end+=this.length;if(end<0){end=0}}if(end>this.length){end=this.length}const result=[],names=[];for(let i=start;i{this.#data[offset]=getValue$1(value)}}}class Reader{allowLoose;#data;#offset;constructor(data,allowLoose){defineProperties(this,{allowLoose:!!allowLoose});this.#data=getBytesCopy(data);this.#offset=0}get data(){return hexlify(this.#data)}get dataLength(){return this.#data.length}get consumed(){return this.#offset}get bytes(){return new Uint8Array(this.#data)}#peekBytes(offset,length,loose){let alignedLength=Math.ceil(length/WordSize)*WordSize;if(this.#offset+alignedLength>this.#data.length){if(this.allowLoose&&loose&&this.#offset+length<=this.#data.length){alignedLength=length}else{assert(false,"data out-of-bounds","BUFFER_OVERRUN",{buffer:getBytesCopy(this.#data),length:this.#data.length,offset:this.#offset+alignedLength})}}return this.#data.slice(this.#offset,this.#offset+alignedLength)}subReader(offset){return new Reader(this.#data.slice(this.#offset+offset),this.allowLoose)}readBytes(length,loose){let bytes=this.#peekBytes(0,length,!!loose);this.#offset+=bytes.length;return bytes.slice(0,length)}readValue(){return toBigInt(this.readBytes(WordSize))}readIndex(){return toNumber(this.readBytes(WordSize))}}const _gaurd={};function n(value,width){let signed=false;if(width<0){signed=true;width*=-1}return new Typed(_gaurd,`${signed?"":"u"}int${width}`,value,{signed:signed,width:width})}function b(value,size){return new Typed(_gaurd,`bytes${size?size:""}`,value,{size:size})}const _typedSymbol=Symbol.for("_corebc_typed");class Typed{type;value;#options;_typedSymbol;constructor(gaurd,type,value,options){if(options==null){options=null}assertPrivate(_gaurd,gaurd,"Typed");defineProperties(this,{_typedSymbol:_typedSymbol,type:type,value:value});this.#options=options;this.format()}format(){if(this.type==="array"){throw new Error("")}else if(this.type==="dynamicArray"){throw new Error("")}else if(this.type==="tuple"){return`tuple(${this.value.map(v=>v.format()).join(",")})`}return this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple"){throw TypeError("not a tuple")}return this.#options}get arrayLength(){if(this.type!=="array"){throw TypeError("not an array")}if(this.#options===true){return-1}if(this.#options===false){return this.value.length}return null}static from(type,value){return new Typed(_gaurd,type,value)}static uint8(v){return n(v,8)}static uint16(v){return n(v,16)}static uint24(v){return n(v,24)}static uint32(v){return n(v,32)}static uint40(v){return n(v,40)}static uint48(v){return n(v,48)}static uint56(v){return n(v,56)}static uint64(v){return n(v,64)}static uint72(v){return n(v,72)}static uint80(v){return n(v,80)}static uint88(v){return n(v,88)}static uint96(v){return n(v,96)}static uint104(v){return n(v,104)}static uint112(v){return n(v,112)}static uint120(v){return n(v,120)}static uint128(v){return n(v,128)}static uint136(v){return n(v,136)}static uint144(v){return n(v,144)}static uint152(v){return n(v,152)}static uint160(v){return n(v,160)}static uint168(v){return n(v,168)}static uint176(v){return n(v,176)}static uint184(v){return n(v,184)}static uint192(v){return n(v,192)}static uint200(v){return n(v,200)}static uint208(v){return n(v,208)}static uint216(v){return n(v,216)}static uint224(v){return n(v,224)}static uint232(v){return n(v,232)}static uint240(v){return n(v,240)}static uint248(v){return n(v,248)}static uint256(v){return n(v,256)}static uint(v){return n(v,256)}static int8(v){return n(v,-8)}static int16(v){return n(v,-16)}static int24(v){return n(v,-24)}static int32(v){return n(v,-32)}static int40(v){return n(v,-40)}static int48(v){return n(v,-48)}static int56(v){return n(v,-56)}static int64(v){return n(v,-64)}static int72(v){return n(v,-72)}static int80(v){return n(v,-80)}static int88(v){return n(v,-88)}static int96(v){return n(v,-96)}static int104(v){return n(v,-104)}static int112(v){return n(v,-112)}static int120(v){return n(v,-120)}static int128(v){return n(v,-128)}static int136(v){return n(v,-136)}static int144(v){return n(v,-144)}static int152(v){return n(v,-152)}static int160(v){return n(v,-160)}static int168(v){return n(v,-168)}static int176(v){return n(v,-176)}static int184(v){return n(v,-184)}static int192(v){return n(v,-192)}static int200(v){return n(v,-200)}static int208(v){return n(v,-208)}static int216(v){return n(v,-216)}static int224(v){return n(v,-224)}static int232(v){return n(v,-232)}static int240(v){return n(v,-240)}static int248(v){return n(v,-248)}static int256(v){return n(v,-256)}static int(v){return n(v,-256)}static bytes1(v){return b(v,1)}static bytes2(v){return b(v,2)}static bytes3(v){return b(v,3)}static bytes4(v){return b(v,4)}static bytes5(v){return b(v,5)}static bytes6(v){return b(v,6)}static bytes7(v){return b(v,7)}static bytes8(v){return b(v,8)}static bytes9(v){return b(v,9)}static bytes10(v){return b(v,10)}static bytes11(v){return b(v,11)}static bytes12(v){return b(v,12)}static bytes13(v){return b(v,13)}static bytes14(v){return b(v,14)}static bytes15(v){return b(v,15)}static bytes16(v){return b(v,16)}static bytes17(v){return b(v,17)}static bytes18(v){return b(v,18)}static bytes19(v){return b(v,19)}static bytes20(v){return b(v,20)}static bytes21(v){return b(v,21)}static bytes22(v){return b(v,22)}static bytes23(v){return b(v,23)}static bytes24(v){return b(v,24)}static bytes25(v){return b(v,25)}static bytes26(v){return b(v,26)}static bytes27(v){return b(v,27)}static bytes28(v){return b(v,28)}static bytes29(v){return b(v,29)}static bytes30(v){return b(v,30)}static bytes31(v){return b(v,31)}static bytes32(v){return b(v,32)}static address(v){return new Typed(_gaurd,"address",v)}static bool(v){return new Typed(_gaurd,"bool",!!v)}static bytes(v){return new Typed(_gaurd,"bytes",v)}static string(v){return new Typed(_gaurd,"string",v)}static array(v,dynamic){throw new Error("not implemented yet")}static tuple(v,name){throw new Error("not implemented yet")}static overrides(v){return new Typed(_gaurd,"overrides",Object.assign({},v))}static isTyped(value){return value&&value._typedSymbol===_typedSymbol}static dereference(value,type){if(Typed.isTyped(value)){if(value.type!==type){throw new Error(`invalid type: expecetd ${type}, got ${value.type}`)}return value.value}return value}}class AddressCoder extends Coder{constructor(localName){super("address","address",localName,false)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(writer,_value){let value=Typed.dereference(_value,"string");try{value=getAddress(value)}catch(error){return this._throwError(error.message,_value)}return writer.writeValue(value)}decode(reader){return getAddress(toBeHex(reader.readValue(),22))}}class AnonymousCoder extends Coder{coder;constructor(coder){super(coder.name,coder.type,"_",coder.dynamic);this.coder=coder}defaultValue(){return this.coder.defaultValue()}encode(writer,value){return this.coder.encode(writer,value)}decode(reader){return this.coder.decode(reader)}}function pack(writer,coders,values){let arrayValues=[];if(Array.isArray(values)){arrayValues=values}else if(values&&typeof values==="object"){let unique={};arrayValues=coders.map(coder=>{const name=coder.localName;assert(name,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:coder},value:values});assert(!unique[name],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:coder},value:values});unique[name]=true;return values[name]})}else{assertArgument(false,"invalid tuple value","tuple",values)}assertArgument(coders.length===arrayValues.length,"types/value length mismatch","tuple",values);let staticWriter=new Writer;let dynamicWriter=new Writer;let updateFuncs=[];coders.forEach((coder,index)=>{let value=arrayValues[index];if(coder.dynamic){let dynamicOffset=dynamicWriter.length;coder.encode(dynamicWriter,value);let updateFunc=staticWriter.writeUpdatableValue();updateFuncs.push(baseOffset=>{updateFunc(baseOffset+dynamicOffset)})}else{coder.encode(staticWriter,value)}});updateFuncs.forEach(func=>{func(staticWriter.length)});let length=writer.appendWriter(staticWriter);length+=writer.appendWriter(dynamicWriter);return length}function unpack(reader,coders){let values=[];let keys=[];let baseReader=reader.subReader(0);coders.forEach(coder=>{let value=null;if(coder.dynamic){let offset=reader.readIndex();let offsetReader=baseReader.subReader(offset);try{value=coder.decode(offsetReader)}catch(error){if(isError(error,"BUFFER_OVERRUN")){throw error}value=error;value.baseType=coder.name;value.name=coder.localName;value.type=coder.type}}else{try{value=coder.decode(reader)}catch(error){if(isError(error,"BUFFER_OVERRUN")){throw error}value=error;value.baseType=coder.name;value.name=coder.localName;value.type=coder.type}}if(value==undefined){throw new Error("investigate")}values.push(value);keys.push(coder.localName||null)});return Result.fromItems(values,keys)}class ArrayCoder extends Coder{coder;length;constructor(coder,length,localName){const type=coder.type+"["+(length>=0?length:"")+"]";const dynamic=length===-1||coder.dynamic;super("array",type,localName,dynamic);defineProperties(this,{coder:coder,length:length})}defaultValue(){const defaultChild=this.coder.defaultValue();const result=[];for(let i=0;ibounds||value<-(bounds+BN_1$2)){this._throwError("value out-of-bounds",_value)}value=toTwos(value,8*WordSize)}else if(valuemask(maxUintValue,this.size*8)){this._throwError("value out-of-bounds",_value)}return writer.writeValue(value)}decode(reader){let value=mask(reader.readValue(),this.size*8);if(this.signed){value=fromTwos(value,this.size*8)}return value}}class StringCoder extends DynamicBytesCoder{constructor(localName){super("string",localName)}defaultValue(){return""}encode(writer,_value){return super.encode(writer,toUtf8Bytes(Typed.dereference(_value,"string")))}decode(reader){return toUtf8String(super.decode(reader))}}class TupleCoder extends Coder{coders;constructor(coders,localName){let dynamic=false;const types=[];coders.forEach(coder=>{if(coder.dynamic){dynamic=true}types.push(coder.type)});const type="tuple("+types.join(",")+")";super("tuple",type,localName,dynamic);defineProperties(this,{coders:Object.freeze(coders.slice())})}defaultValue(){const values=[];this.coders.forEach(coder=>{values.push(coder.defaultValue())});const uniqueNames=this.coders.reduce((accum,coder)=>{const name=coder.localName;if(name){if(!accum[name]){accum[name]=0}accum[name]++}return accum},{});this.coders.forEach((coder,index)=>{let name=coder.localName;if(!name||uniqueNames[name]!==1){return}if(name==="length"){name="_length"}if(values[name]!=null){return}values[name]=values[index]});return Object.freeze(values)}encode(writer,_value){const value=Typed.dereference(_value,"tuple");return pack(writer,this.coders,value)}decode(reader){return unpack(reader,this.coders)}}function id(value,useKeccak){if(useKeccak){return keccak256(toUtf8Bytes(value))}return sha256(toUtf8Bytes(value))}const ZeroAddress="0x0000000000000000000000000000000000000000";const ZeroHash="0x0000000000000000000000000000000000000000000000000000000000000000";const N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");const OrePerXCB=BigInt("1000000000000000000");const MaxUint256=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const MinInt256=BigInt("0x8000000000000000000000000000000000000000000000000000000000000000")*BigInt(-1);const MaxInt256=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const CoreSymbol="Ξ";const MessagePrefix="Core Signed Message:\n";function accessSetify(addr,storageKeys){return{address:getAddress(addr),storageKeys:storageKeys.map((storageKey,index)=>{assertArgument(isHexString(storageKey,32),"invalid slot",`storageKeys[${index}]`,storageKey);return storageKey.toLowerCase()})}}function accessListify(value){if(Array.isArray(value)){return value.map((set,index)=>{if(Array.isArray(set)){assertArgument(set.length===2,"invalid slot set",`value[${index}]`,set);return accessSetify(set[0],set[1])}assertArgument(set!=null&&typeof set==="object","invalid address-slot set","value",value);return accessSetify(set.address,set.storageKeys)})}assertArgument(value!=null&&typeof value==="object","invalid access list","value",value);const result=Object.keys(value).map(addr=>{const storageKeys=value[addr].reduce((accum,storageKey)=>{accum[storageKey]=true;return accum},{});return accessSetify(addr,Object.keys(storageKeys).sort())});result.sort((a,b)=>a.address.localeCompare(b.address));return result}const logger$1=new Logger("transaction/0.0.1");const BN_0$4=BigInt(0);function handleAddress(value){if(value==="0x"){return null}return getAddress(value)}function parse(data){const handleNumber=value=>{if(value==="0x"){return BigNumber.from(0)}return BigNumber.from(value)};const transaction=decode$1(data);if(transaction.length!==7&&transaction.length!==8){logger$1.throwArgumentError("invalid raw transaction","data",data)}const isSigned=transaction.length===8;const tx={nonce:Number(handleNumber(transaction[0])),energyPrice:handleNumber(transaction[1]).toBigInt(),energyLimit:handleNumber(transaction[2]).toBigInt(),networkId:handleNumber(transaction[isSigned?3:6]).toBigInt(),to:handleAddress(transaction[isSigned?4:3]),value:handleNumber(transaction[isSigned?5:4]).toBigInt(),data:transaction[isSigned?6:5]};if(transaction.length===8){const prefix=networkIdToPrefix(Number(tx.networkId));const digest=sha256(serialize(tx));tx.hash=sha256(serialize(tx,transaction[7]));tx.from=recoverAddress(digest,transaction[7],prefix);tx.signature=transaction[7]}return tx}const unsignedTransactionFields=[{name:"nonce",maxLength:32,numeric:true},{name:"energyPrice",maxLength:32,numeric:true},{name:"energyLimit",maxLength:32,numeric:true},{name:"to",length:22},{name:"value",maxLength:32,numeric:true},{name:"data"},{name:"networkId",maxLength:32,numeric:true}];const transactionFields=[{name:"nonce",maxLength:32,numeric:true},{name:"energyPrice",maxLength:32,numeric:true},{name:"energyLimit",maxLength:32,numeric:true},{name:"networkId",maxLength:32,numeric:true},{name:"to",length:22},{name:"value",maxLength:32,numeric:true},{name:"data"}];const allowedTransactionKeys={networkId:true,data:true,energyLimit:true,energyPrice:true,nonce:true,to:true,value:true};function serialize(transaction,signature){checkProperties(transaction,allowedTransactionKeys);const raw=[];(!!signature?transactionFields:unsignedTransactionFields).forEach(function({numeric,maxLength,name,length}){let value=transaction[name]||[];const options={};if(numeric){options.hexPad="left"}const tmpHexlified=hexlify(value,options);value=arrayify(tmpHexlified);if(length&&value.length!==length&&value.length>0){logger$1.throwArgumentError("invalid length for "+name,"transaction:"+name,value)}if(maxLength){value=stripZeros(value);if(value.length>maxLength){logger$1.throwArgumentError("invalid length for "+name,"transaction:"+name,value)}}const hexlified=hexlify(value);raw.push(hexlified)});if(!!signature){raw.push(hexlify(signature))}const finalValue=encode(raw);return finalValue}class Transaction{#to;#data;#nonce;#energyLimit;#energyPrice;#value;#networkId;#sig;get to(){return this.#to}set to(value){this.#to=value==null?null:getAddress(value)}get nonce(){return this.#nonce}set nonce(value){this.#nonce=getNumber(value,"value")}get energyLimit(){return this.#energyLimit}set energyLimit(value){this.#energyLimit=getBigInt(value)}get energyPrice(){const value=this.#energyPrice;if(value==null){return BN_0$4}return value}set energyPrice(value){this.#energyPrice=value==null?null:getBigInt(value,"energyPrice")}get data(){return this.#data}set data(value){this.#data=hexlify(value)}get value(){return this.#value}set value(value){this.#value=getBigInt(value,"value")}get networkId(){return this.#networkId}set networkId(value){this.#networkId=getBigInt(value)}get signature(){return this.#sig||null}set signature(value){this.#sig=value==null?null:value}constructor(){this.#to=null;this.#nonce=0;this.#energyLimit=BigInt(0);this.#energyPrice=null;this.#data="0x";this.#value=BigInt(0);this.#networkId=BigInt(0);this.#sig=null}get hash(){if(this.signature==null){return null}return sha256(this.serialized)}get unsignedHash(){return sha256(this.unsignedSerialized)}get from(){if(this.signature==null){return null}const prefix=networkIdToPrefix(Number(this.#networkId));return recoverAddress(this.unsignedHash,this.signature,prefix)}get fromPublicKey(){if(this.signature==null){return null}return SigningKey.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){assert(this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});return serialize(this,this.signature)}get unsignedSerialized(){return serialize(this)}clone(){return Transaction.from(this)}toJSON(){const s=v=>{if(v==null){return null}return v.toString()};return{to:this.to,data:this.data,nonce:this.nonce,energyLimit:s(this.energyLimit),energyPrice:s(this.energyPrice),value:s(this.value),networkId:s(this.networkId),sig:this.signature?this.signature:null}}static from(tx){if(tx==null){return new Transaction}if(typeof tx==="string"){const payload=getBytes(tx);return Transaction.from(parse(payload))}const result=new Transaction;if(tx.to!=null){result.to=tx.to}if(tx.nonce!=null){result.nonce=tx.nonce}if(tx.energyLimit!=null){result.energyLimit=tx.energyLimit}if(tx.energyPrice!=null){result.energyPrice=tx.energyPrice}if(tx.data!=null){result.data=tx.data}if(tx.value!=null){result.value=tx.value}if(tx.networkId!=null){result.networkId=tx.networkId}if(tx.signature!=null){result.signature=tx.signature}if(tx.hash!=null){assertArgument(result.isSigned(),"unsigned transaction cannot define hash","tx",tx);assertArgument(result.hash===tx.hash,"hash mismatch","tx",tx)}if(tx.from!=null){assertArgument(result.isSigned(),"unsigned transaction cannot define from","tx",tx);assertArgument(result.from.toLowerCase()===(tx.from||"").toLowerCase(),"from mismatch","tx",tx)}return result}}function hashMessage(message){if(typeof message==="string"){message=toUtf8Bytes(message)}return sha256(concat([toUtf8Bytes(MessagePrefix),toUtf8Bytes(String(message.length)),message]))}function verifyMessage(message,sig,prefix){const digest=hashMessage(message);return recoverAddress(digest,sig,prefix)}const regexBytes=new RegExp("^bytes([0-9]+)$");const regexNumber=new RegExp("^(u?int)([0-9]*)$");const regexArray=new RegExp("^(.*)\\[([0-9]*)\\]$");function _pack(type,value,isArray){switch(type){case"address":if(isArray){return getBytes(zeroPadValue(value,32))}return getBytes(getAddress(value));case"string":return toUtf8Bytes(value);case"bytes":return getBytes(value);case"bool":value=!!value?"0x01":"0x00";if(isArray){return getBytes(zeroPadValue(value,32))}return getBytes(value)}let match=type.match(regexNumber);if(match){let signed=match[1]==="int";let size=parseInt(match[2]||"256");assertArgument((!match[2]||match[2]===String(size))&&size%8===0&&size!==0&&size<=256,"invalid number type","type",type);if(isArray){size=256}if(signed){value=toTwos(value,size)}return getBytes(zeroPadValue(toBeArray(value),size/8))}match=type.match(regexBytes);if(match){const size=parseInt(match[1]);assertArgument(String(size)===match[1]&&size!==0&&size<=32,"invalid bytes type","type",type);assertArgument(dataLength(value)===size,`invalid value for ${type}`,"value",value);if(isArray){return getBytes(zeroPadBytes(value,32))}return value}match=type.match(regexArray);if(match&&Array.isArray(value)){const baseType=match[1];const count=parseInt(match[2]||String(value.length));assertArgument(count===value.length,`invalid array length for ${type}`,"value",value);const result=[];value.forEach(function(value){result.push(_pack(baseType,value,true))});return getBytes(concat(result))}assertArgument(false,"invalid type","type",type)}function solidityPacked(types,values){assertArgument(types.length===values.length,"wrong number of values; expected ${ types.length }","values",values);const tight=[];types.forEach(function(type,index){tight.push(_pack(type,values[index]))});return hexlify(concat(tight))}function solidityPackedSha256(types,values){return sha256(solidityPacked(types,values))}const padding=new Uint8Array(32);padding.fill(0);const BN__1=BigInt(-1);const BN_0$3=BigInt(0);const BN_1$1=BigInt(1);const BN_MAX_UINT256=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function hexPadRight(value){const bytes=getBytes(value);const padOffset=bytes.length%32;if(padOffset){return concat([bytes,padding.slice(padOffset)])}return hexlify(bytes)}const hexTrue=toBeHex(BN_1$1,32);const hexFalse=toBeHex(BN_0$3,32);const domainFieldTypes={name:"string",version:"string",networkId:"uint256",verifyingContract:"address",salt:"bytes32"};const domainFieldNames=["name","version","networkId","verifyingContract","salt"];function checkString(key){return function(value){assertArgument(typeof value==="string",`invalid domain value for ${JSON.stringify(key)}`,`domain.${key}`,value);return value}}const domainChecks={name:checkString("name"),version:checkString("version"),networkId:function(_value){const value=getBigInt(_value,"domain.networkId");assertArgument(value>=0,"invalid chain ID","domain.networkId",_value);if(Number.isSafeInteger(value)){return Number(value)}return toQuantity(value)},verifyingContract:function(value){try{return getAddress(value).toLowerCase()}catch(error){}assertArgument(false,`invalid domain value "verifyingContract"`,"domain.verifyingContract",value)},salt:function(value){const bytes=getBytes(value,"domain.salt");assertArgument(bytes.length===32,`invalid domain value "salt"`,"domain.salt",value);return hexlify(bytes)}};function getBaseEncoder(type){{const match=type.match(/^(u?)int(\d*)$/);if(match){const signed=match[1]==="";const width=parseInt(match[2]||"256");assertArgument(width%8===0&&width!==0&&width<=256&&(match[2]==null||match[2]===String(width)),"invalid numeric width","type",type);const boundsUpper=mask(BN_MAX_UINT256,signed?width-1:width);const boundsLower=signed?(boundsUpper+BN_1$1)*BN__1:BN_0$3;return function(_value){const value=getBigInt(_value,"value");assertArgument(value>=boundsLower&&value<=boundsUpper,`value out-of-bounds for ${type}`,"value",value);return toBeHex(signed?toTwos(value,256):value,32)}}}{const match=type.match(/^bytes(\d+)$/);if(match){const width=parseInt(match[1]);assertArgument(width!==0&&width<=32&&match[1]===String(width),"invalid bytes width","type",type);return function(value){const bytes=getBytes(value);assertArgument(bytes.length===width,`invalid length for ${type}`,"value",value);return hexPadRight(value)}}}switch(type){case"address":return function(value){return zeroPadValue(getAddress(value),32)};case"bool":return function(value){return!value?hexFalse:hexTrue};case"bytes":return function(value){return sha256(value)};case"string":return function(value){return id(value)}}return null}function encodeType(name,fields){return`${name}(${fields.map(({name,type})=>type+" "+name).join(",")})`}class TypedDataEncoder{primaryType;#types;get types(){return JSON.parse(this.#types)}#fullTypes;#encoderCache;constructor(types){this.#types=JSON.stringify(types);this.#fullTypes=new Map;this.#encoderCache=new Map;const links=new Map;const parents=new Map;const subtypes=new Map;Object.keys(types).forEach(type=>{links.set(type,new Set);parents.set(type,[]);subtypes.set(type,new Set)});for(const name in types){const uniqueNames=new Set;for(const field of types[name]){assertArgument(!uniqueNames.has(field.name),`duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`,"types",types);uniqueNames.add(field.name);const baseType=field.type.match(/^([^\x5b]*)(\x5b|$)/)[1]||null;assertArgument(baseType!==name,`circular type reference to ${JSON.stringify(baseType)}`,"types",types);const encoder=getBaseEncoder(baseType);if(encoder){continue}assertArgument(parents.has(baseType),`unknown type ${JSON.stringify(baseType)}`,"types",types);parents.get(baseType).push(name);links.get(name).add(baseType)}}const primaryTypes=Array.from(parents.keys()).filter(n=>parents.get(n).length===0);assertArgument(primaryTypes.length!==0,"missing primary type","types",types);assertArgument(primaryTypes.length===1,`ambiguous primary types or unused types: ${primaryTypes.map(t=>JSON.stringify(t)).join(", ")}`,"types",types);defineProperties(this,{primaryType:primaryTypes[0]});function checkCircular(type,found){assertArgument(!found.has(type),`circular type reference to ${JSON.stringify(type)}`,"types",types);found.add(type);for(const child of links.get(type)){if(!parents.has(child)){continue}checkCircular(child,found);for(const subtype of found){subtypes.get(subtype).add(child)}}found.delete(type)}checkCircular(this.primaryType,new Set);for(const[name,set]of subtypes){const st=Array.from(set);st.sort();this.#fullTypes.set(name,encodeType(name,types[name])+st.map(t=>encodeType(t,types[t])).join(""))}}getEncoder(type){let encoder=this.#encoderCache.get(type);if(!encoder){encoder=this.#getEncoder(type);this.#encoderCache.set(type,encoder)}return encoder}#getEncoder(type){{const encoder=getBaseEncoder(type);if(encoder){return encoder}}const match=type.match(/^(.*)(\x5b(\d*)\x5d)$/);if(match){const subtype=match[1];const subEncoder=this.getEncoder(subtype);return value=>{assertArgument(!match[3]||parseInt(match[3])===value.length,`array length mismatch; expected length ${parseInt(match[3])}`,"value",value);let result=value.map(subEncoder);if(this.#fullTypes.has(subtype)){result=result.map(sha256)}return sha256(concat(result))}}const fields=this.types[type];if(fields){const encodedType=id(this.#fullTypes.get(type));return value=>{const values=fields.map(({name,type})=>{const result=this.getEncoder(type)(value[name]);if(this.#fullTypes.has(type)){return sha256(result)}return result});values.unshift(encodedType);return concat(values)}}assertArgument(false,`unknown type: ${type}`,"type",type)}encodeType(name){const result=this.#fullTypes.get(name);assertArgument(result,`unknown type: ${JSON.stringify(name)}`,"name",name);return result}encodeData(type,value){return this.getEncoder(type)(value)}hashStruct(name,value){return sha256(this.encodeData(name,value))}encode(value){return this.encodeData(this.primaryType,value)}hash(value){return this.hashStruct(this.primaryType,value)}_visit(type,value,callback){{const encoder=getBaseEncoder(type);if(encoder){return callback(type,value)}}const match=type.match(/^(.*)(\x5b(\d*)\x5d)$/);if(match){assertArgument(!match[3]||parseInt(match[3])===value.length,`array length mismatch; expected length ${parseInt(match[3])}`,"value",value);return value.map(v=>this._visit(match[1],v,callback))}const fields=this.types[type];if(fields){return fields.reduce((accum,{name,type})=>{accum[name]=this._visit(type,value[name],callback);return accum},{})}assertArgument(false,`unknown type: ${type}`,"type",type)}visit(value,callback){return this._visit(this.primaryType,value,callback)}static from(types){return new TypedDataEncoder(types)}static getPrimaryType(types){return TypedDataEncoder.from(types).primaryType}static hashStruct(name,types,value){return TypedDataEncoder.from(types).hashStruct(name,value)}static hashDomain(domain){const domainFields=[];for(const name in domain){if(domain[name]==null){continue}const type=domainFieldTypes[name];assertArgument(type,`invalid typed-data domain key: ${JSON.stringify(name)}`,"domain",domain);domainFields.push({name:name,type:type})}domainFields.sort((a,b)=>{return domainFieldNames.indexOf(a.name)-domainFieldNames.indexOf(b.name)});return TypedDataEncoder.hashStruct("EIP712Domain",{EIP712Domain:domainFields},domain)}static encode(domain,types,value){return concat(["0x1901",TypedDataEncoder.hashDomain(domain),TypedDataEncoder.from(types).hash(value)])}static hash(domain,types,value){return sha256(TypedDataEncoder.encode(domain,types,value))}static async resolveNames(domain,types,value,resolveName){domain=Object.assign({},domain);for(const key in domain){if(domain[key]==null){delete domain[key]}}const ensCache={};if(domain.verifyingContract&&!isHexString(domain.verifyingContract,20)){ensCache[domain.verifyingContract]="0x"}const encoder=TypedDataEncoder.from(types);encoder.visit(value,(type,value)=>{if(type==="address"&&!isHexString(value,20)){ensCache[value]="0x"}return value});for(const name in ensCache){ensCache[name]=await resolveName(name)}if(domain.verifyingContract&&ensCache[domain.verifyingContract]){domain.verifyingContract=ensCache[domain.verifyingContract]}value=encoder.visit(value,(type,value)=>{if(type==="address"&&ensCache[value]){return ensCache[value]}return value});return{domain:domain,value:value}}static getPayload(domain,types,value){TypedDataEncoder.hashDomain(domain);const domainValues={};const domainTypes=[];domainFieldNames.forEach(name=>{const value=domain[name];if(value==null){return}domainValues[name]=domainChecks[name](value);domainTypes.push({name:name,type:domainFieldTypes[name]})});const encoder=TypedDataEncoder.from(types);const typesWithDomain=Object.assign({},types);assertArgument(typesWithDomain.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",types);typesWithDomain.EIP712Domain=domainTypes;encoder.encode(value);return{types:typesWithDomain,domain:domainValues,primaryType:encoder.primaryType,message:encoder.visit(value,(type,value)=>{if(type.match(/^bytes(\d*)/)){return hexlify(getBytes(value))}if(type.match(/^u?int/)){return getBigInt(value).toString()}switch(type){case"address":return value.toLowerCase();case"bool":return!!value;case"string":assertArgument(typeof value==="string","invalid string","value",value);return value}assertArgument(false,"unsupported type","type",type)})}}}function verifyTypedData(domain,types,value,signature,prefix){return recoverAddress(TypedDataEncoder.hash(domain,types,value),signature,prefix)}var _a;function setify(items){const result=new Set;items.forEach(k=>result.add(k));return Object.freeze(result)}const _kwVisib="constant external internal payable private public pure view";const KwVisib=setify(_kwVisib.split(" "));const _kwTypes="constructor error event fallback function receive struct";const KwTypes=setify(_kwTypes.split(" "));const _kwModifiers="calldata memory storage payable indexed";const KwModifiers=setify(_kwModifiers.split(" "));const _kwOther="tuple returns";const _keywords=[_kwTypes,_kwModifiers,_kwOther,_kwVisib].join(" ");const Keywords=setify(_keywords.split(" "));const SimpleTokens={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"};const regexWhitespacePrefix=new RegExp("^(\\s*)");const regexNumberPrefix=new RegExp("^([0-9]+)");const regexIdPrefix=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)");const regexId=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$");const regexType=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class TokenString{#offset;#tokens;get offset(){return this.#offset}get length(){return this.#tokens.length-this.#offset}constructor(tokens){this.#offset=0;this.#tokens=tokens.slice()}clone(){return new _a(this.#tokens)}reset(){this.#offset=0}#subTokenString(from=0,to=0){return new _a(this.#tokens.slice(from,to).map(t=>{return Object.freeze(Object.assign({},t,{match:t.match-from,linkBack:t.linkBack-from,linkNext:t.linkNext-from}))}))}popKeyword(allowed){const top=this.peek();if(top.type!=="KEYWORD"||!allowed.has(top.text)){throw new Error(`expected keyword ${top.text}`)}return this.pop().text}popType(type){if(this.peek().type!==type){throw new Error(`expected ${type}; got ${JSON.stringify(this.peek())}`)}return this.pop().text}popParen(){const top=this.peek();if(top.type!=="OPEN_PAREN"){throw new Error("bad start")}const result=this.#subTokenString(this.#offset+1,top.match+1);this.#offset=top.match+1;return result}popParams(){const top=this.peek();if(top.type!=="OPEN_PAREN"){throw new Error("bad start")}const result=[];while(this.#offset=this.#tokens.length){throw new Error("out-of-bounds")}return this.#tokens[this.#offset]}peekKeyword(allowed){const top=this.peekType("KEYWORD");return top!=null&&allowed.has(top)?top:null}peekType(type){if(this.length===0){return null}const top=this.peek();return top.type===type?top.text:null}pop(){const result=this.peek();this.#offset++;return result}toString(){const tokens=[];for(let i=this.#offset;i`}}_a=TokenString;function lex(text){const tokens=[];const throwError=message=>{const token=offset0&&tokens[tokens.length-1].type==="NUMBER"){const value=tokens.pop().text;suffix=value+suffix;tokens[tokens.length-1].value=getNumber(value)}if(tokens.length===0||tokens[tokens.length-1].type!=="BRACKET"){throw new Error("missing opening bracket")}tokens[tokens.length-1].text+=suffix}continue}match=cur.match(regexIdPrefix);if(match){token.text=match[1];offset+=token.text.length;if(Keywords.has(token.text)){token.type="KEYWORD";continue}if(token.text.match(regexType)){token.type="TYPE";continue}token.type="ID";continue}match=cur.match(regexNumberPrefix);if(match){token.text=match[1];token.type="NUMBER";offset+=token.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`)}return new TokenString(tokens.map(t=>Object.freeze(t)))}function allowSingle(set,allowed){let included=[];for(const key in allowed.keys()){if(set.has(key)){included.push(key)}}if(included.length>1){throw new Error(`conflicting types: ${included.join(", ")}`)}}function consumeName(type,tokens){if(tokens.peekKeyword(KwTypes)){const keyword=tokens.pop().text;if(keyword!==type){throw new Error(`expected ${type}, got ${keyword}`)}}return tokens.popType("ID")}function consumeKeywords(tokens,allowed){const keywords=new Set;while(true){const keyword=tokens.peekType("KEYWORD");if(keyword==null||allowed&&!allowed.has(keyword)){break}tokens.pop();if(keywords.has(keyword)){throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`)}keywords.add(keyword)}return Object.freeze(keywords)}function consumeMutability(tokens){let modifiers=consumeKeywords(tokens,KwVisib);allowSingle(modifiers,setify("constant payable nonpayable".split(" ")));allowSingle(modifiers,setify("pure view payable nonpayable".split(" ")));if(modifiers.has("view")){return"view"}if(modifiers.has("pure")){return"pure"}if(modifiers.has("payable")){return"payable"}if(modifiers.has("nonpayable")){return"nonpayable"}if(modifiers.has("constant")){return"view"}return"nonpayable"}function consumeParams(tokens,allowIndexed){return tokens.popParams().map(t=>ParamType.from(t,allowIndexed))}function consumeEnergy(tokens){if(tokens.peekType("AT")){tokens.pop();if(tokens.peekType("NUMBER")){return getBigInt(tokens.pop().text)}throw new Error("invalid energy")}return null}function consumeEoi(tokens){if(tokens.length){throw new Error(`unexpected tokens: ${tokens.toString()}`)}}const regexArrayType=new RegExp(/^(.*)\[([0-9]*)\]$/);function verifyBasicType(type){const match=type.match(regexType);assertArgument(match,"invalid type","type",type);if(type==="uint"){return"uint256"}if(type==="int"){return"int256"}if(match[2]){const length=parseInt(match[2]);assertArgument(length!==0&&length<=32,"invalid bytes length","type",type)}else if(match[3]){const size=parseInt(match[3]);assertArgument(size!==0&&size<=256&&size%8===0,"invalid numeric width","type",type)}return type}const _guard$2={};const internal$1=Symbol.for("_corebc_internal");const ParamTypeInternal="_ParamTypeInternal";const ErrorFragmentInternal="_ErrorInternal";const EventFragmentInternal="_EventInternal";const ConstructorFragmentInternal="_ConstructorInternal";const FallbackFragmentInternal="_FallbackInternal";const FunctionFragmentInternal="_FunctionInternal";const StructFragmentInternal="_StructInternal";class ParamType{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(guard,name,type,baseType,indexed,components,arrayLength,arrayChildren){assertPrivate(guard,_guard$2,"ParamType");Object.defineProperty(this,internal$1,{value:ParamTypeInternal});if(components){components=Object.freeze(components.slice())}if(baseType==="array"){if(arrayLength==null||arrayChildren==null){throw new Error("")}}else if(arrayLength!=null||arrayChildren!=null){throw new Error("")}if(baseType==="tuple"){if(components==null){throw new Error("")}}else if(components!=null){throw new Error("")}defineProperties(this,{name:name,type:type,baseType:baseType,indexed:indexed,components:components,arrayLength:arrayLength,arrayChildren:arrayChildren})}format(format){if(format==null){format="sighash"}if(format==="json"){let result={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||undefined};if(typeof this.indexed==="boolean"){result.indexed=this.indexed}if(this.isTuple()){result.components=this.components.map(c=>JSON.parse(c.format(format)))}return JSON.stringify(result)}let result="";if(this.isArray()){result+=this.arrayChildren.format(format);result+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`}else{if(this.isTuple()){if(format!=="sighash"){result+=this.type}result+="("+this.components.map(comp=>comp.format(format)).join(format==="full"?", ":",")+")"}else{result+=this.type}}if(format!=="sighash"){if(this.indexed===true){result+=" indexed"}if(format==="full"&&this.name){result+=" "+this.name}}return result}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(value,process){if(this.isArray()){if(!Array.isArray(value)){throw new Error("invalid array value")}if(this.arrayLength!==-1&&value.length!==this.arrayLength){throw new Error("array is wrong length")}const _this=this;return value.map(v=>_this.arrayChildren.walk(v,process))}if(this.isTuple()){if(!Array.isArray(value)){throw new Error("invalid tuple value")}if(value.length!==this.components.length){throw new Error("array is wrong length")}const _this=this;return value.map((v,i)=>_this.components[i].walk(v,process))}return process(this.type,value)}#walkAsync(promises,value,process,setValue){if(this.isArray()){if(!Array.isArray(value)){throw new Error("invalid array value")}if(this.arrayLength!==-1&&value.length!==this.arrayLength){throw new Error("array is wrong length")}const childType=this.arrayChildren;const result=value.slice();result.forEach((value,index)=>{childType.#walkAsync(promises,value,process,value=>{result[index]=value})});setValue(result);return}if(this.isTuple()){const components=this.components;let result;if(Array.isArray(value)){result=value.slice()}else{if(value==null||typeof value!=="object"){throw new Error("invalid tuple value")}result=components.map(param=>{if(!param.name){throw new Error("cannot use object value with unnamed components")}if(!(param.name in value)){throw new Error(`missing value for component ${param.name}`)}return value[param.name]})}if(result.length!==this.components.length){throw new Error("array is wrong length")}result.forEach((value,index)=>{components[index].#walkAsync(promises,value,process,value=>{result[index]=value})});setValue(result);return}const result=process(this.type,value);if(result.then){promises.push(async function(){setValue(await result)}())}else{setValue(result)}}async walkAsync(value,process){const promises=[];const result=[value];this.#walkAsync(promises,value,process,value=>{result[0]=value});if(promises.length){await Promise.all(promises)}return result[0]}static from(obj,allowIndexed){if(ParamType.isParamType(obj)){return obj}if(typeof obj==="string"){return ParamType.from(lex(obj),allowIndexed)}else if(obj instanceof TokenString){let type="",baseType="";let comps=null;if(consumeKeywords(obj,setify(["tuple"])).has("tuple")||obj.peekType("OPEN_PAREN")){baseType="tuple";comps=obj.popParams().map(t=>ParamType.from(t));type=`tuple(${comps.map(c=>c.format()).join(",")})`}else{type=verifyBasicType(obj.popType("TYPE"));baseType=type}let arrayChildren=null;let arrayLength=null;while(obj.length&&obj.peekType("BRACKET")){const bracket=obj.pop();arrayChildren=new ParamType(_guard$2,"",type,baseType,null,comps,arrayLength,arrayChildren);arrayLength=bracket.value;type+=bracket.text;baseType="array";comps=null}let indexed=null;const keywords=consumeKeywords(obj,KwModifiers);if(keywords.has("indexed")){if(!allowIndexed){throw new Error("")}indexed=true}const name=obj.peekType("ID")?obj.pop().text:"";if(obj.length){throw new Error("leftover tokens")}return new ParamType(_guard$2,name,type,baseType,indexed,comps,arrayLength,arrayChildren)}const name=obj.name;assertArgument(!name||typeof name==="string"&&name.match(regexId),"invalid name","obj.name",name);let indexed=obj.indexed;if(indexed!=null){assertArgument(allowIndexed,"parameter cannot be indexed","obj.indexed",obj.indexed);indexed=!!indexed}let type=obj.type;let arrayMatch=type.match(regexArrayType);if(arrayMatch){const arrayLength=parseInt(arrayMatch[2]||"-1");const arrayChildren=ParamType.from({type:arrayMatch[1],components:obj.components});return new ParamType(_guard$2,name||"",type,"array",indexed,null,arrayLength,arrayChildren)}if(type==="tuple"||type.startsWith("tuple(")||type.startsWith("(")){const comps=obj.components!=null?obj.components.map(c=>ParamType.from(c)):null;const tuple=new ParamType(_guard$2,name||"",type,"tuple",indexed,comps,null,null);return tuple}type=verifyBasicType(obj.type);return new ParamType(_guard$2,name||"",type,type,indexed,null,null,null)}static isParamType(value){return value&&value[internal$1]===ParamTypeInternal}}class Fragment{type;inputs;constructor(guard,type,inputs){assertPrivate(guard,_guard$2,"Fragment");inputs=Object.freeze(inputs.slice());defineProperties(this,{type:type,inputs:inputs})}static from(obj){if(typeof obj==="string"){try{Fragment.from(JSON.parse(obj))}catch(e){}return Fragment.from(lex(obj))}if(obj instanceof TokenString){const type=obj.peekKeyword(KwTypes);switch(type){case"constructor":return ConstructorFragment.from(obj);case"error":return ErrorFragment.from(obj);case"event":return EventFragment.from(obj);case"fallback":case"receive":return FallbackFragment.from(obj);case"function":return FunctionFragment.from(obj);case"struct":return StructFragment.from(obj)}}else if(typeof obj==="object"){switch(obj.type){case"constructor":return ConstructorFragment.from(obj);case"error":return ErrorFragment.from(obj);case"event":return EventFragment.from(obj);case"fallback":case"receive":return FallbackFragment.from(obj);case"function":return FunctionFragment.from(obj);case"struct":return StructFragment.from(obj)}assert(false,`unsupported type: ${obj.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}assertArgument(false,"unsupported frgament object","obj",obj)}static isConstructor(value){return ConstructorFragment.isFragment(value)}static isError(value){return ErrorFragment.isFragment(value)}static isEvent(value){return EventFragment.isFragment(value)}static isFunction(value){return FunctionFragment.isFragment(value)}static isStruct(value){return StructFragment.isFragment(value)}}class NamedFragment extends Fragment{name;constructor(guard,type,name,inputs){super(guard,type,inputs);assertArgument(typeof name==="string"&&name.match(regexId),"invalid identifier","name",name);inputs=Object.freeze(inputs.slice());defineProperties(this,{name:name})}}function joinParams(format,params){return"("+params.map(p=>p.format(format)).join(format==="full"?", ":",")+")"}class ErrorFragment extends NamedFragment{constructor(guard,name,inputs){super(guard,"error",name,inputs);Object.defineProperty(this,internal$1,{value:ErrorFragmentInternal})}get selector(){return id(this.format("sighash")).substring(0,10)}format(format){if(format==null){format="sighash"}if(format==="json"){return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(input=>JSON.parse(input.format(format)))})}const result=[];if(format!=="sighash"){result.push("error")}result.push(this.name+joinParams(format,this.inputs));return result.join(" ")}static from(obj){if(ErrorFragment.isFragment(obj)){return obj}if(typeof obj==="string"){return ErrorFragment.from(lex(obj))}else if(obj instanceof TokenString){const name=consumeName("error",obj);const inputs=consumeParams(obj);consumeEoi(obj);return new ErrorFragment(_guard$2,name,inputs)}return new ErrorFragment(_guard$2,obj.name,obj.inputs?obj.inputs.map(ParamType.from):[])}static isFragment(value){return value&&value[internal$1]===ErrorFragmentInternal}}class EventFragment extends NamedFragment{anonymous;constructor(guard,name,inputs,anonymous){super(guard,"event",name,inputs);Object.defineProperty(this,internal$1,{value:EventFragmentInternal});defineProperties(this,{anonymous:anonymous})}get topicHash(){return id(this.format("sighash"))}format(format){if(format==null){format="sighash"}if(format==="json"){return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(format)))})}const result=[];if(format!=="sighash"){result.push("event")}result.push(this.name+joinParams(format,this.inputs));if(format!=="sighash"&&this.anonymous){result.push("anonymous")}return result.join(" ")}static getTopicHash(name,params){params=(params||[]).map(p=>ParamType.from(p));const fragment=new EventFragment(_guard$2,name,params,false);return fragment.topicHash}static from(obj){if(EventFragment.isFragment(obj)){return obj}if(typeof obj==="string"){return EventFragment.from(lex(obj))}else if(obj instanceof TokenString){const name=consumeName("event",obj);const inputs=consumeParams(obj,true);const anonymous=!!consumeKeywords(obj,setify(["anonymous"])).has("anonymous");consumeEoi(obj);return new EventFragment(_guard$2,name,inputs,anonymous)}return new EventFragment(_guard$2,obj.name,obj.inputs?obj.inputs.map(p=>ParamType.from(p,true)):[],!!obj.anonymous)}static isFragment(value){return value&&value[internal$1]===EventFragmentInternal}}class ConstructorFragment extends Fragment{payable;energy;constructor(guard,type,inputs,payable,energy){super(guard,type,inputs);Object.defineProperty(this,internal$1,{value:ConstructorFragmentInternal});defineProperties(this,{payable:payable,energy:energy})}format(format){assert(format!=null&&format!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"});if(format==="json"){return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,energy:this.energy!=null?this.energy:undefined,inputs:this.inputs.map(i=>JSON.parse(i.format(format)))})}const result=[`constructor${joinParams(format,this.inputs)}`];result.push(this.payable?"payable":"nonpayable");if(this.energy!=null){result.push(`@${this.energy.toString()}`)}return result.join(" ")}static from(obj){if(ConstructorFragment.isFragment(obj)){return obj}if(typeof obj==="string"){return ConstructorFragment.from(lex(obj))}else if(obj instanceof TokenString){consumeKeywords(obj,setify(["constructor"]));const inputs=consumeParams(obj);const payable=!!consumeKeywords(obj,setify(["payable"])).has("payable");const energy=consumeEnergy(obj);consumeEoi(obj);return new ConstructorFragment(_guard$2,"constructor",inputs,payable,energy)}return new ConstructorFragment(_guard$2,"constructor",obj.inputs?obj.inputs.map(ParamType.from):[],!!obj.payable,obj.energy!=null?obj.energy:null)}static isFragment(value){return value&&value[internal$1]===ConstructorFragmentInternal}}class FallbackFragment extends Fragment{payable;constructor(guard,inputs,payable){super(guard,"fallback",inputs);Object.defineProperty(this,internal$1,{value:FallbackFragmentInternal});defineProperties(this,{payable:payable})}format(format){const type=this.inputs.length===0?"receive":"fallback";if(format==="json"){const stateMutability=this.payable?"payable":"nonpayable";return JSON.stringify({type:type,stateMutability:stateMutability})}return`${type}()${this.payable?" payable":""}`}static from(obj){if(FallbackFragment.isFragment(obj)){return obj}if(typeof obj==="string"){return FallbackFragment.from(lex(obj))}else if(obj instanceof TokenString){const errorObj=obj.toString();const topIsValid=obj.peekKeyword(setify(["fallback","receive"]));assertArgument(topIsValid,"type must be fallback or receive","obj",errorObj);const type=obj.popKeyword(setify(["fallback","receive"]));if(type==="receive"){const inputs=consumeParams(obj);assertArgument(inputs.length===0,`receive cannot have arguments`,"obj.inputs",inputs);consumeKeywords(obj,setify(["payable"]));consumeEoi(obj);return new FallbackFragment(_guard$2,[],true)}let inputs=consumeParams(obj);if(inputs.length){assertArgument(inputs.length===1&&inputs[0].type==="bytes","invalid fallback inputs","obj.inputs",inputs.map(i=>i.format("minimal")).join(", "))}else{inputs=[ParamType.from("bytes")]}const mutability=consumeMutability(obj);assertArgument(mutability==="nonpayable"||mutability==="payable","fallback cannot be constants","obj.stateMutability",mutability);if(consumeKeywords(obj,setify(["returns"])).has("returns")){const outputs=consumeParams(obj);assertArgument(outputs.length===1&&outputs[0].type==="bytes","invalid fallback outputs","obj.outputs",outputs.map(i=>i.format("minimal")).join(", "))}consumeEoi(obj);return new FallbackFragment(_guard$2,inputs,mutability==="payable")}if(obj.type==="receive"){return new FallbackFragment(_guard$2,[],true)}if(obj.type==="fallback"){const inputs=[ParamType.from("bytes")];const payable=obj.stateMutability==="payable";return new FallbackFragment(_guard$2,inputs,payable)}assertArgument(false,"invalid fallback description","obj",obj)}static isFragment(value){return value&&value[internal$1]===FallbackFragmentInternal}}class FunctionFragment extends NamedFragment{constant;outputs;stateMutability;payable;energy;constructor(guard,name,stateMutability,inputs,outputs,energy){super(guard,"function",name,inputs);Object.defineProperty(this,internal$1,{value:FunctionFragmentInternal});outputs=Object.freeze(outputs.slice());const constant=stateMutability==="view"||stateMutability==="pure";const payable=stateMutability==="payable";defineProperties(this,{constant:constant,energy:energy,outputs:outputs,payable:payable,stateMutability:stateMutability})}get selector(){return id(this.format("sighash")).substring(0,10)}format(format){if(format==null){format="sighash"}if(format==="json"){return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:undefined,payable:this.payable,energy:this.energy!=null?this.energy:undefined,inputs:this.inputs.map(i=>JSON.parse(i.format(format))),outputs:this.outputs.map(o=>JSON.parse(o.format(format)))})}const result=[];if(format!=="sighash"){result.push("function")}result.push(this.name+joinParams(format,this.inputs));if(format!=="sighash"){if(this.stateMutability!=="nonpayable"){result.push(this.stateMutability)}if(this.outputs&&this.outputs.length){result.push("returns");result.push(joinParams(format,this.outputs))}if(this.energy!=null){result.push(`@${this.energy.toString()}`)}}return result.join(" ")}static getSelector(name,params){params=(params||[]).map(p=>ParamType.from(p));const fragment=new FunctionFragment(_guard$2,name,"view",params,[],null);return fragment.selector}static from(obj){if(FunctionFragment.isFragment(obj)){return obj}if(typeof obj==="string"){return FunctionFragment.from(lex(obj))}else if(obj instanceof TokenString){const name=consumeName("function",obj);const inputs=consumeParams(obj);const mutability=consumeMutability(obj);let outputs=[];if(consumeKeywords(obj,setify(["returns"])).has("returns")){outputs=consumeParams(obj)}const energy=consumeEnergy(obj);consumeEoi(obj);return new FunctionFragment(_guard$2,name,mutability,inputs,outputs,energy)}let stateMutability=obj.stateMutability;if(stateMutability==null){stateMutability="payable";if(typeof obj.constant==="boolean"){stateMutability="view";if(!obj.constant){stateMutability="payable";if(typeof obj.payable==="boolean"&&!obj.payable){stateMutability="nonpayable"}}}else if(typeof obj.payable==="boolean"&&!obj.payable){stateMutability="nonpayable"}}return new FunctionFragment(_guard$2,obj.name,stateMutability,obj.inputs?obj.inputs.map(ParamType.from):[],obj.outputs?obj.outputs.map(ParamType.from):[],obj.energy!=null?obj.energy:null)}static isFragment(value){return value&&value[internal$1]===FunctionFragmentInternal}}class StructFragment extends NamedFragment{constructor(guard,name,inputs){super(guard,"struct",name,inputs);Object.defineProperty(this,internal$1,{value:StructFragmentInternal})}format(){throw new Error("@TODO")}static from(obj){if(typeof obj==="string"){return StructFragment.from(lex(obj))}else if(obj instanceof TokenString){const name=consumeName("struct",obj);const inputs=consumeParams(obj);consumeEoi(obj);return new StructFragment(_guard$2,name,inputs)}return new StructFragment(_guard$2,obj.name,obj.inputs?obj.inputs.map(ParamType.from):[])}static isFragment(value){return value&&value[internal$1]===StructFragmentInternal}}const PanicReasons$1=new Map;PanicReasons$1.set(0,"GENERIC_PANIC");PanicReasons$1.set(1,"ASSERT_FALSE");PanicReasons$1.set(17,"OVERFLOW");PanicReasons$1.set(18,"DIVIDE_BY_ZERO");PanicReasons$1.set(33,"ENUM_RANGE_ERROR");PanicReasons$1.set(34,"BAD_STORAGE_DATA");PanicReasons$1.set(49,"STACK_UNDERFLOW");PanicReasons$1.set(50,"ARRAY_RANGE_ERROR");PanicReasons$1.set(65,"OUT_OF_MEMORY");PanicReasons$1.set(81,"UNINITIALIZED_FUNCTION_CALL");const paramTypeBytes=new RegExp(/^bytes([0-9]*)$/);const paramTypeNumber=new RegExp(/^(u?int)([0-9]*)$/);let defaultCoder=null;function getBuiltinCallException(action,tx,data,abiCoder){let message="missing revert data";let reason=null;const invocation=null;let revert=null;if(data){message="execution reverted";const bytes=getBytes(data);data=hexlify(data);if(bytes.length===0){message+=" (no data present; likely require(false) occurred";reason="require(false)"}else if(bytes.length%32!==4){message+=" (could not decode reason; invalid data length)"}else if(hexlify(bytes.slice(0,4))==="0x08c379a0"){try{reason=abiCoder.decode(["string"],bytes.slice(4))[0];revert={signature:"Error(string)",name:"Error",args:[reason]};message+=`: ${JSON.stringify(reason)}`}catch(error){message+=" (could not decode reason; invalid string data)"}}else if(hexlify(bytes.slice(0,4))==="0x4e487b71"){try{const code=Number(abiCoder.decode(["uint256"],bytes.slice(4))[0]);revert={signature:"Panic(uint256)",name:"Panic",args:[code]};reason=`Panic due to ${PanicReasons$1.get(code)||"UNKNOWN"}(${code})`;message+=`: ${reason}`}catch(error){message+=" (could not decode panic code)"}}else{message+=" (unknown custom error)"}}const transaction={to:tx.to?getAddress(tx.to):null,data:tx.data||"0x"};if(tx.from){transaction.from=getAddress(tx.from)}return makeError(message,"CALL_EXCEPTION",{action:action,data:data,reason:reason,transaction:transaction,invocation:invocation,revert:revert})}class AbiCoder{#getCoder(param){if(param.isArray()){return new ArrayCoder(this.#getCoder(param.arrayChildren),param.arrayLength,param.name)}if(param.isTuple()){return new TupleCoder(param.components.map(c=>this.#getCoder(c)),param.name)}switch(param.baseType){case"address":return new AddressCoder(param.name);case"bool":return new BooleanCoder(param.name);case"string":return new StringCoder(param.name);case"bytes":return new BytesCoder(param.name);case"":return new NullCoder(param.name)}let match=param.type.match(paramTypeNumber);if(match){let size=parseInt(match[2]||"256");assertArgument(size!==0&&size<=256&&size%8===0,"invalid "+match[1]+" bit length","param",param);return new NumberCoder(size/8,match[1]==="int",param.name)}match=param.type.match(paramTypeBytes);if(match){let size=parseInt(match[1]);assertArgument(size!==0&&size<=32,"invalid bytes length","param",param);return new FixedBytesCoder(size,param.name)}assertArgument(false,"invalid type","type",param.type)}getDefaultValue(types){const coders=types.map(type=>this.#getCoder(ParamType.from(type)));const coder=new TupleCoder(coders,"_");return coder.defaultValue()}encode(types,values){assertArgumentCount(values.length,types.length,"types/values length mismatch");const coders=types.map(type=>this.#getCoder(ParamType.from(type)));const coder=new TupleCoder(coders,"_");const writer=new Writer;coder.encode(writer,values);return writer.data}decode(types,data,loose){const coders=types.map(type=>this.#getCoder(ParamType.from(type)));const coder=new TupleCoder(coders,"_");return coder.decode(new Reader(data,loose))}static defaultAbiCoder(){if(defaultCoder==null){defaultCoder=new AbiCoder}return defaultCoder}static getBuiltinCallException(action,tx,data){return getBuiltinCallException(action,tx,data,AbiCoder.defaultAbiCoder())}}function encodeBytes32String(text){const bytes=toUtf8Bytes(text);if(bytes.length>31){throw new Error("bytes32 string must be less than 32 bytes")}return zeroPadBytes(bytes,32)}function decodeBytes32String(_bytes){const data=getBytes(_bytes,"bytes");if(data.length!==32){throw new Error("invalid bytes32 - not 32 bytes long")}if(data[31]!==0){throw new Error("invalid bytes32 string - no null terminator")}let length=31;while(data[length-1]===0){length--}return toUtf8String(data.slice(0,length))}class LogDescription{fragment;name;signature;topic;args;constructor(fragment,topic,args){const name=fragment.name,signature=fragment.format();defineProperties(this,{fragment:fragment,name:name,signature:signature,topic:topic,args:args})}}class TransactionDescription{fragment;name;args;signature;selector;value;constructor(fragment,selector,args,value){const name=fragment.name,signature=fragment.format();defineProperties(this,{fragment:fragment,name:name,args:args,signature:signature,selector:selector,value:value})}}class ErrorDescription{fragment;name;args;signature;selector;constructor(fragment,selector,args){const name=fragment.name,signature=fragment.format();defineProperties(this,{fragment:fragment,name:name,args:args,signature:signature,selector:selector})}}class Indexed{hash;_isIndexed;static isIndexed(value){return!!(value&&value._isIndexed)}constructor(hash){defineProperties(this,{hash:hash,_isIndexed:true})}}const PanicReasons={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"};const BuiltinErrors={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:message=>{return`reverted with reason string ${JSON.stringify(message)}`}},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:code=>{let reason="unknown panic code";if(code>=0&&code<=255&&PanicReasons[code.toString()]){reason=PanicReasons[code.toString()]}return`reverted with panic code 0x${code.toString(16)} (${reason})`}}};class Interface{fragments;deploy;fallback;receive;#errors;#events;#functions;#abiCoder;constructor(fragments){let abi=[];if(typeof fragments==="string"){abi=JSON.parse(fragments)}else{abi=fragments}this.#functions=new Map;this.#errors=new Map;this.#events=new Map;const frags=[];for(const a of abi){try{frags.push(Fragment.from(a))}catch(error){console.log("EE",error)}}defineProperties(this,{fragments:Object.freeze(frags)});let fallback=null;let receive=false;this.#abiCoder=this.getAbiCoder();this.fragments.forEach((fragment,index)=>{let bucket;switch(fragment.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}defineProperties(this,{deploy:fragment});return;case"fallback":if(fragment.inputs.length===0){receive=true}else{assertArgument(!fallback||fragment.payable!==fallback.payable,"conflicting fallback fragments",`fragments[${index}]`,fragment);fallback=fragment;receive=fallback.payable}return;case"function":bucket=this.#functions;break;case"event":bucket=this.#events;break;case"error":bucket=this.#errors;break;default:return}const signature=fragment.format();if(bucket.has(signature)){return}bucket.set(signature,fragment)});if(!this.deploy){defineProperties(this,{deploy:ConstructorFragment.from("constructor()")})}defineProperties(this,{fallback:fallback,receive:receive})}format(minimal){const format=minimal?"minimal":"full";const abi=this.fragments.map(f=>f.format(format));return abi}formatJson(){const abi=this.fragments.map(f=>f.format("json"));return JSON.stringify(abi.map(j=>JSON.parse(j)))}getAbiCoder(){return AbiCoder.defaultAbiCoder()}#getFunction(key,values,forceUnique){if(isHexString(key)){const selector=key.toLowerCase();for(const fragment of this.#functions.values()){if(selector===fragment.selector){return fragment}}return null}if(key.indexOf("(")===-1){const matching=[];for(const[name,fragment]of this.#functions){if(name.split("(")[0]===key){matching.push(fragment)}}if(values){const lastValue=values.length>0?values[values.length-1]:null;let valueLength=values.length;let allowOptions=true;if(Typed.isTyped(lastValue)&&lastValue.type==="overrides"){allowOptions=false;valueLength--}for(let i=matching.length-1;i>=0;i--){const inputs=matching[i].inputs.length;if(inputs!==valueLength&&(!allowOptions||inputs!==valueLength-1)){matching.splice(i,1)}}for(let i=matching.length-1;i>=0;i--){const inputs=matching[i].inputs;for(let j=0;j=inputs.length){if(values[j].type==="overrides"){continue}matching.splice(i,1);break}if(values[j].type!==inputs[j].baseType){matching.splice(i,1);break}}}}if(matching.length===1&&values&&values.length!==matching[0].inputs.length){const lastArg=values[values.length-1];if(lastArg==null||Array.isArray(lastArg)||typeof lastArg!=="object"){matching.splice(0,1)}}if(matching.length===0){return null}if(matching.length>1&&forceUnique){const matchStr=matching.map(m=>JSON.stringify(m.format())).join(", ");assertArgument(false,`ambiguous function description (i.e. matches ${matchStr})`,"key",key)}return matching[0]}const result=this.#functions.get(FunctionFragment.from(key).format());if(result){return result}return null}getFunctionName(key){const fragment=this.#getFunction(key,null,false);assertArgument(fragment,"no matching function","key",key);return fragment.name}hasFunction(key){return!!this.#getFunction(key,null,false)}getFunction(key,values){return this.#getFunction(key,values||null,true)}forEachFunction(callback){const names=Array.from(this.#functions.keys());names.sort((a,b)=>a.localeCompare(b));for(let i=0;i=0;i--){if(matching[i].inputs.length=0;i--){const inputs=matching[i].inputs;for(let j=0;j1&&forceUnique){const matchStr=matching.map(m=>JSON.stringify(m.format())).join(", ");assertArgument(false,`ambiguous event description (i.e. matches ${matchStr})`,"key",key)}return matching[0]}const result=this.#events.get(EventFragment.from(key).format());if(result){return result}return null}getEventName(key){const fragment=this.#getEvent(key,null,false);assertArgument(fragment,"no matching event","key",key);return fragment.name}hasEvent(key){return!!this.#getEvent(key,null,false)}getEvent(key,values){return this.#getEvent(key,values||null,true)}forEachEvent(callback){const names=Array.from(this.#events.keys());names.sort((a,b)=>a.localeCompare(b));for(let i=0;i1){const matchStr=matching.map(m=>JSON.stringify(m.format())).join(", ");assertArgument(false,`ambiguous error description (i.e. ${matchStr})`,"name",key)}return matching[0]}key=ErrorFragment.from(key).format();if(key==="Error(string)"){return ErrorFragment.from("error Error(string)")}if(key==="Panic(uint256)"){return ErrorFragment.from("error Panic(uint256)")}const result=this.#errors.get(key);if(result){return result}return null}forEachError(callback){const names=Array.from(this.#errors.keys());names.sort((a,b)=>a.localeCompare(b));for(let i=0;i{if(param.type==="string"){return id(value)}else if(param.type==="bytes"){return sha256(hexlify(value))}if(param.type==="bool"&&typeof value==="boolean"){value=value?"0x01":"0x00"}if(param.type.match(/^u?int/)){value=toBeHex(value)}if(param.type==="address"){this.#abiCoder.encode(["address"],[value])}return zeroPadValue(hexlify(value),32)};values.forEach((value,index)=>{const param=fragment.inputs[index];if(!param.indexed){assertArgument(value==null,"cannot filter non-indexed parameters; must be null","contract."+param.name,value);return}if(value==null){topics.push(null)}else if(param.baseType==="array"||param.baseType==="tuple"){assertArgument(false,"filtering with tuples or arrays not supported","contract."+param.name,value)}else if(Array.isArray(value)){topics.push(value.map(value=>encodeTopic(param,value)))}else{topics.push(encodeTopic(param,value))}});while(topics.length&&topics[topics.length-1]===null){topics.pop()}return topics}encodeEventLog(fragment,values){if(typeof fragment==="string"){const f=this.getEvent(fragment);assertArgument(f,"unknown event","eventFragment",fragment);fragment=f}const topics=[];const dataTypes=[];const dataValues=[];if(!fragment.anonymous){topics.push(fragment.topicHash)}assertArgument(values.length===fragment.inputs.length,"event arguments/values mismatch","values",values);fragment.inputs.forEach((param,index)=>{const value=values[index];if(param.indexed){if(param.type==="string"){topics.push(id(value))}else if(param.type==="bytes"){topics.push(sha256(value))}else if(param.baseType==="tuple"||param.baseType==="array"){throw new Error("not implemented")}else{topics.push(this.#abiCoder.encode([param.type],[value]))}}else{dataTypes.push(param);dataValues.push(value)}});return{data:this.#abiCoder.encode(dataTypes,dataValues),topics:topics}}decodeEventLog(fragment,data,topics){if(typeof fragment==="string"){const f=this.getEvent(fragment);assertArgument(f,"unknown event","eventFragment",fragment);fragment=f}if(topics!=null&&!fragment.anonymous){const eventTopic=fragment.topicHash;assertArgument(isHexString(topics[0],32)&&topics[0].toLowerCase()===eventTopic,"fragment/topic mismatch","topics[0]",topics[0]);topics=topics.slice(1)}const indexed=[];const nonIndexed=[];const dynamic=[];fragment.inputs.forEach((param,index)=>{if(param.indexed){if(param.type==="string"||param.type==="bytes"||param.baseType==="tuple"||param.baseType==="array"){indexed.push(ParamType.from({type:"bytes32",name:param.name}));dynamic.push(true)}else{indexed.push(param);dynamic.push(false)}}else{nonIndexed.push(param);dynamic.push(false)}});const resultIndexed=topics!=null?this.#abiCoder.decode(indexed,concat(topics)):null;const resultNonIndexed=this.#abiCoder.decode(nonIndexed,data,true);const values=[];const keys=[];let nonIndexedIndex=0,indexedIndex=0;fragment.inputs.forEach((param,index)=>{let value=null;if(param.indexed){if(resultIndexed==null){value=new Indexed(null)}else if(dynamic[index]){value=new Indexed(resultIndexed[indexedIndex++])}else{try{value=resultIndexed[indexedIndex++]}catch(error){value=error}}}else{try{value=resultNonIndexed[nonIndexedIndex++]}catch(error){value=error}}values.push(value);keys.push(param.name||null)});return Result.fromItems(values,keys)}parseTransaction(tx){const data=getBytes(tx.data,"tx.data");const value=getBigInt(tx.value!=null?tx.value:0,"tx.value");const fragment=this.getFunction(hexlify(data.slice(0,4)));if(!fragment){return null}const args=this.#abiCoder.decode(fragment.inputs,data.slice(4));return new TransactionDescription(fragment,fragment.selector,args,value)}parseCallResult(data){throw new Error("@TODO")}parseLog(log){const fragment=this.getEvent(log.topics[0]);if(!fragment||fragment.anonymous){return null}return new LogDescription(fragment,fragment.topicHash,this.decodeEventLog(fragment,log.data,log.topics))}parseError(data){const hexData=hexlify(data);const fragment=this.getError(dataSlice(hexData,0,4));if(!fragment){return null}const args=this.#abiCoder.decode(fragment.inputs,dataSlice(hexData,4));return new ErrorDescription(fragment,fragment.selector,args)}static from(value){if(value instanceof Interface){return value}if(typeof value==="string"){return new Interface(JSON.parse(value))}if(typeof value.format==="function"){return new Interface(value.format("json"))}return new Interface(value)}}const logger=new Logger("contract-address/0.0.1");function getCreateAddress(tx){const from=getAddress(tx.from);const nonce=getBigInt(tx.nonce,"tx.nonce");let nonceHex=nonce.toString(16);if(nonceHex==="0"){nonceHex="0x"}else if(nonceHex.length%2){nonceHex="0x0"+nonceHex}else{nonceHex="0x"+nonceHex}return getAddress(from)}function getCreate2Address(from,salt,initCodeHash){if(hexDataLength(salt)!==32){logger.throwArgumentError("salt must be 32 bytes","salt",salt)}if(hexDataLength(initCodeHash)!==32){logger.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",initCodeHash)}const val=hexDataSlice(sha256(concat(["0xff",getAddress(from),salt,initCodeHash])),12);console.log({"contract-address/74=>should be string":val});const prefix=from.substring(2,4);const checksum=calculateCheckSum(val,prefix);return"0x"+prefix+checksum+removeHexPrefix(val)}function isAddressable(value){return value&&typeof value.getAddress==="function"}function isAddress(value){try{getAddress(value);return true}catch(error){}return false}async function checkAddress(target,promise){const result=await promise;if(result==null||result==="0x0000000000000000000000000000000000000000"){assert(typeof target!=="string","unconfigured name","UNCONFIGURED_NAME",{value:target});assertArgument(false,"invalid AddressLike value; did not resolve to a value address","target",target)}return getAddress(result)}function resolveAddress(target){if(typeof target==="string"){return getAddress(target)}else if(isAddressable(target)){return checkAddress(target,target.getAddress())}else if(target&&typeof target.then==="function"){return checkAddress(target,target)}assertArgument(false,"unsupported addressable value","target",target)}const BN_0$2=BigInt(0);function getValue(value){if(value==null){return null}return value}function toJson(value){if(value==null){return null}return value.toString()}class FeeData{energyPrice;constructor(energyPrice){defineProperties(this,{energyPrice:getValue(energyPrice)})}toJSON(){const{energyPrice}=this;return{_type:"FeeData",energyPrice:toJson(energyPrice)}}}function copyRequest(req){const result={};if(req.to){result.to=req.to}if(req.from){result.from=req.from}if(req.data){result.data=hexlify(req.data)}const bigIntKeys="networkId,energyLimit,energyPrice,value".split(/,/);for(const key of bigIntKeys){if(!(key in req)||req[key]==null){continue}result[key]=getBigInt(req[key],`request.${key}`)}const numberKeys="type,nonce".split(/,/);for(const key of numberKeys){if(!(key in req)||req[key]==null){continue}result[key]=getNumber(req[key],`request.${key}`)}if("blockTag"in req){result.blockTag=req.blockTag}if("enableCcipRead"in req){result.enableCcipReadEnabled=!!req.enableCcipRead}if("customData"in req){result.customData=req.customData}return result}class Block{provider;number;hash;timestamp;parentHash;nonce;difficulty;energyLimit;energyUsed;miner;extraData;baseFeePerEnergy;#transactions;constructor(block,provider){this.#transactions=block.transactions.map(tx=>{if(typeof tx!=="string"){return new TransactionResponse(tx,provider)}return tx});defineProperties(this,{provider:provider,hash:getValue(block.hash),number:block.number,timestamp:block.timestamp,parentHash:block.parentHash,nonce:block.nonce,difficulty:block.difficulty,energyLimit:block.energyLimit,energyUsed:block.energyUsed,miner:block.miner,extraData:block.extraData,baseFeePerEnergy:getValue(block.baseFeePerEnergy)})}get transactions(){return this.#transactions.map(tx=>{if(typeof tx==="string"){return tx}return tx.hash})}get prefetchedTransactions(){const txs=this.#transactions.slice();if(txs.length===0){return[]}assert(typeof txs[0]==="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"});return txs}toJSON(){const{baseFeePerEnergy,difficulty,extraData,energyLimit,energyUsed,hash,miner,nonce,number,parentHash,timestamp,transactions}=this;return{_type:"Block",baseFeePerEnergy:toJson(baseFeePerEnergy),difficulty:toJson(difficulty),extraData:extraData,energyLimit:toJson(energyLimit),energyUsed:toJson(energyUsed),hash:hash,miner:miner,nonce:nonce,number:number,parentHash:parentHash,timestamp:timestamp,transactions:transactions}}[Symbol.iterator](){let index=0;const txs=this.transactions;return{next:()=>{if(index{return new Log(log,provider)}));defineProperties(this,{provider:provider,to:tx.to,from:tx.from,contractAddress:tx.contractAddress,hash:tx.hash,index:tx.index,blockHash:tx.blockHash,blockNumber:tx.blockNumber,logsBloom:tx.logsBloom,energyUsed:tx.energyUsed,cumulativeEnergyUsed:tx.cumulativeEnergyUsed,energyPrice:tx.effectiveEnergyPrice||tx.energyPrice,status:tx.status,root:tx.root})}get logs(){return this.#logs}toJSON(){const{to,from,contractAddress,hash,index,blockHash,blockNumber,logsBloom,logs,status,root}=this;return{_type:"TransactionReceipt",blockHash:blockHash,blockNumber:blockNumber,contractAddress:contractAddress,cumulativeEnergyUsed:toJson(this.cumulativeEnergyUsed),from:from,energyPrice:toJson(this.energyPrice),energyUsed:toJson(this.energyUsed),hash:hash,index:index,logs:logs,logsBloom:logsBloom,root:root,status:status,to:to}}get length(){return this.logs.length}[Symbol.iterator](){let index=0;return{next:()=>{if(index{if(stopScanning){return null}const{blockNumber,nonce}=await resolveProperties({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(nonce=confirms){return receipt}}else{await checkReplacement();if(confirms===0){return null}}const waiter=new Promise((resolve,reject)=>{const cancellers=[];const cancel=()=>{cancellers.forEach(c=>c())};cancellers.push(()=>{stopScanning=true});if(timeout>0){const timer=setTimeout(()=>{cancel();reject(makeError("wait for transaction timeout","TIMEOUT"))},timeout);cancellers.push(()=>{clearTimeout(timer)})}const txListener=async receipt=>{if(await receipt.confirmations()>=confirms){cancel();resolve(receipt)}};cancellers.push(()=>{this.provider.off(this.hash,txListener)});this.provider.on(this.hash,txListener);if(startBlock>=0){const replaceListener=async()=>{try{await checkReplacement()}catch(error){if(isError(error,"TRANSACTION_REPLACED")){cancel();reject(error);return}}if(!stopScanning){this.provider.once("block",replaceListener)}};cancellers.push(()=>{this.provider.off("block",replaceListener)});this.provider.once("block",replaceListener)}});return await waiter}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}removedEvent(){assert(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"});return createRemovedTransactionFilter(this)}reorderedEvent(other){assert(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"});assert(!other||other.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"});return createReorderedTransactionFilter(this,other)}replaceableTransaction(startBlock){assertArgument(Number.isInteger(startBlock)&&startBlock>=0,"invalid startBlock","startBlock",startBlock);const tx=new TransactionResponse(this,this.provider);tx.#startBlock=startBlock;return tx}}function createOrphanedBlockFilter(block){return{orphan:"drop-block",hash:block.hash,number:block.number}}function createReorderedTransactionFilter(tx,other){return{orphan:"reorder-transaction",tx:tx,other:other}}function createRemovedTransactionFilter(tx){return{orphan:"drop-transaction",tx:tx}}function createRemovedLogFilter(log){return{orphan:"drop-log",log:{transactionHash:log.transactionHash,blockHash:log.blockHash,blockNumber:log.blockNumber,address:log.address,data:log.data,topics:Object.freeze(log.topics.slice()),index:log.index}}}class EventLog extends Log{interface;fragment;args;constructor(log,iface,fragment){super(log,log.provider);const args=iface.decodeEventLog(fragment,log.data,log.topics);defineProperties(this,{args:args,fragment:fragment,interface:iface})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class ContractTransactionReceipt extends TransactionReceipt{#iface;constructor(iface,provider,tx){super(tx,provider);this.#iface=iface}get logs(){return super.logs.map(log=>{const fragment=log.topics.length?this.#iface.getEvent(log.topics[0]):null;if(fragment){return new EventLog(log,this.#iface,fragment)}else{return log}})}}class ContractTransactionResponse extends TransactionResponse{#iface;constructor(iface,provider,tx){super(tx,provider);this.#iface=iface}async wait(confirms){const receipt=await super.wait();if(receipt==null){return null}return new ContractTransactionReceipt(this.#iface,this.provider,receipt)}}class ContractUnknownEventPayload extends EventPayload{log;constructor(contract,listener,filter,log){super(contract,listener,filter);defineProperties(this,{log:log})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class ContractEventPayload extends ContractUnknownEventPayload{constructor(contract,listener,filter,fragment,_log){super(contract,listener,filter,new EventLog(_log,contract.interface,fragment));const args=contract.interface.decodeEventLog(fragment,this.log.data,this.log.topics);defineProperties(this,{args:args,fragment:fragment})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const BN_0$1=BigInt(0);function canCall(value){return value&&typeof value.call==="function"}function canEstimate(value){return value&&typeof value.estimateEnergy==="function"}function canResolve(value){return value&&typeof value.resolveName==="function"}function canSend(value){return value&&typeof value.sendTransaction==="function"}class PreparedTopicFilter{#filter;fragment;constructor(contract,fragment,args){defineProperties(this,{fragment:fragment});if(fragment.inputs.length{const arg=args[index];if(arg==null){return null}return param.walkAsync(args[index],(type,value)=>{if(type==="address"){return resolveAddress(value)}return value})}));return contract.interface.encodeFilterTopics(fragment,resolvedArgs)}()}getTopicFilter(){return this.#filter}}function getRunner(value,feature){if(value==null){return null}if(typeof value[feature]==="function"){return value}if(value.provider&&typeof value.provider[feature]==="function"){return value.provider}return null}function getProvider(value){if(value==null){return null}return value.provider||null}async function copyOverrides(arg,allowed){const overrides=copyRequest(Typed.dereference(arg,"overrides"));assertArgument(overrides.to==null||(allowed||[]).indexOf("to")>=0,"cannot override to","overrides.to",overrides.to);assertArgument(overrides.data==null||(allowed||[]).indexOf("data")>=0,"cannot override data","overrides.data",overrides.data);if(overrides.from){overrides.from=await resolveAddress(overrides.from)}return overrides}async function resolveArgs(_runner,inputs,args){return await Promise.all(inputs.map((param,index)=>{return param.walkAsync(args[index],(type,value)=>{value=Typed.dereference(value,type);if(type==="address"){return resolveAddress(value)}return value})}))}function buildWrappedFallback(contract){const populateTransaction=async function(overrides){const tx=await copyOverrides(overrides,["data"]);tx.to=await contract.getAddress();const iface=contract.interface;const payable=iface.receive||iface.fallback&&iface.fallback.payable;assertArgument(payable||(tx.value||BN_0$1)===BN_0$1,"cannot send value to non-payable contract","overrides.value",tx.value);assertArgument(iface.fallback||(tx.data||"0x")==="0x","cannot send data to receive-only contract","overrides.data",tx.data);return tx};const staticCall=async function(overrides){const runner=getRunner(contract.runner,"call");assert(canCall(runner),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const tx=await populateTransaction(overrides);try{return await runner.call(tx)}catch(error){if(isCallException(error)&&error.data){throw contract.interface.makeError(error.data,tx)}throw error}};const send=async function(overrides){const runner=contract.runner;assert(canSend(runner),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const tx=await runner.sendTransaction(await populateTransaction(overrides));const provider=getProvider(contract.runner);return new ContractTransactionResponse(contract.interface,provider,tx)};const estimateEnergy=async function(overrides){const runner=getRunner(contract.runner,"estimateEnergy");assert(canEstimate(runner),"contract runner does not support energy estimation","UNSUPPORTED_OPERATION",{operation:"estimateEnergy"});return await runner.estimateEnergy(await populateTransaction(overrides))};const method=async overrides=>{return await send(overrides)};defineProperties(method,{_contract:contract,estimateEnergy:estimateEnergy,populateTransaction:populateTransaction,send:send,staticCall:staticCall});return method}function buildWrappedMethod(contract,key){const getFragment=function(...args){const fragment=contract.interface.getFunction(key,args);assert(fragment,"no matching fragment in getFragment","UNSUPPORTED_OPERATION",{operation:"fragment"});return fragment};const populateTransaction=async function(...args){const fragment=getFragment(...args);let overrides={};if(fragment.inputs.length+1===args.length){overrides=await copyOverrides(args.pop())}if(fragment.inputs.length!==args.length){throw new Error("internal error: fragment inputs doesn't match arguments; should not happen")}const resolvedArgs=await resolveArgs(contract.runner,fragment.inputs,args);return Object.assign({},overrides,await resolveProperties({to:contract.getAddress(),data:contract.interface.encodeFunctionData(fragment,resolvedArgs)}))};const staticCall=async function(...args){const result=await staticCallResult(...args);if(result.length===1){return result[0]}return result};const send=async function(...args){const runner=contract.runner;assert(canSend(runner),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const tx=await runner.sendTransaction(await populateTransaction(...args));const provider=getProvider(contract.runner);return new ContractTransactionResponse(contract.interface,provider,tx)};const estimateEnergy=async function(...args){const runner=getRunner(contract.runner,"estimateEnergy");assert(canEstimate(runner),"contract runner does not support energy estimation","UNSUPPORTED_OPERATION",{operation:"estimateEnergy"});return await runner.estimateEnergy(await populateTransaction(...args))};const staticCallResult=async function(...args){const runner=getRunner(contract.runner,"call");assert(canCall(runner),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const tx=await populateTransaction(...args);let result="0x";try{result=await runner.call(tx)}catch(error){if(isCallException(error)&&error.data){throw contract.interface.makeError(error.data,tx)}throw error}const fragment=getFragment(...args);return contract.interface.decodeFunctionResult(fragment,result)};const method=async(...args)=>{const fragment=getFragment(...args);if(fragment.constant){return await staticCall(...args)}return await send(...args)};defineProperties(method,{name:contract.interface.getFunctionName(key),_contract:contract,_key:key,getFragment:getFragment,estimateEnergy:estimateEnergy,populateTransaction:populateTransaction,send:send,staticCall:staticCall,staticCallResult:staticCallResult});Object.defineProperty(method,"fragment",{configurable:false,enumerable:true,get:()=>{const fragment=contract.interface.getFunction(key);assert(fragment,"no matching fragment in defineProperty","UNSUPPORTED_OPERATION",{operation:"fragment"});return fragment}});return method}function buildWrappedEvent(contract,key){const getFragment=function(...args){const fragment=contract.interface.getEvent(key,args);assert(fragment,"no matching fragment in","UNSUPPORTED_OPERATION",{operation:"fragment"});return fragment};const method=function(...args){return new PreparedTopicFilter(contract,getFragment(...args),args)};defineProperties(method,{name:contract.interface.getEventName(key),_contract:contract,_key:key,getFragment:getFragment});Object.defineProperty(method,"fragment",{configurable:false,enumerable:true,get:()=>{const fragment=contract.interface.getEvent(key);assert(fragment,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment"});return fragment}});return method}const internal=Symbol.for("_corebcInternal_contract");const internalValues=new WeakMap;function setInternal(contract,values){internalValues.set(contract[internal],values)}function getInternal(contract){return internalValues.get(contract[internal])}function isDeferred(value){return value&&typeof value==="object"&&"getTopicFilter"in value&&typeof value.getTopicFilter==="function"&&value.fragment}async function getSubInfo(contract,event){let topics;let fragment=null;if(Array.isArray(event)){const topicHashify=function(name){if(isHexString(name,32)){return name}const fragment=contract.interface.getEvent(name);assertArgument(fragment,"unknown fragment","name",name);return fragment.topicHash};topics=event.map(e=>{if(e==null){return null}if(Array.isArray(e)){return e.map(topicHashify)}return topicHashify(e)})}else if(event==="*"){topics=[null]}else if(typeof event==="string"){if(isHexString(event,32)){topics=[event]}else{fragment=contract.interface.getEvent(event);assertArgument(fragment,"unknown fragment","event",event);topics=[fragment.topicHash]}}else if(isDeferred(event)){topics=await event.getTopicFilter()}else if("fragment"in event){fragment=event.fragment;topics=[fragment.topicHash]}else{assertArgument(false,"unknown event name","event",event)}topics=topics.map(t=>{if(t==null){return null}if(Array.isArray(t)){const items=Array.from(new Set(t.map(t=>t.toLowerCase())).values());if(items.length===1){return items[0]}items.sort();return items}return t.toLowerCase()});const tag=topics.map(t=>{if(t==null){return"null"}if(Array.isArray(t)){return t.join("|")}return t}).join("&");return{fragment:fragment,tag:tag,topics:topics}}async function hasSub(contract,event){const{subs}=getInternal(contract);return subs.get((await getSubInfo(contract,event)).tag)||null}async function getSub(contract,operation,event){const provider=getProvider(contract.runner);assert(provider,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:operation});const{fragment,tag,topics}=await getSubInfo(contract,event);const{addr,subs}=getInternal(contract);let sub=subs.get(tag);if(!sub){const address=addr?addr:contract;const filter={address:address,topics:topics};const listener=log=>{let foundFragment=fragment;if(foundFragment==null){try{foundFragment=contract.interface.getEvent(log.topics[0])}catch(error){}}if(foundFragment){const _foundFragment=foundFragment;const args=fragment?contract.interface.decodeEventLog(fragment,log.data,log.topics):[];emit(contract,event,args,listener=>{return new ContractEventPayload(contract,listener,event,_foundFragment,log)})}else{emit(contract,event,[],listener=>{return new ContractUnknownEventPayload(contract,listener,event,log)})}};let starting=[];const start=()=>{if(starting.length){return}starting.push(provider.on(filter,listener))};const stop=async()=>{if(starting.length==0){return}let started=starting;starting=[];await Promise.all(started);provider.off(filter,listener)};sub={tag:tag,listeners:[],start:start,stop:stop};subs.set(tag,sub)}return sub}let lastEmit=Promise.resolve();async function _emit(contract,event,args,payloadFunc){await lastEmit;const sub=await hasSub(contract,event);if(!sub){return false}const count=sub.listeners.length;sub.listeners=sub.listeners.filter(({listener,once})=>{const passArgs=Array.from(args);if(payloadFunc){passArgs.push(payloadFunc(once?null:listener))}try{listener.call(contract,...passArgs)}catch(error){}return!once});return count>0}async function emit(contract,event,args,payloadFunc){try{await lastEmit}catch(error){}const resultPromise=_emit(contract,event,args,payloadFunc);lastEmit=resultPromise;return await resultPromise}const passProperties=["then"];class BaseContract{target;interface;runner;filters;[internal];fallback;constructor(target,abi,runner,_deployTx){if(runner==null){runner=null}const iface=Interface.from(abi);defineProperties(this,{target:target,runner:runner,interface:iface});Object.defineProperty(this,internal,{value:{}});let addrPromise;let addr=null;let deployTx=null;if(_deployTx){const provider=getProvider(runner);deployTx=new ContractTransactionResponse(this.interface,provider,_deployTx)}let subs=new Map;if(typeof target==="string"){if(isHexString(target)){addr=target;addrPromise=Promise.resolve(target)}else{const resolver=getRunner(runner,"resolveName");if(!canResolve(resolver)){throw makeError("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"})}addrPromise=resolver.resolveName(target).then(addr=>{if(addr==null){throw new Error("TODO")}getInternal(this).addr=addr;return addr})}}else{addrPromise=target.getAddress().then(addr=>{if(addr==null){throw new Error("TODO")}getInternal(this).addr=addr;return addr})}setInternal(this,{addrPromise:addrPromise,addr:addr,deployTx:deployTx,subs:subs});const filters=new Proxy({},{get:(target,_prop,receiver)=>{if(passProperties.indexOf(_prop)>=0){return Reflect.get(target,_prop,receiver)}const prop=String(_prop);const result=this.getEvent(prop);if(result){return result}throw new Error(`unknown contract event: ${prop}`)},has:(target,prop)=>{if(passProperties.indexOf(prop)>=0){return Reflect.has(target,prop)}return Reflect.has(target,prop)||this.interface.hasEvent(String(prop))}});defineProperties(this,{filters:filters});defineProperties(this,{fallback:iface.receive||iface.fallback?buildWrappedFallback(this):null});return new Proxy(this,{get:(target,_prop,receiver)=>{if(_prop in target||passProperties.indexOf(_prop)>=0){return Reflect.get(target,_prop,receiver)}const prop=String(_prop);const result=target.getFunction(prop);if(result){return result}throw new Error(`unknown contract method: ${prop}`)},has:(target,prop)=>{if(prop in target||passProperties.indexOf(prop)>=0){return Reflect.has(target,prop)}return target.interface.hasFunction(String(prop))}})}connect(runner){return new BaseContract(this.target,this.interface,runner)}async getAddress(){return await getInternal(this).addrPromise}async getDeployedCode(){const provider=getProvider(this.runner);assert(provider,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const code=await provider.getCode(await this.getAddress());if(code==="0x"){return null}return code}async waitForDeployment(){const deployTx=this.deploymentTransaction();if(deployTx){await deployTx.wait();return this}const code=await this.getDeployedCode();if(code!=null){return this}const provider=getProvider(this.runner);assert(provider!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"});return new Promise((resolve,reject)=>{const checkCode=async()=>{try{const code=await this.getDeployedCode();if(code!=null){return resolve(this)}provider.once("block",checkCode)}catch(error){reject(error)}};checkCode()})}deploymentTransaction(){return getInternal(this).deployTx}getFunction(key){if(typeof key!=="string"){key=key.format()}const func=buildWrappedMethod(this,key);return func}getEvent(key){if(typeof key!=="string"){key=key.format()}return buildWrappedEvent(this,key)}async queryTransaction(hash){throw new Error("@TODO")}async queryFilter(event,fromBlock,toBlock){if(fromBlock==null){fromBlock=0}if(toBlock==null){toBlock="latest"}const{addr,addrPromise}=getInternal(this);const address=addr?addr:await addrPromise;const{fragment,topics}=await getSubInfo(this,event);const filter={address:address,topics:topics,fromBlock:fromBlock,toBlock:toBlock};const provider=getProvider(this.runner);assert(provider,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"});return(await provider.getLogs(filter)).map(log=>{let foundFragment=fragment;if(foundFragment==null){try{foundFragment=this.interface.getEvent(log.topics[0])}catch(error){}}if(foundFragment){return new EventLog(log,this.interface,foundFragment)}else{return new Log(log,provider)}})}async on(event,listener){const sub=await getSub(this,"on",event);sub.listeners.push({listener:listener,once:false});sub.start();return this}async once(event,listener){const sub=await getSub(this,"once",event);sub.listeners.push({listener:listener,once:true});sub.start();return this}async emit(event,...args){return await emit(this,event,args,null)}async listenerCount(event){if(event){const sub=await hasSub(this,event);if(!sub){return 0}return sub.listeners.length}const{subs}=getInternal(this);let total=0;for(const{listeners}of subs.values()){total+=listeners.length}return total}async listeners(event){if(event){const sub=await hasSub(this,event);if(!sub){return[]}return sub.listeners.map(({listener})=>listener)}const{subs}=getInternal(this);let result=[];for(const{listeners}of subs.values()){result=result.concat(listeners.map(({listener})=>listener))}return result}async off(event,listener){const sub=await hasSub(this,event);if(!sub){return this}if(listener){const index=sub.listeners.map(({listener})=>listener).indexOf(listener);if(index>=0){sub.listeners.splice(index,1)}}if(listener==null||sub.listeners.length===0){sub.stop();getInternal(this).subs.delete(sub.tag)}return this}async removeAllListeners(event){if(event){const sub=await hasSub(this,event);if(!sub){return this}sub.stop();getInternal(this).subs.delete(sub.tag)}else{const{subs}=getInternal(this);for(const{tag,stop}of subs.values()){stop();subs.delete(tag)}}return this}async addListener(event,listener){return await this.on(event,listener)}async removeListener(event,listener){return await this.off(event,listener)}static buildClass(abi){class CustomContract extends BaseContract{constructor(address,runner=null){super(address,abi,runner)}}return CustomContract}static from(target,abi,runner){if(runner==null){runner=null}const contract=new this(target,abi,runner);return contract}static isIndexed(value){return Indexed.isIndexed(value)}}function _ContractBase(){return BaseContract}class Contract extends _ContractBase(){}class ContractFactory{interface;bytecode;runner;constructor(abi,bytecode,runner){const iface=Interface.from(abi);if(bytecode instanceof Uint8Array){bytecode=hexlify(getBytes(bytecode))}else if(typeof bytecode==="string"){bytecode=bytecode}else if(isBytes(bytecode)){bytecode=hexlify(bytecode)}else if(bytecode&&typeof bytecode.object==="string"){bytecode=bytecode.object}else{bytecode="!"}defineProperties(this,{bytecode:bytecode,interface:iface,runner:runner||null})}async getDeployTransaction(...args){let overrides={};const fragment=this.interface.deploy;if(fragment.inputs.length+1===args.length){overrides=await copyOverrides(args.pop())}if(fragment.inputs.length!==args.length){throw new Error("incorrect number of arguments to constructor")}const resolvedArgs=await resolveArgs(this.runner,fragment.inputs,args);const data=concat([this.bytecode,this.interface.encodeDeploy(resolvedArgs)]);return Object.assign({},overrides,{data:data})}async deploy(...args){const tx=await this.getDeployTransaction(...args);assert(this.runner&&typeof this.runner.sendTransaction==="function","factory runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const sentTx=await this.runner.sendTransaction(tx);const address=getCreateAddress(sentTx);return new BaseContract(address,this.interface,this.runner,sentTx)}connect(runner){return new ContractFactory(this.interface,this.bytecode,runner)}static fromSolidity(output,runner){assertArgument(output!=null,"bad compiler output","output",output);if(typeof output==="string"){output=JSON.parse(output)}const abi=output.abi;let bytecode="";if(output.bytecode){bytecode=output.bytecode}else if(output.evm&&output.evm.bytecode){bytecode=output.evm.bytecode}return new this(abi,bytecode,runner)}}const BN_0=BigInt(0);function allowNull(format,nullValue){return function(value){if(value==null){return nullValue}return format(value)}}function arrayOf(format){return array=>{if(!Array.isArray(array)){throw new Error("not an array")}return array.map(i=>format(i))}}function object(format,altNames){return value=>{const result={};for(const key in format){let srcKey=key;if(altNames&&key in altNames&&!(srcKey in value)){for(const altKey of altNames[key]){if(altKey in value){srcKey=altKey;break}}}try{const nv=format[key](value[srcKey]);if(nv!==undefined){result[key]=nv}}catch(error){const message=error instanceof Error?error.message:"not-an-error";assert(false,`invalid value for value.${key} (${message})`,"BAD_DATA",{value:value})}}return result}}function formatBoolean(value){switch(value){case true:case"true":return true;case false:case"false":return false}assertArgument(false,`invalid boolean; ${JSON.stringify(value)}`,"value",value)}function formatData(value){assertArgument(isHexString(value,true),"invalid data","value",value);return value}function formatHash(value){assertArgument(isHexString(value,32),"invalid hash","value",value);return value}const _formatLog=object({address:getAddress,blockHash:formatHash,blockNumber:getNumber,data:formatData,index:getNumber,removed:allowNull(formatBoolean,false),topics:arrayOf(formatHash),transactionHash:formatHash,transactionIndex:getNumber},{index:["logIndex"]});function formatLog(value){return _formatLog(value)}const _formatBlock=object({hash:allowNull(formatHash),parentHash:formatHash,number:getNumber,timestamp:getNumber,nonce:allowNull(formatData),difficulty:getBigInt,energyLimit:getBigInt,energyUsed:getBigInt,miner:allowNull(getAddress),extraData:formatData,baseFeePerEnergy:allowNull(getBigInt)});function formatBlock(value){const result=_formatBlock(value);result.transactions=value.transactions.map(tx=>{if(typeof tx==="string"){return tx}return formatTransactionResponse(tx)});return result}const _formatReceiptLog=object({transactionIndex:getNumber,blockNumber:getNumber,transactionHash:formatHash,address:getAddress,topics:arrayOf(formatHash),data:formatData,index:getNumber,blockHash:formatHash},{index:["logIndex"]});function formatReceiptLog(value){return _formatReceiptLog(value)}const _formatTransactionReceipt=object({to:allowNull(getAddress,null),from:allowNull(getAddress,null),contractAddress:allowNull(getAddress,null),index:getNumber,root:allowNull(hexlify),energyUsed:getBigInt,logsBloom:allowNull(formatData),blockHash:formatHash,hash:formatHash,logs:arrayOf(formatReceiptLog),blockNumber:getNumber,cumulativeEnergyUsed:getBigInt,effectiveEnergyPrice:allowNull(getBigInt),status:allowNull(getNumber),type:allowNull(getNumber,0)},{effectiveEnergyPrice:["energyPrice"],hash:["transactionHash"],index:["transactionIndex"]});function formatTransactionReceipt(value){return _formatTransactionReceipt(value)}function formatTransactionResponse(value){if(value.to&&!getAddress(value.to)&&getBigInt(value.to)===BN_0){value.to="0x0000000000000000000000000000000000000000"}const result=object({hash:formatHash,type:value=>{if(value==="0x"||value==null){return 0}return getNumber(value)},accessList:allowNull(accessListify,null),blockHash:allowNull(formatHash,null),blockNumber:allowNull(getNumber,null),transactionIndex:allowNull(getNumber,null),from:getAddress,maxFeePerEnergy:allowNull(getBigInt),energyLimit:getBigInt,to:allowNull(getAddress,null),value:getBigInt,nonce:getNumber,data:formatData,creates:allowNull(getAddress,null),networkId:allowNull(getBigInt,null)},{data:["input"],energyLimit:["energy"]})(value);if(result.to==null&&result.creates==null){result.creates=getCreateAddress(result)}if(value.signature){result.signature=value.signature}else{result.signature=value}if(result.networkId==null){const networkId=result.signature.legacynetworkId;if(networkId!=null){result.networkId=networkId}}if(result.blockHash&&getBigInt(result.blockHash)===BN_0){result.blockHash=null}return result}class NetworkPlugin{name;constructor(name){defineProperties(this,{name:name})}clone(){return new NetworkPlugin(this.name)}}class EnergyCostPlugin extends NetworkPlugin{effectiveBlock;txBase;txCreate;txDataZero;txDataNonzero;txAccessListStorageKey;txAccessListAddress;constructor(effectiveBlock,costs){if(effectiveBlock==null){effectiveBlock=0}super(`org.corebc.network.plugins.EnergyCost#${effectiveBlock||0}`);const props={effectiveBlock:effectiveBlock};function set(name,nullish){let value=(costs||{})[name];if(value==null){value=nullish}assertArgument(typeof value==="number",`invalud value for ${name}`,"costs",costs);props[name]=value}set("txBase",21e3);set("txCreate",32e3);set("txDataZero",4);set("txDataNonzero",16);set("txAccessListStorageKey",1900);set("txAccessListAddress",2400);defineProperties(this,props)}clone(){return new EnergyCostPlugin(this.effectiveBlock,this)}}class FeeDataNetworkPlugin extends NetworkPlugin{#feeDataFunc;get feeDataFunc(){return this.#feeDataFunc}constructor(feeDataFunc){super("org.corebc.plugins.network.FeeData");this.#feeDataFunc=feeDataFunc}async getFeeData(provider){return await this.#feeDataFunc(provider)}clone(){return new FeeDataNetworkPlugin(this.#feeDataFunc)}}const Networks=new Map;class Network{#name;#networkId;#plugins;constructor(name,networkId){this.#name=name;this.#networkId=getBigInt(networkId);this.#plugins=new Map}toJSON(){return{name:this.name,networkId:String(this.networkId)}}get name(){return this.#name}set name(value){this.#name=value}get networkId(){return this.#networkId}set networkId(value){this.#networkId=getBigInt(value,"networkId")}matches(other){if(other==null){return false}if(typeof other==="string"){try{return this.networkId===getBigInt(other)}catch(error){}return this.name===other}if(typeof other==="number"||typeof other==="bigint"){try{return this.networkId===getBigInt(other)}catch(error){}return false}if(typeof other==="object"){if(other.networkId!=null){try{return this.networkId===getBigInt(other.networkId)}catch(error){}return false}if(other.name!=null){return this.name===other.name}return false}return false}get plugins(){return Array.from(this.#plugins.values())}attachPlugin(plugin){if(this.#plugins.get(plugin.name)){throw new Error(`cannot replace existing plugin: ${plugin.name} `)}this.#plugins.set(plugin.name,plugin.clone());return this}getPlugin(name){return this.#plugins.get(name)||null}getPlugins(basename){return this.plugins.filter(p=>p.name.split("#")[0]===basename)}clone(){const clone=new Network(this.name,this.networkId);this.plugins.forEach(plugin=>{clone.attachPlugin(plugin.clone())});return clone}computeIntrinsicEnergy(tx){const costs=this.getPlugin("org.corebc.plugins.network.EnergyCost")||new EnergyCostPlugin;let energy=costs.txBase;if(tx.to==null){energy+=costs.txCreate}if(tx.data){for(let i=2;i{Network.register(name,func)})}}registerEth("mainnet",1,{ensNetwork:1,altNames:["homestead"]});registerEth("ropsten",3,{ensNetwork:3});registerEth("rinkeby",4,{ensNetwork:4});registerEth("goerli",5,{ensNetwork:5});registerEth("kovan",42,{ensNetwork:42});registerEth("sepolia",11155111,{});registerEth("classic",61,{});registerEth("classicKotti",6,{});registerEth("xdai",100,{ensNetwork:1})}function copy$2(obj){return JSON.parse(JSON.stringify(obj))}class PollingBlockSubscriber{#provider;#poller;#interval;#blockNumber;constructor(provider){this.#provider=provider;this.#poller=null;this.#interval=4e3;this.#blockNumber=-2}get pollingInterval(){return this.#interval}set pollingInterval(value){this.#interval=value}async#poll(){try{const blockNumber=await this.#provider.getBlockNumber();if(this.#blockNumber===-2){this.#blockNumber=blockNumber;return}if(blockNumber!==this.#blockNumber){for(let b=this.#blockNumber+1;b<=blockNumber;b++){if(this.#poller==null){return}await this.#provider.emit("block",b)}this.#blockNumber=blockNumber}}catch(error){}if(this.#poller==null){return}this.#poller=this.#provider._setTimeout(this.#poll.bind(this),this.#interval)}start(){if(this.#poller){return}this.#poller=this.#provider._setTimeout(this.#poll.bind(this),this.#interval);this.#poll()}stop(){if(!this.#poller){return}this.#provider._clearTimeout(this.#poller);this.#poller=null}pause(dropWhilePaused){this.stop();if(dropWhilePaused){this.#blockNumber=-2}}resume(){this.start()}}class OnBlockSubscriber{#provider;#poll;#running;constructor(provider){this.#provider=provider;this.#running=false;this.#poll=blockNumber=>{this._poll(blockNumber,this.#provider)}}async _poll(blockNumber,provider){throw new Error("sub-classes must override this")}start(){if(this.#running){return}this.#running=true;this.#poll(-2);this.#provider.on("block",this.#poll)}stop(){if(!this.#running){return}this.#running=false;this.#provider.off("block",this.#poll)}pause(dropWhilePaused){this.stop()}resume(){this.start()}}class PollingOrphanSubscriber extends OnBlockSubscriber{#filter;constructor(provider,filter){super(provider);this.#filter=copy$2(filter)}async _poll(blockNumber,provider){throw new Error("@TODO")}}class PollingTransactionSubscriber extends OnBlockSubscriber{#hash;constructor(provider,hash){super(provider);this.#hash=hash}async _poll(blockNumber,provider){const tx=await provider.getTransactionReceipt(this.#hash);if(tx){provider.emit(this.#hash,tx)}}}class PollingEventSubscriber{#provider;#filter;#poller;#running;#blockNumber;constructor(provider,filter){this.#provider=provider;this.#filter=copy$2(filter);this.#poller=this.#poll.bind(this);this.#running=false;this.#blockNumber=-2}async#poll(blockNumber){if(this.#blockNumber===-2){return}const filter=copy$2(this.#filter);filter.fromBlock=this.#blockNumber+1;filter.toBlock=blockNumber;const logs=await this.#provider.getLogs(filter);if(logs.length===0){if(this.#blockNumber{this.#blockNumber=blockNumber})}this.#provider.on("block",this.#poller)}stop(){if(!this.#running){return}this.#running=false;this.#provider.off("block",this.#poller)}pause(dropWhilePaused){this.stop();if(dropWhilePaused){this.#blockNumber=-2}}resume(){this.start()}}const MAX_CCIP_REDIRECTS=10;function isPromise(value){return value&&typeof value.then==="function"}function getTag(prefix,value){return prefix+":"+JSON.stringify(value,(k,v)=>{if(v==null){return"null"}if(typeof v==="bigint"){return`bigint:${v.toString()}`}if(typeof v==="string"){return v.toLowerCase()}if(typeof v==="object"&&!Array.isArray(v)){const keys=Object.keys(v);keys.sort();return keys.reduce((accum,key)=>{accum[key]=v[key];return accum},{})}return v})}class UnmanagedSubscriber{name;constructor(name){defineProperties(this,{name:name})}start(){}stop(){}pause(dropWhilePaused){}resume(){}}function copy$1(value){return JSON.parse(JSON.stringify(value))}function concisify(items){items=Array.from(new Set(items).values());items.sort();return items}async function getSubscription(_event,provider){if(_event==null){throw new Error("invalid event")}if(Array.isArray(_event)){_event={topics:_event}}if(typeof _event==="string"){switch(_event){case"block":case"pending":case"debug":case"error":case"network":{return{type:_event,tag:_event}}}}if(isHexString(_event,32)){const hash=_event.toLowerCase();return{type:"transaction",tag:getTag("tx",{hash:hash}),hash:hash}}if(_event.orphan){const event=_event;return{type:"orphan",tag:getTag("orphan",event),filter:copy$1(event)}}if(_event.address||_event.topics){const event=_event;const filter={topics:(event.topics||[]).map(t=>{if(t==null){return null}if(Array.isArray(t)){return concisify(t.map(t=>t.toLowerCase()))}return t.toLowerCase()})};if(event.address){const addresses=[];const promises=[];const addAddress=addr=>{if(isHexString(addr)){addresses.push(addr)}else{promises.push((async()=>{addresses.push(await resolveAddress(addr))})())}};if(Array.isArray(event.address)){event.address.forEach(addAddress)}else{addAddress(event.address)}if(promises.length){await Promise.all(promises)}filter.address=concisify(addresses.map(a=>a.toLowerCase()))}return{filter:filter,tag:getTag("event",filter),type:"event"}}assertArgument(false,"unknown ProviderEvent","event",_event)}function getTime$1(){return(new Date).getTime()}class AbstractProvider{#subs;#plugins;#pausedState;#networkPromise;#anyNetwork;#performCache;#lastBlockNumber;#nextTimer;#timers;#disableCcipRead;constructor(_network){if(_network==="any"){this.#anyNetwork=true;this.#networkPromise=null}else if(_network){const network=Network.from(_network);this.#anyNetwork=false;this.#networkPromise=Promise.resolve(network);setTimeout(()=>{this.emit("network",network,null)},0)}else{this.#anyNetwork=false;this.#networkPromise=null}this.#lastBlockNumber=-1;this.#performCache=new Map;this.#subs=new Map;this.#plugins=new Map;this.#pausedState=null;this.#nextTimer=1;this.#timers=new Map;this.#disableCcipRead=false}get provider(){return this}get plugins(){return Array.from(this.#plugins.values())}attachPlugin(plugin){if(this.#plugins.get(plugin.name)){throw new Error(`cannot replace existing plugin: ${plugin.name} `)}this.#plugins.set(plugin.name,plugin.connect(this));return this}getPlugin(name){return this.#plugins.get(name)||null}get disableCcipRead(){return this.#disableCcipRead}set disableCcipRead(value){this.#disableCcipRead=!!value}async#perform(req){const tag=getTag(req.method,req);let perform=this.#performCache.get(tag);if(!perform){perform=this._perform(req);this.#performCache.set(tag,perform);setTimeout(()=>{if(this.#performCache.get(tag)===perform){this.#performCache.delete(tag)}},250)}return await perform}async ccipReadFetch(tx,calldata,urls){if(this.disableCcipRead||urls.length===0||tx.to==null){return null}const sender=tx.to.toLowerCase();const data=calldata.toLowerCase();const errorMessages=[];for(let i=0;i=500,`response not found during CCIP fetch: ${errorMessage}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:tx,info:{url:url,errorMessage:errorMessage}});errorMessages.push(errorMessage)}assert(false,`error encountered during CCIP fetch: ${errorMessages.map(m=>JSON.stringify(m)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:tx,info:{urls:urls,errorMessages:errorMessages}})}_wrapBlock(value,network){return new Block(formatBlock(value),this)}_wrapLog(value,network){return new Log(formatLog(value),this)}_wrapTransactionReceipt(value,network){return new TransactionReceipt(formatTransactionReceipt(value),this)}_wrapTransactionResponse(tx,network){return new TransactionResponse(formatTransactionResponse(tx),this)}_detectNetwork(){assert(false,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(req){assert(false,`unsupported method: ${req.method}`,"UNSUPPORTED_OPERATION",{operation:req.method,info:req})}async getBlockNumber(){const blockNumber=getNumber(await this.#perform({method:"getBlockNumber"}),"%response");if(this.#lastBlockNumber>=0){this.#lastBlockNumber=blockNumber}return blockNumber}_getAddress(address){return resolveAddress(address)}_getBlockTag(blockTag){if(blockTag==null){return"latest"}switch(blockTag){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return blockTag}if(isHexString(blockTag)){if(isHexString(blockTag,32)){return blockTag}return toQuantity(blockTag)}if(typeof blockTag==="bigint"){blockTag=getNumber(blockTag,"blockTag")}if(typeof blockTag==="number"){if(blockTag>=0){return toQuantity(blockTag)}if(this.#lastBlockNumber>=0){return toQuantity(this.#lastBlockNumber+blockTag)}return this.getBlockNumber().then(b=>toQuantity(b+blockTag))}assertArgument(false,"invalid blockTag","blockTag",blockTag)}_getFilter(filter){const topics=(filter.topics||[]).map(t=>{if(t==null){return null}if(Array.isArray(t)){return concisify(t.map(t=>t.toLowerCase()))}return t.toLowerCase()});const blockHash="blockHash"in filter?filter.blockHash:undefined;const resolve=(_address,fromBlock,toBlock)=>{let address=undefined;switch(_address.length){case 0:break;case 1:address=_address[0];break;default:_address.sort();address=_address}if(blockHash){if(fromBlock!=null||toBlock!=null){throw new Error("invalid filter")}}const filter={};if(address){filter.address=address}if(topics.length){filter.topics=topics}if(fromBlock){filter.fromBlock=fromBlock}if(toBlock){filter.toBlock=toBlock}if(blockHash){filter.blockHash=blockHash}return filter};let address=[];if(filter.address){if(Array.isArray(filter.address)){for(const addr of filter.address){address.push(this._getAddress(addr))}}else{address.push(this._getAddress(filter.address))}}let fromBlock=undefined;if("fromBlock"in filter){fromBlock=this._getBlockTag(filter.fromBlock)}let toBlock=undefined;if("toBlock"in filter){toBlock=this._getBlockTag(filter.toBlock)}if(address.filter(a=>typeof a!=="string").length||fromBlock!=null&&typeof fromBlock!=="string"||toBlock!=null&&typeof toBlock!=="string"){return Promise.all([Promise.all(address),fromBlock,toBlock]).then(result=>{return resolve(result[0],result[1],result[2])})}return resolve(address,fromBlock,toBlock)}_getTransactionRequest(_request){const request=copyRequest(_request);const promises=[];["to","from"].forEach(key=>{if(request[key]==null){return}const addr=resolveAddress(request[key]);if(isPromise(addr)){promises.push(async function(){request[key]=await addr}())}else{request[key]=addr}});if(request.blockTag!=null){const blockTag=this._getBlockTag(request.blockTag);if(isPromise(blockTag)){promises.push(async function(){request.blockTag=await blockTag}())}else{request.blockTag=blockTag}}if(promises.length){return async function(){await Promise.all(promises);return request}()}return request}async getNetwork(){if(this.#networkPromise==null){const detectNetwork=this._detectNetwork().then(network=>{this.emit("network",network,null);return network},error=>{if(this.#networkPromise===detectNetwork){this.#networkPromise=null}throw error});this.#networkPromise=detectNetwork;return(await detectNetwork).clone()}const networkPromise=this.#networkPromise;const[expected,actual]=await Promise.all([networkPromise,this._detectNetwork()]);if(expected.networkId!==actual.networkId){if(this.#anyNetwork){this.emit("network",actual,expected);if(this.#networkPromise===networkPromise){this.#networkPromise=Promise.resolve(actual)}}else{assert(false,`network changed: ${expected.networkId} => ${actual.networkId} `,"NETWORK_ERROR",{event:"changed"})}}return expected.clone()}async getEnergyPrice(){const{energyPrice}=await resolveProperties({block:this.getBlock("latest"),energyPrice:(async()=>{try{const energyPrice=await this.#perform({method:"getEnergyPrice"});return getBigInt(energyPrice,"%response")}catch(error){}return null})()});return new FeeData(energyPrice)}async getFeeData(){const{energyPrice}=await resolveProperties({block:this.getBlock("latest"),energyPrice:(async()=>{try{const energyPrice=await this.#perform({method:"getEnergyPrice"});return getBigInt(energyPrice,"%response")}catch(error){}return null})()});return new FeeData(energyPrice)}async estimateEnergy(_tx){let tx=this._getTransactionRequest(_tx);if(isPromise(tx)){tx=await tx}return getBigInt(await this.#perform({method:"estimateEnergy",transaction:tx}),"%response")}async#call(tx,blockTag,attempt){assert(attempt=0&&blockTag==="latest"&&transaction.to!=null&&dataSlice(error.data,0,4)==="0x556f1830"){const data=error.data;const txSender=await resolveAddress(transaction.to);let ccipArgs;try{ccipArgs=parseOffchainLookup(dataSlice(error.data,4))}catch(error){assert(false,error.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:transaction,info:{data:data}})}assert(ccipArgs.sender.toLowerCase()===txSender.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:data,reason:"OffchainLookup",transaction:transaction,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:ccipArgs.errorArgs}});const ccipResult=await this.ccipReadFetch(transaction,ccipArgs.calldata,ccipArgs.urls);assert(ccipResult!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:transaction,info:{data:error.data,errorArgs:ccipArgs.errorArgs}});const tx={to:txSender,data:concat([ccipArgs.selector,encodeBytes([ccipResult,ccipArgs.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:tx});try{const result=await this.#call(tx,blockTag,attempt+1);this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},tx),result:result});return result}catch(error){this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},tx),error:error});throw error}}throw error}}async#checkNetwork(promise){const{value}=await resolveProperties({network:this.getNetwork(),value:promise});return value}async call(_tx){const{tx,blockTag}=await resolveProperties({tx:this._getTransactionRequest(_tx),blockTag:this._getBlockTag(_tx.blockTag)});return await this.#checkNetwork(this.#call(tx,blockTag,_tx.enableCcipRead?0:-1))}async#getAccountValue(request,_address,_blockTag){let address=this._getAddress(_address);let blockTag=this._getBlockTag(_blockTag);if(typeof address!=="string"||typeof blockTag!=="string"){[address,blockTag]=await Promise.all([address,blockTag])}return await this.#checkNetwork(this.#perform(Object.assign(request,{address:address,blockTag:blockTag})))}async getBalance(address,blockTag){return getBigInt(await this.#getAccountValue({method:"getBalance"},address,blockTag),"%response")}async getTransactionCount(address,blockTag){return getNumber(await this.#getAccountValue({method:"getTransactionCount"},address,blockTag),"%response")}async getCode(address,blockTag){return hexlify(await this.#getAccountValue({method:"getCode"},address,blockTag))}async getStorage(address,_position,blockTag){const position=getBigInt(_position,"position");return hexlify(await this.#getAccountValue({method:"getStorage",position:position},address,blockTag))}async broadcastTransaction(signedTx){const{blockNumber,hash,network}=await resolveProperties({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:signedTx}),network:this.getNetwork()});const tx=Transaction.from(signedTx);if(tx.hash!==hash){throw new Error("@TODO: the returned hash did not match")}return this._wrapTransactionResponse(tx,network).replaceableTransaction(blockNumber)}async#getBlock(block,includeTransactions){if(isHexString(block,32)){return await this.#perform({method:"getBlock",blockHash:block,includeTransactions:includeTransactions})}let blockTag=this._getBlockTag(block);if(typeof blockTag!=="string"){blockTag=await blockTag}return await this.#perform({method:"getBlock",blockTag:blockTag,includeTransactions:includeTransactions})}async getBlock(block,prefetchTxs){const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#getBlock(block,!!prefetchTxs)});if(params==null){return null}return this._wrapBlock(params,network)}async getTransaction(hash){const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#perform({method:"getTransaction",hash:hash})});if(params==null){return null}return this._wrapTransactionResponse(params,network)}async getTransactionReceipt(hash){const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#perform({method:"getTransactionReceipt",hash:hash})});if(params==null){return null}if(params.energyPrice==null&¶ms.effectiveEnergyPrice==null){const tx=await this.#perform({method:"getTransaction",hash:hash});if(tx==null){throw new Error("report this; could not find tx or effectiveEnergyPrice")}params.effectiveEnergyPrice=tx.energyPrice}return this._wrapTransactionReceipt(params,network)}async getTransactionResult(hash){const{result}=await resolveProperties({network:this.getNetwork(),result:this.#perform({method:"getTransactionResult",hash:hash})});if(result==null){return null}return hexlify(result)}async getLogs(_filter){let filter=this._getFilter(_filter);if(isPromise(filter)){filter=await filter}const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#perform({method:"getLogs",filter:filter})});return params.map(p=>this._wrapLog(p,network))}_getProvider(networkId){assert(false,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async waitForTransaction(hash,_confirms,timeout){const confirms=_confirms!=null?_confirms:1;if(confirms===0){return this.getTransactionReceipt(hash)}return new Promise(async(resolve,reject)=>{let timer=null;const listener=async blockNumber=>{try{const receipt=await this.getTransactionReceipt(hash);if(receipt!=null){if(blockNumber-receipt.blockNumber+1>=confirms){resolve(receipt);if(timer){clearTimeout(timer);timer=null}return}}}catch(error){console.log("EEE",error)}this.once("block",listener)};if(timeout!=null){timer=setTimeout(()=>{if(timer==null){return}timer=null;this.off("block",listener);reject(makeError("timeout","TIMEOUT",{reason:"timeout"}))},timeout)}listener(await this.getBlockNumber())})}async waitForBlock(blockTag){assert(false,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(timerId){const timer=this.#timers.get(timerId);if(!timer){return}if(timer.timer){clearTimeout(timer.timer)}this.#timers.delete(timerId)}_setTimeout(_func,timeout){if(timeout==null){timeout=0}const timerId=this.#nextTimer++;const func=()=>{this.#timers.delete(timerId);_func()};if(this.paused){this.#timers.set(timerId,{timer:null,func:func,time:timeout})}else{const timer=setTimeout(func,timeout);this.#timers.set(timerId,{timer:timer,func:func,time:getTime$1()})}return timerId}_forEachSubscriber(func){for(const sub of this.#subs.values()){func(sub.subscriber)}}_getSubscriber(sub){switch(sub.type){case"debug":case"error":case"network":return new UnmanagedSubscriber(sub.type);case"block":return new PollingBlockSubscriber(this);case"event":return new PollingEventSubscriber(this,sub.filter);case"transaction":return new PollingTransactionSubscriber(this,sub.hash);case"orphan":return new PollingOrphanSubscriber(this,sub.filter)}throw new Error(`unsupported event: ${sub.type}`)}_recoverSubscriber(oldSub,newSub){for(const sub of this.#subs.values()){if(sub.subscriber===oldSub){if(sub.started){sub.subscriber.stop()}sub.subscriber=newSub;if(sub.started){newSub.start()}if(this.#pausedState!=null){newSub.pause(this.#pausedState)}break}}}async#hasSub(event,emitArgs){let sub=await getSubscription(event);if(sub.type==="event"&&emitArgs&&emitArgs.length>0&&emitArgs[0].removed===true){sub=await getSubscription({orphan:"drop-log",log:emitArgs[0]})}return this.#subs.get(sub.tag)||null}async#getSub(event){const subscription=await getSubscription(event);const tag=subscription.tag;let sub=this.#subs.get(tag);if(!sub){const subscriber=this._getSubscriber(subscription);const addressableMap=new WeakMap;const nameMap=new Map;sub={subscriber:subscriber,tag:tag,addressableMap:addressableMap,nameMap:nameMap,started:false,listeners:[]};this.#subs.set(tag,sub)}return sub}async on(event,listener){const sub=await this.#getSub(event);sub.listeners.push({listener:listener,once:false});if(!sub.started){sub.subscriber.start();sub.started=true;if(this.#pausedState!=null){sub.subscriber.pause(this.#pausedState)}}return this}async once(event,listener){const sub=await this.#getSub(event);sub.listeners.push({listener:listener,once:true});if(!sub.started){sub.subscriber.start();sub.started=true;if(this.#pausedState!=null){sub.subscriber.pause(this.#pausedState)}}return this}async emit(event,...args){const sub=await this.#hasSub(event,args);if(!sub||sub.listeners.length===0){return false}const count=sub.listeners.length;sub.listeners=sub.listeners.filter(({listener,once})=>{const payload=new EventPayload(this,once?null:listener,event);try{listener.call(this,...args,payload)}catch(error){}return!once});if(sub.listeners.length===0){if(sub.started){sub.subscriber.stop()}this.#subs.delete(sub.tag)}return count>0}async listenerCount(event){if(event){const sub=await this.#hasSub(event);if(!sub){return 0}return sub.listeners.length}let total=0;for(const{listeners}of this.#subs.values()){total+=listeners.length}return total}async listeners(event){if(event){const sub=await this.#hasSub(event);if(!sub){return[]}return sub.listeners.map(({listener})=>listener)}let result=[];for(const{listeners}of this.#subs.values()){result=result.concat(listeners.map(({listener})=>listener))}return result}async off(event,listener){const sub=await this.#hasSub(event);if(!sub){return this}if(listener){const index=sub.listeners.map(({listener})=>listener).indexOf(listener);if(index>=0){sub.listeners.splice(index,1)}}if(!listener||sub.listeners.length===0){if(sub.started){sub.subscriber.stop()}this.#subs.delete(sub.tag)}return this}async removeAllListeners(event){if(event){const{tag,started,subscriber}=await this.#getSub(event);if(started){subscriber.stop()}this.#subs.delete(tag)}else{for(const[tag,{started,subscriber}]of this.#subs){if(started){subscriber.stop()}this.#subs.delete(tag)}}return this}async addListener(event,listener){return await this.on(event,listener)}async removeListener(event,listener){return this.off(event,listener)}destroy(){this.removeAllListeners();for(const timerId of this.#timers.keys()){this._clearTimeout(timerId)}}get paused(){return this.#pausedState!=null}set paused(pause){if(!!pause===this.paused){return}if(this.paused){this.resume()}else{this.pause(false)}}pause(dropWhilePaused){this.#lastBlockNumber=-1;if(this.#pausedState!=null){if(this.#pausedState==!!dropWhilePaused){return}assert(false,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(s=>s.pause(dropWhilePaused));this.#pausedState=!!dropWhilePaused;for(const timer of this.#timers.values()){if(timer.timer){clearTimeout(timer.timer)}timer.time=getTime$1()-timer.time}}resume(){if(this.#pausedState==null){return}this._forEachSubscriber(s=>s.resume());this.#pausedState=null;for(const timer of this.#timers.values()){let timeout=timer.time;if(timeout<0){timeout=0}timer.time=getTime$1();setTimeout(timer.func,timeout)}}}function _parseString(result,start){try{const bytes=_parseBytes(result,start);if(bytes){return toUtf8String(bytes)}}catch(error){}return null}function _parseBytes(result,start){if(result==="0x"){return null}try{const offset=getNumber(dataSlice(result,start,start+32));const length=getNumber(dataSlice(result,offset,offset+32));return dataSlice(result,offset+32,offset+32+length)}catch(error){}return null}function numPad(value){const result=toBeArray(value);if(result.length>32){throw new Error("internal; should not happen")}const padded=new Uint8Array(32);padded.set(result,32-result.length);return padded}function bytesPad(value){if(value.length%32===0){return value}const result=new Uint8Array(Math.ceil(value.length/32)*32);result.set(value);return result}const empty=new Uint8Array([]);function encodeBytes(datas){const result=[];let byteCount=0;for(let i=0;i=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const sender=dataSlice(data,0,32);assert(dataSlice(sender,0,12)===dataSlice(zeros,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"});result.sender=dataSlice(sender,12);try{const urls=[];const urlsOffset=getNumber(dataSlice(data,32,64));const urlsLength=getNumber(dataSlice(data,urlsOffset,urlsOffset+32));const urlsData=dataSlice(data,urlsOffset+32);for(let u=0;uresult[k]);return result}function checkProvider(signer,operation){if(signer.provider){return signer.provider}assert(false,"missing provider","UNSUPPORTED_OPERATION",{operation:operation})}async function populate(signer,tx){let pop=copyRequest(tx);if(pop.to!=null){pop.to=resolveAddress(pop.to)}if(pop.from!=null){const from=pop.from;pop.from=Promise.all([signer.getAddress(),resolveAddress(from)]).then(([address,from])=>{assertArgument(address.toLowerCase()===from.toLowerCase(),"transaction from mismatch","tx.from",from);return address})}else{pop.from=signer.getAddress()}return await resolveProperties(pop)}class AbstractSigner{provider;constructor(provider){defineProperties(this,{provider:provider||null})}async getNonce(blockTag){return checkProvider(this,"getTransactionCount").getTransactionCount(await this.getAddress(),blockTag)}async populateCall(tx){const pop=await populate(this,tx);return pop}async populateTransaction(tx){const provider=checkProvider(this,"populateTransaction");const pop=await populate(this,tx);if(pop.nonce==null){pop.nonce=await this.getNonce("pending")}if(pop.energyLimit==null){pop.energyLimit=await this.estimateEnergy(pop)}const network=await this.provider.getNetwork();if(pop.networkId!=null){const networkId=getBigInt(pop.networkId);assertArgument(networkId===network.networkId,"transaction networkId mismatch","tx.networkId",tx.networkId)}else{pop.networkId=network.networkId}const feeData=await provider.getFeeData();if(feeData.energyPrice!=null){if(pop.energyPrice==null){pop.energyPrice=feeData.energyPrice}}else{assert(false,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"})}return await resolveProperties(pop)}async estimateEnergy(tx){return checkProvider(this,"estimateEnergy").estimateEnergy(await this.populateCall(tx))}async call(tx){return checkProvider(this,"call").call(await this.populateCall(tx))}async resolveName(name){return getAddress(name)}async sendTransaction(tx){const provider=checkProvider(this,"sendTransaction");const pop=await this.populateTransaction(tx);delete pop.from;const txObj=Transaction.from(pop);return await provider.broadcastTransaction(await this.signTransaction(txObj))}}class VoidSigner extends AbstractSigner{address;constructor(address,provider){super(provider);defineProperties(this,{address:address})}async getAddress(){return this.address}connect(provider){return new VoidSigner(this.address,provider)}#throwUnsupported(suffix,operation){assert(false,`VoidSigner cannot sign ${suffix}`,"UNSUPPORTED_OPERATION",{operation:operation})}async signTransaction(tx){this.#throwUnsupported("transactions","signTransaction")}async signMessage(message){this.#throwUnsupported("messages","signMessage")}async signTypedData(domain,types,value){this.#throwUnsupported("typed-data","signTypedData")}}const shown=new Set;function showThrottleMessage(service){if(shown.has(service)){return}shown.add(service);console.log("========= NOTICE =========");console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`);console.log("");console.log("The default API keys for each service are provided as a highly-throttled,");console.log("community resource for low-traffic projects and early prototyping.");console.log("");console.log("While your application will continue to function, we highly recommended");console.log("signing up for your own API keys to improve performance, increase your");console.log("request rate/limit and enable other perks, such as metrics and advanced APIs.");console.log("")}function copy(obj){return JSON.parse(JSON.stringify(obj))}class FilterIdSubscriber{#provider;#filterIdPromise;#poller;#running;#network;#hault;constructor(provider){this.#provider=provider;this.#filterIdPromise=null;this.#poller=this.#poll.bind(this);this.#running=false;this.#network=null;this.#hault=false}_subscribe(provider){throw new Error("subclasses must override this")}_emitResults(provider,result){throw new Error("subclasses must override this")}_recover(provider){throw new Error("subclasses must override this")}async#poll(blockNumber){try{if(this.#filterIdPromise==null){this.#filterIdPromise=this._subscribe(this.#provider)}let filterId=null;try{filterId=await this.#filterIdPromise}catch(error){if(!isError(error,"UNSUPPORTED_OPERATION")||error.operation!=="xcb_newFilter"){throw error}}if(filterId==null){this.#filterIdPromise=null;this.#provider._recoverSubscriber(this,this._recover(this.#provider));return}const network=await this.#provider.getNetwork();if(!this.#network){this.#network=network}if(this.#network.networkId!==network.networkId){throw new Error("chaid changed")}if(this.#hault){return}const result=await this.#provider.send("xcb_getFilterChanges",[filterId]);await this._emitResults(this.#provider,result)}catch(error){console.log("@TODO",error)}this.#provider.once("block",this.#poller)}#teardown(){const filterIdPromise=this.#filterIdPromise;if(filterIdPromise){this.#filterIdPromise=null;filterIdPromise.then(filterId=>{this.#provider.send("xcb_uninstallFilter",[filterId])})}}start(){if(this.#running){return}this.#running=true;this.#poll(-2)}stop(){if(!this.#running){return}this.#running=false;this.#hault=true;this.#teardown();this.#provider.off("block",this.#poller)}pause(dropWhilePaused){if(dropWhilePaused){this.#teardown()}this.#provider.off("block",this.#poller)}resume(){this.start()}}class FilterIdEventSubscriber extends FilterIdSubscriber{#event;constructor(provider,filter){super(provider);this.#event=copy(filter)}_recover(provider){return new PollingEventSubscriber(provider,this.#event)}async _subscribe(provider){const filterId=await provider.send("xcb_newFilter",[this.#event]);return filterId}async _emitResults(provider,results){for(const result of results){provider.emit(this.#event,provider._wrapLog(result,provider._network))}}}class FilterIdPendingSubscriber extends FilterIdSubscriber{async _subscribe(provider){return await provider.send("xcb_newPendingTransactionFilter",[])}async _emitResults(provider,results){for(const result of results){provider.emit("pending",result)}}}const Primitive="bigint,boolean,function,number,string,symbol".split(/,/g);function deepCopy(value){if(value==null||Primitive.indexOf(typeof value)>=0){return value}if(typeof value.getAddress==="function"){return value}if(Array.isArray(value)){return value.map(deepCopy)}if(typeof value==="object"){return Object.keys(value).reduce((accum,key)=>{accum[key]=value[key];return accum},{})}throw new Error(`should not happen: ${value} (${typeof value})`)}function stall$3(duration){return new Promise(resolve=>{setTimeout(resolve,duration)})}function getLowerCase(value){if(value){return value.toLowerCase()}return value}function isPollable(value){return value&&typeof value.pollingInterval==="number"}const defaultOptions={polling:false,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100};class JsonRpcSigner extends AbstractSigner{address;constructor(provider,address){super(provider);address=getAddress(address);defineProperties(this,{address:address})}connect(provider){assert(false,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(tx){return await this.populateCall(tx)}async sendUncheckedTransaction(_tx){const tx=deepCopy(_tx);const promises=[];if(tx.from){const _from=tx.from;promises.push((async()=>{const from=await resolveAddress(_from);assertArgument(from!=null&&from.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",_tx);tx.from=from})())}else{tx.from=this.address}if(tx.energyLimit==null){promises.push((async()=>{tx.energyLimit=await this.provider.estimateEnergy({...tx,from:this.address})})())}if(tx.to!=null){const _to=tx.to;promises.push((async()=>{tx.to=await resolveAddress(_to)})())}if(promises.length){await Promise.all(promises)}const hexTx=this.provider.getRpcTransaction(tx);return this.provider.send("xcb_sendTransaction",[hexTx])}async sendTransaction(tx){const blockNumber=await this.provider.getBlockNumber();const hash=await this.sendUncheckedTransaction(tx);return await new Promise((resolve,reject)=>{const timeouts=[1e3,100];const checkTx=async()=>{const tx=await this.provider.getTransaction(hash);if(tx!=null){resolve(tx.replaceableTransaction(blockNumber));return}this.provider._setTimeout(()=>{checkTx()},timeouts.pop()||4e3)};checkTx()})}async signTransaction(_tx){const tx=deepCopy(_tx);if(tx.from){const from=await resolveAddress(tx.from);assertArgument(from!=null&&from.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",_tx);tx.from=from}else{tx.from=this.address}const hexTx=this.provider.getRpcTransaction(tx);return await this.provider.send("xcb_signTransaction",[hexTx])}async signMessage(_message){const message=typeof _message==="string"?toUtf8Bytes(_message):_message;return await this.provider.send("personal_sign",[hexlify(message),this.address.toLowerCase()])}async signTypedData(domain,types,_value){const value=deepCopy(_value);const populated=await TypedDataEncoder.resolveNames(domain,types,value,async value=>{const address=await resolveAddress(value);assertArgument(address!=null,"TypedData does not support null address","value",value);return address});return await this.provider.send("xcb_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(TypedDataEncoder.getPayload(populated.domain,types,populated.value))])}async unlock(password){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),password,null])}async _legacySignMessage(_message){const message=typeof _message==="string"?toUtf8Bytes(_message):_message;return await this.provider.send("xcb_sign",[this.address.toLowerCase(),hexlify(message)])}}class JsonRpcApiProvider extends AbstractProvider{#options;#nextId;#payloads;#drainTimer;#notReady;#network;#scheduleDrain(){if(this.#drainTimer){return}const stallTime=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");this.#drainTimer=setTimeout(()=>{this.#drainTimer=null;const payloads=this.#payloads;this.#payloads=[];while(payloads.length){const batch=[payloads.shift()];while(payloads.length){if(batch.length===this.#options.batchMaxCount){break}batch.push(payloads.shift());const bytes=JSON.stringify(batch.map(p=>p.payload));if(bytes.length>this.#options.batchMaxSize){payloads.unshift(batch.pop());break}}(async()=>{const payload=batch.length===1?batch[0].payload:batch.map(p=>p.payload);this.emit("debug",{action:"sendRpcPayload",payload:payload});try{const result=await this._send(payload);this.emit("debug",{action:"receiveRpcResult",result:result});for(const{resolve,reject,payload}of batch){const resp=result.filter(r=>r.id===payload.id)[0];if(resp==null){return reject(makeError("no response from server","BAD_DATA",{value:result,info:{payload:payload}}))}if("error"in resp){return reject(this.getRpcError(payload,resp))}resolve(resp.result)}}catch(error){this.emit("debug",{action:"receiveRpcError",error:error});for(const{reject}of batch){reject(error)}}})()}},stallTime)}constructor(network,options){super(network);this.#nextId=1;this.#options=Object.assign({},defaultOptions,options||{});this.#payloads=[];this.#drainTimer=null;this.#network=null;{let resolve=null;const promise=new Promise(_resolve=>{resolve=_resolve});this.#notReady={promise:promise,resolve:resolve}}const staticNetwork=this._getOption("staticNetwork");if(staticNetwork){assertArgument(network==null||staticNetwork.matches(network),"staticNetwork MUST match network object","options",options);this.#network=staticNetwork}}_getOption(key){return this.#options[key]}get _network(){assert(this.#network,"network is not available yet","NETWORK_ERROR");return this.#network}async _perform(req){const request=this.getRpcRequest(req);if(request!=null){return await this.send(request.method,request.args)}return super._perform(req)}async _detectNetwork(){const network=this._getOption("staticNetwork");if(network){return network}if(this.ready){return Network.from(getBigInt(await this.send("xcb_networkId",[])))}const payload={id:this.#nextId++,method:"xcb_networkId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:payload});let result;try{result=(await this._send(payload))[0]}catch(error){this.emit("debug",{action:"receiveRpcError",error:error});throw error}this.emit("debug",{action:"receiveRpcResult",result:result});if("result"in result){return Network.from(getBigInt(result.result))}throw this.getRpcError(payload,result)}_start(){if(this.#notReady==null||this.#notReady.resolve==null){return}this.#notReady.resolve();this.#notReady=null;(async()=>{while(this.#network==null){try{this.#network=await this._detectNetwork()}catch(error){console.log("JsonRpcProvider failed to startup; retry in 1s");await stall$3(1e3)}}this.#scheduleDrain()})()}async _waitUntilReady(){if(this.#notReady==null){return}return await this.#notReady.promise}_getSubscriber(sub){if(sub.type==="pending"){return new FilterIdPendingSubscriber(this)}if(sub.type==="event"){if(this._getOption("polling")){return new PollingEventSubscriber(this,sub.filter)}return new FilterIdEventSubscriber(this,sub.filter)}if(sub.type==="orphan"&&sub.filter.orphan==="drop-log"){return new UnmanagedSubscriber("orphan")}return super._getSubscriber(sub)}get ready(){return this.#notReady==null}getRpcTransaction(tx){const result={};["networkId","energyLimit","energyPrice","type","nonce","value"].forEach(key=>{if(tx[key]==null){return}let dstKey=key;if(key==="energyLimit"){dstKey="energy"}result[dstKey]=toQuantity(getBigInt(tx[key],`tx.${key}`))});["from","to","data"].forEach(key=>{if(tx[key]==null){return}result[key]=hexlify(tx[key])});return result}getRpcRequest(req){switch(req.method){case"networkId":return{method:"xcb_networkId",args:[]};case"getBlockNumber":return{method:"xcb_blockNumber",args:[]};case"getEnergyPrice":return{method:"xcb_energyPrice",args:[]};case"getBalance":{return{method:"xcb_getBalance",args:[getLowerCase(req.address),req.blockTag]}}case"getTransactionCount":return{method:"xcb_getTransactionCount",args:[getLowerCase(req.address),req.blockTag]};case"getCode":return{method:"xcb_getCode",args:[getLowerCase(req.address),req.blockTag]};case"getStorage":return{method:"xcb_getStorageAt",args:[getLowerCase(req.address),"0x"+req.position.toString(16),req.blockTag]};case"broadcastTransaction":return{method:"xcb_sendRawTransaction",args:[req.signedTransaction]};case"getBlock":if("blockTag"in req){return{method:"xcb_getBlockByNumber",args:[req.blockTag,!!req.includeTransactions]}}else if("blockHash"in req){return{method:"xcb_getBlockByHash",args:[req.blockHash,!!req.includeTransactions]}}break;case"getTransaction":return{method:"xcb_getTransactionByHash",args:[req.hash]};case"getTransactionReceipt":return{method:"xcb_getTransactionReceipt",args:[req.hash]};case"call":return{method:"xcb_call",args:[this.getRpcTransaction(req.transaction),req.blockTag]};case"estimateEnergy":{return{method:"xcb_estimateEnergy",args:[this.getRpcTransaction(req.transaction)]}}case"getLogs":if(req.filter&&req.filter.address!=null){if(Array.isArray(req.filter.address)){req.filter.address=req.filter.address.map(getLowerCase)}else{req.filter.address=getLowerCase(req.filter.address)}}return{method:"xcb_getLogs",args:[req.filter]}}return null}getRpcError(payload,_error){const{method}=payload;const{error}=_error;if(method==="xcb_estimateEnergy"&&error.message){const msg=error.message;if(!msg.match(/revert/i)&&msg.match(/insufficient funds/i)){return makeError("insufficient funds","INSUFFICIENT_FUNDS",{transaction:payload.params[0],info:{payload:payload,error:error}})}}if(method==="xcb_call"||method==="xcb_estimateEnergy"){const result=spelunkData(error);const e=AbiCoder.getBuiltinCallException(method==="xcb_call"?"call":"estimateEnergy",payload.params[0],result?result.data:null);e.info={error:error,payload:payload};return e}const message=JSON.stringify(spelunkMessage(error));if(typeof error.message==="string"&&error.message.match(/user denied|corebc-user-denied/i)){const actionMap={xcb_sign:"signMessage",personal_sign:"signMessage",xcb_signTypedData_v4:"signTypedData",xcb_signTransaction:"signTransaction",xcb_sendTransaction:"sendTransaction",xcb_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"};return makeError(`user rejected action`,"ACTION_REJECTED",{action:actionMap[method]||"unknown",reason:"rejected",info:{payload:payload,error:error}})}if(method==="xcb_sendRawTransaction"||method==="xcb_sendTransaction"){const transaction=payload.params[0];if(message.match(/insufficient funds|base fee exceeds energy limit/i)){return makeError("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:transaction,info:{error:error}})}if(message.match(/nonce/i)&&message.match(/too low/i)){return makeError("nonce has already been used","NONCE_EXPIRED",{transaction:transaction,info:{error:error}})}if(message.match(/replacement transaction/i)&&message.match(/underpriced/i)){return makeError("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:transaction,info:{error:error}})}if(message.match(/only replay-protected/i)){return makeError("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:method,info:{transaction:transaction,info:{error:error}}})}}if(message.match(/the method .* does not exist/i)){return makeError("unsupported operation","UNSUPPORTED_OPERATION",{operation:payload.method,info:{error:error}})}return makeError("could not coalesce error","UNKNOWN_ERROR",{error:error})}send(method,params){const id=this.#nextId++;const promise=new Promise((resolve,reject)=>{this.#payloads.push({resolve:resolve,reject:reject,payload:{method:method,params:params,id:id,jsonrpc:"2.0"}})});this.#scheduleDrain();return promise}async getSigner(address){if(address==null){address=0}const accountsPromise=this.send("xcb_accounts",[]);if(typeof address==="number"){const accounts=await accountsPromise;if(address>=accounts.length){throw new Error("no such account")}return new JsonRpcSigner(this,accounts[address])}const{accounts}=await resolveProperties({network:this.getNetwork(),accounts:accountsPromise});address=getAddress(address);for(const account of accounts){if(getAddress(account)===address){return new JsonRpcSigner(this,address)}}throw new Error("invalid account")}async listAccounts(){const accounts=await this.send("xcb_accounts",[]);return accounts.map(a=>new JsonRpcSigner(this,a))}}class JsonRpcApiPollingProvider extends JsonRpcApiProvider{#pollingInterval;constructor(network,options){super(network,options);this.#pollingInterval=4e3}_getSubscriber(sub){const subscriber=super._getSubscriber(sub);if(isPollable(subscriber)){subscriber.pollingInterval=this.#pollingInterval}return subscriber}get pollingInterval(){return this.#pollingInterval}set pollingInterval(value){if(!Number.isInteger(value)||value<0){throw new Error("invalid interval")}this.#pollingInterval=value;this._forEachSubscriber(sub=>{if(isPollable(sub)){sub.pollingInterval=this.#pollingInterval}})}}class JsonRpcProvider extends JsonRpcApiPollingProvider{#connect;constructor(url,network,options){if(url==null){url="http://localhost:8545"}super(network,options);if(typeof url==="string"){this.#connect=new FetchRequest(url)}else{this.#connect=url.clone()}}_getConnection(){return this.#connect.clone()}async send(method,params){await this._start();return await super.send(method,params)}async _send(payload){const request=this._getConnection();request.body=JSON.stringify(payload);request.setHeader("content-type","application/json");const response=await request.send();response.assertOk();let resp=response.bodyJson;if(!Array.isArray(resp)){resp=[resp]}return resp}}function spelunkData(value){if(value==null){return null}if(typeof value.message==="string"&&value.message.match("reverted")&&isHexString(value.data)){return{message:value.message,data:value.data}}if(typeof value==="object"){for(const key in value){const result=spelunkData(value[key]);if(result){return result}}return null}if(typeof value==="string"){try{return spelunkData(JSON.parse(value))}catch(error){}}return null}function _spelunkMessage(value,result){if(value==null){return}if(typeof value.message==="string"){result.push(value.message)}if(typeof value==="object"){for(const key in value){_spelunkMessage(value[key],result)}}if(typeof value==="string"){try{return _spelunkMessage(JSON.parse(value),result)}catch(error){}}}function spelunkMessage(value){const result=[];_spelunkMessage(value,result);return result}const defaultApiKey$1="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function getHost$4(name){switch(name){case"mainnet":return"rpc.ankr.com/eth";case"goerli":return"rpc.ankr.com/xcb_goerli";case"matic":return"rpc.ankr.com/polygon";case"arbitrum":return"rpc.ankr.com/arbitrum"}assertArgument(false,"unsupported network","network",name)}class AnkrProvider extends JsonRpcProvider{apiKey;constructor(_network,apiKey){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(apiKey==null){apiKey=defaultApiKey$1}const options={polling:true,staticNetwork:network};const request=AnkrProvider.getRequest(network,apiKey);super(request,network,options);defineProperties(this,{apiKey:apiKey})}_getProvider(networkId){try{return new AnkrProvider(networkId,this.apiKey)}catch(error){}return super._getProvider(networkId)}static getRequest(network,apiKey){if(apiKey==null){apiKey=defaultApiKey$1}const request=new FetchRequest(`https:/\/${getHost$4(network.name)}/${apiKey}`);request.allowGzip=true;if(apiKey===defaultApiKey$1){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("AnkrProvider");return true}}return request}getRpcError(payload,error){if(payload.method==="xcb_sendRawTransaction"){if(error&&error.error&&error.error.message==="INTERNAL_ERROR: could not replace existing tx"){error.error.message="replacement transaction underpriced"}}return super.getRpcError(payload,error)}isCommunityResource(){return this.apiKey===defaultApiKey$1}}const defaultApiKey="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function getHost$3(name){switch(name){case"mainnet":return"eth-mainnet.alchemyapi.io";case"goerli":return"eth-goerli.g.alchemy.com";case"sepolia":return"eth-sepolia.g.alchemy.com";case"arbitrum":return"arb-mainnet.g.alchemy.com";case"arbitrum-goerli":return"arb-goerli.g.alchemy.com";case"matic":return"polygon-mainnet.g.alchemy.com";case"matic-mumbai":return"polygon-mumbai.g.alchemy.com";case"optimism":return"opt-mainnet.g.alchemy.com";case"optimism-goerli":return"opt-goerli.g.alchemy.com"}assertArgument(false,"unsupported network","network",name)}class AlchemyProvider extends JsonRpcProvider{apiKey;constructor(_network,apiKey){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(apiKey==null){apiKey=defaultApiKey}const request=AlchemyProvider.getRequest(network,apiKey);super(request,network,{staticNetwork:network});defineProperties(this,{apiKey:apiKey})}_getProvider(networkId){try{return new AlchemyProvider(networkId,this.apiKey)}catch(error){}return super._getProvider(networkId)}async _perform(req){if(req.method==="getTransactionResult"){const{trace,tx}=await resolveProperties({trace:this.send("trace_transaction",[req.hash]),tx:this.getTransaction(req.hash)});if(trace==null||tx==null){return null}let data;let error=false;try{data=trace[0].result.output;error=trace[0].error==="Reverted"}catch(error){}if(data){assert(!error,"an error occurred during transaction executions","CALL_EXCEPTION",{action:"getTransactionResult",data:data,reason:null,transaction:tx,invocation:null,revert:null});return data}assert(false,"could not parse trace result","BAD_DATA",{value:trace})}return await super._perform(req)}isCommunityResource(){return this.apiKey===defaultApiKey}static getRequest(network,apiKey){if(apiKey==null){apiKey=defaultApiKey}const request=new FetchRequest(`https:/\/${getHost$3(network.name)}/v2/${apiKey}`);request.allowGzip=true;if(apiKey===defaultApiKey){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("alchemy");return true}}return request}}class CloudflareProvider extends JsonRpcProvider{constructor(_network){if(_network==null){_network="mainnet"}const network=Network.from(_network);assertArgument(network.name==="mainnet","unsupported network","network",_network);super("https://cloudflare-eth.com/",network,{staticNetwork:network})}}function getGlobal(){if(typeof self!=="undefined"){return self}if(typeof window!=="undefined"){return window}if(typeof global!=="undefined"){return global}throw new Error("unable to locate global object")}const _WebSocket=getGlobal().WebSocket;class SocketSubscriber{#provider;#filter;get filter(){return JSON.parse(this.#filter)}#filterId;#paused;#emitPromise;constructor(provider,filter){this.#provider=provider;this.#filter=JSON.stringify(filter);this.#filterId=null;this.#paused=null;this.#emitPromise=null}start(){this.#filterId=this.#provider.send("xcb_subscribe",this.filter).then(filterId=>{this.#provider._register(filterId,this);return filterId})}stop(){this.#filterId.then(filterId=>{this.#provider.send("xcb_unsubscribe",[filterId])});this.#filterId=null}pause(dropWhilePaused){assert(dropWhilePaused,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"});this.#paused=!!dropWhilePaused}resume(){this.#paused=null}_handleMessage(message){if(this.#filterId==null){return}if(this.#paused===null){let emitPromise=this.#emitPromise;if(emitPromise==null){emitPromise=this._emit(this.#provider,message)}else{emitPromise=emitPromise.then(async()=>{await this._emit(this.#provider,message)})}this.#emitPromise=emitPromise.then(()=>{if(this.#emitPromise===emitPromise){this.#emitPromise=null}})}}async _emit(provider,message){throw new Error("sub-classes must implemente this; _emit")}}class SocketBlockSubscriber extends SocketSubscriber{constructor(provider){super(provider,["newHeads"])}async _emit(provider,message){provider.emit("block",parseInt(message.number))}}class SocketPendingSubscriber extends SocketSubscriber{constructor(provider){super(provider,["newPendingTransactions"])}async _emit(provider,message){provider.emit("pending",message)}}class SocketEventSubscriber extends SocketSubscriber{#logFilter;get logFilter(){return JSON.parse(this.#logFilter)}constructor(provider,filter){super(provider,["logs",filter]);this.#logFilter=JSON.stringify(filter)}async _emit(provider,message){provider.emit(this.logFilter,provider._wrapLog(message,provider._network))}}class SocketProvider extends JsonRpcApiProvider{#callbacks;#subs;#pending;constructor(network){super(network,{batchMaxCount:1});this.#callbacks=new Map;this.#subs=new Map;this.#pending=new Map}_getSubscriber(sub){switch(sub.type){case"close":return new UnmanagedSubscriber("close");case"block":return new SocketBlockSubscriber(this);case"pending":return new SocketPendingSubscriber(this);case"event":return new SocketEventSubscriber(this,sub.filter);case"orphan":if(sub.filter.orphan==="drop-log"){return new UnmanagedSubscriber("drop-log")}}return super._getSubscriber(sub)}_register(filterId,subscriber){this.#subs.set(filterId,subscriber);const pending=this.#pending.get(filterId);if(pending){for(const message of pending){subscriber._handleMessage(message)}this.#pending.delete(filterId)}}async _send(payload){assertArgument(!Array.isArray(payload),"WebSocket does not support batch send","payload",payload);const promise=new Promise((resolve,reject)=>{this.#callbacks.set(payload.id,{payload:payload,resolve:resolve,reject:reject})});await this._waitUntilReady();await this._write(JSON.stringify(payload));return[await promise]}async _processMessage(message){const result=JSON.parse(message);if("id"in result){const callback=this.#callbacks.get(result.id);if(callback==null){this.emit("error",makeError("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:result}));return}this.#callbacks.delete(result.id);callback.resolve(result)}else if(result.method==="xcb_subscription"){const filterId=result.params.subscription;const subscriber=this.#subs.get(filterId);if(subscriber){subscriber._handleMessage(result.params.result)}else{let pending=this.#pending.get(filterId);if(pending==null){pending=[];this.#pending.set(filterId,pending)}pending.push(result.params.result)}}}async _write(message){throw new Error("sub-classes must override this")}}class WebSocketProvider extends SocketProvider{#connect;#websocket;get websocket(){if(this.#websocket==null){throw new Error("websocket closed")}return this.#websocket}constructor(url,network){super(network);if(typeof url==="string"){this.#connect=()=>{return new _WebSocket(url)};this.#websocket=this.#connect()}else if(typeof url==="function"){this.#connect=url;this.#websocket=url()}else{this.#connect=null;this.#websocket=url}this.websocket.onopen=async()=>{try{await this._start();this.resume()}catch(error){console.log("failed to start WebsocketProvider",error)}};this.websocket.onmessage=message=>{this._processMessage(message.data)}}async _write(message){this.websocket.send(message)}async destroy(){if(this.#websocket!=null){this.#websocket.close();this.#websocket=null}super.destroy()}}const defaultProjectId="84842078b09946638c03157f83405213";function getHost$2(name){switch(name){case"mainnet":return"mainnet.infura.io";case"goerli":return"goerli.infura.io";case"sepolia":return"sepolia.infura.io";case"arbitrum":return"arbitrum-mainnet.infura.io";case"arbitrum-goerli":return"arbitrum-goerli.infura.io";case"matic":return"polygon-mainnet.infura.io";case"matic-mumbai":return"polygon-mumbai.infura.io";case"optimism":return"optimism-mainnet.infura.io";case"optimism-goerli":return"optimism-goerli.infura.io"}assertArgument(false,"unsupported network","network",name)}class InfuraWebSocketProvider extends WebSocketProvider{projectId;projectSecret;constructor(network,projectId){const provider=new InfuraProvider(network,projectId);const req=provider._getConnection();assert(!req.credentials,"INFURA WebSocket project secrets unsupported","UNSUPPORTED_OPERATION",{operation:"InfuraProvider.getWebSocketProvider()"});const url=req.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(url,network);defineProperties(this,{projectId:provider.projectId,projectSecret:provider.projectSecret})}isCommunityResource(){return this.projectId===defaultProjectId}}class InfuraProvider extends JsonRpcProvider{projectId;projectSecret;constructor(_network,projectId,projectSecret){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(projectId==null){projectId=defaultProjectId}if(projectSecret==null){projectSecret=null}const request=InfuraProvider.getRequest(network,projectId,projectSecret);super(request,network,{staticNetwork:network});defineProperties(this,{projectId:projectId,projectSecret:projectSecret})}_getProvider(networkId){try{return new InfuraProvider(networkId,this.projectId,this.projectSecret)}catch(error){}return super._getProvider(networkId)}isCommunityResource(){return this.projectId===defaultProjectId}static getWebSocketProvider(network,projectId){return new InfuraWebSocketProvider(network,projectId)}static getRequest(network,projectId,projectSecret){if(projectId==null){projectId=defaultProjectId}if(projectSecret==null){projectSecret=null}const request=new FetchRequest(`https:/\/${getHost$2(network.name)}/v3/${projectId}`);request.allowGzip=true;if(projectSecret){request.setCredentials("",projectSecret)}if(projectId===defaultProjectId){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("InfuraProvider");return true}}return request}}const defaultToken="919b412a057b5e9c9b6dce193c5a60242d6efadb";function getHost$1(name){switch(name){case"mainnet":return"corebc.quiknode.pro";case"arbitrum":return"corebc.arbitrum-mainnet.quiknode.pro";case"arbitrum-goerli":return"corebc.arbitrum-goerli.quiknode.pro";case"matic":return"corebc.matic.quiknode.pro";case"matic-mumbai":return"corebc.matic-testnet.quiknode.pro";case"optimism":return"corebc.optimism.quiknode.pro";case"optimism-goerli":return"corebc.optimism-goerli.quiknode.pro"}assertArgument(false,"unsupported network","network",name)}class QuickNodeProvider extends JsonRpcProvider{token;constructor(_network,token){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(token==null){token=defaultToken}const request=QuickNodeProvider.getRequest(network,token);super(request,network,{staticNetwork:network});defineProperties(this,{token:token})}_getProvider(networkId){try{return new QuickNodeProvider(networkId,this.token)}catch(error){}return super._getProvider(networkId)}isCommunityResource(){return this.token===defaultToken}static getRequest(network,token){if(token==null){token=defaultToken}const request=new FetchRequest(`https:/\/${getHost$1(network.name)}/${token}`);request.allowGzip=true;if(token===defaultToken){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("QuickNodeProvider");return true}}return request}}const BN_1=BigInt("1");const BN_2=BigInt("2");function shuffle(array){for(let i=array.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));const tmp=array[i];array[i]=array[j];array[j]=tmp}}function stall$2(duration){return new Promise(resolve=>{setTimeout(resolve,duration)})}function getTime(){return(new Date).getTime()}function stringify(value){return JSON.stringify(value,(key,value)=>{if(typeof value==="bigint"){return{type:"bigint",value:value.toString()}}return value})}const defaultConfig={stallTimeout:400,priority:1,weight:1};const defaultState={blockNumber:-2,requests:0,lateResponses:0,errorResponses:0,outOfSync:-1,unsupportedEvents:0,rollingDuration:0,score:0,_network:null,_updateNumber:null,_totalTime:0};async function waitForSync(config,blockNumber){while(config.blockNumber<0||config.blockNumber{const blockNumber=await config.provider.getBlockNumber();if(blockNumber>config.blockNumber){config.blockNumber=blockNumber}config._updateNumber=null})()}await config._updateNumber;config.outOfSync++}}function _normalize(value){if(value==null){return"null"}if(Array.isArray(value)){return"["+value.map(_normalize).join(",")+"]"}if(typeof value==="object"&&typeof value.toJSON==="function"){return _normalize(value.toJSON())}switch(typeof value){case"boolean":case"symbol":return value.toString();case"bigint":case"number":return BigInt(value).toString();case"string":return JSON.stringify(value);case"object":{const keys=Object.keys(value);keys.sort();return"{"+keys.map(k=>`${JSON.stringify(k)}:${_normalize(value[k])}`).join(",")+"}"}}console.log("Could not serialize",value);throw new Error("Hmm...")}function normalizeResult(value){if("error"in value){const error=value.error;return{tag:_normalize(error),value:error}}const result=value.result;return{tag:_normalize(result),value:result}}function checkQuorum(quorum,results){const tally=new Map;for(const{value,tag,weight}of results){const t=tally.get(tag)||{value:value,weight:0};t.weight+=weight;tally.set(tag,t)}let best=null;for(const r of tally.values()){if(r.weight>=quorum&&(!best||r.weight>best.weight)){best=r}}if(best){return best.value}return undefined}function getMedian(quorum,results){let resultWeight=0;const errorMap=new Map;let bestError=null;const values=[];for(const{value,tag,weight}of results){if(value instanceof Error){const e=errorMap.get(tag)||{value:value,weight:0};e.weight+=weight;errorMap.set(tag,e);if(bestError==null||e.weight>bestError.weight){bestError=e}}else{values.push(BigInt(value));resultWeight+=weight}}if(resultWeight=quorum){return bestError.value}return undefined}values.sort((a,b)=>aa?1:0);const mid=Math.floor(values.length/2);if(values.length%2){return values[mid]}return(values[mid-1]+values[mid]+BN_1)/BN_2}function getAnyResult(quorum,results){const result=checkQuorum(quorum,results);if(result!==undefined){return result}for(const r of results){if(r.value){return r.value}}return undefined}function getFuzzyMode(quorum,results){if(quorum===1){return getNumber(getMedian(quorum,results),"%internal")}const tally=new Map;const add=(result,weight)=>{const t=tally.get(result)||{result:result,weight:0};t.weight+=weight;tally.set(result,t)};for(const{weight,value}of results){const r=getNumber(value);add(r-1,weight);add(r,weight);add(r+1,weight)}let bestWeight=0;let bestResult=undefined;for(const{weight,result}of tally.values()){if(weight>=quorum&&(weight>bestWeight||bestResult!=null&&weight===bestWeight&&result>bestResult)){bestWeight=weight;bestResult=result}}return bestResult}class FallbackProvider extends AbstractProvider{quorum;eventQuorum;eventWorkers;#configs;#height;#initialSyncPromise;constructor(providers,network){super(network);this.#configs=providers.map(p=>{if(p instanceof AbstractProvider){return Object.assign({provider:p},defaultConfig,defaultState)}else{return Object.assign({},defaultConfig,p,defaultState)}});this.#height=-2;this.#initialSyncPromise=null;this.quorum=2;this.eventQuorum=1;this.eventWorkers=1;assertArgument(this.quorum<=this.#configs.reduce((a,c)=>a+c.weight,0),"quorum exceed provider wieght","quorum",this.quorum)}get providerConfigs(){return this.#configs.map(c=>{const result=Object.assign({},c);for(const key in result){if(key[0]==="_"){delete result[key]}}return result})}async _detectNetwork(){return Network.from(getBigInt(await this._perform({method:"networkId"})))}async _translatePerform(provider,req){switch(req.method){case"broadcastTransaction":return await provider.broadcastTransaction(req.signedTransaction);case"call":return await provider.call(Object.assign({},req.transaction,{blockTag:req.blockTag}));case"networkId":return(await provider.getNetwork()).networkId;case"estimateEnergy":return await provider.estimateEnergy(req.transaction);case"getBalance":return await provider.getBalance(req.address,req.blockTag);case"getBlock":{const block="blockHash"in req?req.blockHash:req.blockTag;return await provider.getBlock(block,req.includeTransactions)}case"getBlockNumber":return await provider.getBlockNumber();case"getCode":return await provider.getCode(req.address,req.blockTag);case"getEnergyPrice":return(await provider.getFeeData()).energyPrice;case"getLogs":return await provider.getLogs(req.filter);case"getStorage":return await provider.getStorage(req.address,req.position,req.blockTag);case"getTransaction":return await provider.getTransaction(req.hash);case"getTransactionCount":return await provider.getTransactionCount(req.address,req.blockTag);case"getTransactionReceipt":return await provider.getTransactionReceipt(req.hash);case"getTransactionResult":return await provider.getTransactionResult(req.hash)}}#getNextConfig(running){const configs=Array.from(running).map(r=>r.config);const allConfigs=this.#configs.slice();shuffle(allConfigs);allConfigs.sort((a,b)=>b.priority-a.priority);for(const config of allConfigs){if(configs.indexOf(config)===-1){return config}}return null}#addRunner(running,req){const config=this.#getNextConfig(running);if(config==null){return null}const runner={config:config,result:null,didBump:false,perform:null,staller:null};const now=getTime();runner.perform=(async()=>{try{config.requests++;const result=await this._translatePerform(config.provider,req);runner.result={result:result}}catch(error){config.errorResponses++;runner.result={error:error}}const dt=getTime()-now;config._totalTime+=dt;config.rollingDuration=.95*config.rollingDuration+.05*dt;runner.perform=null})();runner.staller=(async()=>{await stall$2(config.stallTimeout);runner.staller=null})();running.add(runner);return runner}async#initialSync(){let initialSync=this.#initialSyncPromise;if(!initialSync){const promises=[];this.#configs.forEach(config=>{promises.push(waitForSync(config,0));promises.push((async()=>{config._network=await config.provider.getNetwork()})())});this.#initialSyncPromise=initialSync=(async()=>{await Promise.all(promises);let networkId=null;for(const config of this.#configs){const network=config._network;if(networkId==null){networkId=network.networkId}else if(network.networkId!==networkId){assert(false,"cannot mix providers on different networks","UNSUPPORTED_OPERATION",{operation:"new FallbackProvider"})}}})()}await initialSync}async#checkQuorum(running,req){const results=[];for(const runner of running){if(runner.result!=null){const{tag,value}=normalizeResult(runner.result);results.push({tag:tag,value:value,weight:runner.config.weight})}}if(results.reduce((a,r)=>a+r.weight,0)({value:c.blockNumber,tag:getNumber(c.blockNumber).toString(),weight:c.weight})))))}const mode=getFuzzyMode(this.quorum,results);if(mode===undefined){return undefined}if(mode>this.#height){this.#height=mode}return this.#height}case"getEnergyPrice":case"estimateEnergy":return getMedian(this.quorum,results);case"getBlock":if("blockTag"in req&&req.blockTag==="pending"){return getAnyResult(this.quorum,results)}return checkQuorum(this.quorum,results);case"call":case"networkId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return checkQuorum(this.quorum,results);case"broadcastTransaction":return getAnyResult(this.quorum,results)}assert(false,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${stringify(req.method)})`})}async#waitForQuorum(running,req){if(running.size===0){throw new Error("no runners?!")}const interesting=[];let newRunners=0;for(const runner of running){if(runner.perform){interesting.push(runner.perform)}if(runner.staller){interesting.push(runner.staller);continue}if(runner.didBump){continue}runner.didBump=true;newRunners++}const value=await this.#checkQuorum(running,req);if(value!==undefined){if(value instanceof Error){throw value}return value}for(let i=0;i0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:req,results:Array.from(running).map(r=>stringify(r.result))}});await Promise.race(interesting);return await this.#waitForQuorum(running,req)}async _perform(req){if(req.method==="broadcastTransaction"){const results=await Promise.all(this.#configs.map(async({provider,weight})=>{try{const result=await provider._perform(req);return Object.assign(normalizeResult({result:result}),{weight:weight})}catch(error){return Object.assign(normalizeResult({error:error}),{weight:weight})}}));const result=getAnyResult(this.quorum,results);assert(result!==undefined,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:req,results:results.map(stringify)}});if(result instanceof Error){throw result}return result}await this.#initialSync();const running=new Set;for(let i=0;i{const payload={method:method,params:params};this.emit("debug",{action:"sendEip1193Request",payload:payload});try{const result=await core.request(payload);this.emit("debug",{action:"receiveEip1193Result",result:result});return result}catch(e){const error=new Error(e.message);error.code=e.code;error.data=e.data;error.payload=payload;this.emit("debug",{action:"receiveEip1193Error",error:error});throw error}}}async send(method,params){await this._start();return await super.send(method,params)}async _send(payload){assertArgument(!Array.isArray(payload),"EIP-1193 does not support batch request","payload",payload);try{const result=await this.#request(payload.method,payload.params||[]);return[{id:payload.id,result:result}]}catch(e){return[{id:payload.id,error:{code:e.code,data:e.data,message:e.message}}]}}getRpcError(payload,error){error=JSON.parse(JSON.stringify(error));switch(error.error.code||-1){case 4001:error.error.message=`corebc-user-denied: ${error.error.message}`;break;case 4200:error.error.message=`corebc-unsupported: ${error.error.message}`;break}return super.getRpcError(payload,error)}async hasSigner(address){if(address==null){address=0}const accounts=await this.send("xcb_accounts",[]);if(typeof address==="number"){return accounts.length>address}address=address.toLowerCase();return accounts.filter(a=>a.toLowerCase()===address).length!==0}async getSigner(address){if(address==null){address=0}if(!await this.hasSigner(address)){try{await this.#request("xcb_requestAccounts",[])}catch(error){const payload=error.payload;throw this.getRpcError(payload,{id:payload.id,error:error})}}return await super.getSigner(address)}}const defaultApplicationId="62e1ad51b37b8e00394bda3b";function getHost(name){switch(name){case"mainnet":return"eth-mainnet.gateway.pokt.network";case"goerli":return"eth-goerli.gateway.pokt.network";case"matic":return"poly-mainnet.gateway.pokt.network";case"matic-mumbai":return"polygon-mumbai-rpc.gateway.pokt.network"}assertArgument(false,"unsupported network","network",name)}class PocketProvider extends JsonRpcProvider{applicationId;applicationSecret;constructor(_network,applicationId,applicationSecret){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(applicationId==null){applicationId=defaultApplicationId}if(applicationSecret==null){applicationSecret=null}const options={staticNetwork:network};const request=PocketProvider.getRequest(network,applicationId,applicationSecret);super(request,network,options);defineProperties(this,{applicationId:applicationId,applicationSecret:applicationSecret})}_getProvider(networkId){try{return new PocketProvider(networkId,this.applicationId,this.applicationSecret)}catch(error){}return super._getProvider(networkId)}static getRequest(network,applicationId,applicationSecret){if(applicationId==null){applicationId=defaultApplicationId}const request=new FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`);request.allowGzip=true;if(applicationSecret){request.setCredentials("",applicationSecret)}if(applicationId===defaultApplicationId){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("PocketProvider");return true}}return request}isCommunityResource(){return this.applicationId===defaultApplicationId}}const IpcSocketProvider=undefined;class BaseWallet extends AbstractSigner{address;prefix;#signingKey;constructor({signingKey,prefix,provider}){super(provider);this.prefix=prefix;assertArgument(signingKey&&typeof signingKey.sign==="function","invalid signingKey key","signingKey","[ REDACTED ]");this.#signingKey=signingKey;const address=computeAddress(this.#signingKey,prefix);defineProperties(this,{address:address})}get signingKey(){return this.#signingKey}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(provider){return new BaseWallet({signingKey:this.#signingKey,prefix:this.prefix,provider:provider})}async signTransaction(tx){const{to,from}=await resolveProperties({to:tx.to||undefined,from:tx.from||undefined});if(to!=null){tx.to=to}if(from!=null){tx.from=from}if(tx.from!=null){assertArgument(getAddress(tx.from)===this.address,"transaction from address mismatch","tx.from",tx.from);delete tx.from}const btx=Transaction.from(tx);const unSignedSerialized=btx.unsignedSerialized;const unsignedHash=sha256(unSignedSerialized);btx.signature=this.signingKey.sign(unsignedHash);return btx.serialized}async signMessage(message){return this.signMessageSync(message)}signMessageSync(message){return this.signingKey.sign(hashMessage(message))}async signTypedData(domain,types,value){const populated=await TypedDataEncoder.resolveNames(domain,types,value,async name=>{assert(this.provider!=null,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:name}});const address=getAddress(name);assert(address!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:name});return address});return this.signingKey.sign(TypedDataEncoder.hash(populated.domain,types,populated.value))}}const subsChrs=" !#$%&'()*+,-./<=>?@[]^_`{|}~";const Word=/^[a-z]*$/i;function unfold(words,sep){let initial=97;return words.reduce((accum,word)=>{if(word===sep){initial++}else if(word.match(Word)){accum.push(String.fromCharCode(initial)+word)}else{initial=97;accum.push(word)}return accum},[])}function decode(data,subs){for(let i=subsChrs.length-1;i>=0;i--){data=data.split(subsChrs[i]).join(subs.substring(2*i,2*i+2))}const clumps=[];const leftover=data.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(all,item,semi,word)=>{if(semi){for(let i=parseInt(semi);i>=0;i--){clumps.push(";")}}else{clumps.push(item.toLowerCase())}return""});if(leftover){throw new Error(`leftovers: ${JSON.stringify(leftover)}`)}return unfold(unfold(clumps,";"),":")}function decodeOwl(data){assertArgument(data[0]==="0","unsupported auwl data","data",data);return decode(data.substring(1+2*subsChrs.length),data.substring(1,1+2*subsChrs.length))}class Wordlist{locale;constructor(locale){defineProperties(this,{locale:locale})}split(phrase){return phrase.toLowerCase().split(/\s+/g)}join(words){return words.join(" ")}static check(wordlist){const words=[];for(let i=0;i<2048;i++){const word=wordlist.getWord(i);if(i!==wordlist.getWordIndex(word)){return"0x"}words.push(word)}return id(words.join("\n")+"\n")}}class WordlistOwl extends Wordlist{#data;#checksum;constructor(locale,data,checksum){super(locale);this.#data=data;this.#checksum=checksum;this.#words=null}get _data(){return this.#data}_decodeWords(){return decodeOwl(this.#data)}#words;#loadWords(){if(this.#words==null){const words=this._decodeWords();const checksum=id(words.join("\n")+"\n",true);if(checksum!==this.#checksum){throw new Error(`BIP39 Wordlist for ${this.locale} FffffAILED`)}this.#words=words}return this.#words}getWord(index){const words=this.#loadWords();assertArgument(index>=0&&index{const goldilockSaltPrefix="mnemonic";const aesSaltPrefix="mnemonicfortheAESkey";const goldilockSalt=utf8.encode(goldilockSaltPrefix+password);const aesSalt=utf8.encode(aesSaltPrefix+password);const goldilockKey=pbkdf2Sync(Buffer.from(mnemonic),goldilockSalt,2048,64,"sha512");const aesKeySeed=pbkdf2Sync(Buffer.from(mnemonic),aesSalt,2048,64,"sha512");return{aes:aesKeySeed.toString("hex"),goldilock:goldilockKey.toString("hex")}};function getUpperMask(bits){return(1<=12&&words.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const entropy=new Uint8Array(Math.ceil(11*words.length/8));let offset=0;for(let i=0;i=0,`invalid mnemonic word at index ${i}`,"mnemonic","[ REDACTED ]");for(let bit=0;bit<11;bit++){if(index&1<<10-bit){entropy[offset>>3]|=1<<7-offset%8}offset++}}const entropyBits=32*words.length/3;const checksumBits=words.length/3;const checksumMask=getUpperMask(checksumBits);const checksum=getBytes(legacySha256(entropy.slice(0,entropyBits/8)))[0]&checksumMask;assertArgument(checksum===(entropy[entropy.length-1]&checksumMask),"invalid mnemonic checksum","mnemonic","[ REDACTED ]");return hexlify(entropy.slice(0,entropyBits/8))}function entropyToMnemonic(entropy,wordlist){assertArgument(entropy.length%4===0&&entropy.length>=16&&entropy.length<=32,"invalid entropy size","entropy","[ REDACTED ]");if(wordlist==null){wordlist=LangEn.wordlist()}const indices=[0];let remainingBits=11;for(let i=0;i8){indices[indices.length-1]<<=8;indices[indices.length-1]|=entropy[i];remainingBits-=8}else{indices[indices.length-1]<<=remainingBits;indices[indices.length-1]|=entropy[i]>>8-remainingBits;indices.push(entropy[i]&getLowerMask(8-remainingBits));remainingBits+=3}}const checksumBits=entropy.length/4;const checksum=parseInt(legacySha256(entropy).substring(2,4),16)&getUpperMask(checksumBits);indices[indices.length-1]<<=checksumBits;indices[indices.length-1]|=checksum>>8-checksumBits;return wordlist.join(indices.map(index=>wordlist.getWord(index)))}const _guard$1={};class Mnemonic{phrase;password;wordlist;entropy;constructor(guard,entropy,phrase,password,wordlist){if(password==null){password=""}if(wordlist==null){wordlist=LangEn.wordlist()}assertPrivate(guard,_guard$1,"Mnemonic");defineProperties(this,{phrase:phrase,password:password,wordlist:wordlist,entropy:entropy})}computeSeed(){return mnemonicToSeed(this.phrase,this.password)}static fromPhrase({phrase,password,wordlist}){const entropy=mnemonicToEntropy(phrase,wordlist);phrase=entropyToMnemonic(getBytes(entropy),wordlist);return new Mnemonic(_guard$1,entropy,phrase,password,wordlist)}static fromEntropy(_entropy,password,wordlist){const entropy=getBytes(_entropy,"entropy");const phrase=entropyToMnemonic(entropy,wordlist);return new Mnemonic(_guard$1,hexlify(entropy),phrase,password,wordlist)}static entropyToPhrase(_entropy,wordlist){const entropy=getBytes(_entropy,"entropy");return entropyToMnemonic(entropy,wordlist)}static phraseToEntropy(phrase,wordlist){return mnemonicToEntropy(phrase,wordlist)}static isValidMnemonic(phrase,wordlist){try{mnemonicToEntropy(phrase,wordlist);return true}catch(error){}return false}}function looseArrayify(hexString){if(typeof hexString==="string"&&!hexString.startsWith("0x")){hexString="0x"+hexString}return getBytesCopy(hexString)}function zpad(value,length){value=String(value);while(value.length0&&(N&N-1)===0,"invalid kdf.N","kdf.N",N);assertArgument(r>0&&p>0,"invalid kdf","kdf",kdf);const dkLen=spelunk(data,"crypto.kdfparams.dklen:int!");assertArgument(dkLen===32,"invalid kdf.dklen","kdf.dflen",dkLen);return{name:"scrypt",salt:salt,N:N,r:r,p:p,dkLen:64}}else if(kdf.toLowerCase()==="pbkdf2"){const salt=spelunk(data,"crypto.kdfparams.salt:data!");const prf=spelunk(data,"crypto.kdfparams.prf:string!");const algorithm=prf.split("-").pop();assertArgument(algorithm==="sha256"||algorithm==="sha512","invalid kdf.pdf","kdf.pdf",prf);const count=spelunk(data,"crypto.kdfparams.c:int!");const dkLen=spelunk(data,"crypto.kdfparams.dklen:int!");assertArgument(dkLen===32,"invalid kdf.dklen","kdf.dklen",dkLen);return{name:"pbkdf2",salt:salt,count:count,dkLen:dkLen,algorithm:algorithm}}}assertArgument(false,"unsupported key-derivation function","kdf",kdf)}function decryptKeystoreJsonSync(json,_password){const data=JSON.parse(json);const password=getPassword(_password);const params=getDecryptKdfParams(data);if(params.name==="pbkdf2"){const{salt,count,dkLen,algorithm}=params;const key=pbkdf2(password,salt,count,dkLen,algorithm);return getAccount(data,key)}assert(params.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:params});const{salt,N,r,p,dkLen}=params;const key=scryptSync(password,salt,N,r,p,dkLen);return getAccount(data,key)}function stall$1(duration){return new Promise(resolve=>{setTimeout(()=>{resolve()},duration)})}async function decryptKeystoreJson(json,_password,progress){const data=JSON.parse(json);const password=getPassword(_password);const params=getDecryptKdfParams(data);if(params.name==="pbkdf2"){if(progress){progress(0);await stall$1(0)}const{salt,count,dkLen,algorithm}=params;const key=pbkdf2(password,salt,count,dkLen,algorithm);if(progress){progress(1);await stall$1(0)}return getAccount(data,key)}assert(params.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:params});const{salt,N,r,p,dkLen}=params;const key=await scrypt(password,salt,N,r,p,dkLen,progress);return getAccount(data,key)}function getEncryptKdfParams(options){const salt=options.salt!=null?getBytes(options.salt,"options.salt"):randomBytes(32);let N=1<<17,r=8,p=1;if(options.scrypt){if(options.scrypt.N){N=options.scrypt.N}if(options.scrypt.r){r=options.scrypt.r}if(options.scrypt.p){p=options.scrypt.p}}assertArgument(typeof N==="number"&&N>0&&Number.isSafeInteger(N)&&(BigInt(N)&BigInt(N-1))===BigInt(0),"invalid scrypt N parameter","options.N",N);assertArgument(typeof r==="number"&&r>0&&Number.isSafeInteger(r),"invalid scrypt r parameter","options.r",r);assertArgument(typeof p==="number"&&p>0&&Number.isSafeInteger(p),"invalid scrypt p parameter","options.p",p);return{name:"scrypt",dkLen:32,salt:salt,N:N,r:r,p:p}}function _encryptKeystore(key,kdf,account,options){const privateKey=getBytes(account.privateKey,"privateKey");const iv=options.iv!=null?getBytes(options.iv,"options.iv"):randomBytes(16);assertArgument(iv.length===16,"invalid options.iv length","options.iv",options.iv);const uuidRandom=options.uuid!=null?getBytes(options.uuid,"options.uuid"):randomBytes(16);assertArgument(uuidRandom.length===16,"invalid options.uuid length","options.uuid",options.iv);const derivedKey=key.slice(0,16);const macPrefix=key.slice(16,32);const aesCtr=new CTR(derivedKey,iv);const ciphertext=getBytes(aesCtr.encrypt(privateKey));const mac=sha256(concat([macPrefix,ciphertext]));const data={address:account.address.substring(2).toLowerCase(),id:uuidV4(uuidRandom),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:hexlify(iv).substring(2)},ciphertext:hexlify(ciphertext).substring(2),kdf:"scrypt",kdfparams:{salt:hexlify(kdf.salt).substring(2),n:kdf.N,dklen:32,p:kdf.p,r:kdf.r},mac:mac.substring(2)}};if(account.mnemonic){const client=options.client!=null?options.client:`corebc/${version}`;const path=account.mnemonic.path||defaultPath$1;const locale=account.mnemonic.locale||"en";const mnemonicKey=key.slice(32,64);const entropy=getBytes(account.mnemonic.entropy,"account.mnemonic.entropy");const mnemonicIv=randomBytes(16);const mnemonicAesCtr=new CTR(mnemonicKey,mnemonicIv);const mnemonicCiphertext=getBytes(mnemonicAesCtr.encrypt(entropy));const now=new Date;const timestamp=now.getUTCFullYear()+"-"+zpad(now.getUTCMonth()+1,2)+"-"+zpad(now.getUTCDate(),2)+"T"+zpad(now.getUTCHours(),2)+"-"+zpad(now.getUTCMinutes(),2)+"-"+zpad(now.getUTCSeconds(),2)+".0Z";const gethFilename="UTC--"+timestamp+"--"+data.address;data["x-corebc"]={client:client,gethFilename:gethFilename,path:path,locale:locale,mnemonicCounter:hexlify(mnemonicIv).substring(2),mnemonicCiphertext:hexlify(mnemonicCiphertext).substring(2),version:"0.1"}}return JSON.stringify(data)}function encryptKeystoreJsonSync(account,password,options){if(options==null){options={}}const passwordBytes=getPassword(password);const kdf=getEncryptKdfParams(options);const key=scryptSync(passwordBytes,kdf.salt,kdf.N,kdf.r,kdf.p,64);return _encryptKeystore(getBytes(key),kdf,account,options)}async function encryptKeystoreJson(account,password,options){if(options==null){options={}}const passwordBytes=getPassword(password);const kdf=getEncryptKdfParams(options);const key=await scrypt(passwordBytes,kdf.salt,kdf.N,kdf.r,kdf.p,64,options.progressCallback);return _encryptKeystore(getBytes(key),kdf,account,options)}const defaultPath="m";const HardenedBit=2147483648;const _guard={};function derivePath(node,path){const components=path.split("/");assertArgument(components.length>0&&(components[0]==="m"||node.depth>0),"invalid path","path",path);if(components[0]==="m"){components.shift()}let result=node;for(let i=0;i=0&&index=0&&index{setTimeout(()=>{resolve()},duration)})}class Wallet extends BaseWallet{constructor({key,prefix,provider}){if(typeof key==="string"&&!key.startsWith("0x")){key="0x"+key}let signingKey=typeof key==="string"?new SigningKey(key):key;super({signingKey:signingKey,prefix:prefix,provider:provider})}connect(provider){return new Wallet({key:this.signingKey,prefix:this.prefix,provider:provider})}async encrypt(password,progressCallback){const account={address:this.address,privateKey:this.privateKey};return await encryptKeystoreJson(account,password,{progressCallback:progressCallback})}encryptSync(password){const account={address:this.address,privateKey:this.privateKey};return encryptKeystoreJsonSync(account,password)}static#fromAccount(account){assertArgument(account,"invalid JSON wallet","json","[ REDACTED ]");const address=account.address;const prefix=extractPrefix(address);if("mnemonic"in account&&account.mnemonic&&account.mnemonic.locale==="en"){const mnemonic=Mnemonic.fromEntropy(account.mnemonic.entropy);const wallet=HDNodeWallet.fromMnemonic(mnemonic,prefix,account.mnemonic.path);if(wallet.address===account.address&&wallet.privateKey===account.privateKey){return wallet}console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const wallet=new Wallet({key:account.privateKey,prefix:prefix});assertArgument(wallet.address===account.address,"address/privateKey mismatch","json","[ REDACTED ]");return wallet}static async fromEncryptedJson(json,password,progress){let account=null;if(isKeystoreJson(json)){account=await decryptKeystoreJson(json,password,progress)}else if(isCrowdsaleJson(json)){if(progress){progress(0);await stall(0)}account=decryptCrowdsaleJson(json,password);if(progress){progress(1);await stall(0)}}return Wallet.#fromAccount(account)}static fromEncryptedJsonSync(json,password){let account=null;if(isKeystoreJson(json)){account=decryptKeystoreJsonSync(json,password)}else if(isCrowdsaleJson(json)){account=decryptCrowdsaleJson(json,password)}else{assertArgument(false,"invalid JSON wallet","json","[ REDACTED ]")}return Wallet.#fromAccount(account)}static createRandom(prefix,provider){const wallet=HDNodeWallet.createRandom(prefix,undefined,undefined,undefined);if(provider){return wallet.connect(provider)}return wallet}static fromPhrase({phrase,prefix,provider,password}){const wallet=HDNodeWallet.fromPhrase({phrase:phrase,prefix:prefix,password:password});if(provider){return wallet.connect(provider)}return wallet}static fromSeed({seed,prefix,provider,path}){const wallet=HDNodeWallet.fromSeed({seed:seed,prefix:prefix,path:path||defaultPath});if(provider){return wallet.connect(provider)}return wallet}}const Base64=")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";function decodeBits(width,data){const maxValue=(1<=width){const value=accum>>bits-width;accum&=(1<{const match=accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);assertArgument(match!==null,"internal error parsing accents","accents",accents);let posOffset=0;const positions=decodeBits(parseInt(match[3]),match[4]);const charCode=parseInt(match[2]);const regex=new RegExp(`([${match[1]}])`,"g");words=words.replace(regex,(all,letter)=>{const rem=--positions[posOffset];if(rem===0){letter=String.fromCharCode(letter.charCodeAt(0),charCode);posOffset++}return letter})});return words.split(",")}class WordlistOwlA extends WordlistOwl{#accent;constructor(locale,data,accent,checksum){super(locale,data,checksum);this.#accent=accent}get _accent(){return this.#accent}_decodeWords(){return decodeOwlA(this._data,this._accent)}}const wordlists={en:LangEn.wordlist()};var corebc=Object.freeze({__proto__:null,AbiCoder:AbiCoder,AbstractProvider:AbstractProvider,AbstractSigner:AbstractSigner,AlchemyProvider:AlchemyProvider,AnkrProvider:AnkrProvider,BaseContract:BaseContract,BaseWallet:BaseWallet,BigNumber:BigNumber,Block:Block,BrowserProvider:BrowserProvider,CloudflareProvider:CloudflareProvider,ConstructorFragment:ConstructorFragment,Contract:Contract,ContractEventPayload:ContractEventPayload,ContractFactory:ContractFactory,ContractTransactionReceipt:ContractTransactionReceipt,ContractTransactionResponse:ContractTransactionResponse,ContractUnknownEventPayload:ContractUnknownEventPayload,CoreSymbol:CoreSymbol,Ed448Goldilock:Ed448Goldilock,EnergyCostPlugin:EnergyCostPlugin,ErrorDescription:ErrorDescription,ErrorFragment:ErrorFragment,EventFragment:EventFragment,EventLog:EventLog,EventPayload:EventPayload,FallbackFragment:FallbackFragment,FallbackProvider:FallbackProvider,FeeData:FeeData,FeeDataNetworkPlugin:FeeDataNetworkPlugin,FetchCancelSignal:FetchCancelSignal,FetchRequest:FetchRequest,FetchResponse:FetchResponse,FixedNumber:FixedNumber,Fragment:Fragment,FunctionFragment:FunctionFragment,HDNodeWallet:HDNodeWallet,Indexed:Indexed,InfuraProvider:InfuraProvider,InfuraWebSocketProvider:InfuraWebSocketProvider,Interface:Interface,IpcSocketProvider:IpcSocketProvider,JsonRpcApiProvider:JsonRpcApiProvider,JsonRpcProvider:JsonRpcProvider,JsonRpcSigner:JsonRpcSigner,LangEn:LangEn,Log:Log,LogDescription:LogDescription,MaxInt256:MaxInt256,MaxUint256:MaxUint256,MessagePrefix:MessagePrefix,MinInt256:MinInt256,Mnemonic:Mnemonic,N:N,NamedFragment:NamedFragment,Network:Network,NetworkPlugin:NetworkPlugin,NonceManager:NonceManager,OrePerXCB:OrePerXCB,ParamType:ParamType,PocketProvider:PocketProvider,QuickNodeProvider:QuickNodeProvider,Result:Result,Signature:Signature,SigningKey:SigningKey,SocketBlockSubscriber:SocketBlockSubscriber,SocketEventSubscriber:SocketEventSubscriber,SocketPendingSubscriber:SocketPendingSubscriber,SocketProvider:SocketProvider,SocketSubscriber:SocketSubscriber,StructFragment:StructFragment,Transaction:Transaction,TransactionDescription:TransactionDescription,TransactionReceipt:TransactionReceipt,TransactionResponse:TransactionResponse,Typed:Typed,TypedDataEncoder:TypedDataEncoder,UnmanagedSubscriber:UnmanagedSubscriber,Utf8ErrorFuncs:Utf8ErrorFuncs,VoidSigner:VoidSigner,Wallet:Wallet,WebSocketProvider:WebSocketProvider,Wordlist:Wordlist,WordlistOwl:WordlistOwl,WordlistOwlA:WordlistOwlA,ZeroAddress:ZeroAddress,ZeroHash:ZeroHash,accessListify:accessListify,arrayify:arrayify,assert:assert,assertArgument:assertArgument,assertArgumentCount:assertArgumentCount,assertNormalize:assertNormalize,assertPrivate:assertPrivate,checkResultErrors:checkResultErrors,computeAddress:computeAddress,computeHmac:computeHmac,concat:concat,copyRequest:copyRequest,dataLength:dataLength,dataSlice:dataSlice,decodeBase58:decodeBase58,decodeBase64:decodeBase64,decodeBytes32String:decodeBytes32String,decodeRlp:decodeRlp,decryptCrowdsaleJson:decryptCrowdsaleJson,decryptKeystoreJson:decryptKeystoreJson,decryptKeystoreJsonSync:decryptKeystoreJsonSync,defaultPath:defaultPath,defineProperties:defineProperties,encodeBase58:encodeBase58,encodeBase64:encodeBase64,encodeBytes32String:encodeBytes32String,encodeRlp:encodeRlp,encryptKeystoreJson:encryptKeystoreJson,encryptKeystoreJsonSync:encryptKeystoreJsonSync,formatUnits:formatUnits,formatXCB:formatXCB,fromTwos:fromTwos,getAccountPath:getAccountPath,getAddress:getAddress,getBigInt:getBigInt,getBytes:getBytes,getBytesCopy:getBytesCopy,getCreate2Address:getCreate2Address,getCreateAddress:getCreateAddress,getDefaultProvider:getDefaultProvider,getIndexedAccountPath:getIndexedAccountPath,getNumber:getNumber,getUint:getUint,hashMessage:hashMessage,hexConcat:hexConcat,hexlify:hexlify,id:id,isAddress:isAddress,isAddressable:isAddressable,isBytesLike:isBytesLike,isCallException:isCallException,isCrowdsaleJson:isCrowdsaleJson,isError:isError,isHexString:isHexString,isKeystoreJson:isKeystoreJson,keccak256:keccak256,lock:lock,makeError:makeError,mask:mask,networkIdToPrefix:networkIdToPrefix,parseUnits:parseUnits,parseXCB:parseXCB,pbkdf2:pbkdf2,publicToAddress:publicToAddress,randomBytes:randomBytes,recoverAddress:recoverAddress,resolveAddress:resolveAddress,resolveProperties:resolveProperties,ripemd160:ripemd160,scrypt:scrypt,scryptSync:scryptSync,sha256:sha256,sha512:sha512,showThrottleMessage:showThrottleMessage,solidityPacked:solidityPacked,solidityPackedSha256:solidityPackedSha256,stripZerosLeft:stripZerosLeft,toBeArray:toBeArray,toBeHex:toBeHex,toBigInt:toBigInt,toNumber:toNumber,toQuantity:toQuantity,toTwos:toTwos,toUtf8Bytes:toUtf8Bytes,toUtf8CodePoints:toUtf8CodePoints,toUtf8String:toUtf8String,uuidV4:uuidV4,verifyMessage:verifyMessage,verifyTypedData:verifyTypedData,version:version,wordlists:wordlists,zeroPadBytes:zeroPadBytes,zeroPadValue:zeroPadValue});Object.defineProperty(exports,"Buffer",{enumerable:true,get:function(){return buffer.Buffer}});exports.AbiCoder=AbiCoder;exports.AbstractProvider=AbstractProvider;exports.AbstractSigner=AbstractSigner;exports.AlchemyProvider=AlchemyProvider;exports.AnkrProvider=AnkrProvider;exports.BaseContract=BaseContract;exports.BaseWallet=BaseWallet;exports.BigNumber=BigNumber;exports.Block=Block;exports.BrowserProvider=BrowserProvider;exports.CloudflareProvider=CloudflareProvider;exports.ConstructorFragment=ConstructorFragment;exports.Contract=Contract;exports.ContractEventPayload=ContractEventPayload;exports.ContractFactory=ContractFactory;exports.ContractTransactionReceipt=ContractTransactionReceipt;exports.ContractTransactionResponse=ContractTransactionResponse;exports.ContractUnknownEventPayload=ContractUnknownEventPayload;exports.CoreSymbol=CoreSymbol;exports.Ed448Goldilock=Ed448Goldilock;exports.EnergyCostPlugin=EnergyCostPlugin;exports.ErrorDescription=ErrorDescription;exports.ErrorFragment=ErrorFragment;exports.EventFragment=EventFragment;exports.EventLog=EventLog;exports.EventPayload=EventPayload;exports.FallbackFragment=FallbackFragment;exports.FallbackProvider=FallbackProvider;exports.FeeData=FeeData;exports.FeeDataNetworkPlugin=FeeDataNetworkPlugin;exports.FetchCancelSignal=FetchCancelSignal;exports.FetchRequest=FetchRequest;exports.FetchResponse=FetchResponse;exports.FixedNumber=FixedNumber;exports.Fragment=Fragment;exports.FunctionFragment=FunctionFragment;exports.HDNodeWallet=HDNodeWallet;exports.Indexed=Indexed;exports.InfuraProvider=InfuraProvider;exports.InfuraWebSocketProvider=InfuraWebSocketProvider;exports.Interface=Interface;exports.IpcSocketProvider=IpcSocketProvider;exports.JsonRpcApiProvider=JsonRpcApiProvider;exports.JsonRpcProvider=JsonRpcProvider;exports.JsonRpcSigner=JsonRpcSigner;exports.LangEn=LangEn;exports.Log=Log;exports.LogDescription=LogDescription;exports.MaxInt256=MaxInt256;exports.MaxUint256=MaxUint256;exports.MessagePrefix=MessagePrefix;exports.MinInt256=MinInt256;exports.Mnemonic=Mnemonic;exports.N=N;exports.NamedFragment=NamedFragment;exports.Network=Network;exports.NetworkPlugin=NetworkPlugin;exports.NonceManager=NonceManager;exports.OrePerXCB=OrePerXCB;exports.ParamType=ParamType;exports.PocketProvider=PocketProvider;exports.QuickNodeProvider=QuickNodeProvider;exports.Result=Result;exports.Signature=Signature;exports.SigningKey=SigningKey;exports.SocketBlockSubscriber=SocketBlockSubscriber;exports.SocketEventSubscriber=SocketEventSubscriber;exports.SocketPendingSubscriber=SocketPendingSubscriber;exports.SocketProvider=SocketProvider;exports.SocketSubscriber=SocketSubscriber;exports.StructFragment=StructFragment;exports.Transaction=Transaction;exports.TransactionDescription=TransactionDescription;exports.TransactionReceipt=TransactionReceipt;exports.TransactionResponse=TransactionResponse;exports.Typed=Typed;exports.TypedDataEncoder=TypedDataEncoder;exports.UnmanagedSubscriber=UnmanagedSubscriber;exports.Utf8ErrorFuncs=Utf8ErrorFuncs;exports.VoidSigner=VoidSigner;exports.Wallet=Wallet;exports.WebSocketProvider=WebSocketProvider;exports.Wordlist=Wordlist;exports.WordlistOwl=WordlistOwl;exports.WordlistOwlA=WordlistOwlA;exports.ZeroAddress=ZeroAddress;exports.ZeroHash=ZeroHash;exports.accessListify=accessListify;exports.arrayify=arrayify;exports.assert=assert;exports.assertArgument=assertArgument;exports.assertArgumentCount=assertArgumentCount;exports.assertNormalize=assertNormalize;exports.assertPrivate=assertPrivate;exports.checkResultErrors=checkResultErrors;exports.computeAddress=computeAddress;exports.computeHmac=computeHmac;exports.concat=concat;exports.copyRequest=copyRequest;exports.corebc=corebc;exports.dataLength=dataLength;exports.dataSlice=dataSlice;exports.decodeBase58=decodeBase58;exports.decodeBase64=decodeBase64;exports.decodeBytes32String=decodeBytes32String;exports.decodeRlp=decodeRlp;exports.decryptCrowdsaleJson=decryptCrowdsaleJson;exports.decryptKeystoreJson=decryptKeystoreJson;exports.decryptKeystoreJsonSync=decryptKeystoreJsonSync;exports.defaultPath=defaultPath;exports.defineProperties=defineProperties;exports.encodeBase58=encodeBase58;exports.encodeBase64=encodeBase64;exports.encodeBytes32String=encodeBytes32String;exports.encodeRlp=encodeRlp;exports.encryptKeystoreJson=encryptKeystoreJson;exports.encryptKeystoreJsonSync=encryptKeystoreJsonSync;exports.formatUnits=formatUnits;exports.formatXCB=formatXCB;exports.fromTwos=fromTwos;exports.getAccountPath=getAccountPath;exports.getAddress=getAddress;exports.getBigInt=getBigInt;exports.getBytes=getBytes;exports.getBytesCopy=getBytesCopy;exports.getCreate2Address=getCreate2Address;exports.getCreateAddress=getCreateAddress;exports.getDefaultProvider=getDefaultProvider;exports.getIndexedAccountPath=getIndexedAccountPath;exports.getNumber=getNumber;exports.getUint=getUint;exports.hashMessage=hashMessage;exports.hexConcat=hexConcat;exports.hexlify=hexlify;exports.id=id;exports.isAddress=isAddress;exports.isAddressable=isAddressable;exports.isBytesLike=isBytesLike;exports.isCallException=isCallException;exports.isCrowdsaleJson=isCrowdsaleJson;exports.isError=isError;exports.isHexString=isHexString;exports.isKeystoreJson=isKeystoreJson;exports.keccak256=keccak256;exports.lock=lock;exports.makeError=makeError;exports.mask=mask;exports.networkIdToPrefix=networkIdToPrefix;exports.parseUnits=parseUnits;exports.parseXCB=parseXCB;exports.pbkdf2=pbkdf2;exports.publicToAddress=publicToAddress;exports.randomBytes=randomBytes;exports.recoverAddress=recoverAddress;exports.resolveAddress=resolveAddress;exports.resolveProperties=resolveProperties;exports.ripemd160=ripemd160;exports.scrypt=scrypt;exports.scryptSync=scryptSync;exports.sha256=sha256;exports.sha512=sha512;exports.showThrottleMessage=showThrottleMessage;exports.solidityPacked=solidityPacked;exports.solidityPackedSha256=solidityPackedSha256;exports.stripZerosLeft=stripZerosLeft;exports.toBeArray=toBeArray;exports.toBeHex=toBeHex;exports.toBigInt=toBigInt;exports.toNumber=toNumber;exports.toQuantity=toQuantity;exports.toTwos=toTwos;exports.toUtf8Bytes=toUtf8Bytes;exports.toUtf8CodePoints=toUtf8CodePoints;exports.toUtf8String=toUtf8String;exports.uuidV4=uuidV4;exports.verifyMessage=verifyMessage;exports.verifyTypedData=verifyTypedData;exports.version=version;exports.wordlists=wordlists;exports.zeroPadBytes=zeroPadBytes;exports.zeroPadValue=zeroPadValue}); \ No newline at end of file diff --git a/dist/wordlists-extra.js b/dist/wordlists-extra.js deleted file mode 100644 index f3790aa38..000000000 --- a/dist/wordlists-extra.js +++ /dev/null @@ -1,2549 +0,0 @@ -import { Buffer } from 'buffer'; - -function number(n) { - if (!Number.isSafeInteger(n) || n < 0) - throw new Error(`Wrong positive integer: ${n}`); -} -function bytes(b, ...lengths) { - if (!(b instanceof Uint8Array)) - throw new Error('Expected Uint8Array'); - if (lengths.length > 0 && !lengths.includes(b.length)) - throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); -} -function exists(instance, checkFinished = true) { - if (instance.destroyed) - throw new Error('Hash instance has been destroyed'); - if (checkFinished && instance.finished) - throw new Error('Hash#digest() has already been called'); -} -function output(out, instance) { - bytes(out); - const min = instance.outputLen; - if (out.length < min) { - throw new Error(`digestInto() expects output buffer of length at least ${min}`); - } -} - -const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); -const _32n = /* @__PURE__ */ BigInt(32); -// We are not using BigUint64Array, because they are extremely slow as per 2022 -function fromBig(n, le = false) { - if (le) - return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) }; - return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; -} -function split(lst, le = false) { - let Ah = new Uint32Array(lst.length); - let Al = new Uint32Array(lst.length); - for (let i = 0; i < lst.length; i++) { - const { h, l } = fromBig(lst[i], le); - [Ah[i], Al[i]] = [h, l]; - } - return [Ah, Al]; -} -const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); -// for Shift in [0, 32) -const shrSH = (h, _l, s) => h >>> s; -const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); -// Right rotate for Shift in [1, 32) -const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s)); -const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); -// Right rotate for Shift in (32, 64), NOTE: 32 is special case. -const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32)); -const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s)); -// Right rotate for shift===32 (just swaps l&h) -const rotr32H = (_h, l) => l; -const rotr32L = (h, _l) => h; -// Left rotate for Shift in [1, 32) -const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s)); -const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s)); -// Left rotate for Shift in (32, 64), NOTE: 32 is special case. -const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s)); -const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s)); -// JS uses 32-bit signed integers for bitwise operations which means we cannot -// simple take carry out of low bit sum by shift, we need to use division. -function add(Ah, Al, Bh, Bl) { - const l = (Al >>> 0) + (Bl >>> 0); - return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; -} -// Addition with more than 2 elements -const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); -const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0; -const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); -const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0; -const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); -const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0; -// prettier-ignore -const u64 = { - fromBig, split, toBig, - shrSH, shrSL, - rotrSH, rotrSL, rotrBH, rotrBL, - rotr32H, rotr32L, - rotlSH, rotlSL, rotlBH, rotlBL, - add, add3L, add3H, add4L, add4H, add5H, add5L, -}; -var u64$1 = u64; - -/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. -// node.js versions earlier than v19 don't declare it in global scope. -// For node.js, package.json#exports field mapping rewrites import -// from `crypto` to `cryptoNode`, which imports native module. -// Makes the utils un-importable in browsers without a bundler. -// Once node.js 18 is deprecated, we can just drop the import. -const u8a = (a) => a instanceof Uint8Array; -const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); -// Cast array to view -const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); -// The rotate right (circular right shift) operation for uint32 -const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift); -// big-endian hardware is rare. Just in case someone still decides to run hashes: -// early-throw an error because we don't support BE yet. -const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; -if (!isLE) - throw new Error('Non little-endian hardware is not supported'); -/** - * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) - */ -function utf8ToBytes(str) { - if (typeof str !== 'string') - throw new Error(`utf8ToBytes expected string, got ${typeof str}`); - return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 -} -/** - * Normalizes (non-hex) string or Uint8Array to Uint8Array. - * Warning: when Uint8Array is passed, it would NOT get copied. - * Keep in mind for future mutable operations. - */ -function toBytes(data) { - if (typeof data === 'string') - data = utf8ToBytes(data); - if (!u8a(data)) - throw new Error(`expected Uint8Array, got ${typeof data}`); - return data; -} -// For runtime check if class implements interface -class Hash { - // Safe version that clones internal state - clone() { - return this._cloneInto(); - } -} -function wrapConstructor(hashCons) { - const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); - const tmp = hashCons(); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = () => hashCons(); - return hashC; -} - -// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size. -// It's called a sponge function. -// Various per round constants calculations -const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []]; -const _0n = /* @__PURE__ */ BigInt(0); -const _1n = /* @__PURE__ */ BigInt(1); -const _2n = /* @__PURE__ */ BigInt(2); -const _7n = /* @__PURE__ */ BigInt(7); -const _256n = /* @__PURE__ */ BigInt(256); -const _0x71n = /* @__PURE__ */ BigInt(0x71); -for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { - // Pi - [x, y] = [y, (2 * x + 3 * y) % 5]; - SHA3_PI.push(2 * (5 * y + x)); - // Rotational - SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64); - // Iota - let t = _0n; - for (let j = 0; j < 7; j++) { - R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n; - if (R & _2n) - t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n); - } - _SHA3_IOTA.push(t); -} -const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true); -// Left rotation (without 0, 32, 64) -const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s)); -const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s)); -// Same as keccakf1600, but allows to skip some rounds -function keccakP(s, rounds = 24) { - const B = new Uint32Array(5 * 2); - // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js) - for (let round = 24 - rounds; round < 24; round++) { - // Theta θ - for (let x = 0; x < 10; x++) - B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; - for (let x = 0; x < 10; x += 2) { - const idx1 = (x + 8) % 10; - const idx0 = (x + 2) % 10; - const B0 = B[idx0]; - const B1 = B[idx0 + 1]; - const Th = rotlH(B0, B1, 1) ^ B[idx1]; - const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; - for (let y = 0; y < 50; y += 10) { - s[x + y] ^= Th; - s[x + y + 1] ^= Tl; - } - } - // Rho (ρ) and Pi (π) - let curH = s[2]; - let curL = s[3]; - for (let t = 0; t < 24; t++) { - const shift = SHA3_ROTL[t]; - const Th = rotlH(curH, curL, shift); - const Tl = rotlL(curH, curL, shift); - const PI = SHA3_PI[t]; - curH = s[PI]; - curL = s[PI + 1]; - s[PI] = Th; - s[PI + 1] = Tl; - } - // Chi (χ) - for (let y = 0; y < 50; y += 10) { - for (let x = 0; x < 10; x++) - B[x] = s[y + x]; - for (let x = 0; x < 10; x++) - s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; - } - // Iota (ι) - s[0] ^= SHA3_IOTA_H[round]; - s[1] ^= SHA3_IOTA_L[round]; - } - B.fill(0); -} -class Keccak extends Hash { - // NOTE: we accept arguments in bytes instead of bits here. - constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { - super(); - this.blockLen = blockLen; - this.suffix = suffix; - this.outputLen = outputLen; - this.enableXOF = enableXOF; - this.rounds = rounds; - this.pos = 0; - this.posOut = 0; - this.finished = false; - this.destroyed = false; - // Can be passed from user as dkLen - number(outputLen); - // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes - if (0 >= this.blockLen || this.blockLen >= 200) - throw new Error('Sha3 supports only keccak-f1600 function'); - this.state = new Uint8Array(200); - this.state32 = u32(this.state); - } - keccak() { - keccakP(this.state32, this.rounds); - this.posOut = 0; - this.pos = 0; - } - update(data) { - exists(this); - const { blockLen, state } = this; - data = toBytes(data); - const len = data.length; - for (let pos = 0; pos < len;) { - const take = Math.min(blockLen - this.pos, len - pos); - for (let i = 0; i < take; i++) - state[this.pos++] ^= data[pos++]; - if (this.pos === blockLen) - this.keccak(); - } - return this; - } - finish() { - if (this.finished) - return; - this.finished = true; - const { state, suffix, pos, blockLen } = this; - // Do the padding - state[pos] ^= suffix; - if ((suffix & 0x80) !== 0 && pos === blockLen - 1) - this.keccak(); - state[blockLen - 1] ^= 0x80; - this.keccak(); - } - writeInto(out) { - exists(this, false); - bytes(out); - this.finish(); - const bufferOut = this.state; - const { blockLen } = this; - for (let pos = 0, len = out.length; pos < len;) { - if (this.posOut >= blockLen) - this.keccak(); - const take = Math.min(blockLen - this.posOut, len - pos); - out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); - this.posOut += take; - pos += take; - } - return out; - } - xofInto(out) { - // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF - if (!this.enableXOF) - throw new Error('XOF is not possible for this instance'); - return this.writeInto(out); - } - xof(bytes) { - number(bytes); - return this.xofInto(new Uint8Array(bytes)); - } - digestInto(out) { - output(out, this); - if (this.finished) - throw new Error('digest() was already called'); - this.writeInto(out); - this.destroy(); - return out; - } - digest() { - return this.digestInto(new Uint8Array(this.outputLen)); - } - destroy() { - this.destroyed = true; - this.state.fill(0); - } - _cloneInto(to) { - const { blockLen, suffix, outputLen, rounds, enableXOF } = this; - to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); - to.state32.set(this.state32); - to.pos = this.pos; - to.posOut = this.posOut; - to.finished = this.finished; - to.rounds = rounds; - // Suffix can change in cSHAKE - to.suffix = suffix; - to.outputLen = outputLen; - to.enableXOF = enableXOF; - to.destroyed = this.destroyed; - return to; - } -} -const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)); -/** - * SHA3-256 hash function - * @param message - that would be hashed - */ -const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8); -const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8); -/** - * keccak-256 hash function. Different from SHA3-256. - * @param message - that would be hashed - */ -const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8); - -let _permanentCensorErrors = false; -let _censorErrors = false; -const LogLevels = { - debug: 1, - default: 2, - info: 2, - warning: 3, - error: 4, - off: 5, -}; -let _logLevel = LogLevels["default"]; -let _globalLogger = null; -function _checkNormalize() { - try { - const missing = []; - // Make sure all forms of normalization are supported - ["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => { - try { - if ("test".normalize(form) !== "test") { - throw new Error("bad normalize"); - } - } - catch (error) { - missing.push(form); - } - }); - if (missing.length) { - throw new Error("missing " + missing.join(", ")); - } - if (String.fromCharCode(0xe9).normalize("NFD") !== - String.fromCharCode(0x65, 0x0301)) { - throw new Error("broken implementation"); - } - } - catch (error) { - return error.message; - } - return null; -} -const _normalizeError = _checkNormalize(); -var LogLevel; -(function (LogLevel) { - LogLevel["DEBUG"] = "DEBUG"; - LogLevel["INFO"] = "INFO"; - LogLevel["WARNING"] = "WARNING"; - LogLevel["ERROR"] = "ERROR"; - LogLevel["OFF"] = "OFF"; -})(LogLevel || (LogLevel = {})); -var ErrorCode; -(function (ErrorCode) { - /////////////////// - // Generic Errors - // Unknown Error - ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; - // Not Implemented - ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED"; - // Unsupported Operation - // - operation - ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION"; - // Network Error (i.e. Core Network, such as an invalid network ID) - // - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown) - ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR"; - // Some sort of bad response from the server - ErrorCode["SERVER_ERROR"] = "SERVER_ERROR"; - // Timeout - ErrorCode["TIMEOUT"] = "TIMEOUT"; - /////////////////// - // Operational Errors - // Buffer Overrun - ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN"; - // Numeric Fault - // - operation: the operation being executed - // - fault: the reason this faulted - ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT"; - /////////////////// - // Argument Errors - // Missing new operator to an object - // - name: The name of the class - ErrorCode["MISSING_NEW"] = "MISSING_NEW"; - // Invalid argument (e.g. value is incompatible with type) to a function: - // - argument: The argument name that was invalid - // - value: The value of the argument - ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT"; - // Missing argument to a function: - // - count: The number of arguments received - // - expectedCount: The number of arguments expected - ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT"; - // Too many arguments - // - count: The number of arguments received - // - expectedCount: The number of arguments expected - ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT"; - /////////////////// - // Blockchain Errors - // Call exception - // - transaction: the transaction - // - address?: the contract address - // - args?: The arguments passed into the function - // - method?: The Solidity method signature - // - errorSignature?: The EIP848 error signature - // - errorArgs?: The EIP848 error parameters - // - reason: The reason (only for EIP848 "Error(string)") - ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION"; - // Insufficient funds (< value + energyLimit * energyPrice) - // - transaction: the transaction attempted - ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; - // Nonce has already been used - // - transaction: the transaction attempted - ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED"; - // The replacement fee for the transaction is too low - // - transaction: the transaction attempted - ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED"; - // The energy limit could not be estimated - // - transaction: the transaction passed to estimateEnergy - ErrorCode["UNPREDICTABLE_ENERGY_LIMIT"] = "UNPREDICTABLE_ENERGY_LIMIT"; - // The transaction was replaced by one with a higher energy price - // - reason: "cancelled", "replaced" or "repriced" - // - cancelled: true if reason == "cancelled" or reason == "replaced") - // - hash: original transaction hash - // - replacement: the full TransactionsResponse for the replacement - // - receipt: the receipt of the replacement - ErrorCode["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED"; -})(ErrorCode || (ErrorCode = {})); -const HEX = "0123456789abcdef"; -class Logger { - version = "0.0.1"; - static errors = ErrorCode; - static levels = LogLevel; - constructor(version) { - Object.defineProperty(this, "version", { - enumerable: true, - value: version, - writable: false, - }); - } - _log(logLevel, args) { - const level = logLevel.toLowerCase(); - if (LogLevels[level] == null) { - this.throwArgumentError("invalid log level name", "logLevel", logLevel); - } - if (_logLevel > LogLevels[level]) { - return; - } - console.log.apply(console, args); - } - debug(...args) { - this._log(Logger.levels.DEBUG, args); - } - info(...args) { - this._log(Logger.levels.INFO, args); - } - warn(...args) { - this._log(Logger.levels.WARNING, args); - } - makeError(message, code, params) { - // Errors are being censored - if (_censorErrors) { - return this.makeError("censored error", code, {}); - } - if (!code) { - code = Logger.errors.UNKNOWN_ERROR; - } - if (!params) { - params = {}; - } - const messageDetails = []; - Object.keys(params).forEach((key) => { - const value = params[key]; - try { - if (value instanceof Uint8Array) { - let hex = ""; - for (let i = 0; i < value.length; i++) { - hex += HEX[value[i] >> 4]; - hex += HEX[value[i] & 0x0f]; - } - messageDetails.push(key + "=Uint8Array(0x" + hex + ")"); - } - else { - messageDetails.push(key + "=" + JSON.stringify(value)); - } - } - catch (error) { - messageDetails.push(key + "=" + JSON.stringify(params[key].toString())); - } - }); - messageDetails.push(`code=${code}`); - messageDetails.push(`version=${this.version}`); - const reason = message; - if (messageDetails.length) { - message += " (" + messageDetails.join(", ") + ")"; - } - // @TODO: Any?? - const error = new Error(message); - error.reason = reason; - error.code = code; - Object.keys(params).forEach(function (key) { - error[key] = params[key]; - }); - return error; - } - throwError(message, code, params) { - throw this.makeError(message, code, params); - } - throwArgumentError(message, name, value) { - return this.throwError(message, Logger.errors.INVALID_ARGUMENT, { - argument: name, - value: value, - }); - } - assert(condition, message, code, params) { - if (!!condition) { - return; - } - this.throwError(message, code, params); - } - assertArgument(condition, message, name, value) { - if (!!condition) { - return; - } - this.throwArgumentError(message, name, value); - } - checkNormalize(message) { - if (_normalizeError) { - this.throwError("platform missing String.prototype.normalize", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "String.prototype.normalize", - form: _normalizeError, - }); - } - } - checkSafeUint53(value, message) { - if (typeof value !== "number") { - return; - } - if (message == null) { - message = "value not safe"; - } - if (value < 0 || value >= 0x1fffffffffffff) { - this.throwError(message, Logger.errors.NUMERIC_FAULT, { - operation: "checkSafeInteger", - fault: "out-of-safe-range", - value: value, - }); - } - if (value % 1) { - this.throwError(message, Logger.errors.NUMERIC_FAULT, { - operation: "checkSafeInteger", - fault: "non-integer", - value: value, - }); - } - } - checkArgumentCount(count, expectedCount, message) { - if (message) { - message = ": " + message; - } - else { - message = ""; - } - if (count < expectedCount) { - this.throwError("missing argument" + message, Logger.errors.MISSING_ARGUMENT, { - count: count, - expectedCount: expectedCount, - }); - } - if (count > expectedCount) { - this.throwError("too many arguments" + message, Logger.errors.UNEXPECTED_ARGUMENT, { - count: count, - expectedCount: expectedCount, - }); - } - } - checkNew(target, kind) { - if (target === Object || target == null) { - this.throwError("missing new", Logger.errors.MISSING_NEW, { - name: kind.name, - }); - } - } - checkAbstract(target, kind) { - if (target === kind) { - this.throwError("cannot instantiate abstract class " + - JSON.stringify(kind.name) + - " directly; use a sub-class", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" }); - } - else if (target === Object || target == null) { - this.throwError("missing new", Logger.errors.MISSING_NEW, { - name: kind.name, - }); - } - } - static globalLogger() { - if (!_globalLogger) { - _globalLogger = new Logger("logger/0.0.1"); - } - return _globalLogger; - } - static setCensorship(censorship, permanent) { - if (!censorship && permanent) { - this.globalLogger().throwError("cannot permanently disable censorship", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "setCensorship", - }); - } - if (_permanentCensorErrors) { - if (!censorship) { - return; - } - this.globalLogger().throwError("error censorship permanent", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "setCensorship", - }); - } - _censorErrors = !!censorship; - _permanentCensorErrors = !!permanent; - } - static setLogLevel(logLevel) { - const level = LogLevels[logLevel.toLowerCase()]; - if (level == null) { - Logger.globalLogger().warn("invalid log level - " + logLevel); - return; - } - _logLevel = level; - } - static from(version) { - return new Logger(version); - } -} - -/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ -/** - * The current version of corebc. - */ -const version = "6.4.0"; - -function checkType(value, type, name) { - const types = type.split("|").map((t) => t.trim()); - for (let i = 0; i < types.length; i++) { - switch (type) { - case "any": - return; - case "bigint": - case "boolean": - case "number": - case "string": - if (typeof value === type) { - return; - } - } - } - const error = new Error(`invalid value for type ${type}`); - error.code = "INVALID_ARGUMENT"; - error.argument = `value.${name}`; - error.value = value; - throw error; -} -/** - * Assigns the %%values%% to %%target%% as read-only values. - * - * It %%types%% is specified, the values are checked. - */ -function defineProperties(target, values, types) { - for (let key in values) { - let value = values[key]; - const type = types ? types[key] : null; - if (type) { - checkType(value, type, key); - } - Object.defineProperty(target, key, { - enumerable: true, - value, - writable: false, - }); - } -} - -/** - * About Errors. - * - * @_section: api/utils/errors:Errors [about-errors] - */ -function stringify(value) { - if (value == null) { - return "null"; - } - if (Array.isArray(value)) { - return "[ " + value.map(stringify).join(", ") + " ]"; - } - if (value instanceof Uint8Array) { - const HEX = "0123456789abcdef"; - let result = "0x"; - for (let i = 0; i < value.length; i++) { - result += HEX[value[i] >> 4]; - result += HEX[value[i] & 0xf]; - } - return result; - } - if (typeof value === "object" && typeof value.toJSON === "function") { - return stringify(value.toJSON()); - } - switch (typeof value) { - case "boolean": - case "symbol": - return value.toString(); - case "bigint": - return BigInt(value).toString(); - case "number": - return value.toString(); - case "string": - return JSON.stringify(value); - case "object": { - const keys = Object.keys(value); - keys.sort(); - return ("{ " + - keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + - " }"); - } - } - return `[ COULD NOT SERIALIZE ]`; -} -/** - * Returns a new Error configured to the format corebc emits errors, with - * the %%message%%, [[api:ErrorCode]] %%code%% and additioanl properties - * for the corresponding corebcError. - * - * Each error in corebc includes the version of corebc, a - * machine-readable [[ErrorCode]], and depneding on %%code%%, additional - * required properties. The error message will also include the %%meeage%%, - * corebc version, %%code%% and all aditional properties, serialized. - */ -function makeError(message, code, info) { - { - const details = []; - if (info) { - if ("message" in info || "code" in info || "name" in info) { - throw new Error(`value will overwrite populated values: ${stringify(info)}`); - } - for (const key in info) { - const value = info[key]; - // try { - details.push(key + "=" + stringify(value)); - // } catch (error: any) { - // console.log("MMM", error.message); - // details.push(key + "=[could not serialize object]"); - // } - } - } - details.push(`code=${code}`); - details.push(`version=${version}`); - if (details.length) { - message += " (" + details.join(", ") + ")"; - } - } - let error; - switch (code) { - case "INVALID_ARGUMENT": - error = new TypeError(message); - break; - case "NUMERIC_FAULT": - case "BUFFER_OVERRUN": - error = new RangeError(message); - break; - default: - error = new Error(message); - } - defineProperties(error, { code }); - if (info) { - Object.assign(error, info); - } - return error; -} -/** - * Throws an corebcError with %%message%%, %%code%% and additional error - * %%info%% when %%check%% is falsish.. - * - * @see [[api:makeError]] - */ -function assert(check, message, code, info) { - if (!check) { - throw makeError(message, code, info); - } -} -/** - * A simple helper to simply ensuring provided arguments match expected - * constraints, throwing if not. - * - * In TypeScript environments, the %%check%% has been asserted true, so - * any further code does not need additional compile-time checks. - */ -function assertArgument(check, message, name, value) { - assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); -} -const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => { - try { - // General test for normalize - /* c8 ignore start */ - if ("test".normalize(form) !== "test") { - throw new Error("bad"); - } - /* c8 ignore stop */ - if (form === "NFD") { - const check = String.fromCharCode(0xe9).normalize("NFD"); - const expected = String.fromCharCode(0x65, 0x0301); - /* c8 ignore start */ - if (check !== expected) { - throw new Error("broken"); - } - /* c8 ignore stop */ - } - accum.push(form); - } - catch (error) { } - return accum; -}, []); -/** - * Throws if the normalization %%form%% is not supported. - */ -function assertNormalize(form) { - assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", { - operation: "String.prototype.normalize", - info: { form }, - }); -} - -/** - * Some data helpers. - * - * - * @_subsection api/utils:Data Helpers [about-data] - */ -const logger = new Logger("utils/data/0.0.1"); -function isHexable(value) { - return !!value.toHexString; -} -function isInteger(value) { - return typeof value === "number" && value == value && value % 1 === 0; -} -function isBytes(value) { - if (value == null) { - return false; - } - if (value.constructor === Uint8Array) { - return true; - } - if (typeof value === "string") { - return false; - } - if (!isInteger(value.length) || value.length < 0) { - return false; - } - for (let i = 0; i < value.length; i++) { - const v = value[i]; - if (!isInteger(v) || v < 0 || v >= 256) { - return false; - } - } - return true; -} -function _getBytes(value, name, copy) { - if (value instanceof Uint8Array) { - if (copy) { - return new Uint8Array(value); - } - return value; - } - if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) { - const result = new Uint8Array((value.length - 2) / 2); - let offset = 2; - for (let i = 0; i < result.length; i++) { - result[i] = parseInt(value.substring(offset, offset + 2), 16); - offset += 2; - } - return result; - } - assertArgument(false, "invalid BytesLike value", name || "value", value); -} -/** - * Get a typed Uint8Array for %%value%%. If already a Uint8Array - * the original %%value%% is returned; if a copy is required use - * [[getBytesCopy]]. - * - * @see: getBytesCopy - */ -function getBytes(value, name) { - return _getBytes(value, name, false); -} -/** - * Returns true if %%value%% is a valid [[HexString]]. - * - * If %%length%% is ``true`` or a //number//, it also checks that - * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) - * bytes of data (e.g. ``0x1234`` is 2 bytes). - */ -function isHexString(value, length) { - if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { - return false; - } - if (typeof length === "number" && value.length !== 2 + 2 * length) { - return false; - } - if (length === true && value.length % 2 !== 0) { - return false; - } - return true; -} -const HexCharacters = "0123456789abcdef"; -/** - * Returns a [[DataHexString]] representation of %%data%%. - */ -function hexlify(value, options) { - if (!options) { - options = {}; - } - if (typeof value === "string") { - if (value.includes(",") && value.startsWith("0x")) { - const v = value - .replace("0x", "") - .split(",") - .map((item) => Number(item)); - // @ts-ignore - value = new Uint8Array(v); - } - } - if (typeof value === "number") { - logger.checkSafeUint53(value, "invalid hexlify value"); - let hex = ""; - while (value) { - hex = HexCharacters[value & 0xf] + hex; - value = Math.floor(value / 16); - } - if (hex.length) { - if (hex.length % 2) { - hex = "0" + hex; - } - return "0x" + hex; - } - return "0x00"; - } - if (typeof value === "bigint") { - value = value.toString(16); - if (value.length % 2) { - return "0x0" + value; - } - return "0x" + value; - } - if (options.allowMissingPrefix && - typeof value === "string" && - value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - if (isHexable(value)) { - return value.toHexString(); - } - if (isHexString(value)) { - if (value.length % 2) { - if (options.hexPad === "left") { - value = "0x0" + value.substring(2); - } - else if (options.hexPad === "right") { - value += "0"; - } - else { - logger.throwArgumentError("hex data is odd-length", "value", value); - } - } - return value.toLowerCase(); - } - if (isBytes(value)) { - let result = "0x"; - for (let i = 0; i < value.length; i++) { - let v = value[i]; - result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; - } - return result; - } - return logger.throwArgumentError("invalid hexlify value", "value", value); -} -function arrayify(value, options) { - if (!options) { - options = {}; - } - if (typeof value === "number") { - logger.checkSafeUint53(value, "invalid arrayify value"); - const result = []; - while (value) { - // @ts-ignore - result.unshift(value & 0xff); - value = parseInt(String(value / 256)); - } - if (result.length === 0) { - result.push(0); - } - return addSlice(new Uint8Array(result)); - } - if (options.allowMissingPrefix && - typeof value === "string" && - value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - if (isHexable(value)) { - value = value.toHexString(); - } - if (isHexString(value)) { - let hex = value.substring(2); - if (hex.length % 2) { - if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); - } - else if (options.hexPad === "right") { - hex += "0"; - } - else { - logger.throwArgumentError("hex data is odd-length", "value", value); - } - } - const result = []; - for (let i = 0; i < hex.length; i += 2) { - // @ts-ignore - result.push(parseInt(hex.substring(i, i + 2), 16)); - } - return addSlice(new Uint8Array(result)); - } - if (isBytes(value)) { - return addSlice(new Uint8Array(value)); - } - return logger.throwArgumentError("invalid arrayify value", "value", value); -} -function addSlice(array) { - // @ts-ignore - if (array.slice) { - return array; - } - array.slice = function () { - const args = Array.prototype.slice.call(arguments); - return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args))); - }; - return array; -} - -/** - * Using strings in Core (or any security-basd system) requires - * additional care. These utilities attempt to mitigate some of the - * safety issues as well as provide the ability to recover and analyse - * strings. - * - * @_subsection api/utils:Strings and UTF-8 [about-strings] - */ -function errorFunc(reason, offset, bytes, output, badCodepoint) { - assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); -} -function ignoreFunc(reason, offset, bytes, output, badCodepoint) { - // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes - if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { - let i = 0; - for (let o = offset + 1; o < bytes.length; o++) { - if (bytes[o] >> 6 !== 0x02) { - break; - } - i++; - } - return i; - } - // This byte runs us past the end of the string, so just jump to the end - // (but the first byte was read already read and therefore skipped) - if (reason === "OVERRUN") { - return bytes.length - offset - 1; - } - // Nothing to skip - return 0; -} -function replaceFunc(reason, offset, bytes, output, badCodepoint) { - // Overlong representations are otherwise "valid" code points; just non-deistingtished - if (reason === "OVERLONG") { - assertArgument(typeof badCodepoint === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint); - output.push(badCodepoint); - return 0; - } - // Put the replacement character into the output - output.push(0xfffd); - // Otherwise, process as if ignoring errors - return ignoreFunc(reason, offset, bytes); -} -/** - * A handful of popular, built-in UTF-8 error handling strategies. - * - * **``"error"``** - throws on ANY illegal UTF-8 sequence or - * non-canonical (overlong) codepoints (this is the default) - * - * **``"ignore"``** - silently drops any illegal UTF-8 sequence - * and accepts non-canonical (overlong) codepoints - * - * **``"replace"``** - replace any illegal UTF-8 sequence with the - * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts - * non-canonical (overlong) codepoints - * - * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> - */ -const Utf8ErrorFuncs = Object.freeze({ - error: errorFunc, - ignore: ignoreFunc, - replace: replaceFunc, -}); -// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 -function getUtf8CodePoints(_bytes, onError) { - if (onError == null) { - onError = Utf8ErrorFuncs.error; - } - const bytes = getBytes(_bytes, "bytes"); - const result = []; - let i = 0; - // Invalid bytes are ignored - while (i < bytes.length) { - const c = bytes[i++]; - // 0xxx xxxx - if (c >> 7 === 0) { - result.push(c); - continue; - } - // Multibyte; how many bytes left for this character? - let extraLength = null; - let overlongMask = null; - // 110x xxxx 10xx xxxx - if ((c & 0xe0) === 0xc0) { - extraLength = 1; - overlongMask = 0x7f; - // 1110 xxxx 10xx xxxx 10xx xxxx - } - else if ((c & 0xf0) === 0xe0) { - extraLength = 2; - overlongMask = 0x7ff; - // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx - } - else if ((c & 0xf8) === 0xf0) { - extraLength = 3; - overlongMask = 0xffff; - } - else { - if ((c & 0xc0) === 0x80) { - i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); - } - else { - i += onError("BAD_PREFIX", i - 1, bytes, result); - } - continue; - } - // Do we have enough bytes in our data? - if (i - 1 + extraLength >= bytes.length) { - i += onError("OVERRUN", i - 1, bytes, result); - continue; - } - // Remove the length prefix from the char - let res = c & ((1 << (8 - extraLength - 1)) - 1); - for (let j = 0; j < extraLength; j++) { - let nextChar = bytes[i]; - // Invalid continuation byte - if ((nextChar & 0xc0) != 0x80) { - i += onError("MISSING_CONTINUE", i, bytes, result); - res = null; - break; - } - res = (res << 6) | (nextChar & 0x3f); - i++; - } - // See above loop for invalid continuation byte - if (res === null) { - continue; - } - // Maximum code point - if (res > 0x10ffff) { - i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); - continue; - } - // Reserved for UTF-16 surrogate halves - if (res >= 0xd800 && res <= 0xdfff) { - i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); - continue; - } - // Check for overlong sequences (more bytes than needed) - if (res <= overlongMask) { - i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); - continue; - } - result.push(res); - } - return result; -} -// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array -/** - * Returns the UTF-8 byte representation of %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ -function toUtf8Bytes(str, form) { - if (form != null) { - assertNormalize(form); - str = str.normalize(form); - } - let result = []; - for (let i = 0; i < str.length; i++) { - const c = str.charCodeAt(i); - if (c < 0x80) { - result.push(c); - } - else if (c < 0x800) { - result.push((c >> 6) | 0xc0); - result.push((c & 0x3f) | 0x80); - } - else if ((c & 0xfc00) == 0xd800) { - i++; - const c2 = str.charCodeAt(i); - assertArgument(i < str.length && (c2 & 0xfc00) === 0xdc00, "invalid surrogate pair", "str", str); - // Surrogate Pair - const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); - result.push((pair >> 18) | 0xf0); - result.push(((pair >> 12) & 0x3f) | 0x80); - result.push(((pair >> 6) & 0x3f) | 0x80); - result.push((pair & 0x3f) | 0x80); - } - else { - result.push((c >> 12) | 0xe0); - result.push(((c >> 6) & 0x3f) | 0x80); - result.push((c & 0x3f) | 0x80); - } - } - return new Uint8Array(result); -} -//export -function _toUtf8String(codePoints) { - return codePoints - .map((codePoint) => { - if (codePoint <= 0xffff) { - return String.fromCharCode(codePoint); - } - codePoint -= 0x10000; - return String.fromCharCode(((codePoint >> 10) & 0x3ff) + 0xd800, (codePoint & 0x3ff) + 0xdc00); - }) - .join(""); -} -/** - * Returns the string represented by the UTF-8 data %%bytes%%. - * - * When %%onError%% function is specified, it is called on UTF-8 - * errors allowing recovery using the [[Utf8ErrorFunc]] API. - * (default: [error](Utf8ErrorFuncs)) - */ -function toUtf8String(bytes, onError) { - return _toUtf8String(getUtf8CodePoints(bytes, onError)); -} - -/** - * Cryptographic hashing functions - * - * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] - */ -let locked = false; -const _keccak256 = function (data) { - return keccak_256(data); -}; -let __keccak256 = _keccak256; -/** - * Compute the cryptographic KECCAK256 hash of %%data%%. - * - * The %%data%% **must** be a data representation, to compute the - * hash of UTF-8 data use the [[id]] function. - * - * @returns DataHexstring - * @example: - * keccak256("0x") - * //_result: - * - * keccak256("0x1337") - * //_result: - * - * keccak256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - * // Strings are assumed to be DataHexString, otherwise it will - * // throw. To hash UTF-8 data, see the note above. - * keccak256("Hello World") - * //_error: - */ -function keccak256(_data) { - const data = getBytes(_data, "data"); - return hexlify(__keccak256(data)); -} -keccak256._ = _keccak256; -keccak256.lock = function () { - locked = true; -}; -keccak256.register = function (func) { - if (locked) { - throw new TypeError("keccak256 is locked"); - } - __keccak256 = func; -}; -Object.freeze(keccak256); - -// Polyfill for Safari 14 -function setBigUint64(view, byteOffset, value, isLE) { - if (typeof view.setBigUint64 === 'function') - return view.setBigUint64(byteOffset, value, isLE); - const _32n = BigInt(32); - const _u32_max = BigInt(0xffffffff); - const wh = Number((value >> _32n) & _u32_max); - const wl = Number(value & _u32_max); - const h = isLE ? 4 : 0; - const l = isLE ? 0 : 4; - view.setUint32(byteOffset + h, wh, isLE); - view.setUint32(byteOffset + l, wl, isLE); -} -// Base SHA2 class (RFC 6234) -class SHA2 extends Hash { - constructor(blockLen, outputLen, padOffset, isLE) { - super(); - this.blockLen = blockLen; - this.outputLen = outputLen; - this.padOffset = padOffset; - this.isLE = isLE; - this.finished = false; - this.length = 0; - this.pos = 0; - this.destroyed = false; - this.buffer = new Uint8Array(blockLen); - this.view = createView(this.buffer); - } - update(data) { - exists(this); - const { view, buffer, blockLen } = this; - data = toBytes(data); - const len = data.length; - for (let pos = 0; pos < len;) { - const take = Math.min(blockLen - this.pos, len - pos); - // Fast path: we have at least one block in input, cast it to view and process - if (take === blockLen) { - const dataView = createView(data); - for (; blockLen <= len - pos; pos += blockLen) - this.process(dataView, pos); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - pos += take; - if (this.pos === blockLen) { - this.process(view, 0); - this.pos = 0; - } - } - this.length += data.length; - this.roundClean(); - return this; - } - digestInto(out) { - exists(this); - output(out, this); - this.finished = true; - // Padding - // We can avoid allocation of buffer for padding completely if it - // was previously not allocated here. But it won't change performance. - const { buffer, view, blockLen, isLE } = this; - let { pos } = this; - // append the bit '1' to the message - buffer[pos++] = 0b10000000; - this.buffer.subarray(pos).fill(0); - // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again - if (this.padOffset > blockLen - pos) { - this.process(view, 0); - pos = 0; - } - // Pad until full block byte with zeros - for (let i = pos; i < blockLen; i++) - buffer[i] = 0; - // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that - // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen. - // So we just write lowest 64 bits of that value. - setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE); - this.process(view, 0); - const oview = createView(out); - const len = this.outputLen; - // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT - if (len % 4) - throw new Error('_sha2: outputLen should be aligned to 32bit'); - const outLen = len / 4; - const state = this.get(); - if (outLen > state.length) - throw new Error('_sha2: outputLen bigger than state'); - for (let i = 0; i < outLen; i++) - oview.setUint32(4 * i, state[i], isLE); - } - digest() { - const { buffer, outputLen } = this; - this.digestInto(buffer); - const res = buffer.slice(0, outputLen); - this.destroy(); - return res; - } - _cloneInto(to) { - to || (to = new this.constructor()); - to.set(...this.get()); - const { blockLen, buffer, length, finished, destroyed, pos } = this; - to.length = length; - to.pos = pos; - to.finished = finished; - to.destroyed = destroyed; - if (length % blockLen) - to.buffer.set(buffer); - return to; - } -} - -// SHA2-256 need to try 2^128 hashes to execute birthday attack. -// BTC network is doing 2^67 hashes/sec as per early 2023. -// Choice: a ? b : c -const Chi = (a, b, c) => (a & b) ^ (~a & c); -// Majority function, true if any two inpust is true -const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c); -// Round constants: -// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311) -// prettier-ignore -const SHA256_K = /* @__PURE__ */ new Uint32Array([ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -]); -// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): -// prettier-ignore -const IV = /* @__PURE__ */ new Uint32Array([ - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 -]); -// Temporary buffer, not used to store anything between runs -// Named this way because it matches specification. -const SHA256_W = /* @__PURE__ */ new Uint32Array(64); -class SHA256 extends SHA2 { - constructor() { - super(64, 32, 8, false); - // We cannot use array here since array allows indexing by variable - // which means optimizer/compiler cannot use registers. - this.A = IV[0] | 0; - this.B = IV[1] | 0; - this.C = IV[2] | 0; - this.D = IV[3] | 0; - this.E = IV[4] | 0; - this.F = IV[5] | 0; - this.G = IV[6] | 0; - this.H = IV[7] | 0; - } - get() { - const { A, B, C, D, E, F, G, H } = this; - return [A, B, C, D, E, F, G, H]; - } - // prettier-ignore - set(A, B, C, D, E, F, G, H) { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - this.F = F | 0; - this.G = G | 0; - this.H = H | 0; - } - process(view, offset) { - // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array - for (let i = 0; i < 16; i++, offset += 4) - SHA256_W[i] = view.getUint32(offset, false); - for (let i = 16; i < 64; i++) { - const W15 = SHA256_W[i - 15]; - const W2 = SHA256_W[i - 2]; - const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3); - const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10); - SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; - } - // Compression function main loop, 64 rounds - let { A, B, C, D, E, F, G, H } = this; - for (let i = 0; i < 64; i++) { - const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); - const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; - const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); - const T2 = (sigma0 + Maj(A, B, C)) | 0; - H = G; - G = F; - F = E; - E = (D + T1) | 0; - D = C; - C = B; - B = A; - A = (T1 + T2) | 0; - } - // Add the compressed chunk to the current hash value - A = (A + this.A) | 0; - B = (B + this.B) | 0; - C = (C + this.C) | 0; - D = (D + this.D) | 0; - E = (E + this.E) | 0; - F = (F + this.F) | 0; - G = (G + this.G) | 0; - H = (H + this.H) | 0; - this.set(A, B, C, D, E, F, G, H); - } - roundClean() { - SHA256_W.fill(0); - } - destroy() { - this.set(0, 0, 0, 0, 0, 0, 0, 0); - this.buffer.fill(0); - } -} -/** - * SHA2-256 hash function - * @param message - data that would be hashed - */ -const sha256$1 = /* @__PURE__ */ wrapConstructor(() => new SHA256()); - -// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409): -// prettier-ignore -const [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64$1.split([ - '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc', - '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118', - '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2', - '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694', - '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65', - '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5', - '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4', - '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70', - '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df', - '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b', - '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30', - '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8', - '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8', - '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3', - '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec', - '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b', - '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178', - '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b', - '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c', - '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817' -].map(n => BigInt(n))))(); -// Temporary buffer, not used to store anything between runs -const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80); -const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80); -class SHA512 extends SHA2 { - constructor() { - super(128, 64, 16, false); - // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers. - // Also looks cleaner and easier to verify with spec. - // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): - // h -- high 32 bits, l -- low 32 bits - this.Ah = 0x6a09e667 | 0; - this.Al = 0xf3bcc908 | 0; - this.Bh = 0xbb67ae85 | 0; - this.Bl = 0x84caa73b | 0; - this.Ch = 0x3c6ef372 | 0; - this.Cl = 0xfe94f82b | 0; - this.Dh = 0xa54ff53a | 0; - this.Dl = 0x5f1d36f1 | 0; - this.Eh = 0x510e527f | 0; - this.El = 0xade682d1 | 0; - this.Fh = 0x9b05688c | 0; - this.Fl = 0x2b3e6c1f | 0; - this.Gh = 0x1f83d9ab | 0; - this.Gl = 0xfb41bd6b | 0; - this.Hh = 0x5be0cd19 | 0; - this.Hl = 0x137e2179 | 0; - } - // prettier-ignore - get() { - const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; - } - // prettier-ignore - set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { - this.Ah = Ah | 0; - this.Al = Al | 0; - this.Bh = Bh | 0; - this.Bl = Bl | 0; - this.Ch = Ch | 0; - this.Cl = Cl | 0; - this.Dh = Dh | 0; - this.Dl = Dl | 0; - this.Eh = Eh | 0; - this.El = El | 0; - this.Fh = Fh | 0; - this.Fl = Fl | 0; - this.Gh = Gh | 0; - this.Gl = Gl | 0; - this.Hh = Hh | 0; - this.Hl = Hl | 0; - } - process(view, offset) { - // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array - for (let i = 0; i < 16; i++, offset += 4) { - SHA512_W_H[i] = view.getUint32(offset); - SHA512_W_L[i] = view.getUint32((offset += 4)); - } - for (let i = 16; i < 80; i++) { - // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7) - const W15h = SHA512_W_H[i - 15] | 0; - const W15l = SHA512_W_L[i - 15] | 0; - const s0h = u64$1.rotrSH(W15h, W15l, 1) ^ u64$1.rotrSH(W15h, W15l, 8) ^ u64$1.shrSH(W15h, W15l, 7); - const s0l = u64$1.rotrSL(W15h, W15l, 1) ^ u64$1.rotrSL(W15h, W15l, 8) ^ u64$1.shrSL(W15h, W15l, 7); - // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6) - const W2h = SHA512_W_H[i - 2] | 0; - const W2l = SHA512_W_L[i - 2] | 0; - const s1h = u64$1.rotrSH(W2h, W2l, 19) ^ u64$1.rotrBH(W2h, W2l, 61) ^ u64$1.shrSH(W2h, W2l, 6); - const s1l = u64$1.rotrSL(W2h, W2l, 19) ^ u64$1.rotrBL(W2h, W2l, 61) ^ u64$1.shrSL(W2h, W2l, 6); - // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16]; - const SUMl = u64$1.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); - const SUMh = u64$1.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); - SHA512_W_H[i] = SUMh | 0; - SHA512_W_L[i] = SUMl | 0; - } - let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - // Compression function main loop, 80 rounds - for (let i = 0; i < 80; i++) { - // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41) - const sigma1h = u64$1.rotrSH(Eh, El, 14) ^ u64$1.rotrSH(Eh, El, 18) ^ u64$1.rotrBH(Eh, El, 41); - const sigma1l = u64$1.rotrSL(Eh, El, 14) ^ u64$1.rotrSL(Eh, El, 18) ^ u64$1.rotrBL(Eh, El, 41); - //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; - const CHIh = (Eh & Fh) ^ (~Eh & Gh); - const CHIl = (El & Fl) ^ (~El & Gl); - // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i] - // prettier-ignore - const T1ll = u64$1.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); - const T1h = u64$1.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); - const T1l = T1ll | 0; - // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39) - const sigma0h = u64$1.rotrSH(Ah, Al, 28) ^ u64$1.rotrBH(Ah, Al, 34) ^ u64$1.rotrBH(Ah, Al, 39); - const sigma0l = u64$1.rotrSL(Ah, Al, 28) ^ u64$1.rotrBL(Ah, Al, 34) ^ u64$1.rotrBL(Ah, Al, 39); - const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch); - const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl); - Hh = Gh | 0; - Hl = Gl | 0; - Gh = Fh | 0; - Gl = Fl | 0; - Fh = Eh | 0; - Fl = El | 0; - ({ h: Eh, l: El } = u64$1.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); - Dh = Ch | 0; - Dl = Cl | 0; - Ch = Bh | 0; - Cl = Bl | 0; - Bh = Ah | 0; - Bl = Al | 0; - const All = u64$1.add3L(T1l, sigma0l, MAJl); - Ah = u64$1.add3H(All, T1h, sigma0h, MAJh); - Al = All | 0; - } - // Add the compressed chunk to the current hash value - ({ h: Ah, l: Al } = u64$1.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); - ({ h: Bh, l: Bl } = u64$1.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); - ({ h: Ch, l: Cl } = u64$1.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); - ({ h: Dh, l: Dl } = u64$1.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); - ({ h: Eh, l: El } = u64$1.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); - ({ h: Fh, l: Fl } = u64$1.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); - ({ h: Gh, l: Gl } = u64$1.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); - ({ h: Hh, l: Hl } = u64$1.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); - this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); - } - roundClean() { - SHA512_W_H.fill(0); - SHA512_W_L.fill(0); - } - destroy() { - this.buffer.fill(0); - this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } -} -const sha512 = /* @__PURE__ */ wrapConstructor(() => new SHA512()); - -/* Browser Crypto Shims */ -function getGlobal() { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw new Error("unable to locate global object"); -} -const anyGlobal = getGlobal(); -anyGlobal.crypto || anyGlobal.msCrypto; -function createHash(algo) { - switch (algo) { - case "sha256": - return sha256$1.create(); - case "sha512": - return sha512.create(); - case "sha3-256": - return sha3_256.create(); - case "sha3-512": - return sha3_512.create(); - } - assertArgument(false, "invalid hashing algorithm name", "algorithm", algo); -} - -const _sha256 = function (data) { - let v = "0x" + - createHash("sha3-256") - .update(Buffer.from(arrayify(data))) - .digest("hex"); - return v; -}; -let locked256 = false; -/** - * Compute the cryptographic SHA2-256 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha256("0x") - * //_result: - * - * sha256("0x1337") - * //_result: - * - * sha256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ -var SupportedAlgorithm; -(function (SupportedAlgorithm) { - SupportedAlgorithm["sha256"] = "sha256"; - SupportedAlgorithm["sha512"] = "sha512"; -})(SupportedAlgorithm || (SupportedAlgorithm = {})); -function sha256(data) { - let createdHash = createHash("sha3-256") - .update(Buffer.from(arrayify(data))) - .digest("hex"); - const v = "0x" + createdHash; - if (typeof createdHash !== "string") { - createdHash = hexlify(createdHash); - return createdHash; - } - return v; -} -sha256._ = _sha256; -sha256.lock = function () { - locked256 = true; -}; -sha256.register = function (func) { - if (locked256) { - throw new Error("sha256 is locked"); - } -}; -Object.freeze(sha256); -Object.freeze(sha256); - -/** - * A simple hashing function which operates on UTF-8 strings to - * compute an 32-byte identifier. - * - * - * @example: - * id("hello world") - * //_result: - */ -function id(value, useKeccak) { - if (useKeccak) { - return keccak256(toUtf8Bytes(value)); - } - return sha256(toUtf8Bytes(value)); -} - -const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; -const Word = /^[a-z]*$/i; -function unfold(words, sep) { - let initial = 97; - return words.reduce((accum, word) => { - if (word === sep) { - initial++; - } - else if (word.match(Word)) { - accum.push(String.fromCharCode(initial) + word); - } - else { - initial = 97; - accum.push(word); - } - return accum; - }, []); -} -/** - * @_ignore - */ -function decode(data, subs) { - // Replace all the substitutions with their expanded form - for (let i = subsChrs.length - 1; i >= 0; i--) { - data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); - } - // Get all tle clumps; each suffix, first-increment and second-increment - const clumps = []; - const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => { - if (semi) { - for (let i = parseInt(semi); i >= 0; i--) { - clumps.push(";"); - } - } - else { - clumps.push(item.toLowerCase()); - } - return ""; - }); - /* c8 ignore start */ - if (leftover) { - throw new Error(`leftovers: ${JSON.stringify(leftover)}`); - } - /* c8 ignore stop */ - return unfold(unfold(clumps, ";"), ":"); -} -/** - * @_ignore - */ -function decodeOwl(data) { - assertArgument(data[0] === "0", "unsupported auwl data", "data", data); - return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length)); -} - -/** - * A Wordlist represents a collection of language-specific - * words used to encode and devoce [[link-bip-39]] encoded data - * by mapping words to 11-bit values and vice versa. - */ -class Wordlist { - locale; - /** - * Creates a new Wordlist instance. - * - * Sub-classes MUST call this if they provide their own constructor, - * passing in the locale string of the language. - * - * Generally there is no need to create instances of a Wordlist, - * since each language-specific Wordlist creates an instance and - * there is no state kept internally, so they are safe to share. - */ - constructor(locale) { - defineProperties(this, { locale }); - } - /** - * Sub-classes may override this to provide a language-specific - * method for spliting %%phrase%% into individual words. - * - * By default, %%phrase%% is split using any sequences of - * white-space as defined by regular expressions (i.e. ``/\s+/``). - */ - split(phrase) { - return phrase.toLowerCase().split(/\s+/g); - } - /** - * Sub-classes may override this to provider a language-specific - * method for joining %%words%% into a phrase. - * - * By default, %%words%% are joined by a single space. - */ - join(words) { - return words.join(" "); - } - static check(wordlist) { - const words = []; - for (let i = 0; i < 2048; i++) { - const word = wordlist.getWord(i); - /* istanbul ignore if */ - if (i !== wordlist.getWordIndex(word)) { - return "0x"; - } - words.push(word); - } - return id(words.join("\n") + "\n"); - } -} - -// Use the encode-latin.js script to create the necessary -// data files to be consumed by this class -/** - * An OWL format Wordlist is an encoding method that exploits - * the general locality of alphabetically sorted words to - * achieve a simple but effective means of compression. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on ASCII-7 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ -class WordlistOwl extends Wordlist { - #data; - #checksum; - /** - * Creates a new Wordlist for %%locale%% using the OWL %%data%% - * and validated against the %%checksum%%. - */ - constructor(locale, data, checksum) { - super(locale); - this.#data = data; - this.#checksum = checksum; - this.#words = null; - } - get _data() { - return this.#data; - } - _decodeWords() { - return decodeOwl(this.#data); - } - #words; - #loadWords() { - if (this.#words == null) { - const words = this._decodeWords(); - // Verify the computed list matches the official list - const checksum = id(words.join("\n") + "\n", true); - /* c8 ignore start */ - if (checksum !== this.#checksum) { - throw new Error(`BIP39 Wordlist for ${this.locale} FffffAILED`); - } - /* c8 ignore stop */ - this.#words = words; - } - return this.#words; - } - getWord(index) { - const words = this.#loadWords(); - assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); - return words[index]; - } - getWordIndex(word) { - return this.#loadWords().indexOf(word); - } -} - -const words$4 = "0itatkastcenaovo$taouleraeki&chor*teci%enbalodaeladet'!Chn=0Di#%E%^1Resa2Rese3CeT'#0EjKohol0Pu)%0A&sDul#Ekdo)Ke)Ti#Ul|3}aOgan%0FaltI$@tPi,%TmaTronom0LasL{i#Ol0Tobus4Yl:B#}R'?TaUb_U/!U^U+Ur!Xer2A^v#Ambo,An#AtrEp)Ike)KoLohOnzOskevUn{#Usin#Z^Zy2Bl.Bn|})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Yk"; -const checksum$4 = "0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a"; -let wordlist$6 = null; -/** - * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -class LangCz extends WordlistOwl { - /** - * Creates a new instance of the Czech language Wordlist. - * - * Using the constructor should be unnecessary, instead use the - * [[wordlist]] singleton method. - * - * @_ignore: - */ - constructor() { - super("cz", words$4, checksum$4); - } - /** - * Returns a singleton instance of a ``LangCz``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist$6 == null) { - wordlist$6 = new LangCz(); - } - return wordlist$6; - } -} - -const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; -/** - * @_ignore - */ -function decodeBits(width, data) { - const maxValue = (1 << width) - 1; - const result = []; - let accum = 0, bits = 0, flood = 0; - for (let i = 0; i < data.length; i++) { - // Accumulate 6 bits of data - accum = (accum << 6) | Base64.indexOf(data[i]); - bits += 6; - // While we have enough for a word... - while (bits >= width) { - // ...read the word - const value = accum >> (bits - width); - accum &= (1 << (bits - width)) - 1; - bits -= width; - // A value of 0 indicates we exceeded maxValue, it - // floods over into the next value - if (value === 0) { - flood += maxValue; - } - else { - result.push(value + flood); - flood = 0; - } - } - } - return result; -} - -/** - * @_ignore - */ -function decodeOwlA(data, accents) { - let words = decodeOwl(data).join(","); - // Inject the accents - accents.split(/,/g).forEach((accent) => { - const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); - assertArgument(match !== null, "internal error parsing accents", "accents", accents); - let posOffset = 0; - const positions = decodeBits(parseInt(match[3]), match[4]); - const charCode = parseInt(match[2]); - const regex = new RegExp(`([${match[1]}])`, "g"); - words = words.replace(regex, (all, letter) => { - const rem = --positions[posOffset]; - if (rem === 0) { - letter = String.fromCharCode(letter.charCodeAt(0), charCode); - posOffset++; - } - return letter; - }); - }); - return words.split(","); -} - -/** - * An OWL-A format Wordlist extends the OWL format to add an - * overlay onto an OWL format Wordlist to support diacritic - * marks. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on latin-1 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ -class WordlistOwlA extends WordlistOwl { - #accent; - constructor(locale, data, accent, checksum) { - super(locale, data, checksum); - this.#accent = accent; - } - get _accent() { - return this.#accent; - } - _decodeWords() { - return decodeOwlA(this._data, this._accent); - } -} - -const words$3 = "0arertoiotadonoaRteirroenaNonaLsolocoiliaralaorrenadaChoN$n0A>Dom,EjaI!#Oga&O'Or#RazoR*Ue=U<0Ab Adem@CeLe%OmoRa!RozUn0DazD$GeLaM,#S,)T^0AlAnceA+EEl]`E`EstruzI.I<2ErU{U'0Af[nArO)Uc Uf_Ul:BaB^|eH@IleJ Lanz/c.LdeMbuN>Nd-oRb(>RnizR+Scu]S#nSu[Tal]T!@T*Tu%UlZ 3BeBid/=S SoSt@3|oEnNgo2An>OqueUsa2ABi`BoCaCi`DaDegaIn//!oLsaMb-{dNi#N}saiRdeRr SqueTeTinVe{Zal2AvoAzoEchaEveIl=In>IsaOcaOmaOnceO)UjaUs>U#2CeoCleE'EyFan{F.HoIt_L#Rbuj(l(+Sc TacaZ.:Bal=BezaBi`B[CaoDav!D,aErFeI{ImanJaJ.LLam Lc$L&Li{dLleLm/^LvoMaMb$Mel=Mi'Mp}c!Nd?Nel-gu+Nic-#N-.ObaOsPazPi%nPo)Pt Puch((b.RcelRe%Rg(i'RneRpe%R+R%SaS>S!oSpaS#rT^ceT_U{lUsaZo3Bol]D!D+Ld/eb_LoAmpuAnc]ApaAr]I>Is)IvoOqueOzaUle%Up 0Cl.EgoE=EnEr#F[G +M->NeN%P_sR>Rue]SneTaU{d2Am^AnA+AseAveI,)ImaInica2B_Cc~|i'Ci`CoDigoDoF_G!He)JinJoL/ch/eg$Lg Lin/l LmoLum`Mba)M!Mi{Mo&Mpr-deNej}g-oc!Nsej}t PaPi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=DoE[EveEzLoM!oTr@:Sis0EC~E[In On!T TicaUes#1Ac~A&rAlBi%CaD,EjaGa'G@Gul=I,)Ig,Il]OQues%Uga0Ad@Cu+Ez'OT[0O'Ro1EjaU=1I&Ige'0En)0O':C#D_El]Gi`GoIsJ oLabr/>Le%Li&Lm/om/p NNalNi>Nt!-ue=PaPelP?]Que)R Rcel(edR*RoRpa&RqueR[foR)S SeoS~SoS%TaT$Tr@UsaU%VoYa<3A#nCa&C!a|oDalD*G IneL L{'Le/ig+LlejoLoLuc--s N.OnOrPi'Que'R(ch(d!Rez(f?Ri>Rl(mizEgun%Em$EnsaE|!oD^Eb=Er%Es#Lg/*Lm.LpoLrNd*N%P #Pet*PoN{PaP!oSaScaSt+T 5BiB^DoE{G*I&In/e%LoMboM^Ptu[TaTi`:Ba&B!B$BleC GazG[&L/&L!oL*Lm.L.Ls/#LudLv Mb-c~Ndi-e Ng_Ni{dN}#PoQueRdin()nSt_TanU`Xof.3Cc~CoC_#C%DGu*IsL=LvaMa`M?l-d-Re'Rg*S#T?:Ba>BiqueB]BuCoC#JoL L>L,#Ll/.Ma'Mb^Ng}quePaPe)P@P.Qu?l(deRe(if(je%RotR+R%TuajeU+ZaZ.3At+|oC]CnicaJa&J!Ji&L/efo'MaM^Mp=NazNd!N!NisNRmi'Rnur(+rSisSo+StigoT!aX#Z3B$Bu+nEmpoEn{Er[EPoR(.TanT!eTu=Za5Al]B?=C Ci'DoG/&M N}#P PeQueRaxR!oRm,%RneoRoRpe&R_RS!Xi>2AbajoAc#rA!Afi>AgoAjeAmoAnceA#AumaAz EbolEguaEin%EnEp EsIbuIgoIpaIs)IunfoOfeoOmpaOn>OpaO)OzoU>Ue'Ufa2B!@BoEr#MbaM^NelNic(bin(ismoR'T^:0Ic 9C!a0B[l0I{dIrIv! b) { - return 1; - } - return 0; - } - // Load all the words - for (let length = 3; length <= 9; length++) { - const d = data$2[length - 3]; - for (let offset = 0; offset < d.length; offset += length) { - const word = []; - for (let i = 0; i < length; i++) { - const k = mapping.indexOf(d[offset + i]); - word.push(227); - word.push(k & 0x40 ? 130 : 129); - word.push((k & 0x3f) + 128); - } - wordlist.push(toString(word)); - } - } - wordlist.sort(sortJapanese); - // For some reason kyoku and kiyoku are flipped in node (!!). - // The order SHOULD be: - // - kyoku - // - kiyoku - // This should ignore "if", but that doesn't work here?? - /* c8 ignore start */ - if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) { - const tmp = wordlist[442]; - wordlist[442] = wordlist[443]; - wordlist[443] = tmp; - } - /* c8 ignore stop */ - // Verify the computed list matches the official list - /* istanbul ignore if */ - const checksum = id(wordlist.join("\n") + "\n"); - /* c8 ignore start */ - if (checksum !== - "0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600") { - throw new Error("BIP39 Wordlist for ja (Japanese) FAILED"); - } - /* c8 ignore stop */ - _wordlist$2 = wordlist; - return wordlist; -} -let wordlist$3 = null; -/** - * The [[link-bip39-ja]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -class LangJa extends Wordlist { - /** - * Creates a new instance of the Japanese language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langJa]] should suffice. - * - * @_ignore: - */ - constructor() { - super("ja"); - } - getWord(index) { - const words = loadWords$2(); - assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); - return words[index]; - } - getWordIndex(word) { - return loadWords$2().indexOf(word); - } - split(phrase) { - //logger.assertNormalize(); - return phrase.split(/(?:\u3000| )+/g); - } - join(words) { - return words.join("\u3000"); - } - /** - * Returns a singleton instance of a ``LangJa``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist$3 == null) { - wordlist$3 = new LangJa(); - } - return wordlist$3; - } -} - -const data$1 = [ - "OYAa", - "ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT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8LgvITvATrJUoJUoLZrRnvJU8HT8Jb8JXvFX8QT8JXvLToJTrJYrQnGnQXJgrJnoATrJnoJU8ScvJnvMnvMXoLTCTLgrJXLTJlRTvQlLbRnJlQYvLbrMb8LnvLbvFn3RnoLdCVSTGZrLeSTvGXCnLg3MnoLn3MToLlrETvMT8SToAl3MbrDU6GTvMb8LX4LhrPlrLXGXCnSToLf8Rg3STrDb8LTrSTvLTHXMnSb3RYLnMnSgOg6ATFg", - "HUDlGnrQXrJTrHgLnrAcJYMb8DULc8LTvFgGnCk3Mg8JbAnLX4QYvFYHnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb", - "AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl", -]; -const codes$1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; -function getHangul(code) { - if (code >= 40) { - code = code + 168 - 40; - } - else if (code >= 19) { - code = code + 97 - 19; - } - return toUtf8String(new Uint8Array([225, (code >> 6) + 132, (code & 0x3f) + 128])); -} -let _wordlist$1 = null; -function loadWords$1() { - if (_wordlist$1 != null) { - return _wordlist$1; - } - const wordlist = []; - data$1.forEach((data, length) => { - length += 4; - for (let i = 0; i < data.length; i += length) { - let word = ""; - for (let j = 0; j < length; j++) { - word += getHangul(codes$1.indexOf(data[i + j])); - } - wordlist.push(word); - } - }); - wordlist.sort(); - // Verify the computed list matches the official list - /* istanbul ignore if */ - const checksum = id(wordlist.join("\n") + "\n"); - /* c8 ignore start */ - if (checksum !== - "0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a") { - throw new Error("BIP39 Wordlist for ko (Korean) FAILED"); - } - /* c8 ignore stop */ - _wordlist$1 = wordlist; - return wordlist; -} -let wordlist$2 = null; -/** - * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -class LangKo extends Wordlist { - /** - * Creates a new instance of the Korean language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langKo]] should suffice. - * - * @_ignore: - */ - constructor() { - super("ko"); - } - getWord(index) { - const words = loadWords$1(); - assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); - return words[index]; - } - getWordIndex(word) { - return loadWords$1().indexOf(word); - } - /** - * Returns a singleton instance of a ``LangKo``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist$2 == null) { - wordlist$2 = new LangKo(); - } - return wordlist$2; - } -} - -const words$1 = "0torea noica!iosorolotaleratelanena%oiadoencotivomai t ca%a0A]Bagl'Bin#E.Is(Oli!Rasi_Rog#0Cade!C[$Cus#E Roba+U 0Ag'Deb{DomeEgu#Eri!IpeOtt&Ul&1Fabi,Fe|Fis(F-n Oris`O(R~$0AveEn.E_,Ganc'I!It&OnismoR>*Rume Uzzo4AbardaA Bat)Ber#BoBumeCeCol>E|Ertu-OdePari!Pe^ Pogg'P)@Pun Ri,1Ab~AchideAgos+Ald~Anc'Atu-AzzoBit)Chiv'D{Eni,G[ GiSoTef%eZil*0Ciu|Col EpsiEtt>Fal I$O/Pir#P)Sagg'SeSolu Sur@TaT[u T%eT-|0Av>EismoOm>O$TesaTiv&Tor$Tr{Tua,0Sil'Str?Tis+To$moTun$0Anz#E!V[i!Vi(Volge!3IoS(Tos+Ttu U,VaVosa3C]FfaLg'LvaNdaNe_,Nig$Nzi=ReRli=Ta3Bi+CiDoR@S]Tan>T^$Zzo*2Acc'AdipoA`An}Avu-E.l/Eve|EzzaIgl?Il/n.Ind&Oc]*O@Onzi=Ul*U$2BboT+di$UffoVet+Vi,2Ass>In~O)2C]Dar@D%eE!n.G$meLl&Lm#Lo!Lpo(L^v#LzaMaMe+M`n@Mo@Mpu.rMuS+n.Ttu-V#2A.!Avat+E#Ede!Emo(Esci+E+Ice I=,IsiIt>OceO=}Os++Uc?,Us}2Ci!Cu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IppoI)ppoI_*Ler&Odel/Olp{Ompar Onfor Opri!Or+Os(Mul#Nfon?Ngo*Nist)NoN.siNu(idePar'S`S ,Tu#2It+Ogatu-Ove$0Arr{Emor#En^ E-l@IlzoOnt&Ott#Uss#0Elli!Erv#O@0BbalzoBr'C]r(C?,Da,Ffi|G$Ld#L[M`NdaNe|Nnife)Pi!Ppe(P-Rge!Rpas(Rri(R(R.gg'R_l#Spi)S+T^,0AdaAl/Arge!A /Av[ Azzo/EcieEdi!EgRappoReg#Ridu*Rozz&Ru|Ucc&UfoUp[@0B[t)C](Do!Gger{GoL+$On&PerboPpor Rgel#R)g#Ssur)Tu-0Ag&EdeseEgl'El&Enu Ez?IluppoIs+Izze-Ol+Uot&:Bac]Bul#Cci&Citur$LeLis`$MpoVer=Vo/+Zza3CaCn>Lefo$Me-r'MpoMu N@Pog-foRagg'RoTan'To*Tuban.Z'Zzo<5Cc&L,r&L Mbo/MoNfoNsil/Paz'Po*g?PpaRbaRn&R)L,t+Lo)(Lut&L_/Mpa+Ng&N{(NoN+gg'Nve-Po!Ra$Rc#R?n.S}3Det+DovaDu Ge+,I]*Lc)Li=Llu LoceN#Ndemm?N RaceRba,Rgog=Rif~RoRru}Rt~,Sc~Ssil*S+,Te-$Tri=Tus 3Andan.B-n.C[daChingoCi=nzaDim&Gil?G< Go!LeL/$MiniNc{!O/Pe-Rgo/Ro*goRu,n S](S'5Cche)Fo*LuPpa"; -const checksum$1 = "0x5c1362d88fd4cf614a96f3234941d29f7d37c08c5292fde03bf62c2db6ff7620"; -let wordlist$1 = null; -/** - * The [[link-bip39-it]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -class LangIt extends WordlistOwl { - /** - * Creates a new instance of the Italian language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langIt]] should suffice. - * - * @_ignore: - */ - constructor() { - super("it", words$1, checksum$1); - } - /** - * Returns a singleton instance of a ``LangIt``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist$1 == null) { - wordlist$1 = new LangIt(); - } - return wordlist$1; - } -} - -const words = "0arad!ototealirertainrasoent hoandoaR#riareha!aroele'oronul0Aca%AixoAl A%rDuz'El]Er$IsmoO$ Rum S-&T(i&TigoVo[=0F&.Il#P' S?S* So&/Sun$Tr&0Ac#Adu+Al/A[f E End(Er_EuIng'Ir?IvoOl{oRac Revi=RizU&Um0Di$rM-.R>o+TismoT|@Tu 0Ali An%Ar@Ent&Es,I?Is Ul,1Ila1Ar E=Ei%Ulejo:B BosaC&]uCh `C@GagemI+c>~/Se#S)n%Ta)Te=rTidaTomTuc Unil]3B(IjoIr^IsebolLd!eLezaLgaLisc Ndi$Ng&aNz(RimbauRl*d>_Sou_XigaZ(_3CoCu=En&Foc&Furc G|naLhe%Mest[Mo$rOlog@OmboOsf(aPol Rr-$Scoi$Sne$SpoSsex$TolaZ _2Ind#OcoOque 2A$BagemC#CejoChec]Ico.L^LetimL]LoMb{oNdeNecoNi)Rb~h>d>e&R+c]V*oXe?2AncoAsaAvezaEuIgaIl/Inc OaOchu+Onze O$Uxo2C]DismoF LeRacoScaS$Z*a:Bimb Rn{oRpe%R['>)zRv&/SacoScaSeb[S%loS~oT a)Tiv UleUs?U%l V&oV(na3BolaDil]G}]Lebr L~ Nou+N,N%ioRc Rr#R%'oRvejaTimV^2Aco)Al{aAm#Ap^ArmeAticeAveEfeEg^E'oEqueIco%If[In`oOc&/Ov(UmboU.Uva0CatrizCl}eD!eD['aEn%Gcui$Rurg@T 2A[zaE_Ic OneUbe2A=Ag'Ba@B($rBr C^El/Ent_E,Gum`oIb'IfaIo%L L{aLh(Lid'Lme@L}oLunaM<=Mb* M-.MitivaMov(MplexoMumNc]N=rNec.Nfu,Ng` Nhec(Njug Nsum'Nt+$Nvi%Op( P{oPi?PoQue%lRagemRdi&Rne)R}h>p|&R[ioR%joRuj>voSs-oS%laT}e%U_UveVilZ*]2A%+AvoEcheE=rEmeErEspoI^Im*&Io~oIseItic Os)UaUz{o2B+m SafioS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aIm Lef}eLh#Mp(oN-%N,rN.Rm&RnoRr-oSeSou+St#ToXtu+Xugo3A+G`aJoloMbr MidezNgi=N%'oRagemT~ 5Al]C]L( LiceM^Mil/N`Ntu+Pe%R>ci=RneioRqueRr!>$S.UcaUp{aX*a2Ab&/Acej Adu$rAfeg Aje$AmaAnc ApoAs{oAt?Av E*oEm(Epid EvoIagemIboIcicloId-%Ilog@Ind!eIploItur Iunf&Oc Ombe)OvaUnfoUque2B~ CquesaT` T|i&:7V 3Bigo0HaId!eIf|me3Olog@SoTigaUbu0A=InaUfru':C*aDi G o,I=,LaL-%Lid!eLo[sN)gemQu{oRe)Rr(Sc~ Sil]S,u+Z Zio3A=D Ge.Ic~ L{oLhiceLu=Nce=rNdav&N( Nt[Rb&Rd!eRe?Rg}h>m`/RnizRs R%n%SpaSti=T|i&3Adu$AgemAj Atu+Br?D{aDr @ElaGaG-%Gi G| L ejoNcoNhe)NilOle)R!>tudeSi.S$Tr&V{oZ*/5A=rArG&L<%LeibolL)gemLumo,Nt!e5L$Vuz`a::D[zRope3QueRe.Rife3Ng ::Ng#Rp 3BuL?9Mb Olog@5Mbi="; -const checksum = "0x2219000926df7b50d8aa0a3d495826b988287df4657fbd100e6fe596c8f737ac"; -let wordlist = null; -/** - * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -class LangPt extends WordlistOwl { - /** - * Creates a new instance of the Portuguese language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langPt]] should suffice. - * - * @_ignore: - */ - constructor() { - super("pt", words, checksum); - } - /** - * Returns a singleton instance of a ``LangPt``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist == null) { - wordlist = new LangPt(); - } - return wordlist; - } -} - -const data = "}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN> 2), - 128 + codes.indexOf(data[i * 3 + 1]), - 128 + codes.indexOf(data[i * 3 + 2]), - ]; - if (locale === "zh_tw") { - const common = s % 4; - for (let i = common; i < 3; i++) { - bytes[i] = - codes.indexOf(deltaData[deltaOffset++]) + (i == 0 ? 228 : 128); - } - } - wordlist.push(toUtf8String(new Uint8Array(bytes))); - } - // Verify the computed list matches the official list - const checksum = id(wordlist.join("\n") + "\n"); - /* c8 ignore start */ - if (checksum !== Checks[locale]) { - throw new Error(`BIP39 Wordlist for ${locale} (Chinese) FAILED`); - } - /* c8 ignore stop */ - _wordlist[locale] = wordlist; - return wordlist; -} -const wordlists = {}; -/** - * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for - * [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -class LangZh extends Wordlist { - /** - * Creates a new instance of the Chinese language Wordlist for - * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified - * or traditional, respectively. - * - * This should be unnecessary most of the time as the exported - * [[langZhCn]] and [[langZhTw]] should suffice. - * - * @_ignore: - */ - constructor(dialect) { - super("zh_" + dialect); - } - getWord(index) { - const words = loadWords(this.locale); - assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); - return words[index]; - } - getWordIndex(word) { - return loadWords(this.locale).indexOf(word); - } - split(phrase) { - phrase = phrase.replace(/(?:\u3000| )+/g, ""); - return phrase.split(""); - } - /** - * Returns a singleton instance of a ``LangZh`` for %%dialect%%, - * creating it if this is the first time being called. - * - * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or - * traditional, respectively. - */ - static wordlist(dialect) { - if (wordlists[dialect] == null) { - wordlists[dialect] = new LangZh(dialect); - } - return wordlists[dialect]; - } -} - -export { LangCz, LangEs, LangFr, LangIt, LangJa, LangKo, LangPt, LangZh }; -//# sourceMappingURL=wordlists-extra.js.map diff --git a/dist/wordlists-extra.js.map b/dist/wordlists-extra.js.map deleted file mode 100644 index 4bc424516..000000000 --- a/dist/wordlists-extra.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists-extra.js","sources":["../node_modules/@noble/hashes/esm/_assert.js","../node_modules/@noble/hashes/esm/_u64.js","../node_modules/@noble/hashes/esm/utils.js","../node_modules/@noble/hashes/esm/sha3.js","../lib.esm/logger/logger.js","../lib.esm/_version.js","../lib.esm/utils/properties.js","../lib.esm/utils/errors.js","../lib.esm/utils/data.js","../lib.esm/utils/utf8.js","../lib.esm/crypto/keccak.js","../node_modules/@noble/hashes/esm/_sha2.js","../node_modules/@noble/hashes/esm/sha256.js","../node_modules/@noble/hashes/esm/sha512.js","../lib.esm/crypto/crypto-browser.js","../lib.esm/crypto/sha3.js","../lib.esm/hash/id.js","../lib.esm/wordlists/decode-owl.js","../lib.esm/wordlists/wordlist.js","../lib.esm/wordlists/wordlist-owl.js","../lib.esm/wordlists/lang-cz.js","../lib.esm/wordlists/bit-reader.js","../lib.esm/wordlists/decode-owla.js","../lib.esm/wordlists/wordlist-owla.js","../lib.esm/wordlists/lang-es.js","../lib.esm/wordlists/lang-fr.js","../lib.esm/wordlists/lang-ja.js","../lib.esm/wordlists/lang-ko.js","../lib.esm/wordlists/lang-it.js","../lib.esm/wordlists/lang-pt.js","../lib.esm/wordlists/lang-zh.js"],"sourcesContent":["function number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`Wrong positive integer: ${n}`);\n}\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`Expected boolean, not ${b}`);\n}\nfunction bytes(b, ...lengths) {\n if (!(b instanceof Uint8Array))\n throw new Error('Expected Uint8Array');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\nexport { number, bool, bytes, hash, exists, output };\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n//# sourceMappingURL=_assert.js.map","const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nconst rotr32L = (h, _l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add, add3L, add3H, add4L, add4H, add5H, add5L, };\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n//# sourceMappingURL=_u64.js.map","/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated, we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\nconst u8a = (a) => a instanceof Uint8Array;\n// Cast array to different type\nexport const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n// Cast array to view\nexport const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\n// big-endian hardware is rare. Just in case someone still decides to run hashes:\n// early-throw an error because we don't support BE yet.\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!isLE)\n throw new Error('Non little-endian hardware is not supported');\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n if (!u8a(data))\n throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\n// For runtime check if class implements interface\nexport class Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\nconst toStr = {}.toString;\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nexport function wrapConstructor(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nexport function wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nexport function wrapXOFConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32) {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map","import { bytes, exists, number, output } from './_assert.js';\nimport { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.js';\nimport { Hash, u32, toBytes, wrapConstructor, wrapXOFConstructorWithOpts, } from './utils.js';\n// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.\n// It's called a sponge function.\n// Various per round constants calculations\nconst [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nconst _2n = /* @__PURE__ */ BigInt(2);\nconst _7n = /* @__PURE__ */ BigInt(7);\nconst _256n = /* @__PURE__ */ BigInt(256);\nconst _0x71n = /* @__PURE__ */ BigInt(0x71);\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n)\n t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n// Same as keccakf1600, but allows to skip some rounds\nexport function keccakP(s, rounds = 24) {\n const B = new Uint32Array(5 * 2);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++)\n B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n for (let x = 0; x < 10; x += 2) {\n const idx1 = (x + 8) % 10;\n const idx0 = (x + 2) % 10;\n const B0 = B[idx0];\n const B1 = B[idx0 + 1];\n const Th = rotlH(B0, B1, 1) ^ B[idx1];\n const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n for (let y = 0; y < 50; y += 10) {\n s[x + y] ^= Th;\n s[x + y + 1] ^= Tl;\n }\n }\n // Rho (ρ) and Pi (π)\n let curH = s[2];\n let curL = s[3];\n for (let t = 0; t < 24; t++) {\n const shift = SHA3_ROTL[t];\n const Th = rotlH(curH, curL, shift);\n const Tl = rotlL(curH, curL, shift);\n const PI = SHA3_PI[t];\n curH = s[PI];\n curL = s[PI + 1];\n s[PI] = Th;\n s[PI + 1] = Tl;\n }\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n for (let x = 0; x < 10; x++)\n B[x] = s[y + x];\n for (let x = 0; x < 10; x++)\n s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n B.fill(0);\n}\nexport class Keccak extends Hash {\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n super();\n this.blockLen = blockLen;\n this.suffix = suffix;\n this.outputLen = outputLen;\n this.enableXOF = enableXOF;\n this.rounds = rounds;\n this.pos = 0;\n this.posOut = 0;\n this.finished = false;\n this.destroyed = false;\n // Can be passed from user as dkLen\n number(outputLen);\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n if (0 >= this.blockLen || this.blockLen >= 200)\n throw new Error('Sha3 supports only keccak-f1600 function');\n this.state = new Uint8Array(200);\n this.state32 = u32(this.state);\n }\n keccak() {\n keccakP(this.state32, this.rounds);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data) {\n exists(this);\n const { blockLen, state } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++)\n state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen)\n this.keccak();\n }\n return this;\n }\n finish() {\n if (this.finished)\n return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n writeInto(out) {\n exists(this, false);\n bytes(out);\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len;) {\n if (this.posOut >= blockLen)\n this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out) {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF)\n throw new Error('XOF is not possible for this instance');\n return this.writeInto(out);\n }\n xof(bytes) {\n number(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out) {\n output(out, this);\n if (this.finished)\n throw new Error('digest() was already called');\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n this.state.fill(0);\n }\n _cloneInto(to) {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\nconst gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));\nexport const sha3_224 = /* @__PURE__ */ gen(0x06, 144, 224 / 8);\n/**\n * SHA3-256 hash function\n * @param message - that would be hashed\n */\nexport const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8);\nexport const sha3_384 = /* @__PURE__ */ gen(0x06, 104, 384 / 8);\nexport const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);\nexport const keccak_224 = /* @__PURE__ */ gen(0x01, 144, 224 / 8);\n/**\n * keccak-256 hash function. Different from SHA3-256.\n * @param message - that would be hashed\n */\nexport const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);\nexport const keccak_384 = /* @__PURE__ */ gen(0x01, 104, 384 / 8);\nexport const keccak_512 = /* @__PURE__ */ gen(0x01, 72, 512 / 8);\nconst genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));\nexport const shake128 = /* @__PURE__ */ genShake(0x1f, 168, 128 / 8);\nexport const shake256 = /* @__PURE__ */ genShake(0x1f, 136, 256 / 8);\n//# sourceMappingURL=sha3.js.map","\"use strict\";\nlet _permanentCensorErrors = false;\nlet _censorErrors = false;\nconst LogLevels = {\n debug: 1,\n default: 2,\n info: 2,\n warning: 3,\n error: 4,\n off: 5,\n};\nlet _logLevel = LogLevels[\"default\"];\nlet _globalLogger = null;\nfunction _checkNormalize() {\n try {\n const missing = [];\n // Make sure all forms of normalization are supported\n [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].forEach((form) => {\n try {\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad normalize\");\n }\n }\n catch (error) {\n missing.push(form);\n }\n });\n if (missing.length) {\n throw new Error(\"missing \" + missing.join(\", \"));\n }\n if (String.fromCharCode(0xe9).normalize(\"NFD\") !==\n String.fromCharCode(0x65, 0x0301)) {\n throw new Error(\"broken implementation\");\n }\n }\n catch (error) {\n return error.message;\n }\n return null;\n}\nconst _normalizeError = _checkNormalize();\nexport var LogLevel;\n(function (LogLevel) {\n LogLevel[\"DEBUG\"] = \"DEBUG\";\n LogLevel[\"INFO\"] = \"INFO\";\n LogLevel[\"WARNING\"] = \"WARNING\";\n LogLevel[\"ERROR\"] = \"ERROR\";\n LogLevel[\"OFF\"] = \"OFF\";\n})(LogLevel || (LogLevel = {}));\nexport var ErrorCode;\n(function (ErrorCode) {\n ///////////////////\n // Generic Errors\n // Unknown Error\n ErrorCode[\"UNKNOWN_ERROR\"] = \"UNKNOWN_ERROR\";\n // Not Implemented\n ErrorCode[\"NOT_IMPLEMENTED\"] = \"NOT_IMPLEMENTED\";\n // Unsupported Operation\n // - operation\n ErrorCode[\"UNSUPPORTED_OPERATION\"] = \"UNSUPPORTED_OPERATION\";\n // Network Error (i.e. Core Network, such as an invalid network ID)\n // - event (\"noNetwork\" is not re-thrown in provider.ready; otherwise thrown)\n ErrorCode[\"NETWORK_ERROR\"] = \"NETWORK_ERROR\";\n // Some sort of bad response from the server\n ErrorCode[\"SERVER_ERROR\"] = \"SERVER_ERROR\";\n // Timeout\n ErrorCode[\"TIMEOUT\"] = \"TIMEOUT\";\n ///////////////////\n // Operational Errors\n // Buffer Overrun\n ErrorCode[\"BUFFER_OVERRUN\"] = \"BUFFER_OVERRUN\";\n // Numeric Fault\n // - operation: the operation being executed\n // - fault: the reason this faulted\n ErrorCode[\"NUMERIC_FAULT\"] = \"NUMERIC_FAULT\";\n ///////////////////\n // Argument Errors\n // Missing new operator to an object\n // - name: The name of the class\n ErrorCode[\"MISSING_NEW\"] = \"MISSING_NEW\";\n // Invalid argument (e.g. value is incompatible with type) to a function:\n // - argument: The argument name that was invalid\n // - value: The value of the argument\n ErrorCode[\"INVALID_ARGUMENT\"] = \"INVALID_ARGUMENT\";\n // Missing argument to a function:\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"MISSING_ARGUMENT\"] = \"MISSING_ARGUMENT\";\n // Too many arguments\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"UNEXPECTED_ARGUMENT\"] = \"UNEXPECTED_ARGUMENT\";\n ///////////////////\n // Blockchain Errors\n // Call exception\n // - transaction: the transaction\n // - address?: the contract address\n // - args?: The arguments passed into the function\n // - method?: The Solidity method signature\n // - errorSignature?: The EIP848 error signature\n // - errorArgs?: The EIP848 error parameters\n // - reason: The reason (only for EIP848 \"Error(string)\")\n ErrorCode[\"CALL_EXCEPTION\"] = \"CALL_EXCEPTION\";\n // Insufficient funds (< value + energyLimit * energyPrice)\n // - transaction: the transaction attempted\n ErrorCode[\"INSUFFICIENT_FUNDS\"] = \"INSUFFICIENT_FUNDS\";\n // Nonce has already been used\n // - transaction: the transaction attempted\n ErrorCode[\"NONCE_EXPIRED\"] = \"NONCE_EXPIRED\";\n // The replacement fee for the transaction is too low\n // - transaction: the transaction attempted\n ErrorCode[\"REPLACEMENT_UNDERPRICED\"] = \"REPLACEMENT_UNDERPRICED\";\n // The energy limit could not be estimated\n // - transaction: the transaction passed to estimateEnergy\n ErrorCode[\"UNPREDICTABLE_ENERGY_LIMIT\"] = \"UNPREDICTABLE_ENERGY_LIMIT\";\n // The transaction was replaced by one with a higher energy price\n // - reason: \"cancelled\", \"replaced\" or \"repriced\"\n // - cancelled: true if reason == \"cancelled\" or reason == \"replaced\")\n // - hash: original transaction hash\n // - replacement: the full TransactionsResponse for the replacement\n // - receipt: the receipt of the replacement\n ErrorCode[\"TRANSACTION_REPLACED\"] = \"TRANSACTION_REPLACED\";\n})(ErrorCode || (ErrorCode = {}));\nconst HEX = \"0123456789abcdef\";\nexport class Logger {\n version = \"0.0.1\";\n static errors = ErrorCode;\n static levels = LogLevel;\n constructor(version) {\n Object.defineProperty(this, \"version\", {\n enumerable: true,\n value: version,\n writable: false,\n });\n }\n _log(logLevel, args) {\n const level = logLevel.toLowerCase();\n if (LogLevels[level] == null) {\n this.throwArgumentError(\"invalid log level name\", \"logLevel\", logLevel);\n }\n if (_logLevel > LogLevels[level]) {\n return;\n }\n console.log.apply(console, args);\n }\n debug(...args) {\n this._log(Logger.levels.DEBUG, args);\n }\n info(...args) {\n this._log(Logger.levels.INFO, args);\n }\n warn(...args) {\n this._log(Logger.levels.WARNING, args);\n }\n makeError(message, code, params) {\n // Errors are being censored\n if (_censorErrors) {\n return this.makeError(\"censored error\", code, {});\n }\n if (!code) {\n code = Logger.errors.UNKNOWN_ERROR;\n }\n if (!params) {\n params = {};\n }\n const messageDetails = [];\n Object.keys(params).forEach((key) => {\n const value = params[key];\n try {\n if (value instanceof Uint8Array) {\n let hex = \"\";\n for (let i = 0; i < value.length; i++) {\n hex += HEX[value[i] >> 4];\n hex += HEX[value[i] & 0x0f];\n }\n messageDetails.push(key + \"=Uint8Array(0x\" + hex + \")\");\n }\n else {\n messageDetails.push(key + \"=\" + JSON.stringify(value));\n }\n }\n catch (error) {\n messageDetails.push(key + \"=\" + JSON.stringify(params[key].toString()));\n }\n });\n messageDetails.push(`code=${code}`);\n messageDetails.push(`version=${this.version}`);\n const reason = message;\n if (messageDetails.length) {\n message += \" (\" + messageDetails.join(\", \") + \")\";\n }\n // @TODO: Any??\n const error = new Error(message);\n error.reason = reason;\n error.code = code;\n Object.keys(params).forEach(function (key) {\n error[key] = params[key];\n });\n return error;\n }\n throwError(message, code, params) {\n throw this.makeError(message, code, params);\n }\n throwArgumentError(message, name, value) {\n return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {\n argument: name,\n value: value,\n });\n }\n assert(condition, message, code, params) {\n if (!!condition) {\n return;\n }\n this.throwError(message, code, params);\n }\n assertArgument(condition, message, name, value) {\n if (!!condition) {\n return;\n }\n this.throwArgumentError(message, name, value);\n }\n checkNormalize(message) {\n if (message == null) {\n message = \"platform missing String.prototype.normalize\";\n }\n if (_normalizeError) {\n this.throwError(\"platform missing String.prototype.normalize\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"String.prototype.normalize\",\n form: _normalizeError,\n });\n }\n }\n checkSafeUint53(value, message) {\n if (typeof value !== \"number\") {\n return;\n }\n if (message == null) {\n message = \"value not safe\";\n }\n if (value < 0 || value >= 0x1fffffffffffff) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"out-of-safe-range\",\n value: value,\n });\n }\n if (value % 1) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"non-integer\",\n value: value,\n });\n }\n }\n checkArgumentCount(count, expectedCount, message) {\n if (message) {\n message = \": \" + message;\n }\n else {\n message = \"\";\n }\n if (count < expectedCount) {\n this.throwError(\"missing argument\" + message, Logger.errors.MISSING_ARGUMENT, {\n count: count,\n expectedCount: expectedCount,\n });\n }\n if (count > expectedCount) {\n this.throwError(\"too many arguments\" + message, Logger.errors.UNEXPECTED_ARGUMENT, {\n count: count,\n expectedCount: expectedCount,\n });\n }\n }\n checkNew(target, kind) {\n if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, {\n name: kind.name,\n });\n }\n }\n checkAbstract(target, kind) {\n if (target === kind) {\n this.throwError(\"cannot instantiate abstract class \" +\n JSON.stringify(kind.name) +\n \" directly; use a sub-class\", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: \"new\" });\n }\n else if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, {\n name: kind.name,\n });\n }\n }\n static globalLogger() {\n if (!_globalLogger) {\n _globalLogger = new Logger(\"logger/0.0.1\");\n }\n return _globalLogger;\n }\n static setCensorship(censorship, permanent) {\n if (!censorship && permanent) {\n this.globalLogger().throwError(\"cannot permanently disable censorship\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\",\n });\n }\n if (_permanentCensorErrors) {\n if (!censorship) {\n return;\n }\n this.globalLogger().throwError(\"error censorship permanent\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\",\n });\n }\n _censorErrors = !!censorship;\n _permanentCensorErrors = !!permanent;\n }\n static setLogLevel(logLevel) {\n const level = LogLevels[logLevel.toLowerCase()];\n if (level == null) {\n Logger.globalLogger().warn(\"invalid log level - \" + logLevel);\n return;\n }\n _logLevel = level;\n }\n static from(version) {\n return new Logger(version);\n }\n}\n//# sourceMappingURL=logger.js.map","/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */\n/**\n * The current version of corebc.\n */\nexport const version = \"6.4.0\";\n//# sourceMappingURL=_version.js.map","import { Logger } from \"../logger/logger.js\";\n/**\n * Property helper functions.\n *\n * @_subsection api/utils:Properties [about-properties]\n */\nconst logger = new Logger(\"utils/properties/0.0.1\");\nfunction checkType(value, type, name) {\n const types = type.split(\"|\").map((t) => t.trim());\n for (let i = 0; i < types.length; i++) {\n switch (type) {\n case \"any\":\n return;\n case \"bigint\":\n case \"boolean\":\n case \"number\":\n case \"string\":\n if (typeof value === type) {\n return;\n }\n }\n }\n const error = new Error(`invalid value for type ${type}`);\n error.code = \"INVALID_ARGUMENT\";\n error.argument = `value.${name}`;\n error.value = value;\n throw error;\n}\n/**\n * Resolves to a new object that is a copy of %%value%%, but with all\n * values resolved.\n */\nexport async function resolveProperties(value) {\n const keys = Object.keys(value);\n const results = await Promise.all(keys.map((k) => Promise.resolve(value[k])));\n return results.reduce((accum, v, index) => {\n accum[keys[index]] = v;\n return accum;\n }, {});\n}\n/**\n * Assigns the %%values%% to %%target%% as read-only values.\n *\n * It %%types%% is specified, the values are checked.\n */\nexport function defineProperties(target, values, types) {\n for (let key in values) {\n let value = values[key];\n const type = types ? types[key] : null;\n if (type) {\n checkType(value, type, key);\n }\n Object.defineProperty(target, key, {\n enumerable: true,\n value,\n writable: false,\n });\n }\n}\nexport function checkProperties(object, properties) {\n if (!object || typeof object !== \"object\") {\n logger.throwArgumentError(\"invalid object\", \"object\", object);\n }\n Object.keys(object).forEach((key) => {\n if (!properties[key]) {\n logger.throwArgumentError(\"invalid object key - \" + key, \"transaction:\" + key, object);\n }\n });\n}\n//# sourceMappingURL=properties.js.map","/**\n * About Errors.\n *\n * @_section: api/utils/errors:Errors [about-errors]\n */\nimport { version } from \"../_version.js\";\nimport { defineProperties } from \"./properties.js\";\nfunction stringify(value) {\n if (value == null) {\n return \"null\";\n }\n if (Array.isArray(value)) {\n return \"[ \" + value.map(stringify).join(\", \") + \" ]\";\n }\n if (value instanceof Uint8Array) {\n const HEX = \"0123456789abcdef\";\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n result += HEX[value[i] >> 4];\n result += HEX[value[i] & 0xf];\n }\n return result;\n }\n if (typeof value === \"object\" && typeof value.toJSON === \"function\") {\n return stringify(value.toJSON());\n }\n switch (typeof value) {\n case \"boolean\":\n case \"symbol\":\n return value.toString();\n case \"bigint\":\n return BigInt(value).toString();\n case \"number\":\n return value.toString();\n case \"string\":\n return JSON.stringify(value);\n case \"object\": {\n const keys = Object.keys(value);\n keys.sort();\n return (\"{ \" +\n keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(\", \") +\n \" }\");\n }\n }\n return `[ COULD NOT SERIALIZE ]`;\n}\n/**\n * Returns true if the %%error%% matches an error thrown by corebc\n * that matches the error %%code%%.\n *\n * In TypeScript envornoments, this can be used to check that %%error%%\n * matches an corebcError type, which means the expected properties will\n * be set.\n *\n * @See [ErrorCodes](api:ErrorCode)\n * @example\n * try {\n * // code....\n * } catch (e) {\n * if (isError(e, \"CALL_EXCEPTION\")) {\n * // The Type Guard has validated this object\n * console.log(e.data);\n * }\n * }\n */\nexport function isError(error, code) {\n return error && error.code === code;\n}\n/**\n * Returns true if %%error%% is a [[CallExceptionError].\n */\nexport function isCallException(error) {\n return isError(error, \"CALL_EXCEPTION\");\n}\n/**\n * Returns a new Error configured to the format corebc emits errors, with\n * the %%message%%, [[api:ErrorCode]] %%code%% and additioanl properties\n * for the corresponding corebcError.\n *\n * Each error in corebc includes the version of corebc, a\n * machine-readable [[ErrorCode]], and depneding on %%code%%, additional\n * required properties. The error message will also include the %%meeage%%,\n * corebc version, %%code%% and all aditional properties, serialized.\n */\nexport function makeError(message, code, info) {\n {\n const details = [];\n if (info) {\n if (\"message\" in info || \"code\" in info || \"name\" in info) {\n throw new Error(`value will overwrite populated values: ${stringify(info)}`);\n }\n for (const key in info) {\n const value = info[key];\n // try {\n details.push(key + \"=\" + stringify(value));\n // } catch (error: any) {\n // console.log(\"MMM\", error.message);\n // details.push(key + \"=[could not serialize object]\");\n // }\n }\n }\n details.push(`code=${code}`);\n details.push(`version=${version}`);\n if (details.length) {\n message += \" (\" + details.join(\", \") + \")\";\n }\n }\n let error;\n switch (code) {\n case \"INVALID_ARGUMENT\":\n error = new TypeError(message);\n break;\n case \"NUMERIC_FAULT\":\n case \"BUFFER_OVERRUN\":\n error = new RangeError(message);\n break;\n default:\n error = new Error(message);\n }\n defineProperties(error, { code });\n if (info) {\n Object.assign(error, info);\n }\n return error;\n}\n/**\n * Throws an corebcError with %%message%%, %%code%% and additional error\n * %%info%% when %%check%% is falsish..\n *\n * @see [[api:makeError]]\n */\nexport function assert(check, message, code, info) {\n if (!check) {\n throw makeError(message, code, info);\n }\n}\n/**\n * A simple helper to simply ensuring provided arguments match expected\n * constraints, throwing if not.\n *\n * In TypeScript environments, the %%check%% has been asserted true, so\n * any further code does not need additional compile-time checks.\n */\nexport function assertArgument(check, message, name, value) {\n assert(check, message, \"INVALID_ARGUMENT\", { argument: name, value: value });\n}\nexport function assertArgumentCount(count, expectedCount, message) {\n if (message == null) {\n message = \"\";\n }\n if (message) {\n message = \": \" + message;\n }\n assert(count >= expectedCount, \"missing arguemnt\" + message, \"MISSING_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount,\n });\n assert(count <= expectedCount, \"too many arguemnts\" + message, \"UNEXPECTED_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount,\n });\n}\nconst _normalizeForms = [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].reduce((accum, form) => {\n try {\n // General test for normalize\n /* c8 ignore start */\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad\");\n }\n /* c8 ignore stop */\n if (form === \"NFD\") {\n const check = String.fromCharCode(0xe9).normalize(\"NFD\");\n const expected = String.fromCharCode(0x65, 0x0301);\n /* c8 ignore start */\n if (check !== expected) {\n throw new Error(\"broken\");\n }\n /* c8 ignore stop */\n }\n accum.push(form);\n }\n catch (error) { }\n return accum;\n}, []);\n/**\n * Throws if the normalization %%form%% is not supported.\n */\nexport function assertNormalize(form) {\n assert(_normalizeForms.indexOf(form) >= 0, \"platform missing String.prototype.normalize\", \"UNSUPPORTED_OPERATION\", {\n operation: \"String.prototype.normalize\",\n info: { form },\n });\n}\n/**\n * Many classes use file-scoped values to guard the constructor,\n * making it effectively private. This facilitates that pattern\n * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%,\n * throwing if not, indicating the %%className%% if provided.\n */\nexport function assertPrivate(givenGuard, guard, className) {\n if (className == null) {\n className = \"\";\n }\n if (givenGuard !== guard) {\n let method = className, operation = \"new\";\n if (className) {\n method += \".\";\n operation += \" \" + className;\n }\n assert(false, `private constructor; use ${method}from* methods`, \"UNSUPPORTED_OPERATION\", {\n operation,\n });\n }\n}\n//# sourceMappingURL=errors.js.map","/**\n * Some data helpers.\n *\n *\n * @_subsection api/utils:Data Helpers [about-data]\n */\nimport { Logger } from \"../logger/logger.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nconst logger = new Logger(\"utils/data/0.0.1\");\nfunction isHexable(value) {\n return !!value.toHexString;\n}\nfunction isInteger(value) {\n return typeof value === \"number\" && value == value && value % 1 === 0;\n}\nexport function isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof value === \"string\") {\n return false;\n }\n if (!isInteger(value.length) || value.length < 0) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n}\nfunction _getBytes(value, name, copy) {\n if (value instanceof Uint8Array) {\n if (copy) {\n return new Uint8Array(value);\n }\n return value;\n }\n if (typeof value === \"string\" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {\n const result = new Uint8Array((value.length - 2) / 2);\n let offset = 2;\n for (let i = 0; i < result.length; i++) {\n result[i] = parseInt(value.substring(offset, offset + 2), 16);\n offset += 2;\n }\n return result;\n }\n assertArgument(false, \"invalid BytesLike value\", name || \"value\", value);\n}\n/**\n * Get a typed Uint8Array for %%value%%. If already a Uint8Array\n * the original %%value%% is returned; if a copy is required use\n * [[getBytesCopy]].\n *\n * @see: getBytesCopy\n */\nexport function getBytes(value, name) {\n return _getBytes(value, name, false);\n}\n/**\n * Get a typed Uint8Array for %%value%%, creating a copy if necessary\n * to prevent any modifications of the returned value from being\n * reflected elsewhere.\n *\n * @see: getBytes\n */\nexport function getBytesCopy(value, name) {\n return _getBytes(value, name, true);\n}\n/**\n * Returns true if %%value%% is a valid [[HexString]].\n *\n * If %%length%% is ``true`` or a //number//, it also checks that\n * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//)\n * bytes of data (e.g. ``0x1234`` is 2 bytes).\n */\nexport function isHexString(value, length) {\n if (typeof value !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (typeof length === \"number\" && value.length !== 2 + 2 * length) {\n return false;\n }\n if (length === true && value.length % 2 !== 0) {\n return false;\n }\n return true;\n}\n/**\n * Returns true if %%value%% is a valid representation of arbitrary\n * data (i.e. a valid [[DataHexString]] or a Uint8Array).\n */\nexport function isBytesLike(value) {\n return isHexString(value, true) || value instanceof Uint8Array;\n}\nconst HexCharacters = \"0123456789abcdef\";\n/**\n * Returns a [[DataHexString]] representation of %%data%%.\n */\nexport function hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof value === \"string\") {\n if (value.includes(\",\") && value.startsWith(\"0x\")) {\n const v = value\n .replace(\"0x\", \"\")\n .split(\",\")\n .map((item) => Number(item));\n // @ts-ignore\n value = new Uint8Array(v);\n }\n }\n if (typeof value === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (typeof value === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) {\n return \"0x0\" + value;\n }\n return \"0x\" + value;\n }\n if (options.allowMissingPrefix &&\n typeof value === \"string\" &&\n value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/**\n * Returns a [[DataHexString]] by concatenating all values\n * within %%data%%.\n */\nexport function concat(items) {\n return \"0x\" + items.map((d) => hexlify(d).substring(2)).join(\"\");\n}\nexport function hexDataSlice(data, offset, endOffset) {\n if (typeof data !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || data.length % 2) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nexport function hexDataLength(data) {\n if (typeof data !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || data.length % 2) {\n return null;\n }\n return (data.length - 2) / 2;\n}\n/**\n * Returns the length of %%data%%, in bytes.\n */\nexport function dataLength(data) {\n if (isHexString(data, true)) {\n return (data.length - 2) / 2;\n }\n return getBytes(data).length;\n}\n/**\n * Returns a [[DataHexString]] by slicing %%data%% from the %%start%%\n * offset to the %%end%% offset.\n *\n * By default %%start%% is 0 and %%end%% is the length of %%data%%.\n */\nexport function dataSlice(data, start, end) {\n const bytes = getBytes(data);\n if (end != null && end > bytes.length) {\n assert(false, \"cannot slice beyond data bounds\", \"BUFFER_OVERRUN\", {\n buffer: bytes,\n length: bytes.length,\n offset: end,\n });\n }\n return hexlify(bytes.slice(start == null ? 0 : start, end == null ? bytes.length : end));\n}\n/**\n * Return the [[DataHexString]] result by stripping all **leading**\n ** zero bytes from %%data%%.\n */\nexport function stripZerosLeft(data) {\n let bytes = hexlify(data).substring(2);\n while (bytes.startsWith(\"00\")) {\n bytes = bytes.substring(2);\n }\n return \"0x\" + bytes;\n}\nfunction zeroPad(data, length, left) {\n const bytes = getBytes(data);\n assert(length >= bytes.length, \"padding exceeds data length\", \"BUFFER_OVERRUN\", {\n buffer: new Uint8Array(bytes),\n length: length,\n offset: length + 1,\n });\n const result = new Uint8Array(length);\n result.fill(0);\n if (left) {\n result.set(bytes, length - bytes.length);\n }\n else {\n result.set(bytes, 0);\n }\n return hexlify(result);\n}\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **left**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **values** are in Solidity\n * (e.g. ``uint128``).\n */\nexport function zeroPadValue(data, length) {\n return zeroPad(data, length, true);\n}\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **right**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **bytes** are in Solidity\n * (e.g. ``bytes16``).\n */\nexport function zeroPadBytes(data, length) {\n return zeroPad(data, length, false);\n}\nexport function stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nexport function arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof value === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n // @ts-ignore\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix &&\n typeof value === \"string\" &&\n value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0x0\" + hex.substring(2);\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n // @ts-ignore\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nfunction addSlice(array) {\n // @ts-ignore\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nexport function hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\n//# sourceMappingURL=data.js.map","/**\n * Using strings in Core (or any security-basd system) requires\n * additional care. These utilities attempt to mitigate some of the\n * safety issues as well as provide the ability to recover and analyse\n * strings.\n *\n * @_subsection api/utils:Strings and UTF-8 [about-strings]\n */\nimport { getBytes } from \"./data.js\";\nimport { assertArgument, assertNormalize } from \"./errors.js\";\nfunction errorFunc(reason, offset, bytes, output, badCodepoint) {\n assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, \"bytes\", bytes);\n}\nfunction ignoreFunc(reason, offset, bytes, output, badCodepoint) {\n // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes\n if (reason === \"BAD_PREFIX\" || reason === \"UNEXPECTED_CONTINUE\") {\n let i = 0;\n for (let o = offset + 1; o < bytes.length; o++) {\n if (bytes[o] >> 6 !== 0x02) {\n break;\n }\n i++;\n }\n return i;\n }\n // This byte runs us past the end of the string, so just jump to the end\n // (but the first byte was read already read and therefore skipped)\n if (reason === \"OVERRUN\") {\n return bytes.length - offset - 1;\n }\n // Nothing to skip\n return 0;\n}\nfunction replaceFunc(reason, offset, bytes, output, badCodepoint) {\n // Overlong representations are otherwise \"valid\" code points; just non-deistingtished\n if (reason === \"OVERLONG\") {\n assertArgument(typeof badCodepoint === \"number\", \"invalid bad code point for replacement\", \"badCodepoint\", badCodepoint);\n output.push(badCodepoint);\n return 0;\n }\n // Put the replacement character into the output\n output.push(0xfffd);\n // Otherwise, process as if ignoring errors\n return ignoreFunc(reason, offset, bytes, output, badCodepoint);\n}\n/**\n * A handful of popular, built-in UTF-8 error handling strategies.\n *\n * **``\"error\"``** - throws on ANY illegal UTF-8 sequence or\n * non-canonical (overlong) codepoints (this is the default)\n *\n * **``\"ignore\"``** - silently drops any illegal UTF-8 sequence\n * and accepts non-canonical (overlong) codepoints\n *\n * **``\"replace\"``** - replace any illegal UTF-8 sequence with the\n * UTF-8 replacement character (i.e. ``\"\\\\ufffd\"``) and accepts\n * non-canonical (overlong) codepoints\n *\n * @returns: Record<\"error\" | \"ignore\" | \"replace\", Utf8ErrorFunc>\n */\nexport const Utf8ErrorFuncs = Object.freeze({\n error: errorFunc,\n ignore: ignoreFunc,\n replace: replaceFunc,\n});\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction getUtf8CodePoints(_bytes, onError) {\n if (onError == null) {\n onError = Utf8ErrorFuncs.error;\n }\n const bytes = getBytes(_bytes, \"bytes\");\n const result = [];\n let i = 0;\n // Invalid bytes are ignored\n while (i < bytes.length) {\n const c = bytes[i++];\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result.push(c);\n continue;\n }\n // Multibyte; how many bytes left for this character?\n let extraLength = null;\n let overlongMask = null;\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n // 1110 xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n }\n else {\n if ((c & 0xc0) === 0x80) {\n i += onError(\"UNEXPECTED_CONTINUE\", i - 1, bytes, result);\n }\n else {\n i += onError(\"BAD_PREFIX\", i - 1, bytes, result);\n }\n continue;\n }\n // Do we have enough bytes in our data?\n if (i - 1 + extraLength >= bytes.length) {\n i += onError(\"OVERRUN\", i - 1, bytes, result);\n continue;\n }\n // Remove the length prefix from the char\n let res = c & ((1 << (8 - extraLength - 1)) - 1);\n for (let j = 0; j < extraLength; j++) {\n let nextChar = bytes[i];\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n i += onError(\"MISSING_CONTINUE\", i, bytes, result);\n res = null;\n break;\n }\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n // See above loop for invalid continuation byte\n if (res === null) {\n continue;\n }\n // Maximum code point\n if (res > 0x10ffff) {\n i += onError(\"OUT_OF_RANGE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n i += onError(\"UTF16_SURROGATE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Check for overlong sequences (more bytes than needed)\n if (res <= overlongMask) {\n i += onError(\"OVERLONG\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n result.push(res);\n }\n return result;\n}\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\n/**\n * Returns the UTF-8 byte representation of %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8Bytes(str, form) {\n if (form != null) {\n assertNormalize(form);\n str = str.normalize(form);\n }\n let result = [];\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i);\n if (c < 0x80) {\n result.push(c);\n }\n else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n }\n else if ((c & 0xfc00) == 0xd800) {\n i++;\n const c2 = str.charCodeAt(i);\n assertArgument(i < str.length && (c2 & 0xfc00) === 0xdc00, \"invalid surrogate pair\", \"str\", str);\n // Surrogate Pair\n const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((pair >> 18) | 0xf0);\n result.push(((pair >> 12) & 0x3f) | 0x80);\n result.push(((pair >> 6) & 0x3f) | 0x80);\n result.push((pair & 0x3f) | 0x80);\n }\n else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n return new Uint8Array(result);\n}\n//export\nfunction _toUtf8String(codePoints) {\n return codePoints\n .map((codePoint) => {\n if (codePoint <= 0xffff) {\n return String.fromCharCode(codePoint);\n }\n codePoint -= 0x10000;\n return String.fromCharCode(((codePoint >> 10) & 0x3ff) + 0xd800, (codePoint & 0x3ff) + 0xdc00);\n })\n .join(\"\");\n}\n/**\n * Returns the string represented by the UTF-8 data %%bytes%%.\n *\n * When %%onError%% function is specified, it is called on UTF-8\n * errors allowing recovery using the [[Utf8ErrorFunc]] API.\n * (default: [error](Utf8ErrorFuncs))\n */\nexport function toUtf8String(bytes, onError) {\n return _toUtf8String(getUtf8CodePoints(bytes, onError));\n}\n/**\n * Returns the UTF-8 code-points for %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8CodePoints(str, form) {\n return getUtf8CodePoints(toUtf8Bytes(str, form));\n}\n//# sourceMappingURL=utf8.js.map","/**\n * Cryptographic hashing functions\n *\n * @_subsection: api/crypto:Hash Functions [about-crypto-hashing]\n */\nimport { keccak_256 } from \"@noble/hashes/sha3\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _keccak256 = function (data) {\n return keccak_256(data);\n};\nlet __keccak256 = _keccak256;\n/**\n * Compute the cryptographic KECCAK256 hash of %%data%%.\n *\n * The %%data%% **must** be a data representation, to compute the\n * hash of UTF-8 data use the [[id]] function.\n *\n * @returns DataHexstring\n * @example:\n * keccak256(\"0x\")\n * //_result:\n *\n * keccak256(\"0x1337\")\n * //_result:\n *\n * keccak256(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n * // Strings are assumed to be DataHexString, otherwise it will\n * // throw. To hash UTF-8 data, see the note above.\n * keccak256(\"Hello World\")\n * //_error:\n */\nexport function keccak256(_data) {\n const data = getBytes(_data, \"data\");\n return hexlify(__keccak256(data));\n}\nkeccak256._ = _keccak256;\nkeccak256.lock = function () {\n locked = true;\n};\nkeccak256.register = function (func) {\n if (locked) {\n throw new TypeError(\"keccak256 is locked\");\n }\n __keccak256 = func;\n};\nObject.freeze(keccak256);\n//# sourceMappingURL=keccak.js.map","import { exists, output } from './_assert.js';\nimport { Hash, createView, toBytes } from './utils.js';\n// Polyfill for Safari 14\nfunction setBigUint64(view, byteOffset, value, isLE) {\n if (typeof view.setBigUint64 === 'function')\n return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n// Base SHA2 class (RFC 6234)\nexport class SHA2 extends Hash {\n constructor(blockLen, outputLen, padOffset, isLE) {\n super();\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.finished = false;\n this.length = 0;\n this.pos = 0;\n this.destroyed = false;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data) {\n exists(this);\n const { view, buffer, blockLen } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n exists(this);\n output(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n this.buffer.subarray(pos).fill(0);\n // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to || (to = new this.constructor());\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.length = length;\n to.pos = pos;\n to.finished = finished;\n to.destroyed = destroyed;\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n}\n//# sourceMappingURL=_sha2.js.map","import { SHA2 } from './_sha2.js';\nimport { rotr, wrapConstructor } from './utils.js';\n// SHA2-256 need to try 2^128 hashes to execute birthday attack.\n// BTC network is doing 2^67 hashes/sec as per early 2023.\n// Choice: a ? b : c\nconst Chi = (a, b, c) => (a & b) ^ (~a & c);\n// Majority function, true if any two inpust is true\nconst Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);\n// Round constants:\n// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n// prettier-ignore\nconst IV = /* @__PURE__ */ new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n]);\n// Temporary buffer, not used to store anything between runs\n// Named this way because it matches specification.\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nclass SHA256 extends SHA2 {\n constructor() {\n super(64, 32, 8, false);\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n this.A = IV[0] | 0;\n this.B = IV[1] | 0;\n this.C = IV[2] | 0;\n this.D = IV[3] | 0;\n this.E = IV[4] | 0;\n this.F = IV[5] | 0;\n this.G = IV[6] | 0;\n this.H = IV[7] | 0;\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n SHA256_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\n// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf\nclass SHA224 extends SHA256 {\n constructor() {\n super();\n this.A = 0xc1059ed8 | 0;\n this.B = 0x367cd507 | 0;\n this.C = 0x3070dd17 | 0;\n this.D = 0xf70e5939 | 0;\n this.E = 0xffc00b31 | 0;\n this.F = 0x68581511 | 0;\n this.G = 0x64f98fa7 | 0;\n this.H = 0xbefa4fa4 | 0;\n this.outputLen = 28;\n }\n}\n/**\n * SHA2-256 hash function\n * @param message - data that would be hashed\n */\nexport const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());\nexport const sha224 = /* @__PURE__ */ wrapConstructor(() => new SHA224());\n//# sourceMappingURL=sha256.js.map","import { SHA2 } from './_sha2.js';\nimport u64 from './_u64.js';\nimport { wrapConstructor } from './utils.js';\n// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):\n// prettier-ignore\nconst [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\n// Temporary buffer, not used to store anything between runs\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\nexport class SHA512 extends SHA2 {\n constructor() {\n super(128, 64, 16, false);\n // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.\n // Also looks cleaner and easier to verify with spec.\n // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x6a09e667 | 0;\n this.Al = 0xf3bcc908 | 0;\n this.Bh = 0xbb67ae85 | 0;\n this.Bl = 0x84caa73b | 0;\n this.Ch = 0x3c6ef372 | 0;\n this.Cl = 0xfe94f82b | 0;\n this.Dh = 0xa54ff53a | 0;\n this.Dl = 0x5f1d36f1 | 0;\n this.Eh = 0x510e527f | 0;\n this.El = 0xade682d1 | 0;\n this.Fh = 0x9b05688c | 0;\n this.Fl = 0x2b3e6c1f | 0;\n this.Gh = 0x1f83d9ab | 0;\n this.Gl = 0xfb41bd6b | 0;\n this.Hh = 0x5be0cd19 | 0;\n this.Hl = 0x137e2179 | 0;\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n SHA512_W_H.fill(0);\n SHA512_W_L.fill(0);\n }\n destroy() {\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\nclass SHA512_224 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x8c3d37c8 | 0;\n this.Al = 0x19544da2 | 0;\n this.Bh = 0x73e19966 | 0;\n this.Bl = 0x89dcd4d6 | 0;\n this.Ch = 0x1dfab7ae | 0;\n this.Cl = 0x32ff9c82 | 0;\n this.Dh = 0x679dd514 | 0;\n this.Dl = 0x582f9fcf | 0;\n this.Eh = 0x0f6d2b69 | 0;\n this.El = 0x7bd44da8 | 0;\n this.Fh = 0x77e36f73 | 0;\n this.Fl = 0x04c48942 | 0;\n this.Gh = 0x3f9d85a8 | 0;\n this.Gl = 0x6a1d36c8 | 0;\n this.Hh = 0x1112e6ad | 0;\n this.Hl = 0x91d692a1 | 0;\n this.outputLen = 28;\n }\n}\nclass SHA512_256 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x22312194 | 0;\n this.Al = 0xfc2bf72c | 0;\n this.Bh = 0x9f555fa3 | 0;\n this.Bl = 0xc84c64c2 | 0;\n this.Ch = 0x2393b86b | 0;\n this.Cl = 0x6f53b151 | 0;\n this.Dh = 0x96387719 | 0;\n this.Dl = 0x5940eabd | 0;\n this.Eh = 0x96283ee2 | 0;\n this.El = 0xa88effe3 | 0;\n this.Fh = 0xbe5e1e25 | 0;\n this.Fl = 0x53863992 | 0;\n this.Gh = 0x2b0199fc | 0;\n this.Gl = 0x2c85b8aa | 0;\n this.Hh = 0x0eb72ddc | 0;\n this.Hl = 0x81c52ca2 | 0;\n this.outputLen = 32;\n }\n}\nclass SHA384 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0xcbbb9d5d | 0;\n this.Al = 0xc1059ed8 | 0;\n this.Bh = 0x629a292a | 0;\n this.Bl = 0x367cd507 | 0;\n this.Ch = 0x9159015a | 0;\n this.Cl = 0x3070dd17 | 0;\n this.Dh = 0x152fecd8 | 0;\n this.Dl = 0xf70e5939 | 0;\n this.Eh = 0x67332667 | 0;\n this.El = 0xffc00b31 | 0;\n this.Fh = 0x8eb44a87 | 0;\n this.Fl = 0x68581511 | 0;\n this.Gh = 0xdb0c2e0d | 0;\n this.Gl = 0x64f98fa7 | 0;\n this.Hh = 0x47b5481d | 0;\n this.Hl = 0xbefa4fa4 | 0;\n this.outputLen = 48;\n }\n}\nexport const sha512 = /* @__PURE__ */ wrapConstructor(() => new SHA512());\nexport const sha512_224 = /* @__PURE__ */ wrapConstructor(() => new SHA512_224());\nexport const sha512_256 = /* @__PURE__ */ wrapConstructor(() => new SHA512_256());\nexport const sha384 = /* @__PURE__ */ wrapConstructor(() => new SHA384());\n//# sourceMappingURL=sha512.js.map","/* Browser Crypto Shims */\nimport { hmac } from \"@noble/hashes/hmac\";\nimport { pbkdf2 } from \"@noble/hashes/pbkdf2\";\nimport { sha256 } from \"@noble/hashes/sha256\";\nimport { sha512 } from \"@noble/hashes/sha512\";\nimport { sha3_256, sha3_512 } from \"@noble/hashes/sha3\";\nimport ed448 from \"./browser-ed448.js\";\nimport { assert, assertArgument } from \"../utils/index.js\";\nexport { ed448 };\nexport { Ed448Goldilock } from \"./ed448goldilock-browser.js\";\nfunction getGlobal() {\n if (typeof self !== \"undefined\") {\n return self;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof global !== \"undefined\") {\n return global;\n }\n throw new Error(\"unable to locate global object\");\n}\nconst anyGlobal = getGlobal();\nconst crypto = anyGlobal.crypto || anyGlobal.msCrypto;\nexport function createHash(algo) {\n switch (algo) {\n case \"sha256\":\n return sha256.create();\n case \"sha512\":\n return sha512.create();\n case \"sha3-256\":\n return sha3_256.create();\n case \"sha3-512\":\n return sha3_512.create();\n }\n assertArgument(false, \"invalid hashing algorithm name\", \"algorithm\", algo);\n}\nexport function createHmac(_algo, key) {\n const algo = { sha256, sha512 }[_algo];\n assertArgument(algo != null, \"invalid hmac algorithm\", \"algorithm\", _algo);\n return hmac.create(algo, key);\n}\nexport function pbkdf2Sync(password, salt, iterations, keylen, _algo) {\n const algo = { sha256, sha512 }[_algo];\n assertArgument(algo != null, \"invalid pbkdf2 algorithm\", \"algorithm\", _algo);\n return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen });\n}\nexport function randomBytes(length) {\n assert(crypto != null, \"platform does not support secure random numbers\", \"UNSUPPORTED_OPERATION\", {\n operation: \"randomBytes\",\n });\n assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, \"invalid length\", \"length\", length);\n const result = new Uint8Array(length);\n crypto.getRandomValues(result);\n return result;\n}\n//# sourceMappingURL=crypto-browser.js.map","import { Logger } from \"../logger/logger.js\";\nimport { arrayify, getBytes, hexlify } from \"../utils/data.js\";\nimport { createHash, createHmac } from \"./crypto.js\";\nimport { Buffer } from \"buffer\";\nconst logger = new Logger(\"sha3/0.0.1\");\nconst _sha256 = function (data) {\n let v = \"0x\" +\n createHash(\"sha3-256\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n return v;\n};\nconst _sha512 = function (data) {\n let v = \"0x\" +\n createHash(\"sha3-512\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n return v;\n};\n// @ts-ignore\nlet __sha256 = _sha256;\n// @ts-ignore\nlet __sha512 = _sha512;\nlet locked256 = false, locked512 = false;\n/**\n * Compute the cryptographic SHA2-256 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * sha256(\"0x\")\n * //_result:\n *\n * sha256(\"0x1337\")\n * //_result:\n *\n * sha256(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n */\nexport var SupportedAlgorithm;\n(function (SupportedAlgorithm) {\n SupportedAlgorithm[\"sha256\"] = \"sha256\";\n SupportedAlgorithm[\"sha512\"] = \"sha512\";\n})(SupportedAlgorithm || (SupportedAlgorithm = {}));\nexport function ripemd160(data) {\n let createdHash = \"0x\" +\n createHash(\"ripemd160\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n const v = \"0x\" + createdHash;\n if (typeof createdHash !== \"string\") {\n createdHash = hexlify(createdHash);\n return createdHash;\n }\n return v;\n}\nexport function sha256(data) {\n let createdHash = createHash(\"sha3-256\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n const v = \"0x\" + createdHash;\n if (typeof createdHash !== \"string\") {\n createdHash = hexlify(createdHash);\n return createdHash;\n }\n return v;\n}\nexport function legacySha256(data) {\n const _data = getBytes(data, \"data\");\n const hexlified = hexlify(createHash(\"sha256\").update(_data).digest());\n return hexlified;\n}\nexport function computeHmac(algorithm, key, data) {\n const d = Buffer.from(arrayify(data));\n const k = Buffer.from(arrayify(key));\n if (algorithm === SupportedAlgorithm.sha256) {\n return \"0x\" + createHmac(\"sha3-256\", k).update(d).digest(\"hex\");\n }\n else if (algorithm === SupportedAlgorithm.sha512) {\n return \"0x\" + createHmac(\"sha3-512\", k).update(d).digest(\"hex\");\n }\n logger.throwError(\"unsupported algorithm - \" + algorithm, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"computeHmac\",\n algorithm: algorithm,\n });\n return \"\";\n}\nsha256._ = _sha256;\nsha256.lock = function () {\n locked256 = true;\n};\nsha256.register = function (func) {\n if (locked256) {\n throw new Error(\"sha256 is locked\");\n }\n __sha256 = func;\n};\nObject.freeze(sha256);\n/**\n * Compute the cryptographic SHA2-512 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * sha512(\"0x\")\n * //_result:\n *\n * sha512(\"0x1337\")\n * //_result:\n *\n * sha512(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n */\nexport function sha512(data) {\n let createdHash = createHash(\"sha3-512\")\n .update(Buffer.from(arrayify(data)))\n .digest(\"hex\");\n const v = \"0x\" + createdHash;\n if (typeof createdHash !== \"string\") {\n createdHash = hexlify(createdHash);\n return createdHash;\n }\n return v;\n}\nsha512._ = _sha512;\nsha512.lock = function () {\n locked512 = true;\n};\nsha512.register = function (func) {\n if (locked512) {\n throw new Error(\"sha512 is locked\");\n }\n __sha512 = func;\n};\nObject.freeze(sha256);\n//# sourceMappingURL=sha3.js.map","import { keccak256 } from \"../crypto/keccak.js\";\nimport { sha256 } from \"../crypto/sha3.js\";\nimport { toUtf8Bytes } from \"../utils/index.js\";\n/**\n * A simple hashing function which operates on UTF-8 strings to\n * compute an 32-byte identifier.\n *\n *\n * @example:\n * id(\"hello world\")\n * //_result:\n */\nexport function id(value, useKeccak) {\n if (useKeccak) {\n return keccak256(toUtf8Bytes(value));\n }\n return sha256(toUtf8Bytes(value));\n}\n//# sourceMappingURL=id.js.map","import { assertArgument } from \"../utils/index.js\";\nconst subsChrs = \" !#$%&'()*+,-./<=>?@[]^_`{|}~\";\nconst Word = /^[a-z]*$/i;\nfunction unfold(words, sep) {\n let initial = 97;\n return words.reduce((accum, word) => {\n if (word === sep) {\n initial++;\n }\n else if (word.match(Word)) {\n accum.push(String.fromCharCode(initial) + word);\n }\n else {\n initial = 97;\n accum.push(word);\n }\n return accum;\n }, []);\n}\n/**\n * @_ignore\n */\nexport function decode(data, subs) {\n // Replace all the substitutions with their expanded form\n for (let i = subsChrs.length - 1; i >= 0; i--) {\n data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2));\n }\n // Get all tle clumps; each suffix, first-increment and second-increment\n const clumps = [];\n const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => {\n if (semi) {\n for (let i = parseInt(semi); i >= 0; i--) {\n clumps.push(\";\");\n }\n }\n else {\n clumps.push(item.toLowerCase());\n }\n return \"\";\n });\n /* c8 ignore start */\n if (leftover) {\n throw new Error(`leftovers: ${JSON.stringify(leftover)}`);\n }\n /* c8 ignore stop */\n return unfold(unfold(clumps, \";\"), \":\");\n}\n/**\n * @_ignore\n */\nexport function decodeOwl(data) {\n assertArgument(data[0] === \"0\", \"unsupported auwl data\", \"data\", data);\n return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length));\n}\n//# sourceMappingURL=decode-owl.js.map","import { id } from \"../hash/id.js\";\nimport { defineProperties } from \"../utils/index.js\";\n/**\n * A Wordlist represents a collection of language-specific\n * words used to encode and devoce [[link-bip-39]] encoded data\n * by mapping words to 11-bit values and vice versa.\n */\nexport class Wordlist {\n locale;\n /**\n * Creates a new Wordlist instance.\n *\n * Sub-classes MUST call this if they provide their own constructor,\n * passing in the locale string of the language.\n *\n * Generally there is no need to create instances of a Wordlist,\n * since each language-specific Wordlist creates an instance and\n * there is no state kept internally, so they are safe to share.\n */\n constructor(locale) {\n defineProperties(this, { locale });\n }\n /**\n * Sub-classes may override this to provide a language-specific\n * method for spliting %%phrase%% into individual words.\n *\n * By default, %%phrase%% is split using any sequences of\n * white-space as defined by regular expressions (i.e. ``/\\s+/``).\n */\n split(phrase) {\n return phrase.toLowerCase().split(/\\s+/g);\n }\n /**\n * Sub-classes may override this to provider a language-specific\n * method for joining %%words%% into a phrase.\n *\n * By default, %%words%% are joined by a single space.\n */\n join(words) {\n return words.join(\" \");\n }\n static check(wordlist) {\n const words = [];\n for (let i = 0; i < 2048; i++) {\n const word = wordlist.getWord(i);\n /* istanbul ignore if */\n if (i !== wordlist.getWordIndex(word)) {\n return \"0x\";\n }\n words.push(word);\n }\n return id(words.join(\"\\n\") + \"\\n\");\n }\n}\n//# sourceMappingURL=wordlist.js.map","// Use the encode-latin.js script to create the necessary\n// data files to be consumed by this class\nimport { id } from \"../hash/index.js\";\nimport { assertArgument } from \"../utils/index.js\";\nimport { decodeOwl } from \"./decode-owl.js\";\nimport { Wordlist } from \"./wordlist.js\";\n/**\n * An OWL format Wordlist is an encoding method that exploits\n * the general locality of alphabetically sorted words to\n * achieve a simple but effective means of compression.\n *\n * This class is generally not useful to most developers as\n * it is used mainly internally to keep Wordlists for languages\n * based on ASCII-7 small.\n *\n * If necessary, there are tools within the ``generation/`` folder\n * to create these necessary data.\n */\nexport class WordlistOwl extends Wordlist {\n #data;\n #checksum;\n /**\n * Creates a new Wordlist for %%locale%% using the OWL %%data%%\n * and validated against the %%checksum%%.\n */\n constructor(locale, data, checksum) {\n super(locale);\n this.#data = data;\n this.#checksum = checksum;\n this.#words = null;\n }\n get _data() {\n return this.#data;\n }\n _decodeWords() {\n return decodeOwl(this.#data);\n }\n #words;\n #loadWords() {\n if (this.#words == null) {\n const words = this._decodeWords();\n // Verify the computed list matches the official list\n const checksum = id(words.join(\"\\n\") + \"\\n\", true);\n /* c8 ignore start */\n if (checksum !== this.#checksum) {\n throw new Error(`BIP39 Wordlist for ${this.locale} FffffAILED`);\n }\n /* c8 ignore stop */\n this.#words = words;\n }\n return this.#words;\n }\n getWord(index) {\n const words = this.#loadWords();\n assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, \"index\", index);\n return words[index];\n }\n getWordIndex(word) {\n return this.#loadWords().indexOf(word);\n }\n}\n//# sourceMappingURL=wordlist-owl.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nconst words = \"0itatkastcenaovo$taouleraeki&chor*teci%enbalodaeladet'!Chn=0Di#%E%^1Resa2Rese3CeT'#0EjKohol0Pu)%0A&sDul#Ekdo)Ke)Ti#Ul|3}aOgan%0FaltI$@tPi,%TmaTronom0LasL{i#Ol0Tobus4Yl:B#}R'?TaUb_U/!U^U+Ur!Xer2A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An C`]N (NoOv&Y/l Zav(1I/aR! 0B'.Br0Ed~EnkuEs_aOnR!Uk'odYk\";\nconst checksum = \"0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a\";\nlet wordlist = null;\n/**\n * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangCz extends WordlistOwl {\n /**\n * Creates a new instance of the Czech language Wordlist.\n *\n * Using the constructor should be unnecessary, instead use the\n * [[wordlist]] singleton method.\n *\n * @_ignore:\n */\n constructor() {\n super(\"cz\", words, checksum);\n }\n /**\n * Returns a singleton instance of a ``LangCz``, creating it\n * if this is the first time being called.\n */\n static wordlist() {\n if (wordlist == null) {\n wordlist = new LangCz();\n }\n return wordlist;\n }\n}\n//# sourceMappingURL=lang-cz.js.map","const Base64 = \")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_\";\n/**\n * @_ignore\n */\nexport function decodeBits(width, data) {\n const maxValue = (1 << width) - 1;\n const result = [];\n let accum = 0, bits = 0, flood = 0;\n for (let i = 0; i < data.length; i++) {\n // Accumulate 6 bits of data\n accum = (accum << 6) | Base64.indexOf(data[i]);\n bits += 6;\n // While we have enough for a word...\n while (bits >= width) {\n // ...read the word\n const value = accum >> (bits - width);\n accum &= (1 << (bits - width)) - 1;\n bits -= width;\n // A value of 0 indicates we exceeded maxValue, it\n // floods over into the next value\n if (value === 0) {\n flood += maxValue;\n }\n else {\n result.push(value + flood);\n flood = 0;\n }\n }\n }\n return result;\n}\n//# sourceMappingURL=bit-reader.js.map","import { assertArgument } from \"../utils/index.js\";\nimport { decodeBits } from \"./bit-reader.js\";\nimport { decodeOwl } from \"./decode-owl.js\";\n/**\n * @_ignore\n */\nexport function decodeOwlA(data, accents) {\n let words = decodeOwl(data).join(\",\");\n // Inject the accents\n accents.split(/,/g).forEach((accent) => {\n const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);\n assertArgument(match !== null, \"internal error parsing accents\", \"accents\", accents);\n let posOffset = 0;\n const positions = decodeBits(parseInt(match[3]), match[4]);\n const charCode = parseInt(match[2]);\n const regex = new RegExp(`([${match[1]}])`, \"g\");\n words = words.replace(regex, (all, letter) => {\n const rem = --positions[posOffset];\n if (rem === 0) {\n letter = String.fromCharCode(letter.charCodeAt(0), charCode);\n posOffset++;\n }\n return letter;\n });\n });\n return words.split(\",\");\n}\n//# sourceMappingURL=decode-owla.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nimport { decodeOwlA } from \"./decode-owla.js\";\n/**\n * An OWL-A format Wordlist extends the OWL format to add an\n * overlay onto an OWL format Wordlist to support diacritic\n * marks.\n *\n * This class is generally not useful to most developers as\n * it is used mainly internally to keep Wordlists for languages\n * based on latin-1 small.\n *\n * If necessary, there are tools within the ``generation/`` folder\n * to create these necessary data.\n */\nexport class WordlistOwlA extends WordlistOwl {\n #accent;\n constructor(locale, data, accent, checksum) {\n super(locale, data, checksum);\n this.#accent = accent;\n }\n get _accent() {\n return this.#accent;\n }\n _decodeWords() {\n return decodeOwlA(this._data, this._accent);\n }\n}\n//# sourceMappingURL=wordlist-owla.js.map","import { WordlistOwlA } from \"./wordlist-owla.js\";\nconst words = \"0arertoiotadonoaRteirroenaNonaLsolocoiliaralaorrenadaChoN$n0A>Dom,EjaI!#Oga&O'Or#RazoR*Ue=U<0Ab Adem@CeLe%OmoRa!RozUn0DazD$GeLaM,#S,)T^0AlAnceA+EEl]`E`EstruzI.I<2ErU{U'0Af[nArO)Uc Uf_Ul:BaB^|eH@IleJ Lanz/c.LdeMbuN>Nd-oRb(>RnizR+Scu]S#nSu[Tal]T!@T*Tu%UlZ 3BeBid/=S SoSt@3|oEnNgo2An>OqueUsa2ABi`BoCaCi`DaDegaIn//!oLsaMb-{dNi#N}saiRdeRr SqueTeTinVe{Zal2AvoAzoEchaEveIl=In>IsaOcaOmaOnceO)UjaUs>U#2CeoCleE'EyFan{F.HoI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1F_}Fic>Fr*0Ive1Se|S`l$2Fac%fIv>0Bra.Ett!0Ct){Du]E!{Iri^1A#A^Er Ini$PortunPrim T Ti^1A.{An.Bi&D$n E`#G/eG)`Ifi-Ne?ntQ)T+0C`]MoPo,PyrusRadoxeR-l#ResIss$Iv!Lai!Lic>L#nLyg$eMma@Mp>Nct)lNd NeyR%^Si%$SZz#3Rami@:99AsarE!l#Es%$Ietu@It,O%_t:C(eC$,D+{G$d(I@'Is(L_%rLl$.Mas}Pi@Sa.Tis}Vag V(Y$n 3Ac%fAg*Ali}Anim Cevo*Ci,Clam Col,Cru,Cu]Cyc]Dig Dou,Fai!F#xeForm Fra(Fu.G=+nGi$Gla.Gul>I, Je,Jou La%fLev L+fMar^Me@MiPor,Prie5Che{M/-Mp!N-Nd(Se|S>Ta%fTorTu#U.U`#U#|U%[Y|?5B/BisCheEl#G){In Is<|S S%^3Th?:B]Bo,B!Co~eFariGesRcas?Rd(eT' Ug!nuUm$U,Uva.V/tV$n 1AlpelAnda#E]atEnarioEpt!HemaI_-Ind O!Ru%nUlp,1An-Cab#Ch Cou C!,Da%fDui!Ig['Jo'Lec%fMa(eMb]M_-M(=Na&'Nsib#N&n-Par Q)n-Re(R.ntR+{Rru!RumRvi-Sa?V*Vra.Xtup#3D =Ec#Eg Ff]G#Gn=L_-LiciumMp#Nc eNist!Ph$RopSmi^Tu 1I 3Ci=C#DiumIg[{LdatLe`Litu@Lub#Mb!M?`Mno]N@N.'N[t&No!Rc>R%rS+T%Rfa-Rica&R?n RpriC%#Il]L_tLism/L$n Mbo'Mi}Ngib#PisQu( Rd RifR%[SI$I^Itai!Iv s3AniumBa(Tic/t0A.I[UelU!0I#Op+:Car?Cc(Gab$dG)Ill/tInc!Is<|Lab#LiSe{Ss=S&3C&'Det&Get=Hicu#InardLo-Nd!diN Ng Ni?{Ntou b) {\n return 1;\n }\n return 0;\n }\n // Load all the words\n for (let length = 3; length <= 9; length++) {\n const d = data[length - 3];\n for (let offset = 0; offset < d.length; offset += length) {\n const word = [];\n for (let i = 0; i < length; i++) {\n const k = mapping.indexOf(d[offset + i]);\n word.push(227);\n word.push(k & 0x40 ? 130 : 129);\n word.push((k & 0x3f) + 128);\n }\n wordlist.push(toString(word));\n }\n }\n wordlist.sort(sortJapanese);\n // For some reason kyoku and kiyoku are flipped in node (!!).\n // The order SHOULD be:\n // - kyoku\n // - kiyoku\n // This should ignore \"if\", but that doesn't work here??\n /* c8 ignore start */\n if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) {\n const tmp = wordlist[442];\n wordlist[442] = wordlist[443];\n wordlist[443] = tmp;\n }\n /* c8 ignore stop */\n // Verify the computed list matches the official list\n /* istanbul ignore if */\n const checksum = id(wordlist.join(\"\\n\") + \"\\n\");\n /* c8 ignore start */\n if (checksum !==\n \"0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600\") {\n throw new Error(\"BIP39 Wordlist for ja (Japanese) FAILED\");\n }\n /* c8 ignore stop */\n _wordlist = wordlist;\n return wordlist;\n}\nlet wordlist = null;\n/**\n * The [[link-bip39-ja]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangJa extends Wordlist {\n /**\n * Creates a new instance of the Japanese language Wordlist.\n *\n * This should be unnecessary most of the time as the exported\n * [[langJa]] should suffice.\n *\n * @_ignore:\n */\n constructor() {\n super(\"ja\");\n }\n getWord(index) {\n const words = loadWords();\n assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, \"index\", index);\n return words[index];\n }\n getWordIndex(word) {\n return loadWords().indexOf(word);\n }\n split(phrase) {\n //logger.assertNormalize();\n return phrase.split(/(?:\\u3000| )+/g);\n }\n join(words) {\n return words.join(\"\\u3000\");\n }\n /**\n * Returns a singleton instance of a ``LangJa``, creating it\n * if this is the first time being called.\n */\n static wordlist() {\n if (wordlist == null) {\n wordlist = new LangJa();\n }\n return wordlist;\n }\n}\n//# sourceMappingURL=lang-ja.js.map","import { id } from \"../hash/index.js\";\nimport { assertArgument, toUtf8String } from \"../utils/index.js\";\nimport { Wordlist } from \"./wordlist.js\";\nconst data = [\n \"OYAa\",\n \"ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMbAX3JTAX3QbAYLn3AZLgvAZrSUAZvAcAZ8AaAZ8AbAZ8AnAZ8HnAZ8LgAZ8MYAZ8MgAZ8OnAaAboAaDTrAaFTrAaJTrAaJboAaLVoAaMXvAaOl8AaSeoAbAUoAbAg8AbAl4AbGnrAbMT8AbMXrAbMn4AbQb8AbSV8AbvRlAb8AUAb8AnAb8HgAb8JTAb8NTAb8RbAcGboAcLnvAcMT8AcMX8AcSToAcrAaAcrFnAc8AbAc8MgAfGgrAfHboAfJnvAfLV8AfLkoAfMT8AfMnoAfQb8AfScrAfSgrAgAZ8AgFl3AgGX8AgHZvAgHgrAgJXoAgJX8AgJboAgLZoAgLn4AgOX8AgoATAgoAnAgoCUAgoJgAgoLXAgoMYAgoSeAgrDUAgrJTAhrFnAhrLjAhrQgAjAgoAjJnrAkMX8AkOnoAlCTvAlCV8AlClvAlFg4AlFl6AlFn3AloSnAlrAXAlrAfAlrFUAlrFbAlrGgAlrOXAlvKnAlvMTAl3AbAl3MnAnATrAnAcrAnCZ3AnCl8AnDg8AnFboAnFl3AnHX4AnHbrAnHgrAnIl3AnJgvAnLXoAnLX4AnLbrAnLgrAnLhrAnMXoAnMgrAnOn3AnSbrAnSeoAnvLnAn3OnCTGgvCTSlvCTvAUCTvKnCTvNTCT3CZCT3GUCT3MTCT8HnCUCZrCULf8CULnvCU3HnCU3JUCY6NUCbDb8CbFZoCbLnrCboOTCboScCbrFnCbvLnCb8AgCb8HgCb$LnC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UrDlHUoScvHTvSnSfLkvMXo\",\n \"AUoAcrMXoAZ8HboAg8AbOg6ATFgAg8AloMXoAl3AT8JTrAl8MX8MXoCT3SToJU8Cl8Db8MXoDT8HgrATrDboOT8MXoGTOTrATMnGT8LhrAZ8GnvFnGnQXHToGgvAcrHTvAXvLl3HbrAZoMXoHgBlFXLg3HgMnFXrSnHgrSb8JUoHn6HT8LgvITvATrJUoJUoLZrRnvJU8HT8Jb8JXvFX8QT8JXvLToJTrJYrQnGnQXJgrJnoATrJnoJU8ScvJnvMnvMXoLTCTLgrJXLTJlRTvQlLbRnJlQYvLbrMb8LnvLbvFn3RnoLdCVSTGZrLeSTvGXCnLg3MnoLn3MToLlrETvMT8SToAl3MbrDU6GTvMb8LX4LhrPlrLXGXCnSToLf8Rg3STrDb8LTrSTvLTHXMnSb3RYLnMnSgOg6ATFg\",\n \"HUDlGnrQXrJTrHgLnrAcJYMb8DULc8LTvFgGnCk3Mg8JbAnLX4QYvFYHnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb\",\n \"AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl\",\n];\nconst codes = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*\";\nfunction getHangul(code) {\n if (code >= 40) {\n code = code + 168 - 40;\n }\n else if (code >= 19) {\n code = code + 97 - 19;\n }\n return toUtf8String(new Uint8Array([225, (code >> 6) + 132, (code & 0x3f) + 128]));\n}\nlet _wordlist = null;\nfunction loadWords() {\n if (_wordlist != null) {\n return _wordlist;\n }\n const wordlist = [];\n data.forEach((data, length) => {\n length += 4;\n for (let i = 0; i < data.length; i += length) {\n let word = \"\";\n for (let j = 0; j < length; j++) {\n word += getHangul(codes.indexOf(data[i + j]));\n }\n wordlist.push(word);\n }\n });\n wordlist.sort();\n // Verify the computed list matches the official list\n /* istanbul ignore if */\n const checksum = id(wordlist.join(\"\\n\") + \"\\n\");\n /* c8 ignore start */\n if (checksum !==\n \"0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a\") {\n throw new Error(\"BIP39 Wordlist for ko (Korean) FAILED\");\n }\n /* c8 ignore stop */\n _wordlist = wordlist;\n return wordlist;\n}\nlet wordlist = null;\n/**\n * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangKo extends Wordlist {\n /**\n * Creates a new instance of the Korean language Wordlist.\n *\n * This should be unnecessary most of the time as the exported\n * [[langKo]] should suffice.\n *\n * @_ignore:\n */\n constructor() {\n super(\"ko\");\n }\n getWord(index) {\n const words = loadWords();\n assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, \"index\", index);\n return words[index];\n }\n getWordIndex(word) {\n return loadWords().indexOf(word);\n }\n /**\n * Returns a singleton instance of a ``LangKo``, creating it\n * if this is the first time being called.\n */\n static wordlist() {\n if (wordlist == null) {\n wordlist = new LangKo();\n }\n return wordlist;\n }\n}\n//# sourceMappingURL=lang-ko.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nconst words = \"0torea noica!iosorolotaleratelanena%oiadoencotivomai t ca%a0A]Bagl'Bin#E.Is(Oli!Rasi_Rog#0Cade!C[$Cus#E Roba+U 0Ag'Deb{DomeEgu#Eri!IpeOtt&Ul&1Fabi,Fe|Fis(F-n Oris`O(R~$0AveEn.E_,Ganc'I!It&OnismoR>*Rume Uzzo4AbardaA Bat)Ber#BoBumeCeCol>E|Ertu-OdePari!Pe^ Pogg'P)@Pun Ri,1Ab~AchideAgos+Ald~Anc'Atu-AzzoBit)Chiv'D{Eni,G[ GiSoTef%eZil*0Ciu|Col EpsiEtt>Fal I$O/Pir#P)Sagg'SeSolu Sur@TaT[u T%eT-|0Av>EismoOm>O$TesaTiv&Tor$Tr{Tua,0Sil'Str?Tis+To$moTun$0Anz#E!V[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n S](S'5Cche)Fo*LuPpa\";\nconst checksum = \"0x5c1362d88fd4cf614a96f3234941d29f7d37c08c5292fde03bf62c2db6ff7620\";\nlet wordlist = null;\n/**\n * The [[link-bip39-it]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangIt extends WordlistOwl {\n /**\n * Creates a new instance of the Italian language Wordlist.\n *\n * This should be unnecessary most of the time as the exported\n * [[langIt]] should suffice.\n *\n * @_ignore:\n */\n constructor() {\n super(\"it\", words, checksum);\n }\n /**\n * Returns a singleton instance of a ``LangIt``, creating it\n * if this is the first time being called.\n */\n static wordlist() {\n if (wordlist == null) {\n wordlist = new LangIt();\n }\n return wordlist;\n }\n}\n//# sourceMappingURL=lang-it.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nconst words = \"0arad!ototealirertainrasoent hoandoaR#riareha!aroele'oronul0Aca%AixoAl A%rDuz'El]Er$IsmoO$ Rum S-&T(i&TigoVo[=0F&.Il#P' S?S* So&/Sun$Tr&0Ac#Adu+Al/A[f E End(Er_EuIng'Ir?IvoOl{oRac Revi=RizU&Um0Di$rM-.R>o+TismoT|@Tu 0Ali An%Ar@Ent&Es,I?Is Ul,1Ila1Ar E=Ei%Ulejo:B BosaC&]uCh `C@GagemI+c>~/Se#S)n%Ta)Te=rTidaTomTuc Unil]3B(IjoIr^IsebolLd!eLezaLgaLisc Ndi$Ng&aNz(RimbauRl*d>_Sou_XigaZ(_3CoCu=En&Foc&Furc G|naLhe%Mest[Mo$rOlog@OmboOsf(aPol Rr-$Scoi$Sne$SpoSsex$TolaZ _2Ind#OcoOque 2A$BagemC#CejoChec]Ico.L^LetimL]LoMb{oNdeNecoNi)Rb~h>d>e&R+c]V*oXe?2AncoAsaAvezaEuIgaIl/Inc OaOchu+Onze O$Uxo2C]DismoF LeRacoScaS$Z*a:Bimb Rn{oRpe%R['>)zRv&/SacoScaSeb[S%loS~oT a)Tiv UleUs?U%l V&oV(na3BolaDil]G}]Lebr L~ N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l^Us 3C~i D& Dest[D@t+D+G^I$r&IxeLeLicplexoRsi<>%nceRucaSc#SquisaS,aTisc 3AdaC#Ed!eGm-$Last+Lh#Lo.M-)Nc`NguimN]No%N.On{oPocaQue%ResRue)Sc S$laTg-$Rje)Tur Ud!eXof}eZ}&3C C~ DaD-$Di#Do,Du$rGm-$G[=Gun=IvaLe$LvagemM<&M-%N?N/rNsu&Nt#P #Rei>*g>+RvoTemb_T|3GiloLhue)Lic}eMetr@Mpat@M~ N&Nc(oNg~ NopseN$ni>-eRiTu#5B(fis)Rp[s>[&Rt'Sp'oS%n$:B`aBle%Bu^C/G `aLh(LoLvezMdioRef>j>+xaTuagemUr*oXativoXis)3Atr&C(Ci=Cl#Dio,IaIm Lef}eLh#Mp(oN-%N,rN.Rm&RnoRr-oSeSou+St#ToXtu+Xugo3A+G`aJoloMbr MidezNgi=N%'oRagemT~ 5Al]C]L( LiceM^Mil/N`Ntu+Pe%R>ci=RneioRqueRr!>$S.UcaUp{aX*a2Ab&/Acej Adu$rAfeg Aje$AmaAnc ApoAs{oAt?Av E*oEm(Epid EvoIagemIboIcicloId-%Ilog@Ind!eIploItur Iunf&Oc Ombe)OvaUnfoUque2B~ CquesaT` T|i&:7V 3Bigo0HaId!eIf|me3Olog@SoTigaUbu0A=InaUfru':C*aDi G o,I=,LaL-%Lid!eLo[sN)gemQu{oRe)Rr(Sc~ Sil]S,u+Z Zio3A=D Ge.Ic~ L{oLhiceLu=Nce=rNdav&N( Nt[Rb&Rd!eRe?Rg}h>m`/RnizRs R%n%SpaSti=T|i&3Adu$AgemAj Atu+Br?D{aDr @ElaGaG-%Gi G| L ejoNcoNhe)NilOle)R!>tudeSi.S$Tr&V{oZ*/5A=rArG&L<%LeibolL)gemLumo,Nt!e5L$Vuz`a::D[zRope3QueRe.Rife3Ng ::Ng#Rp 3BuL?9Mb Olog@5Mbi=\";\nconst checksum = \"0x2219000926df7b50d8aa0a3d495826b988287df4657fbd100e6fe596c8f737ac\";\nlet wordlist = null;\n/**\n * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangPt extends WordlistOwl {\n /**\n * Creates a new instance of the Portuguese language Wordlist.\n *\n * This should be unnecessary most of the time as the exported\n * [[langPt]] should suffice.\n *\n * @_ignore:\n */\n constructor() {\n super(\"pt\", words, checksum);\n }\n /**\n * Returns a singleton instance of a ``LangPt``, creating it\n * if this is the first time being called.\n */\n static wordlist() {\n if (wordlist == null) {\n wordlist = new LangPt();\n }\n return wordlist;\n }\n}\n//# sourceMappingURL=lang-pt.js.map","import { id } from \"../hash/index.js\";\nimport { assertArgument, toUtf8String } from \"../utils/index.js\";\nimport { Wordlist } from \"./wordlist.js\";\nconst data = \"}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN?\";\nfunction loadWords(locale) {\n if (_wordlist[locale] != null) {\n return _wordlist[locale];\n }\n const wordlist = [];\n let deltaOffset = 0;\n for (let i = 0; i < 2048; i++) {\n const s = style.indexOf(data[i * 3]);\n const bytes = [\n 228 + (s >> 2),\n 128 + codes.indexOf(data[i * 3 + 1]),\n 128 + codes.indexOf(data[i * 3 + 2]),\n ];\n if (locale === \"zh_tw\") {\n const common = s % 4;\n for (let i = common; i < 3; i++) {\n bytes[i] =\n codes.indexOf(deltaData[deltaOffset++]) + (i == 0 ? 228 : 128);\n }\n }\n wordlist.push(toUtf8String(new Uint8Array(bytes)));\n }\n // Verify the computed list matches the official list\n const checksum = id(wordlist.join(\"\\n\") + \"\\n\");\n /* c8 ignore start */\n if (checksum !== Checks[locale]) {\n throw new Error(`BIP39 Wordlist for ${locale} (Chinese) FAILED`);\n }\n /* c8 ignore stop */\n _wordlist[locale] = wordlist;\n return wordlist;\n}\nconst wordlists = {};\n/**\n * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for\n * [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangZh extends Wordlist {\n /**\n * Creates a new instance of the Chinese language Wordlist for\n * the %%dialect%%, either ``\"cn\"`` or ``\"tw\"`` for simplified\n * or traditional, respectively.\n *\n * This should be unnecessary most of the time as the exported\n * [[langZhCn]] and [[langZhTw]] should suffice.\n *\n * @_ignore:\n */\n constructor(dialect) {\n super(\"zh_\" + dialect);\n }\n getWord(index) {\n const words = loadWords(this.locale);\n assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, \"index\", index);\n return words[index];\n }\n getWordIndex(word) {\n return loadWords(this.locale).indexOf(word);\n }\n split(phrase) {\n phrase = phrase.replace(/(?:\\u3000| )+/g, \"\");\n return phrase.split(\"\");\n }\n /**\n * Returns a singleton instance of a ``LangZh`` for %%dialect%%,\n * creating it if this is the first time being called.\n *\n * Use the %%dialect%% ``\"cn\"`` or ``\"tw\"`` for simplified or\n * traditional, respectively.\n */\n static wordlist(dialect) {\n if (wordlists[dialect] == null) {\n wordlists[dialect] = new LangZh(dialect);\n }\n return wordlists[dialect];\n }\n}\n//# sourceMappingURL=lang-zh.js.map"],"names":["sha256","u64","words","checksum","wordlist","accents","data","_wordlist","loadWords","codes"],"mappings":";;AAAA,SAAS,MAAM,CAAC,CAAC,EAAE;AACnB,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AACzC,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,wBAAwB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC;AAKD,SAAS,KAAK,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE;AAC9B,IAAI,IAAI,EAAE,CAAC,YAAY,UAAU,CAAC;AAClC,QAAQ,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAC/C,IAAI,IAAI,O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KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC3G,QAAQ,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;AAC5B,KAAK;AACL,IAAI,YAAY,CAAC,IAAI,EAAE;AACvB,QAAQ,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACpD,KAAK;AACL,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,QAAQ,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AACtD,QAAQ,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAChC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,QAAQ,CAAC,OAAO,EAAE;AAC7B,QAAQ,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE;AACxC,YAAY,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;AACrD,SAAS;AACT,QAAQ,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;AAClC,KAAK;AACL;;;;","x_google_ignoreList":[0,1,2,3,11,12,13]} \ No newline at end of file diff --git a/dist/wordlists-extra.min.js b/dist/wordlists-extra.min.js deleted file mode 100644 index 65e2c03f8..000000000 --- a/dist/wordlists-extra.min.js +++ /dev/null @@ -1 +0,0 @@ -import{Buffer}from"buffer";function number(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function bytes(b,...lengths){if(!(b instanceof Uint8Array))throw new Error("Expected Uint8Array");if(lengths.length>0&&!lengths.includes(b.length))throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`)}function exists(instance,checkFinished=true){if(instance.destroyed)throw new Error("Hash instance has been destroyed");if(checkFinished&&instance.finished)throw new Error("Hash#digest() has already been called")}function output(out,instance){bytes(out);const min=instance.outputLen;if(out.length>_32n&U32_MASK64)};return{h:Number(n>>_32n&U32_MASK64)|0,l:Number(n&U32_MASK64)|0}}function split(lst,le=false){let Ah=new Uint32Array(lst.length);let Al=new Uint32Array(lst.length);for(let i=0;iBigInt(h>>>0)<<_32n|BigInt(l>>>0);const shrSH=(h,_l,s)=>h>>>s;const shrSL=(h,l,s)=>h<<32-s|l>>>s;const rotrSH=(h,l,s)=>h>>>s|l<<32-s;const rotrSL=(h,l,s)=>h<<32-s|l>>>s;const rotrBH=(h,l,s)=>h<<64-s|l>>>s-32;const rotrBL=(h,l,s)=>h>>>s-32|l<<64-s;const rotr32H=(_h,l)=>l;const rotr32L=(h,_l)=>h;const rotlSH=(h,l,s)=>h<>>32-s;const rotlSL=(h,l,s)=>l<>>32-s;const rotlBH=(h,l,s)=>l<>>64-s;const rotlBL=(h,l,s)=>h<>>64-s;function add(Ah,Al,Bh,Bl){const l=(Al>>>0)+(Bl>>>0);return{h:Ah+Bh+(l/2**32|0)|0,l:l|0}}const add3L=(Al,Bl,Cl)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0);const add3H=(low,Ah,Bh,Ch)=>Ah+Bh+Ch+(low/2**32|0)|0;const add4L=(Al,Bl,Cl,Dl)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0)+(Dl>>>0);const add4H=(low,Ah,Bh,Ch,Dh)=>Ah+Bh+Ch+Dh+(low/2**32|0)|0;const add5L=(Al,Bl,Cl,Dl,El)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0)+(Dl>>>0)+(El>>>0);const add5H=(low,Ah,Bh,Ch,Dh,Eh)=>Ah+Bh+Ch+Dh+Eh+(low/2**32|0)|0;const u64={fromBig:fromBig,split:split,toBig:toBig,shrSH:shrSH,shrSL:shrSL,rotrSH:rotrSH,rotrSL:rotrSL,rotrBH:rotrBH,rotrBL:rotrBL,rotr32H:rotr32H,rotr32L:rotr32L,rotlSH:rotlSH,rotlSL:rotlSL,rotlBH:rotlBH,rotlBL:rotlBL,add:add,add3L:add3L,add3H:add3H,add4L:add4L,add4H:add4H,add5H:add5H,add5L:add5L};var u64$1=u64;const u8a=a=>a instanceof Uint8Array;const u32=arr=>new Uint32Array(arr.buffer,arr.byteOffset,Math.floor(arr.byteLength/4));const createView=arr=>new DataView(arr.buffer,arr.byteOffset,arr.byteLength);const rotr=(word,shift)=>word<<32-shift|word>>>shift;const isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes(str){if(typeof str!=="string")throw new Error(`utf8ToBytes expected string, got ${typeof str}`);return new Uint8Array((new TextEncoder).encode(str))}function toBytes(data){if(typeof data==="string")data=utf8ToBytes(data);if(!u8a(data))throw new Error(`expected Uint8Array, got ${typeof data}`);return data}class Hash{clone(){return this._cloneInto()}}function wrapConstructor(hashCons){const hashC=msg=>hashCons().update(toBytes(msg)).digest();const tmp=hashCons();hashC.outputLen=tmp.outputLen;hashC.blockLen=tmp.blockLen;hashC.create=()=>hashCons();return hashC}const[SHA3_PI,SHA3_ROTL,_SHA3_IOTA]=[[],[],[]];const _0n=BigInt(0);const _1n=BigInt(1);const _2n=BigInt(2);const _7n=BigInt(7);const _256n=BigInt(256);const _0x71n=BigInt(113);for(let round=0,R=_1n,x=1,y=0;round<24;round++){[x,y]=[y,(2*x+3*y)%5];SHA3_PI.push(2*(5*y+x));SHA3_ROTL.push((round+1)*(round+2)/2%64);let t=_0n;for(let j=0;j<7;j++){R=(R<<_1n^(R>>_7n)*_0x71n)%_256n;if(R&_2n)t^=_1n<<(_1n<s>32?rotlBH(h,l,s):rotlSH(h,l,s);const rotlL=(h,l,s)=>s>32?rotlBL(h,l,s):rotlSL(h,l,s);function keccakP(s,rounds=24){const B=new Uint32Array(5*2);for(let round=24-rounds;round<24;round++){for(let x=0;x<10;x++)B[x]=s[x]^s[x+10]^s[x+20]^s[x+30]^s[x+40];for(let x=0;x<10;x+=2){const idx1=(x+8)%10;const idx0=(x+2)%10;const B0=B[idx0];const B1=B[idx0+1];const Th=rotlH(B0,B1,1)^B[idx1];const Tl=rotlL(B0,B1,1)^B[idx1+1];for(let y=0;y<50;y+=10){s[x+y]^=Th;s[x+y+1]^=Tl}}let curH=s[2];let curL=s[3];for(let t=0;t<24;t++){const shift=SHA3_ROTL[t];const Th=rotlH(curH,curL,shift);const Tl=rotlL(curH,curL,shift);const PI=SHA3_PI[t];curH=s[PI];curL=s[PI+1];s[PI]=Th;s[PI+1]=Tl}for(let y=0;y<50;y+=10){for(let x=0;x<10;x++)B[x]=s[y+x];for(let x=0;x<10;x++)s[y+x]^=~B[(x+2)%10]&B[(x+4)%10]}s[0]^=SHA3_IOTA_H[round];s[1]^=SHA3_IOTA_L[round]}B.fill(0)}class Keccak extends Hash{constructor(blockLen,suffix,outputLen,enableXOF=false,rounds=24){super();this.blockLen=blockLen;this.suffix=suffix;this.outputLen=outputLen;this.enableXOF=enableXOF;this.rounds=rounds;this.pos=0;this.posOut=0;this.finished=false;this.destroyed=false;number(outputLen);if(0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200);this.state32=u32(this.state)}keccak(){keccakP(this.state32,this.rounds);this.posOut=0;this.pos=0}update(data){exists(this);const{blockLen,state}=this;data=toBytes(data);const len=data.length;for(let pos=0;pos=blockLen)this.keccak();const take=Math.min(blockLen-this.posOut,len-pos);out.set(bufferOut.subarray(this.posOut,this.posOut+take),pos);this.posOut+=take;pos+=take}return out}xofInto(out){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(out)}xof(bytes){number(bytes);return this.xofInto(new Uint8Array(bytes))}digestInto(out){output(out,this);if(this.finished)throw new Error("digest() was already called");this.writeInto(out);this.destroy();return out}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=true;this.state.fill(0)}_cloneInto(to){const{blockLen,suffix,outputLen,rounds,enableXOF}=this;to||(to=new Keccak(blockLen,suffix,outputLen,enableXOF,rounds));to.state32.set(this.state32);to.pos=this.pos;to.posOut=this.posOut;to.finished=this.finished;to.rounds=rounds;to.suffix=suffix;to.outputLen=outputLen;to.enableXOF=enableXOF;to.destroyed=this.destroyed;return to}}const gen=(suffix,blockLen,outputLen)=>wrapConstructor(()=>new Keccak(blockLen,suffix,outputLen));const sha3_256=gen(6,136,256/8);const sha3_512=gen(6,72,512/8);const keccak_256=gen(1,136,256/8);let _permanentCensorErrors=false;let _censorErrors=false;const LogLevels={debug:1,default:2,info:2,warning:3,error:4,off:5};let _logLevel=LogLevels["default"];let _globalLogger=null;function _checkNormalize(){try{const missing=[];["NFD","NFC","NFKD","NFKC"].forEach(form=>{try{if("test".normalize(form)!=="test"){throw new Error("bad normalize")}}catch(error){missing.push(form)}});if(missing.length){throw new Error("missing "+missing.join(", "))}if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769)){throw new Error("broken implementation")}}catch(error){return error.message}return null}const _normalizeError=_checkNormalize();var LogLevel;(function(LogLevel){LogLevel["DEBUG"]="DEBUG";LogLevel["INFO"]="INFO";LogLevel["WARNING"]="WARNING";LogLevel["ERROR"]="ERROR";LogLevel["OFF"]="OFF"})(LogLevel||(LogLevel={}));var ErrorCode;(function(ErrorCode){ErrorCode["UNKNOWN_ERROR"]="UNKNOWN_ERROR";ErrorCode["NOT_IMPLEMENTED"]="NOT_IMPLEMENTED";ErrorCode["UNSUPPORTED_OPERATION"]="UNSUPPORTED_OPERATION";ErrorCode["NETWORK_ERROR"]="NETWORK_ERROR";ErrorCode["SERVER_ERROR"]="SERVER_ERROR";ErrorCode["TIMEOUT"]="TIMEOUT";ErrorCode["BUFFER_OVERRUN"]="BUFFER_OVERRUN";ErrorCode["NUMERIC_FAULT"]="NUMERIC_FAULT";ErrorCode["MISSING_NEW"]="MISSING_NEW";ErrorCode["INVALID_ARGUMENT"]="INVALID_ARGUMENT";ErrorCode["MISSING_ARGUMENT"]="MISSING_ARGUMENT";ErrorCode["UNEXPECTED_ARGUMENT"]="UNEXPECTED_ARGUMENT";ErrorCode["CALL_EXCEPTION"]="CALL_EXCEPTION";ErrorCode["INSUFFICIENT_FUNDS"]="INSUFFICIENT_FUNDS";ErrorCode["NONCE_EXPIRED"]="NONCE_EXPIRED";ErrorCode["REPLACEMENT_UNDERPRICED"]="REPLACEMENT_UNDERPRICED";ErrorCode["UNPREDICTABLE_ENERGY_LIMIT"]="UNPREDICTABLE_ENERGY_LIMIT";ErrorCode["TRANSACTION_REPLACED"]="TRANSACTION_REPLACED"})(ErrorCode||(ErrorCode={}));const HEX="0123456789abcdef";class Logger{version="0.0.1";static errors=ErrorCode;static levels=LogLevel;constructor(version){Object.defineProperty(this,"version",{enumerable:true,value:version,writable:false})}_log(logLevel,args){const level=logLevel.toLowerCase();if(LogLevels[level]==null){this.throwArgumentError("invalid log level name","logLevel",logLevel)}if(_logLevel>LogLevels[level]){return}console.log.apply(console,args)}debug(...args){this._log(Logger.levels.DEBUG,args)}info(...args){this._log(Logger.levels.INFO,args)}warn(...args){this._log(Logger.levels.WARNING,args)}makeError(message,code,params){if(_censorErrors){return this.makeError("censored error",code,{})}if(!code){code=Logger.errors.UNKNOWN_ERROR}if(!params){params={}}const messageDetails=[];Object.keys(params).forEach(key=>{const value=params[key];try{if(value instanceof Uint8Array){let hex="";for(let i=0;i>4];hex+=HEX[value[i]&15]}messageDetails.push(key+"=Uint8Array(0x"+hex+")")}else{messageDetails.push(key+"="+JSON.stringify(value))}}catch(error){messageDetails.push(key+"="+JSON.stringify(params[key].toString()))}});messageDetails.push(`code=${code}`);messageDetails.push(`version=${this.version}`);const reason=message;if(messageDetails.length){message+=" ("+messageDetails.join(", ")+")"}const error=new Error(message);error.reason=reason;error.code=code;Object.keys(params).forEach(function(key){error[key]=params[key]});return error}throwError(message,code,params){throw this.makeError(message,code,params)}throwArgumentError(message,name,value){return this.throwError(message,Logger.errors.INVALID_ARGUMENT,{argument:name,value:value})}assert(condition,message,code,params){if(!!condition){return}this.throwError(message,code,params)}assertArgument(condition,message,name,value){if(!!condition){return}this.throwArgumentError(message,name,value)}checkNormalize(message){if(_normalizeError){this.throwError("platform missing String.prototype.normalize",Logger.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_normalizeError})}}checkSafeUint53(value,message){if(typeof value!=="number"){return}if(message==null){message="value not safe"}if(value<0||value>=9007199254740991){this.throwError(message,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:value})}if(value%1){this.throwError(message,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:value})}}checkArgumentCount(count,expectedCount,message){if(message){message=": "+message}else{message=""}if(countexpectedCount){this.throwError("too many arguments"+message,Logger.errors.UNEXPECTED_ARGUMENT,{count:count,expectedCount:expectedCount})}}checkNew(target,kind){if(target===Object||target==null){this.throwError("missing new",Logger.errors.MISSING_NEW,{name:kind.name})}}checkAbstract(target,kind){if(target===kind){this.throwError("cannot instantiate abstract class "+JSON.stringify(kind.name)+" directly; use a sub-class",Logger.errors.UNSUPPORTED_OPERATION,{name:target.name,operation:"new"})}else if(target===Object||target==null){this.throwError("missing new",Logger.errors.MISSING_NEW,{name:kind.name})}}static globalLogger(){if(!_globalLogger){_globalLogger=new Logger("logger/0.0.1")}return _globalLogger}static setCensorship(censorship,permanent){if(!censorship&&permanent){this.globalLogger().throwError("cannot permanently disable censorship",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}if(_permanentCensorErrors){if(!censorship){return}this.globalLogger().throwError("error censorship permanent",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_censorErrors=!!censorship;_permanentCensorErrors=!!permanent}static setLogLevel(logLevel){const level=LogLevels[logLevel.toLowerCase()];if(level==null){Logger.globalLogger().warn("invalid log level - "+logLevel);return}_logLevel=level}static from(version){return new Logger(version)}}const version="6.4.0";function checkType(value,type,name){const types=type.split("|").map(t=>t.trim());for(let i=0;i>4];result+=HEX[value[i]&15]}return result}if(typeof value==="object"&&typeof value.toJSON==="function"){return stringify(value.toJSON())}switch(typeof value){case"boolean":case"symbol":return value.toString();case"bigint":return BigInt(value).toString();case"number":return value.toString();case"string":return JSON.stringify(value);case"object":{const keys=Object.keys(value);keys.sort();return"{ "+keys.map(k=>`${stringify(k)}: ${stringify(value[k])}`).join(", ")+" }"}}return`[ COULD NOT SERIALIZE ]`}function makeError(message,code,info){{const details=[];if(info){if("message"in info||"code"in info||"name"in info){throw new Error(`value will overwrite populated values: ${stringify(info)}`)}for(const key in info){const value=info[key];details.push(key+"="+stringify(value))}}details.push(`code=${code}`);details.push(`version=${version}`);if(details.length){message+=" ("+details.join(", ")+")"}}let error;switch(code){case"INVALID_ARGUMENT":error=new TypeError(message);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":error=new RangeError(message);break;default:error=new Error(message)}defineProperties(error,{code:code});if(info){Object.assign(error,info)}return error}function assert(check,message,code,info){if(!check){throw makeError(message,code,info)}}function assertArgument(check,message,name,value){assert(check,message,"INVALID_ARGUMENT",{argument:name,value:value})}const _normalizeForms=["NFD","NFC","NFKD","NFKC"].reduce((accum,form)=>{try{if("test".normalize(form)!=="test"){throw new Error("bad")}if(form==="NFD"){const check=String.fromCharCode(233).normalize("NFD");const expected=String.fromCharCode(101,769);if(check!==expected){throw new Error("broken")}}accum.push(form)}catch(error){}return accum},[]);function assertNormalize(form){assert(_normalizeForms.indexOf(form)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:form}})}const logger=new Logger("utils/data/0.0.1");function isHexable(value){return!!value.toHexString}function isInteger(value){return typeof value==="number"&&value==value&&value%1===0}function isBytes(value){if(value==null){return false}if(value.constructor===Uint8Array){return true}if(typeof value==="string"){return false}if(!isInteger(value.length)||value.length<0){return false}for(let i=0;i=256){return false}}return true}function _getBytes(value,name,copy){if(value instanceof Uint8Array){if(copy){return new Uint8Array(value)}return value}if(typeof value==="string"&&value.match(/^0x([0-9a-f][0-9a-f])*$/i)){const result=new Uint8Array((value.length-2)/2);let offset=2;for(let i=0;iNumber(item));value=new Uint8Array(v)}}if(typeof value==="number"){logger.checkSafeUint53(value,"invalid hexlify value");let hex="";while(value){hex=HexCharacters[value&15]+hex;value=Math.floor(value/16)}if(hex.length){if(hex.length%2){hex="0"+hex}return"0x"+hex}return"0x00"}if(typeof value==="bigint"){value=value.toString(16);if(value.length%2){return"0x0"+value}return"0x"+value}if(options.allowMissingPrefix&&typeof value==="string"&&value.substring(0,2)!=="0x"){value="0x"+value}if(isHexable(value)){return value.toHexString()}if(isHexString(value)){if(value.length%2){if(options.hexPad==="left"){value="0x0"+value.substring(2)}else if(options.hexPad==="right"){value+="0"}else{logger.throwArgumentError("hex data is odd-length","value",value)}}return value.toLowerCase()}if(isBytes(value)){let result="0x";for(let i=0;i>4]+HexCharacters[v&15]}return result}return logger.throwArgumentError("invalid hexlify value","value",value)}function arrayify(value,options){if(!options){options={}}if(typeof value==="number"){logger.checkSafeUint53(value,"invalid arrayify value");const result=[];while(value){result.unshift(value&255);value=parseInt(String(value/256))}if(result.length===0){result.push(0)}return addSlice(new Uint8Array(result))}if(options.allowMissingPrefix&&typeof value==="string"&&value.substring(0,2)!=="0x"){value="0x"+value}if(isHexable(value)){value=value.toHexString()}if(isHexString(value)){let hex=value.substring(2);if(hex.length%2){if(options.hexPad==="left"){hex="0x0"+hex.substring(2)}else if(options.hexPad==="right"){hex+="0"}else{logger.throwArgumentError("hex data is odd-length","value",value)}}const result=[];for(let i=0;i>6!==2){break}i++}return i}if(reason==="OVERRUN"){return bytes.length-offset-1}return 0}function replaceFunc(reason,offset,bytes,output,badCodepoint){if(reason==="OVERLONG"){assertArgument(typeof badCodepoint==="number","invalid bad code point for replacement","badCodepoint",badCodepoint);output.push(badCodepoint);return 0}output.push(65533);return ignoreFunc(reason,offset,bytes)}const Utf8ErrorFuncs=Object.freeze({error:errorFunc,ignore:ignoreFunc,replace:replaceFunc});function getUtf8CodePoints(_bytes,onError){if(onError==null){onError=Utf8ErrorFuncs.error}const bytes=getBytes(_bytes,"bytes");const result=[];let i=0;while(i>7===0){result.push(c);continue}let extraLength=null;let overlongMask=null;if((c&224)===192){extraLength=1;overlongMask=127}else if((c&240)===224){extraLength=2;overlongMask=2047}else if((c&248)===240){extraLength=3;overlongMask=65535}else{if((c&192)===128){i+=onError("UNEXPECTED_CONTINUE",i-1,bytes,result)}else{i+=onError("BAD_PREFIX",i-1,bytes,result)}continue}if(i-1+extraLength>=bytes.length){i+=onError("OVERRUN",i-1,bytes,result);continue}let res=c&(1<<8-extraLength-1)-1;for(let j=0;j1114111){i+=onError("OUT_OF_RANGE",i-1-extraLength,bytes,result,res);continue}if(res>=55296&&res<=57343){i+=onError("UTF16_SURROGATE",i-1-extraLength,bytes,result,res);continue}if(res<=overlongMask){i+=onError("OVERLONG",i-1-extraLength,bytes,result,res);continue}result.push(res)}return result}function toUtf8Bytes(str,form){if(form!=null){assertNormalize(form);str=str.normalize(form)}let result=[];for(let i=0;i>6|192);result.push(c&63|128)}else if((c&64512)==55296){i++;const c2=str.charCodeAt(i);assertArgument(i>18|240);result.push(pair>>12&63|128);result.push(pair>>6&63|128);result.push(pair&63|128)}else{result.push(c>>12|224);result.push(c>>6&63|128);result.push(c&63|128)}}return new Uint8Array(result)}function _toUtf8String(codePoints){return codePoints.map(codePoint=>{if(codePoint<=65535){return String.fromCharCode(codePoint)}codePoint-=65536;return String.fromCharCode((codePoint>>10&1023)+55296,(codePoint&1023)+56320)}).join("")}function toUtf8String(bytes,onError){return _toUtf8String(getUtf8CodePoints(bytes,onError))}let locked=false;const _keccak256=function(data){return keccak_256(data)};let __keccak256=_keccak256;function keccak256(_data){const data=getBytes(_data,"data");return hexlify(__keccak256(data))}keccak256._=_keccak256;keccak256.lock=function(){locked=true};keccak256.register=function(func){if(locked){throw new TypeError("keccak256 is locked")}__keccak256=func};Object.freeze(keccak256);function setBigUint64(view,byteOffset,value,isLE){if(typeof view.setBigUint64==="function")return view.setBigUint64(byteOffset,value,isLE);const _32n=BigInt(32);const _u32_max=BigInt(4294967295);const wh=Number(value>>_32n&_u32_max);const wl=Number(value&_u32_max);const h=isLE?4:0;const l=isLE?0:4;view.setUint32(byteOffset+h,wh,isLE);view.setUint32(byteOffset+l,wl,isLE)}class SHA2 extends Hash{constructor(blockLen,outputLen,padOffset,isLE){super();this.blockLen=blockLen;this.outputLen=outputLen;this.padOffset=padOffset;this.isLE=isLE;this.finished=false;this.length=0;this.pos=0;this.destroyed=false;this.buffer=new Uint8Array(blockLen);this.view=createView(this.buffer)}update(data){exists(this);const{view,buffer,blockLen}=this;data=toBytes(data);const len=data.length;for(let pos=0;posblockLen-pos){this.process(view,0);pos=0}for(let i=pos;istate.length)throw new Error("_sha2: outputLen bigger than state");for(let i=0;ia&b^~a&c;const Maj=(a,b,c)=>a&b^a&c^b&c;const SHA256_K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);const IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);const SHA256_W=new Uint32Array(64);class SHA256 extends SHA2{constructor(){super(64,32,8,false);this.A=IV[0]|0;this.B=IV[1]|0;this.C=IV[2]|0;this.D=IV[3]|0;this.E=IV[4]|0;this.F=IV[5]|0;this.G=IV[6]|0;this.H=IV[7]|0}get(){const{A,B,C,D,E,F,G,H}=this;return[A,B,C,D,E,F,G,H]}set(A,B,C,D,E,F,G,H){this.A=A|0;this.B=B|0;this.C=C|0;this.D=D|0;this.E=E|0;this.F=F|0;this.G=G|0;this.H=H|0}process(view,offset){for(let i=0;i<16;i++,offset+=4)SHA256_W[i]=view.getUint32(offset,false);for(let i=16;i<64;i++){const W15=SHA256_W[i-15];const W2=SHA256_W[i-2];const s0=rotr(W15,7)^rotr(W15,18)^W15>>>3;const s1=rotr(W2,17)^rotr(W2,19)^W2>>>10;SHA256_W[i]=s1+SHA256_W[i-7]+s0+SHA256_W[i-16]|0}let{A,B,C,D,E,F,G,H}=this;for(let i=0;i<64;i++){const sigma1=rotr(E,6)^rotr(E,11)^rotr(E,25);const T1=H+sigma1+Chi(E,F,G)+SHA256_K[i]+SHA256_W[i]|0;const sigma0=rotr(A,2)^rotr(A,13)^rotr(A,22);const T2=sigma0+Maj(A,B,C)|0;H=G;G=F;F=E;E=D+T1|0;D=C;C=B;B=A;A=T1+T2|0}A=A+this.A|0;B=B+this.B|0;C=C+this.C|0;D=D+this.D|0;E=E+this.E|0;F=F+this.F|0;G=G+this.G|0;H=H+this.H|0;this.set(A,B,C,D,E,F,G,H)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0);this.buffer.fill(0)}}const sha256$1=wrapConstructor(()=>new SHA256);const[SHA512_Kh,SHA512_Kl]=(()=>u64$1.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))))();const SHA512_W_H=new Uint32Array(80);const SHA512_W_L=new Uint32Array(80);class SHA512 extends SHA2{constructor(){super(128,64,16,false);this.Ah=1779033703|0;this.Al=4089235720|0;this.Bh=3144134277|0;this.Bl=2227873595|0;this.Ch=1013904242|0;this.Cl=4271175723|0;this.Dh=2773480762|0;this.Dl=1595750129|0;this.Eh=1359893119|0;this.El=2917565137|0;this.Fh=2600822924|0;this.Fl=725511199|0;this.Gh=528734635|0;this.Gl=4215389547|0;this.Hh=1541459225|0;this.Hl=327033209|0}get(){const{Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl}=this;return[Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl]}set(Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl){this.Ah=Ah|0;this.Al=Al|0;this.Bh=Bh|0;this.Bl=Bl|0;this.Ch=Ch|0;this.Cl=Cl|0;this.Dh=Dh|0;this.Dl=Dl|0;this.Eh=Eh|0;this.El=El|0;this.Fh=Fh|0;this.Fl=Fl|0;this.Gh=Gh|0;this.Gl=Gl|0;this.Hh=Hh|0;this.Hl=Hl|0}process(view,offset){for(let i=0;i<16;i++,offset+=4){SHA512_W_H[i]=view.getUint32(offset);SHA512_W_L[i]=view.getUint32(offset+=4)}for(let i=16;i<80;i++){const W15h=SHA512_W_H[i-15]|0;const W15l=SHA512_W_L[i-15]|0;const s0h=u64$1.rotrSH(W15h,W15l,1)^u64$1.rotrSH(W15h,W15l,8)^u64$1.shrSH(W15h,W15l,7);const s0l=u64$1.rotrSL(W15h,W15l,1)^u64$1.rotrSL(W15h,W15l,8)^u64$1.shrSL(W15h,W15l,7);const W2h=SHA512_W_H[i-2]|0;const W2l=SHA512_W_L[i-2]|0;const s1h=u64$1.rotrSH(W2h,W2l,19)^u64$1.rotrBH(W2h,W2l,61)^u64$1.shrSH(W2h,W2l,6);const s1l=u64$1.rotrSL(W2h,W2l,19)^u64$1.rotrBL(W2h,W2l,61)^u64$1.shrSL(W2h,W2l,6);const SUMl=u64$1.add4L(s0l,s1l,SHA512_W_L[i-7],SHA512_W_L[i-16]);const SUMh=u64$1.add4H(SUMl,s0h,s1h,SHA512_W_H[i-7],SHA512_W_H[i-16]);SHA512_W_H[i]=SUMh|0;SHA512_W_L[i]=SUMl|0}let{Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl}=this;for(let i=0;i<80;i++){const sigma1h=u64$1.rotrSH(Eh,El,14)^u64$1.rotrSH(Eh,El,18)^u64$1.rotrBH(Eh,El,41);const sigma1l=u64$1.rotrSL(Eh,El,14)^u64$1.rotrSL(Eh,El,18)^u64$1.rotrBL(Eh,El,41);const CHIh=Eh&Fh^~Eh&Gh;const CHIl=El&Fl^~El&Gl;const T1ll=u64$1.add5L(Hl,sigma1l,CHIl,SHA512_Kl[i],SHA512_W_L[i]);const T1h=u64$1.add5H(T1ll,Hh,sigma1h,CHIh,SHA512_Kh[i],SHA512_W_H[i]);const T1l=T1ll|0;const sigma0h=u64$1.rotrSH(Ah,Al,28)^u64$1.rotrBH(Ah,Al,34)^u64$1.rotrBH(Ah,Al,39);const sigma0l=u64$1.rotrSL(Ah,Al,28)^u64$1.rotrBL(Ah,Al,34)^u64$1.rotrBL(Ah,Al,39);const MAJh=Ah&Bh^Ah&Ch^Bh&Ch;const MAJl=Al&Bl^Al&Cl^Bl&Cl;Hh=Gh|0;Hl=Gl|0;Gh=Fh|0;Gl=Fl|0;Fh=Eh|0;Fl=El|0;({h:Eh,l:El}=u64$1.add(Dh|0,Dl|0,T1h|0,T1l|0));Dh=Ch|0;Dl=Cl|0;Ch=Bh|0;Cl=Bl|0;Bh=Ah|0;Bl=Al|0;const All=u64$1.add3L(T1l,sigma0l,MAJl);Ah=u64$1.add3H(All,T1h,sigma0h,MAJh);Al=All|0}({h:Ah,l:Al}=u64$1.add(this.Ah|0,this.Al|0,Ah|0,Al|0));({h:Bh,l:Bl}=u64$1.add(this.Bh|0,this.Bl|0,Bh|0,Bl|0));({h:Ch,l:Cl}=u64$1.add(this.Ch|0,this.Cl|0,Ch|0,Cl|0));({h:Dh,l:Dl}=u64$1.add(this.Dh|0,this.Dl|0,Dh|0,Dl|0));({h:Eh,l:El}=u64$1.add(this.Eh|0,this.El|0,Eh|0,El|0));({h:Fh,l:Fl}=u64$1.add(this.Fh|0,this.Fl|0,Fh|0,Fl|0));({h:Gh,l:Gl}=u64$1.add(this.Gh|0,this.Gl|0,Gh|0,Gl|0));({h:Hh,l:Hl}=u64$1.add(this.Hh|0,this.Hl|0,Hh|0,Hl|0));this.set(Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl)}roundClean(){SHA512_W_H.fill(0);SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0);this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha512=wrapConstructor(()=>new SHA512);function getGlobal(){if(typeof self!=="undefined"){return self}if(typeof window!=="undefined"){return window}if(typeof global!=="undefined"){return global}throw new Error("unable to locate global object")}const anyGlobal=getGlobal();anyGlobal.crypto||anyGlobal.msCrypto;function createHash(algo){switch(algo){case"sha256":return sha256$1.create();case"sha512":return sha512.create();case"sha3-256":return sha3_256.create();case"sha3-512":return sha3_512.create()}assertArgument(false,"invalid hashing algorithm name","algorithm",algo)}const _sha256=function(data){let v="0x"+createHash("sha3-256").update(Buffer.from(arrayify(data))).digest("hex");return v};let locked256=false;var SupportedAlgorithm;(function(SupportedAlgorithm){SupportedAlgorithm["sha256"]="sha256";SupportedAlgorithm["sha512"]="sha512"})(SupportedAlgorithm||(SupportedAlgorithm={}));function sha256(data){let createdHash=createHash("sha3-256").update(Buffer.from(arrayify(data))).digest("hex");const v="0x"+createdHash;if(typeof createdHash!=="string"){createdHash=hexlify(createdHash);return createdHash}return v}sha256._=_sha256;sha256.lock=function(){locked256=true};sha256.register=function(func){if(locked256){throw new Error("sha256 is locked")}};Object.freeze(sha256);Object.freeze(sha256);function id(value,useKeccak){if(useKeccak){return keccak256(toUtf8Bytes(value))}return sha256(toUtf8Bytes(value))}const subsChrs=" !#$%&'()*+,-./<=>?@[]^_`{|}~";const Word=/^[a-z]*$/i;function unfold(words,sep){let initial=97;return words.reduce((accum,word)=>{if(word===sep){initial++}else if(word.match(Word)){accum.push(String.fromCharCode(initial)+word)}else{initial=97;accum.push(word)}return accum},[])}function decode(data,subs){for(let i=subsChrs.length-1;i>=0;i--){data=data.split(subsChrs[i]).join(subs.substring(2*i,2*i+2))}const clumps=[];const leftover=data.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(all,item,semi,word)=>{if(semi){for(let i=parseInt(semi);i>=0;i--){clumps.push(";")}}else{clumps.push(item.toLowerCase())}return""});if(leftover){throw new Error(`leftovers: ${JSON.stringify(leftover)}`)}return unfold(unfold(clumps,";"),":")}function decodeOwl(data){assertArgument(data[0]==="0","unsupported auwl data","data",data);return decode(data.substring(1+2*subsChrs.length),data.substring(1,1+2*subsChrs.length))}class Wordlist{locale;constructor(locale){defineProperties(this,{locale:locale})}split(phrase){return phrase.toLowerCase().split(/\s+/g)}join(words){return words.join(" ")}static check(wordlist){const words=[];for(let i=0;i<2048;i++){const word=wordlist.getWord(i);if(i!==wordlist.getWordIndex(word)){return"0x"}words.push(word)}return id(words.join("\n")+"\n")}}class WordlistOwl extends Wordlist{#data;#checksum;constructor(locale,data,checksum){super(locale);this.#data=data;this.#checksum=checksum;this.#words=null}get _data(){return this.#data}_decodeWords(){return decodeOwl(this.#data)}#words;#loadWords(){if(this.#words==null){const words=this._decodeWords();const checksum=id(words.join("\n")+"\n",true);if(checksum!==this.#checksum){throw new Error(`BIP39 Wordlist for ${this.locale} FffffAILED`)}this.#words=words}return this.#words}getWord(index){const words=this.#loadWords();assertArgument(index>=0&&index=width){const value=accum>>bits-width;accum&=(1<{const match=accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);assertArgument(match!==null,"internal error parsing accents","accents",accents);let posOffset=0;const positions=decodeBits(parseInt(match[3]),match[4]);const charCode=parseInt(match[2]);const regex=new RegExp(`([${match[1]}])`,"g");words=words.replace(regex,(all,letter)=>{const rem=--positions[posOffset];if(rem===0){letter=String.fromCharCode(letter.charCodeAt(0),charCode);posOffset++}return letter})});return words.split(",")}class WordlistOwlA extends WordlistOwl{#accent;constructor(locale,data,accent,checksum){super(locale,data,checksum);this.#accent=accent}get _accent(){return this.#accent}_decodeWords(){return decodeOwlA(this._data,this._accent)}}const words$3="0arertoiotadonoaRteirroenaNonaLsolocoiliaralaorrenadaChoN$n0A>Dom,EjaI!#Oga&O'Or#RazoR*Ue=U<0Ab Adem@CeLe%OmoRa!RozUn0DazD$GeLaM,#S,)T^0AlAnceA+EEl]`E`EstruzI.I<2ErU{U'0Af[nArO)Uc Uf_Ul:BaB^|eH@IleJ Lanz/c.LdeMbuN>Nd-oRb(>RnizR+Scu]S#nSu[Tal]T!@T*Tu%UlZ 3BeBid/=S SoSt@3|oEnNgo2An>OqueUsa2ABi`BoCaCi`DaDegaIn//!oLsaMb-{dNi#N}saiRdeRr SqueTeTinVe{Zal2AvoAzoEchaEveIl=In>IsaOcaOmaOnceO)UjaUs>U#2CeoCleE'EyFan{F.HoIt_L#Rbuj(l(+Sc TacaZ.:Bal=BezaBi`B[CaoDav!D,aErFeI{ImanJaJ.LLam Lc$L&Li{dLleLm/^LvoMaMb$Mel=Mi'Mp}c!Nd?Nel-gu+Nic-#N-.ObaOsPazPi%nPo)Pt Puch((b.RcelRe%Rg(i'RneRpe%R+R%SaS>S!oSpaS#rT^ceT_U{lUsaZo3Bol]D!D+Ld/eb_LoAmpuAnc]ApaAr]I>Is)IvoOqueOzaUle%Up 0Cl.EgoE=EnEr#F[G +M->NeN%P_sR>Rue]SneTaU{d2Am^AnA+AseAveI,)ImaInica2B_Cc~|i'Ci`CoDigoDoF_G!He)JinJoL/ch/eg$Lg Lin/l LmoLum`Mba)M!Mi{Mo&Mpr-deNej}g-oc!Nsej}t PaPi(az.Rba%RchoR&nR.(r!S!SmosS%2AneoAt!E Ec!Ei&EmaIaIm,Ip%IsisOmoOnicaOque%U&Uz2Ad+Ar#At+BoBr*| aEl=En#Er{Es%EvaId Lebr/p/#Mb_Mpl*N-e%O%P.Pul( R$Se'Sf[zVaVi'5BleCeL^Ming}N Ra&Rm*RAu%EchaOrO%U*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que)R Rcel(edR*RoRpa&RqueR[foR)S SeoS~SoS%TaT$Tr@UsaU%VoYa<3A#nCa&C!a|oDalD*G IneL L{'Le/ig+LlejoLoLuc--s N.OnOrPi'Que'R(ch(d!Rez(f?Ri>Rl(mizEgun%Em$EnsaE|!oD^Eb=Er%Es#Lg/*Lm.LpoLrNd*N%P #Pet*PoN{PaP!oSaScaSt+T 5BiB^DoE{G*I&In/e%LoMboM^Ptu[TaTi`:Ba&B!B$BleC GazG[&L/&L!oL*Lm.L.Ls/#LudLv Mb-c~Ndi-e Ng_Ni{dN}#PoQueRdin()nSt_TanU`Xof.3Cc~CoC_#C%DGu*IsL=LvaMa`M?l-d-Re'Rg*S#T?:Ba>BiqueB]BuCoC#JoL L>L,#Ll/.Ma'Mb^Ng}quePaPe)P@P.Qu?l(deRe(if(je%RotR+R%TuajeU+ZaZ.3At+|oC]CnicaJa&J!Ji&L/efo'MaM^Mp=NazNd!N!NisNRmi'Rnur(+rSisSo+StigoT!aX#Z3B$Bu+nEmpoEn{Er[EPoR(.TanT!eTu=Za5Al]B?=C Ci'DoG/&M N}#P PeQueRaxR!oRm,%RneoRoRpe&R_RS!Xi>2AbajoAc#rA!Afi>AgoAjeAmoAnceA#AumaAz EbolEguaEin%EnEp EsIbuIgoIpaIs)IunfoOfeoOmpaOn>OpaO)OzoU>Ue'Ufa2B!@BoEr#MbaM^NelNic(bin(ismoR'T^:0Ic 9C!a0B[l0I{dIrIv!b){return 1}return 0}for(let length=3;length<=9;length++){const d=data$2[length-3];for(let offset=0;offset=0&&index=40){code=code+168-40}else if(code>=19){code=code+97-19}return toUtf8String(new Uint8Array([225,(code>>6)+132,(code&63)+128]))}let _wordlist$1=null;function loadWords$1(){if(_wordlist$1!=null){return _wordlist$1}const wordlist=[];data$1.forEach((data,length)=>{length+=4;for(let i=0;i=0&&index>2),128+codes.indexOf(data[i*3+1]),128+codes.indexOf(data[i*3+2])];if(locale==="zh_tw"){const common=s%4;for(let i=common;i<3;i++){bytes[i]=codes.indexOf(deltaData[deltaOffset++])+(i==0?228:128)}}wordlist.push(toUtf8String(new Uint8Array(bytes)))}const checksum=id(wordlist.join("\n")+"\n");if(checksum!==Checks[locale]){throw new Error(`BIP39 Wordlist for ${locale} (Chinese) FAILED`)}_wordlist[locale]=wordlist;return wordlist}const wordlists={};class LangZh extends Wordlist{constructor(dialect){super("zh_"+dialect)}getWord(index){const words=loadWords(this.locale);assertArgument(index>=0&&index; -} -export interface TestBlockchainBlock { - test: string; - hash: string; - parentHash: string; - number: number; - timestamp: number; - nonce: string; - difficulty: bigint; - energyLimit: bigint; - energyUsed: bigint; - miner: string; - extraData: string; - transactions: Array; - baseFeePerEnergy?: bigint; -} -export interface TestBlockchainTransaction { - test: string; - hash: string; - blockHash: string; - blockNumber: number; - type: number; - from: string; - energyPrice: bigint; - energyLimit: bigint; - to: string; - value: bigint; - nonce: number; - data: string; - signature: { - r: string; - s: string; - yParity: 0 | 1; - v: number; - networkV: null | bigint; - }; - creates: null | string; - networkId: bigint; - accessList?: Array>>; -} -export interface TestBlockchainReceipt { - test: string; - blockHash: string; - blockNumber: number; - type: number; - contractAddress: null | string; - cumulativeEnergyUsed: bigint; - from: string; - energyUsed: bigint; - energyPrice: bigint; - logs: Array<{ - address: string; - blockHash: string; - blockNumber: number; - data: string; - index: number; - topics: Array; - transactionHash: string; - transactionIndex: number; - }>; - logsBloom: string; - root: null | string; - status: null | number; - to: string; - hash: string; - index: number; -} -export declare const testAddress: Record>; -export declare const testBlock: Record>; -export declare const testTransaction: Record>; -export declare const testReceipt: Record>; -export declare const networkNames: Array; -export declare function networkFeatureAtBlock(feature: string, block: number): boolean; -//# sourceMappingURL=blockchain-data.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/_tests/blockchain-data.d.ts.map b/lib.commonjs/_tests/blockchain-data.d.ts.map deleted file mode 100644 index 768360b32..000000000 --- a/lib.commonjs/_tests/blockchain-data.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"blockchain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WAAW,EAAE,MAAM,CAC9B,qBAAqB,EACrB,KAAK,CAAC,qBAAqB,CAAC,CAyB7B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,MAAM,CAC5B,qBAAqB,EACrB,KAAK,CAAC,mBAAmB,CAAC,CAiE3B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,qBAAqB,EACrB,KAAK,CAAC,yBAAyB,CAAC,CAwDjC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAM,CAC9B,qBAAqB,EACrB,KAAK,CAAC,qBAAqB,CAAC,CAiG7B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,qBAAqB,CAAyB,CAAC;AAChF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAQ7E"} \ No newline at end of file diff --git a/lib.commonjs/_tests/blockchain-data.js b/lib.commonjs/_tests/blockchain-data.js deleted file mode 100644 index df2ff3211..000000000 --- a/lib.commonjs/_tests/blockchain-data.js +++ /dev/null @@ -1,243 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.networkFeatureAtBlock = exports.networkNames = exports.testReceipt = exports.testTransaction = exports.testBlock = exports.testAddress = void 0; -exports.testAddress = { - mainnet: [ - { - test: "old-account", - address: "0xAC1639CF97a3A46D431e6d1216f576622894cBB5", - balance: BigInt("4813414100000000"), - nonce: 3, - code: "0x", - }, - { - test: "TheDAO-splitter-contract", - address: "0x3474627D4F63A678266BC17171D87f8570936622", - code: "0x606060405260e060020a60003504630b3ed5368114602e57806337b0574a14605257806356fa47f0146062575b005b602c6004356000546101009004600160a060020a03908116339091161460bb575b50565b60005460ff166060908152602090f35b602c60043560005460ff1615609657600160a060020a038116600034606082818181858883f193505050501515604f576002565b33600160a060020a0316600034606082818181858883f193505050501515604f576002565b600080546101009004600160a060020a03169082606082818181858883f193505050501515604f57600256", - storage: { - "0": "0x0000000000000000000000b2682160c482eb985ec9f3e364eec0a904c44c2300", - }, - }, - { - test: "ricmoo.firefly.eth", - address: "0x8ba1f109551bD432803012645Ac136ddd64DBA72", - name: "ricmoo.firefly.eth", - }, - ], - goerli: [], -}; -exports.testBlock = { - mainnet: [ - { - test: "old-homestead-block", - hash: "0x3d6122660cc824376f11ee842f83addc3525e2dd6756b9bcf0affa6aa88cf741", - parentHash: "0xb495a1d7e6663152ae92708da4843337b958146015a2802f4193a410044698c9", - number: 3, - timestamp: 1438270048, - nonce: "0x2e9344e0cbde83ce", - difficulty: BigInt(17154715646), - energyLimit: BigInt("0x1388"), - energyUsed: BigInt("0"), - miner: "0x5088D623ba0fcf0131E0897a91734A4D83596AA0", - extraData: "0x476574682f76312e302e302d66633739643332642f6c696e75782f676f312e34", - transactions: [], - }, - { - test: "london-block", - number: 14413999, - hash: "0x6c79356d40ebb6ed63dc19f5d407f8f1c876047b59dc1a4598cce0e64dcabec5", - parentHash: "0xbf09b0e215f247a5066d19ece5b4c66960771d45fae62985e8d751fb1adcfe2f", - timestamp: 1647654576, - nonce: "0xb4bc9979af5369fe", - difficulty: BigInt("12841513359509721"), - energyLimit: BigInt("30087914"), - energyUsed: BigInt("2008910"), - miner: "0x2A20380DcA5bC24D052acfbf79ba23e988ad0050", - extraData: "0x706f6f6c696e2e636f6d21f7092f019bb92a76", - baseFeePerEnergy: BigInt("40911884304"), - transactions: [ - "0x1c3a398933db10634631f54b435c40c8805c13f12bbac7c3dab858ca44213fa2", - "0xd98947cbdd892cc7f679c903903e6d18a5c5afb19e94437beba79372ad71c347", - "0x4d66190deb55b5820cb0ce9adb972f646fa0f3e64eaeee674bbf3d054bf3d883", - "0x9db7bd5f4c91d6103c714bcbc35df3dc708daa668aaef7449b589dbd3be24dac", - "0x126a43ae4ade4b7fc5c8ac9ebd3dbcf7314f63c60f2804fb49aa25b5c7d80bb1", - "0x82a90aa4b3b1b7873b117c3ff1ca7165ae34b2fc0788cc0cbfd41805d588590d", - "0x7f694a6a9972457753ed3dec164f17272b1c8b1da4eab149df95e31a3e72f606", - "0xdce1cba1ff33f0c23881087d49de3b34fe84c8a6883f3edd75b04fc23e458aac", - "0xbe1c69f825279cebef42d1f0e07397dcddef7fb278b0195e295ede3e156836c4", - "0x1d2f007b3c0f894403973a30e5ffaa78589f873d963e9554c6bb1bd7a3127245", - "0x9c8c78191cf4ae9ae8eee1165153eabe24dbd8b9509b83d5f0caeea85251bb2f", - "0x42e956f4b3dd6535359b272a0d2dab995c364cb48baaf8d0a1981995f3f8c808", - "0xdc2c2e99393e24d5dc66e38665fa1d1ff007d92088ef3fd2549545fdbe862ef6", - "0xaad7be28fffd2e77e8e40bf57f2ac140aa8283ec93c7f3f61a82c79405602f53", - "0x4735f1421b7b30283e87e0799e82e54307d3e5ba14cd54ad8420b57577489a71", - "0x0b9d6aa23aa439b41e86595f2ad91f498adffa3e6e7cb26ac7d73252e59fd3de", - "0xcd93e19bd5d5c5a834fec613116fa01f46eddfd2faa20ef302271b874b9d812a", - "0x5bf1976574a637f5ac0b8bda1a792fa16cc7ce9624d32e9bd6bd9aa6a8f19d2f", - "0x2e778da4f66f10f7b681b605635c6599cdbeea167fc1c4396a097aef5d06de61", - "0xd5fd68eebc4c870ccda081786a74c75c250e9e2d8269b8935edb3adb11b80bb2", - "0x2aec42a11c1d8c1e5198d54aacbc6bebb09bcd5e78f6af81ea09d65c9064734a", - "0xbea2e364ea4959ec438d9ccc2d2f7120c7eaba3b177cc0d7df8ff65d866ef89f", - "0xf48bbb0f838353060da4126a555ce532abf497a9d1108001afffaac513a59ddf", - "0xf5664e4372cce62733a6610efb7701a4a0e552d81f8caa764d8474b3070c6617", - "0x9d3732ddbd20610008ff737da2f61120734a1cbfa864374bcbcf10051e6048cb", - "0xc4d0df5bc6fa51b34ac3c898866d779d4e51a6be4d13be1ec3084b7229b03b47", - "0x90c86ec98b8ad98049b4ee54cb3aa72c5ae743077b830e8a294aa5dc47a1fb18", - ], - }, - ], - goerli: [], -}; -exports.testTransaction = { - mainnet: [ - { - test: "legacy", - hash: "0xccc90ab97a74c952fb3376c4a3efb566a58a10df62eb4d44a61e106fcf10ec61", - blockHash: "0x9653f180a5720f3634816eb945a6d722adee52cc47526f6357ac10adaf368135", - blockNumber: 4097745, - // index: 18, - type: 0, - from: "0x32DEF047DeFd076DB21A2D759aff2A591c972248", - energyPrice: BigInt("0x4a817c800"), - energyLimit: BigInt("0x3d090"), - to: "0x6fC21092DA55B392b045eD78F4732bff3C580e2c", - value: BigInt("0x186cc6acd4b0000"), - nonce: 0, - data: "0xf2c298be000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000067269636d6f6f0000000000000000000000000000000000000000000000000000", - signature: { - r: "0x1e5605197a03e3f0a168f14749168dfeefc44c9228312dacbffdcbbb13263265", - s: "0x269c3e5b3558267ad91b0a887d51f9f10098771c67b82ea6cb74f29638754f54", - yParity: 1, - v: 28, - networkV: BigInt(38), - }, - creates: null, - networkId: BigInt(1), - }, - { - test: "EIP-1559", - hash: "0x8ff41d0ba5d239acc8c123ff12451a2c15721c838f657e583d355999af4a4349", - blockHash: "0x9d4c3bef68e119841281105da96beb1c7252f357340d7a3355236b3332b197b0", - blockNumber: 12966000, - // index: 185, - type: 2, - from: "0x5afFBa12E9332bbc0E221c8E7BEf7CB7cfB3F281", - to: "0x2258CcD34ae29E6B199b6CD64eb2aEF157df7CdE", - energyLimit: BigInt("21000"), - nonce: 2, - data: "0x", - value: BigInt("1100000000000000"), - energyPrice: BigInt("70578812137"), - networkId: BigInt(1), - signature: { - r: "0xdd26e5478d0aa84e334a0393d335ab24b83de8ecae9290305f15ab884ded246c", - s: "0x6494b4f61b0d9a5a82ecb86d72b301f859f404f0bec9682bbfff619903ecfbe2", - yParity: 1, - v: 28, - networkV: null, - }, - creates: null, - accessList: [], - }, - ], - goerli: [], -}; -exports.testReceipt = { - mainnet: [ - { - test: "legacy", - //byzantium: false, - blockHash: "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", - blockNumber: 0x3c92b5, - type: 0, - contractAddress: null, - cumulativeEnergyUsed: BigInt(0x1cca2e), - from: "0x18C6045651826824FEBBD39d8560584078d1b247", - energyUsed: BigInt(0x14bb7), - energyPrice: BigInt(4100000000), - logs: [ - { - address: "0x314159265dD8dbb310642f98f50C066173C1259b", - blockHash: "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", - blockNumber: 0x3c92b5, - data: "0x00000000000000000000000018c6045651826824febbd39d8560584078d1b247", - index: 0x1a, - topics: [ - "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", - "0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae", - "0xf0106919d12469348e14ad6a051d0656227e1aba2fefed41737fdf78421b20e1", - ], - transactionHash: "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", - transactionIndex: 0x39, - }, - { - address: "0x6090A6e47849629b7245Dfa1Ca21D94cd15878Ef", - blockHash: "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", - blockNumber: 0x3c92b5, - data: "0x000000000000000000000000000000000000000000000000002386f26fc1000000000000000000000000000000000000000000000000000000000000595a32ce", - index: 0x1b, - topics: [ - "0x0f0c27adfd84b60b6f456b0e87cdccb1e5fb9603991588d87fa99f5b6b61e670", - "0xf0106919d12469348e14ad6a051d0656227e1aba2fefed41737fdf78421b20e1", - "0x00000000000000000000000018c6045651826824febbd39d8560584078d1b247", - ], - transactionHash: "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", - transactionIndex: 0x39, - }, - ], - logsBloom: "0x00000000000000040000000000100000010000000000000040000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000200000010000000004000000000000000000000000000000000002000000000000000000000000400000000020000000000000000000000000000000000000004000000000000000000000000000000000000000000000000801000000000000000000000020000000000040000000040000000000000000002000000004000000000000000000000000000000000000000000000010000000000000000000000000000000000200000000000000000", - root: "0x9b550a9a640ce50331b64504ef87aaa7e2aaf97344acb6ff111f879b319d2590", - // Should be null for pre-byzantium, but some nodes have backfilled it - status: 1, - to: "0x6090A6e47849629b7245Dfa1Ca21D94cd15878Ef", - hash: "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", - index: 0x39, - }, - { - test: "byzantium", - //byzantium: true, - blockHash: "0x34e5a6cfbdbb84f7625df1de69d218ade4da72f4a2558064a156674e72e976c9", - blockNumber: 0x444f76, - type: 0, - contractAddress: null, - cumulativeEnergyUsed: BigInt(0x15bfe7), - from: "0x18C6045651826824FEBBD39d8560584078d1b247", - energyUsed: BigInt(0x1b968), - energyPrice: BigInt(1000000000), - logs: [ - { - address: "0xb90E64082D00437e65A76d4c8187596BC213480a", - blockHash: "0x34e5a6cfbdbb84f7625df1de69d218ade4da72f4a2558064a156674e72e976c9", - blockNumber: 0x444f76, - data: "0x", - index: 0x10, - topics: [ - "0x748d071d1992ee1bfe7a39058114d0a50d5798fe8eb3a9bfb4687f024629a2ce", - "0x5574aa58f7191ccab6de6cf75fe2ea0484f010b852fdd8c6b7ae151d6c2f4b83", - ], - transactionHash: "0x7f1c6a58dc880438236d0b0a4ae166e9e9a038dbea8ec074149bd8b176332cac", - transactionIndex: 0x1e, - }, - ], - logsBloom: "0x00000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000200000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000800000000000000000800000000000000000000000000000000000000", - root: null, - status: 1, - to: "0xb90E64082D00437e65A76d4c8187596BC213480a", - hash: "0x7f1c6a58dc880438236d0b0a4ae166e9e9a038dbea8ec074149bd8b176332cac", - index: 0x1e, - }, - ], - goerli: [], -}; -exports.networkNames = ["mainnet", "goerli"]; -function networkFeatureAtBlock(feature, block) { - switch (feature) { - case "byzantium": - return block >= 4370000; - default: - break; - } - throw new Error(`unknown feature: ${feature}`); -} -exports.networkFeatureAtBlock = networkFeatureAtBlock; -//# sourceMappingURL=blockchain-data.js.map \ No newline at end of file diff --git a/lib.commonjs/_tests/blockchain-data.js.map b/lib.commonjs/_tests/blockchain-data.js.map deleted file mode 100644 index 8e380c7e2..000000000 --- a/lib.commonjs/_tests/blockchain-data.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"blockchain-data.js","sourceRoot":"","sources":["../../src.ts/_tests/blockchain-data.ts"],"names":[],"mappings":";;;AAqFa,QAAA,WAAW,GAGpB;IACF,OAAO,EAAE;QACP;YACE,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,4CAA4C;YACrD,OAAO,EAAE,MAAM,CAAC,kBAAkB,CAAC;YACnC,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,IAAI;SACX;QACD;YACE,IAAI,EAAE,0BAA0B;YAChC,OAAO,EAAE,4CAA4C;YACrD,IAAI,EAAE,kdAAkd;YACxd,OAAO,EAAE;gBACP,GAAG,EAAE,oEAAoE;aAC1E;SACF;QACD;YACE,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,4CAA4C;YACrD,IAAI,EAAE,oBAAoB;SAC3B;KACF;IACD,MAAM,EAAE,EAAE;CACX,CAAC;AAEW,QAAA,SAAS,GAGlB;IACF,OAAO,EAAE;QACP;YACE,IAAI,EAAE,qBAAqB;YAC3B,IAAI,EAAE,oEAAoE;YAC1E,UAAU,EACR,oEAAoE;YACtE,MAAM,EAAE,CAAC;YACT,SAAS,EAAE,UAAU;YACrB,KAAK,EAAE,oBAAoB;YAC3B,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC;YAC/B,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC;YAC7B,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC;YACvB,KAAK,EAAE,4CAA4C;YACnD,SAAS,EACP,oEAAoE;YACtE,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oBACrB,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,IAAI;oBACX,MAAM,EAAE;wBACN,oEAAoE;wBACpE,oEAAoE;qBACrE;oBACD,eAAe,EACb,oEAAoE;oBACtE,gBAAgB,EAAE,IAAI;iBACvB;aACF;YACD,SAAS,EACP,ogBAAogB;YACtgB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,CAAC;YACT,EAAE,EAAE,4CAA4C;YAChD,IAAI,EAAE,oEAAoE;YAC1E,KAAK,EAAE,IAAI;SACZ;KACF;IACD,MAAM,EAAE,EAAE;CACX,CAAC;AAEW,QAAA,YAAY,GAAiC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAChF,SAAgB,qBAAqB,CAAC,OAAe,EAAE,KAAa;IAClE,QAAQ,OAAO,EAAE;QACf,KAAK,WAAW;YACd,OAAO,KAAK,IAAI,OAAO,CAAC;QAC1B;YACE,MAAM;KACT;IACD,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;AACjD,CAAC;AARD,sDAQC"} \ No newline at end of file diff --git a/lib.commonjs/_tests/create-provider.d.ts b/lib.commonjs/_tests/create-provider.d.ts deleted file mode 100644 index ef373e81a..000000000 --- a/lib.commonjs/_tests/create-provider.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { AbstractProvider } from "../index.js"; -export declare function setupProviders(): void; -export declare const providerNames: readonly string[]; -export declare function getProviderNetworks(provider: string): Array; -export declare function getProvider(provider: string, network: string): null | AbstractProvider; -export declare function checkProvider(provider: string, network: string): boolean; -export declare function connect(network: string): AbstractProvider; -//# sourceMappingURL=create-provider.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/_tests/create-provider.d.ts.map b/lib.commonjs/_tests/create-provider.d.ts.map deleted file mode 100644 index 901738c3a..000000000 --- a/lib.commonjs/_tests/create-provider.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"create-provider.d.ts","sourceRoot":"","sources":["../../src.ts/_tests/create-provider.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA2EpD,wBAAgB,cAAc,IAAI,IAAI,CAOrC;AAED,eAAO,MAAM,aAAa,mBAAqD,CAAC;AAUhF,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAMnE;AAED,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,IAAI,GAAG,gBAAgB,CAsBzB;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAGxE;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAMzD"} \ No newline at end of file diff --git a/lib.commonjs/_tests/create-provider.js b/lib.commonjs/_tests/create-provider.js deleted file mode 100644 index aeff79c71..000000000 --- a/lib.commonjs/_tests/create-provider.js +++ /dev/null @@ -1,129 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.connect = exports.checkProvider = exports.getProvider = exports.getProviderNetworks = exports.providerNames = exports.setupProviders = void 0; -const index_js_1 = require("../index.js"); -const ethNetworks = ["default", "mainnet", "goerli"]; -//const maticNetworks = [ "matic", "maticmum" ]; -const ProviderCreators = [ - { - name: "AlchemyProvider", - networks: ethNetworks, - create: function (network) { - return new index_js_1.AlchemyProvider(network, "YrPw6SWb20vJDRFkhWq8aKnTQ8JRNRHM"); - }, - }, - { - name: "InfuraProvider", - networks: ethNetworks, - create: function (network) { - return new index_js_1.InfuraProvider(network, "49a0efa3aaee4fd99797bfa94d8ce2f1"); - }, - }, - { - name: "InfuraWebsocketProvider", - networks: ethNetworks, - create: function (network) { - return index_js_1.InfuraProvider.getWebSocketProvider(network, "49a0efa3aaee4fd99797bfa94d8ce2f1"); - }, - }, - { - name: "PocketProvider", - networks: ethNetworks, - create: function (network) { - return new index_js_1.PocketProvider(network); - }, - }, - { - name: "QuickNodeProvider", - networks: ethNetworks, - create: function (network) { - return new index_js_1.QuickNodeProvider(network); - }, - }, - { - name: "FallbackProvider", - networks: ethNetworks, - create: function (network) { - const providers = []; - for (const providerName of [ - "AlchemyProvider", - "AnkrProvider", - "InfuraProvider", - ]) { - const provider = getProvider(providerName, network); - if (provider) { - providers.push(provider); - } - } - if (providers.length === 0) { - throw new Error("UNSUPPORTED NETWORK"); - } - return new index_js_1.FallbackProvider(providers); - }, - }, -]; -let setup = false; -const cleanup = []; -function setupProviders() { - after(function () { - for (const func of cleanup) { - func(); - } - }); - setup = true; -} -exports.setupProviders = setupProviders; -exports.providerNames = Object.freeze(ProviderCreators.map((c) => c.name)); -function getCreator(provider) { - const creators = ProviderCreators.filter((c) => c.name === provider); - if (creators.length === 1) { - return creators[0]; - } - return null; -} -function getProviderNetworks(provider) { - const creator = getCreator(provider); - if (creator) { - return creator.networks; - } - return []; -} -exports.getProviderNetworks = getProviderNetworks; -function getProvider(provider, network) { - if (setup == false) { - throw new Error("MUST CALL setupProviders in root context"); - } - const creator = getCreator(provider); - try { - if (creator) { - const provider = creator.create(network); - if (provider) { - cleanup.push(() => { - provider.destroy(); - }); - } - return provider; - } - } - catch (error) { - if (!(0, index_js_1.isError)(error, "INVALID_ARGUMENT")) { - throw error; - } - } - return null; -} -exports.getProvider = getProvider; -function checkProvider(provider, network) { - const creator = getCreator(provider); - return creator != null; -} -exports.checkProvider = checkProvider; -function connect(network) { - const provider = getProvider("InfuraProvider", network); - if (provider == null) { - throw new Error(`could not connect to ${network}`); - } - return provider; -} -exports.connect = connect; -//# sourceMappingURL=create-provider.js.map \ No newline at end of file diff --git a/lib.commonjs/_tests/create-provider.js.map b/lib.commonjs/_tests/create-provider.js.map deleted file mode 100644 index 0d682e419..000000000 --- a/lib.commonjs/_tests/create-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"create-provider.js","sourceRoot":"","sources":["../../src.ts/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,OAAe;IAEf,IAAI,KAAK,IAAI,KAAK,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;KAC7D;IAED,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI;QACF,IAAI,OAAO,EAAE;YACX,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACzC,IAAI,QAAQ,EAAE;gBACZ,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;oBAChB,QAAQ,CAAC,OAAO,EAAE,CAAC;gBACrB,CAAC,CAAC,CAAC;aACJ;YACD,OAAO,QAAQ,CAAC;SACjB;KACF;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,IAAA,kBAAO,EAAC,KAAK,EAAE,kBAAkB,CAAC,EAAE;YACvC,MAAM,KAAK,CAAC;SACb;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAzBD,kCAyBC;AAED,SAAgB,aAAa,CAAC,QAAgB,EAAE,OAAe;IAC7D,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IACrC,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC;AAHD,sCAGC;AAED,SAAgB,OAAO,CAAC,OAAe;IACrC,MAAM,QAAQ,GAAG,WAAW,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACxD,IAAI,QAAQ,IAAI,IAAI,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;KACpD;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAND,0BAMC"} \ No newline at end of file diff --git a/lib.commonjs/_tests/test-contract.d.ts b/lib.commonjs/_tests/test-contract.d.ts deleted file mode 100644 index 1427a8692..000000000 --- a/lib.commonjs/_tests/test-contract.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=test-contract.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/_tests/test-contract.d.ts.map b/lib.commonjs/_tests/test-contract.d.ts.map deleted file mode 100644 index fb6a18b4b..000000000 --- a/lib.commonjs/_tests/test-contract.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test-contract.d.ts","sourceRoot":"","sources":["../../src.ts/_tests/test-contract.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.commonjs/_tests/test-contract.js b/lib.commonjs/_tests/test-contract.js deleted file mode 100644 index 829301e88..000000000 --- a/lib.commonjs/_tests/test-contract.js +++ /dev/null @@ -1,86 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const corebc_js_1 = require("../corebc.js"); -const assert_1 = tslib_1.__importDefault(require("assert")); -const index_js_1 = require("../address/index.js"); -const TIMEOUT_PERIOD = 120000; -const tesSignedTransaction = "0xf8ce800a830f423f0496ce276773ac97d16855a3c8faa45399136b56d419486081c880b8ab54bc60412c90c104a89865a43c33f335836bcb473f0cd477ecb2c82e6310676c87b708e3971d009b4a04e518f12454c3ee1aebc19a6b7df00076b834b692b7432611f3dafff0f422dfbae722ba4b989cfc82fee2e539fbbf21d652ea587df59e8421a3a8bc8ca2ba35033598954c54e10c00315484db568379ce94f9c894e3e6e4c7ee216676b713ca892d9b26746ae902a772e217a6a8bb493ce2bb313cf0cb66e76765d4c45ec6b68600"; -const testWalletPhrase = "better artwork flavor fish solve deer orient spread adapt doll attack hour sort copper super income bacon engine skate ill similar wink crack club"; -const testSeed = "ec372b08ffc451a5dd991c68006aa01a033a6a391e0e72d5690c13cff719fdcb2502812dbf5f32a6df828cd22d77a36405bb15bb2637b7e77f99fa60f00d3560"; -const tesPrivateKey = "69bb68c3a00a0cd9cbf2cab316476228c758329bbfe0b1759e8634694a9497afea05bcbf24e2aa0627eac4240484bb71de646a9296872a3c0e"; -const testAddress = "0xab38254e30777140469a3aa168df81182d3d61f9843f"; -const testPublicKey = "0x484ed765af56534f1c98c0f3ac9fb460fbf5c3cf582e54a6cdfc319986ce1bb875d3afcc9c336764348c96264dfeef9565364d7e8e14e9aa80"; -const provider = (0, corebc_js_1.getDefaultProvider)("https://xcbapi.corecoin.cc/"); -const mnemonicWallet = corebc_js_1.Wallet.fromPhrase({ - phrase: testWalletPhrase, - password: "111111", - prefix: (0, index_js_1.networkIdToPrefix)(3), -}); -const mnemonicWalletWithoutPassKey = corebc_js_1.Wallet.fromPhrase({ - phrase: testWalletPhrase, - prefix: (0, index_js_1.networkIdToPrefix)(3), -}); -console.log(mnemonicWalletWithoutPassKey.publicKey); -const wallet = corebc_js_1.Wallet.fromSeed({ - prefix: (0, index_js_1.networkIdToPrefix)(3), - seed: testSeed, - provider, -}); -const seedWallet = corebc_js_1.Wallet.fromSeed({ - prefix: (0, index_js_1.networkIdToPrefix)(3), - seed: testSeed, -}); -const signingKey = new corebc_js_1.SigningKey(tesPrivateKey); -const baseWalletAddress = "0xab03a5fd22b9bee8b8ab877c86e0a2c21765e1d5bfc5"; -const baseWallet = new corebc_js_1.BaseWallet({ - signingKey, - prefix: (0, index_js_1.networkIdToPrefix)(3), - provider, -}); -const randomWallet = corebc_js_1.Wallet.createRandom((0, index_js_1.networkIdToPrefix)(3), provider); -const transaction = corebc_js_1.Transaction.from({ - to: "0xce276773ac97d16855a3c8faa45399136b56d4194860", - value: 200n, - nonce: 0, - energyLimit: 999999n, - energyPrice: 10n, - networkId: 4, -}); -describe("Test wallet creation", function () { - it("can generate a random wallet", function () { - assert_1.default.equal(randomWallet.mnemonic?.phrase.split(" ").length, 24, "mismatch in phrase length"); - assert_1.default.equal((0, corebc_js_1.isAddressable)(randomWallet), true, "random wallet is not addressable"); - }); -}); -describe("Test getting data from blockchain and calling smart contract", function () { - it("can currectly sign a transaction", async function () { - this.timeout(TIMEOUT_PERIOD); - const tx = await baseWallet.signTransaction(transaction); - assert_1.default.equal(tx, tesSignedTransaction, "sign transaction failed"); - }); - it("can currectly get signer from signed transaction", async function () { - this.timeout(TIMEOUT_PERIOD); - const message = "my message"; - const signedMessage = await baseWallet.signMessage(message); - const address = (0, corebc_js_1.verifyMessage)(message, signedMessage, (0, index_js_1.networkIdToPrefix)(3)); - assert_1.default.equal(address, baseWalletAddress, "get address from signed message failed"); - }); - it("can get feeData ", async function () { - this.timeout(TIMEOUT_PERIOD); - const feeData = await provider.getFeeData(); - assert_1.default.equal(feeData.energyPrice, 1000000000n, "mismatch in expected energy price"); - }); - it("can generate wallet", function () { - assert_1.default.equal(mnemonicWallet.address.length, 46, "mismatch in address length"); - assert_1.default.equal(mnemonicWallet.publicKey, testPublicKey, "mismatch in public key"); - assert_1.default.equal(mnemonicWallet.address, testAddress, "mismatch in generated address"); - assert_1.default.equal(seedWallet.address.length, 46, "mismatch in address length for seed wallet"); - assert_1.default.equal(seedWallet.publicKey, testPublicKey, "mismatch in public key for seed wallet"); - assert_1.default.equal(seedWallet.address, testAddress, "mismatch in seed length for seed wallet"); - assert_1.default.equal(wallet.address.length, 46, "mismatch in address length for wallet"); - assert_1.default.equal(wallet.publicKey, testPublicKey, "mismatch in public key for wallet"); - assert_1.default.equal(wallet.address, testAddress, "mismatch in seed length for wallet"); - }); -}); -//# sourceMappingURL=test-contract.js.map \ No newline at end of file diff --git a/lib.commonjs/_tests/test-contract.js.map b/lib.commonjs/_tests/test-contract.js.map deleted file mode 100644 index 8ae061013..000000000 --- a/lib.commonjs/_tests/test-contract.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test-contract.js","sourceRoot":"","sources":["../../src.ts/_tests/test-contract.ts"],"names":[],"mappings":";;;AAAA,4CAQsB;AACtB,4DAA4B;AAC5B,kDAAwD;AAExD,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,oBAAoB,GACxB,oaAAoa,CAAC;AACva,MAAM,gBAAgB,GACpB,oJAAoJ,CAAC;AACvJ,MAAM,QAAQ,GACZ,kIAAkI,CAAC;AACrI,MAAM,aAAa,GACjB,oHAAoH,CAAC;AACvH,MAAM,W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E,KAAK;QAC1B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAC7B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC5C,gBAAM,CAAC,KAAK,CACV,OAAO,CAAC,WAAW,EACnB,WAAW,EACX,mCAAmC,CACpC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,qBAAqB,EAAE;QACxB,gBAAM,CAAC,KAAK,CACV,cAAc,CAAC,OAAO,CAAC,MAAM,EAC7B,EAAE,EACF,4BAA4B,CAC7B,CAAC;QACF,gBAAM,CAAC,KAAK,CACV,cAAc,CAAC,SAAS,EACxB,aAAa,EACb,wBAAwB,CACzB,CAAC;QACF,gBAAM,CAAC,KAAK,CACV,cAAc,CAAC,OAAO,EACtB,WAAW,EACX,+BAA+B,CAChC,CAAC;QACF,gBAAM,CAAC,KAAK,CACV,UAAU,CAAC,OAAO,CAAC,MAAM,EACzB,EAAE,EACF,4CAA4C,CAC7C,CAAC;QACF,gBAAM,CAAC,KAAK,CACV,UAAU,CAAC,SAAS,EACpB,aAAa,EACb,wCAAwC,CACzC,CAAC;QACF,gBAAM,CAAC,KAAK,CACV,UAAU,CAAC,OAAO,EAClB,WAAW,EACX,yCAAyC,CAC1C,CAAC;QACF,gBAAM,CAAC,KAAK,CACV,MAAM,CAAC,OAAO,CAAC,MAAM,EACrB,EAAE,EACF,uCAAuC,CACxC,CAAC;QACF,gBAAM,CAAC,KAAK,CACV,MAAM,CAAC,SAAS,EAChB,aAAa,EACb,mCAAmC,CACpC,CAAC;QACF,gBAAM,CAAC,KAAK,CACV,MAAM,CAAC,OAAO,EACd,WAAW,EACX,oCAAoC,CACrC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/_tests/types.d.ts b/lib.commonjs/_tests/types.d.ts deleted file mode 100644 index 153d8067f..000000000 --- a/lib.commonjs/_tests/types.d.ts +++ /dev/null @@ -1,191 +0,0 @@ -export type TestCaseAbiVerbose = { - type: "address" | "hexstring" | "number" | "string"; - value: string; -} | { - type: "boolean"; - value: boolean; -} | { - type: "array"; - value: Array; -} | { - type: "object"; - value: Array; -}; -export interface TestCaseAbi { - name: string; - type: string; - value: any; - verbose: TestCaseAbiVerbose; - bytecode: string; - encoded: string; -} -export interface TestCaseAccount { - name: string; - privateKey: string; - address: string; - icap: string; -} -export type TestCaseCreate = { - sender: string; - creates: Array<{ - name: string; - nonce: number; - address: string; - }>; -}; -export type TestCaseCreate2 = { - sender: string; - creates: Array<{ - name: string; - salt: string; - initCode: string; - initCodeHash: string; - address: string; - }>; -}; -export interface TestCaseHash { - name: string; - data: string; - sha256: string; - sha512: string; - ripemd160: string; -} -export interface TestCasePbkdf { - name: string; - password: string; - salt: string; - dkLen: number; - pbkdf2: { - iterations: number; - algorithm: "sha256" | "sha512"; - key: string; - }; - scrypt: { - N: number; - r: number; - p: number; - key: string; - }; -} -export interface TestCaseHmac { - name: string; - data: string; - key: string; - algorithm: "sha256" | "sha512"; - hmac: string; -} -export interface TestCaseHash { - name: string; - data: string; - sha256: string; - sha512: string; - ripemd160: string; -} -export interface TestCaseTypedDataDomain { - name?: string; - version?: string; - networkId?: number; - verifyingContract?: string; - salt?: string; -} -export interface TestCaseTypedDataType { - name: string; - type: string; -} -export interface TestCaseTypedData { - name: string; - domain: TestCaseTypedDataDomain; - primaryType: string; - types: Record>; - data: any; - encoded: string; - digest: string; - privateKey?: string; - signature?: string; -} -export interface TestCaseSolidityHash { - name: string; - types: Array; - ripemd160: string; - sha256: string; - values: Array; -} -export type NestedHexString = string | Array; -export interface TestCaseRlp { - name: string; - encoded: string; - decoded: NestedHexString; -} -export interface TestCaseTransactionTx { - to?: string; - nonce?: number; - energyLimit?: string; - energyPrice?: string; - maxFeePerEnergy?: string; - data?: string; - value?: string; - accessList?: Array<{ - address: string; - storageKeys: Array; - }>; - networkId?: string; -} -export interface TestCaseTransactionSig { - r: string; - s: string; - v: string; -} -export interface TestCaseTransaction { - name: string; - transaction: TestCaseTransactionTx; - privateKey: string; - unsignedLegacy: string; - signedLegacy: string; - unsignedEip155: string; - signedEip155: string; - unsignedBerlin: string; - signedBerlin: string; - unsignedLondon: string; - signedLondon: string; - signatureLegacy: TestCaseTransactionSig; - signatureEip155: TestCaseTransactionSig; - signatureBerlin: TestCaseTransactionSig; - signatureLondon: TestCaseTransactionSig; -} -export interface TestCaseMnemonicNode { - path: string; - chainCode: string; - depth: number; - index: number; - parentFingerprint: string; - fingerprint: string; - publicKey: string; - privateKey: string; - xpriv: string; - xpub: string; -} -export interface TestCaseMnemonic { - name: string; - phrase: string; - phraseHash: string; - password: string; - locale: string; - entropy: string; - seed: string; - nodes: Array; -} -export interface TestCaseWallet { - name: string; - filename: string; - type: string; - address: string; - password: string; - content: string; -} -export interface TestCaseWordlist { - name: string; - filename: string; - locale: string; - content: string; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/_tests/types.d.ts.map b/lib.commonjs/_tests/types.d.ts.map deleted file mode 100644 index 6619a1cf6..000000000 --- a/lib.commonjs/_tests/types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src.ts/_tests/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAC1B;IACE,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACpD,KAAK,EAAE,MAAM,CAAC;CACf,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;CAChB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;CAClC,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;CAClC,CAAC;AAEN,MAAM,WAAW,WAAW;IAC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end of file diff --git a/lib.commonjs/_tests/types.js b/lib.commonjs/_tests/types.js deleted file mode 100644 index 11e638d1e..000000000 --- a/lib.commonjs/_tests/types.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/lib.commonjs/_tests/types.js.map b/lib.commonjs/_tests/types.js.map deleted file mode 100644 index 52b4d3276..000000000 --- a/lib.commonjs/_tests/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src.ts/_tests/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.commonjs/_version.d.ts b/lib.commonjs/_version.d.ts deleted file mode 100644 index ab655b4ad..000000000 --- a/lib.commonjs/_version.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * The current version of corebc. - */ -export declare const version: string; -//# sourceMappingURL=_version.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/_version.d.ts.map b/lib.commonjs/_version.d.ts.map deleted file mode 100644 index 502b731b4..000000000 --- a/lib.commonjs/_version.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"_version.d.ts","sourceRoot":"","sources":["../src.ts/_version.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MAAgB,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/_version.js b/lib.commonjs/_version.js deleted file mode 100644 index 62023dc8c..000000000 --- a/lib.commonjs/_version.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.version = void 0; -/** - * The current version of corebc. - */ -exports.version = "6.4.0"; -//# sourceMappingURL=_version.js.map \ No newline at end of file diff --git a/lib.commonjs/_version.js.map b/lib.commonjs/_version.js.map deleted file mode 100644 index 895e9da44..000000000 --- a/lib.commonjs/_version.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"_version.js","sourceRoot":"","sources":["../src.ts/_version.ts"],"names":[],"mappings":";AAAA,mEAAmE;;;AAEnE;;GAEG;AACU,QAAA,OAAO,GAAW,OAAO,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/abi-types/Tes.d.ts b/lib.commonjs/abi-types/Tes.d.ts deleted file mode 100644 index ab20b2246..000000000 --- a/lib.commonjs/abi-types/Tes.d.ts +++ /dev/null @@ -1,223 +0,0 @@ -import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "../corebc.js"; -import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common.js"; -export interface TesInterface extends Interface { - getFunction(nameOrSignature: "approve" | "balanceOf" | "batchOwnerOf" | "getApproved" | "isApprovedForAll" | "mint" | "ownerOf" | "safeTransferFrom(address,address,uint256)" | "safeTransferFrom(address,address,uint256,bytes)" | "setApprovalForAll" | "tokenByIndex" | "tokenOfOwnerByIndex" | "totalSupply" | "transferFrom"): FunctionFragment; - getEvent(nameOrSignatureOrTopic: "Approval" | "ApprovalForAll" | "Transfer"): EventFragment; - encodeFunctionData(functionFragment: "approve", values: [AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "balanceOf", values: [AddressLike]): string; - encodeFunctionData(functionFragment: "batchOwnerOf", values: [BigNumberish[]]): string; - encodeFunctionData(functionFragment: "getApproved", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "isApprovedForAll", values: [AddressLike, AddressLike]): string; - encodeFunctionData(functionFragment: "mint", values: [AddressLike]): string; - encodeFunctionData(functionFragment: "ownerOf", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "safeTransferFrom(address,address,uint256)", values: [AddressLike, AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "safeTransferFrom(address,address,uint256,bytes)", values: [AddressLike, AddressLike, BigNumberish, BytesLike]): string; - encodeFunctionData(functionFragment: "setApprovalForAll", values: [AddressLike, boolean]): string; - encodeFunctionData(functionFragment: "tokenByIndex", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "tokenOfOwnerByIndex", values: [AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "totalSupply", values?: undefined): string; - encodeFunctionData(functionFragment: "transferFrom", values: [AddressLike, AddressLike, BigNumberish]): string; - decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "batchOwnerOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "getApproved", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "isApprovedForAll", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "ownerOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "safeTransferFrom(address,address,uint256)", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "safeTransferFrom(address,address,uint256,bytes)", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "setApprovalForAll", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "tokenByIndex", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "tokenOfOwnerByIndex", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "totalSupply", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "transferFrom", data: BytesLike): Result; -} -export declare namespace ApprovalEvent { - type InputTuple = [ - owner: AddressLike, - approved: AddressLike, - tokenId: BigNumberish - ]; - type OutputTuple = [owner: string, approved: string, tokenId: bigint]; - interface OutputObject { - owner: string; - approved: string; - tokenId: bigint; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export declare namespace ApprovalForAllEvent { - type InputTuple = [ - owner: AddressLike, - operator: AddressLike, - approved: boolean - ]; - type OutputTuple = [ - owner: string, - operator: string, - approved: boolean - ]; - interface OutputObject { - owner: string; - operator: string; - approved: boolean; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export declare namespace TransferEvent { - type InputTuple = [ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ]; - type OutputTuple = [from: string, to: string, tokenId: bigint]; - interface OutputObject { - from: string; - to: string; - tokenId: bigint; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export interface Tes extends BaseContract { - connect(runner?: ContractRunner | null): BaseContract; - attach(addressOrName: AddressLike): this; - deployed(): Promise; - interface: TesInterface; - queryFilter(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; - queryFilter(filter: TypedDeferredTopicFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; - on(event: TCEvent, listener: TypedListener): Promise; - on(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; - once(event: TCEvent, listener: TypedListener): Promise; - once(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - approve: TypedContractMethod<[ - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - balanceOf: TypedContractMethod<[owner: AddressLike], [bigint], "view">; - batchOwnerOf: TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - getApproved: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - isApprovedForAll: TypedContractMethod<[ - owner: AddressLike, - operator: AddressLike - ], [ - boolean - ], "view">; - mint: TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - ownerOf: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - "safeTransferFrom(address,address,uint256)": TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - "safeTransferFrom(address,address,uint256,bytes)": TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike - ], [ - void - ], "nonpayable">; - setApprovalForAll: TypedContractMethod<[ - operator: AddressLike, - approved: boolean - ], [ - void - ], "nonpayable">; - tokenByIndex: TypedContractMethod<[index: BigNumberish], [bigint], "view">; - tokenOfOwnerByIndex: TypedContractMethod<[ - owner: AddressLike, - index: BigNumberish - ], [ - bigint - ], "view">; - totalSupply: TypedContractMethod<[], [bigint], "view">; - transferFrom: TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(key: string | FunctionFragment): T; - getFunction(nameOrSignature: "approve"): TypedContractMethod<[ - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "balanceOf"): TypedContractMethod<[owner: AddressLike], [bigint], "view">; - getFunction(nameOrSignature: "batchOwnerOf"): TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - getFunction(nameOrSignature: "getApproved"): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction(nameOrSignature: "isApprovedForAll"): TypedContractMethod<[ - owner: AddressLike, - operator: AddressLike - ], [ - boolean - ], "view">; - getFunction(nameOrSignature: "mint"): TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - getFunction(nameOrSignature: "ownerOf"): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction(nameOrSignature: "safeTransferFrom(address,address,uint256)"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "safeTransferFrom(address,address,uint256,bytes)"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "setApprovalForAll"): TypedContractMethod<[ - operator: AddressLike, - approved: boolean - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "tokenByIndex"): TypedContractMethod<[index: BigNumberish], [bigint], "view">; - getFunction(nameOrSignature: "tokenOfOwnerByIndex"): TypedContractMethod<[ - owner: AddressLike, - index: BigNumberish - ], [ - bigint - ], "view">; - getFunction(nameOrSignature: "totalSupply"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "transferFrom"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getEvent(key: "Approval"): TypedContractEvent; - getEvent(key: "ApprovalForAll"): TypedContractEvent; - getEvent(key: "Transfer"): TypedContractEvent; - filters: { - "Approval(address,address,uint256)": TypedContractEvent; - Approval: TypedContractEvent; - "ApprovalForAll(address,address,bool)": TypedContractEvent; - ApprovalForAll: TypedContractEvent; - "Transfer(address,address,uint256)": TypedContractEvent; - Transfer: TypedContractEvent; - }; -} -//# sourceMappingURL=Tes.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi-types/Tes.d.ts.map b/lib.commonjs/abi-types/Tes.d.ts.map deleted file mode 100644 index 04a5ce028..000000000 --- a/lib.commonjs/abi-types/Tes.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes.d.ts","sourceRoot":"","sources":["../../src.ts/abi-types/Tes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACd,QAAQ,EACT,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,WAAW,CACT,eAAe,EACX,SAAS,GACT,WAAW,GACX,cAAc,GACd,aAAa,GACb,kBAAk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Aa,CAAC,YAAY,CAC3B,CAAC;QAEF,sCAAsC,EAAE,kBAAkB,CACxD,mBAAmB,CAAC,UAAU,EAC9B,mBAAmB,CAAC,WAAW,EAC/B,mBAAmB,CAAC,YAAY,CACjC,CAAC;QACF,cAAc,EAAE,kBAAkB,CAChC,mBAAmB,CAAC,UAAU,EAC9B,mBAAmB,CAAC,WAAW,EAC/B,mBAAmB,CAAC,YAAY,CACjC,CAAC;QAEF,mCAAmC,EAAE,kBAAkB,CACrD,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,WAAW,EACzB,aAAa,CAAC,YAAY,CAC3B,CAAC;QACF,QAAQ,EAAE,kBAAkB,CAC1B,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,WAAW,EACzB,aAAa,CAAC,YAAY,CAC3B,CAAC;KACH,CAAC;CACH"} \ No newline at end of file diff --git a/lib.commonjs/abi-types/Tes.js b/lib.commonjs/abi-types/Tes.js deleted file mode 100644 index 9219b6545..000000000 --- a/lib.commonjs/abi-types/Tes.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Tes.js.map \ No newline at end of file diff --git a/lib.commonjs/abi-types/Tes.js.map b/lib.commonjs/abi-types/Tes.js.map deleted file mode 100644 index af1f5205d..000000000 --- a/lib.commonjs/abi-types/Tes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes.js","sourceRoot":"","sources":["../../src.ts/abi-types/Tes.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.commonjs/abi-types/Tes_abi.d.ts b/lib.commonjs/abi-types/Tes_abi.d.ts deleted file mode 100644 index 3df4e144e..000000000 --- a/lib.commonjs/abi-types/Tes_abi.d.ts +++ /dev/null @@ -1,223 +0,0 @@ -import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "../corebc.js"; -import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common.js"; -export interface Tes_abiInterface extends Interface { - getFunction(nameOrSignature: "approve" | "balanceOf" | "batchOwnerOf" | "getApproved" | "isApprovedForAll" | "mint" | "ownerOf" | "safeTransferFrom(address,address,uint256)" | "safeTransferFrom(address,address,uint256,bytes)" | "setApprovalForAll" | "tokenByIndex" | "tokenOfOwnerByIndex" | "totalSupply" | "transferFrom"): FunctionFragment; - getEvent(nameOrSignatureOrTopic: "Approval" | "ApprovalForAll" | "Transfer"): EventFragment; - encodeFunctionData(functionFragment: "approve", values: [AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "balanceOf", values: [AddressLike]): string; - encodeFunctionData(functionFragment: "batchOwnerOf", values: [BigNumberish[]]): string; - encodeFunctionData(functionFragment: "getApproved", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "isApprovedForAll", values: [AddressLike, AddressLike]): string; - encodeFunctionData(functionFragment: "mint", values: [AddressLike]): string; - encodeFunctionData(functionFragment: "ownerOf", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "safeTransferFrom(address,address,uint256)", values: [AddressLike, AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "safeTransferFrom(address,address,uint256,bytes)", values: [AddressLike, AddressLike, BigNumberish, BytesLike]): string; - encodeFunctionData(functionFragment: "setApprovalForAll", values: [AddressLike, boolean]): string; - encodeFunctionData(functionFragment: "tokenByIndex", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "tokenOfOwnerByIndex", values: [AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "totalSupply", values?: undefined): string; - encodeFunctionData(functionFragment: "transferFrom", values: [AddressLike, AddressLike, BigNumberish]): string; - decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "batchOwnerOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "getApproved", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "isApprovedForAll", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "ownerOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "safeTransferFrom(address,address,uint256)", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "safeTransferFrom(address,address,uint256,bytes)", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "setApprovalForAll", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "tokenByIndex", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "tokenOfOwnerByIndex", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "totalSupply", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "transferFrom", data: BytesLike): Result; -} -export declare namespace ApprovalEvent { - type InputTuple = [ - owner: AddressLike, - approved: AddressLike, - tokenId: BigNumberish - ]; - type OutputTuple = [owner: string, approved: string, tokenId: bigint]; - interface OutputObject { - owner: string; - approved: string; - tokenId: bigint; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export declare namespace ApprovalForAllEvent { - type InputTuple = [ - owner: AddressLike, - operator: AddressLike, - approved: boolean - ]; - type OutputTuple = [ - owner: string, - operator: string, - approved: boolean - ]; - interface OutputObject { - owner: string; - operator: string; - approved: boolean; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export declare namespace TransferEvent { - type InputTuple = [ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ]; - type OutputTuple = [from: string, to: string, tokenId: bigint]; - interface OutputObject { - from: string; - to: string; - tokenId: bigint; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export interface Tes_abi extends BaseContract { - connect(runner?: ContractRunner | null): BaseContract; - attach(addressOrName: AddressLike): this; - deployed(): Promise; - interface: Tes_abiInterface; - queryFilter(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; - queryFilter(filter: TypedDeferredTopicFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; - on(event: TCEvent, listener: TypedListener): Promise; - on(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; - once(event: TCEvent, listener: TypedListener): Promise; - once(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - approve: TypedContractMethod<[ - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - balanceOf: TypedContractMethod<[owner: AddressLike], [bigint], "view">; - batchOwnerOf: TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - getApproved: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - isApprovedForAll: TypedContractMethod<[ - owner: AddressLike, - operator: AddressLike - ], [ - boolean - ], "view">; - mint: TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - ownerOf: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - "safeTransferFrom(address,address,uint256)": TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - "safeTransferFrom(address,address,uint256,bytes)": TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike - ], [ - void - ], "nonpayable">; - setApprovalForAll: TypedContractMethod<[ - operator: AddressLike, - approved: boolean - ], [ - void - ], "nonpayable">; - tokenByIndex: TypedContractMethod<[index: BigNumberish], [bigint], "view">; - tokenOfOwnerByIndex: TypedContractMethod<[ - owner: AddressLike, - index: BigNumberish - ], [ - bigint - ], "view">; - totalSupply: TypedContractMethod<[], [bigint], "view">; - transferFrom: TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(key: string | FunctionFragment): T; - getFunction(nameOrSignature: "approve"): TypedContractMethod<[ - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "balanceOf"): TypedContractMethod<[owner: AddressLike], [bigint], "view">; - getFunction(nameOrSignature: "batchOwnerOf"): TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - getFunction(nameOrSignature: "getApproved"): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction(nameOrSignature: "isApprovedForAll"): TypedContractMethod<[ - owner: AddressLike, - operator: AddressLike - ], [ - boolean - ], "view">; - getFunction(nameOrSignature: "mint"): TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - getFunction(nameOrSignature: "ownerOf"): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction(nameOrSignature: "safeTransferFrom(address,address,uint256)"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "safeTransferFrom(address,address,uint256,bytes)"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "setApprovalForAll"): TypedContractMethod<[ - operator: AddressLike, - approved: boolean - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "tokenByIndex"): TypedContractMethod<[index: BigNumberish], [bigint], "view">; - getFunction(nameOrSignature: "tokenOfOwnerByIndex"): TypedContractMethod<[ - owner: AddressLike, - index: BigNumberish - ], [ - bigint - ], "view">; - getFunction(nameOrSignature: "totalSupply"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "transferFrom"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getEvent(key: "Approval"): TypedContractEvent; - getEvent(key: "ApprovalForAll"): TypedContractEvent; - getEvent(key: "Transfer"): TypedContractEvent; - filters: { - "Approval(address,address,uint256)": TypedContractEvent; - Approval: TypedContractEvent; - "ApprovalForAll(address,address,bool)": TypedContractEvent; - ApprovalForAll: TypedContractEvent; - "Transfer(address,address,uint256)": TypedContractEvent; - Transfer: TypedContractEvent; - }; -} -//# sourceMappingURL=Tes_abi.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi-types/Tes_abi.d.ts.map b/lib.commonjs/abi-types/Tes_abi.d.ts.map deleted file mode 100644 index 4d5fd9d95..000000000 --- a/lib.commonjs/abi-types/Tes_abi.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes_abi.d.ts","sourceRoot":"","sources":["../../src.ts/abi-types/Tes_abi.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACd,QAAQ,EACT,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,WAAW,CACT,eAAe,EACX,SAAS,GACT,WAAW,GACX,cAAc,GACd,aAAa,GACb,kBAAkB,GAClB,MAAM,GACN,SAAS,GACT,2CAA2C,GAC3C,iDAAiD,GACjD,mBAAmB,GACnB,cAAc,GACd,qBAAqB,GACrB,aAAa,GACb,cAAc,GACjB,gBAAgB,CAAC;IAEpB,QAAQ,CACN,sBAAsB,EAAE,UAAU,GAAG,gBAAgB,GAAG,UAAU,GACjE,aAAa,CAAC;IAEjB,kBAAkB,CAChB,gBAAgB,EAAE,SAAS,EAC3B,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,GAClC,MAAM,CAAC;IACV,kBAAkB,CAChB,gBAAgB,EAAE,WAAW,EAC7B,MAAM,EA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AAC;QACF,QAAQ,EAAE,kBAAkB,CAC1B,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,WAAW,EACzB,aAAa,CAAC,YAAY,CAC3B,CAAC;KACH,CAAC;CACH"} \ No newline at end of file diff --git a/lib.commonjs/abi-types/Tes_abi.js b/lib.commonjs/abi-types/Tes_abi.js deleted file mode 100644 index bf10fc829..000000000 --- a/lib.commonjs/abi-types/Tes_abi.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Tes_abi.js.map \ No newline at end of file diff --git a/lib.commonjs/abi-types/Tes_abi.js.map b/lib.commonjs/abi-types/Tes_abi.js.map deleted file mode 100644 index 062e82f0f..000000000 --- a/lib.commonjs/abi-types/Tes_abi.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes_abi.js","sourceRoot":"","sources":["../../src.ts/abi-types/Tes_abi.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.commonjs/abi-types/common.d.ts b/lib.commonjs/abi-types/common.d.ts deleted file mode 100644 index d6e86d0d7..000000000 --- a/lib.commonjs/abi-types/common.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import type { FunctionFragment, Typed, EventFragment, ContractTransaction, ContractTransactionResponse, DeferredTopicFilter, EventLog, TransactionRequest, LogDescription } from "../corebc.js"; -export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> extends DeferredTopicFilter { -} -export interface TypedContractEvent = any, OutputTuple extends Array = any, OutputObject = any> { - (...args: Partial): TypedDeferredTopicFilter>; - name: string; - fragment: EventFragment; - getFragment(...args: Partial): EventFragment; -} -type __TypechainAOutputTuple = T extends TypedContractEvent ? W : never; -type __TypechainOutputObject = T extends TypedContractEvent ? V : never; -export interface TypedEventLog extends Omit { - args: __TypechainAOutputTuple & __TypechainOutputObject; -} -export interface TypedLogDescription extends Omit { - args: __TypechainAOutputTuple & __TypechainOutputObject; -} -export type TypedListener = (...listenerArg: [ - ...__TypechainAOutputTuple, - TypedEventLog, - ...undefined[] -]) => void; -export type MinCoreBCFactory = { - deploy(...a: ARGS[]): Promise; -}; -export type GetContractTypeFromFactory = F extends MinCoreBCFactory ? C : never; -export type GetARGsTypeFromFactory = F extends MinCoreBCFactory ? Parameters : never; -export type StateMutability = "nonpayable" | "payable" | "view"; -export type BaseOverrides = Omit; -export type NonPayableOverrides = Omit; -export type PayableOverrides = Omit; -export type ViewOverrides = Omit; -export type Overrides = S extends "nonpayable" ? NonPayableOverrides : S extends "payable" ? PayableOverrides : ViewOverrides; -export type PostfixOverrides, S extends StateMutability> = A | [...A, Overrides]; -export type ContractMethodArgs, S extends StateMutability> = PostfixOverrides<{ - [I in keyof A]-?: A[I] | Typed; -}, S>; -export type DefaultReturnType = R extends Array ? R[0] : R; -export interface TypedContractMethod = Array, R = any, S extends StateMutability = "payable"> { - (...args: ContractMethodArgs): S extends "view" ? Promise> : Promise; - name: string; - fragment: FunctionFragment; - getFragment(...args: ContractMethodArgs): FunctionFragment; - populateTransaction(...args: ContractMethodArgs): Promise; - staticCall(...args: ContractMethodArgs): Promise>; - send(...args: ContractMethodArgs): Promise; - estimateGas(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; -} -export {}; -//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi-types/common.d.ts.map b/lib.commonjs/abi-types/common.d.ts.map deleted file mode 100644 index 1d45da294..000000000 --- a/lib.commonjs/abi-types/common.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src.ts/abi-types/common.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,gBAAgB,EAChB,KAAK,EACL,aAAa,EACb,mBAAmB,EACnB,2BAA2B,EAC3B,mBAAmB,EACnB,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACf,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,wBAAwB,CAAC,Q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C,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC9E,WAAW,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChE,gBAAgB,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACjE"} \ No newline at end of file diff --git a/lib.commonjs/abi-types/common.js b/lib.commonjs/abi-types/common.js deleted file mode 100644 index 023264ffe..000000000 --- a/lib.commonjs/abi-types/common.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/lib.commonjs/abi-types/common.js.map b/lib.commonjs/abi-types/common.js.map deleted file mode 100644 index a8598baee..000000000 --- a/lib.commonjs/abi-types/common.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src.ts/abi-types/common.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.commonjs/abi-types/factories/Tes__factory.d.ts b/lib.commonjs/abi-types/factories/Tes__factory.d.ts deleted file mode 100644 index 9fb691f6d..000000000 --- a/lib.commonjs/abi-types/factories/Tes__factory.d.ts +++ /dev/null @@ -1,280 +0,0 @@ -import { ContractRunner } from "../../corebc.js"; -import type { Tes, TesInterface } from "../Tes.js"; -export declare class Tes__factory { - static readonly abi: readonly [{ - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "approved"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "Approval"; - readonly type: "event"; - }, { - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }, { - readonly indexed: false; - readonly internalType: "bool"; - readonly name: "approved"; - readonly type: "bool"; - }]; - readonly name: "ApprovalForAll"; - readonly type: "event"; - }, { - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "Transfer"; - readonly type: "event"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "approve"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }]; - readonly name: "balanceOf"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256[]"; - readonly name: "ids"; - readonly type: "uint256[]"; - }]; - readonly name: "batchOwnerOf"; - readonly outputs: readonly [{ - readonly internalType: "address[]"; - readonly name: ""; - readonly type: "address[]"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "getApproved"; - readonly outputs: readonly [{ - readonly internalType: "address"; - readonly name: ""; - readonly type: "address"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }]; - readonly name: "isApprovedForAll"; - readonly outputs: readonly [{ - readonly internalType: "bool"; - readonly name: ""; - readonly type: "bool"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }]; - readonly name: "mint"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "ownerOf"; - readonly outputs: readonly [{ - readonly internalType: "address"; - readonly name: ""; - readonly type: "address"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "safeTransferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }, { - readonly internalType: "bytes"; - readonly name: "data"; - readonly type: "bytes"; - }]; - readonly name: "safeTransferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }, { - readonly internalType: "bool"; - readonly name: "approved"; - readonly type: "bool"; - }]; - readonly name: "setApprovalForAll"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "index"; - readonly type: "uint256"; - }]; - readonly name: "tokenByIndex"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "index"; - readonly type: "uint256"; - }]; - readonly name: "tokenOfOwnerByIndex"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly []; - readonly name: "totalSupply"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "transferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }]; - static createInterface(): TesInterface; - static connect(address: string, runner?: ContractRunner | null): Tes; -} -//# sourceMappingURL=Tes__factory.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi-types/factories/Tes__factory.d.ts.map b/lib.commonjs/abi-types/factories/Tes__factory.d.ts.map deleted file mode 100644 index 9c0f56a13..000000000 --- a/lib.commonjs/abi-types/factories/Tes__factory.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes__factory.d.ts","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/Tes__factory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAY,cAAc,EAAa,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAuWnD,qBAAa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAQ;IAC3B,MAAM,CAAC,eAAe,IAAI,YAAY;IAGtC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,GAAG,GAAG;CAGrE"} \ No newline at end of file diff --git a/lib.commonjs/abi-types/factories/Tes__factory.js b/lib.commonjs/abi-types/factories/Tes__factory.js deleted file mode 100644 index fd589bb96..000000000 --- a/lib.commonjs/abi-types/factories/Tes__factory.js +++ /dev/null @@ -1,374 +0,0 @@ -"use strict"; -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Tes__factory = void 0; -const corebc_js_1 = require("../../corebc.js"); -const _abi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "approved", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "Approval", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "operator", - type: "address", - }, - { - indexed: false, - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "ApprovalForAll", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "to", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "Transfer", - type: "event", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "approve", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "balanceOf", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256[]", - name: "ids", - type: "uint256[]", - }, - ], - name: "batchOwnerOf", - outputs: [ - { - internalType: "address[]", - name: "", - type: "address[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "getApproved", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "operator", - type: "address", - }, - ], - name: "isApprovedForAll", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - ], - name: "mint", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "ownerOf", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - { - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "setApprovalForAll", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "index", - type: "uint256", - }, - ], - name: "tokenByIndex", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "uint256", - name: "index", - type: "uint256", - }, - ], - name: "tokenOfOwnerByIndex", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "totalSupply", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "transferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, -]; -class Tes__factory { - static abi = _abi; - static createInterface() { - return new corebc_js_1.Interface(_abi); - } - static connect(address, runner) { - return new corebc_js_1.Contract(address, _abi, runner); - } -} -exports.Tes__factory = Tes__factory; -//# sourceMappingURL=Tes__factory.js.map \ No newline at end of file diff --git a/lib.commonjs/abi-types/factories/Tes__factory.js.map b/lib.commonjs/abi-types/factories/Tes__factory.js.map deleted file mode 100644 index 7092d2c05..000000000 --- a/lib.commonjs/abi-types/factories/Tes__factory.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes__factory.js","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/Tes__factory.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;;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tes_abi__factory.d.ts b/lib.commonjs/abi-types/factories/Tes_abi__factory.d.ts deleted file mode 100644 index bd8c9ccc6..000000000 --- a/lib.commonjs/abi-types/factories/Tes_abi__factory.d.ts +++ /dev/null @@ -1,280 +0,0 @@ -import { ContractRunner } from "../../corebc.js"; -import type { Tes_abi, Tes_abiInterface } from "../Tes_abi.js"; -export declare class Tes_abi__factory { - static readonly abi: readonly [{ - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "approved"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "Approval"; - readonly type: "event"; - }, { - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }, { - readonly indexed: false; - readonly internalType: "bool"; - readonly name: "approved"; - readonly type: "bool"; - }]; - readonly name: "ApprovalForAll"; - readonly type: "event"; - }, { - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "Transfer"; - readonly type: "event"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "approve"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }]; - readonly name: "balanceOf"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256[]"; - readonly name: "ids"; - readonly type: "uint256[]"; - }]; - readonly name: "batchOwnerOf"; - readonly outputs: readonly [{ - readonly internalType: "address[]"; - readonly name: ""; - readonly type: "address[]"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "getApproved"; - readonly outputs: readonly [{ - readonly internalType: "address"; - readonly name: ""; - readonly type: "address"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }]; - readonly name: "isApprovedForAll"; - readonly outputs: readonly [{ - readonly internalType: "bool"; - readonly name: ""; - readonly type: "bool"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }]; - readonly name: "mint"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "ownerOf"; - readonly outputs: readonly [{ - readonly internalType: "address"; - readonly name: ""; - readonly type: "address"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "safeTransferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }, { - readonly internalType: "bytes"; - readonly name: "data"; - readonly type: "bytes"; - }]; - readonly name: "safeTransferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }, { - readonly internalType: "bool"; - readonly name: "approved"; - readonly type: "bool"; - }]; - readonly name: "setApprovalForAll"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "index"; - readonly type: "uint256"; - }]; - readonly name: "tokenByIndex"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "index"; - readonly type: "uint256"; - }]; - readonly name: "tokenOfOwnerByIndex"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly []; - readonly name: "totalSupply"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "transferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }]; - static createInterface(): Tes_abiInterface; - static connect(address: string, runner?: ContractRunner | null): Tes_abi; -} -//# sourceMappingURL=Tes_abi__factory.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi-types/factories/Tes_abi__factory.d.ts.map b/lib.commonjs/abi-types/factories/Tes_abi__factory.d.ts.map deleted file mode 100644 index 5abc35679..000000000 --- a/lib.commonjs/abi-types/factories/Tes_abi__factory.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes_abi__factory.d.ts","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/Tes_abi__factory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAY,cAAc,EAAa,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAuW/D,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAQ;IAC3B,MAAM,CAAC,eAAe,IAAI,gBAAgB;IAG1C,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO;CAGzE"} \ No newline at end of file diff --git a/lib.commonjs/abi-types/factories/Tes_abi__factory.js b/lib.commonjs/abi-types/factories/Tes_abi__factory.js deleted file mode 100644 index 448c01fbe..000000000 --- a/lib.commonjs/abi-types/factories/Tes_abi__factory.js +++ /dev/null @@ -1,374 +0,0 @@ -"use strict"; -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Tes_abi__factory = void 0; -const corebc_js_1 = require("../../corebc.js"); -const _abi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "approved", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "Approval", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "operator", - type: "address", - }, - { - indexed: false, - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "ApprovalForAll", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "to", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "Transfer", - type: "event", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "approve", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "balanceOf", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256[]", - name: "ids", - type: "uint256[]", - }, - ], - name: "batchOwnerOf", - outputs: [ - { - internalType: "address[]", - name: "", - type: "address[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "getApproved", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "operator", - type: "address", - }, - ], - name: "isApprovedForAll", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - ], - name: "mint", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "ownerOf", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - { - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "setApprovalForAll", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "index", - type: "uint256", - }, - ], - name: "tokenByIndex", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "uint256", - name: "index", - type: "uint256", - }, - ], - name: "tokenOfOwnerByIndex", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "totalSupply", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "transferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, -]; -class Tes_abi__factory { - static abi = _abi; - static createInterface() { - return new corebc_js_1.Interface(_abi); - } - static connect(address, runner) { - return new corebc_js_1.Contract(address, _abi, runner); - } -} -exports.Tes_abi__factory = Tes_abi__factory; -//# sourceMappingURL=Tes_abi__factory.js.map \ No newline at end of file diff --git a/lib.commonjs/abi-types/factories/Tes_abi__factory.js.map b/lib.commonjs/abi-types/factories/Tes_abi__factory.js.map deleted file mode 100644 index 30434e166..000000000 --- a/lib.commonjs/abi-types/factories/Tes_abi__factory.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes_abi__factory.js","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/Tes_abi__factory.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;;;AAEpB,+CAAsE;AAGtE,MAAM,IAAI,GAAG;IACX;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS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AAY,EAAE,SAAS;gBACvB,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX,MAAa,gBAAgB;IAC3B,MAAM,CAAU,GAAG,GAAG,IAAI,CAAC;IAC3B,MAAM,CAAC,eAAe;QACpB,OAAO,IAAI,qBAAS,CAAC,IAAI,CAAqB,CAAC;IACjD,CAAC;IACD,MAAM,CAAC,OAAO,CAAC,OAAe,EAAE,MAA8B;QAC5D,OAAO,IAAI,oBAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAuB,CAAC;IACnE,CAAC;;AAPH,4CAQC"} \ No newline at end of file diff --git a/lib.commonjs/abi-types/factories/index.d.ts b/lib.commonjs/abi-types/factories/index.d.ts deleted file mode 100644 index e6b4dbcc0..000000000 --- a/lib.commonjs/abi-types/factories/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { Tes__factory } from "./Tes__factory.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi-types/factories/index.d.ts.map b/lib.commonjs/abi-types/factories/index.d.ts.map deleted file mode 100644 index 2727001fd..000000000 --- a/lib.commonjs/abi-types/factories/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/abi-types/factories/index.js b/lib.commonjs/abi-types/factories/index.js deleted file mode 100644 index 82be5be94..000000000 --- a/lib.commonjs/abi-types/factories/index.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Tes__factory = void 0; -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -var Tes__factory_js_1 = require("./Tes__factory.js"); -Object.defineProperty(exports, "Tes__factory", { enumerable: true, get: function () { return Tes__factory_js_1.Tes__factory; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.commonjs/abi-types/factories/index.js.map b/lib.commonjs/abi-types/factories/index.js.map deleted file mode 100644 index 7750b2c8c..000000000 --- a/lib.commonjs/abi-types/factories/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/index.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AACpB,qDAAiD;AAAxC,+GAAA,YAAY,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/abi-types/index.d.ts b/lib.commonjs/abi-types/index.d.ts deleted file mode 100644 index ca4fb7b40..000000000 --- a/lib.commonjs/abi-types/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type { Tes } from "./Tes.js"; -export * as factories from "./factories/index.js"; -export { Tes__factory } from "./factories/Tes__factory.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi-types/index.d.ts.map b/lib.commonjs/abi-types/index.d.ts.map deleted file mode 100644 index 90d11b2fc..000000000 --- a/lib.commonjs/abi-types/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/abi-types/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/abi-types/index.js b/lib.commonjs/abi-types/index.js deleted file mode 100644 index c92186878..000000000 --- a/lib.commonjs/abi-types/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Tes__factory = exports.factories = void 0; -const tslib_1 = require("tslib"); -exports.factories = tslib_1.__importStar(require("./factories/index.js")); -var Tes__factory_js_1 = require("./factories/Tes__factory.js"); -Object.defineProperty(exports, "Tes__factory", { enumerable: true, get: function () { return Tes__factory_js_1.Tes__factory; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.commonjs/abi-types/index.js.map b/lib.commonjs/abi-types/index.js.map deleted file mode 100644 index c8cd9951c..000000000 --- a/lib.commonjs/abi-types/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/abi-types/index.ts"],"names":[],"mappings":";;;;AAIA,0EAAkD;AAClD,+DAA2D;AAAlD,+GAAA,YAAY,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/abi/abi-coder.d.ts b/lib.commonjs/abi/abi-coder.d.ts deleted file mode 100644 index 1350031d4..000000000 --- a/lib.commonjs/abi/abi-coder.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * When sending values to or receiving values from a [[Contract]], the - * data is generally encoded using the [ABI standard](link-solc-abi). - * - * The AbiCoder provides a utility to encode values to ABI data and - * decode values from ABI data. - * - * Most of the time, developers should favour the [[Contract]] class, - * which further abstracts a lot of the finer details of ABI data. - * - * @_section api/abi/abi-coder:ABI Encoding - */ -import { Result } from "./coders/abstract-coder.js"; -import { ParamType } from "./fragments.js"; -import type { BytesLike, CallExceptionAction, CallExceptionError } from "../utils/index.js"; -/** - * About AbiCoder - */ -export declare class AbiCoder { - #private; - /** - * Get the default values for the given %%types%%. - * - * For example, a ``uint`` is by default ``0`` and ``bool`` - * is by default ``false``. - */ - getDefaultValue(types: ReadonlyArray): Result; - /** - * Encode the %%values%% as the %%types%% into ABI data. - * - * @returns DataHexstring - */ - encode(types: ReadonlyArray, values: ReadonlyArray): string; - /** - * Decode the ABI %%data%% as the %%types%% into values. - * - * If %%loose%% decoding is enabled, then strict padding is - * not enforced. Some older versions of Solidity incorrectly - * padded event data emitted from ``external`` functions. - */ - decode(types: ReadonlyArray, data: BytesLike, loose?: boolean): Result; - /** - * Returns the shared singleton instance of a default [[AbiCoder]]. - * - * On the first call, the instance is created internally. - */ - static defaultAbiCoder(): AbiCoder; - /** - * Returns an corebc-compatible [[CallExceptionError]] Error for the given - * result %%data%% for the [[CallExceptionAction]] %%action%% against - * the Transaction %%tx%%. - */ - static getBuiltinCallException(action: CallExceptionAction, tx: { - to?: null | string; - from?: null | string; - data?: string; - }, data: null | BytesLike): CallExceptionError; -} -//# sourceMappingURL=abi-coder.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/abi-coder.d.ts.map b/lib.commonjs/abi/abi-coder.d.ts.map deleted file mode 100644 index a86e1aca8..000000000 --- a/lib.commonjs/abi/abi-coder.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abi-coder.d.ts","sourceRoot":"","sources":["../../src.ts/abi/abi-coder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAiB,MAAM,EAAU,MAAM,4BAA4B,CAAC;AAU3E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAEnB,MAAM,mBAAmB,CAAC;AA8F3B;;GAEG;AACH,qBAAa,QAAQ;;IA2DnB;;;;;OAKG;IACH,eAAe,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM;IAQjE;;;;OAIG;IACH,MAAM,CACJ,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EACxC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GACzB,MAAM;IAeT;;;;;;OAMG;IACH,MAAM,CACJ,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EACxC,IAAI,EAAE,SAAS,EACf,KAAK,CAAC,EAAE,OAAO,GACd,MAAM;IAQT;;;;OAIG;IACH,MAAM,CAAC,eAAe,IAAI,QAAQ;IAOlC;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAC5B,MAAM,EAAE,mBAAmB,EAC3B,EAAE,EAAE;QAAE,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAC/D,IAAI,EAAE,IAAI,GAAG,SAAS,GACrB,kBAAkB;CAQtB"} \ No newline at end of file diff --git a/lib.commonjs/abi/abi-coder.js b/lib.commonjs/abi/abi-coder.js deleted file mode 100644 index 5da77fe8b..000000000 --- a/lib.commonjs/abi/abi-coder.js +++ /dev/null @@ -1,208 +0,0 @@ -"use strict"; -/** - * When sending values to or receiving values from a [[Contract]], the - * data is generally encoded using the [ABI standard](link-solc-abi). - * - * The AbiCoder provides a utility to encode values to ABI data and - * decode values from ABI data. - * - * Most of the time, developers should favour the [[Contract]] class, - * which further abstracts a lot of the finer details of ABI data. - * - * @_section api/abi/abi-coder:ABI Encoding - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AbiCoder = void 0; -const index_js_1 = require("../utils/index.js"); -const abstract_coder_js_1 = require("./coders/abstract-coder.js"); -const address_js_1 = require("./coders/address.js"); -const array_js_1 = require("./coders/array.js"); -const boolean_js_1 = require("./coders/boolean.js"); -const bytes_js_1 = require("./coders/bytes.js"); -const fixed_bytes_js_1 = require("./coders/fixed-bytes.js"); -const null_js_1 = require("./coders/null.js"); -const number_js_1 = require("./coders/number.js"); -const string_js_1 = require("./coders/string.js"); -const tuple_js_1 = require("./coders/tuple.js"); -const fragments_js_1 = require("./fragments.js"); -const index_js_2 = require("../address/index.js"); -const index_js_3 = require("../utils/index.js"); -// https://docs.soliditylang.org/en/v0.8.17/control-structures.html -const PanicReasons = new Map(); -PanicReasons.set(0x00, "GENERIC_PANIC"); -PanicReasons.set(0x01, "ASSERT_FALSE"); -PanicReasons.set(0x11, "OVERFLOW"); -PanicReasons.set(0x12, "DIVIDE_BY_ZERO"); -PanicReasons.set(0x21, "ENUM_RANGE_ERROR"); -PanicReasons.set(0x22, "BAD_STORAGE_DATA"); -PanicReasons.set(0x31, "STACK_UNDERFLOW"); -PanicReasons.set(0x32, "ARRAY_RANGE_ERROR"); -PanicReasons.set(0x41, "OUT_OF_MEMORY"); -PanicReasons.set(0x51, "UNINITIALIZED_FUNCTION_CALL"); -const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); -const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); -let defaultCoder = null; -function getBuiltinCallException(action, tx, data, abiCoder) { - let message = "missing revert data"; - let reason = null; - const invocation = null; - let revert = null; - if (data) { - message = "execution reverted"; - const bytes = (0, index_js_3.getBytes)(data); - data = (0, index_js_3.hexlify)(data); - if (bytes.length === 0) { - message += " (no data present; likely require(false) occurred"; - reason = "require(false)"; - } - else if (bytes.length % 32 !== 4) { - message += " (could not decode reason; invalid data length)"; - } - else if ((0, index_js_3.hexlify)(bytes.slice(0, 4)) === "0x08c379a0") { - // Error(string) - try { - reason = abiCoder.decode(["string"], bytes.slice(4))[0]; - revert = { - signature: "Error(string)", - name: "Error", - args: [reason], - }; - message += `: ${JSON.stringify(reason)}`; - } - catch (error) { - message += " (could not decode reason; invalid string data)"; - } - } - else if ((0, index_js_3.hexlify)(bytes.slice(0, 4)) === "0x4e487b71") { - // Panic(uint256) - try { - const code = Number(abiCoder.decode(["uint256"], bytes.slice(4))[0]); - revert = { - signature: "Panic(uint256)", - name: "Panic", - args: [code], - }; - reason = `Panic due to ${PanicReasons.get(code) || "UNKNOWN"}(${code})`; - message += `: ${reason}`; - } - catch (error) { - message += " (could not decode panic code)"; - } - } - else { - message += " (unknown custom error)"; - } - } - const transaction = { - to: tx.to ? (0, index_js_2.getAddress)(tx.to) : null, - data: tx.data || "0x", - }; - if (tx.from) { - transaction.from = (0, index_js_2.getAddress)(tx.from); - } - return (0, index_js_3.makeError)(message, "CALL_EXCEPTION", { - action, - data, - reason, - transaction, - invocation, - revert, - }); -} -/** - * About AbiCoder - */ -class AbiCoder { - #getCoder(param) { - if (param.isArray()) { - return new array_js_1.ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name); - } - if (param.isTuple()) { - return new tuple_js_1.TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name); - } - switch (param.baseType) { - case "address": - return new address_js_1.AddressCoder(param.name); - case "bool": - return new boolean_js_1.BooleanCoder(param.name); - case "string": - return new string_js_1.StringCoder(param.name); - case "bytes": - return new bytes_js_1.BytesCoder(param.name); - case "": - return new null_js_1.NullCoder(param.name); - } - // u?int[0-9]* - let match = param.type.match(paramTypeNumber); - if (match) { - let size = parseInt(match[2] || "256"); - (0, index_js_1.assertArgument)(size !== 0 && size <= 256 && size % 8 === 0, "invalid " + match[1] + " bit length", "param", param); - return new number_js_1.NumberCoder(size / 8, match[1] === "int", param.name); - } - // bytes[0-9]+ - match = param.type.match(paramTypeBytes); - if (match) { - let size = parseInt(match[1]); - (0, index_js_1.assertArgument)(size !== 0 && size <= 32, "invalid bytes length", "param", param); - return new fixed_bytes_js_1.FixedBytesCoder(size, param.name); - } - (0, index_js_1.assertArgument)(false, "invalid type", "type", param.type); - } - /** - * Get the default values for the given %%types%%. - * - * For example, a ``uint`` is by default ``0`` and ``bool`` - * is by default ``false``. - */ - getDefaultValue(types) { - const coders = types.map((type) => this.#getCoder(fragments_js_1.ParamType.from(type))); - const coder = new tuple_js_1.TupleCoder(coders, "_"); - return coder.defaultValue(); - } - /** - * Encode the %%values%% as the %%types%% into ABI data. - * - * @returns DataHexstring - */ - encode(types, values) { - (0, index_js_1.assertArgumentCount)(values.length, types.length, "types/values length mismatch"); - const coders = types.map((type) => this.#getCoder(fragments_js_1.ParamType.from(type))); - const coder = new tuple_js_1.TupleCoder(coders, "_"); - const writer = new abstract_coder_js_1.Writer(); - coder.encode(writer, values); - return writer.data; - } - /** - * Decode the ABI %%data%% as the %%types%% into values. - * - * If %%loose%% decoding is enabled, then strict padding is - * not enforced. Some older versions of Solidity incorrectly - * padded event data emitted from ``external`` functions. - */ - decode(types, data, loose) { - const coders = types.map((type) => this.#getCoder(fragments_js_1.ParamType.from(type))); - const coder = new tuple_js_1.TupleCoder(coders, "_"); - return coder.decode(new abstract_coder_js_1.Reader(data, loose)); - } - /** - * Returns the shared singleton instance of a default [[AbiCoder]]. - * - * On the first call, the instance is created internally. - */ - static defaultAbiCoder() { - if (defaultCoder == null) { - defaultCoder = new AbiCoder(); - } - return defaultCoder; - } - /** - * Returns an corebc-compatible [[CallExceptionError]] Error for the given - * result %%data%% for the [[CallExceptionAction]] %%action%% against - * the Transaction %%tx%%. - */ - static getBuiltinCallException(action, tx, data) { - return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder()); - } -} -exports.AbiCoder = AbiCoder; -//# sourceMappingURL=abi-coder.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/abi-coder.js.map b/lib.commonjs/abi/abi-coder.js.map deleted file mode 100644 index 64cd2edea..000000000 --- a/lib.commonjs/abi/abi-coder.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abi-coder.js","sourceRoot":"","sources":["../../src.ts/abi/abi-coder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,gDAAwE;AAExE,kEAA2E;AAC3E,oDAAmD;AACnD,gDAA+C;AAC/C,oDAAmD;AACnD,gDAA+C;AAC/C,4DAA0D;AAC1D,8CAA6C;AAC7C,kDAAiD;AACjD,kDAAiD;AACjD,gDAA+C;AAC/C,iDAA2C;AAE3C,kDAAiD;AACjD,gDAAiE;AASjE,mEAAmE;AACnE,MAAM,YAAY,GAAwB,IAAI,GAAG,EAAE,CAAC;AACpD,YAAY,CA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AAK,CAAC,MAAM,CAAC,IAAI,0BAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,eAAe;QACpB,IAAI,YAAY,IAAI,IAAI,EAAE;YACxB,YAAY,GAAG,IAAI,QAAQ,EAAE,CAAC;SAC/B;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAC5B,MAA2B,EAC3B,EAA+D,EAC/D,IAAsB;QAEtB,OAAO,uBAAuB,CAC5B,MAAM,EACN,EAAE,EACF,IAAI,EACJ,QAAQ,CAAC,eAAe,EAAE,CAC3B,CAAC;IACJ,CAAC;CACF;AAhJD,4BAgJC"} \ No newline at end of file diff --git a/lib.commonjs/abi/bytes32.d.ts b/lib.commonjs/abi/bytes32.d.ts deleted file mode 100644 index 73455cb5d..000000000 --- a/lib.commonjs/abi/bytes32.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * About bytes32 strings... - * - * @_docloc: api/utils:Bytes32 Strings - */ -import type { BytesLike } from "../utils/index.js"; -/** - * Encodes %%text%% as a Bytes32 string. - */ -export declare function encodeBytes32String(text: string): string; -/** - * Encodes the Bytes32-encoded %%bytes%% into a string. - */ -export declare function decodeBytes32String(_bytes: BytesLike): string; -//# sourceMappingURL=bytes32.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/bytes32.d.ts.map b/lib.commonjs/abi/bytes32.d.ts.map deleted file mode 100644 index 09513605d..000000000 --- a/lib.commonjs/abi/bytes32.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bytes32.d.ts","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWxD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAmB7D"} \ No newline at end of file diff --git a/lib.commonjs/abi/bytes32.js b/lib.commonjs/abi/bytes32.js deleted file mode 100644 index e5c22aa37..000000000 --- a/lib.commonjs/abi/bytes32.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; -/** - * About bytes32 strings... - * - * @_docloc: api/utils:Bytes32 Strings - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.decodeBytes32String = exports.encodeBytes32String = void 0; -const index_js_1 = require("../utils/index.js"); -/** - * Encodes %%text%% as a Bytes32 string. - */ -function encodeBytes32String(text) { - // Get the bytes - const bytes = (0, index_js_1.toUtf8Bytes)(text); - // Check we have room for null-termination - if (bytes.length > 31) { - throw new Error("bytes32 string must be less than 32 bytes"); - } - // Zero-pad (implicitly null-terminates) - return (0, index_js_1.zeroPadBytes)(bytes, 32); -} -exports.encodeBytes32String = encodeBytes32String; -/** - * Encodes the Bytes32-encoded %%bytes%% into a string. - */ -function decodeBytes32String(_bytes) { - const data = (0, index_js_1.getBytes)(_bytes, "bytes"); - // Must be 32 bytes with a null-termination - if (data.length !== 32) { - throw new Error("invalid bytes32 - not 32 bytes long"); - } - if (data[31] !== 0) { - throw new Error("invalid bytes32 string - no null terminator"); - } - // Find the null termination - let length = 31; - while (data[length - 1] === 0) { - length--; - } - // Determine the string value - return (0, index_js_1.toUtf8String)(data.slice(0, length)); -} -exports.decodeBytes32String = decodeBytes32String; -//# sourceMappingURL=bytes32.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/bytes32.js.map b/lib.commonjs/abi/bytes32.js.map deleted file mode 100644 index af74c1571..000000000 --- a/lib.commonjs/abi/bytes32.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bytes32.js","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gDAK2B;AAI3B;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,gBAAgB;IAChB,MAAM,KAAK,GAAG,IAAA,sBAAW,EAAC,IAAI,CAAC,CAAC;IAEhC,0CAA0C;IAC1C,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC9D;IAED,wCAAwC;IACxC,OAAO,IAAA,uBAAY,EAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC;AAXD,kDAWC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,MAAiB;IACnD,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC,2CAA2C;IAC3C,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KACxD;IACD,IAAI,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;KAChE;IAED,4BAA4B;IAC5B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE;QAC7B,MAAM,EAAE,CAAC;KACV;IAED,6BAA6B;IAC7B,OAAO,IAAA,uBAAY,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC7C,CAAC;AAnBD,kDAmBC"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/abstract-coder.d.ts b/lib.commonjs/abi/coders/abstract-coder.d.ts deleted file mode 100644 index 53d1481b3..000000000 --- a/lib.commonjs/abi/coders/abstract-coder.d.ts +++ /dev/null @@ -1,117 +0,0 @@ -import type { BigNumberish, BytesLike } from "../../utils/index.js"; -/** - * @_ignore: - */ -export declare const WordSize: number; -/** - * A [[Result]] is a sub-class of Array, which allows accessing any - * of its values either positionally by its index or, if keys are - * provided by its name. - * - * @_docloc: api/abi - */ -export declare class Result extends Array { - #private; - [K: string | number]: any; - /** - * @private - */ - constructor(...args: Array); - /** - * Returns the Result as a normal Array. - * - * This will throw if there are any outstanding deferred - * errors. - */ - toArray(): Array; - /** - * Returns the Result as an Object with each name-value pair. - * - * This will throw if any value is unnamed, or if there are - * any outstanding deferred errors. - */ - toObject(): Record; - /** - * @_ignore - */ - slice(start?: number | undefined, end?: number | undefined): Result; - /** - * @_ignore - */ - filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result; - /** - * Returns the value for %%name%%. - * - * Since it is possible to have a key whose name conflicts with - * a method on a [[Result]] or its superclass Array, or any - * JavaScript keyword, this ensures all named values are still - * accessible by name. - */ - getValue(name: string): any; - /** - * Creates a new [[Result]] for %%items%% with each entry - * also accessible by its corresponding name in %%keys%%. - */ - static fromItems(items: Array, keys?: Array): Result; -} -/** - * Returns all errors found in a [[Result]]. - * - * Since certain errors encountered when creating a [[Result]] do - * not impact the ability to continue parsing data, they are - * deferred until they are actually accessed. Hence a faulty string - * in an Event that is never used does not impact the program flow. - * - * However, sometimes it may be useful to access, identify or - * validate correctness of a [[Result]]. - * - * @_docloc api/abi - */ -export declare function checkResultErrors(result: Result): Array<{ - path: Array; - error: Error; -}>; -/** - * @_ignore - */ -export declare abstract class Coder { - readonly name: string; - readonly type: string; - readonly localName: string; - readonly dynamic: boolean; - constructor(name: string, type: string, localName: string, dynamic: boolean); - _throwError(message: string, value: any): never; - abstract encode(writer: Writer, value: any): number; - abstract decode(reader: Reader): any; - abstract defaultValue(): any; -} -/** - * @_ignore - */ -export declare class Writer { - #private; - constructor(); - get data(): string; - get length(): number; - appendWriter(writer: Writer): number; - writeBytes(value: BytesLike): number; - writeValue(value: BigNumberish): number; - writeUpdatableValue(): (value: BigNumberish) => void; -} -/** - * @_ignore - */ -export declare class Reader { - #private; - readonly allowLoose: boolean; - constructor(data: BytesLike, allowLoose?: boolean); - get data(): string; - get dataLength(): number; - get consumed(): number; - get bytes(): Uint8Array; - subReader(offset: number): Reader; - readBytes(length: number, loose?: boolean): Uint8Array; - readValue(): bigint; - readIndex(): number; -} -//# sourceMappingURL=abstract-coder.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/abstract-coder.d.ts.map b/lib.commonjs/abi/coders/abstract-coder.d.ts.map deleted file mode 100644 index 3141c016e..000000000 --- a/lib.commonjs/abi/coders/abstract-coder.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-coder.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/abstract-coder.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAW,CAAC;AAiBnC;;;;;;GAMG;AACH,qBAAa,MAAO,SAAQ,KAAK,CAAC,GAAG,CAAC;;IAGpC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAE1B;;OAEG;gBACS,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;IAkG/B;;;;;OAKG;IACH,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC;IAWrB;;;;;OAKG;IACH,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAuB/B;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM;IAkCnE;;OAEG;IACH,MAAM,CACJ,QAAQ,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,EAC5D,OAAO,CAAC,EAAE,GAAG,GACZ,MAAM;IAkBT;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG;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Y,KAAK,IAAI;CAQrD;AAED;;GAEG;AACH,qBAAa,MAAM;;IAKjB,QAAQ,CAAC,UAAU,EAAG,OAAO,CAAC;gBAKlB,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO;IAQjD,IAAI,IAAI,IAAI,MAAM,CAEjB;IACD,IAAI,UAAU,IAAI,MAAM,CAEvB;IACD,IAAI,QAAQ,IAAI,MAAM,CAErB;IACD,IAAI,KAAK,IAAI,UAAU,CAEtB;IAuBD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAKjC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU;IAQtD,SAAS,IAAI,MAAM;IAInB,SAAS,IAAI,MAAM;CAGpB"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/abstract-coder.js b/lib.commonjs/abi/coders/abstract-coder.js deleted file mode 100644 index 67d44dcc3..000000000 --- a/lib.commonjs/abi/coders/abstract-coder.js +++ /dev/null @@ -1,416 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Reader = exports.Writer = exports.Coder = exports.checkResultErrors = exports.Result = exports.WordSize = void 0; -const index_js_1 = require("../../utils/index.js"); -/** - * @_ignore: - */ -exports.WordSize = 32; -const Padding = new Uint8Array(exports.WordSize); -// Properties used to immediate pass through to the underlying object -// - `then` is used to detect if an object is a Promise for await -const passProperties = ["then"]; -const _guard = {}; -function throwError(name, error) { - const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`); - wrapped.error = error; - throw wrapped; -} -/** - * A [[Result]] is a sub-class of Array, which allows accessing any - * of its values either positionally by its index or, if keys are - * provided by its name. - * - * @_docloc: api/abi - */ -class Result extends Array { - #names; - /** - * @private - */ - constructor(...args) { - // To properly sub-class Array so the other built-in - // functions work, the constructor has to behave fairly - // well. So, in the event we are created via fromItems() - // we build the read-only Result object we want, but on - // any other input, we use the default constructor - // constructor(guard: any, items: Array, keys?: Array); - const guard = args[0]; - let items = args[1]; - let names = (args[2] || []).slice(); - let wrap = true; - if (guard !== _guard) { - items = args; - names = []; - wrap = false; - } - // Can't just pass in ...items since an array of length 1 - // is a special case in the super. - super(items.length); - items.forEach((item, index) => { - this[index] = item; - }); - // Find all unique keys - const nameCounts = names.reduce((accum, name) => { - if (typeof name === "string") { - accum.set(name, (accum.get(name) || 0) + 1); - } - return accum; - }, new Map()); - // Remove any key thats not unique - this.#names = Object.freeze(items.map((item, index) => { - const name = names[index]; - if (name != null && nameCounts.get(name) === 1) { - return name; - } - return null; - })); - if (!wrap) { - return; - } - // A wrapped Result is immutable - Object.freeze(this); - // Proxy indices and names so we can trap deferred errors - return new Proxy(this, { - get: (target, prop, receiver) => { - if (typeof prop === "string") { - // Index accessor - if (prop.match(/^[0-9]+$/)) { - const index = (0, index_js_1.getNumber)(prop, "%index"); - if (index < 0 || index >= this.length) { - throw new RangeError("out of result range"); - } - const item = target[index]; - if (item instanceof Error) { - throwError(`index ${index}`, item); - } - return item; - } - // Pass important checks (like `then` for Promise) through - if (passProperties.indexOf(prop) >= 0) { - return Reflect.get(target, prop, receiver); - } - const value = target[prop]; - if (value instanceof Function) { - // Make sure functions work with private variables - // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding - return function (...args) { - return value.apply(this === receiver ? target : this, args); - }; - } - else if (!(prop in target)) { - // Possible name accessor - return target.getValue.apply(this === receiver ? target : this, [ - prop, - ]); - } - } - return Reflect.get(target, prop, receiver); - }, - }); - } - /** - * Returns the Result as a normal Array. - * - * This will throw if there are any outstanding deferred - * errors. - */ - toArray() { - const result = []; - this.forEach((item, index) => { - if (item instanceof Error) { - throwError(`index ${index}`, item); - } - result.push(item); - }); - return result; - } - /** - * Returns the Result as an Object with each name-value pair. - * - * This will throw if any value is unnamed, or if there are - * any outstanding deferred errors. - */ - toObject() { - return this.#names.reduce((accum, name, index) => { - (0, index_js_1.assert)(name != null, "value at index ${ index } unnamed", "UNSUPPORTED_OPERATION", { - operation: "toObject()", - }); - // Add values for names that don't conflict - if (!(name in accum)) { - accum[name] = this.getValue(name); - } - return accum; - }, {}); - } - /** - * @_ignore - */ - slice(start, end) { - if (start == null) { - start = 0; - } - if (start < 0) { - start += this.length; - if (start < 0) { - start = 0; - } - } - if (end == null) { - end = this.length; - } - if (end < 0) { - end += this.length; - if (end < 0) { - end = 0; - } - } - if (end > this.length) { - end = this.length; - } - const result = [], names = []; - for (let i = start; i < end; i++) { - result.push(this[i]); - names.push(this.#names[i]); - } - return new Result(_guard, result, names); - } - /** - * @_ignore - */ - filter(callback, thisArg) { - const result = [], names = []; - for (let i = 0; i < this.length; i++) { - const item = this[i]; - if (item instanceof Error) { - throwError(`index ${i}`, item); - } - if (callback.call(thisArg, item, i, this)) { - result.push(item); - names.push(this.#names[i]); - } - } - return new Result(_guard, result, names); - } - /** - * Returns the value for %%name%%. - * - * Since it is possible to have a key whose name conflicts with - * a method on a [[Result]] or its superclass Array, or any - * JavaScript keyword, this ensures all named values are still - * accessible by name. - */ - getValue(name) { - const index = this.#names.indexOf(name); - if (index === -1) { - return undefined; - } - const value = this[index]; - if (value instanceof Error) { - throwError(`property ${JSON.stringify(name)}`, value.error); - } - return value; - } - /** - * Creates a new [[Result]] for %%items%% with each entry - * also accessible by its corresponding name in %%keys%%. - */ - static fromItems(items, keys) { - return new Result(_guard, items, keys); - } -} -exports.Result = Result; -/** - * Returns all errors found in a [[Result]]. - * - * Since certain errors encountered when creating a [[Result]] do - * not impact the ability to continue parsing data, they are - * deferred until they are actually accessed. Hence a faulty string - * in an Event that is never used does not impact the program flow. - * - * However, sometimes it may be useful to access, identify or - * validate correctness of a [[Result]]. - * - * @_docloc api/abi - */ -function checkResultErrors(result) { - // Find the first error (if any) - const errors = []; - const checkErrors = function (path, object) { - if (!Array.isArray(object)) { - return; - } - for (let key in object) { - const childPath = path.slice(); - childPath.push(key); - try { - checkErrors(childPath, object[key]); - } - catch (error) { - errors.push({ path: childPath, error: error }); - } - } - }; - checkErrors([], result); - return errors; -} -exports.checkResultErrors = checkResultErrors; -function getValue(value) { - let bytes = (0, index_js_1.toBeArray)(value); - (0, index_js_1.assert)(bytes.length <= exports.WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { - buffer: bytes, - length: exports.WordSize, - offset: bytes.length, - }); - if (bytes.length !== exports.WordSize) { - bytes = (0, index_js_1.getBytesCopy)((0, index_js_1.concat)([Padding.slice(bytes.length % exports.WordSize), bytes])); - } - return bytes; -} -/** - * @_ignore - */ -class Coder { - // The coder name: - // - address, uint256, tuple, array, etc. - name; - // The fully expanded type, including composite types: - // - address, uint256, tuple(address,bytes), uint256[3][4][], etc. - type; - // The localName bound in the signature, in this example it is "baz": - // - tuple(address foo, uint bar) baz - localName; - // Whether this type is dynamic: - // - Dynamic: bytes, string, address[], tuple(boolean[]), etc. - // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8) - dynamic; - constructor(name, type, localName, dynamic) { - (0, index_js_1.defineProperties)(this, { name, type, localName, dynamic }, { - name: "string", - type: "string", - localName: "string", - dynamic: "boolean", - }); - } - _throwError(message, value) { - (0, index_js_1.assertArgument)(false, message, this.localName, value); - } -} -exports.Coder = Coder; -/** - * @_ignore - */ -class Writer { - // An array of WordSize lengthed objects to concatenation - #data; - #dataLength; - constructor() { - this.#data = []; - this.#dataLength = 0; - } - get data() { - return (0, index_js_1.concat)(this.#data); - } - get length() { - return this.#dataLength; - } - #writeData(data) { - this.#data.push(data); - this.#dataLength += data.length; - return data.length; - } - appendWriter(writer) { - return this.#writeData((0, index_js_1.getBytesCopy)(writer.data)); - } - // Arrayish item; pad on the right to *nearest* WordSize - writeBytes(value) { - let bytes = (0, index_js_1.getBytesCopy)(value); - const paddingOffset = bytes.length % exports.WordSize; - if (paddingOffset) { - bytes = (0, index_js_1.getBytesCopy)((0, index_js_1.concat)([bytes, Padding.slice(paddingOffset)])); - } - return this.#writeData(bytes); - } - // Numeric item; pad on the left *to* WordSize - writeValue(value) { - return this.#writeData(getValue(value)); - } - // Inserts a numeric place-holder, returning a callback that can - // be used to asjust the value later - writeUpdatableValue() { - const offset = this.#data.length; - this.#data.push(Padding); - this.#dataLength += exports.WordSize; - return (value) => { - this.#data[offset] = getValue(value); - }; - } -} -exports.Writer = Writer; -/** - * @_ignore - */ -class Reader { - // Allows incomplete unpadded data to be read; otherwise an error - // is raised if attempting to overrun the buffer. This is required - // to deal with an old Solidity bug, in which event data for - // external (not public thoguh) was tightly packed. - allowLoose; - #data; - #offset; - constructor(data, allowLoose) { - (0, index_js_1.defineProperties)(this, { allowLoose: !!allowLoose }); - this.#data = (0, index_js_1.getBytesCopy)(data); - this.#offset = 0; - } - get data() { - return (0, index_js_1.hexlify)(this.#data); - } - get dataLength() { - return this.#data.length; - } - get consumed() { - return this.#offset; - } - get bytes() { - return new Uint8Array(this.#data); - } - #peekBytes(offset, length, loose) { - let alignedLength = Math.ceil(length / exports.WordSize) * exports.WordSize; - if (this.#offset + alignedLength > this.#data.length) { - if (this.allowLoose && - loose && - this.#offset + length <= this.#data.length) { - alignedLength = length; - } - else { - (0, index_js_1.assert)(false, "data out-of-bounds", "BUFFER_OVERRUN", { - buffer: (0, index_js_1.getBytesCopy)(this.#data), - length: this.#data.length, - offset: this.#offset + alignedLength, - }); - } - } - return this.#data.slice(this.#offset, this.#offset + alignedLength); - } - // Create a sub-reader with the same underlying data, but offset - subReader(offset) { - return new Reader(this.#data.slice(this.#offset + offset), this.allowLoose); - } - // Read bytes - readBytes(length, loose) { - let bytes = this.#peekBytes(0, length, !!loose); - this.#offset += bytes.length; - // @TODO: Make sure the length..end bytes are all 0? - return bytes.slice(0, length); - } - // Read a numeric values - readValue() { - return (0, index_js_1.toBigInt)(this.readBytes(exports.WordSize)); - } - readIndex() { - return (0, index_js_1.toNumber)(this.readBytes(exports.WordSize)); - } -} -exports.Reader = Reader; -//# sourceMappingURL=abstract-coder.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/abstract-coder.js.map b/lib.commonjs/abi/coders/abstract-coder.js.map deleted file mode 100644 index f184833ec..000000000 --- a/lib.commonjs/abi/coders/abstract-coder.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-coder.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/abstract-coder.ts"],"names":[],"mappings":";;;AAAA,mDAW8B;AAI9B;;GAEG;AACU,QAAA,QAAQ,GAAW,EAAE,CAAC;AACnC,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,gBAAQ,CAAC,CAAC;AAEzC,qEAAqE;AACrE,iEAAiE;AACjE,MAAM,cAAc,GAAG,CAAC,MAAM,CAAC,CAAC;AAEhC,MAAM,MAAM,GAAG,EAAE,CAAC;AAElB,SAAS,UAAU,CAAC,IAAY,EAAE,KAAY;IAC5C,MAAM,OAAO,GAAG,IAAI,KAAK,CACvB,0DAA0D,IAAI,EAAE,CACjE,CAAC;IACI,OAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;IAC7B,MAAM,OAAO,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAa,MAAO,SAAQ,KAAU;IAC3B,MAAM,CAA+B;IAI9C;;OAEG;IACH,YAAY,GAAG,IAAgB;QAC7B,oDAAoD;QACpD,uDAAuD;QACvD,wDAAwD;QACxD,uDAAuD;QACvD,kDAAkD;QAElD,2EAA2E;QAC3E,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,KAAK,GAAe,IAAI,CAAC,CAAC,CAAC,CAAC;QAChC,IAAI,KAAK,GAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QAE1D,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,IAAI,KAAK,KAAK,MAAM,EAAE;YACpB,KAAK,GAAG,IAAI,CAAC;YACb,KAAK,GAAG,EAAE,CAAC;YACX,IAAI,GAAG,KAAK,CAAC;SACd;QAED,yDAAyD;QACz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,IAAI,CAAC,SAAS,CAAC,gBAAQ,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,SAAS;QACP,OAAO,IAAA,mBAAQ,EAAC,IAAI,CAAC,SAAS,CAAC,gBAAQ,CAAC,CAAC,CAAC;IAC5C,CAAC;CACF;AAxED,wBAwEC"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/address.d.ts b/lib.commonjs/abi/coders/address.d.ts deleted file mode 100644 index 8befac03a..000000000 --- a/lib.commonjs/abi/coders/address.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class AddressCoder extends Coder { - constructor(localName: string); - defaultValue(): string; - encode(writer: Writer, _value: string | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/address.d.ts.map b/lib.commonjs/abi/coders/address.d.ts.map deleted file mode 100644 index 89cabff49..000000000 --- a/lib.commonjs/abi/coders/address.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/address.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBACzB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM;IAUtD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/address.js b/lib.commonjs/abi/coders/address.js deleted file mode 100644 index 71d2dea91..000000000 --- a/lib.commonjs/abi/coders/address.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AddressCoder = void 0; -const index_js_1 = require("../../address/index.js"); -const maths_js_1 = require("../../utils/maths.js"); -const typed_js_1 = require("../typed.js"); -const abstract_coder_js_1 = require("./abstract-coder.js"); -/** - * @_ignore - */ -class AddressCoder extends abstract_coder_js_1.Coder { - constructor(localName) { - super("address", "address", localName, false); - } - defaultValue() { - return "0x0000000000000000000000000000000000000000"; - } - encode(writer, _value) { - let value = typed_js_1.Typed.dereference(_value, "string"); - try { - value = (0, index_js_1.getAddress)(value); - } - catch (error) { - return this._throwError(error.message, _value); - } - return writer.writeValue(value); - } - decode(reader) { - return (0, index_js_1.getAddress)((0, maths_js_1.toBeHex)(reader.readValue(), 22)); - } -} -exports.AddressCoder = AddressCoder; -//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/address.js.map b/lib.commonjs/abi/coders/address.js.map deleted file mode 100644 index 279a8fa8d..000000000 --- a/lib.commonjs/abi/coders/address.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"address.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/address.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AACpD,mDAA+C;AAE/C,0CAAoC;AACpC,2DAA4C;AAI5C;;GAEG;AACH,MAAa,YAAa,SAAQ,yBAAK;IACrC,YAAY,SAAiB;QAC3B,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,YAAY;QACV,OAAO,4CAA4C,CAAC;IACtD,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsB;QAC3C,IAAI,KAAK,GAAG,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAChD,IAAI;YACF,KAAK,GAAG,IAAA,qBAAU,EAAC,KAAK,CAAC,CAAC;SAC3B;QAAC,OAAO,KAAU,EAAE;YACnB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAChD;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,IAAA,qBAAU,EAAC,IAAA,kBAAO,EAAC,MAAM,CAAC,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACrD,CAAC;CACF;AAtBD,oCAsBC"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/anonymous.d.ts b/lib.commonjs/abi/coders/anonymous.d.ts deleted file mode 100644 index 554bf03f0..000000000 --- a/lib.commonjs/abi/coders/anonymous.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * Clones the functionality of an existing Coder, but without a localName - * - * @_ignore - */ -export declare class AnonymousCoder extends Coder { - private coder; - constructor(coder: Coder); - defaultValue(): any; - encode(writer: Writer, value: any): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=anonymous.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/anonymous.d.ts.map b/lib.commonjs/abi/coders/anonymous.d.ts.map deleted file mode 100644 index 75c762afb..000000000 --- a/lib.commonjs/abi/coders/anonymous.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"anonymous.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/anonymous.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,OAAO,CAAC,KAAK,CAAQ;gBAET,KAAK,EAAE,KAAK;IAKxB,YAAY,IAAI,GAAG;IAInB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAI1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/anonymous.js b/lib.commonjs/abi/coders/anonymous.js deleted file mode 100644 index cbd655c67..000000000 --- a/lib.commonjs/abi/coders/anonymous.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AnonymousCoder = void 0; -const abstract_coder_js_1 = require("./abstract-coder.js"); -/** - * Clones the functionality of an existing Coder, but without a localName - * - * @_ignore - */ -class AnonymousCoder extends abstract_coder_js_1.Coder { - coder; - constructor(coder) { - super(coder.name, coder.type, "_", coder.dynamic); - this.coder = coder; - } - defaultValue() { - return this.coder.defaultValue(); - } - encode(writer, value) { - return this.coder.encode(writer, value); - } - decode(reader) { - return this.coder.decode(reader); - } -} -exports.AnonymousCoder = AnonymousCoder; -//# sourceMappingURL=anonymous.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/anonymous.js.map b/lib.commonjs/abi/coders/anonymous.js.map deleted file mode 100644 index a3ff4490e..000000000 --- a/lib.commonjs/abi/coders/anonymous.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"anonymous.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/anonymous.ts"],"names":[],"mappings":";;;AAAA,2DAA4C;AAI5C;;;;GAIG;AACH,MAAa,cAAe,SAAQ,yBAAK;IAC/B,KAAK,CAAQ;IAErB,YAAY,KAAY;QACtB,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF;AAnBD,wCAmBC"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/array.d.ts b/lib.commonjs/abi/coders/array.d.ts deleted file mode 100644 index 954c4e17e..000000000 --- a/lib.commonjs/abi/coders/array.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder, Result, Writer } from "./abstract-coder.js"; -import type { Reader } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare function pack(writer: Writer, coders: ReadonlyArray, values: Array | { - [name: string]: any; -}): number; -/** - * @_ignore - */ -export declare function unpack(reader: Reader, coders: ReadonlyArray): Result; -/** - * @_ignore - */ -export declare class ArrayCoder extends Coder { - readonly coder: Coder; - readonly length: number; - constructor(coder: Coder, length: number, localName: string); - defaultValue(): Array; - encode(writer: Writer, _value: Array | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=array.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/array.d.ts.map b/lib.commonjs/abi/coders/array.d.ts.map deleted file mode 100644 index 9875b8e9e..000000000 --- a/lib.commonjs/abi/coders/array.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/array.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAY,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD;;GAEG;AACH,wBAAgB,IAAI,CAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,EAC5B,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAC3C,MAAM,CAuER;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,MAAM,CAmD3E;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,KAAK,EAAG,KAAK,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;gBAEb,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAO3D,YAAY,IAAI,KAAK,CAAC,GAAG,CAAC;IAW1B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,MAAM;IA4B1D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CA4B5B"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/array.js b/lib.commonjs/abi/coders/array.js deleted file mode 100644 index c2b0c03dc..000000000 --- a/lib.commonjs/abi/coders/array.js +++ /dev/null @@ -1,171 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ArrayCoder = exports.unpack = exports.pack = void 0; -const index_js_1 = require("../../utils/index.js"); -const typed_js_1 = require("../typed.js"); -const abstract_coder_js_1 = require("./abstract-coder.js"); -const anonymous_js_1 = require("./anonymous.js"); -/** - * @_ignore - */ -function pack(writer, coders, values) { - let arrayValues = []; - if (Array.isArray(values)) { - arrayValues = values; - } - else if (values && typeof values === "object") { - let unique = {}; - arrayValues = coders.map((coder) => { - const name = coder.localName; - (0, index_js_1.assert)(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); - (0, index_js_1.assert)(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); - unique[name] = true; - return values[name]; - }); - } - else { - (0, index_js_1.assertArgument)(false, "invalid tuple value", "tuple", values); - } - (0, index_js_1.assertArgument)(coders.length === arrayValues.length, "types/value length mismatch", "tuple", values); - let staticWriter = new abstract_coder_js_1.Writer(); - let dynamicWriter = new abstract_coder_js_1.Writer(); - let updateFuncs = []; - coders.forEach((coder, index) => { - let value = arrayValues[index]; - if (coder.dynamic) { - // Get current dynamic offset (for the future pointer) - let dynamicOffset = dynamicWriter.length; - // Encode the dynamic value into the dynamicWriter - coder.encode(dynamicWriter, value); - // Prepare to populate the correct offset once we are done - let updateFunc = staticWriter.writeUpdatableValue(); - updateFuncs.push((baseOffset) => { - updateFunc(baseOffset + dynamicOffset); - }); - } - else { - coder.encode(staticWriter, value); - } - }); - // Backfill all the dynamic offsets, now that we know the static length - updateFuncs.forEach((func) => { - func(staticWriter.length); - }); - let length = writer.appendWriter(staticWriter); - length += writer.appendWriter(dynamicWriter); - return length; -} -exports.pack = pack; -/** - * @_ignore - */ -function unpack(reader, coders) { - let values = []; - let keys = []; - // A reader anchored to this base - let baseReader = reader.subReader(0); - coders.forEach((coder) => { - let value = null; - if (coder.dynamic) { - let offset = reader.readIndex(); - let offsetReader = baseReader.subReader(offset); - try { - value = coder.decode(offsetReader); - } - catch (error) { - // Cannot recover from this - if ((0, index_js_1.isError)(error, "BUFFER_OVERRUN")) { - throw error; - } - value = error; - value.baseType = coder.name; - value.name = coder.localName; - value.type = coder.type; - } - } - else { - try { - value = coder.decode(reader); - } - catch (error) { - // Cannot recover from this - if ((0, index_js_1.isError)(error, "BUFFER_OVERRUN")) { - throw error; - } - value = error; - value.baseType = coder.name; - value.name = coder.localName; - value.type = coder.type; - } - } - if (value == undefined) { - throw new Error("investigate"); - } - values.push(value); - keys.push(coder.localName || null); - }); - return abstract_coder_js_1.Result.fromItems(values, keys); -} -exports.unpack = unpack; -/** - * @_ignore - */ -class ArrayCoder extends abstract_coder_js_1.Coder { - coder; - length; - constructor(coder, length, localName) { - const type = coder.type + "[" + (length >= 0 ? length : "") + "]"; - const dynamic = length === -1 || coder.dynamic; - super("array", type, localName, dynamic); - (0, index_js_1.defineProperties)(this, { coder, length }); - } - defaultValue() { - // Verifies the child coder is valid (even if the array is dynamic or 0-length) - const defaultChild = this.coder.defaultValue(); - const result = []; - for (let i = 0; i < this.length; i++) { - result.push(defaultChild); - } - return result; - } - encode(writer, _value) { - const value = typed_js_1.Typed.dereference(_value, "array"); - if (!Array.isArray(value)) { - this._throwError("expected array value", value); - } - let count = this.length; - if (count === -1) { - count = value.length; - writer.writeValue(value.length); - } - (0, index_js_1.assertArgumentCount)(value.length, count, "coder array" + (this.localName ? " " + this.localName : "")); - let coders = []; - for (let i = 0; i < value.length; i++) { - coders.push(this.coder); - } - return pack(writer, coders, value); - } - decode(reader) { - let count = this.length; - if (count === -1) { - count = reader.readIndex(); - // Check that there is *roughly* enough data to ensure - // stray random data is not being read as a length. Each - // slot requires at least 32 bytes for their value (or 32 - // bytes as a link to the data). This could use a much - // tighter bound, but we are erroring on the side of safety. - (0, index_js_1.assert)(count * abstract_coder_js_1.WordSize <= reader.dataLength, "insufficient data length", "BUFFER_OVERRUN", { - buffer: reader.bytes, - offset: count * abstract_coder_js_1.WordSize, - length: reader.dataLength, - }); - } - let coders = []; - for (let i = 0; i < count; i++) { - coders.push(new anonymous_js_1.AnonymousCoder(this.coder)); - } - return unpack(reader, coders); - } -} -exports.ArrayCoder = ArrayCoder; -//# sourceMappingURL=array.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/array.js.map b/lib.commonjs/abi/coders/array.js.map deleted file mode 100644 index a42625d19..000000000 --- a/lib.commonjs/abi/coders/array.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src.ts/ab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QAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,6BAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;SAC7C;QAED,OAAO,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,CAAC;CACF;AA9ED,gCA8EC"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/boolean.d.ts b/lib.commonjs/abi/coders/boolean.d.ts deleted file mode 100644 index f073e37ee..000000000 --- a/lib.commonjs/abi/coders/boolean.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class BooleanCoder extends Coder { - constructor(localName: string); - defaultValue(): boolean; - encode(writer: Writer, _value: boolean | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=boolean.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/boolean.d.ts.map b/lib.commonjs/abi/coders/boolean.d.ts.map deleted file mode 100644 index 8f22ce499..000000000 --- a/lib.commonjs/abi/coders/boolean.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBACzB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,OAAO;IAIvB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM;IAKvD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/boolean.js b/lib.commonjs/abi/coders/boolean.js deleted file mode 100644 index bc8b50731..000000000 --- a/lib.commonjs/abi/coders/boolean.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BooleanCoder = void 0; -const typed_js_1 = require("../typed.js"); -const abstract_coder_js_1 = require("./abstract-coder.js"); -/** - * @_ignore - */ -class BooleanCoder extends abstract_coder_js_1.Coder { - constructor(localName) { - super("bool", "bool", localName, false); - } - defaultValue() { - return false; - } - encode(writer, _value) { - const value = typed_js_1.Typed.dereference(_value, "bool"); - return writer.writeValue(value ? 1 : 0); - } - decode(reader) { - return !!reader.readValue(); - } -} -exports.BooleanCoder = BooleanCoder; -//# sourceMappingURL=boolean.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/boolean.js.map b/lib.commonjs/abi/coders/boolean.js.map deleted file mode 100644 index 1851d7e96..000000000 --- a/lib.commonjs/abi/coders/boolean.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/boolean.ts"],"names":[],"mappings":";;;AAAA,0CAAoC;AACpC,2DAA4C;AAI5C;;GAEG;AACH,MAAa,YAAa,SAAQ,yBAAK;IACrC,YAAY,SAAiB;QAC3B,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,YAAY;QACV,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAuB;QAC5C,MAAM,KAAK,GAAG,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IAC9B,CAAC;CACF;AAjBD,oCAiBC"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/bytes.d.ts b/lib.commonjs/abi/coders/bytes.d.ts deleted file mode 100644 index 1e554582f..000000000 --- a/lib.commonjs/abi/coders/bytes.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class DynamicBytesCoder extends Coder { - constructor(type: string, localName: string); - defaultValue(): string; - encode(writer: Writer, value: any): number; - decode(reader: Reader): any; -} -/** - * @_ignore - */ -export declare class BytesCoder extends DynamicBytesCoder { - constructor(localName: string); - decode(reader: Reader): any; -} -//# sourceMappingURL=bytes.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/bytes.d.ts.map b/lib.commonjs/abi/coders/bytes.d.ts.map deleted file mode 100644 index d765084b7..000000000 --- a/lib.commonjs/abi/coders/bytes.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/bytes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAI3C,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAO1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,iBAAiB;gBACnC,SAAS,EAAE,MAAM;IAI7B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/bytes.js b/lib.commonjs/abi/coders/bytes.js deleted file mode 100644 index 0788ed622..000000000 --- a/lib.commonjs/abi/coders/bytes.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BytesCoder = exports.DynamicBytesCoder = void 0; -const index_js_1 = require("../../utils/index.js"); -const abstract_coder_js_1 = require("./abstract-coder.js"); -/** - * @_ignore - */ -class DynamicBytesCoder extends abstract_coder_js_1.Coder { - constructor(type, localName) { - super(type, type, localName, true); - } - defaultValue() { - return "0x"; - } - encode(writer, value) { - value = (0, index_js_1.getBytesCopy)(value); - let length = writer.writeValue(value.length); - length += writer.writeBytes(value); - return length; - } - decode(reader) { - return reader.readBytes(reader.readIndex(), true); - } -} -exports.DynamicBytesCoder = DynamicBytesCoder; -/** - * @_ignore - */ -class BytesCoder extends DynamicBytesCoder { - constructor(localName) { - super("bytes", localName); - } - decode(reader) { - return (0, index_js_1.hexlify)(super.decode(reader)); - } -} -exports.BytesCoder = BytesCoder; -//# sourceMappingURL=bytes.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/bytes.js.map b/lib.commonjs/abi/coders/bytes.js.map deleted file mode 100644 index 4e08c778b..000000000 --- a/lib.commonjs/abi/coders/bytes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/bytes.ts"],"names":[],"mappings":";;;AAAA,mDAA6D;AAE7D,2DAA4C;AAI5C;;GAEG;AACH,MAAa,iBAAkB,SAAQ,yBAAK;IAC1C,YAAY,IAAY,EAAE,SAAiB;QACzC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC/B,KAAK,GAAG,IAAA,uBAAY,EAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACF;AAnBD,8CAmBC;AAED;;GAEG;AACH,MAAa,UAAW,SAAQ,iBAAiB;IAC/C,YAAY,SAAiB;QAC3B,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,IAAA,kBAAO,EAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACvC,CAAC;CACF;AARD,gCAQC"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/fixed-bytes.d.ts b/lib.commonjs/abi/coders/fixed-bytes.d.ts deleted file mode 100644 index 5c485fef6..000000000 --- a/lib.commonjs/abi/coders/fixed-bytes.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { BytesLike } from "../../utils/index.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class FixedBytesCoder extends Coder { - readonly size: number; - constructor(size: number, localName: string); - defaultValue(): string; - encode(writer: Writer, _value: BytesLike | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=fixed-bytes.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/fixed-bytes.d.ts.map b/lib.commonjs/abi/coders/fixed-bytes.d.ts.map deleted file mode 100644 index cca02a1ac..000000000 --- a/lib.commonjs/abi/coders/fixed-bytes.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fixed-bytes.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/fixed-bytes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAM3C,YAAY,IAAI,MAAM;IAOtB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM;IAQzD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/fixed-bytes.js b/lib.commonjs/abi/coders/fixed-bytes.js deleted file mode 100644 index 587c79bd4..000000000 --- a/lib.commonjs/abi/coders/fixed-bytes.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FixedBytesCoder = void 0; -const index_js_1 = require("../../utils/index.js"); -const typed_js_1 = require("../typed.js"); -const abstract_coder_js_1 = require("./abstract-coder.js"); -/** - * @_ignore - */ -class FixedBytesCoder extends abstract_coder_js_1.Coder { - size; - constructor(size, localName) { - let name = "bytes" + String(size); - super(name, name, localName, false); - (0, index_js_1.defineProperties)(this, { size }, { size: "number" }); - } - defaultValue() { - return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0, 2 + this.size * 2); - } - encode(writer, _value) { - let data = (0, index_js_1.getBytesCopy)(typed_js_1.Typed.dereference(_value, this.type)); - if (data.length !== this.size) { - this._throwError("incorrect data length", _value); - } - return writer.writeBytes(data); - } - decode(reader) { - return (0, index_js_1.hexlify)(reader.readBytes(this.size)); - } -} -exports.FixedBytesCoder = FixedBytesCoder; -//# sourceMappingURL=fixed-bytes.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/fixed-bytes.js.map b/lib.commonjs/abi/coders/fixed-bytes.js.map deleted file mode 100644 index 062c4f0c6..000000000 --- a/lib.commonjs/abi/coders/fixed-bytes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fixed-bytes.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/fixed-bytes.ts"],"names":[],"mappings":";;;AAAA,mDAA+E;AAE/E,0CAAoC;AACpC,2DAA4C;AAM5C;;GAEG;AACH,MAAa,eAAgB,SAAQ,yBAAK;IAC/B,IAAI,CAAU;IAEvB,YAAY,IAAY,EAAE,SAAiB;QACzC,IAAI,IAAI,GAAG,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAClC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACpC,IAAA,2BAAgB,EAAkB,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,YAAY;QACV,OAAO,oEAAoE,CAAC,SAAS,CACnF,CAAC,EACD,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CAClB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAyB;QAC9C,IAAI,IAAI,GAAG,IAAA,uBAAY,EAAC,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,EAAE;YAC7B,IAAI,CAAC,WAAW,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;SACnD;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,IAAA,kBAAO,EAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF;AA3BD,0CA2BC"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/null.d.ts b/lib.commonjs/abi/coders/null.d.ts deleted file mode 100644 index 5df5da342..000000000 --- a/lib.commonjs/abi/coders/null.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class NullCoder extends Coder { - constructor(localName: string); - defaultValue(): null; - encode(writer: Writer, value: any): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=null.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/null.d.ts.map b/lib.commonjs/abi/coders/null.d.ts.map deleted file mode 100644 index 5b43f1d78..000000000 --- a/lib.commonjs/abi/coders/null.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"null.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/null.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI1D;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;gBACtB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,IAAI;IAIpB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAO1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAI5B"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/null.js b/lib.commonjs/abi/coders/null.js deleted file mode 100644 index e9af0056f..000000000 --- a/lib.commonjs/abi/coders/null.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NullCoder = void 0; -const abstract_coder_js_1 = require("./abstract-coder.js"); -const Empty = new Uint8Array([]); -/** - * @_ignore - */ -class NullCoder extends abstract_coder_js_1.Coder { - constructor(localName) { - super("null", "", localName, false); - } - defaultValue() { - return null; - } - encode(writer, value) { - if (value != null) { - this._throwError("not null", value); - } - return writer.writeBytes(Empty); - } - decode(reader) { - reader.readBytes(0); - return null; - } -} -exports.NullCoder = NullCoder; -//# sourceMappingURL=null.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/null.js.map b/lib.commonjs/abi/coders/null.js.map deleted file mode 100644 index 096a97e2f..000000000 --- a/lib.commonjs/abi/coders/null.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"null.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/null.ts"],"names":[],"mappings":";;;AAAA,2DAA4C;AAG5C,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AAEjC;;GAEG;AACH,MAAa,SAAU,SAAQ,yBAAK;IAClC,YAAY,SAAiB;QAC3B,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC/B,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;SACrC;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AApBD,8BAoBC"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/number.d.ts b/lib.commonjs/abi/coders/number.d.ts deleted file mode 100644 index 822cc6df2..000000000 --- a/lib.commonjs/abi/coders/number.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { BigNumberish } from "../../utils/index.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class NumberCoder extends Coder { - readonly size: number; - readonly signed: boolean; - constructor(size: number, signed: boolean, localName: string); - defaultValue(): number; - encode(writer: Writer, _value: BigNumberish | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=number.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/number.d.ts.map b/lib.commonjs/abi/coders/number.d.ts.map deleted file mode 100644 index b9ef16d8a..000000000 --- a/lib.commonjs/abi/coders/number.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/number.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAY,MAAM,qBAAqB,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAQ1D;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAG,OAAO,CAAC;gBAEd,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM;IAW5D,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,KAAK,GAAG,MAAM;IAkB5D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAS5B"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/number.js b/lib.commonjs/abi/coders/number.js deleted file mode 100644 index 67000611e..000000000 --- a/lib.commonjs/abi/coders/number.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NumberCoder = void 0; -const index_js_1 = require("../../utils/index.js"); -const typed_js_1 = require("../typed.js"); -const abstract_coder_js_1 = require("./abstract-coder.js"); -const BN_0 = BigInt(0); -const BN_1 = BigInt(1); -const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -/** - * @_ignore - */ -class NumberCoder extends abstract_coder_js_1.Coder { - size; - signed; - constructor(size, signed, localName) { - const name = (signed ? "int" : "uint") + size * 8; - super(name, name, localName, false); - (0, index_js_1.defineProperties)(this, { size, signed }, { size: "number", signed: "boolean" }); - } - defaultValue() { - return 0; - } - encode(writer, _value) { - let value = (0, index_js_1.getBigInt)(typed_js_1.Typed.dereference(_value, this.type)); - // Check bounds are safe for encoding - let maxUintValue = (0, index_js_1.mask)(BN_MAX_UINT256, abstract_coder_js_1.WordSize * 8); - if (this.signed) { - let bounds = (0, index_js_1.mask)(maxUintValue, this.size * 8 - 1); - if (value > bounds || value < -(bounds + BN_1)) { - this._throwError("value out-of-bounds", _value); - } - value = (0, index_js_1.toTwos)(value, 8 * abstract_coder_js_1.WordSize); - } - else if (value < BN_0 || value > (0, index_js_1.mask)(maxUintValue, this.size * 8)) { - this._throwError("value out-of-bounds", _value); - } - return writer.writeValue(value); - } - decode(reader) { - let value = (0, index_js_1.mask)(reader.readValue(), this.size * 8); - if (this.signed) { - value = (0, index_js_1.fromTwos)(value, this.size * 8); - } - return value; - } -} -exports.NumberCoder = NumberCoder; -//# sourceMappingURL=number.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/number.js.map b/lib.commonjs/abi/coders/number.js.map deleted file mode 100644 index 84ffee9ed..000000000 --- a/lib.commonjs/abi/coders/number.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ACnD,IAAI,KAAK,GAAG,MAAM,IAAI,KAAK,GAAG,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE;gBAC9C,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;aACjD;YACD,KAAK,GAAG,IAAA,iBAAM,EAAC,KAAK,EAAE,CAAC,GAAG,4BAAQ,CAAC,CAAC;SACrC;aAAM,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,IAAA,eAAI,EAAC,YAAY,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE;YACpE,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;SACjD;QAED,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,IAAI,KAAK,GAAG,IAAA,eAAI,EAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAEpD,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,KAAK,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;SACxC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA9CD,kCA8CC"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/string.d.ts b/lib.commonjs/abi/coders/string.d.ts deleted file mode 100644 index 8e1c63593..000000000 --- a/lib.commonjs/abi/coders/string.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Typed } from "../typed.js"; -import { DynamicBytesCoder } from "./bytes.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class StringCoder extends DynamicBytesCoder { - constructor(localName: string); - defaultValue(): string; - encode(writer: Writer, _value: string | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=string.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/string.d.ts.map b/lib.commonjs/abi/coders/string.d.ts.map deleted file mode 100644 index 38618a702..000000000 --- a/lib.commonjs/abi/coders/string.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/string.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,WAAY,SAAQ,iBAAiB;gBACpC,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM;IAOtD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/string.js b/lib.commonjs/abi/coders/string.js deleted file mode 100644 index 7370af011..000000000 --- a/lib.commonjs/abi/coders/string.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.StringCoder = void 0; -const utf8_js_1 = require("../../utils/utf8.js"); -const typed_js_1 = require("../typed.js"); -const bytes_js_1 = require("./bytes.js"); -/** - * @_ignore - */ -class StringCoder extends bytes_js_1.DynamicBytesCoder { - constructor(localName) { - super("string", localName); - } - defaultValue() { - return ""; - } - encode(writer, _value) { - return super.encode(writer, (0, utf8_js_1.toUtf8Bytes)(typed_js_1.Typed.dereference(_value, "string"))); - } - decode(reader) { - return (0, utf8_js_1.toUtf8String)(super.decode(reader)); - } -} -exports.StringCoder = StringCoder; -//# sourceMappingURL=string.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/string.js.map b/lib.commonjs/abi/coders/string.js.map deleted file mode 100644 index 141262afb..000000000 --- a/lib.commonjs/abi/coders/string.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/string.ts"],"names":[],"mappings":";;;AAAA,iDAAgE;AAEhE,0CAAoC;AACpC,yCAA+C;AAI/C;;GAEG;AACH,MAAa,WAAY,SAAQ,4BAAiB;IAChD,YAAY,SAAiB;QAC3B,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC7B,CAAC;IAED,YAAY;QACV,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsB;QAC3C,OAAO,KAAK,CAAC,MAAM,CACjB,MAAM,EACN,IAAA,qBAAW,EAAC,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CACjD,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,IAAA,sBAAY,EAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5C,CAAC;CACF;AAnBD,kCAmBC"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/tuple.d.ts b/lib.commonjs/abi/coders/tuple.d.ts deleted file mode 100644 index fe3ec0328..000000000 --- a/lib.commonjs/abi/coders/tuple.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class TupleCoder extends Coder { - readonly coders: ReadonlyArray; - constructor(coders: Array, localName: string); - defaultValue(): any; - encode(writer: Writer, _value: Array | { - [name: string]: any; - } | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=tuple.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/tuple.d.ts.map b/lib.commonjs/abi/coders/tuple.d.ts.map deleted file mode 100644 index de1068222..000000000 --- a/lib.commonjs/abi/coders/tuple.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tuple.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/tuple.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,MAAM,EAAG,aAAa,CAAC,KAAK,CAAC,CAAC;gBAE3B,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM;IAiBnD,YAAY,IAAI,GAAG;IA0CnB,MAAM,CACJ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,KAAK,GACnD,MAAM;IAKT,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/lib.commonjs/abi/coders/tuple.js b/lib.commonjs/abi/coders/tuple.js deleted file mode 100644 index d4645f26e..000000000 --- a/lib.commonjs/abi/coders/tuple.js +++ /dev/null @@ -1,69 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TupleCoder = void 0; -const properties_js_1 = require("../../utils/properties.js"); -const typed_js_1 = require("../typed.js"); -const abstract_coder_js_1 = require("./abstract-coder.js"); -const array_js_1 = require("./array.js"); -/** - * @_ignore - */ -class TupleCoder extends abstract_coder_js_1.Coder { - coders; - constructor(coders, localName) { - let dynamic = false; - const types = []; - coders.forEach((coder) => { - if (coder.dynamic) { - dynamic = true; - } - types.push(coder.type); - }); - const type = "tuple(" + types.join(",") + ")"; - super("tuple", type, localName, dynamic); - (0, properties_js_1.defineProperties)(this, { - coders: Object.freeze(coders.slice()), - }); - } - defaultValue() { - const values = []; - this.coders.forEach((coder) => { - values.push(coder.defaultValue()); - }); - // We only output named properties for uniquely named coders - const uniqueNames = this.coders.reduce((accum, coder) => { - const name = coder.localName; - if (name) { - if (!accum[name]) { - accum[name] = 0; - } - accum[name]++; - } - return accum; - }, {}); - // Add named values - this.coders.forEach((coder, index) => { - let name = coder.localName; - if (!name || uniqueNames[name] !== 1) { - return; - } - if (name === "length") { - name = "_length"; - } - if (values[name] != null) { - return; - } - values[name] = values[index]; - }); - return Object.freeze(values); - } - encode(writer, _value) { - const value = typed_js_1.Typed.dereference(_value, "tuple"); - return (0, array_js_1.pack)(writer, this.coders, value); - } - decode(reader) { - return (0, array_js_1.unpack)(reader, this.coders); - } -} -exports.TupleCoder = TupleCoder; -//# sourceMappingURL=tuple.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/coders/tuple.js.map b/lib.commonjs/abi/coders/tuple.js.map deleted file mode 100644 index 679074bb0..000000000 --- a/lib.commonjs/abi/coders/tuple.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tuple.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/tuple.ts"],"names":[],"mappings":";;;AAAA,6DAA6D;AAE7D,0CAAoC;AACpC,2DAA4C;AAE5C,yCAA0C;AAI1C;;GAEG;AACH,MAAa,UAAW,SAAQ,yBAAK;IAC1B,MAAM,CAAwB;IAEvC,YAAY,MAAoB,EAAE,SAAiB;QACjD,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,KAAK,GAAkB,EAAE,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACvB,IAAI,KAAK,CAAC,OAAO,EAAE;gBACjB,OAAO,GAAG,IAAI,CAAC;aAChB;YACD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,C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AI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,CACJ,MAAc,EACd,MAAoD;QAEpD,MAAM,KAAK,GAAG,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjD,OAAO,IAAA,eAAI,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,IAAA,iBAAM,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACF;AAzED,gCAyEC"} \ No newline at end of file diff --git a/lib.commonjs/abi/fragments.d.ts b/lib.commonjs/abi/fragments.d.ts deleted file mode 100644 index 6d88c3596..000000000 --- a/lib.commonjs/abi/fragments.d.ts +++ /dev/null @@ -1,372 +0,0 @@ -/** - * About frgaments... - * - * @_subsection api/abi/abi-coder:Fragments [about-fragments] - */ -/** - * A type description in a JSON API. - */ -export interface JsonFragmentType { - /** - * The parameter name. - */ - readonly name?: string; - /** - * If the parameter is indexed. - */ - readonly indexed?: boolean; - /** - * The type of the parameter. - */ - readonly type?: string; - /** - * The internal Solidity type. - */ - readonly internalType?: string; - /** - * The components for a tuple. - */ - readonly components?: ReadonlyArray; -} -/** - * A fragment for a method, event or error in a JSON API. - */ -export interface JsonFragment { - /** - * The name of the error, event, function, etc. - */ - readonly name?: string; - /** - * The type of the fragment (e.g. ``event``, ``"function"``, etc.) - */ - readonly type?: string; - /** - * If the event is anonymous. - */ - readonly anonymous?: boolean; - /** - * If the function is payable. - */ - readonly payable?: boolean; - /** - * If the function is constant. - */ - readonly constant?: boolean; - /** - * The mutability state of the function. - */ - readonly stateMutability?: string; - /** - * The input parameters. - */ - readonly inputs?: ReadonlyArray; - /** - * The output parameters. - */ - readonly outputs?: ReadonlyArray; - /** - * The energy limit to use when sending a transaction for this function. - */ - readonly energy?: string; -} -/** - * The format to serialize the output as. - */ -export type FormatType = "sighash" | "minimal" | "full" | "json"; -/** - * When [walking](ParamType-walk) a [[ParamType]], this is called - * on each component. - */ -export type ParamTypeWalkFunc = (type: string, value: any) => any; -/** - * When [walking asynchronously](ParamType-walkAsync) a [[ParamType]], - * this is called on each component. - */ -export type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise; -/** - * Each input and output of a [[Fragment]] is an Array of **PAramType**. - */ -export declare class ParamType { - #private; - /** - * The local name of the parameter (or ``""`` if unbound) - */ - readonly name: string; - /** - * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, - * ``"uint256[3][]"``) - */ - readonly type: string; - /** - * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) - */ - readonly baseType: string; - /** - * True if the parameters is indexed. - * - * For non-indexable types this is ``null``. - */ - readonly indexed: null | boolean; - /** - * The components for the tuple. - * - * For non-tuple types this is ``null``. - */ - readonly components: null | ReadonlyArray; - /** - * The array length, or ``-1`` for dynamic-lengthed arrays. - * - * For non-array types this is ``null``. - */ - readonly arrayLength: null | number; - /** - * The type of each child in the array. - * - * For non-array types this is ``null``. - */ - readonly arrayChildren: null | ParamType; - /** - * @private - */ - constructor(guard: any, name: string, type: string, baseType: string, indexed: null | boolean, components: null | ReadonlyArray, arrayLength: null | number, arrayChildren: null | ParamType); - /** - * Return a string representation of this type. - * - * For example, - * - * ``sighash" => "(uint256,address)"`` - * - * ``"minimal" => "tuple(uint256,address) indexed"`` - * - * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` - */ - format(format?: FormatType): string; - /** - * Returns true if %%this%% is an Array type. - * - * This provides a type gaurd ensuring that [[arrayChildren]] - * and [[arrayLength]] are non-null. - */ - isArray(): this is ParamType & { - arrayChildren: ParamType; - arrayLength: number; - }; - /** - * Returns true if %%this%% is a Tuple type. - * - * This provides a type gaurd ensuring that [[components]] - * is non-null. - */ - isTuple(): this is ParamType & { - components: ReadonlyArray; - }; - /** - * Returns true if %%this%% is an Indexable type. - * - * This provides a type gaurd ensuring that [[indexed]] - * is non-null. - */ - isIndexable(): this is ParamType & { - indexed: boolean; - }; - /** - * Walks the **ParamType** with %%value%%, calling %%process%% - * on each type, destructing the %%value%% recursively. - */ - walk(value: any, process: ParamTypeWalkFunc): any; - /** - * Walks the **ParamType** with %%value%%, asynchronously calling - * %%process%% on each type, destructing the %%value%% recursively. - * - * This can be used to resolve ENS naes by walking and resolving each - * ``"address"`` type. - */ - walkAsync(value: any, process: ParamTypeWalkAsyncFunc): Promise; - /** - * Creates a new **ParamType** for %%obj%%. - * - * If %%allowIndexed%% then the ``indexed`` keyword is permitted, - * otherwise the ``indexed`` keyword will throw an error. - */ - static from(obj: any, allowIndexed?: boolean): ParamType; - /** - * Returns true if %%value%% is a **ParamType**. - */ - static isParamType(value: any): value is ParamType; -} -/** - * The type of a [[Fragment]]. - */ -export type FragmentType = "constructor" | "error" | "event" | "fallback" | "function" | "struct"; -/** - * An abstract class to represent An individual fragment from a parse ABI. - */ -export declare abstract class Fragment { - /** - * The type of the fragment. - */ - readonly type: FragmentType; - /** - * The inputs for the fragment. - */ - readonly inputs: ReadonlyArray; - /** - * @private - */ - constructor(guard: any, type: FragmentType, inputs: ReadonlyArray); - /** - * Returns a string representation of this fragment. - */ - abstract format(format?: FormatType): string; - /** - * Creates a new **Fragment** for %%obj%%, wich can be any supported - * ABI frgament type. - */ - static from(obj: any): Fragment; - /** - * Returns true if %%value%% is a [[ConstructorFragment]]. - */ - static isConstructor(value: any): value is ConstructorFragment; - /** - * Returns true if %%value%% is an [[ErrorFragment]]. - */ - static isError(value: any): value is ErrorFragment; - /** - * Returns true if %%value%% is an [[EventFragment]]. - */ - static isEvent(value: any): value is EventFragment; - /** - * Returns true if %%value%% is a [[FunctionFragment]]. - */ - static isFunction(value: any): value is FunctionFragment; - /** - * Returns true if %%value%% is a [[StructFragment]]. - */ - static isStruct(value: any): value is StructFragment; -} -/** - * An abstract class to represent An individual fragment - * which has a name from a parse ABI. - */ -export declare abstract class NamedFragment extends Fragment { - /** - * The name of the fragment. - */ - readonly name: string; - /** - * @private - */ - constructor(guard: any, type: FragmentType, name: string, inputs: ReadonlyArray); -} -/** - * A Fragment which represents a //Custom Error//. - */ -export declare class ErrorFragment extends NamedFragment { - /** - * @private - */ - constructor(guard: any, name: string, inputs: ReadonlyArray); - /** - * The Custom Error selector. - */ - get selector(): string; - format(format?: FormatType): string; - static from(obj: any): ErrorFragment; - static isFragment(value: any): value is ErrorFragment; -} -/** - * A Fragment which represents an Event. - */ -export declare class EventFragment extends NamedFragment { - readonly anonymous: boolean; - /** - * @private - */ - constructor(guard: any, name: string, inputs: ReadonlyArray, anonymous: boolean); - /** - * The Event topic hash. - */ - get topicHash(): string; - format(format?: FormatType): string; - static getTopicHash(name: string, params?: Array): string; - static from(obj: any): EventFragment; - static isFragment(value: any): value is EventFragment; -} -/** - * A Fragment which represents a constructor. - */ -export declare class ConstructorFragment extends Fragment { - readonly payable: boolean; - readonly energy: null | bigint; - /** - * @private - */ - constructor(guard: any, type: FragmentType, inputs: ReadonlyArray, payable: boolean, energy: null | bigint); - format(format?: FormatType): string; - static from(obj: any): ConstructorFragment; - static isFragment(value: any): value is ConstructorFragment; -} -/** - * A Fragment which represents a method. - */ -export declare class FallbackFragment extends Fragment { - /** - * If the function can be sent value during invocation. - */ - readonly payable: boolean; - constructor(guard: any, inputs: ReadonlyArray, payable: boolean); - format(format?: FormatType): string; - static from(obj: any): FallbackFragment; - static isFragment(value: any): value is FallbackFragment; -} -/** - * A Fragment which represents a method. - */ -export declare class FunctionFragment extends NamedFragment { - /** - * If the function is constant (e.g. ``pure`` or ``view`` functions). - */ - readonly constant: boolean; - /** - * The returned types for the result of calling this function. - */ - readonly outputs: ReadonlyArray; - /** - * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` - * or ``pure``) - */ - readonly stateMutability: "payable" | "nonpayable" | "view" | "pure"; - /** - * If the function can be sent value during invocation. - */ - readonly payable: boolean; - /** - * The amount of energy to send when calling this function - */ - readonly energy: null | bigint; - /** - * @private - */ - constructor(guard: any, name: string, stateMutability: "payable" | "nonpayable" | "view" | "pure", inputs: ReadonlyArray, outputs: ReadonlyArray, energy: null | bigint); - /** - * The Function selector. - */ - get selector(): string; - format(format?: FormatType): string; - static getSelector(name: string, params?: Array): string; - static from(obj: any): FunctionFragment; - static isFragment(value: any): value is FunctionFragment; -} -/** - * A Fragment which represents a structure. - */ -export declare class StructFragment extends NamedFragment { - /** - * @private - */ - constructor(guard: any, name: string, inputs: ReadonlyArray); - format(): string; - static from(obj: any): StructFragment; - static isFragment(value: any): value is FunctionFragment; -} -//# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/fragments.d.ts.map b/lib.commonjs/abi/fragments.d.ts.map deleted file mode 100644 index c3f678ffe..000000000 --- a/lib.commonjs/abi/fragments.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../src.ts/abi/fragments.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,E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AAG,MAAM;IAgBvB;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM;IA6CnC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM;IAa7D,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,gBAAgB;IA+DvC,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAGzD;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,aAAa;IAC/C;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC;IAKtE,MAAM,IAAI,MAAM;IAIhB,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc;IAiBrC,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAGzD"} \ No newline at end of file diff --git a/lib.commonjs/abi/fragments.js b/lib.commonjs/abi/fragments.js deleted file mode 100644 index 0eaaad046..000000000 --- a/lib.commonjs/abi/fragments.js +++ /dev/null @@ -1,1282 +0,0 @@ -"use strict"; -/** - * About frgaments... - * - * @_subsection api/abi/abi-coder:Fragments [about-fragments] - */ -var _a; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.StructFragment = exports.FunctionFragment = exports.FallbackFragment = exports.ConstructorFragment = exports.EventFragment = exports.ErrorFragment = exports.NamedFragment = exports.Fragment = exports.ParamType = void 0; -const index_js_1 = require("../utils/index.js"); -const index_js_2 = require("../hash/index.js"); -// [ "a", "b" ] => { "a": 1, "b": 1 } -function setify(items) { - const result = new Set(); - items.forEach((k) => result.add(k)); - return Object.freeze(result); -} -// Visibility Keywords -const _kwVisib = "constant external internal payable private public pure view"; -const KwVisib = setify(_kwVisib.split(" ")); -const _kwTypes = "constructor error event fallback function receive struct"; -const KwTypes = setify(_kwTypes.split(" ")); -const _kwModifiers = "calldata memory storage payable indexed"; -const KwModifiers = setify(_kwModifiers.split(" ")); -const _kwOther = "tuple returns"; -// All Keywords -const _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(" "); -const Keywords = setify(_keywords.split(" ")); -// Single character tokens -const SimpleTokens = { - "(": "OPEN_PAREN", - ")": "CLOSE_PAREN", - "[": "OPEN_BRACKET", - "]": "CLOSE_BRACKET", - ",": "COMMA", - "@": "AT", -}; -// Parser regexes to consume the next token -const regexWhitespacePrefix = new RegExp("^(\\s*)"); -const regexNumberPrefix = new RegExp("^([0-9]+)"); -const regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"); -// Parser regexs to check validity -const regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"); -const regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"); -class TokenString { - #offset; - #tokens; - get offset() { - return this.#offset; - } - get length() { - return this.#tokens.length - this.#offset; - } - constructor(tokens) { - this.#offset = 0; - this.#tokens = tokens.slice(); - } - clone() { - return new _a(this.#tokens); - } - reset() { - this.#offset = 0; - } - #subTokenString(from = 0, to = 0) { - return new _a(this.#tokens.slice(from, to).map((t) => { - return Object.freeze(Object.assign({}, t, { - match: t.match - from, - linkBack: t.linkBack - from, - linkNext: t.linkNext - from, - })); - })); - } - // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens - popKeyword(allowed) { - const top = this.peek(); - if (top.type !== "KEYWORD" || !allowed.has(top.text)) { - throw new Error(`expected keyword ${top.text}`); - } - return this.pop().text; - } - // Pops and returns the value of the next token if it is `type`; throws if out of tokens - popType(type) { - if (this.peek().type !== type) { - throw new Error(`expected ${type}; got ${JSON.stringify(this.peek())}`); - } - return this.pop().text; - } - // Pops and returns a "(" TOKENS ")" - popParen() { - const top = this.peek(); - if (top.type !== "OPEN_PAREN") { - throw new Error("bad start"); - } - const result = this.#subTokenString(this.#offset + 1, top.match + 1); - this.#offset = top.match + 1; - return result; - } - // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" - popParams() { - const top = this.peek(); - if (top.type !== "OPEN_PAREN") { - throw new Error("bad start"); - } - const result = []; - while (this.#offset < top.match - 1) { - const link = this.peek().linkNext; - result.push(this.#subTokenString(this.#offset + 1, link)); - this.#offset = link; - } - this.#offset = top.match + 1; - return result; - } - // Returns the top Token, throwing if out of tokens - peek() { - if (this.#offset >= this.#tokens.length) { - throw new Error("out-of-bounds"); - } - return this.#tokens[this.#offset]; - } - // Returns the next value, if it is a keyword in `allowed` - peekKeyword(allowed) { - const top = this.peekType("KEYWORD"); - return top != null && allowed.has(top) ? top : null; - } - // Returns the value of the next token if it is `type` - peekType(type) { - if (this.length === 0) { - return null; - } - const top = this.peek(); - return top.type === type ? top.text : null; - } - // Returns the next token; throws if out of tokens - pop() { - const result = this.peek(); - this.#offset++; - return result; - } - toString() { - const tokens = []; - for (let i = this.#offset; i < this.#tokens.length; i++) { - const token = this.#tokens[i]; - tokens.push(`${token.type}:${token.text}`); - } - return ``; - } -} -_a = TokenString; -function lex(text) { - const tokens = []; - const throwError = (message) => { - const token = offset < text.length ? JSON.stringify(text[offset]) : "$EOI"; - throw new Error(`invalid token ${token} at ${offset}: ${message}`); - }; - let brackets = []; - let commas = []; - let offset = 0; - while (offset < text.length) { - // Strip off any leading whitespace - let cur = text.substring(offset); - let match = cur.match(regexWhitespacePrefix); - if (match) { - offset += match[1].length; - cur = text.substring(offset); - } - const token = { - depth: brackets.length, - linkBack: -1, - linkNext: -1, - match: -1, - type: "", - text: "", - offset, - value: -1, - }; - tokens.push(token); - let type = SimpleTokens[cur[0]] || ""; - if (type) { - token.type = type; - token.text = cur[0]; - offset++; - if (type === "OPEN_PAREN") { - brackets.push(tokens.length - 1); - commas.push(tokens.length - 1); - } - else if (type == "CLOSE_PAREN") { - if (brackets.length === 0) { - throwError("no matching open bracket"); - } - token.match = brackets.pop(); - tokens[token.match].match = tokens.length - 1; - token.depth--; - token.linkBack = commas.pop(); - tokens[token.linkBack].linkNext = tokens.length - 1; - } - else if (type === "COMMA") { - token.linkBack = commas.pop(); - tokens[token.linkBack].linkNext = tokens.length - 1; - commas.push(tokens.length - 1); - } - else if (type === "OPEN_BRACKET") { - token.type = "BRACKET"; - } - else if (type === "CLOSE_BRACKET") { - // Remove the CLOSE_BRACKET - let suffix = tokens.pop().text; - if (tokens.length > 0 && tokens[tokens.length - 1].type === "NUMBER") { - const value = tokens.pop().text; - suffix = value + suffix; - tokens[tokens.length - 1].value = - (0, index_js_1.getNumber)(value); - } - if (tokens.length === 0 || - tokens[tokens.length - 1].type !== "BRACKET") { - throw new Error("missing opening bracket"); - } - tokens[tokens.length - 1].text += suffix; - } - continue; - } - match = cur.match(regexIdPrefix); - if (match) { - token.text = match[1]; - offset += token.text.length; - if (Keywords.has(token.text)) { - token.type = "KEYWORD"; - continue; - } - if (token.text.match(regexType)) { - token.type = "TYPE"; - continue; - } - token.type = "ID"; - continue; - } - match = cur.match(regexNumberPrefix); - if (match) { - token.text = match[1]; - token.type = "NUMBER"; - offset += token.text.length; - continue; - } - throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`); - } - return new TokenString(tokens.map((t) => Object.freeze(t))); -} -// Check only one of `allowed` is in `set` -function allowSingle(set, allowed) { - let included = []; - for (const key in allowed.keys()) { - if (set.has(key)) { - included.push(key); - } - } - if (included.length > 1) { - throw new Error(`conflicting types: ${included.join(", ")}`); - } -} -// Functions to process a Solidity Signature TokenString from left-to-right for... -// ...the name with an optional type, returning the name -function consumeName(type, tokens) { - if (tokens.peekKeyword(KwTypes)) { - const keyword = tokens.pop().text; - if (keyword !== type) { - throw new Error(`expected ${type}, got ${keyword}`); - } - } - return tokens.popType("ID"); -} -// ...all keywords matching allowed, returning the keywords -function consumeKeywords(tokens, allowed) { - const keywords = new Set(); - while (true) { - const keyword = tokens.peekType("KEYWORD"); - if (keyword == null || (allowed && !allowed.has(keyword))) { - break; - } - tokens.pop(); - if (keywords.has(keyword)) { - throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`); - } - keywords.add(keyword); - } - return Object.freeze(keywords); -} -// ...all visibility keywords, returning the coalesced mutability -function consumeMutability(tokens) { - let modifiers = consumeKeywords(tokens, KwVisib); - // Detect conflicting modifiers - allowSingle(modifiers, setify("constant payable nonpayable".split(" "))); - allowSingle(modifiers, setify("pure view payable nonpayable".split(" "))); - // Process mutability states - if (modifiers.has("view")) { - return "view"; - } - if (modifiers.has("pure")) { - return "pure"; - } - if (modifiers.has("payable")) { - return "payable"; - } - if (modifiers.has("nonpayable")) { - return "nonpayable"; - } - // Process legacy `constant` last - if (modifiers.has("constant")) { - return "view"; - } - return "nonpayable"; -} -// ...a parameter list, returning the ParamType list -function consumeParams(tokens, allowIndexed) { - return tokens.popParams().map((t) => ParamType.from(t, allowIndexed)); -} -// ...a energy limit, returning a BigNumber or null if none -function consumeEnergy(tokens) { - if (tokens.peekType("AT")) { - tokens.pop(); - if (tokens.peekType("NUMBER")) { - return (0, index_js_1.getBigInt)(tokens.pop().text); - } - throw new Error("invalid energy"); - } - return null; -} -function consumeEoi(tokens) { - if (tokens.length) { - throw new Error(`unexpected tokens: ${tokens.toString()}`); - } -} -const regexArrayType = new RegExp(/^(.*)\[([0-9]*)\]$/); -function verifyBasicType(type) { - const match = type.match(regexType); - (0, index_js_1.assertArgument)(match, "invalid type", "type", type); - if (type === "uint") { - return "uint256"; - } - if (type === "int") { - return "int256"; - } - if (match[2]) { - // bytesXX - const length = parseInt(match[2]); - (0, index_js_1.assertArgument)(length !== 0 && length <= 32, "invalid bytes length", "type", type); - } - else if (match[3]) { - // intXX or uintXX - const size = parseInt(match[3]); - (0, index_js_1.assertArgument)(size !== 0 && size <= 256 && size % 8 === 0, "invalid numeric width", "type", type); - } - return type; -} -// Make the Fragment constructors effectively private -const _guard = {}; -const internal = Symbol.for("_corebc_internal"); -const ParamTypeInternal = "_ParamTypeInternal"; -const ErrorFragmentInternal = "_ErrorInternal"; -const EventFragmentInternal = "_EventInternal"; -const ConstructorFragmentInternal = "_ConstructorInternal"; -const FallbackFragmentInternal = "_FallbackInternal"; -const FunctionFragmentInternal = "_FunctionInternal"; -const StructFragmentInternal = "_StructInternal"; -/** - * Each input and output of a [[Fragment]] is an Array of **PAramType**. - */ -class ParamType { - /** - * The local name of the parameter (or ``""`` if unbound) - */ - name; - /** - * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, - * ``"uint256[3][]"``) - */ - type; - /** - * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) - */ - baseType; - /** - * True if the parameters is indexed. - * - * For non-indexable types this is ``null``. - */ - indexed; - /** - * The components for the tuple. - * - * For non-tuple types this is ``null``. - */ - components; - /** - * The array length, or ``-1`` for dynamic-lengthed arrays. - * - * For non-array types this is ``null``. - */ - arrayLength; - /** - * The type of each child in the array. - * - * For non-array types this is ``null``. - */ - arrayChildren; - /** - * @private - */ - constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) { - (0, index_js_1.assertPrivate)(guard, _guard, "ParamType"); - Object.defineProperty(this, internal, { value: ParamTypeInternal }); - if (components) { - components = Object.freeze(components.slice()); - } - if (baseType === "array") { - if (arrayLength == null || arrayChildren == null) { - throw new Error(""); - } - } - else if (arrayLength != null || arrayChildren != null) { - throw new Error(""); - } - if (baseType === "tuple") { - if (components == null) { - throw new Error(""); - } - } - else if (components != null) { - throw new Error(""); - } - (0, index_js_1.defineProperties)(this, { - name, - type, - baseType, - indexed, - components, - arrayLength, - arrayChildren, - }); - } - /** - * Return a string representation of this type. - * - * For example, - * - * ``sighash" => "(uint256,address)"`` - * - * ``"minimal" => "tuple(uint256,address) indexed"`` - * - * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` - */ - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - let result = { - type: this.baseType === "tuple" ? "tuple" : this.type, - name: this.name || undefined, - }; - if (typeof this.indexed === "boolean") { - result.indexed = this.indexed; - } - if (this.isTuple()) { - result.components = this.components.map((c) => JSON.parse(c.format(format))); - } - return JSON.stringify(result); - } - let result = ""; - // Array - if (this.isArray()) { - result += this.arrayChildren.format(format); - result += `[${this.arrayLength < 0 ? "" : String(this.arrayLength)}]`; - } - else { - if (this.isTuple()) { - if (format !== "sighash") { - result += this.type; - } - result += - "(" + - this.components - .map((comp) => comp.format(format)) - .join(format === "full" ? ", " : ",") + - ")"; - } - else { - result += this.type; - } - } - if (format !== "sighash") { - if (this.indexed === true) { - result += " indexed"; - } - if (format === "full" && this.name) { - result += " " + this.name; - } - } - return result; - } - /* - * Returns true if %%value%% is an Array type. - * - * This provides a type gaurd ensuring that the - * [[arrayChildren]] and [[arrayLength]] are non-null. - */ - //static isArray(value: any): value is { arrayChildren: ParamType, arrayLength: number } { - // return value && (value.baseType === "array") - //} - /** - * Returns true if %%this%% is an Array type. - * - * This provides a type gaurd ensuring that [[arrayChildren]] - * and [[arrayLength]] are non-null. - */ - isArray() { - return this.baseType === "array"; - } - /** - * Returns true if %%this%% is a Tuple type. - * - * This provides a type gaurd ensuring that [[components]] - * is non-null. - */ - isTuple() { - return this.baseType === "tuple"; - } - /** - * Returns true if %%this%% is an Indexable type. - * - * This provides a type gaurd ensuring that [[indexed]] - * is non-null. - */ - isIndexable() { - return this.indexed != null; - } - /** - * Walks the **ParamType** with %%value%%, calling %%process%% - * on each type, destructing the %%value%% recursively. - */ - walk(value, process) { - if (this.isArray()) { - if (!Array.isArray(value)) { - throw new Error("invalid array value"); - } - if (this.arrayLength !== -1 && value.length !== this.arrayLength) { - throw new Error("array is wrong length"); - } - const _this = this; - return value.map((v) => _this.arrayChildren.walk(v, process)); - } - if (this.isTuple()) { - if (!Array.isArray(value)) { - throw new Error("invalid tuple value"); - } - if (value.length !== this.components.length) { - throw new Error("array is wrong length"); - } - const _this = this; - return value.map((v, i) => _this.components[i].walk(v, process)); - } - return process(this.type, value); - } - #walkAsync(promises, value, process, setValue) { - if (this.isArray()) { - if (!Array.isArray(value)) { - throw new Error("invalid array value"); - } - if (this.arrayLength !== -1 && value.length !== this.arrayLength) { - throw new Error("array is wrong length"); - } - const childType = this.arrayChildren; - const result = value.slice(); - result.forEach((value, index) => { - childType.#walkAsync(promises, value, process, (value) => { - result[index] = value; - }); - }); - setValue(result); - return; - } - if (this.isTuple()) { - const components = this.components; - // Convert the object into an array - let result; - if (Array.isArray(value)) { - result = value.slice(); - } - else { - if (value == null || typeof value !== "object") { - throw new Error("invalid tuple value"); - } - result = components.map((param) => { - if (!param.name) { - throw new Error("cannot use object value with unnamed components"); - } - if (!(param.name in value)) { - throw new Error(`missing value for component ${param.name}`); - } - return value[param.name]; - }); - } - if (result.length !== this.components.length) { - throw new Error("array is wrong length"); - } - result.forEach((value, index) => { - components[index].#walkAsync(promises, value, process, (value) => { - result[index] = value; - }); - }); - setValue(result); - return; - } - const result = process(this.type, value); - if (result.then) { - promises.push((async function () { - setValue(await result); - })()); - } - else { - setValue(result); - } - } - /** - * Walks the **ParamType** with %%value%%, asynchronously calling - * %%process%% on each type, destructing the %%value%% recursively. - * - * This can be used to resolve ENS naes by walking and resolving each - * ``"address"`` type. - */ - async walkAsync(value, process) { - const promises = []; - const result = [value]; - this.#walkAsync(promises, value, process, (value) => { - result[0] = value; - }); - if (promises.length) { - await Promise.all(promises); - } - return result[0]; - } - /** - * Creates a new **ParamType** for %%obj%%. - * - * If %%allowIndexed%% then the ``indexed`` keyword is permitted, - * otherwise the ``indexed`` keyword will throw an error. - */ - static from(obj, allowIndexed) { - if (ParamType.isParamType(obj)) { - return obj; - } - if (typeof obj === "string") { - return ParamType.from(lex(obj), allowIndexed); - } - else if (obj instanceof TokenString) { - let type = "", baseType = ""; - let comps = null; - if (consumeKeywords(obj, setify(["tuple"])).has("tuple") || - obj.peekType("OPEN_PAREN")) { - // Tuple - baseType = "tuple"; - comps = obj.popParams().map((t) => ParamType.from(t)); - type = `tuple(${comps.map((c) => c.format()).join(",")})`; - } - else { - // Normal - type = verifyBasicType(obj.popType("TYPE")); - baseType = type; - } - // Check for Array - let arrayChildren = null; - let arrayLength = null; - while (obj.length && obj.peekType("BRACKET")) { - const bracket = obj.pop(); //arrays[i]; - arrayChildren = new ParamType(_guard, "", type, baseType, null, comps, arrayLength, arrayChildren); - arrayLength = bracket.value; - type += bracket.text; - baseType = "array"; - comps = null; - } - let indexed = null; - const keywords = consumeKeywords(obj, KwModifiers); - if (keywords.has("indexed")) { - if (!allowIndexed) { - throw new Error(""); - } - indexed = true; - } - const name = obj.peekType("ID") ? obj.pop().text : ""; - if (obj.length) { - throw new Error("leftover tokens"); - } - return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren); - } - const name = obj.name; - (0, index_js_1.assertArgument)(!name || (typeof name === "string" && name.match(regexId)), "invalid name", "obj.name", name); - let indexed = obj.indexed; - if (indexed != null) { - (0, index_js_1.assertArgument)(allowIndexed, "parameter cannot be indexed", "obj.indexed", obj.indexed); - indexed = !!indexed; - } - let type = obj.type; - let arrayMatch = type.match(regexArrayType); - if (arrayMatch) { - const arrayLength = parseInt(arrayMatch[2] || "-1"); - const arrayChildren = ParamType.from({ - type: arrayMatch[1], - components: obj.components, - }); - return new ParamType(_guard, name || "", type, "array", indexed, null, arrayLength, arrayChildren); - } - if (type === "tuple" || - type.startsWith("tuple(" /* fix: ) */) || - type.startsWith("(" /* fix: ) */)) { - const comps = obj.components != null - ? obj.components.map((c) => ParamType.from(c)) - : null; - const tuple = new ParamType(_guard, name || "", type, "tuple", indexed, comps, null, null); - // @TODO: use lexer to validate and normalize type - return tuple; - } - type = verifyBasicType(obj.type); - return new ParamType(_guard, name || "", type, type, indexed, null, null, null); - } - /** - * Returns true if %%value%% is a **ParamType**. - */ - static isParamType(value) { - return value && value[internal] === ParamTypeInternal; - } -} -exports.ParamType = ParamType; -/** - * An abstract class to represent An individual fragment from a parse ABI. - */ -class Fragment { - /** - * The type of the fragment. - */ - type; - /** - * The inputs for the fragment. - */ - inputs; - /** - * @private - */ - constructor(guard, type, inputs) { - (0, index_js_1.assertPrivate)(guard, _guard, "Fragment"); - inputs = Object.freeze(inputs.slice()); - (0, index_js_1.defineProperties)(this, { type, inputs }); - } - /** - * Creates a new **Fragment** for %%obj%%, wich can be any supported - * ABI frgament type. - */ - static from(obj) { - if (typeof obj === "string") { - // Try parsing JSON... - try { - Fragment.from(JSON.parse(obj)); - } - catch (e) { } - // ...otherwise, use the human-readable lexer - return Fragment.from(lex(obj)); - } - if (obj instanceof TokenString) { - // Human-readable ABI (already lexed) - const type = obj.peekKeyword(KwTypes); - switch (type) { - case "constructor": - return ConstructorFragment.from(obj); - case "error": - return ErrorFragment.from(obj); - case "event": - return EventFragment.from(obj); - case "fallback": - case "receive": - return FallbackFragment.from(obj); - case "function": - return FunctionFragment.from(obj); - case "struct": - return StructFragment.from(obj); - } - } - else if (typeof obj === "object") { - // JSON ABI - switch (obj.type) { - case "constructor": - return ConstructorFragment.from(obj); - case "error": - return ErrorFragment.from(obj); - case "event": - return EventFragment.from(obj); - case "fallback": - case "receive": - return FallbackFragment.from(obj); - case "function": - return FunctionFragment.from(obj); - case "struct": - return StructFragment.from(obj); - } - (0, index_js_1.assert)(false, `unsupported type: ${obj.type}`, "UNSUPPORTED_OPERATION", { - operation: "Fragment.from", - }); - } - (0, index_js_1.assertArgument)(false, "unsupported frgament object", "obj", obj); - } - /** - * Returns true if %%value%% is a [[ConstructorFragment]]. - */ - static isConstructor(value) { - return ConstructorFragment.isFragment(value); - } - /** - * Returns true if %%value%% is an [[ErrorFragment]]. - */ - static isError(value) { - return ErrorFragment.isFragment(value); - } - /** - * Returns true if %%value%% is an [[EventFragment]]. - */ - static isEvent(value) { - return EventFragment.isFragment(value); - } - /** - * Returns true if %%value%% is a [[FunctionFragment]]. - */ - static isFunction(value) { - return FunctionFragment.isFragment(value); - } - /** - * Returns true if %%value%% is a [[StructFragment]]. - */ - static isStruct(value) { - return StructFragment.isFragment(value); - } -} -exports.Fragment = Fragment; -/** - * An abstract class to represent An individual fragment - * which has a name from a parse ABI. - */ -class NamedFragment extends Fragment { - /** - * The name of the fragment. - */ - name; - /** - * @private - */ - constructor(guard, type, name, inputs) { - super(guard, type, inputs); - (0, index_js_1.assertArgument)(typeof name === "string" && name.match(regexId), "invalid identifier", "name", name); - inputs = Object.freeze(inputs.slice()); - (0, index_js_1.defineProperties)(this, { name }); - } -} -exports.NamedFragment = NamedFragment; -function joinParams(format, params) { - return ("(" + - params.map((p) => p.format(format)).join(format === "full" ? ", " : ",") + - ")"); -} -/** - * A Fragment which represents a //Custom Error//. - */ -class ErrorFragment extends NamedFragment { - /** - * @private - */ - constructor(guard, name, inputs) { - super(guard, "error", name, inputs); - Object.defineProperty(this, internal, { value: ErrorFragmentInternal }); - } - /** - * The Custom Error selector. - */ - get selector() { - return (0, index_js_2.id)(this.format("sighash")).substring(0, 10); - } - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "error", - name: this.name, - inputs: this.inputs.map((input) => JSON.parse(input.format(format))), - }); - } - const result = []; - if (format !== "sighash") { - result.push("error"); - } - result.push(this.name + joinParams(format, this.inputs)); - return result.join(" "); - } - static from(obj) { - if (ErrorFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return ErrorFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("error", obj); - const inputs = consumeParams(obj); - consumeEoi(obj); - return new ErrorFragment(_guard, name, inputs); - } - return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); - } - static isFragment(value) { - return value && value[internal] === ErrorFragmentInternal; - } -} -exports.ErrorFragment = ErrorFragment; -/** - * A Fragment which represents an Event. - */ -class EventFragment extends NamedFragment { - anonymous; - /** - * @private - */ - constructor(guard, name, inputs, anonymous) { - super(guard, "event", name, inputs); - Object.defineProperty(this, internal, { value: EventFragmentInternal }); - (0, index_js_1.defineProperties)(this, { anonymous }); - } - /** - * The Event topic hash. - */ - get topicHash() { - return (0, index_js_2.id)(this.format("sighash")); - } - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "event", - anonymous: this.anonymous, - name: this.name, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - }); - } - const result = []; - if (format !== "sighash") { - result.push("event"); - } - result.push(this.name + joinParams(format, this.inputs)); - if (format !== "sighash" && this.anonymous) { - result.push("anonymous"); - } - return result.join(" "); - } - static getTopicHash(name, params) { - params = (params || []).map((p) => ParamType.from(p)); - const fragment = new EventFragment(_guard, name, params, false); - return fragment.topicHash; - } - static from(obj) { - if (EventFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return EventFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("event", obj); - const inputs = consumeParams(obj, true); - const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has("anonymous"); - consumeEoi(obj); - return new EventFragment(_guard, name, inputs, anonymous); - } - return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous); - } - static isFragment(value) { - return value && value[internal] === EventFragmentInternal; - } -} -exports.EventFragment = EventFragment; -/** - * A Fragment which represents a constructor. - */ -class ConstructorFragment extends Fragment { - payable; - energy; - /** - * @private - */ - constructor(guard, type, inputs, payable, energy) { - super(guard, type, inputs); - Object.defineProperty(this, internal, { - value: ConstructorFragmentInternal, - }); - (0, index_js_1.defineProperties)(this, { payable, energy }); - } - format(format) { - (0, index_js_1.assert)(format != null && format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" }); - if (format === "json") { - return JSON.stringify({ - type: "constructor", - stateMutability: this.payable ? "payable" : "undefined", - payable: this.payable, - energy: this.energy != null ? this.energy : undefined, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - }); - } - const result = [`constructor${joinParams(format, this.inputs)}`]; - result.push(this.payable ? "payable" : "nonpayable"); - if (this.energy != null) { - result.push(`@${this.energy.toString()}`); - } - return result.join(" "); - } - static from(obj) { - if (ConstructorFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return ConstructorFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - consumeKeywords(obj, setify(["constructor"])); - const inputs = consumeParams(obj); - const payable = !!consumeKeywords(obj, setify(["payable"])).has("payable"); - const energy = consumeEnergy(obj); - consumeEoi(obj); - return new ConstructorFragment(_guard, "constructor", inputs, payable, energy); - } - return new ConstructorFragment(_guard, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, obj.energy != null ? obj.energy : null); - } - static isFragment(value) { - return value && value[internal] === ConstructorFragmentInternal; - } -} -exports.ConstructorFragment = ConstructorFragment; -/** - * A Fragment which represents a method. - */ -class FallbackFragment extends Fragment { - /** - * If the function can be sent value during invocation. - */ - payable; - constructor(guard, inputs, payable) { - super(guard, "fallback", inputs); - Object.defineProperty(this, internal, { value: FallbackFragmentInternal }); - (0, index_js_1.defineProperties)(this, { payable }); - } - format(format) { - const type = this.inputs.length === 0 ? "receive" : "fallback"; - if (format === "json") { - const stateMutability = this.payable ? "payable" : "nonpayable"; - return JSON.stringify({ type, stateMutability }); - } - return `${type}()${this.payable ? " payable" : ""}`; - } - static from(obj) { - if (FallbackFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return FallbackFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const errorObj = obj.toString(); - const topIsValid = obj.peekKeyword(setify(["fallback", "receive"])); - (0, index_js_1.assertArgument)(topIsValid, "type must be fallback or receive", "obj", errorObj); - const type = obj.popKeyword(setify(["fallback", "receive"])); - // receive() - if (type === "receive") { - const inputs = consumeParams(obj); - (0, index_js_1.assertArgument)(inputs.length === 0, `receive cannot have arguments`, "obj.inputs", inputs); - consumeKeywords(obj, setify(["payable"])); - consumeEoi(obj); - return new FallbackFragment(_guard, [], true); - } - // fallback() [payable] - // fallback(bytes) [payable] returns (bytes) - let inputs = consumeParams(obj); - if (inputs.length) { - (0, index_js_1.assertArgument)(inputs.length === 1 && inputs[0].type === "bytes", "invalid fallback inputs", "obj.inputs", inputs.map((i) => i.format("minimal")).join(", ")); - } - else { - inputs = [ParamType.from("bytes")]; - } - const mutability = consumeMutability(obj); - (0, index_js_1.assertArgument)(mutability === "nonpayable" || mutability === "payable", "fallback cannot be constants", "obj.stateMutability", mutability); - if (consumeKeywords(obj, setify(["returns"])).has("returns")) { - const outputs = consumeParams(obj); - (0, index_js_1.assertArgument)(outputs.length === 1 && outputs[0].type === "bytes", "invalid fallback outputs", "obj.outputs", outputs.map((i) => i.format("minimal")).join(", ")); - } - consumeEoi(obj); - return new FallbackFragment(_guard, inputs, mutability === "payable"); - } - if (obj.type === "receive") { - return new FallbackFragment(_guard, [], true); - } - if (obj.type === "fallback") { - const inputs = [ParamType.from("bytes")]; - const payable = obj.stateMutability === "payable"; - return new FallbackFragment(_guard, inputs, payable); - } - (0, index_js_1.assertArgument)(false, "invalid fallback description", "obj", obj); - } - static isFragment(value) { - return value && value[internal] === FallbackFragmentInternal; - } -} -exports.FallbackFragment = FallbackFragment; -/** - * A Fragment which represents a method. - */ -class FunctionFragment extends NamedFragment { - /** - * If the function is constant (e.g. ``pure`` or ``view`` functions). - */ - constant; - /** - * The returned types for the result of calling this function. - */ - outputs; - /** - * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` - * or ``pure``) - */ - stateMutability; - /** - * If the function can be sent value during invocation. - */ - payable; - /** - * The amount of energy to send when calling this function - */ - energy; - /** - * @private - */ - constructor(guard, name, stateMutability, inputs, outputs, energy) { - super(guard, "function", name, inputs); - Object.defineProperty(this, internal, { value: FunctionFragmentInternal }); - outputs = Object.freeze(outputs.slice()); - const constant = stateMutability === "view" || stateMutability === "pure"; - const payable = stateMutability === "payable"; - (0, index_js_1.defineProperties)(this, { - constant, - energy, - outputs, - payable, - stateMutability, - }); - } - /** - * The Function selector. - */ - get selector() { - return (0, index_js_2.id)(this.format("sighash")).substring(0, 10); - } - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "function", - name: this.name, - constant: this.constant, - stateMutability: this.stateMutability !== "nonpayable" - ? this.stateMutability - : undefined, - payable: this.payable, - energy: this.energy != null ? this.energy : undefined, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - outputs: this.outputs.map((o) => JSON.parse(o.format(format))), - }); - } - const result = []; - if (format !== "sighash") { - result.push("function"); - } - result.push(this.name + joinParams(format, this.inputs)); - if (format !== "sighash") { - if (this.stateMutability !== "nonpayable") { - result.push(this.stateMutability); - } - if (this.outputs && this.outputs.length) { - result.push("returns"); - result.push(joinParams(format, this.outputs)); - } - if (this.energy != null) { - result.push(`@${this.energy.toString()}`); - } - } - return result.join(" "); - } - static getSelector(name, params) { - params = (params || []).map((p) => ParamType.from(p)); - const fragment = new FunctionFragment(_guard, name, "view", params, [], null); - return fragment.selector; - } - static from(obj) { - if (FunctionFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return FunctionFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("function", obj); - const inputs = consumeParams(obj); - const mutability = consumeMutability(obj); - let outputs = []; - if (consumeKeywords(obj, setify(["returns"])).has("returns")) { - outputs = consumeParams(obj); - } - const energy = consumeEnergy(obj); - consumeEoi(obj); - return new FunctionFragment(_guard, name, mutability, inputs, outputs, energy); - } - let stateMutability = obj.stateMutability; - // Use legacy Solidity ABI logic if stateMutability is missing - if (stateMutability == null) { - stateMutability = "payable"; - if (typeof obj.constant === "boolean") { - stateMutability = "view"; - if (!obj.constant) { - stateMutability = "payable"; - if (typeof obj.payable === "boolean" && !obj.payable) { - stateMutability = "nonpayable"; - } - } - } - else if (typeof obj.payable === "boolean" && !obj.payable) { - stateMutability = "nonpayable"; - } - } - // @TODO: verifyState for stateMutability (e.g. throw if - // payable: false but stateMutability is "nonpayable") - return new FunctionFragment(_guard, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], obj.energy != null ? obj.energy : null); - } - static isFragment(value) { - return value && value[internal] === FunctionFragmentInternal; - } -} -exports.FunctionFragment = FunctionFragment; -/** - * A Fragment which represents a structure. - */ -class StructFragment extends NamedFragment { - /** - * @private - */ - constructor(guard, name, inputs) { - super(guard, "struct", name, inputs); - Object.defineProperty(this, internal, { value: StructFragmentInternal }); - } - format() { - throw new Error("@TODO"); - } - static from(obj) { - if (typeof obj === "string") { - return StructFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("struct", obj); - const inputs = consumeParams(obj); - consumeEoi(obj); - return new StructFragment(_guard, name, inputs); - } - return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); - } - static isFragment(value) { - return value && value[internal] === StructFragmentInternal; - } -} -exports.StructFragment = StructFragment; -//# sourceMappingURL=fragments.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/fragments.js.map b/lib.commonjs/abi/fragments.js.map deleted file mode 100644 index e4c9e6ac9..000000000 --- a/lib.commonjs/abi/fragments.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../../src.ts/abi/fragments.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAEH,gDAO2B;AAC3B,+CAAsC;AAkGtC,qCAAqC;AACrC,SAAS,MAAM,CAAC,KAAoB;IAClC,MAAM,MAAM,GAAgB,IAAI,GAAG,EAAE,CAAC;IACtC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,sBAAsB;AACtB,MAAM,QAAQ,GAAG,6DAA6D,CAAC;AAC/E,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,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AK,QAAQ,EAAE;YAC3B,OAAO,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;SACtC;aAAM,IAAI,GAAG,YAAY,WAAW,EAAE;YACrC,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YACxC,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;YAClC,UAAU,CAAC,GAAG,CAAC,CAAC;YAChB,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;SACjD;QAED,OAAO,IAAI,cAAc,CACvB,MAAM,EACN,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CACjD,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,KAAU;QAC1B,OAAO,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,sBAAsB,CAAC;IAC7D,CAAC;CACF;AAjCD,wCAiCC"} \ No newline at end of file diff --git a/lib.commonjs/abi/index.d.ts b/lib.commonjs/abi/index.d.ts deleted file mode 100644 index ce0ddb016..000000000 --- a/lib.commonjs/abi/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Explain about ABI here... - * - * @_section api/abi:Application Binary Interface [about-abi] - * @_navTitle: ABI - */ -export { AbiCoder } from "./abi-coder.js"; -export { decodeBytes32String, encodeBytes32String } from "./bytes32.js"; -export { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, NamedFragment, ParamType, StructFragment, } from "./fragments.js"; -export { checkResultErrors, Indexed, Interface, ErrorDescription, LogDescription, TransactionDescription, Result, } from "./interface.js"; -export { Typed } from "./typed.js"; -export type { JsonFragment, JsonFragmentType, FormatType, FragmentType, ParamTypeWalkAsyncFunc, ParamTypeWalkFunc, } from "./fragments.js"; -export type { InterfaceAbi } from "./interface.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/index.d.ts.map b/lib.commonjs/abi/index.d.ts.map deleted file mode 100644 index 4eb1a4ab8..000000000 --- a/lib.commonjs/abi/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,MAAM,GACP,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/abi/index.js b/lib.commonjs/abi/index.js deleted file mode 100644 index 9699edfa4..000000000 --- a/lib.commonjs/abi/index.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -/** - * Explain about ABI here... - * - * @_section api/abi:Application Binary Interface [about-abi] - * @_navTitle: ABI - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Typed = exports.Result = exports.TransactionDescription = exports.LogDescription = exports.ErrorDescription = exports.Interface = exports.Indexed = exports.checkResultErrors = exports.StructFragment = exports.ParamType = exports.NamedFragment = exports.FunctionFragment = exports.Fragment = exports.FallbackFragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.encodeBytes32String = exports.decodeBytes32String = exports.AbiCoder = void 0; -////// -var abi_coder_js_1 = require("./abi-coder.js"); -Object.defineProperty(exports, "AbiCoder", { enumerable: true, get: function () { return abi_coder_js_1.AbiCoder; } }); -var bytes32_js_1 = require("./bytes32.js"); -Object.defineProperty(exports, "decodeBytes32String", { enumerable: true, get: function () { return bytes32_js_1.decodeBytes32String; } }); -Object.defineProperty(exports, "encodeBytes32String", { enumerable: true, get: function () { return bytes32_js_1.encodeBytes32String; } }); -var fragments_js_1 = require("./fragments.js"); -Object.defineProperty(exports, "ConstructorFragment", { enumerable: true, get: function () { return fragments_js_1.ConstructorFragment; } }); -Object.defineProperty(exports, "ErrorFragment", { enumerable: true, get: function () { return fragments_js_1.ErrorFragment; } }); -Object.defineProperty(exports, "EventFragment", { enumerable: true, get: function () { return fragments_js_1.EventFragment; } }); -Object.defineProperty(exports, "FallbackFragment", { enumerable: true, get: function () { return fragments_js_1.FallbackFragment; } }); -Object.defineProperty(exports, "Fragment", { enumerable: true, get: function () { return fragments_js_1.Fragment; } }); -Object.defineProperty(exports, "FunctionFragment", { enumerable: true, get: function () { return fragments_js_1.FunctionFragment; } }); -Object.defineProperty(exports, "NamedFragment", { enumerable: true, get: function () { return fragments_js_1.NamedFragment; } }); -Object.defineProperty(exports, "ParamType", { enumerable: true, get: function () { return fragments_js_1.ParamType; } }); -Object.defineProperty(exports, "StructFragment", { enumerable: true, get: function () { return fragments_js_1.StructFragment; } }); -var interface_js_1 = require("./interface.js"); -Object.defineProperty(exports, "checkResultErrors", { enumerable: true, get: function () { return interface_js_1.checkResultErrors; } }); -Object.defineProperty(exports, "Indexed", { enumerable: true, get: function () { return interface_js_1.Indexed; } }); -Object.defineProperty(exports, "Interface", { enumerable: true, get: function () { return interface_js_1.Interface; } }); -Object.defineProperty(exports, "ErrorDescription", { enumerable: true, get: function () { return interface_js_1.ErrorDescription; } }); -Object.defineProperty(exports, "LogDescription", { enumerable: true, get: function () { return interface_js_1.LogDescription; } }); -Object.defineProperty(exports, "TransactionDescription", { enumerable: true, get: function () { return interface_js_1.TransactionDescription; } }); -Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return interface_js_1.Result; } }); -var typed_js_1 = require("./typed.js"); -Object.defineProperty(exports, "Typed", { enumerable: true, get: function () { return typed_js_1.Typed; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/index.js.map b/lib.commonjs/abi/index.js.map deleted file mode 100644 index 6c03f307a..000000000 --- a/lib.commonjs/abi/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,MAAM;AACN,+CAA0C;AAAjC,wGAAA,QAAQ,OAAA;AAEjB,2CAAwE;AAA/D,iHAAA,mBAAmB,OAAA;AAAE,iHAAA,mBAAmB,OAAA;AAEjD,+CAUwB;AATtB,mHAAA,mBAAmB,OAAA;AACnB,6GAAA,aAAa,OAAA;AACb,6GAAA,aAAa,OAAA;AACb,gHAAA,gBAAgB,OAAA;AAChB,wGAAA,QAAQ,OAAA;AACR,gHAAA,gBAAgB,OAAA;AAChB,6GAAA,aAAa,OAAA;AACb,yGAAA,SAAS,OAAA;AACT,8GAAA,cAAc,OAAA;AAGhB,+CAQwB;AAPtB,iHAAA,iBAAiB,OAAA;AACjB,uGAAA,OAAO,OAAA;AACP,yGAAA,SAAS,OAAA;AACT,gHAAA,gBAAgB,OAAA;AAChB,8GAAA,cAAc,OAAA;AACd,sHAAA,sBAAsB,OAAA;AACtB,sGAAA,MAAM,OAAA;AAGR,uCAAmC;AAA1B,iGAAA,KAAK,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/abi/interface.d.ts b/lib.commonjs/abi/interface.d.ts deleted file mode 100644 index 62b24ebe4..000000000 --- a/lib.commonjs/abi/interface.d.ts +++ /dev/null @@ -1,270 +0,0 @@ -/** - * About Interface - * - * @_subsection api/abi:Interfaces [interfaces] - */ -import { AbiCoder } from "./abi-coder.js"; -import { checkResultErrors, Result } from "./coders/abstract-coder.js"; -import { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, ParamType } from "./fragments.js"; -import { Typed } from "./typed.js"; -import type { BigNumberish, BytesLike, CallExceptionError, CallExceptionTransaction } from "../utils/index.js"; -import type { JsonFragment } from "./fragments.js"; -export { checkResultErrors, Result }; -export declare class LogDescription { - readonly fragment: EventFragment; - readonly name: string; - readonly signature: string; - readonly topic: string; - readonly args: Result; - constructor(fragment: EventFragment, topic: string, args: Result); -} -export declare class TransactionDescription { - readonly fragment: FunctionFragment; - readonly name: string; - readonly args: Result; - readonly signature: string; - readonly selector: string; - readonly value: bigint; - constructor(fragment: FunctionFragment, selector: string, args: Result, value: bigint); -} -export declare class ErrorDescription { - readonly fragment: ErrorFragment; - readonly name: string; - readonly args: Result; - readonly signature: string; - readonly selector: string; - constructor(fragment: ErrorFragment, selector: string, args: Result); -} -export declare class Indexed { - readonly hash: null | string; - readonly _isIndexed: boolean; - static isIndexed(value: any): value is Indexed; - constructor(hash: null | string); -} -/** - * @TODO - */ -export type InterfaceAbi = string | ReadonlyArray; -/** - * An Interface abstracts many of the low-level details for - * encoding and decoding the data on the blockchain. - * - * An ABI provides information on how to encode data to send to - * a Contract, how to decode the results and events and how to - * interpret revert errors. - * - * The ABI can be specified by [any supported format](InterfaceAbi). - */ -export declare class Interface { - #private; - /** - * All the Contract ABI members (i.e. methods, events, errors, etc). - */ - readonly fragments: ReadonlyArray; - /** - * The Contract constructor. - */ - readonly deploy: ConstructorFragment; - /** - * The Fallback method, if any. - */ - readonly fallback: null | FallbackFragment; - /** - * If receiving xcb is supported. - */ - readonly receive: boolean; - /** - * Create a new Interface for the %%fragments%%. - */ - constructor(fragments: InterfaceAbi); - /** - * Returns the entire Human-Readable ABI, as an array of - * signatures, optionally as %%minimal%% strings, which - * removes parameter names and unneceesary spaces. - */ - format(minimal?: boolean): Array; - /** - * Return the JSON-encoded ABI. This is the format Solidiy - * returns. - */ - formatJson(): string; - /** - * The ABI coder that will be used to encode and decode binary - * data. - */ - getAbiCoder(): AbiCoder; - /** - * Get the function name for %%key%%, which may be a function selector, - * function name or function signature that belongs to the ABI. - */ - getFunctionName(key: string): string; - /** - * Returns true if %%key%% (a function selector, function name or - * function signature) is present in the ABI. - * - * In the case of a function name, the name may be ambiguous, so - * accessing the [[FunctionFragment]] may require refinement. - */ - hasFunction(key: string): boolean; - /** - * Get the [[FunctionFragment]] for %%key%%, which may be a function - * selector, function name or function signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple functions match by name. - * - * If the %%key%% and %%values%% do not refine to a single function in - * the ABI, this will throw. - */ - getFunction(key: string, values?: Array): null | FunctionFragment; - /** - * Iterate over all functions, calling %%callback%%, sorted by their name. - */ - forEachFunction(callback: (func: FunctionFragment, index: number) => void): void; - /** - * Get the event name for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - */ - getEventName(key: string): string; - /** - * Returns true if %%key%% (an event topic hash, event name or - * event signature) is present in the ABI. - * - * In the case of an event name, the name may be ambiguous, so - * accessing the [[EventFragment]] may require refinement. - */ - hasEvent(key: string): boolean; - /** - * Get the [[EventFragment]] for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple events match by name. - * - * If the %%key%% and %%values%% do not refine to a single event in - * the ABI, this will throw. - */ - getEvent(key: string, values?: Array): null | EventFragment; - /** - * Iterate over all events, calling %%callback%%, sorted by their name. - */ - forEachEvent(callback: (func: EventFragment, index: number) => void): void; - /** - * Get the [[ErrorFragment]] for %%key%%, which may be an error - * selector, error name or error signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple errors match by name. - * - * If the %%key%% and %%values%% do not refine to a single error in - * the ABI, this will throw. - */ - getError(key: string, values?: Array): null | ErrorFragment; - /** - * Iterate over all errors, calling %%callback%%, sorted by their name. - */ - forEachError(callback: (func: ErrorFragment, index: number) => void): void; - _decodeParams(params: ReadonlyArray, data: BytesLike): Result; - _encodeParams(params: ReadonlyArray, values: ReadonlyArray): string; - /** - * Encodes a ``tx.data`` object for deploying the Contract with - * the %%values%% as the constructor arguments. - */ - encodeDeploy(values?: ReadonlyArray): string; - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified error (see [[getError]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeErrorResult(fragment: ErrorFragment | string, data: BytesLike): Result; - /** - * Encodes the transaction revert data for a call result that - * reverted from the the Contract with the sepcified %%error%% - * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeErrorResult(fragment: ErrorFragment | string, values?: ReadonlyArray): string; - /** - * Decodes the %%data%% from a transaction ``tx.data`` for - * the function specified (see [[getFunction]] for valid values - * for %%fragment%%). - * - * Most developers should prefer the [[parseTransaction]] method - * instead, which will automatically detect the fragment. - */ - decodeFunctionData(fragment: FunctionFragment | string, data: BytesLike): Result; - /** - * Encodes the ``tx.data`` for a transaction that calls the function - * specified (see [[getFunction]] for valid values for %%fragment%%) with - * the %%values%%. - */ - encodeFunctionData(fragment: FunctionFragment | string, values?: ReadonlyArray): string; - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeFunctionResult(fragment: FunctionFragment | string, data: BytesLike): Result; - makeError(_data: BytesLike, tx: CallExceptionTransaction): CallExceptionError; - /** - * Encodes the result data (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values - * for %%fragment%%) with %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeFunctionResult(fragment: FunctionFragment | string, values?: ReadonlyArray): string; - encodeFilterTopics(fragment: EventFragment | string, values: ReadonlyArray): Array>; - encodeEventLog(fragment: EventFragment | string, values: ReadonlyArray): { - data: string; - topics: Array; - }; - decodeEventLog(fragment: EventFragment | string, data: BytesLike, topics?: ReadonlyArray): Result; - /** - * Parses a transaction, finding the matching function and extracts - * the parameter values along with other useful function details. - * - * If the matching function cannot be found, return null. - */ - parseTransaction(tx: { - data: string; - value?: BigNumberish; - }): null | TransactionDescription; - parseCallResult(data: BytesLike): Result; - /** - * Parses a receipt log, finding the matching event and extracts - * the parameter values along with other useful event details. - * - * If the matching event cannot be found, returns null. - */ - parseLog(log: { - topics: Array; - data: string; - }): null | LogDescription; - /** - * Parses a revert data, finding the matching error and extracts - * the parameter values along with other useful error details. - * - * If the matching event cannot be found, returns null. - */ - parseError(data: BytesLike): null | ErrorDescription; - /** - * Creates a new [[Interface]] from the ABI %%value%%. - * - * The %%value%% may be provided as an existing [[Interface]] object, - * a JSON-encoded ABI or any Human-Readable ABI format. - */ - static from(value: InterfaceAbi | Interface): Interface; -} -//# sourceMappingURL=interface.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/interface.d.ts.map b/lib.commonjs/abi/interface.d.ts.map deleted file mode 100644 index 763cd7ac3..000000000 --- a/lib.commonjs/abi/interface.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src.ts/abi/interface.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,E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B,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,YAAY,CAAC;KACtB,GAAG,IAAI,GAAG,sBAAsB;IAcjC,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;IAIxC;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE;QACZ,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,IAAI,GAAG,cAAc;IAkBzB;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,gBAAgB;IAapD;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,SAAS;CAmBxD"} \ No newline at end of file diff --git a/lib.commonjs/abi/interface.js b/lib.commonjs/abi/interface.js deleted file mode 100644 index 8db6100b6..000000000 --- a/lib.commonjs/abi/interface.js +++ /dev/null @@ -1,1039 +0,0 @@ -"use strict"; -/** - * About Interface - * - * @_subsection api/abi:Interfaces [interfaces] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Interface = exports.Indexed = exports.ErrorDescription = exports.TransactionDescription = exports.LogDescription = exports.Result = exports.checkResultErrors = void 0; -const index_js_1 = require("../hash/index.js"); -const index_js_2 = require("../utils/index.js"); -const abi_coder_js_1 = require("./abi-coder.js"); -const abstract_coder_js_1 = require("./coders/abstract-coder.js"); -Object.defineProperty(exports, "checkResultErrors", { enumerable: true, get: function () { return abstract_coder_js_1.checkResultErrors; } }); -Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return abstract_coder_js_1.Result; } }); -const fragments_js_1 = require("./fragments.js"); -const typed_js_1 = require("./typed.js"); -const sha3_js_1 = require("../crypto/sha3.js"); -class LogDescription { - fragment; - name; - signature; - topic; - args; - constructor(fragment, topic, args) { - const name = fragment.name, signature = fragment.format(); - (0, index_js_2.defineProperties)(this, { - fragment, - name, - signature, - topic, - args, - }); - } -} -exports.LogDescription = LogDescription; -class TransactionDescription { - fragment; - name; - args; - signature; - selector; - value; - constructor(fragment, selector, args, value) { - const name = fragment.name, signature = fragment.format(); - (0, index_js_2.defineProperties)(this, { - fragment, - name, - args, - signature, - selector, - value, - }); - } -} -exports.TransactionDescription = TransactionDescription; -class ErrorDescription { - fragment; - name; - args; - signature; - selector; - constructor(fragment, selector, args) { - const name = fragment.name, signature = fragment.format(); - (0, index_js_2.defineProperties)(this, { - fragment, - name, - args, - signature, - selector, - }); - } -} -exports.ErrorDescription = ErrorDescription; -class Indexed { - hash; - _isIndexed; - static isIndexed(value) { - return !!(value && value._isIndexed); - } - constructor(hash) { - (0, index_js_2.defineProperties)(this, { hash, _isIndexed: true }); - } -} -exports.Indexed = Indexed; -// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require -const PanicReasons = { - "0": "generic panic", - "1": "assert(false)", - "17": "arithmetic overflow", - "18": "division or modulo by zero", - "33": "enum overflow", - "34": "invalid encoded storage byte array accessed", - "49": "out-of-bounds array access; popping on an empty array", - "50": "out-of-bounds access of an array or bytesN", - "65": "out of memory", - "81": "uninitialized function", -}; -const BuiltinErrors = { - "0x08c379a0": { - signature: "Error(string)", - name: "Error", - inputs: ["string"], - reason: (message) => { - return `reverted with reason string ${JSON.stringify(message)}`; - }, - }, - "0x4e487b71": { - signature: "Panic(uint256)", - name: "Panic", - inputs: ["uint256"], - reason: (code) => { - let reason = "unknown panic code"; - if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) { - reason = PanicReasons[code.toString()]; - } - return `reverted with panic code 0x${code.toString(16)} (${reason})`; - }, - }, -}; -/** - * An Interface abstracts many of the low-level details for - * encoding and decoding the data on the blockchain. - * - * An ABI provides information on how to encode data to send to - * a Contract, how to decode the results and events and how to - * interpret revert errors. - * - * The ABI can be specified by [any supported format](InterfaceAbi). - */ -class Interface { - /** - * All the Contract ABI members (i.e. methods, events, errors, etc). - */ - fragments; - /** - * The Contract constructor. - */ - deploy; - /** - * The Fallback method, if any. - */ - fallback; - /** - * If receiving xcb is supported. - */ - receive; - #errors; - #events; - #functions; - // #structs: Map; - #abiCoder; - /** - * Create a new Interface for the %%fragments%%. - */ - constructor(fragments) { - let abi = []; - if (typeof fragments === "string") { - abi = JSON.parse(fragments); - } - else { - abi = fragments; - } - this.#functions = new Map(); - this.#errors = new Map(); - this.#events = new Map(); - // this.#structs = new Map(); - const frags = []; - for (const a of abi) { - try { - frags.push(fragments_js_1.Fragment.from(a)); - } - catch (error) { - console.log("EE", error); - } - } - (0, index_js_2.defineProperties)(this, { - fragments: Object.freeze(frags), - }); - let fallback = null; - let receive = false; - this.#abiCoder = this.getAbiCoder(); - // Add all fragments by their signature - this.fragments.forEach((fragment, index) => { - let bucket; - switch (fragment.type) { - case "constructor": - if (this.deploy) { - console.log("duplicate definition - constructor"); - return; - } - //checkNames(fragment, "input", fragment.inputs); - (0, index_js_2.defineProperties)(this, { - deploy: fragment, - }); - return; - case "fallback": - if (fragment.inputs.length === 0) { - receive = true; - } - else { - (0, index_js_2.assertArgument)(!fallback || - fragment.payable !== fallback.payable, "conflicting fallback fragments", `fragments[${index}]`, fragment); - fallback = fragment; - receive = fallback.payable; - } - return; - case "function": - //checkNames(fragment, "input", fragment.inputs); - //checkNames(fragment, "output", (fragment).outputs); - bucket = this.#functions; - break; - case "event": - //checkNames(fragment, "input", fragment.inputs); - bucket = this.#events; - break; - case "error": - bucket = this.#errors; - break; - default: - return; - } - // Two identical entries; ignore it - const signature = fragment.format(); - if (bucket.has(signature)) { - return; - } - bucket.set(signature, fragment); - }); - // If we do not have a constructor add a default - if (!this.deploy) { - (0, index_js_2.defineProperties)(this, { - deploy: fragments_js_1.ConstructorFragment.from("constructor()"), - }); - } - (0, index_js_2.defineProperties)(this, { fallback, receive }); - } - /** - * Returns the entire Human-Readable ABI, as an array of - * signatures, optionally as %%minimal%% strings, which - * removes parameter names and unneceesary spaces. - */ - format(minimal) { - const format = minimal ? "minimal" : "full"; - const abi = this.fragments.map((f) => f.format(format)); - return abi; - } - /** - * Return the JSON-encoded ABI. This is the format Solidiy - * returns. - */ - formatJson() { - const abi = this.fragments.map((f) => f.format("json")); - // We need to re-bundle the JSON fragments a bit - return JSON.stringify(abi.map((j) => JSON.parse(j))); - } - /** - * The ABI coder that will be used to encode and decode binary - * data. - */ - getAbiCoder() { - return abi_coder_js_1.AbiCoder.defaultAbiCoder(); - } - // Find a function definition by any means necessary (unless it is ambiguous) - #getFunction(key, values, forceUnique) { - // Selector - if ((0, index_js_2.isHexString)(key)) { - const selector = key.toLowerCase(); - for (const fragment of this.#functions.values()) { - if (selector === fragment.selector) { - return fragment; - } - } - return null; - } - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of this.#functions) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - if (values) { - const lastValue = values.length > 0 ? values[values.length - 1] : null; - let valueLength = values.length; - let allowOptions = true; - if (typed_js_1.Typed.isTyped(lastValue) && lastValue.type === "overrides") { - allowOptions = false; - valueLength--; - } - // Remove all matches that don't have a compatible length. The args - // may contain an overrides, so the match may have n or n - 1 parameters - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs.length; - if (inputs !== valueLength && - (!allowOptions || inputs !== valueLength - 1)) { - matching.splice(i, 1); - } - } - // Remove all matches that don't match the Typed signature - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs; - for (let j = 0; j < values.length; j++) { - // Not a typed value - if (!typed_js_1.Typed.isTyped(values[j])) { - continue; - } - // We are past the inputs - if (j >= inputs.length) { - if (values[j].type === "overrides") { - continue; - } - matching.splice(i, 1); - break; - } - // Make sure the value type matches the input type - if (values[j].type !== inputs[j].baseType) { - matching.splice(i, 1); - break; - } - } - } - } - // We found a single matching signature with an overrides, but the - // last value is something that cannot possibly be an options - if (matching.length === 1 && - values && - values.length !== matching[0].inputs.length) { - const lastArg = values[values.length - 1]; - if (lastArg == null || - Array.isArray(lastArg) || - typeof lastArg !== "object") { - matching.splice(0, 1); - } - } - if (matching.length === 0) { - return null; - } - if (matching.length > 1 && forceUnique) { - const matchStr = matching - .map((m) => JSON.stringify(m.format())) - .join(", "); - (0, index_js_2.assertArgument)(false, `ambiguous function description (i.e. matches ${matchStr})`, "key", key); - } - return matching[0]; - } - // Normalize the signature and lookup the function - const result = this.#functions.get(fragments_js_1.FunctionFragment.from(key).format()); - if (result) { - return result; - } - return null; - } - /** - * Get the function name for %%key%%, which may be a function selector, - * function name or function signature that belongs to the ABI. - */ - getFunctionName(key) { - const fragment = this.#getFunction(key, null, false); - (0, index_js_2.assertArgument)(fragment, "no matching function", "key", key); - return fragment.name; - } - /** - * Returns true if %%key%% (a function selector, function name or - * function signature) is present in the ABI. - * - * In the case of a function name, the name may be ambiguous, so - * accessing the [[FunctionFragment]] may require refinement. - */ - hasFunction(key) { - return !!this.#getFunction(key, null, false); - } - /** - * Get the [[FunctionFragment]] for %%key%%, which may be a function - * selector, function name or function signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple functions match by name. - * - * If the %%key%% and %%values%% do not refine to a single function in - * the ABI, this will throw. - */ - getFunction(key, values) { - return this.#getFunction(key, values || null, true); - } - /** - * Iterate over all functions, calling %%callback%%, sorted by their name. - */ - forEachFunction(callback) { - const names = Array.from(this.#functions.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#functions.get(name), i); - } - } - // Find an event definition by any means necessary (unless it is ambiguous) - #getEvent(key, values, forceUnique) { - // EventTopic - if ((0, index_js_2.isHexString)(key)) { - const eventTopic = key.toLowerCase(); - for (const fragment of this.#events.values()) { - if (eventTopic === fragment.topicHash) { - return fragment; - } - } - return null; - } - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of this.#events) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - if (values) { - // Remove all matches that don't have a compatible length. - for (let i = matching.length - 1; i >= 0; i--) { - if (matching[i].inputs.length < values.length) { - matching.splice(i, 1); - } - } - // Remove all matches that don't match the Typed signature - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs; - for (let j = 0; j < values.length; j++) { - // Not a typed value - if (!typed_js_1.Typed.isTyped(values[j])) { - continue; - } - // Make sure the value type matches the input type - if (values[j].type !== inputs[j].baseType) { - matching.splice(i, 1); - break; - } - } - } - } - if (matching.length === 0) { - return null; - } - if (matching.length > 1 && forceUnique) { - const matchStr = matching - .map((m) => JSON.stringify(m.format())) - .join(", "); - (0, index_js_2.assertArgument)(false, `ambiguous event description (i.e. matches ${matchStr})`, "key", key); - } - return matching[0]; - } - // Normalize the signature and lookup the function - const result = this.#events.get(fragments_js_1.EventFragment.from(key).format()); - if (result) { - return result; - } - return null; - } - /** - * Get the event name for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - */ - getEventName(key) { - const fragment = this.#getEvent(key, null, false); - (0, index_js_2.assertArgument)(fragment, "no matching event", "key", key); - return fragment.name; - } - /** - * Returns true if %%key%% (an event topic hash, event name or - * event signature) is present in the ABI. - * - * In the case of an event name, the name may be ambiguous, so - * accessing the [[EventFragment]] may require refinement. - */ - hasEvent(key) { - return !!this.#getEvent(key, null, false); - } - /** - * Get the [[EventFragment]] for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple events match by name. - * - * If the %%key%% and %%values%% do not refine to a single event in - * the ABI, this will throw. - */ - getEvent(key, values) { - return this.#getEvent(key, values || null, true); - } - /** - * Iterate over all events, calling %%callback%%, sorted by their name. - */ - forEachEvent(callback) { - const names = Array.from(this.#events.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#events.get(name), i); - } - } - /** - * Get the [[ErrorFragment]] for %%key%%, which may be an error - * selector, error name or error signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple errors match by name. - * - * If the %%key%% and %%values%% do not refine to a single error in - * the ABI, this will throw. - */ - getError(key, values) { - if ((0, index_js_2.isHexString)(key)) { - const selector = key.toLowerCase(); - if (BuiltinErrors[selector]) { - return fragments_js_1.ErrorFragment.from(BuiltinErrors[selector].signature); - } - for (const fragment of this.#errors.values()) { - if (selector === fragment.selector) { - return fragment; - } - } - return null; - } - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of this.#errors) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - if (matching.length === 0) { - if (key === "Error") { - return fragments_js_1.ErrorFragment.from("error Error(string)"); - } - if (key === "Panic") { - return fragments_js_1.ErrorFragment.from("error Panic(uint256)"); - } - return null; - } - else if (matching.length > 1) { - const matchStr = matching - .map((m) => JSON.stringify(m.format())) - .join(", "); - (0, index_js_2.assertArgument)(false, `ambiguous error description (i.e. ${matchStr})`, "name", key); - } - return matching[0]; - } - // Normalize the signature and lookup the function - key = fragments_js_1.ErrorFragment.from(key).format(); - if (key === "Error(string)") { - return fragments_js_1.ErrorFragment.from("error Error(string)"); - } - if (key === "Panic(uint256)") { - return fragments_js_1.ErrorFragment.from("error Panic(uint256)"); - } - const result = this.#errors.get(key); - if (result) { - return result; - } - return null; - } - /** - * Iterate over all errors, calling %%callback%%, sorted by their name. - */ - forEachError(callback) { - const names = Array.from(this.#errors.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#errors.get(name), i); - } - } - // Get the 4-byte selector used by Solidity to identify a function - /* - getSelector(fragment: ErrorFragment | FunctionFragment): string { - if (typeof(fragment) === "string") { - const matches: Array = [ ]; - - try { matches.push(this.getFunction(fragment)); } catch (error) { } - try { matches.push(this.getError(fragment)); } catch (_) { } - - if (matches.length === 0) { - logger.throwArgumentError("unknown fragment", "key", fragment); - } else if (matches.length > 1) { - logger.throwArgumentError("ambiguous fragment matches function and error", "key", fragment); - } - - fragment = matches[0]; - } - - return dataSlice(id(fragment.format()), 0, 4); - } - */ - // Get the 32-byte topic hash used by Solidity to identify an event - /* - getEventTopic(fragment: EventFragment): string { - //if (typeof(fragment) === "string") { fragment = this.getEvent(eventFragment); } - return id(fragment.format()); - } - */ - _decodeParams(params, data) { - return this.#abiCoder.decode(params, data); - } - _encodeParams(params, values) { - return this.#abiCoder.encode(params, values); - } - /** - * Encodes a ``tx.data`` object for deploying the Contract with - * the %%values%% as the constructor arguments. - */ - encodeDeploy(values) { - return this._encodeParams(this.deploy.inputs, values || []); - } - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified error (see [[getError]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeErrorResult(fragment, data) { - if (typeof fragment === "string") { - const f = this.getError(fragment); - (0, index_js_2.assertArgument)(f, "unknown error", "fragment", fragment); - fragment = f; - } - (0, index_js_2.assertArgument)((0, index_js_2.dataSlice)(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, "data", data); - return this._decodeParams(fragment.inputs, (0, index_js_2.dataSlice)(data, 4)); - } - /** - * Encodes the transaction revert data for a call result that - * reverted from the the Contract with the sepcified %%error%% - * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeErrorResult(fragment, values) { - if (typeof fragment === "string") { - const f = this.getError(fragment); - (0, index_js_2.assertArgument)(f, "unknown error", "fragment", fragment); - fragment = f; - } - return (0, index_js_2.concat)([ - fragment.selector, - this._encodeParams(fragment.inputs, values || []), - ]); - } - /** - * Decodes the %%data%% from a transaction ``tx.data`` for - * the function specified (see [[getFunction]] for valid values - * for %%fragment%%). - * - * Most developers should prefer the [[parseTransaction]] method - * instead, which will automatically detect the fragment. - */ - decodeFunctionData(fragment, data) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - (0, index_js_2.assertArgument)(f, "unknown function", "fragment", fragment); - fragment = f; - } - (0, index_js_2.assertArgument)((0, index_js_2.dataSlice)(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, "data", data); - return this._decodeParams(fragment.inputs, (0, index_js_2.dataSlice)(data, 4)); - } - /** - * Encodes the ``tx.data`` for a transaction that calls the function - * specified (see [[getFunction]] for valid values for %%fragment%%) with - * the %%values%%. - */ - encodeFunctionData(fragment, values) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - (0, index_js_2.assertArgument)(f, "unknown function", "fragment", fragment); - fragment = f; - } - return (0, index_js_2.concat)([ - fragment.selector, - this._encodeParams(fragment.inputs, values || []), - ]); - } - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeFunctionResult(fragment, data) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - (0, index_js_2.assertArgument)(f, "unknown function", "fragment", fragment); - fragment = f; - } - let message = "invalid length for result data"; - const bytes = (0, index_js_2.getBytesCopy)(data); - if (bytes.length % 32 === 0) { - try { - return this.#abiCoder.decode(fragment.outputs, bytes); - } - catch (error) { - message = "could not decode result data"; - } - } - // Call returned data with no error, but the data is junk - (0, index_js_2.assert)(false, message, "BAD_DATA", { - value: (0, index_js_2.hexlify)(bytes), - info: { method: fragment.name, signature: fragment.format() }, - }); - } - makeError(_data, tx) { - const data = (0, index_js_2.getBytes)(_data, "data"); - const error = abi_coder_js_1.AbiCoder.getBuiltinCallException("call", tx, data); - // Not a built-in error; try finding a custom error - const customPrefix = "execution reverted (unknown custom error)"; - if (error.message.startsWith(customPrefix)) { - const selector = (0, index_js_2.hexlify)(data.slice(0, 4)); - const ef = this.getError(selector); - if (ef) { - try { - const args = this.#abiCoder.decode(ef.inputs, data.slice(4)); - error.revert = { - name: ef.name, - signature: ef.format(), - args, - }; - error.reason = error.revert.signature; - error.message = `execution reverted: ${error.reason}`; - } - catch (e) { - error.message = `execution reverted (coult not decode custom error)`; - } - } - } - // Add the invocation, if available - const parsed = this.parseTransaction(tx); - if (parsed) { - error.invocation = { - method: parsed.name, - signature: parsed.signature, - args: parsed.args, - }; - } - return error; - } - /** - * Encodes the result data (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values - * for %%fragment%%) with %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeFunctionResult(fragment, values) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - (0, index_js_2.assertArgument)(f, "unknown function", "fragment", fragment); - fragment = f; - } - return (0, index_js_2.hexlify)(this.#abiCoder.encode(fragment.outputs, values || [])); - } - /* - spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> { - const promises: Array> = [ ]; - const process = function(type: ParamType, value: any): any { - if (type.baseType === "array") { - return descend(type.child - } - if (type. === "address") { - } - }; - - const descend = function (inputs: Array, values: ReadonlyArray) { - if (inputs.length !== values.length) { throw new Error("length mismatch"); } - }; - - const result: Array = [ ]; - values.forEach((value, index) => { - if (value == null) { - topics.push(null); - } else if (param.baseType === "array" || param.baseType === "tuple") { - logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); - } else if (Array.isArray(value)) { - topics.push(value.map((value) => encodeTopic(param, value))); - } else { - topics.push(encodeTopic(param, value)); - } - }); - } - */ - // Create the filter for the event with search criteria (e.g. for xcb_filterLog) - encodeFilterTopics(fragment, values) { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - (0, index_js_2.assertArgument)(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - (0, index_js_2.assert)(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, "UNEXPECTED_ARGUMENT", { count: values.length, expectedCount: fragment.inputs.length }); - const topics = []; - if (!fragment.anonymous) { - topics.push(fragment.topicHash); - } - // @TODO: Use the coders for this; to properly support tuples, etc. - const encodeTopic = (param, value) => { - if (param.type === "string") { - return (0, index_js_1.id)(value); - } - else if (param.type === "bytes") { - return (0, sha3_js_1.sha256)((0, index_js_2.hexlify)(value)); - } - if (param.type === "bool" && typeof value === "boolean") { - value = value ? "0x01" : "0x00"; - } - if (param.type.match(/^u?int/)) { - value = (0, index_js_2.toBeHex)(value); - } - // Check addresses are valid - if (param.type === "address") { - this.#abiCoder.encode(["address"], [value]); - } - return (0, index_js_2.zeroPadValue)((0, index_js_2.hexlify)(value), 32); - //@TOOD should probably be return toHex(value, 32) - }; - values.forEach((value, index) => { - const param = fragment.inputs[index]; - if (!param.indexed) { - (0, index_js_2.assertArgument)(value == null, "cannot filter non-indexed parameters; must be null", "contract." + param.name, value); - return; - } - if (value == null) { - topics.push(null); - } - else if (param.baseType === "array" || param.baseType === "tuple") { - (0, index_js_2.assertArgument)(false, "filtering with tuples or arrays not supported", "contract." + param.name, value); - } - else if (Array.isArray(value)) { - topics.push(value.map((value) => encodeTopic(param, value))); - } - else { - topics.push(encodeTopic(param, value)); - } - }); - // Trim off trailing nulls - while (topics.length && topics[topics.length - 1] === null) { - topics.pop(); - } - return topics; - } - encodeEventLog(fragment, values) { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - (0, index_js_2.assertArgument)(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - const topics = []; - const dataTypes = []; - const dataValues = []; - if (!fragment.anonymous) { - topics.push(fragment.topicHash); - } - (0, index_js_2.assertArgument)(values.length === fragment.inputs.length, "event arguments/values mismatch", "values", values); - fragment.inputs.forEach((param, index) => { - const value = values[index]; - if (param.indexed) { - if (param.type === "string") { - topics.push((0, index_js_1.id)(value)); - } - else if (param.type === "bytes") { - topics.push((0, sha3_js_1.sha256)(value)); - } - else if (param.baseType === "tuple" || param.baseType === "array") { - // @TODO - throw new Error("not implemented"); - } - else { - topics.push(this.#abiCoder.encode([param.type], [value])); - } - } - else { - dataTypes.push(param); - dataValues.push(value); - } - }); - return { - data: this.#abiCoder.encode(dataTypes, dataValues), - topics: topics, - }; - } - // Decode a filter for the event and the search criteria - decodeEventLog(fragment, data, topics) { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - (0, index_js_2.assertArgument)(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - if (topics != null && !fragment.anonymous) { - const eventTopic = fragment.topicHash; - (0, index_js_2.assertArgument)((0, index_js_2.isHexString)(topics[0], 32) && topics[0].toLowerCase() === eventTopic, "fragment/topic mismatch", "topics[0]", topics[0]); - topics = topics.slice(1); - } - const indexed = []; - const nonIndexed = []; - const dynamic = []; - fragment.inputs.forEach((param, index) => { - if (param.indexed) { - if (param.type === "string" || - param.type === "bytes" || - param.baseType === "tuple" || - param.baseType === "array") { - indexed.push(fragments_js_1.ParamType.from({ type: "bytes32", name: param.name })); - dynamic.push(true); - } - else { - indexed.push(param); - dynamic.push(false); - } - } - else { - nonIndexed.push(param); - dynamic.push(false); - } - }); - const resultIndexed = topics != null ? this.#abiCoder.decode(indexed, (0, index_js_2.concat)(topics)) : null; - const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true); - //const result: (Array & { [ key: string ]: any }) = [ ]; - const values = []; - const keys = []; - let nonIndexedIndex = 0, indexedIndex = 0; - fragment.inputs.forEach((param, index) => { - let value = null; - if (param.indexed) { - if (resultIndexed == null) { - value = new Indexed(null); - } - else if (dynamic[index]) { - value = new Indexed(resultIndexed[indexedIndex++]); - } - else { - try { - value = resultIndexed[indexedIndex++]; - } - catch (error) { - value = error; - } - } - } - else { - try { - value = resultNonIndexed[nonIndexedIndex++]; - } - catch (error) { - value = error; - } - } - values.push(value); - keys.push(param.name || null); - }); - return abstract_coder_js_1.Result.fromItems(values, keys); - } - /** - * Parses a transaction, finding the matching function and extracts - * the parameter values along with other useful function details. - * - * If the matching function cannot be found, return null. - */ - parseTransaction(tx) { - const data = (0, index_js_2.getBytes)(tx.data, "tx.data"); - const value = (0, index_js_2.getBigInt)(tx.value != null ? tx.value : 0, "tx.value"); - const fragment = this.getFunction((0, index_js_2.hexlify)(data.slice(0, 4))); - if (!fragment) { - return null; - } - const args = this.#abiCoder.decode(fragment.inputs, data.slice(4)); - return new TransactionDescription(fragment, fragment.selector, args, value); - } - parseCallResult(data) { - throw new Error("@TODO"); - } - /** - * Parses a receipt log, finding the matching event and extracts - * the parameter values along with other useful event details. - * - * If the matching event cannot be found, returns null. - */ - parseLog(log) { - const fragment = this.getEvent(log.topics[0]); - if (!fragment || fragment.anonymous) { - return null; - } - // @TODO: If anonymous, and the only method, and the input count matches, should we parse? - // Probably not, because just because it is the only event in the ABI does - // not mean we have the full ABI; maybe just a fragment? - return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics)); - } - /** - * Parses a revert data, finding the matching error and extracts - * the parameter values along with other useful error details. - * - * If the matching event cannot be found, returns null. - */ - parseError(data) { - const hexData = (0, index_js_2.hexlify)(data); - const fragment = this.getError((0, index_js_2.dataSlice)(hexData, 0, 4)); - if (!fragment) { - return null; - } - const args = this.#abiCoder.decode(fragment.inputs, (0, index_js_2.dataSlice)(hexData, 4)); - return new ErrorDescription(fragment, fragment.selector, args); - } - /** - * Creates a new [[Interface]] from the ABI %%value%%. - * - * The %%value%% may be provided as an existing [[Interface]] object, - * a JSON-encoded ABI or any Human-Readable ABI format. - */ - static from(value) { - // Already an Interface, which is immutable - if (value instanceof Interface) { - return value; - } - // JSON - if (typeof value === "string") { - return new Interface(JSON.parse(value)); - } - // Maybe an interface from an older version, or from a symlinked copy - if (typeof value.format === "function") { - return new Interface(value.format("json")); - } - // Array of fragments - return new Interface(value); - } -} -exports.Interface = Interface; -//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/interface.js.map b/lib.commonjs/abi/interface.js.map deleted file mode 100644 index ec5282318..000000000 --- a/lib.commonjs/abi/interface.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src.ts/abi/interface.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,+CAAsC;AACtC,gDAa2B;AAE3B,iDAA0C;AAC1C,kEAAuE;AAsB9D,kGAtBA,qCAAiB,OAsBA;AAAE,uFAtBA,0BAAM,OAsBA;AArBlC,iDAQwB;AACxB,yCAAmC;AAUnC,+CAA2C;AAI3C,MAAa,cAAc;IAChB,QAAQ,CAAiB;IACzB,IAAI,CAAU;IACd,SAAS,CAAU;IACnB,KAAK,CAAU;IACf,IAAI,CAAU;IAEvB,YAAY,QAAuB,EAAE,KAAa,EAAE,IAAY;QAC9D,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EACxB,SAAS,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QAChC,IAAA,2BAAgB,EAAiB,IAAI,EAAE;YACrC,QAAQ;YACR,IAAI;YACJ,SAAS;YACT,KAAK;YACL,IAAI;SACL,CAAC,CAAC;IACL,CAAC;CACF;AAlBD,wCAkBC;AAED,MAAa,sBAAsB;IACxB,QAAQ,CAAoB;IAC5B,IAAI,CAAU;IACd,IAAI,CAAU;IACd,SAAS,CAAU;IACnB,QAAQ,CAAU;IAClB,KAAK,CAAU;IAExB,YACE,QAA0B,EAC1B,QAAgB,EAChB,IAAY,EACZ,KAAa;QAEb,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EACxB,SAAS,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QAChC,IAAA,2BAAgB,EAAyB,IAAI,EAAE;YAC7C,QAAQ;YACR,IAAI;YACJ,IAAI;YACJ,SAAS;YACT,QAAQ;YACR,KAAK;SACN,CAAC,CAAC;IACL,CAAC;CACF;AAzBD,wDAyBC;AAED,MAAa,gBAAgB;IAClB,QAAQ,CAAiB;IACzB,IAAI,CAAU;IACd,IAAI,CAAU;IACd,SAAS,CAAU;IACnB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G,IAAI,CAAC,QAAQ,CAAC,IAAA,oBAAS,EAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAEzD,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO,IAAI,CAAC;SACb;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAA,oBAAS,EAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3E,OAAO,IAAI,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,KAA+B;QACzC,2CAA2C;QAC3C,IAAI,KAAK,YAAY,SAAS,EAAE;YAC9B,OAAO,KAAK,CAAC;SACd;QAED,OAAO;QACP,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;SACzC;QAED,qEAAqE;QACrE,IAAI,OAAa,KAAM,CAAC,MAAM,KAAK,UAAU,EAAE;YAC7C,OAAO,IAAI,SAAS,CAAO,KAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;SACnD;QAED,qBAAqB;QACrB,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CACF;AAtnCD,8BAsnCC"} \ No newline at end of file diff --git a/lib.commonjs/abi/typed.d.ts b/lib.commonjs/abi/typed.d.ts deleted file mode 100644 index 3dce9d6a9..000000000 --- a/lib.commonjs/abi/typed.d.ts +++ /dev/null @@ -1,172 +0,0 @@ -/** - * A Typed object allows a value to have its type explicitly - * specified. - * - * For example, in Solidity, the value ``45`` could represent a - * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent - * a ``bytes2`` or ``bytes``. - * - * Since JavaScript has no meaningful way to explicitly inform any - * APIs which what the type is, this allows transparent interoperation - * with Soldity. - * - * @_subsection: api/abi:Typed Values - */ -import type { Addressable } from "../address/index.js"; -import type { BigNumberish, BytesLike } from "../utils/index.js"; -import type { Result } from "./coders/abstract-coder.js"; -export interface TypedNumber extends Typed { - value: number; - defaultValue(): number; - minValue(): number; - maxValue(): number; -} -export interface TypedBigInt extends Typed { - value: bigint; - defaultValue(): bigint; - minValue(): bigint; - maxValue(): bigint; -} -export interface TypedData extends Typed { - value: string; - defaultValue(): string; -} -export interface TypedString extends Typed { - value: string; - defaultValue(): string; -} -export declare class Typed { - #private; - readonly type: string; - readonly value: any; - readonly _typedSymbol: Symbol; - constructor(gaurd: any, type: string, value: any, options?: any); - format(): string; - defaultValue(): string | number | bigint | Result; - minValue(): string | number | bigint; - maxValue(): string | number | bigint; - isBigInt(): this is TypedBigInt; - isData(): this is TypedData; - isString(): this is TypedString; - get tupleName(): null | string; - get arrayLength(): null | number; - static from(type: string, value: any): Typed; - static uint8(v: BigNumberish): Typed; - static uint16(v: BigNumberish): Typed; - static uint24(v: BigNumberish): Typed; - static uint32(v: BigNumberish): Typed; - static uint40(v: BigNumberish): Typed; - static uint48(v: BigNumberish): Typed; - static uint56(v: BigNumberish): Typed; - static uint64(v: BigNumberish): Typed; - static uint72(v: BigNumberish): Typed; - static uint80(v: BigNumberish): Typed; - static uint88(v: BigNumberish): Typed; - static uint96(v: BigNumberish): Typed; - static uint104(v: BigNumberish): Typed; - static uint112(v: BigNumberish): Typed; - static uint120(v: BigNumberish): Typed; - static uint128(v: BigNumberish): Typed; - static uint136(v: BigNumberish): Typed; - static uint144(v: BigNumberish): Typed; - static uint152(v: BigNumberish): Typed; - static uint160(v: BigNumberish): Typed; - static uint168(v: BigNumberish): Typed; - static uint176(v: BigNumberish): Typed; - static uint184(v: BigNumberish): Typed; - static uint192(v: BigNumberish): Typed; - static uint200(v: BigNumberish): Typed; - static uint208(v: BigNumberish): Typed; - static uint216(v: BigNumberish): Typed; - static uint224(v: BigNumberish): Typed; - static uint232(v: BigNumberish): Typed; - static uint240(v: BigNumberish): Typed; - static uint248(v: BigNumberish): Typed; - static uint256(v: BigNumberish): Typed; - static uint(v: BigNumberish): Typed; - static int8(v: BigNumberish): Typed; - static int16(v: BigNumberish): Typed; - static int24(v: BigNumberish): Typed; - static int32(v: BigNumberish): Typed; - static int40(v: BigNumberish): Typed; - static int48(v: BigNumberish): Typed; - static int56(v: BigNumberish): Typed; - static int64(v: BigNumberish): Typed; - static int72(v: BigNumberish): Typed; - static int80(v: BigNumberish): Typed; - static int88(v: BigNumberish): Typed; - static int96(v: BigNumberish): Typed; - static int104(v: BigNumberish): Typed; - static int112(v: BigNumberish): Typed; - static int120(v: BigNumberish): Typed; - static int128(v: BigNumberish): Typed; - static int136(v: BigNumberish): Typed; - static int144(v: BigNumberish): Typed; - static int152(v: BigNumberish): Typed; - static int160(v: BigNumberish): Typed; - static int168(v: BigNumberish): Typed; - static int176(v: BigNumberish): Typed; - static int184(v: BigNumberish): Typed; - static int192(v: BigNumberish): Typed; - static int200(v: BigNumberish): Typed; - static int208(v: BigNumberish): Typed; - static int216(v: BigNumberish): Typed; - static int224(v: BigNumberish): Typed; - static int232(v: BigNumberish): Typed; - static int240(v: BigNumberish): Typed; - static int248(v: BigNumberish): Typed; - static int256(v: BigNumberish): Typed; - static int(v: BigNumberish): Typed; - static bytes1(v: BytesLike): Typed; - static bytes2(v: BytesLike): Typed; - static bytes3(v: BytesLike): Typed; - static bytes4(v: BytesLike): Typed; - static bytes5(v: BytesLike): Typed; - static bytes6(v: BytesLike): Typed; - static bytes7(v: BytesLike): Typed; - static bytes8(v: BytesLike): Typed; - static bytes9(v: BytesLike): Typed; - static bytes10(v: BytesLike): Typed; - static bytes11(v: BytesLike): Typed; - static bytes12(v: BytesLike): Typed; - static bytes13(v: BytesLike): Typed; - static bytes14(v: BytesLike): Typed; - static bytes15(v: BytesLike): Typed; - static bytes16(v: BytesLike): Typed; - static bytes17(v: BytesLike): Typed; - static bytes18(v: BytesLike): Typed; - static bytes19(v: BytesLike): Typed; - static bytes20(v: BytesLike): Typed; - static bytes21(v: BytesLike): Typed; - static bytes22(v: BytesLike): Typed; - static bytes23(v: BytesLike): Typed; - static bytes24(v: BytesLike): Typed; - static bytes25(v: BytesLike): Typed; - static bytes26(v: BytesLike): Typed; - static bytes27(v: BytesLike): Typed; - static bytes28(v: BytesLike): Typed; - static bytes29(v: BytesLike): Typed; - static bytes30(v: BytesLike): Typed; - static bytes31(v: BytesLike): Typed; - static bytes32(v: BytesLike): Typed; - static address(v: string | Addressable): Typed; - static bool(v: any): Typed; - static bytes(v: BytesLike): Typed; - static string(v: string): Typed; - static array(v: Array, dynamic?: null | boolean): Typed; - static tuple(v: Array | Record, name?: string): Typed; - static overrides(v: Record): Typed; - /** - * Returns true only if %%value%% is a [[Typed]] instance. - */ - static isTyped(value: any): value is Typed; - /** - * If the value is a [[Typed]] instance, validates the underlying value - * and returns it, otherwise returns value directly. - * - * This is useful for functions that with to accept either a [[Typed]] - * object or values. - */ - static dereference(value: Typed | T, type: string): T; -} -//# sourceMappingURL=typed.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/abi/typed.d.ts.map b/lib.commonjs/abi/typed.d.ts.map deleted file mode 100644 index 552156f75..000000000 --- a/lib.commonjs/abi/typed.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"typed.d.ts","sourceRoot":"","sources":["../../src.ts/abi/typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAuBzD,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,IAAI,MAAM,CAAC;IACvB,QAAQ,IAAI,MAA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AC,EAAE,MAAM,GAAG,KAAK;IAI/B,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,IAAI,GAAG,OAAO,GAAG,KAAK;IAKpE,MAAM,CAAC,KAAK,CACV,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,KAAK,CAAC,EACnD,IAAI,CAAC,EAAE,MAAM,GACZ,KAAK;IAKR,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK;IAI/C;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,KAAK;IAI1C;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;CASzD"} \ No newline at end of file diff --git a/lib.commonjs/abi/typed.js b/lib.commonjs/abi/typed.js deleted file mode 100644 index b9cc6915a..000000000 --- a/lib.commonjs/abi/typed.js +++ /dev/null @@ -1,448 +0,0 @@ -"use strict"; -/** - * A Typed object allows a value to have its type explicitly - * specified. - * - * For example, in Solidity, the value ``45`` could represent a - * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent - * a ``bytes2`` or ``bytes``. - * - * Since JavaScript has no meaningful way to explicitly inform any - * APIs which what the type is, this allows transparent interoperation - * with Soldity. - * - * @_subsection: api/abi:Typed Values - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Typed = void 0; -const index_js_1 = require("../utils/index.js"); -const _gaurd = {}; -function n(value, width) { - let signed = false; - if (width < 0) { - signed = true; - width *= -1; - } - // @TODO: Check range is valid for value - return new Typed(_gaurd, `${signed ? "" : "u"}int${width}`, value, { - signed, - width, - }); -} -function b(value, size) { - // @TODO: Check range is valid for value - return new Typed(_gaurd, `bytes${size ? size : ""}`, value, { size }); -} -const _typedSymbol = Symbol.for("_corebc_typed"); -class Typed { - type; - value; - #options; - _typedSymbol; - constructor(gaurd, type, value, options) { - if (options == null) { - options = null; - } - (0, index_js_1.assertPrivate)(_gaurd, gaurd, "Typed"); - (0, index_js_1.defineProperties)(this, { _typedSymbol, type, value }); - this.#options = options; - // Check the value is valid - this.format(); - } - format() { - if (this.type === "array") { - throw new Error(""); - } - else if (this.type === "dynamicArray") { - throw new Error(""); - } - else if (this.type === "tuple") { - return `tuple(${this.value.map((v) => v.format()).join(",")})`; - } - return this.type; - } - defaultValue() { - return 0; - } - minValue() { - return 0; - } - maxValue() { - return 0; - } - isBigInt() { - return !!this.type.match(/^u?int[0-9]+$/); - } - isData() { - return this.type.startsWith("bytes"); - } - isString() { - return this.type === "string"; - } - get tupleName() { - if (this.type !== "tuple") { - throw TypeError("not a tuple"); - } - return this.#options; - } - // Returns the length of this type as an array - // - `null` indicates the length is unforced, it could be dynamic - // - `-1` indicates the length is dynamic - // - any other value indicates it is a static array and is its length - get arrayLength() { - if (this.type !== "array") { - throw TypeError("not an array"); - } - if (this.#options === true) { - return -1; - } - if (this.#options === false) { - return this.value.length; - } - return null; - } - static from(type, value) { - return new Typed(_gaurd, type, value); - } - static uint8(v) { - return n(v, 8); - } - static uint16(v) { - return n(v, 16); - } - static uint24(v) { - return n(v, 24); - } - static uint32(v) { - return n(v, 32); - } - static uint40(v) { - return n(v, 40); - } - static uint48(v) { - return n(v, 48); - } - static uint56(v) { - return n(v, 56); - } - static uint64(v) { - return n(v, 64); - } - static uint72(v) { - return n(v, 72); - } - static uint80(v) { - return n(v, 80); - } - static uint88(v) { - return n(v, 88); - } - static uint96(v) { - return n(v, 96); - } - static uint104(v) { - return n(v, 104); - } - static uint112(v) { - return n(v, 112); - } - static uint120(v) { - return n(v, 120); - } - static uint128(v) { - return n(v, 128); - } - static uint136(v) { - return n(v, 136); - } - static uint144(v) { - return n(v, 144); - } - static uint152(v) { - return n(v, 152); - } - static uint160(v) { - return n(v, 160); - } - static uint168(v) { - return n(v, 168); - } - static uint176(v) { - return n(v, 176); - } - static uint184(v) { - return n(v, 184); - } - static uint192(v) { - return n(v, 192); - } - static uint200(v) { - return n(v, 200); - } - static uint208(v) { - return n(v, 208); - } - static uint216(v) { - return n(v, 216); - } - static uint224(v) { - return n(v, 224); - } - static uint232(v) { - return n(v, 232); - } - static uint240(v) { - return n(v, 240); - } - static uint248(v) { - return n(v, 248); - } - static uint256(v) { - return n(v, 256); - } - static uint(v) { - return n(v, 256); - } - static int8(v) { - return n(v, -8); - } - static int16(v) { - return n(v, -16); - } - static int24(v) { - return n(v, -24); - } - static int32(v) { - return n(v, -32); - } - static int40(v) { - return n(v, -40); - } - static int48(v) { - return n(v, -48); - } - static int56(v) { - return n(v, -56); - } - static int64(v) { - return n(v, -64); - } - static int72(v) { - return n(v, -72); - } - static int80(v) { - return n(v, -80); - } - static int88(v) { - return n(v, -88); - } - static int96(v) { - return n(v, -96); - } - static int104(v) { - return n(v, -104); - } - static int112(v) { - return n(v, -112); - } - static int120(v) { - return n(v, -120); - } - static int128(v) { - return n(v, -128); - } - static int136(v) { - return n(v, -136); - } - static int144(v) { - return n(v, -144); - } - static int152(v) { - return n(v, -152); - } - static int160(v) { - return n(v, -160); - } - static int168(v) { - return n(v, -168); - } - static int176(v) { - return n(v, -176); - } - static int184(v) { - return n(v, -184); - } - static int192(v) { - return n(v, -192); - } - static int200(v) { - return n(v, -200); - } - static int208(v) { - return n(v, -208); - } - static int216(v) { - return n(v, -216); - } - static int224(v) { - return n(v, -224); - } - static int232(v) { - return n(v, -232); - } - static int240(v) { - return n(v, -240); - } - static int248(v) { - return n(v, -248); - } - static int256(v) { - return n(v, -256); - } - static int(v) { - return n(v, -256); - } - static bytes1(v) { - return b(v, 1); - } - static bytes2(v) { - return b(v, 2); - } - static bytes3(v) { - return b(v, 3); - } - static bytes4(v) { - return b(v, 4); - } - static bytes5(v) { - return b(v, 5); - } - static bytes6(v) { - return b(v, 6); - } - static bytes7(v) { - return b(v, 7); - } - static bytes8(v) { - return b(v, 8); - } - static bytes9(v) { - return b(v, 9); - } - static bytes10(v) { - return b(v, 10); - } - static bytes11(v) { - return b(v, 11); - } - static bytes12(v) { - return b(v, 12); - } - static bytes13(v) { - return b(v, 13); - } - static bytes14(v) { - return b(v, 14); - } - static bytes15(v) { - return b(v, 15); - } - static bytes16(v) { - return b(v, 16); - } - static bytes17(v) { - return b(v, 17); - } - static bytes18(v) { - return b(v, 18); - } - static bytes19(v) { - return b(v, 19); - } - static bytes20(v) { - return b(v, 20); - } - static bytes21(v) { - return b(v, 21); - } - static bytes22(v) { - return b(v, 22); - } - static bytes23(v) { - return b(v, 23); - } - static bytes24(v) { - return b(v, 24); - } - static bytes25(v) { - return b(v, 25); - } - static bytes26(v) { - return b(v, 26); - } - static bytes27(v) { - return b(v, 27); - } - static bytes28(v) { - return b(v, 28); - } - static bytes29(v) { - return b(v, 29); - } - static bytes30(v) { - return b(v, 30); - } - static bytes31(v) { - return b(v, 31); - } - static bytes32(v) { - return b(v, 32); - } - static address(v) { - return new Typed(_gaurd, "address", v); - } - static bool(v) { - return new Typed(_gaurd, "bool", !!v); - } - static bytes(v) { - return new Typed(_gaurd, "bytes", v); - } - static string(v) { - return new Typed(_gaurd, "string", v); - } - static array(v, dynamic) { - throw new Error("not implemented yet"); - return new Typed(_gaurd, "array", v, dynamic); - } - static tuple(v, name) { - throw new Error("not implemented yet"); - return new Typed(_gaurd, "tuple", v, name); - } - static overrides(v) { - return new Typed(_gaurd, "overrides", Object.assign({}, v)); - } - /** - * Returns true only if %%value%% is a [[Typed]] instance. - */ - static isTyped(value) { - return value && value._typedSymbol === _typedSymbol; - } - /** - * If the value is a [[Typed]] instance, validates the underlying value - * and returns it, otherwise returns value directly. - * - * This is useful for functions that with to accept either a [[Typed]] - * object or values. - */ - static dereference(value, type) { - if (Typed.isTyped(value)) { - if (value.type !== type) { - throw new Error(`invalid type: expecetd ${type}, got ${value.type}`); - } - return value.value; - } - return value; - } -} -exports.Typed = Typed; -//# sourceMappingURL=typed.js.map \ No newline at end of file diff --git a/lib.commonjs/abi/typed.js.map b/lib.commonjs/abi/typed.js.map deleted file mode 100644 index dd6463d51..000000000 --- a/lib.commonjs/abi/typed.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"typed.js","sourceRoot":"","sources":["../../src.ts/abi/typed.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAEH,gDAAoE;AAOpE,MAAM,MAAM,GAAG,EAAE,CAAC;AAElB,SAAS,CAAC,CAAC,KAAmB,EAAE,KAAa;IAC3C,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,KAAK,GAAG,CAAC,EAAE;QACb,MAAM,GAAG,IAAI,CAAC;QACd,KAAK,IAAI,CAAC,CAAC,CAAC;KACb;IAED,wCAAwC;IACxC,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,EAAE,EAAE,KAAK,EAAE;QACjE,MAAM;QACN,KAAK;KACN,CAAC,CAAC;AACL,CAAC;AAED,SAAS,CAAC,CAAC,KAAgB,EAAE,IAAa;IACxC,wCAAwC;IACxC,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE,QAAQ,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AACxE,CAAC;AA0BD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAEjD,MAAa,KAAK;IACP,IAAI,CAAU;IACd,KAAK,CAAO;IAEZ,QAAQ,CAAM;IAEd,YAAY,CAAU;IAE/B,YAAY,KAAU,EAAE,IAAY,EAAE,KAAU,EAAE,OAAa;QAC7D,IAAI,OAAO,IAAI,IAAI,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;AAlbD,sBAkbC"} \ No newline at end of file diff --git a/lib.commonjs/address/checks.d.ts b/lib.commonjs/address/checks.d.ts deleted file mode 100644 index 865b0aca9..000000000 --- a/lib.commonjs/address/checks.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { Addressable, AddressLike } from "./index.js"; -/** - * Returns true if %%value%% is an object which implements the - * [[Addressable]] interface. - * - * @example: - * // Wallets and AbstractSigner sub-classes - * isAddressable(Wallet.createRandom()) - * //_result: - * - * // Contracts - * contract = new Contract("dai.tokens.corebc.eth", [ ], provider) - * isAddressable(contract) - * //_result: - */ -export declare function isAddressable(value: any): value is Addressable; -/** - * Returns true if %%value%% is a valid address. - * - * @example: - * // Valid address - * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") - * //_result: - * - * // Valid ICAP address - * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") - * //_result: - * - * // Invalid checksum - * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") - * //_result: - * - * // Invalid ICAP checksum - * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") - * //_result: - * - * // Not an address (an ENS name requires a provided and an - * // asynchronous API to access) - * isAddress("ricmoo.eth") - * //_result: - */ -export declare function isAddress(value: any): value is string; -/** - * Resolves to an address for the %%target%%, which may be any - * supported address type, an [[Addressable]] or a Promise which - * resolves to an address. - * - * If an ENS name is provided, but that name has not been correctly - * configured a [[UnconfiguredNameError]] is thrown. - * - * @example: - * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" - * - * // Addresses are return synchronously - * resolveAddress(addr, provider) - * //_result: - * - * // Address promises are resolved asynchronously - * resolveAddress(Promise.resolve(addr)) - * //_result: - * - * - * // Addressable objects are resolved asynchronously - * contract = new Contract(addr, [ ]) - * resolveAddress(contract, provider) - * //_result: - * - * // Unconfigured ENS names reject - * resolveAddress("nothing-here.ricmoo.eth", provider) - * //_error: - * - * // ENS names require a NameResolver object passed in - * // (notice the provider was omitted) - * resolveAddress("nothing-here.ricmoo.eth") - * //_error: - */ -export declare function resolveAddress(target: AddressLike): string | Promise; -//# sourceMappingURL=checks.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/address/checks.d.ts.map b/lib.commonjs/address/checks.d.ts.map deleted file mode 100644 index 936fbc09c..000000000 --- a/lib.commonjs/address/checks.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src.ts/address/checks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAc,MAAM,YAAY,CAAC;AAElE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,WAAW,CAE9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAMrD;AA2BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAe5E"} \ No newline at end of file diff --git a/lib.commonjs/address/checks.js b/lib.commonjs/address/checks.js deleted file mode 100644 index 135695157..000000000 --- a/lib.commonjs/address/checks.js +++ /dev/null @@ -1,117 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.resolveAddress = exports.isAddress = exports.isAddressable = void 0; -const index_js_1 = require("../utils/index.js"); -const index_js_2 = require("./index.js"); -/** - * Returns true if %%value%% is an object which implements the - * [[Addressable]] interface. - * - * @example: - * // Wallets and AbstractSigner sub-classes - * isAddressable(Wallet.createRandom()) - * //_result: - * - * // Contracts - * contract = new Contract("dai.tokens.corebc.eth", [ ], provider) - * isAddressable(contract) - * //_result: - */ -function isAddressable(value) { - return value && typeof value.getAddress === "function"; -} -exports.isAddressable = isAddressable; -/** - * Returns true if %%value%% is a valid address. - * - * @example: - * // Valid address - * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") - * //_result: - * - * // Valid ICAP address - * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") - * //_result: - * - * // Invalid checksum - * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") - * //_result: - * - * // Invalid ICAP checksum - * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") - * //_result: - * - * // Not an address (an ENS name requires a provided and an - * // asynchronous API to access) - * isAddress("ricmoo.eth") - * //_result: - */ -function isAddress(value) { - try { - (0, index_js_2.getAddress)(value); - return true; - } - catch (error) { } - return false; -} -exports.isAddress = isAddress; -async function checkAddress(target, promise) { - const result = await promise; - if (result == null || - result === "0x0000000000000000000000000000000000000000") { - (0, index_js_1.assert)(typeof target !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target }); - (0, index_js_1.assertArgument)(false, "invalid AddressLike value; did not resolve to a value address", "target", target); - } - return (0, index_js_2.getAddress)(result); -} -/** - * Resolves to an address for the %%target%%, which may be any - * supported address type, an [[Addressable]] or a Promise which - * resolves to an address. - * - * If an ENS name is provided, but that name has not been correctly - * configured a [[UnconfiguredNameError]] is thrown. - * - * @example: - * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" - * - * // Addresses are return synchronously - * resolveAddress(addr, provider) - * //_result: - * - * // Address promises are resolved asynchronously - * resolveAddress(Promise.resolve(addr)) - * //_result: - * - * - * // Addressable objects are resolved asynchronously - * contract = new Contract(addr, [ ]) - * resolveAddress(contract, provider) - * //_result: - * - * // Unconfigured ENS names reject - * resolveAddress("nothing-here.ricmoo.eth", provider) - * //_error: - * - * // ENS names require a NameResolver object passed in - * // (notice the provider was omitted) - * resolveAddress("nothing-here.ricmoo.eth") - * //_error: - */ -function resolveAddress(target) { - if (typeof target === "string") { - return (0, index_js_2.getAddress)(target); - // assert(resolver != null, "ENS resolution requires a provider", - // "UNSUPPORTED_OPERATION", { operation: "resolveName" }); - // return checkAddress(target, resolver.resolveName(target)); - } - else if (isAddressable(target)) { - return checkAddress(target, target.getAddress()); - } - else if (target && typeof target.then === "function") { - return checkAddress(target, target); - } - (0, index_js_1.assertArgument)(false, "unsupported addressable value", "target", target); -} -exports.resolveAddress = resolveAddress; -//# sourceMappingURL=checks.js.map \ No newline at end of file diff --git a/lib.commonjs/address/checks.js.map b/lib.commonjs/address/checks.js.map deleted file mode 100644 index 149c9fe76..000000000 --- a/lib.commonjs/address/checks.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../src.ts/address/checks.ts"],"names":[],"mappings":";;;AAAA,gDAA2D;AAE3D,yCAAkE;AAElE;;;;;;;;;;;;;GAaG;AACH,SAAgB,aAAa,CAAC,KAAU;IACtC,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,UAAU,KAAK,UAAU,CAAC;AACzD,CAAC;AAFD,sCAEC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,SAAS,CAAC,KAAU;IAClC,IAAI;QACF,IAAA,qBAAU,EAAC,KAAK,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,KAAK,EAAE,GAAE;IAClB,OAAO,KAAK,CAAC;AACf,CAAC;AAND,8BAMC;AAED,KAAK,UAAU,YAAY,CACzB,MAAW,EACX,OAA+B;IAE/B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC;IAC7B,IACE,MAAM,IAAI,IAAI;QACd,MAAM,KAAK,4CAA4C,EACvD;QACA,IAAA,iBAAM,EACJ,OAAO,MAAM,KAAK,QAAQ,EAC1B,mBAAmB,EACnB,mBAAmB,EACnB,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CAAC;QACF,IAAA,yBAAc,EACZ,KAAK,EACL,+DAA+D,EAC/D,QAAQ,EACR,MAAM,CACP,CAAC;KACH;IACD,OAAO,IAAA,qBAAU,EAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,SAAgB,cAAc,CAAC,MAAmB;IAChD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,OAAO,IAAA,qBAAU,EAAC,MAAM,CAAC,CAAC;QAE1B,iEAAiE;QACjE,8DAA8D;QAE9D,6DAA6D;KAC9D;SAAM,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;QAChC,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;KAClD;SAAM,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE;QACtD,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACrC;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,+BAA+B,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC3E,CAAC;AAfD,wCAeC"} \ No newline at end of file diff --git a/lib.commonjs/address/contract-address.d.ts b/lib.commonjs/address/contract-address.d.ts deleted file mode 100644 index 5aaa076ad..000000000 --- a/lib.commonjs/address/contract-address.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { BigNumberish, BytesLike } from "../utils/index.js"; -/** - * Returns the address that would result from a ``CREATE`` for %%tx%%. - * - * This can be used to compute the address a contract will be - * deployed to by an EOA when sending a deployment transaction (i.e. - * when the ``to`` address is ``null``). - * - * This can also be used to compute the address a contract will be - * deployed to by a contract, by using the contract's address as the - * ``to`` and the contract's nonce. - * - * @example - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; - * nonce = 5; - * - * getCreateAddress({ from, nonce }); - * //_result: - */ -export declare function getCreateAddress(tx: { - from: string; - nonce: BigNumberish; -}): string; -/** - * Returns the address that would result from a ``CREATE2`` operation - * with the given %%from%%, %%salt%% and %%initCodeHash%%. - - * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. - * - * @example - * // The address of the contract - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" - * - * // The salt - * salt = id("HelloWorld") - * - * getCreate2Address(from, salt, initCodeHash) - * //_result: - */ -export declare function getCreate2Address(from: string, salt: BytesLike, initCodeHash: BytesLike): string; -//# sourceMappingURL=contract-address.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/address/contract-address.d.ts.map b/lib.commonjs/address/contract-address.d.ts.map deleted file mode 100644 index 8511ac269..000000000 --- a/lib.commonjs/address/contract-address.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contract-address.d.ts","sourceRoot":"","sources":["../../src.ts/address/contract-address.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAQjE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,YAAY,CAAC;CACrB,GAAG,MAAM,CAcT;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,SAAS,GACtB,MAAM,CAoBR"} \ No newline at end of file diff --git a/lib.commonjs/address/contract-address.js b/lib.commonjs/address/contract-address.js deleted file mode 100644 index dde55c473..000000000 --- a/lib.commonjs/address/contract-address.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getCreate2Address = exports.getCreateAddress = void 0; -const index_js_1 = require("../utils/index.js"); -const index_js_2 = require("./index.js"); -const sha3_js_1 = require("../crypto/sha3.js"); -const data_js_1 = require("../utils/data.js"); -const logger_js_1 = require("../logger/logger.js"); -const address_js_1 = require("../transaction/address.js"); -const index_js_3 = require("./index.js"); -const logger = new logger_js_1.Logger("contract-address/0.0.1"); -/** - * Returns the address that would result from a ``CREATE`` for %%tx%%. - * - * This can be used to compute the address a contract will be - * deployed to by an EOA when sending a deployment transaction (i.e. - * when the ``to`` address is ``null``). - * - * This can also be used to compute the address a contract will be - * deployed to by a contract, by using the contract's address as the - * ``to`` and the contract's nonce. - * - * @example - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; - * nonce = 5; - * - * getCreateAddress({ from, nonce }); - * //_result: - */ -function getCreateAddress(tx) { - const from = (0, index_js_2.getAddress)(tx.from); - const nonce = (0, index_js_1.getBigInt)(tx.nonce, "tx.nonce"); - let nonceHex = nonce.toString(16); - if (nonceHex === "0") { - nonceHex = "0x"; - } - else if (nonceHex.length % 2) { - nonceHex = "0x0" + nonceHex; - } - else { - nonceHex = "0x" + nonceHex; - } - return (0, index_js_2.getAddress)(from); -} -exports.getCreateAddress = getCreateAddress; -/** - * Returns the address that would result from a ``CREATE2`` operation - * with the given %%from%%, %%salt%% and %%initCodeHash%%. - - * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. - * - * @example - * // The address of the contract - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" - * - * // The salt - * salt = id("HelloWorld") - * - * getCreate2Address(from, salt, initCodeHash) - * //_result: - */ -function getCreate2Address(from, salt, initCodeHash) { - if ((0, data_js_1.hexDataLength)(salt) !== 32) { - logger.throwArgumentError("salt must be 32 bytes", "salt", salt); - } - if ((0, data_js_1.hexDataLength)(initCodeHash) !== 32) { - logger.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash); - } - const val = (0, data_js_1.hexDataSlice)((0, sha3_js_1.sha256)((0, index_js_1.concat)(["0xff", (0, index_js_2.getAddress)(from), salt, initCodeHash])), 12); - console.log({ "contract-address/74=>should be string": val }); - const prefix = from.substring(2, 4); - const checksum = (0, index_js_3.calculateCheckSum)(val, prefix); - return "0x" + prefix + checksum + (0, address_js_1.removeHexPrefix)(val); -} -exports.getCreate2Address = getCreate2Address; -//# sourceMappingURL=contract-address.js.map \ No newline at end of file diff --git a/lib.commonjs/address/contract-address.js.map b/lib.commonjs/address/contract-address.js.map deleted file mode 100644 index 6942f9d99..000000000 --- a/lib.commonjs/address/contract-address.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contract-address.js","sourceRoot":"","sources":["../../src.ts/address/contract-address.ts"],"names":[],"mappings":";;;AAAA,gDAK2B;AAE3B,yCAAwC;AAGxC,+CAA2C;AAC3C,8CAA+D;AAC/D,mDAA6C;AAC7C,0DAA4D;AAC5D,yCAA+C;AAC/C,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,wBAAwB,CAAC,CAAC;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,gBAAgB,CAAC,EAGhC;IACC,MAAM,IAAI,GAAG,IAAA,qBAAU,EAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAE9C,IAAI,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAClC,IAAI,QAAQ,KAAK,GAAG,EAAE;QACpB,QAAQ,GAAG,IAAI,CAAC;KACjB;SAAM,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QAC9B,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;KAC7B;SAAM;QACL,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAAC;KAC5B;IAED,OAAO,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAjBD,4CAiBC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,iBAAiB,CAC/B,IAAY,EACZ,IAAe,EACf,YAAuB;IAEvB,IAAI,IAAA,uBAAa,EAAC,IAAI,CAAC,KAAK,EAAE,EAAE;QAC9B,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;KAClE;IACD,IAAI,IAAA,uBAAa,EAAC,YAAY,CAAC,KAAK,EAAE,EAAE;QACtC,MAAM,CAAC,kBAAkB,CACvB,+BAA+B,EAC/B,cAAc,EACd,YAAY,CACb,CAAC;KACH;IAED,MAAM,GAAG,GAAG,IAAA,sBAAY,EACtB,IAAA,gBAAM,EAAC,IAAA,iBAAM,EAAC,CAAC,MAAM,EAAE,IAAA,qBAAU,EAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,EAC9D,EAAE,CACH,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,EAAE,uCAAuC,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAA,4BAAiB,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAChD,OAAO,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAA,4BAAe,EAAC,GAAG,CAAC,CAAC;AACzD,CAAC;AAxBD,8CAwBC"} \ No newline at end of file diff --git a/lib.commonjs/address/index.d.ts b/lib.commonjs/address/index.d.ts deleted file mode 100644 index 180d9faa2..000000000 --- a/lib.commonjs/address/index.d.ts +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Addresses are a fundamental part of interacting with Core. They - * represent the gloabal identity of Externally Owned Accounts (accounts - * backed by a private key) and contracts. - * - * The Core Naming Service (CNS) provides an interconnected ecosystem - * of contracts, standards and libraries which enable looking up an - * address for an ENS name. - * - * These functions help convert between various formats, validate - * addresses and safely resolve ENS names. - * - * @_section: api/address:Addresses [about-addresses] - */ -/** - * An interface for objects which have an address, and can - * resolve it asyncronously. - * - * This allows objects such as [[Signer]] or [[Contract]] to - * be used most places an address can be, for example getting - * the [balance](Provider-getBalance). - */ -export interface Addressable { - /** - * Get the object address. - */ - getAddress(): Promise; -} -/** - * Anything that can be used to return or resolve an address. - */ -export type AddressLike = string | Promise | Addressable; -/** - * An interface for any object which can resolve an ENS name. - */ -export interface NameResolver { -} -import { BigNumberish } from "../bigNumber/bigNumber.js"; -declare function calculateCheckSum(_address: string, _prefix: string): string; -/** - * Returns a normalized and checksumed address for %%address%%. - * This accepts non-checksum addresses, checksum addresses and - * [[getIcapAddress]] formats. - * - * The checksum in Core uses the capitalization (upper-case - * vs lower-case) of the characters within an address to encode - * its checksum, which offers, on average, a checksum of 15-bits. - * - * If %%address%% contains both upper-case and lower-case, it is - * assumed to already be a checksum address and its checksum is - * validated, and if the address fails its expected checksum an - * error is thrown. - * - * If you wish the checksum of %%address%% to be ignore, it should - * be converted to lower-case (i.e. ``.toLowercase()``) before - * being passed in. This should be a very rare situation though, - * that you wish to bypass the safegaurds in place to protect - * against an address that has been incorrectly copied from another - * source. - * - * @example: - * // Adds the checksum (via upper-casing specific letters) - * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") - * //_result: - * - * // Converts ICAP address and adds checksum - * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); - * //_result: - * - * // Throws an error if an address contains mixed case, - * // but the checksum fails - * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") - * //_error: - */ -declare function getAddress(address: string): string; -/** - * The [ICAP Address format](link-icap) format is an early checksum - * format which attempts to be compatible with the banking - * industry [IBAN format](link-wiki-iban) for bank accounts. - * - * It is no longer common or a recommended format. - * - * @example: - * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); - * //_result: - * - * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); - * //_result: - * - * // Throws an error if the ICAP checksum is wrong - * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); - * //_error: - */ -declare function getIcapAddress(address: string): string; -declare function networkIdToPrefix(networkId: number): string; -declare function getContractAddress(transaction: { - from: string; - nonce: BigNumberish; -}): string; -export { getAddress, getIcapAddress, calculateCheckSum, networkIdToPrefix, getContractAddress, }; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/address/index.d.ts.map b/lib.commonjs/address/index.d.ts.map deleted file mode 100644 index 3dc38445f..000000000 --- a/lib.commonjs/address/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/address/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,YAAY;CAQ5B;AAED,OAAO,EAAa,YAAY,EAAE,MAAM,2BAA2B,CAAC;AA8BpE,iBAAS,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAkBpE;AA0CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAoB3C;AACD;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAO/C;AAED,iBAAS,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAWpD;AAED,iBAAS,kBAAkB,CAAC,WAAW,EAAE;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,YAAY,CAAC;CACrB,UAmBA;AAED,OAAO,EACL,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/address/index.js b/lib.commonjs/address/index.js deleted file mode 100644 index e48403b07..000000000 --- a/lib.commonjs/address/index.js +++ /dev/null @@ -1,205 +0,0 @@ -"use strict"; -/** - * Addresses are a fundamental part of interacting with Core. They - * represent the gloabal identity of Externally Owned Accounts (accounts - * backed by a private key) and contracts. - * - * The Core Naming Service (CNS) provides an interconnected ecosystem - * of contracts, standards and libraries which enable looking up an - * address for an ENS name. - * - * These functions help convert between various formats, validate - * addresses and safely resolve ENS names. - * - * @_section: api/address:Addresses [about-addresses] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getContractAddress = exports.networkIdToPrefix = exports.calculateCheckSum = exports.getIcapAddress = exports.getAddress = void 0; -null; -const bigNumber_js_1 = require("../bigNumber/bigNumber.js"); -const rlp_js_1 = require("../crypto/rlp.js"); -const sha3_js_1 = require("../crypto/sha3.js"); -const logger_js_1 = require("../logger/logger.js"); -const data_js_1 = require("../utils/data.js"); -const logger = new logger_js_1.Logger("address/0.0.1"); -const precompiledAddresses = [ - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000001", - "0000000000000000000000000000000000000000000000000000000000000002", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000005", - "0000000000000000000000000000000000000000000000000000000000000006", - "0000000000000000000000000000000000000000000000000000000000000007", - "0000000000000000000000000000000000000000000000000000000000000008", - "0000000000000000000000000000000000000000000000000000000000000009", -]; -function removeHexPrefix(val) { - return val.substring(0, 2) === "0x" ? val.substring(2) : val; -} -function calculateCheckSum(_address, _prefix) { - const address = (0, data_js_1.getBytes)("0x" + _address.replace("0x", "")); - const prefix = (0, data_js_1.getBytes)("0x" + _prefix.replace("0x", "")); - const tmpConcated = new Uint8Array([...address, ...prefix]); - const hexedConcat = (0, data_js_1.hexlify)(tmpConcated).replace("0x", "") + "00"; - const mods = Array.from(hexedConcat.toUpperCase(), (c) => { - const charCode = c.charCodeAt(0); - return charCode > 64 && charCode < 91 - ? (charCode - 55).toString() - : (charCode - 48).toString(); - }).join(""); - const bigVal = BigInt(mods); - const val97 = BigInt(97); - const val98 = BigInt(98); - const remainder = bigVal % val97; - const checkSum = val98 - remainder; - const result = checkSum > 9 ? checkSum.toString() : "0" + checkSum.toString(); - return result; -} -exports.calculateCheckSum = calculateCheckSum; -// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number -// Create lookup table -const ibanLookup = {}; -for (let i = 0; i < 10; i++) { - ibanLookup[String(i)] = String(i); -} -for (let i = 0; i < 26; i++) { - ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); -} -// How many decimal digits can we process? (for 64-bit float, this is 15) -// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER)); -const safeDigits = 15; -function ibanChecksum(address) { - address = address.toUpperCase(); - address = address.substring(4) + address.substring(0, 2) + "00"; - let expanded = address - .split("") - .map((c) => { - return ibanLookup[c]; - }) - .join(""); - // Javascript can handle integers safely up to 15 (decimal) digits - while (expanded.length >= safeDigits) { - let block = expanded.substring(0, safeDigits); - expanded = (parseInt(block, 10) % 97) + expanded.substring(block.length); - } - let checksum = String(98 - (parseInt(expanded, 10) % 97)); - while (checksum.length < 2) { - checksum = "0" + checksum; - } - return checksum; -} -/** - * Returns a normalized and checksumed address for %%address%%. - * This accepts non-checksum addresses, checksum addresses and - * [[getIcapAddress]] formats. - * - * The checksum in Core uses the capitalization (upper-case - * vs lower-case) of the characters within an address to encode - * its checksum, which offers, on average, a checksum of 15-bits. - * - * If %%address%% contains both upper-case and lower-case, it is - * assumed to already be a checksum address and its checksum is - * validated, and if the address fails its expected checksum an - * error is thrown. - * - * If you wish the checksum of %%address%% to be ignore, it should - * be converted to lower-case (i.e. ``.toLowercase()``) before - * being passed in. This should be a very rare situation though, - * that you wish to bypass the safegaurds in place to protect - * against an address that has been incorrectly copied from another - * source. - * - * @example: - * // Adds the checksum (via upper-casing specific letters) - * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") - * //_result: - * - * // Converts ICAP address and adds checksum - * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); - * //_result: - * - * // Throws an error if an address contains mixed case, - * // but the checksum fails - * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") - * //_error: - */ -function getAddress(address) { - if (typeof address !== "string") { - logger.throwArgumentError("invalid address", "address", address); - } - if (!address.match(/^(0x)?[0-9a-fA-F]{44}$/)) { - logger.throwArgumentError("invalid address", "address", address); - } - const raw = removeHexPrefix(address); - if (precompiledAddresses.includes(raw)) { - return "0x" + raw; - } - const prefix = raw.substring(0, 2); - const val = raw.substring(4); - const checksum = calculateCheckSum(val, prefix); - if (checksum !== raw.substring(2, 4)) { - logger.throwArgumentError("bad address checksum", "address", address); - } - return "0x" + prefix + checksum + val; -} -exports.getAddress = getAddress; -/** - * The [ICAP Address format](link-icap) format is an early checksum - * format which attempts to be compatible with the banking - * industry [IBAN format](link-wiki-iban) for bank accounts. - * - * It is no longer common or a recommended format. - * - * @example: - * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); - * //_result: - * - * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); - * //_result: - * - * // Throws an error if the ICAP checksum is wrong - * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); - * //_error: - */ -function getIcapAddress(address) { - //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase(); - let base36 = BigInt(getAddress(address)).toString(36).toUpperCase(); - while (base36.length < 30) { - base36 = "0" + base36; - } - return "XE" + ibanChecksum("XE00" + base36) + base36; -} -exports.getIcapAddress = getIcapAddress; -function networkIdToPrefix(networkId) { - if (networkId == 1) { - return "cb"; - } - else if (networkId == 3 || networkId == 4) { - return "ab"; - } - else if (networkId > 10 || networkId == 0) { - return "ce"; - } - else { - logger.throwArgumentError("bad networkId", "networkId", networkId); - return ""; - } -} -exports.networkIdToPrefix = networkIdToPrefix; -function getContractAddress(transaction) { - let from = null; - try { - from = getAddress(transaction.from); - } - catch (error) { - logger.throwArgumentError("missing from address", "transaction", transaction); - } - const nonce = (0, data_js_1.stripZeros)((0, data_js_1.arrayify)(bigNumber_js_1.BigNumber.from(transaction.nonce).toHexString())); - const val = (0, data_js_1.hexDataSlice)((0, sha3_js_1.sha256)((0, rlp_js_1.encode)([from, nonce])), 12); - const prefix = from.substring(2, 4); - const checksum = calculateCheckSum(val, prefix); - return "0x" + prefix + checksum + removeHexPrefix(val); -} -exports.getContractAddress = getContractAddress; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.commonjs/address/index.js.map b/lib.commonjs/address/index.js.map deleted file mode 100644 index f538e9942..000000000 --- a/lib.commonjs/address/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/address/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAEH,IAAI,CAAC;AAmCL,4DAAoE;AACpE,6CAA0C;AAC1C,+CAA2C;AAC3C,mDAA6C;AAC7C,8CAM0B;AAC1B,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,eAAe,CAAC,CAAC;AAE3C,MAAM,oBAAoB,GAAG;IAC3B,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;CACnE,CAAC;AAEF,SAAS,eAAe,CAAC,GAAW;IAClC,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC/D,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB,EAAE,OAAe;IAC1D,MAAM,OAAO,GAAG,IAAA,kBAAQ,EAAC,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,IAAA,kBAAQ,EAA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AAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAChD,OAAO,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;AACzD,CAAC;AAOC,gDAAkB"} \ No newline at end of file diff --git a/lib.commonjs/bigNumber/bigNumber.d.ts b/lib.commonjs/bigNumber/bigNumber.d.ts deleted file mode 100644 index 089132488..000000000 --- a/lib.commonjs/bigNumber/bigNumber.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Bytes, Hexable } from "../utils/data.js"; -export type BigNumberish = BigNumber | Bytes | bigint | string | number; -export declare function isBigNumberish(value: any): value is BigNumberish; -export declare class BigNumber implements Hexable { - readonly _hex: string; - readonly _isBigNumber: boolean; - constructor(constructorGuard: any, hex: string); - fromTwos(value: number): BigNumber; - toTwos(value: number): BigNumber; - abs(): BigNumber; - add(other: BigNumberish): BigNumber; - sub(other: BigNumberish): BigNumber; - div(other: BigNumberish): BigNumber; - mul(other: BigNumberish): BigNumber; - mod(other: BigNumberish): BigNumber; - pow(other: BigNumberish): BigNumber; - and(other: BigNumberish): BigNumber; - or(other: BigNumberish): BigNumber; - xor(other: BigNumberish): BigNumber; - mask(value: number): BigNumber; - shl(value: number): BigNumber; - shr(value: number): BigNumber; - eq(other: BigNumberish): boolean; - lt(other: BigNumberish): boolean; - lte(other: BigNumberish): boolean; - gt(other: BigNumberish): boolean; - gte(other: BigNumberish): boolean; - isNegative(): boolean; - isZero(): boolean; - toNumber(): number; - toBigInt(): bigint; - toString(): string; - toHexString(): string; - toJSON(key?: string): any; - static from(value: any): BigNumber; - static isBigNumber(value: any): value is BigNumber; -} -export declare function _base36To16(value: string): string; -export declare function _base16To36(value: string): string; -//# sourceMappingURL=bigNumber.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/bigNumber/bigNumber.d.ts.map b/lib.commonjs/bigNumber/bigNumber.d.ts.map deleted file mode 100644 index d71c9db78..000000000 --- a/lib.commonjs/bigNumber/bigNumber.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bigNumber.d.ts","sourceRoot":"","sources":["../../src.ts/bigNumber/bigNumber.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,KAAK,EACL,OAAO,EAIR,MAAM,kBAAkB,CAAC;AAS1B,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAExE,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,YAAY,CAUhE;AAKD,qBAAa,SAAU,YAAW,OAAO;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;gBAEnB,gBAAgB,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM;IAmB9C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAIlC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAIhC,GAAG,IAAI,SAAS;IAOhB,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAInC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAInC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQnC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAInC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQnC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQnC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQnC,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQlC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQnC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAO9B,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAO7B,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAO7B,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAIhC,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAIhC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAIjC,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAIhC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAIjC,UAAU,IAAI,OAAO;IAIrB,MAAM,IAAI,OAAO;IAIjB,QAAQ,IAAI,MAAM;IAUlB,QAAQ,IAAI,MAAM;IAclB,QAAQ,IAAI,MAAM;IA2BlB,WAAW,IAAI,MAAM;IAIrB,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG;IAIzB,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS;IAyElC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS;CAGnD;AA6ED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD"} \ No newline at end of file diff --git a/lib.commonjs/bigNumber/bigNumber.js b/lib.commonjs/bigNumber/bigNumber.js deleted file mode 100644 index ee55f18fe..000000000 --- a/lib.commonjs/bigNumber/bigNumber.js +++ /dev/null @@ -1,320 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports._base16To36 = exports._base36To16 = exports.BigNumber = exports.isBigNumberish = void 0; -const tslib_1 = require("tslib"); -/** - * BigNumber - * - * A wrapper around the BN.js object. We use the BN.js library - * because it is used by elliptic, so it is required regardless. - * - */ -const bn_js_1 = tslib_1.__importDefault(require("bn.js")); -const logger_js_1 = require("../logger/logger.js"); -const data_js_1 = require("../utils/data.js"); -var BN = bn_js_1.default.BN; -const logger = new logger_js_1.Logger("bigNumber/0.0.1"); -const _constructorGuard = {}; -const MAX_SAFE = 0x1fffffffffffff; -function isBigNumberish(value) { - return (value != null && - (BigNumber.isBigNumber(value) || - (typeof value === "number" && value % 1 === 0) || - (typeof value === "string" && !!value.match(/^-?[0-9]+$/)) || - (0, data_js_1.isHexString)(value) || - typeof value === "bigint" || - (0, data_js_1.isBytes)(value))); -} -exports.isBigNumberish = isBigNumberish; -// Only warn about passing 10 into radix once -let _warnedToStringRadix = false; -class BigNumber { - _hex; - _isBigNumber; - constructor(constructorGuard, hex) { - logger.checkNew(new.target, BigNumber); - if (constructorGuard !== _constructorGuard) { - logger.throwError("cannot call constructor directly; use BigNumber.from", logger_js_1.Logger.errors.UNSUPPORTED_OPERATION, { - operation: "new (BigNumber)", - }); - } - this._hex = hex; - this._isBigNumber = true; - Object.freeze(this); - } - fromTwos(value) { - return toBigNumber(toBN(this).fromTwos(value)); - } - toTwos(value) { - return toBigNumber(toBN(this).toTwos(value)); - } - abs() { - if (this._hex[0] === "-") { - return BigNumber.from(this._hex.substring(1)); - } - return this; - } - add(other) { - return toBigNumber(toBN(this).add(toBN(other))); - } - sub(other) { - return toBigNumber(toBN(this).sub(toBN(other))); - } - div(other) { - const o = BigNumber.from(other); - if (o.isZero()) { - throwFault("division by zero", "div"); - } - return toBigNumber(toBN(this).div(toBN(other))); - } - mul(other) { - return toBigNumber(toBN(this).mul(toBN(other))); - } - mod(other) { - const value = toBN(other); - if (value.isNeg()) { - throwFault("cannot modulo negative values", "mod"); - } - return toBigNumber(toBN(this).umod(value)); - } - pow(other) { - const value = toBN(other); - if (value.isNeg()) { - throwFault("cannot raise to negative values", "pow"); - } - return toBigNumber(toBN(this).pow(value)); - } - and(other) { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'and' negative values", "and"); - } - return toBigNumber(toBN(this).and(value)); - } - or(other) { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'or' negative values", "or"); - } - return toBigNumber(toBN(this).or(value)); - } - xor(other) { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'xor' negative values", "xor"); - } - return toBigNumber(toBN(this).xor(value)); - } - mask(value) { - if (this.isNegative() || value < 0) { - throwFault("cannot mask negative values", "mask"); - } - return toBigNumber(toBN(this).maskn(value)); - } - shl(value) { - if (this.isNegative() || value < 0) { - throwFault("cannot shift negative values", "shl"); - } - return toBigNumber(toBN(this).shln(value)); - } - shr(value) { - if (this.isNegative() || value < 0) { - throwFault("cannot shift negative values", "shr"); - } - return toBigNumber(toBN(this).shrn(value)); - } - eq(other) { - return toBN(this).eq(toBN(other)); - } - lt(other) { - return toBN(this).lt(toBN(other)); - } - lte(other) { - return toBN(this).lte(toBN(other)); - } - gt(other) { - return toBN(this).gt(toBN(other)); - } - gte(other) { - return toBN(this).gte(toBN(other)); - } - isNegative() { - return this._hex[0] === "-"; - } - isZero() { - return toBN(this).isZero(); - } - toNumber() { - try { - return toBN(this).toNumber(); - } - catch (error) { - throwFault("overflow", "toNumber", this.toString()); - } - // @ts-ignore - return null; - } - toBigInt() { - try { - return BigInt(this.toString()); - } - catch (e) { } - return logger.throwError("this platform does not support BigInt", logger_js_1.Logger.errors.UNSUPPORTED_OPERATION, { - value: this.toString(), - }); - } - toString() { - // Lots of people expect this, which we do not support, so check (See: #889) - if (arguments.length > 0) { - if (arguments[0] === 10) { - if (!_warnedToStringRadix) { - _warnedToStringRadix = true; - logger.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); - } - } - else if (arguments[0] === 16) { - logger.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", logger_js_1.Logger.errors.UNEXPECTED_ARGUMENT, {}); - } - else { - logger.throwError("BigNumber.toString does not accept parameters", logger_js_1.Logger.errors.UNEXPECTED_ARGUMENT, {}); - } - } - return toBN(this).toString(10); - } - toHexString() { - return this._hex; - } - toJSON(key) { - return { type: "BigNumber", hex: this.toHexString() }; - } - static from(value) { - if (value instanceof BigNumber) { - return value; - } - if (typeof value === "string") { - if (value.match(/^-?0x[0-9a-f]+$/i)) { - return new BigNumber(_constructorGuard, toHex(value)); - } - if (value.match(/^-?[0-9]+$/)) { - return new BigNumber(_constructorGuard, toHex(new BN(value))); - } - return logger.throwArgumentError("invalid BigNumber string", "value", value); - } - if (typeof value === "number") { - if (value % 1) { - throwFault("underflow", "BigNumber.from", value); - } - if (value >= MAX_SAFE || value <= -MAX_SAFE) { - throwFault("overflow", "BigNumber.from", value); - } - return BigNumber.from(String(value)); - } - const anyValue = value; - if (typeof anyValue === "bigint") { - return BigNumber.from(anyValue.toString()); - } - if ((0, data_js_1.isBytes)(anyValue)) { - return BigNumber.from((0, data_js_1.hexlify)(anyValue)); - } - if (anyValue) { - // Hexable interface (takes priority) - if (anyValue.toHexString) { - const hex = anyValue.toHexString(); - if (typeof hex === "string") { - return BigNumber.from(hex); - } - } - else { - // For now, handle legacy JSON-ified values (goes away in v6) - let hex = anyValue._hex; - // New-form JSON - if (hex == null && anyValue.type === "BigNumber") { - hex = anyValue.hex; - } - if (typeof hex === "string") { - if ((0, data_js_1.isHexString)(hex) || - (hex[0] === "-" && (0, data_js_1.isHexString)(hex.substring(1)))) { - return BigNumber.from(hex); - } - } - } - } - return logger.throwArgumentError("invalid BigNumber value", "value", value); - } - static isBigNumber(value) { - return !!(value && value._isBigNumber); - } -} -exports.BigNumber = BigNumber; -// Normalize the hex string -// @ts-ignore -function toHex(value) { - // For BN, call on the hex string - if (typeof value !== "string") { - return toHex(value.toString(16)); - } - // If negative, prepend the negative sign to the normalized positive value - if (value[0] === "-") { - // Strip off the negative sign - value = value.substring(1); - // Cannot have multiple negative signs (e.g. "--0x04") - if (value[0] === "-") { - logger.throwArgumentError("invalid hex", "value", value); - } - // Call toHex on the positive component - value = toHex(value); - // Do not allow "-0x00" - if (value === "0x00") { - return value; - } - // Negate the value - return "-" + value; - } - // Add a "0x" prefix if missing - if (value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - // Normalize zero - if (value === "0x") { - return "0x00"; - } - // Make the string even length - if (value.length % 2) { - value = "0x0" + value.substring(2); - } - // Trim to smallest even-length string - while (value.length > 4 && value.substring(0, 4) === "0x00") { - value = "0x" + value.substring(4); - } - return value; -} -// @ts-ignore -function toBigNumber(value) { - return BigNumber.from(toHex(value)); -} -// @ts-ignore -function toBN(value) { - const hex = BigNumber.from(value).toHexString(); - if (hex[0] === "-") { - return new BN("-" + hex.substring(3), 16); - } - return new BN(hex.substring(2), 16); -} -function throwFault(fault, operation, value) { - const params = { fault: fault, operation: operation }; - if (value != null) { - params.value = value; - } - return logger.throwError(fault, logger_js_1.Logger.errors.NUMERIC_FAULT, params); -} -// value should have no prefix -function _base36To16(value) { - return new BN(value, 36).toString(16); -} -exports._base36To16 = _base36To16; -// value should have no prefix -function _base16To36(value) { - return new BN(value, 16).toString(36); -} -exports._base16To36 = _base16To36; -//# sourceMappingURL=bigNumber.js.map \ No newline at end of file diff --git a/lib.commonjs/bigNumber/bigNumber.js.map b/lib.commonjs/bigNumber/bigNumber.js.map deleted file mode 100644 index e462166ef..000000000 --- a/lib.commonjs/bigNumber/bigNumber.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bigNumber.js","sourceRoot":"","sources":["../../src.ts/bigNumber/bigNumber.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;AAEb;;;;;;GAMG;AAEH,0DAAwB;AACxB,mDAA6C;AAC7C,8CAM0B;AAC1B,IAAO,EAAE,GAAG,eAAG,CAAC,EAAE,CAAC;AAEnB,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,iBAAiB,CAAC,CAAC;AAE7C,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AAIlC,SAAgB,cA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;IACvC,OAAO,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACxC,CAAC;AAFD,kCAEC"} \ No newline at end of file diff --git a/lib.commonjs/constants/addresses.d.ts b/lib.commonjs/constants/addresses.d.ts deleted file mode 100644 index a32d6be03..000000000 --- a/lib.commonjs/constants/addresses.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * A constant for the zero address. - * - * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) - */ -export declare const ZeroAddress: string; -//# sourceMappingURL=addresses.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/constants/addresses.d.ts.map b/lib.commonjs/constants/addresses.d.ts.map deleted file mode 100644 index a67118b65..000000000 --- a/lib.commonjs/constants/addresses.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAqD,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/constants/addresses.js b/lib.commonjs/constants/addresses.js deleted file mode 100644 index ff4fb40a5..000000000 --- a/lib.commonjs/constants/addresses.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ZeroAddress = void 0; -/** - * A constant for the zero address. - * - * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) - */ -exports.ZeroAddress = "0x0000000000000000000000000000000000000000"; -//# sourceMappingURL=addresses.js.map \ No newline at end of file diff --git a/lib.commonjs/constants/addresses.js.map b/lib.commonjs/constants/addresses.js.map deleted file mode 100644 index e6f9509d5..000000000 --- a/lib.commonjs/constants/addresses.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,WAAW,GAAW,4CAA4C,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/constants/hashes.d.ts b/lib.commonjs/constants/hashes.d.ts deleted file mode 100644 index 784df7156..000000000 --- a/lib.commonjs/constants/hashes.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * A constant for the zero hash. - * - * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) - */ -export declare const ZeroHash: string; -//# sourceMappingURL=hashes.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/constants/hashes.d.ts.map b/lib.commonjs/constants/hashes.d.ts.map deleted file mode 100644 index ef1df7d58..000000000 --- a/lib.commonjs/constants/hashes.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hashes.d.ts","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,MAC+C,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/constants/hashes.js b/lib.commonjs/constants/hashes.js deleted file mode 100644 index fbcd74c86..000000000 --- a/lib.commonjs/constants/hashes.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ZeroHash = void 0; -/** - * A constant for the zero hash. - * - * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) - */ -exports.ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000"; -//# sourceMappingURL=hashes.js.map \ No newline at end of file diff --git a/lib.commonjs/constants/hashes.js.map b/lib.commonjs/constants/hashes.js.map deleted file mode 100644 index d2ccd4b9d..000000000 --- a/lib.commonjs/constants/hashes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,QAAQ,GACnB,oEAAoE,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/constants/index.d.ts b/lib.commonjs/constants/index.d.ts deleted file mode 100644 index ba9ae1821..000000000 --- a/lib.commonjs/constants/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Some common constants useful for Core. - * - * @_section: api/constants: Constants [about-constants] - */ -export { ZeroAddress } from "./addresses.js"; -export { ZeroHash } from "./hashes.js"; -export { N, NegativeOne, Zero, One, Two, OrePerXCB, MaxUint256, MinInt256, MaxInt256, } from "./numbers.js"; -export { CoreSymbol, MessagePrefix } from "./strings.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/constants/index.d.ts.map b/lib.commonjs/constants/index.d.ts.map deleted file mode 100644 index 0c26e029d..000000000 --- a/lib.commonjs/constants/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/constants/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,CAAC,EACD,WAAW,EACX,IAAI,EACJ,GAAG,EACH,GAAG,EACH,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/constants/index.js b/lib.commonjs/constants/index.js deleted file mode 100644 index a8e8a6b27..000000000 --- a/lib.commonjs/constants/index.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -/** - * Some common constants useful for Core. - * - * @_section: api/constants: Constants [about-constants] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MessagePrefix = exports.CoreSymbol = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.OrePerXCB = exports.Two = exports.One = exports.Zero = exports.NegativeOne = exports.N = exports.ZeroHash = exports.ZeroAddress = void 0; -var addresses_js_1 = require("./addresses.js"); -Object.defineProperty(exports, "ZeroAddress", { enumerable: true, get: function () { return addresses_js_1.ZeroAddress; } }); -var hashes_js_1 = require("./hashes.js"); -Object.defineProperty(exports, "ZeroHash", { enumerable: true, get: function () { return hashes_js_1.ZeroHash; } }); -var numbers_js_1 = require("./numbers.js"); -Object.defineProperty(exports, "N", { enumerable: true, get: function () { return numbers_js_1.N; } }); -Object.defineProperty(exports, "NegativeOne", { enumerable: true, get: function () { return numbers_js_1.NegativeOne; } }); -Object.defineProperty(exports, "Zero", { enumerable: true, get: function () { return numbers_js_1.Zero; } }); -Object.defineProperty(exports, "One", { enumerable: true, get: function () { return numbers_js_1.One; } }); -Object.defineProperty(exports, "Two", { enumerable: true, get: function () { return numbers_js_1.Two; } }); -Object.defineProperty(exports, "OrePerXCB", { enumerable: true, get: function () { return numbers_js_1.OrePerXCB; } }); -Object.defineProperty(exports, "MaxUint256", { enumerable: true, get: function () { return numbers_js_1.MaxUint256; } }); -Object.defineProperty(exports, "MinInt256", { enumerable: true, get: function () { return numbers_js_1.MinInt256; } }); -Object.defineProperty(exports, "MaxInt256", { enumerable: true, get: function () { return numbers_js_1.MaxInt256; } }); -var strings_js_1 = require("./strings.js"); -Object.defineProperty(exports, "CoreSymbol", { enumerable: true, get: function () { return strings_js_1.CoreSymbol; } }); -Object.defineProperty(exports, "MessagePrefix", { enumerable: true, get: function () { return strings_js_1.MessagePrefix; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.commonjs/constants/index.js.map b/lib.commonjs/constants/index.js.map deleted file mode 100644 index e9bc2ce70..000000000 --- a/lib.commonjs/constants/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/constants/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,2CAUsB;AATpB,+FAAA,CAAC,OAAA;AACD,yGAAA,WAAW,OAAA;AACX,kGAAA,IAAI,OAAA;AACJ,iGAAA,GAAG,OAAA;AACH,iGAAA,GAAG,OAAA;AACH,uGAAA,SAAS,OAAA;AACT,wGAAA,UAAU,OAAA;AACV,uGAAA,SAAS,OAAA;AACT,uGAAA,SAAS,OAAA;AAEX,2CAAyD;AAAhD,wGAAA,UAAU,OAAA;AAAE,2GAAA,aAAa,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/constants/numbers.d.ts b/lib.commonjs/constants/numbers.d.ts deleted file mode 100644 index ac92f9623..000000000 --- a/lib.commonjs/constants/numbers.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * A constant for the order N for the secp256k1 curve. - * - * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) - */ -export declare const N: bigint; -/** - * A constant for the number of ore in a single xcb. - * - * (**i.e.** ``1000000000000000000n``) - */ -export declare const OrePerXCB: bigint; -/** - * A constant for the maximum value for a ``uint256``. - * - * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) - */ -export declare const MaxUint256: bigint; -/** - * A constant for the minimum value for an ``int256``. - * - * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) - */ -export declare const MinInt256: bigint; -/** - * A constant for the maximum value for an ``int256``. - * - * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) - */ -export declare const MaxInt256: bigint; -export declare const NegativeOne: bigint; -export declare const Zero: bigint; -export declare const One: bigint; -export declare const Two: bigint; -//# sourceMappingURL=numbers.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/constants/numbers.d.ts.map b/lib.commonjs/constants/numbers.d.ts.map deleted file mode 100644 index 7e7f487f7..000000000 --- a/lib.commonjs/constants/numbers.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src.ts/constants/numbers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,CAAC,EAAE,MAEf,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAAsC,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAExB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAEZ,CAAC;AAEb;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAEvB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAiC,CAAC;AAC5D,eAAO,MAAM,IAAI,EAAE,MAAgC,CAAC;AACpD,eAAO,MAAM,GAAG,EAAE,MAAgC,CAAC;AACnD,eAAO,MAAM,GAAG,EAAE,MAAgC,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/constants/numbers.js b/lib.commonjs/constants/numbers.js deleted file mode 100644 index 4ace3630f..000000000 --- a/lib.commonjs/constants/numbers.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Two = exports.One = exports.Zero = exports.NegativeOne = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.OrePerXCB = exports.N = void 0; -/** - * A constant for the order N for the secp256k1 curve. - * - * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) - */ -exports.N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); -/** - * A constant for the number of ore in a single xcb. - * - * (**i.e.** ``1000000000000000000n``) - */ -exports.OrePerXCB = BigInt("1000000000000000000"); -/** - * A constant for the maximum value for a ``uint256``. - * - * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) - */ -exports.MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -/** - * A constant for the minimum value for an ``int256``. - * - * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) - */ -exports.MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * - BigInt(-1); -/** - * A constant for the maximum value for an ``int256``. - * - * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) - */ -exports.MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -exports.NegativeOne = BigInt(-1); -exports.Zero = BigInt(0); -exports.One = BigInt(1); -exports.Two = BigInt(2); -//# sourceMappingURL=numbers.js.map \ No newline at end of file diff --git a/lib.commonjs/constants/numbers.js.map b/lib.commonjs/constants/numbers.js.map deleted file mode 100644 index bded42aec..000000000 --- a/lib.commonjs/constants/numbers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../src.ts/constants/numbers.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,CAAC,GAAW,MAAM,CAC7B,oEAAoE,CACrE,CAAC;AAEF;;;;GAIG;AACU,QAAA,SAAS,GAAW,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAE/D;;;;GAIG;AACU,QAAA,UAAU,GAAW,MAAM,CACtC,oEAAoE,CACrE,CAAC;AAEF;;;;GAIG;AACU,QAAA,SAAS,GACpB,MAAM,CAAC,oEAAoE,CAAC;IAC5E,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAEb;;;;GAIG;AACU,QAAA,SAAS,GAAW,MAAM,CACrC,oEAAoE,CACrE,CAAC;AAEW,QAAA,WAAW,GAAyB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,QAAA,IAAI,GAAyB,MAAM,CAAC,CAAC,CAAC,CAAC;AACvC,QAAA,GAAG,GAAyB,MAAM,CAAC,CAAC,CAAC,CAAC;AACtC,QAAA,GAAG,GAAyB,MAAM,CAAC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/constants/strings.d.ts b/lib.commonjs/constants/strings.d.ts deleted file mode 100644 index 164253121..000000000 --- a/lib.commonjs/constants/strings.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * A constant for the core symbol (normalized using NFKC). - * - * (**i.e.** ``"\\u039e"``) - */ -export declare const CoreSymbol: string; -/** - * A constant for the [[link-eip-191]] personal message prefix. - * - * (**i.e.** ``"\\x19Core Signed Message:\\n"``) - */ -export declare const MessagePrefix: string; -//# sourceMappingURL=strings.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/constants/strings.d.ts.map b/lib.commonjs/constants/strings.d.ts.map deleted file mode 100644 index 788cc8ce6..000000000 --- a/lib.commonjs/constants/strings.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src.ts/constants/strings.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAAiB,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,MAAqC,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/constants/strings.js b/lib.commonjs/constants/strings.js deleted file mode 100644 index 6bd80541f..000000000 --- a/lib.commonjs/constants/strings.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// NFKC (composed) // (decomposed) -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MessagePrefix = exports.CoreSymbol = void 0; -/** - * A constant for the core symbol (normalized using NFKC). - * - * (**i.e.** ``"\\u039e"``) - */ -exports.CoreSymbol = "\u039e"; // "\uD835\uDF63"; -/** - * A constant for the [[link-eip-191]] personal message prefix. - * - * (**i.e.** ``"\\x19Core Signed Message:\\n"``) - */ -exports.MessagePrefix = "\x19Core Signed Message:\n"; -//# sourceMappingURL=strings.js.map \ No newline at end of file diff --git a/lib.commonjs/constants/strings.js.map b/lib.commonjs/constants/strings.js.map deleted file mode 100644 index e12c6ebda..000000000 --- a/lib.commonjs/constants/strings.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src.ts/constants/strings.ts"],"names":[],"mappings":";AAAA,8CAA8C;;;AAE9C;;;;GAIG;AACU,QAAA,UAAU,GAAW,QAAQ,CAAC,CAAC,kBAAkB;AAE9D;;;;GAIG;AACU,QAAA,aAAa,GAAW,4BAA4B,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/contract/contract.d.ts b/lib.commonjs/contract/contract.d.ts deleted file mode 100644 index b7a2cd009..000000000 --- a/lib.commonjs/contract/contract.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Indexed, Interface } from "../abi/index.js"; -import { Log, TransactionResponse } from "../providers/provider.js"; -import { ContractTransactionResponse, EventLog } from "./wrappers.js"; -import type { EventFragment, FunctionFragment, InterfaceAbi, ParamType } from "../abi/index.js"; -import type { Addressable } from "../address/index.js"; -import type { EventEmitterable, Listener } from "../utils/index.js"; -import type { BlockTag, ContractRunner } from "../providers/index.js"; -import type { ContractEventName, ContractInterface, ContractMethod, ContractEvent, ContractTransaction, WrappedFallback } from "./types.js"; -/** - * @_ignore: - */ -export declare function copyOverrides(arg: any, allowed?: Array): Promise>; -/** - * @_ignore: - */ -export declare function resolveArgs(_runner: null | ContractRunner, inputs: ReadonlyArray, args: Array): Promise>; -declare const internal: unique symbol; -export declare class BaseContract implements Addressable, EventEmitterable { - readonly target: string | Addressable; - readonly interface: Interface; - readonly runner: null | ContractRunner; - readonly filters: Record; - readonly [internal]: any; - readonly fallback: null | WrappedFallback; - constructor(target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner, _deployTx?: null | TransactionResponse); - connect(runner: null | ContractRunner): BaseContract; - getAddress(): Promise; - getDeployedCode(): Promise; - waitForDeployment(): Promise; - deploymentTransaction(): null | ContractTransactionResponse; - getFunction(key: string | FunctionFragment): T; - getEvent(key: string | EventFragment): ContractEvent; - queryTransaction(hash: string): Promise>; - queryFilter(event: ContractEventName, fromBlock?: BlockTag, toBlock?: BlockTag): Promise>; - on(event: ContractEventName, listener: Listener): Promise; - once(event: ContractEventName, listener: Listener): Promise; - emit(event: ContractEventName, ...args: Array): Promise; - listenerCount(event?: ContractEventName): Promise; - listeners(event?: ContractEventName): Promise>; - off(event: ContractEventName, listener?: Listener): Promise; - removeAllListeners(event?: ContractEventName): Promise; - addListener(event: ContractEventName, listener: Listener): Promise; - removeListener(event: ContractEventName, listener: Listener): Promise; - static buildClass(abi: InterfaceAbi): new (target: string, runner?: null | ContractRunner) => BaseContract & Omit; - static from(target: string, abi: InterfaceAbi, runner?: null | ContractRunner): BaseContract & Omit; - static isIndexed(value: any): value is Indexed; -} -declare const Contract_base: new (target: string, abi: InterfaceAbi, runner?: ContractRunner | null | undefined) => BaseContract & Omit; -export declare class Contract extends Contract_base { -} -export {}; -//# sourceMappingURL=contract.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/contract/contract.d.ts.map b/lib.commonjs/contract/contract.d.ts.map deleted file mode 100644 index d2114f9d0..000000000 --- a/lib.commonjs/contract/contract.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src.ts/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAS,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAEL,GAAG,EACH,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAWlC,OAAO,EAGL,2BAA2B,EAC3B,QAAQ,EACT,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,SAAS,EAEV,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EAIf,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAEV,iBAAiB,EACjB,iBAAiB,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D,WAAW,CACf,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,IAAI,CAAC;IAKV,cAAc,CAClB,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,IAAI,CAAC;IAIhB,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,iBAAiB,EACrC,GAAG,EAAE,YAAY,GAChB,KACD,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc,KAC3B,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;IAS/C,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,iBAAiB,EAC/B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,YAAY,EACjB,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc,GAC7B,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;IAO7C,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,OAAO;CAG/C;;AAUD,qBAAa,QAAS,SAAQ,aAAe;CAAG"} \ No newline at end of file diff --git a/lib.commonjs/contract/contract.js b/lib.commonjs/contract/contract.js deleted file mode 100644 index 4dc00baa9..000000000 --- a/lib.commonjs/contract/contract.js +++ /dev/null @@ -1,791 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Contract = exports.BaseContract = exports.resolveArgs = exports.copyOverrides = void 0; -const index_js_1 = require("../abi/index.js"); -const checks_js_1 = require("../address/checks.js"); -const provider_js_1 = require("../providers/provider.js"); -const index_js_2 = require("../utils/index.js"); -const wrappers_js_1 = require("./wrappers.js"); -const BN_0 = BigInt(0); -function canCall(value) { - return value && typeof value.call === "function"; -} -function canEstimate(value) { - return value && typeof value.estimateEnergy === "function"; -} -function canResolve(value) { - return value && typeof value.resolveName === "function"; -} -function canSend(value) { - return value && typeof value.sendTransaction === "function"; -} -class PreparedTopicFilter { - #filter; - fragment; - constructor(contract, fragment, args) { - (0, index_js_2.defineProperties)(this, { fragment }); - if (fragment.inputs.length < args.length) { - throw new Error("too many arguments"); - } - // Recursively descend into args and resolve any addresses - this.#filter = (async function () { - const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => { - const arg = args[index]; - if (arg == null) { - return null; - } - return param.walkAsync(args[index], (type, value) => { - if (type === "address") { - return (0, checks_js_1.resolveAddress)(value); - } - return value; - }); - })); - return contract.interface.encodeFilterTopics(fragment, resolvedArgs); - })(); - } - getTopicFilter() { - return this.#filter; - } -} -// A = Arguments passed in as a tuple -// R = The result type of the call (i.e. if only one return type, -// the qualified type, otherwise Result) -// D = The type the default call will return (i.e. R for view/pure, -// TransactionResponse otherwise) -//export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> { -function getRunner(value, feature) { - if (value == null) { - return null; - } - if (typeof value[feature] === "function") { - return value; - } - if (value.provider && typeof value.provider[feature] === "function") { - return value.provider; - } - return null; -} -function getProvider(value) { - if (value == null) { - return null; - } - return value.provider || null; -} -/** - * @_ignore: - */ -async function copyOverrides(arg, allowed) { - // Create a shallow copy (we'll deep-ify anything needed during normalizing) - const overrides = (0, provider_js_1.copyRequest)(index_js_1.Typed.dereference(arg, "overrides")); - (0, index_js_2.assertArgument)(overrides.to == null || (allowed || []).indexOf("to") >= 0, "cannot override to", "overrides.to", overrides.to); - (0, index_js_2.assertArgument)(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); - // Resolve any from - if (overrides.from) { - overrides.from = await (0, checks_js_1.resolveAddress)(overrides.from); - } - return overrides; -} -exports.copyOverrides = copyOverrides; -/** - * @_ignore: - */ -async function resolveArgs(_runner, inputs, args) { - // Recursively descend into args and resolve any addresses - return await Promise.all(inputs.map((param, index) => { - return param.walkAsync(args[index], (type, value) => { - value = index_js_1.Typed.dereference(value, type); - if (type === "address") { - return (0, checks_js_1.resolveAddress)(value); - } - return value; - }); - })); -} -exports.resolveArgs = resolveArgs; -function buildWrappedFallback(contract) { - const populateTransaction = async function (overrides) { - // If an overrides was passed in, copy it and normalize the values - const tx = (await copyOverrides(overrides, ["data"])); - tx.to = await contract.getAddress(); - const iface = contract.interface; - // Only allow payable contracts to set non-zero value - const payable = iface.receive || (iface.fallback && iface.fallback.payable); - (0, index_js_2.assertArgument)(payable || (tx.value || BN_0) === BN_0, "cannot send value to non-payable contract", "overrides.value", tx.value); - // Only allow fallback contracts to set non-empty data - (0, index_js_2.assertArgument)(iface.fallback || (tx.data || "0x") === "0x", "cannot send data to receive-only contract", "overrides.data", tx.data); - return tx; - }; - const staticCall = async function (overrides) { - const runner = getRunner(contract.runner, "call"); - (0, index_js_2.assert)(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); - const tx = await populateTransaction(overrides); - try { - return await runner.call(tx); - } - catch (error) { - if ((0, index_js_2.isCallException)(error) && error.data) { - throw contract.interface.makeError(error.data, tx); - } - throw error; - } - }; - const send = async function (overrides) { - const runner = contract.runner; - (0, index_js_2.assert)(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); - const tx = await runner.sendTransaction(await populateTransaction(overrides)); - const provider = getProvider(contract.runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - return new wrappers_js_1.ContractTransactionResponse(contract.interface, provider, tx); - }; - const estimateEnergy = async function (overrides) { - const runner = getRunner(contract.runner, "estimateEnergy"); - (0, index_js_2.assert)(canEstimate(runner), "contract runner does not support energy estimation", "UNSUPPORTED_OPERATION", { operation: "estimateEnergy" }); - return await runner.estimateEnergy(await populateTransaction(overrides)); - }; - const method = async (overrides) => { - return await send(overrides); - }; - (0, index_js_2.defineProperties)(method, { - _contract: contract, - estimateEnergy, - populateTransaction, - send, - staticCall, - }); - return method; -} -function buildWrappedMethod(contract, key) { - const getFragment = function (...args) { - const fragment = contract.interface.getFunction(key, args); - (0, index_js_2.assert)(fragment, "no matching fragment in getFragment", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }; - const populateTransaction = async function (...args) { - const fragment = getFragment(...args); - // If an overrides was passed in, copy it and normalize the values - let overrides = {}; - if (fragment.inputs.length + 1 === args.length) { - overrides = await copyOverrides(args.pop()); - } - if (fragment.inputs.length !== args.length) { - throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); - } - const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args); - return Object.assign({}, overrides, await (0, index_js_2.resolveProperties)({ - to: contract.getAddress(), - data: contract.interface.encodeFunctionData(fragment, resolvedArgs), - })); - }; - const staticCall = async function (...args) { - const result = await staticCallResult(...args); - if (result.length === 1) { - return result[0]; - } - return result; - }; - const send = async function (...args) { - const runner = contract.runner; - (0, index_js_2.assert)(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); - const tx = await runner.sendTransaction(await populateTransaction(...args)); - const provider = getProvider(contract.runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - return new wrappers_js_1.ContractTransactionResponse(contract.interface, provider, tx); - }; - const estimateEnergy = async function (...args) { - const runner = getRunner(contract.runner, "estimateEnergy"); - (0, index_js_2.assert)(canEstimate(runner), "contract runner does not support energy estimation", "UNSUPPORTED_OPERATION", { operation: "estimateEnergy" }); - return await runner.estimateEnergy(await populateTransaction(...args)); - }; - const staticCallResult = async function (...args) { - const runner = getRunner(contract.runner, "call"); - (0, index_js_2.assert)(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); - const tx = await populateTransaction(...args); - let result = "0x"; - try { - result = await runner.call(tx); - } - catch (error) { - if ((0, index_js_2.isCallException)(error) && error.data) { - throw contract.interface.makeError(error.data, tx); - } - throw error; - } - const fragment = getFragment(...args); - return contract.interface.decodeFunctionResult(fragment, result); - }; - const method = async (...args) => { - const fragment = getFragment(...args); - if (fragment.constant) { - return await staticCall(...args); - } - return await send(...args); - }; - (0, index_js_2.defineProperties)(method, { - name: contract.interface.getFunctionName(key), - _contract: contract, - _key: key, - getFragment, - estimateEnergy, - populateTransaction, - send, - staticCall, - staticCallResult, - }); - // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) - Object.defineProperty(method, "fragment", { - configurable: false, - enumerable: true, - get: () => { - const fragment = contract.interface.getFunction(key); - (0, index_js_2.assert)(fragment, "no matching fragment in defineProperty", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }, - }); - return method; -} -function buildWrappedEvent(contract, key) { - const getFragment = function (...args) { - const fragment = contract.interface.getEvent(key, args); - (0, index_js_2.assert)(fragment, "no matching fragment in", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }; - const method = function (...args) { - return new PreparedTopicFilter(contract, getFragment(...args), args); - }; - (0, index_js_2.defineProperties)(method, { - name: contract.interface.getEventName(key), - _contract: contract, - _key: key, - getFragment, - }); - // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) - Object.defineProperty(method, "fragment", { - configurable: false, - enumerable: true, - get: () => { - const fragment = contract.interface.getEvent(key); - (0, index_js_2.assert)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }, - }); - return method; -} -// The combination of TypeScrype, Private Fields and Proxies makes -// the world go boom; so we hide variables with some trickery keeping -// a symbol attached to each BaseContract which its sub-class (even -// via a Proxy) can reach and use to look up its internal values. -const internal = Symbol.for("_corebcInternal_contract"); -const internalValues = new WeakMap(); -function setInternal(contract, values) { - internalValues.set(contract[internal], values); -} -function getInternal(contract) { - return internalValues.get(contract[internal]); -} -function isDeferred(value) { - return (value && - typeof value === "object" && - "getTopicFilter" in value && - typeof value.getTopicFilter === "function" && - value.fragment); -} -async function getSubInfo(contract, event) { - let topics; - let fragment = null; - // Convert named events to topicHash and get the fragment for - // events which need deconstructing. - if (Array.isArray(event)) { - const topicHashify = function (name) { - if ((0, index_js_2.isHexString)(name, 32)) { - return name; - } - const fragment = contract.interface.getEvent(name); - (0, index_js_2.assertArgument)(fragment, "unknown fragment", "name", name); - return fragment.topicHash; - }; - // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` - topics = event.map((e) => { - if (e == null) { - return null; - } - if (Array.isArray(e)) { - return e.map(topicHashify); - } - return topicHashify(e); - }); - } - else if (event === "*") { - topics = [null]; - } - else if (typeof event === "string") { - if ((0, index_js_2.isHexString)(event, 32)) { - // Topic Hash - topics = [event]; - } - else { - // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` - fragment = contract.interface.getEvent(event); - (0, index_js_2.assertArgument)(fragment, "unknown fragment", "event", event); - topics = [fragment.topicHash]; - } - } - else if (isDeferred(event)) { - // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)` - topics = await event.getTopicFilter(); - } - else if ("fragment" in event) { - // ContractEvent; e.g. `contract.filter.Transfer` - fragment = event.fragment; - topics = [fragment.topicHash]; - } - else { - (0, index_js_2.assertArgument)(false, "unknown event name", "event", event); - } - // Normalize topics and sort TopicSets - topics = topics.map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values()); - if (items.length === 1) { - return items[0]; - } - items.sort(); - return items; - } - return t.toLowerCase(); - }); - const tag = topics - .map((t) => { - if (t == null) { - return "null"; - } - if (Array.isArray(t)) { - return t.join("|"); - } - return t; - }) - .join("&"); - return { fragment, tag, topics }; -} -async function hasSub(contract, event) { - const { subs } = getInternal(contract); - return subs.get((await getSubInfo(contract, event)).tag) || null; -} -async function getSub(contract, operation, event) { - // Make sure our runner can actually subscribe to events - const provider = getProvider(contract.runner); - (0, index_js_2.assert)(provider, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation }); - const { fragment, tag, topics } = await getSubInfo(contract, event); - const { addr, subs } = getInternal(contract); - let sub = subs.get(tag); - if (!sub) { - const address = addr ? addr : contract; - const filter = { address, topics }; - const listener = (log) => { - let foundFragment = fragment; - if (foundFragment == null) { - try { - foundFragment = contract.interface.getEvent(log.topics[0]); - } - catch (error) { } - } - // If fragment is null, we do not deconstruct the args to emit - if (foundFragment) { - const _foundFragment = foundFragment; - const args = fragment - ? contract.interface.decodeEventLog(fragment, log.data, log.topics) - : []; - emit(contract, event, args, (listener) => { - return new wrappers_js_1.ContractEventPayload(contract, listener, event, _foundFragment, log); - }); - } - else { - emit(contract, event, [], (listener) => { - return new wrappers_js_1.ContractUnknownEventPayload(contract, listener, event, log); - }); - } - }; - let starting = []; - const start = () => { - if (starting.length) { - return; - } - starting.push(provider.on(filter, listener)); - }; - const stop = async () => { - if (starting.length == 0) { - return; - } - let started = starting; - starting = []; - await Promise.all(started); - provider.off(filter, listener); - }; - sub = { tag, listeners: [], start, stop }; - subs.set(tag, sub); - } - return sub; -} -// We use this to ensure one emit resolves before firing the next to -// ensure correct ordering (note this cannot throw and just adds the -// notice to the event queu using setTimeout). -let lastEmit = Promise.resolve(); -async function _emit(contract, event, args, payloadFunc) { - await lastEmit; - const sub = await hasSub(contract, event); - if (!sub) { - return false; - } - const count = sub.listeners.length; - sub.listeners = sub.listeners.filter(({ listener, once }) => { - const passArgs = Array.from(args); - if (payloadFunc) { - passArgs.push(payloadFunc(once ? null : listener)); - } - try { - listener.call(contract, ...passArgs); - } - catch (error) { } - return !once; - }); - return count > 0; -} -async function emit(contract, event, args, payloadFunc) { - try { - await lastEmit; - } - catch (error) { } - const resultPromise = _emit(contract, event, args, payloadFunc); - lastEmit = resultPromise; - return await resultPromise; -} -const passProperties = ["then"]; -class BaseContract { - target; - interface; - runner; - filters; - [internal]; - fallback; - constructor(target, abi, runner, _deployTx) { - if (runner == null) { - runner = null; - } - const iface = index_js_1.Interface.from(abi); - (0, index_js_2.defineProperties)(this, { target, runner, interface: iface }); - Object.defineProperty(this, internal, { value: {} }); - let addrPromise; - let addr = null; - let deployTx = null; - if (_deployTx) { - const provider = getProvider(runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - deployTx = new wrappers_js_1.ContractTransactionResponse(this.interface, provider, _deployTx); - } - let subs = new Map(); - // Resolve the target as the address - if (typeof target === "string") { - if ((0, index_js_2.isHexString)(target)) { - addr = target; - addrPromise = Promise.resolve(target); - } - else { - const resolver = getRunner(runner, "resolveName"); - if (!canResolve(resolver)) { - throw (0, index_js_2.makeError)("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", { - operation: "resolveName", - }); - } - addrPromise = resolver.resolveName(target).then((addr) => { - if (addr == null) { - throw new Error("TODO"); - } - getInternal(this).addr = addr; - return addr; - }); - } - } - else { - addrPromise = target.getAddress().then((addr) => { - if (addr == null) { - throw new Error("TODO"); - } - getInternal(this).addr = addr; - return addr; - }); - } - // Set our private values - setInternal(this, { addrPromise, addr, deployTx, subs }); - // Add the event filters - const filters = new Proxy({}, { - get: (target, _prop, receiver) => { - // Pass important checks (like `then` for Promise) through - if (passProperties.indexOf(_prop) >= 0) { - return Reflect.get(target, _prop, receiver); - } - const prop = String(_prop); - const result = this.getEvent(prop); - if (result) { - return result; - } - throw new Error(`unknown contract event: ${prop}`); - }, - has: (target, prop) => { - // Pass important checks (like `then` for Promise) through - if (passProperties.indexOf(prop) >= 0) { - return Reflect.has(target, prop); - } - return (Reflect.has(target, prop) || this.interface.hasEvent(String(prop))); - }, - }); - (0, index_js_2.defineProperties)(this, { filters }); - (0, index_js_2.defineProperties)(this, { - fallback: iface.receive || iface.fallback ? buildWrappedFallback(this) : null, - }); - // Return a Proxy that will respond to functions - return new Proxy(this, { - get: (target, _prop, receiver) => { - if (_prop in target || passProperties.indexOf(_prop) >= 0) { - return Reflect.get(target, _prop, receiver); - } - const prop = String(_prop); - const result = target.getFunction(prop); - if (result) { - return result; - } - throw new Error(`unknown contract method: ${prop}`); - }, - has: (target, prop) => { - if (prop in target || passProperties.indexOf(prop) >= 0) { - return Reflect.has(target, prop); - } - return target.interface.hasFunction(String(prop)); - }, - }); - } - connect(runner) { - return new BaseContract(this.target, this.interface, runner); - } - async getAddress() { - return await getInternal(this).addrPromise; - } - async getDeployedCode() { - const provider = getProvider(this.runner); - (0, index_js_2.assert)(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" }); - const code = await provider.getCode(await this.getAddress()); - if (code === "0x") { - return null; - } - return code; - } - async waitForDeployment() { - // We have the deployement transaction; just use that (throws if deployement fails) - const deployTx = this.deploymentTransaction(); - if (deployTx) { - await deployTx.wait(); - return this; - } - // Check for code - const code = await this.getDeployedCode(); - if (code != null) { - return this; - } - // Make sure we can subscribe to a provider event - const provider = getProvider(this.runner); - (0, index_js_2.assert)(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }); - return new Promise((resolve, reject) => { - const checkCode = async () => { - try { - const code = await this.getDeployedCode(); - if (code != null) { - return resolve(this); - } - provider.once("block", checkCode); - } - catch (error) { - reject(error); - } - }; - checkCode(); - }); - } - deploymentTransaction() { - return getInternal(this).deployTx; - } - getFunction(key) { - if (typeof key !== "string") { - key = key.format(); - } - const func = buildWrappedMethod(this, key); - return func; - } - getEvent(key) { - if (typeof key !== "string") { - key = key.format(); - } - return buildWrappedEvent(this, key); - } - async queryTransaction(hash) { - // Is this useful? - throw new Error("@TODO"); - } - async queryFilter(event, fromBlock, toBlock) { - if (fromBlock == null) { - fromBlock = 0; - } - if (toBlock == null) { - toBlock = "latest"; - } - const { addr, addrPromise } = getInternal(this); - const address = addr ? addr : await addrPromise; - const { fragment, topics } = await getSubInfo(this, event); - const filter = { address, topics, fromBlock, toBlock }; - const provider = getProvider(this.runner); - (0, index_js_2.assert)(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); - return (await provider.getLogs(filter)).map((log) => { - let foundFragment = fragment; - if (foundFragment == null) { - try { - foundFragment = this.interface.getEvent(log.topics[0]); - } - catch (error) { } - } - if (foundFragment) { - return new wrappers_js_1.EventLog(log, this.interface, foundFragment); - } - else { - return new provider_js_1.Log(log, provider); - } - }); - } - async on(event, listener) { - const sub = await getSub(this, "on", event); - sub.listeners.push({ listener, once: false }); - sub.start(); - return this; - } - async once(event, listener) { - const sub = await getSub(this, "once", event); - sub.listeners.push({ listener, once: true }); - sub.start(); - return this; - } - async emit(event, ...args) { - return await emit(this, event, args, null); - } - async listenerCount(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return 0; - } - return sub.listeners.length; - } - const { subs } = getInternal(this); - let total = 0; - for (const { listeners } of subs.values()) { - total += listeners.length; - } - return total; - } - async listeners(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return []; - } - return sub.listeners.map(({ listener }) => listener); - } - const { subs } = getInternal(this); - let result = []; - for (const { listeners } of subs.values()) { - result = result.concat(listeners.map(({ listener }) => listener)); - } - return result; - } - async off(event, listener) { - const sub = await hasSub(this, event); - if (!sub) { - return this; - } - if (listener) { - const index = sub.listeners - .map(({ listener }) => listener) - .indexOf(listener); - if (index >= 0) { - sub.listeners.splice(index, 1); - } - } - if (listener == null || sub.listeners.length === 0) { - sub.stop(); - getInternal(this).subs.delete(sub.tag); - } - return this; - } - async removeAllListeners(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return this; - } - sub.stop(); - getInternal(this).subs.delete(sub.tag); - } - else { - const { subs } = getInternal(this); - for (const { tag, stop } of subs.values()) { - stop(); - subs.delete(tag); - } - } - return this; - } - // Alias for "on" - async addListener(event, listener) { - return await this.on(event, listener); - } - // Alias for "off" - async removeListener(event, listener) { - return await this.off(event, listener); - } - static buildClass(abi) { - class CustomContract extends BaseContract { - constructor(address, runner = null) { - super(address, abi, runner); - } - } - return CustomContract; - } - static from(target, abi, runner) { - if (runner == null) { - runner = null; - } - const contract = new this(target, abi, runner); - return contract; - } - static isIndexed(value) { - return index_js_1.Indexed.isIndexed(value); - } -} -exports.BaseContract = BaseContract; -function _ContractBase() { - return BaseContract; -} -class Contract extends _ContractBase() { -} -exports.Contract = Contract; -//# sourceMappingURL=contract.js.map \ No newline at end of file diff --git a/lib.commonjs/contract/contract.js.map b/lib.commonjs/contract/contract.js.map deleted file mode 100644 index 6a0b4482b..000000000 --- a/lib.commonjs/contract/contract.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src.ts/contract/contract.ts"],"names":[],"mappings":";;;AAAA,8CAA4D;AAC5D,oDAAsD;AACtD,0DAIkC;AAClC,gDAQ2B;AAE3B,+CAKuB;AAgCvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAkBvB,SAAS,OAAO,CAAC,KAAU;IACzB,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnD,CAAC;AAED,SAAS,WAAW,CAAC,KAAU;IAC7B,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,cAAc,KAAK,UAAU,CAAC;AAC7D,CAAC;AAED,SAAS,UAAU,CAAC,KAAU;IAC5B,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,WAAW,KAAK,UAAU,CAAC;AAC1D,CAAC;AAED,SAAS,OAAO,CAAC,KAAU;IACzB,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,eAAe,KAAK,UAAU,CAAC;AAC9D,CAAC;AAED,MAAM,mBAAmB;IACvB,OAAO,CAAuB;IACrB,QAAQ,CAAiB;IAElC,YACE,QAAsB,EACtB,QAAuB,EACvB,IAAgB;QAEhB,IAAA,2BAAgB,EAAsB,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC1D,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE;YACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;SACvC;QAED,0DAA0D;QAC1D,IAAI,CAAC,OAAO,GAAG,CAAC,KAAK;YACnB,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,GAAG,CACpC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAA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e,CAAC;IACzB,CAAC;IACD,MAAM,CAAC,SAAS,CAAC,KAAU;QACzB,OAAO,kBAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACF;AA9ZD,oCA8ZC;AAED,SAAS,aAAa;IAKpB,OAAO,YAAmB,CAAC;AAC7B,CAAC;AAED,MAAa,QAAS,SAAQ,aAAa,EAAE;CAAG;AAAhD,4BAAgD"} \ No newline at end of file diff --git a/lib.commonjs/contract/factory.d.ts b/lib.commonjs/contract/factory.d.ts deleted file mode 100644 index f58d98552..000000000 --- a/lib.commonjs/contract/factory.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Interface } from "../abi/index.js"; -import { BaseContract } from "./contract.js"; -import type { InterfaceAbi } from "../abi/index.js"; -import type { ContractRunner } from "../providers/index.js"; -import type { BytesLike } from "../utils/index.js"; -import type { ContractInterface, ContractMethodArgs, ContractDeployTransaction } from "./types.js"; -import type { ContractTransactionResponse } from "./wrappers.js"; -export declare class ContractFactory = Array, I = BaseContract> { - readonly interface: Interface; - readonly bytecode: string; - readonly runner: null | ContractRunner; - constructor(abi: Interface | InterfaceAbi, bytecode: BytesLike | { - object: string; - }, runner?: null | ContractRunner); - getDeployTransaction(...args: ContractMethodArgs): Promise; - deploy(...args: ContractMethodArgs): Promise>; - connect(runner: null | ContractRunner): ContractFactory; - static fromSolidity = Array, I = ContractInterface>(output: any, runner?: ContractRunner): ContractFactory; -} -//# sourceMappingURL=factory.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/contract/factory.d.ts.map b/lib.commonjs/contract/factory.d.ts.map deleted file mode 100644 index 600026a1b..000000000 --- a/lib.commonjs/contract/factory.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src.ts/contract/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C,OAAO,EAAE,YAAY,EAA8B,MAAM,eAA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G,iBAAiB,EAC1E,MAAM,EAAE,GAAG,EACX,MAAM,CAAC,EAAE,cAAc,GACtB,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;CAkBzB"} \ No newline at end of file diff --git a/lib.commonjs/contract/factory.js b/lib.commonjs/contract/factory.js deleted file mode 100644 index f472c926d..000000000 --- a/lib.commonjs/contract/factory.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ContractFactory = void 0; -const index_js_1 = require("../abi/index.js"); -const contract_address_js_1 = require("../address/contract-address.js"); -const index_js_2 = require("../utils/index.js"); -const contract_js_1 = require("./contract.js"); -const data_js_1 = require("../utils/data.js"); -// A = Arguments to the constructor -// I = Interface of deployed contracts -class ContractFactory { - interface; - bytecode; - runner; - constructor(abi, bytecode, runner) { - const iface = index_js_1.Interface.from(abi); - // Dereference Solidity bytecode objects and allow a missing `0x`-prefix - if (bytecode instanceof Uint8Array) { - bytecode = (0, index_js_2.hexlify)((0, index_js_2.getBytes)(bytecode)); - } - else if (typeof bytecode === "string") { - bytecode = bytecode; - } - else if ((0, data_js_1.isBytes)(bytecode)) { - bytecode = (0, index_js_2.hexlify)(bytecode); - } - else if (bytecode && typeof bytecode.object === "string") { - // Allow the bytecode object from the Solidity compiler - bytecode = bytecode.object; - } - else { - // Crash in the next verification step - bytecode = "!"; - } - (0, index_js_2.defineProperties)(this, { - // @ts-ignore - bytecode, - interface: iface, - runner: runner || null, - }); - } - async getDeployTransaction(...args) { - let overrides = {}; - const fragment = this.interface.deploy; - if (fragment.inputs.length + 1 === args.length) { - overrides = await (0, contract_js_1.copyOverrides)(args.pop()); - } - if (fragment.inputs.length !== args.length) { - throw new Error("incorrect number of arguments to constructor"); - } - const resolvedArgs = await (0, contract_js_1.resolveArgs)(this.runner, fragment.inputs, args); - const data = (0, index_js_2.concat)([ - this.bytecode, - this.interface.encodeDeploy(resolvedArgs), - ]); - return Object.assign({}, overrides, { data }); - } - async deploy(...args) { - const tx = await this.getDeployTransaction(...args); - (0, index_js_2.assert)(this.runner && typeof this.runner.sendTransaction === "function", "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", { - operation: "sendTransaction", - }); - const sentTx = await this.runner.sendTransaction(tx); - const address = (0, contract_address_js_1.getCreateAddress)(sentTx); - return new contract_js_1.BaseContract(address, this.interface, this.runner, sentTx); - } - connect(runner) { - return new ContractFactory(this.interface, this.bytecode, runner); - } - static fromSolidity(output, runner) { - (0, index_js_2.assertArgument)(output != null, "bad compiler output", "output", output); - if (typeof output === "string") { - output = JSON.parse(output); - } - const abi = output.abi; - let bytecode = ""; - if (output.bytecode) { - bytecode = output.bytecode; - } - else if (output.evm && output.evm.bytecode) { - bytecode = output.evm.bytecode; - } - return new this(abi, bytecode, runner); - } -} -exports.ContractFactory = ContractFactory; -//# sourceMappingURL=factory.js.map \ No newline at end of file diff --git a/lib.commonjs/contract/factory.js.map b/lib.commonjs/contract/factory.js.map deleted file mode 100644 index 00a14902b..000000000 --- a/lib.commonjs/contract/factory.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src.ts/contract/factory.ts"],"names":[],"mappings":";;;AAAA,8CAA4C;AAC5C,wEAAkE;AAClE,gDAO2B;AAE3B,+CAAyE;AAYzE,8CAA2C;AAE3C,mCAAmC;AACnC,sCAAsC;AACtC,MAAa,eAAe;IAIjB,SAAS,CAAa;IACtB,QAAQ,CAAU;IAClB,MAAM,CAAyB;IAExC,YACE,GAA6B,EAC7B,QAAwC,EACxC,MAA8B;QAE9B,MAAM,KAAK,GAAG,oBAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAElC,wEAAwE;QACxE,IAAI,QAAQ,YAAY,UAAU,EAAE;YAClC,QAAQ,GAAG,IAAA,kBAAO,EAAC,IAAA,mBAAQ,EAAC,QAAQ,CAAC,CAAC,CAAC;SACxC;aAAM,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;YACvC,QA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AM,CAAC,GAAG,CAAC,QAAQ,EAAE;YAC5C,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;SAChC;QAED,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;CACF;AAjHD,0CAiHC"} \ No newline at end of file diff --git a/lib.commonjs/contract/index.d.ts b/lib.commonjs/contract/index.d.ts deleted file mode 100644 index 8be93dacb..000000000 --- a/lib.commonjs/contract/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * About contracts... - * - * @_section: api/contract:Contracts [about-contracts] - */ -export { BaseContract, Contract } from "./contract.js"; -export { ContractFactory } from "./factory.js"; -export { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, } from "./wrappers.js"; -export type { BaseContractMethod, ConstantContractMethod, PostfixOverrides, ContractEvent, ContractEventArgs, ContractEventName, ContractDeployTransaction, ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, DeferredTopicFilter, Overrides, WrappedFallback, } from "./types.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/contract/index.d.ts.map b/lib.commonjs/contract/index.d.ts.map deleted file mode 100644 index ce8d05bb5..000000000 --- a/lib.commonjs/contract/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,EACzB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,SAAS,EACT,eAAe,GAChB,MAAM,YAAY,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/contract/index.js b/lib.commonjs/contract/index.js deleted file mode 100644 index 9c890164c..000000000 --- a/lib.commonjs/contract/index.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EventLog = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractUnknownEventPayload = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = void 0; -/** - * About contracts... - * - * @_section: api/contract:Contracts [about-contracts] - */ -var contract_js_1 = require("./contract.js"); -Object.defineProperty(exports, "BaseContract", { enumerable: true, get: function () { return contract_js_1.BaseContract; } }); -Object.defineProperty(exports, "Contract", { enumerable: true, get: function () { return contract_js_1.Contract; } }); -var factory_js_1 = require("./factory.js"); -Object.defineProperty(exports, "ContractFactory", { enumerable: true, get: function () { return factory_js_1.ContractFactory; } }); -var wrappers_js_1 = require("./wrappers.js"); -Object.defineProperty(exports, "ContractEventPayload", { enumerable: true, get: function () { return wrappers_js_1.ContractEventPayload; } }); -Object.defineProperty(exports, "ContractUnknownEventPayload", { enumerable: true, get: function () { return wrappers_js_1.ContractUnknownEventPayload; } }); -Object.defineProperty(exports, "ContractTransactionReceipt", { enumerable: true, get: function () { return wrappers_js_1.ContractTransactionReceipt; } }); -Object.defineProperty(exports, "ContractTransactionResponse", { enumerable: true, get: function () { return wrappers_js_1.ContractTransactionResponse; } }); -Object.defineProperty(exports, "EventLog", { enumerable: true, get: function () { return wrappers_js_1.EventLog; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.commonjs/contract/index.js.map b/lib.commonjs/contract/index.js.map deleted file mode 100644 index 68b5e2805..000000000 --- a/lib.commonjs/contract/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,6CAAuD;AAA9C,2GAAA,YAAY,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAE/B,2CAA+C;AAAtC,6GAAA,eAAe,OAAA;AAExB,6CAMuB;AALrB,mHAAA,oBAAoB,OAAA;AACpB,0HAAA,2BAA2B,OAAA;AAC3B,yHAAA,0BAA0B,OAAA;AAC1B,0HAAA,2BAA2B,OAAA;AAC3B,uGAAA,QAAQ,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/contract/types.d.ts b/lib.commonjs/contract/types.d.ts deleted file mode 100644 index cf836c128..000000000 --- a/lib.commonjs/contract/types.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -import type { EventFragment, FunctionFragment, Result, Typed } from "../abi/index.js"; -import type { TransactionRequest, PreparedTransactionRequest, TopicFilter } from "../providers/index.js"; -import type { ContractTransactionResponse } from "./wrappers.js"; -export type ContractEventName = string | ContractEvent | TopicFilter | DeferredTopicFilter; -export interface ContractInterface { - [name: string]: BaseContractMethod; -} -export interface DeferredTopicFilter { - getTopicFilter(): Promise; - fragment: EventFragment; -} -export interface ContractTransaction extends PreparedTransactionRequest { - to: string; - data: string; - from?: string; -} -export interface ContractDeployTransaction extends Omit { -} -export interface Overrides extends Omit { -} -export type PostfixOverrides> = A | [...A, Overrides]; -export type ContractMethodArgs> = PostfixOverrides<{ - [I in keyof A]-?: A[I] | Typed; -}>; -export interface BaseContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { - (...args: ContractMethodArgs): Promise; - name: string; - fragment: FunctionFragment; - getFragment(...args: ContractMethodArgs): FunctionFragment; - populateTransaction(...args: ContractMethodArgs): Promise; - staticCall(...args: ContractMethodArgs): Promise; - send(...args: ContractMethodArgs): Promise; - estimateEnergy(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; -} -export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> extends BaseContractMethod { -} -export interface ConstantContractMethod, R = any> extends ContractMethod { -} -export type ContractEventArgs> = { - [I in keyof A]?: A[I] | Typed | null; -}; -export interface ContractEvent = Array> { - (...args: ContractEventArgs): DeferredTopicFilter; - name: string; - fragment: EventFragment; - getFragment(...args: ContractEventArgs): EventFragment; -} -export interface WrappedFallback { - (overrides?: Omit): Promise; - populateTransaction(overrides?: Omit): Promise; - staticCall(overrides?: Omit): Promise; - send(overrides?: Omit): Promise; - estimateEnergy(overrides?: Omit): Promise; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/contract/types.d.ts.map b/lib.commonjs/contract/types.d.ts.map deleted file mode 100644 index d0dd8e022..000000000 --- a/lib.commonjs/contract/types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src.ts/contract/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,KAAK,EACN,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAGjE,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,aAAa,GACb,WAAW,GACX,mBAAmB,CAAC;AAExB,MAAM,WAAW,iBAAiB;IAChC,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACpC;AAED,MAAM,WAAW,mBAAmB;IAClC,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,mBAAoB,SAAQ,0BAA0B;IAErE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;I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B,EAAE,IAAI,CAAC,GACzC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAExC,mBAAmB,CACjB,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GACzC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChC,UAAU,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxE,IAAI,CACF,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GACzC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACxC,cAAc,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7E"} \ No newline at end of file diff --git a/lib.commonjs/contract/types.js b/lib.commonjs/contract/types.js deleted file mode 100644 index 11e638d1e..000000000 --- a/lib.commonjs/contract/types.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/lib.commonjs/contract/types.js.map b/lib.commonjs/contract/types.js.map deleted file mode 100644 index 595591811..000000000 --- a/lib.commonjs/contract/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src.ts/contract/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.commonjs/contract/wrappers.d.ts b/lib.commonjs/contract/wrappers.d.ts deleted file mode 100644 index 184e06900..000000000 --- a/lib.commonjs/contract/wrappers.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Block, Log, TransactionReceipt, TransactionResponse } from "../providers/provider.js"; -import { EventPayload } from "../utils/index.js"; -import type { EventFragment, Interface, Result } from "../abi/index.js"; -import type { Listener } from "../utils/index.js"; -import type { Provider } from "../providers/index.js"; -import type { BaseContract } from "./contract.js"; -import type { ContractEventName } from "./types.js"; -export declare class EventLog extends Log { - readonly interface: Interface; - readonly fragment: EventFragment; - readonly args: Result; - constructor(log: Log, iface: Interface, fragment: EventFragment); - get eventName(): string; - get eventSignature(): string; -} -export declare class ContractTransactionReceipt extends TransactionReceipt { - #private; - constructor(iface: Interface, provider: Provider, tx: TransactionReceipt); - get logs(): Array; -} -export declare class ContractTransactionResponse extends TransactionResponse { - #private; - constructor(iface: Interface, provider: Provider, tx: TransactionResponse); - wait(confirms?: number): Promise; -} -export declare class ContractUnknownEventPayload extends EventPayload { - readonly log: Log; - constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, log: Log); - getBlock(): Promise; - getTransaction(): Promise; - getTransactionReceipt(): Promise; -} -export declare class ContractEventPayload extends ContractUnknownEventPayload { - readonly fragment: EventFragment; - readonly log: EventLog; - readonly args: Result; - constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, fragment: EventFragment, _log: Log); - get eventName(): string; - get eventSignature(): string; -} -//# sourceMappingURL=wrappers.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/contract/wrappers.d.ts.map b/lib.commonjs/contract/wrappers.d.ts.map deleted file mode 100644 index aa2542479..000000000 --- a/lib.commonjs/contract/wrappers.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wrappers.d.ts","sourceRoot":"","sources":["../../src.ts/contract/wrappers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,GAAG,EACH,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAoB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,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Q,EAAE,aAAa,CAAC;IACzC,SAAiB,GAAG,EAAE,QAAQ,CAAC;IAC/B,SAAiB,IAAI,EAAE,MAAM,CAAC;gBAG5B,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,IAAI,GAAG,QAAQ,EACzB,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,GAAG;IAgBX,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,cAAc,IAAI,MAAM,CAE3B;CACF"} \ No newline at end of file diff --git a/lib.commonjs/contract/wrappers.js b/lib.commonjs/contract/wrappers.js deleted file mode 100644 index df5640b3b..000000000 --- a/lib.commonjs/contract/wrappers.js +++ /dev/null @@ -1,90 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ContractEventPayload = exports.ContractUnknownEventPayload = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.EventLog = void 0; -const provider_js_1 = require("../providers/provider.js"); -const index_js_1 = require("../utils/index.js"); -class EventLog extends provider_js_1.Log { - interface; - fragment; - args; - constructor(log, iface, fragment) { - super(log, log.provider); - const args = iface.decodeEventLog(fragment, log.data, log.topics); - (0, index_js_1.defineProperties)(this, { args, fragment, interface: iface }); - } - get eventName() { - return this.fragment.name; - } - get eventSignature() { - return this.fragment.format(); - } -} -exports.EventLog = EventLog; -class ContractTransactionReceipt extends provider_js_1.TransactionReceipt { - #iface; - constructor(iface, provider, tx) { - super(tx, provider); - this.#iface = iface; - } - get logs() { - return super.logs.map((log) => { - const fragment = log.topics.length - ? this.#iface.getEvent(log.topics[0]) - : null; - if (fragment) { - return new EventLog(log, this.#iface, fragment); - } - else { - return log; - } - }); - } -} -exports.ContractTransactionReceipt = ContractTransactionReceipt; -class ContractTransactionResponse extends provider_js_1.TransactionResponse { - #iface; - constructor(iface, provider, tx) { - super(tx, provider); - this.#iface = iface; - } - async wait(confirms) { - const receipt = await super.wait(); - if (receipt == null) { - return null; - } - return new ContractTransactionReceipt(this.#iface, this.provider, receipt); - } -} -exports.ContractTransactionResponse = ContractTransactionResponse; -class ContractUnknownEventPayload extends index_js_1.EventPayload { - log; - constructor(contract, listener, filter, log) { - super(contract, listener, filter); - (0, index_js_1.defineProperties)(this, { log }); - } - async getBlock() { - return await this.log.getBlock(); - } - async getTransaction() { - return await this.log.getTransaction(); - } - async getTransactionReceipt() { - return await this.log.getTransactionReceipt(); - } -} -exports.ContractUnknownEventPayload = ContractUnknownEventPayload; -class ContractEventPayload extends ContractUnknownEventPayload { - constructor(contract, listener, filter, fragment, _log) { - super(contract, listener, filter, new EventLog(_log, contract.interface, fragment)); - const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics); - (0, index_js_1.defineProperties)(this, { args, fragment }); - } - get eventName() { - return this.fragment.name; - } - get eventSignature() { - return this.fragment.format(); - } -} -exports.ContractEventPayload = ContractEventPayload; -//# sourceMappingURL=wrappers.js.map \ No newline at end of file diff --git a/lib.commonjs/contract/wrappers.js.map b/lib.commonjs/contract/wrappers.js.map deleted file mode 100644 index 818df92c7..000000000 --- a/lib.commonjs/contract/wrappers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wrappers.js","sourceRoot":"","sources":["../../src.ts/contract/wrappers.ts"],"names":[],"mappings":";;;AAAA,0DAKkC;AAClC,gDAAmE;AASnE,MAAa,QAAS,SAAQ,iBAAG;IACtB,SAAS,CAAa;IACtB,QAAQ,CAAiB;IACzB,IAAI,CAAU;IAEvB,YAAY,GAAQ,EAAE,KAAgB,EAAE,QAAuB;QAC7D,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACzB,MAAM,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QAClE,IAAA,2BAAgB,EAAW,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAA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OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IAChC,CAAC;CACF;AAjCD,oDAiCC"} \ No newline at end of file diff --git a/lib.commonjs/corebc.d.ts b/lib.commonjs/corebc.d.ts deleted file mode 100644 index 04ae175d8..000000000 --- a/lib.commonjs/corebc.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -export { version } from "./_version.js"; -export { publicToAddress } from "./transaction/address.js"; -export { decodeBytes32String, encodeBytes32String, AbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FallbackFragment, FunctionFragment, NamedFragment, ParamType, StructFragment, checkResultErrors, ErrorDescription, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from "./abi/index.js"; -export { getAddress, networkIdToPrefix } from "./address/index.js"; -export { getCreate2Address, getCreateAddress, } from "./address/contract-address.js"; -export { isAddressable, isAddress, resolveAddress } from "./address/checks.js"; -export { ZeroAddress, OrePerXCB, MaxUint256, MinInt256, MaxInt256, N, ZeroHash, CoreSymbol, MessagePrefix, } from "./constants/index.js"; -export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, EventLog, } from "./contract/index.js"; -export { computeHmac, randomBytes, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Ed448Goldilock, Signature, SigningKey, keccak256, } from "./crypto/index.js"; -export { id, hashMessage, verifyMessage, solidityPacked, solidityPackedSha256, TypedDataEncoder, verifyTypedData, } from "./hash/index.js"; -export { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, NonceManager, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, CloudflareProvider, InfuraProvider, InfuraWebSocketProvider, PocketProvider, QuickNodeProvider, IpcSocketProvider, SocketProvider, WebSocketProvider, Network, FeeDataNetworkPlugin, EnergyCostPlugin, NetworkPlugin, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketSubscriber, UnmanagedSubscriber, copyRequest, showThrottleMessage, } from "./providers/index.js"; -export { accessListify, computeAddress, recoverAddress, Transaction, } from "./transaction/index.js"; -export { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, resolveProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, EventPayload, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatXCB, parseXCB, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp, uuidV4, arrayify, hexConcat, } from "./utils/index.js"; -export { Mnemonic, BaseWallet, HDNodeWallet, Wallet, defaultPath, getAccountPath, getIndexedAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./wallet/index.js"; -export { BigNumber } from "./bigNumber/bigNumber.js"; -export { Wordlist, LangEn, WordlistOwl, WordlistOwlA, wordlists, } from "./wordlists/index.js"; -export type { JsonFragment, JsonFragmentType, FormatType, FragmentType, InterfaceAbi, ParamTypeWalkFunc, ParamTypeWalkAsyncFunc, } from "./abi/index.js"; -export type { Addressable, AddressLike, NameResolver, } from "./address/index.js"; -export type { ConstantContractMethod, ContractEvent, ContractEventArgs, ContractEventName, ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, DeferredTopicFilter, Overrides, BaseContractMethod, ContractDeployTransaction, PostfixOverrides, WrappedFallback, } from "./contract/index.js"; -export type { ProgressCallback, SignatureLike } from "./crypto/index.js"; -export type { TypedDataDomain, TypedDataField } from "./hash/index.js"; -export type { Provider, Signer, AbstractProviderPlugin, BlockParams, BlockTag, ContractRunner, DebugEventBrowserProvider, Eip1193Provider, EventFilter, Filter, FilterByBlockHash, EnergyCostParameters, JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcTransactionRequest, LogParams, MinedBlock, MinedTransactionResponse, Networkish, OrphanFilter, PerformActionFilter, PerformActionRequest, PerformActionTransaction, PreparedTransactionRequest, ProviderEvent, Subscriber, Subscription, TopicFilter, TransactionReceiptParams, TransactionRequest, TransactionResponseParams, WebSocketCreator, WebSocketLike, } from "./providers/index.js"; -export type { AccessList, AccessListish, AccessListEntry, TransactionLike, } from "./transaction/index.js"; -export type { BytesLike, BigNumberish, Numeric, ErrorCode, FixedFormat, Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, RlpStructuredData, GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc, CoreBCError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CodedCoreBCError, CallExceptionAction, CallExceptionTransaction, EventEmitterable, Listener, } from "./utils/index.js"; -export type { CrowdsaleAccount, KeystoreAccount, EncryptOptions, } from "./wallet/index.js"; -//# sourceMappingURL=corebc.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/corebc.d.ts.map b/lib.commonjs/corebc.d.ts.map deleted file mode 100644 index d023fbd11..000000000 --- a/lib.commonjs/corebc.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"corebc.d.ts","sourceRoot":"","sources":["../src.ts/coreb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B,EAC1B,aAAa,EACb,UAAU,EACV,YAAY,EACZ,WAAW,EACX,wBAAwB,EACxB,kBAAkB,EAClB,yBAAyB,EACzB,gBAAgB,EAChB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,UAAU,EACV,aAAa,EACb,eAAe,EACf,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACV,SAAS,EACT,YAAY,EACZ,OAAO,EACP,SAAS,EACT,WAAW,EACX,aAAa,EACb,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,mBAAmB,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/corebc.js b/lib.commonjs/corebc.js deleted file mode 100644 index 5f41c1d4a..000000000 --- a/lib.commonjs/corebc.js +++ /dev/null @@ -1,203 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.sha256 = exports.ripemd160 = exports.randomBytes = exports.computeHmac = exports.EventLog = exports.ContractUnknownEventPayload = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = exports.MessagePrefix = exports.CoreSymbol = exports.ZeroHash = exports.N = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.OrePerXCB = exports.ZeroAddress = exports.resolveAddress = exports.isAddress = exports.isAddressable = exports.getCreateAddress = exports.getCreate2Address = exports.networkIdToPrefix = exports.getAddress = exports.Typed = exports.TransactionDescription = exports.Result = exports.LogDescription = exports.Interface = exports.Indexed = exports.ErrorDescription = exports.checkResultErrors = exports.StructFragment = exports.ParamType = exports.NamedFragment = exports.FunctionFragment = exports.FallbackFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.AbiCoder = exports.encodeBytes32String = exports.decodeBytes32String = exports.publicToAddress = exports.version = void 0; -exports.UnmanagedSubscriber = exports.SocketSubscriber = exports.SocketPendingSubscriber = exports.SocketEventSubscriber = exports.SocketBlockSubscriber = exports.NetworkPlugin = exports.EnergyCostPlugin = exports.FeeDataNetworkPlugin = exports.Network = exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.QuickNodeProvider = exports.PocketProvider = exports.InfuraWebSocketProvider = exports.InfuraProvider = exports.CloudflareProvider = exports.AnkrProvider = exports.AlchemyProvider = exports.BrowserProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.AbstractProvider = exports.VoidSigner = exports.NonceManager = exports.AbstractSigner = exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.FeeData = exports.Block = exports.getDefaultProvider = exports.verifyTypedData = exports.TypedDataEncoder = exports.solidityPackedSha256 = exports.solidityPacked = exports.verifyMessage = exports.hashMessage = exports.id = exports.keccak256 = exports.SigningKey = exports.Signature = exports.Ed448Goldilock = exports.lock = exports.scryptSync = exports.scrypt = exports.pbkdf2 = exports.sha512 = void 0; -exports.formatUnits = exports.parseXCB = exports.formatXCB = exports.mask = exports.toTwos = exports.fromTwos = exports.toQuantity = exports.toNumber = exports.toBeHex = exports.toBigInt = exports.toBeArray = exports.getUint = exports.getNumber = exports.getBigInt = exports.FixedNumber = exports.FetchCancelSignal = exports.FetchResponse = exports.FetchRequest = exports.EventPayload = exports.isError = exports.isCallException = exports.makeError = exports.assertPrivate = exports.assertNormalize = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.resolveProperties = exports.defineProperties = exports.zeroPadValue = exports.zeroPadBytes = exports.stripZerosLeft = exports.isBytesLike = exports.isHexString = exports.hexlify = exports.getBytesCopy = exports.getBytes = exports.dataSlice = exports.dataLength = exports.concat = exports.encodeBase64 = exports.decodeBase64 = exports.encodeBase58 = exports.decodeBase58 = exports.Transaction = exports.recoverAddress = exports.computeAddress = exports.accessListify = exports.showThrottleMessage = exports.copyRequest = void 0; -exports.wordlists = exports.WordlistOwlA = exports.WordlistOwl = exports.LangEn = exports.Wordlist = exports.BigNumber = exports.encryptKeystoreJsonSync = exports.encryptKeystoreJson = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.decryptCrowdsaleJson = exports.isKeystoreJson = exports.isCrowdsaleJson = exports.getIndexedAccountPath = exports.getAccountPath = exports.defaultPath = exports.Wallet = exports.HDNodeWallet = exports.BaseWallet = exports.Mnemonic = exports.hexConcat = exports.arrayify = exports.uuidV4 = exports.encodeRlp = exports.decodeRlp = exports.Utf8ErrorFuncs = exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports.parseUnits = void 0; -var _version_js_1 = require("./_version.js"); -Object.defineProperty(exports, "version", { enumerable: true, get: function () { return _version_js_1.version; } }); -var address_js_1 = require("./transaction/address.js"); -Object.defineProperty(exports, "publicToAddress", { enumerable: true, get: function () { return address_js_1.publicToAddress; } }); -var index_js_1 = require("./abi/index.js"); -Object.defineProperty(exports, "decodeBytes32String", { enumerable: true, get: function () { return index_js_1.decodeBytes32String; } }); -Object.defineProperty(exports, "encodeBytes32String", { enumerable: true, get: function () { return index_js_1.encodeBytes32String; } }); -Object.defineProperty(exports, "AbiCoder", { enumerable: true, get: function () { return index_js_1.AbiCoder; } }); -Object.defineProperty(exports, "ConstructorFragment", { enumerable: true, get: function () { return index_js_1.ConstructorFragment; } }); -Object.defineProperty(exports, "ErrorFragment", { enumerable: true, get: function () { return index_js_1.ErrorFragment; } }); -Object.defineProperty(exports, "EventFragment", { enumerable: true, get: function () { return index_js_1.EventFragment; } }); -Object.defineProperty(exports, "Fragment", { enumerable: true, get: function () { return index_js_1.Fragment; } }); -Object.defineProperty(exports, "FallbackFragment", { enumerable: true, get: function () { return index_js_1.FallbackFragment; } }); -Object.defineProperty(exports, "FunctionFragment", { enumerable: true, get: function () { return index_js_1.FunctionFragment; } }); -Object.defineProperty(exports, "NamedFragment", { enumerable: true, get: function () { return index_js_1.NamedFragment; } }); -Object.defineProperty(exports, "ParamType", { enumerable: true, get: function () { return index_js_1.ParamType; } }); -Object.defineProperty(exports, "StructFragment", { enumerable: true, get: function () { return index_js_1.StructFragment; } }); -Object.defineProperty(exports, "checkResultErrors", { enumerable: true, get: function () { return index_js_1.checkResultErrors; } }); -Object.defineProperty(exports, "ErrorDescription", { enumerable: true, get: function () { return index_js_1.ErrorDescription; } }); -Object.defineProperty(exports, "Indexed", { enumerable: true, get: function () { return index_js_1.Indexed; } }); -Object.defineProperty(exports, "Interface", { enumerable: true, get: function () { return index_js_1.Interface; } }); -Object.defineProperty(exports, "LogDescription", { enumerable: true, get: function () { return index_js_1.LogDescription; } }); -Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return index_js_1.Result; } }); -Object.defineProperty(exports, "TransactionDescription", { enumerable: true, get: function () { return index_js_1.TransactionDescription; } }); -Object.defineProperty(exports, "Typed", { enumerable: true, get: function () { return index_js_1.Typed; } }); -var index_js_2 = require("./address/index.js"); -Object.defineProperty(exports, "getAddress", { enumerable: true, get: function () { return index_js_2.getAddress; } }); -Object.defineProperty(exports, "networkIdToPrefix", { enumerable: true, get: function () { return index_js_2.networkIdToPrefix; } }); -var contract_address_js_1 = require("./address/contract-address.js"); -Object.defineProperty(exports, "getCreate2Address", { enumerable: true, get: function () { return contract_address_js_1.getCreate2Address; } }); -Object.defineProperty(exports, "getCreateAddress", { enumerable: true, get: function () { return contract_address_js_1.getCreateAddress; } }); -var checks_js_1 = require("./address/checks.js"); -Object.defineProperty(exports, "isAddressable", { enumerable: true, get: function () { return checks_js_1.isAddressable; } }); -Object.defineProperty(exports, "isAddress", { enumerable: true, get: function () { return checks_js_1.isAddress; } }); -Object.defineProperty(exports, "resolveAddress", { enumerable: true, get: function () { return checks_js_1.resolveAddress; } }); -var index_js_3 = require("./constants/index.js"); -Object.defineProperty(exports, "ZeroAddress", { enumerable: true, get: function () { return index_js_3.ZeroAddress; } }); -Object.defineProperty(exports, "OrePerXCB", { enumerable: true, get: function () { return index_js_3.OrePerXCB; } }); -Object.defineProperty(exports, "MaxUint256", { enumerable: true, get: function () { return index_js_3.MaxUint256; } }); -Object.defineProperty(exports, "MinInt256", { enumerable: true, get: function () { return index_js_3.MinInt256; } }); -Object.defineProperty(exports, "MaxInt256", { enumerable: true, get: function () { return index_js_3.MaxInt256; } }); -Object.defineProperty(exports, "N", { enumerable: true, get: function () { return index_js_3.N; } }); -Object.defineProperty(exports, "ZeroHash", { enumerable: true, get: function () { return index_js_3.ZeroHash; } }); -Object.defineProperty(exports, "CoreSymbol", { enumerable: true, get: function () { return index_js_3.CoreSymbol; } }); -Object.defineProperty(exports, "MessagePrefix", { enumerable: true, get: function () { return index_js_3.MessagePrefix; } }); -var index_js_4 = require("./contract/index.js"); -Object.defineProperty(exports, "BaseContract", { enumerable: true, get: function () { return index_js_4.BaseContract; } }); -Object.defineProperty(exports, "Contract", { enumerable: true, get: function () { return index_js_4.Contract; } }); -Object.defineProperty(exports, "ContractFactory", { enumerable: true, get: function () { return index_js_4.ContractFactory; } }); -Object.defineProperty(exports, "ContractEventPayload", { enumerable: true, get: function () { return index_js_4.ContractEventPayload; } }); -Object.defineProperty(exports, "ContractTransactionReceipt", { enumerable: true, get: function () { return index_js_4.ContractTransactionReceipt; } }); -Object.defineProperty(exports, "ContractTransactionResponse", { enumerable: true, get: function () { return index_js_4.ContractTransactionResponse; } }); -Object.defineProperty(exports, "ContractUnknownEventPayload", { enumerable: true, get: function () { return index_js_4.ContractUnknownEventPayload; } }); -Object.defineProperty(exports, "EventLog", { enumerable: true, get: function () { return index_js_4.EventLog; } }); -var index_js_5 = require("./crypto/index.js"); -Object.defineProperty(exports, "computeHmac", { enumerable: true, get: function () { return index_js_5.computeHmac; } }); -Object.defineProperty(exports, "randomBytes", { enumerable: true, get: function () { return index_js_5.randomBytes; } }); -Object.defineProperty(exports, "ripemd160", { enumerable: true, get: function () { return index_js_5.ripemd160; } }); -Object.defineProperty(exports, "sha256", { enumerable: true, get: function () { return index_js_5.sha256; } }); -Object.defineProperty(exports, "sha512", { enumerable: true, get: function () { return index_js_5.sha512; } }); -Object.defineProperty(exports, "pbkdf2", { enumerable: true, get: function () { return index_js_5.pbkdf2; } }); -Object.defineProperty(exports, "scrypt", { enumerable: true, get: function () { return index_js_5.scrypt; } }); -Object.defineProperty(exports, "scryptSync", { enumerable: true, get: function () { return index_js_5.scryptSync; } }); -Object.defineProperty(exports, "lock", { enumerable: true, get: function () { return index_js_5.lock; } }); -Object.defineProperty(exports, "Ed448Goldilock", { enumerable: true, get: function () { return index_js_5.Ed448Goldilock; } }); -Object.defineProperty(exports, "Signature", { enumerable: true, get: function () { return index_js_5.Signature; } }); -Object.defineProperty(exports, "SigningKey", { enumerable: true, get: function () { return index_js_5.SigningKey; } }); -Object.defineProperty(exports, "keccak256", { enumerable: true, get: function () { return index_js_5.keccak256; } }); -var index_js_6 = require("./hash/index.js"); -Object.defineProperty(exports, "id", { enumerable: true, get: function () { return index_js_6.id; } }); -Object.defineProperty(exports, "hashMessage", { enumerable: true, get: function () { return index_js_6.hashMessage; } }); -Object.defineProperty(exports, "verifyMessage", { enumerable: true, get: function () { return index_js_6.verifyMessage; } }); -Object.defineProperty(exports, "solidityPacked", { enumerable: true, get: function () { return index_js_6.solidityPacked; } }); -Object.defineProperty(exports, "solidityPackedSha256", { enumerable: true, get: function () { return index_js_6.solidityPackedSha256; } }); -Object.defineProperty(exports, "TypedDataEncoder", { enumerable: true, get: function () { return index_js_6.TypedDataEncoder; } }); -Object.defineProperty(exports, "verifyTypedData", { enumerable: true, get: function () { return index_js_6.verifyTypedData; } }); -var index_js_7 = require("./providers/index.js"); -Object.defineProperty(exports, "getDefaultProvider", { enumerable: true, get: function () { return index_js_7.getDefaultProvider; } }); -Object.defineProperty(exports, "Block", { enumerable: true, get: function () { return index_js_7.Block; } }); -Object.defineProperty(exports, "FeeData", { enumerable: true, get: function () { return index_js_7.FeeData; } }); -Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return index_js_7.Log; } }); -Object.defineProperty(exports, "TransactionReceipt", { enumerable: true, get: function () { return index_js_7.TransactionReceipt; } }); -Object.defineProperty(exports, "TransactionResponse", { enumerable: true, get: function () { return index_js_7.TransactionResponse; } }); -Object.defineProperty(exports, "AbstractSigner", { enumerable: true, get: function () { return index_js_7.AbstractSigner; } }); -Object.defineProperty(exports, "NonceManager", { enumerable: true, get: function () { return index_js_7.NonceManager; } }); -Object.defineProperty(exports, "VoidSigner", { enumerable: true, get: function () { return index_js_7.VoidSigner; } }); -Object.defineProperty(exports, "AbstractProvider", { enumerable: true, get: function () { return index_js_7.AbstractProvider; } }); -Object.defineProperty(exports, "FallbackProvider", { enumerable: true, get: function () { return index_js_7.FallbackProvider; } }); -Object.defineProperty(exports, "JsonRpcApiProvider", { enumerable: true, get: function () { return index_js_7.JsonRpcApiProvider; } }); -Object.defineProperty(exports, "JsonRpcProvider", { enumerable: true, get: function () { return index_js_7.JsonRpcProvider; } }); -Object.defineProperty(exports, "JsonRpcSigner", { enumerable: true, get: function () { return index_js_7.JsonRpcSigner; } }); -Object.defineProperty(exports, "BrowserProvider", { enumerable: true, get: function () { return index_js_7.BrowserProvider; } }); -Object.defineProperty(exports, "AlchemyProvider", { enumerable: true, get: function () { return index_js_7.AlchemyProvider; } }); -Object.defineProperty(exports, "AnkrProvider", { enumerable: true, get: function () { return index_js_7.AnkrProvider; } }); -Object.defineProperty(exports, "CloudflareProvider", { enumerable: true, get: function () { return index_js_7.CloudflareProvider; } }); -Object.defineProperty(exports, "InfuraProvider", { enumerable: true, get: function () { return index_js_7.InfuraProvider; } }); -Object.defineProperty(exports, "InfuraWebSocketProvider", { enumerable: true, get: function () { return index_js_7.InfuraWebSocketProvider; } }); -Object.defineProperty(exports, "PocketProvider", { enumerable: true, get: function () { return index_js_7.PocketProvider; } }); -Object.defineProperty(exports, "QuickNodeProvider", { enumerable: true, get: function () { return index_js_7.QuickNodeProvider; } }); -Object.defineProperty(exports, "IpcSocketProvider", { enumerable: true, get: function () { return index_js_7.IpcSocketProvider; } }); -Object.defineProperty(exports, "SocketProvider", { enumerable: true, get: function () { return index_js_7.SocketProvider; } }); -Object.defineProperty(exports, "WebSocketProvider", { enumerable: true, get: function () { return index_js_7.WebSocketProvider; } }); -Object.defineProperty(exports, "Network", { enumerable: true, get: function () { return index_js_7.Network; } }); -Object.defineProperty(exports, "FeeDataNetworkPlugin", { enumerable: true, get: function () { return index_js_7.FeeDataNetworkPlugin; } }); -Object.defineProperty(exports, "EnergyCostPlugin", { enumerable: true, get: function () { return index_js_7.EnergyCostPlugin; } }); -Object.defineProperty(exports, "NetworkPlugin", { enumerable: true, get: function () { return index_js_7.NetworkPlugin; } }); -Object.defineProperty(exports, "SocketBlockSubscriber", { enumerable: true, get: function () { return index_js_7.SocketBlockSubscriber; } }); -Object.defineProperty(exports, "SocketEventSubscriber", { enumerable: true, get: function () { return index_js_7.SocketEventSubscriber; } }); -Object.defineProperty(exports, "SocketPendingSubscriber", { enumerable: true, get: function () { return index_js_7.SocketPendingSubscriber; } }); -Object.defineProperty(exports, "SocketSubscriber", { enumerable: true, get: function () { return index_js_7.SocketSubscriber; } }); -Object.defineProperty(exports, "UnmanagedSubscriber", { enumerable: true, get: function () { return index_js_7.UnmanagedSubscriber; } }); -Object.defineProperty(exports, "copyRequest", { enumerable: true, get: function () { return index_js_7.copyRequest; } }); -Object.defineProperty(exports, "showThrottleMessage", { enumerable: true, get: function () { return index_js_7.showThrottleMessage; } }); -var index_js_8 = require("./transaction/index.js"); -Object.defineProperty(exports, "accessListify", { enumerable: true, get: function () { return index_js_8.accessListify; } }); -Object.defineProperty(exports, "computeAddress", { enumerable: true, get: function () { return index_js_8.computeAddress; } }); -Object.defineProperty(exports, "recoverAddress", { enumerable: true, get: function () { return index_js_8.recoverAddress; } }); -Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return index_js_8.Transaction; } }); -var index_js_9 = require("./utils/index.js"); -Object.defineProperty(exports, "decodeBase58", { enumerable: true, get: function () { return index_js_9.decodeBase58; } }); -Object.defineProperty(exports, "encodeBase58", { enumerable: true, get: function () { return index_js_9.encodeBase58; } }); -Object.defineProperty(exports, "decodeBase64", { enumerable: true, get: function () { return index_js_9.decodeBase64; } }); -Object.defineProperty(exports, "encodeBase64", { enumerable: true, get: function () { return index_js_9.encodeBase64; } }); -Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return index_js_9.concat; } }); -Object.defineProperty(exports, "dataLength", { enumerable: true, get: function () { return index_js_9.dataLength; } }); -Object.defineProperty(exports, "dataSlice", { enumerable: true, get: function () { return index_js_9.dataSlice; } }); -Object.defineProperty(exports, "getBytes", { enumerable: true, get: function () { return index_js_9.getBytes; } }); -Object.defineProperty(exports, "getBytesCopy", { enumerable: true, get: function () { return index_js_9.getBytesCopy; } }); -Object.defineProperty(exports, "hexlify", { enumerable: true, get: function () { return index_js_9.hexlify; } }); -Object.defineProperty(exports, "isHexString", { enumerable: true, get: function () { return index_js_9.isHexString; } }); -Object.defineProperty(exports, "isBytesLike", { enumerable: true, get: function () { return index_js_9.isBytesLike; } }); -Object.defineProperty(exports, "stripZerosLeft", { enumerable: true, get: function () { return index_js_9.stripZerosLeft; } }); -Object.defineProperty(exports, "zeroPadBytes", { enumerable: true, get: function () { return index_js_9.zeroPadBytes; } }); -Object.defineProperty(exports, "zeroPadValue", { enumerable: true, get: function () { return index_js_9.zeroPadValue; } }); -Object.defineProperty(exports, "defineProperties", { enumerable: true, get: function () { return index_js_9.defineProperties; } }); -Object.defineProperty(exports, "resolveProperties", { enumerable: true, get: function () { return index_js_9.resolveProperties; } }); -Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return index_js_9.assert; } }); -Object.defineProperty(exports, "assertArgument", { enumerable: true, get: function () { return index_js_9.assertArgument; } }); -Object.defineProperty(exports, "assertArgumentCount", { enumerable: true, get: function () { return index_js_9.assertArgumentCount; } }); -Object.defineProperty(exports, "assertNormalize", { enumerable: true, get: function () { return index_js_9.assertNormalize; } }); -Object.defineProperty(exports, "assertPrivate", { enumerable: true, get: function () { return index_js_9.assertPrivate; } }); -Object.defineProperty(exports, "makeError", { enumerable: true, get: function () { return index_js_9.makeError; } }); -Object.defineProperty(exports, "isCallException", { enumerable: true, get: function () { return index_js_9.isCallException; } }); -Object.defineProperty(exports, "isError", { enumerable: true, get: function () { return index_js_9.isError; } }); -Object.defineProperty(exports, "EventPayload", { enumerable: true, get: function () { return index_js_9.EventPayload; } }); -Object.defineProperty(exports, "FetchRequest", { enumerable: true, get: function () { return index_js_9.FetchRequest; } }); -Object.defineProperty(exports, "FetchResponse", { enumerable: true, get: function () { return index_js_9.FetchResponse; } }); -Object.defineProperty(exports, "FetchCancelSignal", { enumerable: true, get: function () { return index_js_9.FetchCancelSignal; } }); -Object.defineProperty(exports, "FixedNumber", { enumerable: true, get: function () { return index_js_9.FixedNumber; } }); -Object.defineProperty(exports, "getBigInt", { enumerable: true, get: function () { return index_js_9.getBigInt; } }); -Object.defineProperty(exports, "getNumber", { enumerable: true, get: function () { return index_js_9.getNumber; } }); -Object.defineProperty(exports, "getUint", { enumerable: true, get: function () { return index_js_9.getUint; } }); -Object.defineProperty(exports, "toBeArray", { enumerable: true, get: function () { return index_js_9.toBeArray; } }); -Object.defineProperty(exports, "toBigInt", { enumerable: true, get: function () { return index_js_9.toBigInt; } }); -Object.defineProperty(exports, "toBeHex", { enumerable: true, get: function () { return index_js_9.toBeHex; } }); -Object.defineProperty(exports, "toNumber", { enumerable: true, get: function () { return index_js_9.toNumber; } }); -Object.defineProperty(exports, "toQuantity", { enumerable: true, get: function () { return index_js_9.toQuantity; } }); -Object.defineProperty(exports, "fromTwos", { enumerable: true, get: function () { return index_js_9.fromTwos; } }); -Object.defineProperty(exports, "toTwos", { enumerable: true, get: function () { return index_js_9.toTwos; } }); -Object.defineProperty(exports, "mask", { enumerable: true, get: function () { return index_js_9.mask; } }); -Object.defineProperty(exports, "formatXCB", { enumerable: true, get: function () { return index_js_9.formatXCB; } }); -Object.defineProperty(exports, "parseXCB", { enumerable: true, get: function () { return index_js_9.parseXCB; } }); -Object.defineProperty(exports, "formatUnits", { enumerable: true, get: function () { return index_js_9.formatUnits; } }); -Object.defineProperty(exports, "parseUnits", { enumerable: true, get: function () { return index_js_9.parseUnits; } }); -Object.defineProperty(exports, "toUtf8Bytes", { enumerable: true, get: function () { return index_js_9.toUtf8Bytes; } }); -Object.defineProperty(exports, "toUtf8CodePoints", { enumerable: true, get: function () { return index_js_9.toUtf8CodePoints; } }); -Object.defineProperty(exports, "toUtf8String", { enumerable: true, get: function () { return index_js_9.toUtf8String; } }); -Object.defineProperty(exports, "Utf8ErrorFuncs", { enumerable: true, get: function () { return index_js_9.Utf8ErrorFuncs; } }); -Object.defineProperty(exports, "decodeRlp", { enumerable: true, get: function () { return index_js_9.decodeRlp; } }); -Object.defineProperty(exports, "encodeRlp", { enumerable: true, get: function () { return index_js_9.encodeRlp; } }); -Object.defineProperty(exports, "uuidV4", { enumerable: true, get: function () { return index_js_9.uuidV4; } }); -Object.defineProperty(exports, "arrayify", { enumerable: true, get: function () { return index_js_9.arrayify; } }); -Object.defineProperty(exports, "hexConcat", { enumerable: true, get: function () { return index_js_9.hexConcat; } }); -var index_js_10 = require("./wallet/index.js"); -Object.defineProperty(exports, "Mnemonic", { enumerable: true, get: function () { return index_js_10.Mnemonic; } }); -Object.defineProperty(exports, "BaseWallet", { enumerable: true, get: function () { return index_js_10.BaseWallet; } }); -Object.defineProperty(exports, "HDNodeWallet", { enumerable: true, get: function () { return index_js_10.HDNodeWallet; } }); -Object.defineProperty(exports, "Wallet", { enumerable: true, get: function () { return index_js_10.Wallet; } }); -Object.defineProperty(exports, "defaultPath", { enumerable: true, get: function () { return index_js_10.defaultPath; } }); -Object.defineProperty(exports, "getAccountPath", { enumerable: true, get: function () { return index_js_10.getAccountPath; } }); -Object.defineProperty(exports, "getIndexedAccountPath", { enumerable: true, get: function () { return index_js_10.getIndexedAccountPath; } }); -Object.defineProperty(exports, "isCrowdsaleJson", { enumerable: true, get: function () { return index_js_10.isCrowdsaleJson; } }); -Object.defineProperty(exports, "isKeystoreJson", { enumerable: true, get: function () { return index_js_10.isKeystoreJson; } }); -Object.defineProperty(exports, "decryptCrowdsaleJson", { enumerable: true, get: function () { return index_js_10.decryptCrowdsaleJson; } }); -Object.defineProperty(exports, "decryptKeystoreJsonSync", { enumerable: true, get: function () { return index_js_10.decryptKeystoreJsonSync; } }); -Object.defineProperty(exports, "decryptKeystoreJson", { enumerable: true, get: function () { return index_js_10.decryptKeystoreJson; } }); -Object.defineProperty(exports, "encryptKeystoreJson", { enumerable: true, get: function () { return index_js_10.encryptKeystoreJson; } }); -Object.defineProperty(exports, "encryptKeystoreJsonSync", { enumerable: true, get: function () { return index_js_10.encryptKeystoreJsonSync; } }); -var bigNumber_js_1 = require("./bigNumber/bigNumber.js"); -Object.defineProperty(exports, "BigNumber", { enumerable: true, get: function () { return bigNumber_js_1.BigNumber; } }); -var index_js_11 = require("./wordlists/index.js"); -Object.defineProperty(exports, "Wordlist", { enumerable: true, get: function () { return index_js_11.Wordlist; } }); -Object.defineProperty(exports, "LangEn", { enumerable: true, get: function () { return index_js_11.LangEn; } }); -Object.defineProperty(exports, "WordlistOwl", { enumerable: true, get: function () { return index_js_11.WordlistOwl; } }); -Object.defineProperty(exports, "WordlistOwlA", { enumerable: true, get: function () { return index_js_11.WordlistOwlA; } }); -Object.defineProperty(exports, "wordlists", { enumerable: true, get: function () { return index_js_11.wordlists; } }); -//# sourceMappingURL=corebc.js.map \ No newline at end of file diff --git a/lib.commonjs/corebc.js.map b/lib.commonjs/corebc.js.map deleted file mode 100644 index 0f4909326..000000000 --- a/lib.commonjs/corebc.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"corebc.js","sourceRoot":"","sources":["../src.ts/corebc.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAwC;AAA/B,sGAAA,OAAO,OAAA;AAChB,uDAA2D;AAAlD,6GAAA,eAAe,OAAA;AAExB,2CAqBwB;AApBtB,+GAAA,mBAAmB,OAAA;AACnB,+GAAA,mBAAmB,OAAA;AACnB,oGAAA,QAAQ,OAAA;AACR,+GAAA,mBAAmB,OAAA;AACnB,yGAAA,aAAa,OAAA;AACb,yGAAA,aAAa,OAAA;AACb,oGAAA,QAAQ,OAAA;AACR,4GAAA,gBAAgB,OAAA;AAChB,4GAAA,gBAAgB,OAAA;AAChB,yGAAA,aAAa,OAAA;AACb,qGAAA,SAAS,OAAA;AACT,0GAAA,cAAc,OAAA;AACd,6GAAA,iBAAiB,OAAA;AACjB,4GAAA,gBAAgB,OAAA;AAChB,mGAAA,OAAO,OAAA;AACP,qGAAA,SAAS,OAAA;AACT,0GAAA,cAAc,OAAA;AACd,kGAAA,MAAM,OAAA;AACN,kHAAA,sBAAsB,OAAA;AACtB,iGAAA,KAAK,OAAA;AAGP,+CAAmE;AAA1D,sGAAA,UAAU,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAEtC,qEAGuC;AAFrC,wHAAA,iBAAiB,OAAA;AACjB,uHAAA,gBAAgB,OAAA;AAGlB,iDAA+E;AAAtE,0GAAA,aAAa,OAAA;AAAE,sGAAA,SAAS,OAAA;AAAE,2GAAA,cAAc,OAAA;AAEjD,iDAU8B;AAT5B,uGAAA,WAAW,OAAA;AACX,qGAAA,SAAS,OAAA;AACT,sGA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B,oHAAA,uBAAuB,OAAA;AAGzB,yDAAqD;AAA5C,yGAAA,SAAS,OAAA;AAElB,kDAM8B;AAL5B,qGAAA,QAAQ,OAAA;AACR,mGAAA,MAAM,OAAA;AACN,wGAAA,WAAW,OAAA;AACX,yGAAA,YAAY,OAAA;AACZ,sGAAA,SAAS,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/crypto/browser-ed448.d.ts b/lib.commonjs/crypto/browser-ed448.d.ts deleted file mode 100644 index 7aee3772e..000000000 --- a/lib.commonjs/crypto/browser-ed448.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import ed448 from "bcrypto/lib/ed448-browser.js"; -export default ed448; -//# sourceMappingURL=browser-ed448.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/browser-ed448.d.ts.map b/lib.commonjs/crypto/browser-ed448.d.ts.map deleted file mode 100644 index ac87af8f7..000000000 --- a/lib.commonjs/crypto/browser-ed448.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"browser-ed448.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/browser-ed448.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,8BAA8B,CAAC;AACjD,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/browser-ed448.js b/lib.commonjs/crypto/browser-ed448.js deleted file mode 100644 index 254e69ad2..000000000 --- a/lib.commonjs/crypto/browser-ed448.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -// @ts-ignore -const ed448_browser_js_1 = tslib_1.__importDefault(require("bcrypto/lib/ed448-browser.js")); -exports.default = ed448_browser_js_1.default; -//# sourceMappingURL=browser-ed448.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/browser-ed448.js.map b/lib.commonjs/crypto/browser-ed448.js.map deleted file mode 100644 index fe53b4ee8..000000000 --- a/lib.commonjs/crypto/browser-ed448.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"browser-ed448.js","sourceRoot":"","sources":["../../src.ts/crypto/browser-ed448.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,aAAa;AACb,4FAAiD;AACjD,kBAAe,0BAAK,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/browser-sha3.d.ts b/lib.commonjs/crypto/browser-sha3.d.ts deleted file mode 100644 index 3b83a4fbb..000000000 --- a/lib.commonjs/crypto/browser-sha3.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { BytesLike } from "../utils/data.js"; -import { SupportedAlgorithm } from "./sha3.js"; -export declare function ripemd160(data: BytesLike): string; -export declare function sha256(data: BytesLike): string; -export declare function sha512(data: BytesLike): string; -export declare function computeHmac(algorithm: SupportedAlgorithm, key: BytesLike, data: BytesLike): string; -//# sourceMappingURL=browser-sha3.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/browser-sha3.d.ts.map b/lib.commonjs/crypto/browser-sha3.d.ts.map deleted file mode 100644 index e40fa9ffd..000000000 --- a/lib.commonjs/crypto/browser-sha3.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"browser-sha3.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/browser-sha3.ts"],"names":[],"mappings":"AAQA,OAAO,EAAY,SAAS,EAAW,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAI/C,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAIjD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAI9C;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAI9C;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,kBAAkB,EAC7B,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,SAAS,GACd,MAAM,CAkBR"} \ No newline at end of file diff --git a/lib.commonjs/crypto/browser-sha3.js b/lib.commonjs/crypto/browser-sha3.js deleted file mode 100644 index 3a21eb73f..000000000 --- a/lib.commonjs/crypto/browser-sha3.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.computeHmac = exports.sha512 = exports.sha256 = exports.ripemd160 = void 0; -const tslib_1 = require("tslib"); -// @ts-ignore -const ripemd160_browser_1 = tslib_1.__importDefault(require("bcrypto/lib/ripemd160-browser")); -// @ts-ignore -const sha3_browser_js_1 = tslib_1.__importDefault(require("bcrypto/lib/sha3-browser.js")); -const logger_js_1 = require("../logger/logger.js"); -const data_js_1 = require("../utils/data.js"); -const sha3_js_1 = require("./sha3.js"); -const logger = new logger_js_1.Logger("corebc-crypto/browser-sha3/0.0.1"); -function ripemd160(data) { - const d = Buffer.from((0, data_js_1.arrayify)(data)); - const h = ripemd160_browser_1.default.digest(d); - return (0, data_js_1.hexlify)(h); -} -exports.ripemd160 = ripemd160; -function sha256(data) { - const d = Buffer.from((0, data_js_1.arrayify)(data)); - const h = sha3_browser_js_1.default.digest(d, 256); - return (0, data_js_1.hexlify)(h); -} -exports.sha256 = sha256; -function sha512(data) { - const d = Buffer.from((0, data_js_1.arrayify)(data)); - const h = sha3_browser_js_1.default.digest(d, 512); - return (0, data_js_1.hexlify)(h); -} -exports.sha512 = sha512; -function computeHmac(algorithm, key, data) { - const d = Buffer.from((0, data_js_1.arrayify)(data)); - const k = Buffer.from((0, data_js_1.arrayify)(key)); - if (algorithm === sha3_js_1.SupportedAlgorithm.sha256) { - return (0, data_js_1.hexlify)(sha3_browser_js_1.default.mac(d, k, 256)); - } - else if (algorithm === sha3_js_1.SupportedAlgorithm.sha512) { - return (0, data_js_1.hexlify)(sha3_browser_js_1.default.mac(d, k, 512)); - } - logger.throwError("unsupported algorithm - " + algorithm, logger_js_1.Logger.errors.UNSUPPORTED_OPERATION, { - operation: "computeHmac", - algorithm: algorithm, - }); - return ""; -} -exports.computeHmac = computeHmac; -//# sourceMappingURL=browser-sha3.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/browser-sha3.js.map b/lib.commonjs/crypto/browser-sha3.js.map deleted file mode 100644 index 8f943a180..000000000 --- a/lib.commonjs/crypto/browser-sha3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"browser-sha3.js","sourceRoot":"","sources":["../../src.ts/crypto/browser-sha3.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;AAEb,aAAa;AACb,8FAAuD;AACvD,aAAa;AACb,0FAA+C;AAE/C,mDAA6C;AAC7C,8CAAgE;AAChE,uCAA+C;AAE/C,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,kCAAkC,CAAC,CAAC;AAE9D,SAAgB,SAAS,CAAC,IAAe;IACvC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC;IACtC,MAAM,CAAC,GAAG,2BAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC/B,OAAO,IAAA,iBAAO,EAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAJD,8BAIC;AAED,SAAgB,MAAM,CAAC,IAAe;IACpC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC;IACtC,MAAM,CAAC,GAAG,yBAAI,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9B,OAAO,IAAA,iBAAO,EAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAJD,wBAIC;AAED,SAAgB,MAAM,CAAC,IAAe;IACpC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC;IACtC,MAAM,CAAC,GAAG,yBAAI,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9B,OAAO,IAAA,iBAAO,EAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAJD,wBAIC;AAED,SAAgB,WAAW,CACzB,SAA6B,EAC7B,GAAc,EACd,IAAe;IAEf,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC;IACtC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,GAAG,CAAC,CAAC,CAAC;IACrC,IAAI,SAAS,KAAK,4BAAkB,CAAC,MAAM,EAAE;QAC3C,OAAO,IAAA,iBAAO,EAAC,yBAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;KACrC;SAAM,IAAI,SAAS,KAAK,4BAAkB,CAAC,MAAM,EAAE;QAClD,OAAO,IAAA,iBAAO,EAAC,yBAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;KACrC;IAED,MAAM,CAAC,UAAU,CACf,0BAA0B,GAAG,SAAS,EACtC,kBAAM,CAAC,MAAM,CAAC,qBAAqB,EACnC;QACE,SAAS,EAAE,aAAa;QACxB,SAAS,EAAE,SAAS;KACrB,CACF,CAAC;IACF,OAAO,EAAE,CAAC;AACZ,CAAC;AAtBD,kCAsBC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/crypto-browser.d.ts b/lib.commonjs/crypto/crypto-browser.d.ts deleted file mode 100644 index c1f839009..000000000 --- a/lib.commonjs/crypto/crypto-browser.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import ed448 from "./browser-ed448.js"; -export { ed448 }; -export { Ed448Goldilock } from "./ed448goldilock-browser.js"; -declare global { - interface Window { - } - const window: Window; - const self: Window; -} -export interface CryptoHasher { - update(data: Uint8Array): CryptoHasher; - digest(): Uint8Array; -} -export declare function createHash(algo: string): CryptoHasher; -export declare function createHmac(_algo: string, key: Uint8Array): CryptoHasher; -export declare function pbkdf2Sync(password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, _algo: "sha256" | "sha512"): Uint8Array; -export declare function randomBytes(length: number): Uint8Array; -//# sourceMappingURL=crypto-browser.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/crypto-browser.d.ts.map b/lib.commonjs/crypto/crypto-browser.d.ts.map deleted file mode 100644 index 74fb87c78..000000000 --- a/lib.commonjs/crypto/crypto-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"crypto-browser.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/crypto-browser.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,oBAAoB,CAAC;AAGvC,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;KAAG;IAEnB,MAAM,MAAM,EAAE,MAAM,CAAC;IAErB,MAAM,IAAI,EAAE,MAAM,CAAC;CACpB;AAkBD,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAAC;IACvC,MAAM,IAAI,UAAU,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAYrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,GAAG,YAAY,CAIvE;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,UAAU,EACpB,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,QAAQ,GAAG,QAAQ,GACzB,UAAU,CAIZ;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAoBtD"} \ No newline at end of file diff --git a/lib.commonjs/crypto/crypto-browser.js b/lib.commonjs/crypto/crypto-browser.js deleted file mode 100644 index 3216f9182..000000000 --- a/lib.commonjs/crypto/crypto-browser.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -/* Browser Crypto Shims */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.randomBytes = exports.pbkdf2Sync = exports.createHmac = exports.createHash = exports.Ed448Goldilock = exports.ed448 = void 0; -const tslib_1 = require("tslib"); -const hmac_1 = require("@noble/hashes/hmac"); -const pbkdf2_1 = require("@noble/hashes/pbkdf2"); -const sha256_1 = require("@noble/hashes/sha256"); -const sha512_1 = require("@noble/hashes/sha512"); -const sha3_1 = require("@noble/hashes/sha3"); -const browser_ed448_js_1 = tslib_1.__importDefault(require("./browser-ed448.js")); -exports.ed448 = browser_ed448_js_1.default; -const index_js_1 = require("../utils/index.js"); -var ed448goldilock_browser_js_1 = require("./ed448goldilock-browser.js"); -Object.defineProperty(exports, "Ed448Goldilock", { enumerable: true, get: function () { return ed448goldilock_browser_js_1.Ed448Goldilock; } }); -function getGlobal() { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw new Error("unable to locate global object"); -} -const anyGlobal = getGlobal(); -const crypto = anyGlobal.crypto || anyGlobal.msCrypto; -function createHash(algo) { - switch (algo) { - case "sha256": - return sha256_1.sha256.create(); - case "sha512": - return sha512_1.sha512.create(); - case "sha3-256": - return sha3_1.sha3_256.create(); - case "sha3-512": - return sha3_1.sha3_512.create(); - } - (0, index_js_1.assertArgument)(false, "invalid hashing algorithm name", "algorithm", algo); -} -exports.createHash = createHash; -function createHmac(_algo, key) { - const algo = { sha256: sha256_1.sha256, sha512: sha512_1.sha512 }[_algo]; - (0, index_js_1.assertArgument)(algo != null, "invalid hmac algorithm", "algorithm", _algo); - return hmac_1.hmac.create(algo, key); -} -exports.createHmac = createHmac; -function pbkdf2Sync(password, salt, iterations, keylen, _algo) { - const algo = { sha256: sha256_1.sha256, sha512: sha512_1.sha512 }[_algo]; - (0, index_js_1.assertArgument)(algo != null, "invalid pbkdf2 algorithm", "algorithm", _algo); - return (0, pbkdf2_1.pbkdf2)(algo, password, salt, { c: iterations, dkLen: keylen }); -} -exports.pbkdf2Sync = pbkdf2Sync; -function randomBytes(length) { - (0, index_js_1.assert)(crypto != null, "platform does not support secure random numbers", "UNSUPPORTED_OPERATION", { - operation: "randomBytes", - }); - (0, index_js_1.assertArgument)(Number.isInteger(length) && length > 0 && length <= 1024, "invalid length", "length", length); - const result = new Uint8Array(length); - crypto.getRandomValues(result); - return result; -} -exports.randomBytes = randomBytes; -//# sourceMappingURL=crypto-browser.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/crypto-browser.js.map b/lib.commonjs/crypto/crypto-browser.js.map deleted file mode 100644 index aff74ccd0..000000000 --- a/lib.commonjs/crypto/crypto-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"crypto-browser.js","sourceRoot":"","sources":["../../src.ts/crypto/crypto-browser.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;;AAE1B,6CAA0C;AAC1C,iDAA8C;AAC9C,iDAA8C;AAC9C,iDAA8C;AAC9C,6CAAwD;AACxD,kFAAuC;AAG9B,gBAHF,0BAAK,CAGE;AAFd,gDAA2D;AAG3D,yEAA6D;AAApD,2HAAA,cAAc,OAAA;AAUvB,SAAS,SAAS;IAChB,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC/B,OAAO,IAAI,CAAC;KACb;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC;KACf;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC;KACf;IACD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AAC9B,MAAM,MAAM,GAAQ,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC;AAO3D,SAAgB,UAAU,CAAC,IAAY;IACrC,QAAQ,IAAI,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,EACvB;QACE,SAAS,EAAE,aAAa;KACzB,CACF,CAAC;IAEF,IAAA,yBAAc,EACZ,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,IAAI,IAAI,EACxD,gBAAgB,EAChB,QAAQ,EACR,MAAM,CACP,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAChB,CAAC;AApBD,kCAoBC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/crypto.d.ts b/lib.commonjs/crypto/crypto.d.ts deleted file mode 100644 index 56e369d6c..000000000 --- a/lib.commonjs/crypto/crypto.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import ed448 from "./ed448.js"; -export { ed448 }; -export { Ed448Goldilock } from "./ed448goldilock.js"; -export { createHash, createHmac, pbkdf2Sync, randomBytes } from "crypto"; -//# sourceMappingURL=crypto.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/crypto.d.ts.map b/lib.commonjs/crypto/crypto.d.ts.map deleted file mode 100644 index a472d84a5..000000000 --- a/lib.commonjs/crypto/crypto.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/crypto.js b/lib.commonjs/crypto/crypto.js deleted file mode 100644 index a87aabdf0..000000000 --- a/lib.commonjs/crypto/crypto.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.randomBytes = exports.pbkdf2Sync = exports.createHmac = exports.createHash = exports.Ed448Goldilock = exports.ed448 = void 0; -const tslib_1 = require("tslib"); -const ed448_js_1 = tslib_1.__importDefault(require("./ed448.js")); -exports.ed448 = ed448_js_1.default; -var ed448goldilock_js_1 = require("./ed448goldilock.js"); -Object.defineProperty(exports, "Ed448Goldilock", { enumerable: true, get: function () { return ed448goldilock_js_1.Ed448Goldilock; } }); -var crypto_1 = require("crypto"); -Object.defineProperty(exports, "createHash", { enumerable: true, get: function () { return crypto_1.createHash; } }); -Object.defineProperty(exports, "createHmac", { enumerable: true, get: function () { return crypto_1.createHmac; } }); -Object.defineProperty(exports, "pbkdf2Sync", { enumerable: true, get: function () { return crypto_1.pbkdf2Sync; } }); -Object.defineProperty(exports, "randomBytes", { enumerable: true, get: function () { return crypto_1.randomBytes; } }); -//# sourceMappingURL=crypto.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/crypto.js.map b/lib.commonjs/crypto/crypto.js.map deleted file mode 100644 index 9c6cefb24..000000000 --- a/lib.commonjs/crypto/crypto.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src.ts/crypto/crypto.ts"],"names":[],"mappings":";;;;AAAA,kEAA+B;AACtB,gBADF,kBAAK,CACE;AACd,yDAAqD;AAA5C,mHAAA,cAAc,OAAA;AAEvB,iCAAyE;AAAhE,oGAAA,UAAU,OAAA;AAAE,oGAAA,UAAU,OAAA;AAAE,oGAAA,UAAU,OAAA;AAAE,qGAAA,WAAW,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/crypto/ed448.d.ts b/lib.commonjs/crypto/ed448.d.ts deleted file mode 100644 index 5dfe597f9..000000000 --- a/lib.commonjs/crypto/ed448.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import ed448 from "bcrypto/lib/ed448.js"; -export default ed448; -//# sourceMappingURL=ed448.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/ed448.d.ts.map b/lib.commonjs/crypto/ed448.d.ts.map deleted file mode 100644 index 19085a96e..000000000 --- a/lib.commonjs/crypto/ed448.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ed448.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,sBAAsB,CAAC;AAEzC,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/ed448.js b/lib.commonjs/crypto/ed448.js deleted file mode 100644 index 3f0eeead6..000000000 --- a/lib.commonjs/crypto/ed448.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -// @ts-ignore -const ed448_js_1 = tslib_1.__importDefault(require("bcrypto/lib/ed448.js")); -exports.default = ed448_js_1.default; -//# sourceMappingURL=ed448.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/ed448.js.map b/lib.commonjs/crypto/ed448.js.map deleted file mode 100644 index 54ebb326a..000000000 --- a/lib.commonjs/crypto/ed448.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448.js","sourceRoot":"","sources":["../../src.ts/crypto/ed448.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,aAAa;AACb,4EAAyC;AAEzC,kBAAe,kBAAK,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/ed448goldilock-browser.d.ts b/lib.commonjs/crypto/ed448goldilock-browser.d.ts deleted file mode 100644 index 675f772fa..000000000 --- a/lib.commonjs/crypto/ed448goldilock-browser.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export declare class Ed448Goldilock { - static _channel: any; - static generatePrivateKey(): any; - static getPublicKeyFromPrivateKey(privateKey: string): string; - static signWithPrivateKey(privateKey: string, msg: string): string; - static signWithPrivateKeyNConcatPubkey(privateKey: string, msg: string): string; - static verifySignature(msgHash: string, signedMsg: string, pubKey: string): boolean; - static SHA512Hash(password: string, salt: string): string; - static concatenateAndHex(prefix: number, key: string, index: number, salt: string): string; - static addScalar(a: string, b: string): string; - static seedToExtendedPrivate(seed: string): string; - static childPrivateToPrivate(s: string, index: number): string; - static HDWalletGenerateKeyFromSeed(seed: string, index: number): string; -} -//# sourceMappingURL=ed448goldilock-browser.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/ed448goldilock-browser.d.ts.map b/lib.commonjs/crypto/ed448goldilock-browser.d.ts.map deleted file mode 100644 index 754f2764a..000000000 --- a/lib.commonjs/crypto/ed448goldilock-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448goldilock-browser.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ed448goldilock-browser.ts"],"names":[],"mappings":"AAOA,qBAAa,cAAc;IACzB,MAAM,CAAC,QAAQ,MAAS;IAExB,MAAM,CAAC,kBAAkB;IAMzB,MAAM,CAAC,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAc7D,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAqBlE,MAAM,CAAC,+BAA+B,CACpC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,GACV,MAAM;IAMT,MAAM,CAAC,eAAe,CACpB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,OAAO;IAIV,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAQzD,MAAM,CAAC,iBAAiB,CACtB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,MAAM;IAaT,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM;IAc9C,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiBlD,MAAM,CAAC,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAgBrD,MAAM,CAAC,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;CASxE"} \ No newline at end of file diff --git a/lib.commonjs/crypto/ed448goldilock-browser.js b/lib.commonjs/crypto/ed448goldilock-browser.js deleted file mode 100644 index 9dc555f30..000000000 --- a/lib.commonjs/crypto/ed448goldilock-browser.js +++ /dev/null @@ -1,124 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Ed448Goldilock = void 0; -const tslib_1 = require("tslib"); -// @ts-ignore -const browser_ed448_js_1 = tslib_1.__importDefault(require("./browser-ed448.js")); -// @ts-ignore -const pbkdf2_browser_js_1 = tslib_1.__importDefault(require("./pbkdf2-browser.js")); -// @ts-ignore -const sha3_512_js_1 = tslib_1.__importDefault(require("bcrypto/lib/sha3-512.js")); -class Ed448Goldilock { - static _channel = browser_ed448_js_1.default; - static generatePrivateKey() { - var privateKey = browser_ed448_js_1.default.privateKeyGenerate(); - privateKey[56] &= 0x7f; - return privateKey; - } - static getPublicKeyFromPrivateKey(privateKey) { - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var scalar = secret.slice(0, 56); - scalar[0] &= 0xfc; - scalar[55] |= 0x80; - var publicKey = this._channel.publicKeyFromScalar(scalar); - return Buffer.from(publicKey).toString("hex"); - } - else { - var publicKey = this._channel.publicKeyCreate(secret); - return Buffer.from(publicKey).toString("hex"); - } - } - static signWithPrivateKey(privateKey, msg) { - var msgToSign = Buffer.from(msg, "hex"); - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var prefix = secret.slice(0, 57); - prefix[0] &= 0xfc; - prefix[56] = 0; - prefix[55] |= 0x80; - var scalar = prefix.slice(0, 56); - var signedMessage = this._channel.signWithScalar(msgToSign, scalar, prefix); - return Buffer.from(signedMessage).toString("hex"); - } - else { - var signedMessage = this._channel.sign(msgToSign, secret); - return Buffer.from(signedMessage).toString("hex"); - } - } - static signWithPrivateKeyNConcatPubkey(privateKey, msg) { - var signedMessage = Ed448Goldilock.signWithPrivateKey(privateKey, msg); - var publicKey = Ed448Goldilock.getPublicKeyFromPrivateKey(privateKey); - return signedMessage + publicKey; - } - static verifySignature(msgHash, signedMsg, pubKey) { - return this._channel.verify(msgHash, signedMsg, pubKey); - } - static SHA512Hash(password, salt) { - var p1 = Buffer.from(password, "hex"); - var s1 = Buffer.from(salt, "hex"); - return Buffer.from(pbkdf2_browser_js_1.default.derive(sha3_512_js_1.default, p1, s1, 2048, 57)).toString("hex"); - } - static concatenateAndHex(prefix, key, index, salt) { - var ind = Buffer.alloc(4); - var p = Buffer.alloc(1); - p[0] = prefix % 256; - var j = index; - for (let i = 0; i < 4; i++) { - ind[i] = j % 256; - j = Math.floor(j / 256); - } - var t = p.toString("hex") + key + ind.toString("hex"); - return Ed448Goldilock.SHA512Hash(t, salt); - } - static addScalar(a, b) { - var a1 = Buffer.from(a, "hex"); - var b1 = Buffer.from(b.substr(0, 106) + "00000000", "hex"); - b1[0] &= 0xfc; - var c = Buffer.alloc(57); - var hold = 0; - for (let i = 0; i < 57; i++) { - hold += a1[i] + b1[i]; - c[i] = hold % 256; - hold = Math.floor(hold / 256); - } - return c.toString("hex"); - } - static seedToExtendedPrivate(seed) { - var s1 = Ed448Goldilock.SHA512Hash(seed, "6d6e656d6f6e6963666f72746865636861696e"); - var s2 = Ed448Goldilock.SHA512Hash(seed, "6d6e656d6f6e6963666f727468656b6579"); - var b = Buffer.from(s2, "hex"); - b[56] |= 0x80; - b[55] |= 0x80; - b[55] &= 0xbf; - var s3 = b.toString("hex"); - return s1 + s3; - } - static childPrivateToPrivate(s, index) { - var s0 = s.substr(0, 114); - var s1 = s.substr(114, 228); - var r0, r1; - if (index >= 0x80000000) { - r0 = Ed448Goldilock.concatenateAndHex(1, s1, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(0, s1, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } - else { - var pub = Ed448Goldilock.getPublicKeyFromPrivateKey(s1); - r0 = Ed448Goldilock.concatenateAndHex(3, pub, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(2, pub, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } - } - static HDWalletGenerateKeyFromSeed(seed, index) { - var m = Ed448Goldilock.seedToExtendedPrivate(seed); - var k1 = Ed448Goldilock.childPrivateToPrivate(m, 0x80000000 + 44); - var k2 = Ed448Goldilock.childPrivateToPrivate(k1, 0x80000000 + 654); - var k3 = Ed448Goldilock.childPrivateToPrivate(k2, 0x80000000 + 0); - var k4 = Ed448Goldilock.childPrivateToPrivate(k3, 0x80000000 + 0); - var k5 = Ed448Goldilock.childPrivateToPrivate(k4, index); - return k5.substr(114, 228); - } -} -exports.Ed448Goldilock = Ed448Goldilock; -//# sourceMappingURL=ed448goldilock-browser.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/ed448goldilock-browser.js.map b/lib.commonjs/crypto/ed448goldilock-browser.js.map deleted file mode 100644 index 588973450..000000000 --- a/lib.commonjs/crypto/ed448goldilock-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448goldilock-browser.js","sourceRoot":"","sources":["../../src.ts/crypto/ed448goldilock-browser.ts"],"names":[],"mappings":";;;;AAAA,aAAa;AACb,kFAAuC;AACvC,aAAa;AACb,oFAAyC;AACzC,aAAa;AACb,kFAA+C;AAE/C,MAAa,cAAc;IACzB,MAAM,CAAC,QAAQ,GAAG,0BAAK,CAAC;IAExB,MAAM,CAAC,kBAAkB;QACvB,IAAI,UAAU,GAAG,0BAAK,CAAC,kBAAkB,EAAE,CAAC;QAC5C,UAAU,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;QACvB,OAAO,UAAU,C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.commonjs/crypto/ed448goldilock.d.ts deleted file mode 100644 index 737cae0a1..000000000 --- a/lib.commonjs/crypto/ed448goldilock.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export declare class Ed448Goldilock { - static _channel: any; - static generatePrivateKey(): any; - static getPublicKeyFromPrivateKey(privateKey: string): string; - static signWithPrivateKey(privateKey: string, msg: string): string; - static signWithPrivateKeyNConcatPubkey(privateKey: string, msg: string): string; - static verifySignature(msgHash: string, signedMsg: string, pubKey: string): boolean; - static SHA512Hash(password: string, salt: string): string; - static concatenateAndHex(prefix: number, key: string, index: number, salt: string): string; - static addScalar(a: string, b: string): string; - static seedToExtendedPrivate(seed: string): string; - static childPrivateToPrivate(s: string, index: number): string; - static HDWalletGenerateKeyFromSeed(seed: string, index: number): string; -} -//# sourceMappingURL=ed448goldilock.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/ed448goldilock.d.ts.map b/lib.commonjs/crypto/ed448goldilock.d.ts.map deleted file mode 100644 index 34092c2fe..000000000 --- a/lib.commonjs/crypto/ed448goldilock.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448goldilock.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ed448goldilock.ts"],"names":[],"mappings":"AAOA,qBAAa,cAAc;IACzB,MAAM,CAAC,QAAQ,MAAS;IAExB,MAAM,CAAC,kBAAkB;IAMzB,MAAM,CAAC,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAc7D,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAqBlE,MAAM,CAAC,+BAA+B,CACpC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,GACV,MAAM;IAMT,MAAM,CAAC,eAAe,CACpB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,OAAO;IAIV,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAQzD,MAAM,CAAC,iBAAiB,CACtB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,MAAM;IAaT,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM;IAc9C,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiBlD,MAAM,CAAC,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAgBrD,MAAM,CAAC,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;CASxE"} \ No newline at end of file diff --git a/lib.commonjs/crypto/ed448goldilock.js b/lib.commonjs/crypto/ed448goldilock.js deleted file mode 100644 index c3c7be47c..000000000 --- a/lib.commonjs/crypto/ed448goldilock.js +++ /dev/null @@ -1,124 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Ed448Goldilock = void 0; -const tslib_1 = require("tslib"); -// @ts-ignore -const ed448_js_1 = tslib_1.__importDefault(require("bcrypto/lib/ed448.js")); -// @ts-ignore -const pbkdf2_js_1 = tslib_1.__importDefault(require("bcrypto/lib/pbkdf2.js")); -// @ts-ignore -const sha3_512_js_1 = tslib_1.__importDefault(require("bcrypto/lib/sha3-512.js")); -class Ed448Goldilock { - static _channel = ed448_js_1.default; - static generatePrivateKey() { - var privateKey = ed448_js_1.default.privateKeyGenerate(); - privateKey[56] &= 0x7f; - return privateKey; - } - static getPublicKeyFromPrivateKey(privateKey) { - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var scalar = secret.slice(0, 56); - scalar[0] &= 0xfc; - scalar[55] |= 0x80; - var publicKey = this._channel.publicKeyFromScalar(scalar); - return Buffer.from(publicKey).toString("hex"); - } - else { - var publicKey = this._channel.publicKeyCreate(secret); - return Buffer.from(publicKey).toString("hex"); - } - } - static signWithPrivateKey(privateKey, msg) { - var msgToSign = Buffer.from(msg, "hex"); - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var prefix = secret.slice(0, 57); - prefix[0] &= 0xfc; - prefix[56] = 0; - prefix[55] |= 0x80; - var scalar = prefix.slice(0, 56); - var signedMessage = this._channel.signWithScalar(msgToSign, scalar, prefix); - return Buffer.from(signedMessage).toString("hex"); - } - else { - var signedMessage = this._channel.sign(msgToSign, secret); - return Buffer.from(signedMessage).toString("hex"); - } - } - static signWithPrivateKeyNConcatPubkey(privateKey, msg) { - var signedMessage = Ed448Goldilock.signWithPrivateKey(privateKey, msg); - var publicKey = Ed448Goldilock.getPublicKeyFromPrivateKey(privateKey); - return signedMessage + publicKey; - } - static verifySignature(msgHash, signedMsg, pubKey) { - return this._channel.verify(msgHash, signedMsg, pubKey); - } - static SHA512Hash(password, salt) { - var p1 = Buffer.from(password, "hex"); - var s1 = Buffer.from(salt, "hex"); - return Buffer.from(pbkdf2_js_1.default.derive(sha3_512_js_1.default, p1, s1, 2048, 57)).toString("hex"); - } - static concatenateAndHex(prefix, key, index, salt) { - var ind = Buffer.alloc(4); - var p = Buffer.alloc(1); - p[0] = prefix % 256; - var j = index; - for (let i = 0; i < 4; i++) { - ind[i] = j % 256; - j = Math.floor(j / 256); - } - var t = p.toString("hex") + key + ind.toString("hex"); - return Ed448Goldilock.SHA512Hash(t, salt); - } - static addScalar(a, b) { - var a1 = Buffer.from(a, "hex"); - var b1 = Buffer.from(b.substr(0, 106) + "00000000", "hex"); - b1[0] &= 0xfc; - var c = Buffer.alloc(57); - var hold = 0; - for (let i = 0; i < 57; i++) { - hold += a1[i] + b1[i]; - c[i] = hold % 256; - hold = Math.floor(hold / 256); - } - return c.toString("hex"); - } - static seedToExtendedPrivate(seed) { - var s1 = Ed448Goldilock.SHA512Hash(seed, "6d6e656d6f6e6963666f72746865636861696e"); - var s2 = Ed448Goldilock.SHA512Hash(seed, "6d6e656d6f6e6963666f727468656b6579"); - var b = Buffer.from(s2, "hex"); - b[56] |= 0x80; - b[55] |= 0x80; - b[55] &= 0xbf; - var s3 = b.toString("hex"); - return s1 + s3; - } - static childPrivateToPrivate(s, index) { - var s0 = s.substr(0, 114); - var s1 = s.substr(114, 228); - var r0, r1; - if (index >= 0x80000000) { - r0 = Ed448Goldilock.concatenateAndHex(1, s1, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(0, s1, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } - else { - var pub = Ed448Goldilock.getPublicKeyFromPrivateKey(s1); - r0 = Ed448Goldilock.concatenateAndHex(3, pub, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(2, pub, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } - } - static HDWalletGenerateKeyFromSeed(seed, index) { - var m = Ed448Goldilock.seedToExtendedPrivate(seed); - var k1 = Ed448Goldilock.childPrivateToPrivate(m, 0x80000000 + 44); - var k2 = Ed448Goldilock.childPrivateToPrivate(k1, 0x80000000 + 654); - var k3 = Ed448Goldilock.childPrivateToPrivate(k2, 0x80000000 + 0); - var k4 = Ed448Goldilock.childPrivateToPrivate(k3, 0x80000000 + 0); - var k5 = Ed448Goldilock.childPrivateToPrivate(k4, index); - return k5.substr(114, 228); - } -} -exports.Ed448Goldilock = Ed448Goldilock; -//# sourceMappingURL=ed448goldilock.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/ed448goldilock.js.map b/lib.commonjs/crypto/ed448goldilock.js.map deleted file mode 100644 index 37cd1f147..000000000 --- a/lib.commonjs/crypto/ed448goldilock.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448goldilock.js","sourceRoot":"","sources":["../../src.ts/crypto/ed448goldilock.ts"],"names":[],"mappings":";;;;AAAA,aAAa;AACb,4EAAyC;AACzC,aAAa;AACb,8EAA2C;AAC3C,aAAa;AACb,kFAA+C;A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AE,GAAG,cAAc,CAAC,qBAAqB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACzD,OAAO,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC;;AA9IH,wCA+IC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/hmac.d.ts b/lib.commonjs/crypto/hmac.d.ts deleted file mode 100644 index 4c5e3227d..000000000 --- a/lib.commonjs/crypto/hmac.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { BytesLike } from "../utils/index.js"; -/** - * Return the HMAC for %%data%% using the %%key%% key with the underlying - * %%algo%% used for compression. - * - * @example: - * key = id("some-secret") - * - * // Compute the HMAC - * computeHmac("sha256", key, "0x1337") - * //_result: - * - * // To compute the HMAC of UTF-8 data, the data must be - * // converted to UTF-8 bytes - * computeHmac("sha256", key, toUtf8Bytes("Hello World")) - * //_result: - * - */ -export declare function computeHmac(algorithm: "sha256" | "sha512", _key: BytesLike, _data: BytesLike): string; -export declare namespace computeHmac { - var _: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike; - var lock: () => void; - var register: (func: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike) => void; -} -//# sourceMappingURL=hmac.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/hmac.d.ts.map b/lib.commonjs/crypto/hmac.d.ts.map deleted file mode 100644 index 49d9b637c..000000000 --- a/lib.commonjs/crypto/hmac.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/hmac.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAcnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAC9B,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,SAAS,GACf,MAAM,CAIR;yBARe,WAAW"} \ No newline at end of file diff --git a/lib.commonjs/crypto/hmac.js b/lib.commonjs/crypto/hmac.js deleted file mode 100644 index 6cd179766..000000000 --- a/lib.commonjs/crypto/hmac.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.computeHmac = void 0; -/** - * An **HMAC** enables verification that a given key was used - * to authenticate a payload. - * - * See: [[link-wiki-hmac]] - * - * @_subsection: api/crypto:HMAC [about-hmac] - */ -const crypto_js_1 = require("./crypto.js"); -const index_js_1 = require("../utils/index.js"); -let locked = false; -const _computeHmac = function (algorithm, key, data) { - return (0, crypto_js_1.createHmac)(algorithm, key).update(data).digest(); -}; -let __computeHmac = _computeHmac; -/** - * Return the HMAC for %%data%% using the %%key%% key with the underlying - * %%algo%% used for compression. - * - * @example: - * key = id("some-secret") - * - * // Compute the HMAC - * computeHmac("sha256", key, "0x1337") - * //_result: - * - * // To compute the HMAC of UTF-8 data, the data must be - * // converted to UTF-8 bytes - * computeHmac("sha256", key, toUtf8Bytes("Hello World")) - * //_result: - * - */ -function computeHmac(algorithm, _key, _data) { - const key = (0, index_js_1.getBytes)(_key, "key"); - const data = (0, index_js_1.getBytes)(_data, "data"); - return (0, index_js_1.hexlify)(__computeHmac(algorithm, key, data)); -} -exports.computeHmac = computeHmac; -computeHmac._ = _computeHmac; -computeHmac.lock = function () { - locked = true; -}; -computeHmac.register = function (func) { - if (locked) { - throw new Error("computeHmac is locked"); - } - __computeHmac = func; -}; -Object.freeze(computeHmac); -//# sourceMappingURL=hmac.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/hmac.js.map b/lib.commonjs/crypto/hmac.js.map deleted file mode 100644 index 4c2a90a61..000000000 --- a/lib.commonjs/crypto/hmac.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hmac.js","sourceRoot":"","sources":["../../src.ts/crypto/hmac.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,2CAAyC;AACzC,gDAAsD;AAItD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,UACnB,SAA8B,EAC9B,GAAe,EACf,IAAgB;IAEhB,OAAO,IAAA,sBAAU,EAAC,SAAS,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC1D,CAAC,CAAC;AAEF,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,WAAW,CACzB,SAA8B,EAC9B,IAAe,EACf,KAAgB;IAEhB,MAAM,GAAG,GAAG,IAAA,mBAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,aAAa,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACtD,CAAC;AARD,kCAQC;AACD,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAG;IACjB,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC,CAAC;AACF,WAAW,CAAC,QAAQ,GAAG,UACrB,IAIc;IAEd,IAAI,MAAM,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAC1C;IACD,aAAa,GAAG,IAAI,CAAC;AACvB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/index.d.ts b/lib.commonjs/crypto/index.d.ts deleted file mode 100644 index 0730e25c8..000000000 --- a/lib.commonjs/crypto/index.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A fundamental building block of Core is the underlying - * cryptographic primitives. - * - * @_section: api/crypto:Cryptographic Functions [about-crypto] - */ -import { computeHmac } from "./hmac.js"; -import { ripemd160 } from "./ripemd160.js"; -import { pbkdf2 } from "./pbkdf2.js"; -import { randomBytes } from "./random.js"; -import { scrypt, scryptSync } from "./scrypt.js"; -import { sha256, sha512 } from "./sha3.js"; -import { Ed448Goldilock } from "./crypto.js"; -import { keccak256 } from "./keccak.js"; -export { computeHmac, randomBytes, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, keccak256, Ed448Goldilock, }; -export { SigningKey } from "./signing-key.js"; -export { Signature } from "./signature.js"; -declare function lock(): void; -export { lock }; -export type { ProgressCallback } from "./scrypt.js"; -export type { SignatureLike } from "./signature.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/index.d.ts.map b/lib.commonjs/crypto/index.d.ts.map deleted file mode 100644 index 153bb6fd7..000000000 --- a/lib.commonjs/crypto/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,cAAc,GACf,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,iBAAS,IAAI,IAAI,IAAI,CAUpB;AAED,OAAO,EAAE,IAAI,EAAE,CAAC;AAKhB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/index.js b/lib.commonjs/crypto/index.js deleted file mode 100644 index e3bff558b..000000000 --- a/lib.commonjs/crypto/index.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -/** - * A fundamental building block of Core is the underlying - * cryptographic primitives. - * - * @_section: api/crypto:Cryptographic Functions [about-crypto] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.lock = exports.Signature = exports.SigningKey = exports.Ed448Goldilock = exports.keccak256 = exports.scryptSync = exports.scrypt = exports.pbkdf2 = exports.sha512 = exports.sha256 = exports.ripemd160 = exports.randomBytes = exports.computeHmac = void 0; -null; -// We import all these so we can export lock() -const hmac_js_1 = require("./hmac.js"); -Object.defineProperty(exports, "computeHmac", { enumerable: true, get: function () { return hmac_js_1.computeHmac; } }); -const ripemd160_js_1 = require("./ripemd160.js"); -Object.defineProperty(exports, "ripemd160", { enumerable: true, get: function () { return ripemd160_js_1.ripemd160; } }); -const pbkdf2_js_1 = require("./pbkdf2.js"); -Object.defineProperty(exports, "pbkdf2", { enumerable: true, get: function () { return pbkdf2_js_1.pbkdf2; } }); -const random_js_1 = require("./random.js"); -Object.defineProperty(exports, "randomBytes", { enumerable: true, get: function () { return random_js_1.randomBytes; } }); -const scrypt_js_1 = require("./scrypt.js"); -Object.defineProperty(exports, "scrypt", { enumerable: true, get: function () { return scrypt_js_1.scrypt; } }); -Object.defineProperty(exports, "scryptSync", { enumerable: true, get: function () { return scrypt_js_1.scryptSync; } }); -const sha3_js_1 = require("./sha3.js"); -Object.defineProperty(exports, "sha256", { enumerable: true, get: function () { return sha3_js_1.sha256; } }); -Object.defineProperty(exports, "sha512", { enumerable: true, get: function () { return sha3_js_1.sha512; } }); -const crypto_js_1 = require("./crypto.js"); -Object.defineProperty(exports, "Ed448Goldilock", { enumerable: true, get: function () { return crypto_js_1.Ed448Goldilock; } }); -const keccak_js_1 = require("./keccak.js"); -Object.defineProperty(exports, "keccak256", { enumerable: true, get: function () { return keccak_js_1.keccak256; } }); -var signing_key_js_1 = require("./signing-key.js"); -Object.defineProperty(exports, "SigningKey", { enumerable: true, get: function () { return signing_key_js_1.SigningKey; } }); -var signature_js_1 = require("./signature.js"); -Object.defineProperty(exports, "Signature", { enumerable: true, get: function () { return signature_js_1.Signature; } }); -function lock() { - hmac_js_1.computeHmac.lock(); - pbkdf2_js_1.pbkdf2.lock(); - random_js_1.randomBytes.lock(); - ripemd160_js_1.ripemd160.lock(); - scrypt_js_1.scrypt.lock(); - scrypt_js_1.scryptSync.lock(); - sha3_js_1.sha256.lock(); - sha3_js_1.sha512.lock(); - random_js_1.randomBytes.lock(); -} -exports.lock = lock; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/index.js.map b/lib.commonjs/crypto/index.js.map deleted file mode 100644 index 9007d9409..000000000 --- a/lib.commonjs/crypto/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,IAAI,CAAC;AAEL,8CAA8C;AAC9C,uCAAwC;AAUtC,4FAVO,qBAAW,OAUP;AATb,iDAA2C;AAWzC,0FAXO,wBAAS,OAWP;AAVX,2CAAqC;AAanC,uFAbO,kBAAM,OAaP;AAZR,2CAA0C;AAQxC,4FARO,uBAAW,OAQP;AAPb,2CAAiD;AAY/C,uFAZO,kBAAM,OAYP;AACN,2FAbe,sBAAU,OAaf;AAZZ,uCAA2C;AAQzC,uFARO,gBAAM,OAQP;AACN,uFATe,gBAAM,OASf;AARR,2CAA6C;AAa3C,+FAbO,0BAAc,OAaP;AAZhB,2CAAwC;AAWtC,0FAXO,qBAAS,OAWP;AAIX,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AACnB,+CAA2C;AAAlC,yGAAA,SAAS,OAAA;AAElB,SAAS,IAAI;IACX,qBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,wBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,sBAAU,CAAC,IAAI,EAAE,CAAC;IAClB,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;AACrB,CAAC;AAEQ,oBAAI"} \ No newline at end of file diff --git a/lib.commonjs/crypto/keccak.d.ts b/lib.commonjs/crypto/keccak.d.ts deleted file mode 100644 index 533f46dc6..000000000 --- a/lib.commonjs/crypto/keccak.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Cryptographic hashing functions - * - * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] - */ -import type { BytesLike } from "../utils/index.js"; -/** - * Compute the cryptographic KECCAK256 hash of %%data%%. - * - * The %%data%% **must** be a data representation, to compute the - * hash of UTF-8 data use the [[id]] function. - * - * @returns DataHexstring - * @example: - * keccak256("0x") - * //_result: - * - * keccak256("0x1337") - * //_result: - * - * keccak256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - * // Strings are assumed to be DataHexString, otherwise it will - * // throw. To hash UTF-8 data, see the note above. - * keccak256("Hello World") - * //_error: - */ -export declare function keccak256(_data: BytesLike): string; -export declare namespace keccak256 { - var _: (data: Uint8Array) => Uint8Array; - var lock: () => void; - var register: (func: (data: Uint8Array) => BytesLike) => void; -} -//# sourceMappingURL=keccak.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/keccak.d.ts.map b/lib.commonjs/crypto/keccak.d.ts.map deleted file mode 100644 index 2f0a88fb1..000000000 --- a/lib.commonjs/crypto/keccak.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keccak.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/keccak.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAUnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGlD;yBAHe,SAAS"} \ No newline at end of file diff --git a/lib.commonjs/crypto/keccak.js b/lib.commonjs/crypto/keccak.js deleted file mode 100644 index c0bb82ec9..000000000 --- a/lib.commonjs/crypto/keccak.js +++ /dev/null @@ -1,54 +0,0 @@ -"use strict"; -/** - * Cryptographic hashing functions - * - * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.keccak256 = void 0; -const sha3_1 = require("@noble/hashes/sha3"); -const index_js_1 = require("../utils/index.js"); -let locked = false; -const _keccak256 = function (data) { - return (0, sha3_1.keccak_256)(data); -}; -let __keccak256 = _keccak256; -/** - * Compute the cryptographic KECCAK256 hash of %%data%%. - * - * The %%data%% **must** be a data representation, to compute the - * hash of UTF-8 data use the [[id]] function. - * - * @returns DataHexstring - * @example: - * keccak256("0x") - * //_result: - * - * keccak256("0x1337") - * //_result: - * - * keccak256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - * // Strings are assumed to be DataHexString, otherwise it will - * // throw. To hash UTF-8 data, see the note above. - * keccak256("Hello World") - * //_error: - */ -function keccak256(_data) { - const data = (0, index_js_1.getBytes)(_data, "data"); - return (0, index_js_1.hexlify)(__keccak256(data)); -} -exports.keccak256 = keccak256; -keccak256._ = _keccak256; -keccak256.lock = function () { - locked = true; -}; -keccak256.register = function (func) { - if (locked) { - throw new TypeError("keccak256 is locked"); - } - __keccak256 = func; -}; -Object.freeze(keccak256); -//# sourceMappingURL=keccak.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/keccak.js.map b/lib.commonjs/crypto/keccak.js.map deleted file mode 100644 index 23a587fd7..000000000 --- a/lib.commonjs/crypto/keccak.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keccak.js","sourceRoot":"","sources":["../../src.ts/crypto/keccak.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,6CAAgD;AAEhD,gDAAsD;AAItD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAAG,UAAU,IAAgB;IAC3C,OAAO,IAAA,iBAAU,EAAC,IAAI,CAAC,CAAC;AAC1B,CAAC,CAAC;AAEF,IAAI,WAAW,GAAoC,UAAU,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,SAAS,CAAC,KAAgB;IACxC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACpC,CAAC;AAHD,8BAGC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG;IACf,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC,CAAC;AACF,SAAS,CAAC,QAAQ,GAAG,UAAU,IAAqC;IAClE,IAAI,MAAM,EAAE;QACV,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAC5C;IACD,WAAW,GAAG,IAAI,CAAC;AACrB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/pbkdf2-browser.d.ts b/lib.commonjs/crypto/pbkdf2-browser.d.ts deleted file mode 100644 index 31ae18ebe..000000000 --- a/lib.commonjs/crypto/pbkdf2-browser.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import pbkdf2 from "bcrypto/lib/pbkdf2-browser.js"; -export default pbkdf2; -//# sourceMappingURL=pbkdf2-browser.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/pbkdf2-browser.d.ts.map b/lib.commonjs/crypto/pbkdf2-browser.d.ts.map deleted file mode 100644 index a7519b4b4..000000000 --- a/lib.commonjs/crypto/pbkdf2-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pbkdf2-browser.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2-browser.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/pbkdf2-browser.js b/lib.commonjs/crypto/pbkdf2-browser.js deleted file mode 100644 index 373709aef..000000000 --- a/lib.commonjs/crypto/pbkdf2-browser.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -// @ts-ignore -const pbkdf2_browser_js_1 = tslib_1.__importDefault(require("bcrypto/lib/pbkdf2-browser.js")); -exports.default = pbkdf2_browser_js_1.default; -//# sourceMappingURL=pbkdf2-browser.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/pbkdf2-browser.js.map b/lib.commonjs/crypto/pbkdf2-browser.js.map deleted file mode 100644 index dfb41ea64..000000000 --- a/lib.commonjs/crypto/pbkdf2-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pbkdf2-browser.js","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2-browser.ts"],"names":[],"mappings":";;;AAAA,aAAa;AACb,8FAAmD;AACnD,kBAAe,2BAAM,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/pbkdf2.d.ts b/lib.commonjs/crypto/pbkdf2.d.ts deleted file mode 100644 index 400e9744f..000000000 --- a/lib.commonjs/crypto/pbkdf2.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * A **Password-Based Key-Derivation Function** is designed to create - * a sequence of bytes suitible as a **key** from a human-rememberable - * password. - * - * @_subsection: api/crypto:Passwords [about-pbkdf] - */ -import type { BytesLike } from "../utils/index.js"; -/** - * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using - * the %%salt%% and using %%iterations%% of %%algo%%. - * - * This PBKDF is outdated and should not be used in new projects, but is - * required to decrypt older files. - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the PBKDF2 - * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") - * //_result: - */ -export declare function pbkdf2(_password: BytesLike, _salt: BytesLike, iterations: number, keylen: number, algo: "sha256" | "sha512"): string; -export declare namespace pbkdf2 { - var _: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike; - var lock: () => void; - var register: (func: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike) => void; -} -//# sourceMappingURL=pbkdf2.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/pbkdf2.d.ts.map b/lib.commonjs/crypto/pbkdf2.d.ts.map deleted file mode 100644 index 99323c18c..000000000 --- a/lib.commonjs/crypto/pbkdf2.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pbkdf2.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAgBnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CACpB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,QAAQ,GAAG,QAAQ,GACxB,MAAM,CAIR;yBAVe,MAAM"} \ No newline at end of file diff --git a/lib.commonjs/crypto/pbkdf2.js b/lib.commonjs/crypto/pbkdf2.js deleted file mode 100644 index 499f120d6..000000000 --- a/lib.commonjs/crypto/pbkdf2.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -/** - * A **Password-Based Key-Derivation Function** is designed to create - * a sequence of bytes suitible as a **key** from a human-rememberable - * password. - * - * @_subsection: api/crypto:Passwords [about-pbkdf] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.pbkdf2 = void 0; -const crypto_js_1 = require("./crypto.js"); -const index_js_1 = require("../utils/index.js"); -let locked = false; -const _pbkdf2 = function (password, salt, iterations, keylen, algo) { - return (0, crypto_js_1.pbkdf2Sync)(password, salt, iterations, keylen, algo); -}; -let __pbkdf2 = _pbkdf2; -/** - * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using - * the %%salt%% and using %%iterations%% of %%algo%%. - * - * This PBKDF is outdated and should not be used in new projects, but is - * required to decrypt older files. - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the PBKDF2 - * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") - * //_result: - */ -function pbkdf2(_password, _salt, iterations, keylen, algo) { - const password = (0, index_js_1.getBytes)(_password, "password"); - const salt = (0, index_js_1.getBytes)(_salt, "salt"); - return (0, index_js_1.hexlify)(__pbkdf2(password, salt, iterations, keylen, algo)); -} -exports.pbkdf2 = pbkdf2; -pbkdf2._ = _pbkdf2; -pbkdf2.lock = function () { - locked = true; -}; -pbkdf2.register = function (func) { - if (locked) { - throw new Error("pbkdf2 is locked"); - } - __pbkdf2 = func; -}; -Object.freeze(pbkdf2); -//# sourceMappingURL=pbkdf2.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/pbkdf2.js.map b/lib.commonjs/crypto/pbkdf2.js.map deleted file mode 100644 index 99339c314..000000000 --- a/lib.commonjs/crypto/pbkdf2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pbkdf2.js","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2CAAyC;AAEzC,gDAAsD;AAItD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,OAAO,GAAG,UACd,QAAoB,EACpB,IAAgB,EAChB,UAAkB,EAClB,MAAc,EACd,IAAyB;IAEzB,OAAO,IAAA,sBAAU,EAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AAC9D,CAAC,CAAC;AAEF,IAAI,QAAQ,GAAG,OAAO,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,MAAM,CACpB,SAAoB,EACpB,KAAgB,EAChB,UAAkB,EAClB,MAAc,EACd,IAAyB;IAEzB,MAAM,QAAQ,GAAG,IAAA,mBAAQ,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACjD,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACrE,CAAC;AAVD,wBAUC;AACD,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC;AACnB,MAAM,CAAC,IAAI,GAAG;IACZ,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC,CAAC;AACF,MAAM,CAAC,QAAQ,GAAG,UAChB,IAMc;IAEd,IAAI,MAAM,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KACrC;IACD,QAAQ,GAAG,IAAI,CAAC;AAClB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/random.d.ts b/lib.commonjs/crypto/random.d.ts deleted file mode 100644 index fd9378000..000000000 --- a/lib.commonjs/crypto/random.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Return %%length%% bytes of cryptographically secure random data. - * - * @example: - * randomBytes(8) - * //_result: - */ -export declare function randomBytes(length: number): Uint8Array; -export declare namespace randomBytes { - var _: (length: number) => Uint8Array; - var lock: () => void; - var register: (func: (length: number) => Uint8Array) => void; -} -//# sourceMappingURL=random.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/random.d.ts.map b/lib.commonjs/crypto/random.d.ts.map deleted file mode 100644 index a907fd7ef..000000000 --- a/lib.commonjs/crypto/random.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAEtD;yBAFe,WAAW"} \ No newline at end of file diff --git a/lib.commonjs/crypto/random.js b/lib.commonjs/crypto/random.js deleted file mode 100644 index f8f60ea1d..000000000 --- a/lib.commonjs/crypto/random.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.randomBytes = void 0; -/** - * A **Cryptographically Secure Random Value** is one that has been - * generated with additional care take to prevent side-channels - * from allowing others to detect it and prevent others from through - * coincidence generate the same values. - * - * @_subsection: api/crypto:Random Values [about-crypto-random] - */ -const crypto_js_1 = require("./crypto.js"); -let locked = false; -const _randomBytes = function (length) { - return new Uint8Array((0, crypto_js_1.randomBytes)(length)); -}; -let __randomBytes = _randomBytes; -/** - * Return %%length%% bytes of cryptographically secure random data. - * - * @example: - * randomBytes(8) - * //_result: - */ -function randomBytes(length) { - return __randomBytes(length); -} -exports.randomBytes = randomBytes; -randomBytes._ = _randomBytes; -randomBytes.lock = function () { - locked = true; -}; -randomBytes.register = function (func) { - if (locked) { - throw new Error("randomBytes is locked"); - } - __randomBytes = func; -}; -Object.freeze(randomBytes); -//# sourceMappingURL=random.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/random.js.map b/lib.commonjs/crypto/random.js.map deleted file mode 100644 index 052be12bb..000000000 --- a/lib.commonjs/crypto/random.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"random.js","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,2CAA2D;AAE3D,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,UAAU,MAAc;IAC3C,OAAO,IAAI,UAAU,CAAC,IAAA,uBAAa,EAAC,MAAM,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,MAAc;IACxC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAFD,kCAEC;AAED,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAG;IACjB,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC,CAAC;AACF,WAAW,CAAC,QAAQ,GAAG,UAAU,IAAoC;IACnE,IAAI,MAAM,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAC1C;IACD,aAAa,GAAG,IAAI,CAAC;AACvB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/ripemd160.d.ts b/lib.commonjs/crypto/ripemd160.d.ts deleted file mode 100644 index 27b7b4a1c..000000000 --- a/lib.commonjs/crypto/ripemd160.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { BytesLike } from "../utils/index.js"; -/** - * Compute the cryptographic RIPEMD-160 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * ripemd160("0x") - * //_result: - * - * ripemd160("0x1337") - * //_result: - * - * ripemd160(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ -export declare function ripemd160(_data: BytesLike): string; -export declare namespace ripemd160 { - var _: (data: Uint8Array) => Uint8Array; - var lock: () => void; - var register: (func: (data: Uint8Array) => BytesLike) => void; -} -//# sourceMappingURL=ripemd160.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/ripemd160.d.ts.map b/lib.commonjs/crypto/ripemd160.d.ts.map deleted file mode 100644 index 2eb29db41..000000000 --- a/lib.commonjs/crypto/ripemd160.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ripemd160.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ripemd160.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAUnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGlD;yBAHe,SAAS"} \ No newline at end of file diff --git a/lib.commonjs/crypto/ripemd160.js b/lib.commonjs/crypto/ripemd160.js deleted file mode 100644 index a3f656010..000000000 --- a/lib.commonjs/crypto/ripemd160.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ripemd160 = void 0; -const ripemd160_1 = require("@noble/hashes/ripemd160"); -const index_js_1 = require("../utils/index.js"); -let locked = false; -const _ripemd160 = function (data) { - return (0, ripemd160_1.ripemd160)(data); -}; -let __ripemd160 = _ripemd160; -/** - * Compute the cryptographic RIPEMD-160 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * ripemd160("0x") - * //_result: - * - * ripemd160("0x1337") - * //_result: - * - * ripemd160(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ -function ripemd160(_data) { - const data = (0, index_js_1.getBytes)(_data, "data"); - return (0, index_js_1.hexlify)(__ripemd160(data)); -} -exports.ripemd160 = ripemd160; -ripemd160._ = _ripemd160; -ripemd160.lock = function () { - locked = true; -}; -ripemd160.register = function (func) { - if (locked) { - throw new TypeError("ripemd160 is locked"); - } - __ripemd160 = func; -}; -Object.freeze(ripemd160); -//# sourceMappingURL=ripemd160.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/ripemd160.js.map b/lib.commonjs/crypto/ripemd160.js.map deleted file mode 100644 index a274f81ce..000000000 --- a/lib.commonjs/crypto/ripemd160.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ripemd160.js","sourceRoot":"","sources":["../../src.ts/crypto/ripemd160.ts"],"names":[],"mappings":";;;AAAA,uDAAuE;AAEvE,gDAAsD;AAItD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAAG,UAAU,IAAgB;IAC3C,OAAO,IAAA,qBAAe,EAAC,IAAI,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,IAAI,WAAW,GAAoC,UAAU,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,SAAS,CAAC,KAAgB;IACxC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACpC,CAAC;AAHD,8BAGC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG;IACf,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC,CAAC;AACF,SAAS,CAAC,QAAQ,GAAG,UAAU,IAAqC;IAClE,IAAI,MAAM,EAAE;QACV,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAC5C;IACD,WAAW,GAAG,IAAI,CAAC;AACrB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/rlp.d.ts b/lib.commonjs/crypto/rlp.d.ts deleted file mode 100644 index 42970ab48..000000000 --- a/lib.commonjs/crypto/rlp.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { BytesLike } from "../utils/data.js"; -export declare function encode(object: any): string; -export declare function decode(data: BytesLike): any; -//# sourceMappingURL=rlp.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/rlp.d.ts.map b/lib.commonjs/crypto/rlp.d.ts.map deleted file mode 100644 index 6c9570fb1..000000000 --- a/lib.commonjs/crypto/rlp.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/rlp.ts"],"names":[],"mappings":"AAGA,OAAO,EAAY,SAAS,EAAwB,MAAM,kBAAkB,CAAC;AA+D7E,wBAAgB,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAE1C;AAkHD,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,GAAG,CAO3C"} \ No newline at end of file diff --git a/lib.commonjs/crypto/rlp.js b/lib.commonjs/crypto/rlp.js deleted file mode 100644 index 8d8da6354..000000000 --- a/lib.commonjs/crypto/rlp.js +++ /dev/null @@ -1,123 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.decode = exports.encode = void 0; -const logger_js_1 = require("../logger/logger.js"); -const data_js_1 = require("../utils/data.js"); -const logger = new logger_js_1.Logger("rlp/0.0.1"); -function arrayifyInteger(value) { - const result = []; - while (value) { - // @ts-ignore - result.unshift(value & 0xff); - value >>= 8; - } - return result; -} -function unarrayifyInteger(data, offset, length) { - let result = 0; - for (let i = 0; i < length; i++) { - result = result * 256 + data[offset + i]; - } - return result; -} -function _encode(object) { - if (Array.isArray(object)) { - let payload = []; - object.forEach(function (child) { - payload = payload.concat(_encode(child)); - }); - if (payload.length <= 55) { - payload.unshift(0xc0 + payload.length); - return payload; - } - const length = arrayifyInteger(payload.length); - length.unshift(0xf7 + length.length); - return length.concat(payload); - } - if (!(0, data_js_1.isBytesLike)(object)) { - logger.throwArgumentError("RLP object must be BytesLike", "object", object); - } - const data = Array.prototype.slice.call((0, data_js_1.arrayify)(object)); - if (data.length === 1 && data[0] <= 0x7f) { - return data; - } - else if (data.length <= 55) { - data.unshift(0x80 + data.length); - return data; - } - const length = arrayifyInteger(data.length); - length.unshift(0xb7 + length.length); - return length.concat(data); -} -function encode(object) { - return (0, data_js_1.hexlify)(_encode(object)); -} -exports.encode = encode; -function _decodeChildren(data, offset, childOffset, length) { - const result = []; - while (childOffset < offset + 1 + length) { - const decoded = _decode(data, childOffset); - result.push(decoded.result); - childOffset += decoded.consumed; - if (childOffset > offset + 1 + length) { - logger.throwError("child data too short", logger_js_1.Logger.errors.BUFFER_OVERRUN, {}); - } - } - return { consumed: 1 + length, result: result }; -} -// returns { consumed: number, result: Object } -function _decode(data, offset) { - if (data.length === 0) { - logger.throwError("data too short", logger_js_1.Logger.errors.BUFFER_OVERRUN, {}); - } - // Array with extra length prefix - if (data[offset] >= 0xf8) { - const lengthLength = data[offset] - 0xf7; - if (offset + 1 + lengthLength > data.length) { - logger.throwError("data short segment too short", logger_js_1.Logger.errors.BUFFER_OVERRUN, {}); - } - const length = unarrayifyInteger(data, offset + 1, lengthLength); - if (offset + 1 + lengthLength + length > data.length) { - logger.throwError("data long segment too short", logger_js_1.Logger.errors.BUFFER_OVERRUN, {}); - } - return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); - } - else if (data[offset] >= 0xc0) { - const length = data[offset] - 0xc0; - if (offset + 1 + length > data.length) { - logger.throwError("data array too short", logger_js_1.Logger.errors.BUFFER_OVERRUN, {}); - } - return _decodeChildren(data, offset, offset + 1, length); - } - else if (data[offset] >= 0xb8) { - const lengthLength = data[offset] - 0xb7; - if (offset + 1 + lengthLength > data.length) { - logger.throwError("data array too short", logger_js_1.Logger.errors.BUFFER_OVERRUN, {}); - } - const length = unarrayifyInteger(data, offset + 1, lengthLength); - if (offset + 1 + lengthLength + length > data.length) { - logger.throwError("data array too short", logger_js_1.Logger.errors.BUFFER_OVERRUN, {}); - } - const result = (0, data_js_1.hexlify)(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); - return { consumed: 1 + lengthLength + length, result: result }; - } - else if (data[offset] >= 0x80) { - const length = data[offset] - 0x80; - if (offset + 1 + length > data.length) { - logger.throwError("data too short", logger_js_1.Logger.errors.BUFFER_OVERRUN, {}); - } - const result = (0, data_js_1.hexlify)(data.slice(offset + 1, offset + 1 + length)); - return { consumed: 1 + length, result: result }; - } - return { consumed: 1, result: (0, data_js_1.hexlify)(data[offset]) }; -} -function decode(data) { - const bytes = (0, data_js_1.arrayify)(data); - const decoded = _decode(bytes, 0); - if (decoded.consumed !== bytes.length) { - logger.throwArgumentError("invalid rlp data", "data", data); - } - return decoded.result; -} -exports.decode = decode; -//# sourceMappingURL=rlp.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/rlp.js.map b/lib.commonjs/crypto/rlp.js.map deleted file mode 100644 index 295290e97..000000000 --- a/lib.commonjs/crypto/rlp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp.js","sourceRoot":"","sources":["../../src.ts/crypto/rlp.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,mDAA6C;AAC7C,8CAA6E;AAE7E,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,WAAW,CAAC,CAAC;AAEvC,SAAS,eAAe,CAAC,KAAa;IACpC,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,OAAO,KAAK,EAAE;QACZ,aAAa;QACb,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;QAC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A,iBAAO,EAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QACpE,OAAO,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;KACjD;IACD,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,IAAA,iBAAO,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;AACxD,CAAC;AAED,SAAgB,MAAM,CAAC,IAAe;IACpC,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAClC,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK,CAAC,MAAM,EAAE;QACrC,MAAM,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;KAC7D;IACD,OAAO,OAAO,CAAC,MAAM,CAAC;AACxB,CAAC;AAPD,wBAOC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/scrypt.d.ts b/lib.commonjs/crypto/scrypt.d.ts deleted file mode 100644 index b0e678f52..000000000 --- a/lib.commonjs/crypto/scrypt.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -import type { BytesLike } from "../utils/index.js"; -/** - * A callback during long-running operations to update any - * UI or provide programatic access to the progress. - * - * The %%percent%% is a value between ``0`` and ``1``. - * - * @_docloc: api/crypto:Passwords - */ -export type ProgressCallback = (percent: number) => void; -/** - * The [[link-wiki-scrypt]] uses a memory and cpu hard method of - * derivation to increase the resource cost to brute-force a password - * for a given key. - * - * This means this algorithm is intentionally slow, and can be tuned to - * become slower. As computation and memory speed improve over time, - * increasing the difficulty maintains the cost of an attacker. - * - * For example, if a target time of 5 seconds is used, a legitimate user - * which knows their password requires only 5 seconds to unlock their - * account. A 6 character password has 68 billion possibilities, which - * would require an attacker to invest over 10,000 years of CPU time. This - * is of course a crude example (as password generally aren't random), - * but demonstrates to value of imposing large costs to decryption. - * - * For this reason, if building a UI which involved decrypting or - * encrypting datsa using scrypt, it is recommended to use a - * [[ProgressCallback]] (as event short periods can seem lik an eternity - * if the UI freezes). Including the phrase //"decrypting"// in the UI - * can also help, assuring the user their waiting is for a good reason. - * - * @_docloc: api/crypto:Passwords - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the scrypt - * scrypt(passwordBytes, salt, 1024, 8, 1, 16) - * //_result: - */ -export declare function scrypt(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback): Promise; -export declare namespace scrypt { - var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, onProgress?: ProgressCallback | undefined) => Promise; - var lock: () => void; - var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback | undefined) => Promise) => void; -} -/** - * Provides a synchronous variant of [[scrypt]]. - * - * This will completely lock up and freeze the UI in a browser and will - * prevent any event loop from progressing. For this reason, it is - * preferred to use the [async variant](scrypt). - * - * @_docloc: api/crypto:Passwords - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the scrypt - * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) - * //_result: - */ -export declare function scryptSync(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number): string; -export declare namespace scryptSync { - var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => Uint8Array; - var lock: () => void; - var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => BytesLike) => void; -} -//# sourceMappingURL=scrypt.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/scrypt.d.ts.map b/lib.commonjs/crypto/scrypt.d.ts.map deleted file mode 100644 index b8a706e0e..000000000 --- a/lib.commonjs/crypto/scrypt.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scrypt.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/scrypt.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AA6CzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,MAAM,CAC1B,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,SAAS,EAChB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAIjB;yBAZqB,MAAM;;;;;AAmC5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,SAAS,EAChB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,GACZ,MAAM,CAIR;yBAXe,UAAU"} \ No newline at end of file diff --git a/lib.commonjs/crypto/scrypt.js b/lib.commonjs/crypto/scrypt.js deleted file mode 100644 index fbb2202d2..000000000 --- a/lib.commonjs/crypto/scrypt.js +++ /dev/null @@ -1,108 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.scryptSync = exports.scrypt = void 0; -const scrypt_1 = require("@noble/hashes/scrypt"); -const index_js_1 = require("../utils/index.js"); -let lockedSync = false, lockedAsync = false; -const _scryptAsync = async function (passwd, salt, N, r, p, dkLen, onProgress) { - return await (0, scrypt_1.scryptAsync)(passwd, salt, { N, r, p, dkLen, onProgress }); -}; -const _scryptSync = function (passwd, salt, N, r, p, dkLen) { - return (0, scrypt_1.scrypt)(passwd, salt, { N, r, p, dkLen }); -}; -let __scryptAsync = _scryptAsync; -let __scryptSync = _scryptSync; -/** - * The [[link-wiki-scrypt]] uses a memory and cpu hard method of - * derivation to increase the resource cost to brute-force a password - * for a given key. - * - * This means this algorithm is intentionally slow, and can be tuned to - * become slower. As computation and memory speed improve over time, - * increasing the difficulty maintains the cost of an attacker. - * - * For example, if a target time of 5 seconds is used, a legitimate user - * which knows their password requires only 5 seconds to unlock their - * account. A 6 character password has 68 billion possibilities, which - * would require an attacker to invest over 10,000 years of CPU time. This - * is of course a crude example (as password generally aren't random), - * but demonstrates to value of imposing large costs to decryption. - * - * For this reason, if building a UI which involved decrypting or - * encrypting datsa using scrypt, it is recommended to use a - * [[ProgressCallback]] (as event short periods can seem lik an eternity - * if the UI freezes). Including the phrase //"decrypting"// in the UI - * can also help, assuring the user their waiting is for a good reason. - * - * @_docloc: api/crypto:Passwords - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the scrypt - * scrypt(passwordBytes, salt, 1024, 8, 1, 16) - * //_result: - */ -async function scrypt(_passwd, _salt, N, r, p, dkLen, progress) { - const passwd = (0, index_js_1.getBytes)(_passwd, "passwd"); - const salt = (0, index_js_1.getBytes)(_salt, "salt"); - return (0, index_js_1.hexlify)(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress)); -} -exports.scrypt = scrypt; -scrypt._ = _scryptAsync; -scrypt.lock = function () { - lockedAsync = true; -}; -scrypt.register = function (func) { - if (lockedAsync) { - throw new Error("scrypt is locked"); - } - __scryptAsync = func; -}; -Object.freeze(scrypt); -/** - * Provides a synchronous variant of [[scrypt]]. - * - * This will completely lock up and freeze the UI in a browser and will - * prevent any event loop from progressing. For this reason, it is - * preferred to use the [async variant](scrypt). - * - * @_docloc: api/crypto:Passwords - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the scrypt - * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) - * //_result: - */ -function scryptSync(_passwd, _salt, N, r, p, dkLen) { - const passwd = (0, index_js_1.getBytes)(_passwd, "passwd"); - const salt = (0, index_js_1.getBytes)(_salt, "salt"); - return (0, index_js_1.hexlify)(__scryptSync(passwd, salt, N, r, p, dkLen)); -} -exports.scryptSync = scryptSync; -scryptSync._ = _scryptSync; -scryptSync.lock = function () { - lockedSync = true; -}; -scryptSync.register = function (func) { - if (lockedSync) { - throw new Error("scryptSync is locked"); - } - __scryptSync = func; -}; -Object.freeze(scryptSync); -//# sourceMappingURL=scrypt.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/scrypt.js.map b/lib.commonjs/crypto/scrypt.js.map deleted file mode 100644 index fe14e9403..000000000 --- a/lib.commonjs/crypto/scrypt.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scrypt.js","sourceRoot":"","sources":["../../src.ts/crypto/scrypt.ts"],"names":[],"mappings":";;;AAAA,iDAG8B;AAE9B,gDAA2D;AAc3D,IAAI,UAAU,GAAG,KAAK,EACpB,WAAW,GAAG,KAAK,CAAC;AAEtB,MAAM,YAAY,GAAG,KAAK,WACxB,MAAkB,EAClB,IAAgB,EAChB,CAAS,EACT,CAAS,EACT,CAAS,EACT,KAAa,EACb,UAA6B;IAE7B,OAAO,MAAM,IAAA,oBAAW,EAAC,M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AAM,CAAC,CAAC;AAEtB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,UAAU,CACxB,OAAkB,EAClB,KAAgB,EAChB,CAAS,EACT,CAAS,EACT,CAAS,EACT,KAAa;IAEb,MAAM,MAAM,GAAG,IAAA,mBAAQ,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAC,EAAC,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AACvD,CAAC;AAXD,gCAWC;AACD,UAAU,CAAC,CAAC,GAAG,WAAW,CAAC;AAC3B,UAAU,CAAC,IAAI,GAAG;IAChB,UAAU,GAAG,IAAI,CAAC;AACpB,CAAC,CAAC;AACF,UAAU,CAAC,QAAQ,GAAG,UACpB,IAOc;IAEd,IAAI,UAAU,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;KACzC;IACD,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/sha3.d.ts b/lib.commonjs/crypto/sha3.d.ts deleted file mode 100644 index e9130d128..000000000 --- a/lib.commonjs/crypto/sha3.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { BytesLike } from "../utils/data.js"; -/** - * Compute the cryptographic SHA2-256 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha256("0x") - * //_result: - * - * sha256("0x1337") - * //_result: - * - * sha256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ -export declare enum SupportedAlgorithm { - sha256 = "sha256", - sha512 = "sha512" -} -export declare function ripemd160(data: BytesLike): string; -export declare function sha256(data: BytesLike): string; -export declare namespace sha256 { - var _: (data: Uint8Array) => string; - var lock: () => void; - var register: (func: (data: Uint8Array) => BytesLike) => void; -} -export declare function legacySha256(data: BytesLike): string; -export declare function computeHmac(algorithm: SupportedAlgorithm, key: BytesLike, data: BytesLike): string; -/** - * Compute the cryptographic SHA2-512 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha512("0x") - * //_result: - * - * sha512("0x1337") - * //_result: - * - * sha512(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - */ -export declare function sha512(data: BytesLike): string; -export declare namespace sha512 { - var _: (data: Uint8Array) => string; - var lock: () => void; - var register: (func: (data: Uint8Array) => BytesLike) => void; -} -//# sourceMappingURL=sha3.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/sha3.d.ts.map b/lib.commonjs/crypto/sha3.d.ts.map deleted file mode 100644 index 62d2f90aa..000000000 --- a/lib.commonjs/crypto/sha3.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha3.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/sha3.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,SAAS,EAAqB,MAAM,kBAAkB,CAAC;AAgC1E;;;;;;;;;;;;;;;;GAgBG;AACH,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAYjD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAU9C;yBAVe,MAAM;;;;;AAYtB,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAIpD;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,kBAAkB,EAC7B,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,SAAS,GACd,MAAM,CAkBR;AAcD;;;;;;;;;;;;;;;GAeG;AAEH,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAU9C;yBAVe,MAAM"} \ No newline at end of file diff --git a/lib.commonjs/crypto/sha3.js b/lib.commonjs/crypto/sha3.js deleted file mode 100644 index 457bf37a5..000000000 --- a/lib.commonjs/crypto/sha3.js +++ /dev/null @@ -1,147 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.sha512 = exports.computeHmac = exports.legacySha256 = exports.sha256 = exports.ripemd160 = exports.SupportedAlgorithm = void 0; -const logger_js_1 = require("../logger/logger.js"); -const data_js_1 = require("../utils/data.js"); -const crypto_js_1 = require("./crypto.js"); -const buffer_1 = require("buffer"); -const logger = new logger_js_1.Logger("sha3/0.0.1"); -const _sha256 = function (data) { - let v = "0x" + - (0, crypto_js_1.createHash)("sha3-256") - .update(buffer_1.Buffer.from((0, data_js_1.arrayify)(data))) - .digest("hex"); - return v; -}; -const _sha512 = function (data) { - let v = "0x" + - (0, crypto_js_1.createHash)("sha3-512") - .update(buffer_1.Buffer.from((0, data_js_1.arrayify)(data))) - .digest("hex"); - return v; -}; -// @ts-ignore -let __sha256 = _sha256; -// @ts-ignore -let __sha512 = _sha512; -let locked256 = false, locked512 = false; -/** - * Compute the cryptographic SHA2-256 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha256("0x") - * //_result: - * - * sha256("0x1337") - * //_result: - * - * sha256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ -var SupportedAlgorithm; -(function (SupportedAlgorithm) { - SupportedAlgorithm["sha256"] = "sha256"; - SupportedAlgorithm["sha512"] = "sha512"; -})(SupportedAlgorithm || (exports.SupportedAlgorithm = SupportedAlgorithm = {})); -function ripemd160(data) { - let createdHash = "0x" + - (0, crypto_js_1.createHash)("ripemd160") - .update(buffer_1.Buffer.from((0, data_js_1.arrayify)(data))) - .digest("hex"); - const v = "0x" + createdHash; - if (typeof createdHash !== "string") { - createdHash = (0, data_js_1.hexlify)(createdHash); - return createdHash; - } - return v; -} -exports.ripemd160 = ripemd160; -function sha256(data) { - let createdHash = (0, crypto_js_1.createHash)("sha3-256") - .update(buffer_1.Buffer.from((0, data_js_1.arrayify)(data))) - .digest("hex"); - const v = "0x" + createdHash; - if (typeof createdHash !== "string") { - createdHash = (0, data_js_1.hexlify)(createdHash); - return createdHash; - } - return v; -} -exports.sha256 = sha256; -function legacySha256(data) { - const _data = (0, data_js_1.getBytes)(data, "data"); - const hexlified = (0, data_js_1.hexlify)((0, crypto_js_1.createHash)("sha256").update(_data).digest()); - return hexlified; -} -exports.legacySha256 = legacySha256; -function computeHmac(algorithm, key, data) { - const d = buffer_1.Buffer.from((0, data_js_1.arrayify)(data)); - const k = buffer_1.Buffer.from((0, data_js_1.arrayify)(key)); - if (algorithm === SupportedAlgorithm.sha256) { - return "0x" + (0, crypto_js_1.createHmac)("sha3-256", k).update(d).digest("hex"); - } - else if (algorithm === SupportedAlgorithm.sha512) { - return "0x" + (0, crypto_js_1.createHmac)("sha3-512", k).update(d).digest("hex"); - } - logger.throwError("unsupported algorithm - " + algorithm, logger_js_1.Logger.errors.UNSUPPORTED_OPERATION, { - operation: "computeHmac", - algorithm: algorithm, - }); - return ""; -} -exports.computeHmac = computeHmac; -sha256._ = _sha256; -sha256.lock = function () { - locked256 = true; -}; -sha256.register = function (func) { - if (locked256) { - throw new Error("sha256 is locked"); - } - __sha256 = func; -}; -Object.freeze(sha256); -/** - * Compute the cryptographic SHA2-512 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha512("0x") - * //_result: - * - * sha512("0x1337") - * //_result: - * - * sha512(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - */ -function sha512(data) { - let createdHash = (0, crypto_js_1.createHash)("sha3-512") - .update(buffer_1.Buffer.from((0, data_js_1.arrayify)(data))) - .digest("hex"); - const v = "0x" + createdHash; - if (typeof createdHash !== "string") { - createdHash = (0, data_js_1.hexlify)(createdHash); - return createdHash; - } - return v; -} -exports.sha512 = sha512; -sha512._ = _sha512; -sha512.lock = function () { - locked512 = true; -}; -sha512.register = function (func) { - if (locked512) { - throw new Error("sha512 is locked"); - } - __sha512 = func; -}; -Object.freeze(sha256); -//# sourceMappingURL=sha3.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/sha3.js.map b/lib.commonjs/crypto/sha3.js.map deleted file mode 100644 index 0b83136e6..000000000 --- a/lib.commonjs/crypto/sha3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha3.js","sourceRoot":"","sources":["../../src.ts/crypto/sha3.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAC7C,8CAA0E;AAC1E,2CAAqD;AACrD,mCAAgC;AAEhC,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,YAAY,CAAC,CAAC;AAExC,MAAM,OAAO,GAAG,UAAU,IAAgB;IACxC,IAAI,CAAC,GACH,IAAI;QACJ,IAAA,sBAAU,EAAC,UAAU,CAAC;aACnB,MAAM,CAAC,eAAM,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC;aACnC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,UAAU,IAAgB;IACxC,IAAI,CAAC,GACH,IAAI;QACJ,IAAA,sBAAU,EAAC,UAAU,CAAC;aACnB,MAAM,CAAC,eAAM,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC;aACnC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,aAAa;AACb,IAAI,QAAQ,GAAoC,OAAO,CAAC;AACxD,aAAa;AACb,IAAI,QAAQ,GAAoC,OAAO,CAAC;AAExD,IAAI,SAAS,GAAG,KAAK,EACnB,SAAS,GAAG,KAAK,CAAC;AAEpB;;;;;;;;;;;;;;;;GAgBG;AACH,IAAY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;;;;;;;;;;;;;;;GAeG;AAEH,SAAgB,MAAM,CAAC,IAAe;IACpC,IAAI,WAAW,GAAG,IAAA,sBAAU,EAAC,UAAU,CAAC;SACrC,MAAM,CAAC,eAAM,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC;SACnC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjB,MAAM,CAAC,GAAG,IAAI,GAAG,WAAW,CAAC;IAC7B,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACnC,WAAW,GAAG,IAAA,iBAAO,EAAC,WAAW,CAAC,CAAC;QACnC,OAAO,WAAW,CAAC;KACpB;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAVD,wBAUC;AACD,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC;AACnB,MAAM,CAAC,IAAI,GAAG;IACZ,SAAS,GAAG,IAAI,CAAC;AACnB,CAAC,CAAC;AACF,MAAM,CAAC,QAAQ,GAAG,UAAU,IAAqC;IAC/D,IAAI,SAAS,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KACrC;IACD,QAAQ,GAAG,IAAI,CAAC;AAClB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/signature.d.ts b/lib.commonjs/crypto/signature.d.ts deleted file mode 100644 index 075005c42..000000000 --- a/lib.commonjs/crypto/signature.d.ts +++ /dev/null @@ -1,131 +0,0 @@ -import type { BigNumberish, BytesLike } from "../utils/index.js"; -/** - * A SignatureLike - * - * @_docloc: api/crypto:Signing - */ -export type SignatureLike = string; -/** - * A Signature @TODO - * - * - * @_docloc: api/crypto:Signing - */ -export declare class Signature { - #private; - /** - * The ``r`` value for a signautre. - * - * This represents the ``x`` coordinate of a "reference" or - * challenge point, from which the ``y`` can be computed. - */ - get r(): string; - set r(value: BytesLike); - /** - * The ``s`` value for a signature. - */ - get s(): string; - set s(_value: BytesLike); - /** - * The ``v`` value for a signature. - * - * Since a given ``x`` value for ``r`` has two possible values for - * its correspondin ``y``, the ``v`` indicates which of the two ``y`` - * values to use. - * - * It is normalized to the values ``27`` or ``28`` for legacy - * purposes. - */ - get v(): 27 | 28; - set v(value: BigNumberish); - /** - * The EIP-155 ``v`` for legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get networkV(): null | bigint; - /** - * The chain ID for EIP-155 legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get legacynetworkId(): null | bigint; - /** - * The ``yParity`` for the signature. - * - * See ``v`` for more details on how this value is used. - */ - get yParity(): 0 | 1; - /** - * The [[link-eip-2098]] compact representation of the ``yParity`` - * and ``s`` compacted into a single ``bytes32``. - */ - get yParityAndS(): string; - /** - * The [[link-eip-2098]] compact representation. - */ - get compactSerialized(): string; - /** - * The serialized representation. - */ - get serialized(): string; - /** - * @private - */ - constructor(guard: any, r: string, s: string, v: 27 | 28); - /** - * Returns a new identical [[Signature]]. - */ - clone(): Signature; - /** - * Returns a representation that is compatible with ``JSON.stringify``. - */ - toJSON(): any; - /** - * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. - * - * @example: - * Signature.getnetworkId(45) - * //_result: - * - * Signature.getnetworkId(46) - * //_result: - */ - static getnetworkId(v: BigNumberish): bigint; - /** - * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. - * - * Legacy transactions which use [[link-eip-155]] hijack the ``v`` - * property to include the chain ID. - * - * @example: - * Signature.getnetworkIdV(5, 27) - * //_result: - * - * Signature.getnetworkIdV(5, 28) - * //_result: - * - */ - static getnetworkIdV(networkId: BigNumberish, v: 27 | 28): bigint; - /** - * Compute the normalized legacy transaction ``v`` from a ``yParirty``, - * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. - * - * @example: - * // The values 0 and 1 imply v is actually yParity - * Signature.getNormalizedV(0) - * //_result: - * - * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) - * Signature.getNormalizedV(27) - * //_result: - * - * // Legacy EIP-155 transaction (i.e. >= 35) - * Signature.getNormalizedV(46) - * //_result: - * - * // Invalid values throw - * Signature.getNormalizedV(5) - * //_error: - */ - static getNormalizedV(v: BigNumberish): 27 | 28; -} -//# sourceMappingURL=signature.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/signature.d.ts.map b/lib.commonjs/crypto/signature.d.ts.map deleted file mode 100644 index 83d7e9f37..000000000 --- a/lib.commonjs/crypto/signature.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signature.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAcjE;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC;;;;;GAKG;AACH,qBAAa,SAAS;;IAMpB;;;;;OAKG;IACH,IAAI,CAAC,IAAI,MAAM,CAEd;IACD,IAAI,CAAC,CAAC,KAAK,EAAE,SAAS,EAGrB;IAED;;OAEG;IACH,IAAI,CAAC,IAAI,MAAM,CAEd;IACD,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,EAUtB;IAED;;;;;;;;;OASG;IACH,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAEf;IACD,IAAI,CAAC,CAAC,KAAK,EAAE,YAAY,EAIxB;IAED;;;OAGG;IACH,IAAI,QAAQ,IAAI,IAAI,GAAG,MAAM,CAE5B;IAED;;;OAGG;IACH,IAAI,eAAe,IAAI,IAAI,GAAG,MAAM,CAMnC;IAED;;;;OAIG;IACH,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,CAEnB;IAED;;;OAGG;IACH,IAAI,WAAW,IAAI,MAAM,CAOxB;IAED;;OAEG;IACH,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE;IAYxD;;OAEG;IACH,KAAK,IAAI,SAAS;IAQlB;;OAEG;IACH,MAAM,IAAI,GAAG;IAWb;;;;;;;;;OASG;IACH,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM;IAc5C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,MAAM;IAIjE;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,YAAY,GAAG,EAAE,GAAG,EAAE;CAwBhD"} \ No newline at end of file diff --git a/lib.commonjs/crypto/signature.js b/lib.commonjs/crypto/signature.js deleted file mode 100644 index f3e24c859..000000000 --- a/lib.commonjs/crypto/signature.js +++ /dev/null @@ -1,225 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Signature = void 0; -const index_js_1 = require("../utils/index.js"); -// Constants -const BN_0 = BigInt(0); -const BN_1 = BigInt(1); -const BN_2 = BigInt(2); -const BN_27 = BigInt(27); -const BN_28 = BigInt(28); -const BN_35 = BigInt(35); -const _guard = {}; -/** - * A Signature @TODO - * - * - * @_docloc: api/crypto:Signing - */ -class Signature { - #r; - #s; - #v; - #networkV; - /** - * The ``r`` value for a signautre. - * - * This represents the ``x`` coordinate of a "reference" or - * challenge point, from which the ``y`` can be computed. - */ - get r() { - return this.#r; - } - set r(value) { - (0, index_js_1.assertArgument)((0, index_js_1.dataLength)(value) === 32, "invalid r", "value", value); - this.#r = (0, index_js_1.hexlify)(value); - } - /** - * The ``s`` value for a signature. - */ - get s() { - return this.#s; - } - set s(_value) { - (0, index_js_1.assertArgument)((0, index_js_1.dataLength)(_value) === 32, "invalid s", "value", _value); - const value = (0, index_js_1.hexlify)(_value); - (0, index_js_1.assertArgument)(parseInt(value.substring(0, 3)) < 8, "non-canonical s", "value", value); - this.#s = value; - } - /** - * The ``v`` value for a signature. - * - * Since a given ``x`` value for ``r`` has two possible values for - * its correspondin ``y``, the ``v`` indicates which of the two ``y`` - * values to use. - * - * It is normalized to the values ``27`` or ``28`` for legacy - * purposes. - */ - get v() { - return this.#v; - } - set v(value) { - const v = (0, index_js_1.getNumber)(value, "value"); - (0, index_js_1.assertArgument)(v === 27 || v === 28, "invalid v", "v", value); - this.#v = v; - } - /** - * The EIP-155 ``v`` for legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get networkV() { - return this.#networkV; - } - /** - * The chain ID for EIP-155 legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get legacynetworkId() { - const v = this.networkV; - if (v == null) { - return null; - } - return Signature.getnetworkId(v); - } - /** - * The ``yParity`` for the signature. - * - * See ``v`` for more details on how this value is used. - */ - get yParity() { - return this.v === 27 ? 0 : 1; - } - /** - * The [[link-eip-2098]] compact representation of the ``yParity`` - * and ``s`` compacted into a single ``bytes32``. - */ - get yParityAndS() { - // The EIP-2098 compact representation - const yParityAndS = (0, index_js_1.getBytes)(this.s); - if (this.yParity) { - yParityAndS[0] |= 0x80; - } - return (0, index_js_1.hexlify)(yParityAndS); - } - /** - * The [[link-eip-2098]] compact representation. - */ - get compactSerialized() { - return (0, index_js_1.concat)([this.r, this.yParityAndS]); - } - /** - * The serialized representation. - */ - get serialized() { - return (0, index_js_1.concat)([this.r, this.s, this.yParity ? "0x1c" : "0x1b"]); - } - /** - * @private - */ - constructor(guard, r, s, v) { - (0, index_js_1.assertPrivate)(guard, _guard, "Signature"); - this.#r = r; - this.#s = s; - this.#v = v; - this.#networkV = null; - } - [Symbol.for("nodejs.util.inspect.custom")]() { - return `Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`; - } - /** - * Returns a new identical [[Signature]]. - */ - clone() { - const clone = new Signature(_guard, this.r, this.s, this.v); - if (this.networkV) { - clone.#networkV = this.networkV; - } - return clone; - } - /** - * Returns a representation that is compatible with ``JSON.stringify``. - */ - toJSON() { - const networkV = this.networkV; - return { - _type: "signature", - networkV: networkV != null ? networkV.toString() : null, - r: this.r, - s: this.s, - v: this.v, - }; - } - /** - * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. - * - * @example: - * Signature.getnetworkId(45) - * //_result: - * - * Signature.getnetworkId(46) - * //_result: - */ - static getnetworkId(v) { - const bv = (0, index_js_1.getBigInt)(v, "v"); - // The v is not an EIP-155 v, so it is the unspecified chain ID - if (bv == BN_27 || bv == BN_28) { - return BN_0; - } - // Bad value for an EIP-155 v - (0, index_js_1.assertArgument)(bv >= BN_35, "invalid EIP-155 v", "v", v); - return (bv - BN_35) / BN_2; - } - /** - * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. - * - * Legacy transactions which use [[link-eip-155]] hijack the ``v`` - * property to include the chain ID. - * - * @example: - * Signature.getnetworkIdV(5, 27) - * //_result: - * - * Signature.getnetworkIdV(5, 28) - * //_result: - * - */ - static getnetworkIdV(networkId, v) { - return (0, index_js_1.getBigInt)(networkId) * BN_2 + BigInt(35 + v - 27); - } - /** - * Compute the normalized legacy transaction ``v`` from a ``yParirty``, - * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. - * - * @example: - * // The values 0 and 1 imply v is actually yParity - * Signature.getNormalizedV(0) - * //_result: - * - * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) - * Signature.getNormalizedV(27) - * //_result: - * - * // Legacy EIP-155 transaction (i.e. >= 35) - * Signature.getNormalizedV(46) - * //_result: - * - * // Invalid values throw - * Signature.getNormalizedV(5) - * //_error: - */ - static getNormalizedV(v) { - const bv = (0, index_js_1.getBigInt)(v); - if (bv === BN_0 || bv === BN_27) { - return 27; - } - if (bv === BN_1 || bv === BN_28) { - return 28; - } - (0, index_js_1.assertArgument)(bv >= BN_35, "invalid v", "v", v); - // Otherwise, EIP-155 v means odd is 27 and even is 28 - return bv & BN_1 ? 27 : 28; - } -} -exports.Signature = Signature; -//# sourceMappingURL=signature.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/signature.js.map b/lib.commonjs/crypto/signature.js.map deleted file mode 100644 index 0a50ae988..000000000 --- a/lib.commonjs/crypto/signature.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src.ts/crypto/signature.ts"],"names":[],"mappings":";;;AAAA,gDAS2B;AAI3B,YAAY;AACZ,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AACzB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AACzB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEzB,MAAM,MAAM,GAAG,EAAE,CAAC;AAWlB;;;;;GAKG;AACH,MAAa,SAAS;IACpB,EAAE,CAAS;IACX,EAAE,CAAS;IACX,EAAE,CAAU;IACZ,SAAS,CAAgB;IAEzB;;;;;OAKG;IACH,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IACD,IAAI,CAAC,CAAC,KAAgB;QACpB,IAAA,yBAAc,EAAC,IAAA,qBAAU,EAAC,KAAK,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACtE,IAAI,CAAC,EAAE,GAAG,IAAA,kBAAO,EAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IACD,IAAI,CAAC,CAAC,MAAiB;QACrB,IAAA,yBAAc,EAAC,IAAA,qBA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K,EAAE;YAC/B,OAAO,EAAE,CAAC;SACX;QACD,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,KAAK,EAAE;YAC/B,OAAO,EAAE,CAAC;SACX;QAED,IAAA,yBAAc,EAAC,EAAE,IAAI,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QAEjD,sDAAsD;QACtD,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7B,CAAC;CAUF;AAhPD,8BAgPC"} \ No newline at end of file diff --git a/lib.commonjs/crypto/signing-key.d.ts b/lib.commonjs/crypto/signing-key.d.ts deleted file mode 100644 index a030dac26..000000000 --- a/lib.commonjs/crypto/signing-key.d.ts +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Add details about signing here. - * - * @_subsection: api/crypto:Signing [about-signing] - */ -import type { BytesLike } from "../utils/index.js"; -import type { SignatureLike } from "./index.js"; -/** - * A **SigningKey** provides high-level access to the elliptic curve - * cryptography (ECC) operations and key management. - */ -export declare class SigningKey { - #private; - /** - * Creates a new **SigningKey** for %%privateKey%%. - */ - constructor(privateKey: BytesLike); - /** - * The private key. - */ - get privateKey(): string; - /** - * The uncompressed public key. - * - * This will always begin with the prefix ``0x04`` and be 132 - * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). - */ - get publicKey(): string; - /** - * The compressed public key. - * - * This will always begin with either the prefix ``0x02`` or ``0x03`` - * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal - * nibbles) - */ - get compressedPublicKey(): string; - /** - * Return the signature of the signed %%digest%%. - */ - sign(digest: BytesLike): string; - /** - * Returns the [[link-wiki-ecdh]] shared secret between this - * private key and the %%other%% key. - * - * The %%other%% key may be any type of key, a raw public key, - * a compressed/uncompressed pubic key or aprivate key. - * - * Best practice is usually to use a cryptographic hash on the - * returned value before using it as a symetric secret. - * - * @example: - * sign1 = new SigningKey(id("some-secret-1")) - * sign2 = new SigningKey(id("some-secret-2")) - * - * // Notice that privA.computeSharedSecret(pubB)... - * sign1.computeSharedSecret(sign2.publicKey) - * //_result: - * - * // ...is equal to privB.computeSharedSecret(pubA). - * sign2.computeSharedSecret(sign1.publicKey) - * //_result: - */ - computeSharedSecret(other: BytesLike): string; - /** - * Compute the public key for %%key%%, optionally %%compressed%%. - * - * The %%key%% may be any type of key, a raw public key, a - * compressed/uncompressed public key or private key. - * - * @example: - * sign = new SigningKey(id("some-secret")); - * - * // Compute the uncompressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey) - * //_result: - * - * // Compute the compressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey, true) - * //_result: - * - * // Compute the uncompressed public key - * SigningKey.computePublicKey(sign.publicKey, false); - * //_result: - * - * // Compute the Compressed a public key - * SigningKey.computePublicKey(sign.publicKey, true); - * //_result: - */ - static computePublicKey(key: BytesLike, compressed?: boolean): string; - /** - * Returns the public key for the private key which produced the - * %%signature%% for the given %%digest%%. - * - * @example: - * key = new SigningKey(id("some-secret")) - * digest = id("hello world") - * sig = key.sign(digest) - * - * // Notice the signer public key... - * key.publicKey - * //_result: - * - * // ...is equal to the recovered public key - * SigningKey.recoverPublicKey(digest, sig) - * //_result: - * - */ - static recoverPublicKey(digest: BytesLike, signature: SignatureLike): string; - /** - * Returns the point resulting from adding the ellipic curve points - * %%p0%% and %%p1%%. - * - * This is not a common function most developers should require, but - * can be useful for certain privacy-specific techniques. - * - * For example, it is used by [[HDNodeWallet]] to compute child - * addresses from parent public keys and chain codes. - */ - static addPoints(p0: BytesLike, p1: BytesLike, compressed?: boolean): string; -} -//# sourceMappingURL=signing-key.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/crypto/signing-key.d.ts.map b/lib.commonjs/crypto/signing-key.d.ts.map deleted file mode 100644 index b5aea9127..000000000 --- a/lib.commonjs/crypto/signing-key.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signing-key.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAYhD;;;GAGG;AACH,qBAAa,UAAU;;IAGrB;;OAEG;gBACS,UAAU,EAAE,SAAS;IAcjC;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;;;;OAKG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;;;;;OAMG;IACH,IAAI,mBAAmB,IAAI,MAAM,CAEhC;IAED;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM;IAmC/B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAU7C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;IAkBrE;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM;IAqB5E;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;CAS7E"} \ No newline at end of file diff --git a/lib.commonjs/crypto/signing-key.js b/lib.commonjs/crypto/signing-key.js deleted file mode 100644 index d819085d9..000000000 --- a/lib.commonjs/crypto/signing-key.js +++ /dev/null @@ -1,208 +0,0 @@ -"use strict"; -/** - * Add details about signing here. - * - * @_subsection: api/crypto:Signing [about-signing] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SigningKey = void 0; -const tslib_1 = require("tslib"); -const secp256k1 = tslib_1.__importStar(require("@noble/secp256k1")); -const index_js_1 = require("../utils/index.js"); -const data_js_1 = require("../utils/data.js"); -const logger_js_1 = require("../logger/logger.js"); -const crypto_js_1 = require("./crypto.js"); -const buffer_1 = require("buffer"); -const logger = new logger_js_1.Logger("signing-key/0.0.1"); -//const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); -// Make noble-secp256k1 sync -/** - * A **SigningKey** provides high-level access to the elliptic curve - * cryptography (ECC) operations and key management. - */ -class SigningKey { - #privateKey; - /** - * Creates a new **SigningKey** for %%privateKey%%. - */ - constructor(privateKey) { - let tmp = privateKey; - if (typeof tmp === "string" && tmp.startsWith("0x")) { - tmp = tmp.replace("0x", ""); - } - (0, index_js_1.assertArgument)((0, index_js_1.dataLength)("0x" + tmp) === 57, "invalid private key", "privateKey", "[REDACTED]"); - this.#privateKey = (0, index_js_1.hexlify)("0x" + tmp); - } - /** - * The private key. - */ - get privateKey() { - return this.#privateKey; - } - /** - * The uncompressed public key. - * - * This will always begin with the prefix ``0x04`` and be 132 - * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). - */ - get publicKey() { - return SigningKey.computePublicKey(this.#privateKey); - } - /** - * The compressed public key. - * - * This will always begin with either the prefix ``0x02`` or ``0x03`` - * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal - * nibbles) - */ - get compressedPublicKey() { - return SigningKey.computePublicKey(this.#privateKey, true); - } - /** - * Return the signature of the signed %%digest%%. - */ - sign(digest) { - const key = (0, index_js_1.getBytesCopy)(this.#privateKey); - (0, index_js_1.assertArgument)((0, index_js_1.dataLength)(digest) === 32, "invalid digest length", "digest", digest); - const keyBuffer = new Uint8Array((0, data_js_1.arrayify)(key)); - if (keyBuffer.length !== 57) { - logger.throwArgumentError("invalid private key", "key", "[REDACTED]"); - } - const digestBuffer = new Uint8Array((0, data_js_1.arrayify)(digest)); - if (digestBuffer.length !== 32) { - logger.throwArgumentError("bad digest length", "digest", digest); - } - if (keyBuffer[56] > 127) { - const prefix = keyBuffer.slice(0, 57); - prefix[0] &= 0xfc; - prefix[55] |= 0x80; - prefix[56] = 0; - const scalar = prefix.slice(0, 56); - const bufferDigest = buffer_1.Buffer.from(digestBuffer); - const bufferPrfx = buffer_1.Buffer.from(prefix); - const bufferScalar = buffer_1.Buffer.from(scalar); - const sig = crypto_js_1.ed448.signWithScalar(bufferDigest, bufferScalar, bufferPrfx); - const hexlified = (0, index_js_1.hexlify)(sig); - return (0, data_js_1.hexConcat)([hexlified, this.publicKey]); - } - const sig = crypto_js_1.ed448.sign(buffer_1.Buffer.from(digestBuffer), buffer_1.Buffer.from(keyBuffer)); - const hexlified = (0, index_js_1.hexlify)(sig); - return (0, data_js_1.hexConcat)([hexlified, this.publicKey]); - } - /** - * Returns the [[link-wiki-ecdh]] shared secret between this - * private key and the %%other%% key. - * - * The %%other%% key may be any type of key, a raw public key, - * a compressed/uncompressed pubic key or aprivate key. - * - * Best practice is usually to use a cryptographic hash on the - * returned value before using it as a symetric secret. - * - * @example: - * sign1 = new SigningKey(id("some-secret-1")) - * sign2 = new SigningKey(id("some-secret-2")) - * - * // Notice that privA.computeSharedSecret(pubB)... - * sign1.computeSharedSecret(sign2.publicKey) - * //_result: - * - * // ...is equal to privB.computeSharedSecret(pubA). - * sign2.computeSharedSecret(sign1.publicKey) - * //_result: - */ - computeSharedSecret(other) { - const pubKey = SigningKey.computePublicKey(other); - return (0, index_js_1.hexlify)(secp256k1.getSharedSecret((0, index_js_1.getBytesCopy)(this.#privateKey), (0, index_js_1.getBytes)(pubKey))); - } - /** - * Compute the public key for %%key%%, optionally %%compressed%%. - * - * The %%key%% may be any type of key, a raw public key, a - * compressed/uncompressed public key or private key. - * - * @example: - * sign = new SigningKey(id("some-secret")); - * - * // Compute the uncompressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey) - * //_result: - * - * // Compute the compressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey, true) - * //_result: - * - * // Compute the uncompressed public key - * SigningKey.computePublicKey(sign.publicKey, false); - * //_result: - * - * // Compute the Compressed a public key - * SigningKey.computePublicKey(sign.publicKey, true); - * //_result: - */ - static computePublicKey(key, compressed) { - const bytes = buffer_1.Buffer.from((0, data_js_1.arrayify)(key)); - if (bytes.length !== 57) { - logger.throwArgumentError("invalid private key", "key", "[REDACTED]"); - } - if (bytes[56] > 127) { - const scalar = bytes.slice(0, 56); - scalar[0] &= 0xfc; - scalar[55] |= 0x80; - const pub = crypto_js_1.ed448.publicKeyFromScalar(scalar); - return (0, index_js_1.hexlify)(pub); - } - const pub = crypto_js_1.ed448.publicKeyCreate(bytes); - return (0, index_js_1.hexlify)(pub); - } - /** - * Returns the public key for the private key which produced the - * %%signature%% for the given %%digest%%. - * - * @example: - * key = new SigningKey(id("some-secret")) - * digest = id("hello world") - * sig = key.sign(digest) - * - * // Notice the signer public key... - * key.publicKey - * //_result: - * - * // ...is equal to the recovered public key - * SigningKey.recoverPublicKey(digest, sig) - * //_result: - * - */ - static recoverPublicKey(digest, signature) { - (0, index_js_1.assertArgument)((0, index_js_1.dataLength)(digest) === 32, "invalid digest length", "digest", digest); - const digestBuffer = buffer_1.Buffer.from((0, data_js_1.arrayify)(digest)); - const sigBuffer = buffer_1.Buffer.from((0, data_js_1.arrayify)(signature)); - if (sigBuffer.length !== 171) { - logger.throwArgumentError("invalid signature", "signature", signature); - } - const sig = sigBuffer.slice(0, 114); - const pub = sigBuffer.slice(114); - if (crypto_js_1.ed448.verify(digestBuffer, sig, pub)) { - return (0, index_js_1.hexlify)(pub); - } - logger.throwArgumentError("invalid signature", "signature", signature); - return ""; - } - /** - * Returns the point resulting from adding the ellipic curve points - * %%p0%% and %%p1%%. - * - * This is not a common function most developers should require, but - * can be useful for certain privacy-specific techniques. - * - * For example, it is used by [[HDNodeWallet]] to compute child - * addresses from parent public keys and chain codes. - */ - static addPoints(p0, p1, compressed) { - const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2)); - const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2)); - return "0x" + pub0.add(pub1).toHex(!!compressed); - } -} -exports.SigningKey = SigningKey; -//# sourceMappingURL=signing-key.js.map \ No newline at end of file diff --git a/lib.commonjs/crypto/signing-key.js.map b/lib.commonjs/crypto/signing-key.js.map deleted file mode 100644 index 8d36adb76..000000000 --- a/lib.commonjs/crypto/signing-key.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signing-key.js","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAEH,oEAA8C;AAE9C,gDAM2B;AAK3B,8CAAuD;AACvD,mDAA6C;AAC7C,2CAAoC;AACpC,mCAAgC;AAEhC,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,mBAAmB,CAAC,CAAC;AAE/C,yFAAyF;AAEzF,4BAA4B;AAE5B;;;GAGG;AACH,MAAa,UAAU;IACrB,WAAW,CAAS;IAEpB;;OAEG;IACH,YAAY,UAAqB;QAC/B,IAAI,GAAG,GAAC,UAAU,CAAA;QAClB,IAAG,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAC;YACjD,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;SAC7B;QACD,IAAA,yBAAc,EACZ,IAAA,qBAAU,EAAC,IAAI,GAAG,GAAG,CAAC,KAAK,EAAE,EAC7B,qBAAqB,EACrB,YAAY,EACZ,YAAY,CACb,CAAC;QACF,IAAI,CAAC,WAAW,GAAG,IAAA,kBAAO,EAAC,IAAI,GAAG,GAAG,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACH,IAAI,SAAS;QACX,OAAO,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;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C,YAAY,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;YACxC,OAAO,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC;SACrB;QACD,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QACvE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CAAC,EAAa,EAAE,EAAa,EAAE,UAAoB;QACjE,MAAM,IAAI,GAAG,SAAS,CAAC,eAAe,CAAC,OAAO,CAC5C,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAC7C,CAAC;QACF,MAAM,IAAI,GAAG,SAAS,CAAC,eAAe,CAAC,OAAO,CAC5C,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAC7C,CAAC;QACF,OAAO,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;CACF;AA3ND,gCA2NC"} \ No newline at end of file diff --git a/lib.commonjs/hash/id.d.ts b/lib.commonjs/hash/id.d.ts deleted file mode 100644 index c55374a67..000000000 --- a/lib.commonjs/hash/id.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * A simple hashing function which operates on UTF-8 strings to - * compute an 32-byte identifier. - * - * - * @example: - * id("hello world") - * //_result: - */ -export declare function id(value: string, useKeccak?: boolean): string; -//# sourceMappingURL=id.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/hash/id.d.ts.map b/lib.commonjs/hash/id.d.ts.map deleted file mode 100644 index 140f79634..000000000 --- a/lib.commonjs/hash/id.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../src.ts/hash/id.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,wBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAK7D"} \ No newline at end of file diff --git a/lib.commonjs/hash/id.js b/lib.commonjs/hash/id.js deleted file mode 100644 index 1f1489c37..000000000 --- a/lib.commonjs/hash/id.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.id = void 0; -const keccak_js_1 = require("../crypto/keccak.js"); -const sha3_js_1 = require("../crypto/sha3.js"); -const index_js_1 = require("../utils/index.js"); -/** - * A simple hashing function which operates on UTF-8 strings to - * compute an 32-byte identifier. - * - * - * @example: - * id("hello world") - * //_result: - */ -function id(value, useKeccak) { - if (useKeccak) { - return (0, keccak_js_1.keccak256)((0, index_js_1.toUtf8Bytes)(value)); - } - return (0, sha3_js_1.sha256)((0, index_js_1.toUtf8Bytes)(value)); -} -exports.id = id; -//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/lib.commonjs/hash/id.js.map b/lib.commonjs/hash/id.js.map deleted file mode 100644 index 129cf8f51..000000000 --- a/lib.commonjs/hash/id.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"id.js","sourceRoot":"","sources":["../../src.ts/hash/id.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAChD,+CAA2C;AAC3C,gDAAgD;AAEhD;;;;;;;;GAQG;AACH,SAAgB,EAAE,CAAC,KAAa,EAAE,SAAmB;IACnD,IAAI,SAAS,EAAE;QACb,OAAO,IAAA,qBAAS,EAAC,IAAA,sBAAW,EAAC,KAAK,CAAC,CAAC,CAAC;KACtC;IACD,OAAO,IAAA,gBAAM,EAAC,IAAA,sBAAW,EAAC,KAAK,CAAC,CAAC,CAAC;AACpC,CAAC;AALD,gBAKC"} \ No newline at end of file diff --git a/lib.commonjs/hash/index.d.ts b/lib.commonjs/hash/index.d.ts deleted file mode 100644 index a9ba6fa23..000000000 --- a/lib.commonjs/hash/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * About hashing here... - * - * @_section: api/hashing:Hashing Utilities [about-hashing] - */ -export { id } from "./id.js"; -export { hashMessage, verifyMessage } from "./message.js"; -export { solidityPacked, solidityPackedSha256 } from "./solidity.js"; -export { TypedDataEncoder, verifyTypedData } from "./typed-data.js"; -export type { TypedDataDomain, TypedDataField } from "./typed-data.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/hash/index.d.ts.map b/lib.commonjs/hash/index.d.ts.map deleted file mode 100644 index 70eb7509e..000000000 --- a/lib.commonjs/hash/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/hash/index.js b/lib.commonjs/hash/index.js deleted file mode 100644 index 8ce260a85..000000000 --- a/lib.commonjs/hash/index.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -/** - * About hashing here... - * - * @_section: api/hashing:Hashing Utilities [about-hashing] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.verifyTypedData = exports.TypedDataEncoder = exports.solidityPackedSha256 = exports.solidityPacked = exports.verifyMessage = exports.hashMessage = exports.id = void 0; -var id_js_1 = require("./id.js"); -Object.defineProperty(exports, "id", { enumerable: true, get: function () { return id_js_1.id; } }); -var message_js_1 = require("./message.js"); -Object.defineProperty(exports, "hashMessage", { enumerable: true, get: function () { return message_js_1.hashMessage; } }); -Object.defineProperty(exports, "verifyMessage", { enumerable: true, get: function () { return message_js_1.verifyMessage; } }); -var solidity_js_1 = require("./solidity.js"); -Object.defineProperty(exports, "solidityPacked", { enumerable: true, get: function () { return solidity_js_1.solidityPacked; } }); -Object.defineProperty(exports, "solidityPackedSha256", { enumerable: true, get: function () { return solidity_js_1.solidityPackedSha256; } }); -var typed_data_js_1 = require("./typed-data.js"); -Object.defineProperty(exports, "TypedDataEncoder", { enumerable: true, get: function () { return typed_data_js_1.TypedDataEncoder; } }); -Object.defineProperty(exports, "verifyTypedData", { enumerable: true, get: function () { return typed_data_js_1.verifyTypedData; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.commonjs/hash/index.js.map b/lib.commonjs/hash/index.js.map deleted file mode 100644 index 7d729b70d..000000000 --- a/lib.commonjs/hash/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,iCAA6B;AAApB,2FAAA,EAAE,OAAA;AACX,2CAA0D;AAAjD,yGAAA,WAAW,OAAA;AAAE,2GAAA,aAAa,OAAA;AACnC,6CAAqE;AAA5D,6GAAA,cAAc,OAAA;AAAE,mHAAA,oBAAoB,OAAA;AAC7C,iDAAoE;AAA3D,iHAAA,gBAAgB,OAAA;AAAE,gHAAA,eAAe,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/hash/message.d.ts b/lib.commonjs/hash/message.d.ts deleted file mode 100644 index c7776facd..000000000 --- a/lib.commonjs/hash/message.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { SignatureLike } from "../crypto/index.js"; -/** - * Computes the [[link-eip-191]] personal-sign message digest to sign. - * - * - * If %%message%% is a string, it is converted to its UTF-8 bytes - * first. To compute the digest of a [[DataHexString]], it must be converted - * to [bytes](getBytes). - * - * @example: - * hashMessage("Hello World") - * //_result: - * - * // Hashes the SIX (6) string characters, i.e. - * // [ "0", "x", "4", "2", "4", "3" ] - * hashMessage("0x4243") - * //_result: - * - * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... - * hashMessage(getBytes("0x4243")) - * //_result: - * - * // ...which is equal to using data - * hashMessage(new Uint8Array([ 0x42, 0x43 ])) - * //_result: - * - */ -export declare function hashMessage(message: Uint8Array | string): string; -/** - * Return the address of the private key that produced - * the signature %%sig%% during signing for %%message%%. - */ -export declare function verifyMessage(message: Uint8Array | string, sig: SignatureLike, prefix: string): string; -//# sourceMappingURL=message.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/hash/message.d.ts.map b/lib.commonjs/hash/message.d.ts.map deleted file mode 100644 index 76c7dfa70..000000000 --- a/lib.commonjs/hash/message.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src.ts/hash/message.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC3D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAWhE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,UAAU,GAAG,MAAM,EAC5B,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,MAAM,GACb,MAAM,CAGR"} \ No newline at end of file diff --git a/lib.commonjs/hash/message.js b/lib.commonjs/hash/message.js deleted file mode 100644 index 4fcc140a5..000000000 --- a/lib.commonjs/hash/message.js +++ /dev/null @@ -1,54 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.verifyMessage = exports.hashMessage = void 0; -const index_js_1 = require("../constants/index.js"); -const index_js_2 = require("../transaction/index.js"); -const index_js_3 = require("../utils/index.js"); -const index_js_4 = require("../crypto/index.js"); -/** - * Computes the [[link-eip-191]] personal-sign message digest to sign. - * - * - * If %%message%% is a string, it is converted to its UTF-8 bytes - * first. To compute the digest of a [[DataHexString]], it must be converted - * to [bytes](getBytes). - * - * @example: - * hashMessage("Hello World") - * //_result: - * - * // Hashes the SIX (6) string characters, i.e. - * // [ "0", "x", "4", "2", "4", "3" ] - * hashMessage("0x4243") - * //_result: - * - * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... - * hashMessage(getBytes("0x4243")) - * //_result: - * - * // ...which is equal to using data - * hashMessage(new Uint8Array([ 0x42, 0x43 ])) - * //_result: - * - */ -function hashMessage(message) { - if (typeof message === "string") { - message = (0, index_js_3.toUtf8Bytes)(message); - } - return (0, index_js_4.sha256)((0, index_js_3.concat)([ - (0, index_js_3.toUtf8Bytes)(index_js_1.MessagePrefix), - (0, index_js_3.toUtf8Bytes)(String(message.length)), - message, - ])); -} -exports.hashMessage = hashMessage; -/** - * Return the address of the private key that produced - * the signature %%sig%% during signing for %%message%%. - */ -function verifyMessage(message, sig, prefix) { - const digest = hashMessage(message); - return (0, index_js_2.recoverAddress)(digest, sig, prefix); -} -exports.verifyMessage = verifyMessage; -//# sourceMappingURL=message.js.map \ No newline at end of file diff --git a/lib.commonjs/hash/message.js.map b/lib.commonjs/hash/message.js.map deleted file mode 100644 index 479763109..000000000 --- a/lib.commonjs/hash/message.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src.ts/hash/message.ts"],"names":[],"mappings":";;;AAAA,oDAAsD;AACtD,sDAAyD;AACzD,gDAAwD;AAExD,iDAA2D;AAC3D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,WAAW,CAAC,OAA4B;IACtD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,OAAO,GAAG,IAAA,sBAAW,EAAC,OAAO,CAAC,CAAC;KAChC;IACD,OAAO,IAAA,iBAAM,EACX,IAAA,iBAAM,EAAC;QACL,IAAA,sBAAW,EAAC,wBAAa,CAAC;QAC1B,IAAA,sBAAW,EAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,OAAO;KACR,CAAC,CACH,CAAC;AACJ,CAAC;AAXD,kCAWC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAC3B,OAA4B,EAC5B,GAAkB,EAClB,MAAc;IAEd,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,IAAA,yBAAc,EAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC;AAPD,sCAOC"} \ No newline at end of file diff --git a/lib.commonjs/hash/solidity.d.ts b/lib.commonjs/hash/solidity.d.ts deleted file mode 100644 index f6e66a454..000000000 --- a/lib.commonjs/hash/solidity.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Computes the [[link-solc-packed]] representation of %%values%% - * respectively to their %%types%%. - * - * @example: - * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" - * solidityPacked([ "address", "uint" ], [ addr, 45 ]); - * //_result: - */ -export declare function solidityPacked(types: ReadonlyArray, values: ReadonlyArray): string; -/** - * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% - * respectively to their %%types%%. - * - * @example: - * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" - * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); - * //_result: - */ -export declare function solidityPackedSha256(types: ReadonlyArray, values: ReadonlyArray): string; -//# sourceMappingURL=solidity.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/hash/solidity.d.ts.map b/lib.commonjs/hash/solidity.d.ts.map deleted file mode 100644 index 251b44140..000000000 --- a/lib.commonjs/hash/solidity.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"solidity.d.ts","sourceRoot":"","sources":["../../src.ts/hash/solidity.ts"],"names":[],"mappings":"AA8GA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GACzB,MAAM,CAaR;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GACzB,MAAM,CAER"} \ No newline at end of file diff --git a/lib.commonjs/hash/solidity.js b/lib.commonjs/hash/solidity.js deleted file mode 100644 index 3667dcd00..000000000 --- a/lib.commonjs/hash/solidity.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.solidityPackedSha256 = exports.solidityPacked = void 0; -const index_js_1 = require("../address/index.js"); -const index_js_2 = require("../crypto/index.js"); -const index_js_3 = require("../utils/index.js"); -const regexBytes = new RegExp("^bytes([0-9]+)$"); -const regexNumber = new RegExp("^(u?int)([0-9]*)$"); -const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); -function _pack(type, value, isArray) { - switch (type) { - case "address": - if (isArray) { - return (0, index_js_3.getBytes)((0, index_js_3.zeroPadValue)(value, 32)); - } - return (0, index_js_3.getBytes)((0, index_js_1.getAddress)(value)); - case "string": - return (0, index_js_3.toUtf8Bytes)(value); - case "bytes": - return (0, index_js_3.getBytes)(value); - case "bool": - value = !!value ? "0x01" : "0x00"; - if (isArray) { - return (0, index_js_3.getBytes)((0, index_js_3.zeroPadValue)(value, 32)); - } - return (0, index_js_3.getBytes)(value); - } - let match = type.match(regexNumber); - if (match) { - let signed = match[1] === "int"; - let size = parseInt(match[2] || "256"); - (0, index_js_3.assertArgument)((!match[2] || match[2] === String(size)) && - size % 8 === 0 && - size !== 0 && - size <= 256, "invalid number type", "type", type); - if (isArray) { - size = 256; - } - if (signed) { - value = (0, index_js_3.toTwos)(value, size); - } - return (0, index_js_3.getBytes)((0, index_js_3.zeroPadValue)((0, index_js_3.toBeArray)(value), size / 8)); - } - match = type.match(regexBytes); - if (match) { - const size = parseInt(match[1]); - (0, index_js_3.assertArgument)(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type); - (0, index_js_3.assertArgument)((0, index_js_3.dataLength)(value) === size, `invalid value for ${type}`, "value", value); - if (isArray) { - return (0, index_js_3.getBytes)((0, index_js_3.zeroPadBytes)(value, 32)); - } - return value; - } - match = type.match(regexArray); - if (match && Array.isArray(value)) { - const baseType = match[1]; - const count = parseInt(match[2] || String(value.length)); - (0, index_js_3.assertArgument)(count === value.length, `invalid array length for ${type}`, "value", value); - const result = []; - value.forEach(function (value) { - result.push(_pack(baseType, value, true)); - }); - return (0, index_js_3.getBytes)((0, index_js_3.concat)(result)); - } - (0, index_js_3.assertArgument)(false, "invalid type", "type", type); -} -// @TODO: Array Enum -/** - * Computes the [[link-solc-packed]] representation of %%values%% - * respectively to their %%types%%. - * - * @example: - * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" - * solidityPacked([ "address", "uint" ], [ addr, 45 ]); - * //_result: - */ -function solidityPacked(types, values) { - (0, index_js_3.assertArgument)(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values); - const tight = []; - types.forEach(function (type, index) { - tight.push(_pack(type, values[index])); - }); - return (0, index_js_3.hexlify)((0, index_js_3.concat)(tight)); -} -exports.solidityPacked = solidityPacked; -/** - * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% - * respectively to their %%types%%. - * - * @example: - * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" - * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); - * //_result: - */ -function solidityPackedSha256(types, values) { - return (0, index_js_2.sha256)(solidityPacked(types, values)); -} -exports.solidityPackedSha256 = solidityPackedSha256; -//# sourceMappingURL=solidity.js.map \ No newline at end of file diff --git a/lib.commonjs/hash/solidity.js.map b/lib.commonjs/hash/solidity.js.map deleted file mode 100644 index bd70a7127..000000000 --- a/lib.commonjs/hash/solidity.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"solidity.js","sourceRoot":"","sources":["../../src.ts/hash/solidity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ClC,KAA4B,EAC5B,MAA0B;IAE1B,OAAO,IAAA,iBAAO,EAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAChD,CAAC;AALD,oDAKC"} \ No newline at end of file diff --git a/lib.commonjs/hash/typed-data.d.ts b/lib.commonjs/hash/typed-data.d.ts deleted file mode 100644 index 76130b694..000000000 --- a/lib.commonjs/hash/typed-data.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import type { BigNumberish, BytesLike } from "../utils/index.js"; -export interface TypedDataDomain { - name?: null | string; - version?: null | string; - networkId?: null | BigNumberish; - verifyingContract?: null | string; - salt?: null | BytesLike; -} -export interface TypedDataField { - name: string; - type: string; -} -export declare class TypedDataEncoder { - #private; - readonly primaryType: string; - get types(): Record>; - constructor(types: Record>); - getEncoder(type: string): (value: any) => string; - encodeType(name: string): string; - encodeData(type: string, value: any): string; - hashStruct(name: string, value: Record): string; - encode(value: Record): string; - hash(value: Record): string; - _visit(type: string, value: any, callback: (type: string, data: any) => any): any; - visit(value: Record, callback: (type: string, data: any) => any): any; - static from(types: Record>): TypedDataEncoder; - static getPrimaryType(types: Record>): string; - static hashStruct(name: string, types: Record>, value: Record): string; - static hashDomain(domain: TypedDataDomain): string; - static encode(domain: TypedDataDomain, types: Record>, value: Record): string; - static hash(domain: TypedDataDomain, types: Record>, value: Record): string; - static resolveNames(domain: TypedDataDomain, types: Record>, value: Record, resolveName: (name: string) => Promise): Promise<{ - domain: TypedDataDomain; - value: any; - }>; - static getPayload(domain: TypedDataDomain, types: Record>, value: Record): any; -} -/** - * Compute the address used to sign the typed data for the %%signature%%. - */ -export declare function verifyTypedData(domain: TypedDataDomain, types: Record>, value: Record, signature: string, prefix: string): string; -//# sourceMappingURL=typed-data.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/hash/typed-data.d.ts.map b/lib.commonjs/hash/typed-data.d.ts.map deleted file mode 100644 index fc4135d06..000000000 --- a/lib.commonjs/hash/typed-data.d.ts.map +++ /dev/null @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,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAC7C,OAAO,CAAC;QAAE,MAAM,EAAE,eAAe,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC;IAsDnD,MAAM,CAAC,UAAU,CACf,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,GAAG;CAkEP;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,MAAM,CAMR"} \ No newline at end of file diff --git a/lib.commonjs/hash/typed-data.js b/lib.commonjs/hash/typed-data.js deleted file mode 100644 index 5b41d37ec..000000000 --- a/lib.commonjs/hash/typed-data.js +++ /dev/null @@ -1,427 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.verifyTypedData = exports.TypedDataEncoder = void 0; -const index_js_1 = require("../address/index.js"); -const index_js_2 = require("../transaction/index.js"); -const index_js_3 = require("../utils/index.js"); -const id_js_1 = require("./id.js"); -const index_js_4 = require("../crypto/index.js"); -const padding = new Uint8Array(32); -padding.fill(0); -const BN__1 = BigInt(-1); -const BN_0 = BigInt(0); -const BN_1 = BigInt(1); -const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -function hexPadRight(value) { - const bytes = (0, index_js_3.getBytes)(value); - const padOffset = bytes.length % 32; - if (padOffset) { - return (0, index_js_3.concat)([bytes, padding.slice(padOffset)]); - } - return (0, index_js_3.hexlify)(bytes); -} -const hexTrue = (0, index_js_3.toBeHex)(BN_1, 32); -const hexFalse = (0, index_js_3.toBeHex)(BN_0, 32); -const domainFieldTypes = { - name: "string", - version: "string", - networkId: "uint256", - verifyingContract: "address", - salt: "bytes32", -}; -const domainFieldNames = [ - "name", - "version", - "networkId", - "verifyingContract", - "salt", -]; -function checkString(key) { - return function (value) { - (0, index_js_3.assertArgument)(typeof value === "string", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); - return value; - }; -} -const domainChecks = { - name: checkString("name"), - version: checkString("version"), - networkId: function (_value) { - const value = (0, index_js_3.getBigInt)(_value, "domain.networkId"); - (0, index_js_3.assertArgument)(value >= 0, "invalid chain ID", "domain.networkId", _value); - if (Number.isSafeInteger(value)) { - return Number(value); - } - return (0, index_js_3.toQuantity)(value); - }, - verifyingContract: function (value) { - try { - return (0, index_js_1.getAddress)(value).toLowerCase(); - } - catch (error) { } - (0, index_js_3.assertArgument)(false, `invalid domain value "verifyingContract"`, "domain.verifyingContract", value); - }, - salt: function (value) { - const bytes = (0, index_js_3.getBytes)(value, "domain.salt"); - (0, index_js_3.assertArgument)(bytes.length === 32, `invalid domain value "salt"`, "domain.salt", value); - return (0, index_js_3.hexlify)(bytes); - }, -}; -function getBaseEncoder(type) { - // intXX and uintXX - { - const match = type.match(/^(u?)int(\d*)$/); - if (match) { - const signed = match[1] === ""; - const width = parseInt(match[2] || "256"); - (0, index_js_3.assertArgument)(width % 8 === 0 && - width !== 0 && - width <= 256 && - (match[2] == null || match[2] === String(width)), "invalid numeric width", "type", type); - const boundsUpper = (0, index_js_3.mask)(BN_MAX_UINT256, signed ? width - 1 : width); - const boundsLower = signed ? (boundsUpper + BN_1) * BN__1 : BN_0; - return function (_value) { - const value = (0, index_js_3.getBigInt)(_value, "value"); - (0, index_js_3.assertArgument)(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, "value", value); - return (0, index_js_3.toBeHex)(signed ? (0, index_js_3.toTwos)(value, 256) : value, 32); - }; - } - } - // bytesXX - { - const match = type.match(/^bytes(\d+)$/); - if (match) { - const width = parseInt(match[1]); - (0, index_js_3.assertArgument)(width !== 0 && width <= 32 && match[1] === String(width), "invalid bytes width", "type", type); - return function (value) { - const bytes = (0, index_js_3.getBytes)(value); - (0, index_js_3.assertArgument)(bytes.length === width, `invalid length for ${type}`, "value", value); - return hexPadRight(value); - }; - } - } - switch (type) { - case "address": - return function (value) { - return (0, index_js_3.zeroPadValue)((0, index_js_1.getAddress)(value), 32); - }; - case "bool": - return function (value) { - return !value ? hexFalse : hexTrue; - }; - case "bytes": - return function (value) { - return (0, index_js_4.sha256)(value); - }; - case "string": - return function (value) { - return (0, id_js_1.id)(value); - }; - } - return null; -} -function encodeType(name, fields) { - return `${name}(${fields - .map(({ name, type }) => type + " " + name) - .join(",")})`; -} -class TypedDataEncoder { - primaryType; - #types; - get types() { - return JSON.parse(this.#types); - } - #fullTypes; - #encoderCache; - constructor(types) { - this.#types = JSON.stringify(types); - this.#fullTypes = new Map(); - this.#encoderCache = new Map(); - // Link struct types to their direct child structs - const links = new Map(); - // Link structs to structs which contain them as a child - const parents = new Map(); - // Link all subtypes within a given struct - const subtypes = new Map(); - Object.keys(types).forEach((type) => { - links.set(type, new Set()); - parents.set(type, []); - subtypes.set(type, new Set()); - }); - for (const name in types) { - const uniqueNames = new Set(); - for (const field of types[name]) { - // Check each field has a unique name - (0, index_js_3.assertArgument)(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types); - uniqueNames.add(field.name); - // Get the base type (drop any array specifiers) - const baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1] || null; - (0, index_js_3.assertArgument)(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", types); - // Is this a base encoding type? - const encoder = getBaseEncoder(baseType); - if (encoder) { - continue; - } - (0, index_js_3.assertArgument)(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", types); - // Add linkage - parents.get(baseType).push(name); - links.get(name).add(baseType); - } - } - // Deduce the primary type - const primaryTypes = Array.from(parents.keys()).filter((n) => parents.get(n).length === 0); - (0, index_js_3.assertArgument)(primaryTypes.length !== 0, "missing primary type", "types", types); - (0, index_js_3.assertArgument)(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes - .map((t) => JSON.stringify(t)) - .join(", ")}`, "types", types); - (0, index_js_3.defineProperties)(this, { primaryType: primaryTypes[0] }); - // Check for circular type references - function checkCircular(type, found) { - (0, index_js_3.assertArgument)(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", types); - found.add(type); - for (const child of links.get(type)) { - if (!parents.has(child)) { - continue; - } - // Recursively check children - checkCircular(child, found); - // Mark all ancestors as having this decendant - for (const subtype of found) { - subtypes.get(subtype).add(child); - } - } - found.delete(type); - } - checkCircular(this.primaryType, new Set()); - // Compute each fully describe type - for (const [name, set] of subtypes) { - const st = Array.from(set); - st.sort(); - this.#fullTypes.set(name, encodeType(name, types[name]) + - st.map((t) => encodeType(t, types[t])).join("")); - } - } - getEncoder(type) { - let encoder = this.#encoderCache.get(type); - if (!encoder) { - encoder = this.#getEncoder(type); - this.#encoderCache.set(type, encoder); - } - return encoder; - } - #getEncoder(type) { - // Basic encoder type (address, bool, uint256, etc) - { - const encoder = getBaseEncoder(type); - if (encoder) { - return encoder; - } - } - // Array - const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); - if (match) { - const subtype = match[1]; - const subEncoder = this.getEncoder(subtype); - return (value) => { - (0, index_js_3.assertArgument)(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value); - let result = value.map(subEncoder); - if (this.#fullTypes.has(subtype)) { - result = result.map(index_js_4.sha256); - } - return (0, index_js_4.sha256)((0, index_js_3.concat)(result)); - }; - } - // Struct - const fields = this.types[type]; - if (fields) { - const encodedType = (0, id_js_1.id)(this.#fullTypes.get(type)); - return (value) => { - const values = fields.map(({ name, type }) => { - const result = this.getEncoder(type)(value[name]); - if (this.#fullTypes.has(type)) { - return (0, index_js_4.sha256)(result); - } - return result; - }); - values.unshift(encodedType); - return (0, index_js_3.concat)(values); - }; - } - (0, index_js_3.assertArgument)(false, `unknown type: ${type}`, "type", type); - } - encodeType(name) { - const result = this.#fullTypes.get(name); - (0, index_js_3.assertArgument)(result, `unknown type: ${JSON.stringify(name)}`, "name", name); - return result; - } - encodeData(type, value) { - return this.getEncoder(type)(value); - } - hashStruct(name, value) { - return (0, index_js_4.sha256)(this.encodeData(name, value)); - } - encode(value) { - return this.encodeData(this.primaryType, value); - } - hash(value) { - return this.hashStruct(this.primaryType, value); - } - _visit(type, value, callback) { - // Basic encoder type (address, bool, uint256, etc) - { - const encoder = getBaseEncoder(type); - if (encoder) { - return callback(type, value); - } - } - // Array - const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); - if (match) { - (0, index_js_3.assertArgument)(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value); - return value.map((v) => this._visit(match[1], v, callback)); - } - // Struct - const fields = this.types[type]; - if (fields) { - return fields.reduce((accum, { name, type }) => { - accum[name] = this._visit(type, value[name], callback); - return accum; - }, {}); - } - (0, index_js_3.assertArgument)(false, `unknown type: ${type}`, "type", type); - } - visit(value, callback) { - return this._visit(this.primaryType, value, callback); - } - static from(types) { - return new TypedDataEncoder(types); - } - static getPrimaryType(types) { - return TypedDataEncoder.from(types).primaryType; - } - static hashStruct(name, types, value) { - return TypedDataEncoder.from(types).hashStruct(name, value); - } - static hashDomain(domain) { - const domainFields = []; - for (const name in domain) { - if (domain[name] == null) { - continue; - } - const type = domainFieldTypes[name]; - (0, index_js_3.assertArgument)(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); - domainFields.push({ name, type }); - } - domainFields.sort((a, b) => { - return (domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name)); - }); - return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); - } - static encode(domain, types, value) { - return (0, index_js_3.concat)([ - "0x1901", - TypedDataEncoder.hashDomain(domain), - TypedDataEncoder.from(types).hash(value), - ]); - } - static hash(domain, types, value) { - return (0, index_js_4.sha256)(TypedDataEncoder.encode(domain, types, value)); - } - // Replaces all address types with ENS names with their looked up address - static async resolveNames(domain, types, value, resolveName) { - // Make a copy to isolate it from the object passed in - domain = Object.assign({}, domain); - // Allow passing null to ignore value - for (const key in domain) { - if (domain[key] == null) { - delete domain[key]; - } - } - // Look up all ENS names - const ensCache = {}; - // Do we need to look up the domain's verifyingContract? - if (domain.verifyingContract && - !(0, index_js_3.isHexString)(domain.verifyingContract, 20)) { - ensCache[domain.verifyingContract] = "0x"; - } - // We are going to use the encoder to visit all the base values - const encoder = TypedDataEncoder.from(types); - // Get a list of all the addresses - encoder.visit(value, (type, value) => { - if (type === "address" && !(0, index_js_3.isHexString)(value, 20)) { - ensCache[value] = "0x"; - } - return value; - }); - // Lookup each name - for (const name in ensCache) { - ensCache[name] = await resolveName(name); - } - // Replace the domain verifyingContract if needed - if (domain.verifyingContract && ensCache[domain.verifyingContract]) { - domain.verifyingContract = ensCache[domain.verifyingContract]; - } - // Replace all ENS names with their address - value = encoder.visit(value, (type, value) => { - if (type === "address" && ensCache[value]) { - return ensCache[value]; - } - return value; - }); - return { domain, value }; - } - static getPayload(domain, types, value) { - // Validate the domain fields - TypedDataEncoder.hashDomain(domain); - // Derive the EIP712Domain Struct reference type - const domainValues = {}; - const domainTypes = []; - domainFieldNames.forEach((name) => { - const value = domain[name]; - if (value == null) { - return; - } - domainValues[name] = domainChecks[name](value); - domainTypes.push({ name, type: domainFieldTypes[name] }); - }); - const encoder = TypedDataEncoder.from(types); - const typesWithDomain = Object.assign({}, types); - (0, index_js_3.assertArgument)(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types); - typesWithDomain.EIP712Domain = domainTypes; - // Validate the data structures and types - encoder.encode(value); - return { - types: typesWithDomain, - domain: domainValues, - primaryType: encoder.primaryType, - message: encoder.visit(value, (type, value) => { - // bytes - if (type.match(/^bytes(\d*)/)) { - return (0, index_js_3.hexlify)((0, index_js_3.getBytes)(value)); - } - // uint or int - if (type.match(/^u?int/)) { - return (0, index_js_3.getBigInt)(value).toString(); - } - switch (type) { - case "address": - return value.toLowerCase(); - case "bool": - return !!value; - case "string": - (0, index_js_3.assertArgument)(typeof value === "string", "invalid string", "value", value); - return value; - } - (0, index_js_3.assertArgument)(false, "unsupported type", "type", type); - }), - }; - } -} -exports.TypedDataEncoder = TypedDataEncoder; -/** - * Compute the address used to sign the typed data for the %%signature%%. - */ -function verifyTypedData(domain, types, value, signature, prefix) { - return (0, index_js_2.recoverAddress)(TypedDataEncoder.hash(domain, types, value), signature, prefix); -} -exports.verifyTypedData = verifyTypedData; -//# sourceMappingURL=typed-data.js.map \ No newline at end of file diff --git a/lib.commonjs/hash/typed-data.js.map b/lib.commonjs/hash/typed-data.js.map deleted file mode 100644 index 49aa14550..000000000 --- a/lib.commonjs/hash/typed-data.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"typed-data.js","sourceRoot":"","sources":["../../src.ts/hash/typed-data.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AACjD,sDAAyD;AACzD,gDAa2B;AAE3B,mCAA6B;AAE7B,iDAA4C;AAG5C,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEhB,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,cAAc,GAAG,MAAM,CAC3B,oEAAoE,CACr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,KAAU,EAAE,EAAE;gBACzD,QAAQ;gBACR,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;oBAC7B,OAAO,IAAA,kBAAO,EAAC,IAAA,mBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC;iBACjC;gBAED,cAAc;gBACd,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;oBACxB,OAAO,IAAA,oBAAS,EAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;iBACpC;gBAED,QAAQ,IAAI,EAAE;oBACZ,KAAK,SAAS;wBACZ,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;oBAC7B,KAAK,MAAM;wBACT,OAAO,CAAC,CAAC,KAAK,CAAC;oBACjB,KAAK,QAAQ;wBACX,IAAA,yBAAc,EACZ,OAAO,KAAK,KAAK,QAAQ,EACzB,gBAAgB,EAChB,OAAO,EACP,KAAK,CACN,CAAC;wBACF,OAAO,KAAK,CAAC;iBAChB;gBAED,IAAA,yBAAc,EAAC,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;YAC1D,CAAC,CAAC;SACH,CAAC;IACJ,CAAC;CACF;AAndD,4CAmdC;AAED;;GAEG;AACH,SAAgB,eAAe,CAC7B,MAAuB,EACvB,KAA4C,EAC5C,KAA0B,EAC1B,SAAiB,EACjB,MAAc;IAEd,OAAO,IAAA,yBAAc,EACnB,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,EAC3C,SAAS,EACT,MAAM,CACP,CAAC;AACJ,CAAC;AAZD,0CAYC"} \ No newline at end of file diff --git a/lib.commonjs/index.d.ts b/lib.commonjs/index.d.ts deleted file mode 100644 index 3fd593002..000000000 --- a/lib.commonjs/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * The Application Programming Interface (API) is the collection of - * functions, classes and types offered by the CoreBC library. - * - * @_section: api:Application Programming Interface [about-api] - * @_navTitle: API - */ -import { Buffer } from "buffer"; -export { Buffer }; -import * as corebc from "./corebc.js"; -export { corebc }; -export * from "./corebc.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/index.d.ts.map b/lib.commonjs/index.d.ts.map deleted file mode 100644 index 5841be6e6..000000000 --- a/lib.commonjs/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,cAAc,aAAa,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/index.js b/lib.commonjs/index.js deleted file mode 100644 index b9a3516bd..000000000 --- a/lib.commonjs/index.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.corebc = exports.Buffer = void 0; -const tslib_1 = require("tslib"); -/** - * The Application Programming Interface (API) is the collection of - * functions, classes and types offered by the CoreBC library. - * - * @_section: api:Application Programming Interface [about-api] - * @_navTitle: API - */ -const buffer_1 = require("buffer"); -Object.defineProperty(exports, "Buffer", { enumerable: true, get: function () { return buffer_1.Buffer; } }); -const corebc = tslib_1.__importStar(require("./corebc.js")); -exports.corebc = corebc; -tslib_1.__exportStar(require("./corebc.js"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.commonjs/index.js.map b/lib.commonjs/index.js.map deleted file mode 100644 index 26921c071..000000000 --- a/lib.commonjs/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":";;;;AAAA;;;;;;GAMG;AACH,mCAAgC;AACvB,uFADA,eAAM,OACA;AAEf,4DAAsC;AAE7B,wBAAM;AAEf,sDAA4B"} \ No newline at end of file diff --git a/lib.commonjs/logger/logger.d.ts b/lib.commonjs/logger/logger.d.ts deleted file mode 100644 index df72240a3..000000000 --- a/lib.commonjs/logger/logger.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -export declare enum LogLevel { - DEBUG = "DEBUG", - INFO = "INFO", - WARNING = "WARNING", - ERROR = "ERROR", - OFF = "OFF" -} -export declare enum ErrorCode { - UNKNOWN_ERROR = "UNKNOWN_ERROR", - NOT_IMPLEMENTED = "NOT_IMPLEMENTED", - UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", - NETWORK_ERROR = "NETWORK_ERROR", - SERVER_ERROR = "SERVER_ERROR", - TIMEOUT = "TIMEOUT", - BUFFER_OVERRUN = "BUFFER_OVERRUN", - NUMERIC_FAULT = "NUMERIC_FAULT", - MISSING_NEW = "MISSING_NEW", - INVALID_ARGUMENT = "INVALID_ARGUMENT", - MISSING_ARGUMENT = "MISSING_ARGUMENT", - UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", - CALL_EXCEPTION = "CALL_EXCEPTION", - INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", - NONCE_EXPIRED = "NONCE_EXPIRED", - REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", - UNPREDICTABLE_ENERGY_LIMIT = "UNPREDICTABLE_ENERGY_LIMIT", - TRANSACTION_REPLACED = "TRANSACTION_REPLACED" -} -export declare class Logger { - readonly version: string; - static errors: typeof ErrorCode; - static levels: typeof LogLevel; - constructor(version: string); - _log(logLevel: LogLevel, args: Array): void; - debug(...args: Array): void; - info(...args: Array): void; - warn(...args: Array): void; - makeError(message: string, code?: ErrorCode, params?: any): Error; - throwError(message: string, code?: ErrorCode, params?: any): never; - throwArgumentError(message: string, name: string, value: any): never; - assert(condition: any, message: string, code?: ErrorCode, params?: any): void; - assertArgument(condition: any, message: string, name: string, value: any): void; - checkNormalize(message?: string): void; - checkSafeUint53(value: number, message?: string): void; - checkArgumentCount(count: number, expectedCount: number, message?: string): void; - checkNew(target: any, kind: any): void; - checkAbstract(target: any, kind: any): void; - static globalLogger(): Logger; - static setCensorship(censorship: boolean, permanent?: boolean): void; - static setLogLevel(logLevel: LogLevel): void; - static from(version: string): Logger; -} -//# sourceMappingURL=logger.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/logger/logger.d.ts.map b/lib.commonjs/logger/logger.d.ts.map deleted file mode 100644 index f1ca4504f..000000000 --- a/lib.commonjs/logger/logger.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src.ts/logger/logger.ts"],"names":[],"mappings":"AAmDA,oBAAY,QAAQ;IAClB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,GAAG,QAAQ;CACZ;AAED,oBAAY,SAAS;IAKnB,aAAa,kBAAkB;IAG/B,eAAe,oBAAoB;IAInC,qBAAqB,0BAA0B;IAI/C,aAAa,kBAAkB;IAG/B,YAAY,iBAAiB;IAG7B,OAAO,YAAY;IAMnB,cAAc,mBAAmB;IAKjC,aAAa,kBAAkB;IAO/B,WAAW,gBAAgB;IAK3B,gBAAgB,qBAAqB;IAKrC,gBAAgB,qBAAqB;IAKrC,mBAAmB,wBAAwB;IAa3C,cAAc,mBAAmB;IAIjC,kBAAkB,uBAAuB;IAIzC,aAAa,kBAAkB;IAI/B,uBAAuB,4BAA4B;IAInD,0BAA0B,+BAA+B;IAQzD,oBAAoB,yBAAyB;CAC9C;AAID,qBAAa,MAAM;IACjB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAW;IAEnC,MAAM,CAAC,MAAM,mBAAa;IAE1B,MAAM,CAAC,MAAM,kBAAY;gBAEb,OAAO,EAAE,MAAM;IAQ3B,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI;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aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI;IA4BpE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAS5C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAGrC"} \ No newline at end of file diff --git a/lib.commonjs/logger/logger.js b/lib.commonjs/logger/logger.js deleted file mode 100644 index 9147d093e..000000000 --- a/lib.commonjs/logger/logger.js +++ /dev/null @@ -1,332 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Logger = exports.ErrorCode = exports.LogLevel = void 0; -let _permanentCensorErrors = false; -let _censorErrors = false; -const LogLevels = { - debug: 1, - default: 2, - info: 2, - warning: 3, - error: 4, - off: 5, -}; -let _logLevel = LogLevels["default"]; -let _globalLogger = null; -function _checkNormalize() { - try { - const missing = []; - // Make sure all forms of normalization are supported - ["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => { - try { - if ("test".normalize(form) !== "test") { - throw new Error("bad normalize"); - } - } - catch (error) { - missing.push(form); - } - }); - if (missing.length) { - throw new Error("missing " + missing.join(", ")); - } - if (String.fromCharCode(0xe9).normalize("NFD") !== - String.fromCharCode(0x65, 0x0301)) { - throw new Error("broken implementation"); - } - } - catch (error) { - return error.message; - } - return null; -} -const _normalizeError = _checkNormalize(); -var LogLevel; -(function (LogLevel) { - LogLevel["DEBUG"] = "DEBUG"; - LogLevel["INFO"] = "INFO"; - LogLevel["WARNING"] = "WARNING"; - LogLevel["ERROR"] = "ERROR"; - LogLevel["OFF"] = "OFF"; -})(LogLevel || (exports.LogLevel = LogLevel = {})); -var ErrorCode; -(function (ErrorCode) { - /////////////////// - // Generic Errors - // Unknown Error - ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; - // Not Implemented - ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED"; - // Unsupported Operation - // - operation - ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION"; - // Network Error (i.e. Core Network, such as an invalid network ID) - // - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown) - ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR"; - // Some sort of bad response from the server - ErrorCode["SERVER_ERROR"] = "SERVER_ERROR"; - // Timeout - ErrorCode["TIMEOUT"] = "TIMEOUT"; - /////////////////// - // Operational Errors - // Buffer Overrun - ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN"; - // Numeric Fault - // - operation: the operation being executed - // - fault: the reason this faulted - ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT"; - /////////////////// - // Argument Errors - // Missing new operator to an object - // - name: The name of the class - ErrorCode["MISSING_NEW"] = "MISSING_NEW"; - // Invalid argument (e.g. value is incompatible with type) to a function: - // - argument: The argument name that was invalid - // - value: The value of the argument - ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT"; - // Missing argument to a function: - // - count: The number of arguments received - // - expectedCount: The number of arguments expected - ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT"; - // Too many arguments - // - count: The number of arguments received - // - expectedCount: The number of arguments expected - ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT"; - /////////////////// - // Blockchain Errors - // Call exception - // - transaction: the transaction - // - address?: the contract address - // - args?: The arguments passed into the function - // - method?: The Solidity method signature - // - errorSignature?: The EIP848 error signature - // - errorArgs?: The EIP848 error parameters - // - reason: The reason (only for EIP848 "Error(string)") - ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION"; - // Insufficient funds (< value + energyLimit * energyPrice) - // - transaction: the transaction attempted - ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; - // Nonce has already been used - // - transaction: the transaction attempted - ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED"; - // The replacement fee for the transaction is too low - // - transaction: the transaction attempted - ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED"; - // The energy limit could not be estimated - // - transaction: the transaction passed to estimateEnergy - ErrorCode["UNPREDICTABLE_ENERGY_LIMIT"] = "UNPREDICTABLE_ENERGY_LIMIT"; - // The transaction was replaced by one with a higher energy price - // - reason: "cancelled", "replaced" or "repriced" - // - cancelled: true if reason == "cancelled" or reason == "replaced") - // - hash: original transaction hash - // - replacement: the full TransactionsResponse for the replacement - // - receipt: the receipt of the replacement - ErrorCode["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED"; -})(ErrorCode || (exports.ErrorCode = ErrorCode = {})); -const HEX = "0123456789abcdef"; -class Logger { - version = "0.0.1"; - static errors = ErrorCode; - static levels = LogLevel; - constructor(version) { - Object.defineProperty(this, "version", { - enumerable: true, - value: version, - writable: false, - }); - } - _log(logLevel, args) { - const level = logLevel.toLowerCase(); - if (LogLevels[level] == null) { - this.throwArgumentError("invalid log level name", "logLevel", logLevel); - } - if (_logLevel > LogLevels[level]) { - return; - } - console.log.apply(console, args); - } - debug(...args) { - this._log(Logger.levels.DEBUG, args); - } - info(...args) { - this._log(Logger.levels.INFO, args); - } - warn(...args) { - this._log(Logger.levels.WARNING, args); - } - makeError(message, code, params) { - // Errors are being censored - if (_censorErrors) { - return this.makeError("censored error", code, {}); - } - if (!code) { - code = Logger.errors.UNKNOWN_ERROR; - } - if (!params) { - params = {}; - } - const messageDetails = []; - Object.keys(params).forEach((key) => { - const value = params[key]; - try { - if (value instanceof Uint8Array) { - let hex = ""; - for (let i = 0; i < value.length; i++) { - hex += HEX[value[i] >> 4]; - hex += HEX[value[i] & 0x0f]; - } - messageDetails.push(key + "=Uint8Array(0x" + hex + ")"); - } - else { - messageDetails.push(key + "=" + JSON.stringify(value)); - } - } - catch (error) { - messageDetails.push(key + "=" + JSON.stringify(params[key].toString())); - } - }); - messageDetails.push(`code=${code}`); - messageDetails.push(`version=${this.version}`); - const reason = message; - if (messageDetails.length) { - message += " (" + messageDetails.join(", ") + ")"; - } - // @TODO: Any?? - const error = new Error(message); - error.reason = reason; - error.code = code; - Object.keys(params).forEach(function (key) { - error[key] = params[key]; - }); - return error; - } - throwError(message, code, params) { - throw this.makeError(message, code, params); - } - throwArgumentError(message, name, value) { - return this.throwError(message, Logger.errors.INVALID_ARGUMENT, { - argument: name, - value: value, - }); - } - assert(condition, message, code, params) { - if (!!condition) { - return; - } - this.throwError(message, code, params); - } - assertArgument(condition, message, name, value) { - if (!!condition) { - return; - } - this.throwArgumentError(message, name, value); - } - checkNormalize(message) { - if (message == null) { - message = "platform missing String.prototype.normalize"; - } - if (_normalizeError) { - this.throwError("platform missing String.prototype.normalize", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "String.prototype.normalize", - form: _normalizeError, - }); - } - } - checkSafeUint53(value, message) { - if (typeof value !== "number") { - return; - } - if (message == null) { - message = "value not safe"; - } - if (value < 0 || value >= 0x1fffffffffffff) { - this.throwError(message, Logger.errors.NUMERIC_FAULT, { - operation: "checkSafeInteger", - fault: "out-of-safe-range", - value: value, - }); - } - if (value % 1) { - this.throwError(message, Logger.errors.NUMERIC_FAULT, { - operation: "checkSafeInteger", - fault: "non-integer", - value: value, - }); - } - } - checkArgumentCount(count, expectedCount, message) { - if (message) { - message = ": " + message; - } - else { - message = ""; - } - if (count < expectedCount) { - this.throwError("missing argument" + message, Logger.errors.MISSING_ARGUMENT, { - count: count, - expectedCount: expectedCount, - }); - } - if (count > expectedCount) { - this.throwError("too many arguments" + message, Logger.errors.UNEXPECTED_ARGUMENT, { - count: count, - expectedCount: expectedCount, - }); - } - } - checkNew(target, kind) { - if (target === Object || target == null) { - this.throwError("missing new", Logger.errors.MISSING_NEW, { - name: kind.name, - }); - } - } - checkAbstract(target, kind) { - if (target === kind) { - this.throwError("cannot instantiate abstract class " + - JSON.stringify(kind.name) + - " directly; use a sub-class", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" }); - } - else if (target === Object || target == null) { - this.throwError("missing new", Logger.errors.MISSING_NEW, { - name: kind.name, - }); - } - } - static globalLogger() { - if (!_globalLogger) { - _globalLogger = new Logger("logger/0.0.1"); - } - return _globalLogger; - } - static setCensorship(censorship, permanent) { - if (!censorship && permanent) { - this.globalLogger().throwError("cannot permanently disable censorship", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "setCensorship", - }); - } - if (_permanentCensorErrors) { - if (!censorship) { - return; - } - this.globalLogger().throwError("error censorship permanent", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "setCensorship", - }); - } - _censorErrors = !!censorship; - _permanentCensorErrors = !!permanent; - } - static setLogLevel(logLevel) { - const level = LogLevels[logLevel.toLowerCase()]; - if (level == null) { - Logger.globalLogger().warn("invalid log level - " + logLevel); - return; - } - _logLevel = level; - } - static from(version) { - return new Logger(version); - } -} -exports.Logger = Logger; -//# sourceMappingURL=logger.js.map \ No newline at end of file diff --git a/lib.commonjs/logger/logger.js.map b/lib.commonjs/logger/logger.js.map deleted file mode 100644 index c7cfb4eff..000000000 --- a/lib.commonjs/logger/logger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src.ts/logger/logger.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,IAAI,sBAAsB,GAAG,KAAK,CAAC;AACnC,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B,MAAM,SAAS,GAA+B;IAC5C,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,CAAC;CACP,CAAC;AACF,IAAI,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;AAErC,IAAI,aAAa,GAAQ,IAAI,CAAC;AAE9B,SAAS,eAAe;IACtB,IAAI;QACF,MAAM,OAAO,GAAkB,EAAE,CAAC;QAElC,qDAAqD;QACrD,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,C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AED,IAAI,sBAAsB,EAAE;YAC1B,IAAI,CAAC,UAAU,EAAE;gBACf,OAAO;aACR;YACD,IAAI,CAAC,YAAY,EAAE,CAAC,UAAU,CAC5B,4BAA4B,EAC5B,MAAM,CAAC,MAAM,CAAC,qBAAqB,EACnC;gBACE,SAAS,EAAE,eAAe;aAC3B,CACF,CAAC;SACH;QAED,aAAa,GAAG,CAAC,CAAC,UAAU,CAAC;QAC7B,sBAAsB,GAAG,CAAC,CAAC,SAAS,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,QAAkB;QACnC,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QAChD,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,MAAM,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,sBAAsB,GAAG,QAAQ,CAAC,CAAC;YAC9D,OAAO;SACR;QACD,SAAS,GAAG,KAAK,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,OAAe;QACzB,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;;AA9QH,wBA+QC"} \ No newline at end of file diff --git a/lib.commonjs/package.json b/lib.commonjs/package.json deleted file mode 100644 index 0e2116858..000000000 --- a/lib.commonjs/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "browser": { - "./crypto/crypto.js": "./crypto/crypto-browser.js", - "./providers/provider-ipcsocket.js": "./providers/provider-ipcsocket-browser.js", - "./providers/ws.js": "./providers/ws-browser.js", - "./utils/base64.js": "./utils/base64-browser.js", - "./utils/geturl.js": "./utils/geturl-browser.js", - "./wordlists/wordlists.js": "./wordlists/wordlists-browser.js" - }, - "sideEffects": false, - "type": "commonjs" -} diff --git a/lib.commonjs/providers/abstract-provider.d.ts b/lib.commonjs/providers/abstract-provider.d.ts deleted file mode 100644 index 79ee0dee3..000000000 --- a/lib.commonjs/providers/abstract-provider.d.ts +++ /dev/null @@ -1,211 +0,0 @@ -/** - * About Subclassing the Provider... - * - * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] - */ -import { FetchRequest } from "../utils/index.js"; -import { Network } from "./network.js"; -import { Block, FeeData, Log, TransactionReceipt, TransactionResponse } from "./provider.js"; -import type { AddressLike } from "../address/index.js"; -import type { BigNumberish } from "../utils/index.js"; -import type { Listener } from "../utils/index.js"; -import type { Networkish } from "./network.js"; -import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; -import type { BlockTag, EventFilter, Filter, FilterByBlockHash, OrphanFilter, PreparedTransactionRequest, Provider, ProviderEvent, TransactionRequest } from "./provider.js"; -export type DebugEventAbstractProvider = { - action: "sendCcipReadFetchRequest"; - request: FetchRequest; - index: number; - urls: Array; -} | { - action: "receiveCcipReadFetchResult"; - request: FetchRequest; - result: any; -} | { - action: "receiveCcipReadFetchError"; - request: FetchRequest; - result: any; -} | { - action: "sendCcipReadCall"; - transaction: { - to: string; - data: string; - }; -} | { - action: "receiveCcipReadCallResult"; - transaction: { - to: string; - data: string; - }; - result: string; -} | { - action: "receiveCcipReadCallError"; - transaction: { - to: string; - data: string; - }; - error: Error; -}; -export type Subscription = { - type: "block" | "close" | "debug" | "error" | "network" | "pending"; - tag: string; -} | { - type: "transaction"; - tag: string; - hash: string; -} | { - type: "event"; - tag: string; - filter: EventFilter; -} | { - type: "orphan"; - tag: string; - filter: OrphanFilter; -}; -export interface Subscriber { - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; - pollingInterval?: number; -} -export declare class UnmanagedSubscriber implements Subscriber { - name: string; - constructor(name: string); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -export interface AbstractProviderPlugin { - readonly name: string; - connect(provider: AbstractProvider): AbstractProviderPlugin; -} -export type PerformActionFilter = { - address?: string | Array; - topics?: Array>; - fromBlock?: BlockTag; - toBlock?: BlockTag; -} | { - address?: string | Array; - topics?: Array>; - blockHash?: string; -}; -export interface PerformActionTransaction extends PreparedTransactionRequest { - to?: string; - from?: string; -} -export type PerformActionRequest = { - method: "broadcastTransaction"; - signedTransaction: string; -} | { - method: "call"; - transaction: PerformActionTransaction; - blockTag: BlockTag; -} | { - method: "networkId"; -} | { - method: "estimateEnergy"; - transaction: PerformActionTransaction; -} | { - method: "getBalance"; - address: string; - blockTag: BlockTag; -} | { - method: "getBlock"; - blockTag: BlockTag; - includeTransactions: boolean; -} | { - method: "getBlock"; - blockHash: string; - includeTransactions: boolean; -} | { - method: "getBlockNumber"; -} | { - method: "getCode"; - address: string; - blockTag: BlockTag; -} | { - method: "getEnergyPrice"; -} | { - method: "getLogs"; - filter: PerformActionFilter; -} | { - method: "getStorage"; - address: string; - position: bigint; - blockTag: BlockTag; -} | { - method: "getTransaction"; - hash: string; -} | { - method: "getTransactionCount"; - address: string; - blockTag: BlockTag; -} | { - method: "getTransactionReceipt"; - hash: string; -} | { - method: "getTransactionResult"; - hash: string; -}; -export declare class AbstractProvider implements Provider { - #private; - constructor(_network?: "any" | Networkish); - get provider(): this; - get plugins(): Array; - attachPlugin(plugin: AbstractProviderPlugin): this; - getPlugin(name: string): null | T; - get disableCcipRead(): boolean; - set disableCcipRead(value: boolean); - ccipReadFetch(tx: PerformActionTransaction, calldata: string, urls: Array): Promise; - _wrapBlock(value: BlockParams, network: Network): Block; - _wrapLog(value: LogParams, network: Network): Log; - _wrapTransactionReceipt(value: TransactionReceiptParams, network: Network): TransactionReceipt; - _wrapTransactionResponse(tx: TransactionResponseParams, network: Network): TransactionResponse; - _detectNetwork(): Promise; - _perform(req: PerformActionRequest): Promise; - getBlockNumber(): Promise; - _getAddress(address: AddressLike): string | Promise; - _getBlockTag(blockTag?: BlockTag): string | Promise; - _getFilter(filter: Filter | FilterByBlockHash): PerformActionFilter | Promise; - _getTransactionRequest(_request: TransactionRequest): PerformActionTransaction | Promise; - getNetwork(): Promise; - getEnergyPrice(): Promise; - getFeeData(): Promise; - estimateEnergy(_tx: TransactionRequest): Promise; - call(_tx: TransactionRequest): Promise; - getBalance(address: AddressLike, blockTag?: BlockTag): Promise; - getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise; - getCode(address: AddressLike, blockTag?: BlockTag): Promise; - getStorage(address: AddressLike, _position: BigNumberish, blockTag?: BlockTag): Promise; - broadcastTransaction(signedTx: string): Promise; - getBlock(block: BlockTag | string, prefetchTxs?: boolean): Promise; - getTransaction(hash: string): Promise; - getTransactionReceipt(hash: string): Promise; - getTransactionResult(hash: string): Promise; - getLogs(_filter: Filter | FilterByBlockHash): Promise>; - _getProvider(networkId: number): AbstractProvider; - waitForTransaction(hash: string, _confirms?: null | number, timeout?: null | number): Promise; - waitForBlock(blockTag?: BlockTag): Promise; - _clearTimeout(timerId: number): void; - _setTimeout(_func: () => void, timeout?: number): number; - _forEachSubscriber(func: (s: Subscriber) => void): void; - _getSubscriber(sub: Subscription): Subscriber; - _recoverSubscriber(oldSub: Subscriber, newSub: Subscriber): void; - on(event: ProviderEvent, listener: Listener): Promise; - once(event: ProviderEvent, listener: Listener): Promise; - emit(event: ProviderEvent, ...args: Array): Promise; - listenerCount(event?: ProviderEvent): Promise; - listeners(event?: ProviderEvent): Promise>; - off(event: ProviderEvent, listener?: Listener): Promise; - removeAllListeners(event?: ProviderEvent): Promise; - addListener(event: ProviderEvent, listener: Listener): Promise; - removeListener(event: ProviderEvent, listener: Listener): Promise; - destroy(): void; - get paused(): boolean; - set paused(pause: boolean); - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -//# sourceMappingURL=abstract-provider.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/abstract-provider.d.ts.map b/lib.commonjs/providers/abstract-provider.d.ts.map deleted file mode 100644 index ca3a7ea53..000000000 --- a/lib.commonjs/providers/abstract-provider.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/abstract-provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;A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E,QAAQ,GACjB,OAAO,CAAC,IAAI,CAAC;IAMhB,OAAO,IAAI,IAAI;IAUf,IAAI,MAAM,IAAI,OAAO,CAEpB;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,EAUxB;IAED,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IA+BtC,MAAM,IAAI,IAAI;CAqBf"} \ No newline at end of file diff --git a/lib.commonjs/providers/abstract-provider.js b/lib.commonjs/providers/abstract-provider.js deleted file mode 100644 index eee42c067..000000000 --- a/lib.commonjs/providers/abstract-provider.js +++ /dev/null @@ -1,1240 +0,0 @@ -"use strict"; -/** - * About Subclassing the Provider... - * - * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AbstractProvider = exports.UnmanagedSubscriber = void 0; -// @TODO -// Event coalescence -// When we register an event with an async value (e.g. address is a Signer -// or ENS name), we need to add it immeidately for the Event API, but also -// need time to resolve the address. Upon resolving the address, we need to -// migrate the listener to the static event. We also need to maintain a map -// of Signer/ENS name to address so we can sync respond to listenerCount. -const checks_js_1 = require("../address/checks.js"); -const index_js_1 = require("../transaction/index.js"); -const index_js_2 = require("../utils/index.js"); -const format_js_1 = require("./format.js"); -const network_js_1 = require("./network.js"); -const provider_js_1 = require("./provider.js"); -const subscriber_polling_js_1 = require("./subscriber-polling.js"); -const MAX_CCIP_REDIRECTS = 10; -function isPromise(value) { - return value && typeof value.then === "function"; -} -function getTag(prefix, value) { - return (prefix + - ":" + - JSON.stringify(value, (k, v) => { - if (v == null) { - return "null"; - } - if (typeof v === "bigint") { - return `bigint:${v.toString()}`; - } - if (typeof v === "string") { - return v.toLowerCase(); - } - // Sort object keys - if (typeof v === "object" && !Array.isArray(v)) { - const keys = Object.keys(v); - keys.sort(); - return keys.reduce((accum, key) => { - accum[key] = v[key]; - return accum; - }, {}); - } - return v; - })); -} -class UnmanagedSubscriber { - name; - constructor(name) { - (0, index_js_2.defineProperties)(this, { name }); - } - start() { } - stop() { } - pause(dropWhilePaused) { } - resume() { } -} -exports.UnmanagedSubscriber = UnmanagedSubscriber; -function copy(value) { - return JSON.parse(JSON.stringify(value)); -} -function concisify(items) { - items = Array.from(new Set(items).values()); - items.sort(); - return items; -} -async function getSubscription(_event, provider) { - if (_event == null) { - throw new Error("invalid event"); - } - // Normalize topic array info an EventFilter - if (Array.isArray(_event)) { - _event = { topics: _event }; - } - if (typeof _event === "string") { - switch (_event) { - case "block": - case "pending": - case "debug": - case "error": - case "network": { - return { type: _event, tag: _event }; - } - } - } - if ((0, index_js_2.isHexString)(_event, 32)) { - const hash = _event.toLowerCase(); - return { type: "transaction", tag: getTag("tx", { hash }), hash }; - } - if (_event.orphan) { - const event = _event; - // @TODO: Should lowercase and whatnot things here instead of copy... - return { - type: "orphan", - tag: getTag("orphan", event), - filter: copy(event), - }; - } - if (_event.address || _event.topics) { - const event = _event; - const filter = { - topics: (event.topics || []).map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - return concisify(t.map((t) => t.toLowerCase())); - } - return t.toLowerCase(); - }), - }; - if (event.address) { - const addresses = []; - const promises = []; - const addAddress = (addr) => { - if ((0, index_js_2.isHexString)(addr)) { - addresses.push(addr); - } - else { - promises.push((async () => { - addresses.push(await (0, checks_js_1.resolveAddress)(addr)); - })()); - } - }; - if (Array.isArray(event.address)) { - event.address.forEach(addAddress); - } - else { - addAddress(event.address); - } - if (promises.length) { - await Promise.all(promises); - } - filter.address = concisify(addresses.map((a) => a.toLowerCase())); - } - return { filter, tag: getTag("event", filter), type: "event" }; - } - (0, index_js_2.assertArgument)(false, "unknown ProviderEvent", "event", _event); -} -function getTime() { - return new Date().getTime(); -} -class AbstractProvider { - #subs; - #plugins; - // null=unpaused, true=paused+dropWhilePaused, false=paused - #pausedState; - #networkPromise; - #anyNetwork; - #performCache; - // The most recent block number if running an event or -1 if no "block" event - #lastBlockNumber; - #nextTimer; - #timers; - #disableCcipRead; - // @TODO: This should be a () => Promise so network can be - // done when needed; or rely entirely on _detectNetwork? - constructor(_network) { - if (_network === "any") { - this.#anyNetwork = true; - this.#networkPromise = null; - } - else if (_network) { - const network = network_js_1.Network.from(_network); - this.#anyNetwork = false; - this.#networkPromise = Promise.resolve(network); - setTimeout(() => { - this.emit("network", network, null); - }, 0); - } - else { - this.#anyNetwork = false; - this.#networkPromise = null; - } - this.#lastBlockNumber = -1; - this.#performCache = new Map(); - this.#subs = new Map(); - this.#plugins = new Map(); - this.#pausedState = null; - this.#nextTimer = 1; - this.#timers = new Map(); - this.#disableCcipRead = false; - } - get provider() { - return this; - } - get plugins() { - return Array.from(this.#plugins.values()); - } - attachPlugin(plugin) { - if (this.#plugins.get(plugin.name)) { - throw new Error(`cannot replace existing plugin: ${plugin.name} `); - } - this.#plugins.set(plugin.name, plugin.connect(this)); - return this; - } - getPlugin(name) { - return this.#plugins.get(name) || null; - } - get disableCcipRead() { - return this.#disableCcipRead; - } - set disableCcipRead(value) { - this.#disableCcipRead = !!value; - } - // Shares multiple identical requests made during the same 250ms - async #perform(req) { - // Create a tag - const tag = getTag(req.method, req); - let perform = this.#performCache.get(tag); - if (!perform) { - perform = this._perform(req); - this.#performCache.set(tag, perform); - setTimeout(() => { - if (this.#performCache.get(tag) === perform) { - this.#performCache.delete(tag); - } - }, 250); - } - return await perform; - } - async ccipReadFetch(tx, calldata, urls) { - if (this.disableCcipRead || urls.length === 0 || tx.to == null) { - return null; - } - const sender = tx.to.toLowerCase(); - const data = calldata.toLowerCase(); - const errorMessages = []; - for (let i = 0; i < urls.length; i++) { - const url = urls[i]; - // URL expansion - const href = url.replace("{sender}", sender).replace("{data}", data); - // If no {data} is present, use POST; otherwise GET - //const json: string | null = (url.indexOf("{data}") >= 0) ? null: JSON.stringify({ data, sender }); - //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { - // value.status = response.statusCode; - // return value; - //}); - const request = new index_js_2.FetchRequest(href); - if (url.indexOf("{data}") === -1) { - request.body = { data, sender }; - } - this.emit("debug", { - action: "sendCcipReadFetchRequest", - request, - index: i, - urls, - }); - let errorMessage = "unknown error"; - const resp = await request.send(); - try { - const result = resp.bodyJson; - if (result.data) { - this.emit("debug", { - action: "receiveCcipReadFetchResult", - request, - result, - }); - return result.data; - } - if (result.message) { - errorMessage = result.message; - } - this.emit("debug", { - action: "receiveCcipReadFetchError", - request, - result, - }); - } - catch (error) { } - // 4xx indicates the result is not present; stop - (0, index_js_2.assert)(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, "OFFCHAIN_FAULT", { - reason: "404_MISSING_RESOURCE", - transaction: tx, - info: { url, errorMessage }, - }); - // 5xx indicates server issue; try the next url - errorMessages.push(errorMessage); - } - (0, index_js_2.assert)(false, `error encountered during CCIP fetch: ${errorMessages - .map((m) => JSON.stringify(m)) - .join(", ")}`, "OFFCHAIN_FAULT", { - reason: "500_SERVER_ERROR", - transaction: tx, - info: { urls, errorMessages }, - }); - } - _wrapBlock(value, network) { - return new provider_js_1.Block((0, format_js_1.formatBlock)(value), this); - } - _wrapLog(value, network) { - return new provider_js_1.Log((0, format_js_1.formatLog)(value), this); - } - _wrapTransactionReceipt(value, network) { - return new provider_js_1.TransactionReceipt((0, format_js_1.formatTransactionReceipt)(value), this); - } - _wrapTransactionResponse(tx, network) { - return new provider_js_1.TransactionResponse((0, format_js_1.formatTransactionResponse)(tx), this); - } - _detectNetwork() { - (0, index_js_2.assert)(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", { - operation: "_detectNetwork", - }); - } - // Sub-classes should override this and handle PerformActionRequest requests, calling - // the super for any unhandled actions. - async _perform(req) { - (0, index_js_2.assert)(false, `unsupported method: ${req.method}`, "UNSUPPORTED_OPERATION", { - operation: req.method, - info: req, - }); - } - // State - async getBlockNumber() { - const blockNumber = (0, index_js_2.getNumber)(await this.#perform({ method: "getBlockNumber" }), "%response"); - if (this.#lastBlockNumber >= 0) { - this.#lastBlockNumber = blockNumber; - } - return blockNumber; - } - _getAddress(address) { - return (0, checks_js_1.resolveAddress)(address); - } - _getBlockTag(blockTag) { - if (blockTag == null) { - return "latest"; - } - switch (blockTag) { - case "earliest": - return "0x0"; - case "latest": - case "pending": - case "safe": - case "finalized": - return blockTag; - } - if ((0, index_js_2.isHexString)(blockTag)) { - if ((0, index_js_2.isHexString)(blockTag, 32)) { - return blockTag; - } - return (0, index_js_2.toQuantity)(blockTag); - } - if (typeof blockTag === "bigint") { - blockTag = (0, index_js_2.getNumber)(blockTag, "blockTag"); - } - if (typeof blockTag === "number") { - if (blockTag >= 0) { - return (0, index_js_2.toQuantity)(blockTag); - } - if (this.#lastBlockNumber >= 0) { - return (0, index_js_2.toQuantity)(this.#lastBlockNumber + blockTag); - } - return this.getBlockNumber().then((b) => (0, index_js_2.toQuantity)(b + blockTag)); - } - (0, index_js_2.assertArgument)(false, "invalid blockTag", "blockTag", blockTag); - } - _getFilter(filter) { - // Create a canonical representation of the topics - const topics = (filter.topics || []).map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - return concisify(t.map((t) => t.toLowerCase())); - } - return t.toLowerCase(); - }); - const blockHash = "blockHash" in filter ? filter.blockHash : undefined; - const resolve = (_address, fromBlock, toBlock) => { - let address = undefined; - switch (_address.length) { - case 0: - break; - case 1: - address = _address[0]; - break; - default: - _address.sort(); - address = _address; - } - if (blockHash) { - if (fromBlock != null || toBlock != null) { - throw new Error("invalid filter"); - } - } - const filter = {}; - if (address) { - filter.address = address; - } - if (topics.length) { - filter.topics = topics; - } - if (fromBlock) { - filter.fromBlock = fromBlock; - } - if (toBlock) { - filter.toBlock = toBlock; - } - if (blockHash) { - filter.blockHash = blockHash; - } - return filter; - }; - // Addresses could be async (ENS names or Addressables) - let address = []; - if (filter.address) { - if (Array.isArray(filter.address)) { - for (const addr of filter.address) { - address.push(this._getAddress(addr)); - } - } - else { - address.push(this._getAddress(filter.address)); - } - } - let fromBlock = undefined; - if ("fromBlock" in filter) { - fromBlock = this._getBlockTag(filter.fromBlock); - } - let toBlock = undefined; - if ("toBlock" in filter) { - toBlock = this._getBlockTag(filter.toBlock); - } - if (address.filter((a) => typeof a !== "string").length || - (fromBlock != null && typeof fromBlock !== "string") || - (toBlock != null && typeof toBlock !== "string")) { - return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result) => { - return resolve(result[0], result[1], result[2]); - }); - } - return resolve(address, fromBlock, toBlock); - } - _getTransactionRequest(_request) { - const request = (0, provider_js_1.copyRequest)(_request); - const promises = []; - ["to", "from"].forEach((key) => { - if (request[key] == null) { - return; - } - const addr = (0, checks_js_1.resolveAddress)(request[key]); - if (isPromise(addr)) { - promises.push((async function () { - request[key] = await addr; - })()); - } - else { - request[key] = addr; - } - }); - if (request.blockTag != null) { - const blockTag = this._getBlockTag(request.blockTag); - if (isPromise(blockTag)) { - promises.push((async function () { - request.blockTag = await blockTag; - })()); - } - else { - request.blockTag = blockTag; - } - } - if (promises.length) { - return (async function () { - await Promise.all(promises); - return request; - })(); - } - return request; - } - async getNetwork() { - // No explicit network was set and this is our first time - if (this.#networkPromise == null) { - // Detect the current network (shared with all calls) - const detectNetwork = this._detectNetwork().then((network) => { - this.emit("network", network, null); - return network; - }, (error) => { - // Reset the networkPromise on failure, so we will try again - if (this.#networkPromise === detectNetwork) { - this.#networkPromise = null; - } - throw error; - }); - this.#networkPromise = detectNetwork; - return (await detectNetwork).clone(); - } - const networkPromise = this.#networkPromise; - const [expected, actual] = await Promise.all([ - networkPromise, - this._detectNetwork(), // The actual connected network - ]); - if (expected.networkId !== actual.networkId) { - if (this.#anyNetwork) { - // The "any" network can change, so notify listeners - this.emit("network", actual, expected); - // Update the network if something else hasn't already changed it - if (this.#networkPromise === networkPromise) { - this.#networkPromise = Promise.resolve(actual); - } - } - else { - // Otherwise, we do not allow changes to the underlying network - (0, index_js_2.assert)(false, `network changed: ${expected.networkId} => ${actual.networkId} `, "NETWORK_ERROR", { - event: "changed", - }); - } - } - return expected.clone(); - } - async getEnergyPrice() { - const { energyPrice } = await (0, index_js_2.resolveProperties)({ - block: this.getBlock("latest"), - energyPrice: (async () => { - try { - const energyPrice = await this.#perform({ method: "getEnergyPrice" }); - return (0, index_js_2.getBigInt)(energyPrice, "%response"); - } - catch (error) { } - return null; - })(), - }); - return new provider_js_1.FeeData(energyPrice); - } - async getFeeData() { - const { energyPrice } = await (0, index_js_2.resolveProperties)({ - block: this.getBlock("latest"), - energyPrice: (async () => { - try { - const energyPrice = await this.#perform({ method: "getEnergyPrice" }); - return (0, index_js_2.getBigInt)(energyPrice, "%response"); - } - catch (error) { } - return null; - })(), - }); - return new provider_js_1.FeeData(energyPrice); - } - async estimateEnergy(_tx) { - let tx = this._getTransactionRequest(_tx); - if (isPromise(tx)) { - tx = await tx; - } - return (0, index_js_2.getBigInt)(await this.#perform({ - method: "estimateEnergy", - transaction: tx, - }), "%response"); - } - async #call(tx, blockTag, attempt) { - (0, index_js_2.assert)(attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", { - reason: "TOO_MANY_REDIRECTS", - transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }), - }); - // This came in as a PerformActionTransaction, so to/from are safe; we can cast - const transaction = (0, provider_js_1.copyRequest)(tx); - try { - return (0, index_js_2.hexlify)(await this._perform({ method: "call", transaction, blockTag })); - } - catch (error) { - // CCIP Read OffchainLookup - if (!this.disableCcipRead && - (0, index_js_2.isCallException)(error) && - error.data && - attempt >= 0 && - blockTag === "latest" && - transaction.to != null && - (0, index_js_2.dataSlice)(error.data, 0, 4) === "0x556f1830") { - const data = error.data; - const txSender = await (0, checks_js_1.resolveAddress)(transaction.to); - // Parse the CCIP Read Arguments - let ccipArgs; - try { - ccipArgs = parseOffchainLookup((0, index_js_2.dataSlice)(error.data, 4)); - } - catch (error) { - (0, index_js_2.assert)(false, error.message, "OFFCHAIN_FAULT", { - reason: "BAD_DATA", - transaction, - info: { data }, - }); - } - // Check the sender of the OffchainLookup matches the transaction - (0, index_js_2.assert)(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), "CCIP Read sender mismatch", "CALL_EXCEPTION", { - action: "call", - data, - reason: "OffchainLookup", - transaction: transaction, - invocation: null, - revert: { - signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", - name: "OffchainLookup", - args: ccipArgs.errorArgs, - }, - }); - const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls); - (0, index_js_2.assert)(ccipResult != null, "CCIP Read failed to fetch data", "OFFCHAIN_FAULT", { - reason: "FETCH_FAILED", - transaction, - info: { data: error.data, errorArgs: ccipArgs.errorArgs }, - }); - const tx = { - to: txSender, - data: (0, index_js_2.concat)([ - ccipArgs.selector, - encodeBytes([ccipResult, ccipArgs.extraData]), - ]), - }; - this.emit("debug", { action: "sendCcipReadCall", transaction: tx }); - try { - const result = await this.#call(tx, blockTag, attempt + 1); - this.emit("debug", { - action: "receiveCcipReadCallResult", - transaction: Object.assign({}, tx), - result, - }); - return result; - } - catch (error) { - this.emit("debug", { - action: "receiveCcipReadCallError", - transaction: Object.assign({}, tx), - error, - }); - throw error; - } - } - throw error; - } - } - async #checkNetwork(promise) { - const { value } = await (0, index_js_2.resolveProperties)({ - network: this.getNetwork(), - value: promise, - }); - return value; - } - async call(_tx) { - const { tx, blockTag } = await (0, index_js_2.resolveProperties)({ - tx: this._getTransactionRequest(_tx), - blockTag: this._getBlockTag(_tx.blockTag), - }); - return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1)); - } - // Account - async #getAccountValue(request, _address, _blockTag) { - let address = this._getAddress(_address); - let blockTag = this._getBlockTag(_blockTag); - if (typeof address !== "string" || typeof blockTag !== "string") { - [address, blockTag] = await Promise.all([address, blockTag]); - } - return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag }))); - } - async getBalance(address, blockTag) { - return (0, index_js_2.getBigInt)(await this.#getAccountValue({ method: "getBalance" }, address, blockTag), "%response"); - } - async getTransactionCount(address, blockTag) { - return (0, index_js_2.getNumber)(await this.#getAccountValue({ method: "getTransactionCount" }, address, blockTag), "%response"); - } - async getCode(address, blockTag) { - return (0, index_js_2.hexlify)(await this.#getAccountValue({ method: "getCode" }, address, blockTag)); - } - async getStorage(address, _position, blockTag) { - const position = (0, index_js_2.getBigInt)(_position, "position"); - return (0, index_js_2.hexlify)(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag)); - } - // Write - async broadcastTransaction(signedTx) { - const { blockNumber, hash, network } = await (0, index_js_2.resolveProperties)({ - blockNumber: this.getBlockNumber(), - hash: this._perform({ - method: "broadcastTransaction", - signedTransaction: signedTx, - }), - network: this.getNetwork(), - }); - const tx = index_js_1.Transaction.from(signedTx); - if (tx.hash !== hash) { - throw new Error("@TODO: the returned hash did not match"); - } - return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber); - } - async #getBlock(block, includeTransactions) { - // @TODO: Add CustomBlockPlugin check - if ((0, index_js_2.isHexString)(block, 32)) { - return await this.#perform({ - method: "getBlock", - blockHash: block, - includeTransactions, - }); - } - let blockTag = this._getBlockTag(block); - if (typeof blockTag !== "string") { - blockTag = await blockTag; - } - return await this.#perform({ - method: "getBlock", - blockTag, - includeTransactions, - }); - } - // Queries - async getBlock(block, prefetchTxs) { - const { network, params } = await (0, index_js_2.resolveProperties)({ - network: this.getNetwork(), - params: this.#getBlock(block, !!prefetchTxs), - }); - if (params == null) { - return null; - } - return this._wrapBlock(params, network); - } - async getTransaction(hash) { - const { network, params } = await (0, index_js_2.resolveProperties)({ - network: this.getNetwork(), - params: this.#perform({ method: "getTransaction", hash }), - }); - if (params == null) { - return null; - } - return this._wrapTransactionResponse(params, network); - } - async getTransactionReceipt(hash) { - const { network, params } = await (0, index_js_2.resolveProperties)({ - network: this.getNetwork(), - params: this.#perform({ method: "getTransactionReceipt", hash }), - }); - if (params == null) { - return null; - } - // Some backends did not backfill the effectiveEnergyPrice into old transactions - // in the receipt, so we look it up manually and inject it. - if (params.energyPrice == null && params.effectiveEnergyPrice == null) { - const tx = await this.#perform({ method: "getTransaction", hash }); - if (tx == null) { - throw new Error("report this; could not find tx or effectiveEnergyPrice"); - } - params.effectiveEnergyPrice = tx.energyPrice; - } - return this._wrapTransactionReceipt(params, network); - } - async getTransactionResult(hash) { - const { result } = await (0, index_js_2.resolveProperties)({ - network: this.getNetwork(), - result: this.#perform({ method: "getTransactionResult", hash }), - }); - if (result == null) { - return null; - } - return (0, index_js_2.hexlify)(result); - } - // Bloom-filter Queries - async getLogs(_filter) { - let filter = this._getFilter(_filter); - if (isPromise(filter)) { - filter = await filter; - } - const { network, params } = await (0, index_js_2.resolveProperties)({ - network: this.getNetwork(), - params: this.#perform({ method: "getLogs", filter }), - }); - return params.map((p) => this._wrapLog(p, network)); - } - // ENS - _getProvider(networkId) { - (0, index_js_2.assert)(false, "provider cannot connect to target network", "UNSUPPORTED_OPERATION", { - operation: "_getProvider()", - }); - } - async waitForTransaction(hash, _confirms, timeout) { - const confirms = _confirms != null ? _confirms : 1; - if (confirms === 0) { - return this.getTransactionReceipt(hash); - } - return new Promise(async (resolve, reject) => { - let timer = null; - const listener = async (blockNumber) => { - try { - const receipt = await this.getTransactionReceipt(hash); - if (receipt != null) { - if (blockNumber - receipt.blockNumber + 1 >= confirms) { - resolve(receipt); - //this.off("block", listener); - if (timer) { - clearTimeout(timer); - timer = null; - } - return; - } - } - } - catch (error) { - console.log("EEE", error); - } - this.once("block", listener); - }; - if (timeout != null) { - timer = setTimeout(() => { - if (timer == null) { - return; - } - timer = null; - this.off("block", listener); - reject((0, index_js_2.makeError)("timeout", "TIMEOUT", { reason: "timeout" })); - }, timeout); - } - listener(await this.getBlockNumber()); - }); - } - async waitForBlock(blockTag) { - (0, index_js_2.assert)(false, "not implemented yet", "NOT_IMPLEMENTED", { - operation: "waitForBlock", - }); - } - _clearTimeout(timerId) { - const timer = this.#timers.get(timerId); - if (!timer) { - return; - } - if (timer.timer) { - clearTimeout(timer.timer); - } - this.#timers.delete(timerId); - } - _setTimeout(_func, timeout) { - if (timeout == null) { - timeout = 0; - } - const timerId = this.#nextTimer++; - const func = () => { - this.#timers.delete(timerId); - _func(); - }; - if (this.paused) { - this.#timers.set(timerId, { timer: null, func, time: timeout }); - } - else { - const timer = setTimeout(func, timeout); - this.#timers.set(timerId, { timer, func, time: getTime() }); - } - return timerId; - } - _forEachSubscriber(func) { - for (const sub of this.#subs.values()) { - func(sub.subscriber); - } - } - // Event API; sub-classes should override this; any supported - // event filter will have been munged into an EventFilter - _getSubscriber(sub) { - switch (sub.type) { - case "debug": - case "error": - case "network": - return new UnmanagedSubscriber(sub.type); - case "block": - return new subscriber_polling_js_1.PollingBlockSubscriber(this); - case "event": - return new subscriber_polling_js_1.PollingEventSubscriber(this, sub.filter); - case "transaction": - return new subscriber_polling_js_1.PollingTransactionSubscriber(this, sub.hash); - case "orphan": - return new subscriber_polling_js_1.PollingOrphanSubscriber(this, sub.filter); - } - throw new Error(`unsupported event: ${sub.type}`); - } - _recoverSubscriber(oldSub, newSub) { - for (const sub of this.#subs.values()) { - if (sub.subscriber === oldSub) { - if (sub.started) { - sub.subscriber.stop(); - } - sub.subscriber = newSub; - if (sub.started) { - newSub.start(); - } - if (this.#pausedState != null) { - newSub.pause(this.#pausedState); - } - break; - } - } - } - async #hasSub(event, emitArgs) { - let sub = await getSubscription(event, this); - // This is a log that is removing an existing log; we actually want - // to emit an orphan event for the removed log - if (sub.type === "event" && - emitArgs && - emitArgs.length > 0 && - emitArgs[0].removed === true) { - sub = await getSubscription({ orphan: "drop-log", log: emitArgs[0] }, this); - } - return this.#subs.get(sub.tag) || null; - } - async #getSub(event) { - const subscription = await getSubscription(event, this); - // Prevent tampering with our tag in any subclass' _getSubscriber - const tag = subscription.tag; - let sub = this.#subs.get(tag); - if (!sub) { - const subscriber = this._getSubscriber(subscription); - const addressableMap = new WeakMap(); - const nameMap = new Map(); - sub = { - subscriber, - tag, - addressableMap, - nameMap, - started: false, - listeners: [], - }; - this.#subs.set(tag, sub); - } - return sub; - } - async on(event, listener) { - const sub = await this.#getSub(event); - sub.listeners.push({ listener, once: false }); - if (!sub.started) { - sub.subscriber.start(); - sub.started = true; - if (this.#pausedState != null) { - sub.subscriber.pause(this.#pausedState); - } - } - return this; - } - async once(event, listener) { - const sub = await this.#getSub(event); - sub.listeners.push({ listener, once: true }); - if (!sub.started) { - sub.subscriber.start(); - sub.started = true; - if (this.#pausedState != null) { - sub.subscriber.pause(this.#pausedState); - } - } - return this; - } - async emit(event, ...args) { - const sub = await this.#hasSub(event, args); - // If there is not subscription or if a recent emit removed - // the last of them (which also deleted the sub) do nothing - if (!sub || sub.listeners.length === 0) { - return false; - } - const count = sub.listeners.length; - sub.listeners = sub.listeners.filter(({ listener, once }) => { - const payload = new index_js_2.EventPayload(this, once ? null : listener, event); - try { - listener.call(this, ...args, payload); - } - catch (error) { } - return !once; - }); - if (sub.listeners.length === 0) { - if (sub.started) { - sub.subscriber.stop(); - } - this.#subs.delete(sub.tag); - } - return count > 0; - } - async listenerCount(event) { - if (event) { - const sub = await this.#hasSub(event); - if (!sub) { - return 0; - } - return sub.listeners.length; - } - let total = 0; - for (const { listeners } of this.#subs.values()) { - total += listeners.length; - } - return total; - } - async listeners(event) { - if (event) { - const sub = await this.#hasSub(event); - if (!sub) { - return []; - } - return sub.listeners.map(({ listener }) => listener); - } - let result = []; - for (const { listeners } of this.#subs.values()) { - result = result.concat(listeners.map(({ listener }) => listener)); - } - return result; - } - async off(event, listener) { - const sub = await this.#hasSub(event); - if (!sub) { - return this; - } - if (listener) { - const index = sub.listeners - .map(({ listener }) => listener) - .indexOf(listener); - if (index >= 0) { - sub.listeners.splice(index, 1); - } - } - if (!listener || sub.listeners.length === 0) { - if (sub.started) { - sub.subscriber.stop(); - } - this.#subs.delete(sub.tag); - } - return this; - } - async removeAllListeners(event) { - if (event) { - const { tag, started, subscriber } = await this.#getSub(event); - if (started) { - subscriber.stop(); - } - this.#subs.delete(tag); - } - else { - for (const [tag, { started, subscriber }] of this.#subs) { - if (started) { - subscriber.stop(); - } - this.#subs.delete(tag); - } - } - return this; - } - // Alias for "on" - async addListener(event, listener) { - return await this.on(event, listener); - } - // Alias for "off" - async removeListener(event, listener) { - return this.off(event, listener); - } - // Sub-classes should override this to shutdown any sockets, etc. - // but MUST call this super.shutdown. - destroy() { - // Stop all listeners - this.removeAllListeners(); - // Shut down all tiemrs - for (const timerId of this.#timers.keys()) { - this._clearTimeout(timerId); - } - } - get paused() { - return this.#pausedState != null; - } - set paused(pause) { - if (!!pause === this.paused) { - return; - } - if (this.paused) { - this.resume(); - } - else { - this.pause(false); - } - } - pause(dropWhilePaused) { - this.#lastBlockNumber = -1; - if (this.#pausedState != null) { - if (this.#pausedState == !!dropWhilePaused) { - return; - } - (0, index_js_2.assert)(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", { - operation: "pause", - }); - } - this._forEachSubscriber((s) => s.pause(dropWhilePaused)); - this.#pausedState = !!dropWhilePaused; - for (const timer of this.#timers.values()) { - // Clear the timer - if (timer.timer) { - clearTimeout(timer.timer); - } - // Remaining time needed for when we become unpaused - timer.time = getTime() - timer.time; - } - } - resume() { - if (this.#pausedState == null) { - return; - } - this._forEachSubscriber((s) => s.resume()); - this.#pausedState = null; - for (const timer of this.#timers.values()) { - // Remaining time when we were paused - let timeout = timer.time; - if (timeout < 0) { - timeout = 0; - } - // Start time (in cause paused, so we con compute remaininf time) - timer.time = getTime(); - // Start the timer - setTimeout(timer.func, timeout); - } - } -} -exports.AbstractProvider = AbstractProvider; -function _parseString(result, start) { - try { - const bytes = _parseBytes(result, start); - if (bytes) { - return (0, index_js_2.toUtf8String)(bytes); - } - } - catch (error) { } - return null; -} -function _parseBytes(result, start) { - if (result === "0x") { - return null; - } - try { - const offset = (0, index_js_2.getNumber)((0, index_js_2.dataSlice)(result, start, start + 32)); - const length = (0, index_js_2.getNumber)((0, index_js_2.dataSlice)(result, offset, offset + 32)); - return (0, index_js_2.dataSlice)(result, offset + 32, offset + 32 + length); - } - catch (error) { } - return null; -} -function numPad(value) { - const result = (0, index_js_2.toBeArray)(value); - if (result.length > 32) { - throw new Error("internal; should not happen"); - } - const padded = new Uint8Array(32); - padded.set(result, 32 - result.length); - return padded; -} -function bytesPad(value) { - if (value.length % 32 === 0) { - return value; - } - const result = new Uint8Array(Math.ceil(value.length / 32) * 32); - result.set(value); - return result; -} -const empty = new Uint8Array([]); -// ABI Encodes a series of (bytes, bytes, ...) -function encodeBytes(datas) { - const result = []; - let byteCount = 0; - // Add place-holders for pointers as we add items - for (let i = 0; i < datas.length; i++) { - result.push(empty); - byteCount += 32; - } - for (let i = 0; i < datas.length; i++) { - const data = (0, index_js_2.getBytes)(datas[i]); - // Update the bytes offset - result[i] = numPad(byteCount); - // The length and padded value of data - result.push(numPad(data.length)); - result.push(bytesPad(data)); - byteCount += 32 + Math.ceil(data.length / 32) * 32; - } - return (0, index_js_2.concat)(result); -} -const zeros = "0x0000000000000000000000000000000000000000000000000000000000000000"; -function parseOffchainLookup(data) { - const result = { - sender: "", - urls: [], - calldata: "", - selector: "", - extraData: "", - errorArgs: [], - }; - (0, index_js_2.assert)((0, index_js_2.dataLength)(data) >= 5 * 32, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", { - reason: "insufficient OffchainLookup data", - }); - const sender = (0, index_js_2.dataSlice)(data, 0, 32); - (0, index_js_2.assert)((0, index_js_2.dataSlice)(sender, 0, 12) === (0, index_js_2.dataSlice)(zeros, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup sender", - }); - result.sender = (0, index_js_2.dataSlice)(sender, 12); - // Read the URLs from the response - try { - const urls = []; - const urlsOffset = (0, index_js_2.getNumber)((0, index_js_2.dataSlice)(data, 32, 64)); - const urlsLength = (0, index_js_2.getNumber)((0, index_js_2.dataSlice)(data, urlsOffset, urlsOffset + 32)); - const urlsData = (0, index_js_2.dataSlice)(data, urlsOffset + 32); - for (let u = 0; u < urlsLength; u++) { - const url = _parseString(urlsData, u * 32); - if (url == null) { - throw new Error("abort"); - } - urls.push(url); - } - result.urls = urls; - } - catch (error) { - (0, index_js_2.assert)(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup urls", - }); - } - // Get the CCIP calldata to forward - try { - const calldata = _parseBytes(data, 64); - if (calldata == null) { - throw new Error("abort"); - } - result.calldata = calldata; - } - catch (error) { - (0, index_js_2.assert)(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup calldata", - }); - } - // Get the callbackSelector (bytes4) - (0, index_js_2.assert)((0, index_js_2.dataSlice)(data, 100, 128) === (0, index_js_2.dataSlice)(zeros, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup callbaackSelector", - }); - result.selector = (0, index_js_2.dataSlice)(data, 96, 100); - // Get the extra data to send back to the contract as context - try { - const extraData = _parseBytes(data, 128); - if (extraData == null) { - throw new Error("abort"); - } - result.extraData = extraData; - } - catch (error) { - (0, index_js_2.assert)(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup extraData", - }); - } - result.errorArgs = "sender,urls,calldata,selector,extraData" - .split(/,/) - .map((k) => result[k]); - return result; -} -//# sourceMappingURL=abstract-provider.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/abstract-provider.js.map b/lib.commonjs/providers/abstract-provider.js.map deleted file mode 100644 index 033abdb45..000000000 --- a/lib.commonjs/providers/abstract-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-provider.js","sourceRoot":"","sources":["../../src.ts/providers/abstract-provider.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,QAAQ;AACR,oBAAoB;AACpB,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAE3E,oDAAsD;AACtD,sDAAsD;AACtD,gDAoB2B;AAE3B,2CAKqB;AAC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AAM,EAAE,iCAAiC;SAC1C,CAAC,CAAC;KACJ;IAED,oCAAoC;IACpC,IAAA,iBAAM,EACJ,IAAA,oBAAS,EAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,IAAA,oBAAS,EAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EACrD,0CAA0C,EAC1C,gBAAgB,EAChB;QACE,MAAM,EAAE,0CAA0C;KACnD,CACF,CAAC;IACF,MAAM,CAAC,QAAQ,GAAG,IAAA,oBAAS,EAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IAE3C,6DAA6D;IAC7D,IAAI;QACF,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACzC,IAAI,SAAS,IAAI,IAAI,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;SAC1B;QACD,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;KAC9B;IAAC,OAAO,KAAK,EAAE;QACd,IAAA,iBAAM,EAAC,KAAK,EAAE,kCAAkC,EAAE,gBAAgB,EAAE;YAClE,MAAM,EAAE,kCAAkC;SAC3C,CAAC,CAAC;KACJ;IAED,MAAM,CAAC,SAAS,GAAG,yCAAyC;SACzD,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAO,MAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhC,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/providers/abstract-signer.d.ts b/lib.commonjs/providers/abstract-signer.d.ts deleted file mode 100644 index ab4997033..000000000 --- a/lib.commonjs/providers/abstract-signer.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -import type { Signer } from "./signer.js"; -export declare abstract class AbstractSigner

implements Signer { - readonly provider: P; - constructor(provider?: P); - abstract getAddress(): Promise; - abstract connect(provider: null | Provider): Signer; - getNonce(blockTag?: BlockTag): Promise; - populateCall(tx: TransactionRequest): Promise>; - populateTransaction(tx: TransactionRequest): Promise>; - estimateEnergy(tx: TransactionRequest): Promise; - call(tx: TransactionRequest): Promise; - resolveName(name: string): Promise; - sendTransaction(tx: TransactionRequest): Promise; - abstract signTransaction(tx: TransactionRequest): Promise; - abstract signMessage(message: string | Uint8Array): Promise; - abstract signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -export declare class VoidSigner extends AbstractSigner { - #private; - readonly address: string; - constructor(address: string, provider?: null | Provider); - getAddress(): Promise; - connect(provider: null | Provider): VoidSigner; - signTransaction(tx: TransactionRequest): Promise; - signMessage(message: string | Uint8Array): Promise; - signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -//# sourceMappingURL=abstract-signer.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/abstract-signer.d.ts.map b/lib.commonjs/providers/abstract-signer.d.ts.map deleted file mode 100644 index 41b30b933..000000000 --- a/lib.commonjs/providers/abstract-signer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-signer.d.ts","sourceRoot":"","sources":["../../src.ts/providers/abstract-signer.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAuC1C,8BAAsB,cAAc,CAClC,CAAC,SAAS,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAC3C,YAAW,MAAM;IAEjB,QAAQ,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,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ;IAKjD,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,UAAU;IAUxC,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1D,aAAa,CACjB,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC;CAGnB"} \ No newline at end of file diff --git a/lib.commonjs/providers/abstract-signer.js b/lib.commonjs/providers/abstract-signer.js deleted file mode 100644 index 2355b41ba..000000000 --- a/lib.commonjs/providers/abstract-signer.js +++ /dev/null @@ -1,133 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VoidSigner = exports.AbstractSigner = void 0; -/** - * About Abstract Signer and subclassing - * - * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer] - */ -const checks_js_1 = require("../address/checks.js"); -const index_js_1 = require("../address/index.js"); -const index_js_2 = require("../transaction/index.js"); -const index_js_3 = require("../utils/index.js"); -const provider_js_1 = require("./provider.js"); -function checkProvider(signer, operation) { - if (signer.provider) { - return signer.provider; - } - (0, index_js_3.assert)(false, "missing provider", "UNSUPPORTED_OPERATION", { operation }); -} -async function populate(signer, tx) { - let pop = (0, provider_js_1.copyRequest)(tx); - if (pop.to != null) { - pop.to = (0, checks_js_1.resolveAddress)(pop.to); - } - if (pop.from != null) { - const from = pop.from; - pop.from = Promise.all([signer.getAddress(), (0, checks_js_1.resolveAddress)(from)]).then(([address, from]) => { - (0, index_js_3.assertArgument)(address.toLowerCase() === from.toLowerCase(), "transaction from mismatch", "tx.from", from); - return address; - }); - } - else { - pop.from = signer.getAddress(); - } - return await (0, index_js_3.resolveProperties)(pop); -} -class AbstractSigner { - provider; - constructor(provider) { - (0, index_js_3.defineProperties)(this, { provider: provider || null }); - } - async getNonce(blockTag) { - return checkProvider(this, "getTransactionCount").getTransactionCount(await this.getAddress(), blockTag); - } - async populateCall(tx) { - const pop = await populate(this, tx); - return pop; - } - async populateTransaction(tx) { - const provider = checkProvider(this, "populateTransaction"); - const pop = await populate(this, tx); - if (pop.nonce == null) { - pop.nonce = await this.getNonce("pending"); - } - if (pop.energyLimit == null) { - pop.energyLimit = await this.estimateEnergy(pop); - } - // Populate the chain ID - const network = await this.provider.getNetwork(); - if (pop.networkId != null) { - const networkId = (0, index_js_3.getBigInt)(pop.networkId); - (0, index_js_3.assertArgument)(networkId === network.networkId, "transaction networkId mismatch", "tx.networkId", tx.networkId); - } - else { - pop.networkId = network.networkId; - } - // We need to get fee data to determine things - const feeData = await provider.getFeeData(); - // We need to auto-detect the intended type of this transaction... - if (feeData.energyPrice != null) { - // Network doesn't support EIP-1559... - // Populate missing fee data - if (pop.energyPrice == null) { - pop.energyPrice = feeData.energyPrice; - } - } - else { - // getFeeData has failed us. - (0, index_js_3.assert)(false, "failed to get consistent fee data", "UNSUPPORTED_OPERATION", { - operation: "signer.getFeeData", - }); - } - //@TOOD: Don't await all over the place; save them up for - // the end for better batching - return await (0, index_js_3.resolveProperties)(pop); - } - async estimateEnergy(tx) { - return checkProvider(this, "estimateEnergy").estimateEnergy(await this.populateCall(tx)); - } - async call(tx) { - return checkProvider(this, "call").call(await this.populateCall(tx)); - } - async resolveName(name) { - return (0, index_js_1.getAddress)(name); - } - async sendTransaction(tx) { - const provider = checkProvider(this, "sendTransaction"); - const pop = await this.populateTransaction(tx); - delete pop.from; - const txObj = index_js_2.Transaction.from(pop); - return await provider.broadcastTransaction(await this.signTransaction(txObj)); - } -} -exports.AbstractSigner = AbstractSigner; -class VoidSigner extends AbstractSigner { - address; - constructor(address, provider) { - super(provider); - (0, index_js_3.defineProperties)(this, { address }); - } - async getAddress() { - return this.address; - } - connect(provider) { - return new VoidSigner(this.address, provider); - } - #throwUnsupported(suffix, operation) { - (0, index_js_3.assert)(false, `VoidSigner cannot sign ${suffix}`, "UNSUPPORTED_OPERATION", { - operation, - }); - } - async signTransaction(tx) { - this.#throwUnsupported("transactions", "signTransaction"); - } - async signMessage(message) { - this.#throwUnsupported("messages", "signMessage"); - } - async signTypedData(domain, types, value) { - this.#throwUnsupported("typed-data", "signTypedData"); - } -} -exports.VoidSigner = VoidSigner; -//# sourceMappingURL=abstract-signer.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/abstract-signer.js.map b/lib.commonjs/providers/abstract-signer.js.map deleted file mode 100644 index a68aae586..000000000 --- a/lib.commonjs/providers/abstract-signer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-signer.js","sourceRoot":"","sources":["../../src.ts/providers/abstract-signer.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAAsD;AACtD,kDAAiD;AACjD,sDAAsD;AACtD,gDAM2B;AAE3B,+CAA4C;AAa5C,SAAS,aAAa,CAAC,MAAsB,EAAE,SAAiB;IAC9D,IAAI,MAAM,CAAC,QAAQ,EAAE;QACnB,OAAO,MAAM,CAAC,QAAQ,CAAC;KACxB;IACD,IAAA,iBAAM,EAAC,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED,KAAK,UAAU,QAAQ,CACrB,MAAsB,EACtB,EAAsB;IAEtB,IAAI,GAAG,GAAQ,IAAA,yBAAW,EAAC,EAAE,CAAC,CAAC;IAE/B,IAAI,GAAG,CAAC,EAAE,IAAI,IAAI,EAAE;QAClB,GAAG,CAAC,EAAE,GAAG,IAAA,0BAAc,EAAC,GAAG,CAAC,EAAE,CAAC,CAAC;KACjC;IAED,IAAI,GAAG,CAAC,IA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C,MAAc,EAAE,SAAiB;QACjD,IAAA,iBAAM,EAAC,KAAK,EAAE,0BAA0B,MAAM,EAAE,EAAE,uBAAuB,EAAE;YACzE,SAAS;SACV,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,EAAsB;QAC1C,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAA4B;QAC5C,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,MAAuB,EACvB,KAA4C,EAC5C,KAA0B;QAE1B,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;IACxD,CAAC;CACF;AArCD,gCAqCC"} \ No newline at end of file diff --git a/lib.commonjs/providers/community.d.ts b/lib.commonjs/providers/community.d.ts deleted file mode 100644 index a61908d27..000000000 --- a/lib.commonjs/providers/community.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * There are many awesome community services that provide Core - * nodes both for developers just starting out and for large-scale - * communities. - * - * @_section: api/providers/thirdparty: Community Providers [thirdparty] - */ -/** - * Providers which offer community credentials should extend this - * to notify any interested consumers whether community credentials - * are in-use. - */ -export interface CommunityResourcable { - /** - * Returns true of the instance is connected using the community - * credentials. - */ - isCommunityResource(): boolean; -} -/** - * Displays a warning in tht console when the community resource is - * being used too heavily by the app, recommending the developer - * acquire their own credentials instead of using the community - * credentials. - * - * The notification will only occur once per service. - */ -export declare function showThrottleMessage(service: string): void; -//# sourceMappingURL=community.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/community.d.ts.map b/lib.commonjs/providers/community.d.ts.map deleted file mode 100644 index f8a2a68bc..000000000 --- a/lib.commonjs/providers/community.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"community.d.ts","sourceRoot":"","sources":["../../src.ts/providers/community.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,mBAAmB,IAAI,OAAO,CAAC;CAChC;AAKD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CA4BzD"} \ No newline at end of file diff --git a/lib.commonjs/providers/community.js b/lib.commonjs/providers/community.js deleted file mode 100644 index 68d332987..000000000 --- a/lib.commonjs/providers/community.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -/** - * There are many awesome community services that provide Core - * nodes both for developers just starting out and for large-scale - * communities. - * - * @_section: api/providers/thirdparty: Community Providers [thirdparty] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.showThrottleMessage = void 0; -// Show the throttle message only once per service -const shown = new Set(); -/** - * Displays a warning in tht console when the community resource is - * being used too heavily by the app, recommending the developer - * acquire their own credentials instead of using the community - * credentials. - * - * The notification will only occur once per service. - */ -function showThrottleMessage(service) { - if (shown.has(service)) { - return; - } - shown.add(service); - console.log("========= NOTICE ========="); - console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`); - console.log(""); - console.log("The default API keys for each service are provided as a highly-throttled,"); - console.log("community resource for low-traffic projects and early prototyping."); - console.log(""); - console.log("While your application will continue to function, we highly recommended"); - console.log("signing up for your own API keys to improve performance, increase your"); - console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."); - console.log(""); -} -exports.showThrottleMessage = showThrottleMessage; -//# sourceMappingURL=community.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/community.js.map b/lib.commonjs/providers/community.js.map deleted file mode 100644 index 59ada24ff..000000000 --- a/lib.commonjs/providers/community.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"community.js","sourceRoot":"","sources":["../../src.ts/providers/community.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAeH,kDAAkD;AAClD,MAAM,KAAK,GAAgB,IAAI,GAAG,EAAE,CAAC;AAErC;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAAC,OAAe;IACjD,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QACtB,OAAO;KACR;IACD,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEnB,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CACT,6BAA6B,OAAO,sCAAsC,CAC3E,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CACT,2EAA2E,CAC5E,CAAC;IACF,OAAO,CAAC,GAAG,CACT,oEAAoE,CACrE,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CACT,yEAAyE,CAC1E,CAAC;IACF,OAAO,CAAC,GAAG,CACT,wEAAwE,CACzE,CAAC;IACF,OAAO,CAAC,GAAG,CACT,+EAA+E,CAChF,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC;AA5BD,kDA4BC"} \ No newline at end of file diff --git a/lib.commonjs/providers/contracts.d.ts b/lib.commonjs/providers/contracts.d.ts deleted file mode 100644 index 187f28cce..000000000 --- a/lib.commonjs/providers/contracts.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -export interface ContractRunner { - provider: null | Provider; - estimateEnergy?: (tx: TransactionRequest) => Promise; - call?: (tx: TransactionRequest) => Promise; - resolveName?: (name: string) => Promise; - sendTransaction?: (tx: TransactionRequest) => Promise; -} -//# sourceMappingURL=contracts.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/contracts.d.ts.map b/lib.commonjs/providers/contracts.d.ts.map deleted file mode 100644 index 085cff0c7..000000000 --- a/lib.commonjs/providers/contracts.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src.ts/providers/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC;IAG1B,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAG7D,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAGnD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAGvD,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC5E"} \ No newline at end of file diff --git a/lib.commonjs/providers/contracts.js b/lib.commonjs/providers/contracts.js deleted file mode 100644 index 705cd38a9..000000000 --- a/lib.commonjs/providers/contracts.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=contracts.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/contracts.js.map b/lib.commonjs/providers/contracts.js.map deleted file mode 100644 index 42ac4de89..000000000 --- a/lib.commonjs/providers/contracts.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src.ts/providers/contracts.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.commonjs/providers/default-provider.d.ts b/lib.commonjs/providers/default-provider.d.ts deleted file mode 100644 index 657919cb1..000000000 --- a/lib.commonjs/providers/default-provider.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { AbstractProvider } from "./abstract-provider.js"; -import type { Networkish } from "./network.js"; -import { WebSocketLike } from "./provider-websocket.js"; -export declare function getDefaultProvider(network: string | Networkish | WebSocketLike, options?: any): AbstractProvider; -//# sourceMappingURL=default-provider.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/default-provider.d.ts.map b/lib.commonjs/providers/default-provider.d.ts.map deleted file mode 100644 index a7b02c6c0..000000000 --- a/lib.commonjs/providers/default-provider.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"default-provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAUxD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,EAC5C,OAAO,CAAC,EAAE,GAAG,GACZ,gBAAgB,CA6FlB"} \ No newline at end of file diff --git a/lib.commonjs/providers/default-provider.js b/lib.commonjs/providers/default-provider.js deleted file mode 100644 index c2e69a8f4..000000000 --- a/lib.commonjs/providers/default-provider.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getDefaultProvider = void 0; -const index_js_1 = require("../utils/index.js"); -const provider_ankr_js_1 = require("./provider-ankr.js"); -const provider_alchemy_js_1 = require("./provider-alchemy.js"); -const provider_cloudflare_js_1 = require("./provider-cloudflare.js"); -const provider_infura_js_1 = require("./provider-infura.js"); -//import { PocketProvider } from "./provider-pocket.js"; -const provider_quicknode_js_1 = require("./provider-quicknode.js"); -const provider_fallback_js_1 = require("./provider-fallback.js"); -const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); -const provider_websocket_js_1 = require("./provider-websocket.js"); -function isWebSocketLike(value) { - return (value && - typeof value.send === "function" && - typeof value.close === "function"); -} -function getDefaultProvider(network, options) { - if (options == null) { - options = {}; - } - if (typeof network === "string" && network.match(/^https?:/)) { - return new provider_jsonrpc_js_1.JsonRpcProvider(network); - } - if ((typeof network === "string" && network.match(/^wss?:/)) || - isWebSocketLike(network)) { - return new provider_websocket_js_1.WebSocketProvider(network); - } - const providers = []; - if (options.alchemy !== "-") { - try { - providers.push(new provider_alchemy_js_1.AlchemyProvider(network, options.alchemy)); - } - catch (error) { - console.log(error); - } - } - if (options.ankr !== "-" && options.ankr != null) { - try { - providers.push(new provider_ankr_js_1.AnkrProvider(network, options.ankr)); - } - catch (error) { - console.log(error); - } - } - if (options.cloudflare !== "-") { - try { - providers.push(new provider_cloudflare_js_1.CloudflareProvider(network)); - } - catch (error) { - console.log(error); - } - } - if (options.infura !== "-") { - try { - let projectId = options.infura; - let projectSecret = undefined; - if (typeof projectId === "object") { - projectSecret = projectId.projectSecret; - projectId = projectId.projectId; - } - providers.push(new provider_infura_js_1.InfuraProvider(network, projectId, projectSecret)); - } - catch (error) { - console.log(error); - } - } - /* - if (options.pocket !== "-") { - try { - let appId = options.pocket; - let secretKey: undefined | string = undefined; - let loadBalancer: undefined | boolean = undefined; - if (typeof(appId) === "object") { - loadBalancer = !!appId.loadBalancer; - secretKey = appId.secretKey; - appId = appId.appId; - } - providers.push(new PocketProvider(network, appId, secretKey, loadBalancer)); - } catch (error) { console.log(error); } - } - */ - if (options.quicknode !== "-") { - try { - let token = options.quicknode; - providers.push(new provider_quicknode_js_1.QuickNodeProvider(network, token)); - } - catch (error) { - console.log(error); - } - } - (0, index_js_1.assert)(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", { - operation: "getDefaultProvider", - }); - if (providers.length === 1) { - return providers[0]; - } - return new provider_fallback_js_1.FallbackProvider(providers); -} -exports.getDefaultProvider = getDefaultProvider; -//# sourceMappingURL=default-provider.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/default-provider.js.map b/lib.commonjs/providers/default-provider.js.map deleted file mode 100644 index efb7dce63..000000000 --- a/lib.commonjs/providers/default-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"default-provider.js","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":";;;AAAA,gDAA2C;AAE3C,yDAAkD;AAClD,+DAAwD;AACxD,qEAA8D;AAC9D,6DAAsD;AACtD,wDAAwD;AACxD,mEAA4D;AAE5D,iEAA0D;AAC1D,+DAAwD;AACxD,mEAA4D;AAM5D,SAAS,eAAe,CAAC,KAAU;IACjC,OAAO,CACL,KAAK;QACL,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU;QAChC,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU,CAClC,CAAC;AACJ,CAAC;AAED,SAAgB,kBAAkB,CAChC,OAA4C,EAC5C,OAAa;IAEb,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,GAAG,EAAE,CAAC;KACd;IAED,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE;QAC5D,OAAO,IAAI,qCAAe,CAAC,OAAO,CAAC,CAAC;KACrC;IAED,IACE,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACxD,eAAe,CAAC,OAAO,CAAC,EACxB;QACA,OAAO,IAAI,yCAAiB,CAAC,OAAO,CAAC,CAAC;KACvC;IAED,MAAM,SAAS,GAA4B,EAAE,CAAC;IAE9C,IAAI,OAAO,CAAC,OAAO,KAAK,GAAG,EAAE;QAC3B,IAAI;YACF,SAAS,CAAC,IAAI,CAAC,IAAI,qCAAe,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;SAC/D;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACpB;KACF;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,IAAI,IAAI,EAAE;QAChD,IAAI;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A6B,EAC7B,uBAAuB,EACvB;QACE,SAAS,EAAE,oBAAoB;KAChC,CACF,CAAC;IAEF,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1B,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;KACrB;IAED,OAAO,IAAI,uCAAgB,CAAC,SAAS,CAAC,CAAC;AACzC,CAAC;AAhGD,gDAgGC"} \ No newline at end of file diff --git a/lib.commonjs/providers/format.d.ts b/lib.commonjs/providers/format.d.ts deleted file mode 100644 index e088632a0..000000000 --- a/lib.commonjs/providers/format.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; -export type FormatFunc = (value: any) => any; -export declare function allowNull(format: FormatFunc, nullValue?: any): FormatFunc; -export declare function arrayOf(format: FormatFunc): FormatFunc; -export declare function object(format: Record, altNames?: Record>): FormatFunc; -export declare function formatBoolean(value: any): boolean; -export declare function formatData(value: string): string; -export declare function formatHash(value: any): string; -export declare function formatUint256(value: any): string; -export declare function formatLog(value: any): LogParams; -export declare function formatBlock(value: any): BlockParams; -export declare function formatReceiptLog(value: any): LogParams; -export declare function formatTransactionReceipt(value: any): TransactionReceiptParams; -export declare function formatTransactionResponse(value: any): TransactionResponseParams; -//# sourceMappingURL=format.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/format.d.ts.map b/lib.commonjs/providers/format.d.ts.map deleted file mode 100644 index da5b2ee35..000000000 --- a/lib.commonjs/providers/format.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src.ts/providers/format.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,iBAAiB,CAAC;AAIzB,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;AAE7C,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,UAAU,CAOzE;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAOtD;AAKD,wBAAgB,MAAM,CACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GACvC,UAAU,CA+BZ;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAejD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGhD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAG7C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAKhD;AAmBD,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAE/C;AAoBD,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,WAAW,CAWnD;AAkBD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAEtD;AA6BD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,wBAAwB,CAE7E;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,GAAG,GACT,yBAAyB,CA0G3B"} \ No newline at end of file diff --git a/lib.commonjs/providers/format.js b/lib.commonjs/providers/format.js deleted file mode 100644 index 061ec8057..000000000 --- a/lib.commonjs/providers/format.js +++ /dev/null @@ -1,265 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.formatTransactionResponse = exports.formatTransactionReceipt = exports.formatReceiptLog = exports.formatBlock = exports.formatLog = exports.formatUint256 = exports.formatHash = exports.formatData = exports.formatBoolean = exports.object = exports.arrayOf = exports.allowNull = void 0; -/** - * @_ignore - */ -const index_js_1 = require("../address/index.js"); -const contract_address_js_1 = require("../address/contract-address.js"); -const index_js_2 = require("../transaction/index.js"); -const index_js_3 = require("../utils/index.js"); -const BN_0 = BigInt(0); -function allowNull(format, nullValue) { - return function (value) { - if (value == null) { - return nullValue; - } - return format(value); - }; -} -exports.allowNull = allowNull; -function arrayOf(format) { - return (array) => { - if (!Array.isArray(array)) { - throw new Error("not an array"); - } - return array.map((i) => format(i)); - }; -} -exports.arrayOf = arrayOf; -// Requires an object which matches a fleet of other formatters -// Any FormatFunc may return `undefined` to have the value omitted -// from the result object. Calls preserve `this`. -function object(format, altNames) { - return (value) => { - const result = {}; - for (const key in format) { - let srcKey = key; - if (altNames && key in altNames && !(srcKey in value)) { - for (const altKey of altNames[key]) { - if (altKey in value) { - srcKey = altKey; - break; - } - } - } - try { - const nv = format[key](value[srcKey]); - if (nv !== undefined) { - result[key] = nv; - } - } - catch (error) { - const message = error instanceof Error ? error.message : "not-an-error"; - (0, index_js_3.assert)(false, `invalid value for value.${key} (${message})`, "BAD_DATA", { value }); - } - } - return result; - }; -} -exports.object = object; -function formatBoolean(value) { - switch (value) { - case true: - case "true": - return true; - case false: - case "false": - return false; - } - (0, index_js_3.assertArgument)(false, `invalid boolean; ${JSON.stringify(value)}`, "value", value); -} -exports.formatBoolean = formatBoolean; -function formatData(value) { - (0, index_js_3.assertArgument)((0, index_js_3.isHexString)(value, true), "invalid data", "value", value); - return value; -} -exports.formatData = formatData; -function formatHash(value) { - (0, index_js_3.assertArgument)((0, index_js_3.isHexString)(value, 32), "invalid hash", "value", value); - return value; -} -exports.formatHash = formatHash; -function formatUint256(value) { - if (!(0, index_js_3.isHexString)(value)) { - throw new Error("invalid uint256"); - } - return (0, index_js_3.zeroPadValue)(value, 32); -} -exports.formatUint256 = formatUint256; -const _formatLog = object({ - address: index_js_1.getAddress, - blockHash: formatHash, - blockNumber: index_js_3.getNumber, - data: formatData, - index: index_js_3.getNumber, - removed: allowNull(formatBoolean, false), - topics: arrayOf(formatHash), - transactionHash: formatHash, - transactionIndex: index_js_3.getNumber, -}, { - index: ["logIndex"], -}); -function formatLog(value) { - return _formatLog(value); -} -exports.formatLog = formatLog; -const _formatBlock = object({ - hash: allowNull(formatHash), - parentHash: formatHash, - number: index_js_3.getNumber, - timestamp: index_js_3.getNumber, - nonce: allowNull(formatData), - difficulty: index_js_3.getBigInt, - energyLimit: index_js_3.getBigInt, - energyUsed: index_js_3.getBigInt, - miner: allowNull(index_js_1.getAddress), - extraData: formatData, - baseFeePerEnergy: allowNull(index_js_3.getBigInt), -}); -function formatBlock(value) { - const result = _formatBlock(value); - result.transactions = value.transactions.map((tx) => { - if (typeof tx === "string") { - return tx; - } - return formatTransactionResponse(tx); - }); - return result; -} -exports.formatBlock = formatBlock; -const _formatReceiptLog = object({ - transactionIndex: index_js_3.getNumber, - blockNumber: index_js_3.getNumber, - transactionHash: formatHash, - address: index_js_1.getAddress, - topics: arrayOf(formatHash), - data: formatData, - index: index_js_3.getNumber, - blockHash: formatHash, -}, { - index: ["logIndex"], -}); -function formatReceiptLog(value) { - return _formatReceiptLog(value); -} -exports.formatReceiptLog = formatReceiptLog; -const _formatTransactionReceipt = object({ - to: allowNull(index_js_1.getAddress, null), - from: allowNull(index_js_1.getAddress, null), - contractAddress: allowNull(index_js_1.getAddress, null), - // should be allowNull(hash), but broken-EIP-658 support is handled in receipt - index: index_js_3.getNumber, - root: allowNull(index_js_3.hexlify), - energyUsed: index_js_3.getBigInt, - logsBloom: allowNull(formatData), - blockHash: formatHash, - hash: formatHash, - logs: arrayOf(formatReceiptLog), - blockNumber: index_js_3.getNumber, - //confirmations: allowNull(getNumber, null), - cumulativeEnergyUsed: index_js_3.getBigInt, - effectiveEnergyPrice: allowNull(index_js_3.getBigInt), - status: allowNull(index_js_3.getNumber), - type: allowNull(index_js_3.getNumber, 0), -}, { - effectiveEnergyPrice: ["energyPrice"], - hash: ["transactionHash"], - index: ["transactionIndex"], -}); -function formatTransactionReceipt(value) { - return _formatTransactionReceipt(value); -} -exports.formatTransactionReceipt = formatTransactionReceipt; -function formatTransactionResponse(value) { - // Some clients (TestRPC) do strange things like return 0x0 for the - // 0 address; correct this to be a real address - if (value.to && !(0, index_js_1.getAddress)(value.to) && (0, index_js_3.getBigInt)(value.to) === BN_0) { - value.to = "0x0000000000000000000000000000000000000000"; - } - const result = object({ - hash: formatHash, - type: (value) => { - if (value === "0x" || value == null) { - return 0; - } - return (0, index_js_3.getNumber)(value); - }, - accessList: allowNull(index_js_2.accessListify, null), - blockHash: allowNull(formatHash, null), - blockNumber: allowNull(index_js_3.getNumber, null), - transactionIndex: allowNull(index_js_3.getNumber, null), - //confirmations: allowNull(getNumber, null), - from: index_js_1.getAddress, - maxFeePerEnergy: allowNull(index_js_3.getBigInt), - energyLimit: index_js_3.getBigInt, - to: allowNull(index_js_1.getAddress, null), - value: index_js_3.getBigInt, - nonce: index_js_3.getNumber, - data: formatData, - creates: allowNull(index_js_1.getAddress, null), - networkId: allowNull(index_js_3.getBigInt, null), - }, { - data: ["input"], - energyLimit: ["energy"], - })(value); - // If to and creates are empty, populate the creates from the value - if (result.to == null && result.creates == null) { - result.creates = (0, contract_address_js_1.getCreateAddress)(result); - } - // Compute the signature - if (value.signature) { - result.signature = value.signature; - } - else { - result.signature = value; - } - // Some backends omit networkId on legacy transactions, but we can compute it - if (result.networkId == null) { - const networkId = result.signature.legacynetworkId; - if (networkId != null) { - result.networkId = networkId; - } - } - // @TODO: check networkId - /* - if (value.networkId != null) { - let networkId = value.networkId; - - if (isHexString(networkId)) { - networkId = BigNumber.from(networkId).toNumber(); - } - - result.networkId = networkId; - - } else { - let networkId = value.networkId; - - // geth-etc returns networkId - if (networkId == null && result.v == null) { - networkId = value.networkId; - } - - if (isHexString(networkId)) { - networkId = BigNumber.from(networkId).toNumber(); - } - - if (typeof(networkId) !== "number" && result.v != null) { - networkId = (result.v - 35) / 2; - if (networkId < 0) { networkId = 0; } - networkId = parseInt(networkId); - } - - if (typeof(networkId) !== "number") { networkId = 0; } - - result.networkId = networkId; - } - */ - // 0x0000... should actually be null - if (result.blockHash && (0, index_js_3.getBigInt)(result.blockHash) === BN_0) { - result.blockHash = null; - } - return result; -} -exports.formatTransactionResponse = formatTransactionResponse; -//# sourceMappingURL=format.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/format.js.map b/lib.commonjs/providers/format.js.map deleted file mode 100644 index ee93c25ce..000000000 --- a/lib.commonjs/providers/format.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src.ts/providers/format.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,kDAAiD;AACjD,wEAAkE;AAClE,sDAAwD;AACxD,gDAQ2B;AAS3B,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAIvB,SAAgB,SAAS,CAAC,MAAkB,EAAE,SAAe;IAC3D,OAAO,UAAU,KAAU;QACzB,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC;AAPD,8BAOC;AAED,SAAgB,OAAO,CAAC,MAAkB;IACxC,OAAO,CAAC,KAAU,EAAE,EAAE;QACpB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACzB,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;SACjC;QACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC;AACJ,CAAC;AAPD,0BAOC;AAED,+DAA+D;AAC/D,kEAAkE;AAClE,iDAAiD;AACjD,SAAgB,MAAM,CACpB,MAAkC,EAClC,QAAwC;IAExC,OAAO,CAAC,KAAU,EAAE,EAAE;QACpB,MAAM,MAAM,GAAQ,EAAE,CAAC;QACvB,KAAK,MAAM,GAAG,IAAI,MAAM,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;;;;;;;;;;;;;;;QAgCI;IAEJ,oCAAoC;IACpC,IAAI,MAAM,CAAC,SAAS,IAAI,IAAA,oBAAS,EAAC,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QAC5D,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC;KACzB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AA5GD,8DA4GC"} \ No newline at end of file diff --git a/lib.commonjs/providers/formatting.d.ts b/lib.commonjs/providers/formatting.d.ts deleted file mode 100644 index 82736fe7c..000000000 --- a/lib.commonjs/providers/formatting.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * About provider formatting? - * - * @_section: api/providers/formatting:Formatting [provider-formatting] - */ -export interface BlockParams { - hash?: null | string; - number: number; - timestamp: number; - parentHash: string; - nonce: string; - difficulty: bigint; - energyLimit: bigint; - energyUsed: bigint; - miner: string; - extraData: string; - baseFeePerEnergy: null | bigint; - transactions: ReadonlyArray; -} -export interface LogParams { - transactionHash: string; - blockHash: string; - blockNumber: number; - removed: boolean; - address: string; - data: string; - topics: ReadonlyArray; - index: number; - transactionIndex: number; -} -export interface TransactionReceiptParams { - to: null | string; - from: string; - contractAddress: null | string; - hash: string; - index: number; - blockHash: string; - blockNumber: number; - logsBloom: string; - logs: ReadonlyArray; - energyUsed: bigint; - cumulativeEnergyUsed: bigint; - energyPrice?: null | bigint; - effectiveEnergyPrice?: null | bigint; - type: number; - status: null | number; - root: null | string; -} -export interface TransactionResponseParams { - blockNumber: null | number; - blockHash: null | string; - hash: string; - index: number; - type: number; - to: null | string; - from: string; - nonce: number; - energyLimit: bigint; - energyPrice: bigint; - data: string; - value: bigint; - networkId: bigint; - signature: string; -} -//# sourceMappingURL=formatting.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/formatting.d.ts.map b/lib.commonjs/providers/formatting.d.ts.map deleted file mode 100644 index 65b377ed3..000000000 --- a/lib.commonjs/providers/formatting.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"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AM,CAAC;IACnB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErC,IAAI,EAAE,MAAM,CAAC;IAEb,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;IACtB,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;CACrB;AAmBD,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,IAAI,GAAG,MAAM,CAAC;IAC3B,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;IAEzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,MAAM,CAAC;IAEb,EAAE,EAAE,IAAI,GAAG,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,EAAE,MAAM,CAAC;IAEd,WAAW,EAAE,MAAM,CAAC;IAEpB,WAAW,EAAE,MAAM,CAAC;IAEpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,MAAM,CAAC;CACnB"} \ No newline at end of file diff --git a/lib.commonjs/providers/formatting.js b/lib.commonjs/providers/formatting.js deleted file mode 100644 index e8f629d94..000000000 --- a/lib.commonjs/providers/formatting.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -/** - * About provider formatting? - * - * @_section: api/providers/formatting:Formatting [provider-formatting] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=formatting.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/formatting.js.map b/lib.commonjs/providers/formatting.js.map deleted file mode 100644 index 4eb88d886..000000000 --- a/lib.commonjs/providers/formatting.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"formatting.js","sourceRoot":"","sources":["../../src.ts/providers/formatting.ts"],"names":[],"mappings":";AAAA;;;;GAIG"} \ No newline at end of file diff --git a/lib.commonjs/providers/index.d.ts b/lib.commonjs/providers/index.d.ts deleted file mode 100644 index 7e80c01e9..000000000 --- a/lib.commonjs/providers/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * About providers. - * - * @_section: api/providers:Providers [about-providers] - */ -export { AbstractProvider, UnmanagedSubscriber } from "./abstract-provider.js"; -export { AbstractSigner, VoidSigner } from "./abstract-signer.js"; -export { showThrottleMessage } from "./community.js"; -export { getDefaultProvider } from "./default-provider.js"; -export { Network } from "./network.js"; -export { NonceManager } from "./signer-noncemanager.js"; -export { NetworkPlugin, EnergyCostPlugin, FeeDataNetworkPlugin, } from "./plugins-network.js"; -export { Block, FeeData, Log, TransactionReceipt, TransactionResponse, copyRequest, } from "./provider.js"; -export { FallbackProvider } from "./provider-fallback.js"; -export { JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, } from "./provider-jsonrpc.js"; -export { BrowserProvider } from "./provider-browser.js"; -export { AlchemyProvider } from "./provider-alchemy.js"; -export { AnkrProvider } from "./provider-ankr.js"; -export { CloudflareProvider } from "./provider-cloudflare.js"; -export { InfuraProvider, InfuraWebSocketProvider } from "./provider-infura.js"; -export { PocketProvider } from "./provider-pocket.js"; -export { QuickNodeProvider } from "./provider-quicknode.js"; -import { IpcSocketProvider } from "./provider-ipcsocket.js"; -export { IpcSocketProvider }; -export { SocketProvider } from "./provider-socket.js"; -export { WebSocketProvider } from "./provider-websocket.js"; -export { SocketSubscriber, SocketBlockSubscriber, SocketPendingSubscriber, SocketEventSubscriber, } from "./provider-socket.js"; -export type { Subscription, Subscriber, AbstractProviderPlugin, PerformActionFilter, PerformActionTransaction, PerformActionRequest, } from "./abstract-provider.js"; -export type { ContractRunner } from "./contracts.js"; -export type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams, } from "./formatting.js"; -export type { Networkish } from "./network.js"; -export type { EnergyCostParameters } from "./plugins-network.js"; -export type { BlockTag, TransactionRequest, PreparedTransactionRequest, EventFilter, Filter, FilterByBlockHash, OrphanFilter, ProviderEvent, TopicFilter, Provider, MinedBlock, MinedTransactionResponse, } from "./provider.js"; -export type { DebugEventBrowserProvider, Eip1193Provider, } from "./provider-browser.js"; -export type { JsonRpcPayload, JsonRpcResult, JsonRpcError, JsonRpcApiProviderOptions, JsonRpcTransactionRequest, } from "./provider-jsonrpc.js"; -export type { WebSocketCreator, WebSocketLike } from "./provider-websocket.js"; -export type { Signer } from "./signer.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/index.d.ts.map b/lib.commonjs/providers/index.d.ts.map deleted file mode 100644 index 206142646..000000000 --- a/lib.commonjs/providers/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/providers/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,KAAK,EACL,OAAO,EACP,GAAG,EACH,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,GAEZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,eAAe,E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GAChB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE/E,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/providers/index.js b/lib.commonjs/providers/index.js deleted file mode 100644 index 739152e2e..000000000 --- a/lib.commonjs/providers/index.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -/** - * About providers. - * - * @_section: api/providers:Providers [about-providers] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SocketEventSubscriber = exports.SocketPendingSubscriber = exports.SocketBlockSubscriber = exports.SocketSubscriber = exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.QuickNodeProvider = exports.PocketProvider = exports.InfuraWebSocketProvider = exports.InfuraProvider = exports.CloudflareProvider = exports.AnkrProvider = exports.AlchemyProvider = exports.BrowserProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.copyRequest = exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.FeeData = exports.Block = exports.FeeDataNetworkPlugin = exports.EnergyCostPlugin = exports.NetworkPlugin = exports.NonceManager = exports.Network = exports.getDefaultProvider = exports.showThrottleMessage = exports.VoidSigner = exports.AbstractSigner = exports.UnmanagedSubscriber = exports.AbstractProvider = void 0; -var abstract_provider_js_1 = require("./abstract-provider.js"); -Object.defineProperty(exports, "AbstractProvider", { enumerable: true, get: function () { return abstract_provider_js_1.AbstractProvider; } }); -Object.defineProperty(exports, "UnmanagedSubscriber", { enumerable: true, get: function () { return abstract_provider_js_1.UnmanagedSubscriber; } }); -var abstract_signer_js_1 = require("./abstract-signer.js"); -Object.defineProperty(exports, "AbstractSigner", { enumerable: true, get: function () { return abstract_signer_js_1.AbstractSigner; } }); -Object.defineProperty(exports, "VoidSigner", { enumerable: true, get: function () { return abstract_signer_js_1.VoidSigner; } }); -var community_js_1 = require("./community.js"); -Object.defineProperty(exports, "showThrottleMessage", { enumerable: true, get: function () { return community_js_1.showThrottleMessage; } }); -var default_provider_js_1 = require("./default-provider.js"); -Object.defineProperty(exports, "getDefaultProvider", { enumerable: true, get: function () { return default_provider_js_1.getDefaultProvider; } }); -var network_js_1 = require("./network.js"); -Object.defineProperty(exports, "Network", { enumerable: true, get: function () { return network_js_1.Network; } }); -var signer_noncemanager_js_1 = require("./signer-noncemanager.js"); -Object.defineProperty(exports, "NonceManager", { enumerable: true, get: function () { return signer_noncemanager_js_1.NonceManager; } }); -var plugins_network_js_1 = require("./plugins-network.js"); -Object.defineProperty(exports, "NetworkPlugin", { enumerable: true, get: function () { return plugins_network_js_1.NetworkPlugin; } }); -Object.defineProperty(exports, "EnergyCostPlugin", { enumerable: true, get: function () { return plugins_network_js_1.EnergyCostPlugin; } }); -Object.defineProperty(exports, "FeeDataNetworkPlugin", { enumerable: true, get: function () { return plugins_network_js_1.FeeDataNetworkPlugin; } }); -var provider_js_1 = require("./provider.js"); -Object.defineProperty(exports, "Block", { enumerable: true, get: function () { return provider_js_1.Block; } }); -Object.defineProperty(exports, "FeeData", { enumerable: true, get: function () { return provider_js_1.FeeData; } }); -Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return provider_js_1.Log; } }); -Object.defineProperty(exports, "TransactionReceipt", { enumerable: true, get: function () { return provider_js_1.TransactionReceipt; } }); -Object.defineProperty(exports, "TransactionResponse", { enumerable: true, get: function () { return provider_js_1.TransactionResponse; } }); -Object.defineProperty(exports, "copyRequest", { enumerable: true, get: function () { return provider_js_1.copyRequest; } }); -var provider_fallback_js_1 = require("./provider-fallback.js"); -Object.defineProperty(exports, "FallbackProvider", { enumerable: true, get: function () { return provider_fallback_js_1.FallbackProvider; } }); -var provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); -Object.defineProperty(exports, "JsonRpcApiProvider", { enumerable: true, get: function () { return provider_jsonrpc_js_1.JsonRpcApiProvider; } }); -Object.defineProperty(exports, "JsonRpcProvider", { enumerable: true, get: function () { return provider_jsonrpc_js_1.JsonRpcProvider; } }); -Object.defineProperty(exports, "JsonRpcSigner", { enumerable: true, get: function () { return provider_jsonrpc_js_1.JsonRpcSigner; } }); -var provider_browser_js_1 = require("./provider-browser.js"); -Object.defineProperty(exports, "BrowserProvider", { enumerable: true, get: function () { return provider_browser_js_1.BrowserProvider; } }); -var provider_alchemy_js_1 = require("./provider-alchemy.js"); -Object.defineProperty(exports, "AlchemyProvider", { enumerable: true, get: function () { return provider_alchemy_js_1.AlchemyProvider; } }); -var provider_ankr_js_1 = require("./provider-ankr.js"); -Object.defineProperty(exports, "AnkrProvider", { enumerable: true, get: function () { return provider_ankr_js_1.AnkrProvider; } }); -var provider_cloudflare_js_1 = require("./provider-cloudflare.js"); -Object.defineProperty(exports, "CloudflareProvider", { enumerable: true, get: function () { return provider_cloudflare_js_1.CloudflareProvider; } }); -var provider_infura_js_1 = require("./provider-infura.js"); -Object.defineProperty(exports, "InfuraProvider", { enumerable: true, get: function () { return provider_infura_js_1.InfuraProvider; } }); -Object.defineProperty(exports, "InfuraWebSocketProvider", { enumerable: true, get: function () { return provider_infura_js_1.InfuraWebSocketProvider; } }); -var provider_pocket_js_1 = require("./provider-pocket.js"); -Object.defineProperty(exports, "PocketProvider", { enumerable: true, get: function () { return provider_pocket_js_1.PocketProvider; } }); -var provider_quicknode_js_1 = require("./provider-quicknode.js"); -Object.defineProperty(exports, "QuickNodeProvider", { enumerable: true, get: function () { return provider_quicknode_js_1.QuickNodeProvider; } }); -const provider_ipcsocket_js_1 = require("./provider-ipcsocket.js"); /*-browser*/ -Object.defineProperty(exports, "IpcSocketProvider", { enumerable: true, get: function () { return provider_ipcsocket_js_1.IpcSocketProvider; } }); -var provider_socket_js_1 = require("./provider-socket.js"); -Object.defineProperty(exports, "SocketProvider", { enumerable: true, get: function () { return provider_socket_js_1.SocketProvider; } }); -var provider_websocket_js_1 = require("./provider-websocket.js"); -Object.defineProperty(exports, "WebSocketProvider", { enumerable: true, get: function () { return provider_websocket_js_1.WebSocketProvider; } }); -var provider_socket_js_2 = require("./provider-socket.js"); -Object.defineProperty(exports, "SocketSubscriber", { enumerable: true, get: function () { return provider_socket_js_2.SocketSubscriber; } }); -Object.defineProperty(exports, "SocketBlockSubscriber", { enumerable: true, get: function () { return provider_socket_js_2.SocketBlockSubscriber; } }); -Object.defineProperty(exports, "SocketPendingSubscriber", { enumerable: true, get: function () { return provider_socket_js_2.SocketPendingSubscriber; } }); -Object.defineProperty(exports, "SocketEventSubscriber", { enumerable: true, get: function () { return provider_socket_js_2.SocketEventSubscriber; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/index.js.map b/lib.commonjs/providers/index.js.map deleted file mode 100644 index f87938ea5..000000000 --- a/lib.commonjs/providers/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/providers/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,+DAA+E;AAAtE,wHAAA,gBAAgB,OAAA;AAAE,2HAAA,mBAAmB,OAAA;AAE9C,2DAAkE;AAAzD,oHAAA,cAAc,OAAA;AAAE,gHAAA,UAAU,OAAA;AAEnC,+CAAqD;AAA5C,mHAAA,mBAAmB,OAAA;AAE5B,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA;AAE3B,2CAAuC;AAA9B,qGAAA,OAAO,OAAA;AAEhB,mEAAwD;AAA/C,sHAAA,YAAY,OAAA;AAErB,2DAI8B;AAH5B,mHAAA,aAAa,OAAA;AACb,sHAAA,gBAAgB,OAAA;AAChB,0HAAA,oBAAoB,OAAA;AAGtB,6CAQuB;AAPrB,oGAAA,KAAK,OAAA;AACL,sGAAA,OAAO,OAAA;AACP,kGAAA,GAAG,OAAA;AACH,iHAAA,kBAAkB,OAAA;AAClB,kHAAA,mBAAmB,OAAA;AACnB,0GAAA,WAAW,OAAA;AAIb,+DAA0D;AAAjD,wHAAA,gBAAgB,OAAA;AACzB,6DAI+B;AAH7B,yHAAA,kBAAkB,OAAA;AAClB,sHAAA,eAAe,OAAA;AACf,oHAAA,aAAa,OAAA;AAGf,6DAAwD;AAA/C,sHAAA,eAAe,OAAA;AAExB,6DAAwD;AAA/C,sHAAA,eAAe,OAAA;AACxB,uDAAkD;AAAzC,gHAAA,YAAY,OAAA;AACrB,mEAA8D;AAArD,4HAAA,kBAAkB,OAAA;AAC3B,2DAA+E;AAAtE,oHAAA,cAAc,OAAA;AAAE,6HAAA,uBAAuB,OAAA;AAChD,2DAAsD;AAA7C,oHAAA,cAAc,OAAA;AACvB,iEAA4D;AAAnD,0HAAA,iBAAiB,OAAA;AAE1B,mEAA4D,CAAC,YAAY;AAChE,kGADA,yCAAiB,OACA;AAC1B,2DAAsD;AAA7C,oHAAA,cAAc,OAAA;AACvB,iEAA4D;AAAnD,0HAAA,iBAAiB,OAAA;AAE1B,2DAK8B;AAJ5B,sHAAA,gBAAgB,OAAA;AAChB,2HAAA,qBAAqB,OAAA;AACrB,6HAAA,uBAAuB,OAAA;AACvB,2HAAA,qBAAqB,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/providers/network.d.ts b/lib.commonjs/providers/network.d.ts deleted file mode 100644 index eb935dd8b..000000000 --- a/lib.commonjs/providers/network.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -import type { BigNumberish } from "../utils/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { NetworkPlugin } from "./plugins-network.js"; -/** - * A Networkish can be used to allude to a Network, by specifing: - * - a [[Network]] object - * - a well-known (or registered) network name - * - a well-known (or registered) chain ID - * - an object with sufficient details to describe a network - */ -export type Networkish = Network | number | bigint | string | { - name?: string; - networkId?: number; - ensAddress?: string; - ensNetwork?: number; -}; -export declare class Network { - #private; - constructor(name: string, networkId: BigNumberish); - toJSON(): any; - /** - * The network common name. - * - * This is the canonical name, as networks migh have multiple - * names. - */ - get name(): string; - set name(value: string); - /** - * The network chain ID. - */ - get networkId(): bigint; - set networkId(value: BigNumberish); - /** - * Returns true if %%other%% matches this network. Any chain ID - * must match, and if no chain ID is present, the name must match. - * - * This method does not currently check for additional properties, - * such as ENS address or plug-in compatibility. - */ - matches(other: Networkish): boolean; - /** - * Returns the list of plugins currently attached to this Network. - */ - get plugins(): Array; - /** - * Attach a new %%plugin%% to this Network. The network name - * must be unique, excluding any fragment. - */ - attachPlugin(plugin: NetworkPlugin): this; - /** - * Return the plugin, if any, matching %%name%% exactly. Plugins - * with fragments will not be returned unless %%name%% includes - * a fragment. - */ - getPlugin(name: string): null | T; - /** - * Gets a list of all plugins that match %%name%%, with otr without - * a fragment. - */ - getPlugins(basename: string): Array; - /** - * Create a copy of this Network. - */ - clone(): Network; - /** - * Compute the intrinsic energy required for a transaction. - * - * A EnergyCostPlugin can be attached to override the default - * values. - */ - computeIntrinsicEnergy(tx: TransactionLike): number; - /** - * Returns a new Network for the %%network%% name or networkId. - */ - static from(network?: Networkish): Network; - /** - * Register %%nameOrnetworkId%% with a function which returns - * an instance of a Network representing that chain. - */ - static register(nameOrnetworkId: string | number | bigint, networkFunc: () => Network): void; -} -//# sourceMappingURL=network.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/network.d.ts.map b/lib.commonjs/providers/network.d.ts.map deleted file mode 100644 index a62904576..000000000 --- a/lib.commonjs/providers/network.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src.ts/providers/network.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,MAAM,UA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AI;CAeR"} \ No newline at end of file diff --git a/lib.commonjs/providers/network.js b/lib.commonjs/providers/network.js deleted file mode 100644 index c3a52c39e..000000000 --- a/lib.commonjs/providers/network.js +++ /dev/null @@ -1,253 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Network = void 0; -/** - * About networks - * - * @_subsection: api/providers:Networks [networks] - */ -const index_js_1 = require("../utils/index.js"); -const plugins_network_js_1 = require("./plugins-network.js"); -/* * * * -// Networks which operation against an L2 can use this plugin to -// specify how to access L1, for the purpose of resolving ENS, -// for example. -export class LayerOneConnectionPlugin extends NetworkPlugin { - readonly provider!: Provider; -*/ -// Networks or clients with a higher need for security (such as clients -// that may automatically make CCIP requests without user interaction) -// can use this plugin to anonymize requests or intercept CCIP requests -// to notify and/or receive authorization from the user -const Networks = new Map(); -class Network { - #name; - #networkId; - #plugins; - constructor(name, networkId) { - this.#name = name; - this.#networkId = (0, index_js_1.getBigInt)(networkId); - this.#plugins = new Map(); - } - toJSON() { - return { name: this.name, networkId: String(this.networkId) }; - } - /** - * The network common name. - * - * This is the canonical name, as networks migh have multiple - * names. - */ - get name() { - return this.#name; - } - set name(value) { - this.#name = value; - } - /** - * The network chain ID. - */ - get networkId() { - return this.#networkId; - } - set networkId(value) { - this.#networkId = (0, index_js_1.getBigInt)(value, "networkId"); - } - /** - * Returns true if %%other%% matches this network. Any chain ID - * must match, and if no chain ID is present, the name must match. - * - * This method does not currently check for additional properties, - * such as ENS address or plug-in compatibility. - */ - matches(other) { - if (other == null) { - return false; - } - if (typeof other === "string") { - try { - return this.networkId === (0, index_js_1.getBigInt)(other); - } - catch (error) { } - return this.name === other; - } - if (typeof other === "number" || typeof other === "bigint") { - try { - return this.networkId === (0, index_js_1.getBigInt)(other); - } - catch (error) { } - return false; - } - if (typeof other === "object") { - if (other.networkId != null) { - try { - return this.networkId === (0, index_js_1.getBigInt)(other.networkId); - } - catch (error) { } - return false; - } - if (other.name != null) { - return this.name === other.name; - } - return false; - } - return false; - } - /** - * Returns the list of plugins currently attached to this Network. - */ - get plugins() { - return Array.from(this.#plugins.values()); - } - /** - * Attach a new %%plugin%% to this Network. The network name - * must be unique, excluding any fragment. - */ - attachPlugin(plugin) { - if (this.#plugins.get(plugin.name)) { - throw new Error(`cannot replace existing plugin: ${plugin.name} `); - } - this.#plugins.set(plugin.name, plugin.clone()); - return this; - } - /** - * Return the plugin, if any, matching %%name%% exactly. Plugins - * with fragments will not be returned unless %%name%% includes - * a fragment. - */ - getPlugin(name) { - return this.#plugins.get(name) || null; - } - /** - * Gets a list of all plugins that match %%name%%, with otr without - * a fragment. - */ - getPlugins(basename) { - return (this.plugins.filter((p) => p.name.split("#")[0] === basename)); - } - /** - * Create a copy of this Network. - */ - clone() { - const clone = new Network(this.name, this.networkId); - this.plugins.forEach((plugin) => { - clone.attachPlugin(plugin.clone()); - }); - return clone; - } - /** - * Compute the intrinsic energy required for a transaction. - * - * A EnergyCostPlugin can be attached to override the default - * values. - */ - computeIntrinsicEnergy(tx) { - const costs = this.getPlugin("org.corebc.plugins.network.EnergyCost") || new plugins_network_js_1.EnergyCostPlugin(); - let energy = costs.txBase; - if (tx.to == null) { - energy += costs.txCreate; - } - if (tx.data) { - for (let i = 2; i < tx.data.length; i += 2) { - if (tx.data.substring(i, i + 2) === "00") { - energy += costs.txDataZero; - } - else { - energy += costs.txDataNonzero; - } - } - } - return energy; - } - /** - * Returns a new Network for the %%network%% name or networkId. - */ - static from(network) { - injectCommonNetworks(); - // Default network - if (network == null) { - return Network.from("mainnet"); - } - // Canonical name or chain ID - if (typeof network === "number") { - network = BigInt(network); - } - if (typeof network === "string" || typeof network === "bigint") { - const networkFunc = Networks.get(network); - if (networkFunc) { - return networkFunc(); - } - if (typeof network === "bigint") { - return new Network("unknown", network); - } - (0, index_js_1.assertArgument)(false, "unknown network", "network", network); - } - // Clonable with network-like abilities - if (typeof network.clone === "function") { - const clone = network.clone(); - //if (typeof(network.name) !== "string" || typeof(network.networkId) !== "number") { - //} - return clone; - } - // Networkish - if (typeof network === "object") { - (0, index_js_1.assertArgument)(typeof network.name === "string" && - typeof network.networkId === "number", "invalid network object name or networkId", "network", network); - const custom = new Network(network.name, network.networkId); - //if ((network).layerOneConnection) { - // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection)); - //} - return custom; - } - (0, index_js_1.assertArgument)(false, "invalid network", "network", network); - } - /** - * Register %%nameOrnetworkId%% with a function which returns - * an instance of a Network representing that chain. - */ - static register(nameOrnetworkId, networkFunc) { - if (typeof nameOrnetworkId === "number") { - nameOrnetworkId = BigInt(nameOrnetworkId); - } - const existing = Networks.get(nameOrnetworkId); - if (existing) { - (0, index_js_1.assertArgument)(false, `conflicting network for ${JSON.stringify(existing.name)}`, "nameOrnetworkId", nameOrnetworkId); - } - Networks.set(nameOrnetworkId, networkFunc); - } -} -exports.Network = Network; -// See: https://chainlist.org -let injected = false; -function injectCommonNetworks() { - if (injected) { - return; - } - injected = true; - /// Register popular Core networks - function registerEth(name, networkId, options) { - const func = function () { - const network = new Network(name, networkId); - network.attachPlugin(new plugins_network_js_1.EnergyCostPlugin()); - return network; - }; - // Register the network by name and chain ID - Network.register(name, func); - Network.register(networkId, func); - if (options.altNames) { - options.altNames.forEach((name) => { - Network.register(name, func); - }); - } - } - registerEth("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] }); - registerEth("ropsten", 3, { ensNetwork: 3 }); - registerEth("rinkeby", 4, { ensNetwork: 4 }); - registerEth("goerli", 5, { ensNetwork: 5 }); - registerEth("kovan", 42, { ensNetwork: 42 }); - registerEth("sepolia", 11155111, {}); - registerEth("classic", 61, {}); - registerEth("classicKotti", 6, {}); - registerEth("xdai", 100, { ensNetwork: 1 }); -} -//# sourceMappingURL=network.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/network.js.map b/lib.commonjs/providers/network.js.map deleted file mode 100644 index 9a4f7ceed..000000000 --- a/lib.commonjs/providers/network.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3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AI,EAAE,IAAI,CAAC,CAAC;QAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAElC,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBAChC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,WAAW,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACtE,WAAW,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;IAC7C,WAAW,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;IAC7C,WAAW,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;IAC5C,WAAW,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7C,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;IAErC,WAAW,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC/B,WAAW,CAAC,cAAc,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEnC,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;AAC9C,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/providers/pagination.d.ts b/lib.commonjs/providers/pagination.d.ts deleted file mode 100644 index a772a85c2..000000000 --- a/lib.commonjs/providers/pagination.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface PaginationResult extends Array { - next(): Promise>; - totalResults: null | number; - done: boolean; -} -//# sourceMappingURL=pagination.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/pagination.d.ts.map b/lib.commonjs/providers/pagination.d.ts.map deleted file mode 100644 index 5479c9c0a..000000000 --- a/lib.commonjs/providers/pagination.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src.ts/providers/pagination.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IACnD,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IAGrC,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC;IAE5B,IAAI,EAAE,OAAO,CAAC;CACf"} \ No newline at end of file diff --git a/lib.commonjs/providers/pagination.js b/lib.commonjs/providers/pagination.js deleted file mode 100644 index 7696f1a42..000000000 --- a/lib.commonjs/providers/pagination.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=pagination.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/pagination.js.map b/lib.commonjs/providers/pagination.js.map deleted file mode 100644 index d08e925cb..000000000 --- a/lib.commonjs/providers/pagination.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src.ts/providers/pagination.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.commonjs/providers/plugin-fallback.d.ts b/lib.commonjs/providers/plugin-fallback.d.ts deleted file mode 100644 index 10009e4b3..000000000 --- a/lib.commonjs/providers/plugin-fallback.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { AbstractProviderPlugin } from "./abstract-provider.js"; -import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; -export declare const PluginIdFallbackProvider = "org.corebc.plugins.provider.QualifiedPlugin"; -export declare class CheckQualifiedPlugin implements AbstractProviderPlugin { - name: string; - constructor(); - connect(provider: AbstractProvider): CheckQualifiedPlugin; - isQualified(action: PerformActionRequest, result: any): boolean; -} -export declare class PossiblyPrunedTransactionPlugin extends CheckQualifiedPlugin { - isQualified(action: PerformActionRequest, result: any): boolean; -} -//# sourceMappingURL=plugin-fallback.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/plugin-fallback.d.ts.map b/lib.commonjs/providers/plugin-fallback.d.ts.map deleted file mode 100644 index 6d2023762..000000000 --- a/lib.commonjs/providers/plugin-fallback.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugin-fallback.d.ts","sourceRoot":"","sources":["../../src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,wBAAwB,gDACU,CAAC;AAEhD,qBAAa,oBAAqB,YAAW,sBAAsB;IACzD,IAAI,EAAE,MAAM,CAAC;;IAQrB,OAAO,CAAC,QAAQ,EAAE,gBAAgB,GAAG,oBAAoB;IAMzD,WAAW,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;CAGhE;AAED,qBAAa,+BAAgC,SAAQ,oBAAoB;IACvE,WAAW,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;CAWhE"} \ No newline at end of file diff --git a/lib.commonjs/providers/plugin-fallback.js b/lib.commonjs/providers/plugin-fallback.js deleted file mode 100644 index bc707b885..000000000 --- a/lib.commonjs/providers/plugin-fallback.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PossiblyPrunedTransactionPlugin = exports.CheckQualifiedPlugin = exports.PluginIdFallbackProvider = void 0; -const index_js_1 = require("../utils/index.js"); -exports.PluginIdFallbackProvider = "org.corebc.plugins.provider.QualifiedPlugin"; -class CheckQualifiedPlugin { - constructor() { - (0, index_js_1.defineProperties)(this, { - name: exports.PluginIdFallbackProvider, - }); - } - connect(provider) { - return this; - } - // Retruns true if this value should be considered qualified for - // inclusion in the quorum. - isQualified(action, result) { - return true; - } -} -exports.CheckQualifiedPlugin = CheckQualifiedPlugin; -class PossiblyPrunedTransactionPlugin extends CheckQualifiedPlugin { - isQualified(action, result) { - if (action.method === "getTransaction" || - action.method === "getTransactionReceipt") { - if (result == null) { - return false; - } - } - return super.isQualified(action, result); - } -} -exports.PossiblyPrunedTransactionPlugin = PossiblyPrunedTransactionPlugin; -//# sourceMappingURL=plugin-fallback.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/plugin-fallback.js.map b/lib.commonjs/providers/plugin-fallback.js.map deleted file mode 100644 index 4112d5803..000000000 --- a/lib.commonjs/providers/plugin-fallback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugin-fallback.js","sourceRoot":"","sources":["../../src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":";;;AACA,gDAAqD;AAOxC,QAAA,wBAAwB,GACnC,6CAA6C,CAAC;AAEhD,MAAa,oBAAoB;IAG/B;QACE,IAAA,2BAAgB,EAAuB,IAAI,EAAE;YAC3C,IAAI,EAAE,gCAAwB;SAC/B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,QAA0B;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gEAAgE;IAChE,2BAA2B;IAC3B,WAAW,CAAC,MAA4B,EAAE,MAAW;QACnD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAlBD,oDAkBC;AAED,MAAa,+BAAgC,SAAQ,oBAAoB;IACvE,WAAW,CAAC,MAA4B,EAAE,MAAW;QACnD,IACE,MAAM,CAAC,MAAM,KAAK,gBAAgB;YAClC,MAAM,CAAC,MAAM,KAAK,uBAAuB,EACzC;YACA,IAAI,MAAM,IAAI,IAAI,EAAE;gBAClB,OAAO,KAAK,CAAC;aACd;SACF;QACD,OAAO,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;CACF;AAZD,0EAYC"} \ No newline at end of file diff --git a/lib.commonjs/providers/plugins-network.d.ts b/lib.commonjs/providers/plugins-network.d.ts deleted file mode 100644 index 80364b3ad..000000000 --- a/lib.commonjs/providers/plugins-network.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { FeeData, Provider } from "./provider.js"; -export declare class NetworkPlugin { - readonly name: string; - constructor(name: string); - clone(): NetworkPlugin; -} -export type EnergyCostParameters = { - txBase?: number; - txCreate?: number; - txDataZero?: number; - txDataNonzero?: number; - txAccessListStorageKey?: number; - txAccessListAddress?: number; -}; -export declare class EnergyCostPlugin extends NetworkPlugin implements EnergyCostParameters { - readonly effectiveBlock: number; - readonly txBase: number; - readonly txCreate: number; - readonly txDataZero: number; - readonly txDataNonzero: number; - readonly txAccessListStorageKey: number; - readonly txAccessListAddress: number; - constructor(effectiveBlock?: number, costs?: EnergyCostParameters); - clone(): EnergyCostPlugin; -} -export declare class FeeDataNetworkPlugin extends NetworkPlugin { - #private; - get feeDataFunc(): (provider: Provider) => Promise; - constructor(feeDataFunc: (provider: Provider) => Promise); - getFeeData(provider: Provider): Promise; - clone(): FeeDataNetworkPlugin; -} -//# sourceMappingURL=plugins-network.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/plugins-network.d.ts.map b/lib.commonjs/providers/plugins-network.d.ts.map deleted file mode 100644 index 7c9b9b3c7..000000000 --- a/lib.commonjs/providers/plugins-network.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugins-network.d.ts","sourceRoot":"","sources":["../../src.ts/providers/plugins-network.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACvD,qBAAa,aAAa;IACxB,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM;IAIxB,KAAK,IAAI,aAAa;CAOvB;AAKD,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,qBAAa,gBACX,SAAQ,aACR,YAAW,oBAAoB;IAE/B,QAAQ,CAAC,cAAc,EAAG,MAAM,CAAC;IAEjC,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAG,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAG,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,sBAAsB,EAAG,MAAM,CAAC;IACzC,QAAQ,CAAC,mBAAmB,EAAG,MAAM,CAAC;gBAE1B,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,oBAAoB;IA+BjE,KAAK,IAAI,gBAAgB;CAG1B;AAED,qBAAa,oBAAqB,SAAQ,aAAa;;IAGrD,IAAI,WAAW,IAAI,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,OAAO,CAAC,CAE1D;gBAEW,WAAW,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,OAAO,CAAC;IAK3D,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAItD,KAAK,IAAI,oBAAoB;CAG9B"} \ No newline at end of file diff --git a/lib.commonjs/providers/plugins-network.js b/lib.commonjs/providers/plugins-network.js deleted file mode 100644 index 3097e4f50..000000000 --- a/lib.commonjs/providers/plugins-network.js +++ /dev/null @@ -1,86 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FeeDataNetworkPlugin = exports.EnergyCostPlugin = exports.NetworkPlugin = void 0; -const properties_js_1 = require("../utils/properties.js"); -const index_js_1 = require("../utils/index.js"); -class NetworkPlugin { - name; - constructor(name) { - (0, properties_js_1.defineProperties)(this, { name }); - } - clone() { - return new NetworkPlugin(this.name); - } -} -exports.NetworkPlugin = NetworkPlugin; -class EnergyCostPlugin extends NetworkPlugin { - effectiveBlock; - txBase; - txCreate; - txDataZero; - txDataNonzero; - txAccessListStorageKey; - txAccessListAddress; - constructor(effectiveBlock, costs) { - if (effectiveBlock == null) { - effectiveBlock = 0; - } - super(`org.corebc.network.plugins.EnergyCost#${effectiveBlock || 0}`); - const props = { effectiveBlock }; - function set(name, nullish) { - let value = (costs || {})[name]; - if (value == null) { - value = nullish; - } - (0, index_js_1.assertArgument)(typeof value === "number", `invalud value for ${name}`, "costs", costs); - props[name] = value; - } - set("txBase", 21000); - set("txCreate", 32000); - set("txDataZero", 4); - set("txDataNonzero", 16); - set("txAccessListStorageKey", 1900); - set("txAccessListAddress", 2400); - (0, properties_js_1.defineProperties)(this, props); - } - clone() { - return new EnergyCostPlugin(this.effectiveBlock, this); - } -} -exports.EnergyCostPlugin = EnergyCostPlugin; -class FeeDataNetworkPlugin extends NetworkPlugin { - #feeDataFunc; - get feeDataFunc() { - return this.#feeDataFunc; - } - constructor(feeDataFunc) { - super("org.corebc.plugins.network.FeeData"); - this.#feeDataFunc = feeDataFunc; - } - async getFeeData(provider) { - return await this.#feeDataFunc(provider); - } - clone() { - return new FeeDataNetworkPlugin(this.#feeDataFunc); - } -} -exports.FeeDataNetworkPlugin = FeeDataNetworkPlugin; -/* -export class CustomBlockNetworkPlugin extends NetworkPlugin { - readonly #blockFunc: (provider: Provider, block: BlockParams) => Block; - readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block; - - async getBlock(provider: Provider, block: BlockParams): Promise> { - return await this.#blockFunc(provider, block); - } - - async getBlockions(provider: Provider, block: BlockParams): Promise> { - return await this.#blockWithTxsFunc(provider, block); - } - - clone(): CustomBlockNetworkPlugin { - return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc); - } -} -*/ -//# sourceMappingURL=plugins-network.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/plugins-network.js.map b/lib.commonjs/providers/plugins-network.js.map deleted file mode 100644 index 87a365b2e..000000000 --- a/lib.commonjs/providers/plugins-network.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugins-network.js","sourceRoot":"","sources":["../../src.ts/providers/plugins-network.ts"],"names":[],"mappings":";;;AAAA,0DAA0D;AAE1D,gDAAmD;AAGnD,MAAa,aAAa;IACf,IAAI,CAAU;IAEvB,YAAY,IAAY;QACtB,IAAA,gCAAgB,EAAgB,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,KAAK;QACH,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;CAKF;AAdD,sCAcC;AAcD,MAAa,gBACX,SAAQ,aAAa;IAGZ,cAAc,CAAU;IAExB,MAAM,CAAU;IAChB,QAAQ,CAAU;IAClB,UAAU,CAAU;IACpB,aAAa,CAAU;IACvB,sBAAsB,CAAU;IAChC,mBAAmB,CAAU;IAEtC,YAAY,cAAuB,EAAE,KAA4B;QAC/D,IAAI,cAAc,IAAI,IAAI,EAAE;YAC1B,cAAc,GAAG,CAAC,CAAC;SACpB;QACD,KAAK,CAAC,yCAAyC,cAAc,IAAI,CAAC,EAAE,CAAC,CAAC;QAEtE,MAAM,KAAK,GAA2B,EAAE,cAAc,EAAE,CAAC;QACzD,SAAS,GAAG,CAAC,IAAgC,EAAE,OAAe;YAC5D,IAAI,KAAK,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;YAChC,IAAI,KAAK,IAAI,IAAI,EAAE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provider-alchemy.d.ts deleted file mode 100644 index 17af0df46..000000000 --- a/lib.commonjs/providers/provider-alchemy.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * About Alchemy - * - * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] - */ -import { FetchRequest } from "../utils/index.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -/** - * The **AlchemyProvider** connects to the [[link-alchemy]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-alchemy-signup). - * - * @_docloc: api/providers/thirdparty - */ -export declare class AlchemyProvider extends JsonRpcProvider implements CommunityResourcable { - readonly apiKey: string; - constructor(_network?: Networkish, apiKey?: null | string); - _getProvider(networkId: number): AbstractProvider; - _perform(req: PerformActionRequest): Promise; - isCommunityResource(): boolean; - static getRequest(network: Network, apiKey?: string): FetchRequest; -} -//# sourceMappingURL=provider-alchemy.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-alchemy.d.ts.map b/lib.commonjs/providers/provider-alchemy.d.ts.map deleted file mode 100644 index f2eec176b..000000000 --- a/lib.commonjs/providers/provider-alchemy.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-alchemy.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-alchemy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAKL,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA8B/C;;;;;;;;;;GAUG;AACH,qBAAa,eACX,SAAQ,eACR,YAAW,oBAAoB;IAE/B,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;gBAEb,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAezD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAO3C,QAAQ,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IA2CvD,mBAAmB,IAAI,OAAO;IAI9B,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY;CAmBnE"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-alchemy.js b/lib.commonjs/providers/provider-alchemy.js deleted file mode 100644 index 45a21abf1..000000000 --- a/lib.commonjs/providers/provider-alchemy.js +++ /dev/null @@ -1,122 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AlchemyProvider = void 0; -/** - * About Alchemy - * - * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] - */ -const index_js_1 = require("../utils/index.js"); -const community_js_1 = require("./community.js"); -const network_js_1 = require("./network.js"); -const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); -const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; -function getHost(name) { - switch (name) { - case "mainnet": - return "eth-mainnet.alchemyapi.io"; - case "goerli": - return "eth-goerli.g.alchemy.com"; - case "sepolia": - return "eth-sepolia.g.alchemy.com"; - case "arbitrum": - return "arb-mainnet.g.alchemy.com"; - case "arbitrum-goerli": - return "arb-goerli.g.alchemy.com"; - case "matic": - return "polygon-mainnet.g.alchemy.com"; - case "matic-mumbai": - return "polygon-mumbai.g.alchemy.com"; - case "optimism": - return "opt-mainnet.g.alchemy.com"; - case "optimism-goerli": - return "opt-goerli.g.alchemy.com"; - } - (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); -} -/** - * The **AlchemyProvider** connects to the [[link-alchemy]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-alchemy-signup). - * - * @_docloc: api/providers/thirdparty - */ -class AlchemyProvider extends provider_jsonrpc_js_1.JsonRpcProvider { - apiKey; - constructor(_network, apiKey) { - if (_network == null) { - _network = "mainnet"; - } - const network = network_js_1.Network.from(_network); - if (apiKey == null) { - apiKey = defaultApiKey; - } - const request = AlchemyProvider.getRequest(network, apiKey); - super(request, network, { staticNetwork: network }); - (0, index_js_1.defineProperties)(this, { apiKey }); - } - _getProvider(networkId) { - try { - return new AlchemyProvider(networkId, this.apiKey); - } - catch (error) { } - return super._getProvider(networkId); - } - async _perform(req) { - // https://docs.alchemy.com/reference/trace-transaction - if (req.method === "getTransactionResult") { - const { trace, tx } = await (0, index_js_1.resolveProperties)({ - trace: this.send("trace_transaction", [req.hash]), - tx: this.getTransaction(req.hash), - }); - if (trace == null || tx == null) { - return null; - } - let data; - let error = false; - try { - data = trace[0].result.output; - error = trace[0].error === "Reverted"; - } - catch (error) { } - if (data) { - (0, index_js_1.assert)(!error, "an error occurred during transaction executions", "CALL_EXCEPTION", { - action: "getTransactionResult", - data, - reason: null, - transaction: tx, - invocation: null, - revert: null, // @TODO - }); - return data; - } - (0, index_js_1.assert)(false, "could not parse trace result", "BAD_DATA", { - value: trace, - }); - } - return await super._perform(req); - } - isCommunityResource() { - return this.apiKey === defaultApiKey; - } - static getRequest(network, apiKey) { - if (apiKey == null) { - apiKey = defaultApiKey; - } - const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/v2/${apiKey}`); - request.allowGzip = true; - if (apiKey === defaultApiKey) { - request.retryFunc = async (request, response, attempt) => { - (0, community_js_1.showThrottleMessage)("alchemy"); - return true; - }; - } - return request; - } -} -exports.AlchemyProvider = AlchemyProvider; -//# sourceMappingURL=provider-alchemy.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-alchemy.js.map b/lib.commonjs/providers/provider-alchemy.js.map deleted file mode 100644 index 30555b7a9..000000000 --- a/lib.commonjs/providers/provider-alchemy.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-alchemy.js","sourceRoot":"","sources":["../../src.ts/providers/provider-alchemy.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,gDAM2B;AAE3B,iDAAqD;AACrD,6CAAuC;AACvC,+DAAwD;AASxD,MAAM,aAAa,GAAG,kCAAkC,CAAC;AAEzD,SAAS,OAAO,CAAC,IAAY;IAC3B,QAAQ,IAAI,EAAE;QACZ,KAAK,SAAS;YACZ,OAAO,2BAA2B,CAAC;QACrC,KAAK,QAAQ;YACX,OAAO,0BAA0B,CAAC;QACpC,KAAK,SAAS;YACZ,OAAO,2BAA2B,CAAC;QAErC,KAAK,UAAU;YACb,OAAO,2BAA2B,CAAC;QACrC,KAAK,iBAAiB;YACpB,OAAO,0BAA0B,CAAC;QACpC,KAAK,OAAO;YACV,OAAO,+BAA+B,CAAC;QACzC,KAAK,cAAc;YACjB,OAAO,8BAA8B,CAAC;QACxC,KAAK,UAAU;YACb,OAAO,2BAA2B,CAAC;QACrC,KAAK,iBAAiB;YACpB,OAAO,0BAA0B,CAAC;KACrC;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAa,eACX,SAAQ,qCAAe;IAGd,MAAM,CAAU;IAEzB,YAAY,QAAqB,EAAE,MAAsB;QACvD,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,SAAS,CAAC;SACtB;QACD,MAAM,OAAO,GAAG,oBAAO,CAAC,IAA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AC,OAAO,KAAK,EAAE,GAAE;YAElB,IAAI,IAAI,EAAE;gBACR,IAAA,iBAAM,EACJ,CAAC,KAAK,EACN,iDAAiD,EACjD,gBAAgB,EAChB;oBACE,MAAM,EAAE,sBAAsB;oBAC9B,IAAI;oBACJ,MAAM,EAAE,IAAI;oBACZ,WAAW,EAAE,EAAE;oBACf,UAAU,EAAE,IAAI;oBAChB,MAAM,EAAE,IAAI,EAAE,QAAQ;iBACvB,CACF,CAAC;gBACF,OAAO,IAAI,CAAC;aACb;YAED,IAAA,iBAAM,EAAC,KAAK,EAAE,8BAA8B,EAAE,UAAU,EAAE;gBACxD,KAAK,EAAE,KAAK;aACb,CAAC,CAAC;SACJ;QAED,OAAO,MAAM,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,mBAAmB;QACjB,OAAO,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,OAAgB,EAAE,MAAe;QACjD,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,MAAM,GAAG,aAAa,CAAC;SACxB;QAED,MAAM,OAAO,GAAG,IAAI,uBAAY,CAC9B,YAAY,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,MAAM,EAAE,CACjD,CAAC;QACF,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QAEzB,IAAI,MAAM,KAAK,aAAa,EAAE;YAC5B,OAAO,CAAC,SAAS,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACvD,IAAA,kCAAmB,EAAC,SAAS,CAAC,CAAC;gBAC/B,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;SACH;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA9FD,0CA8FC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-ankr.d.ts b/lib.commonjs/providers/provider-ankr.d.ts deleted file mode 100644 index 77af5a3a0..000000000 --- a/lib.commonjs/providers/provider-ankr.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * [[link-ankr]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Polygon (``matic``) - * - Arbitrum (``arbitrum``) - * - * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] - */ -import { FetchRequest } from "../utils/index.js"; -import { AbstractProvider } from "./abstract-provider.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -import type { JsonRpcError, JsonRpcPayload } from "./provider-jsonrpc.js"; -/** - * The **AnkrProvider** connects to the [[link-ankr]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-ankr-signup). - */ -export declare class AnkrProvider extends JsonRpcProvider implements CommunityResourcable { - /** - * The API key for the Ankr connection. - */ - readonly apiKey: string; - /** - * Create a new **AnkrProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network?: Networkish, apiKey?: null | string); - _getProvider(networkId: number): AbstractProvider; - /** - * Returns a prepared request for connecting to %%network%% with - * %%apiKey%%. - */ - static getRequest(network: Network, apiKey?: null | string): FetchRequest; - getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error; - isCommunityResource(): boolean; -} -//# sourceMappingURL=provider-ankr.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-ankr.d.ts.map b/lib.commonjs/providers/provider-ankr.d.ts.map deleted file mode 100644 index 45cfc5423..000000000 --- a/lib.commonjs/providers/provider-ankr.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ankr.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ankr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAoB1E;;;;;;;;GAQG;AACH,qBAAa,YACX,SAAQ,eACR,YAAW,oBAAoB;IAE/B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAEzB;;;;;OAKG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAkBzD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAOjD;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;IAoBzE,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,GAAG,KAAK;IAchE,mBAAmB,IAAI,OAAO;CAG/B"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-ankr.js b/lib.commonjs/providers/provider-ankr.js deleted file mode 100644 index 563b9ea65..000000000 --- a/lib.commonjs/providers/provider-ankr.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AnkrProvider = void 0; -/** - * [[link-ankr]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Polygon (``matic``) - * - Arbitrum (``arbitrum``) - * - * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] - */ -const index_js_1 = require("../utils/index.js"); -const community_js_1 = require("./community.js"); -const network_js_1 = require("./network.js"); -const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); -const defaultApiKey = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; -function getHost(name) { - switch (name) { - case "mainnet": - return "rpc.ankr.com/eth"; - case "goerli": - return "rpc.ankr.com/xcb_goerli"; - case "matic": - return "rpc.ankr.com/polygon"; - case "arbitrum": - return "rpc.ankr.com/arbitrum"; - } - (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); -} -/** - * The **AnkrProvider** connects to the [[link-ankr]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-ankr-signup). - */ -class AnkrProvider extends provider_jsonrpc_js_1.JsonRpcProvider { - /** - * The API key for the Ankr connection. - */ - apiKey; - /** - * Create a new **AnkrProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network, apiKey) { - if (_network == null) { - _network = "mainnet"; - } - const network = network_js_1.Network.from(_network); - if (apiKey == null) { - apiKey = defaultApiKey; - } - // Ankr does not support filterId, so we force polling - const options = { polling: true, staticNetwork: network }; - const request = AnkrProvider.getRequest(network, apiKey); - super(request, network, options); - (0, index_js_1.defineProperties)(this, { apiKey }); - } - _getProvider(networkId) { - try { - return new AnkrProvider(networkId, this.apiKey); - } - catch (error) { } - return super._getProvider(networkId); - } - /** - * Returns a prepared request for connecting to %%network%% with - * %%apiKey%%. - */ - static getRequest(network, apiKey) { - if (apiKey == null) { - apiKey = defaultApiKey; - } - const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/${apiKey}`); - request.allowGzip = true; - if (apiKey === defaultApiKey) { - request.retryFunc = async (request, response, attempt) => { - (0, community_js_1.showThrottleMessage)("AnkrProvider"); - return true; - }; - } - return request; - } - getRpcError(payload, error) { - if (payload.method === "xcb_sendRawTransaction") { - if (error && - error.error && - error.error.message === "INTERNAL_ERROR: could not replace existing tx") { - error.error.message = "replacement transaction underpriced"; - } - } - return super.getRpcError(payload, error); - } - isCommunityResource() { - return this.apiKey === defaultApiKey; - } -} -exports.AnkrProvider = AnkrProvider; -//# sourceMappingURL=provider-ankr.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-ankr.js.map b/lib.commonjs/providers/provider-ankr.js.map deleted file mode 100644 index 8e0719c0a..000000000 --- a/lib.commonjs/providers/provider-ankr.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ankr.js","sourceRoot":"","sources":["../../src.ts/providers/provider-ankr.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,gDAI2B;AAG3B,iDAAqD;AACrD,6CAAuC;AACvC,+DAAwD;AAMxD,MAAM,aAAa,GACjB,kEAAkE,CAAC;AAErE,SAAS,OAAO,CAAC,IAAY;IAC3B,QAAQ,IAAI,EAAE;QACZ,KAAK,SAAS;YACZ,OAAO,kBAAkB,CAAC;QAC5B,KAAK,QAAQ;YACX,OAAO,yBAAyB,CAAC;QACnC,KAAK,OAAO;YACV,OAAO,sBAAsB,CAAC;QAChC,KAAK,UAAU;YACb,OAAO,uBAAuB,CAAC;KAClC;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAa,YACX,SAAQ,qCAAe;IAGvB;;OAEG;IACM,MAAM,CAAU;IAEzB;;;;;OAKG;IACH,YAAY,QAAqB,EAAE,MAAsB;QACvD,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,SAAS,CAAC;SACtB;QACD,MAAM,OAAO,GAAG,oBAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,MAAM,IAAI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L,KAAK,CAAC,KAAK;gBACX,KAAK,CAAC,KAAK,CAAC,OAAO,KAAK,+CAA+C,EACvE;gBACA,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,qCAAqC,CAAC;aAC7D;SACF;QAED,OAAO,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,mBAAmB;QACjB,OAAO,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC;IACvC,CAAC;CACF;AAjFD,oCAiFC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-browser.d.ts b/lib.commonjs/providers/provider-browser.d.ts deleted file mode 100644 index 2e917663a..000000000 --- a/lib.commonjs/providers/provider-browser.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { JsonRpcApiPollingProvider } from "./provider-jsonrpc.js"; -import type { JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcSigner } from "./provider-jsonrpc.js"; -import type { Networkish } from "./network.js"; -export interface Eip1193Provider { - request(request: { - method: string; - params?: Array | Record; - }): Promise; -} -export type DebugEventBrowserProvider = { - action: "sendEip1193Payload"; - payload: { - method: string; - params: Array; - }; -} | { - action: "receiveEip1193Result"; - result: any; -} | { - action: "receiveEip1193Error"; - error: Error; -}; -export declare class BrowserProvider extends JsonRpcApiPollingProvider { - #private; - constructor(core: Eip1193Provider, network?: Networkish); - send(method: string, params: Array | Record): Promise; - _send(payload: JsonRpcPayload | Array): Promise>; - getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error; - hasSigner(address: number | string): Promise; - getSigner(address?: number | string): Promise; -} -//# sourceMappingURL=provider-browser.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-browser.d.ts.map b/lib.commonjs/providers/provider-browser.d.ts.map deleted file mode 100644 index cf224c60e..000000000 --- a/lib.commonjs/providers/provider-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider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AAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBrD,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAkBnE"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-browser.js b/lib.commonjs/providers/provider-browser.js deleted file mode 100644 index 696d96d90..000000000 --- a/lib.commonjs/providers/provider-browser.js +++ /dev/null @@ -1,91 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BrowserProvider = void 0; -const index_js_1 = require("../utils/index.js"); -const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); -class BrowserProvider extends provider_jsonrpc_js_1.JsonRpcApiPollingProvider { - #request; - constructor(core, network) { - super(network, { batchMaxCount: 1 }); - this.#request = async (method, params) => { - const payload = { method, params }; - this.emit("debug", { action: "sendEip1193Request", payload }); - try { - const result = await core.request(payload); - this.emit("debug", { action: "receiveEip1193Result", result }); - return result; - } - catch (e) { - const error = new Error(e.message); - error.code = e.code; - error.data = e.data; - error.payload = payload; - this.emit("debug", { action: "receiveEip1193Error", error }); - throw error; - } - }; - } - async send(method, params) { - await this._start(); - return await super.send(method, params); - } - async _send(payload) { - (0, index_js_1.assertArgument)(!Array.isArray(payload), "EIP-1193 does not support batch request", "payload", payload); - try { - const result = await this.#request(payload.method, payload.params || []); - return [{ id: payload.id, result }]; - } - catch (e) { - return [ - { - id: payload.id, - error: { code: e.code, data: e.data, message: e.message }, - }, - ]; - } - } - getRpcError(payload, error) { - error = JSON.parse(JSON.stringify(error)); - // EIP-1193 gives us some machine-readable error codes, so rewrite - // them into - switch (error.error.code || -1) { - case 4001: - error.error.message = `corebc-user-denied: ${error.error.message}`; - break; - case 4200: - error.error.message = `corebc-unsupported: ${error.error.message}`; - break; - } - return super.getRpcError(payload, error); - } - async hasSigner(address) { - if (address == null) { - address = 0; - } - const accounts = await this.send("xcb_accounts", []); - if (typeof address === "number") { - return accounts.length > address; - } - address = address.toLowerCase(); - return (accounts.filter((a) => a.toLowerCase() === address).length !== 0); - } - async getSigner(address) { - if (address == null) { - address = 0; - } - if (!(await this.hasSigner(address))) { - try { - //const resp = - await this.#request("xcb_requestAccounts", []); - //console.log("RESP", resp); - } - catch (error) { - const payload = error.payload; - throw this.getRpcError(payload, { id: payload.id, error }); - } - } - return await super.getSigner(address); - } -} -exports.BrowserProvider = BrowserProvider; -//# sourceMappingURL=provider-browser.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-browser.js.map b/lib.commonjs/providers/provider-browser.js.map deleted file mode 100644 index 2f27405dd..000000000 --- a/lib.commonjs/providers/provider-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-browser.js","sourceRoot":"","sources":["../../src.ts/providers/provider-browser.ts"],"names":[],"mappings":";;;AAAA,gDAAmD;AAEnD,+DAAkE;AA+BlE,MAAa,eAAgB,SAAQ,+CAAyB;IAC5D,QAAQ,CAGU;IAElB,YAAY,IAAqB,EAAE,OAAoB;QACrD,KAAK,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC;QAErC,IAAI,CAAC,QAAQ,GAAG,KAAK,EACnB,MAAc,EACd,MAAwC,EACxC,EAAE;YACF,MAAM,OAAO,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,CAAC,CAAC;YAC9D,IAAI;gBACF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC3C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,CAAC,CAAC;gBAC/D,OAAO,MAAM,CAAC;aACf;YAAC,OAAO,CAAM,EAAE;gBACf,MAAM,KAAK,GAAG,IAA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AE,EAAE,CAAC,CAAC;gBAC/C,4BAA4B;aAC7B;YAAC,OAAO,KAAU,EAAE;gBACnB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;gBAC9B,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;aAC5D;SACF;QAED,OAAO,MAAM,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;CACF;AAjHD,0CAiHC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-cloudflare.d.ts b/lib.commonjs/providers/provider-cloudflare.d.ts deleted file mode 100644 index 869651f44..000000000 --- a/lib.commonjs/providers/provider-cloudflare.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * About Cloudflare - * - * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] - */ -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { Networkish } from "./network.js"; -/** - * About Cloudflare... - */ -export declare class CloudflareProvider extends JsonRpcProvider { - constructor(_network?: Networkish); -} -//# sourceMappingURL=provider-cloudflare.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-cloudflare.d.ts.map b/lib.commonjs/providers/provider-cloudflare.d.ts.map deleted file mode 100644 index e70790a60..000000000 --- a/lib.commonjs/providers/provider-cloudflare.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-cloudflare.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-cloudflare.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,eAAe;gBACzC,QAAQ,CAAC,EAAE,UAAU;CAalC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-cloudflare.js b/lib.commonjs/providers/provider-cloudflare.js deleted file mode 100644 index f519bef45..000000000 --- a/lib.commonjs/providers/provider-cloudflare.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -/** - * About Cloudflare - * - * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CloudflareProvider = void 0; -const index_js_1 = require("../utils/index.js"); -const network_js_1 = require("./network.js"); -const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); -/** - * About Cloudflare... - */ -class CloudflareProvider extends provider_jsonrpc_js_1.JsonRpcProvider { - constructor(_network) { - if (_network == null) { - _network = "mainnet"; - } - const network = network_js_1.Network.from(_network); - (0, index_js_1.assertArgument)(network.name === "mainnet", "unsupported network", "network", _network); - super("https://cloudflare-eth.com/", network, { staticNetwork: network }); - } -} -exports.CloudflareProvider = CloudflareProvider; -//# sourceMappingURL=provider-cloudflare.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-cloudflare.js.map b/lib.commonjs/providers/provider-cloudflare.js.map deleted file mode 100644 index fe7209db0..000000000 --- a/lib.commonjs/providers/provider-cloudflare.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-cloudflare.js","sourceRoot":"","sources":["../../src.ts/providers/provider-cloudflare.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gDAAmD;AAEnD,6CAAuC;AACvC,+DAAwD;AAIxD;;GAEG;AACH,MAAa,kBAAmB,SAAQ,qCAAe;IACrD,YAAY,QAAqB;QAC/B,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,SAAS,CAAC;SACtB;QACD,MAAM,OAAO,GAAG,oBAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAA,yBAAc,EACZ,OAAO,CAAC,IAAI,KAAK,SAAS,EAC1B,qBAAqB,EACrB,SAAS,EACT,QAAQ,CACT,CAAC;QACF,KAAK,CAAC,6BAA6B,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF;AAdD,gDAcC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-fallback.d.ts b/lib.commonjs/providers/provider-fallback.d.ts deleted file mode 100644 index bf814a2ff..000000000 --- a/lib.commonjs/providers/provider-fallback.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { AbstractProvider } from "./abstract-provider.js"; -import { Network } from "./network.js"; -import type { PerformActionRequest } from "./abstract-provider.js"; -import type { Networkish } from "./network.js"; -/** - * A configuration entry for how to use a [[Provider]]. - */ -export interface FallbackProviderConfig { - provider: AbstractProvider; - stallTimeout?: number; - priority?: number; - weight?: number; -} -/** - * The statistics and state maintained for a [[Provider]]. - */ -export interface FallbackProviderState extends Required { - blockNumber: number; - requests: number; - errorResponses: number; - lateResponses: number; - outOfSync: number; - unsupportedEvents: number; - rollingDuration: number; - score: number; -} -/** - * Additional options to configure a [[FallbackProvider]]. - */ -export type FallbackProviderOptions = { - quorum: number; - eventQuorum: number; - eventWorkers: number; -}; -/** - * A Fallback Provider. - * - */ -export declare class FallbackProvider extends AbstractProvider { - #private; - readonly quorum: number; - readonly eventQuorum: number; - readonly eventWorkers: number; - constructor(providers: Array, network?: Networkish); - get providerConfigs(): Array; - _detectNetwork(): Promise; - _translatePerform(provider: AbstractProvider, req: PerformActionRequest): Promise; - _perform(req: PerformActionRequest): Promise; - destroy(): Promise; -} -//# sourceMappingURL=provider-fallback.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-fallback.d.ts.map b/lib.commonjs/providers/provider-fallback.d.ts.map deleted file mode 100644 index 16b3b607f..000000000 --- a/lib.commonjs/providers/provider-fallback.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-fallback.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-fallback.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAw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iBAAiB,CACrB,QAAQ,EAAE,gBAAgB,EAC1B,GAAG,EAAE,oBAAoB,GACxB,OAAO,CAAC,GAAG,CAAC;IAqTT,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,CAAC;IAqDxD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAM/B"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-fallback.js b/lib.commonjs/providers/provider-fallback.js deleted file mode 100644 index d5743d99a..000000000 --- a/lib.commonjs/providers/provider-fallback.js +++ /dev/null @@ -1,545 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FallbackProvider = void 0; -/** - * Explain all the nitty-gritty about the **FallbackProvider**. - * - * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider] - */ -const index_js_1 = require("../utils/index.js"); -const abstract_provider_js_1 = require("./abstract-provider.js"); -const network_js_1 = require("./network.js"); -const BN_1 = BigInt("1"); -const BN_2 = BigInt("2"); -function shuffle(array) { - for (let i = array.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - const tmp = array[i]; - array[i] = array[j]; - array[j] = tmp; - } -} -function stall(duration) { - return new Promise((resolve) => { - setTimeout(resolve, duration); - }); -} -function getTime() { - return new Date().getTime(); -} -function stringify(value) { - return JSON.stringify(value, (key, value) => { - if (typeof value === "bigint") { - return { type: "bigint", value: value.toString() }; - } - return value; - }); -} -const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 }; -const defaultState = { - blockNumber: -2, - requests: 0, - lateResponses: 0, - errorResponses: 0, - outOfSync: -1, - unsupportedEvents: 0, - rollingDuration: 0, - score: 0, - _network: null, - _updateNumber: null, - _totalTime: 0, -}; -async function waitForSync(config, blockNumber) { - while (config.blockNumber < 0 || config.blockNumber < blockNumber) { - if (!config._updateNumber) { - config._updateNumber = (async () => { - const blockNumber = await config.provider.getBlockNumber(); - if (blockNumber > config.blockNumber) { - config.blockNumber = blockNumber; - } - config._updateNumber = null; - })(); - } - await config._updateNumber; - config.outOfSync++; - } -} -function _normalize(value) { - if (value == null) { - return "null"; - } - if (Array.isArray(value)) { - return "[" + value.map(_normalize).join(",") + "]"; - } - if (typeof value === "object" && typeof value.toJSON === "function") { - return _normalize(value.toJSON()); - } - switch (typeof value) { - case "boolean": - case "symbol": - return value.toString(); - case "bigint": - case "number": - return BigInt(value).toString(); - case "string": - return JSON.stringify(value); - case "object": { - const keys = Object.keys(value); - keys.sort(); - return ("{" + - keys - .map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`) - .join(",") + - "}"); - } - } - console.log("Could not serialize", value); - throw new Error("Hmm..."); -} -function normalizeResult(value) { - if ("error" in value) { - const error = value.error; - return { tag: _normalize(error), value: error }; - } - const result = value.result; - return { tag: _normalize(result), value: result }; -} -// This strategy picks the highest weight result, as long as the weight is -// equal to or greater than quorum -function checkQuorum(quorum, results) { - const tally = new Map(); - for (const { value, tag, weight } of results) { - const t = tally.get(tag) || { value, weight: 0 }; - t.weight += weight; - tally.set(tag, t); - } - let best = null; - for (const r of tally.values()) { - if (r.weight >= quorum && (!best || r.weight > best.weight)) { - best = r; - } - } - if (best) { - return best.value; - } - return undefined; -} -function getMedian(quorum, results) { - let resultWeight = 0; - const errorMap = new Map(); - let bestError = null; - const values = []; - for (const { value, tag, weight } of results) { - if (value instanceof Error) { - const e = errorMap.get(tag) || { value, weight: 0 }; - e.weight += weight; - errorMap.set(tag, e); - if (bestError == null || e.weight > bestError.weight) { - bestError = e; - } - } - else { - values.push(BigInt(value)); - resultWeight += weight; - } - } - if (resultWeight < quorum) { - // We have quorum for an error - if (bestError && bestError.weight >= quorum) { - return bestError.value; - } - // We do not have quorum for a result - return undefined; - } - // Get the sorted values - values.sort((a, b) => (a < b ? -1 : b > a ? 1 : 0)); - const mid = Math.floor(values.length / 2); - // Odd-length; take the middle value - if (values.length % 2) { - return values[mid]; - } - // Even length; take the ceiling of the mean of the center two values - return (values[mid - 1] + values[mid] + BN_1) / BN_2; -} -function getAnyResult(quorum, results) { - // If any value or error meets quorum, that is our preferred result - const result = checkQuorum(quorum, results); - if (result !== undefined) { - return result; - } - // Otherwise, do we have any result? - for (const r of results) { - if (r.value) { - return r.value; - } - } - // Nope! - return undefined; -} -function getFuzzyMode(quorum, results) { - if (quorum === 1) { - return (0, index_js_1.getNumber)(getMedian(quorum, results), "%internal"); - } - const tally = new Map(); - const add = (result, weight) => { - const t = tally.get(result) || { result, weight: 0 }; - t.weight += weight; - tally.set(result, t); - }; - for (const { weight, value } of results) { - const r = (0, index_js_1.getNumber)(value); - add(r - 1, weight); - add(r, weight); - add(r + 1, weight); - } - let bestWeight = 0; - let bestResult = undefined; - for (const { weight, result } of tally.values()) { - // Use this result, if this result meets quorum and has either: - // - a better weight - // - or equal weight, but the result is larger - if (weight >= quorum && - (weight > bestWeight || - (bestResult != null && weight === bestWeight && result > bestResult))) { - bestWeight = weight; - bestResult = result; - } - } - return bestResult; -} -/** - * A Fallback Provider. - * - */ -class FallbackProvider extends abstract_provider_js_1.AbstractProvider { - quorum; - eventQuorum; - eventWorkers; - #configs; - #height; - #initialSyncPromise; - constructor(providers, network) { - super(network); - this.#configs = providers.map((p) => { - if (p instanceof abstract_provider_js_1.AbstractProvider) { - return Object.assign({ provider: p }, defaultConfig, defaultState); - } - else { - return Object.assign({}, defaultConfig, p, defaultState); - } - }); - this.#height = -2; - this.#initialSyncPromise = null; - this.quorum = 2; //Math.ceil(providers.length / 2); - this.eventQuorum = 1; - this.eventWorkers = 1; - (0, index_js_1.assertArgument)(this.quorum <= this.#configs.reduce((a, c) => a + c.weight, 0), "quorum exceed provider wieght", "quorum", this.quorum); - } - get providerConfigs() { - return this.#configs.map((c) => { - const result = Object.assign({}, c); - for (const key in result) { - if (key[0] === "_") { - delete result[key]; - } - } - return result; - }); - } - async _detectNetwork() { - return network_js_1.Network.from((0, index_js_1.getBigInt)(await this._perform({ method: "networkId" }))); - } - // @TODO: Add support to select providers to be the event subscriber - //_getSubscriber(sub: Subscription): Subscriber { - // throw new Error("@TODO"); - //} - async _translatePerform(provider, req) { - switch (req.method) { - case "broadcastTransaction": - return await provider.broadcastTransaction(req.signedTransaction); - case "call": - return await provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag })); - case "networkId": - return (await provider.getNetwork()).networkId; - case "estimateEnergy": - return await provider.estimateEnergy(req.transaction); - case "getBalance": - return await provider.getBalance(req.address, req.blockTag); - case "getBlock": { - const block = "blockHash" in req ? req.blockHash : req.blockTag; - return await provider.getBlock(block, req.includeTransactions); - } - case "getBlockNumber": - return await provider.getBlockNumber(); - case "getCode": - return await provider.getCode(req.address, req.blockTag); - case "getEnergyPrice": - return (await provider.getFeeData()).energyPrice; - case "getLogs": - return await provider.getLogs(req.filter); - case "getStorage": - return await provider.getStorage(req.address, req.position, req.blockTag); - case "getTransaction": - return await provider.getTransaction(req.hash); - case "getTransactionCount": - return await provider.getTransactionCount(req.address, req.blockTag); - case "getTransactionReceipt": - return await provider.getTransactionReceipt(req.hash); - case "getTransactionResult": - return await provider.getTransactionResult(req.hash); - } - } - // Grab the next (random) config that is not already part of - // the running set - #getNextConfig(running) { - // @TODO: Maybe do a check here to favour (heavily) providers that - // do not require waitForSync and disfavour providers that - // seem down-ish or are behaving slowly - const configs = Array.from(running).map((r) => r.config); - // Shuffle the states, sorted by priority - const allConfigs = this.#configs.slice(); - shuffle(allConfigs); - allConfigs.sort((a, b) => b.priority - a.priority); - for (const config of allConfigs) { - if (configs.indexOf(config) === -1) { - return config; - } - } - return null; - } - // Adds a new runner (if available) to running. - #addRunner(running, req) { - const config = this.#getNextConfig(running); - // No runners available - if (config == null) { - return null; - } - // Create a new runner - const runner = { - config, - result: null, - didBump: false, - perform: null, - staller: null, - }; - const now = getTime(); - // Start performing this operation - runner.perform = (async () => { - try { - config.requests++; - const result = await this._translatePerform(config.provider, req); - runner.result = { result }; - } - catch (error) { - config.errorResponses++; - runner.result = { error }; - } - const dt = getTime() - now; - config._totalTime += dt; - config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt; - runner.perform = null; - })(); - // Start a staller; when this times out, it's time to force - // kicking off another runner because we are taking too long - runner.staller = (async () => { - await stall(config.stallTimeout); - runner.staller = null; - })(); - running.add(runner); - return runner; - } - // Initializes the blockNumber and network for each runner and - // blocks until initialized - async #initialSync() { - let initialSync = this.#initialSyncPromise; - if (!initialSync) { - const promises = []; - this.#configs.forEach((config) => { - promises.push(waitForSync(config, 0)); - promises.push((async () => { - config._network = await config.provider.getNetwork(); - })()); - }); - this.#initialSyncPromise = initialSync = (async () => { - // Wait for all providers to have a block number and network - await Promise.all(promises); - // Check all the networks match - let networkId = null; - for (const config of this.#configs) { - const network = config._network; - if (networkId == null) { - networkId = network.networkId; - } - else if (network.networkId !== networkId) { - (0, index_js_1.assert)(false, "cannot mix providers on different networks", "UNSUPPORTED_OPERATION", { - operation: "new FallbackProvider", - }); - } - } - })(); - } - await initialSync; - } - async #checkQuorum(running, req) { - // Get all the result objects - const results = []; - for (const runner of running) { - if (runner.result != null) { - const { tag, value } = normalizeResult(runner.result); - results.push({ tag, value, weight: runner.config.weight }); - } - } - // Are there enough results to event meet quorum? - if (results.reduce((a, r) => a + r.weight, 0) < this.quorum) { - return undefined; - } - switch (req.method) { - case "getBlockNumber": { - // We need to get the bootstrap block height - if (this.#height === -2) { - this.#height = Math.ceil((0, index_js_1.getNumber)(getMedian(this.quorum, this.#configs.map((c) => ({ - value: c.blockNumber, - tag: (0, index_js_1.getNumber)(c.blockNumber).toString(), - weight: c.weight, - }))))); - } - // Find the mode across all the providers, allowing for - // a little drift between block heights - const mode = getFuzzyMode(this.quorum, results); - if (mode === undefined) { - return undefined; - } - if (mode > this.#height) { - this.#height = mode; - } - return this.#height; - } - case "getEnergyPrice": - case "estimateEnergy": - return getMedian(this.quorum, results); - case "getBlock": - // Pending blocks are in the mempool and already - // quite untrustworthy; just grab anything - if ("blockTag" in req && req.blockTag === "pending") { - return getAnyResult(this.quorum, results); - } - return checkQuorum(this.quorum, results); - case "call": - case "networkId": - case "getBalance": - case "getTransactionCount": - case "getCode": - case "getStorage": - case "getTransaction": - case "getTransactionReceipt": - case "getLogs": - return checkQuorum(this.quorum, results); - case "broadcastTransaction": - return getAnyResult(this.quorum, results); - } - (0, index_js_1.assert)(false, "unsupported method", "UNSUPPORTED_OPERATION", { - operation: `_perform(${stringify(req.method)})`, - }); - } - async #waitForQuorum(running, req) { - if (running.size === 0) { - throw new Error("no runners?!"); - } - // Any promises that are interesting to watch for; an expired stall - // or a successful perform - const interesting = []; - let newRunners = 0; - for (const runner of running) { - // No responses, yet; keep an eye on it - if (runner.perform) { - interesting.push(runner.perform); - } - // Still stalling... - if (runner.staller) { - interesting.push(runner.staller); - continue; - } - // This runner has already triggered another runner - if (runner.didBump) { - continue; - } - // Got a response (result or error) or stalled; kick off another runner - runner.didBump = true; - newRunners++; - } - // Check if we have reached quorum on a result (or error) - const value = await this.#checkQuorum(running, req); - if (value !== undefined) { - if (value instanceof Error) { - throw value; - } - return value; - } - // Add any new runners, because a staller timed out or a result - // or error response came in. - for (let i = 0; i < newRunners; i++) { - this.#addRunner(running, req); - } - // All providers have returned, and we have no result - (0, index_js_1.assert)(interesting.length > 0, "quorum not met", "SERVER_ERROR", { - request: "%sub-requests", - info: { - request: req, - results: Array.from(running).map((r) => stringify(r.result)), - }, - }); - // Wait for someone to either complete its perform or stall out - await Promise.race(interesting); - // This is recursive, but at worst case the depth is 2x the - // number of providers (each has a perform and a staller) - return await this.#waitForQuorum(running, req); - } - async _perform(req) { - // Broadcasting a transaction is rare (ish) and already incurs - // a cost on the user, so spamming is safe-ish. Just send it to - // every backend. - if (req.method === "broadcastTransaction") { - const results = await Promise.all(this.#configs.map(async ({ provider, weight }) => { - try { - const result = await provider._perform(req); - return Object.assign(normalizeResult({ result }), { weight }); - } - catch (error) { - return Object.assign(normalizeResult({ error }), { weight }); - } - })); - const result = getAnyResult(this.quorum, results); - (0, index_js_1.assert)(result !== undefined, "problem multi-broadcasting", "SERVER_ERROR", { - request: "%sub-requests", - info: { request: req, results: results.map(stringify) }, - }); - if (result instanceof Error) { - throw result; - } - return result; - } - await this.#initialSync(); - // Bootstrap enough runners to meet quorum - const running = new Set(); - for (let i = 0; i < this.quorum; i++) { - this.#addRunner(running, req); - } - const result = await this.#waitForQuorum(running, req); - // Track requests sent to a provider that are still - // outstanding after quorum has been otherwise found - for (const runner of running) { - if (runner.perform && runner.result == null) { - runner.config.lateResponses++; - } - } - return result; - } - async destroy() { - for (const { provider } of this.#configs) { - provider.destroy(); - } - super.destroy(); - } -} -exports.FallbackProvider = FallbackProvider; -//# sourceMappingURL=provider-fallback.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-fallback.js.map b/lib.commonjs/providers/provider-fallback.js.map deleted file mode 100644 index e42596793..000000000 --- a/lib.commonjs/providers/provider-fallback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-fallback.js","sourceRoot":"","sources":["../../src.ts/providers/provider-fallback.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,gDAK2B;AAE3B,iEAA0D;AAC1D,6CAAuC;AAKvC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAEzB,SAAS,OAAO,CAAU,KAAe;IACvC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QACzC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACrB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,KAAK,CAAC,CAAC,CA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CAAC,QAAQ,EAAE;YACxC,QAAQ,CAAC,OAAO,EAAE,CAAC;SACpB;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF;AAhbD,4CAgbC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-infura.d.ts b/lib.commonjs/providers/provider-infura.d.ts deleted file mode 100644 index e09baec46..000000000 --- a/lib.commonjs/providers/provider-infura.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -/** - * [[link-infura]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Sepolia Testnet (``sepolia``) - * - Arbitrum (``arbitrum``) - * - Arbitrum Goerli Testnet (``arbitrum-goerli``) - * - Optimism (``optimism``) - * - Optimism Goerli Testnet (``optimism-goerli``) - * - Polygon (``matic``) - * - Polygon Mumbai Testnet (``matic-mumbai``) - * - * @_subsection: api/providers/thirdparty:INFURA [providers-infura] - */ -import { FetchRequest } from "../utils/index.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import { WebSocketProvider } from "./provider-websocket.js"; -import type { AbstractProvider } from "./abstract-provider.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -/** - * The **InfuraWebSocketProvider** connects to the [[link-infura]] - * WebSocket end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-infura-signup). - */ -export declare class InfuraWebSocketProvider extends WebSocketProvider implements CommunityResourcable { - /** - * The Project ID for the INFURA connection. - */ - readonly projectId: string; - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - readonly projectSecret: null | string; - /** - * Creates a new **InfuraWebSocketProvider**. - */ - constructor(network?: Networkish, projectId?: string); - isCommunityResource(): boolean; -} -/** - * The **InfuraProvider** connects to the [[link-infura]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-infura-signup). - */ -export declare class InfuraProvider extends JsonRpcProvider implements CommunityResourcable { - /** - * The Project ID for the INFURA connection. - */ - readonly projectId: string; - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - readonly projectSecret: null | string; - /** - * Creates a new **InfuraProvider**. - */ - constructor(_network?: Networkish, projectId?: null | string, projectSecret?: null | string); - _getProvider(networkId: number): AbstractProvider; - isCommunityResource(): boolean; - /** - * Creates a new **InfuraWebSocketProvider**. - */ - static getWebSocketProvider(network?: Networkish, projectId?: string): InfuraWebSocketProvider; - /** - * Returns a prepared request for connecting to %%network%% - * with %%projectId%% and %%projectSecret%%. - */ - static getRequest(network: Network, projectId?: null | string, projectSecret?: null | string): FetchRequest; -} -//# sourceMappingURL=provider-infura.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-infura.d.ts.map b/lib.commonjs/providers/provider-infura.d.ts.map deleted file mode 100644 index cc3baf59e..000000000 --- a/lib.commonjs/providers/provider-infura.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-infura.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-infura.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAEL,YAAY,EAGb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA8B/C;;;;;;;;GAQG;AACH,qBAAa,uBACX,SAAQ,iBACR,YAAW,oBAAoB;IAE/B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAG,MAAM,CAAC;IAE5B;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAG,IAAI,GAAG,MAAM,CAAC;IAEvC;;OAEG;gBACS,OAAO,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM;IAoBpD,mBAAmB,IAAI,OAAO;CAG/B;AAED;;;;;;;;GAQG;AACH,qBAAa,cACX,SAAQ,eACR,YAAW,oBAAoB;IAE/B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAG,MAAM,CAAC;IAE5B;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAG,IAAI,GAAG,MAAM,CAAC;IAEvC;;OAEG;gBAED,QAAQ,CAAC,EAAE,UAAU,EACrB,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,EACzB,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM;IAuB/B,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAOjD,mBAAmB,IAAI,OAAO;IAI9B;;OAEG;IACH,MAAM,CAAC,oBAAoB,CACzB,OAAO,CAAC,EAAE,UAAU,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,uBAAuB;IAI1B;;;OAGG;IACH,MAAM,CAAC,UAAU,CACf,OAAO,EAAE,OAAO,EAChB,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,EACzB,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,GAC5B,YAAY;CAyBhB"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-infura.js b/lib.commonjs/providers/provider-infura.js deleted file mode 100644 index 512a67732..000000000 --- a/lib.commonjs/providers/provider-infura.js +++ /dev/null @@ -1,172 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.InfuraProvider = exports.InfuraWebSocketProvider = void 0; -/** - * [[link-infura]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Sepolia Testnet (``sepolia``) - * - Arbitrum (``arbitrum``) - * - Arbitrum Goerli Testnet (``arbitrum-goerli``) - * - Optimism (``optimism``) - * - Optimism Goerli Testnet (``optimism-goerli``) - * - Polygon (``matic``) - * - Polygon Mumbai Testnet (``matic-mumbai``) - * - * @_subsection: api/providers/thirdparty:INFURA [providers-infura] - */ -const index_js_1 = require("../utils/index.js"); -const community_js_1 = require("./community.js"); -const network_js_1 = require("./network.js"); -const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); -const provider_websocket_js_1 = require("./provider-websocket.js"); -const defaultProjectId = "84842078b09946638c03157f83405213"; -function getHost(name) { - switch (name) { - case "mainnet": - return "mainnet.infura.io"; - case "goerli": - return "goerli.infura.io"; - case "sepolia": - return "sepolia.infura.io"; - case "arbitrum": - return "arbitrum-mainnet.infura.io"; - case "arbitrum-goerli": - return "arbitrum-goerli.infura.io"; - case "matic": - return "polygon-mainnet.infura.io"; - case "matic-mumbai": - return "polygon-mumbai.infura.io"; - case "optimism": - return "optimism-mainnet.infura.io"; - case "optimism-goerli": - return "optimism-goerli.infura.io"; - } - (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); -} -/** - * The **InfuraWebSocketProvider** connects to the [[link-infura]] - * WebSocket end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-infura-signup). - */ -class InfuraWebSocketProvider extends provider_websocket_js_1.WebSocketProvider { - /** - * The Project ID for the INFURA connection. - */ - projectId; - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - projectSecret; - /** - * Creates a new **InfuraWebSocketProvider**. - */ - constructor(network, projectId) { - const provider = new InfuraProvider(network, projectId); - const req = provider._getConnection(); - (0, index_js_1.assert)(!req.credentials, "INFURA WebSocket project secrets unsupported", "UNSUPPORTED_OPERATION", { operation: "InfuraProvider.getWebSocketProvider()" }); - const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); - super(url, network); - (0, index_js_1.defineProperties)(this, { - projectId: provider.projectId, - projectSecret: provider.projectSecret, - }); - } - isCommunityResource() { - return this.projectId === defaultProjectId; - } -} -exports.InfuraWebSocketProvider = InfuraWebSocketProvider; -/** - * The **InfuraProvider** connects to the [[link-infura]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-infura-signup). - */ -class InfuraProvider extends provider_jsonrpc_js_1.JsonRpcProvider { - /** - * The Project ID for the INFURA connection. - */ - projectId; - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - projectSecret; - /** - * Creates a new **InfuraProvider**. - */ - constructor(_network, projectId, projectSecret) { - if (_network == null) { - _network = "mainnet"; - } - const network = network_js_1.Network.from(_network); - if (projectId == null) { - projectId = defaultProjectId; - } - if (projectSecret == null) { - projectSecret = null; - } - const request = InfuraProvider.getRequest(network, projectId, projectSecret); - super(request, network, { staticNetwork: network }); - (0, index_js_1.defineProperties)(this, { projectId, projectSecret }); - } - _getProvider(networkId) { - try { - return new InfuraProvider(networkId, this.projectId, this.projectSecret); - } - catch (error) { } - return super._getProvider(networkId); - } - isCommunityResource() { - return this.projectId === defaultProjectId; - } - /** - * Creates a new **InfuraWebSocketProvider**. - */ - static getWebSocketProvider(network, projectId) { - return new InfuraWebSocketProvider(network, projectId); - } - /** - * Returns a prepared request for connecting to %%network%% - * with %%projectId%% and %%projectSecret%%. - */ - static getRequest(network, projectId, projectSecret) { - if (projectId == null) { - projectId = defaultProjectId; - } - if (projectSecret == null) { - projectSecret = null; - } - const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/v3/${projectId}`); - request.allowGzip = true; - if (projectSecret) { - request.setCredentials("", projectSecret); - } - if (projectId === defaultProjectId) { - request.retryFunc = async (request, response, attempt) => { - (0, community_js_1.showThrottleMessage)("InfuraProvider"); - return true; - }; - } - return request; - } -} -exports.InfuraProvider = InfuraProvider; -//# sourceMappingURL=provider-infura.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-infura.js.map b/lib.commonjs/providers/provider-infura.js.map deleted file mode 100644 index 100aef685..000000000 --- a/lib.commonjs/providers/provider-infura.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-infura.js","sourceRoot":"","sources":["../../src.ts/providers/provider-infura.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,gDAK2B;AAE3B,iDAAqD;AACrD,6CAAuC;AACvC,+DAAwD;AACxD,mEAA4D;AAM5D,MAAM,gBAAgB,GAAG,kCAAkC,CAAC;AAE5D,SAAS,OAAO,CAAC,IAAY;IAC3B,QAAQ,IAAI,EAAE;QACZ,KAAK,SAAS;YACZ,OAAO,mBAAmB,CAAC;QAC7B,KAAK,QAAQ;YACX,OAAO,kBAAkB,CAAC;QAC5B,KAAK,SAAS;YACZ,OAAO,mBAAmB,CAAC;QAE7B,KAAK,UAAU;YACb,OAAO,4BAA4B,CAAC;QACtC,KAAK,iBAAiB;YACpB,OAAO,2BAA2B,CAAC;QACrC,KAAK,OAAO;YACV,OAAO,2BAA2B,CAAC;QACrC,KAAK,cAAc;YACjB,OAAO,0BAA0B,CAAC;QACpC,KAAK,UAAU;YACb,OAAO,4BAA4B,CAAC;QACtC,KAAK,iBAAiB;YACpB,OAAO,2BAA2B,CAAC;KACtC;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAa,uBACX,SAAQ,yCAAiB;IAGzB;;OAEG;IACM,SAAS,CAAU;IAE5B;;;;;OAKG;IACM,aAAa,CAAiB;IAEvC;;OAE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,EAAE,OAAO,EAAE,EAAE;gBACvD,IAAA,kCAAmB,EAAC,gBAAgB,CAAC,CAAC;gBACtC,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;SACH;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AApGD,wCAoGC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-ipcsocket-browser.d.ts b/lib.commonjs/providers/provider-ipcsocket-browser.d.ts deleted file mode 100644 index 6aae787dc..000000000 --- a/lib.commonjs/providers/provider-ipcsocket-browser.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const IpcSocketProvider: undefined; -export { IpcSocketProvider }; -//# sourceMappingURL=provider-ipcsocket-browser.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-ipcsocket-browser.d.ts.map b/lib.commonjs/providers/provider-ipcsocket-browser.d.ts.map deleted file mode 100644 index e49cd58d3..000000000 --- a/lib.commonjs/providers/provider-ipcsocket-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ipcsocket-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket-browser.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,iBAAiB,WAAY,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-ipcsocket-browser.js b/lib.commonjs/providers/provider-ipcsocket-browser.js deleted file mode 100644 index 7a8728ff4..000000000 --- a/lib.commonjs/providers/provider-ipcsocket-browser.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.IpcSocketProvider = void 0; -const IpcSocketProvider = undefined; -exports.IpcSocketProvider = IpcSocketProvider; -//# sourceMappingURL=provider-ipcsocket-browser.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-ipcsocket-browser.js.map b/lib.commonjs/providers/provider-ipcsocket-browser.js.map deleted file mode 100644 index a4527c7ae..000000000 --- a/lib.commonjs/providers/provider-ipcsocket-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ipcsocket-browser.js","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket-browser.ts"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAE3B,8CAAiB"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-ipcsocket.d.ts b/lib.commonjs/providers/provider-ipcsocket.d.ts deleted file mode 100644 index a9ee3bfc9..000000000 --- a/lib.commonjs/providers/provider-ipcsocket.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -import { SocketProvider } from "./provider-socket.js"; -import type { Socket } from "net"; -import type { Networkish } from "./network.js"; -export declare class IpcSocketProvider extends SocketProvider { - #private; - get socket(): Socket; - constructor(path: string, network?: Networkish); - destroy(): void; - _write(message: string): Promise; -} -//# sourceMappingURL=provider-ipcsocket.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-ipcsocket.d.ts.map b/lib.commonjs/providers/provider-ipcsocket.d.ts.map deleted file mode 100644 index 91d6287d7..000000000 --- a/lib.commonjs/providers/provider-ipcsocket.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ipcsocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAuB/C,qBAAa,iBAAkB,SAAQ,cAAc;;IAEnD,IAAI,MAAM,IAAI,MAAM,CAEnB;gBAEW,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU;IA8B9C,OAAO,IAAI,IAAI;IAOT,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-ipcsocket.js b/lib.commonjs/providers/provider-ipcsocket.js deleted file mode 100644 index a7ca9dedf..000000000 --- a/lib.commonjs/providers/provider-ipcsocket.js +++ /dev/null @@ -1,63 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.IpcSocketProvider = void 0; -const net_1 = require("net"); -const provider_socket_js_1 = require("./provider-socket.js"); -// @TODO: Is this sufficient? Is this robust? Will newlines occur between -// all payloads and only between payloads? -function splitBuffer(data) { - const messages = []; - let lastStart = 0; - while (true) { - const nl = data.indexOf(10, lastStart); - if (nl === -1) { - break; - } - messages.push(data.subarray(lastStart, nl).toString().trim()); - lastStart = nl + 1; - } - return { messages, remaining: data.subarray(lastStart) }; -} -class IpcSocketProvider extends provider_socket_js_1.SocketProvider { - #socket; - get socket() { - return this.#socket; - } - constructor(path, network) { - super(network); - this.#socket = (0, net_1.connect)(path); - this.socket.on("ready", async () => { - try { - await this._start(); - } - catch (error) { - console.log("failed to start IpcSocketProvider", error); - // @TODO: Now what? Restart? - } - }); - let response = Buffer.alloc(0); - this.socket.on("data", (data) => { - response = Buffer.concat([response, data]); - const { messages, remaining } = splitBuffer(response); - messages.forEach((message) => { - this._processMessage(message); - }); - response = remaining; - }); - this.socket.on("end", () => { - this.emit("close"); - this.socket.destroy(); - this.socket.end(); - }); - } - destroy() { - this.socket.destroy(); - this.socket.end(); - super.destroy(); - } - async _write(message) { - this.socket.write(message); - } -} -exports.IpcSocketProvider = IpcSocketProvider; -//# sourceMappingURL=provider-ipcsocket.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-ipcsocket.js.map b/lib.commonjs/providers/provider-ipcsocket.js.map deleted file mode 100644 index 5b55fb309..000000000 --- a/lib.commonjs/providers/provider-ipcsocket.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ipcsocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket.ts"],"names":[],"mappings":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,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YAC9B,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;YAC3C,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;YACtD,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC3B,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;YACH,QAAQ,GAAG,SAAS,CAAC;QACvB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YACzB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACnB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QAElB,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAe;QAC1B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;CACF;AA9CD,8CA8CC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-jsonrpc.d.ts b/lib.commonjs/providers/provider-jsonrpc.d.ts deleted file mode 100644 index f4dc34d1e..000000000 --- a/lib.commonjs/providers/provider-jsonrpc.d.ts +++ /dev/null @@ -1,267 +0,0 @@ -/** - * About JSON-RPC... - * - * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] - */ -import { FetchRequest } from "../utils/index.js"; -import { AbstractProvider } from "./abstract-provider.js"; -import { AbstractSigner } from "./abstract-signer.js"; -import { Network } from "./network.js"; -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { PerformActionRequest, Subscriber, Subscription } from "./abstract-provider.js"; -import type { Networkish } from "./network.js"; -import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -import type { Signer } from "./signer.js"; -/** - * A JSON-RPC payload, which are sent to a JSON-RPC server. - */ -export type JsonRpcPayload = { - id: number; - method: string; - params: Array | Record; - jsonrpc: "2.0"; -}; -/** - * A JSON-RPC result, which are returned on success from a JSON-RPC server. - */ -export type JsonRpcResult = { - id: number; - result: any; -}; -/** - * A JSON-RPC error, which are returned on failure from a JSON-RPC server. - */ -export type JsonRpcError = { - id: number; - error: { - code: number; - message?: string; - data?: any; - }; -}; -/** - * When subscribing to the ``"debug"`` event, the [[Listener]] will - * receive this object as the first parameter. - */ -export type DebugEventJsonRpcApiProvider = { - action: "sendRpcPayload"; - payload: JsonRpcPayload | Array; -} | { - action: "receiveRpcResult"; - result: Array; -} | { - action: "receiveRpcError"; - error: Error; -}; -/** - * Options for configuring a [[JsonRpcApiProvider]]. Much of this - * is targetted towards sub-classes, which often will not expose - * any of these options to their consumers. - * - * **``polling``** - use the polling strategy is used immediately - * for events; otherwise, attempt to use filters and fall back onto - * polling (default: ``false``) - * - * **``staticNetwork``** - do not request chain ID on requests to - * validate the underlying chain has not changed (default: ``null``) - * - * This should **ONLY** be used if it is **certain** that the network - * cannot change, such as when using INFURA (since the URL dictates the - * network). If the network is assumed static and it does change, this - * can have tragic consequences. For example, this **CANNOT** be used - * with MetaMask, since the used can select a new network from the - * drop-down at any time. - * - * **``batchStallTime``** - how long (ms) to aggregate requests into a - * single batch. ``0`` indicates batching will only encompass the current - * event loop. If ``batchMaxCount = 1``, this is ignored. (default: ``10``) - * - * **``batchMaxSize``** - target maximum size (bytes) to allow per batch - * request (default: 1Mb) - * - * **``batchMaxCount``** - maximum number of requests to allow in a batch. - * If ``batchMaxCount = 1``, then batching is disabled. (default: ``100``) - */ -export type JsonRpcApiProviderOptions = { - polling?: boolean; - staticNetwork?: null | Network; - batchStallTime?: number; - batchMaxSize?: number; - batchMaxCount?: number; -}; -export interface JsonRpcTransactionRequest { - from?: string; - to?: string; - data?: string; - networkId?: string; - type?: string; - energy?: string; - energyPrice?: string; - nonce?: string; - value?: string; - accessList?: Array<{ - address: string; - storageKeys: Array; - }>; -} -export declare class JsonRpcSigner extends AbstractSigner { - address: string; - constructor(provider: JsonRpcApiProvider, address: string); - connect(provider: null | Provider): Signer; - getAddress(): Promise; - populateTransaction(tx: TransactionRequest): Promise>; - sendUncheckedTransaction(_tx: TransactionRequest): Promise; - sendTransaction(tx: TransactionRequest): Promise; - signTransaction(_tx: TransactionRequest): Promise; - signMessage(_message: string | Uint8Array): Promise; - signTypedData(domain: TypedDataDomain, types: Record>, _value: Record): Promise; - unlock(password: string): Promise; - _legacySignMessage(_message: string | Uint8Array): Promise; -} -/** - * The JsonRpcApiProvider is an abstract class and **MUST** be - * sub-classed. - * - * It provides the base for all JSON-RPC-based Provider interaction. - * - * Sub-classing Notes: - * - a sub-class MUST override _send - * - a sub-class MUST call the `_start()` method once connected - */ -export declare abstract class JsonRpcApiProvider extends AbstractProvider { - #private; - constructor(network?: Networkish, options?: JsonRpcApiProviderOptions); - /** - * Returns the value associated with the option %%key%%. - * - * Sub-classes can use this to inquire about configuration options. - */ - _getOption(key: K): JsonRpcApiProviderOptions[K]; - /** - * Gets the [[Network]] this provider has committed to. On each call, the network - * is detected, and if it has changed, the call will reject. - */ - get _network(): Network; - /** - * Sends a JSON-RPC %%payload%% (or a batch) to the underlying channel. - * - * Sub-classes **MUST** override this. - */ - abstract _send(payload: JsonRpcPayload | Array): Promise>; - /** - * Resolves to the non-normalized value by performing %%req%%. - * - * Sub-classes may override this to modify behavior of actions, - * and should generally call ``super._perform`` as a fallback. - */ - _perform(req: PerformActionRequest): Promise; - /** - * Sub-classes may override this; it detects the *actual* network that - * we are **currently** connected to. - * - * Keep in mind that [[send]] may only be used once [[ready]], otherwise the - * _send primitive must be used instead. - */ - _detectNetwork(): Promise; - /** - * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls - * will be passed to [[_send]] from [[send]]. If it is overridden, then - * ``super._start()`` **MUST** be called. - * - * Calling it multiple times is safe and has no effect. - */ - _start(): void; - /** - * Resolves once the [[_start]] has been called. This can be used in - * sub-classes to defer sending data until the connection has been - * established. - */ - _waitUntilReady(): Promise; - /** - * Return a Subscriber that will manage the %%sub%%. - * - * Sub-classes may override this to modify the behavior of - * subscription management. - */ - _getSubscriber(sub: Subscription): Subscriber; - /** - * Returns true only if the [[_start]] has been called. - */ - get ready(): boolean; - /** - * Returns %%tx%% as a normalized JSON-RPC transaction request, - * which has all values hexlified and any numeric values converted - * to Quantity values. - */ - getRpcTransaction(tx: TransactionRequest): JsonRpcTransactionRequest; - /** - * Returns the request method and arguments required to perform - * %%req%%. - */ - getRpcRequest(req: PerformActionRequest): null | { - method: string; - args: Array; - }; - /** - * Returns an CoreBC-style Error for the given JSON-RPC error - * %%payload%%, coalescing the various strings and error shapes - * that different nodes return, coercing them into a machine-readable - * standardized error. - */ - getRpcError(payload: JsonRpcPayload, _error: JsonRpcError): Error; - /** - * Requests the %%method%% with %%params%% via the JSON-RPC protocol - * over the underlying channel. This can be used to call methods - * on the backend that do not have a high-level API within the Provider - * API. - * - * This method queues requests according to the batch constraints - * in the options, assigns the request a unique ID. - * - * **Do NOT override** this method in sub-classes; instead - * override [[_send]] or force the options values in the - * call to the constructor to modify this method's behavior. - */ - send(method: string, params: Array | Record): Promise; - /** - * Resolves to the [[Signer]] account for %%address%% managed by - * the client. - * - * If the %%address%% is a number, it is used as an index in the - * the accounts from [[listAccounts]]. - * - * This can only be used on clients which manage accounts (such as - * Geth with imported account or MetaMask). - * - * Throws if the account doesn't exist. - */ - getSigner(address?: number | string): Promise; - listAccounts(): Promise>; -} -export declare abstract class JsonRpcApiPollingProvider extends JsonRpcApiProvider { - #private; - constructor(network?: Networkish, options?: JsonRpcApiProviderOptions); - _getSubscriber(sub: Subscription): Subscriber; - /** - * The polling interval (default: 4000 ms) - */ - get pollingInterval(): number; - set pollingInterval(value: number); -} -/** - * The JsonRpcProvider is one of the most common Providers, - * which performs all operations over HTTP (or HTTPS) requests. - * - * Events are processed by polling the backend for the current block - * number; when it advances, all block-base events are then checked - * for updates. - */ -export declare class JsonRpcProvider extends JsonRpcApiPollingProvider { - #private; - constructor(url?: string | FetchRequest, network?: Networkish, options?: JsonRpcApiProviderOptions); - _getConnection(): FetchRequest; - send(method: string, params: Array | Record): Promise; - _send(payload: JsonRpcPayload | Array): Promise>; -} -//# sourceMappingURL=provider-jsonrpc.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-jsonrpc.d.ts.map b/lib.commonjs/providers/provider-jsonrpc.d.ts.map deleted file mode 100644 index 5e8ed8fa0..000000000 --- a/lib.commonjs/providers/provider-jsonrpc.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-jsonrpc.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-jsonrpc.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAUL,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAuB,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAOvC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EACV,YAAY,EACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACV,QAAQ,E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CAAC,CAAC;CAgBjC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-jsonrpc.js b/lib.commonjs/providers/provider-jsonrpc.js deleted file mode 100644 index 5cb92bc55..000000000 --- a/lib.commonjs/providers/provider-jsonrpc.js +++ /dev/null @@ -1,860 +0,0 @@ -"use strict"; -/** - * About JSON-RPC... - * - * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.JsonRpcProvider = exports.JsonRpcApiPollingProvider = exports.JsonRpcApiProvider = exports.JsonRpcSigner = void 0; -// @TODO: -// - Add the batching API -const index_js_1 = require("../abi/index.js"); -const index_js_2 = require("../address/index.js"); -const index_js_3 = require("../hash/index.js"); -const index_js_4 = require("../utils/index.js"); -const abstract_provider_js_1 = require("./abstract-provider.js"); -const abstract_signer_js_1 = require("./abstract-signer.js"); -const network_js_1 = require("./network.js"); -const subscriber_filterid_js_1 = require("./subscriber-filterid.js"); -const subscriber_polling_js_1 = require("./subscriber-polling.js"); -const checks_js_1 = require("../address/checks.js"); -const Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g); -//const Methods = "getAddress,then".split(/,/g); -function deepCopy(value) { - if (value == null || Primitive.indexOf(typeof value) >= 0) { - return value; - } - // Keep any Addressable - if (typeof value.getAddress === "function") { - return value; - } - if (Array.isArray(value)) { - return value.map(deepCopy); - } - if (typeof value === "object") { - return Object.keys(value).reduce((accum, key) => { - accum[key] = value[key]; - return accum; - }, {}); - } - throw new Error(`should not happen: ${value} (${typeof value})`); -} -function stall(duration) { - return new Promise((resolve) => { - setTimeout(resolve, duration); - }); -} -function getLowerCase(value) { - if (value) { - return value.toLowerCase(); - } - return value; -} -function isPollable(value) { - return value && typeof value.pollingInterval === "number"; -} -const defaultOptions = { - polling: false, - staticNetwork: null, - batchStallTime: 10, - batchMaxSize: 1 << 20, - batchMaxCount: 100, // 100 requests -}; -// @TODO: Unchecked Signers -class JsonRpcSigner extends abstract_signer_js_1.AbstractSigner { - address; - constructor(provider, address) { - super(provider); - address = (0, index_js_2.getAddress)(address); - (0, index_js_4.defineProperties)(this, { address }); - } - connect(provider) { - (0, index_js_4.assert)(false, "cannot reconnect JsonRpcSigner", "UNSUPPORTED_OPERATION", { - operation: "signer.connect", - }); - } - async getAddress() { - return this.address; - } - // JSON-RPC will automatially fill in nonce, etc. so we just check from - async populateTransaction(tx) { - return await this.populateCall(tx); - } - // Returns just the hash of the transaction after sent, which is what - // the bare JSON-RPC API does; - async sendUncheckedTransaction(_tx) { - const tx = deepCopy(_tx); - const promises = []; - // Make sure the from matches the sender - if (tx.from) { - const _from = tx.from; - promises.push((async () => { - const from = await (0, checks_js_1.resolveAddress)(_from); - (0, index_js_4.assertArgument)(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); - tx.from = from; - })()); - } - else { - tx.from = this.address; - } - // The JSON-RPC for xcb_sendTransaction uses 90000 energy; if the user - // wishes to use this, it is easy to specify explicitly, otherwise - // we look it up for them. - if (tx.energyLimit == null) { - promises.push((async () => { - tx.energyLimit = await this.provider.estimateEnergy({ - ...tx, - from: this.address, - }); - })()); - } - // The address may be an ENS name or Addressable - if (tx.to != null) { - const _to = tx.to; - promises.push((async () => { - tx.to = await (0, checks_js_1.resolveAddress)(_to); - })()); - } - // Wait until all of our properties are filled in - if (promises.length) { - await Promise.all(promises); - } - const hexTx = this.provider.getRpcTransaction(tx); - return this.provider.send("xcb_sendTransaction", [hexTx]); - } - async sendTransaction(tx) { - // This cannot be mined any earlier than any recent block - const blockNumber = await this.provider.getBlockNumber(); - // Send the transaction - const hash = await this.sendUncheckedTransaction(tx); - // Unfortunately, JSON-RPC only provides and opaque transaction hash - // for a response, and we need the actual transaction, so we poll - // for it; it should show up very quickly - return await new Promise((resolve, reject) => { - const timeouts = [1000, 100]; - const checkTx = async () => { - // Try getting the transaction - const tx = await this.provider.getTransaction(hash); - if (tx != null) { - resolve(tx.replaceableTransaction(blockNumber)); - return; - } - // Wait another 4 seconds - this.provider._setTimeout(() => { - checkTx(); - }, timeouts.pop() || 4000); - }; - checkTx(); - }); - } - async signTransaction(_tx) { - const tx = deepCopy(_tx); - // Make sure the from matches the sender - if (tx.from) { - const from = await (0, checks_js_1.resolveAddress)(tx.from); - (0, index_js_4.assertArgument)(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); - tx.from = from; - } - else { - tx.from = this.address; - } - const hexTx = this.provider.getRpcTransaction(tx); - return await this.provider.send("xcb_signTransaction", [hexTx]); - } - async signMessage(_message) { - const message = typeof _message === "string" ? (0, index_js_4.toUtf8Bytes)(_message) : _message; - return await this.provider.send("personal_sign", [ - (0, index_js_4.hexlify)(message), - this.address.toLowerCase(), - ]); - } - async signTypedData(domain, types, _value) { - const value = deepCopy(_value); - // Populate any ENS names (in-place) - const populated = await index_js_3.TypedDataEncoder.resolveNames(domain, types, value, async (value) => { - const address = await (0, checks_js_1.resolveAddress)(value); - (0, index_js_4.assertArgument)(address != null, "TypedData does not support null address", "value", value); - return address; - }); - return await this.provider.send("xcb_signTypedData_v4", [ - this.address.toLowerCase(), - JSON.stringify(index_js_3.TypedDataEncoder.getPayload(populated.domain, types, populated.value)), - ]); - } - async unlock(password) { - return this.provider.send("personal_unlockAccount", [ - this.address.toLowerCase(), - password, - null, - ]); - } - async _legacySignMessage(_message) { - const message = typeof _message === "string" ? (0, index_js_4.toUtf8Bytes)(_message) : _message; - return await this.provider.send("xcb_sign", [ - this.address.toLowerCase(), - (0, index_js_4.hexlify)(message), - ]); - } -} -exports.JsonRpcSigner = JsonRpcSigner; -/** - * The JsonRpcApiProvider is an abstract class and **MUST** be - * sub-classed. - * - * It provides the base for all JSON-RPC-based Provider interaction. - * - * Sub-classing Notes: - * - a sub-class MUST override _send - * - a sub-class MUST call the `_start()` method once connected - */ -class JsonRpcApiProvider extends abstract_provider_js_1.AbstractProvider { - #options; - // The next ID to use for the JSON-RPC ID field - #nextId; - // Payloads are queued and triggered in batches using the drainTimer - #payloads; - #drainTimer; - #notReady; - #network; - #scheduleDrain() { - if (this.#drainTimer) { - return; - } - // If we aren't using batching, no hard in sending it immeidately - const stallTime = this._getOption("batchMaxCount") === 1 - ? 0 - : this._getOption("batchStallTime"); - this.#drainTimer = setTimeout(() => { - this.#drainTimer = null; - const payloads = this.#payloads; - this.#payloads = []; - while (payloads.length) { - // Create payload batches that satisfy our batch constraints - const batch = [payloads.shift()]; - while (payloads.length) { - if (batch.length === this.#options.batchMaxCount) { - break; - } - batch.push(payloads.shift()); - const bytes = JSON.stringify(batch.map((p) => p.payload)); - if (bytes.length > this.#options.batchMaxSize) { - payloads.unshift(batch.pop()); - break; - } - } - // Process the result to each payload - (async () => { - const payload = batch.length === 1 ? batch[0].payload : batch.map((p) => p.payload); - this.emit("debug", { action: "sendRpcPayload", payload }); - try { - // console.log({payload}) - const result = await this._send(payload); - // console.log({result}) - this.emit("debug", { action: "receiveRpcResult", result }); - // Process results in batch order - for (const { resolve, reject, payload } of batch) { - // Find the matching result - const resp = result.filter((r) => r.id === payload.id)[0]; - // No result; the node failed us in unexpected ways - if (resp == null) { - return reject((0, index_js_4.makeError)("no response from server", "BAD_DATA", { - value: result, - info: { payload }, - })); - } - // The response is an error - if ("error" in resp) { - return reject(this.getRpcError(payload, resp)); - } - // All good; send the result - resolve(resp.result); - } - } - catch (error) { - this.emit("debug", { action: "receiveRpcError", error }); - for (const { reject } of batch) { - // @TODO: augment the error with the payload - reject(error); - } - } - })(); - } - }, stallTime); - } - constructor(network, options) { - super(network); - this.#nextId = 1; - this.#options = Object.assign({}, defaultOptions, options || {}); - this.#payloads = []; - this.#drainTimer = null; - this.#network = null; - { - let resolve = null; - const promise = new Promise((_resolve) => { - resolve = _resolve; - }); - this.#notReady = { promise, resolve }; - } - // Make sure any static network is compatbile with the provided netwrok - const staticNetwork = this._getOption("staticNetwork"); - if (staticNetwork) { - (0, index_js_4.assertArgument)(network == null || staticNetwork.matches(network), "staticNetwork MUST match network object", "options", options); - this.#network = staticNetwork; - } - } - /** - * Returns the value associated with the option %%key%%. - * - * Sub-classes can use this to inquire about configuration options. - */ - _getOption(key) { - return this.#options[key]; - } - /** - * Gets the [[Network]] this provider has committed to. On each call, the network - * is detected, and if it has changed, the call will reject. - */ - get _network() { - (0, index_js_4.assert)(this.#network, "network is not available yet", "NETWORK_ERROR"); - return this.#network; - } - /* - { - assert(false, "sub-classes must override _send", "UNSUPPORTED_OPERATION", { - operation: "jsonRpcApiProvider._send" - }); - } - */ - /** - * Resolves to the non-normalized value by performing %%req%%. - * - * Sub-classes may override this to modify behavior of actions, - * and should generally call ``super._perform`` as a fallback. - */ - async _perform(req) { - const request = this.getRpcRequest(req); - if (request != null) { - return await this.send(request.method, request.args); - } - return super._perform(req); - } - /** - * Sub-classes may override this; it detects the *actual* network that - * we are **currently** connected to. - * - * Keep in mind that [[send]] may only be used once [[ready]], otherwise the - * _send primitive must be used instead. - */ - async _detectNetwork() { - const network = this._getOption("staticNetwork"); - if (network) { - return network; - } - // If we are ready, use ``send``, which enabled requests to be batched - if (this.ready) { - return network_js_1.Network.from((0, index_js_4.getBigInt)(await this.send("xcb_networkId", []))); - } - // We are not ready yet; use the primitive _send - const payload = { - id: this.#nextId++, - method: "xcb_networkId", - params: [], - jsonrpc: "2.0", - }; - this.emit("debug", { action: "sendRpcPayload", payload }); - let result; - try { - result = (await this._send(payload))[0]; - } - catch (error) { - this.emit("debug", { action: "receiveRpcError", error }); - throw error; - } - this.emit("debug", { action: "receiveRpcResult", result }); - if ("result" in result) { - return network_js_1.Network.from((0, index_js_4.getBigInt)(result.result)); - } - throw this.getRpcError(payload, result); - } - /** - * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls - * will be passed to [[_send]] from [[send]]. If it is overridden, then - * ``super._start()`` **MUST** be called. - * - * Calling it multiple times is safe and has no effect. - */ - _start() { - if (this.#notReady == null || this.#notReady.resolve == null) { - return; - } - this.#notReady.resolve(); - this.#notReady = null; - (async () => { - // Bootstrap the network - while (this.#network == null) { - try { - this.#network = await this._detectNetwork(); - } - catch (error) { - console.log("JsonRpcProvider failed to startup; retry in 1s"); - await stall(1000); - } - } - // Start dispatching requests - this.#scheduleDrain(); - })(); - } - /** - * Resolves once the [[_start]] has been called. This can be used in - * sub-classes to defer sending data until the connection has been - * established. - */ - async _waitUntilReady() { - if (this.#notReady == null) { - return; - } - return await this.#notReady.promise; - } - /** - * Return a Subscriber that will manage the %%sub%%. - * - * Sub-classes may override this to modify the behavior of - * subscription management. - */ - _getSubscriber(sub) { - // Pending Filters aren't availble via polling - if (sub.type === "pending") { - return new subscriber_filterid_js_1.FilterIdPendingSubscriber(this); - } - if (sub.type === "event") { - if (this._getOption("polling")) { - return new subscriber_polling_js_1.PollingEventSubscriber(this, sub.filter); - } - return new subscriber_filterid_js_1.FilterIdEventSubscriber(this, sub.filter); - } - // Orphaned Logs are handled automatically, by the filter, since - // logs with removed are emitted by it - if (sub.type === "orphan" && sub.filter.orphan === "drop-log") { - return new abstract_provider_js_1.UnmanagedSubscriber("orphan"); - } - return super._getSubscriber(sub); - } - /** - * Returns true only if the [[_start]] has been called. - */ - get ready() { - return this.#notReady == null; - } - /** - * Returns %%tx%% as a normalized JSON-RPC transaction request, - * which has all values hexlified and any numeric values converted - * to Quantity values. - */ - getRpcTransaction(tx) { - const result = {}; - // JSON-RPC now requires numeric values to be "quantity" values - [ - "networkId", - "energyLimit", - "energyPrice", - "type", - "nonce", - "value", - ].forEach((key) => { - if (tx[key] == null) { - return; - } - let dstKey = key; - if (key === "energyLimit") { - dstKey = "energy"; - } - result[dstKey] = (0, index_js_4.toQuantity)((0, index_js_4.getBigInt)(tx[key], `tx.${key}`)); - }); - // Make sure addresses and data are lowercase - ["from", "to", "data"].forEach((key) => { - if (tx[key] == null) { - return; - } - result[key] = (0, index_js_4.hexlify)(tx[key]); - }); - return result; - } - /** - * Returns the request method and arguments required to perform - * %%req%%. - */ - getRpcRequest(req) { - switch (req.method) { - case "networkId": - return { method: "xcb_networkId", args: [] }; - case "getBlockNumber": - return { method: "xcb_blockNumber", args: [] }; - case "getEnergyPrice": - return { method: "xcb_energyPrice", args: [] }; - case "getBalance": { - return { - method: "xcb_getBalance", - args: [getLowerCase(req.address), req.blockTag], - }; - } - case "getTransactionCount": - return { - method: "xcb_getTransactionCount", - args: [getLowerCase(req.address), req.blockTag], - }; - case "getCode": - return { - method: "xcb_getCode", - args: [getLowerCase(req.address), req.blockTag], - }; - case "getStorage": - return { - method: "xcb_getStorageAt", - args: [ - getLowerCase(req.address), - "0x" + req.position.toString(16), - req.blockTag, - ], - }; - case "broadcastTransaction": - return { - method: "xcb_sendRawTransaction", - args: [req.signedTransaction], - }; - case "getBlock": - if ("blockTag" in req) { - return { - method: "xcb_getBlockByNumber", - args: [req.blockTag, !!req.includeTransactions], - }; - } - else if ("blockHash" in req) { - return { - method: "xcb_getBlockByHash", - args: [req.blockHash, !!req.includeTransactions], - }; - } - break; - case "getTransaction": - return { - method: "xcb_getTransactionByHash", - args: [req.hash], - }; - case "getTransactionReceipt": - return { - method: "xcb_getTransactionReceipt", - args: [req.hash], - }; - case "call": - return { - method: "xcb_call", - args: [this.getRpcTransaction(req.transaction), req.blockTag], - }; - case "estimateEnergy": { - return { - method: "xcb_estimateEnergy", - args: [this.getRpcTransaction(req.transaction)], - }; - } - case "getLogs": - if (req.filter && req.filter.address != null) { - if (Array.isArray(req.filter.address)) { - req.filter.address = req.filter.address.map(getLowerCase); - } - else { - req.filter.address = getLowerCase(req.filter.address); - } - } - return { method: "xcb_getLogs", args: [req.filter] }; - } - return null; - } - /** - * Returns an CoreBC-style Error for the given JSON-RPC error - * %%payload%%, coalescing the various strings and error shapes - * that different nodes return, coercing them into a machine-readable - * standardized error. - */ - getRpcError(payload, _error) { - const { method } = payload; - const { error } = _error; - if (method === "xcb_estimateEnergy" && error.message) { - const msg = error.message; - if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) { - return (0, index_js_4.makeError)("insufficient funds", "INSUFFICIENT_FUNDS", { - transaction: payload.params[0], - info: { payload, error }, - }); - } - } - if (method === "xcb_call" || method === "xcb_estimateEnergy") { - const result = spelunkData(error); - const e = index_js_1.AbiCoder.getBuiltinCallException(method === "xcb_call" ? "call" : "estimateEnergy", payload.params[0], result ? result.data : null); - e.info = { error, payload }; - return e; - } - // Only estimateEnergy and call can return arbitrary contract-defined text, so now we - // we can process text safely. - const message = JSON.stringify(spelunkMessage(error)); - if (typeof error.message === "string" && - error.message.match(/user denied|corebc-user-denied/i)) { - const actionMap = { - xcb_sign: "signMessage", - personal_sign: "signMessage", - xcb_signTypedData_v4: "signTypedData", - xcb_signTransaction: "signTransaction", - xcb_sendTransaction: "sendTransaction", - xcb_requestAccounts: "requestAccess", - wallet_requestAccounts: "requestAccess", - }; - return (0, index_js_4.makeError)(`user rejected action`, "ACTION_REJECTED", { - action: actionMap[method] || "unknown", - reason: "rejected", - info: { payload, error }, - }); - } - if (method === "xcb_sendRawTransaction" || - method === "xcb_sendTransaction") { - const transaction = payload.params[0]; - if (message.match(/insufficient funds|base fee exceeds energy limit/i)) { - return (0, index_js_4.makeError)("insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { - transaction, - info: { error }, - }); - } - if (message.match(/nonce/i) && message.match(/too low/i)) { - return (0, index_js_4.makeError)("nonce has already been used", "NONCE_EXPIRED", { - transaction, - info: { error }, - }); - } - // "replacement transaction underpriced" - if (message.match(/replacement transaction/i) && - message.match(/underpriced/i)) { - return (0, index_js_4.makeError)("replacement fee too low", "REPLACEMENT_UNDERPRICED", { - transaction, - info: { error }, - }); - } - if (message.match(/only replay-protected/i)) { - return (0, index_js_4.makeError)("legacy pre-eip-155 transactions not supported", "UNSUPPORTED_OPERATION", { - operation: method, - info: { transaction, info: { error } }, - }); - } - } - if (message.match(/the method .* does not exist/i)) { - return (0, index_js_4.makeError)("unsupported operation", "UNSUPPORTED_OPERATION", { - operation: payload.method, - info: { error }, - }); - } - return (0, index_js_4.makeError)("could not coalesce error", "UNKNOWN_ERROR", { error }); - } - /** - * Requests the %%method%% with %%params%% via the JSON-RPC protocol - * over the underlying channel. This can be used to call methods - * on the backend that do not have a high-level API within the Provider - * API. - * - * This method queues requests according to the batch constraints - * in the options, assigns the request a unique ID. - * - * **Do NOT override** this method in sub-classes; instead - * override [[_send]] or force the options values in the - * call to the constructor to modify this method's behavior. - */ - send(method, params) { - // @TODO: cache networkId?? purge on switch_networks - const id = this.#nextId++; - const promise = new Promise((resolve, reject) => { - this.#payloads.push({ - resolve, - reject, - payload: { method, params, id, jsonrpc: "2.0" }, - }); - }); - // If there is not a pending drainTimer, set one - this.#scheduleDrain(); - return promise; - } - /** - * Resolves to the [[Signer]] account for %%address%% managed by - * the client. - * - * If the %%address%% is a number, it is used as an index in the - * the accounts from [[listAccounts]]. - * - * This can only be used on clients which manage accounts (such as - * Geth with imported account or MetaMask). - * - * Throws if the account doesn't exist. - */ - async getSigner(address) { - if (address == null) { - address = 0; - } - const accountsPromise = this.send("xcb_accounts", []); - // Account index - if (typeof address === "number") { - const accounts = await accountsPromise; - if (address >= accounts.length) { - throw new Error("no such account"); - } - return new JsonRpcSigner(this, accounts[address]); - } - const { accounts } = await (0, index_js_4.resolveProperties)({ - network: this.getNetwork(), - accounts: accountsPromise, - }); - // Account address - address = (0, index_js_2.getAddress)(address); - for (const account of accounts) { - if ((0, index_js_2.getAddress)(account) === address) { - return new JsonRpcSigner(this, address); - } - } - throw new Error("invalid account"); - } - async listAccounts() { - const accounts = await this.send("xcb_accounts", []); - return accounts.map((a) => new JsonRpcSigner(this, a)); - } -} -exports.JsonRpcApiProvider = JsonRpcApiProvider; -class JsonRpcApiPollingProvider extends JsonRpcApiProvider { - #pollingInterval; - constructor(network, options) { - super(network, options); - this.#pollingInterval = 4000; - } - _getSubscriber(sub) { - const subscriber = super._getSubscriber(sub); - if (isPollable(subscriber)) { - subscriber.pollingInterval = this.#pollingInterval; - } - return subscriber; - } - /** - * The polling interval (default: 4000 ms) - */ - get pollingInterval() { - return this.#pollingInterval; - } - set pollingInterval(value) { - if (!Number.isInteger(value) || value < 0) { - throw new Error("invalid interval"); - } - this.#pollingInterval = value; - this._forEachSubscriber((sub) => { - if (isPollable(sub)) { - sub.pollingInterval = this.#pollingInterval; - } - }); - } -} -exports.JsonRpcApiPollingProvider = JsonRpcApiPollingProvider; -/** - * The JsonRpcProvider is one of the most common Providers, - * which performs all operations over HTTP (or HTTPS) requests. - * - * Events are processed by polling the backend for the current block - * number; when it advances, all block-base events are then checked - * for updates. - */ -class JsonRpcProvider extends JsonRpcApiPollingProvider { - #connect; - constructor(url, network, options) { - if (url == null) { - url = "http://localhost:8545"; - } - super(network, options); - if (typeof url === "string") { - this.#connect = new index_js_4.FetchRequest(url); - } - else { - this.#connect = url.clone(); - } - } - _getConnection() { - return this.#connect.clone(); - } - async send(method, params) { - // All requests are over HTTP, so we can just start handling requests - // We do this here rather than the constructor so that we don't send any - // requests to the network (i.e. xcb_networkId) until we absolutely have to. - await this._start(); - return await super.send(method, params); - } - async _send(payload) { - // Configure a POST connection for the requested method - const request = this._getConnection(); - request.body = JSON.stringify(payload); - request.setHeader("content-type", "application/json"); - const response = await request.send(); - response.assertOk(); - let resp = response.bodyJson; - if (!Array.isArray(resp)) { - resp = [resp]; - } - return resp; - } -} -exports.JsonRpcProvider = JsonRpcProvider; -function spelunkData(value) { - if (value == null) { - return null; - } - // These *are* the droids we're looking for. - if (typeof value.message === "string" && - value.message.match("reverted") && - (0, index_js_4.isHexString)(value.data)) { - return { message: value.message, data: value.data }; - } - // Spelunk further... - if (typeof value === "object") { - for (const key in value) { - const result = spelunkData(value[key]); - if (result) { - return result; - } - } - return null; - } - // Might be a JSON string we can further descend... - if (typeof value === "string") { - try { - return spelunkData(JSON.parse(value)); - } - catch (error) { } - } - return null; -} -function _spelunkMessage(value, result) { - if (value == null) { - return; - } - // These *are* the droids we're looking for. - if (typeof value.message === "string") { - result.push(value.message); - } - // Spelunk further... - if (typeof value === "object") { - for (const key in value) { - _spelunkMessage(value[key], result); - } - } - // Might be a JSON string we can further descend... - if (typeof value === "string") { - try { - return _spelunkMessage(JSON.parse(value), result); - } - catch (error) { } - } -} -function spelunkMessage(value) { - const result = []; - _spelunkMessage(value, result); - return result; -} -//# sourceMappingURL=provider-jsonrpc.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-jsonrpc.js.map b/lib.commonjs/providers/provider-jsonrpc.js.map deleted file mode 100644 index f3641223c..000000000 --- a/lib.commonjs/providers/provider-jsonrpc.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-jsonrpc.js","sourceRoot":"","sources":["../../src.ts/providers/provider-jsonrpc.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,SAAS;AACT,yBAAyB;AAEzB,8CAA2C;AAC3C,kDAAiD;AAEjD,+CAAoD;AACpD,gDAY2B;AAE3B,iEAA+E;AAC/E,6DAAsD;AACtD,6CAAuC;AACvC,qEAGkC;AAClC,mEAAiE;AAiBjE,oDAAsD;AAItD,MAAM,SAAS,GAAG,8CAA8C,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC7E,gDAAgD;AAChD,SAAS,QAAQ,CAAU,KAAQ;IACjC,IAAI,KAAK,IAAI,IAAI,IAAI,SAAS,CAAC,OAAO,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE;QACzD,OAAO,KAAK,CAAC;KACd;IAED,uBAAuB;IACvB,IAAI,OAAa,KAAM,CAAC,UAAU,KAAK,UAAU,EAAE;QACjD,OAAO,KAAK,CAAC;KACd;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,OAAY,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;KACjC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAC9B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACb,KAAK,CAAC,GAAG,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CAAC,CAAC;YACvC,IAAI,MAAM,EAAE;gBACV,OAAO,MAAM,CAAC;aACf;SACF;QACD,OAAO,IAAI,CAAC;KACb;IAED,mDAAmD;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,IAAI;YACF,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;SACvC;QAAC,OAAO,KAAK,EAAE,GAAE;KACnB;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,eAAe,CAAC,KAAU,EAAE,MAAqB;IACxD,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO;KACR;IAED,4CAA4C;IAC5C,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE;QACrC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC5B;IAED,qBAAqB;IACrB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;YACvB,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;SACrC;KACF;IAED,mDAAmD;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,IAAI;YACF,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;SACnD;QAAC,OAAO,KAAK,EAAE,GAAE;KACnB;AACH,CAAC;AAED,SAAS,cAAc,CAAC,KAAU;IAChC,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-pocket.d.ts b/lib.commonjs/providers/provider-pocket.d.ts deleted file mode 100644 index 01b2fd311..000000000 --- a/lib.commonjs/providers/provider-pocket.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * [[link-pocket]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Polygon (``matic``) - * - Arbitrum (``arbitrum``) - * - * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] - */ -import { FetchRequest } from "../utils/index.js"; -import { AbstractProvider } from "./abstract-provider.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -/** - * The **PocketProvider** connects to the [[link-pocket]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-pocket-signup). - */ -export declare class PocketProvider extends JsonRpcProvider implements CommunityResourcable { - /** - * The Application ID for the Pocket connection. - */ - readonly applicationId: string; - /** - * The Application Secret for making authenticated requests - * to the Pocket connection. - */ - readonly applicationSecret: null | string; - /** - * Create a new **PocketProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network?: Networkish, applicationId?: null | string, applicationSecret?: null | string); - _getProvider(networkId: number): AbstractProvider; - /** - * Returns a prepared request for connecting to %%network%% with - * %%applicationId%%. - */ - static getRequest(network: Network, applicationId?: null | string, applicationSecret?: null | string): FetchRequest; - isCommunityResource(): boolean; -} -//# sourceMappingURL=provider-pocket.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-pocket.d.ts.map b/lib.commonjs/providers/provider-pocket.d.ts.map deleted file mode 100644 index fc500ed76..000000000 --- a/lib.commonjs/providers/provider-pocket.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-pocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-pocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAoB/C;;;;;;;;GAQG;AACH,qBAAa,cACX,SAAQ,eACR,YAAW,oBAAoB;IAE/B;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAG,MAAM,CAAC;IAEhC;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAG,IAAI,GAAG,MAAM,CAAC;IAE3C;;;;;OAKG;gBAED,QAAQ,CAAC,EAAE,UAAU,EACrB,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,EAC7B,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM;IA4BnC,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAWjD;;;OAGG;IACH,MAAM,CAAC,UAAU,CACf,OAAO,EAAE,OAAO,EAChB,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,EAC7B,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM,GAChC,YAAY;IAwBf,mBAAmB,IAAI,OAAO;CAG/B"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-pocket.js b/lib.commonjs/providers/provider-pocket.js deleted file mode 100644 index 30b43b67f..000000000 --- a/lib.commonjs/providers/provider-pocket.js +++ /dev/null @@ -1,112 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PocketProvider = void 0; -/** - * [[link-pocket]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Polygon (``matic``) - * - Arbitrum (``arbitrum``) - * - * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] - */ -const index_js_1 = require("../utils/index.js"); -const community_js_1 = require("./community.js"); -const network_js_1 = require("./network.js"); -const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); -const defaultApplicationId = "62e1ad51b37b8e00394bda3b"; -function getHost(name) { - switch (name) { - case "mainnet": - return "eth-mainnet.gateway.pokt.network"; - case "goerli": - return "eth-goerli.gateway.pokt.network"; - case "matic": - return "poly-mainnet.gateway.pokt.network"; - case "matic-mumbai": - return "polygon-mumbai-rpc.gateway.pokt.network"; - } - (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); -} -/** - * The **PocketProvider** connects to the [[link-pocket]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-pocket-signup). - */ -class PocketProvider extends provider_jsonrpc_js_1.JsonRpcProvider { - /** - * The Application ID for the Pocket connection. - */ - applicationId; - /** - * The Application Secret for making authenticated requests - * to the Pocket connection. - */ - applicationSecret; - /** - * Create a new **PocketProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network, applicationId, applicationSecret) { - if (_network == null) { - _network = "mainnet"; - } - const network = network_js_1.Network.from(_network); - if (applicationId == null) { - applicationId = defaultApplicationId; - } - if (applicationSecret == null) { - applicationSecret = null; - } - const options = { staticNetwork: network }; - const request = PocketProvider.getRequest(network, applicationId, applicationSecret); - super(request, network, options); - (0, index_js_1.defineProperties)(this, { - applicationId, - applicationSecret, - }); - } - _getProvider(networkId) { - try { - return new PocketProvider(networkId, this.applicationId, this.applicationSecret); - } - catch (error) { } - return super._getProvider(networkId); - } - /** - * Returns a prepared request for connecting to %%network%% with - * %%applicationId%%. - */ - static getRequest(network, applicationId, applicationSecret) { - if (applicationId == null) { - applicationId = defaultApplicationId; - } - const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`); - request.allowGzip = true; - if (applicationSecret) { - request.setCredentials("", applicationSecret); - } - if (applicationId === defaultApplicationId) { - request.retryFunc = async (request, response, attempt) => { - (0, community_js_1.showThrottleMessage)("PocketProvider"); - return true; - }; - } - return request; - } - isCommunityResource() { - return this.applicationId === defaultApplicationId; - } -} -exports.PocketProvider = PocketProvider; -//# sourceMappingURL=provider-pocket.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-pocket.js.map b/lib.commonjs/providers/provider-pocket.js.map deleted file mode 100644 index 59750bc71..000000000 --- a/lib.commonjs/providers/provider-pocket.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-pocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-pocket.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,gDAI2B;AAG3B,iDAAqD;AACrD,6CAAuC;AACvC,+DAAwD;AAKxD,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAExD,SAAS,OAAO,CAAC,IAAY;IAC3B,QAAQ,IAAI,EAAE;QACZ,KAAK,SAAS;YACZ,OAAO,kCAAkC,CAAC;QAC5C,KAAK,QAAQ;YACX,OAAO,iCAAiC,CAAC;QAE3C,KAAK,OAAO;YACV,OAAO,mCAAmC,CAAC;QAC7C,KAAK,cAAc;YACjB,OAAO,yCAAyC,CAAC;KACpD;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAa,cACX,SAAQ,qCAAe;IAGvB;;OAEG;IACM,aAAa,CAAU;IAEhC;;;OAGG;IACM,iBAAiB,CAAiB;IAE3C;;;;;OAKG;IACH,YACE,QAAqB,EACrB,aAA6B,EAC7B,iBAAiC;QAEjC,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,SAAS,CAAC;SACtB;QACD,MAAM,OAAO,GAAG,oBAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC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A,kCAAmB,EAAC,gBAAgB,CAAC,CAAC;gBACtC,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;SACH;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,mBAAmB;QACjB,OAAO,IAAI,CAAC,aAAa,KAAK,oBAAoB,CAAC;IACrD,CAAC;CACF;AAlGD,wCAkGC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-quicknode.d.ts b/lib.commonjs/providers/provider-quicknode.d.ts deleted file mode 100644 index 610dc234a..000000000 --- a/lib.commonjs/providers/provider-quicknode.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * [[link-quicknode]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Arbitrum (``arbitrum``) - * - Arbitrum Goerli Testnet (``arbitrum-goerli``) - * - Optimism (``optimism``) - * - Optimism Goerli Testnet (``optimism-goerli``) - * - Polygon (``matic``) - * - Polygon Mumbai Testnet (``matic-mumbai``) - * - * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] - */ -import { FetchRequest } from "../utils/index.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { AbstractProvider } from "./abstract-provider.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -/** - * The **QuickNodeProvider** connects to the [[link-quicknode]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API token is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-quicknode). - */ -export declare class QuickNodeProvider extends JsonRpcProvider implements CommunityResourcable { - /** - * The API token. - */ - readonly token: string; - /** - * Creates a new **QuickNodeProvider**. - */ - constructor(_network?: Networkish, token?: null | string); - _getProvider(networkId: number): AbstractProvider; - isCommunityResource(): boolean; - /** - * Returns a new request prepared for %%network%% and the - * %%token%%. - */ - static getRequest(network: Network, token?: null | string): FetchRequest; -} -//# sourceMappingURL=provider-quicknode.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-quicknode.d.ts.map b/lib.commonjs/providers/provider-quicknode.d.ts.map deleted file mode 100644 index 8b27f9f9d..000000000 --- a/lib.commonjs/providers/provider-quicknode.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-quicknode.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-quicknode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAEL,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA0B/C;;;;;;;;GAQG;AACH,qBAAa,iBACX,SAAQ,eACR,YAAW,oBAAoB;IAE/B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAG,MAAM,CAAC;IAExB;;OAEG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM;IAexD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAOjD,mBAAmB,IAAI,OAAO;IAI9B;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;CAoBzE"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-quicknode.js b/lib.commonjs/providers/provider-quicknode.js deleted file mode 100644 index 517feb28c..000000000 --- a/lib.commonjs/providers/provider-quicknode.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; -/** - * [[link-quicknode]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Arbitrum (``arbitrum``) - * - Arbitrum Goerli Testnet (``arbitrum-goerli``) - * - Optimism (``optimism``) - * - Optimism Goerli Testnet (``optimism-goerli``) - * - Polygon (``matic``) - * - Polygon Mumbai Testnet (``matic-mumbai``) - * - * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.QuickNodeProvider = void 0; -const index_js_1 = require("../utils/index.js"); -const community_js_1 = require("./community.js"); -const network_js_1 = require("./network.js"); -const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); -const defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb"; -function getHost(name) { - switch (name) { - case "mainnet": - return "corebc.quiknode.pro"; - case "arbitrum": - return "corebc.arbitrum-mainnet.quiknode.pro"; - case "arbitrum-goerli": - return "corebc.arbitrum-goerli.quiknode.pro"; - case "matic": - return "corebc.matic.quiknode.pro"; - case "matic-mumbai": - return "corebc.matic-testnet.quiknode.pro"; - case "optimism": - return "corebc.optimism.quiknode.pro"; - case "optimism-goerli": - return "corebc.optimism-goerli.quiknode.pro"; - } - (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); -} -/** - * The **QuickNodeProvider** connects to the [[link-quicknode]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API token is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-quicknode). - */ -class QuickNodeProvider extends provider_jsonrpc_js_1.JsonRpcProvider { - /** - * The API token. - */ - token; - /** - * Creates a new **QuickNodeProvider**. - */ - constructor(_network, token) { - if (_network == null) { - _network = "mainnet"; - } - const network = network_js_1.Network.from(_network); - if (token == null) { - token = defaultToken; - } - const request = QuickNodeProvider.getRequest(network, token); - super(request, network, { staticNetwork: network }); - (0, index_js_1.defineProperties)(this, { token }); - } - _getProvider(networkId) { - try { - return new QuickNodeProvider(networkId, this.token); - } - catch (error) { } - return super._getProvider(networkId); - } - isCommunityResource() { - return this.token === defaultToken; - } - /** - * Returns a new request prepared for %%network%% and the - * %%token%%. - */ - static getRequest(network, token) { - if (token == null) { - token = defaultToken; - } - const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/${token}`); - request.allowGzip = true; - //if (projectSecret) { request.setCredentials("", projectSecret); } - if (token === defaultToken) { - request.retryFunc = async (request, response, attempt) => { - (0, community_js_1.showThrottleMessage)("QuickNodeProvider"); - return true; - }; - } - return request; - } -} -exports.QuickNodeProvider = QuickNodeProvider; -//# sourceMappingURL=provider-quicknode.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-quicknode.js.map b/lib.commonjs/providers/provider-quicknode.js.map deleted file mode 100644 index 102684f56..000000000 --- a/lib.commonjs/providers/provider-quicknode.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-quicknode.js","sourceRoot":"","sources":["../../src.ts/providers/provider-quicknode.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,gDAI2B;AAE3B,iDAAqD;AACrD,6CAAuC;AACvC,+DAAwD;AAMxD,MAAM,YAAY,GAAG,0CAA0C,CAAC;AAEhE,SAAS,OAAO,CAAC,IAAY;IAC3B,QAAQ,IAAI,EAAE;QACZ,KAAK,SAAS;YACZ,OAAO,qBAAqB,CAAC;QAE/B,KAAK,UAAU;YACb,OAAO,sCAAsC,CAAC;QAChD,KAAK,iBAAiB;YACpB,OAAO,qCAAqC,CAAC;QAC/C,KAAK,OAAO;YACV,OAAO,2BAA2B,CAAC;QACrC,KAAK,cAAc;YACjB,OAAO,mCAAmC,CAAC;QAC7C,KAAK,UAAU;YACb,OAAO,8BAA8B,CAAC;QACxC,KAAK,iBAAiB;YACpB,OAAO,qCAAqC,CAAC;KAChD;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,qBAAqB,EAA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,IAAI,KAAK,KAAK,YAAY,EAAE;YAC1B,OAAO,CAAC,SAAS,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACvD,IAAA,kCAAmB,EAAC,mBAAmB,CAAC,CAAC;gBACzC,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;SACH;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA9DD,8CA8DC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-socket.d.ts b/lib.commonjs/providers/provider-socket.d.ts deleted file mode 100644 index 7ee5054ce..000000000 --- a/lib.commonjs/providers/provider-socket.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Generic long-lived socket provider. - * - * Sub-classing notes - * - a sub-class MUST call the `_start()` method once connected - * - a sub-class MUST override the `_write(string)` method - * - a sub-class MUST call `_processMessage(string)` for each message - * - * @_subsection: api/providers/abstract-provider - */ -import { JsonRpcApiProvider } from "./provider-jsonrpc.js"; -import type { Subscriber, Subscription } from "./abstract-provider.js"; -import type { EventFilter } from "./provider.js"; -import type { JsonRpcError, JsonRpcPayload, JsonRpcResult } from "./provider-jsonrpc.js"; -import type { Networkish } from "./network.js"; -export declare class SocketSubscriber implements Subscriber { - #private; - get filter(): Array; - constructor(provider: SocketProvider, filter: Array); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; - _handleMessage(message: any): void; - _emit(provider: SocketProvider, message: any): Promise; -} -export declare class SocketBlockSubscriber extends SocketSubscriber { - constructor(provider: SocketProvider); - _emit(provider: SocketProvider, message: any): Promise; -} -export declare class SocketPendingSubscriber extends SocketSubscriber { - constructor(provider: SocketProvider); - _emit(provider: SocketProvider, message: any): Promise; -} -export declare class SocketEventSubscriber extends SocketSubscriber { - #private; - get logFilter(): EventFilter; - constructor(provider: SocketProvider, filter: EventFilter); - _emit(provider: SocketProvider, message: any): Promise; -} -/** - * SocketProvider... - * - */ -export declare class SocketProvider extends JsonRpcApiProvider { - #private; - constructor(network?: Networkish); - _getSubscriber(sub: Subscription): Subscriber; - _register(filterId: number | string, subscriber: SocketSubscriber): void; - _send(payload: JsonRpcPayload | Array): Promise>; - _processMessage(message: string): Promise; - _write(message: string): Promise; -} -//# sourceMappingURL=provider-socket.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-socket.d.ts.map b/lib.commonjs/providers/provider-socket.d.ts.map deleted file mode 100644 index bdbc5029a..000000000 --- a/lib.commonjs/providers/provider-socket.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-socket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU/C,qBAAa,gBAAiB,YAAW,UAAU;;IAIjD,IAAI,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAEvB;gBAOW,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC;IAQxD,KAAK,IAAI,IAAI;IASb,IAAI,IAAI,IAAI;IASZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAUtC,MAAM,IAAI,IAAI;IAId,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI;IAqB5B,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE;AAED,qBAAa,qBAAsB,SAAQ,gBAAgB;gBAC7C,QAAQ,EAAE,cAAc;IAI9B,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE;AAED,qBAAa,uBAAwB,SAAQ,gBAAgB;gBAC/C,QAAQ,EAAE,cAAc;IAI9B,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE;AAED,qBAAa,qBAAsB,SAAQ,gBAAgB;;IAEzD,IAAI,SAAS,IAAI,WAAW,CAE3B;gBAEW,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW;IAKnD,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAMnE;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,kBAAkB;;gBAiBxC,OAAO,CAAC,EAAE,UAAU;IAiBhC,cAAc,CAAC,GAAG,EAAE,YAAY,GAAG,UAAU;IAoB7C,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,gBAAgB,GAAG,IAAI;IAWlE,KAAK,CACT,OAAO,EAAE,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAC9C,OAAO,CAAC,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC,CAAC;IAyCzC,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoC/C,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-socket.js b/lib.commonjs/providers/provider-socket.js deleted file mode 100644 index ad8dfce7a..000000000 --- a/lib.commonjs/providers/provider-socket.js +++ /dev/null @@ -1,233 +0,0 @@ -"use strict"; -/** - * Generic long-lived socket provider. - * - * Sub-classing notes - * - a sub-class MUST call the `_start()` method once connected - * - a sub-class MUST override the `_write(string)` method - * - a sub-class MUST call `_processMessage(string)` for each message - * - * @_subsection: api/providers/abstract-provider - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SocketProvider = exports.SocketEventSubscriber = exports.SocketPendingSubscriber = exports.SocketBlockSubscriber = exports.SocketSubscriber = void 0; -const abstract_provider_js_1 = require("./abstract-provider.js"); -const index_js_1 = require("../utils/index.js"); -const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); -class SocketSubscriber { - #provider; - #filter; - get filter() { - return JSON.parse(this.#filter); - } - #filterId; - #paused; - #emitPromise; - constructor(provider, filter) { - this.#provider = provider; - this.#filter = JSON.stringify(filter); - this.#filterId = null; - this.#paused = null; - this.#emitPromise = null; - } - start() { - this.#filterId = this.#provider - .send("xcb_subscribe", this.filter) - .then((filterId) => { - this.#provider._register(filterId, this); - return filterId; - }); - } - stop() { - this.#filterId.then((filterId) => { - this.#provider.send("xcb_unsubscribe", [filterId]); - }); - this.#filterId = null; - } - // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs - // and resume - pause(dropWhilePaused) { - (0, index_js_1.assert)(dropWhilePaused, "preserve logs while paused not supported by SocketSubscriber yet", "UNSUPPORTED_OPERATION", { operation: "pause(false)" }); - this.#paused = !!dropWhilePaused; - } - resume() { - this.#paused = null; - } - _handleMessage(message) { - if (this.#filterId == null) { - return; - } - if (this.#paused === null) { - let emitPromise = this.#emitPromise; - if (emitPromise == null) { - emitPromise = this._emit(this.#provider, message); - } - else { - emitPromise = emitPromise.then(async () => { - await this._emit(this.#provider, message); - }); - } - this.#emitPromise = emitPromise.then(() => { - if (this.#emitPromise === emitPromise) { - this.#emitPromise = null; - } - }); - } - } - async _emit(provider, message) { - throw new Error("sub-classes must implemente this; _emit"); - } -} -exports.SocketSubscriber = SocketSubscriber; -class SocketBlockSubscriber extends SocketSubscriber { - constructor(provider) { - super(provider, ["newHeads"]); - } - async _emit(provider, message) { - provider.emit("block", parseInt(message.number)); - } -} -exports.SocketBlockSubscriber = SocketBlockSubscriber; -class SocketPendingSubscriber extends SocketSubscriber { - constructor(provider) { - super(provider, ["newPendingTransactions"]); - } - async _emit(provider, message) { - provider.emit("pending", message); - } -} -exports.SocketPendingSubscriber = SocketPendingSubscriber; -class SocketEventSubscriber extends SocketSubscriber { - #logFilter; - get logFilter() { - return JSON.parse(this.#logFilter); - } - constructor(provider, filter) { - super(provider, ["logs", filter]); - this.#logFilter = JSON.stringify(filter); - } - async _emit(provider, message) { - provider.emit(this.logFilter, provider._wrapLog(message, provider._network)); - } -} -exports.SocketEventSubscriber = SocketEventSubscriber; -/** - * SocketProvider... - * - */ -class SocketProvider extends provider_jsonrpc_js_1.JsonRpcApiProvider { - #callbacks; - // Maps each filterId to its subscriber - #subs; - // If any events come in before a subscriber has finished - // registering, queue them - #pending; - constructor(network) { - super(network, { batchMaxCount: 1 }); - this.#callbacks = new Map(); - this.#subs = new Map(); - this.#pending = new Map(); - } - // This value is only valid after _start has been called - /* - get _network(): Network { - if (this.#network == null) { - throw new Error("this shouldn't happen"); - } - return this.#network.clone(); - } - */ - _getSubscriber(sub) { - switch (sub.type) { - case "close": - return new abstract_provider_js_1.UnmanagedSubscriber("close"); - case "block": - return new SocketBlockSubscriber(this); - case "pending": - return new SocketPendingSubscriber(this); - case "event": - return new SocketEventSubscriber(this, sub.filter); - case "orphan": - // Handled auto-matically within AbstractProvider - // when the log.removed = true - if (sub.filter.orphan === "drop-log") { - return new abstract_provider_js_1.UnmanagedSubscriber("drop-log"); - } - } - return super._getSubscriber(sub); - } - _register(filterId, subscriber) { - this.#subs.set(filterId, subscriber); - const pending = this.#pending.get(filterId); - if (pending) { - for (const message of pending) { - subscriber._handleMessage(message); - } - this.#pending.delete(filterId); - } - } - async _send(payload) { - // WebSocket provider doesn't accept batches - (0, index_js_1.assertArgument)(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload); - // @TODO: stringify payloads here and store to prevent mutations - // Prepare a promise to respond to - const promise = new Promise((resolve, reject) => { - this.#callbacks.set(payload.id, { payload, resolve, reject }); - }); - // Wait until the socket is connected before writing to it - await this._waitUntilReady(); - // Write the request to the socket - await this._write(JSON.stringify(payload)); - return [await promise]; - } - // Sub-classes must call this once they are connected - /* - async _start(): Promise { - if (this.#ready) { return; } - - for (const { payload } of this.#callbacks.values()) { - await this._write(JSON.stringify(payload)); - } - - this.#ready = (async function() { - await super._start(); - })(); - } - */ - // Sub-classes must call this for each message - async _processMessage(message) { - const result = (JSON.parse(message)); - if ("id" in result) { - const callback = this.#callbacks.get(result.id); - if (callback == null) { - this.emit("error", (0, index_js_1.makeError)("received result for unknown id", "UNKNOWN_ERROR", { - reasonCode: "UNKNOWN_ID", - result, - })); - return; - } - this.#callbacks.delete(result.id); - callback.resolve(result); - } - else if (result.method === "xcb_subscription") { - const filterId = result.params.subscription; - const subscriber = this.#subs.get(filterId); - if (subscriber) { - subscriber._handleMessage(result.params.result); - } - else { - let pending = this.#pending.get(filterId); - if (pending == null) { - pending = []; - this.#pending.set(filterId, pending); - } - pending.push(result.params.result); - } - } - } - async _write(message) { - throw new Error("sub-classes must override this"); - } -} -exports.SocketProvider = SocketProvider; -//# sourceMappingURL=provider-socket.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-socket.js.map b/lib.commonjs/providers/provider-socket.js.map deleted file mode 100644 index a62d20d14..000000000 --- a/lib.commonjs/providers/provider-socket.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-socket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-socket.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,iEAA6D;AAC7D,gDAAsE;AACtE,+DAA2D;AAmB3D,MAAa,gBAAgB;IAC3B,SAAS,CAAiB;IAE1B,OAAO,CAAS;IAChB,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,SAAS,CAAkC;IAC3C,OAAO,CAAiB;IAExB,YAAY,CAAuB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,CAAC,CAAC;gBAC1C,IAAI,OAAO,IAAI,IAAI,EAAE;oBACnB,OAAO,GAAG,EAAE,CAAC;oBACb,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;iBACtC;gBACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;aACpC;SACF;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAe;QAC1B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;CACF;AAnJD,wCAmJC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-websocket.d.ts b/lib.commonjs/providers/provider-websocket.d.ts deleted file mode 100644 index 9938502d0..000000000 --- a/lib.commonjs/providers/provider-websocket.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { SocketProvider } from "./provider-socket.js"; -import type { Networkish } from "./network.js"; -export interface WebSocketLike { - onopen: null | ((...args: Array) => any); - onmessage: null | ((...args: Array) => any); - onerror: null | ((...args: Array) => any); - readyState: number; - send(payload: any): void; - close(code?: number, reason?: string): void; -} -export type WebSocketCreator = () => WebSocketLike; -export declare class WebSocketProvider extends SocketProvider { - #private; - get websocket(): WebSocketLike; - constructor(url: string | WebSocketLike | WebSocketCreator, network?: Networkish); - _write(message: string): Promise; - destroy(): Promise; -} -//# sourceMappingURL=provider-websocket.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-websocket.d.ts.map b/lib.commonjs/providers/provider-websocket.d.ts.map deleted file mode 100644 index a60b262ca..000000000 --- a/lib.commonjs/providers/provider-websocket.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-websocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-websocket.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IAC9C,SAAS,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IACjD,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IAE/C,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,aAAa,CAAC;AAEnD,qBAAa,iBAAkB,SAAQ,cAAc;;IAInD,IAAI,SAAS,IAAI,aAAa,CAK7B;gBAGC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,gBAAgB,EAC9C,OAAO,CAAC,EAAE,UAAU;IA8ChB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAO/B"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider-websocket.js b/lib.commonjs/providers/provider-websocket.js deleted file mode 100644 index 182470c1f..000000000 --- a/lib.commonjs/providers/provider-websocket.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WebSocketProvider = void 0; -const ws_js_1 = require("./ws.js"); /*-browser*/ -const provider_socket_js_1 = require("./provider-socket.js"); -class WebSocketProvider extends provider_socket_js_1.SocketProvider { - #connect; - #websocket; - get websocket() { - if (this.#websocket == null) { - throw new Error("websocket closed"); - } - return this.#websocket; - } - constructor(url, network) { - super(network); - if (typeof url === "string") { - this.#connect = () => { - return new ws_js_1.WebSocket(url); - }; - this.#websocket = this.#connect(); - } - else if (typeof url === "function") { - this.#connect = url; - this.#websocket = url(); - } - else { - this.#connect = null; - this.#websocket = url; - } - this.websocket.onopen = async () => { - try { - await this._start(); - this.resume(); - } - catch (error) { - console.log("failed to start WebsocketProvider", error); - // @TODO: now what? Attempt reconnect? - } - }; - this.websocket.onmessage = (message) => { - this._processMessage(message.data); - }; - /* - this.websocket.onclose = (event) => { - // @TODO: What event.code should we reconnect on? - const reconnect = false; - if (reconnect) { - this.pause(true); - if (this.#connect) { - this.#websocket = this.#connect(); - this.#websocket.onopen = ... - // @TODO: this requires the super class to rebroadcast; move it there - } - this._reconnect(); - } - }; - */ - } - async _write(message) { - this.websocket.send(message); - } - async destroy() { - if (this.#websocket != null) { - this.#websocket.close(); - this.#websocket = null; - } - super.destroy(); - } -} -exports.WebSocketProvider = WebSocketProvider; -//# sourceMappingURL=provider-websocket.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider-websocket.js.map b/lib.commonjs/providers/provider-websocket.js.map deleted file mode 100644 index ddeb9c7fc..000000000 --- a/lib.commonjs/providers/provider-websocket.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-websocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-websocket.ts"],"names":[],"mappings":";;;AAAA,mCAAkD,CAAC,YAAY;AAE/D,6DAAsD;AAiBtD,MAAa,iBAAkB,SAAQ,mCAAc;IACnD,QAAQ,CAA0B;IAElC,UAAU,CAAuB;IACjC,IAAI,SAAS;QACX,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;SACrC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,YACE,GAA8C,EAC9C,OAAoB;QAEpB,KAAK,CAAC,OAAO,CAAC,CAAC;Q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IAClB,CAAC;CACF;AAtED,8CAsEC"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider.d.ts b/lib.commonjs/providers/provider.d.ts deleted file mode 100644 index 68556f754..000000000 --- a/lib.commonjs/providers/provider.d.ts +++ /dev/null @@ -1,623 +0,0 @@ -import type { AddressLike, NameResolver } from "../address/index.js"; -import type { BigNumberish, EventEmitterable } from "../utils/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { ContractRunner } from "./contracts.js"; -import type { Network } from "./network.js"; -export type BlockTag = BigNumberish | string; -import { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; -/** - * A **FeeData** wraps all the fee-related values associated with - * the network. - */ -export declare class FeeData { - /** - * The energy price for legacy networks. - */ - readonly energyPrice: null | bigint; - constructor(energyPrice?: null | bigint); - /** - * Returns a JSON-friendly value. - */ - toJSON(): any; -} -export interface TransactionRequest { - type?: null | number; - to?: null | AddressLike; - from?: null | AddressLike; - nonce?: null | number; - energyLimit?: null | BigNumberish; - energyPrice?: null | BigNumberish; - data?: null | string; - value?: null | BigNumberish; - networkId?: null | BigNumberish; - customData?: any; - blockTag?: BlockTag; - enableCcipRead?: boolean; -} -export interface PreparedTransactionRequest { - to?: AddressLike; - from?: AddressLike; - nonce?: number; - energyLimit?: bigint; - energyPrice?: bigint; - data?: string; - value?: bigint; - networkId?: bigint; - customData?: any; - blockTag?: BlockTag; - enableCcipRead?: boolean; -} -export declare function copyRequest(req: TransactionRequest): PreparedTransactionRequest; -/** - * An Interface to indicate a [[Block]] has been included in the - * blockchain. This asserts a Type Guard that necessary properties - * are non-null. - * - * Before a block is included, it is a //pending// block. - */ -export interface MinedBlock extends Block { - readonly number: number; - readonly hash: string; - readonly timestamp: number; - readonly date: Date; - readonly miner: string; -} -/** - * A **Block** represents the data associated with a full block on - * Core. - */ -export declare class Block implements BlockParams, Iterable { - #private; - /** - * The provider connected to the block used to fetch additional details - * if necessary. - */ - readonly provider: Provider; - /** - * The block number, sometimes called the block height. This is a - * sequential number that is one higher than the parent block. - */ - readonly number: number; - /** - * The block hash. - */ - readonly hash: null | string; - /** - * The timestamp for this block, which is the number of seconds since - * epoch that this block was included. - */ - readonly timestamp: number; - /** - * The block hash of the parent block. - */ - readonly parentHash: string; - /** - * The nonce. - * - * On legacy networks, this is the random number inserted which - * permitted the difficulty target to be reached. - */ - readonly nonce: string; - /** - * The difficulty target. - * - * On legacy networks, this is the proof-of-work target required - * for a block to meet the protocol rules to be included. - * - * On modern networks, this is a random number arrived at using - * randao. @TODO: Find links? - */ - readonly difficulty: bigint; - /** - * The total energy limit for this block. - */ - readonly energyLimit: bigint; - /** - * The total energy used in this block. - */ - readonly energyUsed: bigint; - /** - * The miner coinbase address, wihch receives any subsidies for - * including this block. - */ - readonly miner: string; - /** - * Any extra data the validator wished to include. - */ - readonly extraData: string; - /** - * The base fee per energy that all transactions in this block were - * charged. - * - * This adjusts after each block, depending on how congested the network - * is. - */ - readonly baseFeePerEnergy: null | bigint; - /** - * Create a new **Block** object. - * - * This should generally not be necessary as the unless implementing a - * low-level library. - */ - constructor(block: BlockParams, provider: Provider); - /** - * Returns the list of transaction hashes. - */ - get transactions(): ReadonlyArray; - /** - * Returns the complete transactions for blocks which - * prefetched them, by passing ``true`` to %%prefetchTxs%% - * into [[provider_getBlock]]. - */ - get prefetchedTransactions(): Array; - /** - * Returns a JSON-friendly value. - */ - toJSON(): any; - [Symbol.iterator](): Iterator; - /** - * The number of transactions in this block. - */ - get length(): number; - /** - * The [[link-js-date]] this block was included at. - */ - get date(): null | Date; - /** - * Get the transaction at %%indexe%% within this block. - */ - getTransaction(indexOrHash: number | string): Promise; - getPrefetchedTransaction(indexOrHash: number | string): TransactionResponse; - /** - * Has this block been mined. - * - * If true, the block has been typed-gaurded that all mined - * properties are non-null. - */ - isMined(): this is MinedBlock; - /** - * - */ - isLondon(): this is Block & { - baseFeePerEnergy: bigint; - }; - orphanedEvent(): OrphanFilter; -} -export declare class Log implements LogParams { - readonly provider: Provider; - readonly transactionHash: string; - readonly blockHash: string; - readonly blockNumber: number; - readonly removed: boolean; - readonly address: string; - readonly data: string; - readonly topics: ReadonlyArray; - readonly index: number; - readonly transactionIndex: number; - constructor(log: LogParams, provider: Provider); - toJSON(): any; - getBlock(): Promise; - getTransaction(): Promise; - getTransactionReceipt(): Promise; - removedEvent(): OrphanFilter; -} -export declare class TransactionReceipt implements TransactionReceiptParams, Iterable { - #private; - readonly provider: Provider; - readonly to: null | string; - readonly from: string; - readonly contractAddress: null | string; - readonly hash: string; - readonly index: number; - readonly blockHash: string; - readonly blockNumber: number; - readonly logsBloom: string; - readonly energyUsed: bigint; - readonly cumulativeEnergyUsed: bigint; - readonly energyPrice: bigint; - readonly type: number; - readonly status: null | number; - readonly root: null | string; - constructor(tx: TransactionReceiptParams, provider: Provider); - get logs(): ReadonlyArray; - toJSON(): any; - get length(): number; - [Symbol.iterator](): Iterator; - get fee(): bigint; - getBlock(): Promise; - getTransaction(): Promise; - getResult(): Promise; - confirmations(): Promise; - removedEvent(): OrphanFilter; - reorderedEvent(other?: TransactionResponse): OrphanFilter; -} -export interface MinedTransactionResponse extends TransactionResponse { - blockNumber: number; - blockHash: string; - date: Date; -} -export declare class TransactionResponse implements TransactionLike, TransactionResponseParams { - #private; - /** - * The provider this is connected to, which will influence how its - * methods will resolve its async inspection methods. - */ - readonly provider: Provider; - /** - * The block number of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - readonly blockNumber: null | number; - /** - * The blockHash of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - readonly blockHash: null | string; - /** - * The index within the block that this transaction resides at. - */ - readonly index: number; - /** - * The transaction hash. - */ - readonly hash: string; - /** - * The [[link-eip-2718]] transaction envelope type. This is - * ``0`` for legacy transactions types. - */ - readonly type: number; - /** - * The receiver of this transaction. - * - * If ``null``, then the transaction is an initcode transaction. - * This means the result of executing the [[data]] will be deployed - * as a new contract on chain (assuming it does not revert) and the - * address may be computed using [[getCreateAddress]]. - */ - readonly to: null | string; - /** - * The sender of this transaction. It is implicitly computed - * from the transaction pre-image hash (as the digest) and the - * [[signature]] using ecrecover. - */ - readonly from: string; - /** - * The nonce, which is used to prevent replay attacks and offer - * a method to ensure transactions from a given sender are explicitly - * ordered. - * - * When sending a transaction, this must be equal to the number of - * transactions ever sent by [[from]]. - */ - readonly nonce: number; - /** - * The maximum units of energy this transaction can consume. If execution - * exceeds this, the entries transaction is reverted and the sender - * is charged for the full amount, despite not state changes being made. - */ - readonly energyLimit: bigint; - /** - * The energy price can have various values, depending on the network. - * - * In modern networks, for transactions that are included this is - * the //effective energy price// (the fee per energy that was actually - * charged), while for transactions that have not been included yet - * is the [[maxFeePerEnergy]]. - * - * For legacy transactions, or transactions on legacy networks, this - * is the fee that will be charged per unit of energy the transaction - * consumes. - */ - readonly energyPrice: bigint; - /** - * The data. - */ - readonly data: string; - /** - * The value, in ore. Use [[formatXCB]] to format this value - * as xcb. - */ - readonly value: bigint; - /** - * The chain ID. - */ - readonly networkId: bigint; - /** - * The signature. - */ - readonly signature: string; - /** - * Create a new TransactionResponse with %%tx%% parameters - * connected to %%provider%%. - */ - constructor(tx: TransactionResponseParams, provider: Provider); - /** - * Returns a JSON representation of this transaction. - */ - toJSON(): any; - /** - * Resolves to the Block that this transaction was included in. - * - * This will return null if the transaction has not been included yet. - */ - getBlock(): Promise; - /** - * Resolves to this transaction being re-requested from the - * provider. This can be used if you have an unmined transaction - * and wish to get an up-to-date populated instance. - */ - getTransaction(): Promise; - /** - * Resolves once this transaction has been mined and has - * %%confirms%% blocks including it (default: ``1``) with an - * optional %%timeout%%. - * - * This can resolve to ``null`` only if %%confirms%% is ``0`` - * and the transaction has not been mined, otherwise this will - * wait until enough confirmations have completed. - */ - wait(_confirms?: number, _timeout?: number): Promise; - /** - * Returns ``true`` if this transaction has been included. - * - * This is effective only as of the time the TransactionResponse - * was instantiated. To get up-to-date information, use - * [[getTransaction]]. - * - * This provides a Type Guard that this transaction will have - * non-null property values for properties that are null for - * unmined transactions. - */ - isMined(): this is MinedTransactionResponse; - /** - * Returns true if the transaction is a legacy (i.e. ``type == 0``) - * transaction. - * - * This provides a Type Guard that this transaction will have - * the ``null``-ness for hardfork-specific properties set correctly. - */ - isLegacy(): this is TransactionResponse & { - accessList: null; - maxFeePerEnergy: null; - maxPriorityFeePerEnergy: null; - }; - /** - * Returns a filter which can be used to listen for orphan events - * that evict this transaction. - */ - removedEvent(): OrphanFilter; - /** - * Returns a filter which can be used to listen for orphan events - * that re-order this event against %%other%%. - */ - reorderedEvent(other?: TransactionResponse): OrphanFilter; - /** - * Returns a new TransactionResponse instance which has the ability to - * detect (and throw an error) if the transaction is replaced, which - * will begin scanning at %%startBlock%%. - * - * This should generally not be used by developers and is intended - * primarily for internal use. Setting an incorrect %%startBlock%% can - * have devastating performance consequences if used incorrectly. - */ - replaceableTransaction(startBlock: number): TransactionResponse; -} -/** - * An Orphan Filter allows detecting when an orphan block has - * resulted in dropping a block or transaction or has resulted - * in transactions changing order. - * - * Not currently fully supported. - */ -export type OrphanFilter = { - orphan: "drop-block"; - hash: string; - number: number; -} | { - orphan: "drop-transaction"; - tx: { - hash: string; - blockHash: string; - blockNumber: number; - }; - other?: { - hash: string; - blockHash: string; - blockNumber: number; - }; -} | { - orphan: "reorder-transaction"; - tx: { - hash: string; - blockHash: string; - blockNumber: number; - }; - other?: { - hash: string; - blockHash: string; - blockNumber: number; - }; -} | { - orphan: "drop-log"; - log: { - transactionHash: string; - blockHash: string; - blockNumber: number; - address: string; - data: string; - topics: ReadonlyArray; - index: number; - }; -}; -/** - * A **TopicFilter** provides a struture to define bloom-filter - * queries. - * - * Each field that is ``null`` matches **any** value, a field that is - * a ``string`` must match exactly that value and and ``array`` is - * effectively an ``OR``-ed set, where any one of those values must - * match. - */ -export type TopicFilter = Array>; -export interface EventFilter { - address?: AddressLike | Array; - topics?: TopicFilter; -} -export interface Filter extends EventFilter { - fromBlock?: BlockTag; - toBlock?: BlockTag; -} -export interface FilterByBlockHash extends EventFilter { - blockHash?: string; -} -export type ProviderEvent = string | Array> | EventFilter | OrphanFilter; -/** - * A **Provider** is the primary method to interact with the read-only - * content on Core. - * - * It allows access to details about accounts, blocks and transactions - * and the ability to query event logs and simulate contract execution. - * - * Account data includes the [balance](getBalance), - * [transaction count](getTransactionCount), [code](getCode) and - * [state trie storage](getStorage). - * - * Simulating execution can be used to [call](call), - * [estimate energy](estimateEnergy) and - * [get transaction results](getTransactionResult). - * - * The [[broadcastTransaction]] is the only method which allows updating - * the blockchain, but it is usually accessed by a [[Signer]], since a - * private key must be used to sign the transaction before it can be - * broadcast. - */ -export interface Provider extends ContractRunner, EventEmitterable, NameResolver { - /** - * The provider iteself. - * - * This is part of the necessary API for executing a contract, as - * it provides a common property on any [[ContractRunner]] that - * can be used to access the read-only portion of the runner. - */ - provider: this; - /** - * Shutdown any resources this provider is using. No additional - * calls should be made to this provider after calling this. - */ - destroy(): void; - /** - * Get the current block number. - */ - getBlockNumber(): Promise; - /** - * Get the connected [[Network]]. - */ - getNetwork(): Promise; - /** - * Get the best guess at the recommended [[FeeData]]. - */ - getFeeData(): Promise; - /** - * Get the account balance (in ore) of %%address%%. If %%blockTag%% - * is specified and the node supports archive access for that - * %%blockTag%%, the balance is as of that [[BlockTag]]. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getBalance(address: AddressLike, blockTag?: BlockTag): Promise; - /** - * Get the number of transactions ever sent for %%address%%, which - * is used as the ``nonce`` when sending a transaction. If - * %%blockTag%% is specified and the node supports archive access - * for that %%blockTag%%, the transaction count is as of that - * [[BlockTag]]. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise; - /** - * Get the bytecode for %%address%%. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getCode(address: AddressLike, blockTag?: BlockTag): Promise; - /** - * Get the storage slot value for %%address%% at slot %%position%%. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getStorage(address: AddressLike, position: BigNumberish, blockTag?: BlockTag): Promise; - /** - * Estimates the amount of energy required to executre %%tx%%. - */ - estimateEnergy(tx: TransactionRequest): Promise; - /** - * Simulate the execution of %%tx%%. If the call reverts, it will - * throw a [[CallExceptionError]] which includes the revert data. - */ - call(tx: TransactionRequest): Promise; - /** - * Broadcasts the %%signedTx%% to the network, adding it to the - * memory pool of any node for which the transaction meets the - * rebroadcast requirements. - */ - broadcastTransaction(signedTx: string): Promise; - /** - * Resolves to the block for %%blockHashOrBlockTag%%. - * - * If %%prefetchTxs%%, and the backend supports including transactions - * with block requests, all transactions will be included and the - * [[Block]] object will not need to make remote calls for getting - * transactions. - */ - getBlock(blockHashOrBlockTag: BlockTag | string, prefetchTxs?: boolean): Promise; - /** - * Resolves to the transaction for %%hash%%. - * - * If the transaction is unknown or on pruning nodes which - * discard old transactions this resolves to ``null``. - */ - getTransaction(hash: string): Promise; - /** - * Resolves to the transaction receipt for %%hash%%, if mined. - * - * If the transaction has not been mined, is unknown or on - * pruning nodes which discard old transactions this resolves to - * ``null``. - */ - getTransactionReceipt(hash: string): Promise; - /** - * Resolves to the result returned by the executions of %%hash%%. - * - * This is only supported on nodes with archive access and with - * the necessary debug APIs enabled. - */ - getTransactionResult(hash: string): Promise; - /** - * Resolves to the list of Logs that match %%filter%% - */ - getLogs(filter: Filter | FilterByBlockHash): Promise>; - /** - * Resolves to the address configured for the %%ensName%% or - * ``null`` if unconfigured. - */ - /** - * Waits until the transaction %%hash%% is mined and has %%confirms%% - * confirmations. - */ - waitForTransaction(hash: string, confirms?: number, timeout?: number): Promise; - /** - * Resolves to the block at %%blockTag%% once it has been mined. - * - * This can be useful for waiting some number of blocks by using - * the ``currentBlockNumber + N``. - */ - waitForBlock(blockTag?: BlockTag): Promise; -} -//# sourceMappingURL=provider.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider.d.ts.map b/lib.commonjs/providers/provider.d.ts.map deleted file mode 100644 index fdfa52655..000000000 --- a/lib.commonjs/providers/provider.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,MAAM,CAAC;AAE7C,OAAO,EACL,WAAW,EACX,SAAS,EACT,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,iBAAiB,CAAC;AAoBzB;;;GAGG;AACH,qBAAa,OAAO;IAClB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAG,IAAI,GAAG,MAAM,CAAC;gBAEzB,WAAW,CAAC,EAAE,IAAI,GAAG,MAAM;IAMvC;;OAEG;IACH,MAAM,IAAI,GAAG;CAOd;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErB,EAAE,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC;IAE1B,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAEtB,WAAW,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAClC,WAAW,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAElC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM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AE,MAAM,GAAG,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAKjE;;;OAGG;IAEH;;;OAGG;IACH,kBAAkB,CAChB,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAC,CAAC;IAEtC;;;;;OAKG;IACH,YAAY,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CACnD"} \ No newline at end of file diff --git a/lib.commonjs/providers/provider.js b/lib.commonjs/providers/provider.js deleted file mode 100644 index b03c16be5..000000000 --- a/lib.commonjs/providers/provider.js +++ /dev/null @@ -1,957 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.Block = exports.copyRequest = exports.FeeData = void 0; -const index_js_1 = require("../utils/index.js"); -const BN_0 = BigInt(0); -// ----------------------- -function getValue(value) { - if (value == null) { - return null; - } - return value; -} -function toJson(value) { - if (value == null) { - return null; - } - return value.toString(); -} -// @TODO? implements Required -/** - * A **FeeData** wraps all the fee-related values associated with - * the network. - */ -class FeeData { - /** - * The energy price for legacy networks. - */ - energyPrice; - constructor(energyPrice) { - (0, index_js_1.defineProperties)(this, { - energyPrice: getValue(energyPrice), - }); - } - /** - * Returns a JSON-friendly value. - */ - toJSON() { - const { energyPrice } = this; - return { - _type: "FeeData", - energyPrice: toJson(energyPrice), - }; - } -} -exports.FeeData = FeeData; -function copyRequest(req) { - const result = {}; - // These could be addresses, ENS names or Addressables - if (req.to) { - result.to = req.to; - } - if (req.from) { - result.from = req.from; - } - if (req.data) { - result.data = (0, index_js_1.hexlify)(req.data); - } - const bigIntKeys = "networkId,energyLimit,energyPrice,value".split(/,/); - for (const key of bigIntKeys) { - if (!(key in req) || req[key] == null) { - continue; - } - result[key] = (0, index_js_1.getBigInt)(req[key], `request.${key}`); - } - const numberKeys = "type,nonce".split(/,/); - for (const key of numberKeys) { - if (!(key in req) || req[key] == null) { - continue; - } - result[key] = (0, index_js_1.getNumber)(req[key], `request.${key}`); - } - if ("blockTag" in req) { - result.blockTag = req.blockTag; - } - if ("enableCcipRead" in req) { - result.enableCcipReadEnabled = !!req.enableCcipRead; - } - if ("customData" in req) { - result.customData = req.customData; - } - return result; -} -exports.copyRequest = copyRequest; -/** - * A **Block** represents the data associated with a full block on - * Core. - */ -class Block { - /** - * The provider connected to the block used to fetch additional details - * if necessary. - */ - provider; - /** - * The block number, sometimes called the block height. This is a - * sequential number that is one higher than the parent block. - */ - number; - /** - * The block hash. - */ - hash; - /** - * The timestamp for this block, which is the number of seconds since - * epoch that this block was included. - */ - timestamp; - /** - * The block hash of the parent block. - */ - parentHash; - /** - * The nonce. - * - * On legacy networks, this is the random number inserted which - * permitted the difficulty target to be reached. - */ - nonce; - /** - * The difficulty target. - * - * On legacy networks, this is the proof-of-work target required - * for a block to meet the protocol rules to be included. - * - * On modern networks, this is a random number arrived at using - * randao. @TODO: Find links? - */ - difficulty; - /** - * The total energy limit for this block. - */ - energyLimit; - /** - * The total energy used in this block. - */ - energyUsed; - /** - * The miner coinbase address, wihch receives any subsidies for - * including this block. - */ - miner; - /** - * Any extra data the validator wished to include. - */ - extraData; - /** - * The base fee per energy that all transactions in this block were - * charged. - * - * This adjusts after each block, depending on how congested the network - * is. - */ - baseFeePerEnergy; - #transactions; - /** - * Create a new **Block** object. - * - * This should generally not be necessary as the unless implementing a - * low-level library. - */ - constructor(block, provider) { - this.#transactions = block.transactions.map((tx) => { - if (typeof tx !== "string") { - return new TransactionResponse(tx, provider); - } - return tx; - }); - (0, index_js_1.defineProperties)(this, { - provider, - hash: getValue(block.hash), - number: block.number, - timestamp: block.timestamp, - parentHash: block.parentHash, - nonce: block.nonce, - difficulty: block.difficulty, - energyLimit: block.energyLimit, - energyUsed: block.energyUsed, - miner: block.miner, - extraData: block.extraData, - baseFeePerEnergy: getValue(block.baseFeePerEnergy), - }); - } - /** - * Returns the list of transaction hashes. - */ - get transactions() { - return this.#transactions.map((tx) => { - if (typeof tx === "string") { - return tx; - } - return tx.hash; - }); - } - /** - * Returns the complete transactions for blocks which - * prefetched them, by passing ``true`` to %%prefetchTxs%% - * into [[provider_getBlock]]. - */ - get prefetchedTransactions() { - const txs = this.#transactions.slice(); - // Doesn't matter... - if (txs.length === 0) { - return []; - } - // Make sure we prefetched the transactions - (0, index_js_1.assert)(typeof txs[0] === "object", "transactions were not prefetched with block request", "UNSUPPORTED_OPERATION", { - operation: "transactionResponses()", - }); - return txs; - } - /** - * Returns a JSON-friendly value. - */ - toJSON() { - const { baseFeePerEnergy, difficulty, extraData, energyLimit, energyUsed, hash, miner, nonce, number, parentHash, timestamp, transactions, } = this; - return { - _type: "Block", - baseFeePerEnergy: toJson(baseFeePerEnergy), - difficulty: toJson(difficulty), - extraData, - energyLimit: toJson(energyLimit), - energyUsed: toJson(energyUsed), - hash, - miner, - nonce, - number, - parentHash, - timestamp, - transactions, - }; - } - [Symbol.iterator]() { - let index = 0; - const txs = this.transactions; - return { - next: () => { - if (index < this.length) { - return { - value: txs[index++], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - /** - * The number of transactions in this block. - */ - get length() { - return this.#transactions.length; - } - /** - * The [[link-js-date]] this block was included at. - */ - get date() { - if (this.timestamp == null) { - return null; - } - return new Date(this.timestamp * 1000); - } - /** - * Get the transaction at %%indexe%% within this block. - */ - async getTransaction(indexOrHash) { - // Find the internal value by its index or hash - let tx = undefined; - if (typeof indexOrHash === "number") { - tx = this.#transactions[indexOrHash]; - } - else { - const hash = indexOrHash.toLowerCase(); - for (const v of this.#transactions) { - if (typeof v === "string") { - if (v !== hash) { - continue; - } - tx = v; - break; - } - else { - if (v.hash === hash) { - continue; - } - tx = v; - break; - } - } - } - if (tx == null) { - throw new Error("no such tx"); - } - if (typeof tx === "string") { - return await this.provider.getTransaction(tx); - } - else { - return tx; - } - } - getPrefetchedTransaction(indexOrHash) { - const txs = this.prefetchedTransactions; - if (typeof indexOrHash === "number") { - return txs[indexOrHash]; - } - indexOrHash = indexOrHash.toLowerCase(); - for (const tx of txs) { - if (tx.hash === indexOrHash) { - return tx; - } - } - (0, index_js_1.assertArgument)(false, "no matching transaction", "indexOrHash", indexOrHash); - } - /** - * Has this block been mined. - * - * If true, the block has been typed-gaurded that all mined - * properties are non-null. - */ - isMined() { - return !!this.hash; - } - /** - * - */ - isLondon() { - return !!this.baseFeePerEnergy; - } - orphanedEvent() { - if (!this.isMined()) { - throw new Error(""); - } - return createOrphanedBlockFilter(this); - } -} -exports.Block = Block; -////////////////////// -// Log -class Log { - provider; - transactionHash; - blockHash; - blockNumber; - removed; - address; - data; - topics; - index; - transactionIndex; - constructor(log, provider) { - this.provider = provider; - const topics = Object.freeze(log.topics.slice()); - (0, index_js_1.defineProperties)(this, { - transactionHash: log.transactionHash, - blockHash: log.blockHash, - blockNumber: log.blockNumber, - removed: log.removed, - address: log.address, - data: log.data, - topics, - index: log.index, - transactionIndex: log.transactionIndex, - }); - } - toJSON() { - const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex, } = this; - return { - _type: "log", - address, - blockHash, - blockNumber, - data, - index, - removed, - topics, - transactionHash, - transactionIndex, - }; - } - async getBlock() { - const block = await this.provider.getBlock(this.blockHash); - (0, index_js_1.assert)(!!block, "failed to find transaction", "UNKNOWN_ERROR", {}); - return block; - } - async getTransaction() { - const tx = await this.provider.getTransaction(this.transactionHash); - (0, index_js_1.assert)(!!tx, "failed to find transaction", "UNKNOWN_ERROR", {}); - return tx; - } - async getTransactionReceipt() { - const receipt = await this.provider.getTransactionReceipt(this.transactionHash); - (0, index_js_1.assert)(!!receipt, "failed to find transaction receipt", "UNKNOWN_ERROR", {}); - return receipt; - } - removedEvent() { - return createRemovedLogFilter(this); - } -} -exports.Log = Log; -////////////////////// -// Transaction Receipt -/* -export interface LegacyTransactionReceipt { - byzantium: false; - status: null; - root: string; -} - -export interface ByzantiumTransactionReceipt { - byzantium: true; - status: number; - root: null; -} -*/ -class TransactionReceipt { - provider; - to; - from; - contractAddress; - hash; - index; - blockHash; - blockNumber; - logsBloom; - energyUsed; - cumulativeEnergyUsed; - energyPrice; - type; - //readonly byzantium!: boolean; - status; - root; - #logs; - constructor(tx, provider) { - this.#logs = Object.freeze(tx.logs.map((log) => { - return new Log(log, provider); - })); - (0, index_js_1.defineProperties)(this, { - provider, - to: tx.to, - from: tx.from, - contractAddress: tx.contractAddress, - hash: tx.hash, - index: tx.index, - blockHash: tx.blockHash, - blockNumber: tx.blockNumber, - logsBloom: tx.logsBloom, - energyUsed: tx.energyUsed, - cumulativeEnergyUsed: tx.cumulativeEnergyUsed, - energyPrice: (tx.effectiveEnergyPrice || tx.energyPrice), - //byzantium: tx.byzantium, - status: tx.status, - root: tx.root, - }); - } - get logs() { - return this.#logs; - } - toJSON() { - const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium, - status, root, } = this; - return { - _type: "TransactionReceipt", - blockHash, - blockNumber, - //byzantium, - contractAddress, - cumulativeEnergyUsed: toJson(this.cumulativeEnergyUsed), - from, - energyPrice: toJson(this.energyPrice), - energyUsed: toJson(this.energyUsed), - hash, - index, - logs, - logsBloom, - root, - status, - to, - }; - } - get length() { - return this.logs.length; - } - [Symbol.iterator]() { - let index = 0; - return { - next: () => { - if (index < this.length) { - return { value: this.logs[index++], done: false }; - } - return { value: undefined, done: true }; - }, - }; - } - get fee() { - return this.energyUsed * this.energyPrice; - } - async getBlock() { - const block = await this.provider.getBlock(this.blockHash); - if (block == null) { - throw new Error("TODO"); - } - return block; - } - async getTransaction() { - const tx = await this.provider.getTransaction(this.hash); - if (tx == null) { - throw new Error("TODO"); - } - return tx; - } - async getResult() { - return await this.provider.getTransactionResult(this.hash); - } - async confirmations() { - return (await this.provider.getBlockNumber()) - this.blockNumber + 1; - } - removedEvent() { - return createRemovedTransactionFilter(this); - } - reorderedEvent(other) { - (0, index_js_1.assert)(!other || other.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }); - return createReorderedTransactionFilter(this, other); - } -} -exports.TransactionReceipt = TransactionReceipt; -/* -export type ReplacementDetectionSetup = { - to: string; - from: string; - value: bigint; - data: string; - nonce: number; - block: number; -}; -*/ -class TransactionResponse { - /** - * The provider this is connected to, which will influence how its - * methods will resolve its async inspection methods. - */ - provider; - /** - * The block number of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - blockNumber; - /** - * The blockHash of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - blockHash; - /** - * The index within the block that this transaction resides at. - */ - index; - /** - * The transaction hash. - */ - hash; - /** - * The [[link-eip-2718]] transaction envelope type. This is - * ``0`` for legacy transactions types. - */ - type; - /** - * The receiver of this transaction. - * - * If ``null``, then the transaction is an initcode transaction. - * This means the result of executing the [[data]] will be deployed - * as a new contract on chain (assuming it does not revert) and the - * address may be computed using [[getCreateAddress]]. - */ - to; - /** - * The sender of this transaction. It is implicitly computed - * from the transaction pre-image hash (as the digest) and the - * [[signature]] using ecrecover. - */ - from; - /** - * The nonce, which is used to prevent replay attacks and offer - * a method to ensure transactions from a given sender are explicitly - * ordered. - * - * When sending a transaction, this must be equal to the number of - * transactions ever sent by [[from]]. - */ - nonce; - /** - * The maximum units of energy this transaction can consume. If execution - * exceeds this, the entries transaction is reverted and the sender - * is charged for the full amount, despite not state changes being made. - */ - energyLimit; - /** - * The energy price can have various values, depending on the network. - * - * In modern networks, for transactions that are included this is - * the //effective energy price// (the fee per energy that was actually - * charged), while for transactions that have not been included yet - * is the [[maxFeePerEnergy]]. - * - * For legacy transactions, or transactions on legacy networks, this - * is the fee that will be charged per unit of energy the transaction - * consumes. - */ - energyPrice; - /** - * The data. - */ - data; - /** - * The value, in ore. Use [[formatXCB]] to format this value - * as xcb. - */ - value; - /** - * The chain ID. - */ - networkId; - /** - * The signature. - */ - signature; - #startBlock; - /** - * Create a new TransactionResponse with %%tx%% parameters - * connected to %%provider%%. - */ - constructor(tx, provider) { - this.provider = provider; - this.blockNumber = tx.blockNumber != null ? tx.blockNumber : null; - this.blockHash = tx.blockHash != null ? tx.blockHash : null; - this.hash = tx.hash; - this.index = tx.index; - this.from = tx.from; - this.to = tx.to || null; - this.energyLimit = tx.energyLimit; - this.nonce = tx.nonce; - this.data = tx.data; - this.value = tx.value; - this.energyPrice = tx.energyPrice; - this.networkId = tx.networkId; - this.signature = tx.signature; - this.#startBlock = -1; - } - /** - * Returns a JSON representation of this transaction. - */ - toJSON() { - const { index, hash, type, to, from, nonce, data, signature } = this; - return { - _type: "TransactionReceipt", - networkId: toJson(this.networkId), - data, - from, - energyLimit: toJson(this.energyLimit), - energyPrice: toJson(this.energyPrice), - hash, - nonce, - signature, - to, - index, - type, - value: toJson(this.value), - }; - } - /** - * Resolves to the Block that this transaction was included in. - * - * This will return null if the transaction has not been included yet. - */ - async getBlock() { - let blockNumber = this.blockNumber; - if (blockNumber == null) { - const tx = await this.getTransaction(); - if (tx) { - blockNumber = tx.blockNumber; - } - } - if (blockNumber == null) { - return null; - } - const block = this.provider.getBlock(blockNumber); - if (block == null) { - throw new Error("TODO"); - } - return block; - } - /** - * Resolves to this transaction being re-requested from the - * provider. This can be used if you have an unmined transaction - * and wish to get an up-to-date populated instance. - */ - async getTransaction() { - return this.provider.getTransaction(this.hash); - } - /** - * Resolves once this transaction has been mined and has - * %%confirms%% blocks including it (default: ``1``) with an - * optional %%timeout%%. - * - * This can resolve to ``null`` only if %%confirms%% is ``0`` - * and the transaction has not been mined, otherwise this will - * wait until enough confirmations have completed. - */ - async wait(_confirms, _timeout) { - const confirms = _confirms == null ? 1 : _confirms; - const timeout = _timeout == null ? 0 : _timeout; - let startBlock = this.#startBlock; - let nextScan = -1; - let stopScanning = startBlock === -1 ? true : false; - const checkReplacement = async () => { - // Get the current transaction count for this sender - if (stopScanning) { - return null; - } - const { blockNumber, nonce } = await (0, index_js_1.resolveProperties)({ - blockNumber: this.provider.getBlockNumber(), - nonce: this.provider.getTransactionCount(this.from), - }); - // No transaction or our nonce has not been mined yet; but we - // can start scanning later when we do start - if (nonce < this.nonce) { - startBlock = blockNumber; - return; - } - // We were mined; no replacement - if (stopScanning) { - return null; - } - const mined = await this.getTransaction(); - if (mined && mined.blockNumber != null) { - return; - } - // We were replaced; start scanning for that transaction - // Starting to scan; look back a few extra blocks for safety - if (nextScan === -1) { - nextScan = startBlock - 3; - if (nextScan < this.#startBlock) { - nextScan = this.#startBlock; - } - } - while (nextScan <= blockNumber) { - // Get the next block to scan - if (stopScanning) { - return null; - } - const block = await this.provider.getBlock(nextScan, true); - // This should not happen; but we'll try again shortly - if (block == null) { - return; - } - // We were mined; no replacement - for (const hash of block) { - if (hash === this.hash) { - return; - } - } - // Search for the transaction that replaced us - for (let i = 0; i < block.length; i++) { - const tx = await block.getTransaction(i); - if (tx.from === this.from && tx.nonce === this.nonce) { - // Get the receipt - if (stopScanning) { - return null; - } - const receipt = await this.provider.getTransactionReceipt(tx.hash); - // This should not happen; but we'll try again shortly - if (receipt == null) { - return; - } - // We will retry this on the next block (this case could be optimized) - if (blockNumber - receipt.blockNumber + 1 < confirms) { - return; - } - // The reason we were replaced - let reason = "replaced"; - if (tx.data === this.data && - tx.to === this.to && - tx.value === this.value) { - reason = "repriced"; - } - else if (tx.data === "0x" && - tx.from === tx.to && - tx.value === BN_0) { - reason = "cancelled"; - } - (0, index_js_1.assert)(false, "transaction was replaced", "TRANSACTION_REPLACED", { - cancelled: reason === "replaced" || reason === "cancelled", - reason, - replacement: tx.replaceableTransaction(startBlock), - hash: tx.hash, - receipt, - }); - } - } - nextScan++; - } - return; - }; - const receipt = await this.provider.getTransactionReceipt(this.hash); - if (receipt) { - if ((await receipt.confirmations()) >= confirms) { - return receipt; - } - } - else { - // Check for a replacement; throws if a replacement was found - await checkReplacement(); - // Allow null only when the confirms is 0 - if (confirms === 0) { - return null; - } - } - const waiter = new Promise((resolve, reject) => { - // List of things to cancel when we have a result (one way or the other) - const cancellers = []; - const cancel = () => { - cancellers.forEach((c) => c()); - }; - // On cancel, stop scanning for replacements - cancellers.push(() => { - stopScanning = true; - }); - // Set up any timeout requested - if (timeout > 0) { - const timer = setTimeout(() => { - cancel(); - reject((0, index_js_1.makeError)("wait for transaction timeout", "TIMEOUT")); - }, timeout); - cancellers.push(() => { - clearTimeout(timer); - }); - } - const txListener = async (receipt) => { - // Done; return it! - if ((await receipt.confirmations()) >= confirms) { - cancel(); - resolve(receipt); - } - }; - cancellers.push(() => { - this.provider.off(this.hash, txListener); - }); - this.provider.on(this.hash, txListener); - // We support replacement detection; start checking - if (startBlock >= 0) { - const replaceListener = async () => { - try { - // Check for a replacement; this throws only if one is found - await checkReplacement(); - } - catch (error) { - // We were replaced (with enough confirms); re-throw the error - if ((0, index_js_1.isError)(error, "TRANSACTION_REPLACED")) { - cancel(); - reject(error); - return; - } - } - // Rescheudle a check on the next block - if (!stopScanning) { - this.provider.once("block", replaceListener); - } - }; - cancellers.push(() => { - this.provider.off("block", replaceListener); - }); - this.provider.once("block", replaceListener); - } - }); - return await waiter; - } - /** - * Returns ``true`` if this transaction has been included. - * - * This is effective only as of the time the TransactionResponse - * was instantiated. To get up-to-date information, use - * [[getTransaction]]. - * - * This provides a Type Guard that this transaction will have - * non-null property values for properties that are null for - * unmined transactions. - */ - isMined() { - return this.blockHash != null; - } - /** - * Returns true if the transaction is a legacy (i.e. ``type == 0``) - * transaction. - * - * This provides a Type Guard that this transaction will have - * the ``null``-ness for hardfork-specific properties set correctly. - */ - isLegacy() { - return this.type === 0; - } - /** - * Returns a filter which can be used to listen for orphan events - * that evict this transaction. - */ - removedEvent() { - (0, index_js_1.assert)(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - return createRemovedTransactionFilter(this); - } - /** - * Returns a filter which can be used to listen for orphan events - * that re-order this event against %%other%%. - */ - reorderedEvent(other) { - (0, index_js_1.assert)(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - (0, index_js_1.assert)(!other || other.isMined(), "unmined 'other' transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - return createReorderedTransactionFilter(this, other); - } - /** - * Returns a new TransactionResponse instance which has the ability to - * detect (and throw an error) if the transaction is replaced, which - * will begin scanning at %%startBlock%%. - * - * This should generally not be used by developers and is intended - * primarily for internal use. Setting an incorrect %%startBlock%% can - * have devastating performance consequences if used incorrectly. - */ - replaceableTransaction(startBlock) { - (0, index_js_1.assertArgument)(Number.isInteger(startBlock) && startBlock >= 0, "invalid startBlock", "startBlock", startBlock); - const tx = new TransactionResponse(this, this.provider); - tx.#startBlock = startBlock; - return tx; - } -} -exports.TransactionResponse = TransactionResponse; -function createOrphanedBlockFilter(block) { - return { orphan: "drop-block", hash: block.hash, number: block.number }; -} -function createReorderedTransactionFilter(tx, other) { - return { orphan: "reorder-transaction", tx, other }; -} -function createRemovedTransactionFilter(tx) { - return { orphan: "drop-transaction", tx }; -} -function createRemovedLogFilter(log) { - return { - orphan: "drop-log", - log: { - transactionHash: log.transactionHash, - blockHash: log.blockHash, - blockNumber: log.blockNumber, - address: log.address, - data: log.data, - topics: Object.freeze(log.topics.slice()), - index: log.index, - }, - }; -} -//# sourceMappingURL=provider.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/provider.js.map b/lib.commonjs/providers/provider.js.map deleted file mode 100644 index b2619baf1..000000000 --- a/lib.commonjs/providers/provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src.ts/providers/provider.ts"],"names":[],"mappings":";;;AAAA,gDAU2B;AAS3B,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAWvB,0BAA0B;AAE1B,SAAS,QAAQ,CAAI,KAA2B;IAC9C,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB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O;QACL,MAAM,EAAE,UAAU;QAClB,GAAG,EAAE;YACH,eAAe,EAAE,GAAG,CAAC,eAAe;YACpC,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACzC,KAAK,EAAE,GAAG,CAAC,KAAK;SACjB;KACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/providers/signer-noncemanager.d.ts b/lib.commonjs/providers/signer-noncemanager.d.ts deleted file mode 100644 index 31eae80ab..000000000 --- a/lib.commonjs/providers/signer-noncemanager.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { AbstractSigner } from "./abstract-signer.js"; -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -import type { Signer } from "./signer.js"; -export declare class NonceManager extends AbstractSigner { - #private; - signer: Signer; - constructor(signer: Signer); - getAddress(): Promise; - connect(provider: null | Provider): NonceManager; - getNonce(blockTag?: BlockTag): Promise; - increment(): void; - reset(): void; - sendTransaction(tx: TransactionRequest): Promise; - signTransaction(tx: TransactionRequest): Promise; - signMessage(message: string | Uint8Array): Promise; - signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -//# sourceMappingURL=signer-noncemanager.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/signer-noncemanager.d.ts.map b/lib.commonjs/providers/signer-noncemanager.d.ts.map deleted file mode 100644 index 9f69385c3..000000000 --- a/lib.commonjs/providers/signer-noncemanager.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signer-noncemanager.d.ts","sourceRoot":"","sources":["../../src.ts/providers/signer-noncemanager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,qBAAa,YAAa,SAAQ,cAAc;;IAC9C,MAAM,EAAG,MAAM,CAAC;gBAKJ,MAAM,EAAE,MAAM;IAQpB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,YAAY;IAI1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAapD,SAAS,IAAI,IAAI;IAIjB,KAAK,IAAI,IAAI;IAKP,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAY3E,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1D,aAAa,CACX,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC;CAGnB"} \ No newline at end of file diff --git a/lib.commonjs/providers/signer-noncemanager.js b/lib.commonjs/providers/signer-noncemanager.js deleted file mode 100644 index 477bdb636..000000000 --- a/lib.commonjs/providers/signer-noncemanager.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NonceManager = void 0; -const index_js_1 = require("../utils/index.js"); -const abstract_signer_js_1 = require("./abstract-signer.js"); -class NonceManager extends abstract_signer_js_1.AbstractSigner { - signer; - #noncePromise; - #delta; - constructor(signer) { - super(signer.provider); - (0, index_js_1.defineProperties)(this, { signer }); - this.#noncePromise = null; - this.#delta = 0; - } - async getAddress() { - return this.signer.getAddress(); - } - connect(provider) { - return new NonceManager(this.signer.connect(provider)); - } - async getNonce(blockTag) { - if (blockTag === "pending") { - if (this.#noncePromise == null) { - this.#noncePromise = super.getNonce("pending"); - } - const delta = this.#delta; - return (await this.#noncePromise) + delta; - } - return super.getNonce(blockTag); - } - increment() { - this.#delta++; - } - reset() { - this.#delta = 0; - this.#noncePromise = null; - } - async sendTransaction(tx) { - const noncePromise = this.getNonce("pending"); - this.increment(); - tx = await this.signer.populateTransaction(tx); - tx.nonce = await noncePromise; - // @TODO: Maybe handle interesting/recoverable errors? - // Like don't increment if the tx was certainly not sent - return await this.signer.sendTransaction(tx); - } - signTransaction(tx) { - return this.signer.signTransaction(tx); - } - signMessage(message) { - return this.signer.signMessage(message); - } - signTypedData(domain, types, value) { - return this.signer.signTypedData(domain, types, value); - } -} -exports.NonceManager = NonceManager; -//# sourceMappingURL=signer-noncemanager.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/signer-noncemanager.js.map b/lib.commonjs/providers/signer-noncemanager.js.map deleted file mode 100644 index 267ba9ef3..000000000 --- a/lib.commonjs/providers/signer-noncemanager.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signer-noncemanager.js","sourceRoot":"","sources":["../../src.ts/providers/signer-noncemanager.ts"],"names":[],"mappings":";;;AAAA,gDAAqD;AACrD,6DAAsD;AAYtD,MAAa,YAAa,SAAQ,mCAAc;IAC9C,MAAM,CAAU;IAEhB,aAAa,CAAyB;IACtC,MAAM,CAAS;IAEf,YAAY,MAAc;QACxB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvB,IAAA,2BAAgB,EAAe,IAAI,EAAE,EAAE,M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AAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,eAAe,CAAC,EAAsB;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,WAAW,CAAC,OAA4B;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,aAAa,CACX,MAAuB,EACvB,KAA4C,EAC5C,KAA0B;QAE1B,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;CACF;AAvED,oCAuEC"} \ No newline at end of file diff --git a/lib.commonjs/providers/signer.d.ts b/lib.commonjs/providers/signer.d.ts deleted file mode 100644 index a6383a32f..000000000 --- a/lib.commonjs/providers/signer.d.ts +++ /dev/null @@ -1,118 +0,0 @@ -import type { Addressable, NameResolver } from "../address/index.js"; -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { ContractRunner } from "./contracts.js"; -import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -/** - * A Signer represents an account on the Core Blockchain, and is most often - * backed by a private key represented by a mnemonic or residing on a Hardware Wallet. - * - * The API remains abstract though, so that it can deal with more advanced exotic - * Signing entities, such as Smart Contract Wallets or Virtual Wallets (where the - * private key may not be known). - */ -export interface Signer extends Addressable, ContractRunner, NameResolver { - /** - * The [[Provider]] attached to this Signer (if any). - */ - provider: null | Provider; - /** - * Returns a new instance of this Signer connected to //provider// or detached - * from any Provider if null. - */ - connect(provider: null | Provider): Signer; - /** - * Get the address of the Signer. - */ - getAddress(): Promise; - /** - * Gets the next nonce required for this Signer to send a transaction. - * - * @param blockTag - The blocktag to base the transaction count on, keep in mind - * many nodes do not honour this value and silently ignore it [default: ``"latest"``] - */ - getNonce(blockTag?: BlockTag): Promise; - /** - * Prepares a {@link TransactionRequest} for calling: - * - resolves ``to`` and ``from`` addresses - * - if ``from`` is specified , check that it matches this Signer - * - * @param tx - The call to prepare - */ - populateCall(tx: TransactionRequest): Promise>; - /** - * Prepares a {@link TransactionRequest} for sending to the network by - * populating any missing properties: - * - resolves ``to`` and ``from`` addresses - * - if ``from`` is specified , check that it matches this Signer - * - populates ``nonce`` via ``signer.getNonce("pending")`` - * - populates ``energyLimit`` via ``signer.estimateEnergy(tx)`` - * - populates ``networkId`` via ``signer.provider.getNetwork()`` - * - populates ``type`` and relevant fee data for that type (``energyPrice`` - * for legacy transactions, ``maxFeePerEnergy`` for EIP-1559, etc) - * - * @note Some Signer implementations may skip populating properties that - * are populated downstream; for example JsonRpcSigner defers to the - * node to populate the nonce and fee data. - * - * @param tx - The call to prepare - */ - populateTransaction(tx: TransactionRequest): Promise>; - /** - * Estimates the required energy required to execute //tx// on the Blockchain. This - * will be the expected amount a transaction will require as its ``energyLimit`` - * to successfully run all the necessary computations and store the needed state - * that the transaction intends. - * - * Keep in mind that this is **best efforts**, since the state of the Blockchain - * is in flux, which could affect transaction energy requirements. - * - * @throws UNPREDICTABLE_ENERGY_LIMIT A transaction that is believed by the node to likely - * fail will throw an error during energy estimation. This could indicate that it - * will actually fail or that the circumstances are simply too complex for the - * node to take into account. In these cases, a manually determined ``energyLimit`` - * will need to be made. - */ - estimateEnergy(tx: TransactionRequest): Promise; - /** - * Evaluates the //tx// by running it against the current Blockchain state. This - * cannot change state and has no cost in xcb, as it is effectively simulating - * execution. - * - * This can be used to have the Blockchain perform computations based on its state - * (e.g. running a Contract's getters) or to simulate the effect of a transaction - * before actually performing an operation. - */ - call(tx: TransactionRequest): Promise; - /** - * Resolves an ENS Name to an address. - */ - resolveName(name: string): Promise; - /** - * Signs %%tx%%, returning the fully signed transaction. This does not - * populate any additional properties within the transaction. - */ - signTransaction(tx: TransactionRequest): Promise; - /** - * Sends %%tx%% to the Network. The ``signer.populateTransaction(tx)`` - * is called first to ensure all necessary properties for the - * transaction to be valid have been popualted first. - */ - sendTransaction(tx: TransactionRequest): Promise; - /** - * Signers an [[link-eip-191]] prefixed personal message. - * - * If the %%message%% is a string, it is signed as UTF-8 encoded bytes. It is **not** - * interpretted as a [[BytesLike]]; so the string ``"0x1234"`` is signed as six - * characters, **not** two bytes. - * - * To sign that example as two bytes, the Uint8Array should be used - * (i.e. ``new Uint8Array([ 0x12, 0x34 ])``). - */ - signMessage(message: string | Uint8Array): Promise; - /** - * Signs the [[link-eip-712]] typed data. - */ - signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -//# sourceMappingURL=signer.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/signer.d.ts.map b/lib.commonjs/providers/signer.d.ts.map deleted file mode 100644 index 4dff87bbe..000000000 --- a/lib.commonjs/providers/signer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src.ts/providers/signer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAEvB;;;;;;;GAOG;AACH,MAAM,WAAW,MAAO,SAAQ,WAAW,EAAE,cAAc,EAAE,YAAY;IACvE;;OAEG;IACH,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC;IAE1B;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM,CAAC;IAK3C;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAE9B;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAK/C;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAEvE;;;;;;;;;;;;;;;;OAgBG;IACH,mBAAmB,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAK9E;;;;;;;;;;;;;;OAcG;IACH,cAAc,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExD;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE9C;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAKlD;;;OAGG;IACH,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzD;;;;OAIG;IACH,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEtE;;;;;;;;;OASG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3D;;OAEG;IACH,aAAa,CACX,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB"} \ No newline at end of file diff --git a/lib.commonjs/providers/signer.js b/lib.commonjs/providers/signer.js deleted file mode 100644 index c73406acc..000000000 --- a/lib.commonjs/providers/signer.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=signer.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/signer.js.map b/lib.commonjs/providers/signer.js.map deleted file mode 100644 index 68d48a837..000000000 --- a/lib.commonjs/providers/signer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../src.ts/providers/signer.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.commonjs/providers/subscriber-connection.d.ts b/lib.commonjs/providers/subscriber-connection.d.ts deleted file mode 100644 index b235e3b46..000000000 --- a/lib.commonjs/providers/subscriber-connection.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Subscriber } from "./abstract-provider.js"; -import type { Provider } from "./provider.js"; -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export interface ConnectionRpcProvider extends Provider { - _subscribe(param: Array, processFunc: (result: any) => void): number; - _unsubscribe(filterId: number): void; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class BlockConnectionSubscriber implements Subscriber { - #private; - constructor(provider: ConnectionRpcProvider); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -//# sourceMappingURL=subscriber-connection.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/subscriber-connection.d.ts.map b/lib.commonjs/providers/subscriber-connection.d.ts.map deleted file mode 100644 index 2f88c6893..000000000 --- a/lib.commonjs/providers/subscriber-connection.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-connection.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-connection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,QAAQ;IAErD,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,CAAC;IAC1E,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,UAAU;;gBAQ9C,QAAQ,EAAE,qBAAqB;IAO3C,KAAK,IAAI,IAAI;IAiBb,IAAI,IAAI,IAAI;IAYZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAOtC,MAAM,IAAI,IAAI;CAGf"} \ No newline at end of file diff --git a/lib.commonjs/providers/subscriber-connection.js b/lib.commonjs/providers/subscriber-connection.js deleted file mode 100644 index b5fe46d6a..000000000 --- a/lib.commonjs/providers/subscriber-connection.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BlockConnectionSubscriber = void 0; -const index_js_1 = require("../utils/index.js"); -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -class BlockConnectionSubscriber { - #provider; - #blockNumber; - #running; - #filterId; - constructor(provider) { - this.#provider = provider; - this.#blockNumber = -2; - this.#running = false; - this.#filterId = null; - } - start() { - if (this.#running) { - return; - } - this.#running = true; - this.#filterId = this.#provider._subscribe(["newHeads"], (result) => { - const blockNumber = (0, index_js_1.getNumber)(result.number); - const initial = this.#blockNumber === -2 ? blockNumber : this.#blockNumber + 1; - for (let b = initial; b <= blockNumber; b++) { - this.#provider.emit("block", b); - } - this.#blockNumber = blockNumber; - }); - } - stop() { - if (!this.#running) { - return; - } - this.#running = false; - if (this.#filterId != null) { - this.#provider._unsubscribe(this.#filterId); - this.#filterId = null; - } - } - pause(dropWhilePaused) { - if (dropWhilePaused) { - this.#blockNumber = -2; - } - this.stop(); - } - resume() { - this.start(); - } -} -exports.BlockConnectionSubscriber = BlockConnectionSubscriber; -//# sourceMappingURL=subscriber-connection.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/subscriber-connection.js.map b/lib.commonjs/providers/subscriber-connection.js.map deleted file mode 100644 index 61ac5b476..000000000 --- a/lib.commonjs/providers/subscriber-connection.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-connection.js","sourceRoot":"","sources":["../../src.ts/providers/subscriber-connection.ts"],"names":[],"mappings":";;;AAAA,gDAA8C;AAkB9C;;;;GAIG;AACH,MAAa,yBAAyB;IACpC,SAAS,CAAwB;IACjC,YAAY,CAAS;IAErB,QAAQ,CAAU;IAElB,SAAS,CAAgB;IAEzB,YAAY,QAA+B;QACzC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO;SACR;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,MAAW,EAAE,EAAE;YACvE,MAAM,WAAW,GAAG,IAAA,oBAAS,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC7C,MAAM,OAAO,GACX,IAAI,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;YACjE,KAAK,IAAI,CAAC,GAAG,OAAO,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC,EAAE,EAAE;gBAC3C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;aACjC;YACD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI;QACF,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO;SACR;QACD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAEtB,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE;YAC1B,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;SACvB;IACH,CAAC;IAED,KAAK,CAAC,eAAyB;QAC7B,IAAI,eAAe,EAAE;YACnB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;SACxB;QACD,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF;AAtDD,8DAsDC"} \ No newline at end of file diff --git a/lib.commonjs/providers/subscriber-filterid.d.ts b/lib.commonjs/providers/subscriber-filterid.d.ts deleted file mode 100644 index 3e58a6871..000000000 --- a/lib.commonjs/providers/subscriber-filterid.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; -import type { EventFilter } from "./provider.js"; -import type { JsonRpcApiProvider } from "./provider-jsonrpc.js"; -/** - * Some backends support subscribing to events using a Filter ID. - * - * When subscribing with this technique, the node issues a unique - * //Filter ID//. At this point the node dedicates resources to - * the filter, so that periodic calls to follow up on the //Filter ID// - * will receive any events since the last call. - * - * @_docloc: api/providers/abstract-provider - */ -export declare class FilterIdSubscriber implements Subscriber { - #private; - constructor(provider: JsonRpcApiProvider); - _subscribe(provider: JsonRpcApiProvider): Promise; - _emitResults(provider: AbstractProvider, result: Array): Promise; - _recover(provider: AbstractProvider): Subscriber; - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -/** - * A **FilterIdSubscriber** for receiving contract events. - * - * @_docloc: api/providers/abstract-provider - */ -export declare class FilterIdEventSubscriber extends FilterIdSubscriber { - #private; - constructor(provider: JsonRpcApiProvider, filter: EventFilter); - _recover(provider: AbstractProvider): Subscriber; - _subscribe(provider: JsonRpcApiProvider): Promise; - _emitResults(provider: JsonRpcApiProvider, results: Array): Promise; -} -/** - * A **FilterIdSubscriber** for receiving pending transactions events. - * - * @_docloc: api/providers/abstract-provider - */ -export declare class FilterIdPendingSubscriber extends FilterIdSubscriber { - _subscribe(provider: JsonRpcApiProvider): Promise; - _emitResults(provider: JsonRpcApiProvider, results: Array): Promise; -} -//# sourceMappingURL=subscriber-filterid.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/subscriber-filterid.d.ts.map b/lib.commonjs/providers/subscriber-filterid.d.ts.map deleted file mode 100644 index b2d81a26c..000000000 --- a/lib.commonjs/providers/subscriber-filterid.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-filterid.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-filterid.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAMhE;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,YAAW,UAAU;;gBAYvC,QAAQ,EAAE,kBAAkB;IAaxC,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3E,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU;IAkEhD,KAAK,IAAI,IAAI;IASb,IAAI,IAAI,IAAI;IAWZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAOtC,MAAM,IAAI,IAAI;CAGf;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,kBAAkB;;gBAGjD,QAAQ,EAAE,kBAAkB,EAAE,MAAM,EAAE,WAAW;IAK7D,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU;IAI1C,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAKzD,YAAY,CAChB,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAClB,OAAO,CAAC,IAAI,CAAC;CAKjB;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,kBAAkB;IACzD,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,YAAY,CAChB,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAClB,OAAO,CAAC,IAAI,CAAC;CAKjB"} \ No newline at end of file diff --git a/lib.commonjs/providers/subscriber-filterid.js b/lib.commonjs/providers/subscriber-filterid.js deleted file mode 100644 index 8618304de..000000000 --- a/lib.commonjs/providers/subscriber-filterid.js +++ /dev/null @@ -1,164 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FilterIdPendingSubscriber = exports.FilterIdEventSubscriber = exports.FilterIdSubscriber = void 0; -const index_js_1 = require("../utils/index.js"); -const subscriber_polling_js_1 = require("./subscriber-polling.js"); -function copy(obj) { - return JSON.parse(JSON.stringify(obj)); -} -/** - * Some backends support subscribing to events using a Filter ID. - * - * When subscribing with this technique, the node issues a unique - * //Filter ID//. At this point the node dedicates resources to - * the filter, so that periodic calls to follow up on the //Filter ID// - * will receive any events since the last call. - * - * @_docloc: api/providers/abstract-provider - */ -class FilterIdSubscriber { - #provider; - #filterIdPromise; - #poller; - #running; - #network; - #hault; - constructor(provider) { - this.#provider = provider; - this.#filterIdPromise = null; - this.#poller = this.#poll.bind(this); - this.#running = false; - this.#network = null; - this.#hault = false; - } - _subscribe(provider) { - throw new Error("subclasses must override this"); - } - _emitResults(provider, result) { - throw new Error("subclasses must override this"); - } - _recover(provider) { - throw new Error("subclasses must override this"); - } - async #poll(blockNumber) { - try { - // Subscribe if necessary - if (this.#filterIdPromise == null) { - this.#filterIdPromise = this._subscribe(this.#provider); - } - // Get the Filter ID - let filterId = null; - try { - filterId = await this.#filterIdPromise; - } - catch (error) { - if (!(0, index_js_1.isError)(error, "UNSUPPORTED_OPERATION") || - error.operation !== "xcb_newFilter") { - throw error; - } - } - // The backend does not support Filter ID; downgrade to - // polling - if (filterId == null) { - this.#filterIdPromise = null; - this.#provider._recoverSubscriber(this, this._recover(this.#provider)); - return; - } - const network = await this.#provider.getNetwork(); - if (!this.#network) { - this.#network = network; - } - if (this.#network.networkId !== network.networkId) { - throw new Error("chaid changed"); - } - if (this.#hault) { - return; - } - const result = await this.#provider.send("xcb_getFilterChanges", [ - filterId, - ]); - await this._emitResults(this.#provider, result); - } - catch (error) { - console.log("@TODO", error); - } - this.#provider.once("block", this.#poller); - } - #teardown() { - const filterIdPromise = this.#filterIdPromise; - if (filterIdPromise) { - this.#filterIdPromise = null; - filterIdPromise.then((filterId) => { - this.#provider.send("xcb_uninstallFilter", [filterId]); - }); - } - } - start() { - if (this.#running) { - return; - } - this.#running = true; - this.#poll(-2); - } - stop() { - if (!this.#running) { - return; - } - this.#running = false; - this.#hault = true; - this.#teardown(); - this.#provider.off("block", this.#poller); - } - pause(dropWhilePaused) { - if (dropWhilePaused) { - this.#teardown(); - } - this.#provider.off("block", this.#poller); - } - resume() { - this.start(); - } -} -exports.FilterIdSubscriber = FilterIdSubscriber; -/** - * A **FilterIdSubscriber** for receiving contract events. - * - * @_docloc: api/providers/abstract-provider - */ -class FilterIdEventSubscriber extends FilterIdSubscriber { - #event; - constructor(provider, filter) { - super(provider); - this.#event = copy(filter); - } - _recover(provider) { - return new subscriber_polling_js_1.PollingEventSubscriber(provider, this.#event); - } - async _subscribe(provider) { - const filterId = await provider.send("xcb_newFilter", [this.#event]); - return filterId; - } - async _emitResults(provider, results) { - for (const result of results) { - provider.emit(this.#event, provider._wrapLog(result, provider._network)); - } - } -} -exports.FilterIdEventSubscriber = FilterIdEventSubscriber; -/** - * A **FilterIdSubscriber** for receiving pending transactions events. - * - * @_docloc: api/providers/abstract-provider - */ -class FilterIdPendingSubscriber extends FilterIdSubscriber { - async _subscribe(provider) { - return await provider.send("xcb_newPendingTransactionFilter", []); - } - async _emitResults(provider, results) { - for (const result of results) { - provider.emit("pending", result); - } - } -} -exports.FilterIdPendingSubscriber = FilterIdPendingSubscriber; -//# sourceMappingURL=subscriber-filterid.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/subscriber-filterid.js.map b/lib.commonjs/providers/subscriber-filterid.js.map deleted file mode 100644 index 0605e1c06..000000000 --- a/lib.commonjs/providers/subscriber-filterid.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-filterid.js","sourceRoot":"","sources":["../../src.ts/providers/subscriber-filterid.ts"],"names":[],"mappings":";;;AAAA,gDAA4C;AAE5C,mEAAiE;AAOjE,SAAS,IAAI,CAAC,GAAQ;IACpB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAa,kBAAkB;IAC7B,SAAS,CAAqB;IAE9B,gBAAgB,CAAyB;IACzC,OAAO,CAA+B;IAEtC,QAAQ,CAAU;IAElB,QAAQ,CAAiB;IAEzB,MAAM,CAAU;IAEhB,YAAY,QAA4B;QACtC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,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AAC;CACF;AAzBD,0DAyBC;AAED;;;;GAIG;AACH,MAAa,yBAA0B,SAAQ,kBAAkB;IAC/D,KAAK,CAAC,UAAU,CAAC,QAA4B;QAC3C,OAAO,MAAM,QAAQ,CAAC,IAAI,CAAC,iCAAiC,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,QAA4B,EAC5B,OAAmB;QAEnB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC5B,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;SAClC;IACH,CAAC;CACF;AAbD,8DAaC"} \ No newline at end of file diff --git a/lib.commonjs/providers/subscriber-polling.d.ts b/lib.commonjs/providers/subscriber-polling.d.ts deleted file mode 100644 index fcf4a8070..000000000 --- a/lib.commonjs/providers/subscriber-polling.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; -import type { EventFilter, OrphanFilter, ProviderEvent } from "./provider.js"; -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare function getPollingSubscriber(provider: AbstractProvider, event: ProviderEvent): Subscriber; -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class PollingBlockSubscriber implements Subscriber { - #private; - constructor(provider: AbstractProvider); - get pollingInterval(): number; - set pollingInterval(value: number); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class OnBlockSubscriber implements Subscriber { - #private; - constructor(provider: AbstractProvider); - _poll(blockNumber: number, provider: AbstractProvider): Promise; - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class PollingOrphanSubscriber extends OnBlockSubscriber { - #private; - constructor(provider: AbstractProvider, filter: OrphanFilter); - _poll(blockNumber: number, provider: AbstractProvider): Promise; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class PollingTransactionSubscriber extends OnBlockSubscriber { - #private; - constructor(provider: AbstractProvider, hash: string); - _poll(blockNumber: number, provider: AbstractProvider): Promise; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class PollingEventSubscriber implements Subscriber { - #private; - constructor(provider: AbstractProvider, filter: EventFilter); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -//# sourceMappingURL=subscriber-polling.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/subscriber-polling.d.ts.map b/lib.commonjs/providers/subscriber-polling.d.ts.map deleted file mode 100644 index 9082a53d0..000000000 --- a/lib.commonjs/providers/subscriber-polling.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-polling.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-polling.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAM9E;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,aAAa,GACnB,UAAU,CAYZ;AAID;;;;GAIG;AACH,qBAAa,sBAAuB,YAAW,UAAU;;gBAU3C,QAAQ,EAAE,gBAAgB;IAQtC,IAAI,eAAe,IAAI,MAAM,CAE5B;IACD,IAAI,eAAe,CAAC,KAAK,EAAE,MAAM,EAEhC;IA2CD,KAAK,IAAI,IAAI;IAWb,IAAI,IAAI,IAAI;IAQZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAOtC,MAAM,IAAI,IAAI;CAGf;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW,UAAU;;gBAKtC,QAAQ,EAAE,gBAAgB;IAQhC,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3E,KAAK,IAAI,IAAI;IAUb,IAAI,IAAI,IAAI;IASZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAGtC,MAAM,IAAI,IAAI;CAGf;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,iBAAiB;;gBAGhD,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY;IAKtD,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAI5E;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,iBAAiB;;gBAGrD,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM;IAK9C,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAM5E;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,YAAW,UAAU;;gBAW3C,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW;IAmC3D,KAAK,IAAI,IAAI;IAcb,IAAI,IAAI,IAAI;IASZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAOtC,MAAM,IAAI,IAAI;CAGf"} \ No newline at end of file diff --git a/lib.commonjs/providers/subscriber-polling.js b/lib.commonjs/providers/subscriber-polling.js deleted file mode 100644 index a07025304..000000000 --- a/lib.commonjs/providers/subscriber-polling.js +++ /dev/null @@ -1,257 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PollingEventSubscriber = exports.PollingTransactionSubscriber = exports.PollingOrphanSubscriber = exports.OnBlockSubscriber = exports.PollingBlockSubscriber = exports.getPollingSubscriber = void 0; -const index_js_1 = require("../utils/index.js"); -function copy(obj) { - return JSON.parse(JSON.stringify(obj)); -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -function getPollingSubscriber(provider, event) { - if (event === "block") { - return new PollingBlockSubscriber(provider); - } - if ((0, index_js_1.isHexString)(event, 32)) { - return new PollingTransactionSubscriber(provider, event); - } - (0, index_js_1.assert)(false, "unsupported polling event", "UNSUPPORTED_OPERATION", { - operation: "getPollingSubscriber", - info: { event }, - }); -} -exports.getPollingSubscriber = getPollingSubscriber; -// @TODO: refactor this -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -class PollingBlockSubscriber { - #provider; - #poller; - #interval; - // The most recent block we have scanned for events. The value -2 - // indicates we still need to fetch an initial block number - #blockNumber; - constructor(provider) { - this.#provider = provider; - this.#poller = null; - this.#interval = 4000; - this.#blockNumber = -2; - } - get pollingInterval() { - return this.#interval; - } - set pollingInterval(value) { - this.#interval = value; - } - async #poll() { - try { - const blockNumber = await this.#provider.getBlockNumber(); - // Bootstrap poll to setup our initial block number - if (this.#blockNumber === -2) { - this.#blockNumber = blockNumber; - return; - } - // @TODO: Put a cap on the maximum number of events per loop? - if (blockNumber !== this.#blockNumber) { - for (let b = this.#blockNumber + 1; b <= blockNumber; b++) { - // We have been stopped - if (this.#poller == null) { - return; - } - await this.#provider.emit("block", b); - } - this.#blockNumber = blockNumber; - } - } - catch (error) { - // @TODO: Minor bump, add an "error" event to let subscribers - // know things went awry. - //console.log(error); - } - // We have been stopped - if (this.#poller == null) { - return; - } - this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); - } - start() { - if (this.#poller) { - return; - } - this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); - this.#poll(); - } - stop() { - if (!this.#poller) { - return; - } - this.#provider._clearTimeout(this.#poller); - this.#poller = null; - } - pause(dropWhilePaused) { - this.stop(); - if (dropWhilePaused) { - this.#blockNumber = -2; - } - } - resume() { - this.start(); - } -} -exports.PollingBlockSubscriber = PollingBlockSubscriber; -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -class OnBlockSubscriber { - #provider; - #poll; - #running; - constructor(provider) { - this.#provider = provider; - this.#running = false; - this.#poll = (blockNumber) => { - this._poll(blockNumber, this.#provider); - }; - } - async _poll(blockNumber, provider) { - throw new Error("sub-classes must override this"); - } - start() { - if (this.#running) { - return; - } - this.#running = true; - this.#poll(-2); - this.#provider.on("block", this.#poll); - } - stop() { - if (!this.#running) { - return; - } - this.#running = false; - this.#provider.off("block", this.#poll); - } - pause(dropWhilePaused) { - this.stop(); - } - resume() { - this.start(); - } -} -exports.OnBlockSubscriber = OnBlockSubscriber; -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -class PollingOrphanSubscriber extends OnBlockSubscriber { - #filter; - constructor(provider, filter) { - super(provider); - this.#filter = copy(filter); - } - async _poll(blockNumber, provider) { - throw new Error("@TODO"); - console.log(this.#filter); - } -} -exports.PollingOrphanSubscriber = PollingOrphanSubscriber; -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -class PollingTransactionSubscriber extends OnBlockSubscriber { - #hash; - constructor(provider, hash) { - super(provider); - this.#hash = hash; - } - async _poll(blockNumber, provider) { - const tx = await provider.getTransactionReceipt(this.#hash); - if (tx) { - provider.emit(this.#hash, tx); - } - } -} -exports.PollingTransactionSubscriber = PollingTransactionSubscriber; -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -class PollingEventSubscriber { - #provider; - #filter; - #poller; - #running; - // The most recent block we have scanned for events. The value -2 - // indicates we still need to fetch an initial block number - #blockNumber; - constructor(provider, filter) { - this.#provider = provider; - this.#filter = copy(filter); - this.#poller = this.#poll.bind(this); - this.#running = false; - this.#blockNumber = -2; - } - async #poll(blockNumber) { - // The initial block hasn't been determined yet - if (this.#blockNumber === -2) { - return; - } - const filter = copy(this.#filter); - filter.fromBlock = this.#blockNumber + 1; - filter.toBlock = blockNumber; - const logs = await this.#provider.getLogs(filter); - // No logs could just mean the node has not indexed them yet, - // so we keep a sliding window of 60 blocks to keep scanning - if (logs.length === 0) { - if (this.#blockNumber < blockNumber - 60) { - this.#blockNumber = blockNumber - 60; - } - return; - } - this.#blockNumber = blockNumber; - for (const log of logs) { - this.#provider.emit(this.#filter, log); - } - } - start() { - if (this.#running) { - return; - } - this.#running = true; - if (this.#blockNumber === -2) { - this.#provider.getBlockNumber().then((blockNumber) => { - this.#blockNumber = blockNumber; - }); - } - this.#provider.on("block", this.#poller); - } - stop() { - if (!this.#running) { - return; - } - this.#running = false; - this.#provider.off("block", this.#poller); - } - pause(dropWhilePaused) { - this.stop(); - if (dropWhilePaused) { - this.#blockNumber = -2; - } - } - resume() { - this.start(); - } -} -exports.PollingEventSubscriber = PollingEventSubscriber; -//# sourceMappingURL=subscriber-polling.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/subscriber-polling.js.map b/lib.commonjs/providers/subscriber-polling.js.map deleted file mode 100644 index c73438137..000000000 --- a/lib.commonjs/providers/subscriber-polling.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-polling.js","sourceRoot":"","sources":["../../src.ts/providers/subscriber-polling.ts"],"names":[],"mappings":";;;AAAA,gDAAwD;AAKxD,SAAS,IAAI,CAAC,GAAQ;IACpB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAClC,QAA0B,EAC1B,KAAoB;IAEpB,IAAI,KAAK,KAAK,OAAO,EAAE;QACrB,OAAO,IAAI,sBAAsB,CAAC,QAAQ,CAAC,CAAC;KAC7C;IACD,IAAI,IAAA,sBAAW,EAAC,KAAK,EAAE,EAAE,CAAC,EAAE;QAC1B,OAAO,IAAI,4BAA4B,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;KAC1D;IAED,IAAA,iBAAM,EAAC,KAAK,EAAE,2BAA2B,EAAE,uBAAuB,EAAE;QAClE,SAAS,EAAE,sBAAsB;QACjC,IAAI,EAAE,EAAE,KAAK,EAAE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AAC;SACxB;IACH,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF;AA/ED,wDA+EC"} \ No newline at end of file diff --git a/lib.commonjs/providers/ws-browser.d.ts b/lib.commonjs/providers/ws-browser.d.ts deleted file mode 100644 index d92720422..000000000 --- a/lib.commonjs/providers/ws-browser.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const _WebSocket: any; -export { _WebSocket as WebSocket }; -//# sourceMappingURL=ws-browser.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/ws-browser.d.ts.map b/lib.commonjs/providers/ws-browser.d.ts.map deleted file mode 100644 index 63da59ec3..000000000 --- a/lib.commonjs/providers/ws-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ws-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/ws-browser.ts"],"names":[],"mappings":"AAaA,QAAA,MAAM,UAAU,KAAwB,CAAC;AAEzC,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/providers/ws-browser.js b/lib.commonjs/providers/ws-browser.js deleted file mode 100644 index 88df45b31..000000000 --- a/lib.commonjs/providers/ws-browser.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WebSocket = void 0; -function getGlobal() { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw new Error("unable to locate global object"); -} -const _WebSocket = getGlobal().WebSocket; -exports.WebSocket = _WebSocket; -//# sourceMappingURL=ws-browser.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/ws-browser.js.map b/lib.commonjs/providers/ws-browser.js.map deleted file mode 100644 index 36e022e9b..000000000 --- a/lib.commonjs/providers/ws-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ws-browser.js","sourceRoot":"","sources":["../../src.ts/providers/ws-browser.ts"],"names":[],"mappings":";;;AAAA,SAAS,SAAS;IAChB,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC/B,OAAO,IAAI,CAAC;KACb;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC;KACf;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC;KACf;IACD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,GAAG,SAAS,EAAE,CAAC,SAAS,CAAC;AAElB,+BAAS"} \ No newline at end of file diff --git a/lib.commonjs/providers/ws.d.ts b/lib.commonjs/providers/ws.d.ts deleted file mode 100644 index 75d53b7d4..000000000 --- a/lib.commonjs/providers/ws.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { WebSocket } from "ws"; -//# sourceMappingURL=ws.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/providers/ws.d.ts.map b/lib.commonjs/providers/ws.d.ts.map deleted file mode 100644 index c424f8d82..000000000 --- a/lib.commonjs/providers/ws.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src.ts/providers/ws.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/providers/ws.js b/lib.commonjs/providers/ws.js deleted file mode 100644 index c06b35808..000000000 --- a/lib.commonjs/providers/ws.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WebSocket = void 0; -var ws_1 = require("ws"); -Object.defineProperty(exports, "WebSocket", { enumerable: true, get: function () { return ws_1.WebSocket; } }); -//# sourceMappingURL=ws.js.map \ No newline at end of file diff --git a/lib.commonjs/providers/ws.js.map b/lib.commonjs/providers/ws.js.map deleted file mode 100644 index 15568f152..000000000 --- a/lib.commonjs/providers/ws.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ws.js","sourceRoot":"","sources":["../../src.ts/providers/ws.ts"],"names":[],"mappings":";;;AAAA,yBAA+B;AAAtB,+FAAA,SAAS,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/transaction/accesslist.d.ts b/lib.commonjs/transaction/accesslist.d.ts deleted file mode 100644 index aac12cccf..000000000 --- a/lib.commonjs/transaction/accesslist.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { AccessList, AccessListish } from "./index.js"; -/** - * Returns a [[AccessList]] from any corebcsupported access-list structure. - */ -export declare function accessListify(value: AccessListish): AccessList; -//# sourceMappingURL=accesslist.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/transaction/accesslist.d.ts.map b/lib.commonjs/transaction/accesslist.d.ts.map deleted file mode 100644 index 4bd8ae700..000000000 --- a/lib.commonjs/transaction/accesslist.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"accesslist.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/accesslist.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAoB5D;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CA+C9D"} \ No newline at end of file diff --git a/lib.commonjs/transaction/accesslist.js b/lib.commonjs/transaction/accesslist.js deleted file mode 100644 index bf6e4fe5e..000000000 --- a/lib.commonjs/transaction/accesslist.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.accessListify = void 0; -const index_js_1 = require("../address/index.js"); -const index_js_2 = require("../utils/index.js"); -function accessSetify(addr, storageKeys) { - return { - address: (0, index_js_1.getAddress)(addr), - storageKeys: storageKeys.map((storageKey, index) => { - (0, index_js_2.assertArgument)((0, index_js_2.isHexString)(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey); - return storageKey.toLowerCase(); - }), - }; -} -/** - * Returns a [[AccessList]] from any corebcsupported access-list structure. - */ -function accessListify(value) { - if (Array.isArray(value)) { - return value.map((set, index) => { - if (Array.isArray(set)) { - (0, index_js_2.assertArgument)(set.length === 2, "invalid slot set", `value[${index}]`, set); - return accessSetify(set[0], set[1]); - } - (0, index_js_2.assertArgument)(set != null && typeof set === "object", "invalid address-slot set", "value", value); - return accessSetify(set.address, set.storageKeys); - }); - } - (0, index_js_2.assertArgument)(value != null && typeof value === "object", "invalid access list", "value", value); - const result = Object.keys(value).map((addr) => { - const storageKeys = value[addr].reduce((accum, storageKey) => { - accum[storageKey] = true; - return accum; - }, {}); - return accessSetify(addr, Object.keys(storageKeys).sort()); - }); - result.sort((a, b) => a.address.localeCompare(b.address)); - return result; -} -exports.accessListify = accessListify; -//# sourceMappingURL=accesslist.js.map \ No newline at end of file diff --git a/lib.commonjs/transaction/accesslist.js.map b/lib.commonjs/transaction/accesslist.js.map deleted file mode 100644 index 2e6dad05b..000000000 --- a/lib.commonjs/transaction/accesslist.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"accesslist.js","sourceRoot":"","sources":["../../src.ts/transaction/accesslist.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AACjD,gDAAgE;AAIhE,SAAS,YAAY,CACnB,IAAY,EACZ,WAA0B;IAE1B,OAAO;QACL,OAAO,EAAE,IAAA,qBAAU,EAAC,IAAI,CAAC;QACzB,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE;YACjD,IAAA,yBAAc,EACZ,IAAA,sBAAW,EAAC,UAAU,EAAE,EAAE,CAAC,EAC3B,cAAc,EACd,eAAe,KAAK,GAAG,EACvB,UAAU,CACX,CAAC;YACF,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC;QAClC,CAAC,CAAC;KACH,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,KAAoB;IAChD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AAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,OAAO,MAAM,CAAC;AAChB,CAAC;AA/CD,sCA+CC"} \ No newline at end of file diff --git a/lib.commonjs/transaction/address.d.ts b/lib.commonjs/transaction/address.d.ts deleted file mode 100644 index 5abba54e2..000000000 --- a/lib.commonjs/transaction/address.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { SigningKey } from "../crypto/index.js"; -import type { SignatureLike } from "../crypto/index.js"; -import type { BytesLike } from "../utils/index.js"; -/** - * Returns the address for the %%key%%. - * - * The key may be any standard form of public key or a private key. - */ -export declare function removeHexPrefix(val: string): string; -export declare function publicToAddress(key: BytesLike | string, prefix: string): string; -export declare function computeAddress(key: string | SigningKey, prefix: string): string; -/** - * Returns the recovered address for the private key that was - * used to sign %%digest%% that resulted in %%signature%%. - */ -export declare function recoverAddress(digest: BytesLike, signature: SignatureLike, prefix: string): string; -export declare function extractPrefix(address: string): string; -//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/transaction/address.d.ts.map b/lib.commonjs/transaction/address.d.ts.map deleted file mode 100644 index 620aa31e9..000000000 --- a/lib.commonjs/transaction/address.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/address.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD;;;;GAIG;AAEH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,SAAS,GAAG,MAAM,EACvB,MAAM,EAAE,MAAM,GACb,MAAM,CAIR;AAED,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,GAAG,UAAU,EACxB,MAAM,EAAE,MAAM,GACb,MAAM,CAQR;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,MAAM,GACb,MAAM,CAIR;AACD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGrD"} \ No newline at end of file diff --git a/lib.commonjs/transaction/address.js b/lib.commonjs/transaction/address.js deleted file mode 100644 index 3f436b5fd..000000000 --- a/lib.commonjs/transaction/address.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.extractPrefix = exports.recoverAddress = exports.computeAddress = exports.publicToAddress = exports.removeHexPrefix = void 0; -const index_js_1 = require("../address/index.js"); -const index_js_2 = require("../crypto/index.js"); -const data_js_1 = require("../utils/data.js"); -const index_js_3 = require("../address/index.js"); -/** - * Returns the address for the %%key%%. - * - * The key may be any standard form of public key or a private key. - */ -function removeHexPrefix(val) { - return val.substring(0, 2) === "0x" ? val.substring(2) : val; -} -exports.removeHexPrefix = removeHexPrefix; -function publicToAddress(key, prefix) { - const val = (0, data_js_1.hexDataSlice)((0, index_js_2.sha256)(key), 12); - const checksum = (0, index_js_3.calculateCheckSum)(val, prefix); - return "0x" + prefix + checksum + removeHexPrefix(val); -} -exports.publicToAddress = publicToAddress; -function computeAddress(key, prefix) { - let pubkey; - if (typeof key === "string") { - pubkey = index_js_2.SigningKey.computePublicKey(key, false); - } - else { - pubkey = key.publicKey; - } - return publicToAddress(pubkey, prefix); // getAddress(sha256("0x" + pubkey.substring(4)).substring(26)); -} -exports.computeAddress = computeAddress; -/** - * Returns the recovered address for the private key that was - * used to sign %%digest%% that resulted in %%signature%%. - */ -function recoverAddress(digest, signature, prefix) { - // return computeAddress(SigningKey.recoverPublicKey(digest, signature)); - const publicKey = index_js_2.SigningKey.recoverPublicKey((0, data_js_1.arrayify)(digest), signature); - return publicToAddress(publicKey, prefix); -} -exports.recoverAddress = recoverAddress; -function extractPrefix(address) { - address = (0, index_js_1.getAddress)(address); - return address.substring(2, 4); -} -exports.extractPrefix = extractPrefix; -//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/lib.commonjs/transaction/address.js.map b/lib.commonjs/transaction/address.js.map deleted file mode 100644 index 6accac4d3..000000000 --- a/lib.commonjs/transaction/address.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src.ts/transaction/address.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AACjD,iDAAwD;AAIxD,8CAA0D;AAC1D,kDAAwD;AAExD;;;;GAIG;AAEH,SAAgB,eAAe,CAAC,GAAW;IACzC,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC/D,CAAC;AAFD,0CAEC;AAED,SAAgB,eAAe,CAC7B,GAAuB,EACvB,MAAc;IAEd,MAAM,GAAG,GAAG,IAAA,sBAAY,EAAC,IAAA,iBAAM,EAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,IAAA,4BAAiB,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAChD,OAAO,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;AACzD,CAAC;AAPD,0CAOC;AAED,SAAgB,cAAc,CAC5B,GAAwB,EACxB,MAAc;IAEd,IAAI,MAAc,CAAC;IACnB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,MAAM,GAAG,qBAAU,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;KAClD;SAAM;QACL,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC;KACxB;IACD,OAAO,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,gEAAgE;AAC1G,CAAC;AAXD,wCAWC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAC5B,MAAiB,EACjB,SAAwB,EACxB,MAAc;IAEd,yEAAyE;IACzE,MAAM,SAAS,GAAG,qBAAU,CAAC,gBAAgB,CAAC,IAAA,kBAAQ,EAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;IAC3E,OAAO,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AARD,wCAQC;AACD,SAAgB,aAAa,CAAC,OAAe;IAC3C,OAAO,GAAG,IAAA,qBAAU,EAAC,OAAO,CAAC,CAAC;IAC9B,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACjC,CAAC;AAHD,sCAGC"} \ No newline at end of file diff --git a/lib.commonjs/transaction/index.d.ts b/lib.commonjs/transaction/index.d.ts deleted file mode 100644 index 01bca63fa..000000000 --- a/lib.commonjs/transaction/index.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Transactions.. - * - * @_section api/transaction:Transactions [about-transactions] - */ -/** - * A single [[AccessList]] entry of storage keys (slots) for an address. - */ -export type AccessListEntry = { - address: string; - storageKeys: Array; -}; -/** - * An ordered collection of [[AccessList]] entries. - */ -export type AccessList = Array; -/** - * Any corebc-supported access list structure. - */ -export type AccessListish = AccessList | Array<[string, Array]> | Record>; -export { accessListify } from "./accesslist.js"; -export { computeAddress, recoverAddress } from "./address.js"; -export { Transaction } from "./transaction.js"; -export type { TransactionLike } from "./transaction.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/transaction/index.d.ts.map b/lib.commonjs/transaction/index.d.ts.map deleted file mode 100644 index 304612964..000000000 --- a/lib.commonjs/transaction/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,KAAK,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAC9B,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/transaction/index.js b/lib.commonjs/transaction/index.js deleted file mode 100644 index 7257a75d1..000000000 --- a/lib.commonjs/transaction/index.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -/** - * Transactions.. - * - * @_section api/transaction:Transactions [about-transactions] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Transaction = exports.recoverAddress = exports.computeAddress = exports.accessListify = void 0; -null; -var accesslist_js_1 = require("./accesslist.js"); -Object.defineProperty(exports, "accessListify", { enumerable: true, get: function () { return accesslist_js_1.accessListify; } }); -var address_js_1 = require("./address.js"); -Object.defineProperty(exports, "computeAddress", { enumerable: true, get: function () { return address_js_1.computeAddress; } }); -Object.defineProperty(exports, "recoverAddress", { enumerable: true, get: function () { return address_js_1.recoverAddress; } }); -var transaction_js_1 = require("./transaction.js"); -Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return transaction_js_1.Transaction; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.commonjs/transaction/index.js.map b/lib.commonjs/transaction/index.js.map deleted file mode 100644 index cc167e391..000000000 --- a/lib.commonjs/transaction/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/transaction/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,IAAI,CAAC;AAoBL,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,2CAA8D;AAArD,4GAAA,cAAc,OAAA;AAAE,4GAAA,cAAc,OAAA;AACvC,mDAA+C;AAAtC,6GAAA,WAAW,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/transaction/transaction.d.ts b/lib.commonjs/transaction/transaction.d.ts deleted file mode 100644 index 83340f6b5..000000000 --- a/lib.commonjs/transaction/transaction.d.ts +++ /dev/null @@ -1,169 +0,0 @@ -import { Signature } from "../crypto/index.js"; -import type { BigNumberish, BytesLike } from "../utils/index.js"; -import type { SignatureLike } from "../crypto/index.js"; -export interface TransactionLike { - /** - * The recipient address or ``null`` for an ``init`` transaction. - */ - to?: null | A; - /** - * The sender. - */ - from?: null | A; - /** - * The nonce. - */ - nonce?: null | number; - /** - * The maximum amount of energy that can be used. - */ - energyLimit?: null | BigNumberish; - /** - * The energy price for legacy and berlin transactions. - */ - energyPrice?: null | BigNumberish; - /** - * The data. - */ - data?: null | string; - /** - * The value (in ore) to send. - */ - value?: null | BigNumberish; - /** - * The chain ID the transaction is valid on. - */ - networkId?: null | BigNumberish; - /** - * The transaction hash. - */ - hash?: null | string; - /** - * The signature provided by the sender. - */ - signature?: null | SignatureLike; -} -/** - * A **Transaction** describes an operation to be executed on - * Core by an Externally Owned Account (EOA). It includes - * who (the [[to]] address), what (the [[data]]) and how much (the - * [[value]] in corebc) the operation should entail. - * - * @example: - * tx = new Transaction() - * //_result: - * - * tx.data = "0x1234"; - * //_result: - */ -export declare class Transaction implements TransactionLike { - #private; - /** - * The ``to`` address for the transaction or ``null`` if the - * transaction is an ``init`` transaction. - */ - get to(): null | string; - set to(value: null | string); - /** - * The transaction nonce. - */ - get nonce(): number; - set nonce(value: BigNumberish); - /** - * The energy limit. - */ - get energyLimit(): bigint; - set energyLimit(value: BigNumberish); - /** - * The energy price. - * - * On legacy networks this defines the fee that will be paid. On - * EIP-1559 networks, this should be ``null``. - */ - get energyPrice(): null | bigint; - set energyPrice(value: null | BigNumberish); - /** - * The transaction data. For ``init`` transactions this is the - * deployment code. - */ - get data(): string; - set data(value: BytesLike); - /** - * The amount of xcb (in ore) to send in this transactions. - */ - get value(): bigint; - set value(value: BigNumberish); - /** - * The chain ID this transaction is valid on. - */ - get networkId(): bigint; - set networkId(value: BigNumberish); - /** - * If signed, the signature for this transaction. - */ - get signature(): null | string; - set signature(value: null | SignatureLike); - /** - * Creates a new Transaction with default values. - */ - constructor(); - /** - * The transaction hash, if signed. Otherwise, ``null``. - */ - get hash(): null | string; - /** - * The pre-image hash of this transaction. - * - * This is the digest that a [[Signer]] must sign to authorize - * this transaction. - */ - get unsignedHash(): string; - /** - * The sending address, if signed. Otherwise, ``null``. - */ - get from(): null | string; - /** - * The public key of the sender, if signed. Otherwise, ``null``. - */ - get fromPublicKey(): null | string; - /** - * Returns true if signed. - * - * This provides a Type Guard that properties requiring a signed - * transaction are non-null. - */ - isSigned(): this is Transaction & { - type: number; - typeName: string; - from: string; - signature: Signature; - }; - /** - * The serialized transaction. - * - * This throws if the transaction is unsigned. For the pre-image, - * use [[unsignedSerialized]]. - */ - get serialized(): string; - /** - * The transaction pre-image. - * - * The hash of this is the digest which needs to be signed to - * authorize this transaction. - */ - get unsignedSerialized(): string; - /** - * Create a copy of this transaciton. - */ - clone(): Transaction; - /** - * Return a JSON-friendly object. - */ - toJSON(): any; - /** - * Create a **Transaction** from a serialized transaction or a - * Transaction-like object. - */ - static from(tx?: string | TransactionLike): Transaction; -} -//# sourceMappingURL=transaction.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/transaction/transaction.d.ts.map b/lib.commonjs/transaction/transaction.d.ts.map deleted file mode 100644 index f298b00da..000000000 --- a/lib.commonjs/transaction/transaction.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAYnE,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAWxD,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,MAAM;IACzC;;OAEG;IACH,EAAE,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAEtB;;OAEG;IACH,WAAW,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAElC;;OAEG;IACH,WAAW,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAElC;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAEhC;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,IAAI,GAAG,aAAa,CAAC;CAClC;AA2HD;;;;;;;;;;;;GAYG;AACH,qBAAa,WAAY,YAAW,eAAe,CAAC,MAAM,CAAC;;IAUzD;;;OAGG;IACH,IAAI,EAAE,IAAI,IAAI,GAAG,MAAM,CAEtB;IACD,IAAI,EAAE,CAAC,K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AQvB;IAED;;;;;OAKG;IACH,IAAI,kBAAkB,IAAI,MAAM,CAE/B;IAED;;OAEG;IACH,KAAK,IAAI,WAAW;IAIpB;;OAEG;IACH,MAAM,IAAI,GAAG;IAoBb;;;OAGG;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,WAAW;CA6DhE"} \ No newline at end of file diff --git a/lib.commonjs/transaction/transaction.js b/lib.commonjs/transaction/transaction.js deleted file mode 100644 index 4b959a0f4..000000000 --- a/lib.commonjs/transaction/transaction.js +++ /dev/null @@ -1,370 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Transaction = void 0; -const tslib_1 = require("tslib"); -const index_js_1 = require("../address/index.js"); -const index_js_2 = require("../crypto/index.js"); -const index_js_3 = require("../utils/index.js"); -const address_js_1 = require("./address.js"); -const properties_js_1 = require("../utils/properties.js"); -const data_js_1 = require("../utils/data.js"); -const logger_js_1 = require("../logger/logger.js"); -const RLP = tslib_1.__importStar(require("../crypto/rlp.js")); -const bigNumber_js_1 = require("../bigNumber/bigNumber.js"); -const index_js_4 = require("../address/index.js"); -const logger = new logger_js_1.Logger("transaction/0.0.1"); -const BN_0 = BigInt(0); -function handleAddress(value) { - if (value === "0x") { - return null; - } - return (0, index_js_1.getAddress)(value); -} -function parse(data) { - const handleNumber = (value) => { - // @ts-ignore - if (value === "0x") { - return bigNumber_js_1.BigNumber.from(0); - } - return bigNumber_js_1.BigNumber.from(value); - }; - const transaction = RLP.decode(data); - if (transaction.length !== 7 && transaction.length !== 8) { - logger.throwArgumentError("invalid raw transaction", "data", data); - } - const isSigned = transaction.length === 8; - const tx = { - nonce: Number(handleNumber(transaction[0])), - energyPrice: handleNumber(transaction[1]).toBigInt(), - energyLimit: handleNumber(transaction[2]).toBigInt(), - networkId: handleNumber(transaction[isSigned ? 3 : 6]).toBigInt(), - to: handleAddress(transaction[isSigned ? 4 : 3]), - value: handleNumber(transaction[isSigned ? 5 : 4]).toBigInt(), - data: transaction[isSigned ? 6 : 5], - }; - if (transaction.length === 8) { - const prefix = (0, index_js_4.networkIdToPrefix)(Number(tx.networkId)); - const digest = (0, index_js_2.sha256)(serialize(tx)); - tx.hash = (0, index_js_2.sha256)(serialize(tx, transaction[7])); - tx.from = (0, address_js_1.recoverAddress)(digest, transaction[7], prefix); - tx.signature = transaction[7]; - } - return tx; -} -const unsignedTransactionFields = [ - { name: "nonce", maxLength: 32, numeric: true }, - { name: "energyPrice", maxLength: 32, numeric: true }, - { name: "energyLimit", maxLength: 32, numeric: true }, - { name: "to", length: 22 }, - { name: "value", maxLength: 32, numeric: true }, - { name: "data" }, - { name: "networkId", maxLength: 32, numeric: true }, -]; -const transactionFields = [ - { name: "nonce", maxLength: 32, numeric: true }, - { name: "energyPrice", maxLength: 32, numeric: true }, - { name: "energyLimit", maxLength: 32, numeric: true }, - { name: "networkId", maxLength: 32, numeric: true }, - { name: "to", length: 22 }, - { name: "value", maxLength: 32, numeric: true }, - { name: "data" }, -]; -const allowedTransactionKeys = { - networkId: true, - data: true, - energyLimit: true, - energyPrice: true, - nonce: true, - to: true, - value: true, -}; -function serialize(transaction, signature) { - (0, properties_js_1.checkProperties)(transaction, allowedTransactionKeys); - const raw = []; - (!!signature ? transactionFields : unsignedTransactionFields).forEach(function ({ numeric, maxLength, name, length }) { - let value = transaction[name] || []; - const options = {}; - if (numeric) { - options.hexPad = "left"; - } - const tmpHexlified = (0, index_js_3.hexlify)(value, options); - value = (0, data_js_1.arrayify)(tmpHexlified); - // Fixed-width field - if (length && value.length !== length && value.length > 0) { - logger.throwArgumentError("invalid length for " + name, "transaction:" + name, value); - } - // Variable-width (with a maximum) - if (maxLength) { - value = (0, data_js_1.stripZeros)(value); - if (value.length > maxLength) { - logger.throwArgumentError("invalid length for " + name, "transaction:" + name, value); - } - } - const hexlified = (0, index_js_3.hexlify)(value); - raw.push(hexlified); - }); - if (!!signature) { - raw.push((0, index_js_3.hexlify)(signature)); - } - const finalValue = RLP.encode(raw); - return finalValue; -} -/** - * A **Transaction** describes an operation to be executed on - * Core by an Externally Owned Account (EOA). It includes - * who (the [[to]] address), what (the [[data]]) and how much (the - * [[value]] in corebc) the operation should entail. - * - * @example: - * tx = new Transaction() - * //_result: - * - * tx.data = "0x1234"; - * //_result: - */ -class Transaction { - #to; - #data; - #nonce; - #energyLimit; - #energyPrice; - #value; - #networkId; - #sig; - /** - * The ``to`` address for the transaction or ``null`` if the - * transaction is an ``init`` transaction. - */ - get to() { - return this.#to; - } - set to(value) { - this.#to = value == null ? null : (0, index_js_1.getAddress)(value); - } - /** - * The transaction nonce. - */ - get nonce() { - return this.#nonce; - } - set nonce(value) { - this.#nonce = (0, index_js_3.getNumber)(value, "value"); - } - /** - * The energy limit. - */ - get energyLimit() { - return this.#energyLimit; - } - set energyLimit(value) { - this.#energyLimit = (0, index_js_3.getBigInt)(value); - } - /** - * The energy price. - * - * On legacy networks this defines the fee that will be paid. On - * EIP-1559 networks, this should be ``null``. - */ - get energyPrice() { - const value = this.#energyPrice; - if (value == null) { - return BN_0; - } - return value; - } - set energyPrice(value) { - this.#energyPrice = value == null ? null : (0, index_js_3.getBigInt)(value, "energyPrice"); - } - /** - * The transaction data. For ``init`` transactions this is the - * deployment code. - */ - get data() { - return this.#data; - } - set data(value) { - this.#data = (0, index_js_3.hexlify)(value); - } - /** - * The amount of xcb (in ore) to send in this transactions. - */ - get value() { - return this.#value; - } - set value(value) { - this.#value = (0, index_js_3.getBigInt)(value, "value"); - } - /** - * The chain ID this transaction is valid on. - */ - get networkId() { - return this.#networkId; - } - set networkId(value) { - this.#networkId = (0, index_js_3.getBigInt)(value); - } - /** - * If signed, the signature for this transaction. - */ - get signature() { - return this.#sig || null; - } - set signature(value) { - this.#sig = value == null ? null : value; - } - /** - * Creates a new Transaction with default values. - */ - constructor() { - this.#to = null; - this.#nonce = 0; - this.#energyLimit = BigInt(0); - this.#energyPrice = null; - this.#data = "0x"; - this.#value = BigInt(0); - this.#networkId = BigInt(0); - this.#sig = null; - } - /** - * The transaction hash, if signed. Otherwise, ``null``. - */ - get hash() { - if (this.signature == null) { - return null; - } - return (0, index_js_2.sha256)(this.serialized); - } - /** - * The pre-image hash of this transaction. - * - * This is the digest that a [[Signer]] must sign to authorize - * this transaction. - */ - get unsignedHash() { - return (0, index_js_2.sha256)(this.unsignedSerialized); - } - /** - * The sending address, if signed. Otherwise, ``null``. - */ - get from() { - if (this.signature == null) { - return null; - } - const prefix = (0, index_js_4.networkIdToPrefix)(Number(this.#networkId)); - return (0, address_js_1.recoverAddress)(this.unsignedHash, this.signature, prefix); - } - /** - * The public key of the sender, if signed. Otherwise, ``null``. - */ - get fromPublicKey() { - if (this.signature == null) { - return null; - } - return index_js_2.SigningKey.recoverPublicKey(this.unsignedHash, this.signature); - } - /** - * Returns true if signed. - * - * This provides a Type Guard that properties requiring a signed - * transaction are non-null. - */ - isSigned() { - //isSigned(): this is SignedTransaction { - return this.signature != null; - } - /** - * The serialized transaction. - * - * This throws if the transaction is unsigned. For the pre-image, - * use [[unsignedSerialized]]. - */ - get serialized() { - (0, index_js_3.assert)(this.signature != null, "cannot serialize unsigned transaction; maybe you meant .unsignedSerialized", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); - return serialize(this, this.signature); - } - /** - * The transaction pre-image. - * - * The hash of this is the digest which needs to be signed to - * authorize this transaction. - */ - get unsignedSerialized() { - return serialize(this); - } - /** - * Create a copy of this transaciton. - */ - clone() { - return Transaction.from(this); - } - /** - * Return a JSON-friendly object. - */ - toJSON() { - const s = (v) => { - if (v == null) { - return null; - } - return v.toString(); - }; - return { - to: this.to, - data: this.data, - nonce: this.nonce, - energyLimit: s(this.energyLimit), - energyPrice: s(this.energyPrice), - value: s(this.value), - networkId: s(this.networkId), - sig: this.signature ? this.signature : null, - }; - } - /** - * Create a **Transaction** from a serialized transaction or a - * Transaction-like object. - */ - static from(tx) { - if (tx == null) { - return new Transaction(); - } - if (typeof tx === "string") { - const payload = (0, index_js_3.getBytes)(tx); - return Transaction.from(parse(payload)); - } - const result = new Transaction(); - if (tx.to != null) { - result.to = tx.to; - } - if (tx.nonce != null) { - result.nonce = tx.nonce; - } - if (tx.energyLimit != null) { - result.energyLimit = tx.energyLimit; - } - if (tx.energyPrice != null) { - result.energyPrice = tx.energyPrice; - } - if (tx.data != null) { - result.data = tx.data; - } - if (tx.value != null) { - result.value = tx.value; - } - if (tx.networkId != null) { - result.networkId = tx.networkId; - } - if (tx.signature != null) { - result.signature = tx.signature; - } - if (tx.hash != null) { - (0, index_js_3.assertArgument)(result.isSigned(), "unsigned transaction cannot define hash", "tx", tx); - (0, index_js_3.assertArgument)(result.hash === tx.hash, "hash mismatch", "tx", tx); - } - if (tx.from != null) { - (0, index_js_3.assertArgument)(result.isSigned(), "unsigned transaction cannot define from", "tx", tx); - (0, index_js_3.assertArgument)(result.from.toLowerCase() === (tx.from || "").toLowerCase(), "from mismatch", "tx", tx); - } - return result; - } -} -exports.Transaction = Transaction; -//# sourceMappingURL=transaction.js.map \ No newline at end of file diff --git a/lib.commonjs/transaction/transaction.js.map b/lib.commonjs/transaction/transaction.js.map deleted file mode 100644 index 675e20705..000000000 --- a/lib.commonjs/transaction/transaction.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src.ts/transaction/transaction.ts"],"names":[],"mappings":";;;;AAAA,kDAAiD;AACjD,iDAAmE;AACnE,gDAO2B;AAE3B,6CAA8C;AAI9C,0DAAyD;AACzD,8CAAqE;AACrE,mDAA6C;AAC7C,8DAAwC;AACxC,4DAAsD;AACtD,kDAAwD;AAExD,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,mBAAmB,CAAC,CAAC;AAE/C,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAqDvB,SAAS,aAAa,CAAC,KAAa;IAClC,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,OAAO,IAAI,CAAC;K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AI,EAAE,CAAC,IAAI,IAAI,IAAI,EAAE;YACnB,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;SACvB;QACD,IAAI,EAAE,CAAC,KAAK,IAAI,IAAI,EAAE;YACpB,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;SACzB;QACD,IAAI,EAAE,CAAC,SAAS,IAAI,IAAI,EAAE;YACxB,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC;SACjC;QACD,IAAI,EAAE,CAAC,SAAS,IAAI,IAAI,EAAE;YACxB,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC;SACjC;QAED,IAAI,EAAE,CAAC,IAAI,IAAI,IAAI,EAAE;YACnB,IAAA,yBAAc,EACZ,MAAM,CAAC,QAAQ,EAAE,EACjB,yCAAyC,EACzC,IAAI,EACJ,EAAE,CACH,CAAC;YACF,IAAA,yBAAc,EAAC,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;SACpE;QAED,IAAI,EAAE,CAAC,IAAI,IAAI,IAAI,EAAE;YACnB,IAAA,yBAAc,EACZ,MAAM,CAAC,QAAQ,EAAE,EACjB,yCAAyC,EACzC,IAAI,EACJ,EAAE,CACH,CAAC;YACF,IAAA,yBAAc,EACZ,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,EAC3D,eAAe,EACf,IAAI,EACJ,EAAE,CACH,CAAC;SACH;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAnSD,kCAmSC"} \ No newline at end of file diff --git a/lib.commonjs/utils/base58.d.ts b/lib.commonjs/utils/base58.d.ts deleted file mode 100644 index 8b377936b..000000000 --- a/lib.commonjs/utils/base58.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * The [Base58 Encoding](link-base58) scheme allows a **numeric** value - * to be encoded as a compact string using a radix of 58 using only - * alpha-numeric characters. Confusingly similar characters are omitted - * (i.e. ``"l0O"``). - * - * Note that Base58 encodes a **numeric** value, not arbitrary bytes, - * since any zero-bytes on the left would get removed. To mitigate this - * issue most schemes that use Base58 choose specific high-order values - * to ensure non-zero prefixes. - * - * @_subsection: api/utils:Base58 Encoding [about-base58] - */ -import type { BytesLike } from "./index.js"; -/** - * Encode %%value%% as a Base58-encoded string. - */ -export declare function encodeBase58(_value: BytesLike): string; -/** - * Decode the Base58-encoded %%value%%. - */ -export declare function decodeBase58(value: string): bigint; -//# sourceMappingURL=base58.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/base58.d.ts.map b/lib.commonjs/utils/base58.d.ts.map deleted file mode 100644 index 21386c9f3..000000000 --- a/lib.commonjs/utils/base58.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base58.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base58.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAoB5C;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAQtD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOlD"} \ No newline at end of file diff --git a/lib.commonjs/utils/base58.js b/lib.commonjs/utils/base58.js deleted file mode 100644 index 16f4c2404..000000000 --- a/lib.commonjs/utils/base58.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; -/** - * The [Base58 Encoding](link-base58) scheme allows a **numeric** value - * to be encoded as a compact string using a radix of 58 using only - * alpha-numeric characters. Confusingly similar characters are omitted - * (i.e. ``"l0O"``). - * - * Note that Base58 encodes a **numeric** value, not arbitrary bytes, - * since any zero-bytes on the left would get removed. To mitigate this - * issue most schemes that use Base58 choose specific high-order values - * to ensure non-zero prefixes. - * - * @_subsection: api/utils:Base58 Encoding [about-base58] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.decodeBase58 = exports.encodeBase58 = void 0; -const data_js_1 = require("./data.js"); -const errors_js_1 = require("./errors.js"); -const maths_js_1 = require("./maths.js"); -const Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; -let Lookup = null; -function getAlpha(letter) { - if (Lookup == null) { - Lookup = {}; - for (let i = 0; i < Alphabet.length; i++) { - Lookup[Alphabet[i]] = BigInt(i); - } - } - const result = Lookup[letter]; - (0, errors_js_1.assertArgument)(result != null, `invalid base58 value`, "letter", letter); - return result; -} -const BN_0 = BigInt(0); -const BN_58 = BigInt(58); -/** - * Encode %%value%% as a Base58-encoded string. - */ -function encodeBase58(_value) { - let value = (0, maths_js_1.toBigInt)((0, data_js_1.getBytes)(_value)); - let result = ""; - while (value) { - result = Alphabet[Number(value % BN_58)] + result; - value /= BN_58; - } - return result; -} -exports.encodeBase58 = encodeBase58; -/** - * Decode the Base58-encoded %%value%%. - */ -function decodeBase58(value) { - let result = BN_0; - for (let i = 0; i < value.length; i++) { - result *= BN_58; - result += getAlpha(value[i]); - } - return result; -} -exports.decodeBase58 = decodeBase58; -//# sourceMappingURL=base58.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/base58.js.map b/lib.commonjs/utils/base58.js.map deleted file mode 100644 index db61f2d9e..000000000 --- a/lib.commonjs/utils/base58.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base58.js","sourceRoot":"","sources":["../../src.ts/utils/base58.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAEH,uCAAqC;AACrC,2CAA6C;AAC7C,yCAAsC;AAItC,MAAM,QAAQ,GAAG,4DAA4D,CAAC;AAC9E,IAAI,MAAM,GAAkC,IAAI,CAAC;AAEjD,SAAS,QAAQ,CAAC,MAAc;IAC9B,IAAI,MAAM,IAAI,IAAI,EAAE;QA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ib.commonjs/utils/base64-browser.d.ts b/lib.commonjs/utils/base64-browser.d.ts deleted file mode 100644 index ea96c442c..000000000 --- a/lib.commonjs/utils/base64-browser.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { BytesLike } from "./data.js"; -export declare function decodeBase64(textData: string): Uint8Array; -export declare function encodeBase64(_data: BytesLike): string; -//# sourceMappingURL=base64-browser.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/base64-browser.d.ts.map b/lib.commonjs/utils/base64-browser.d.ts.map deleted file mode 100644 index 83a734cd1..000000000 --- a/lib.commonjs/utils/base64-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base64-browser.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base64-browser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAOzD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAOrD"} \ No newline at end of file diff --git a/lib.commonjs/utils/base64-browser.js b/lib.commonjs/utils/base64-browser.js deleted file mode 100644 index ecab4a50a..000000000 --- a/lib.commonjs/utils/base64-browser.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -// utils/base64-browser -Object.defineProperty(exports, "__esModule", { value: true }); -exports.encodeBase64 = exports.decodeBase64 = void 0; -const data_js_1 = require("./data.js"); -function decodeBase64(textData) { - textData = atob(textData); - const data = new Uint8Array(textData.length); - for (let i = 0; i < textData.length; i++) { - data[i] = textData.charCodeAt(i); - } - return (0, data_js_1.getBytes)(data); -} -exports.decodeBase64 = decodeBase64; -function encodeBase64(_data) { - const data = (0, data_js_1.getBytes)(_data); - let textData = ""; - for (let i = 0; i < data.length; i++) { - textData += String.fromCharCode(data[i]); - } - return btoa(textData); -} -exports.encodeBase64 = encodeBase64; -//# sourceMappingURL=base64-browser.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/base64-browser.js.map b/lib.commonjs/utils/base64-browser.js.map deleted file mode 100644 index 184743902..000000000 --- a/lib.commonjs/utils/base64-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base64-browser.js","sourceRoot":"","sources":["../../src.ts/utils/base64-browser.ts"],"names":[],"mappings":";AAAA,uBAAuB;;;AAEvB,uCAAqC;AAIrC,SAAgB,YAAY,CAAC,QAAgB;IAC3C,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,IAAI,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KAClC;IACD,OAAO,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AAPD,oCAOC;AAED,SAAgB,YAAY,CAAC,KAAgB;IAC3C,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,QAAQ,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1C;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC;AACxB,CAAC;AAPD,oCAOC"} \ No newline at end of file diff --git a/lib.commonjs/utils/base64.d.ts b/lib.commonjs/utils/base64.d.ts deleted file mode 100644 index 0cab53288..000000000 --- a/lib.commonjs/utils/base64.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { BytesLike } from "./data.js"; -/** - * Decodes the base-64 encoded %%value%%. - * - * @example: - * // The decoded value is always binary data... - * result = decodeBase64("SGVsbG8gV29ybGQhIQ==") - * //_result: - * - * // ...use toUtf8String to convert it to a string. - * toUtf8String(result) - * //_result: - * - * // Decoding binary data - * decodeBase64("EjQ=") - * //_result: - */ -export declare function decodeBase64(value: string): Uint8Array; -/** - * Encodes %%data%% as a base-64 encoded string. - * - * @example: - * // Encoding binary data as a hexstring - * encodeBase64("0x1234") - * //_result: - * - * // Encoding binary data as a Uint8Array - * encodeBase64(new Uint8Array([ 0x12, 0x34 ])) - * //_result: - * - * // The input MUST be data... - * encodeBase64("Hello World!!") - * //_error: - * - * // ...use toUtf8Bytes for this. - * encodeBase64(toUtf8Bytes("Hello World!!")) - * //_result: - */ -export declare function encodeBase64(data: BytesLike): string; -//# sourceMappingURL=base64.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/base64.d.ts.map b/lib.commonjs/utils/base64.d.ts.map deleted file mode 100644 index 34656262c..000000000 --- a/lib.commonjs/utils/base64.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base64.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAEtD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAEpD"} \ No newline at end of file diff --git a/lib.commonjs/utils/base64.js b/lib.commonjs/utils/base64.js deleted file mode 100644 index 73d372770..000000000 --- a/lib.commonjs/utils/base64.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.encodeBase64 = exports.decodeBase64 = void 0; -/** - * [Base64 encoding](link-wiki-base64) using 6-bit words to encode - * arbitrary bytes into a string using 65 printable symbols, the - * upper-case and lower-case alphabet, the digits ``0`` through ``9``, - * ``"+"`` and ``"/"`` with the ``"="`` used for padding. - * - * @_subsection: api/utils:Base64 Encoding [about-base64] - */ -const data_js_1 = require("./data.js"); -/** - * Decodes the base-64 encoded %%value%%. - * - * @example: - * // The decoded value is always binary data... - * result = decodeBase64("SGVsbG8gV29ybGQhIQ==") - * //_result: - * - * // ...use toUtf8String to convert it to a string. - * toUtf8String(result) - * //_result: - * - * // Decoding binary data - * decodeBase64("EjQ=") - * //_result: - */ -function decodeBase64(value) { - return (0, data_js_1.getBytesCopy)(Buffer.from(value, "base64")); -} -exports.decodeBase64 = decodeBase64; -/** - * Encodes %%data%% as a base-64 encoded string. - * - * @example: - * // Encoding binary data as a hexstring - * encodeBase64("0x1234") - * //_result: - * - * // Encoding binary data as a Uint8Array - * encodeBase64(new Uint8Array([ 0x12, 0x34 ])) - * //_result: - * - * // The input MUST be data... - * encodeBase64("Hello World!!") - * //_error: - * - * // ...use toUtf8Bytes for this. - * encodeBase64(toUtf8Bytes("Hello World!!")) - * //_result: - */ -function encodeBase64(data) { - return Buffer.from((0, data_js_1.getBytes)(data)).toString("base64"); -} -exports.encodeBase64 = encodeBase64; -//# sourceMappingURL=base64.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/base64.js.map b/lib.commonjs/utils/base64.js.map deleted file mode 100644 index f42d22710..000000000 --- a/lib.commonjs/utils/base64.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src.ts/utils/base64.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,uCAAmD;AAInD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,YAAY,CAAC,KAAa;IACxC,OAAO,IAAA,sBAAY,EAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AACpD,CAAC;AAFD,oCAEC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,YAAY,CAAC,IAAe;IAC1C,OAAO,MAAM,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACxD,CAAC;AAFD,oCAEC"} \ No newline at end of file diff --git a/lib.commonjs/utils/data.d.ts b/lib.commonjs/utils/data.d.ts deleted file mode 100644 index 59cca6eba..000000000 --- a/lib.commonjs/utils/data.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/** - * A [[HexString]] whose length is even, which ensures it is a valid - * representation of binary data. - */ -export type DataHexString = string; -/** - * A string which is prefixed with ``0x`` and followed by any number - * of case-agnostic hexadecimal characters. - * - * It must match the regular expression ``/0x[0-9A-Fa-f]*\/``. - */ -export type HexString = string; -/** - * An object that can be used to represent binary data. - */ -export type Bytes = ArrayLike; -export type BytesLike = Bytes | string; -export type DataOptions = { - allowMissingPrefix?: boolean; - hexPad?: "left" | "right" | null; -}; -export interface Hexable { - toHexString(): string; -} -export declare function isBytes(value: any): value is Bytes; -/** - * Get a typed Uint8Array for %%value%%. If already a Uint8Array - * the original %%value%% is returned; if a copy is required use - * [[getBytesCopy]]. - * - * @see: getBytesCopy - */ -export declare function getBytes(value: BytesLike, name?: string): Uint8Array; -/** - * Get a typed Uint8Array for %%value%%, creating a copy if necessary - * to prevent any modifications of the returned value from being - * reflected elsewhere. - * - * @see: getBytes - */ -export declare function getBytesCopy(value: BytesLike, name?: string): Uint8Array; -/** - * Returns true if %%value%% is a valid [[HexString]]. - * - * If %%length%% is ``true`` or a //number//, it also checks that - * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) - * bytes of data (e.g. ``0x1234`` is 2 bytes). - */ -export declare function isHexString(value: any, length?: number | boolean): value is `0x${string}`; -/** - * Returns true if %%value%% is a valid representation of arbitrary - * data (i.e. a valid [[DataHexString]] or a Uint8Array). - */ -export declare function isBytesLike(value: any): value is BytesLike; -/** - * Returns a [[DataHexString]] representation of %%data%%. - */ -export declare function hexlify(value: BytesLike | Hexable | number | bigint, options?: DataOptions): string; -/** - * Returns a [[DataHexString]] by concatenating all values - * within %%data%%. - */ -export declare function concat(items: ReadonlyArray): string; -export declare function hexDataSlice(data: BytesLike, offset: number, endOffset?: number): string; -export declare function hexDataLength(data: BytesLike): number | null; -/** - * Returns the length of %%data%%, in bytes. - */ -export declare function dataLength(data: BytesLike): number; -/** - * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% - * offset to the %%end%% offset. - * - * By default %%start%% is 0 and %%end%% is the length of %%data%%. - */ -export declare function dataSlice(data: BytesLike, start?: number, end?: number): string; -/** - * Return the [[DataHexString]] result by stripping all **leading** - ** zero bytes from %%data%%. - */ -export declare function stripZerosLeft(data: BytesLike): string; -/** - * Return the [[DataHexString]] of %%data%% padded on the **left** - * to %%length%% bytes. - * - * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is - * thrown. - * - * This pads data the same as **values** are in Solidity - * (e.g. ``uint128``). - */ -export declare function zeroPadValue(data: BytesLike, length: number): string; -/** - * Return the [[DataHexString]] of %%data%% padded on the **right** - * to %%length%% bytes. - * - * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is - * thrown. - * - * This pads data the same as **bytes** are in Solidity - * (e.g. ``bytes16``). - */ -export declare function zeroPadBytes(data: BytesLike, length: number): string; -export declare function stripZeros(value: BytesLike): Uint8Array; -export declare function arrayify(value: BytesLike | Hexable | number, options?: DataOptions): Uint8Array; -export declare function hexConcat(items: ReadonlyArray): string; -//# sourceMappingURL=data.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/data.d.ts.map b/lib.commonjs/utils/data.d.ts.map deleted file mode 100644 index b82bf731e..000000000 --- a/lib.commonjs/utils/data.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src.ts/utils/data.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AA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AAC,EAAE,MAAM,GACjB,MAAM,CAcR;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,iBAQ5C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAKlD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,SAAS,EACf,KAAK,CAAC,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,MAAM,GACX,MAAM,CAYR;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAMtD;AA0BD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,CAmBvD;AAED,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,EACnC,OAAO,CAAC,EAAE,WAAW,GACpB,UAAU,CAuDZ;AAeD,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,MAAM,CAMjE"} \ No newline at end of file diff --git a/lib.commonjs/utils/data.js b/lib.commonjs/utils/data.js deleted file mode 100644 index 4d0fb3a5d..000000000 --- a/lib.commonjs/utils/data.js +++ /dev/null @@ -1,386 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.hexConcat = exports.arrayify = exports.stripZeros = exports.zeroPadBytes = exports.zeroPadValue = exports.stripZerosLeft = exports.dataSlice = exports.dataLength = exports.hexDataLength = exports.hexDataSlice = exports.concat = exports.hexlify = exports.isBytesLike = exports.isHexString = exports.getBytesCopy = exports.getBytes = exports.isBytes = void 0; -/** - * Some data helpers. - * - * - * @_subsection api/utils:Data Helpers [about-data] - */ -const logger_js_1 = require("../logger/logger.js"); -const errors_js_1 = require("./errors.js"); -const logger = new logger_js_1.Logger("utils/data/0.0.1"); -function isHexable(value) { - return !!value.toHexString; -} -function isInteger(value) { - return typeof value === "number" && value == value && value % 1 === 0; -} -function isBytes(value) { - if (value == null) { - return false; - } - if (value.constructor === Uint8Array) { - return true; - } - if (typeof value === "string") { - return false; - } - if (!isInteger(value.length) || value.length < 0) { - return false; - } - for (let i = 0; i < value.length; i++) { - const v = value[i]; - if (!isInteger(v) || v < 0 || v >= 256) { - return false; - } - } - return true; -} -exports.isBytes = isBytes; -function _getBytes(value, name, copy) { - if (value instanceof Uint8Array) { - if (copy) { - return new Uint8Array(value); - } - return value; - } - if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) { - const result = new Uint8Array((value.length - 2) / 2); - let offset = 2; - for (let i = 0; i < result.length; i++) { - result[i] = parseInt(value.substring(offset, offset + 2), 16); - offset += 2; - } - return result; - } - (0, errors_js_1.assertArgument)(false, "invalid BytesLike value", name || "value", value); -} -/** - * Get a typed Uint8Array for %%value%%. If already a Uint8Array - * the original %%value%% is returned; if a copy is required use - * [[getBytesCopy]]. - * - * @see: getBytesCopy - */ -function getBytes(value, name) { - return _getBytes(value, name, false); -} -exports.getBytes = getBytes; -/** - * Get a typed Uint8Array for %%value%%, creating a copy if necessary - * to prevent any modifications of the returned value from being - * reflected elsewhere. - * - * @see: getBytes - */ -function getBytesCopy(value, name) { - return _getBytes(value, name, true); -} -exports.getBytesCopy = getBytesCopy; -/** - * Returns true if %%value%% is a valid [[HexString]]. - * - * If %%length%% is ``true`` or a //number//, it also checks that - * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) - * bytes of data (e.g. ``0x1234`` is 2 bytes). - */ -function isHexString(value, length) { - if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { - return false; - } - if (typeof length === "number" && value.length !== 2 + 2 * length) { - return false; - } - if (length === true && value.length % 2 !== 0) { - return false; - } - return true; -} -exports.isHexString = isHexString; -/** - * Returns true if %%value%% is a valid representation of arbitrary - * data (i.e. a valid [[DataHexString]] or a Uint8Array). - */ -function isBytesLike(value) { - return isHexString(value, true) || value instanceof Uint8Array; -} -exports.isBytesLike = isBytesLike; -const HexCharacters = "0123456789abcdef"; -/** - * Returns a [[DataHexString]] representation of %%data%%. - */ -function hexlify(value, options) { - if (!options) { - options = {}; - } - if (typeof value === "string") { - if (value.includes(",") && value.startsWith("0x")) { - const v = value - .replace("0x", "") - .split(",") - .map((item) => Number(item)); - // @ts-ignore - value = new Uint8Array(v); - } - } - if (typeof value === "number") { - logger.checkSafeUint53(value, "invalid hexlify value"); - let hex = ""; - while (value) { - hex = HexCharacters[value & 0xf] + hex; - value = Math.floor(value / 16); - } - if (hex.length) { - if (hex.length % 2) { - hex = "0" + hex; - } - return "0x" + hex; - } - return "0x00"; - } - if (typeof value === "bigint") { - value = value.toString(16); - if (value.length % 2) { - return "0x0" + value; - } - return "0x" + value; - } - if (options.allowMissingPrefix && - typeof value === "string" && - value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - if (isHexable(value)) { - return value.toHexString(); - } - if (isHexString(value)) { - if (value.length % 2) { - if (options.hexPad === "left") { - value = "0x0" + value.substring(2); - } - else if (options.hexPad === "right") { - value += "0"; - } - else { - logger.throwArgumentError("hex data is odd-length", "value", value); - } - } - return value.toLowerCase(); - } - if (isBytes(value)) { - let result = "0x"; - for (let i = 0; i < value.length; i++) { - let v = value[i]; - result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; - } - return result; - } - return logger.throwArgumentError("invalid hexlify value", "value", value); -} -exports.hexlify = hexlify; -/** - * Returns a [[DataHexString]] by concatenating all values - * within %%data%%. - */ -function concat(items) { - return "0x" + items.map((d) => hexlify(d).substring(2)).join(""); -} -exports.concat = concat; -function hexDataSlice(data, offset, endOffset) { - if (typeof data !== "string") { - data = hexlify(data); - } - else if (!isHexString(data) || data.length % 2) { - logger.throwArgumentError("invalid hexData", "value", data); - } - offset = 2 + 2 * offset; - if (endOffset != null) { - return "0x" + data.substring(offset, 2 + 2 * endOffset); - } - return "0x" + data.substring(offset); -} -exports.hexDataSlice = hexDataSlice; -function hexDataLength(data) { - if (typeof data !== "string") { - data = hexlify(data); - } - else if (!isHexString(data) || data.length % 2) { - return null; - } - return (data.length - 2) / 2; -} -exports.hexDataLength = hexDataLength; -/** - * Returns the length of %%data%%, in bytes. - */ -function dataLength(data) { - if (isHexString(data, true)) { - return (data.length - 2) / 2; - } - return getBytes(data).length; -} -exports.dataLength = dataLength; -/** - * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% - * offset to the %%end%% offset. - * - * By default %%start%% is 0 and %%end%% is the length of %%data%%. - */ -function dataSlice(data, start, end) { - const bytes = getBytes(data); - if (end != null && end > bytes.length) { - (0, errors_js_1.assert)(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { - buffer: bytes, - length: bytes.length, - offset: end, - }); - } - return hexlify(bytes.slice(start == null ? 0 : start, end == null ? bytes.length : end)); -} -exports.dataSlice = dataSlice; -/** - * Return the [[DataHexString]] result by stripping all **leading** - ** zero bytes from %%data%%. - */ -function stripZerosLeft(data) { - let bytes = hexlify(data).substring(2); - while (bytes.startsWith("00")) { - bytes = bytes.substring(2); - } - return "0x" + bytes; -} -exports.stripZerosLeft = stripZerosLeft; -function zeroPad(data, length, left) { - const bytes = getBytes(data); - (0, errors_js_1.assert)(length >= bytes.length, "padding exceeds data length", "BUFFER_OVERRUN", { - buffer: new Uint8Array(bytes), - length: length, - offset: length + 1, - }); - const result = new Uint8Array(length); - result.fill(0); - if (left) { - result.set(bytes, length - bytes.length); - } - else { - result.set(bytes, 0); - } - return hexlify(result); -} -/** - * Return the [[DataHexString]] of %%data%% padded on the **left** - * to %%length%% bytes. - * - * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is - * thrown. - * - * This pads data the same as **values** are in Solidity - * (e.g. ``uint128``). - */ -function zeroPadValue(data, length) { - return zeroPad(data, length, true); -} -exports.zeroPadValue = zeroPadValue; -/** - * Return the [[DataHexString]] of %%data%% padded on the **right** - * to %%length%% bytes. - * - * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is - * thrown. - * - * This pads data the same as **bytes** are in Solidity - * (e.g. ``bytes16``). - */ -function zeroPadBytes(data, length) { - return zeroPad(data, length, false); -} -exports.zeroPadBytes = zeroPadBytes; -function stripZeros(value) { - let result = arrayify(value); - if (result.length === 0) { - return result; - } - // Find the first non-zero entry - let start = 0; - while (start < result.length && result[start] === 0) { - start++; - } - // If we started with zeros, strip them - if (start) { - result = result.slice(start); - } - return result; -} -exports.stripZeros = stripZeros; -function arrayify(value, options) { - if (!options) { - options = {}; - } - if (typeof value === "number") { - logger.checkSafeUint53(value, "invalid arrayify value"); - const result = []; - while (value) { - // @ts-ignore - result.unshift(value & 0xff); - value = parseInt(String(value / 256)); - } - if (result.length === 0) { - result.push(0); - } - return addSlice(new Uint8Array(result)); - } - if (options.allowMissingPrefix && - typeof value === "string" && - value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - if (isHexable(value)) { - value = value.toHexString(); - } - if (isHexString(value)) { - let hex = value.substring(2); - if (hex.length % 2) { - if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); - } - else if (options.hexPad === "right") { - hex += "0"; - } - else { - logger.throwArgumentError("hex data is odd-length", "value", value); - } - } - const result = []; - for (let i = 0; i < hex.length; i += 2) { - // @ts-ignore - result.push(parseInt(hex.substring(i, i + 2), 16)); - } - return addSlice(new Uint8Array(result)); - } - if (isBytes(value)) { - return addSlice(new Uint8Array(value)); - } - return logger.throwArgumentError("invalid arrayify value", "value", value); -} -exports.arrayify = arrayify; -function addSlice(array) { - // @ts-ignore - if (array.slice) { - return array; - } - array.slice = function () { - const args = Array.prototype.slice.call(arguments); - return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args))); - }; - return array; -} -function hexConcat(items) { - let result = "0x"; - items.forEach((item) => { - result += hexlify(item).substring(2); - }); - return result; -} -exports.hexConcat = hexConcat; -//# sourceMappingURL=data.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/data.js.map b/lib.commonjs/utils/data.js.map deleted file mode 100644 index 9aa67c61f..000000000 --- a/lib.commonjs/utils/data.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src.ts/utils/data.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,mDAA6C;AAC7C,2CAAqD;AACrD,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,kBAAkB,CAAC,CAAC;AA8B9C,SAAS,SAAS,CAAC,KAAU;IAC3B,OAAO,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;AAC7B,CAAC;AACD,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,KAAK,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC;AAED,SAAgB,OAAO,CAAC,KAAU;IAChC,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,KAAK,CAAC;KACd;IAED,IAAI,KAAK,CAAC,WAAW,KAAK,UAAU,EAAE;QACpC,OAAO,IAAI,CAAC;KACb;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAO,KAAK,CAAC;KACd;IACD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QAChD,OAAO,KAAK,CAAC;KACd;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI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,EAAE,CAAC,CAAC,CAAC;SACpD;QAED,OAAO,QAAQ,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;KACzC;IAED,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;QAClB,OAAO,QAAQ,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;KACxC;IAED,OAAO,MAAM,CAAC,kBAAkB,CAAC,wBAAwB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7E,CAAC;AA1DD,4BA0DC;AACD,SAAS,QAAQ,CAAC,KAAiB;IACjC,aAAa;IACb,IAAI,KAAK,CAAC,KAAK,EAAE;QACf,OAAO,KAAK,CAAC;KACd;IAED,KAAK,CAAC,KAAK,GAAG;QACZ,MAAM,IAAI,GAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxD,OAAO,QAAQ,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5E,CAAC,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,SAAS,CAAC,KAA+B;IACvD,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAND,8BAMC"} \ No newline at end of file diff --git a/lib.commonjs/utils/errors.d.ts b/lib.commonjs/utils/errors.d.ts deleted file mode 100644 index 130aa0621..000000000 --- a/lib.commonjs/utils/errors.d.ts +++ /dev/null @@ -1,486 +0,0 @@ -/** - * About Errors. - * - * @_section: api/utils/errors:Errors [about-errors] - */ -import type { TransactionRequest, TransactionReceipt, TransactionResponse } from "../providers/index.js"; -import type { FetchRequest, FetchResponse } from "./fetch.js"; -export type ErrorInfo = Omit; -/** - * All errors emitted by corebc have an **ErrorCode** to help - * identify and coalesce errors to simplfy programatic analysis. - * - * Each **ErrorCode** is the %%code%% proerty of a coresponding - * [[corebcError]]. - * - * **Generic Errors** - * - * **``"UNKNOWN_ERROR"``** - see [[UnknownError]] - * - * **``"NOT_IMPLEMENTED"``** - see [[NotImplementedError]] - * - * **``"UNSUPPORTED_OPERATION"``** - see [[UnsupportedOperationError]] - * - * **``"NETWORK_ERROR"``** - see [[NetworkError]] - * - * **``"SERVER_ERROR"``** - see [[ServerError]] - * - * **``"TIMEOUT"``** - see [[TimeoutError]] - * - * **``"BAD_DATA"``** - see [[BadDataError]] - * - * **``"CANCELLED"``** - see [[CancelledError]] - * - * **Operational Errors** - * - * **``"BUFFER_OVERRUN"``** - see [[BufferOverrunError]] - * - * **``"NUMERIC_FAULT"``** - see [[NumericFaultError]] - * - * **Argument Errors** - * - * **``"INVALID_ARGUMENT"``** - see [[InvalidArgumentError]] - * - * **``"MISSING_ARGUMENT"``** - see [[MissingArgumentError]] - * - * **``"UNEXPECTED_ARGUMENT"``** - see [[UnexpectedArgumentError]] - * - * **``"VALUE_MISMATCH"``** - //unused// - * - * **Blockchain Errors** - * - * **``"CALL_EXCEPTION"``** - see [[CallExceptionError]] - * - * **``"INSUFFICIENT_FUNDS"``** - see [[InsufficientFundsError]] - * - * **``"NONCE_EXPIRED"``** - see [[NonceExpiredError]] - * - * **``"REPLACEMENT_UNDERPRICED"``** - see [[ReplacementUnderpricedError]] - * - * **``"TRANSACTION_REPLACED"``** - see [[TransactionReplacedError]] - * - * **``"UNCONFIGURED_NAME"``** - see [[UnconfiguredNameError]] - * - * **``"OFFCHAIN_FAULT"``** - see [[OffchainFaultError]] - * - * **User Interaction Errors** - * - * **``"ACTION_REJECTED"``** - see [[ActionRejectedError]] - */ -export type ErrorCode = "UNKNOWN_ERROR" | "NOT_IMPLEMENTED" | "UNSUPPORTED_OPERATION" | "NETWORK_ERROR" | "SERVER_ERROR" | "TIMEOUT" | "BAD_DATA" | "CANCELLED" | "BUFFER_OVERRUN" | "NUMERIC_FAULT" | "INVALID_ARGUMENT" | "MISSING_ARGUMENT" | "UNEXPECTED_ARGUMENT" | "VALUE_MISMATCH" | "CALL_EXCEPTION" | "INSUFFICIENT_FUNDS" | "NONCE_EXPIRED" | "REPLACEMENT_UNDERPRICED" | "TRANSACTION_REPLACED" | "UNCONFIGURED_NAME" | "OFFCHAIN_FAULT" | "ACTION_REJECTED"; -/** - * All errors in corebc include properties to assist in - * machine-readable errors. - */ -export interface CoreBCError extends Error { - /** - * The string error code. - */ - code: ErrorCode; - /** - * Additional info regarding the error that may be useful. - * - * This is generally helpful mostly for human-based debugging. - */ - info?: Record; - /** - * Any related error. - */ - error?: Error; -} -/** - * This Error is a catch-all for when there is no way for corebc to - * know what the underlying problem is. - */ -export interface UnknownError extends CoreBCError<"UNKNOWN_ERROR"> { - [key: string]: any; -} -/** - * This Error is mostly used as a stub for functionality that is - * intended for the future, but is currently not implemented. - */ -export interface NotImplementedError extends CoreBCError<"NOT_IMPLEMENTED"> { - /** - * The attempted operation. - */ - operation: string; -} -/** - * This Error indicates that the attempted operation is not supported. - * - * This could range from a specifc JSON-RPC end-point not supporting - * a feature to a specific configuration of an object prohibiting the - * operation. - * - * For example, a [[Wallet]] with no connected [[Provider]] is unable - * to send a transaction. - */ -export interface UnsupportedOperationError extends CoreBCError<"UNSUPPORTED_OPERATION"> { - /** - * The attempted operation. - */ - operation: string; -} -export interface NetworkError extends CoreBCError<"NETWORK_ERROR"> { - event: string; -} -/** - * This Error indicates there was a problem fetching a resource from - * a server. - */ -export interface ServerError extends CoreBCError<"SERVER_ERROR"> { - /** - * The requested resource. - */ - request: FetchRequest | string; - /** - * The response received from the server, if available. - */ - response?: FetchResponse; -} -/** - * This Error indicates that the timeout duration has expired and - * that the operation has been implicitly cancelled. - * - * The side-effect of the operation may still occur, as this - * generally means a request has been sent and there has simply - * been no response to indicate whether it was processed or not. - */ -export interface TimeoutError extends CoreBCError<"TIMEOUT"> { - /** - * The attempted operation. - */ - operation: string; - /** - * The reason. - */ - reason: string; - /** - * The resource request, if available. - */ - request?: FetchRequest; -} -/** - * This Error indicates that a provided set of data cannot - * be correctly interpretted. - */ -export interface BadDataError extends CoreBCError<"BAD_DATA"> { - /** - * The data. - */ - value: any; -} -/** - * This Error indicates that the operation was cancelled by a - * programmatic call, for example to ``cancel()``. - */ -export interface CancelledError extends CoreBCError<"CANCELLED"> { -} -/** - * This Error indicates an attempt was made to read outside the bounds - * of protected data. - * - * Most operations in corebc are protected by bounds checks, to mitigate - * exploits when parsing data. - */ -export interface BufferOverrunError extends CoreBCError<"BUFFER_OVERRUN"> { - /** - * The buffer that was overrun. - */ - buffer: Uint8Array; - /** - * The length of the buffer. - */ - length: number; - /** - * The offset that was requested. - */ - offset: number; -} -/** - * This Error indicates an operation which would result in incorrect - * arithmetic output has occurred. - * - * For example, trying to divide by zero or using a ``uint8`` to store - * a negative value. - */ -export interface NumericFaultError extends CoreBCError<"NUMERIC_FAULT"> { - /** - * The attempted operation. - */ - operation: string; - /** - * The fault reported. - */ - fault: string; - /** - * The value the operation was attempted against. - */ - value: any; -} -/** - * This Error indicates an incorrect type or value was passed to - * a function or method. - */ -export interface InvalidArgumentError extends CoreBCError<"INVALID_ARGUMENT"> { - /** - * The name of the argument. - */ - argument: string; - /** - * The value that was provided. - */ - value: any; - info?: Record; -} -/** - * This Error indicates there were too few arguments were provided. - */ -export interface MissingArgumentError extends CoreBCError<"MISSING_ARGUMENT"> { - /** - * The number of arguments received. - */ - count: number; - /** - * The number of arguments expected. - */ - expectedCount: number; -} -/** - * This Error indicates too many arguments were provided. - */ -export interface UnexpectedArgumentError extends CoreBCError<"UNEXPECTED_ARGUMENT"> { - /** - * The number of arguments received. - */ - count: number; - /** - * The number of arguments expected. - */ - expectedCount: number; -} -/** - * The action that resulted in the error. - */ -export type CallExceptionAction = "call" | "estimateEnergy" | "getTransactionResult" | "unknown"; -/** - * The related transaction that caused the error. - */ -export type CallExceptionTransaction = { - to: null | string; - from?: string; - data: string; -}; -/** - * This **Error** indicates a transaction reverted. - */ -export interface CallExceptionError extends CoreBCError<"CALL_EXCEPTION"> { - /** - * The action being performed when the revert was encountered. - */ - action: CallExceptionAction; - /** - * The revert data returned. - */ - data: null | string; - /** - * A human-readable representation of data, if possible. - */ - reason: null | string; - /** - * The transaction that triggered the exception. - */ - transaction: CallExceptionTransaction; - /** - * The contract invocation details, if available. - */ - invocation: null | { - method: string; - signature: string; - args: Array; - }; - /** - * The built-in or custom revert error, if available - */ - revert: null | { - signature: string; - name: string; - args: Array; - }; -} -/** - * The sending account has insufficient funds to cover the - * entire transaction cost. - */ -export interface InsufficientFundsError extends CoreBCError<"INSUFFICIENT_FUNDS"> { - /** - * The transaction. - */ - transaction: TransactionRequest; -} -/** - * The sending account has already used this nonce in a - * transaction that has been included. - */ -export interface NonceExpiredError extends CoreBCError<"NONCE_EXPIRED"> { - /** - * The transaction. - */ - transaction: TransactionRequest; -} -/** - * A CCIP-read exception, which cannot be recovered from or - * be further processed. - */ -export interface OffchainFaultError extends CoreBCError<"OFFCHAIN_FAULT"> { - /** - * The transaction. - */ - transaction?: TransactionRequest; - /** - * The reason the CCIP-read failed. - */ - reason: string; -} -/** - * An attempt was made to replace a transaction, but with an - * insufficient additional fee to afford evicting the old - * transaction from the memory pool. - */ -export interface ReplacementUnderpricedError extends CoreBCError<"REPLACEMENT_UNDERPRICED"> { - /** - * The transaction. - */ - transaction: TransactionRequest; -} -/** - * A pending transaction was replaced by another. - */ -export interface TransactionReplacedError extends CoreBCError<"TRANSACTION_REPLACED"> { - /** - * If the transaction was cancelled, such that the original - * effects of the transaction cannot be assured. - */ - cancelled: boolean; - /** - * The reason the transaction was replaced. - */ - reason: "repriced" | "cancelled" | "replaced"; - /** - * The hash of the replaced transaction. - */ - hash: string; - /** - * The transaction that replaced the transaction. - */ - replacement: TransactionResponse; - /** - * The receipt of the transaction that replace the transaction. - */ - receipt: TransactionReceipt; -} -/** - * This Error indicates an ENS name was used, but the name has not - * been configured. - * - * This could indicate an ENS name is unowned or that the current - * address being pointed to is the [[ZeroAddress]]. - */ -export interface UnconfiguredNameError extends CoreBCError<"UNCONFIGURED_NAME"> { - /** - * The ENS name that was requested - */ - value: string; -} -/** - * This Error indicates a request was rejected by the user. - * - * In most clients (such as MetaMask), when an operation requires user - * authorization (such as ``signer.sendTransaction``), the client - * presents a dialog box to the user. If the user denies the request - * this error is thrown. - */ -export interface ActionRejectedError extends CoreBCError<"ACTION_REJECTED"> { - /** - * The requested action. - */ - action: "requestAccess" | "sendTransaction" | "signMessage" | "signTransaction" | "signTypedData" | "unknown"; - /** - * The reason the action was rejected. - * - * If there is already a pending request, some clients may indicate - * there is already a ``"pending"`` action. This prevents an app - * from spamming the user. - */ - reason: "expired" | "rejected" | "pending"; -} -/** - * A conditional type that transforms the [[ErrorCode]] T into - * its corebcError type. - * - * @flatworm-skip-docs - */ -export type CodedCoreBCError = T extends "UNKNOWN_ERROR" ? UnknownError : T extends "NOT_IMPLEMENTED" ? NotImplementedError : T extends "UNSUPPORTED_OPERATION" ? UnsupportedOperationError : T extends "NETWORK_ERROR" ? NetworkError : T extends "SERVER_ERROR" ? ServerError : T extends "TIMEOUT" ? TimeoutError : T extends "BAD_DATA" ? BadDataError : T extends "CANCELLED" ? CancelledError : T extends "BUFFER_OVERRUN" ? BufferOverrunError : T extends "NUMERIC_FAULT" ? NumericFaultError : T extends "INVALID_ARGUMENT" ? InvalidArgumentError : T extends "MISSING_ARGUMENT" ? MissingArgumentError : T extends "UNEXPECTED_ARGUMENT" ? UnexpectedArgumentError : T extends "CALL_EXCEPTION" ? CallExceptionError : T extends "INSUFFICIENT_FUNDS" ? InsufficientFundsError : T extends "NONCE_EXPIRED" ? NonceExpiredError : T extends "OFFCHAIN_FAULT" ? OffchainFaultError : T extends "REPLACEMENT_UNDERPRICED" ? ReplacementUnderpricedError : T extends "TRANSACTION_REPLACED" ? TransactionReplacedError : T extends "UNCONFIGURED_NAME" ? UnconfiguredNameError : T extends "ACTION_REJECTED" ? ActionRejectedError : never; -/** - * Returns true if the %%error%% matches an error thrown by corebc - * that matches the error %%code%%. - * - * In TypeScript envornoments, this can be used to check that %%error%% - * matches an corebcError type, which means the expected properties will - * be set. - * - * @See [ErrorCodes](api:ErrorCode) - * @example - * try { - * // code.... - * } catch (e) { - * if (isError(e, "CALL_EXCEPTION")) { - * // The Type Guard has validated this object - * console.log(e.data); - * } - * } - */ -export declare function isError>(error: any, code: K): error is T; -/** - * Returns true if %%error%% is a [[CallExceptionError]. - */ -export declare function isCallException(error: any): error is CallExceptionError; -/** - * Returns a new Error configured to the format corebc emits errors, with - * the %%message%%, [[api:ErrorCode]] %%code%% and additioanl properties - * for the corresponding corebcError. - * - * Each error in corebc includes the version of corebc, a - * machine-readable [[ErrorCode]], and depneding on %%code%%, additional - * required properties. The error message will also include the %%meeage%%, - * corebc version, %%code%% and all aditional properties, serialized. - */ -export declare function makeError>(message: string, code: K, info?: ErrorInfo): T; -/** - * Throws an corebcError with %%message%%, %%code%% and additional error - * %%info%% when %%check%% is falsish.. - * - * @see [[api:makeError]] - */ -export declare function assert>(check: unknown, message: string, code: K, info?: ErrorInfo): asserts check; -/** - * A simple helper to simply ensuring provided arguments match expected - * constraints, throwing if not. - * - * In TypeScript environments, the %%check%% has been asserted true, so - * any further code does not need additional compile-time checks. - */ -export declare function assertArgument(check: unknown, message: string, name: string, value: unknown): asserts check; -export declare function assertArgumentCount(count: number, expectedCount: number, message?: string): void; -/** - * Throws if the normalization %%form%% is not supported. - */ -export declare function assertNormalize(form: string): void; -/** - * Many classes use file-scoped values to guard the constructor, - * making it effectively private. This facilitates that pattern - * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, - * throwing if not, indicating the %%className%% if provided. - */ -export declare function assertPrivate(givenGuard: any, guard: any, className?: string): void; -//# sourceMappingURL=errors.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/errors.d.ts.map b/lib.commonjs/utils/errors.d.ts.map deleted file mode 100644 index de9bc0ec5..000000000 --- a/lib.commonjs/utils/errors.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src.ts/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9D,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;AAiDhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAM,MAAM,SAAS,GAEjB,eAAe,GACf,iBAAiB,GACjB,uBAAuB,GACvB,eAAe,GACf,cAAc,GACd,SAAS,GACT,UAAU,GACV,WAAW,GAGX,gBAAgB,GAChB,eAAe,GAGf,kBAAkB,GAClB,kBAAkB,GAClB,qBAAqB,GACrB,gBAAgB,GAGhB,gBAAgB,GAChB,oBAAoB,GACpB,eAAe,GACf,yBAAyB,GACzB,sBAAsB,GACtB,mBAAmB,GACnB,gBAAgB,GAGhB,iBAAiB,CAAC;AAEtB;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,CAAE,SAAQ,KAAK;IACzE;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC;IAEhB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE3B;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAID;;;GAGG;AACH,MAAM,WAAW,YAAa,SAAQ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AAG,EACV,SAAS,CAAC,EAAE,MAAM,GACjB,IAAI,CAoBN"} \ No newline at end of file diff --git a/lib.commonjs/utils/errors.js b/lib.commonjs/utils/errors.js deleted file mode 100644 index af2744803..000000000 --- a/lib.commonjs/utils/errors.js +++ /dev/null @@ -1,226 +0,0 @@ -"use strict"; -/** - * About Errors. - * - * @_section: api/utils/errors:Errors [about-errors] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.assertPrivate = exports.assertNormalize = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.makeError = exports.isCallException = exports.isError = void 0; -const _version_js_1 = require("../_version.js"); -const properties_js_1 = require("./properties.js"); -function stringify(value) { - if (value == null) { - return "null"; - } - if (Array.isArray(value)) { - return "[ " + value.map(stringify).join(", ") + " ]"; - } - if (value instanceof Uint8Array) { - const HEX = "0123456789abcdef"; - let result = "0x"; - for (let i = 0; i < value.length; i++) { - result += HEX[value[i] >> 4]; - result += HEX[value[i] & 0xf]; - } - return result; - } - if (typeof value === "object" && typeof value.toJSON === "function") { - return stringify(value.toJSON()); - } - switch (typeof value) { - case "boolean": - case "symbol": - return value.toString(); - case "bigint": - return BigInt(value).toString(); - case "number": - return value.toString(); - case "string": - return JSON.stringify(value); - case "object": { - const keys = Object.keys(value); - keys.sort(); - return ("{ " + - keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + - " }"); - } - } - return `[ COULD NOT SERIALIZE ]`; -} -/** - * Returns true if the %%error%% matches an error thrown by corebc - * that matches the error %%code%%. - * - * In TypeScript envornoments, this can be used to check that %%error%% - * matches an corebcError type, which means the expected properties will - * be set. - * - * @See [ErrorCodes](api:ErrorCode) - * @example - * try { - * // code.... - * } catch (e) { - * if (isError(e, "CALL_EXCEPTION")) { - * // The Type Guard has validated this object - * console.log(e.data); - * } - * } - */ -function isError(error, code) { - return error && error.code === code; -} -exports.isError = isError; -/** - * Returns true if %%error%% is a [[CallExceptionError]. - */ -function isCallException(error) { - return isError(error, "CALL_EXCEPTION"); -} -exports.isCallException = isCallException; -/** - * Returns a new Error configured to the format corebc emits errors, with - * the %%message%%, [[api:ErrorCode]] %%code%% and additioanl properties - * for the corresponding corebcError. - * - * Each error in corebc includes the version of corebc, a - * machine-readable [[ErrorCode]], and depneding on %%code%%, additional - * required properties. The error message will also include the %%meeage%%, - * corebc version, %%code%% and all aditional properties, serialized. - */ -function makeError(message, code, info) { - { - const details = []; - if (info) { - if ("message" in info || "code" in info || "name" in info) { - throw new Error(`value will overwrite populated values: ${stringify(info)}`); - } - for (const key in info) { - const value = info[key]; - // try { - details.push(key + "=" + stringify(value)); - // } catch (error: any) { - // console.log("MMM", error.message); - // details.push(key + "=[could not serialize object]"); - // } - } - } - details.push(`code=${code}`); - details.push(`version=${_version_js_1.version}`); - if (details.length) { - message += " (" + details.join(", ") + ")"; - } - } - let error; - switch (code) { - case "INVALID_ARGUMENT": - error = new TypeError(message); - break; - case "NUMERIC_FAULT": - case "BUFFER_OVERRUN": - error = new RangeError(message); - break; - default: - error = new Error(message); - } - (0, properties_js_1.defineProperties)(error, { code }); - if (info) { - Object.assign(error, info); - } - return error; -} -exports.makeError = makeError; -/** - * Throws an corebcError with %%message%%, %%code%% and additional error - * %%info%% when %%check%% is falsish.. - * - * @see [[api:makeError]] - */ -function assert(check, message, code, info) { - if (!check) { - throw makeError(message, code, info); - } -} -exports.assert = assert; -/** - * A simple helper to simply ensuring provided arguments match expected - * constraints, throwing if not. - * - * In TypeScript environments, the %%check%% has been asserted true, so - * any further code does not need additional compile-time checks. - */ -function assertArgument(check, message, name, value) { - assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); -} -exports.assertArgument = assertArgument; -function assertArgumentCount(count, expectedCount, message) { - if (message == null) { - message = ""; - } - if (message) { - message = ": " + message; - } - assert(count >= expectedCount, "missing arguemnt" + message, "MISSING_ARGUMENT", { - count: count, - expectedCount: expectedCount, - }); - assert(count <= expectedCount, "too many arguemnts" + message, "UNEXPECTED_ARGUMENT", { - count: count, - expectedCount: expectedCount, - }); -} -exports.assertArgumentCount = assertArgumentCount; -const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => { - try { - // General test for normalize - /* c8 ignore start */ - if ("test".normalize(form) !== "test") { - throw new Error("bad"); - } - /* c8 ignore stop */ - if (form === "NFD") { - const check = String.fromCharCode(0xe9).normalize("NFD"); - const expected = String.fromCharCode(0x65, 0x0301); - /* c8 ignore start */ - if (check !== expected) { - throw new Error("broken"); - } - /* c8 ignore stop */ - } - accum.push(form); - } - catch (error) { } - return accum; -}, []); -/** - * Throws if the normalization %%form%% is not supported. - */ -function assertNormalize(form) { - assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", { - operation: "String.prototype.normalize", - info: { form }, - }); -} -exports.assertNormalize = assertNormalize; -/** - * Many classes use file-scoped values to guard the constructor, - * making it effectively private. This facilitates that pattern - * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, - * throwing if not, indicating the %%className%% if provided. - */ -function assertPrivate(givenGuard, guard, className) { - if (className == null) { - className = ""; - } - if (givenGuard !== guard) { - let method = className, operation = "new"; - if (className) { - method += "."; - operation += " " + className; - } - assert(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", { - operation, - }); - } -} -exports.assertPrivate = assertPrivate; -//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/errors.js.map b/lib.commonjs/utils/errors.js.map deleted file mode 100644 index e3e20c719..000000000 --- a/lib.commonjs/utils/errors.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src.ts/utils/errors.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gDAAyC;AAEzC,mDAAmD;AAYnD,SAAS,SAAS,CAAC,KAAU;IAC3B,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,MAAM,CAAC;KACf;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KA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CAAC,EAClC,6CAA6C,EAC7C,uBAAuB,EACvB;QACE,SAAS,EAAE,4BAA4B;QACvC,IAAI,EAAE,EAAE,IAAI,EAAE;KACf,CACF,CAAC;AACJ,CAAC;AAVD,0CAUC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAC3B,UAAe,EACf,KAAU,EACV,SAAkB;IAElB,IAAI,SAAS,IAAI,IAAI,EAAE;QACrB,SAAS,GAAG,EAAE,CAAC;KAChB;IACD,IAAI,UAAU,KAAK,KAAK,EAAE;QACxB,IAAI,MAAM,GAAG,SAAS,EACpB,SAAS,GAAG,KAAK,CAAC;QACpB,IAAI,SAAS,EAAE;YACb,MAAM,IAAI,GAAG,CAAC;YACd,SAAS,IAAI,GAAG,GAAG,SAAS,CAAC;SAC9B;QACD,MAAM,CACJ,KAAK,EACL,4BAA4B,MAAM,eAAe,EACjD,uBAAuB,EACvB;YACE,SAAS;SACV,CACF,CAAC;KACH;AACH,CAAC;AAxBD,sCAwBC"} \ No newline at end of file diff --git a/lib.commonjs/utils/events.d.ts b/lib.commonjs/utils/events.d.ts deleted file mode 100644 index 5da088923..000000000 --- a/lib.commonjs/utils/events.d.ts +++ /dev/null @@ -1,77 +0,0 @@ -/** - * A callback function called when a an event is triggered. - */ -export type Listener = (...args: Array) => void; -/** - * An **EventEmitterable** behaves similar to an EventEmitter - * except provides async access to its methods. - * - * An EventEmitter implements the observer pattern. - */ -export interface EventEmitterable { - /** - * Registers a %%listener%% that is called whenever the - * %%event%% occurs until unregistered. - */ - on(event: T, listener: Listener): Promise; - /** - * Registers a %%listener%% that is called the next time - * %%event%% occurs. - */ - once(event: T, listener: Listener): Promise; - /** - * Triggers each listener for %%event%% with the %%args%%. - */ - emit(event: T, ...args: Array): Promise; - /** - * Resolves to the number of listeners for %%event%%. - */ - listenerCount(event?: T): Promise; - /** - * Resolves to the listeners for %%event%%. - */ - listeners(event?: T): Promise>; - /** - * Unregister the %%listener%% for %%event%%. If %%listener%% - * is unspecified, all listeners are unregistered. - */ - off(event: T, listener?: Listener): Promise; - /** - * Unregister all listeners for %%event%%. - */ - removeAllListeners(event?: T): Promise; - /** - * Alias for [[on]]. - */ - addListener(event: T, listener: Listener): Promise; - /** - * Alias for [[off]]. - */ - removeListener(event: T, listener: Listener): Promise; -} -/** - * When an [[EventEmitterable]] triggers a [[Listener]], the - * callback always ahas one additional argument passed, which is - * an **EventPayload**. - */ -export declare class EventPayload { - #private; - /** - * The event filter. - */ - readonly filter: T; - /** - * The **EventEmitterable**. - */ - readonly emitter: EventEmitterable; - /** - * Create a new **EventPayload** for %%emitter%% with - * the %%listener%% and for %%filter%%. - */ - constructor(emitter: EventEmitterable, listener: null | Listener, filter: T); - /** - * Unregister the triggered listener for future events. - */ - removeListener(): Promise; -} -//# sourceMappingURL=events.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/events.d.ts.map b/lib.commonjs/utils/events.d.ts.map deleted file mode 100644 index 13c18f4ef..000000000 --- a/lib.commonjs/utils/events.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src.ts/utils/events.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC;;;OAGG;IACH,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtD;;OAEG;IACH,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1C;;OAEG;IACH,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE/C;;;OAGG;IACH,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;OAEG;IACH,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzD;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED;;;;GAIG;AACH,qBAAa,YAAY,CAAC,CAAC;;IACzB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,CAAC,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAIvC;;;OAGG;gBAED,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAC5B,QAAQ,EAAE,IAAI,GAAG,QAAQ,EACzB,MAAM,EAAE,CAAC;IAMX;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAMtC"} \ No newline at end of file diff --git a/lib.commonjs/utils/events.js b/lib.commonjs/utils/events.js deleted file mode 100644 index 44e6a210c..000000000 --- a/lib.commonjs/utils/events.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EventPayload = void 0; -/** - * Explain events... - * - * @_section api/utils/events:Events [about-events] - */ -const properties_js_1 = require("./properties.js"); -/** - * When an [[EventEmitterable]] triggers a [[Listener]], the - * callback always ahas one additional argument passed, which is - * an **EventPayload**. - */ -class EventPayload { - /** - * The event filter. - */ - filter; - /** - * The **EventEmitterable**. - */ - emitter; - #listener; - /** - * Create a new **EventPayload** for %%emitter%% with - * the %%listener%% and for %%filter%%. - */ - constructor(emitter, listener, filter) { - this.#listener = listener; - (0, properties_js_1.defineProperties)(this, { emitter, filter }); - } - /** - * Unregister the triggered listener for future events. - */ - async removeListener() { - if (this.#listener == null) { - return; - } - await this.emitter.off(this.filter, this.#listener); - } -} -exports.EventPayload = EventPayload; -//# sourceMappingURL=events.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/events.js.map b/lib.commonjs/utils/events.js.map deleted file mode 100644 index 04dc60079..000000000 --- a/lib.commonjs/utils/events.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src.ts/utils/events.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,mDAAmD;AA+DnD;;;;GAIG;AACH,MAAa,YAAY;IACvB;;OAEG;IACM,MAAM,CAAK;IAEpB;;OAEG;IACM,OAAO,CAAuB;IAE9B,SAAS,CAAkB;IAEpC;;;OAGG;IACH,YACE,OAA4B,EAC5B,QAAyB,EACzB,MAAS;QAET,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAA,gCAAgB,EAAoB,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc;QAClB,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE;YAC1B,OAAO;SACR;QACD,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;CACF;AAnCD,oCAmCC"} \ No newline at end of file diff --git a/lib.commonjs/utils/fetch.d.ts b/lib.commonjs/utils/fetch.d.ts deleted file mode 100644 index 7d226ccc0..000000000 --- a/lib.commonjs/utils/fetch.d.ts +++ /dev/null @@ -1,327 +0,0 @@ -export type GetUrlResponse = { - statusCode: number; - statusMessage: string; - headers: Record; - body: null | Uint8Array; -}; -export type FetchThrottleParams = { - maxAttempts?: number; - slotInterval?: number; -}; -/** - * Called before any network request, allowing updated headers (e.g. Bearer tokens), etc. - */ -export type FetchPreflightFunc = (req: FetchRequest) => Promise; -/** - * Called on the response, allowing client-based throttling logic or post-processing. - */ -export type FetchProcessFunc = (req: FetchRequest, resp: FetchResponse) => Promise; -/** - * Called prior to each retry; return true to retry, false to abort. - */ -export type FetchRetryFunc = (req: FetchRequest, resp: FetchResponse, attempt: number) => Promise; -/** - * Called on Gateway URLs. - */ -export type FetchGatewayFunc = (url: string, signal?: FetchCancelSignal) => Promise; -/** - * Used to perform a fetch; use this to override the underlying network - * fetch layer. In NodeJS, the default uses the "http" and "https" libraries - * and in the browser ``fetch`` is used. If you wish to use Axios, this is - * how you would register it. - */ -export type FetchGetUrlFunc = (req: FetchRequest, signal?: FetchCancelSignal) => Promise; -/** - * @_ignore - */ -export declare class FetchCancelSignal { - #private; - constructor(request: FetchRequest); - addListener(listener: () => void): void; - get cancelled(): boolean; - checkSignal(): void; -} -/** - * Represents a request for a resource using a URI. - * - * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, - * and ``IPFS:``. - * - * Additional schemes can be added globally using [[registerGateway]]. - * - * @example: - * req = new FetchRequest("https://www.ricmoo.com") - * resp = await req.send() - * resp.body.length - * //_result: - */ -export declare class FetchRequest implements Iterable<[key: string, value: string]> { - #private; - /** - * The fetch URI to requrest. - */ - get url(): string; - set url(url: string); - /** - * The fetch body, if any, to send as the request body. //(default: null)// - * - * When setting a body, the intrinsic ``Content-Type`` is automatically - * set and will be used if **not overridden** by setting a custom - * header. - * - * If %%body%% is null, the body is cleared (along with the - * intrinsic ``Content-Type``) and the . - * - * If %%body%% is a string, the intrincis ``Content-Type`` is set to - * ``text/plain``. - * - * If %%body%% is a Uint8Array, the intrincis ``Content-Type`` is set to - * ``application/octet-stream``. - * - * If %%body%% is any other object, the intrincis ``Content-Type`` is - * set to ``application/json``. - */ - get body(): null | Uint8Array; - set body(body: null | string | Readonly | Readonly); - /** - * Returns true if the request has a body. - */ - hasBody(): this is FetchRequest & { - body: Uint8Array; - }; - /** - * The HTTP method to use when requesting the URI. If no method - * has been explicitly set, then ``GET`` is used if the body is - * null and ``POST`` otherwise. - */ - get method(): string; - set method(method: null | string); - /** - * The headers that will be used when requesting the URI. All - * keys are lower-case. - * - * This object is a copy, so any chnages will **NOT** be reflected - * in the ``FetchRequest``. - * - * To set a header entry, use the ``setHeader`` method. - */ - get headers(): Record; - /** - * Get the header for %%key%%, ignoring case. - */ - getHeader(key: string): string; - /** - * Set the header for %%key%% to %%value%%. All values are coerced - * to a string. - */ - setHeader(key: string, value: string | number): void; - /** - * Clear all headers, resetting all intrinsic headers. - */ - clearHeaders(): void; - [Symbol.iterator](): Iterator<[key: string, value: string]>; - /** - * The value that will be sent for the ``Authorization`` header. - * - * To set the credentials, use the ``setCredentials`` method. - */ - get credentials(): null | string; - /** - * Sets an ``Authorization`` for %%username%% with %%password%%. - */ - setCredentials(username: string, password: string): void; - /** - * Enable and request gzip-encoded responses. The response will - * automatically be decompressed. //(default: true)// - */ - get allowGzip(): boolean; - set allowGzip(value: boolean); - /** - * Allow ``Authentication`` credentials to be sent over insecure - * channels. //(default: false)// - */ - get allowInsecureAuthentication(): boolean; - set allowInsecureAuthentication(value: boolean); - /** - * The timeout (in milliseconds) to wait for a complere response. - * //(default: 5 minutes)// - */ - get timeout(): number; - set timeout(timeout: number); - /** - * This function is called prior to each request, for example - * during a redirection or retry in case of server throttling. - * - * This offers an opportunity to populate headers or update - * content before sending a request. - */ - get preflightFunc(): null | FetchPreflightFunc; - set preflightFunc(preflight: null | FetchPreflightFunc); - /** - * This function is called after each response, offering an - * opportunity to provide client-level throttling or updating - * response data. - * - * Any error thrown in this causes the ``send()`` to throw. - * - * To schedule a retry attempt (assuming the maximum retry limit - * has not been reached), use [[response.throwThrottleError]]. - */ - get processFunc(): null | FetchProcessFunc; - set processFunc(process: null | FetchProcessFunc); - /** - * This function is called on each retry attempt. - */ - get retryFunc(): null | FetchRetryFunc; - set retryFunc(retry: null | FetchRetryFunc); - /** - * Create a new FetchRequest instance with default values. - * - * Once created, each property may be set before issuing a - * ``.send()`` to make the request. - */ - constructor(url: string); - toString(): string; - /** - * Update the throttle parameters used to determine maximum - * attempts and exponential-backoff properties. - */ - setThrottleParams(params: FetchThrottleParams): void; - /** - * Resolves to the response by sending the request. - */ - send(): Promise; - /** - * Cancels the inflight response, causing a ``CANCELLED`` - * error to be rejected from the [[send]]. - */ - cancel(): void; - /** - * Returns a new [[FetchRequest]] that represents the redirection - * to %%location%%. - */ - redirect(location: string): FetchRequest; - /** - * Create a new copy of this request. - */ - clone(): FetchRequest; - /** - * Locks all static configuration for gateways and FetchGetUrlFunc - * registration. - */ - static lockConfig(): void; - /** - * Get the current Gateway function for %%scheme%%. - */ - static getGateway(scheme: string): null | FetchGatewayFunc; - /** - * Use the %%func%% when fetching URIs using %%scheme%%. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGateway(scheme: string, func: FetchGatewayFunc): void; - /** - * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGetUrl(getUrl: FetchGetUrlFunc): void; - /** - * Creates a function that can "fetch" data URIs. - * - * Note that this is automatically done internally to support - * data URIs, so it is not necessary to register it. - * - * This is not generally something that is needed, but may - * be useful in a wrapper to perfom custom data URI functionality. - */ - static createDataGateway(): FetchGatewayFunc; - /** - * Creates a function that will fetch IPFS (unvalidated) from - * a custom gateway baseUrl. - * - * The default IPFS gateway used internally is - * ``"https:/\/gateway.ipfs.io/ipfs/"``. - */ - static createIpfsGatewayFunc(baseUrl: string): FetchGatewayFunc; -} -/** - * The response for a FetchREquest. - */ -export declare class FetchResponse implements Iterable<[key: string, value: string]> { - #private; - toString(): string; - /** - * The response status code. - */ - get statusCode(): number; - /** - * The response status message. - */ - get statusMessage(): string; - /** - * The response headers. All keys are lower-case. - */ - get headers(): Record; - /** - * The response body, or ``null`` if there was no body. - */ - get body(): null | Readonly; - /** - * The response body as a UTF-8 encoded string, or the empty - * string (i.e. ``""``) if there was no body. - * - * An error is thrown if the body is invalid UTF-8 data. - */ - get bodyText(): string; - /** - * The response body, decoded as JSON. - * - * An error is thrown if the body is invalid JSON-encoded data - * or if there was no body. - */ - get bodyJson(): any; - [Symbol.iterator](): Iterator<[key: string, value: string]>; - constructor(statusCode: number, statusMessage: string, headers: Readonly>, body: null | Uint8Array, request?: FetchRequest); - /** - * Return a Response with matching headers and body, but with - * an error status code (i.e. 599) and %%message%% with an - * optional %%error%%. - */ - makeServerError(message?: string, error?: Error): FetchResponse; - /** - * If called within a [request.processFunc](FetchRequest-processFunc) - * call, causes the request to retry as if throttled for %%stall%% - * milliseconds. - */ - throwThrottleError(message?: string, stall?: number): never; - /** - * Get the header value for %%key%%, ignoring case. - */ - getHeader(key: string): string; - /** - * Returns true of the response has a body. - */ - hasBody(): this is FetchResponse & { - body: Uint8Array; - }; - /** - * The request made for this response. - */ - get request(): null | FetchRequest; - /** - * Returns true if this response was a success statusCode. - */ - ok(): boolean; - /** - * Throws a ``SERVER_ERROR`` if this response is not ok. - */ - assertOk(): void; -} -//# sourceMappingURL=fetch.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/fetch.d.ts.map b/lib.commonjs/utils/fetch.d.ts.map deleted file mode 100644 index 1319c39a1..000000000 --- a/lib.commonjs/utils/fetch.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src.ts/utils/fetch.ts"],"names":[],"mappings":"AAaA,MAAM,MA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AEG;IACH,OAAO,IAAI,IAAI,IAAI,aAAa,GAAG;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE;IAIvD;;OAEG;IACH,IAAI,OAAO,IAAI,IAAI,GAAG,YAAY,CAEjC;IAED;;OAEG;IACH,EAAE,IAAI,OAAO;IAQb;;OAEG;IACH,QAAQ,IAAI,IAAI;CAcjB"} \ No newline at end of file diff --git a/lib.commonjs/utils/fetch.js b/lib.commonjs/utils/fetch.js deleted file mode 100644 index cf0b195da..000000000 --- a/lib.commonjs/utils/fetch.js +++ /dev/null @@ -1,831 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FetchResponse = exports.FetchRequest = exports.FetchCancelSignal = void 0; -/** - * Explain fetching here... - * - * @_section api/utils/fetching:Fetching Web Content [about-fetch] - */ -const base64_js_1 = require("./base64.js"); -const data_js_1 = require("./data.js"); -const errors_js_1 = require("./errors.js"); -const properties_js_1 = require("./properties.js"); -const utf8_js_1 = require("./utf8.js"); -const geturl_js_1 = require("./geturl.js"); -const MAX_ATTEMPTS = 12; -const SLOT_INTERVAL = 250; -// The global FetchGetUrlFunc implementation. -let getUrlFunc = geturl_js_1.getUrl; -const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); -const reIpfs = new RegExp("^ipfs://(ipfs/)?(.*)$", "i"); -// If locked, new Gateways cannot be added -let locked = false; -// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs -async function dataGatewayFunc(url, signal) { - try { - const match = url.match(reData); - if (!match) { - throw new Error("invalid data"); - } - return new FetchResponse(200, "OK", { - "content-type": match[1] || "text/plain", - }, match[2] ? (0, base64_js_1.decodeBase64)(match[3]) : unpercent(match[3])); - } - catch (error) { - return new FetchResponse(599, "BAD REQUEST (invalid data: URI)", {}, null, new FetchRequest(url)); - } -} -/** - * Returns a [[FetchGatewayFunc]] for fetching content from a standard - * IPFS gateway hosted at %%baseUrl%%. - */ -function getIpfsGatewayFunc(baseUrl) { - async function gatewayIpfs(url, signal) { - try { - const match = url.match(reIpfs); - if (!match) { - throw new Error("invalid link"); - } - return new FetchRequest(`${baseUrl}${match[2]}`); - } - catch (error) { - return new FetchResponse(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new FetchRequest(url)); - } - } - return gatewayIpfs; -} -const Gateways = { - data: dataGatewayFunc, - ipfs: getIpfsGatewayFunc("https://gateway.ipfs.io/ipfs/"), -}; -const fetchSignals = new WeakMap(); -/** - * @_ignore - */ -class FetchCancelSignal { - #listeners; - #cancelled; - constructor(request) { - this.#listeners = []; - this.#cancelled = false; - fetchSignals.set(request, () => { - if (this.#cancelled) { - return; - } - this.#cancelled = true; - for (const listener of this.#listeners) { - setTimeout(() => { - listener(); - }, 0); - } - this.#listeners = []; - }); - } - addListener(listener) { - (0, errors_js_1.assert)(!this.#cancelled, "singal already cancelled", "UNSUPPORTED_OPERATION", { - operation: "fetchCancelSignal.addCancelListener", - }); - this.#listeners.push(listener); - } - get cancelled() { - return this.#cancelled; - } - checkSignal() { - (0, errors_js_1.assert)(!this.cancelled, "cancelled", "CANCELLED", {}); - } -} -exports.FetchCancelSignal = FetchCancelSignal; -// Check the signal, throwing if it is cancelled -function checkSignal(signal) { - if (signal == null) { - throw new Error("missing signal; should not happen"); - } - signal.checkSignal(); - return signal; -} -/** - * Represents a request for a resource using a URI. - * - * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, - * and ``IPFS:``. - * - * Additional schemes can be added globally using [[registerGateway]]. - * - * @example: - * req = new FetchRequest("https://www.ricmoo.com") - * resp = await req.send() - * resp.body.length - * //_result: - */ -class FetchRequest { - #allowInsecure; - #gzip; - #headers; - #method; - #timeout; - #url; - #body; - #bodyType; - #creds; - // Hooks - #preflight; - #process; - #retry; - #signal; - #throttle; - /** - * The fetch URI to requrest. - */ - get url() { - return this.#url; - } - set url(url) { - this.#url = String(url); - } - /** - * The fetch body, if any, to send as the request body. //(default: null)// - * - * When setting a body, the intrinsic ``Content-Type`` is automatically - * set and will be used if **not overridden** by setting a custom - * header. - * - * If %%body%% is null, the body is cleared (along with the - * intrinsic ``Content-Type``) and the . - * - * If %%body%% is a string, the intrincis ``Content-Type`` is set to - * ``text/plain``. - * - * If %%body%% is a Uint8Array, the intrincis ``Content-Type`` is set to - * ``application/octet-stream``. - * - * If %%body%% is any other object, the intrincis ``Content-Type`` is - * set to ``application/json``. - */ - get body() { - if (this.#body == null) { - return null; - } - return new Uint8Array(this.#body); - } - set body(body) { - if (body == null) { - this.#body = undefined; - this.#bodyType = undefined; - } - else if (typeof body === "string") { - this.#body = (0, utf8_js_1.toUtf8Bytes)(body); - this.#bodyType = "text/plain"; - } - else if (body instanceof Uint8Array) { - this.#body = body; - this.#bodyType = "application/octet-stream"; - } - else if (typeof body === "object") { - this.#body = (0, utf8_js_1.toUtf8Bytes)(JSON.stringify(body)); - this.#bodyType = "application/json"; - } - else { - throw new Error("invalid body"); - } - } - /** - * Returns true if the request has a body. - */ - hasBody() { - return this.#body != null; - } - /** - * The HTTP method to use when requesting the URI. If no method - * has been explicitly set, then ``GET`` is used if the body is - * null and ``POST`` otherwise. - */ - get method() { - if (this.#method) { - return this.#method; - } - if (this.hasBody()) { - return "POST"; - } - return "GET"; - } - set method(method) { - if (method == null) { - method = ""; - } - this.#method = String(method).toUpperCase(); - } - /** - * The headers that will be used when requesting the URI. All - * keys are lower-case. - * - * This object is a copy, so any chnages will **NOT** be reflected - * in the ``FetchRequest``. - * - * To set a header entry, use the ``setHeader`` method. - */ - get headers() { - const headers = Object.assign({}, this.#headers); - if (this.#creds) { - headers["authorization"] = `Basic ${(0, base64_js_1.encodeBase64)((0, utf8_js_1.toUtf8Bytes)(this.#creds))}`; - } - if (this.allowGzip) { - headers["accept-encoding"] = "gzip"; - } - if (headers["content-type"] == null && this.#bodyType) { - headers["content-type"] = this.#bodyType; - } - if (this.body) { - headers["content-length"] = String(this.body.length); - } - return headers; - } - /** - * Get the header for %%key%%, ignoring case. - */ - getHeader(key) { - return this.headers[key.toLowerCase()]; - } - /** - * Set the header for %%key%% to %%value%%. All values are coerced - * to a string. - */ - setHeader(key, value) { - this.#headers[String(key).toLowerCase()] = String(value); - } - /** - * Clear all headers, resetting all intrinsic headers. - */ - clearHeaders() { - this.#headers = {}; - } - [Symbol.iterator]() { - const headers = this.headers; - const keys = Object.keys(headers); - let index = 0; - return { - next: () => { - if (index < keys.length) { - const key = keys[index++]; - return { - value: [key, headers[key]], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - /** - * The value that will be sent for the ``Authorization`` header. - * - * To set the credentials, use the ``setCredentials`` method. - */ - get credentials() { - return this.#creds || null; - } - /** - * Sets an ``Authorization`` for %%username%% with %%password%%. - */ - setCredentials(username, password) { - (0, errors_js_1.assertArgument)(!username.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"); - this.#creds = `${username}:${password}`; - } - /** - * Enable and request gzip-encoded responses. The response will - * automatically be decompressed. //(default: true)// - */ - get allowGzip() { - return this.#gzip; - } - set allowGzip(value) { - this.#gzip = !!value; - } - /** - * Allow ``Authentication`` credentials to be sent over insecure - * channels. //(default: false)// - */ - get allowInsecureAuthentication() { - return !!this.#allowInsecure; - } - set allowInsecureAuthentication(value) { - this.#allowInsecure = !!value; - } - /** - * The timeout (in milliseconds) to wait for a complere response. - * //(default: 5 minutes)// - */ - get timeout() { - return this.#timeout; - } - set timeout(timeout) { - (0, errors_js_1.assertArgument)(timeout >= 0, "timeout must be non-zero", "timeout", timeout); - this.#timeout = timeout; - } - /** - * This function is called prior to each request, for example - * during a redirection or retry in case of server throttling. - * - * This offers an opportunity to populate headers or update - * content before sending a request. - */ - get preflightFunc() { - return this.#preflight || null; - } - set preflightFunc(preflight) { - this.#preflight = preflight; - } - /** - * This function is called after each response, offering an - * opportunity to provide client-level throttling or updating - * response data. - * - * Any error thrown in this causes the ``send()`` to throw. - * - * To schedule a retry attempt (assuming the maximum retry limit - * has not been reached), use [[response.throwThrottleError]]. - */ - get processFunc() { - return this.#process || null; - } - set processFunc(process) { - this.#process = process; - } - /** - * This function is called on each retry attempt. - */ - get retryFunc() { - return this.#retry || null; - } - set retryFunc(retry) { - this.#retry = retry; - } - /** - * Create a new FetchRequest instance with default values. - * - * Once created, each property may be set before issuing a - * ``.send()`` to make the request. - */ - constructor(url) { - this.#url = String(url); - this.#allowInsecure = false; - this.#gzip = true; - this.#headers = {}; - this.#method = ""; - this.#timeout = 300000; - this.#throttle = { - slotInterval: SLOT_INTERVAL, - maxAttempts: MAX_ATTEMPTS, - }; - } - toString() { - return ``; - } - /** - * Update the throttle parameters used to determine maximum - * attempts and exponential-backoff properties. - */ - setThrottleParams(params) { - if (params.slotInterval != null) { - this.#throttle.slotInterval = params.slotInterval; - } - if (params.maxAttempts != null) { - this.#throttle.maxAttempts = params.maxAttempts; - } - } - async #send(attempt, expires, delay, _request, _response) { - if (attempt >= this.#throttle.maxAttempts) { - return _response.makeServerError("exceeded maximum retry limit"); - } - (0, errors_js_1.assert)(getTime() <= expires, "timeout", "TIMEOUT", { - operation: "request.send", - reason: "timeout", - request: _request, - }); - if (delay > 0) { - await wait(delay); - } - let req = this.clone(); - const scheme = (req.url.split(":")[0] || "").toLowerCase(); - // Process any Gateways - if (scheme in Gateways) { - const result = await Gateways[scheme](req.url, checkSignal(_request.#signal)); - if (result instanceof FetchResponse) { - let response = result; - if (this.processFunc) { - checkSignal(_request.#signal); - try { - response = await this.processFunc(req, response); - } - catch (error) { - // Something went wrong during processing; throw a 5xx server error - if (error.throttle == null || typeof error.stall !== "number") { - response - .makeServerError("error in post-processing function", error) - .assertOk(); - } - // Ignore throttling - } - } - return response; - } - req = result; - } - // We have a preflight function; update the request - if (this.preflightFunc) { - req = await this.preflightFunc(req); - } - const resp = await getUrlFunc(req, checkSignal(_request.#signal)); - let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); - if (response.statusCode === 301 || response.statusCode === 302) { - // Redirect - try { - const location = response.headers.location || ""; - return req - .redirect(location) - .#send(attempt + 1, expires, 0, _request, response); - } - catch (error) { } - // Things won't get any better on another attempt; abort - return response; - } - else if (response.statusCode === 429) { - // Throttle - if (this.retryFunc == null || - (await this.retryFunc(req, response, attempt))) { - const retryAfter = response.headers["retry-after"]; - let delay = this.#throttle.slotInterval * - Math.trunc(Math.random() * Math.pow(2, attempt)); - if (typeof retryAfter === "string" && - retryAfter.match(/^[1-9][0-9]*$/)) { - delay = parseInt(retryAfter); - } - return req - .clone() - .#send(attempt + 1, expires, delay, _request, response); - } - } - if (this.processFunc) { - checkSignal(_request.#signal); - try { - response = await this.processFunc(req, response); - } - catch (error) { - // Something went wrong during processing; throw a 5xx server error - if (error.throttle == null || typeof error.stall !== "number") { - response - .makeServerError("error in post-processing function", error) - .assertOk(); - } - // Throttle - let delay = this.#throttle.slotInterval * - Math.trunc(Math.random() * Math.pow(2, attempt)); - if (error.stall >= 0) { - delay = error.stall; - } - return req - .clone() - .#send(attempt + 1, expires, delay, _request, response); - } - } - return response; - } - /** - * Resolves to the response by sending the request. - */ - send() { - (0, errors_js_1.assert)(this.#signal == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); - this.#signal = new FetchCancelSignal(this); - return this.#send(0, getTime() + this.timeout, 0, this, new FetchResponse(0, "", {}, null, this)); - } - /** - * Cancels the inflight response, causing a ``CANCELLED`` - * error to be rejected from the [[send]]. - */ - cancel() { - (0, errors_js_1.assert)(this.#signal != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); - const signal = fetchSignals.get(this); - if (!signal) { - throw new Error("missing signal; should not happen"); - } - signal(); - } - /** - * Returns a new [[FetchRequest]] that represents the redirection - * to %%location%%. - */ - redirect(location) { - // Redirection; for now we only support absolute locataions - const current = this.url.split(":")[0].toLowerCase(); - const target = location.split(":")[0].toLowerCase(); - // Don't allow redirecting: - // - non-GET requests - // - downgrading the security (e.g. https => http) - // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?] - (0, errors_js_1.assert)(this.method === "GET" && - (current !== "https" || target !== "http") && - location.match(/^https?:/), `unsupported redirect`, "UNSUPPORTED_OPERATION", { - operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})`, - }); - // Create a copy of this request, with a new URL - const req = new FetchRequest(location); - req.method = "GET"; - req.allowGzip = this.allowGzip; - req.timeout = this.timeout; - req.#headers = Object.assign({}, this.#headers); - if (this.#body) { - req.#body = new Uint8Array(this.#body); - } - req.#bodyType = this.#bodyType; - // Do not forward credentials unless on the same domain; only absolute - //req.allowInsecure = false; - // paths are currently supported; may want a way to specify to forward? - //setStore(req.#props, "creds", getStore(this.#pros, "creds")); - return req; - } - /** - * Create a new copy of this request. - */ - clone() { - const clone = new FetchRequest(this.url); - // Preserve "default method" (i.e. null) - clone.#method = this.#method; - // Preserve "default body" with type, copying the Uint8Array is present - if (this.#body) { - clone.#body = this.#body; - } - clone.#bodyType = this.#bodyType; - // Preserve "default headers" - clone.#headers = Object.assign({}, this.#headers); - // Credentials is readonly, so we copy internally - clone.#creds = this.#creds; - if (this.allowGzip) { - clone.allowGzip = true; - } - clone.timeout = this.timeout; - if (this.allowInsecureAuthentication) { - clone.allowInsecureAuthentication = true; - } - clone.#preflight = this.#preflight; - clone.#process = this.#process; - clone.#retry = this.#retry; - return clone; - } - /** - * Locks all static configuration for gateways and FetchGetUrlFunc - * registration. - */ - static lockConfig() { - locked = true; - } - /** - * Get the current Gateway function for %%scheme%%. - */ - static getGateway(scheme) { - return Gateways[scheme.toLowerCase()] || null; - } - /** - * Use the %%func%% when fetching URIs using %%scheme%%. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGateway(scheme, func) { - scheme = scheme.toLowerCase(); - if (scheme === "http" || scheme === "https") { - throw new Error(`cannot intercept ${scheme}; use registerGetUrl`); - } - if (locked) { - throw new Error("gateways locked"); - } - Gateways[scheme] = func; - } - /** - * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGetUrl(getUrl) { - if (locked) { - throw new Error("gateways locked"); - } - getUrlFunc = getUrl; - } - /** - * Creates a function that can "fetch" data URIs. - * - * Note that this is automatically done internally to support - * data URIs, so it is not necessary to register it. - * - * This is not generally something that is needed, but may - * be useful in a wrapper to perfom custom data URI functionality. - */ - static createDataGateway() { - return dataGatewayFunc; - } - /** - * Creates a function that will fetch IPFS (unvalidated) from - * a custom gateway baseUrl. - * - * The default IPFS gateway used internally is - * ``"https:/\/gateway.ipfs.io/ipfs/"``. - */ - static createIpfsGatewayFunc(baseUrl) { - return getIpfsGatewayFunc(baseUrl); - } -} -exports.FetchRequest = FetchRequest; -/** - * The response for a FetchREquest. - */ -class FetchResponse { - #statusCode; - #statusMessage; - #headers; - #body; - #request; - #error; - toString() { - return ``; - } - /** - * The response status code. - */ - get statusCode() { - return this.#statusCode; - } - /** - * The response status message. - */ - get statusMessage() { - return this.#statusMessage; - } - /** - * The response headers. All keys are lower-case. - */ - get headers() { - return Object.assign({}, this.#headers); - } - /** - * The response body, or ``null`` if there was no body. - */ - get body() { - return this.#body == null ? null : new Uint8Array(this.#body); - } - /** - * The response body as a UTF-8 encoded string, or the empty - * string (i.e. ``""``) if there was no body. - * - * An error is thrown if the body is invalid UTF-8 data. - */ - get bodyText() { - try { - return this.#body == null ? "" : (0, utf8_js_1.toUtf8String)(this.#body); - } - catch (error) { - (0, errors_js_1.assert)(false, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { - operation: "bodyText", - info: { response: this }, - }); - } - } - /** - * The response body, decoded as JSON. - * - * An error is thrown if the body is invalid JSON-encoded data - * or if there was no body. - */ - get bodyJson() { - try { - return JSON.parse(this.bodyText); - } - catch (error) { - (0, errors_js_1.assert)(false, "response body is not valid JSON", "UNSUPPORTED_OPERATION", { - operation: "bodyJson", - info: { response: this }, - }); - } - } - [Symbol.iterator]() { - const headers = this.headers; - const keys = Object.keys(headers); - let index = 0; - return { - next: () => { - if (index < keys.length) { - const key = keys[index++]; - return { - value: [key, headers[key]], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - constructor(statusCode, statusMessage, headers, body, request) { - this.#statusCode = statusCode; - this.#statusMessage = statusMessage; - this.#headers = Object.keys(headers).reduce((accum, k) => { - accum[k.toLowerCase()] = String(headers[k]); - return accum; - }, {}); - this.#body = body == null ? null : new Uint8Array(body); - this.#request = request || null; - this.#error = { message: "" }; - } - /** - * Return a Response with matching headers and body, but with - * an error status code (i.e. 599) and %%message%% with an - * optional %%error%%. - */ - makeServerError(message, error) { - let statusMessage; - if (!message) { - message = `${this.statusCode} ${this.statusMessage}`; - statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`; - } - else { - statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; - } - const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined); - response.#error = { message, error }; - return response; - } - /** - * If called within a [request.processFunc](FetchRequest-processFunc) - * call, causes the request to retry as if throttled for %%stall%% - * milliseconds. - */ - throwThrottleError(message, stall) { - if (stall == null) { - stall = -1; - } - else { - (0, errors_js_1.assertArgument)(Number.isInteger(stall) && stall >= 0, "invalid stall timeout", "stall", stall); - } - const error = new Error(message || "throttling requests"); - (0, properties_js_1.defineProperties)(error, { stall, throttle: true }); - throw error; - } - /** - * Get the header value for %%key%%, ignoring case. - */ - getHeader(key) { - return this.headers[key.toLowerCase()]; - } - /** - * Returns true of the response has a body. - */ - hasBody() { - return this.#body != null; - } - /** - * The request made for this response. - */ - get request() { - return this.#request; - } - /** - * Returns true if this response was a success statusCode. - */ - ok() { - return (this.#error.message === "" && - this.statusCode >= 200 && - this.statusCode < 300); - } - /** - * Throws a ``SERVER_ERROR`` if this response is not ok. - */ - assertOk() { - if (this.ok()) { - return; - } - let { message, error } = this.#error; - if (message === "") { - message = `server response ${this.statusCode} ${this.statusMessage}`; - } - (0, errors_js_1.assert)(false, message, "SERVER_ERROR", { - request: this.request || "unknown request", - response: this, - error, - }); - } -} -exports.FetchResponse = FetchResponse; -function getTime() { - return new Date().getTime(); -} -function unpercent(value) { - return (0, utf8_js_1.toUtf8Bytes)(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { - return String.fromCharCode(parseInt(code, 16)); - })); -} -function wait(delay) { - return new Promise((resolve) => setTimeout(resolve, delay)); -} -//# sourceMappingURL=fetch.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/fetch.js.map b/lib.commonjs/utils/fetch.js.map deleted file mode 100644 index 72a94f05e..000000000 --- a/lib.commonjs/utils/fetch.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src.ts/utils/fetch.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,2CAAyD;AACzD,uCAAoC;AACpC,2CAAqD;AACrD,mDAAmD;AACnD,uCAAsD;AAEtD,2CAAqC;AAsDrC,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,6CAA6C;AAC7C,IAAI,UAAU,GAAoB,kBAAM,CAAC;AAEzC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,iCAAiC,EAAE,GAAG,CAAC,CAAC;AAClE,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;AAExD,0CAA0C;AAC1C,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,6EAA6E;AAC7E,KAAK,UAAU,eAAe,CAC5B,GAAW,EACX,MAA0B;IAE1B,IAAI;QACF,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;SACjC;QACD,OAAO,IAAI,aAAa,CACtB,GAAG,EACH,IAAI,EACJ;YACE,cAAc,EAAE,KAAK,C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AI,EAAE,CAAC,OAAO,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,IAAA,qBAAW,EAChB,KAAK,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACnD,OAAO,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,SAAS,IAAI,CAAC,KAAa;IACzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAC9D,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/utils/fixednumber.d.ts b/lib.commonjs/utils/fixednumber.d.ts deleted file mode 100644 index c8a28f158..000000000 --- a/lib.commonjs/utils/fixednumber.d.ts +++ /dev/null @@ -1,252 +0,0 @@ -import type { BigNumberish, BytesLike } from "./index.js"; -/** - * A description of a fixed-point arithmetic field. - * - * When specifying the fixed format, the values override the default of - * a ``fixed128x18``, which implies a signed 128-bit value with 18 - * decimals of precision. - * - * The alias ``fixed`` and ``ufixed`` can be used for ``fixed128x18`` and - * ``ufixed128x18`` respectively. - * - * When a fixed format string begins with a ``u``, it indicates the field - * is unsigned, so any negative values will overflow. The first number - * indicates the bit-width and the second number indicates the decimal - * precision. - * - * When a ``number`` is used for a fixed format, it indicates the number - * of decimal places, and the default width and signed-ness will be used. - * - * The bit-width must be byte aligned and the decimals can be at most 80. - */ -export type FixedFormat = number | string | { - signed?: boolean; - width?: number; - decimals?: number; -}; -/** - * A FixedNumber represents a value over its [[FixedFormat]] - * arithmetic field. - * - * A FixedNumber can be used to perform math, losslessly, on - * values which have decmial places. - * - * A FixedNumber has a fixed bit-width to store values in, and stores all - * values internally by multiplying the value by 10 raised to the power of - * %%decimals%%. - * - * If operations are performed that cause a value to grow too high (close to - * positive infinity) or too low (close to negative infinity), the value - * is said to //overflow//. - * - * For example, an 8-bit signed value, with 0 decimals may only be within - * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become - * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. - * - * Many operation have a normal and //unsafe// variant. The normal variant - * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// - * variant will silently allow overflow, corrupting its value value. - * - * If operations are performed that cause a value to become too small - * (close to zero), the value loses precison and is said to //underflow//. - * - * For example, an value with 1 decimal place may store a number as small - * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit - * into 1 decimal place, so underflow occurs which means precision is lost - * and the value becomes ``0``. - * - * Some operations have a normal and //signalling// variant. The normal - * variant will silently ignore underflow, while the //signalling// variant - * will thow a [[NumericFaultError]] on underflow. - */ -export declare class FixedNumber { - #private; - /** - * The specific fixed-point arithmetic field for this value. - */ - readonly format: string; - /** - * This is a property so console.log shows a human-meaningful value. - * - * @private - */ - readonly _value: string; - /** - * @private - */ - constructor(guard: any, value: bigint, format: any); - /** - * If true, negative values are permitted, otherwise only - * positive values and zero are allowed. - */ - get signed(): boolean; - /** - * The number of bits available to store the value. - */ - get width(): number; - /** - * The number of decimal places in the fixed-point arithment field. - */ - get decimals(): number; - /** - * The value as an integer, based on the smallest unit the - * [[decimals]] allow. - */ - get value(): bigint; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%, ignoring overflow. - */ - addUnsafe(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - add(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%, ignoring overflow. - */ - subUnsafe(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - sub(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%, ignoring overflow and underflow (precision loss). - */ - mulUnsafe(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - mul(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs or if underflow (precision loss) occurs. - */ - mulSignal(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - divUnsafe(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - div(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%. A [[NumericFaultError]] is thrown if underflow - * (precision loss) occurs. - */ - divSignal(other: FixedNumber): FixedNumber; - /** - * Returns a comparison result between %%this%% and %%other%%. - * - * This is suitable for use in sorting, where ``-1`` implies %%this%% - * is smaller, ``1`` implies %%other%% is larger and ``0`` implies - * both are equal. - */ - cmp(other: FixedNumber): number; - /** - * Returns true if %%other%% is equal to %%this%%. - */ - eq(other: FixedNumber): boolean; - /** - * Returns true if %%other%% is less than to %%this%%. - */ - lt(other: FixedNumber): boolean; - /** - * Returns true if %%other%% is less than or equal to %%this%%. - */ - lte(other: FixedNumber): boolean; - /** - * Returns true if %%other%% is greater than to %%this%%. - */ - gt(other: FixedNumber): boolean; - /** - * Returns true if %%other%% is greater than or equal to %%this%%. - */ - gte(other: FixedNumber): boolean; - /** - * Returns a new [[FixedNumber]] which is the largest **integer** - * that is less than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - floor(): FixedNumber; - /** - * Returns a new [[FixedNumber]] which is the smallest **integer** - * that is greater than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - ceiling(): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the decimal component - * rounded up on ties at %%decimals%% places. - */ - round(decimals?: number): FixedNumber; - /** - * Returns true if %%this%% is equal to ``0``. - */ - isZero(): boolean; - /** - * Returns true if %%this%% is less than ``0``. - */ - isNegative(): boolean; - /** - * Returns the string representation of %%this%%. - */ - toString(): string; - /** - * Returns a float approximation. - * - * Due to IEEE 754 precission (or lack thereof), this function - * can only return an approximation and most values will contain - * rounding errors. - */ - toUnsafeFloat(): number; - /** - * Return a new [[FixedNumber]] with the same value but has had - * its field set to %%format%%. - * - * This will throw if the value cannot fit into %%format%%. - */ - toFormat(format: FixedFormat): FixedNumber; - /** - * Creates a new [[FixedNumber]] for %%value%% divided by - * %%decimal%% places with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% (once adjusted - * for %%decimals%%) cannot fit in %%format%%, either due to overflow - * or underflow (precision loss). - */ - static fromValue(_value: BigNumberish, decimals?: number, _format?: FixedFormat): FixedNumber; - /** - * Creates a new [[FixedNumber]] for %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%%, either due to overflow or underflow (precision loss). - */ - static fromString(_value: string, _format?: FixedFormat): FixedNumber; - /** - * Creates a new [[FixedNumber]] with the big-endian representation - * %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%% due to overflow. - */ - static fromBytes(_value: BytesLike, _format?: FixedFormat): FixedNumber; -} -//# sourceMappingURL=fixednumber.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/fixednumber.d.ts.map b/lib.commonjs/utils/fixednumber.d.ts.map deleted file mode 100644 index 2f8afd8ab..000000000 --- a/lib.commonjs/utils/fixednumber.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fixednumber.d.ts","sourceRoot":"","sources":["../../src.ts/ut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EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW;CAYxE"} \ No newline at end of file diff --git a/lib.commonjs/utils/fixednumber.js b/lib.commonjs/utils/fixednumber.js deleted file mode 100644 index 44be83fe6..000000000 --- a/lib.commonjs/utils/fixednumber.js +++ /dev/null @@ -1,587 +0,0 @@ -"use strict"; -var _a; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FixedNumber = void 0; -/** - * About fixed-point math... - * - * @_section: api/utils/fixed-point-math:Fixed-Point Maths [about-fixed-point-math] - */ -const data_js_1 = require("./data.js"); -const errors_js_1 = require("./errors.js"); -const maths_js_1 = require("./maths.js"); -const properties_js_1 = require("./properties.js"); -const BN_N1 = BigInt(-1); -const BN_0 = BigInt(0); -const BN_1 = BigInt(1); -const BN_5 = BigInt(5); -const _guard = {}; -// Constant to pull zeros from for multipliers -let Zeros = "0000"; -while (Zeros.length < 80) { - Zeros += Zeros; -} -// Returns a string "1" followed by decimal "0"s -function getTens(decimals) { - let result = Zeros; - while (result.length < decimals) { - result += result; - } - return BigInt("1" + result.substring(0, decimals)); -} -function checkValue(val, format, safeOp) { - const width = BigInt(format.width); - if (format.signed) { - const limit = BN_1 << (width - BN_1); - (0, errors_js_1.assert)(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { - operation: safeOp, - fault: "overflow", - value: val, - }); - if (val > BN_0) { - val = (0, maths_js_1.fromTwos)((0, maths_js_1.mask)(val, width), width); - } - else { - val = -(0, maths_js_1.fromTwos)((0, maths_js_1.mask)(-val, width), width); - } - } - else { - const limit = BN_1 << width; - (0, errors_js_1.assert)(safeOp == null || (val >= 0 && val < limit), "overflow", "NUMERIC_FAULT", { - operation: safeOp, - fault: "overflow", - value: val, - }); - val = ((val % limit) + limit) % limit & (limit - BN_1); - } - return val; -} -function getFormat(value) { - if (typeof value === "number") { - value = `fixed128x${value}`; - } - let signed = true; - let width = 128; - let decimals = 18; - if (typeof value === "string") { - // Parse the format string - if (value === "fixed") { - // defaults... - } - else if (value === "ufixed") { - signed = false; - } - else { - const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); - (0, errors_js_1.assertArgument)(match, "invalid fixed format", "format", value); - signed = match[1] !== "u"; - width = parseInt(match[2]); - decimals = parseInt(match[3]); - } - } - else if (value) { - // Extract the values from the object - const v = value; - const check = (key, type, defaultValue) => { - if (v[key] == null) { - return defaultValue; - } - (0, errors_js_1.assertArgument)(typeof v[key] === type, "invalid fixed format (" + key + " not " + type + ")", "format." + key, v[key]); - return v[key]; - }; - signed = check("signed", "boolean", signed); - width = check("width", "number", width); - decimals = check("decimals", "number", decimals); - } - (0, errors_js_1.assertArgument)(width % 8 === 0, "invalid FixedNumber width (not byte aligned)", "format.width", width); - (0, errors_js_1.assertArgument)(decimals <= 80, "invalid FixedNumber decimals (too large)", "format.decimals", decimals); - const name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); - return { signed, width, decimals, name }; -} -function toString(val, decimals) { - let negative = ""; - if (val < BN_0) { - negative = "-"; - val *= BN_N1; - } - let str = val.toString(); - // No decimal point for whole values - if (decimals === 0) { - return negative + str; - } - // Pad out to the whole component (including a whole digit) - while (str.length <= decimals) { - str = Zeros + str; - } - // Insert the decimal point - const index = str.length - decimals; - str = str.substring(0, index) + "." + str.substring(index); - // Trim the whole component (leaving at least one 0) - while (str[0] === "0" && str[1] !== ".") { - str = str.substring(1); - } - // Trim the decimal component (leaving at least one 0) - while (str[str.length - 1] === "0" && str[str.length - 2] !== ".") { - str = str.substring(0, str.length - 1); - } - return negative + str; -} -/** - * A FixedNumber represents a value over its [[FixedFormat]] - * arithmetic field. - * - * A FixedNumber can be used to perform math, losslessly, on - * values which have decmial places. - * - * A FixedNumber has a fixed bit-width to store values in, and stores all - * values internally by multiplying the value by 10 raised to the power of - * %%decimals%%. - * - * If operations are performed that cause a value to grow too high (close to - * positive infinity) or too low (close to negative infinity), the value - * is said to //overflow//. - * - * For example, an 8-bit signed value, with 0 decimals may only be within - * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become - * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. - * - * Many operation have a normal and //unsafe// variant. The normal variant - * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// - * variant will silently allow overflow, corrupting its value value. - * - * If operations are performed that cause a value to become too small - * (close to zero), the value loses precison and is said to //underflow//. - * - * For example, an value with 1 decimal place may store a number as small - * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit - * into 1 decimal place, so underflow occurs which means precision is lost - * and the value becomes ``0``. - * - * Some operations have a normal and //signalling// variant. The normal - * variant will silently ignore underflow, while the //signalling// variant - * will thow a [[NumericFaultError]] on underflow. - */ -class FixedNumber { - /** - * The specific fixed-point arithmetic field for this value. - */ - format; - #format; - // The actual value (accounting for decimals) - #val; - // A base-10 value to multiple values by to maintain the magnitude - #tens; - /** - * This is a property so console.log shows a human-meaningful value. - * - * @private - */ - _value; - // Use this when changing this file to get some typing info, - // but then switch to any to mask the internal type - //constructor(guard: any, value: bigint, format: _FixedFormat) { - /** - * @private - */ - constructor(guard, value, format) { - (0, errors_js_1.assertPrivate)(guard, _guard, "FixedNumber"); - this.#val = value; - this.#format = format; - const _value = toString(value, format.decimals); - (0, properties_js_1.defineProperties)(this, { format: format.name, _value }); - this.#tens = getTens(format.decimals); - } - /** - * If true, negative values are permitted, otherwise only - * positive values and zero are allowed. - */ - get signed() { - return this.#format.signed; - } - /** - * The number of bits available to store the value. - */ - get width() { - return this.#format.width; - } - /** - * The number of decimal places in the fixed-point arithment field. - */ - get decimals() { - return this.#format.decimals; - } - /** - * The value as an integer, based on the smallest unit the - * [[decimals]] allow. - */ - get value() { - return this.#val; - } - #checkFormat(other) { - (0, errors_js_1.assertArgument)(this.format === other.format, "incompatible format; use fixedNumber.toFormat", "other", other); - } - #checkValue(val, safeOp) { - /* - const width = BigInt(this.width); - if (this.signed) { - const limit = (BN_1 << (width - BN_1)); - assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { - operation: safeOp, fault: "overflow", value: val - }); - - if (val > BN_0) { - val = fromTwos(mask(val, width), width); - } else { - val = -fromTwos(mask(-val, width), width); - } - - } else { - const masked = mask(val, width); - assert(safeOp == null || (val >= 0 && val === masked), "overflow", "NUMERIC_FAULT", { - operation: safeOp, fault: "overflow", value: val - }); - val = masked; - } - */ - val = checkValue(val, this.#format, safeOp); - return new _a(_guard, val, this.#format); - } - #add(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue(this.#val + o.#val, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%, ignoring overflow. - */ - addUnsafe(other) { - return this.#add(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - add(other) { - return this.#add(other, "add"); - } - #sub(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue(this.#val - o.#val, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%, ignoring overflow. - */ - subUnsafe(other) { - return this.#sub(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - sub(other) { - return this.#sub(other, "sub"); - } - #mul(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%, ignoring overflow and underflow (precision loss). - */ - mulUnsafe(other) { - return this.#mul(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - mul(other) { - return this.#mul(other, "mul"); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs or if underflow (precision loss) occurs. - */ - mulSignal(other) { - this.#checkFormat(other); - const value = this.#val * other.#val; - (0, errors_js_1.assert)(value % this.#tens === BN_0, "precision lost during signalling mul", "NUMERIC_FAULT", { - operation: "mulSignal", - fault: "underflow", - value: this, - }); - return this.#checkValue(value / this.#tens, "mulSignal"); - } - #div(o, safeOp) { - (0, errors_js_1.assert)(o.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { - operation: "div", - fault: "divide-by-zero", - value: this, - }); - this.#checkFormat(o); - return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - divUnsafe(other) { - return this.#div(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - div(other) { - return this.#div(other, "div"); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%. A [[NumericFaultError]] is thrown if underflow - * (precision loss) occurs. - */ - divSignal(other) { - (0, errors_js_1.assert)(other.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { - operation: "div", - fault: "divide-by-zero", - value: this, - }); - this.#checkFormat(other); - const value = this.#val * this.#tens; - (0, errors_js_1.assert)(value % other.#val === BN_0, "precision lost during signalling div", "NUMERIC_FAULT", { - operation: "divSignal", - fault: "underflow", - value: this, - }); - return this.#checkValue(value / other.#val, "divSignal"); - } - /** - * Returns a comparison result between %%this%% and %%other%%. - * - * This is suitable for use in sorting, where ``-1`` implies %%this%% - * is smaller, ``1`` implies %%other%% is larger and ``0`` implies - * both are equal. - */ - cmp(other) { - let a = this.value, b = other.value; - // Coerce a and b to the same magnitude - const delta = this.decimals - other.decimals; - if (delta > 0) { - b *= getTens(delta); - } - else if (delta < 0) { - a *= getTens(-delta); - } - // Comnpare - if (a < b) { - return -1; - } - if (a > b) { - return -1; - } - return 0; - } - /** - * Returns true if %%other%% is equal to %%this%%. - */ - eq(other) { - return this.cmp(other) === 0; - } - /** - * Returns true if %%other%% is less than to %%this%%. - */ - lt(other) { - return this.cmp(other) < 0; - } - /** - * Returns true if %%other%% is less than or equal to %%this%%. - */ - lte(other) { - return this.cmp(other) <= 0; - } - /** - * Returns true if %%other%% is greater than to %%this%%. - */ - gt(other) { - return this.cmp(other) > 0; - } - /** - * Returns true if %%other%% is greater than or equal to %%this%%. - */ - gte(other) { - return this.cmp(other) >= 0; - } - /** - * Returns a new [[FixedNumber]] which is the largest **integer** - * that is less than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - floor() { - let val = this.#val; - if (this.#val < BN_0) { - val -= this.#tens - BN_1; - } - val = (this.#val / this.#tens) * this.#tens; - return this.#checkValue(val, "floor"); - } - /** - * Returns a new [[FixedNumber]] which is the smallest **integer** - * that is greater than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - ceiling() { - let val = this.#val; - if (this.#val > BN_0) { - val += this.#tens - BN_1; - } - val = (this.#val / this.#tens) * this.#tens; - return this.#checkValue(val, "ceiling"); - } - /** - * Returns a new [[FixedNumber]] with the decimal component - * rounded up on ties at %%decimals%% places. - */ - round(decimals) { - if (decimals == null) { - decimals = 0; - } - // Not enough precision to not already be rounded - if (decimals >= this.decimals) { - return this; - } - const delta = this.decimals - decimals; - const bump = BN_5 * getTens(delta - 1); - let value = this.value + bump; - const tens = getTens(delta); - value = (value / tens) * tens; - checkValue(value, this.#format, "round"); - return new _a(_guard, value, this.#format); - } - /** - * Returns true if %%this%% is equal to ``0``. - */ - isZero() { - return this.#val === BN_0; - } - /** - * Returns true if %%this%% is less than ``0``. - */ - isNegative() { - return this.#val < BN_0; - } - /** - * Returns the string representation of %%this%%. - */ - toString() { - return this._value; - } - /** - * Returns a float approximation. - * - * Due to IEEE 754 precission (or lack thereof), this function - * can only return an approximation and most values will contain - * rounding errors. - */ - toUnsafeFloat() { - return parseFloat(this.toString()); - } - /** - * Return a new [[FixedNumber]] with the same value but has had - * its field set to %%format%%. - * - * This will throw if the value cannot fit into %%format%%. - */ - toFormat(format) { - return _a.fromString(this.toString(), format); - } - /** - * Creates a new [[FixedNumber]] for %%value%% divided by - * %%decimal%% places with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% (once adjusted - * for %%decimals%%) cannot fit in %%format%%, either due to overflow - * or underflow (precision loss). - */ - static fromValue(_value, decimals, _format) { - if (decimals == null) { - decimals = 0; - } - const format = getFormat(_format); - let value = (0, maths_js_1.getBigInt)(_value, "value"); - const delta = decimals - format.decimals; - if (delta > 0) { - const tens = getTens(delta); - (0, errors_js_1.assert)(value % tens === BN_0, "value loses precision for format", "NUMERIC_FAULT", { - operation: "fromValue", - fault: "underflow", - value: _value, - }); - value /= tens; - } - else if (delta < 0) { - value *= getTens(-delta); - } - checkValue(value, format, "fromValue"); - return new _a(_guard, value, format); - } - /** - * Creates a new [[FixedNumber]] for %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%%, either due to overflow or underflow (precision loss). - */ - static fromString(_value, _format) { - const match = _value.match(/^(-?)([0-9]*)\.?([0-9]*)$/); - (0, errors_js_1.assertArgument)(match && match[2].length + match[3].length > 0, "invalid FixedNumber string value", "value", _value); - const format = getFormat(_format); - let whole = match[2] || "0", decimal = match[3] || ""; - // Pad out the decimals - while (decimal.length < format.decimals) { - decimal += Zeros; - } - // Check precision is safe - (0, errors_js_1.assert)(decimal.substring(format.decimals).match(/^0*$/), "too many decimals for format", "NUMERIC_FAULT", { - operation: "fromString", - fault: "underflow", - value: _value, - }); - // Remove extra padding - decimal = decimal.substring(0, format.decimals); - const value = BigInt(match[1] + whole + decimal); - checkValue(value, format, "fromString"); - return new _a(_guard, value, format); - } - /** - * Creates a new [[FixedNumber]] with the big-endian representation - * %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%% due to overflow. - */ - static fromBytes(_value, _format) { - let value = (0, maths_js_1.toBigInt)((0, data_js_1.getBytes)(_value, "value")); - const format = getFormat(_format); - if (format.signed) { - value = (0, maths_js_1.fromTwos)(value, format.width); - } - checkValue(value, format, "fromBytes"); - return new _a(_guard, value, format); - } -} -exports.FixedNumber = FixedNumber; -_a = FixedNumber; -//const f1 = FixedNumber.fromString("12.56", "fixed16x2"); -//const f2 = FixedNumber.fromString("0.3", "fixed16x2"); -//console.log(f1.divSignal(f2)); -//const BUMP = FixedNumber.from("0.5"); -//# sourceMappingURL=fixednumber.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/fixednumber.js.map b/lib.commonjs/utils/fixednumber.js.map deleted file mode 100644 index c425f9095..000000000 --- a/lib.commonjs/utils/fixednumber.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fixednumber.js","sourceRoot":"","sources":["../../src.ts/utils/fixednumber.ts"],"names":[],"mappings":";;;;AAAA;;;;GAIG;AACH,uCAAqC;AACrC,2CAAoE;AACpE,yCAAiE;AACjE,mDAAmD;AAInD,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAEvB,MAAM,MAAM,GAAG,EAAE,CAAC;AAElB,8CAA8C;AAC9C,IAAI,KAAK,GAAG,MAAM,CAAC;AACnB,OAAO,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;IACxB,KAAK,IAAI,KAAK,CAAC;CAChB;AAED,gDAAgD;AAChD,SAAS,OAAO,CAAC,QAAgB;IAC/B,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,OAAO,MAAM,CAAC,MAAM,GAAG,QAAQ,EAAE;QAC/B,MAAM,IAAI,MAAM,CAAC;KAClB;IACD,OAAO,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CA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ClB,KAAK,EAAE,MAAM;SACd,CACF,CAAC;QAEF,uBAAuB;QACvB,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEhD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,OAAO,CAAC,CAAC;QAEjD,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QAExC,OAAO,IAAI,EAAW,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,CAAC,MAAiB,EAAE,OAAqB;QACvD,IAAI,KAAK,GAAG,IAAA,mBAAQ,EAAC,IAAA,kBAAQ,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAElC,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,KAAK,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;SACvC;QAED,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QAEvC,OAAO,IAAI,EAAW,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;CACF;AAvgBD,kCAugBC;;AAED,0DAA0D;AAC1D,wDAAwD;AACxD,gCAAgC;AAChC,uCAAuC"} \ No newline at end of file diff --git a/lib.commonjs/utils/geturl-browser.d.ts b/lib.commonjs/utils/geturl-browser.d.ts deleted file mode 100644 index 133a13813..000000000 --- a/lib.commonjs/utils/geturl-browser.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; -declare global { - class Headers { - constructor(values: Array<[string, string]>); - forEach(func: (v: string, k: string) => void): void; - } - class Response { - status: number; - statusText: string; - headers: Headers; - arrayBuffer(): Promise; - } - type FetchInit = { - method?: string; - headers?: Headers; - body?: Uint8Array; - }; - function fetch(url: string, init: FetchInit): Promise; -} -export declare function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Promise; -//# sourceMappingURL=geturl-browser.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/geturl-browser.d.ts.map b/lib.commonjs/utils/geturl-browser.d.ts.map deleted file mode 100644 index 852575bca..000000000 --- a/lib.commonjs/utils/geturl-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geturl-browser.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl-browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,OAAO,CAAC,MAAM,CAAC;IAEb,MAAM,OAAO;oBACC,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;KACpD;IAGD,MAAM,QAAQ;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;KACpC;IAED,KAAK,SAAS,GAAG;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,UAAU,CAAC;KACnB,CAAC;IAEF,SAAS,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACjE;AAID,wBAAsB,MAAM,CAC1B,GAAG,EAAE,YAAY,EACjB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CA0DrC"} \ No newline at end of file diff --git a/lib.commonjs/utils/geturl-browser.js b/lib.commonjs/utils/geturl-browser.js deleted file mode 100644 index d620b6b92..000000000 --- a/lib.commonjs/utils/geturl-browser.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getUrl = void 0; -const errors_js_1 = require("./errors.js"); -// @TODO: timeout is completely ignored; start a Promise.any with a reject? -// @ts-ignore -async function getUrl(req, _signal) { - const protocol = req.url.split(":")[0].toLowerCase(); - (0, errors_js_1.assert)(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { - info: { protocol }, - operation: "request", - }); - (0, errors_js_1.assert)(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { - operation: "request", - }); - let signal = undefined; - if (_signal) { - const controller = new AbortController(); - signal = controller.signal; - _signal.addListener(() => { - controller.abort(); - }); - } - const init = { - method: req.method, - headers: new Headers(Array.from(req)), - body: req.body || undefined, - signal, - }; - try { - const resp = await fetch(req.url, init); - const headers = {}; - resp.headers.forEach((value, key) => { - headers[key.toLowerCase()] = value; - }); - const respBody = await resp.arrayBuffer(); - const body = respBody == null ? null : new Uint8Array(respBody); - return { - statusCode: resp.status, - statusMessage: resp.statusText, - headers, - body, - }; - } - catch (error) { - console.log({ error }); - return undefined; - } -} -exports.getUrl = getUrl; -//# sourceMappingURL=geturl-browser.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/geturl-browser.js.map b/lib.commonjs/utils/geturl-browser.js.map deleted file mode 100644 index cd677004f..000000000 --- a/lib.commonjs/utils/geturl-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geturl-browser.js","sourceRoot":"","sources":["../../src.ts/utils/geturl-browser.ts"],"names":[],"mappings":";;;AAAA,2CAAqC;AAgCrC,2EAA2E;AAC3E,aAAa;AACN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C,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC;QAEhE,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,MAAM;YACvB,aAAa,EAAE,IAAI,CAAC,UAAU;YAC9B,OAAO;YACP,IAAI;SACL,CAAC;KACH;IAAC,OAAO,KAAU,EAAE;QACnB,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACvB,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AA7DD,wBA6DC"} \ No newline at end of file diff --git a/lib.commonjs/utils/geturl.d.ts b/lib.commonjs/utils/geturl.d.ts deleted file mode 100644 index a4252134f..000000000 --- a/lib.commonjs/utils/geturl.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; -/** - * @_ignore: - */ -export declare function getUrl(req: FetchRequest, signal?: FetchCancelSignal): Promise; -//# sourceMappingURL=geturl.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/geturl.d.ts.map b/lib.commonjs/utils/geturl.d.ts.map deleted file mode 100644 index 8cde884db..000000000 --- a/lib.commonjs/utils/geturl.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geturl.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAsB,MAAM,CAC1B,GAAG,EAAE,YAAY,EACjB,MAAM,CAAC,EAAE,iBAAiB,GACzB,OAAO,CAAC,cAAc,CAAC,CAqGzB"} \ No newline at end of file diff --git a/lib.commonjs/utils/geturl.js b/lib.commonjs/utils/geturl.js deleted file mode 100644 index c12535f91..000000000 --- a/lib.commonjs/utils/geturl.js +++ /dev/null @@ -1,85 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getUrl = void 0; -const tslib_1 = require("tslib"); -const http_1 = tslib_1.__importDefault(require("http")); -const https_1 = tslib_1.__importDefault(require("https")); -const zlib_1 = require("zlib"); -const errors_js_1 = require("./errors.js"); -const data_js_1 = require("./data.js"); -/** - * @_ignore: - */ -async function getUrl(req, signal) { - const protocol = req.url.split(":")[0].toLowerCase(); - (0, errors_js_1.assert)(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { - info: { protocol }, - operation: "request", - }); - (0, errors_js_1.assert)(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { - operation: "request", - }); - const method = req.method; - const headers = Object.assign({}, req.headers); - const options = { method, headers }; - const request = (protocol === "http" ? http_1.default : https_1.default).request(req.url, options); - request.setTimeout(req.timeout); - const body = req.body; - if (body) { - request.write(Buffer.from(body)); - } - request.end(); - return new Promise((resolve, reject) => { - // @TODO: Node 15 added AbortSignal; once we drop support for - // Node14, we can add that in here too - request.once("response", (resp) => { - const statusCode = resp.statusCode || 0; - const statusMessage = resp.statusMessage || ""; - const headers = Object.keys(resp.headers || {}).reduce((accum, name) => { - let value = resp.headers[name] || ""; - if (Array.isArray(value)) { - value = value.join(", "); - } - accum[name] = value; - return accum; - }, {}); - let body = null; - //resp.setEncoding("utf8"); - resp.on("data", (chunk) => { - if (signal) { - try { - signal.checkSignal(); - } - catch (error) { - return reject(error); - } - } - if (body == null) { - body = chunk; - } - else { - const newBody = new Uint8Array(body.length + chunk.length); - newBody.set(body, 0); - newBody.set(chunk, body.length); - body = newBody; - } - }); - resp.on("end", () => { - if (headers["content-encoding"] === "gzip" && body) { - body = (0, data_js_1.getBytes)((0, zlib_1.gunzipSync)(body)); - } - resolve({ statusCode, statusMessage, headers, body }); - }); - resp.on("error", (error) => { - //@TODO: Should this just return nornal response with a server error? - error.response = { statusCode, statusMessage, headers, body }; - reject(error); - }); - }); - request.on("error", (error) => { - reject(error); - }); - }); -} -exports.getUrl = getUrl; -//# sourceMappingURL=geturl.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/geturl.js.map b/lib.commonjs/utils/geturl.js.map deleted file mode 100644 index 32f47f1bf..000000000 --- a/lib.commonjs/utils/geturl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geturl.js","sourceRoot":"","sources":["../../src.ts/utils/geturl.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AACxB,0DAA0B;AAC1B,+BAAkC;AAElC,2CAAqC;AACrC,uCAAqC;AAQrC;;GAEG;AACI,KAAK,UAAU,MAAM,CAC1B,GAAiB,EACjB,MAA0B;IAE1B,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAErD,IAAA,kBAAM,EACJ,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,OAAO,EAC3C,wBAAwB,QAAQ,EAAE,EAClC,uBAAuB,EACvB;QACE,IAAI,EAAE,EAAE,QAAQ,EAAE;QAClB,SAAS,EAAE,SAAS;KACrB,CACF,CAAC;IAEF,IAAA,kBAAM,EACJ,QAAQ,KAAK,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,2BAA2B,EAC3E,6CAA6C,EAC7C,uBAAuB,EACvB;QACE,SAAS,EAAE,SAAS;KACrB,CACF,CAAC;IAEF,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IAC1B,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAE/C,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,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC5B,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAxGD,wBAwGC"} \ No newline at end of file diff --git a/lib.commonjs/utils/index.d.ts b/lib.commonjs/utils/index.d.ts deleted file mode 100644 index 40183df8b..000000000 --- a/lib.commonjs/utils/index.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * There are many simple utilities required to interact with - * Core and to simplify the library, without increasing - * the library dependencies for simple functions. - * - * @_section api/utils:Utilities [about-utils] - */ -export { decodeBase58, encodeBase58 } from "./base58.js"; -export { decodeBase64, encodeBase64 } from "./base64.js"; -export { getBytes, getBytesCopy, isHexString, isBytesLike, hexlify, concat, dataLength, dataSlice, stripZerosLeft, zeroPadValue, zeroPadBytes, arrayify, hexConcat, } from "./data.js"; -export { isCallException, isError, assert, assertArgument, assertArgumentCount, assertPrivate, assertNormalize, makeError, } from "./errors.js"; -export { EventPayload } from "./events.js"; -export { FetchRequest, FetchResponse, FetchCancelSignal } from "./fetch.js"; -export { FixedNumber } from "./fixednumber.js"; -export { fromTwos, toTwos, mask, getBigInt, getNumber, getUint, toBigInt, toNumber, toBeHex, toBeArray, toQuantity, } from "./maths.js"; -export { resolveProperties, defineProperties } from "./properties.js"; -export { decodeRlp } from "./rlp-decode.js"; -export { encodeRlp } from "./rlp-encode.js"; -export { formatXCB, parseXCB, formatUnits, parseUnits } from "./units.js"; -export { toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, } from "./utf8.js"; -export { uuidV4 } from "./uuid.js"; -export type { BytesLike } from "./data.js"; -export type { ErrorCode, CoreBCError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CallExceptionAction, CallExceptionTransaction, CodedCoreBCError, } from "./errors.js"; -export type { EventEmitterable, Listener } from "./events.js"; -export type { GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc, } from "./fetch.js"; -export type { FixedFormat } from "./fixednumber.js"; -export type { BigNumberish, Numeric } from "./maths.js"; -export type { RlpStructuredData } from "./rlp.js"; -export type { Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, } from "./utf8.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/index.d.ts.map b/lib.commonjs/utils/index.d.ts.map deleted file mode 100644 index 2efd33012..000000000 --- a/lib.commonjs/utils/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,WAAW,EACX,OAAO,EACP,MAAM,EACN,UAAU,EACV,SAAS,EACT,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,SAAS,GACV,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,eAAe,EACf,OAAO,EACP,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,kB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AAEpD,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAExD,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,YAAY,EACV,aAAa,EACb,wBAAwB,EACxB,eAAe,GAChB,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/utils/index.js b/lib.commonjs/utils/index.js deleted file mode 100644 index 418c77a7e..000000000 --- a/lib.commonjs/utils/index.js +++ /dev/null @@ -1,80 +0,0 @@ -"use strict"; -/** - * There are many simple utilities required to interact with - * Core and to simplify the library, without increasing - * the library dependencies for simple functions. - * - * @_section api/utils:Utilities [about-utils] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.toUtf8Bytes = exports.parseUnits = exports.formatUnits = exports.parseXCB = exports.formatXCB = exports.encodeRlp = exports.decodeRlp = exports.defineProperties = exports.resolveProperties = exports.toQuantity = exports.toBeArray = exports.toBeHex = exports.toNumber = exports.toBigInt = exports.getUint = exports.getNumber = exports.getBigInt = exports.mask = exports.toTwos = exports.fromTwos = exports.FixedNumber = exports.FetchCancelSignal = exports.FetchResponse = exports.FetchRequest = exports.EventPayload = exports.makeError = exports.assertNormalize = exports.assertPrivate = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.isError = exports.isCallException = exports.hexConcat = exports.arrayify = exports.zeroPadBytes = exports.zeroPadValue = exports.stripZerosLeft = exports.dataSlice = exports.dataLength = exports.concat = exports.hexlify = exports.isBytesLike = exports.isHexString = exports.getBytesCopy = exports.getBytes = exports.encodeBase64 = exports.decodeBase64 = exports.encodeBase58 = exports.decodeBase58 = void 0; -exports.uuidV4 = exports.Utf8ErrorFuncs = exports.toUtf8String = exports.toUtf8CodePoints = void 0; -var base58_js_1 = require("./base58.js"); -Object.defineProperty(exports, "decodeBase58", { enumerable: true, get: function () { return base58_js_1.decodeBase58; } }); -Object.defineProperty(exports, "encodeBase58", { enumerable: true, get: function () { return base58_js_1.encodeBase58; } }); -var base64_js_1 = require("./base64.js"); -Object.defineProperty(exports, "decodeBase64", { enumerable: true, get: function () { return base64_js_1.decodeBase64; } }); -Object.defineProperty(exports, "encodeBase64", { enumerable: true, get: function () { return base64_js_1.encodeBase64; } }); -var data_js_1 = require("./data.js"); -Object.defineProperty(exports, "getBytes", { enumerable: true, get: function () { return data_js_1.getBytes; } }); -Object.defineProperty(exports, "getBytesCopy", { enumerable: true, get: function () { return data_js_1.getBytesCopy; } }); -Object.defineProperty(exports, "isHexString", { enumerable: true, get: function () { return data_js_1.isHexString; } }); -Object.defineProperty(exports, "isBytesLike", { enumerable: true, get: function () { return data_js_1.isBytesLike; } }); -Object.defineProperty(exports, "hexlify", { enumerable: true, get: function () { return data_js_1.hexlify; } }); -Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return data_js_1.concat; } }); -Object.defineProperty(exports, "dataLength", { enumerable: true, get: function () { return data_js_1.dataLength; } }); -Object.defineProperty(exports, "dataSlice", { enumerable: true, get: function () { return data_js_1.dataSlice; } }); -Object.defineProperty(exports, "stripZerosLeft", { enumerable: true, get: function () { return data_js_1.stripZerosLeft; } }); -Object.defineProperty(exports, "zeroPadValue", { enumerable: true, get: function () { return data_js_1.zeroPadValue; } }); -Object.defineProperty(exports, "zeroPadBytes", { enumerable: true, get: function () { return data_js_1.zeroPadBytes; } }); -Object.defineProperty(exports, "arrayify", { enumerable: true, get: function () { return data_js_1.arrayify; } }); -Object.defineProperty(exports, "hexConcat", { enumerable: true, get: function () { return data_js_1.hexConcat; } }); -var errors_js_1 = require("./errors.js"); -Object.defineProperty(exports, "isCallException", { enumerable: true, get: function () { return errors_js_1.isCallException; } }); -Object.defineProperty(exports, "isError", { enumerable: true, get: function () { return errors_js_1.isError; } }); -Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return errors_js_1.assert; } }); -Object.defineProperty(exports, "assertArgument", { enumerable: true, get: function () { return errors_js_1.assertArgument; } }); -Object.defineProperty(exports, "assertArgumentCount", { enumerable: true, get: function () { return errors_js_1.assertArgumentCount; } }); -Object.defineProperty(exports, "assertPrivate", { enumerable: true, get: function () { return errors_js_1.assertPrivate; } }); -Object.defineProperty(exports, "assertNormalize", { enumerable: true, get: function () { return errors_js_1.assertNormalize; } }); -Object.defineProperty(exports, "makeError", { enumerable: true, get: function () { return errors_js_1.makeError; } }); -var events_js_1 = require("./events.js"); -Object.defineProperty(exports, "EventPayload", { enumerable: true, get: function () { return events_js_1.EventPayload; } }); -var fetch_js_1 = require("./fetch.js"); -Object.defineProperty(exports, "FetchRequest", { enumerable: true, get: function () { return fetch_js_1.FetchRequest; } }); -Object.defineProperty(exports, "FetchResponse", { enumerable: true, get: function () { return fetch_js_1.FetchResponse; } }); -Object.defineProperty(exports, "FetchCancelSignal", { enumerable: true, get: function () { return fetch_js_1.FetchCancelSignal; } }); -var fixednumber_js_1 = require("./fixednumber.js"); -Object.defineProperty(exports, "FixedNumber", { enumerable: true, get: function () { return fixednumber_js_1.FixedNumber; } }); -var maths_js_1 = require("./maths.js"); -Object.defineProperty(exports, "fromTwos", { enumerable: true, get: function () { return maths_js_1.fromTwos; } }); -Object.defineProperty(exports, "toTwos", { enumerable: true, get: function () { return maths_js_1.toTwos; } }); -Object.defineProperty(exports, "mask", { enumerable: true, get: function () { return maths_js_1.mask; } }); -Object.defineProperty(exports, "getBigInt", { enumerable: true, get: function () { return maths_js_1.getBigInt; } }); -Object.defineProperty(exports, "getNumber", { enumerable: true, get: function () { return maths_js_1.getNumber; } }); -Object.defineProperty(exports, "getUint", { enumerable: true, get: function () { return maths_js_1.getUint; } }); -Object.defineProperty(exports, "toBigInt", { enumerable: true, get: function () { return maths_js_1.toBigInt; } }); -Object.defineProperty(exports, "toNumber", { enumerable: true, get: function () { return maths_js_1.toNumber; } }); -Object.defineProperty(exports, "toBeHex", { enumerable: true, get: function () { return maths_js_1.toBeHex; } }); -Object.defineProperty(exports, "toBeArray", { enumerable: true, get: function () { return maths_js_1.toBeArray; } }); -Object.defineProperty(exports, "toQuantity", { enumerable: true, get: function () { return maths_js_1.toQuantity; } }); -var properties_js_1 = require("./properties.js"); -Object.defineProperty(exports, "resolveProperties", { enumerable: true, get: function () { return properties_js_1.resolveProperties; } }); -Object.defineProperty(exports, "defineProperties", { enumerable: true, get: function () { return properties_js_1.defineProperties; } }); -var rlp_decode_js_1 = require("./rlp-decode.js"); -Object.defineProperty(exports, "decodeRlp", { enumerable: true, get: function () { return rlp_decode_js_1.decodeRlp; } }); -var rlp_encode_js_1 = require("./rlp-encode.js"); -Object.defineProperty(exports, "encodeRlp", { enumerable: true, get: function () { return rlp_encode_js_1.encodeRlp; } }); -var units_js_1 = require("./units.js"); -Object.defineProperty(exports, "formatXCB", { enumerable: true, get: function () { return units_js_1.formatXCB; } }); -Object.defineProperty(exports, "parseXCB", { enumerable: true, get: function () { return units_js_1.parseXCB; } }); -Object.defineProperty(exports, "formatUnits", { enumerable: true, get: function () { return units_js_1.formatUnits; } }); -Object.defineProperty(exports, "parseUnits", { enumerable: true, get: function () { return units_js_1.parseUnits; } }); -var utf8_js_1 = require("./utf8.js"); -Object.defineProperty(exports, "toUtf8Bytes", { enumerable: true, get: function () { return utf8_js_1.toUtf8Bytes; } }); -Object.defineProperty(exports, "toUtf8CodePoints", { enumerable: true, get: function () { return utf8_js_1.toUtf8CodePoints; } }); -Object.defineProperty(exports, "toUtf8String", { enumerable: true, get: function () { return utf8_js_1.toUtf8String; } }); -Object.defineProperty(exports, "Utf8ErrorFuncs", { enumerable: true, get: function () { return utf8_js_1.Utf8ErrorFuncs; } }); -var uuid_js_1 = require("./uuid.js"); -Object.defineProperty(exports, "uuidV4", { enumerable: true, get: function () { return uuid_js_1.uuidV4; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/index.js.map b/lib.commonjs/utils/index.js.map deleted file mode 100644 index 3c7c5dfbd..000000000 --- a/lib.commonjs/utils/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/utils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;AAAE,iHAAA,gBAAgB,OAAA;AAE5C,iDAA4C;AAAnC,0GAAA,SAAS,OAAA;AAClB,iDAA4C;AAAnC,0GAAA,SAAS,OAAA;AAElB,uCAA0E;AAAjE,qGAAA,SAAS,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,sGAAA,UAAU,OAAA;AAErD,qCAKmB;AAJjB,sGAAA,WAAW,OAAA;AACX,2GAAA,gBAAgB,OAAA;AAChB,uGAAA,YAAY,OAAA;AACZ,yGAAA,cAAc,OAAA;AAGhB,qCAAmC;AAA1B,iGAAA,MAAM,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/utils/maths.d.ts b/lib.commonjs/utils/maths.d.ts deleted file mode 100644 index e1fd19522..000000000 --- a/lib.commonjs/utils/maths.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -import type { BytesLike } from "./data.js"; -/** - * Any type that can be used where a numeric value is needed. - */ -export type Numeric = number | bigint; -/** - * Any type that can be used where a big number is needed. - */ -export type BigNumberish = string | Numeric; -/** - * Convert %%value%% from a twos-compliment representation of %%width%% - * bits to its value. - * - * If the highest bit is ``1``, the result will be negative. - */ -export declare function fromTwos(_value: BigNumberish, _width: Numeric): bigint; -/** - * Convert %%value%% to a twos-compliment representation of - * %%width%% bits. - * - * The result will always be positive. - */ -export declare function toTwos(_value: BigNumberish, _width: Numeric): bigint; -/** - * Mask %%value%% with a bitmask of %%bits%% ones. - */ -export declare function mask(_value: BigNumberish, _bits: Numeric): bigint; -/** - * Gets a BigInt from %%value%%. If it is an invalid value for - * a BigInt, then an ArgumentError will be thrown for %%name%%. - */ -export declare function getBigInt(value: BigNumberish, name?: string): bigint; -export declare function getUint(value: BigNumberish, name?: string): bigint; -export declare function toBigInt(value: BigNumberish | Uint8Array): bigint; -/** - * Gets a //number// from %%value%%. If it is an invalid value for - * a //number//, then an ArgumentError will be thrown for %%name%%. - */ -export declare function getNumber(value: BigNumberish, name?: string): number; -/** - * Converts %%value%% to a number. If %%value%% is a Uint8Array, it - * is treated as Big Endian data. Throws if the value is not safe. - */ -export declare function toNumber(value: BigNumberish | Uint8Array): number; -/** - * Converts %%value%% to a Big Endian hexstring, optionally padded to - * %%width%% bytes. - */ -export declare function toBeHex(_value: BigNumberish, _width?: Numeric): string; -/** - * Converts %%value%% to a Big Endian Uint8Array. - */ -export declare function toBeArray(_value: BigNumberish): Uint8Array; -/** - * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. - * - * A //Quantity// does not have and leading 0 values unless the value is - * the literal value `0x0`. This is most commonly used for JSSON-RPC - * numeric values. - */ -export declare function toQuantity(value: BytesLike | BigNumberish): string; -//# sourceMappingURL=maths.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/maths.d.ts.map b/lib.commonjs/utils/maths.d.ts.map deleted file mode 100644 index 375586bed..000000000 --- a/lib.commonjs/utils/maths.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"maths.d.ts","sourceRoot":"","sources":["../../src.ts/utils/maths.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAU5C;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAiBtE;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAwBpE;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAIjE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAqCpE;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAQlE;AAQD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAWjE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAwCpE;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAEjE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CA8BtE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAmB1D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,YAAY,GAAG,MAAM,CAWlE"} \ No newline at end of file diff --git a/lib.commonjs/utils/maths.js b/lib.commonjs/utils/maths.js deleted file mode 100644 index 4e6b1e8a3..000000000 --- a/lib.commonjs/utils/maths.js +++ /dev/null @@ -1,234 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.toQuantity = exports.toBeArray = exports.toBeHex = exports.toNumber = exports.getNumber = exports.toBigInt = exports.getUint = exports.getBigInt = exports.mask = exports.toTwos = exports.fromTwos = void 0; -/** - * Some mathematic operations. - * - * @_subsection: api/utils:Math Helpers [about-maths] - */ -const data_js_1 = require("./data.js"); -const errors_js_1 = require("./errors.js"); -const BN_0 = BigInt(0); -const BN_1 = BigInt(1); -//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1; -// IEEE 754 support 53-bits of mantissa -const maxValue = 0x1fffffffffffff; -/** - * Convert %%value%% from a twos-compliment representation of %%width%% - * bits to its value. - * - * If the highest bit is ``1``, the result will be negative. - */ -function fromTwos(_value, _width) { - const value = getUint(_value, "value"); - const width = BigInt(getNumber(_width, "width")); - (0, errors_js_1.assert)(value >> width === BN_0, "overflow", "NUMERIC_FAULT", { - operation: "fromTwos", - fault: "overflow", - value: _value, - }); - // Top bit set; treat as a negative value - if (value >> (width - BN_1)) { - const mask = (BN_1 << width) - BN_1; - return -((~value & mask) + BN_1); - } - return value; -} -exports.fromTwos = fromTwos; -/** - * Convert %%value%% to a twos-compliment representation of - * %%width%% bits. - * - * The result will always be positive. - */ -function toTwos(_value, _width) { - let value = getBigInt(_value, "value"); - const width = BigInt(getNumber(_width, "width")); - const limit = BN_1 << (width - BN_1); - if (value < BN_0) { - value = -value; - (0, errors_js_1.assert)(value <= limit, "too low", "NUMERIC_FAULT", { - operation: "toTwos", - fault: "overflow", - value: _value, - }); - const mask = (BN_1 << width) - BN_1; - return (~value & mask) + BN_1; - } - else { - (0, errors_js_1.assert)(value < limit, "too high", "NUMERIC_FAULT", { - operation: "toTwos", - fault: "overflow", - value: _value, - }); - } - return value; -} -exports.toTwos = toTwos; -/** - * Mask %%value%% with a bitmask of %%bits%% ones. - */ -function mask(_value, _bits) { - const value = getUint(_value, "value"); - const bits = BigInt(getNumber(_bits, "bits")); - return value & ((BN_1 << bits) - BN_1); -} -exports.mask = mask; -/** - * Gets a BigInt from %%value%%. If it is an invalid value for - * a BigInt, then an ArgumentError will be thrown for %%name%%. - */ -function getBigInt(value, name) { - switch (typeof value) { - case "bigint": - return value; - case "number": - (0, errors_js_1.assertArgument)(Number.isInteger(value), "underflow", name || "value", value); - (0, errors_js_1.assertArgument)(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return BigInt(value); - case "string": - try { - if (value === "") { - throw new Error("empty string"); - } - if (value[0] === "-" && value[1] !== "-") { - return -BigInt(value.substring(1)); - } - return BigInt(value); - } - catch (e) { - (0, errors_js_1.assertArgument)(false, `invalid BigNumberish string: ${e.message}`, name || "value", value); - } - } - (0, errors_js_1.assertArgument)(false, "invalid BigNumberish value", name || "value", value); -} -exports.getBigInt = getBigInt; -function getUint(value, name) { - const result = getBigInt(value, name); - (0, errors_js_1.assert)(result >= BN_0, "unsigned value cannot be negative", "NUMERIC_FAULT", { - fault: "overflow", - operation: "getUint", - value, - }); - return result; -} -exports.getUint = getUint; -const Nibbles = "0123456789abcdef"; -/* - * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it - * is treated as Big Endian data. - */ -function toBigInt(value) { - if (value instanceof Uint8Array) { - let result = "0x0"; - for (const v of value) { - result += Nibbles[v >> 4]; - result += Nibbles[v & 0x0f]; - } - return BigInt(result); - } - return getBigInt(value); -} -exports.toBigInt = toBigInt; -/** - * Gets a //number// from %%value%%. If it is an invalid value for - * a //number//, then an ArgumentError will be thrown for %%name%%. - */ -function getNumber(value, name) { - switch (typeof value) { - case "bigint": - (0, errors_js_1.assertArgument)(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return Number(value); - case "number": - (0, errors_js_1.assertArgument)(Number.isInteger(value), "underflow", name || "value", value); - (0, errors_js_1.assertArgument)(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return value; - case "string": - try { - if (value === "") { - throw new Error("empty string"); - } - return getNumber(BigInt(value), name); - } - catch (e) { - (0, errors_js_1.assertArgument)(false, `invalid numeric string: ${e.message}`, name || "value", value); - } - } - (0, errors_js_1.assertArgument)(false, "invalid numeric value", name || "value", value); -} -exports.getNumber = getNumber; -/** - * Converts %%value%% to a number. If %%value%% is a Uint8Array, it - * is treated as Big Endian data. Throws if the value is not safe. - */ -function toNumber(value) { - return getNumber(toBigInt(value)); -} -exports.toNumber = toNumber; -/** - * Converts %%value%% to a Big Endian hexstring, optionally padded to - * %%width%% bytes. - */ -function toBeHex(_value, _width) { - const value = getUint(_value, "value"); - let result = value.toString(16); - if (_width == null) { - // Ensure the value is of even length - if (result.length % 2) { - result = "0" + result; - } - } - else { - const width = getNumber(_width, "width"); - (0, errors_js_1.assert)(width * 2 >= result.length, `value exceeds width (${width} bits)`, "NUMERIC_FAULT", { - operation: "toBeHex", - fault: "overflow", - value: _value, - }); - // Pad the value to the required width - while (result.length < width * 2) { - result = "0" + result; - } - } - return "0x" + result; -} -exports.toBeHex = toBeHex; -/** - * Converts %%value%% to a Big Endian Uint8Array. - */ -function toBeArray(_value) { - const value = getUint(_value, "value"); - if (value === BN_0) { - return new Uint8Array([]); - } - let hex = value.toString(16); - if (hex.length % 2) { - hex = "0" + hex; - } - const result = new Uint8Array(hex.length / 2); - for (let i = 0; i < result.length; i++) { - const offset = i * 2; - result[i] = parseInt(hex.substring(offset, offset + 2), 16); - } - return result; -} -exports.toBeArray = toBeArray; -/** - * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. - * - * A //Quantity// does not have and leading 0 values unless the value is - * the literal value `0x0`. This is most commonly used for JSSON-RPC - * numeric values. - */ -function toQuantity(value) { - let result = (0, data_js_1.hexlify)((0, data_js_1.isBytesLike)(value) ? value : toBeArray(value)).substring(2); - while (result.startsWith("0")) { - result = result.substring(1); - } - if (result === "") { - result = "0"; - } - return "0x" + result; -} -exports.toQuantity = toQuantity; -//# sourceMappingURL=maths.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/maths.js.map b/lib.commonjs/utils/maths.js.map deleted file mode 100644 index 39f57c95a..000000000 --- a/lib.commonjs/utils/maths.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"maths.js","sourceRoot":"","sources":["../../src.ts/utils/maths.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,uCAAiD;AACjD,2CAAqD;AAcrD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAEvB,iDAAiD;AAEjD,uCAAuC;AACvC,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AAElC;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,MAAoB,EAAE,MAAe;IAC5D,M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MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;QACrB,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KAC7D;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAnBD,8BAmBC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,KAA+B;IACxD,IAAI,MAAM,GAAG,IAAA,iBAAO,EAAC,IAAA,qBAAW,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAC3E,CAAC,CACF,CAAC;IACF,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC7B,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KAC9B;IACD,IAAI,MAAM,KAAK,EAAE,EAAE;QACjB,MAAM,GAAG,GAAG,CAAC;KACd;IACD,OAAO,IAAI,GAAG,MAAM,CAAC;AACvB,CAAC;AAXD,gCAWC"} \ No newline at end of file diff --git a/lib.commonjs/utils/properties.d.ts b/lib.commonjs/utils/properties.d.ts deleted file mode 100644 index f7871cc89..000000000 --- a/lib.commonjs/utils/properties.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Resolves to a new object that is a copy of %%value%%, but with all - * values resolved. - */ -export declare function resolveProperties(value: { - [P in keyof T]: T[P] | Promise; -}): Promise; -/** - * Assigns the %%values%% to %%target%% as read-only values. - * - * It %%types%% is specified, the values are checked. - */ -export declare function defineProperties(target: T, values: { - [K in keyof T]?: T[K]; -}, types?: { - [K in keyof T]?: string; -}): void; -export declare function checkProperties(object: any, properties: { - [name: string]: boolean; -}): void; -//# sourceMappingURL=properties.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/properties.d.ts.map b/lib.commonjs/utils/properties.d.ts.map deleted file mode 100644 index 2520af8fb..000000000 --- a/lib.commonjs/utils/properties.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src.ts/utils/properties.ts"],"names":[],"mappings":"AAiCA;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE;KAC/C,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACrC,GAAG,OAAO,CAAC,CAAC,CAAC,CAYb;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,MAAM,EAAE,CAAC,EACT,MAAM,EAAE;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAAE,EACjC,KAAK,CAAC,EAAE;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM;CAAE,GAClC,IAAI,CAeN;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,GAAG,EACX,UAAU,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GACtC,IAAI,CAcN"} \ No newline at end of file diff --git a/lib.commonjs/utils/properties.js b/lib.commonjs/utils/properties.js deleted file mode 100644 index 10cdf2f4a..000000000 --- a/lib.commonjs/utils/properties.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.checkProperties = exports.defineProperties = exports.resolveProperties = void 0; -const logger_js_1 = require("../logger/logger.js"); -/** - * Property helper functions. - * - * @_subsection api/utils:Properties [about-properties] - */ -const logger = new logger_js_1.Logger("utils/properties/0.0.1"); -function checkType(value, type, name) { - const types = type.split("|").map((t) => t.trim()); - for (let i = 0; i < types.length; i++) { - switch (type) { - case "any": - return; - case "bigint": - case "boolean": - case "number": - case "string": - if (typeof value === type) { - return; - } - } - } - const error = new Error(`invalid value for type ${type}`); - error.code = "INVALID_ARGUMENT"; - error.argument = `value.${name}`; - error.value = value; - throw error; -} -/** - * Resolves to a new object that is a copy of %%value%%, but with all - * values resolved. - */ -async function resolveProperties(value) { - const keys = Object.keys(value); - const results = await Promise.all(keys.map((k) => Promise.resolve(value[k]))); - return results.reduce((accum, v, index) => { - accum[keys[index]] = v; - return accum; - }, {}); -} -exports.resolveProperties = resolveProperties; -/** - * Assigns the %%values%% to %%target%% as read-only values. - * - * It %%types%% is specified, the values are checked. - */ -function defineProperties(target, values, types) { - for (let key in values) { - let value = values[key]; - const type = types ? types[key] : null; - if (type) { - checkType(value, type, key); - } - Object.defineProperty(target, key, { - enumerable: true, - value, - writable: false, - }); - } -} -exports.defineProperties = defineProperties; -function checkProperties(object, properties) { - if (!object || typeof object !== "object") { - logger.throwArgumentError("invalid object", "object", object); - } - Object.keys(object).forEach((key) => { - if (!properties[key]) { - logger.throwArgumentError("invalid object key - " + key, "transaction:" + key, object); - } - }); -} -exports.checkProperties = checkProperties; -//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/properties.js.map b/lib.commonjs/utils/properties.js.map deleted file mode 100644 index 676a5c087..000000000 --- a/lib.commonjs/utils/properties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src.ts/utils/properties.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAE7C;;;;GAIG;AACH,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,wBAAwB,CAAC,CAAC;AAEpD,SAAS,SAAS,CAAC,KAAU,EAAE,IAAY,EAAE,IAAY;IACvD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CA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KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACvC,IAAI,IAAI,EAAE;YACR,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;SAC7B;QAED,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE;YACjC,UAAU,EAAE,IAAI;YAChB,KAAK;YACL,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;KACJ;AACH,CAAC;AAnBD,4CAmBC;AAED,SAAgB,eAAe,CAC7B,MAAW,EACX,UAAuC;IAEvC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QACzC,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KAC/D;IAED,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAClC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YACpB,MAAM,CAAC,kBAAkB,CACvB,uBAAuB,GAAG,GAAG,EAC7B,cAAc,GAAG,GAAG,EACpB,MAAM,CACP,CAAC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAjBD,0CAiBC"} \ No newline at end of file diff --git a/lib.commonjs/utils/rlp-decode.d.ts b/lib.commonjs/utils/rlp-decode.d.ts deleted file mode 100644 index b77b08b9c..000000000 --- a/lib.commonjs/utils/rlp-decode.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { BytesLike, RlpStructuredData } from "./index.js"; -/** - * Decodes %%data%% into the structured data it represents. - */ -export declare function decodeRlp(_data: BytesLike): RlpStructuredData; -//# sourceMappingURL=rlp-decode.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/rlp-decode.d.ts.map b/lib.commonjs/utils/rlp-decode.d.ts.map deleted file mode 100644 index b82126ab8..000000000 --- a/lib.commonjs/utils/rlp-decode.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp-decode.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp-decode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAyH/D;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,iBAAiB,CAU7D"} \ No newline at end of file diff --git a/lib.commonjs/utils/rlp-decode.js b/lib.commonjs/utils/rlp-decode.js deleted file mode 100644 index cacc3f487..000000000 --- a/lib.commonjs/utils/rlp-decode.js +++ /dev/null @@ -1,88 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.decodeRlp = void 0; -const data_js_1 = require("./data.js"); -const errors_js_1 = require("./errors.js"); -const data_js_2 = require("./data.js"); -function hexlifyByte(value) { - let result = value.toString(16); - while (result.length < 2) { - result = "0" + result; - } - return "0x" + result; -} -function unarrayifyInteger(data, offset, length) { - let result = 0; - for (let i = 0; i < length; i++) { - result = result * 256 + data[offset + i]; - } - return result; -} -function _decodeChildren(data, offset, childOffset, length) { - const result = []; - while (childOffset < offset + 1 + length) { - const decoded = _decode(data, childOffset); - result.push(decoded.result); - childOffset += decoded.consumed; - (0, errors_js_1.assert)(childOffset <= offset + 1 + length, "child data too short", "BUFFER_OVERRUN", { - buffer: data, - length, - offset, - }); - } - return { consumed: 1 + length, result: result }; -} -// returns { consumed: number, result: Object } -function _decode(data, offset) { - (0, errors_js_1.assert)(data.length !== 0, "data too short", "BUFFER_OVERRUN", { - buffer: data, - length: 0, - offset: 1, - }); - const checkOffset = (offset) => { - (0, errors_js_1.assert)(offset <= data.length, "data short segment too short", "BUFFER_OVERRUN", { - buffer: data, - length: data.length, - offset, - }); - }; - // Array with extra length prefix - if (data[offset] >= 0xf8) { - const lengthLength = data[offset] - 0xf7; - checkOffset(offset + 1 + lengthLength); - const length = unarrayifyInteger(data, offset + 1, lengthLength); - checkOffset(offset + 1 + lengthLength + length); - return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); - } - else if (data[offset] >= 0xc0) { - const length = data[offset] - 0xc0; - checkOffset(offset + 1 + length); - return _decodeChildren(data, offset, offset + 1, length); - } - else if (data[offset] >= 0xb8) { - const lengthLength = data[offset] - 0xb7; - checkOffset(offset + 1 + lengthLength); - const length = unarrayifyInteger(data, offset + 1, lengthLength); - checkOffset(offset + 1 + lengthLength + length); - const result = (0, data_js_1.hexlify)(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); - return { consumed: 1 + lengthLength + length, result: result }; - } - else if (data[offset] >= 0x80) { - const length = data[offset] - 0x80; - checkOffset(offset + 1 + length); - const result = (0, data_js_1.hexlify)(data.slice(offset + 1, offset + 1 + length)); - return { consumed: 1 + length, result: result }; - } - return { consumed: 1, result: hexlifyByte(data[offset]) }; -} -/** - * Decodes %%data%% into the structured data it represents. - */ -function decodeRlp(_data) { - const data = (0, data_js_2.getBytes)(_data, "data"); - const decoded = _decode(data, 0); - (0, errors_js_1.assertArgument)(decoded.consumed === data.length, "unexpected junk after rlp payload", "data", _data); - return decoded.result; -} -exports.decodeRlp = decodeRlp; -//# sourceMappingURL=rlp-decode.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/rlp-decode.js.map b/lib.commonjs/utils/rlp-decode.js.map deleted file mode 100644 index 25b638083..000000000 --- a/lib.commonjs/utils/rlp-decode.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp-decode.js","sourceRoot":"","sources":["../../src.ts/utils/rlp-decode.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AACpC,2CAAqD;AACrD,uCAAqC;AAIrC,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACxB,MAAM,GAAG,GAAG,GAAG,MAAM,C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CAAC;AAVD,8BAUC"} \ No newline at end of file diff --git a/lib.commonjs/utils/rlp-encode.d.ts b/lib.commonjs/utils/rlp-encode.d.ts deleted file mode 100644 index 9c3d024ac..000000000 --- a/lib.commonjs/utils/rlp-encode.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { RlpStructuredData } from "./rlp.js"; -/** - * Encodes %%object%% as an RLP-encoded [[DataHexString]]. - */ -export declare function encodeRlp(object: RlpStructuredData): string; -//# sourceMappingURL=rlp-encode.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/rlp-encode.d.ts.map b/lib.commonjs/utils/rlp-encode.d.ts.map deleted file mode 100644 index 3fa6ef0ba..000000000 --- a/lib.commonjs/utils/rlp-encode.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp-encode.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp-encode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAgDlD;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAO3D"} \ No newline at end of file diff --git a/lib.commonjs/utils/rlp-encode.js b/lib.commonjs/utils/rlp-encode.js deleted file mode 100644 index 63a001ccd..000000000 --- a/lib.commonjs/utils/rlp-encode.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.encodeRlp = void 0; -const data_js_1 = require("./data.js"); -function arrayifyInteger(value) { - const result = []; - while (value) { - result.unshift(value & 0xff); - value >>= 8; - } - return result; -} -function _encode(object) { - if (Array.isArray(object)) { - let payload = []; - object.forEach(function (child) { - payload = payload.concat(_encode(child)); - }); - if (payload.length <= 55) { - payload.unshift(0xc0 + payload.length); - return payload; - } - const length = arrayifyInteger(payload.length); - length.unshift(0xf7 + length.length); - return length.concat(payload); - } - const data = Array.prototype.slice.call((0, data_js_1.getBytes)(object, "object")); - if (data.length === 1 && data[0] <= 0x7f) { - return data; - } - else if (data.length <= 55) { - data.unshift(0x80 + data.length); - return data; - } - const length = arrayifyInteger(data.length); - length.unshift(0xb7 + length.length); - return length.concat(data); -} -const nibbles = "0123456789abcdef"; -/** - * Encodes %%object%% as an RLP-encoded [[DataHexString]]. - */ -function encodeRlp(object) { - let result = "0x"; - for (const v of _encode(object)) { - result += nibbles[v >> 4]; - result += nibbles[v & 0xf]; - } - return result; -} -exports.encodeRlp = encodeRlp; -//# sourceMappingURL=rlp-encode.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/rlp-encode.js.map b/lib.commonjs/utils/rlp-encode.js.map deleted file mode 100644 index 122b77431..000000000 --- a/lib.commonjs/utils/rlp-encode.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp-encode.js","sourceRoot":"","sources":["../../src.ts/utils/rlp-encode.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;AAIrC,SAAS,eAAe,CAAC,KAAa;IACpC,MAAM,MAAM,GAAQ,EAAE,CAAC;IACvB,OAAO,KAAK,EAAE;QACZ,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;QAC7B,KAAK,KAAK,CAAC,CAAC;KACb;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,OAAO,CAAC,MAA2B;IAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACzB,IAAI,OAAO,GAAkB,EAAE,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,UAAU,KAAK;YAC5B,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE;YACxB,OAAO,CAAC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;YACvC,OAAO,OAAO,CAAC;SAChB;QAED,MAAM,MAAM,G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115..000000000 --- a/lib.commonjs/utils/rlp.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * The [[link-rlp]] (RLP) encoding is used throughout Core - * to serialize nested structures of Arrays and data. - * - * @_subsection api/utils:Recursive-Length Prefix [about-rlp] - */ -export { decodeRlp } from "./rlp-decode.js"; -export { encodeRlp } from "./rlp-encode.js"; -/** - * An RLP-encoded structure. - */ -export type RlpStructuredData = string | Array; -//# sourceMappingURL=rlp.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/rlp.d.ts.map b/lib.commonjs/utils/rlp.d.ts.map deleted file mode 100644 index c5043abd3..000000000 --- a/lib.commonjs/utils/rlp.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/utils/rlp.js b/lib.commonjs/utils/rlp.js deleted file mode 100644 index 48eea0d36..000000000 --- a/lib.commonjs/utils/rlp.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -/** - * The [[link-rlp]] (RLP) encoding is used throughout Core - * to serialize nested structures of Arrays and data. - * - * @_subsection api/utils:Recursive-Length Prefix [about-rlp] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.encodeRlp = exports.decodeRlp = void 0; -var rlp_decode_js_1 = require("./rlp-decode.js"); -Object.defineProperty(exports, "decodeRlp", { enumerable: true, get: function () { return rlp_decode_js_1.decodeRlp; } }); -var rlp_encode_js_1 = require("./rlp-encode.js"); -Object.defineProperty(exports, "encodeRlp", { enumerable: true, get: function () { return rlp_encode_js_1.encodeRlp; } }); -//# sourceMappingURL=rlp.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/rlp.js.map b/lib.commonjs/utils/rlp.js.map deleted file mode 100644 index 4e95eb341..000000000 --- a/lib.commonjs/utils/rlp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp.js","sourceRoot":"","sources":["../../src.ts/utils/rlp.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iDAA4C;AAAnC,0GAAA,SAAS,OAAA;AAClB,iDAA4C;AAAnC,0GAAA,SAAS,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/utils/units.d.ts b/lib.commonjs/utils/units.d.ts deleted file mode 100644 index dfb7a32a6..000000000 --- a/lib.commonjs/utils/units.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { BigNumberish, Numeric } from "../utils/index.js"; -/** - * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal - * places. The %%unit%% may be the number of decimal places or the name of - * a unit - * - */ -export declare function formatUnits(value: BigNumberish, unit?: string | Numeric): string; -/** - * Converts the //decimal string// %%value%% to a BigInt, assuming - * %%unit%% decimal places. The %%unit%% may the number of decimal places - * or the name of a unit. - */ -export declare const scientificToDecimal: (num: string | number) => string | number; -export declare const trimDecimals: (n: string, decimals?: number) => string; -export declare function parseUnits(value: string, unit?: string | Numeric): bigint; -/** - * Converts %%value%% into a //decimal string// using 18 decimal places. - */ -export declare function formatXCB(ore: BigNumberish): string; -/** - * Converts the //decimal string// %%xcb%% to a BigInt, using 18 - * decimal places. - */ -export declare function parseXCB(xcb: string): bigint; -//# sourceMappingURL=units.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/units.d.ts.map b/lib.commonjs/utils/units.d.ts.map deleted file mode 100644 index 3db242e6c..000000000 --- a/lib.commonjs/utils/units.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src.ts/utils/units.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAwB/D;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,YAAY,EACnB,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GACtB,MAAM,CAWR;AAED;;;;GAIG;AAEH,eAAO,MAAM,mBAAmB,QAAS,MAAM,GAAG,MAAM,oBA6CvD,CAAC;AACF,eAAO,MAAM,YAAY,MAAO,MAAM,8BAQrC,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAsBzE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAEnD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C"} \ No newline at end of file diff --git a/lib.commonjs/utils/units.js b/lib.commonjs/utils/units.js deleted file mode 100644 index 7dfd6c321..000000000 --- a/lib.commonjs/utils/units.js +++ /dev/null @@ -1,160 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.parseXCB = exports.formatXCB = exports.parseUnits = exports.trimDecimals = exports.scientificToDecimal = exports.formatUnits = void 0; -/** - * Most interactions with Core requires integer values, which use - * the smallest magnitude unit. - * - * For example, imagine dealing with dollars and cents. Since dollars - * are divisible, non-integer values are possible, such as ``$10.77``. - * By using the smallest indivisible unit (i.e. cents), the value can - * be kept as the integer ``1077``. - * - * When receiving decimal input from the user (as a decimal string), - * the value should be converted to an integer and when showing a user - * a value, the integer value should be converted to a decimal string. - * - * This creates a clear distinction, between values to be used by code - * (integers) and values used for display logic to users (decimals). - * - * The native unit in Core, //Core// is divisible to 18 decimal places, - * where each individual unit is called a //ore//. - * - * @_subsection api/utils:Unit Conversion [about-units] - */ -const errors_js_1 = require("./errors.js"); -const fixednumber_js_1 = require("./fixednumber.js"); -const maths_js_1 = require("./maths.js"); -const names = [ - ///Ore, the smallest and atomic amount of Core - "ore", - ///fecore, 1000 ore - "fecore", - ///Picore, one million ore - "picore", - ///Nacore, one billion ore. Typically a reasonable unit to measure energy prices. - "nacore", - ///Μcore, 10^12 ore or 1 μCore - "mcore", - ///micore, 10^15 ore or 1 mcore - "micore", - "core", -]; -/** - * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal - * places. The %%unit%% may be the number of decimal places or the name of - * a unit - * - */ -function formatUnits(value, unit) { - let decimals = 18; - if (typeof unit === "string") { - const index = names.indexOf(unit); - (0, errors_js_1.assertArgument)(index >= 0, "invalid unit", "unit", unit); - decimals = 3 * index; - } - else if (unit != null) { - decimals = (0, maths_js_1.getNumber)(unit, "unit"); - } - return fixednumber_js_1.FixedNumber.fromValue(value, decimals, { decimals }).toString(); -} -exports.formatUnits = formatUnits; -/** - * Converts the //decimal string// %%value%% to a BigInt, assuming - * %%unit%% decimal places. The %%unit%% may the number of decimal places - * or the name of a unit. - */ -const scientificToDecimal = (num) => { - // @ts-ignore - var nsign = Math.sign(num); - //remove the sign - // @ts-ignore - num = Math.abs(num); - //if the number is in scientific notation remove it - // @ts-ignore - if (/\d+\.?\d*e[\+\-]*\d+/i.test(num)) { - var zero = "0", - // @ts-ignore - parts = String(num).toLowerCase().split("e"), //split into coeff and exponent - e = parts.pop(), //store the exponential part - // @ts-ignore - l = Math.abs(e), //get the number of zeros - // @ts-ignore - sign = e / l, coeff_array = parts[0].split("."); - if (sign === -1) { - l = l - coeff_array[0].length; - if (l < 0) { - // @ts-ignore - num = - coeff_array[0].slice(0, l) + - "." + - coeff_array[0].slice(l) + - (coeff_array.length === 2 ? coeff_array[1] : ""); - } - else { - // @ts-ignore - num = zero + "." + new Array(l + 1).join(zero) + coeff_array.join(""); - } - } - else { - var dec = coeff_array[1]; - if (dec) - l = l - dec.length; - if (l < 0) { - // @ts-ignore - num = coeff_array[0] + dec.slice(0, l) + "." + dec.slice(l); - } - else { - // @ts-ignore - num = coeff_array.join("") + new Array(l + 1).join(zero); - } - } - } - // @ts-ignore - return nsign < 0 ? "-" + num : num; -}; -exports.scientificToDecimal = scientificToDecimal; -const trimDecimals = (n, decimals = 18) => { - n += ""; - if (n.indexOf(".") === -1) - return n; - const arr = n.split("."); - const fraction = arr[1].substr(0, decimals); - return arr[0] + "." + fraction; -}; -exports.trimDecimals = trimDecimals; -function parseUnits(value, unit) { - (0, errors_js_1.assertArgument)(typeof value === "string", "value must be a string", "value", value); - if (value.includes("e")) { - value = (0, exports.scientificToDecimal)(value).toString(); - } - let decimals = 18; - if (typeof unit === "string") { - const index = names.indexOf(unit); - (0, errors_js_1.assertArgument)(index >= 0, "invalid unit", "unit", unit); - decimals = 3 * index; - value = (0, exports.trimDecimals)(value, decimals); - } - else if (unit != null) { - decimals = (0, maths_js_1.getNumber)(unit, "unit"); - value = (0, exports.trimDecimals)(value, decimals); - } - return fixednumber_js_1.FixedNumber.fromString(value, { decimals }).value; -} -exports.parseUnits = parseUnits; -/** - * Converts %%value%% into a //decimal string// using 18 decimal places. - */ -function formatXCB(ore) { - return formatUnits(ore, 18); -} -exports.formatXCB = formatXCB; -/** - * Converts the //decimal string// %%xcb%% to a BigInt, using 18 - * decimal places. - */ -function parseXCB(xcb) { - return parseUnits(xcb, 18); -} -exports.parseXCB = parseXCB; -//# sourceMappingURL=units.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/units.js.map b/lib.commonjs/utils/units.js.map deleted file mode 100644 index 5787d59c9..000000000 --- a/lib.commonjs/utils/units.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"units.js","sourceRoot":"","sources":["../../src.ts/utils/units.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,2CAA6C;AAC7C,qDAA+C;AAC/C,yCAAuC;AAIvC,MAAM,KAAK,GAAG;IACZ,8CAA8C;IAC9C,KAAK;IAEL,mBAAmB;IACnB,QAAQ;IAER,0BAA0B;IAC1B,Q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AAc,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QACzD,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC;QACrB,KAAK,GAAG,IAAA,oBAAY,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;KACvC;SAAM,IAAI,IAAI,IAAI,IAAI,EAAE;QACvB,QAAQ,GAAG,IAAA,oBAAS,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACnC,KAAK,GAAG,IAAA,oBAAY,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;KACvC;IAED,OAAO,4BAAW,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC;AAC3D,CAAC;AAtBD,gCAsBC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,GAAiB;IACzC,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,QAAQ,CAAC,GAAW;IAClC,OAAO,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC;AAFD,4BAEC"} \ No newline at end of file diff --git a/lib.commonjs/utils/utf8.d.ts b/lib.commonjs/utils/utf8.d.ts deleted file mode 100644 index 7bb87cc7d..000000000 --- a/lib.commonjs/utils/utf8.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -import type { BytesLike } from "./index.js"; -/** - * The stanard normalization forms. - */ -export type UnicodeNormalizationForm = "NFC" | "NFD" | "NFKC" | "NFKD"; -/** - * When using the UTF-8 error API the following errors can be intercepted - * and processed as the %%reason%% passed to the [[Utf8ErrorFunc]]. - * - * **``"UNEXPECTED_CONTINUE"``** - a continuation byte was present where there - * was nothing to continue. - * - * **``"BAD_PREFIX"``** - an invalid (non-continuation) byte to start a - * UTF-8 codepoint was found. - * - * **``"OVERRUN"``** - the string is too short to process the expected - * codepoint length. - * - * **``"MISSING_CONTINUE"``** - a missing continuation byte was expected but - * not found. The %%offset%% indicates the index the continuation byte - * was expected at. - * - * **``"OUT_OF_RANGE"``** - the computed code point is outside the range - * for UTF-8. The %%badCodepoint%% indicates the computed codepoint, which was - * outside the valid UTF-8 range. - * - * **``"UTF16_SURROGATE"``** - the UTF-8 strings contained a UTF-16 surrogate - * pair. The %%badCodepoint%% is the computed codepoint, which was inside the - * UTF-16 surrogate range. - * - * **``"OVERLONG"``** - the string is an overlong representation. The - * %%badCodepoint%% indicates the computed codepoint, which has already - * been bounds checked. - * - * - * @returns string - */ -export type Utf8ErrorReason = "UNEXPECTED_CONTINUE" | "BAD_PREFIX" | "OVERRUN" | "MISSING_CONTINUE" | "OUT_OF_RANGE" | "UTF16_SURROGATE" | "OVERLONG"; -/** - * A callback that can be used with [[toUtf8String]] to analysis or - * recovery from invalid UTF-8 data. - * - * Parsing UTF-8 data is done through a simple Finite-State Machine (FSM) - * which calls the ``Utf8ErrorFunc`` if a fault is detected. - * - * The %%reason%% indicates where in the FSM execution the fault - * occurred and the %%offset%% indicates where the input failed. - * - * The %%bytes%% represents the raw UTF-8 data that was provided and - * %%output%% is the current array of UTF-8 code-points, which may - * be updated by the ``Utf8ErrorFunc``. - * - * The value of the %%badCodepoint%% depends on the %%reason%%. See - * [[Utf8ErrorReason]] for details. - * - * The function should return the number of bytes that should be skipped - * when control resumes to the FSM. - */ -export type Utf8ErrorFunc = (reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array, badCodepoint?: number) => number; -/** - * A handful of popular, built-in UTF-8 error handling strategies. - * - * **``"error"``** - throws on ANY illegal UTF-8 sequence or - * non-canonical (overlong) codepoints (this is the default) - * - * **``"ignore"``** - silently drops any illegal UTF-8 sequence - * and accepts non-canonical (overlong) codepoints - * - * **``"replace"``** - replace any illegal UTF-8 sequence with the - * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts - * non-canonical (overlong) codepoints - * - * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> - */ -export declare const Utf8ErrorFuncs: Readonly>; -/** - * Returns the UTF-8 byte representation of %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ -export declare function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array; -/** - * Returns the string represented by the UTF-8 data %%bytes%%. - * - * When %%onError%% function is specified, it is called on UTF-8 - * errors allowing recovery using the [[Utf8ErrorFunc]] API. - * (default: [error](Utf8ErrorFuncs)) - */ -export declare function toUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string; -/** - * Returns the UTF-8 code-points for %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ -export declare function toUtf8CodePoints(str: string, form?: UnicodeNormalizationForm): Array; -//# sourceMappingURL=utf8.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/utf8.d.ts.map b/lib.commonjs/utils/utf8.d.ts.map deleted file mode 100644 index f79c87b2e..000000000 --- a/lib.commonjs/utils/utf8.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utf8.d.ts","sourceRoot":"","sources":["../../src.ts/utils/utf8.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAI5C;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,eAAe,GACvB,qBAAqB,GACrB,YAAY,GACZ,SAAS,GACT,kBAAkB,GAClB,cAAc,GACd,iBAAiB,GACjB,UAAU,CAAC;AAEf;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EACrB,YAAY,CAAC,EAAE,MAAM,KAClB,MAAM,CAAC;AAwEZ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CACnC,MAAM,CAAC,OAAO,GAAG,QAAQ,GAAG,SAAS,EAAE,aAAa,CAAC,CAKrD,CAAC;AA2GH;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,wBAAwB,GAC9B,UAAU,CAwCZ;AAkBD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAChB,OAAO,CAAC,EAAE,aAAa,GACtB,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,wBAAwB,GAC9B,KAAK,CAAC,MAAM,CAAC,CAEf"} \ No newline at end of file diff --git a/lib.commonjs/utils/utf8.js b/lib.commonjs/utils/utf8.js deleted file mode 100644 index 935ce193d..000000000 --- a/lib.commonjs/utils/utf8.js +++ /dev/null @@ -1,226 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.toUtf8CodePoints = exports.toUtf8String = exports.toUtf8Bytes = exports.Utf8ErrorFuncs = void 0; -/** - * Using strings in Core (or any security-basd system) requires - * additional care. These utilities attempt to mitigate some of the - * safety issues as well as provide the ability to recover and analyse - * strings. - * - * @_subsection api/utils:Strings and UTF-8 [about-strings] - */ -const data_js_1 = require("./data.js"); -const errors_js_1 = require("./errors.js"); -function errorFunc(reason, offset, bytes, output, badCodepoint) { - (0, errors_js_1.assertArgument)(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); -} -function ignoreFunc(reason, offset, bytes, output, badCodepoint) { - // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes - if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { - let i = 0; - for (let o = offset + 1; o < bytes.length; o++) { - if (bytes[o] >> 6 !== 0x02) { - break; - } - i++; - } - return i; - } - // This byte runs us past the end of the string, so just jump to the end - // (but the first byte was read already read and therefore skipped) - if (reason === "OVERRUN") { - return bytes.length - offset - 1; - } - // Nothing to skip - return 0; -} -function replaceFunc(reason, offset, bytes, output, badCodepoint) { - // Overlong representations are otherwise "valid" code points; just non-deistingtished - if (reason === "OVERLONG") { - (0, errors_js_1.assertArgument)(typeof badCodepoint === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint); - output.push(badCodepoint); - return 0; - } - // Put the replacement character into the output - output.push(0xfffd); - // Otherwise, process as if ignoring errors - return ignoreFunc(reason, offset, bytes, output, badCodepoint); -} -/** - * A handful of popular, built-in UTF-8 error handling strategies. - * - * **``"error"``** - throws on ANY illegal UTF-8 sequence or - * non-canonical (overlong) codepoints (this is the default) - * - * **``"ignore"``** - silently drops any illegal UTF-8 sequence - * and accepts non-canonical (overlong) codepoints - * - * **``"replace"``** - replace any illegal UTF-8 sequence with the - * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts - * non-canonical (overlong) codepoints - * - * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> - */ -exports.Utf8ErrorFuncs = Object.freeze({ - error: errorFunc, - ignore: ignoreFunc, - replace: replaceFunc, -}); -// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 -function getUtf8CodePoints(_bytes, onError) { - if (onError == null) { - onError = exports.Utf8ErrorFuncs.error; - } - const bytes = (0, data_js_1.getBytes)(_bytes, "bytes"); - const result = []; - let i = 0; - // Invalid bytes are ignored - while (i < bytes.length) { - const c = bytes[i++]; - // 0xxx xxxx - if (c >> 7 === 0) { - result.push(c); - continue; - } - // Multibyte; how many bytes left for this character? - let extraLength = null; - let overlongMask = null; - // 110x xxxx 10xx xxxx - if ((c & 0xe0) === 0xc0) { - extraLength = 1; - overlongMask = 0x7f; - // 1110 xxxx 10xx xxxx 10xx xxxx - } - else if ((c & 0xf0) === 0xe0) { - extraLength = 2; - overlongMask = 0x7ff; - // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx - } - else if ((c & 0xf8) === 0xf0) { - extraLength = 3; - overlongMask = 0xffff; - } - else { - if ((c & 0xc0) === 0x80) { - i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); - } - else { - i += onError("BAD_PREFIX", i - 1, bytes, result); - } - continue; - } - // Do we have enough bytes in our data? - if (i - 1 + extraLength >= bytes.length) { - i += onError("OVERRUN", i - 1, bytes, result); - continue; - } - // Remove the length prefix from the char - let res = c & ((1 << (8 - extraLength - 1)) - 1); - for (let j = 0; j < extraLength; j++) { - let nextChar = bytes[i]; - // Invalid continuation byte - if ((nextChar & 0xc0) != 0x80) { - i += onError("MISSING_CONTINUE", i, bytes, result); - res = null; - break; - } - res = (res << 6) | (nextChar & 0x3f); - i++; - } - // See above loop for invalid continuation byte - if (res === null) { - continue; - } - // Maximum code point - if (res > 0x10ffff) { - i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); - continue; - } - // Reserved for UTF-16 surrogate halves - if (res >= 0xd800 && res <= 0xdfff) { - i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); - continue; - } - // Check for overlong sequences (more bytes than needed) - if (res <= overlongMask) { - i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); - continue; - } - result.push(res); - } - return result; -} -// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array -/** - * Returns the UTF-8 byte representation of %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ -function toUtf8Bytes(str, form) { - if (form != null) { - (0, errors_js_1.assertNormalize)(form); - str = str.normalize(form); - } - let result = []; - for (let i = 0; i < str.length; i++) { - const c = str.charCodeAt(i); - if (c < 0x80) { - result.push(c); - } - else if (c < 0x800) { - result.push((c >> 6) | 0xc0); - result.push((c & 0x3f) | 0x80); - } - else if ((c & 0xfc00) == 0xd800) { - i++; - const c2 = str.charCodeAt(i); - (0, errors_js_1.assertArgument)(i < str.length && (c2 & 0xfc00) === 0xdc00, "invalid surrogate pair", "str", str); - // Surrogate Pair - const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); - result.push((pair >> 18) | 0xf0); - result.push(((pair >> 12) & 0x3f) | 0x80); - result.push(((pair >> 6) & 0x3f) | 0x80); - result.push((pair & 0x3f) | 0x80); - } - else { - result.push((c >> 12) | 0xe0); - result.push(((c >> 6) & 0x3f) | 0x80); - result.push((c & 0x3f) | 0x80); - } - } - return new Uint8Array(result); -} -exports.toUtf8Bytes = toUtf8Bytes; -//export -function _toUtf8String(codePoints) { - return codePoints - .map((codePoint) => { - if (codePoint <= 0xffff) { - return String.fromCharCode(codePoint); - } - codePoint -= 0x10000; - return String.fromCharCode(((codePoint >> 10) & 0x3ff) + 0xd800, (codePoint & 0x3ff) + 0xdc00); - }) - .join(""); -} -/** - * Returns the string represented by the UTF-8 data %%bytes%%. - * - * When %%onError%% function is specified, it is called on UTF-8 - * errors allowing recovery using the [[Utf8ErrorFunc]] API. - * (default: [error](Utf8ErrorFuncs)) - */ -function toUtf8String(bytes, onError) { - return _toUtf8String(getUtf8CodePoints(bytes, onError)); -} -exports.toUtf8String = toUtf8String; -/** - * Returns the UTF-8 code-points for %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ -function toUtf8CodePoints(str, form) { - return getUtf8CodePoints(toUtf8Bytes(str, form)); -} -exports.toUtf8CodePoints = toUtf8CodePoints; -//# sourceMappingURL=utf8.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/utf8.js.map b/lib.commonjs/utils/utf8.js.map deleted file mode 100644 index 2a9697302..000000000 --- a/lib.commonjs/utils/utf8.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utf8.js","sourceRoot":"","sources":["../../src.ts/utils/utf8.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,uCAAqC;AACrC,2CAA8D;AAgF9D,SAAS,SAAS,CAChB,MAAuB,EACvB,MAAc,EACd,KAAiB,EACjB,MAAqB,EACrB,YAAqB;IAErB,IAAA,0BAAc,EACZ,KAAK,EACL,+BAA+B,MAAM,KAAK,MAAM,EAAE,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AA3CD,kCA2CC;AAED,QAAQ;AACR,SAAS,aAAa,CAAC,UAAyB;IAC9C,OAAO,UAAU;SACd,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QACjB,IAAI,SAAS,IAAI,MAAM,EAAE;YACvB,OAAO,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;SACvC;QACD,SAAS,IAAI,OAAO,CAAC;QACrB,OAAO,MAAM,CAAC,YAAY,CACxB,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,GAAG,MAAM,EACpC,CAAC,SAAS,GAAG,KAAK,CAAC,GAAG,MAAM,CAC7B,CAAC;IACJ,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,YAAY,CAC1B,KAAgB,EAChB,OAAuB;IAEvB,OAAO,aAAa,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAC1D,CAAC;AALD,oCAKC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAC9B,GAAW,EACX,IAA+B;IAE/B,OAAO,iBAAiB,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACnD,CAAC;AALD,4CAKC"} \ No newline at end of file diff --git a/lib.commonjs/utils/uuid.d.ts b/lib.commonjs/utils/uuid.d.ts deleted file mode 100644 index 7b7465157..000000000 --- a/lib.commonjs/utils/uuid.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { BytesLike } from "./index.js"; -/** - * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. - * - * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) - */ -export declare function uuidV4(randomBytes: BytesLike): string; -//# sourceMappingURL=uuid.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/utils/uuid.d.ts.map b/lib.commonjs/utils/uuid.d.ts.map deleted file mode 100644 index f3cf307c6..000000000 --- a/lib.commonjs/utils/uuid.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src.ts/utils/uuid.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAqBrD"} \ No newline at end of file diff --git a/lib.commonjs/utils/uuid.js b/lib.commonjs/utils/uuid.js deleted file mode 100644 index b02f3b6cd..000000000 --- a/lib.commonjs/utils/uuid.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.uuidV4 = void 0; -/** - * Explain UUID and link to RFC here. - * - * @_subsection: api/utils:UUID [about-uuid] - */ -const data_js_1 = require("./data.js"); -/** - * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. - * - * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) - */ -function uuidV4(randomBytes) { - const bytes = (0, data_js_1.getBytes)(randomBytes, "randomBytes"); - // Section: 4.1.3: - // - time_hi_and_version[12:16] = 0b0100 - bytes[6] = (bytes[6] & 0x0f) | 0x40; - // Section 4.4 - // - clock_seq_hi_and_reserved[6] = 0b0 - // - clock_seq_hi_and_reserved[7] = 0b1 - bytes[8] = (bytes[8] & 0x3f) | 0x80; - const value = (0, data_js_1.hexlify)(bytes); - return [ - value.substring(2, 10), - value.substring(10, 14), - value.substring(14, 18), - value.substring(18, 22), - value.substring(22, 34), - ].join("-"); -} -exports.uuidV4 = uuidV4; -//# sourceMappingURL=uuid.js.map \ No newline at end of file diff --git a/lib.commonjs/utils/uuid.js.map b/lib.commonjs/utils/uuid.js.map deleted file mode 100644 index 5d654455a..000000000 --- a/lib.commonjs/utils/uuid.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../src.ts/utils/uuid.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,uCAA8C;AAI9C;;;;GAIG;AACH,SAAgB,MAAM,CAAC,WAAsB;IAC3C,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAEnD,kBAAkB;IAClB,wCAAwC;IACxC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEpC,cAAc;IACd,uCAAuC;IACvC,uCAAuC;IACvC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEpC,MAAM,KAAK,GAAG,IAAA,iBAAO,EAAC,KAAK,CAAC,CAAC;IAE7B,OAAO;QACL,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC;QACtB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;KACxB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;AArBD,wBAqBC"} \ No newline at end of file diff --git a/lib.commonjs/wallet/base-wallet.d.ts b/lib.commonjs/wallet/base-wallet.d.ts deleted file mode 100644 index a788c67b2..000000000 --- a/lib.commonjs/wallet/base-wallet.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { AbstractSigner } from "../providers/index.js"; -import { SigningKey } from "../crypto/index.js"; -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { Provider, TransactionRequest } from "../providers/index.js"; -/** - * The **BaseWallet** is a stream-lined implementation of a - * [[Signer]] that operates with a private key. - * - * It is preferred to use the [[Wallet]] class, as it offers - * additional functionality and simplifies loading a variety - * of JSON formats, Mnemonic Phrases, etc. - * - * This class may be of use for those attempting to implement - * a minimal Signer. - */ -export declare class BaseWallet extends AbstractSigner { - #private; - /** - * The wallet address. - */ - readonly address: string; - readonly prefix: string; - /** - * Creates a new BaseWallet for %%privateKey%%, optionally - * connected to %%provider%%. - * - * If %%provider%% is not specified, only offline methods can - * be used. - */ - constructor({ signingKey, prefix, provider, }: { - signingKey: SigningKey; - prefix: string; - provider?: null | Provider; - }); - /** - * The [[SigningKey]] used for signing payloads. - */ - get signingKey(): SigningKey; - /** - * The private key for this wallet. - */ - get privateKey(): string; - getAddress(): Promise; - connect(provider: null | Provider): BaseWallet; - signTransaction(tx: TransactionRequest): Promise; - signMessage(message: string | Uint8Array): Promise; - /** - * Returns the signature for %%message%% signed with this wallet. - */ - signMessageSync(message: string | Uint8Array): string; - signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -//# sourceMappingURL=base-wallet.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wallet/base-wallet.d.ts.map b/lib.commonjs/wallet/base-wallet.d.ts.map deleted file mode 100644 index dc25c591a..000000000 --- a/lib.commonjs/wallet/base-wallet.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base-wallet.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/base-wallet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AASvD,OAAO,EAAU,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG1E;;;;;;;;;;GAUG;AACH,qBAAa,UAAW,SAAQ,cAAc;;IAC5C;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAIxB;;;;;;OAMG;gBACS,EACV,UAAU,EACV,MAAM,EACN,QAAQ,GACT,EAAE;QACD,UAAU,EAAE,UAAU,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,CAAC;KAC5B;IAmBD;;OAEG;IACH,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAEK,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,UAAU;IAQxC,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgCxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAMhE;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM;IAI/C,aAAa,CACjB,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC;CAiCnB"} \ No newline at end of file diff --git a/lib.commonjs/wallet/base-wallet.js b/lib.commonjs/wallet/base-wallet.js deleted file mode 100644 index 04918dc0b..000000000 --- a/lib.commonjs/wallet/base-wallet.js +++ /dev/null @@ -1,121 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BaseWallet = void 0; -const index_js_1 = require("../address/index.js"); -const index_js_2 = require("../hash/index.js"); -const index_js_3 = require("../providers/index.js"); -const index_js_4 = require("../transaction/index.js"); -const index_js_5 = require("../utils/index.js"); -const index_js_6 = require("../crypto/index.js"); -/** - * The **BaseWallet** is a stream-lined implementation of a - * [[Signer]] that operates with a private key. - * - * It is preferred to use the [[Wallet]] class, as it offers - * additional functionality and simplifies loading a variety - * of JSON formats, Mnemonic Phrases, etc. - * - * This class may be of use for those attempting to implement - * a minimal Signer. - */ -class BaseWallet extends index_js_3.AbstractSigner { - /** - * The wallet address. - */ - address; - prefix; - #signingKey; - /** - * Creates a new BaseWallet for %%privateKey%%, optionally - * connected to %%provider%%. - * - * If %%provider%% is not specified, only offline methods can - * be used. - */ - constructor({ signingKey, prefix, provider, }) { - super(provider); - this.prefix = prefix; - (0, index_js_5.assertArgument)(signingKey && typeof signingKey.sign === "function", "invalid signingKey key", "signingKey", "[ REDACTED ]"); - this.#signingKey = signingKey; - const address = (0, index_js_4.computeAddress)(this.#signingKey, prefix); - (0, index_js_5.defineProperties)(this, { address }); - } - // Store private values behind getters to reduce visibility - // in console.log - /** - * The [[SigningKey]] used for signing payloads. - */ - get signingKey() { - return this.#signingKey; - } - /** - * The private key for this wallet. - */ - get privateKey() { - return this.signingKey.privateKey; - } - async getAddress() { - return this.address; - } - connect(provider) { - return new BaseWallet({ - signingKey: this.#signingKey, - prefix: this.prefix, - provider, - }); - } - async signTransaction(tx) { - // Replace any Addressable or ENS name with an address - const { to, from } = await (0, index_js_5.resolveProperties)({ - to: tx.to || undefined, - from: tx.from || undefined, - }); - if (to != null) { - tx.to = to; - } - if (from != null) { - tx.from = from; - } - if (tx.from != null) { - (0, index_js_5.assertArgument)((0, index_js_1.getAddress)(tx.from) === this.address, "transaction from address mismatch", "tx.from", tx.from); - delete tx.from; - } - // Build the transaction - const btx = index_js_4.Transaction.from(tx); - const unSignedSerialized = btx.unsignedSerialized; - const unsignedHash = (0, index_js_6.sha256)(unSignedSerialized); - // sha256(btx.unsignedSerialized) - btx.signature = this.signingKey.sign(unsignedHash); - return btx.serialized; - } - async signMessage(message) { - return this.signMessageSync(message); - } - // @TODO: Add a secialized signTx and signTyped sync that enforces - // all parameters are known? - /** - * Returns the signature for %%message%% signed with this wallet. - */ - signMessageSync(message) { - return this.signingKey.sign((0, index_js_2.hashMessage)(message)); - } - async signTypedData(domain, types, value) { - // Populate any ENS names - const populated = await index_js_2.TypedDataEncoder.resolveNames(domain, types, value, async (name) => { - // @TODO: this should use resolveName; addresses don't - // need a provider - (0, index_js_5.assert)(this.provider != null, "cannot resolve ENS names without a provider", "UNSUPPORTED_OPERATION", { - operation: "resolveName", - info: { name }, - }); - const address = (0, index_js_1.getAddress)(name); - (0, index_js_5.assert)(address != null, "unconfigured ENS name", "UNCONFIGURED_NAME", { - value: name, - }); - return address; - }); - return this.signingKey.sign(index_js_2.TypedDataEncoder.hash(populated.domain, types, populated.value)); - } -} -exports.BaseWallet = BaseWallet; -//# sourceMappingURL=base-wallet.js.map \ No newline at end of file diff --git a/lib.commonjs/wallet/base-wallet.js.map b/lib.commonjs/wallet/base-wallet.js.map deleted file mode 100644 index c148eff0e..000000000 --- a/lib.commonjs/wallet/base-wallet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base-wallet.js","sourceRoot":"","sources":["../../src.ts/wallet/base-wallet.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AACjD,+CAAiE;AACjE,oDAAuD;AACvD,sDAAsE;AACtE,gDAK2B;AAE3B,iDAAwD;AAKxD;;;;;;;;;;GAUG;AACH,MAAa,UAAW,SAAQ,yBAAc;IAC5C;;OAEG;IACM,OAAO,CAAU;IACjB,MAAM,CAAS;IAEf,WAAW,CAAa;IAEjC;;;;;;OAMG;IACH,YAAY,EACV,UAAU,EACV,MAAM,EACN,QAAQ,GAKT;QACC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAA,yBAAc,EACZ,UAAU,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,UAAU,EACnD,wBAAwB,EACxB,YAAY,EACZ,cAAc,CACf,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,MAAM,OAAO,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,WAAW,EAAE,MA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CAAC,IAAI,CACzB,2BAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAChE,CAAC;IACJ,CAAC;CACF;AAvJD,gCAuJC"} \ No newline at end of file diff --git a/lib.commonjs/wallet/english_words.d.ts b/lib.commonjs/wallet/english_words.d.ts deleted file mode 100644 index fec60c704..000000000 --- a/lib.commonjs/wallet/english_words.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const englishWords = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; -//# sourceMappingURL=english_words.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wallet/english_words.d.ts.map b/lib.commonjs/wallet/english_words.d.ts.map deleted file mode 100644 index 15a3e8323..000000000 --- a/lib.commonjs/wallet/english_words.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"english_words.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/english_words.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,i0VACuyV,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/wallet/english_words.js b/lib.commonjs/wallet/english_words.js deleted file mode 100644 index 0b1a3d3f9..000000000 --- a/lib.commonjs/wallet/english_words.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.englishWords = void 0; -exports.englishWords = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; -//# sourceMappingURL=english_words.js.map \ No newline at end of file diff --git a/lib.commonjs/wallet/english_words.js.map b/lib.commonjs/wallet/english_words.js.map deleted file mode 100644 index c6e825f0f..000000000 --- a/lib.commonjs/wallet/english_words.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"english_words.js","sourceRoot":"","sources":["../../src.ts/wallet/english_words.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GACvB,8zVAA8zV,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/wallet/hdwallet.d.ts b/lib.commonjs/wallet/hdwallet.d.ts deleted file mode 100644 index 7c96fb8a0..000000000 --- a/lib.commonjs/wallet/hdwallet.d.ts +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Explain HD Wallets.. - * - * @_subsection: api/wallet:HD Wallets [hd-wallets] - */ -import { SigningKey } from "../crypto/index.js"; -import { BaseWallet } from "./base-wallet.js"; -import { Mnemonic } from "./mnemonic.js"; -import type { ProgressCallback } from "../crypto/index.js"; -import type { Provider } from "../providers/index.js"; -import type { Numeric } from "../utils/index.js"; -import type { Wordlist } from "../wordlists/index.js"; -/** - * The default derivation path for Core HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) - */ -export declare const defaultPath: string; -/** - * An **HDNodeWallet** is a [[Signer]] backed by the private key derived - * from an HD Node using the [[link-bip-32]] stantard. - * - * An HD Node forms a hierarchal structure with each HD Node having a - * private key and the ability to derive child HD Nodes, defined by - * a path indicating the index of each child. - */ -export declare class HDNodeWallet extends BaseWallet { - #private; - /** - * The compressed public key. - */ - readonly publicKey: string; - prefix: string; - /** - * The fingerprint. - * - * A fingerprint allows quick qay to detect parent and child nodes, - * but developers should be prepared to deal with collisions as it - * is only 4 bytes. - */ - readonly fingerprint: string; - /** - * The parent fingerprint. - */ - readonly parentFingerprint: string; - /** - * The mnemonic used to create this HD Node, if available. - * - * Sources such as extended keys do not encode the mnemonic, in - * which case this will be ``null``. - */ - readonly mnemonic: null | Mnemonic; - /** - * The derivation path of this wallet. - * - * Since extended keys do not provider full path details, this - * may be ``null``, if instantiated from a source that does not - * enocde it. - */ - readonly path: null | string; - /** - * The child index of this wallet. Values over ``2 *\* 31`` indicate - * the node is hardened. - */ - readonly index: number; - /** - * The depth of this wallet, which is the number of components - * in its path. - */ - readonly depth: number; - /** - * @private - */ - constructor({ guard, seed, signingKey, parentFingerprint, path, index, depth, mnemonic, provider, prefix, }: { - guard: any; - seed: string; - signingKey: SigningKey; - parentFingerprint: string; - path: null | string; - index: number; - depth: number; - mnemonic: null | Mnemonic; - provider: null | Provider; - prefix: string; - }); - connect(provider: null | Provider): HDNodeWallet; - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise; - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password: Uint8Array | string): string; - /** - * Returns true if this wallet has a path, providing a Type Guard - * that the path is non-null. - */ - hasPath(): this is { - path: string; - }; - /** - * Return the child for %%index%%. - */ - deriveChild(_index: number): HDNodeWallet; - /** - * Return the HDNode for %%path%% from this node. - */ - derivePath(path: string): HDNodeWallet; - /** - * Creates a new random HDNode. - */ - static createRandom(prefix: string, password?: string, path?: string, wordlist?: Wordlist): HDNodeWallet; - /** - * Create am HD Node from %%mnemonic%%. - */ - static fromMnemonic(mnemonic: Mnemonic, prefix: string, path?: string): HDNodeWallet; - static mnemonicToSeed(mnemonic: string, password?: string): string; - /** - * Creates an HD Node from a mnemonic %%phrase%%. - */ - static fromPhrase({ phrase, prefix, password, path, wordlist, }: { - phrase: string; - prefix: string; - password?: string; - path?: string; - wordlist?: Wordlist; - }): HDNodeWallet; - /** - * Creates an HD Node from a %%seed%%. - */ - static fromSeed({ seed, prefix, path, }: { - seed: string; - prefix: string; - path?: string; - }): HDNodeWallet; -} -/** - * Returns the [[link-bip-32]] path for the acount at %%index%%. - * - * This is the pattern used by wallets like Ledger. - * - * There is also an [alternate pattern](getIndexedAccountPath) used by - * some software. - */ -export declare function getAccountPath(_index: Numeric): string; -/** - * Returns the path using an alternative pattern for deriving accounts, - * at %%index%%. - * - * This derivation path uses the //index// component rather than the - * //account// component to derive sequential accounts. - * - * This is the pattern used by wallets like MetaMask. - */ -export declare function getIndexedAccountPath(_index: Numeric): string; -//# sourceMappingURL=hdwallet.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wallet/hdwallet.d.ts.map b/lib.commonjs/wallet/hdwallet.d.ts.map deleted file mode 100644 index cc249d4de..000000000 --- a/lib.commonjs/wallet/hdwallet.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hdwallet.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/hdwallet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAA0B,UAAU,EAAU,MAAM,oBAAoB,CAAC;AAUhF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAMzC,OAAO,KAAK,EAAE,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H,MAAM,CAAC,QAAQ,CAAC,EACd,IAAI,EACJ,MAAM,EACN,IAAI,GACL,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,YAAY;CAQjB;AAmBD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAStD;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAS7D"} \ No newline at end of file diff --git a/lib.commonjs/wallet/hdwallet.js b/lib.commonjs/wallet/hdwallet.js deleted file mode 100644 index 4d09e8a58..000000000 --- a/lib.commonjs/wallet/hdwallet.js +++ /dev/null @@ -1,372 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getIndexedAccountPath = exports.getAccountPath = exports.HDNodeWallet = exports.defaultPath = void 0; -/** - * Explain HD Wallets.. - * - * @_subsection: api/wallet:HD Wallets [hd-wallets] - */ -const index_js_1 = require("../crypto/index.js"); -const index_js_2 = require("../utils/index.js"); -const lang_en_js_1 = require("../wordlists/lang-en.js"); -const base_wallet_js_1 = require("./base-wallet.js"); -const mnemonic_js_1 = require("./mnemonic.js"); -const json_keystore_js_1 = require("./json-keystore.js"); -const crypto_js_1 = require("../crypto/crypto.js"); -const mnemonicToSeed_js_1 = require("./mnemonicToSeed.js"); -// import { arrayify, -// // hexDataSlice -// } from "../utils/data.js"; -// function sha512Hash(password: BytesLike, salt: BytesLike): Uint8Array { -// const p = getBytes(password); -// const s = getBytes(salt); -// return getBytes(pbkdf2(p, s, 2048, 57, "sha512")); -// } -/** - * The default derivation path for Core HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) - */ -exports.defaultPath = "m"; -// "Bitcoin seed" -// const MasterSecret = new Uint8Array([66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100]); -const HardenedBit = 0x80000000; -// function addScalar(a: Uint8Array, b: Uint8Array): Uint8Array { -// b = getBytes(concat([b.slice(0, 53), "0x00000000"])); -// b[0] &= 0xfc; -// const c = new Uint8Array(57); -// let hold = 0; -// for (let i = 0; i < 57; i++) { -// hold += a[i] + b[i]; -// c[i] = hold % 256; -// hold = Math.floor(hold / 256); -// } -// return c; -// }; -const _guard = {}; -function derivePath(node, path) { - const components = path.split("/"); - (0, index_js_2.assertArgument)(components.length > 0 && (components[0] === "m" || node.depth > 0), "invalid path", "path", path); - if (components[0] === "m") { - components.shift(); - } - let result = node; - for (let i = 0; i < components.length; i++) { - const component = components[i]; - if (component.match(/^[0-9]+'$/)) { - const index = parseInt(component.substring(0, component.length - 1)); - (0, index_js_2.assertArgument)(index < HardenedBit, "invalid path index", `path[${i}]`, component); - result = result.deriveChild(HardenedBit + index); - } - else if (component.match(/^[0-9]+$/)) { - const index = parseInt(component); - (0, index_js_2.assertArgument)(index < HardenedBit, "invalid path index", `path[${i}]`, component); - result = result.deriveChild(index); - } - else { - (0, index_js_2.assertArgument)(false, "invalid path component", `path[${i}]`, component); - } - } - return result; -} -/** - * An **HDNodeWallet** is a [[Signer]] backed by the private key derived - * from an HD Node using the [[link-bip-32]] stantard. - * - * An HD Node forms a hierarchal structure with each HD Node having a - * private key and the ability to derive child HD Nodes, defined by - * a path indicating the index of each child. - */ -class HDNodeWallet extends base_wallet_js_1.BaseWallet { - /** - * The compressed public key. - */ - publicKey; - prefix; - /** - * The fingerprint. - * - * A fingerprint allows quick qay to detect parent and child nodes, - * but developers should be prepared to deal with collisions as it - * is only 4 bytes. - */ - fingerprint; - /** - * The parent fingerprint. - */ - parentFingerprint; - /** - * The mnemonic used to create this HD Node, if available. - * - * Sources such as extended keys do not encode the mnemonic, in - * which case this will be ``null``. - */ - mnemonic; - #seed; - /** - * The derivation path of this wallet. - * - * Since extended keys do not provider full path details, this - * may be ``null``, if instantiated from a source that does not - * enocde it. - */ - path; - /** - * The child index of this wallet. Values over ``2 *\* 31`` indicate - * the node is hardened. - */ - index; - /** - * The depth of this wallet, which is the number of components - * in its path. - */ - depth; - /** - * @private - */ - constructor({ guard, seed, signingKey, parentFingerprint, path, index, depth, mnemonic, provider, prefix, }) { - super({ - signingKey, - prefix, - provider, - }); - (0, index_js_2.assertPrivate)(guard, _guard, "HDNodeWallet"); - (0, index_js_2.defineProperties)(this, { publicKey: signingKey.publicKey }); - this.prefix = prefix; - this.#seed = seed; - const fingerprint = (0, index_js_2.dataSlice)((0, index_js_1.ripemd160)((0, index_js_1.sha256)(this.publicKey)), 0, 4); - (0, index_js_2.defineProperties)(this, { - parentFingerprint, - fingerprint, - path, - index, - depth, - }); - (0, index_js_2.defineProperties)(this, { mnemonic }); - } - connect(provider) { - return new HDNodeWallet({ - guard: _guard, - signingKey: this.signingKey, - parentFingerprint: this.parentFingerprint, - path: this.path, - index: this.index, - depth: this.depth, - seed: this.#seed, - mnemonic: this.mnemonic, - provider, - prefix: this.prefix, - }); - } - #account() { - const account = { - address: this.address, - privateKey: this.privateKey, - }; - const m = this.mnemonic; - if (this.path && m && m.wordlist.locale === "en" && m.password === "") { - account.mnemonic = { - path: this.path, - locale: "en", - entropy: m.entropy, - }; - } - return account; - } - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - async encrypt(password, progressCallback) { - return await (0, json_keystore_js_1.encryptKeystoreJson)(this.#account(), password, { - progressCallback, - }); - } - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password) { - return (0, json_keystore_js_1.encryptKeystoreJsonSync)(this.#account(), password); - } - /** - * Returns true if this wallet has a path, providing a Type Guard - * that the path is non-null. - */ - hasPath() { - return this.path != null; - } - /** - * Return the child for %%index%%. - */ - deriveChild(_index) { - const newPrivateKey = crypto_js_1.Ed448Goldilock.HDWalletGenerateKeyFromSeed(this.#seed, Number(_index)); - const newSigningKey = new index_js_1.SigningKey(newPrivateKey); - // Base path - let path = this.path; - if (path) { - path += "/" + (_index & ~HardenedBit); - if (_index & HardenedBit) { - path += "'"; - } - } - return new HDNodeWallet({ - guard: _guard, - signingKey: newSigningKey, - parentFingerprint: this.fingerprint, - path, - index: _index, - seed: this.#seed, - depth: this.depth + 1, - mnemonic: this.mnemonic, - provider: this.provider, - prefix: this.prefix, - }); - } - /** - * Return the HDNode for %%path%% from this node. - */ - derivePath(path) { - return derivePath(this, path); - } - static #fromSeed({ _seed, mnemonic, prefix, path, }) { - const extendetPrivateKey = crypto_js_1.Ed448Goldilock.HDWalletGenerateKeyFromSeed(_seed, 0); - const signingKey = new index_js_1.SigningKey(extendetPrivateKey); - // console.log({ privateKey, thisKey: signingKey.privateKey,len:tmp.privateKey.length }) - return new HDNodeWallet({ - seed: _seed, - guard: _guard, - signingKey, - parentFingerprint: "0x00000000", - path: path || exports.defaultPath, - index: 0, - depth: 0, - mnemonic, - provider: null, - prefix, - }); - } - /** - * Creates a new random HDNode. - */ - static createRandom(prefix, password, path, wordlist) { - if (password == null) { - password = ""; - } - if (path == null) { - path = exports.defaultPath; - } - if (wordlist == null) { - wordlist = lang_en_js_1.LangEn.wordlist(); - } - const mnemonic = mnemonic_js_1.Mnemonic.fromEntropy((0, index_js_1.randomBytes)(32), password, wordlist); - return HDNodeWallet.#fromSeed({ - _seed: mnemonic.computeSeed(), - mnemonic, - prefix, - }).derivePath(path); - } - /** - * Create am HD Node from %%mnemonic%%. - */ - static fromMnemonic(mnemonic, prefix, path) { - if (!path) { - path = exports.defaultPath; - } - return HDNodeWallet.#fromSeed({ - _seed: mnemonic.computeSeed(), - mnemonic, - prefix, - }).derivePath(path); - } - static mnemonicToSeed(mnemonic, password) { - const seed = (0, mnemonicToSeed_js_1.mnemonicToSeed)(mnemonic, password); - return seed; - } - /** - * Creates an HD Node from a mnemonic %%phrase%%. - */ - static fromPhrase({ phrase, prefix, password, path, wordlist, }) { - if (!password) { - password = ""; - } - if (!path) { - path = exports.defaultPath; - } - if (!wordlist) { - wordlist = lang_en_js_1.LangEn.wordlist(); - } - const mnemonic = mnemonic_js_1.Mnemonic.fromPhrase({ phrase, password, wordlist }); - const _seed = mnemonic.computeSeed(); - return HDNodeWallet.#fromSeed({ - _seed, - mnemonic, - prefix, - }).derivePath(path); - } - /** - * Creates an HD Node from a %%seed%%. - */ - static fromSeed({ seed, prefix, path, }) { - return HDNodeWallet.#fromSeed({ - _seed: seed, - mnemonic: null, - path: path || exports.defaultPath, - prefix, - }); - } -} -exports.HDNodeWallet = HDNodeWallet; -/* -export class HDNodeWalletManager { - #root: HDNodeWallet; - - constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) { - if (password == null) { password = ""; } - if (path == null) { path = "m/44'/60'/0'/0"; } - if (locale == null) { locale = LangEn.wordlist(); } - this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale); - } - - getSigner(index?: number): HDNodeWallet { - return this.#root.deriveChild((index == null) ? 0: index); - } -} -*/ -/** - * Returns the [[link-bip-32]] path for the acount at %%index%%. - * - * This is the pattern used by wallets like Ledger. - * - * There is also an [alternate pattern](getIndexedAccountPath) used by - * some software. - */ -function getAccountPath(_index) { - const index = (0, index_js_2.getNumber)(_index, "index"); - (0, index_js_2.assertArgument)(index >= 0 && index < HardenedBit, "invalid account index", "index", index); - return `m/44'/60'/${index}'/0/0`; -} -exports.getAccountPath = getAccountPath; -/** - * Returns the path using an alternative pattern for deriving accounts, - * at %%index%%. - * - * This derivation path uses the //index// component rather than the - * //account// component to derive sequential accounts. - * - * This is the pattern used by wallets like MetaMask. - */ -function getIndexedAccountPath(_index) { - const index = (0, index_js_2.getNumber)(_index, "index"); - (0, index_js_2.assertArgument)(index >= 0 && index < HardenedBit, "invalid account index", "index", index); - return `m/44'/60'/0'/0/${index}`; -} -exports.getIndexedAccountPath = getIndexedAccountPath; -//# sourceMappingURL=hdwallet.js.map \ No newline at end of file diff --git a/lib.commonjs/wallet/hdwallet.js.map b/lib.commonjs/wallet/hdwallet.js.map deleted file mode 100644 index a607be3b9..000000000 --- a/lib.commonjs/wallet/hdwallet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hdwallet.js","sourceRoot":"","sources":["../../src.ts/wallet/hdwallet.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,iDAAgF;AAChF,gDAM2B;AAC3B,wDAAiD;AAEjD,qDAA8C;AAC9C,+CAAyC;AACzC,yDAG4B;AAQ5B,mDAAqD;AACrD,2DAAqD;AACrD,qBAAqB;AACrB,uBAAuB;AACvB,kCAAkC;AAElC,0EAA0E;AAC1E,oCAAoC;AACpC,gCAAgC;AAChC,yDAAyD;AACzD,IAAI;AAEJ;;GAEG;AACU,QAAA,WAAW,GAAW,GAAG,CAAC;AAEvC,iBAAiB;AACjB,kGAAkG;AAElG,MAAM,WAAW,GAAG,UAAU,CAAC;AAE/B,iEAAiE;AACjE,4DAA4D;AAC5D,oBAAoB;AAEpB,oCAAoC;AACpC,oBAAoB;AACpB,qCAAqC;AACrC,+BAA+B;AAC/B,6BAA6B;AAC7B,yCAAyC;AACzC,QAAQ;AACR,gBAAgB;AAChB,KAAK;AAEL,MAAM,MAAM,GAAG,EAAE,CAAC;AAgBlB,SAAS,UAAU,CAA0B,IAAO,EAAE,IAAY;IAChE,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEnC,IAAA,yBAAc,EACZ,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,EAClE,cAAc,EACd,MAAM,EACN,IAAI,CACL,CAAC;IAEF,IAAI,UAAU,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACzB,UAAU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CAAC;IACF,OAAO,kBAAkB,KAAK,EAAE,CAAC;AACnC,CAAC;AATD,sDASC"} \ No newline at end of file diff --git a/lib.commonjs/wallet/index.d.ts b/lib.commonjs/wallet/index.d.ts deleted file mode 100644 index d3db8f37c..000000000 --- a/lib.commonjs/wallet/index.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * When interacting with Core, it is necessary to use a private - * key authenticate actions by signing a payload. - * - * Wallets are the simplest way to expose the concept of an - * //Externally Owner Account// (EOA) as it wraps a private key - * and supports high-level methods to sign common types of interaction - * and send transactions. - * - * The class most developers will want to use is [[Wallet]], which - * can load a private key directly or from any common wallet format. - * - * The [[HDNodeWallet]] can be used when it is necessary to access - * low-level details of how an HD wallets are derived, exported - * or imported. - * - * @_section: api/wallet:Wallets [about-wallets] - */ -export { BaseWallet } from "./base-wallet.js"; -export { defaultPath, getAccountPath, getIndexedAccountPath, HDNodeWallet, } from "./hdwallet.js"; -export { isCrowdsaleJson, decryptCrowdsaleJson } from "./json-crowdsale.js"; -export { isKeystoreJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./json-keystore.js"; -export { Mnemonic } from "./mnemonic.js"; -export { Wallet } from "./wallet.js"; -export type { CrowdsaleAccount } from "./json-crowdsale.js"; -export type { KeystoreAccount, EncryptOptions } from "./json-keystore.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wallet/index.d.ts.map b/lib.commonjs/wallet/index.d.ts.map deleted file mode 100644 index fc93212da..000000000 --- a/lib.commonjs/wallet/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACL,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/wallet/index.js b/lib.commonjs/wallet/index.js deleted file mode 100644 index e7f068639..000000000 --- a/lib.commonjs/wallet/index.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -/** - * When interacting with Core, it is necessary to use a private - * key authenticate actions by signing a payload. - * - * Wallets are the simplest way to expose the concept of an - * //Externally Owner Account// (EOA) as it wraps a private key - * and supports high-level methods to sign common types of interaction - * and send transactions. - * - * The class most developers will want to use is [[Wallet]], which - * can load a private key directly or from any common wallet format. - * - * The [[HDNodeWallet]] can be used when it is necessary to access - * low-level details of how an HD wallets are derived, exported - * or imported. - * - * @_section: api/wallet:Wallets [about-wallets] - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Wallet = exports.Mnemonic = exports.encryptKeystoreJsonSync = exports.encryptKeystoreJson = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.isKeystoreJson = exports.decryptCrowdsaleJson = exports.isCrowdsaleJson = exports.HDNodeWallet = exports.getIndexedAccountPath = exports.getAccountPath = exports.defaultPath = exports.BaseWallet = void 0; -var base_wallet_js_1 = require("./base-wallet.js"); -Object.defineProperty(exports, "BaseWallet", { enumerable: true, get: function () { return base_wallet_js_1.BaseWallet; } }); -var hdwallet_js_1 = require("./hdwallet.js"); -Object.defineProperty(exports, "defaultPath", { enumerable: true, get: function () { return hdwallet_js_1.defaultPath; } }); -Object.defineProperty(exports, "getAccountPath", { enumerable: true, get: function () { return hdwallet_js_1.getAccountPath; } }); -Object.defineProperty(exports, "getIndexedAccountPath", { enumerable: true, get: function () { return hdwallet_js_1.getIndexedAccountPath; } }); -Object.defineProperty(exports, "HDNodeWallet", { enumerable: true, get: function () { return hdwallet_js_1.HDNodeWallet; } }); -var json_crowdsale_js_1 = require("./json-crowdsale.js"); -Object.defineProperty(exports, "isCrowdsaleJson", { enumerable: true, get: function () { return json_crowdsale_js_1.isCrowdsaleJson; } }); -Object.defineProperty(exports, "decryptCrowdsaleJson", { enumerable: true, get: function () { return json_crowdsale_js_1.decryptCrowdsaleJson; } }); -var json_keystore_js_1 = require("./json-keystore.js"); -Object.defineProperty(exports, "isKeystoreJson", { enumerable: true, get: function () { return json_keystore_js_1.isKeystoreJson; } }); -Object.defineProperty(exports, "decryptKeystoreJsonSync", { enumerable: true, get: function () { return json_keystore_js_1.decryptKeystoreJsonSync; } }); -Object.defineProperty(exports, "decryptKeystoreJson", { enumerable: true, get: function () { return json_keystore_js_1.decryptKeystoreJson; } }); -Object.defineProperty(exports, "encryptKeystoreJson", { enumerable: true, get: function () { return json_keystore_js_1.encryptKeystoreJson; } }); -Object.defineProperty(exports, "encryptKeystoreJsonSync", { enumerable: true, get: function () { return json_keystore_js_1.encryptKeystoreJsonSync; } }); -var mnemonic_js_1 = require("./mnemonic.js"); -Object.defineProperty(exports, "Mnemonic", { enumerable: true, get: function () { return mnemonic_js_1.Mnemonic; } }); -var wallet_js_1 = require("./wallet.js"); -Object.defineProperty(exports, "Wallet", { enumerable: true, get: function () { return wallet_js_1.Wallet; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.commonjs/wallet/index.js.map b/lib.commonjs/wallet/index.js.map deleted file mode 100644 index 8985d9fbd..000000000 --- a/lib.commonjs/wallet/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/wallet/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AAEnB,6CAKuB;AAJrB,0GAAA,WAAW,OAAA;AACX,6GAAA,cAAc,OAAA;AACd,oHAAA,qBAAqB,OAAA;AACrB,2GAAA,YAAY,OAAA;AAGd,yDAA4E;AAAnE,oHAAA,eAAe,OAAA;AAAE,yHAAA,oBAAoB,OAAA;AAE9C,uDAM4B;AAL1B,kHAAA,cAAc,OAAA;AACd,2HAAA,uBAAuB,OAAA;AACvB,uHAAA,mBAAmB,OAAA;AACnB,uHAAA,mBAAmB,OAAA;AACnB,2HAAA,uBAAuB,OAAA;AAGzB,6CAAyC;AAAhC,uGAAA,QAAQ,OAAA;AAEjB,yCAAqC;AAA5B,mGAAA,MAAM,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/wallet/json-crowdsale.d.ts b/lib.commonjs/wallet/json-crowdsale.d.ts deleted file mode 100644 index 65b5f0251..000000000 --- a/lib.commonjs/wallet/json-crowdsale.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * The data stored within a JSON Crowdsale wallet is fairly - * minimal. - */ -export type CrowdsaleAccount = { - privateKey: string; - address: string; -}; -/** - * Returns true if %%json%% is a valid JSON Crowdsale wallet. - */ -export declare function isCrowdsaleJson(json: string): boolean; -/** - * Before Core launched, it was necessary to create a wallet - * format for backers to use, which would be used to receive xcb - * as a reward for contributing to the project. - * - * The [[link-crowdsale]] format is now obsolete, but it is still - * useful to support and the additional code is fairly trivial as - * all the primitives required are used through core portions of - * the library. - */ -export declare function decryptCrowdsaleJson(json: string, _password: string | Uint8Array): CrowdsaleAccount; -//# sourceMappingURL=json-crowdsale.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wallet/json-crowdsale.d.ts.map b/lib.commonjs/wallet/json-crowdsale.d.ts.map deleted file mode 100644 index 4514aef1b..000000000 --- a/lib.commonjs/wallet/json-crowdsale.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-crowdsale.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/json-crowdsale.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAAG,UAAU,GAC7B,gBAAgB,CAmClB"} \ No newline at end of file diff --git a/lib.commonjs/wallet/json-crowdsale.js b/lib.commonjs/wallet/json-crowdsale.js deleted file mode 100644 index e2e4004d1..000000000 --- a/lib.commonjs/wallet/json-crowdsale.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.decryptCrowdsaleJson = exports.isCrowdsaleJson = void 0; -const tslib_1 = require("tslib"); -/** - * @_subsection: api/wallet:JSON Wallets [json-wallets] - */ -// @ts-ignore -const aes_js_1 = tslib_1.__importDefault(require("aes-js")); -const { CBC, pkcs7Strip } = aes_js_1.default; -const index_js_1 = require("../address/index.js"); -const index_js_2 = require("../crypto/index.js"); -const index_js_3 = require("../hash/index.js"); -const index_js_4 = require("../utils/index.js"); -const utils_js_1 = require("./utils.js"); -/** - * Returns true if %%json%% is a valid JSON Crowdsale wallet. - */ -function isCrowdsaleJson(json) { - try { - const data = JSON.parse(json); - if (data.encseed) { - return true; - } - } - catch (error) { } - return false; -} -exports.isCrowdsaleJson = isCrowdsaleJson; -/** - * Before Core launched, it was necessary to create a wallet - * format for backers to use, which would be used to receive xcb - * as a reward for contributing to the project. - * - * The [[link-crowdsale]] format is now obsolete, but it is still - * useful to support and the additional code is fairly trivial as - * all the primitives required are used through core portions of - * the library. - */ -function decryptCrowdsaleJson(json, _password) { - const data = JSON.parse(json); - const password = (0, utils_js_1.getPassword)(_password); - // Core Address - const address = (0, index_js_1.getAddress)((0, utils_js_1.spelunk)(data, "ethaddr:string!")); - // Encrypted Seed - const encseed = (0, utils_js_1.looseArrayify)((0, utils_js_1.spelunk)(data, "encseed:string!")); - (0, index_js_4.assertArgument)(encseed && encseed.length % 16 === 0, "invalid encseed", "json", json); - const key = (0, index_js_4.getBytes)((0, index_js_2.pbkdf2)(password, password, 2000, 32, "sha256")).slice(0, 16); - const iv = encseed.slice(0, 16); - const encryptedSeed = encseed.slice(16); - // Decrypt the seed - const aesCbc = new CBC(key, iv); - const seed = pkcs7Strip((0, index_js_4.getBytes)(aesCbc.decrypt(encryptedSeed))); - // This wallet format is weird... Convert the binary encoded hex to a string. - let seedHex = ""; - for (let i = 0; i < seed.length; i++) { - seedHex += String.fromCharCode(seed[i]); - } - return { address, privateKey: (0, index_js_3.id)(seedHex) }; -} -exports.decryptCrowdsaleJson = decryptCrowdsaleJson; -//# sourceMappingURL=json-crowdsale.js.map \ No newline at end of file diff --git a/lib.commonjs/wallet/json-crowdsale.js.map b/lib.commonjs/wallet/json-crowdsale.js.map deleted file mode 100644 index a26951158..000000000 --- a/lib.commonjs/wallet/json-crowdsale.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-crowdsale.js","sourceRoot":"","sources":["../../src.ts/wallet/json-crowdsale.ts"],"names":[],"mappings":";;;;AAAA;;GAEG;AACH,aAAa;AACb,4DAAyB;AACzB,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,gBAAG,CAAC;AAChC,kDAAiD;AACjD,iDAA4C;AAC5C,+CAAsC;AACtC,gDAA6D;AAE7D,yCAAiE;AAWjE;;GAEG;AACH,SAAgB,eAAe,CAAC,IAAY;IAC1C,IAAI;QACF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9B,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C7E,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,OAAO,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KACzC;IAED,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAA,aAAE,EAAC,OAAO,CAAC,EAAE,CAAC;AAC9C,CAAC;AAtCD,oDAsCC"} \ No newline at end of file diff --git a/lib.commonjs/wallet/json-keystore.d.ts b/lib.commonjs/wallet/json-keystore.d.ts deleted file mode 100644 index 363fd7956..000000000 --- a/lib.commonjs/wallet/json-keystore.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -import type { ProgressCallback } from "../crypto/index.js"; -import type { BytesLike } from "../utils/index.js"; -/** - * The contents of a JSON Keystore Wallet. - */ -export type KeystoreAccount = { - address: string; - privateKey: string; - mnemonic?: { - path?: string; - locale?: string; - entropy: string; - }; -}; -/** - * The parameters to use when encrypting a JSON Keystore Wallet. - */ -export type EncryptOptions = { - progressCallback?: ProgressCallback; - iv?: BytesLike; - entropy?: BytesLike; - client?: string; - salt?: BytesLike; - uuid?: string; - scrypt?: { - N?: number; - r?: number; - p?: number; - }; -}; -/** - * Returns true if %%json%% is a valid JSON Keystore Wallet. - */ -export declare function isKeystoreJson(json: string): boolean; -/** - * Returns the account details for the JSON Keystore Wallet %%json%% - * using %%password%%. - * - * It is preferred to use the [async version](decryptKeystoreJson) - * instead, which allows a [[ProgressCallback]] to keep the user informed - * as to the decryption status. - * - * This method will block the event loop (freezing all UI) until decryption - * is complete, which can take quite some time, depending on the wallet - * paramters and platform. - */ -export declare function decryptKeystoreJsonSync(json: string, _password: string | Uint8Array): KeystoreAccount; -/** - * Resolves to the decrypted JSON Keystore Wallet %%json%% using the - * %%password%%. - * - * If provided, %%progress%% will be called periodically during the - * decrpytion to provide feedback, and if the function returns - * ``false`` will halt decryption. - * - * The %%progressCallback%% will **always** receive ``0`` before - * decryption begins and ``1`` when complete. - */ -export declare function decryptKeystoreJson(json: string, _password: string | Uint8Array, progress?: ProgressCallback): Promise; -/** - * Return the JSON Keystore Wallet for %%account%% encrypted with - * %%password%%. - * - * The %%options%% can be used to tune the password-based key - * derivation function parameters, explicitly set the random values - * used. Any provided [[ProgressCallback]] is ignord. - */ -export declare function encryptKeystoreJsonSync(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): string; -/** - * Resolved to the JSON Keystore Wallet for %%account%% encrypted - * with %%password%%. - * - * The %%options%% can be used to tune the password-based key - * derivation function parameters, explicitly set the random values - * used and provide a [[ProgressCallback]] to receive periodic updates - * on the completion status.. - */ -export declare function encryptKeystoreJson(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): Promise; -//# sourceMappingURL=json-keystore.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wallet/json-keystore.d.ts.map b/lib.commonjs/wallet/json-keystore.d.ts.map deleted file mode 100644 index a56cc644a..000000000 --- a/lib.commonjs/wallet/json-keystore.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-keystore.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/json-keystore.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAOnD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE;QACP,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CASpD;AA0ID;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAAG,UAAU,GAC7B,eAAe,CAmBjB;AAUD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAAG,UAAU,EAC9B,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,OAAO,CAAC,eAAe,CAAC,CA2B1B;AAkKD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,MAAM,GAAG,UAAU,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,MAAM,CASR;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,MAAM,GAAG,UAAU,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,CAiBjB"} \ No newline at end of file diff --git a/lib.commonjs/wallet/json-keystore.js b/lib.commonjs/wallet/json-keystore.js deleted file mode 100644 index f173c36fd..000000000 --- a/lib.commonjs/wallet/json-keystore.js +++ /dev/null @@ -1,325 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.encryptKeystoreJson = exports.encryptKeystoreJsonSync = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.isKeystoreJson = void 0; -const tslib_1 = require("tslib"); -/** - * The JSON Wallet formats allow a simple way to store the private - * keys needed in Core along with related information and allows - * for extensible forms of encryption. - * - * These utilities facilitate decrypting and encrypting the most common - * JSON Wallet formats. - * - * @_subsection: api/wallet:JSON Wallets [json-wallets] - */ -// @ts-ignore -const aes_js_1 = tslib_1.__importDefault(require("aes-js")); -const { CTR } = aes_js_1.default; -const index_js_1 = require("../address/index.js"); -const index_js_2 = require("../crypto/index.js"); -const index_js_3 = require("../utils/index.js"); -const utils_js_1 = require("./utils.js"); -const _version_js_1 = require("../_version.js"); -const address_js_1 = require("../transaction/address.js"); -const defaultPath = "m/44'/60'/0'/0/0"; -/** - * Returns true if %%json%% is a valid JSON Keystore Wallet. - */ -function isKeystoreJson(json) { - try { - const data = JSON.parse(json); - const version = data.version != null ? parseInt(data.version) : 0; - if (version === 3) { - return true; - } - } - catch (error) { } - return false; -} -exports.isKeystoreJson = isKeystoreJson; -function decrypt(data, key, ciphertext) { - const cipher = (0, utils_js_1.spelunk)(data, "crypto.cipher:string"); - if (cipher === "aes-128-ctr") { - const iv = (0, utils_js_1.spelunk)(data, "crypto.cipherparams.iv:data!"); - const aesCtr = new CTR(key, iv); - return (0, index_js_3.hexlify)(aesCtr.decrypt(ciphertext)); - } - (0, index_js_3.assert)(false, "unsupported cipher", "UNSUPPORTED_OPERATION", { - operation: "decrypt", - }); -} -function getAccount(data, _key) { - const key = (0, index_js_3.getBytes)(_key); - const ciphertext = (0, utils_js_1.spelunk)(data, "crypto.ciphertext:data!"); - const computedMAC = (0, index_js_3.hexlify)((0, index_js_2.sha256)((0, index_js_3.concat)([key.slice(16, 32), ciphertext]))).substring(2); - (0, index_js_3.assertArgument)(computedMAC === (0, utils_js_1.spelunk)(data, "crypto.mac:string!").toLowerCase(), "incorrect password", "password", "[ REDACTED ]"); - const privateKey = decrypt(data, key.slice(0, 16), ciphertext); - const address = (0, index_js_1.getAddress)(data.address); - const prefix = (0, address_js_1.extractPrefix)(address); - if ((0, address_js_1.computeAddress)(privateKey, prefix) !== address) { - throw new Error("address mismatch"); - } - if (data.address) { - let check = data.address.toLowerCase(); - if (!check.startsWith("0x")) { - check = "0x" + check; - } - (0, index_js_3.assertArgument)((0, index_js_1.getAddress)(check) === address, "keystore address/privateKey mismatch", "address", data.address); - } - const account = { address, privateKey }; - // Version 0.1 x-corebc metadata must contain an encrypted mnemonic phrase - const version = (0, utils_js_1.spelunk)(data, "x-corebc.version:string"); - if (version === "0.1") { - const mnemonicKey = key.slice(32, 64); - const mnemonicCiphertext = (0, utils_js_1.spelunk)(data, "x-corebc.mnemonicCiphertext:data!"); - const mnemonicIv = (0, utils_js_1.spelunk)(data, "x-corebc.mnemonicCounter:data!"); - const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); - account.mnemonic = { - path: (0, utils_js_1.spelunk)(data, "x-corebc.path:string") || defaultPath, - locale: (0, utils_js_1.spelunk)(data, "x-corebc.locale:string") || "en", - entropy: (0, index_js_3.hexlify)((0, index_js_3.getBytes)(mnemonicAesCtr.decrypt(mnemonicCiphertext))), - }; - } - return account; -} -function getDecryptKdfParams(data) { - const kdf = (0, utils_js_1.spelunk)(data, "crypto.kdf:string"); - if (kdf && typeof kdf === "string") { - if (kdf.toLowerCase() === "scrypt") { - const salt = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.salt:data!"); - const N = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.n:int!"); - const r = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.r:int!"); - const p = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.p:int!"); - // Make sure N is a power of 2 - (0, index_js_3.assertArgument)(N > 0 && (N & (N - 1)) === 0, "invalid kdf.N", "kdf.N", N); - (0, index_js_3.assertArgument)(r > 0 && p > 0, "invalid kdf", "kdf", kdf); - const dkLen = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.dklen:int!"); - (0, index_js_3.assertArgument)(dkLen === 32, "invalid kdf.dklen", "kdf.dflen", dkLen); - return { name: "scrypt", salt, N, r, p, dkLen: 64 }; - } - else if (kdf.toLowerCase() === "pbkdf2") { - const salt = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.salt:data!"); - const prf = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.prf:string!"); - const algorithm = prf.split("-").pop(); - (0, index_js_3.assertArgument)(algorithm === "sha256" || algorithm === "sha512", "invalid kdf.pdf", "kdf.pdf", prf); - const count = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.c:int!"); - const dkLen = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.dklen:int!"); - (0, index_js_3.assertArgument)(dkLen === 32, "invalid kdf.dklen", "kdf.dklen", dkLen); - return { name: "pbkdf2", salt, count, dkLen, algorithm }; - } - } - (0, index_js_3.assertArgument)(false, "unsupported key-derivation function", "kdf", kdf); -} -/** - * Returns the account details for the JSON Keystore Wallet %%json%% - * using %%password%%. - * - * It is preferred to use the [async version](decryptKeystoreJson) - * instead, which allows a [[ProgressCallback]] to keep the user informed - * as to the decryption status. - * - * This method will block the event loop (freezing all UI) until decryption - * is complete, which can take quite some time, depending on the wallet - * paramters and platform. - */ -function decryptKeystoreJsonSync(json, _password) { - const data = JSON.parse(json); - const password = (0, utils_js_1.getPassword)(_password); - const params = getDecryptKdfParams(data); - if (params.name === "pbkdf2") { - const { salt, count, dkLen, algorithm } = params; - const key = (0, index_js_2.pbkdf2)(password, salt, count, dkLen, algorithm); - return getAccount(data, key); - } - (0, index_js_3.assert)(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { - params, - }); - const { salt, N, r, p, dkLen } = params; - const key = (0, index_js_2.scryptSync)(password, salt, N, r, p, dkLen); - return getAccount(data, key); -} -exports.decryptKeystoreJsonSync = decryptKeystoreJsonSync; -function stall(duration) { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, duration); - }); -} -/** - * Resolves to the decrypted JSON Keystore Wallet %%json%% using the - * %%password%%. - * - * If provided, %%progress%% will be called periodically during the - * decrpytion to provide feedback, and if the function returns - * ``false`` will halt decryption. - * - * The %%progressCallback%% will **always** receive ``0`` before - * decryption begins and ``1`` when complete. - */ -async function decryptKeystoreJson(json, _password, progress) { - const data = JSON.parse(json); - const password = (0, utils_js_1.getPassword)(_password); - const params = getDecryptKdfParams(data); - if (params.name === "pbkdf2") { - if (progress) { - progress(0); - await stall(0); - } - const { salt, count, dkLen, algorithm } = params; - const key = (0, index_js_2.pbkdf2)(password, salt, count, dkLen, algorithm); - if (progress) { - progress(1); - await stall(0); - } - return getAccount(data, key); - } - (0, index_js_3.assert)(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { - params, - }); - const { salt, N, r, p, dkLen } = params; - const key = await (0, index_js_2.scrypt)(password, salt, N, r, p, dkLen, progress); - return getAccount(data, key); -} -exports.decryptKeystoreJson = decryptKeystoreJson; -function getEncryptKdfParams(options) { - // Check/generate the salt - const salt = options.salt != null - ? (0, index_js_3.getBytes)(options.salt, "options.salt") - : (0, index_js_2.randomBytes)(32); - // Override the scrypt password-based key derivation function parameters - let N = 1 << 17, r = 8, p = 1; - if (options.scrypt) { - if (options.scrypt.N) { - N = options.scrypt.N; - } - if (options.scrypt.r) { - r = options.scrypt.r; - } - if (options.scrypt.p) { - p = options.scrypt.p; - } - } - (0, index_js_3.assertArgument)(typeof N === "number" && - N > 0 && - Number.isSafeInteger(N) && - (BigInt(N) & BigInt(N - 1)) === BigInt(0), "invalid scrypt N parameter", "options.N", N); - (0, index_js_3.assertArgument)(typeof r === "number" && r > 0 && Number.isSafeInteger(r), "invalid scrypt r parameter", "options.r", r); - (0, index_js_3.assertArgument)(typeof p === "number" && p > 0 && Number.isSafeInteger(p), "invalid scrypt p parameter", "options.p", p); - return { name: "scrypt", dkLen: 32, salt, N, r, p }; -} -function _encryptKeystore(key, kdf, account, options) { - const privateKey = (0, index_js_3.getBytes)(account.privateKey, "privateKey"); - // Override initialization vector - const iv = options.iv != null ? (0, index_js_3.getBytes)(options.iv, "options.iv") : (0, index_js_2.randomBytes)(16); - (0, index_js_3.assertArgument)(iv.length === 16, "invalid options.iv length", "options.iv", options.iv); - // Override the uuid - const uuidRandom = options.uuid != null - ? (0, index_js_3.getBytes)(options.uuid, "options.uuid") - : (0, index_js_2.randomBytes)(16); - (0, index_js_3.assertArgument)(uuidRandom.length === 16, "invalid options.uuid length", "options.uuid", options.iv); - // This will be used to encrypt the wallet (as per Web3 secret storage) - // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) - // - 32 bytes AES key to encrypt mnemonic with (required here to be corebc Wallet) - const derivedKey = key.slice(0, 16); - const macPrefix = key.slice(16, 32); - // Encrypt the private key - const aesCtr = new CTR(derivedKey, iv); - const ciphertext = (0, index_js_3.getBytes)(aesCtr.encrypt(privateKey)); - // Compute the message authentication code, used to check the password - const mac = (0, index_js_2.sha256)((0, index_js_3.concat)([macPrefix, ciphertext])); - const data = { - address: account.address.substring(2).toLowerCase(), - id: (0, index_js_3.uuidV4)(uuidRandom), - version: 3, - Crypto: { - cipher: "aes-128-ctr", - cipherparams: { - iv: (0, index_js_3.hexlify)(iv).substring(2), - }, - ciphertext: (0, index_js_3.hexlify)(ciphertext).substring(2), - kdf: "scrypt", - kdfparams: { - salt: (0, index_js_3.hexlify)(kdf.salt).substring(2), - n: kdf.N, - dklen: 32, - p: kdf.p, - r: kdf.r, - }, - mac: mac.substring(2), - }, - }; - // If we have a mnemonic, encrypt it into the JSON wallet - if (account.mnemonic) { - const client = options.client != null ? options.client : `corebc/${_version_js_1.version}`; - const path = account.mnemonic.path || defaultPath; - const locale = account.mnemonic.locale || "en"; - const mnemonicKey = key.slice(32, 64); - const entropy = (0, index_js_3.getBytes)(account.mnemonic.entropy, "account.mnemonic.entropy"); - const mnemonicIv = (0, index_js_2.randomBytes)(16); - const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); - const mnemonicCiphertext = (0, index_js_3.getBytes)(mnemonicAesCtr.encrypt(entropy)); - const now = new Date(); - const timestamp = now.getUTCFullYear() + - "-" + - (0, utils_js_1.zpad)(now.getUTCMonth() + 1, 2) + - "-" + - (0, utils_js_1.zpad)(now.getUTCDate(), 2) + - "T" + - (0, utils_js_1.zpad)(now.getUTCHours(), 2) + - "-" + - (0, utils_js_1.zpad)(now.getUTCMinutes(), 2) + - "-" + - (0, utils_js_1.zpad)(now.getUTCSeconds(), 2) + - ".0Z"; - const gethFilename = "UTC--" + timestamp + "--" + data.address; - data["x-corebc"] = { - client, - gethFilename, - path, - locale, - mnemonicCounter: (0, index_js_3.hexlify)(mnemonicIv).substring(2), - mnemonicCiphertext: (0, index_js_3.hexlify)(mnemonicCiphertext).substring(2), - version: "0.1", - }; - } - return JSON.stringify(data); -} -/** - * Return the JSON Keystore Wallet for %%account%% encrypted with - * %%password%%. - * - * The %%options%% can be used to tune the password-based key - * derivation function parameters, explicitly set the random values - * used. Any provided [[ProgressCallback]] is ignord. - */ -function encryptKeystoreJsonSync(account, password, options) { - if (options == null) { - options = {}; - } - const passwordBytes = (0, utils_js_1.getPassword)(password); - const kdf = getEncryptKdfParams(options); - const key = (0, index_js_2.scryptSync)(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64); - return _encryptKeystore((0, index_js_3.getBytes)(key), kdf, account, options); -} -exports.encryptKeystoreJsonSync = encryptKeystoreJsonSync; -/** - * Resolved to the JSON Keystore Wallet for %%account%% encrypted - * with %%password%%. - * - * The %%options%% can be used to tune the password-based key - * derivation function parameters, explicitly set the random values - * used and provide a [[ProgressCallback]] to receive periodic updates - * on the completion status.. - */ -async function encryptKeystoreJson(account, password, options) { - if (options == null) { - options = {}; - } - const passwordBytes = (0, utils_js_1.getPassword)(password); - const kdf = getEncryptKdfParams(options); - const key = await (0, index_js_2.scrypt)(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback); - return _encryptKeystore((0, index_js_3.getBytes)(key), kdf, account, options); -} -exports.encryptKeystoreJson = encryptKeystoreJson; -//# sourceMappingURL=json-keystore.js.map \ No newline at end of file diff --git a/lib.commonjs/wallet/json-keystore.js.map b/lib.commonjs/wallet/json-keystore.js.map deleted file mode 100644 index e1d482fc7..000000000 --- a/lib.commonjs/wallet/json-keystore.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-keystore.js","sourceRoot":"","sources":["../../src.ts/wallet/json-keystore.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;;GASG;AACH,aAAa;AACb,4DAAyB;AACzB,MAAM,EAAE,GAAG,EAAE,GAAG,gBAAG,CAAC;AAEpB,kDAAiD;AACjD,iDAM4B;AAC5B,gDAO2B;AAE3B,yCAAwD;AAKxD,gDAAyC;AACzC,0DAA0E;AAE1E,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAgCvC;;GAEG;AACH,SAAgB,cAAc,CAAC,IAAY;IACzC,IAAI;QACF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,IAAI,OAAO,KAAK,CAAC,EAAE;YACjB,OAAO,IAAI,CAAC;SACb;KACF;IAAC,OAAO,KAAK,EAAE,GAAE;IAClB,OAAO,KAAK,CAAC;AACf,CAAC;AATD,wCASC;AAED,SAAS,OAAO,CAAC,IAAS,EAAE,GAAe,EAAE,UAAsB;IACjE,MAAM,MAAM,GAAG,IAAA,kBAAO,EAAS,IAAI,EAAE,sBAAsB,CAAC,CAAC;IAC7D,IAAI,MAAM,KAAK,aAAa,EAAE;QAC5B,MAAM,EAAE,GAAG,IAAA,kBAAO,EAAa,IAAI,EAAE,8BAA8B,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,IAAI,GAA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AC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACzE,OAAO,gBAAgB,CAAC,IAAA,mBAAQ,EAAC,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC;AAbD,0DAaC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,mBAAmB,CACvC,OAAwB,EACxB,QAA6B,EAC7B,OAAwB;IAExB,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,GAAG,EAAE,CAAC;KACd;IAED,MAAM,aAAa,GAAG,IAAA,sBAAW,EAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,GAAG,GAAG,MAAM,IAAA,iBAAM,EACtB,aAAa,EACb,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,CAAC,EACL,GAAG,CAAC,CAAC,EACL,GAAG,CAAC,CAAC,EACL,EAAE,EACF,OAAO,CAAC,gBAAgB,CACzB,CAAC;IACF,OAAO,gBAAgB,CAAC,IAAA,mBAAQ,EAAC,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC;AArBD,kDAqBC"} \ No newline at end of file diff --git a/lib.commonjs/wallet/mnemonic.d.ts b/lib.commonjs/wallet/mnemonic.d.ts deleted file mode 100644 index 64ef1a10e..000000000 --- a/lib.commonjs/wallet/mnemonic.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -import type { BytesLike } from "../utils/index.js"; -import type { Wordlist } from "../wordlists/index.js"; -/** - * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] - * seeds and convert between phrases and entropy. - */ -export declare class Mnemonic { - /** - * The mnemonic phrase of 12, 15, 18, 21 or 24 words. - * - * Use the [[wordlist]] ``split`` method to get the individual words. - */ - readonly phrase: string; - /** - * The password used for this mnemonic. If no password is used this - * is the empty string (i.e. ``""``) as per the specification. - */ - readonly password: string; - /** - * The wordlist for this mnemonic. - */ - readonly wordlist: Wordlist; - /** - * The underlying entropy which the mnemonic encodes. - */ - readonly entropy: string; - /** - * @private - */ - constructor(guard: any, entropy: string, phrase: string, password?: null | string, wordlist?: null | Wordlist); - /** - * Returns the seed for the mnemonic. - */ - computeSeed(): string; - /** - * Creates a new Mnemonic for the %%phrase%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromPhrase({ phrase, password, wordlist, }: { - phrase: string; - password?: null | string; - wordlist?: null | Wordlist; - }): Mnemonic; - /** - * Create a new **Mnemonic** from the %%entropy%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromEntropy(_entropy: BytesLike, password?: null | string, wordlist?: null | Wordlist): Mnemonic; - /** - * Returns the phrase for %%mnemonic%%. - */ - static entropyToPhrase(_entropy: BytesLike, wordlist?: null | Wordlist): string; - /** - * Returns the entropy for %%phrase%%. - */ - static phraseToEntropy(phrase: string, wordlist?: null | Wordlist): string; - /** - * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. - * - * This checks all the provided words belong to the %%wordlist%%, - * that the length is valid and the checksum is correct. - */ - static isValidMnemonic(phrase: string, wordlist?: null | Wordlist): boolean; -} -//# sourceMappingURL=mnemonic.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wallet/mnemonic.d.ts.map b/lib.commonjs/wallet/mnemonic.d.ts.map deleted file mode 100644 index 82d411a3d..000000000 --- a/lib.commonjs/wallet/mnemonic.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mnemonic.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/mnemonic.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AA6HtD;;;GAGG;AACH,qBAAa,QAAQ;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lib.commonjs/wallet/mnemonic.js b/lib.commonjs/wallet/mnemonic.js deleted file mode 100644 index 8daf343c0..000000000 --- a/lib.commonjs/wallet/mnemonic.js +++ /dev/null @@ -1,170 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Mnemonic = void 0; -const index_js_1 = require("../utils/index.js"); -const lang_en_js_1 = require("../wordlists/lang-en.js"); -const sha3_js_1 = require("../crypto/sha3.js"); -const mnemonicToSeed_js_1 = require("./mnemonicToSeed.js"); -// Returns a byte with the MSB bits set -function getUpperMask(bits) { - return (((1 << bits) - 1) << (8 - bits)) & 0xff; -} -// Returns a byte with the LSB bits set -function getLowerMask(bits) { - return ((1 << bits) - 1) & 0xff; -} -function mnemonicToEntropy(mnemonic, wordlist) { - (0, index_js_1.assertNormalize)("NFKD"); - if (wordlist == null) { - wordlist = lang_en_js_1.LangEn.wordlist(); - } - const words = wordlist.split(mnemonic); - (0, index_js_1.assertArgument)(words.length % 3 === 0 && words.length >= 12 && words.length <= 24, "invalid mnemonic length", "mnemonic", "[ REDACTED ]"); - const entropy = new Uint8Array(Math.ceil((11 * words.length) / 8)); - let offset = 0; - for (let i = 0; i < words.length; i++) { - let index = wordlist.getWordIndex(words[i].normalize("NFKD")); - (0, index_js_1.assertArgument)(index >= 0, `invalid mnemonic word at index ${i}`, "mnemonic", "[ REDACTED ]"); - for (let bit = 0; bit < 11; bit++) { - if (index & (1 << (10 - bit))) { - entropy[offset >> 3] |= 1 << (7 - (offset % 8)); - } - offset++; - } - } - const entropyBits = (32 * words.length) / 3; - const checksumBits = words.length / 3; - const checksumMask = getUpperMask(checksumBits); - const checksum = (0, index_js_1.getBytes)((0, sha3_js_1.legacySha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; - (0, index_js_1.assertArgument)(checksum === (entropy[entropy.length - 1] & checksumMask), "invalid mnemonic checksum", "mnemonic", "[ REDACTED ]"); - return (0, index_js_1.hexlify)(entropy.slice(0, entropyBits / 8)); -} -function entropyToMnemonic(entropy, wordlist) { - (0, index_js_1.assertArgument)(entropy.length % 4 === 0 && entropy.length >= 16 && entropy.length <= 32, "invalid entropy size", "entropy", "[ REDACTED ]"); - if (wordlist == null) { - wordlist = lang_en_js_1.LangEn.wordlist(); - } - const indices = [0]; - let remainingBits = 11; - for (let i = 0; i < entropy.length; i++) { - // Consume the whole byte (with still more to go) - if (remainingBits > 8) { - indices[indices.length - 1] <<= 8; - indices[indices.length - 1] |= entropy[i]; - remainingBits -= 8; - // This byte will complete an 11-bit index - } - else { - indices[indices.length - 1] <<= remainingBits; - indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); - // Start the next word - indices.push(entropy[i] & getLowerMask(8 - remainingBits)); - remainingBits += 3; - } - } - // Compute the checksum bits - const checksumBits = entropy.length / 4; - const checksum = parseInt((0, sha3_js_1.legacySha256)(entropy).substring(2, 4), 16) & - getUpperMask(checksumBits); - // Shift the checksum into the word indices - indices[indices.length - 1] <<= checksumBits; - indices[indices.length - 1] |= checksum >> (8 - checksumBits); - return wordlist.join(indices.map((index) => wordlist.getWord(index))); -} -const _guard = {}; -/** - * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] - * seeds and convert between phrases and entropy. - */ -class Mnemonic { - /** - * The mnemonic phrase of 12, 15, 18, 21 or 24 words. - * - * Use the [[wordlist]] ``split`` method to get the individual words. - */ - phrase; - /** - * The password used for this mnemonic. If no password is used this - * is the empty string (i.e. ``""``) as per the specification. - */ - password; - /** - * The wordlist for this mnemonic. - */ - wordlist; - /** - * The underlying entropy which the mnemonic encodes. - */ - entropy; - /** - * @private - */ - constructor(guard, entropy, phrase, password, wordlist) { - if (password == null) { - password = ""; - } - if (wordlist == null) { - wordlist = lang_en_js_1.LangEn.wordlist(); - } - (0, index_js_1.assertPrivate)(guard, _guard, "Mnemonic"); - (0, index_js_1.defineProperties)(this, { phrase, password, wordlist, entropy }); - } - /** - * Returns the seed for the mnemonic. - */ - computeSeed() { - return (0, mnemonicToSeed_js_1.mnemonicToSeed)(this.phrase, this.password); - } - /** - * Creates a new Mnemonic for the %%phrase%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromPhrase({ phrase, password, wordlist, }) { - // Normalize the case and space; throws if invalid - const entropy = mnemonicToEntropy(phrase, wordlist); - phrase = entropyToMnemonic((0, index_js_1.getBytes)(entropy), wordlist); - return new Mnemonic(_guard, entropy, phrase, password, wordlist); - } - /** - * Create a new **Mnemonic** from the %%entropy%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromEntropy(_entropy, password, wordlist) { - const entropy = (0, index_js_1.getBytes)(_entropy, "entropy"); - const phrase = entropyToMnemonic(entropy, wordlist); - return new Mnemonic(_guard, (0, index_js_1.hexlify)(entropy), phrase, password, wordlist); - } - /** - * Returns the phrase for %%mnemonic%%. - */ - static entropyToPhrase(_entropy, wordlist) { - const entropy = (0, index_js_1.getBytes)(_entropy, "entropy"); - return entropyToMnemonic(entropy, wordlist); - } - /** - * Returns the entropy for %%phrase%%. - */ - static phraseToEntropy(phrase, wordlist) { - return mnemonicToEntropy(phrase, wordlist); - } - /** - * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. - * - * This checks all the provided words belong to the %%wordlist%%, - * that the length is valid and the checksum is correct. - */ - static isValidMnemonic(phrase, wordlist) { - try { - mnemonicToEntropy(phrase, wordlist); - return true; - } - catch (error) { } - return false; - } -} -exports.Mnemonic = Mnemonic; -//# sourceMappingURL=mnemonic.js.map \ No newline at end of file diff --git a/lib.commonjs/wallet/mnemonic.js.map b/lib.commonjs/wallet/mnemonic.js.map deleted file mode 100644 index fbac6eb33..000000000 --- a/lib.commonjs/wallet/mnemonic.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mnemonic.js","sourceRoot":"","sources":["../../src.ts/wallet/mnemonic.ts"],"names":[],"mappings":";;;AAAA,gDAO2B;AAC3B,wDAAiD;AAIjD,+CAAiD;AACjD,2DAAqD;AAEr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ed82a0..000000000 --- a/lib.commonjs/wallet/mnemonicToSeed.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function mnemonicToSeed(mnemonic: string, password?: string): string; -//# sourceMappingURL=mnemonicToSeed.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wallet/mnemonicToSeed.d.ts.map b/lib.commonjs/wallet/mnemonicToSeed.d.ts.map deleted file mode 100644 index fa7e673dc..000000000 --- a/lib.commonjs/wallet/mnemonicToSeed.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mnemonicToSeed.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/mnemonicToSeed.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAM1E"} \ No newline at end of file diff --git a/lib.commonjs/wallet/mnemonicToSeed.js b/lib.commonjs/wallet/mnemonicToSeed.js deleted file mode 100644 index d5135ede3..000000000 --- a/lib.commonjs/wallet/mnemonicToSeed.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.mnemonicToSeed = void 0; -const tslib_1 = require("tslib"); -const crypto_js_1 = require("../crypto/crypto.js"); -const utf8_1 = tslib_1.__importDefault(require("utf8")); -function mnemonicToSeed(mnemonic, password) { - if (!password) { - password = ""; - } - const t = generateSeed(mnemonic, password); - return t.goldilock; -} -exports.mnemonicToSeed = mnemonicToSeed; -const generateSeed = (mnemonic, password) => { - const goldilockSaltPrefix = "mnemonic"; - const aesSaltPrefix = "mnemonicfortheAESkey"; - const goldilockSalt = utf8_1.default.encode(goldilockSaltPrefix + password); - const aesSalt = utf8_1.default.encode(aesSaltPrefix + password); - const goldilockKey = (0, crypto_js_1.pbkdf2Sync)(Buffer.from(mnemonic), goldilockSalt, 2048, 64, "sha512"); - const aesKeySeed = (0, crypto_js_1.pbkdf2Sync)(Buffer.from(mnemonic), aesSalt, 2048, 64, "sha512"); - return { - aes: aesKeySeed.toString("hex"), - goldilock: goldilockKey.toString("hex"), - }; -}; -//# sourceMappingURL=mnemonicToSeed.js.map \ No newline at end of file diff --git a/lib.commonjs/wallet/mnemonicToSeed.js.map b/lib.commonjs/wallet/mnemonicToSeed.js.map deleted file mode 100644 index 47084e866..000000000 --- a/lib.commonjs/wallet/mnemonicToSeed.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mnemonicToSeed.js","sourceRoot":"","sources":["../../src.ts/wallet/mnemonicToSeed.ts"],"names":[],"mappings":";;;;AAAA,mDAAiD;AACjD,wDAAwB;AACxB,SAAgB,cAAc,CAAC,QAAgB,EAAE,QAAiB;IAChE,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,EAAE,CAAC;KACf;IACD,MAAM,CAAC,GAAG,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC,SAAS,CAAC;AACrB,CAAC;AAND,wCAMC;AAED,MAAM,YAAY,GAAG,CAAC,QAAgB,EAAE,QAAiB,EAAE,EAAE;IAC3D,MAAM,mBAAmB,GAAG,UAAU,CAAC;IACvC,MAAM,aAAa,GAAG,sBAAsB,CAAC;IAE7C,MAAM,aAAa,GAAG,cAAI,CAAC,MAAM,CAAC,mBAAmB,GAAG,QAAQ,CAAC,CAAC;IAClE,MAAM,OAAO,GAAG,cAAI,CAAC,MAAM,CAAC,aAAa,GAAG,QAAQ,CAAC,CAAC;IAEtD,MAAM,YAAY,GAAG,IAAA,sBAAU,EAC7B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EACrB,aAAa,EACb,IAAI,EACJ,EAAE,EACF,QAAQ,CACT,CAAC;IAEF,MAAM,UAAU,GAAG,IAAA,sBAAU,EAC3B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EACrB,OAAO,EACP,IAAI,EACJ,EAAE,EACF,QAAQ,CACT,CAAC;IAEF,OAAO;QACL,GAAG,EAAE,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC/B,SAAS,EAAE,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC;KACxC,CAAC;AACJ,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/wallet/utils.d.ts b/lib.commonjs/wallet/utils.d.ts deleted file mode 100644 index 0d4baabe8..000000000 --- a/lib.commonjs/wallet/utils.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @_ignore - */ -export declare function looseArrayify(hexString: string): Uint8Array; -export declare function zpad(value: String | number, length: number): String; -export declare function getPassword(password: string | Uint8Array): Uint8Array; -export declare function spelunk(object: any, _path: string): T; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wallet/utils.d.ts.map b/lib.commonjs/wallet/utils.d.ts.map deleted file mode 100644 index 4c02cc44f..000000000 --- a/lib.commonjs/wallet/utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAK3D;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMnE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAKrE;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAoExD"} \ No newline at end of file diff --git a/lib.commonjs/wallet/utils.js b/lib.commonjs/wallet/utils.js deleted file mode 100644 index d47899df9..000000000 --- a/lib.commonjs/wallet/utils.js +++ /dev/null @@ -1,149 +0,0 @@ -"use strict"; -/** - * @_ignore - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.spelunk = exports.getPassword = exports.zpad = exports.looseArrayify = void 0; -const index_js_1 = require("../utils/index.js"); -function looseArrayify(hexString) { - if (typeof hexString === "string" && !hexString.startsWith("0x")) { - hexString = "0x" + hexString; - } - return (0, index_js_1.getBytesCopy)(hexString); -} -exports.looseArrayify = looseArrayify; -function zpad(value, length) { - value = String(value); - while (value.length < length) { - value = "0" + value; - } - return value; -} -exports.zpad = zpad; -function getPassword(password) { - if (typeof password === "string") { - return (0, index_js_1.toUtf8Bytes)(password, "NFKC"); - } - return (0, index_js_1.getBytesCopy)(password); -} -exports.getPassword = getPassword; -function spelunk(object, _path) { - const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i); - (0, index_js_1.assertArgument)(match != null, "invalid path", "path", _path); - const path = match[1]; - const type = match[3]; - const reqd = match[4] === "!"; - let cur = object; - for (const comp of path.toLowerCase().split(".")) { - // Search for a child object with a case-insensitive matching key - if (Array.isArray(cur)) { - if (!comp.match(/^[0-9]+$/)) { - break; - } - cur = cur[parseInt(comp)]; - } - else if (typeof cur === "object") { - let found = null; - for (const key in cur) { - if (key.toLowerCase() === comp) { - found = cur[key]; - break; - } - } - cur = found; - } - else { - cur = null; - } - if (cur == null) { - break; - } - } - (0, index_js_1.assertArgument)(!reqd || cur != null, "missing required value", "path", path); - if (type && cur != null) { - if (type === "int") { - if (typeof cur === "string" && cur.match(/^-?[0-9]+$/)) { - return parseInt(cur); - } - else if (Number.isSafeInteger(cur)) { - return cur; - } - } - if (type === "number") { - if (typeof cur === "string" && cur.match(/^-?[0-9.]*$/)) { - return parseFloat(cur); - } - } - if (type === "data") { - if (typeof cur === "string") { - return looseArrayify(cur); - } - } - if (type === "array" && Array.isArray(cur)) { - return cur; - } - if (type === typeof cur) { - return cur; - } - (0, index_js_1.assertArgument)(false, `wrong type found for ${type} `, "path", path); - } - return cur; -} -exports.spelunk = spelunk; -/* -export function follow(object: any, path: string): null | string { - let currentChild = object; - - for (const comp of path.toLowerCase().split('/')) { - - // Search for a child object with a case-insensitive matching key - let matchingChild = null; - for (const key in currentChild) { - if (key.toLowerCase() === comp) { - matchingChild = currentChild[key]; - break; - } - } - - if (matchingChild === null) { return null; } - - currentChild = matchingChild; - } - - return currentChild; -} - -// "path/to/something:type!" -export function followRequired(data: any, path: string): string { - const value = follow(data, path); - if (value != null) { return value; } - return logger.throwArgumentError("invalid value", `data:${ path }`, - JSON.stringify(data)); -} -*/ -// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) -/* -export function uuidV4(randomBytes: BytesLike): string { - const bytes = getBytes(randomBytes, "randomBytes"); - - // Section: 4.1.3: - // - time_hi_and_version[12:16] = 0b0100 - bytes[6] = (bytes[6] & 0x0f) | 0x40; - - // Section 4.4 - // - clock_seq_hi_and_reserved[6] = 0b0 - // - clock_seq_hi_and_reserved[7] = 0b1 - bytes[8] = (bytes[8] & 0x3f) | 0x80; - - const value = hexlify(bytes); - - return [ - value.substring(2, 10), - value.substring(10, 14), - value.substring(14, 18), - value.substring(18, 22), - value.substring(22, 34), - ].join("-"); -} -*/ -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/lib.commonjs/wallet/utils.js.map b/lib.commonjs/wallet/utils.js.map deleted file mode 100644 index eaebe84aa..000000000 --- a/lib.commonjs/wallet/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src.ts/wallet/utils.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,gDAA8E;AAE9E,SAAgB,aAAa,CAAC,SAAiB;IAC7C,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QAChE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;KAC9B;IACD,OAAO,IAAA,uBAAY,EAAC,SAAS,CAAC,CAAC;AACjC,CAAC;AALD,sCAKC;AAED,SAAgB,IAAI,CAAC,KAAsB,EAAE,MAAc;IACzD,KAAK,GAAG,MAAM,CAAC,K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AE,MAAM,EAAE,IAAI,CAAC,CAAC;KACtE;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AApED,0BAoEC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BE;AACF,0DAA0D;AAC1D;;;;;;;;;;;;;;;;;;;;;;;EAuBE"} \ No newline at end of file diff --git a/lib.commonjs/wallet/wallet.d.ts b/lib.commonjs/wallet/wallet.d.ts deleted file mode 100644 index 384cb372f..000000000 --- a/lib.commonjs/wallet/wallet.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { SigningKey } from "../crypto/index.js"; -import { BaseWallet } from "./base-wallet.js"; -import { HDNodeWallet } from "./hdwallet.js"; -import type { ProgressCallback } from "../crypto/index.js"; -import type { Provider } from "../providers/index.js"; -/** - * A **Wallet** manages a single private key which is used to sign - * transactions, messages and other common payloads. - * - * This class is generally the main entry point for developers - * that wish to use a private key directly, as it can create - * instances from a large variety of common sources, including - * raw private key, [[link-bip-39]] mnemonics and encrypte JSON - * wallets. - */ -export declare class Wallet extends BaseWallet { - #private; - /** - * Create a new wallet for the %%privateKey%% or %%signingKey%%, optionally connected - * to %%provider%%. - */ - constructor({ key, prefix, provider, }: { - key: string | SigningKey; - prefix: string; - provider?: null | Provider; - }); - connect(provider: null | Provider): Wallet; - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise; - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password: Uint8Array | string): string; - /** - * Creates (asynchronously) a **Wallet** by decrypting the %%json%% - * with %%password%%. - * - * If %%progress%% is provided, it is called periodically during - * decryption so that any UI can be updated. - */ - static fromEncryptedJson(json: string, password: Uint8Array | string, progress?: ProgressCallback): Promise; - /** - * Creates a **Wallet** by decrypting the %%json%% with %%password%%. - * - * The [[fromEncryptedJson]] method is preferred, as this method - * will lock up and freeze the UI during decryption, which may take - * some time. - */ - static fromEncryptedJsonSync(json: string, password: Uint8Array | string): HDNodeWallet | Wallet; - /** - * Creates a new random [[HDNodeWallet]] using the avavilable - * [cryptographic random source](randomBytes). - * - * If there is no crytographic random source, this will throw. - */ - static createRandom(prefix: string, provider?: null | Provider): HDNodeWallet; - /** - * Creates a [[HDNodeWallet]] for %%phrase%%. - */ - static fromPhrase({ phrase, prefix, provider, password, }: { - phrase: string; - prefix: string; - provider?: Provider; - password?: string; - }): HDNodeWallet; - static fromSeed({ seed, prefix, provider, path, }: { - seed: string; - prefix: string; - path?: string; - provider?: Provider; - }): HDNodeWallet; -} -//# sourceMappingURL=wallet.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wallet/wallet.d.ts.map b/lib.commonjs/wallet/wallet.d.ts.map deleted file mode 100644 index edbeaa1bd..000000000 --- a/lib.commonjs/wallet/wallet.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAe,YAAY,EAAE,MAAM,eAAe,CAAC;AAW1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AActD;;;;;;;;;GASG;AACH,qBAAa,MAAO,SAAQ,UAAU;;IACpC;;;OAGG;gBACS,EACV,GAAG,EACH,MAAM,EACN,QAAQ,GACT,EAAE;QACD,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;QACzB,MAAM,EAAE,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AAQ,CAAC;KACrB,GAAG,YAAY;CAWjB"} \ No newline at end of file diff --git a/lib.commonjs/wallet/wallet.js b/lib.commonjs/wallet/wallet.js deleted file mode 100644 index 01aafa681..000000000 --- a/lib.commonjs/wallet/wallet.js +++ /dev/null @@ -1,184 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Wallet = void 0; -const index_js_1 = require("../crypto/index.js"); -const index_js_2 = require("../utils/index.js"); -const base_wallet_js_1 = require("./base-wallet.js"); -const hdwallet_js_1 = require("./hdwallet.js"); -const json_crowdsale_js_1 = require("./json-crowdsale.js"); -const json_keystore_js_1 = require("./json-keystore.js"); -const mnemonic_js_1 = require("./mnemonic.js"); -const address_js_1 = require("../transaction/address.js"); -function stall(duration) { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, duration); - }); -} -/** - * A **Wallet** manages a single private key which is used to sign - * transactions, messages and other common payloads. - * - * This class is generally the main entry point for developers - * that wish to use a private key directly, as it can create - * instances from a large variety of common sources, including - * raw private key, [[link-bip-39]] mnemonics and encrypte JSON - * wallets. - */ -class Wallet extends base_wallet_js_1.BaseWallet { - /** - * Create a new wallet for the %%privateKey%% or %%signingKey%%, optionally connected - * to %%provider%%. - */ - constructor({ key, prefix, provider, }) { - if (typeof key === "string" && !key.startsWith("0x")) { - key = "0x" + key; - } - let signingKey = typeof key === "string" ? new index_js_1.SigningKey(key) : key; - super({ - signingKey, - prefix, - provider, - }); - } - connect(provider) { - return new Wallet({ - key: this.signingKey, - prefix: this.prefix, - provider, - }); - } - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - async encrypt(password, progressCallback) { - const account = { address: this.address, privateKey: this.privateKey }; - return await (0, json_keystore_js_1.encryptKeystoreJson)(account, password, { progressCallback }); - } - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password) { - const account = { address: this.address, privateKey: this.privateKey }; - return (0, json_keystore_js_1.encryptKeystoreJsonSync)(account, password); - } - static #fromAccount(account) { - (0, index_js_2.assertArgument)(account, "invalid JSON wallet", "json", "[ REDACTED ]"); - const address = account.address; - const prefix = (0, address_js_1.extractPrefix)(address); - if ("mnemonic" in account && - account.mnemonic && - account.mnemonic.locale === "en") { - const mnemonic = mnemonic_js_1.Mnemonic.fromEntropy(account.mnemonic.entropy); - const wallet = hdwallet_js_1.HDNodeWallet.fromMnemonic(mnemonic, prefix, account.mnemonic.path); - if (wallet.address === account.address && - wallet.privateKey === account.privateKey) { - return wallet; - } - console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key"); - } - const wallet = new Wallet({ - key: account.privateKey, - prefix, - }); - (0, index_js_2.assertArgument)(wallet.address === account.address, "address/privateKey mismatch", "json", "[ REDACTED ]"); - return wallet; - } - /** - * Creates (asynchronously) a **Wallet** by decrypting the %%json%% - * with %%password%%. - * - * If %%progress%% is provided, it is called periodically during - * decryption so that any UI can be updated. - */ - static async fromEncryptedJson(json, password, progress) { - let account = null; - if ((0, json_keystore_js_1.isKeystoreJson)(json)) { - account = await (0, json_keystore_js_1.decryptKeystoreJson)(json, password, progress); - } - else if ((0, json_crowdsale_js_1.isCrowdsaleJson)(json)) { - if (progress) { - progress(0); - await stall(0); - } - account = (0, json_crowdsale_js_1.decryptCrowdsaleJson)(json, password); - if (progress) { - progress(1); - await stall(0); - } - } - return Wallet.#fromAccount(account); - } - /** - * Creates a **Wallet** by decrypting the %%json%% with %%password%%. - * - * The [[fromEncryptedJson]] method is preferred, as this method - * will lock up and freeze the UI during decryption, which may take - * some time. - */ - static fromEncryptedJsonSync(json, password) { - let account = null; - if ((0, json_keystore_js_1.isKeystoreJson)(json)) { - account = (0, json_keystore_js_1.decryptKeystoreJsonSync)(json, password); - } - else if ((0, json_crowdsale_js_1.isCrowdsaleJson)(json)) { - account = (0, json_crowdsale_js_1.decryptCrowdsaleJson)(json, password); - } - else { - (0, index_js_2.assertArgument)(false, "invalid JSON wallet", "json", "[ REDACTED ]"); - } - return Wallet.#fromAccount(account); - } - /** - * Creates a new random [[HDNodeWallet]] using the avavilable - * [cryptographic random source](randomBytes). - * - * If there is no crytographic random source, this will throw. - */ - static createRandom(prefix, provider) { - const wallet = hdwallet_js_1.HDNodeWallet.createRandom(prefix, undefined, undefined, undefined); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } - /** - * Creates a [[HDNodeWallet]] for %%phrase%%. - */ - static fromPhrase({ phrase, prefix, provider, password, }) { - const wallet = hdwallet_js_1.HDNodeWallet.fromPhrase({ - phrase, - prefix, - password, - }); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } - static fromSeed({ seed, prefix, provider, path, }) { - const wallet = hdwallet_js_1.HDNodeWallet.fromSeed({ - seed, - prefix, - path: path || hdwallet_js_1.defaultPath, - }); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } -} -exports.Wallet = Wallet; -//# sourceMappingURL=wallet.js.map \ No newline at end of file diff --git a/lib.commonjs/wallet/wallet.js.map b/lib.commonjs/wallet/wallet.js.map deleted file mode 100644 index ee53ec8e9..000000000 --- a/lib.commonjs/wallet/wallet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../src.ts/wallet/wallet.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAChD,gDAAmD;AAEnD,qDAA8C;AAC9C,+CAA0D;AAC1D,2DAA4E;AAC5E,yDAM4B;AAC5B,+CAAyC;AAOzC,0DAA0D;AAE1D,SAAS,KAAK,CAAC,QAAgB;IAC7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,UAAU,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,QA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ACH,MAAM,CAAC,UAAU,CAAC,EAChB,MAAM,EACN,MAAM,EACN,QAAQ,EACR,QAAQ,GAMT;QACC,MAAM,MAAM,GAAG,0BAAY,CAAC,UAAU,CAAC;YACrC,MAAM;YACN,MAAM;YACN,QAAQ;SACT,CAAC,CAAC;QACH,IAAI,QAAQ,EAAE;YACZ,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;SACjC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,CAAC,QAAQ,CAAC,EACd,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,IAAI,GAML;QACC,MAAM,MAAM,GAAG,0BAAY,CAAC,QAAQ,CAAC;YACnC,IAAI;YACJ,MAAM;YACN,IAAI,EAAE,IAAI,IAAI,yBAAW;SAC1B,CAAC,CAAC;QACH,IAAI,QAAQ,EAAE;YACZ,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;SACjC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAnOD,wBAmOC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/bit-reader.d.ts b/lib.commonjs/wordlists/bit-reader.d.ts deleted file mode 100644 index 1aa849530..000000000 --- a/lib.commonjs/wordlists/bit-reader.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * @_ignore - */ -export declare function decodeBits(width: number, data: string): Array; -//# sourceMappingURL=bit-reader.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/bit-reader.d.ts.map b/lib.commonjs/wordlists/bit-reader.d.ts.map deleted file mode 100644 index 904904c46..000000000 --- a/lib.commonjs/wordlists/bit-reader.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bit-reader.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/bit-reader.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CA8BrE"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/bit-reader.js b/lib.commonjs/wordlists/bit-reader.js deleted file mode 100644 index 81e244227..000000000 --- a/lib.commonjs/wordlists/bit-reader.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.decodeBits = void 0; -const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; -/** - * @_ignore - */ -function decodeBits(width, data) { - const maxValue = (1 << width) - 1; - const result = []; - let accum = 0, bits = 0, flood = 0; - for (let i = 0; i < data.length; i++) { - // Accumulate 6 bits of data - accum = (accum << 6) | Base64.indexOf(data[i]); - bits += 6; - // While we have enough for a word... - while (bits >= width) { - // ...read the word - const value = accum >> (bits - width); - accum &= (1 << (bits - width)) - 1; - bits -= width; - // A value of 0 indicates we exceeded maxValue, it - // floods over into the next value - if (value === 0) { - flood += maxValue; - } - else { - result.push(value + flood); - flood = 0; - } - } - } - return result; -} -exports.decodeBits = decodeBits; -//# sourceMappingURL=bit-reader.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/bit-reader.js.map b/lib.commonjs/wordlists/bit-reader.js.map deleted file mode 100644 index 9a1ae1127..000000000 --- a/lib.commonjs/wordlists/bit-reader.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bit-reader.js","sourceRoot":"","sources":["../../src.ts/wordlists/bit-reader.ts"],"names":[],"mappings":";;;AAAA,MAAM,MAAM,GACV,kEAAkE,CAAC;AAErE;;GAEG;AACH,SAAgB,UAAU,CAAC,KAAa,EAAE,IAAY;IACpD,MAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,IAAI,KAAK,GAAG,CAAC,EACX,IAAI,GAAG,CAAC,EACR,KAAK,GAAG,CAAC,CAAC;IACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,4BAA4B;QAC5B,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,IAAI,IAAI,CAAC,CAAC;QAEV,qCAAqC;QACrC,OAAO,IAAI,IAAI,KAAK,EAAE;YACpB,mBAAmB;YACnB,MAAM,KAAK,GAAG,KAAK,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;YACtC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,IAAI,KAAK,CAAC;YAEd,kDAAkD;YAClD,kCAAkC;YAClC,IAAI,KAAK,KAAK,CAAC,EAAE;gBACf,KAAK,IAAI,QAAQ,CAAC;aACnB;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;gBAC3B,KAAK,GAAG,CAAC,CAAC;aACX;SACF;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AA9BD,gCA8BC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/decode-owl.d.ts b/lib.commonjs/wordlists/decode-owl.d.ts deleted file mode 100644 index 8822086bb..000000000 --- a/lib.commonjs/wordlists/decode-owl.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @_ignore - */ -export declare function decode(data: string, subs: string): Array; -/** - * @_ignore - */ -export declare function decodeOwl(data: string): Array; -//# sourceMappingURL=decode-owl.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/decode-owl.d.ts.map b/lib.commonjs/wordlists/decode-owl.d.ts.map deleted file mode 100644 index ce10ef2ad..000000000 --- a/lib.commonjs/wordlists/decode-owl.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decode-owl.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owl.ts"],"names":[],"mappings":"AAuBA;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CA4BhE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAOrD"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/decode-owl.js b/lib.commonjs/wordlists/decode-owl.js deleted file mode 100644 index 9ee1c18b6..000000000 --- a/lib.commonjs/wordlists/decode-owl.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.decodeOwl = exports.decode = void 0; -const index_js_1 = require("../utils/index.js"); -const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; -const Word = /^[a-z]*$/i; -function unfold(words, sep) { - let initial = 97; - return words.reduce((accum, word) => { - if (word === sep) { - initial++; - } - else if (word.match(Word)) { - accum.push(String.fromCharCode(initial) + word); - } - else { - initial = 97; - accum.push(word); - } - return accum; - }, []); -} -/** - * @_ignore - */ -function decode(data, subs) { - // Replace all the substitutions with their expanded form - for (let i = subsChrs.length - 1; i >= 0; i--) { - data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); - } - // Get all tle clumps; each suffix, first-increment and second-increment - const clumps = []; - const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => { - if (semi) { - for (let i = parseInt(semi); i >= 0; i--) { - clumps.push(";"); - } - } - else { - clumps.push(item.toLowerCase()); - } - return ""; - }); - /* c8 ignore start */ - if (leftover) { - throw new Error(`leftovers: ${JSON.stringify(leftover)}`); - } - /* c8 ignore stop */ - return unfold(unfold(clumps, ";"), ":"); -} -exports.decode = decode; -/** - * @_ignore - */ -function decodeOwl(data) { - (0, index_js_1.assertArgument)(data[0] === "0", "unsupported auwl data", "data", data); - return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length)); -} -exports.decodeOwl = decodeOwl; -//# sourceMappingURL=decode-owl.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/decode-owl.js.map b/lib.commonjs/wordlists/decode-owl.js.map deleted file mode 100644 index 731a6bba5..000000000 --- a/lib.commonjs/wordlists/decode-owl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decode-owl.js","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owl.ts"],"names":[],"mappings":";;;AAAA,gDAAmD;AAEnD,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AACjD,MAAM,IAAI,GAAG,WAAW,CAAC;AAEzB,SAAS,MAAM,CAAC,KAAoB,EAAE,GAAW;IAC/C,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,OAAO,KAAK,CAAC,MAAM,CACjB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACd,IAAI,IAAI,KAAK,GAAG,EAAE;YAChB,OAAO,EAAE,CAAC;SACX;aAAM,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YAC3B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;SACjD;aAAM;YACL,OAAO,GAAG,EAAE,CAAC;YACb,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAClB;QACD,OAAO,KAAK,CAAC;IACf,CAAC,EACc,EAAE,CAClB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,MAAM,CAAC,IAAY,EAAE,IAAY;IAC/C,yDAAyD;IACzD,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QAC7C,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC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C;AACJ,CAAC;AAPD,8BAOC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/decode-owla.d.ts b/lib.commonjs/wordlists/decode-owla.d.ts deleted file mode 100644 index 479e6c54a..000000000 --- a/lib.commonjs/wordlists/decode-owla.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * @_ignore - */ -export declare function decodeOwlA(data: string, accents: string): Array; -//# sourceMappingURL=decode-owla.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/decode-owla.d.ts.map b/lib.commonjs/wordlists/decode-owla.d.ts.map deleted file mode 100644 index da8636365..000000000 --- a/lib.commonjs/wordlists/decode-owla.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decode-owla.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owla.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CA4BvE"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/decode-owla.js b/lib.commonjs/wordlists/decode-owla.js deleted file mode 100644 index 59dab2985..000000000 --- a/lib.commonjs/wordlists/decode-owla.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.decodeOwlA = void 0; -const index_js_1 = require("../utils/index.js"); -const bit_reader_js_1 = require("./bit-reader.js"); -const decode_owl_js_1 = require("./decode-owl.js"); -/** - * @_ignore - */ -function decodeOwlA(data, accents) { - let words = (0, decode_owl_js_1.decodeOwl)(data).join(","); - // Inject the accents - accents.split(/,/g).forEach((accent) => { - const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); - (0, index_js_1.assertArgument)(match !== null, "internal error parsing accents", "accents", accents); - let posOffset = 0; - const positions = (0, bit_reader_js_1.decodeBits)(parseInt(match[3]), match[4]); - const charCode = parseInt(match[2]); - const regex = new RegExp(`([${match[1]}])`, "g"); - words = words.replace(regex, (all, letter) => { - const rem = --positions[posOffset]; - if (rem === 0) { - letter = String.fromCharCode(letter.charCodeAt(0), charCode); - posOffset++; - } - return letter; - }); - }); - return words.split(","); -} -exports.decodeOwlA = decodeOwlA; -//# sourceMappingURL=decode-owla.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/decode-owla.js.map b/lib.commonjs/wordlists/decode-owla.js.map deleted file mode 100644 index e6eca1730..000000000 --- a/lib.commonjs/wordlists/decode-owla.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decode-owla.js","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owla.ts"],"names":[],"mappings":";;;AAAA,gDAAmD;AAEnD,mDAA6C;AAC7C,mDAA4C;AAE5C;;GAEG;AACH,SAAgB,UAAU,CAAC,IAAY,EAAE,OAAe;IACtD,IAAI,KAAK,GAAG,IAAA,yBAAS,EAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEtC,qBAAqB;IACrB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAC5D,IAAA,yBAAc,EACZ,KAAK,KAAK,IAAI,EACd,gCAAgC,EAChC,SAAS,EACT,OAAO,CACR,CAAC;QAEF,IAAI,SAAS,GAAG,CAAC,CAAC;QAClB,MAAM,SAAS,GAAG,IAAA,0BAAU,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACjD,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YAC3C,MAAM,GAAG,GAAG,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;YACnC,IAAI,GAAG,KAAK,CAAC,EAAE;gBACb,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;gBAC7D,SAAS,EAAE,CAAC;aACb;YACD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC;AA5BD,gCA4BC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/enwords.d.ts b/lib.commonjs/wordlists/enwords.d.ts deleted file mode 100644 index 8600e64a2..000000000 --- a/lib.commonjs/wordlists/enwords.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const enWords = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; -//# sourceMappingURL=enwords.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/enwords.d.ts.map b/lib.commonjs/wordlists/enwords.d.ts.map deleted file mode 100644 index 95d94c6d6..000000000 --- a/lib.commonjs/wordlists/enwords.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"enwords.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/enwords.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,i0VAC4yV,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/enwords.js b/lib.commonjs/wordlists/enwords.js deleted file mode 100644 index 29672cf0e..000000000 --- a/lib.commonjs/wordlists/enwords.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.enWords = void 0; -exports.enWords = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; -//# sourceMappingURL=enwords.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/enwords.js.map b/lib.commonjs/wordlists/enwords.js.map deleted file mode 100644 index 854fe5937..000000000 --- a/lib.commonjs/wordlists/enwords.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"enwords.js","sourceRoot":"","sources":["../../src.ts/wordlists/enwords.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAClB,8zVAA8zV,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/generation/encode-latin.d.ts b/lib.commonjs/wordlists/generation/encode-latin.d.ts deleted file mode 100644 index a646e8246..000000000 --- a/lib.commonjs/wordlists/generation/encode-latin.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export declare class BitWriter { - #private; - readonly width: number; - constructor(width: number); - write(value: number): void; - get length(): number; - get data(): string; -} -export interface AccentSet { - accent: number; - follows: string; - positions: Array; - positionsLength: number; - positionData: string; - positionDataLength: number; -} -export declare function extractAccents(words: Array): { - accents: Array; - words: Array; -}; -export declare function encodeOwl(words: Array): { - subs: string; - data: string; -}; -//# sourceMappingURL=encode-latin.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/generation/encode-latin.d.ts.map b/lib.commonjs/wordlists/generation/encode-latin.d.ts.map deleted file mode 100644 index 87eca3714..000000000 --- a/lib.commonjs/wordlists/generation/encode-latin.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encode-latin.d.ts","sourceRoot":"","sources":["../../../src.ts/wordlists/generation/encode-latin.ts"],"names":[],"mappings":"AAyIA,qBAAa,SAAS;;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAKX,KAAK,EAAE,MAAM;IAMzB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAW1B,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,IAAI,IAAI,MAAM,CA8BjB;CACF;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAWD,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;IACpD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB,CA+FA;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAmDA"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/generation/encode-latin.js b/lib.commonjs/wordlists/generation/encode-latin.js deleted file mode 100644 index 23f41af88..000000000 --- a/lib.commonjs/wordlists/generation/encode-latin.js +++ /dev/null @@ -1,364 +0,0 @@ -"use strict"; -// OWL Data Format -// -// The Official WordList data format exported by this encoder -// encodes sorted latin-1 words (letters only) based on the -// fact that sorted words have prefixes with substantial -// overlap. -// -// For example, the words: -// [ Another, Apple, Apricot, Bread ] -// could be folded once with a single special character, such -// as ":" to yield: -// [ nother, pple, pricot, :, read ]. -// The First letter has been removed, but can be inferred by -// starting at A and incrementing to the next letter when ":" -// is encountered. -// -// The fold operation can be repeated for large sets as even within -// each folded set, there is substatial overlap in prefix. With the -// second special symbol ";", we get: -// [ ; x 13, other, :, ple, ricot, :, ; x 18, ead ] -// which can be further compressed by using numbers instead of the -// special character: -// [ 13, other, :, ple, ricot, :, 18, ead ] -// and to keep all values within a single byte, we only allow a -// maximum value of 10 (using 0 through 9 to represent 1 through 10), -// we get: -// [ 9, 2, other, :, ple, ricot, :, 9, 7, ead ] -// and we use camel-case to imply the bounrary, giving the final string: -// "92Other:PleRicot:97Ead" -// -// Once the entire latin-1 set has been collapsed, we use the remaining -// printable characters (except " and \, which require 2 bytes to represent -// in string) to substiture for the most common 2-letter pairs of letters -// in the string. -// -// OWLA Accent Format -// -// OWLA first removes all accents, and encodes that data using the OWL -// data format and encodes the accents as a base-64 series of 6-bit -// packed bits representing the distance from one followed letter to the -// next. -// -// For example, the acute accent in a given language may follow either -// a or e, in which case the follow-set is "ae". Each letter in the entire -// set is indexed, so the set of words with the accents: -// "thisA/ppleDoe/sNotMa/tterToMe/" -// " 1^ 2^ 3^ 4^ 5^ 6^ " <-- follow-set members, ALL a's and e's -// which gives the positions: -// [ 0, 2, 3, 4, 6 ] -// which then reduce to the distances -// [ 0, 2, 1, 1, 2 ] -// each of which fit into a 2-bit value, so this can be encoded as the -// base-64 encoded string: -// 00 10 01 01 10 = 001001 1010xx -// -// The base-64 set used has all number replaced with their -// shifted-counterparts to prevent comflicting with the numbers used in -// the fold operation to indicate the number of ";". -Object.defineProperty(exports, "__esModule", { value: true }); -exports.encodeOwl = exports.extractAccents = exports.BitWriter = void 0; -const tslib_1 = require("tslib"); -const fs_1 = tslib_1.__importDefault(require("fs")); -const id_js_1 = require("../../hash/id.js"); -const decode_owl_js_1 = require("../decode-owl.js"); -const decode_owla_js_1 = require("../decode-owla.js"); -const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; -const Word = /^[a-z'`]*$/i; -function fold(words, sep) { - const output = []; - let initial = 97; - for (const word of words) { - if (word.match(Word)) { - while (initial < word.charCodeAt(0)) { - initial++; - output.push(sep); - } - output.push(word.substring(1)); - } - else { - initial = 97; - output.push(word); - } - } - return output; -} -function camelcase(words) { - return words - .map((word) => { - if (word.match(Word)) { - return word[0].toUpperCase() + word.substring(1); - } - else { - return word; - } - }) - .join(""); -} -//let cc = 0, ce = 0; -/* -function getChar(c: string): string { - //if (c === "e") { ce++; } - if (c >= 'a' && c <= 'z') { return c; } - if (c.charCodeAt(1)) { - throw new Error(`bad char: "${ c }"`); - } - //cc++; - return ""; - if (c.charCodeAt(0) === 768) { return "`"; } - if (c.charCodeAt(0) === 769) { return "'"; } - if (c.charCodeAt(0) === 771) { return "~"; } - throw new Error(`Unsupported character: ${ c } (${ c.charCodeAt(0) }, ${ c.charCodeAt(1) })`); -} -function mangle(text: string): { word: string, special: string } { - const result: Array = [ ]; - for (let i = 0; i < text.length; i++) { - const c = getChar(text[i]); - result.push(c); - } - - const word = result.join(""); - if (word[1] >= 'a' && word[1] <= 'z') { return { word, special: " " }; } - return { word: word[0] + word.substring(2), special: word[1] }; -} -*/ -/* - Store: [ accent ][ targets ][ rle data; base64-tail ] - ` ae 3, 100 = (63, 37), 15 - ~ n 63, 64 = (63, 1), 27 -*/ -const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; -class BitWriter { - width; - #data; - #bitLength; - constructor(width) { - this.width = width; - this.#data = []; - this.#bitLength = 0; - } - write(value) { - const maxValue = (1 << this.width) - 1; - while (value > maxValue) { - this.#data.push(0); - this.#bitLength += this.width; - value -= maxValue; - } - this.#data.push(value); - this.#bitLength += this.width; - } - get length() { - return 1 + Math.trunc((this.#bitLength + 5) / 6); - } - get data() { - let result = String(this.width); - let bits = 0; - let accum = 0; - const data = this.#data.slice(); - let bitMod = this.#bitLength % 6; - while (bitMod !== 0 && bitMod < 6) { - data.push(0); - bitMod += this.width; - } - for (const value of data) { - accum <<= this.width; - accum |= value; - bits += this.width; - if (bits < 6) { - continue; - } - result += Base64[accum >> (bits - 6)]; - bits -= 6; - accum &= (1 << bits) - 1; - } - if (result.length !== this.length) { - throw new Error(`Hmm: ${this.length} ${result.length} ${result}`); - } - return result; - } -} -exports.BitWriter = BitWriter; -function sorted(text) { - const letters = text.split(""); - letters.sort(); - return letters.join(""); -} -// if (c.charCodeAt(0) === 768) { return "`"; } -// if (c.charCodeAt(0) === 769) { return "'"; } -// if (c.charCodeAt(0) === 771) { return "~"; } -function extractAccents(words) { - // Build a list that maps accents to the letters it can follow - const followsMap = new Map(); - for (const word of words) { - for (let i = 0; i < word.length; i++) { - const c = word[i]; - if (c >= "a" && c <= "z") { - continue; - } - // Make sure this positions and codepoint make sense - if (c.charCodeAt(1)) { - throw new Error(`unsupported codepoint: "${c}"`); - } - if (i === 0) { - throw new Error(`unmatched accent: ${c}`); - } - const ac = c.charCodeAt(0), lastLetter = word[i - 1]; - const follows = followsMap.get(ac) || ""; - if (follows.indexOf(lastLetter) === -1) { - followsMap.set(ac, sorted(follows + lastLetter)); - } - } - } - // Build the positions of each follow-set for those accents - const positionsMap = new Map(); - for (const [accent, follows] of followsMap) { - let count = 0; - for (const word of words) { - for (let i = 0; i < word.length; i++) { - const c = word[i], ac = c.charCodeAt(0); - if (follows.indexOf(c) >= 0) { - count++; - } - if (ac === accent) { - const pos = positionsMap.get(ac) || []; - pos.push(count); - positionsMap.set(ac, pos); - } - } - } - } - const accents = []; - for (const [accent, follows] of followsMap) { - let last = -1; - const positions = (positionsMap.get(accent) || []).map((value, index) => { - const delta = value - last; - last = value; - if (index === 0) { - return value; - } - return delta; - }); - // Find the best encoding of the position data - let positionData = ""; - for (let i = 2; i < 7; i++) { - const bitWriter = new BitWriter(i); - for (const p of positions) { - bitWriter.write(p); - } - if (positionData === "" || bitWriter.length < positionData.length) { - positionData = bitWriter.data; - } - } - const positionsLength = positions.length; - const positionDataLength = positionData.length; - accents.push({ - accent, - follows, - positions, - positionsLength, - positionData, - positionDataLength, - }); - } - words = words.map((word) => { - let result = ""; - for (let i = 0; i < word.length; i++) { - const c = word[i]; - if (c >= "a" && c <= "z") { - result += c; - } - } - return result; - }); - return { accents, words }; -} -exports.extractAccents = extractAccents; -// Encode Official WordList -function encodeOwl(words) { - // Fold the sorted words by indicating delta for the first 2 letters - let data = camelcase(fold(fold(words, ":"), ";")); - // Replace semicolons with counts (e.g. ";;;" with "3") - data = data.replace(/(;+)/g, (all, semis) => { - let result = ""; - while (semis.length) { - let count = semis.length; - if (count > 10) { - count = 10; - } - result += String(count - 1); - semis = semis.substring(count); - } - return result; - }); - // Finds the best option for a shortcut replacement using the - // unused ascii7 characters - function findBest() { - const tally = {}; - const l = 2; - for (let i = l; i < data.length; i++) { - const key = data.substring(i - l, i); - tally[key] = (tally[key] || 0) + 1; - } - const sorted = Object.keys(tally).map((text) => { - return { - text, - count: tally[text], - save: tally[text] * (text.length - 1), - }; - }); - sorted.sort((a, b) => b.save - a.save); - return sorted[0].text; - } - // Make substitutions - let subs = ""; - for (let i = 0; i < subsChrs.length; i++) { - const n = subsChrs[i], o = findBest(); - subs += o; - data = data.split(o).join(n); - } - return { data, subs }; -} -exports.encodeOwl = encodeOwl; -// Returns either: -// - OWL data for accent-free latin-1: { data, accentds: "" } -// - OWLA data for accented latin-1: { data, accents } -function encodeWords(_words) { - const { accents, words } = extractAccents(_words); - const { data, subs } = encodeOwl(words); - const accentData = accents - .map(({ accent, follows, positionData }) => { - return `${follows}${accent}${positionData}`; - }) - .join(","); - return { - data: `0${subs}${data}`, - accents: accentData, - }; -} -// CLI -const content = fs_1.default.readFileSync(process.argv[2]).toString(); -const words = content.split("\n").filter(Boolean); -const { data, accents } = encodeWords(words); -if (accents) { - const rec = (0, decode_owla_js_1.decodeOwlA)(data, accents); - console.log("DATA: ", JSON.stringify(data)); - console.log("ACCENTS: ", JSON.stringify(accents)); - console.log("LENGTH: ", data.length); - console.log("CHECKSUM: ", (0, id_js_1.id)(content)); - console.log("RATIO: ", Math.trunc((100 * data.length) / content.length) + "%"); - if (rec.join("\n") !== words.join("\n")) { - throw new Error("no match!"); - } -} -else { - const rec = (0, decode_owl_js_1.decodeOwl)(data); - console.log("DATA: ", JSON.stringify(data)); - console.log("LENGTH: ", data.length); - console.log("CHECKSUM: ", (0, id_js_1.id)(content)); - console.log("RATIO: ", Math.trunc((100 * data.length) / content.length) + "%"); - if (rec.join("\n") !== words.join("\n")) { - throw new Error("no match!"); - } -} -//# sourceMappingURL=encode-latin.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/generation/encode-latin.js.map b/lib.commonjs/wordlists/generation/encode-latin.js.map deleted file mode 100644 index 1f75bb288..000000000 --- a/lib.commonjs/wordlists/generation/encode-latin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encode-latin.js","sourceRoot":"","sources":["../../../src.ts/wordlists/generation/encode-latin.ts"],"names":[],"mappings":";AAAA,kBAAkB;AAClB,EAAE;AACF,6DAA6D;AAC7D,2DAA2D;AAC3D,wDAAwD;AACxD,WAAW;AACX,EAAE;AACF,0BAA0B;AAC1B,uCAAuC;AACvC,6DAA6D;AAC7D,mBAAmB;AACnB,uCAAuC;AACvC,4DAA4D;AAC5D,6DAA6D;AAC7D,kBAAkB;AAClB,EAAE;AACF,mEAAmE;AACnE,mEAAmE;AACnE,qCAAqC;AACrC,qDA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,CAAC,GAAG,CACT,YAAY,EACZ,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,CACvD,CAAC;IACF,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;KAC9B;CACF"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/index.d.ts b/lib.commonjs/wordlists/index.d.ts deleted file mode 100644 index 04a911c83..000000000 --- a/lib.commonjs/wordlists/index.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * A Wordlist is a set of 2048 words used to encode private keys - * (or other binary data) that is easier for humans to write down, - * transcribe and dictate. - * - * The [[link-bip-39]] standard includes several checksum bits, - * depending on the size of the mnemonic phrase. - * - * A mnemonic phrase may be 12, 15, 18, 21 or 24 words long. For - * most purposes 12 word mnemonics should be used, as including - * additional words increases the difficulty and potential for - * mistakes and does not offer any effective improvement on security. - * - * There are a variety of [[link-bip39-wordlists]] for different - * languages, but for maximal compatibility, the - * [English Wordlist](LangEn) is recommended. - * - * @_section: api/wordlists:Wordlists [about-wordlists] - */ -export { Wordlist } from "./wordlist.js"; -export { LangEn } from "./lang-en.js"; -export { WordlistOwl } from "./wordlist-owl.js"; -export { WordlistOwlA } from "./wordlist-owla.js"; -export { wordlists } from "./wordlists.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/index.d.ts.map b/lib.commonjs/wordlists/index.d.ts.map deleted file mode 100644 index ecd1d4b63..000000000 --- a/lib.commonjs/wordlists/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/index.js b/lib.commonjs/wordlists/index.js deleted file mode 100644 index 26e29cf5f..000000000 --- a/lib.commonjs/wordlists/index.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.wordlists = exports.WordlistOwlA = exports.WordlistOwl = exports.LangEn = exports.Wordlist = void 0; -/** - * A Wordlist is a set of 2048 words used to encode private keys - * (or other binary data) that is easier for humans to write down, - * transcribe and dictate. - * - * The [[link-bip-39]] standard includes several checksum bits, - * depending on the size of the mnemonic phrase. - * - * A mnemonic phrase may be 12, 15, 18, 21 or 24 words long. For - * most purposes 12 word mnemonics should be used, as including - * additional words increases the difficulty and potential for - * mistakes and does not offer any effective improvement on security. - * - * There are a variety of [[link-bip39-wordlists]] for different - * languages, but for maximal compatibility, the - * [English Wordlist](LangEn) is recommended. - * - * @_section: api/wordlists:Wordlists [about-wordlists] - */ -var wordlist_js_1 = require("./wordlist.js"); -Object.defineProperty(exports, "Wordlist", { enumerable: true, get: function () { return wordlist_js_1.Wordlist; } }); -var lang_en_js_1 = require("./lang-en.js"); -Object.defineProperty(exports, "LangEn", { enumerable: true, get: function () { return lang_en_js_1.LangEn; } }); -var wordlist_owl_js_1 = require("./wordlist-owl.js"); -Object.defineProperty(exports, "WordlistOwl", { enumerable: true, get: function () { return wordlist_owl_js_1.WordlistOwl; } }); -var wordlist_owla_js_1 = require("./wordlist-owla.js"); -Object.defineProperty(exports, "WordlistOwlA", { enumerable: true, get: function () { return wordlist_owla_js_1.WordlistOwlA; } }); -var wordlists_js_1 = require("./wordlists.js"); -Object.defineProperty(exports, "wordlists", { enumerable: true, get: function () { return wordlists_js_1.wordlists; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/index.js.map b/lib.commonjs/wordlists/index.js.map deleted file mode 100644 index fe47560b2..000000000 --- a/lib.commonjs/wordlists/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/wordlists/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,6CAAyC;AAAhC,uGAAA,QAAQ,OAAA;AACjB,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AAEf,qDAAgD;AAAvC,8GAAA,WAAW,OAAA;AACpB,uDAAkD;AAAzC,gHAAA,YAAY,OAAA;AAErB,+CAA2C;AAAlC,yGAAA,SAAS,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-cz.d.ts b/lib.commonjs/wordlists/lang-cz.d.ts deleted file mode 100644 index c199d4fad..000000000 --- a/lib.commonjs/wordlists/lang-cz.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -/** - * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangCz extends WordlistOwl { - /** - * Creates a new instance of the Czech language Wordlist. - * - * Using the constructor should be unnecessary, instead use the - * [[wordlist]] singleton method. - * - * @_ignore: - */ - constructor(); - /** - * Returns a singleton instance of a ``LangCz``, creating it - * if this is the first time being called. - */ - static wordlist(): LangCz; -} -//# sourceMappingURL=lang-cz.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-cz.d.ts.map b/lib.commonjs/wordlists/lang-cz.d.ts.map deleted file mode 100644 index 0db7b336b..000000000 --- a/lib.commonjs/wordlists/lang-cz.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-cz.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-cz.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;OAOG;;IAKH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-cz.js b/lib.commonjs/wordlists/lang-cz.js deleted file mode 100644 index 89f71c683..000000000 --- a/lib.commonjs/wordlists/lang-cz.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LangCz = void 0; -const wordlist_owl_js_1 = require("./wordlist-owl.js"); -const words = "0itatkastcenaovo$taouleraeki&chor*teci%enbalodaeladet'!Chn=0Di#%E%^1Resa2Rese3CeT'#0EjKohol0Pu)%0A&sDul#Ekdo)Ke)Ti#Ul|3}aOgan%0FaltI$@tPi,%TmaTronom0LasL{i#Ol0Tobus4Yl:B#}R'?TaUb_U/!U^U+Ur!Xer2A^v#Ambo,An#AtrEp)Ike)KoLohOnzOskevUn{#Usin#Z^Zy2Bl.Bn|})D _D#D'aF{Jar(Kv?LdokLvaN^NkrRzaTikVolZola3D+tL.T'#0Ukot:PartRev&3DrDu+J/JnLaLerLkemLn?N.Nn(N'#NtrumNzZ(2O&2KolivUv!4It_N(0Dn(Ke)KrPot0Ak~AlIkRkot2Kli$a:L-oRe[T_Tum1E,1B!a}'#Cib_Fic Fla%KlKr{Mokr!PreseRbyS#T-tiv3Kob,zKt|O^P]mSkSp+jV`]Vo/2AhaOuhoUhopis1Es0BroByt-C@t}ut DnesH+dHo^H,JemJn?Kl`KolaKtAzeDolObn(OgerieOzdSn(T Z(2B@}'noD-HaH'#S SnoT(0Oj?Or>2Nam :9O]gOnomie0EktronIpsa0AilIseO%P!ie2Izo^O/aOpejOs2EjEn%K<)Kymo0Ike)0FR&S]Zky3StOhOup(T!Ub.U/o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0DaDiv(Doz&kD$voJ@skyJ&JskoLantL[L LnoSk'#Zid]Z'&0Ravo1Ab>A%tAhA)Ba}o+kH!StvaTu+0Ad T*p Tup0Ip4Bav Br!}|D!D,Fot H+d!H~Hod H,d Hub Jasn J{Jm=K]p Kon!L-!Maz!Mez Miz{Mys+tNe/!Nik!Nut P`!Pl! P,v Pu$ Raz R'n!Rv!Sl' SokoS)v Su~Syp!Tas Tes!Tr! Vi~Vol!Vrh_Zdob Zn!0AduBud }op DJ{Ji$ K+p!K*p Lep Mez Mot!Mys+tNe/!Nik!Pl! Poj Ps!Raz S)v Su~Taj Temn Tk~Ujm=Val Ve+tVin Vol!Vrt!Zvon 0Av RusuUd|Yt-1A+#ArmaAtn(IvoOb RojVihYm`]0L@.ManM.Pt!Z`uZdola2At Lt~Lubo#Ot' Ru[0MaMn?0Emn 0Lam!Oum!R!#Umav#0AtoEh#O[OmO$Ozvyk0Ap|ArAt-IjeIz{Ocn Odr!Rzl.Ut|0AkAl(Am@!Ovu0B,z Tav Ub-Ufa+0Lod Omal RavaR( Rud#Rvu1A^An C`]N (NoOv&Y/l Zav(1I/aR! 0B'.Br0Ed~EnkuEs_aOnR!Uk'odYk"; -const checksum = "0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a"; -let wordlist = null; -/** - * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -class LangCz extends wordlist_owl_js_1.WordlistOwl { - /** - * Creates a new instance of the Czech language Wordlist. - * - * Using the constructor should be unnecessary, instead use the - * [[wordlist]] singleton method. - * - * @_ignore: - */ - constructor() { - super("cz", words, checksum); - } - /** - * Returns a singleton instance of a ``LangCz``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist == null) { - wordlist = new LangCz(); - } - return wordlist; - } -} -exports.LangCz = LangCz; -//# sourceMappingURL=lang-cz.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-cz.js.map b/lib.commonjs/wordlists/lang-cz.js.map deleted file mode 100644 index 5a2cb0aae..000000000 --- a/lib.commonjs/wordlists/lang-cz.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-cz.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-cz.ts"],"names":[],"mappings":";;;AAAA,uDAAgD;AAEhD,MAAM,KAAK,GACT,q9NAAq9N,CAAC;AACx9N,MAAM,QAAQ,GACZ,oEAAoE,CAAC;AAEvE,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAa,MAAO,SAAQ,6BAAW;IACrC;;;;;;;OAOG;IACH;QACE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACb,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SACzB;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAvBD,wBAuBC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-en.d.ts b/lib.commonjs/wordlists/lang-en.d.ts deleted file mode 100644 index 87a3234bb..000000000 --- a/lib.commonjs/wordlists/lang-en.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -/** - * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangEn extends WordlistOwl { - /** - * Creates a new instance of the English language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langEn]] should suffice. - * - * @_ignore: - */ - constructor(); - /** - * Returns a singleton instance of a ``LangEn``, creating it - * if this is the first time being called. - */ - static wordlist(): LangEn; -} -//# sourceMappingURL=lang-en.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-en.d.ts.map b/lib.commonjs/wordlists/lang-en.d.ts.map deleted file mode 100644 index c43c99b64..000000000 --- a/lib.commonjs/wordlists/lang-en.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-en.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-en.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;OAOG;;IAKH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-en.js b/lib.commonjs/wordlists/lang-en.js deleted file mode 100644 index 960dc39b9..000000000 --- a/lib.commonjs/wordlists/lang-en.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LangEn = void 0; -const wordlist_owl_js_1 = require("./wordlist-owl.js"); -const words = "0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gSh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/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurEAyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO"; -const checksum = "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"; -let wordlist = null; -/** - * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -class LangEn extends wordlist_owl_js_1.WordlistOwl { - /** - * Creates a new instance of the English language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langEn]] should suffice. - * - * @_ignore: - */ - constructor() { - super("en", words, checksum); - } - /** - * Returns a singleton instance of a ``LangEn``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist == null) { - wordlist = new LangEn(); - } - return wordlist; - } -} -exports.LangEn = LangEn; -//# sourceMappingURL=lang-en.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-en.js.map b/lib.commonjs/wordlists/lang-en.js.map deleted file mode 100644 index 4d36d6979..000000000 --- a/lib.commonjs/wordlists/lang-en.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-en.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-en.ts"],"names":[],"mappings":";;;AAAA,uDAAgD;AAEhD,MAAM,KAAK,GACT,u3LAAu3L,CAAC;AAC13L,MAAM,QAAQ,GACZ,oEAAoE,CAAC;AAEvE,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAa,MAAO,SAAQ,6BAAW;IACrC;;;;;;;OAOG;IACH;QACE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACb,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SACzB;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAvBD,wBAuBC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-es.d.ts b/lib.commonjs/wordlists/lang-es.d.ts deleted file mode 100644 index 7e51683e7..000000000 --- a/lib.commonjs/wordlists/lang-es.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { WordlistOwlA } from "./wordlist-owla.js"; -/** - * The [[link-bip39-es]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangEs extends WordlistOwlA { - /** - * Creates a new instance of the Spanish language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langEs]] should suffice. - * - * @_ignore: - */ - constructor(); - /** - * Returns a singleton instance of a ``LangEs``, creating it - * if this is the first time being called. - */ - static wordlist(): LangEs; -} -//# sourceMappingURL=lang-es.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-es.d.ts.map b/lib.commonjs/wordlists/lang-es.d.ts.map deleted file mode 100644 index 1f4b7bb34..000000000 --- a/lib.commonjs/wordlists/lang-es.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-es.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-es.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAWlD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,YAAY;IACtC;;;;;;;OAOG;;IAKH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-es.js b/lib.commonjs/wordlists/lang-es.js deleted file mode 100644 index be6decdb1..000000000 --- a/lib.commonjs/wordlists/lang-es.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LangEs = void 0; -const wordlist_owla_js_1 = require("./wordlist-owla.js"); -const words = "0arertoiotadonoaRteirroenaNonaLsolocoiliaralaorrenadaChoN$n0A>Dom,EjaI!#Oga&O'Or#RazoR*Ue=U<0Ab Adem@CeLe%OmoRa!RozUn0DazD$GeLaM,#S,)T^0AlAnceA+EEl]`E`EstruzI.I<2ErU{U'0Af[nArO)Uc Uf_Ul:BaB^|eH@IleJ Lanz/c.LdeMbuN>Nd-oRb(>RnizR+Scu]S#nSu[Tal]T!@T*Tu%UlZ 3BeBid/=S SoSt@3|oEnNgo2An>OqueUsa2ABi`BoCaCi`DaDegaIn//!oLsaMb-{dNi#N}saiRdeRr SqueTeTinVe{Zal2AvoAzoEchaEveIl=In>IsaOcaOmaOnceO)UjaUs>U#2CeoCleE'EyFan{F.HoIt_L#Rbuj(l(+Sc TacaZ.:Bal=BezaBi`B[CaoDav!D,aErFeI{ImanJaJ.LLam Lc$L&Li{dLleLm/^LvoMaMb$Mel=Mi'Mp}c!Nd?Nel-gu+Nic-#N-.ObaOsPazPi%nPo)Pt Puch((b.RcelRe%Rg(i'RneRpe%R+R%SaS>S!oSpaS#rT^ceT_U{lUsaZo3Bol]D!D+Ld/eb_LoAmpuAnc]ApaAr]I>Is)IvoOqueOzaUle%Up 0Cl.EgoE=EnEr#F[G +M->NeN%P_sR>Rue]SneTaU{d2Am^AnA+AseAveI,)ImaInica2B_Cc~|i'Ci`CoDigoDoF_G!He)JinJoL/ch/eg$Lg Lin/l LmoLum`Mba)M!Mi{Mo&Mpr-deNej}g-oc!Nsej}t PaPi(az.Rba%RchoR&nR.(r!S!SmosS%2AneoAt!E Ec!Ei&EmaIaIm,Ip%IsisOmoOnicaOque%U&Uz2Ad+Ar#At+BoBr*| aEl=En#Er{Es%EvaId Lebr/p/#Mb_Mpl*N-e%O%P.Pul( R$Se'Sf[zVaVi'5BleCeL^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om/p NNalNi>Nt!-ue=PaPelP?]Que)R Rcel(edR*RoRpa&RqueR[foR)S SeoS~SoS%TaT$Tr@UsaU%VoYa<3A#nCa&C!a|oDalD*G IneL L{'Le/ig+LlejoLoLuc--s N.OnOrPi'Que'R(ch(d!Rez(f?Ri>Rl(mizEgun%Em$EnsaE|!oD^Eb=Er%Es#Lg/*Lm.LpoLrNd*N%P #Pet*PoN{PaP!oSaScaSt+T 5BiB^DoE{G*I&In/e%LoMboM^Ptu[TaTi`:Ba&B!B$BleC GazG[&L/&L!oL*Lm.L.Ls/#LudLv Mb-c~Ndi-e Ng_Ni{dN}#PoQueRdin()nSt_TanU`Xof.3Cc~CoC_#C%DGu*IsL=LvaMa`M?l-d-Re'Rg*S#T?:Ba>BiqueB]BuCoC#JoL L>L,#Ll/.Ma'Mb^Ng}quePaPe)P@P.Qu?l(deRe(if(je%RotR+R%TuajeU+ZaZ.3At+|oC]CnicaJa&J!Ji&L/efo'MaM^Mp=NazNd!N!NisNRmi'Rnur(+rSisSo+StigoT!aX#Z3B$Bu+nEmpoEn{Er[EPoR(.TanT!eTu=Za5Al]B?=C Ci'DoG/&M N}#P PeQueRaxR!oRm,%RneoRoRpe&R_RS!Xi>2AbajoAc#rA!Afi>AgoAjeAmoAnceA#AumaAz EbolEguaEin%EnEp EsIbuIgoIpaIs)IunfoOfeoOmpaOn>OpaO)OzoU>Ue'Ufa2B!@BoEr#MbaM^NelNic(bin(ismoR'T^:0Ic 9C!a0B[l0I{dIrIv!; - join(words: Array): string; - /** - * Returns a singleton instance of a ``LangJa``, creating it - * if this is the first time being called. - */ - static wordlist(): LangJa; -} -//# sourceMappingURL=lang-ja.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-ja.d.ts.map b/lib.commonjs/wordlists/lang-ja.d.ts.map deleted file mode 100644 index f4acbfdf3..000000000 --- a/lib.commonjs/wordlists/lang-ja.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-ja.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ja.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA6IzC;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAClC;;;;;;;OAOG;;IAKH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAW9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAKpC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIlC;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-ja.js b/lib.commonjs/wordlists/lang-ja.js deleted file mode 100644 index 288ec3a6d..000000000 --- a/lib.commonjs/wordlists/lang-ja.js +++ /dev/null @@ -1,161 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LangJa = void 0; -const index_js_1 = require("../hash/index.js"); -const index_js_2 = require("../utils/index.js"); -const wordlist_js_1 = require("./wordlist.js"); -const data = [ - // 4-kana words - "AQRASRAGBAGUAIRAHBAghAURAdBAdcAnoAMEAFBAFCBKFBQRBSFBCXBCDBCHBGFBEQBpBBpQBIkBHNBeOBgFBVCBhBBhNBmOBmRBiHBiFBUFBZDBvFBsXBkFBlcBjYBwDBMBBTBBTRBWBBWXXaQXaRXQWXSRXCFXYBXpHXOQXHRXhRXuRXmXXbRXlXXwDXTRXrCXWQXWGaBWaKcaYgasFadQalmaMBacAKaRKKBKKXKKjKQRKDRKCYKCRKIDKeVKHcKlXKjHKrYNAHNBWNaRNKcNIBNIONmXNsXNdXNnBNMBNRBNrXNWDNWMNFOQABQAHQBrQXBQXFQaRQKXQKDQKOQKFQNBQNDQQgQCXQCDQGBQGDQGdQYXQpBQpQQpHQLXQHuQgB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DJBVRuscisciJBiJBieUtqXiJFDJkiFsJXQUGEZJcUJFsJXZtXIrXZDZJDrZJFNJDZJFstXvJFQqXvJFCJEsJXQJqkhkNGBbDJdTRbYJMEBlDwXUJMEFiJFcfXNJDRcNJWMTBLJXC", - // 8-kana words - "BraFUtHBFSJFdbNBLJXVJQoYJNEBSJBEJfHSJHwXUJCJdAZJMGjaFVJXEJPNJBlEJfFiJFpFbFEJqIJBVJCrIBdHiJhOPFChvJVJZJNJWxGFNIFLueIBQJqUHEJfUFstOZJDrlXEASJRlXVJXSFwVJNJWD", - // 9-kana words - "QJEJNNJDQJEJIBSFQJEJxegBQJEJfHEPSJBmXEJFSJCDEJqXLXNJFQqXIcQsFNJFIFEJqXUJgFsJXIJBUJEJfHNFvJxEqXNJnXUJFQqD", - // 10-kana words - "IJBEJqXZJ", -]; -// Maps each character into its kana value (the index) -const mapping = "~~AzB~X~a~KN~Q~D~S~C~G~E~Y~p~L~I~O~eH~g~V~hxyumi~~U~~Z~~v~~s~~dkoblPjfnqwMcRTr~W~~~F~~~~~Jt"; -let _wordlist = null; -function hex(word) { - return (0, index_js_2.hexlify)((0, index_js_2.toUtf8Bytes)(word)); -} -const KiYoKu = "0xe3818de38284e3818f"; -const KyoKu = "0xe3818de38283e3818f"; -function toString(data) { - return (0, index_js_2.toUtf8String)(new Uint8Array(data)); -} -function loadWords() { - if (_wordlist !== null) { - return _wordlist; - } - const wordlist = []; - // Transforms for normalizing (sort is a not quite UTF-8) - const transform = {}; - // Delete the diacritic marks - transform[toString([227, 130, 154])] = false; - transform[toString([227, 130, 153])] = false; - // Some simple transforms that sort out most of the order - transform[toString([227, 130, 133])] = toString([227, 130, 134]); - transform[toString([227, 129, 163])] = toString([227, 129, 164]); - transform[toString([227, 130, 131])] = toString([227, 130, 132]); - transform[toString([227, 130, 135])] = toString([227, 130, 136]); - // Normalize words using the transform - function normalize(word) { - let result = ""; - for (let i = 0; i < word.length; i++) { - let kana = word[i]; - const target = transform[kana]; - if (target === false) { - continue; - } - if (target) { - kana = target; - } - result += kana; - } - return result; - } - // Sort how the Japanese list is sorted - function sortJapanese(a, b) { - a = normalize(a); - b = normalize(b); - if (a < b) { - return -1; - } - if (a > b) { - return 1; - } - return 0; - } - // Load all the words - for (let length = 3; length <= 9; length++) { - const d = data[length - 3]; - for (let offset = 0; offset < d.length; offset += length) { - const word = []; - for (let i = 0; i < length; i++) { - const k = mapping.indexOf(d[offset + i]); - word.push(227); - word.push(k & 0x40 ? 130 : 129); - word.push((k & 0x3f) + 128); - } - wordlist.push(toString(word)); - } - } - wordlist.sort(sortJapanese); - // For some reason kyoku and kiyoku are flipped in node (!!). - // The order SHOULD be: - // - kyoku - // - kiyoku - // This should ignore "if", but that doesn't work here?? - /* c8 ignore start */ - if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) { - const tmp = wordlist[442]; - wordlist[442] = wordlist[443]; - wordlist[443] = tmp; - } - /* c8 ignore stop */ - // Verify the computed list matches the official list - /* istanbul ignore if */ - const checksum = (0, index_js_1.id)(wordlist.join("\n") + "\n"); - /* c8 ignore start */ - if (checksum !== - "0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600") { - throw new Error("BIP39 Wordlist for ja (Japanese) FAILED"); - } - /* c8 ignore stop */ - _wordlist = wordlist; - return wordlist; -} -let wordlist = null; -/** - * The [[link-bip39-ja]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -class LangJa extends wordlist_js_1.Wordlist { - /** - * Creates a new instance of the Japanese language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langJa]] should suffice. - * - * @_ignore: - */ - constructor() { - super("ja"); - } - getWord(index) { - const words = loadWords(); - (0, index_js_2.assertArgument)(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); - return words[index]; - } - getWordIndex(word) { - return loadWords().indexOf(word); - } - split(phrase) { - //logger.assertNormalize(); - return phrase.split(/(?:\u3000| )+/g); - } - join(words) { - return words.join("\u3000"); - } - /** - * Returns a singleton instance of a ``LangJa``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist == null) { - wordlist = new LangJa(); - } - return wordlist; - } -} -exports.LangJa = LangJa; -//# sourceMappingURL=lang-ja.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-ja.js.map b/lib.commonjs/wordlists/lang-ja.js.map deleted file mode 100644 index 2d6d6b321..000000000 --- a/lib.commonjs/wordlists/lang-ja.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-ja.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ja.ts"],"names":[],"mappings":";;;AAAA,+CAAsC;AACtC,gDAK2B;AAE3B,+CAAyC;AAEzC,MAAM,IAAI,GAAG;IACX,eAAe;IACf,orEAAorE;IAEprE,eAAe;IACf,ssGAAssG;IAEtsG,eAAe;IACf,4uDAA4uD;IAE5uD,eAAe;IACf,olBAAolB;IAEplB,eAAe;IACf,4JAA4J;IAE5J,eAAe;IACf,0GAA0G;IAE1G,gBAAgB;IAChB,WAAW;CACZ,CAAC;AAEF,sDAAsD;AACtD,MAAM,OAAO,GACX,6FAA6F,CAAC;AAEhG,IAAI,SAAS,GAAyB,IAAI,CAAC;AAE3C,SAAS,GAAG,CAAC,IAAY;IACvB,OAAO,IAAA,kBAAO,EAAC,IAAA,sBAAW,EAAC,IAAI,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,MAAM,GAAG,sBAAsB,CAAC;AACtC,MAAM,KAAK,GAAG,sBAAsB,CAAC;AAErC,SAAS,QAAQ,CAAC,IAAmB;IACnC,OAAO,IAAA,uBAAY,EAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,SAAS;IAChB,IAAI,SAAS,KAAK,IAAI,EAAE;QACtB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,QAAQ,GAAG,EAAE,CAAC;IAEpB,yDAAyD;IACzD,MAAM,SAAS,GAAwC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AC;IAED,YAAY,CAAC,IAAY;QACvB,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,MAAc;QAClB,2BAA2B;QAC3B,OAAO,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,KAAoB;QACvB,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACb,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SACzB;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AA/CD,wBA+CC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-ko.d.ts b/lib.commonjs/wordlists/lang-ko.d.ts deleted file mode 100644 index 4329e0556..000000000 --- a/lib.commonjs/wordlists/lang-ko.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Wordlist } from "./wordlist.js"; -/** - * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangKo extends Wordlist { - /** - * Creates a new instance of the Korean language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langKo]] should suffice. - * - * @_ignore: - */ - constructor(); - getWord(index: number): string; - getWordIndex(word: string): number; - /** - * Returns a singleton instance of a ``LangKo``, creating it - * if this is the first time being called. - */ - static wordlist(): LangKo; -} -//# sourceMappingURL=lang-ko.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-ko.d.ts.map b/lib.commonjs/wordlists/lang-ko.d.ts.map deleted file mode 100644 index 8b8d34088..000000000 --- a/lib.commonjs/wordlists/lang-ko.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-ko.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ko.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAqEzC;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAClC;;;;;;;OAOG;;IAKH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAW9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-ko.js b/lib.commonjs/wordlists/lang-ko.js deleted file mode 100644 index e9ce19f26..000000000 --- a/lib.commonjs/wordlists/lang-ko.js +++ /dev/null @@ -1,94 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LangKo = void 0; -const index_js_1 = require("../hash/index.js"); -const index_js_2 = require("../utils/index.js"); -const wordlist_js_1 = require("./wordlist.js"); -const data = [ - "OYAa", - "ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMbAX3JTAX3QbAYLn3AZLgvAZrSUAZvAcAZ8AaAZ8AbAZ8AnAZ8HnAZ8LgAZ8MYAZ8MgAZ8OnAaAboAaDTrAaFTrAaJTrAaJboAaLVoAaMXvAaOl8AaSeoAbAUoAbAg8AbAl4AbGnrAbMT8AbMXrAbMn4AbQb8AbSV8AbvRlAb8AUAb8AnAb8HgAb8JTAb8NTAb8RbAcGboAcLnvAcMT8AcMX8AcSToAcrAaAcrFnAc8AbAc8MgAfGgrAfHboAfJnvAfLV8AfLkoAfMT8AfMnoAfQb8AfScrAfSgrAgAZ8AgFl3AgGX8AgHZvAgHgrAgJXoAgJX8AgJboAgLZoAgLn4AgOX8AgoATAgoAnAgoCUAgoJg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LMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; -function getHangul(code) { - if (code >= 40) { - code = code + 168 - 40; - } - else if (code >= 19) { - code = code + 97 - 19; - } - return (0, index_js_2.toUtf8String)(new Uint8Array([225, (code >> 6) + 132, (code & 0x3f) + 128])); -} -let _wordlist = null; -function loadWords() { - if (_wordlist != null) { - return _wordlist; - } - const wordlist = []; - data.forEach((data, length) => { - length += 4; - for (let i = 0; i < data.length; i += length) { - let word = ""; - for (let j = 0; j < length; j++) { - word += getHangul(codes.indexOf(data[i + j])); - } - wordlist.push(word); - } - }); - wordlist.sort(); - // Verify the computed list matches the official list - /* istanbul ignore if */ - const checksum = (0, index_js_1.id)(wordlist.join("\n") + "\n"); - /* c8 ignore start */ - if (checksum !== - "0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a") { - throw new Error("BIP39 Wordlist for ko (Korean) FAILED"); - } - /* c8 ignore stop */ - _wordlist = wordlist; - return wordlist; -} -let wordlist = null; -/** - * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -class LangKo extends wordlist_js_1.Wordlist { - /** - * Creates a new instance of the Korean language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langKo]] should suffice. - * - * @_ignore: - */ - constructor() { - super("ko"); - } - getWord(index) { - const words = loadWords(); - (0, index_js_2.assertArgument)(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); - return words[index]; - } - getWordIndex(word) { - return loadWords().indexOf(word); - } - /** - * Returns a singleton instance of a ``LangKo``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist == null) { - wordlist = new LangKo(); - } - return wordlist; - } -} -exports.LangKo = LangKo; -//# sourceMappingURL=lang-ko.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-ko.js.map b/lib.commonjs/wordlists/lang-ko.js.map deleted file mode 100644 index 00050a1a2..000000000 --- a/lib.commonjs/wordlists/lang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CAAC;IAClB,CAAC;CACF;AAtCD,wBAsCC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-pt.d.ts b/lib.commonjs/wordlists/lang-pt.d.ts deleted file mode 100644 index f218013c6..000000000 --- a/lib.commonjs/wordlists/lang-pt.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -/** - * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangPt extends WordlistOwl { - /** - * Creates a new instance of the Portuguese language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langPt]] should suffice. - * - * @_ignore: - */ - constructor(); - /** - * Returns a singleton instance of a ``LangPt``, creating it - * if this is the first time being called. - */ - static wordlist(): LangPt; -} -//# sourceMappingURL=lang-pt.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-pt.d.ts.map b/lib.commonjs/wordlists/lang-pt.d.ts.map deleted file mode 100644 index c979f9c09..000000000 --- a/lib.commonjs/wordlists/lang-pt.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-pt.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-pt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;OAOG;;IAKH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-pt.js b/lib.commonjs/wordlists/lang-pt.js deleted file mode 100644 index ad13dc227..000000000 --- a/lib.commonjs/wordlists/lang-pt.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LangPt = void 0; -const wordlist_owl_js_1 = require("./wordlist-owl.js"); -const words = "0arad!ototealirertainrasoent hoandoaR#riareha!aroele'oronul0Aca%AixoAl A%rDuz'El]Er$IsmoO$ Rum S-&T(i&TigoVo[=0F&.Il#P' S?S* So&/Sun$Tr&0Ac#Adu+Al/A[f E End(Er_EuIng'Ir?IvoOl{oRac Revi=RizU&Um0Di$rM-.R>o+TismoT|@Tu 0Ali An%Ar@Ent&Es,I?Is Ul,1Ila1Ar E=Ei%Ulejo:B BosaC&]uCh `C@GagemI+c>~/Se#S)n%Ta)Te=rTidaTomTuc Unil]3B(IjoIr^IsebolLd!eLezaLgaLisc Ndi$Ng&aNz(RimbauRl*d>_Sou_XigaZ(_3CoCu=En&Foc&Furc G|naLhe%Mest[Mo$rOlog@OmboOsf(aPol Rr-$Scoi$Sne$SpoSsex$TolaZ _2Ind#OcoOque 2A$BagemC#CejoChec]Ico.L^LetimL]LoMb{oNdeNecoNi)Rb~h>d>e&R+c]V*oXe?2AncoAsaAvezaEuIgaIl/Inc OaOchu+Onze O$Uxo2C]DismoF LeRacoScaS$Z*a:Bimb Rn{oRpe%R['>)zRv&/SacoScaSeb[S%loS~oT a)Tiv UleUs?U%l V&oV(na3BolaDil]G}]Lebr L~ Nou+N,N%ioRc Rr#R%'oRvejaTimV^2Aco)Al{aAm#Ap^ArmeAticeAveEfeEg^E'oEqueIco%If[In`oOc&/Ov(UmboU.Uva0CatrizCl}eD!eD['aEn%Gcui$Rurg@T 2A[zaE_Ic OneUbe2A=Ag'Ba@B($rBr C^El/Ent_E,Gum`oIb'IfaIo%L L{aLh(Lid'Lme@L}oLunaM<=Mb* M-.MitivaMov(MplexoMumNc]N=rNec.Nfu,Ng` Nhec(Njug Nsum'Nt+$Nvi%Op( P{oPi?PoQue%lRagemRdi&Rne)R}h>p|&R[ioR%joRuj>voSs-oS%laT}e%U_UveVilZ*]2A%+AvoEcheE=rEmeErEspoI^Im*&Io~oIseItic Os)UaUz{o2B+m SafioSbo.Sc<,S-/Sfi#Sgas%Sigu&SlizeSmam SovaSpesaS)queSvi T&h T-$rT} Tri$UsaV(Vi=Vot#Z-a3Ag+ma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5Al]C]L( LiceM^Mil/N`Ntu+Pe%R>ci=RneioRqueRr!>$S.UcaUp{aX*a2Ab&/Acej Adu$rAfeg Aje$AmaAnc ApoAs{oAt?Av E*oEm(Epid EvoIagemIboIcicloId-%Ilog@Ind!eIploItur Iunf&Oc Ombe)OvaUnfoUque2B~ CquesaT` T|i&:7V 3Bigo0HaId!eIf|me3Olog@SoTigaUbu0A=InaUfru':C*aDi G o,I=,LaL-%Lid!eLo[sN)gemQu{oRe)Rr(Sc~ Sil]S,u+Z Zio3A=D Ge.Ic~ L{oLhiceLu=Nce=rNdav&N( Nt[Rb&Rd!eRe?Rg}h>m`/RnizRs R%n%SpaSti=T|i&3Adu$AgemAj Atu+Br?D{aDr @ElaGaG-%Gi G| L ejoNcoNhe)NilOle)R!>tudeSi.S$Tr&V{oZ*/5A=rArG&L<%LeibolL)gemLumo,Nt!e5L$Vuz`a::D[zRope3QueRe.Rife3Ng ::Ng#Rp 3BuL?9Mb Olog@5Mbi="; -const checksum = "0x2219000926df7b50d8aa0a3d495826b988287df4657fbd100e6fe596c8f737ac"; -let wordlist = null; -/** - * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -class LangPt extends wordlist_owl_js_1.WordlistOwl { - /** - * Creates a new instance of the Portuguese language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langPt]] should suffice. - * - * @_ignore: - */ - constructor() { - super("pt", words, checksum); - } - /** - * Returns a singleton instance of a ``LangPt``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist == null) { - wordlist = new LangPt(); - } - return wordlist; - } -} -exports.LangPt = LangPt; -//# sourceMappingURL=lang-pt.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-pt.js.map b/lib.commonjs/wordlists/lang-pt.js.map deleted file mode 100644 index c1b117f0a..000000000 --- a/lib.commonjs/wordlists/lang-pt.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-pt.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-pt.ts"],"names":[],"mappings":";;;AAAA,uDAAgD;AAEhD,MAAM,KAAK,GACT,s0OAAs0O,CAAC;AACz0O,MAAM,QAAQ,GACZ,oEAAoE,CAAC;AAEvE,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAa,MAAO,SAAQ,6BAAW;IACrC;;;;;;;OAOG;IACH;QACE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACb,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SACzB;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAvBD,wBAuBC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-zh.d.ts b/lib.commonjs/wordlists/lang-zh.d.ts deleted file mode 100644 index 5d0c14c7c..000000000 --- a/lib.commonjs/wordlists/lang-zh.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Wordlist } from "./wordlist.js"; -/** - * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for - * [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangZh extends Wordlist { - /** - * Creates a new instance of the Chinese language Wordlist for - * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified - * or traditional, respectively. - * - * This should be unnecessary most of the time as the exported - * [[langZhCn]] and [[langZhTw]] should suffice. - * - * @_ignore: - */ - constructor(dialect: string); - getWord(index: number): string; - getWordIndex(word: string): number; - split(phrase: string): Array; - /** - * Returns a singleton instance of a ``LangZh`` for %%dialect%%, - * creating it if this is the first time being called. - * - * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or - * traditional, respectively. - */ - static wordlist(dialect: string): LangZh; -} -//# sourceMappingURL=lang-zh.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-zh.d.ts.map b/lib.commonjs/wordlists/lang-zh.d.ts.map deleted file mode 100644 index 8dd1943aa..000000000 --- a/lib.commonjs/wordlists/lang-zh.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-zh.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-zh.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA+DzC;;;;;GAKG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAClC;;;;;;;;;OASG;gBACS,OAAO,EAAE,MAAM;IAI3B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAW9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAKpC;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAMzC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-zh.js b/lib.commonjs/wordlists/lang-zh.js deleted file mode 100644 index 767d0d5d0..000000000 --- a/lib.commonjs/wordlists/lang-zh.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LangZh = void 0; -const index_js_1 = require("../hash/index.js"); -const index_js_2 = require("../utils/index.js"); -const wordlist_js_1 = require("./wordlist.js"); -const data = "}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN> 2), - 128 + codes.indexOf(data[i * 3 + 1]), - 128 + codes.indexOf(data[i * 3 + 2]), - ]; - if (locale === "zh_tw") { - const common = s % 4; - for (let i = common; i < 3; i++) { - bytes[i] = - codes.indexOf(deltaData[deltaOffset++]) + (i == 0 ? 228 : 128); - } - } - wordlist.push((0, index_js_2.toUtf8String)(new Uint8Array(bytes))); - } - // Verify the computed list matches the official list - const checksum = (0, index_js_1.id)(wordlist.join("\n") + "\n"); - /* c8 ignore start */ - if (checksum !== Checks[locale]) { - throw new Error(`BIP39 Wordlist for ${locale} (Chinese) FAILED`); - } - /* c8 ignore stop */ - _wordlist[locale] = wordlist; - return wordlist; -} -const wordlists = {}; -/** - * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for - * [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -class LangZh extends wordlist_js_1.Wordlist { - /** - * Creates a new instance of the Chinese language Wordlist for - * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified - * or traditional, respectively. - * - * This should be unnecessary most of the time as the exported - * [[langZhCn]] and [[langZhTw]] should suffice. - * - * @_ignore: - */ - constructor(dialect) { - super("zh_" + dialect); - } - getWord(index) { - const words = loadWords(this.locale); - (0, index_js_2.assertArgument)(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); - return words[index]; - } - getWordIndex(word) { - return loadWords(this.locale).indexOf(word); - } - split(phrase) { - phrase = phrase.replace(/(?:\u3000| )+/g, ""); - return phrase.split(""); - } - /** - * Returns a singleton instance of a ``LangZh`` for %%dialect%%, - * creating it if this is the first time being called. - * - * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or - * traditional, respectively. - */ - static wordlist(dialect) { - if (wordlists[dialect] == null) { - wordlists[dialect] = new LangZh(dialect); - } - return wordlists[dialect]; - } -} -exports.LangZh = LangZh; -//# sourceMappingURL=lang-zh.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/lang-zh.js.map b/lib.commonjs/wordlists/lang-zh.js.map deleted file mode 100644 index efa6f4a2b..000000000 --- a/lib.commonjs/wordlists/lang-zh.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-zh.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-zh.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,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,MAAc;QAClB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;QAC9C,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAe;QAC7B,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE;YAC9B,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;SAC1C;QACD,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;CACF;AAhDD,wBAgDC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlist-owl.d.ts b/lib.commonjs/wordlists/wordlist-owl.d.ts deleted file mode 100644 index 3a831f7cf..000000000 --- a/lib.commonjs/wordlists/wordlist-owl.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Wordlist } from "./wordlist.js"; -/** - * An OWL format Wordlist is an encoding method that exploits - * the general locality of alphabetically sorted words to - * achieve a simple but effective means of compression. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on ASCII-7 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ -export declare class WordlistOwl extends Wordlist { - #private; - /** - * Creates a new Wordlist for %%locale%% using the OWL %%data%% - * and validated against the %%checksum%%. - */ - constructor(locale: string, data: string, checksum: string); - get _data(): string; - _decodeWords(): Array; - getWord(index: number): string; - getWordIndex(word: string): number; -} -//# sourceMappingURL=wordlist-owl.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlist-owl.d.ts.map b/lib.commonjs/wordlists/wordlist-owl.d.ts.map deleted file mode 100644 index c0dcec9e9..000000000 --- a/lib.commonjs/wordlists/wordlist-owl.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist-owl.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owl.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,qBAAa,WAAY,SAAQ,QAAQ;;IAIvC;;;OAGG;gBACS,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAO1D,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC;IAsB7B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAW9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGnC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlist-owl.js b/lib.commonjs/wordlists/wordlist-owl.js deleted file mode 100644 index 9b749e8de..000000000 --- a/lib.commonjs/wordlists/wordlist-owl.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -// Use the encode-latin.js script to create the necessary -// data files to be consumed by this class -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WordlistOwl = void 0; -const index_js_1 = require("../hash/index.js"); -const index_js_2 = require("../utils/index.js"); -const decode_owl_js_1 = require("./decode-owl.js"); -const wordlist_js_1 = require("./wordlist.js"); -/** - * An OWL format Wordlist is an encoding method that exploits - * the general locality of alphabetically sorted words to - * achieve a simple but effective means of compression. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on ASCII-7 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ -class WordlistOwl extends wordlist_js_1.Wordlist { - #data; - #checksum; - /** - * Creates a new Wordlist for %%locale%% using the OWL %%data%% - * and validated against the %%checksum%%. - */ - constructor(locale, data, checksum) { - super(locale); - this.#data = data; - this.#checksum = checksum; - this.#words = null; - } - get _data() { - return this.#data; - } - _decodeWords() { - return (0, decode_owl_js_1.decodeOwl)(this.#data); - } - #words; - #loadWords() { - if (this.#words == null) { - const words = this._decodeWords(); - // Verify the computed list matches the official list - const checksum = (0, index_js_1.id)(words.join("\n") + "\n", true); - /* c8 ignore start */ - if (checksum !== this.#checksum) { - throw new Error(`BIP39 Wordlist for ${this.locale} FffffAILED`); - } - /* c8 ignore stop */ - this.#words = words; - } - return this.#words; - } - getWord(index) { - const words = this.#loadWords(); - (0, index_js_2.assertArgument)(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); - return words[index]; - } - getWordIndex(word) { - return this.#loadWords().indexOf(word); - } -} -exports.WordlistOwl = WordlistOwl; -//# sourceMappingURL=wordlist-owl.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlist-owl.js.map b/lib.commonjs/wordlists/wordlist-owl.js.map deleted file mode 100644 index 807eef1ca..000000000 --- a/lib.commonjs/wordlists/wordlist-owl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist-owl.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owl.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,0CAA0C;;;AAE1C,+CAAsC;AACtC,gDAAmD;AAEnD,mDAA4C;AAC5C,+CAAyC;AAEzC;;;;;;;;;;;GAWG;AACH,MAAa,WAAY,SAAQ,sBAAQ;IACvC,KAAK,CAAS;IACd,SAAS,CAAS;IAElB;;;OAGG;IACH,YAAY,MAAc,EAAE,IAAY,EAAE,QAAgB;QACxD,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,YAAY;QACV,OAAO,IAAA,yBAAS,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,CAAuB;IAC7B,UAAU;QACR,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE;YACvB,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;YAElC,qDAAqD;YACrD,MAAM,QAAQ,GAAG,IAAA,aAAE,EAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC;YACnD,qBAAqB;YACrB,IAAI,QAAQ,KAAK,IAAI,CAAC,SAAS,EAAE;gBAC/B,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,CAAC,MAAM,aAAa,CAAC,CAAC;aACjE;YACD,oBAAoB;YAEpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;SACrB;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,OAAO,CAAC,KAAa;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAChC,IAAA,yBAAc,EACZ,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAClC,uBAAuB,KAAK,EAAE,EAC9B,OAAO,EACP,KAAK,CACN,CAAC;QACF,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAED,YAAY,CAAC,IAAY;QACvB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AAvDD,kCAuDC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlist-owla.d.ts b/lib.commonjs/wordlists/wordlist-owla.d.ts deleted file mode 100644 index d86086b6e..000000000 --- a/lib.commonjs/wordlists/wordlist-owla.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -/** - * An OWL-A format Wordlist extends the OWL format to add an - * overlay onto an OWL format Wordlist to support diacritic - * marks. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on latin-1 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ -export declare class WordlistOwlA extends WordlistOwl { - #private; - constructor(locale: string, data: string, accent: string, checksum: string); - get _accent(): string; - _decodeWords(): Array; -} -//# sourceMappingURL=wordlist-owla.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlist-owla.d.ts.map b/lib.commonjs/wordlists/wordlist-owla.d.ts.map deleted file mode 100644 index a02c1dff5..000000000 --- a/lib.commonjs/wordlists/wordlist-owla.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist-owla.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owla.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;;;;;;;;;GAWG;AACH,qBAAa,YAAa,SAAQ,WAAW;;gBAG/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAK1E,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC;CAG9B"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlist-owla.js b/lib.commonjs/wordlists/wordlist-owla.js deleted file mode 100644 index bf699b2ca..000000000 --- a/lib.commonjs/wordlists/wordlist-owla.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WordlistOwlA = void 0; -const wordlist_owl_js_1 = require("./wordlist-owl.js"); -const decode_owla_js_1 = require("./decode-owla.js"); -/** - * An OWL-A format Wordlist extends the OWL format to add an - * overlay onto an OWL format Wordlist to support diacritic - * marks. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on latin-1 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ -class WordlistOwlA extends wordlist_owl_js_1.WordlistOwl { - #accent; - constructor(locale, data, accent, checksum) { - super(locale, data, checksum); - this.#accent = accent; - } - get _accent() { - return this.#accent; - } - _decodeWords() { - return (0, decode_owla_js_1.decodeOwlA)(this._data, this._accent); - } -} -exports.WordlistOwlA = WordlistOwlA; -//# sourceMappingURL=wordlist-owla.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlist-owla.js.map b/lib.commonjs/wordlists/wordlist-owla.js.map deleted file mode 100644 index 96723d5c5..000000000 --- a/lib.commonjs/wordlists/wordlist-owla.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist-owla.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owla.ts"],"names":[],"mappings":";;;AAAA,uDAAgD;AAChD,qDAA8C;AAE9C;;;;;;;;;;;GAWG;AACH,MAAa,YAAa,SAAQ,6BAAW;IAC3C,OAAO,CAAS;IAEhB,YAAY,MAAc,EAAE,IAAY,EAAE,MAAc,EAAE,QAAgB;QACxE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,YAAY;QACV,OAAO,IAAA,2BAAU,EAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;CACF;AAfD,oCAeC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlist.d.ts b/lib.commonjs/wordlists/wordlist.d.ts deleted file mode 100644 index 081decc72..000000000 --- a/lib.commonjs/wordlists/wordlist.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * A Wordlist represents a collection of language-specific - * words used to encode and devoce [[link-bip-39]] encoded data - * by mapping words to 11-bit values and vice versa. - */ -export declare abstract class Wordlist { - locale: string; - /** - * Creates a new Wordlist instance. - * - * Sub-classes MUST call this if they provide their own constructor, - * passing in the locale string of the language. - * - * Generally there is no need to create instances of a Wordlist, - * since each language-specific Wordlist creates an instance and - * there is no state kept internally, so they are safe to share. - */ - constructor(locale: string); - /** - * Sub-classes may override this to provide a language-specific - * method for spliting %%phrase%% into individual words. - * - * By default, %%phrase%% is split using any sequences of - * white-space as defined by regular expressions (i.e. ``/\s+/``). - */ - split(phrase: string): Array; - /** - * Sub-classes may override this to provider a language-specific - * method for joining %%words%% into a phrase. - * - * By default, %%words%% are joined by a single space. - */ - join(words: Array): string; - /** - * Maps an 11-bit value into its coresponding word in the list. - * - * Sub-classes MUST override this. - */ - abstract getWord(index: number): string; - /** - * Maps a word to its corresponding 11-bit value. - * - * Sub-classes MUST override this. - */ - abstract getWordIndex(word: string): number; - static check(wordlist: Wordlist): string; -} -//# sourceMappingURL=wordlist.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlist.d.ts.map b/lib.commonjs/wordlists/wordlist.d.ts.map deleted file mode 100644 index ef52e4565..000000000 --- a/lib.commonjs/wordlists/wordlist.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,8BAAsB,QAAQ;IAC5B,MAAM,EAAG,MAAM,CAAC;IAEhB;;;;;;;;;OASG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAIpC;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIlC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAEvC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAC3C,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM;CAYzC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlist.js b/lib.commonjs/wordlists/wordlist.js deleted file mode 100644 index cef696213..000000000 --- a/lib.commonjs/wordlists/wordlist.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Wordlist = void 0; -const id_js_1 = require("../hash/id.js"); -const index_js_1 = require("../utils/index.js"); -/** - * A Wordlist represents a collection of language-specific - * words used to encode and devoce [[link-bip-39]] encoded data - * by mapping words to 11-bit values and vice versa. - */ -class Wordlist { - locale; - /** - * Creates a new Wordlist instance. - * - * Sub-classes MUST call this if they provide their own constructor, - * passing in the locale string of the language. - * - * Generally there is no need to create instances of a Wordlist, - * since each language-specific Wordlist creates an instance and - * there is no state kept internally, so they are safe to share. - */ - constructor(locale) { - (0, index_js_1.defineProperties)(this, { locale }); - } - /** - * Sub-classes may override this to provide a language-specific - * method for spliting %%phrase%% into individual words. - * - * By default, %%phrase%% is split using any sequences of - * white-space as defined by regular expressions (i.e. ``/\s+/``). - */ - split(phrase) { - return phrase.toLowerCase().split(/\s+/g); - } - /** - * Sub-classes may override this to provider a language-specific - * method for joining %%words%% into a phrase. - * - * By default, %%words%% are joined by a single space. - */ - join(words) { - return words.join(" "); - } - static check(wordlist) { - const words = []; - for (let i = 0; i < 2048; i++) { - const word = wordlist.getWord(i); - /* istanbul ignore if */ - if (i !== wordlist.getWordIndex(word)) { - return "0x"; - } - words.push(word); - } - return (0, id_js_1.id)(words.join("\n") + "\n"); - } -} -exports.Wordlist = Wordlist; -//# sourceMappingURL=wordlist.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlist.js.map b/lib.commonjs/wordlists/wordlist.js.map deleted file mode 100644 index ea4b48364..000000000 --- a/lib.commonjs/wordlists/wordlist.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist.ts"],"names":[],"mappings":";;;AAAA,yCAAmC;AACnC,gDAAqD;AAErD;;;;GAIG;AACH,MAAsB,QAAQ;IAC5B,MAAM,CAAU;IAEhB;;;;;;;;;OASG;IACH,YAAY,MAAc;QACxB,IAAA,2BAAgB,EAAW,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAc;QAClB,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,KAAoB;QACvB,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAeD,MAAM,CAAC,KAAK,CAAC,QAAkB;QAC7B,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;YAC7B,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACjC,wBAAwB;YACxB,IAAI,CAAC,KAAK,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;gBACrC,OAAO,IAAI,CAAC;aACb;YACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAClB;QACD,OAAO,IAAA,UAAE,EAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACrC,CAAC;CACF;AA/DD,4BA+DC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlists-browser.d.ts b/lib.commonjs/wordlists/wordlists-browser.d.ts deleted file mode 100644 index d0dbd19c9..000000000 --- a/lib.commonjs/wordlists/wordlists-browser.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Wordlist } from "./wordlist.js"; -export declare const wordlists: Record; -//# sourceMappingURL=wordlists-browser.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlists-browser.d.ts.map b/lib.commonjs/wordlists/wordlists-browser.d.ts.map deleted file mode 100644 index 4cd923879..000000000 --- a/lib.commonjs/wordlists/wordlists-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists-browser.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAE9C,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlists-browser.js b/lib.commonjs/wordlists/wordlists-browser.js deleted file mode 100644 index 569f5ca12..000000000 --- a/lib.commonjs/wordlists/wordlists-browser.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.wordlists = void 0; -const lang_en_js_1 = require("./lang-en.js"); -exports.wordlists = { - en: lang_en_js_1.LangEn.wordlist(), -}; -//# sourceMappingURL=wordlists-browser.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlists-browser.js.map b/lib.commonjs/wordlists/wordlists-browser.js.map deleted file mode 100644 index 382337bb9..000000000 --- a/lib.commonjs/wordlists/wordlists-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists-browser.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-browser.ts"],"names":[],"mappings":";;;AAAA,6CAAsC;AAIzB,QAAA,SAAS,GAA6B;IACjD,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;CACtB,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlists-extra.d.ts b/lib.commonjs/wordlists/wordlists-extra.d.ts deleted file mode 100644 index 7e15a233f..000000000 --- a/lib.commonjs/wordlists/wordlists-extra.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export { LangCz } from "./lang-cz.js"; -export { LangEs } from "./lang-es.js"; -export { LangFr } from "./lang-fr.js"; -export { LangJa } from "./lang-ja.js"; -export { LangKo } from "./lang-ko.js"; -export { LangIt } from "./lang-it.js"; -export { LangPt } from "./lang-pt.js"; -export { LangZh } from "./lang-zh.js"; -//# sourceMappingURL=wordlists-extra.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlists-extra.d.ts.map b/lib.commonjs/wordlists/wordlists-extra.d.ts.map deleted file mode 100644 index 66c6c92cd..000000000 --- a/lib.commonjs/wordlists/wordlists-extra.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists-extra.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-extra.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlists-extra.js b/lib.commonjs/wordlists/wordlists-extra.js deleted file mode 100644 index 38dbc9266..000000000 --- a/lib.commonjs/wordlists/wordlists-extra.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LangZh = exports.LangPt = exports.LangIt = exports.LangKo = exports.LangJa = exports.LangFr = exports.LangEs = exports.LangCz = void 0; -var lang_cz_js_1 = require("./lang-cz.js"); -Object.defineProperty(exports, "LangCz", { enumerable: true, get: function () { return lang_cz_js_1.LangCz; } }); -var lang_es_js_1 = require("./lang-es.js"); -Object.defineProperty(exports, "LangEs", { enumerable: true, get: function () { return lang_es_js_1.LangEs; } }); -var lang_fr_js_1 = require("./lang-fr.js"); -Object.defineProperty(exports, "LangFr", { enumerable: true, get: function () { return lang_fr_js_1.LangFr; } }); -var lang_ja_js_1 = require("./lang-ja.js"); -Object.defineProperty(exports, "LangJa", { enumerable: true, get: function () { return lang_ja_js_1.LangJa; } }); -var lang_ko_js_1 = require("./lang-ko.js"); -Object.defineProperty(exports, "LangKo", { enumerable: true, get: function () { return lang_ko_js_1.LangKo; } }); -var lang_it_js_1 = require("./lang-it.js"); -Object.defineProperty(exports, "LangIt", { enumerable: true, get: function () { return lang_it_js_1.LangIt; } }); -var lang_pt_js_1 = require("./lang-pt.js"); -Object.defineProperty(exports, "LangPt", { enumerable: true, get: function () { return lang_pt_js_1.LangPt; } }); -var lang_zh_js_1 = require("./lang-zh.js"); -Object.defineProperty(exports, "LangZh", { enumerable: true, get: function () { return lang_zh_js_1.LangZh; } }); -//# sourceMappingURL=wordlists-extra.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlists-extra.js.map b/lib.commonjs/wordlists/wordlists-extra.js.map deleted file mode 100644 index 45ad32830..000000000 --- a/lib.commonjs/wordlists/wordlists-extra.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists-extra.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-extra.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlists.d.ts b/lib.commonjs/wordlists/wordlists.d.ts deleted file mode 100644 index ab8b0308c..000000000 --- a/lib.commonjs/wordlists/wordlists.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { Wordlist } from "./wordlist.js"; -/** - * The available Wordlists by their - * [ISO 639-1 Language Code](link-wiki-iso639). - * - * (**i.e.** [cz](LangCz), [en](LangEn), [es](LangEs), [fr](LangFr), - * [ja](LangJa), [ko](LangKo), [it](LangIt), [pt](LangPt), - * [zh_cn](LangZh), [zh_tw](LangZh)) - * - * The dist files (in the ``/dist`` folder) have had all languages - * except English stripped out, which reduces the library size by - * about 80kb. If required, they are available by importing the - * included ``wordlists-extra.min.js`` file. - */ -export declare const wordlists: Record; -//# sourceMappingURL=wordlists.d.ts.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlists.d.ts.map b/lib.commonjs/wordlists/wordlists.d.ts.map deleted file mode 100644 index 15f92fcf6..000000000 --- a/lib.commonjs/wordlists/wordlists.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAW9C,CAAC"} \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlists.js b/lib.commonjs/wordlists/wordlists.js deleted file mode 100644 index 97235d88e..000000000 --- a/lib.commonjs/wordlists/wordlists.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.wordlists = void 0; -const lang_cz_js_1 = require("./lang-cz.js"); -const lang_en_js_1 = require("./lang-en.js"); -const lang_es_js_1 = require("./lang-es.js"); -const lang_fr_js_1 = require("./lang-fr.js"); -const lang_ja_js_1 = require("./lang-ja.js"); -const lang_ko_js_1 = require("./lang-ko.js"); -const lang_it_js_1 = require("./lang-it.js"); -const lang_pt_js_1 = require("./lang-pt.js"); -const lang_zh_js_1 = require("./lang-zh.js"); -/** - * The available Wordlists by their - * [ISO 639-1 Language Code](link-wiki-iso639). - * - * (**i.e.** [cz](LangCz), [en](LangEn), [es](LangEs), [fr](LangFr), - * [ja](LangJa), [ko](LangKo), [it](LangIt), [pt](LangPt), - * [zh_cn](LangZh), [zh_tw](LangZh)) - * - * The dist files (in the ``/dist`` folder) have had all languages - * except English stripped out, which reduces the library size by - * about 80kb. If required, they are available by importing the - * included ``wordlists-extra.min.js`` file. - */ -exports.wordlists = { - cz: lang_cz_js_1.LangCz.wordlist(), - en: lang_en_js_1.LangEn.wordlist(), - es: lang_es_js_1.LangEs.wordlist(), - fr: lang_fr_js_1.LangFr.wordlist(), - it: lang_it_js_1.LangIt.wordlist(), - pt: lang_pt_js_1.LangPt.wordlist(), - ja: lang_ja_js_1.LangJa.wordlist(), - ko: lang_ko_js_1.LangKo.wordlist(), - zh_cn: lang_zh_js_1.LangZh.wordlist("cn"), - zh_tw: lang_zh_js_1.LangZh.wordlist("tw"), -}; -//# sourceMappingURL=wordlists.js.map \ No newline at end of file diff --git a/lib.commonjs/wordlists/wordlists.js.map b/lib.commonjs/wordlists/wordlists.js.map deleted file mode 100644 index 6c6c3cf4c..000000000 --- a/lib.commonjs/wordlists/wordlists.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists.ts"],"names":[],"mappings":";;;AAAA,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AAItC;;;;;;;;;;;;GAYG;AACU,QAAA,SAAS,GAA6B;IACjD,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,KAAK,EAAE,mBAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,KAAK,EAAE,mBAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;CAC7B,CAAC"} \ No newline at end of file diff --git a/lib.esm/README.md b/lib.esm/README.md deleted file mode 100644 index ce8d3ba56..000000000 --- a/lib.esm/README.md +++ /dev/null @@ -1,16 +0,0 @@ -ESM Files -========= - -The contents of this folder are for using `import` in ESM -projects. - - -Notes ------ - -The contents are generated via the `npm run build` target -using `tsc` and the `/tsconfig.esm.json` configuration. - -Do not modify the files in this folder. They are deleted on `build-clean`. - -To modify this `README.md`, see the `/output/post-build/lib.esm`. diff --git a/lib.esm/_tests/blockchain-data.d.ts b/lib.esm/_tests/blockchain-data.d.ts deleted file mode 100644 index f9a6125d6..000000000 --- a/lib.esm/_tests/blockchain-data.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -export type TestBlockchainNetwork = "mainnet" | "goerli"; -export interface TestBlockchainAddress { - test: string; - address: string; - code?: string; - nonce?: number; - name?: string; - balance?: bigint; - storage?: Record; -} -export interface TestBlockchainBlock { - test: string; - hash: string; - parentHash: string; - number: number; - timestamp: number; - nonce: string; - difficulty: bigint; - energyLimit: bigint; - energyUsed: bigint; - miner: string; - extraData: string; - transactions: Array; - baseFeePerEnergy?: bigint; -} -export interface TestBlockchainTransaction { - test: string; - hash: string; - blockHash: string; - blockNumber: number; - type: number; - from: string; - energyPrice: bigint; - energyLimit: bigint; - to: string; - value: bigint; - nonce: number; - data: string; - signature: { - r: string; - s: string; - yParity: 0 | 1; - v: number; - networkV: null | bigint; - }; - creates: null | string; - networkId: bigint; - accessList?: Array>>; -} -export interface TestBlockchainReceipt { - test: string; - blockHash: string; - blockNumber: number; - type: number; - contractAddress: null | string; - cumulativeEnergyUsed: bigint; - from: string; - energyUsed: bigint; - energyPrice: bigint; - logs: Array<{ - address: string; - blockHash: string; - blockNumber: number; - data: string; - index: number; - topics: Array; - transactionHash: string; - transactionIndex: number; - }>; - logsBloom: string; - root: null | string; - status: null | number; - to: string; - hash: string; - index: number; -} -export declare const testAddress: Record>; -export declare const testBlock: Record>; -export declare const testTransaction: Record>; -export declare const testReceipt: Record>; -export declare const networkNames: Array; -export declare function networkFeatureAtBlock(feature: string, block: number): boolean; -//# sourceMappingURL=blockchain-data.d.ts.map \ No newline at end of file diff --git a/lib.esm/_tests/blockchain-data.d.ts.map b/lib.esm/_tests/blockchain-data.d.ts.map deleted file mode 100644 index 768360b32..000000000 --- a/lib.esm/_tests/blockchain-data.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"blockchain-data.d.ts","sourceRoot":"","sources":["../../src.ts/_tests/blockchain-data.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEzD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MA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/blockchain-data.js deleted file mode 100644 index a75cea7d7..000000000 --- a/lib.esm/_tests/blockchain-data.js +++ /dev/null @@ -1,239 +0,0 @@ -export const testAddress = { - mainnet: [ - { - test: "old-account", - address: "0xAC1639CF97a3A46D431e6d1216f576622894cBB5", - balance: BigInt("4813414100000000"), - nonce: 3, - code: "0x", - }, - { - test: "TheDAO-splitter-contract", - address: "0x3474627D4F63A678266BC17171D87f8570936622", - code: "0x606060405260e060020a60003504630b3ed5368114602e57806337b0574a14605257806356fa47f0146062575b005b602c6004356000546101009004600160a060020a03908116339091161460bb575b50565b60005460ff166060908152602090f35b602c60043560005460ff1615609657600160a060020a038116600034606082818181858883f193505050501515604f576002565b33600160a060020a0316600034606082818181858883f193505050501515604f576002565b600080546101009004600160a060020a03169082606082818181858883f193505050501515604f57600256", - storage: { - "0": "0x0000000000000000000000b2682160c482eb985ec9f3e364eec0a904c44c2300", - }, - }, - { - test: "ricmoo.firefly.eth", - address: "0x8ba1f109551bD432803012645Ac136ddd64DBA72", - name: "ricmoo.firefly.eth", - }, - ], - goerli: [], -}; -export const testBlock = { - mainnet: [ - { - test: "old-homestead-block", - hash: "0x3d6122660cc824376f11ee842f83addc3525e2dd6756b9bcf0affa6aa88cf741", - parentHash: "0xb495a1d7e6663152ae92708da4843337b958146015a2802f4193a410044698c9", - number: 3, - timestamp: 1438270048, - nonce: "0x2e9344e0cbde83ce", - difficulty: BigInt(17154715646), - energyLimit: BigInt("0x1388"), - energyUsed: BigInt("0"), - miner: "0x5088D623ba0fcf0131E0897a91734A4D83596AA0", - extraData: "0x476574682f76312e302e302d66633739643332642f6c696e75782f676f312e34", - transactions: [], - }, - { - test: "london-block", - number: 14413999, - hash: "0x6c79356d40ebb6ed63dc19f5d407f8f1c876047b59dc1a4598cce0e64dcabec5", - parentHash: "0xbf09b0e215f247a5066d19ece5b4c66960771d45fae62985e8d751fb1adcfe2f", - timestamp: 1647654576, - nonce: "0xb4bc9979af5369fe", - difficulty: BigInt("12841513359509721"), - energyLimit: BigInt("30087914"), - energyUsed: BigInt("2008910"), - miner: "0x2A20380DcA5bC24D052acfbf79ba23e988ad0050", - extraData: "0x706f6f6c696e2e636f6d21f7092f019bb92a76", - baseFeePerEnergy: BigInt("40911884304"), - transactions: [ - "0x1c3a398933db10634631f54b435c40c8805c13f12bbac7c3dab858ca44213fa2", - "0xd98947cbdd892cc7f679c903903e6d18a5c5afb19e94437beba79372ad71c347", - "0x4d66190deb55b5820cb0ce9adb972f646fa0f3e64eaeee674bbf3d054bf3d883", - "0x9db7bd5f4c91d6103c714bcbc35df3dc708daa668aaef7449b589dbd3be24dac", - "0x126a43ae4ade4b7fc5c8ac9ebd3dbcf7314f63c60f2804fb49aa25b5c7d80bb1", - "0x82a90aa4b3b1b7873b117c3ff1ca7165ae34b2fc0788cc0cbfd41805d588590d", - "0x7f694a6a9972457753ed3dec164f17272b1c8b1da4eab149df95e31a3e72f606", - "0xdce1cba1ff33f0c23881087d49de3b34fe84c8a6883f3edd75b04fc23e458aac", - "0xbe1c69f825279cebef42d1f0e07397dcddef7fb278b0195e295ede3e156836c4", - "0x1d2f007b3c0f894403973a30e5ffaa78589f873d963e9554c6bb1bd7a3127245", - "0x9c8c78191cf4ae9ae8eee1165153eabe24dbd8b9509b83d5f0caeea85251bb2f", - "0x42e956f4b3dd6535359b272a0d2dab995c364cb48baaf8d0a1981995f3f8c808", - "0xdc2c2e99393e24d5dc66e38665fa1d1ff007d92088ef3fd2549545fdbe862ef6", - "0xaad7be28fffd2e77e8e40bf57f2ac140aa8283ec93c7f3f61a82c79405602f53", - "0x4735f1421b7b30283e87e0799e82e54307d3e5ba14cd54ad8420b57577489a71", - "0x0b9d6aa23aa439b41e86595f2ad91f498adffa3e6e7cb26ac7d73252e59fd3de", - "0xcd93e19bd5d5c5a834fec613116fa01f46eddfd2faa20ef302271b874b9d812a", - "0x5bf1976574a637f5ac0b8bda1a792fa16cc7ce9624d32e9bd6bd9aa6a8f19d2f", - "0x2e778da4f66f10f7b681b605635c6599cdbeea167fc1c4396a097aef5d06de61", - "0xd5fd68eebc4c870ccda081786a74c75c250e9e2d8269b8935edb3adb11b80bb2", - "0x2aec42a11c1d8c1e5198d54aacbc6bebb09bcd5e78f6af81ea09d65c9064734a", - "0xbea2e364ea4959ec438d9ccc2d2f7120c7eaba3b177cc0d7df8ff65d866ef89f", - "0xf48bbb0f838353060da4126a555ce532abf497a9d1108001afffaac513a59ddf", - "0xf5664e4372cce62733a6610efb7701a4a0e552d81f8caa764d8474b3070c6617", - "0x9d3732ddbd20610008ff737da2f61120734a1cbfa864374bcbcf10051e6048cb", - "0xc4d0df5bc6fa51b34ac3c898866d779d4e51a6be4d13be1ec3084b7229b03b47", - "0x90c86ec98b8ad98049b4ee54cb3aa72c5ae743077b830e8a294aa5dc47a1fb18", - ], - }, - ], - goerli: [], -}; -export const testTransaction = { - mainnet: [ - { - test: "legacy", - hash: "0xccc90ab97a74c952fb3376c4a3efb566a58a10df62eb4d44a61e106fcf10ec61", - blockHash: "0x9653f180a5720f3634816eb945a6d722adee52cc47526f6357ac10adaf368135", - blockNumber: 4097745, - // index: 18, - type: 0, - from: "0x32DEF047DeFd076DB21A2D759aff2A591c972248", - energyPrice: BigInt("0x4a817c800"), - energyLimit: BigInt("0x3d090"), - to: "0x6fC21092DA55B392b045eD78F4732bff3C580e2c", - value: BigInt("0x186cc6acd4b0000"), - nonce: 0, - data: "0xf2c298be000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000067269636d6f6f0000000000000000000000000000000000000000000000000000", - signature: { - r: "0x1e5605197a03e3f0a168f14749168dfeefc44c9228312dacbffdcbbb13263265", - s: "0x269c3e5b3558267ad91b0a887d51f9f10098771c67b82ea6cb74f29638754f54", - yParity: 1, - v: 28, - networkV: BigInt(38), - }, - creates: null, - networkId: BigInt(1), - }, - { - test: "EIP-1559", - hash: "0x8ff41d0ba5d239acc8c123ff12451a2c15721c838f657e583d355999af4a4349", - blockHash: "0x9d4c3bef68e119841281105da96beb1c7252f357340d7a3355236b3332b197b0", - blockNumber: 12966000, - // index: 185, - type: 2, - from: "0x5afFBa12E9332bbc0E221c8E7BEf7CB7cfB3F281", - to: "0x2258CcD34ae29E6B199b6CD64eb2aEF157df7CdE", - energyLimit: BigInt("21000"), - nonce: 2, - data: "0x", - value: BigInt("1100000000000000"), - energyPrice: BigInt("70578812137"), - networkId: BigInt(1), - signature: { - r: "0xdd26e5478d0aa84e334a0393d335ab24b83de8ecae9290305f15ab884ded246c", - s: "0x6494b4f61b0d9a5a82ecb86d72b301f859f404f0bec9682bbfff619903ecfbe2", - yParity: 1, - v: 28, - networkV: null, - }, - creates: null, - accessList: [], - }, - ], - goerli: [], -}; -export const testReceipt = { - mainnet: [ - { - test: "legacy", - //byzantium: false, - blockHash: "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", - blockNumber: 0x3c92b5, - type: 0, - contractAddress: null, - cumulativeEnergyUsed: BigInt(0x1cca2e), - from: "0x18C6045651826824FEBBD39d8560584078d1b247", - energyUsed: BigInt(0x14bb7), - energyPrice: BigInt(4100000000), - logs: [ - { - address: "0x314159265dD8dbb310642f98f50C066173C1259b", - blockHash: "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", - blockNumber: 0x3c92b5, - data: "0x00000000000000000000000018c6045651826824febbd39d8560584078d1b247", - index: 0x1a, - topics: [ - "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", - "0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae", - "0xf0106919d12469348e14ad6a051d0656227e1aba2fefed41737fdf78421b20e1", - ], - transactionHash: "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", - transactionIndex: 0x39, - }, - { - address: "0x6090A6e47849629b7245Dfa1Ca21D94cd15878Ef", - blockHash: "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", - blockNumber: 0x3c92b5, - data: "0x000000000000000000000000000000000000000000000000002386f26fc1000000000000000000000000000000000000000000000000000000000000595a32ce", - index: 0x1b, - topics: [ - "0x0f0c27adfd84b60b6f456b0e87cdccb1e5fb9603991588d87fa99f5b6b61e670", - "0xf0106919d12469348e14ad6a051d0656227e1aba2fefed41737fdf78421b20e1", - "0x00000000000000000000000018c6045651826824febbd39d8560584078d1b247", - ], - transactionHash: "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", - transactionIndex: 0x39, - }, - ], - logsBloom: "0x00000000000000040000000000100000010000000000000040000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000200000010000000004000000000000000000000000000000000002000000000000000000000000400000000020000000000000000000000000000000000000004000000000000000000000000000000000000000000000000801000000000000000000000020000000000040000000040000000000000000002000000004000000000000000000000000000000000000000000000010000000000000000000000000000000000200000000000000000", - root: "0x9b550a9a640ce50331b64504ef87aaa7e2aaf97344acb6ff111f879b319d2590", - // Should be null for pre-byzantium, but some nodes have backfilled it - status: 1, - to: "0x6090A6e47849629b7245Dfa1Ca21D94cd15878Ef", - hash: "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", - index: 0x39, - }, - { - test: "byzantium", - //byzantium: true, - blockHash: "0x34e5a6cfbdbb84f7625df1de69d218ade4da72f4a2558064a156674e72e976c9", - blockNumber: 0x444f76, - type: 0, - contractAddress: null, - cumulativeEnergyUsed: BigInt(0x15bfe7), - from: "0x18C6045651826824FEBBD39d8560584078d1b247", - energyUsed: BigInt(0x1b968), - energyPrice: BigInt(1000000000), - logs: [ - { - address: "0xb90E64082D00437e65A76d4c8187596BC213480a", - blockHash: "0x34e5a6cfbdbb84f7625df1de69d218ade4da72f4a2558064a156674e72e976c9", - blockNumber: 0x444f76, - data: "0x", - index: 0x10, - topics: [ - "0x748d071d1992ee1bfe7a39058114d0a50d5798fe8eb3a9bfb4687f024629a2ce", - "0x5574aa58f7191ccab6de6cf75fe2ea0484f010b852fdd8c6b7ae151d6c2f4b83", - ], - transactionHash: "0x7f1c6a58dc880438236d0b0a4ae166e9e9a038dbea8ec074149bd8b176332cac", - transactionIndex: 0x1e, - }, - ], - logsBloom: "0x00000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000200000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000800000000000000000800000000000000000000000000000000000000", - root: null, - status: 1, - to: "0xb90E64082D00437e65A76d4c8187596BC213480a", - hash: "0x7f1c6a58dc880438236d0b0a4ae166e9e9a038dbea8ec074149bd8b176332cac", - index: 0x1e, - }, - ], - goerli: [], -}; -export const networkNames = ["mainnet", "goerli"]; -export function networkFeatureAtBlock(feature, block) { - switch (feature) { - case "byzantium": - return block >= 4370000; - default: - break; - } - throw new Error(`unknown feature: ${feature}`); -} -//# sourceMappingURL=blockchain-data.js.map \ No newline at end of file diff --git a/lib.esm/_tests/blockchain-data.js.map b/lib.esm/_tests/blockchain-data.js.map deleted file mode 100644 index 5c6db8940..000000000 --- a/lib.esm/_tests/blockchain-data.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"blockchain-data.js","sourceRoot":"","sources":["../../src.ts/_tests/blockchain-data.ts"],"names":[],"mappings":"AAqFA,MAAM,CAAC,MAAM,WAAW,GAGpB;IACF,OAAO,EAAE;QACP;YACE,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,4CAA4C;YACrD,OAAO,EAAE,MAAM,CAAC,kBAAkB,CAAC;YACnC,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,IAAI;SACX;QACD;YACE,IAAI,EAAE,0BAA0B;YAChC,OAAO,EAAE,4CAA4C;YACrD,IAAI,EAAE,kdAAkd;YACxd,OAAO,EAAE;gBACP,GAAG,EAAE,oEAAoE;aAC1E;SACF;QACD;YACE,IAAI,EAAE,oBAAo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b/lib.esm/_tests/create-provider.d.ts deleted file mode 100644 index ef373e81a..000000000 --- a/lib.esm/_tests/create-provider.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { AbstractProvider } from "../index.js"; -export declare function setupProviders(): void; -export declare const providerNames: readonly string[]; -export declare function getProviderNetworks(provider: string): Array; -export declare function getProvider(provider: string, network: string): null | AbstractProvider; -export declare function checkProvider(provider: string, network: string): boolean; -export declare function connect(network: string): AbstractProvider; -//# sourceMappingURL=create-provider.d.ts.map \ No newline at end of file diff --git a/lib.esm/_tests/create-provider.d.ts.map b/lib.esm/_tests/create-provider.d.ts.map deleted file mode 100644 index 901738c3a..000000000 --- a/lib.esm/_tests/create-provider.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"create-provider.d.ts","sourceRoot":"","sources":["../../src.ts/_tests/create-provider.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA2EpD,wBAAgB,cAAc,IAAI,IAAI,CAOrC;AAED,eAAO,MAAM,aAAa,mBAAqD,CAAC;AAUhF,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAMnE;AAED,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,IAAI,GAAG,gBAAgB,CAsBzB;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAGxE;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAMzD"} \ No newline at end of file diff --git a/lib.esm/_tests/create-provider.js b/lib.esm/_tests/create-provider.js deleted file mode 100644 index 8d38b131c..000000000 --- a/lib.esm/_tests/create-provider.js +++ /dev/null @@ -1,121 +0,0 @@ -import { AlchemyProvider, InfuraProvider, PocketProvider, QuickNodeProvider, FallbackProvider, isError, } from "../index.js"; -const ethNetworks = ["default", "mainnet", "goerli"]; -//const maticNetworks = [ "matic", "maticmum" ]; -const ProviderCreators = [ - { - name: "AlchemyProvider", - networks: ethNetworks, - create: function (network) { - return new AlchemyProvider(network, "YrPw6SWb20vJDRFkhWq8aKnTQ8JRNRHM"); - }, - }, - { - name: "InfuraProvider", - networks: ethNetworks, - create: function (network) { - return new InfuraProvider(network, "49a0efa3aaee4fd99797bfa94d8ce2f1"); - }, - }, - { - name: "InfuraWebsocketProvider", - networks: ethNetworks, - create: function (network) { - return InfuraProvider.getWebSocketProvider(network, "49a0efa3aaee4fd99797bfa94d8ce2f1"); - }, - }, - { - name: "PocketProvider", - networks: ethNetworks, - create: function (network) { - return new PocketProvider(network); - }, - }, - { - name: "QuickNodeProvider", - networks: ethNetworks, - create: function (network) { - return new QuickNodeProvider(network); - }, - }, - { - name: "FallbackProvider", - networks: ethNetworks, - create: function (network) { - const providers = []; - for (const providerName of [ - "AlchemyProvider", - "AnkrProvider", - "InfuraProvider", - ]) { - const provider = getProvider(providerName, network); - if (provider) { - providers.push(provider); - } - } - if (providers.length === 0) { - throw new Error("UNSUPPORTED NETWORK"); - } - return new FallbackProvider(providers); - }, - }, -]; -let setup = false; -const cleanup = []; -export function setupProviders() { - after(function () { - for (const func of cleanup) { - func(); - } - }); - setup = true; -} -export const providerNames = Object.freeze(ProviderCreators.map((c) => c.name)); -function getCreator(provider) { - const creators = ProviderCreators.filter((c) => c.name === provider); - if (creators.length === 1) { - return creators[0]; - } - return null; -} -export function getProviderNetworks(provider) { - const creator = getCreator(provider); - if (creator) { - return creator.networks; - } - return []; -} -export function getProvider(provider, network) { - if (setup == false) { - throw new Error("MUST CALL setupProviders in root context"); - } - const creator = getCreator(provider); - try { - if (creator) { - const provider = creator.create(network); - if (provider) { - cleanup.push(() => { - provider.destroy(); - }); - } - return provider; - } - } - catch (error) { - if (!isError(error, "INVALID_ARGUMENT")) { - throw error; - } - } - return null; -} -export function checkProvider(provider, network) { - const creator = getCreator(provider); - return creator != null; -} -export function connect(network) { - const provider = getProvider("InfuraProvider", network); - if (provider == null) { - throw new Error(`could not connect to ${network}`); - } - return provider; -} -//# sourceMappingURL=create-provider.js.map \ No newline at end of file diff --git a/lib.esm/_tests/create-provider.js.map b/lib.esm/_tests/create-provider.js.map deleted file mode 100644 index e0cfff3d4..000000000 --- a/lib.esm/_tests/create-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"create-provider.js","sourceRoot":"","sources":["../../src.ts/_tests/create-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,GACR,MAAM,aAAa,CAAC;AAUrB,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AACrD,gDAAgD;AAEhD,MAAM,gBAAgB,GAA2B;IAC/C;QACE,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,UAAU,OAAe;YAC/B,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,kCAAkC,CAAC,CAAC;QAC1E,CAAC;KACF;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,UAAU,OAAe;YAC/B,OAAO,IAAI,cAAc,CAAC,OAAO,EAAE,kCAAkC,CAAC,CAAC;QACzE,CAAC;KACF;IACD;QACE,IAAI,EAAE,yBAAyB;QAC/B,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,UAAU,OAAe;YAC/B,OAAO,cAAc,CAAC,oBAAoB,CACxC,OAAO,EACP,kCAAkC,CACnC,CAAC;QACJ,CAAC;KACF;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,UAAU,OAAe;YAC/B,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QACrC,CAAC;KACF;IACD;QACE,IAA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D,IAAI,QAAQ,IAAI,IAAI,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;KACpD;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/lib.esm/_tests/test-contract.d.ts b/lib.esm/_tests/test-contract.d.ts deleted file mode 100644 index 1427a8692..000000000 --- a/lib.esm/_tests/test-contract.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=test-contract.d.ts.map \ No newline at end of file diff --git a/lib.esm/_tests/test-contract.d.ts.map b/lib.esm/_tests/test-contract.d.ts.map deleted file mode 100644 index fb6a18b4b..000000000 --- a/lib.esm/_tests/test-contract.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test-contract.d.ts","sourceRoot":"","sources":["../../src.ts/_tests/test-contract.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.esm/_tests/test-contract.js b/lib.esm/_tests/test-contract.js deleted file mode 100644 index b5fa6fff5..000000000 --- a/lib.esm/_tests/test-contract.js +++ /dev/null @@ -1,83 +0,0 @@ -import { getDefaultProvider, Wallet, Transaction, SigningKey, BaseWallet, verifyMessage, isAddressable, } from "../corebc.js"; -import assert from "assert"; -import { networkIdToPrefix } from "../address/index.js"; -const TIMEOUT_PERIOD = 120000; -const tesSignedTransaction = "0xf8ce800a830f423f0496ce276773ac97d16855a3c8faa45399136b56d419486081c880b8ab54bc60412c90c104a89865a43c33f335836bcb473f0cd477ecb2c82e6310676c87b708e3971d009b4a04e518f12454c3ee1aebc19a6b7df00076b834b692b7432611f3dafff0f422dfbae722ba4b989cfc82fee2e539fbbf21d652ea587df59e8421a3a8bc8ca2ba35033598954c54e10c00315484db568379ce94f9c894e3e6e4c7ee216676b713ca892d9b26746ae902a772e217a6a8bb493ce2bb313cf0cb66e76765d4c45ec6b68600"; -const testWalletPhrase = "better artwork flavor fish solve deer orient spread adapt doll attack hour sort copper super income bacon engine skate ill similar wink crack club"; -const testSeed = "ec372b08ffc451a5dd991c68006aa01a033a6a391e0e72d5690c13cff719fdcb2502812dbf5f32a6df828cd22d77a36405bb15bb2637b7e77f99fa60f00d3560"; -const tesPrivateKey = "69bb68c3a00a0cd9cbf2cab316476228c758329bbfe0b1759e8634694a9497afea05bcbf24e2aa0627eac4240484bb71de646a9296872a3c0e"; -const testAddress = "0xab38254e30777140469a3aa168df81182d3d61f9843f"; -const testPublicKey = "0x484ed765af56534f1c98c0f3ac9fb460fbf5c3cf582e54a6cdfc319986ce1bb875d3afcc9c336764348c96264dfeef9565364d7e8e14e9aa80"; -const provider = getDefaultProvider("https://xcbapi.corecoin.cc/"); -const mnemonicWallet = Wallet.fromPhrase({ - phrase: testWalletPhrase, - password: "111111", - prefix: networkIdToPrefix(3), -}); -const mnemonicWalletWithoutPassKey = Wallet.fromPhrase({ - phrase: testWalletPhrase, - prefix: networkIdToPrefix(3), -}); -console.log(mnemonicWalletWithoutPassKey.publicKey); -const wallet = Wallet.fromSeed({ - prefix: networkIdToPrefix(3), - seed: testSeed, - provider, -}); -const seedWallet = Wallet.fromSeed({ - prefix: networkIdToPrefix(3), - seed: testSeed, -}); -const signingKey = new SigningKey(tesPrivateKey); -const baseWalletAddress = "0xab03a5fd22b9bee8b8ab877c86e0a2c21765e1d5bfc5"; -const baseWallet = new BaseWallet({ - signingKey, - prefix: networkIdToPrefix(3), - provider, -}); -const randomWallet = Wallet.createRandom(networkIdToPrefix(3), provider); -const transaction = Transaction.from({ - to: "0xce276773ac97d16855a3c8faa45399136b56d4194860", - value: 200n, - nonce: 0, - energyLimit: 999999n, - energyPrice: 10n, - networkId: 4, -}); -describe("Test wallet creation", function () { - it("can generate a random wallet", function () { - assert.equal(randomWallet.mnemonic?.phrase.split(" ").length, 24, "mismatch in phrase length"); - assert.equal(isAddressable(randomWallet), true, "random wallet is not addressable"); - }); -}); -describe("Test getting data from blockchain and calling smart contract", function () { - it("can currectly sign a transaction", async function () { - this.timeout(TIMEOUT_PERIOD); - const tx = await baseWallet.signTransaction(transaction); - assert.equal(tx, tesSignedTransaction, "sign transaction failed"); - }); - it("can currectly get signer from signed transaction", async function () { - this.timeout(TIMEOUT_PERIOD); - const message = "my message"; - const signedMessage = await baseWallet.signMessage(message); - const address = verifyMessage(message, signedMessage, networkIdToPrefix(3)); - assert.equal(address, baseWalletAddress, "get address from signed message failed"); - }); - it("can get feeData ", async function () { - this.timeout(TIMEOUT_PERIOD); - const feeData = await provider.getFeeData(); - assert.equal(feeData.energyPrice, 1000000000n, "mismatch in expected energy price"); - }); - it("can generate wallet", function () { - assert.equal(mnemonicWallet.address.length, 46, "mismatch in address length"); - assert.equal(mnemonicWallet.publicKey, testPublicKey, "mismatch in public key"); - assert.equal(mnemonicWallet.address, testAddress, "mismatch in generated address"); - assert.equal(seedWallet.address.length, 46, "mismatch in address length for seed wallet"); - assert.equal(seedWallet.publicKey, testPublicKey, "mismatch in public key for seed wallet"); - assert.equal(seedWallet.address, testAddress, "mismatch in seed length for seed wallet"); - assert.equal(wallet.address.length, 46, "mismatch in address length for wallet"); - assert.equal(wallet.publicKey, testPublicKey, "mismatch in public key for wallet"); - assert.equal(wallet.address, testAddress, "mismatch in seed length for wallet"); - }); -}); -//# sourceMappingURL=test-contract.js.map \ No newline at end of file diff --git a/lib.esm/_tests/test-contract.js.map b/lib.esm/_tests/test-contract.js.map deleted file mode 100644 index 83fc2155f..000000000 --- a/lib.esm/_tests/test-contract.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test-contract.js","sourceRoot":"","sources":["../../src.ts/_tests/test-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,WAAW,EACX,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,cAAc,GAAG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m/_tests/types.d.ts b/lib.esm/_tests/types.d.ts deleted file mode 100644 index 153d8067f..000000000 --- a/lib.esm/_tests/types.d.ts +++ /dev/null @@ -1,191 +0,0 @@ -export type TestCaseAbiVerbose = { - type: "address" | "hexstring" | "number" | "string"; - value: string; -} | { - type: "boolean"; - value: boolean; -} | { - type: "array"; - value: Array; -} | { - type: "object"; - value: Array; -}; -export interface TestCaseAbi { - name: string; - type: string; - value: any; - verbose: TestCaseAbiVerbose; - bytecode: string; - encoded: string; -} -export interface TestCaseAccount { - name: string; - privateKey: string; - address: string; - icap: string; -} -export type TestCaseCreate = { - sender: string; - creates: Array<{ - name: string; - nonce: number; - address: string; - }>; -}; -export type TestCaseCreate2 = { - sender: string; - creates: Array<{ - name: string; - salt: string; - initCode: string; - initCodeHash: string; - address: string; - }>; -}; -export interface TestCaseHash { - name: string; - data: string; - sha256: string; - sha512: string; - ripemd160: string; -} -export interface TestCasePbkdf { - name: string; - password: string; - salt: string; - dkLen: number; - pbkdf2: { - iterations: number; - algorithm: "sha256" | "sha512"; - key: string; - }; - scrypt: { - N: number; - r: number; - p: number; - key: string; - }; -} -export interface TestCaseHmac { - name: string; - data: string; - key: string; - algorithm: "sha256" | "sha512"; - hmac: string; -} -export interface TestCaseHash { - name: string; - data: string; - sha256: string; - sha512: string; - ripemd160: string; -} -export interface TestCaseTypedDataDomain { - name?: string; - version?: string; - networkId?: number; - verifyingContract?: string; - salt?: string; -} -export interface TestCaseTypedDataType { - name: string; - type: string; -} -export interface TestCaseTypedData { - name: string; - domain: TestCaseTypedDataDomain; - primaryType: string; - types: Record>; - data: any; - encoded: string; - digest: string; - privateKey?: string; - signature?: string; -} -export interface TestCaseSolidityHash { - name: string; - types: Array; - ripemd160: string; - sha256: string; - values: Array; -} -export type NestedHexString = string | Array; -export interface TestCaseRlp { - name: string; - encoded: string; - decoded: NestedHexString; -} -export interface TestCaseTransactionTx { - to?: string; - nonce?: number; - energyLimit?: string; - energyPrice?: string; - maxFeePerEnergy?: string; - data?: string; - value?: string; - accessList?: Array<{ - address: string; - storageKeys: Array; - }>; - networkId?: string; -} -export interface TestCaseTransactionSig { - r: string; - s: string; - v: string; -} -export interface TestCaseTransaction { - name: string; - transaction: TestCaseTransactionTx; - privateKey: string; - unsignedLegacy: string; - signedLegacy: string; - unsignedEip155: string; - signedEip155: string; - unsignedBerlin: string; - signedBerlin: string; - unsignedLondon: string; - signedLondon: string; - signatureLegacy: TestCaseTransactionSig; - signatureEip155: TestCaseTransactionSig; - signatureBerlin: TestCaseTransactionSig; - signatureLondon: TestCaseTransactionSig; -} -export interface TestCaseMnemonicNode { - path: string; - chainCode: string; - depth: number; - index: number; - parentFingerprint: string; - fingerprint: string; - publicKey: string; - privateKey: string; - xpriv: string; - xpub: string; -} -export interface TestCaseMnemonic { - name: string; - phrase: string; - phraseHash: string; - password: string; - locale: string; - entropy: string; - seed: string; - nodes: Array; -} -export interface TestCaseWallet { - name: string; - filename: string; - type: string; - address: string; - password: string; - content: string; -} -export interface TestCaseWordlist { - name: string; - filename: string; - locale: string; - content: string; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/lib.esm/_tests/types.d.ts.map b/lib.esm/_tests/types.d.ts.map deleted file mode 100644 index 6619a1cf6..000000000 --- a/lib.esm/_tests/types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src.ts/_tests/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAC1B;IACE,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACpD,KAAK,EAAE,MAAM,CAAC;CACf,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;CAChB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;CAClC,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf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MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB"} \ No newline at end of file diff --git a/lib.esm/_tests/types.js b/lib.esm/_tests/types.js deleted file mode 100644 index 718fd38ae..000000000 --- a/lib.esm/_tests/types.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/lib.esm/_tests/types.js.map b/lib.esm/_tests/types.js.map deleted file mode 100644 index 52b4d3276..000000000 --- a/lib.esm/_tests/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src.ts/_tests/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.esm/_version.d.ts b/lib.esm/_version.d.ts deleted file mode 100644 index ab655b4ad..000000000 --- a/lib.esm/_version.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * The current version of corebc. - */ -export declare const version: string; -//# sourceMappingURL=_version.d.ts.map \ No newline at end of file diff --git a/lib.esm/_version.d.ts.map b/lib.esm/_version.d.ts.map deleted file mode 100644 index 502b731b4..000000000 --- a/lib.esm/_version.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"_version.d.ts","sourceRoot":"","sources":["../src.ts/_version.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MAAgB,CAAC"} \ No newline at end of file diff --git a/lib.esm/_version.js b/lib.esm/_version.js deleted file mode 100644 index aefc1f0bb..000000000 --- a/lib.esm/_version.js +++ /dev/null @@ -1,6 +0,0 @@ -/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ -/** - * The current version of corebc. - */ -export const version = "6.4.0"; -//# sourceMappingURL=_version.js.map \ No newline at end of file diff --git a/lib.esm/_version.js.map b/lib.esm/_version.js.map deleted file mode 100644 index 360ba34f9..000000000 --- a/lib.esm/_version.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"_version.js","sourceRoot":"","sources":["../src.ts/_version.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAW,OAAO,CAAC"} \ No newline at end of file diff --git a/lib.esm/abi-types/Tes.d.ts b/lib.esm/abi-types/Tes.d.ts deleted file mode 100644 index ab20b2246..000000000 --- a/lib.esm/abi-types/Tes.d.ts +++ /dev/null @@ -1,223 +0,0 @@ -import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "../corebc.js"; -import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common.js"; -export interface TesInterface extends Interface { - getFunction(nameOrSignature: "approve" | "balanceOf" | "batchOwnerOf" | "getApproved" | "isApprovedForAll" | "mint" | "ownerOf" | "safeTransferFrom(address,address,uint256)" | "safeTransferFrom(address,address,uint256,bytes)" | "setApprovalForAll" | "tokenByIndex" | "tokenOfOwnerByIndex" | "totalSupply" | "transferFrom"): FunctionFragment; - getEvent(nameOrSignatureOrTopic: "Approval" | "ApprovalForAll" | "Transfer"): EventFragment; - encodeFunctionData(functionFragment: "approve", values: [AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "balanceOf", values: [AddressLike]): string; - encodeFunctionData(functionFragment: "batchOwnerOf", values: [BigNumberish[]]): string; - encodeFunctionData(functionFragment: "getApproved", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "isApprovedForAll", values: [AddressLike, AddressLike]): string; - encodeFunctionData(functionFragment: "mint", values: [AddressLike]): string; - encodeFunctionData(functionFragment: "ownerOf", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "safeTransferFrom(address,address,uint256)", values: [AddressLike, AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "safeTransferFrom(address,address,uint256,bytes)", values: [AddressLike, AddressLike, BigNumberish, BytesLike]): string; - encodeFunctionData(functionFragment: "setApprovalForAll", values: [AddressLike, boolean]): string; - encodeFunctionData(functionFragment: "tokenByIndex", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "tokenOfOwnerByIndex", values: [AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "totalSupply", values?: undefined): string; - encodeFunctionData(functionFragment: "transferFrom", values: [AddressLike, AddressLike, BigNumberish]): string; - decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "batchOwnerOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "getApproved", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "isApprovedForAll", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "ownerOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "safeTransferFrom(address,address,uint256)", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "safeTransferFrom(address,address,uint256,bytes)", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "setApprovalForAll", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "tokenByIndex", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "tokenOfOwnerByIndex", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "totalSupply", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "transferFrom", data: BytesLike): Result; -} -export declare namespace ApprovalEvent { - type InputTuple = [ - owner: AddressLike, - approved: AddressLike, - tokenId: BigNumberish - ]; - type OutputTuple = [owner: string, approved: string, tokenId: bigint]; - interface OutputObject { - owner: string; - approved: string; - tokenId: bigint; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export declare namespace ApprovalForAllEvent { - type InputTuple = [ - owner: AddressLike, - operator: AddressLike, - approved: boolean - ]; - type OutputTuple = [ - owner: string, - operator: string, - approved: boolean - ]; - interface OutputObject { - owner: string; - operator: string; - approved: boolean; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export declare namespace TransferEvent { - type InputTuple = [ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ]; - type OutputTuple = [from: string, to: string, tokenId: bigint]; - interface OutputObject { - from: string; - to: string; - tokenId: bigint; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export interface Tes extends BaseContract { - connect(runner?: ContractRunner | null): BaseContract; - attach(addressOrName: AddressLike): this; - deployed(): Promise; - interface: TesInterface; - queryFilter(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; - queryFilter(filter: TypedDeferredTopicFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; - on(event: TCEvent, listener: TypedListener): Promise; - on(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; - once(event: TCEvent, listener: TypedListener): Promise; - once(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - approve: TypedContractMethod<[ - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - balanceOf: TypedContractMethod<[owner: AddressLike], [bigint], "view">; - batchOwnerOf: TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - getApproved: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - isApprovedForAll: TypedContractMethod<[ - owner: AddressLike, - operator: AddressLike - ], [ - boolean - ], "view">; - mint: TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - ownerOf: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - "safeTransferFrom(address,address,uint256)": TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - "safeTransferFrom(address,address,uint256,bytes)": TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike - ], [ - void - ], "nonpayable">; - setApprovalForAll: TypedContractMethod<[ - operator: AddressLike, - approved: boolean - ], [ - void - ], "nonpayable">; - tokenByIndex: TypedContractMethod<[index: BigNumberish], [bigint], "view">; - tokenOfOwnerByIndex: TypedContractMethod<[ - owner: AddressLike, - index: BigNumberish - ], [ - bigint - ], "view">; - totalSupply: TypedContractMethod<[], [bigint], "view">; - transferFrom: TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(key: string | FunctionFragment): T; - getFunction(nameOrSignature: "approve"): TypedContractMethod<[ - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "balanceOf"): TypedContractMethod<[owner: AddressLike], [bigint], "view">; - getFunction(nameOrSignature: "batchOwnerOf"): TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - getFunction(nameOrSignature: "getApproved"): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction(nameOrSignature: "isApprovedForAll"): TypedContractMethod<[ - owner: AddressLike, - operator: AddressLike - ], [ - boolean - ], "view">; - getFunction(nameOrSignature: "mint"): TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - getFunction(nameOrSignature: "ownerOf"): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction(nameOrSignature: "safeTransferFrom(address,address,uint256)"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "safeTransferFrom(address,address,uint256,bytes)"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "setApprovalForAll"): TypedContractMethod<[ - operator: AddressLike, - approved: boolean - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "tokenByIndex"): TypedContractMethod<[index: BigNumberish], [bigint], "view">; - getFunction(nameOrSignature: "tokenOfOwnerByIndex"): TypedContractMethod<[ - owner: AddressLike, - index: BigNumberish - ], [ - bigint - ], "view">; - getFunction(nameOrSignature: "totalSupply"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "transferFrom"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getEvent(key: "Approval"): TypedContractEvent; - getEvent(key: "ApprovalForAll"): TypedContractEvent; - getEvent(key: "Transfer"): TypedContractEvent; - filters: { - "Approval(address,address,uint256)": TypedContractEvent; - Approval: TypedContractEvent; - "ApprovalForAll(address,address,bool)": TypedContractEvent; - ApprovalForAll: TypedContractEvent; - "Transfer(address,address,uint256)": TypedContractEvent; - Transfer: TypedContractEvent; - }; -} -//# sourceMappingURL=Tes.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi-types/Tes.d.ts.map b/lib.esm/abi-types/Tes.d.ts.map deleted file mode 100644 index 04a5ce028..000000000 --- a/lib.esm/abi-types/Tes.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes.d.ts","sourceRoot":"","sources":["../../src.ts/abi-types/Tes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACd,QAAQ,EACT,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,WAAW,CACT,eAAe,EACX,SAAS,GACT,WAAW,GACX,cAAc,GACd,aAAa,GACb,kBAAkB,GAClB,MAAM,GACN,SAAS,GACT,2CAA2C,GAC3C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AAE,kBAAkB,CACxD,mBAAmB,CAAC,UAAU,EAC9B,mBAAmB,CAAC,WAAW,EAC/B,mBAAmB,CAAC,YAAY,CACjC,CAAC;QACF,cAAc,EAAE,kBAAkB,CAChC,mBAAmB,CAAC,UAAU,EAC9B,mBAAmB,CAAC,WAAW,EAC/B,mBAAmB,CAAC,YAAY,CACjC,CAAC;QAEF,mCAAmC,EAAE,kBAAkB,CACrD,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,WAAW,EACzB,aAAa,CAAC,YAAY,CAC3B,CAAC;QACF,QAAQ,EAAE,kBAAkB,CAC1B,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,WAAW,EACzB,aAAa,CAAC,YAAY,CAC3B,CAAC;KACH,CAAC;CACH"} \ No newline at end of file diff --git a/lib.esm/abi-types/Tes.js b/lib.esm/abi-types/Tes.js deleted file mode 100644 index f3d1598c9..000000000 --- a/lib.esm/abi-types/Tes.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=Tes.js.map \ No newline at end of file diff --git a/lib.esm/abi-types/Tes.js.map b/lib.esm/abi-types/Tes.js.map deleted file mode 100644 index af1f5205d..000000000 --- a/lib.esm/abi-types/Tes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes.js","sourceRoot":"","sources":["../../src.ts/abi-types/Tes.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.esm/abi-types/Tes_abi.d.ts b/lib.esm/abi-types/Tes_abi.d.ts deleted file mode 100644 index 3df4e144e..000000000 --- a/lib.esm/abi-types/Tes_abi.d.ts +++ /dev/null @@ -1,223 +0,0 @@ -import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "../corebc.js"; -import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common.js"; -export interface Tes_abiInterface extends Interface { - getFunction(nameOrSignature: "approve" | "balanceOf" | "batchOwnerOf" | "getApproved" | "isApprovedForAll" | "mint" | "ownerOf" | "safeTransferFrom(address,address,uint256)" | "safeTransferFrom(address,address,uint256,bytes)" | "setApprovalForAll" | "tokenByIndex" | "tokenOfOwnerByIndex" | "totalSupply" | "transferFrom"): FunctionFragment; - getEvent(nameOrSignatureOrTopic: "Approval" | "ApprovalForAll" | "Transfer"): EventFragment; - encodeFunctionData(functionFragment: "approve", values: [AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "balanceOf", values: [AddressLike]): string; - encodeFunctionData(functionFragment: "batchOwnerOf", values: [BigNumberish[]]): string; - encodeFunctionData(functionFragment: "getApproved", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "isApprovedForAll", values: [AddressLike, AddressLike]): string; - encodeFunctionData(functionFragment: "mint", values: [AddressLike]): string; - encodeFunctionData(functionFragment: "ownerOf", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "safeTransferFrom(address,address,uint256)", values: [AddressLike, AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "safeTransferFrom(address,address,uint256,bytes)", values: [AddressLike, AddressLike, BigNumberish, BytesLike]): string; - encodeFunctionData(functionFragment: "setApprovalForAll", values: [AddressLike, boolean]): string; - encodeFunctionData(functionFragment: "tokenByIndex", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "tokenOfOwnerByIndex", values: [AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "totalSupply", values?: undefined): string; - encodeFunctionData(functionFragment: "transferFrom", values: [AddressLike, AddressLike, BigNumberish]): string; - decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "batchOwnerOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "getApproved", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "isApprovedForAll", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "ownerOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "safeTransferFrom(address,address,uint256)", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "safeTransferFrom(address,address,uint256,bytes)", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "setApprovalForAll", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "tokenByIndex", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "tokenOfOwnerByIndex", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "totalSupply", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "transferFrom", data: BytesLike): Result; -} -export declare namespace ApprovalEvent { - type InputTuple = [ - owner: AddressLike, - approved: AddressLike, - tokenId: BigNumberish - ]; - type OutputTuple = [owner: string, approved: string, tokenId: bigint]; - interface OutputObject { - owner: string; - approved: string; - tokenId: bigint; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export declare namespace ApprovalForAllEvent { - type InputTuple = [ - owner: AddressLike, - operator: AddressLike, - approved: boolean - ]; - type OutputTuple = [ - owner: string, - operator: string, - approved: boolean - ]; - interface OutputObject { - owner: string; - operator: string; - approved: boolean; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export declare namespace TransferEvent { - type InputTuple = [ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ]; - type OutputTuple = [from: string, to: string, tokenId: bigint]; - interface OutputObject { - from: string; - to: string; - tokenId: bigint; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export interface Tes_abi extends BaseContract { - connect(runner?: ContractRunner | null): BaseContract; - attach(addressOrName: AddressLike): this; - deployed(): Promise; - interface: Tes_abiInterface; - queryFilter(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; - queryFilter(filter: TypedDeferredTopicFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; - on(event: TCEvent, listener: TypedListener): Promise; - on(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; - once(event: TCEvent, listener: TypedListener): Promise; - once(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - approve: TypedContractMethod<[ - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - balanceOf: TypedContractMethod<[owner: AddressLike], [bigint], "view">; - batchOwnerOf: TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - getApproved: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - isApprovedForAll: TypedContractMethod<[ - owner: AddressLike, - operator: AddressLike - ], [ - boolean - ], "view">; - mint: TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - ownerOf: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - "safeTransferFrom(address,address,uint256)": TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - "safeTransferFrom(address,address,uint256,bytes)": TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike - ], [ - void - ], "nonpayable">; - setApprovalForAll: TypedContractMethod<[ - operator: AddressLike, - approved: boolean - ], [ - void - ], "nonpayable">; - tokenByIndex: TypedContractMethod<[index: BigNumberish], [bigint], "view">; - tokenOfOwnerByIndex: TypedContractMethod<[ - owner: AddressLike, - index: BigNumberish - ], [ - bigint - ], "view">; - totalSupply: TypedContractMethod<[], [bigint], "view">; - transferFrom: TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(key: string | FunctionFragment): T; - getFunction(nameOrSignature: "approve"): TypedContractMethod<[ - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "balanceOf"): TypedContractMethod<[owner: AddressLike], [bigint], "view">; - getFunction(nameOrSignature: "batchOwnerOf"): TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - getFunction(nameOrSignature: "getApproved"): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction(nameOrSignature: "isApprovedForAll"): TypedContractMethod<[ - owner: AddressLike, - operator: AddressLike - ], [ - boolean - ], "view">; - getFunction(nameOrSignature: "mint"): TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - getFunction(nameOrSignature: "ownerOf"): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction(nameOrSignature: "safeTransferFrom(address,address,uint256)"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "safeTransferFrom(address,address,uint256,bytes)"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "setApprovalForAll"): TypedContractMethod<[ - operator: AddressLike, - approved: boolean - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "tokenByIndex"): TypedContractMethod<[index: BigNumberish], [bigint], "view">; - getFunction(nameOrSignature: "tokenOfOwnerByIndex"): TypedContractMethod<[ - owner: AddressLike, - index: BigNumberish - ], [ - bigint - ], "view">; - getFunction(nameOrSignature: "totalSupply"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "transferFrom"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getEvent(key: "Approval"): TypedContractEvent; - getEvent(key: "ApprovalForAll"): TypedContractEvent; - getEvent(key: "Transfer"): TypedContractEvent; - filters: { - "Approval(address,address,uint256)": TypedContractEvent; - Approval: TypedContractEvent; - "ApprovalForAll(address,address,bool)": TypedContractEvent; - ApprovalForAll: TypedContractEvent; - "Transfer(address,address,uint256)": TypedContractEvent; - Transfer: TypedContractEvent; - }; -} -//# sourceMappingURL=Tes_abi.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi-types/Tes_abi.d.ts.map b/lib.esm/abi-types/Tes_abi.d.ts.map deleted file mode 100644 index 4d5fd9d95..000000000 --- a/lib.esm/abi-types/Tes_abi.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes_abi.d.ts","sourceRoot":"","sources":["../../src.ts/abi-types/Tes_abi.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACd,QAAQ,EACT,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,WAAW,CACT,eAAe,EACX,SAAS,GACT,WAAW,GACX,cAAc,GACd,aAAa,GACb,kBAAkB,GAClB,MAAM,GACN,SAAS,GACT,2CAA2C,GAC3C,iDAAiD,GACjD,mBAAmB,GACnB,cAAc,GACd,qBAAqB,GACrB,aAAa,GACb,cAAc,GACjB,gBAAgB,CAAC;IAEpB,QAAQ,CACN,sBAAsB,EAAE,UAAU,GAAG,gBAAgB,GAAG,UAAU,GACjE,aAAa,CAAC;IAEjB,kBAAkB,CAChB,gBAAgB,EAAE,SAAS,EAC3B,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,GAClC,MAAM,CAAC;IACV,kBAAkB,CAChB,gBAAgB,EAAE,WAAW,EAC7B,MAAM,EAAE,CAAC,WAAW,CAAC,GACpB,MAAM,CAAC;IACV,kBAAkB,CAChB,gBAAgB,EAAE,cAAc,EAChC,MAAM,EAAE,CAAC,Y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CAC3B,CAAC;KACH,CAAC;CACH"} \ No newline at end of file diff --git a/lib.esm/abi-types/Tes_abi.js b/lib.esm/abi-types/Tes_abi.js deleted file mode 100644 index d4dbd3bd3..000000000 --- a/lib.esm/abi-types/Tes_abi.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=Tes_abi.js.map \ No newline at end of file diff --git a/lib.esm/abi-types/Tes_abi.js.map b/lib.esm/abi-types/Tes_abi.js.map deleted file mode 100644 index 062e82f0f..000000000 --- a/lib.esm/abi-types/Tes_abi.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes_abi.js","sourceRoot":"","sources":["../../src.ts/abi-types/Tes_abi.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.esm/abi-types/common.d.ts b/lib.esm/abi-types/common.d.ts deleted file mode 100644 index d6e86d0d7..000000000 --- a/lib.esm/abi-types/common.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import type { FunctionFragment, Typed, EventFragment, ContractTransaction, ContractTransactionResponse, DeferredTopicFilter, EventLog, TransactionRequest, LogDescription } from "../corebc.js"; -export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> extends DeferredTopicFilter { -} -export interface TypedContractEvent = any, OutputTuple extends Array = any, OutputObject = any> { - (...args: Partial): TypedDeferredTopicFilter>; - name: string; - fragment: EventFragment; - getFragment(...args: Partial): EventFragment; -} -type __TypechainAOutputTuple = T extends TypedContractEvent ? W : never; -type __TypechainOutputObject = T extends TypedContractEvent ? V : never; -export interface TypedEventLog extends Omit { - args: __TypechainAOutputTuple & __TypechainOutputObject; -} -export interface TypedLogDescription extends Omit { - args: __TypechainAOutputTuple & __TypechainOutputObject; -} -export type TypedListener = (...listenerArg: [ - ...__TypechainAOutputTuple, - TypedEventLog, - ...undefined[] -]) => void; -export type MinCoreBCFactory = { - deploy(...a: ARGS[]): Promise; -}; -export type GetContractTypeFromFactory = F extends MinCoreBCFactory ? C : never; -export type GetARGsTypeFromFactory = F extends MinCoreBCFactory ? Parameters : never; -export type StateMutability = "nonpayable" | "payable" | "view"; -export type BaseOverrides = Omit; -export type NonPayableOverrides = Omit; -export type PayableOverrides = Omit; -export type ViewOverrides = Omit; -export type Overrides = S extends "nonpayable" ? NonPayableOverrides : S extends "payable" ? PayableOverrides : ViewOverrides; -export type PostfixOverrides, S extends StateMutability> = A | [...A, Overrides]; -export type ContractMethodArgs, S extends StateMutability> = PostfixOverrides<{ - [I in keyof A]-?: A[I] | Typed; -}, S>; -export type DefaultReturnType = R extends Array ? R[0] : R; -export interface TypedContractMethod = Array, R = any, S extends StateMutability = "payable"> { - (...args: ContractMethodArgs): S extends "view" ? Promise> : Promise; - name: string; - fragment: FunctionFragment; - getFragment(...args: ContractMethodArgs): FunctionFragment; - populateTransaction(...args: ContractMethodArgs): Promise; - staticCall(...args: ContractMethodArgs): Promise>; - send(...args: ContractMethodArgs): Promise; - estimateGas(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; -} -export {}; -//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi-types/common.d.ts.map b/lib.esm/abi-types/common.d.ts.map deleted file mode 100644 index 1d45da294..000000000 --- a/lib.esm/abi-types/common.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src.ts/abi-types/common.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,gBAAgB,EAChB,KAAK,EACL,aAAa,EACb,mBAAmB,EACnB,2BAA2B,EAC3B,mBAAmB,EACnB,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACf,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,wBAAwB,CAAC,QAAQ,SAAS,kBAAkB,CAC3E,SAAQ,mBAAmB;CAAG;AAEhC,MAAM,WAAW,kBAAkB,CACjC,UAAU,SAAS,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,EACnC,WAAW,SAAS,KAAK,CAAC,G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E,gBAAgB,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACjE"} \ No newline at end of file diff --git a/lib.esm/abi-types/common.js b/lib.esm/abi-types/common.js deleted file mode 100644 index 6b84ded1c..000000000 --- a/lib.esm/abi-types/common.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/lib.esm/abi-types/common.js.map b/lib.esm/abi-types/common.js.map deleted file mode 100644 index a8598baee..000000000 --- a/lib.esm/abi-types/common.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src.ts/abi-types/common.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.esm/abi-types/factories/Tes__factory.d.ts b/lib.esm/abi-types/factories/Tes__factory.d.ts deleted file mode 100644 index 9fb691f6d..000000000 --- a/lib.esm/abi-types/factories/Tes__factory.d.ts +++ /dev/null @@ -1,280 +0,0 @@ -import { ContractRunner } from "../../corebc.js"; -import type { Tes, TesInterface } from "../Tes.js"; -export declare class Tes__factory { - static readonly abi: readonly [{ - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "approved"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "Approval"; - readonly type: "event"; - }, { - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }, { - readonly indexed: false; - readonly internalType: "bool"; - readonly name: "approved"; - readonly type: "bool"; - }]; - readonly name: "ApprovalForAll"; - readonly type: "event"; - }, { - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "Transfer"; - readonly type: "event"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "approve"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }]; - readonly name: "balanceOf"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256[]"; - readonly name: "ids"; - readonly type: "uint256[]"; - }]; - readonly name: "batchOwnerOf"; - readonly outputs: readonly [{ - readonly internalType: "address[]"; - readonly name: ""; - readonly type: "address[]"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "getApproved"; - readonly outputs: readonly [{ - readonly internalType: "address"; - readonly name: ""; - readonly type: "address"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }]; - readonly name: "isApprovedForAll"; - readonly outputs: readonly [{ - readonly internalType: "bool"; - readonly name: ""; - readonly type: "bool"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }]; - readonly name: "mint"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "ownerOf"; - readonly outputs: readonly [{ - readonly internalType: "address"; - readonly name: ""; - readonly type: "address"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "safeTransferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }, { - readonly internalType: "bytes"; - readonly name: "data"; - readonly type: "bytes"; - }]; - readonly name: "safeTransferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }, { - readonly internalType: "bool"; - readonly name: "approved"; - readonly type: "bool"; - }]; - readonly name: "setApprovalForAll"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "index"; - readonly type: "uint256"; - }]; - readonly name: "tokenByIndex"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "index"; - readonly type: "uint256"; - }]; - readonly name: "tokenOfOwnerByIndex"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly []; - readonly name: "totalSupply"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "transferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }]; - static createInterface(): TesInterface; - static connect(address: string, runner?: ContractRunner | null): Tes; -} -//# sourceMappingURL=Tes__factory.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi-types/factories/Tes__factory.d.ts.map b/lib.esm/abi-types/factories/Tes__factory.d.ts.map deleted file mode 100644 index 9c0f56a13..000000000 --- a/lib.esm/abi-types/factories/Tes__factory.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes__factory.d.ts","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/Tes__factory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAY,cAAc,EAAa,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAuWnD,qBAAa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAQ;IAC3B,MAAM,CAAC,eAAe,IAAI,YAAY;IAGtC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,GAAG,GAAG;CAGrE"} \ No newline at end of file diff --git a/lib.esm/abi-types/factories/Tes__factory.js b/lib.esm/abi-types/factories/Tes__factory.js deleted file mode 100644 index e8cdaadd8..000000000 --- a/lib.esm/abi-types/factories/Tes__factory.js +++ /dev/null @@ -1,370 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, Interface } from "../../corebc.js"; -const _abi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "approved", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "Approval", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "operator", - type: "address", - }, - { - indexed: false, - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "ApprovalForAll", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "to", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "Transfer", - type: "event", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "approve", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "balanceOf", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256[]", - name: "ids", - type: "uint256[]", - }, - ], - name: "batchOwnerOf", - outputs: [ - { - internalType: "address[]", - name: "", - type: "address[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "getApproved", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "operator", - type: "address", - }, - ], - name: "isApprovedForAll", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - ], - name: "mint", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "ownerOf", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - { - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "setApprovalForAll", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "index", - type: "uint256", - }, - ], - name: "tokenByIndex", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "uint256", - name: "index", - type: "uint256", - }, - ], - name: "tokenOfOwnerByIndex", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "totalSupply", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "transferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, -]; -export class Tes__factory { - static abi = _abi; - static createInterface() { - return new Interface(_abi); - } - static connect(address, runner) { - return new Contract(address, _abi, runner); - } -} -//# sourceMappingURL=Tes__factory.js.map \ No newline at end of file diff --git a/lib.esm/abi-types/factories/Tes__factory.js.map b/lib.esm/abi-types/factories/Tes__factory.js.map deleted file mode 100644 index f47fa5aff..000000000 --- a/lib.esm/abi-types/factories/Tes__factory.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes__factory.js","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/Tes__factory.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,OAAO,EAAE,QAAQ,EAAkB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGtE,MAAM,IAAI,GAAG;IACX;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,UAAU;gBAChB,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KACjB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX,MAAM,OAAO,YAAY;IACvB,MAAM,CAAU,GAAG,GAAG,IAAI,CAAC;IAC3B,MAAM,CAAC,eAAe;QACpB,OAAO,IAAI,SAAS,CAAC,IAAI,CAAiB,CAAC;IAC7C,CAAC;IACD,MAAM,CAAC,OAAO,CAAC,OAAe,EAAE,MAA8B;QAC5D,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAmB,CAAC;IAC/D,CAAC"} \ No newline at end of file diff --git a/lib.esm/abi-types/factories/Tes_abi__factory.d.ts b/lib.esm/abi-types/factories/Tes_abi__factory.d.ts deleted file mode 100644 index bd8c9ccc6..000000000 --- a/lib.esm/abi-types/factories/Tes_abi__factory.d.ts +++ /dev/null @@ -1,280 +0,0 @@ -import { ContractRunner } from "../../corebc.js"; -import type { Tes_abi, Tes_abiInterface } from "../Tes_abi.js"; -export declare class Tes_abi__factory { - static readonly abi: readonly [{ - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "approved"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "Approval"; - readonly type: "event"; - }, { - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }, { - readonly indexed: false; - readonly internalType: "bool"; - readonly name: "approved"; - readonly type: "bool"; - }]; - readonly name: "ApprovalForAll"; - readonly type: "event"; - }, { - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "Transfer"; - readonly type: "event"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "approve"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }]; - readonly name: "balanceOf"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256[]"; - readonly name: "ids"; - readonly type: "uint256[]"; - }]; - readonly name: "batchOwnerOf"; - readonly outputs: readonly [{ - readonly internalType: "address[]"; - readonly name: ""; - readonly type: "address[]"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "getApproved"; - readonly outputs: readonly [{ - readonly internalType: "address"; - readonly name: ""; - readonly type: "address"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }]; - readonly name: "isApprovedForAll"; - readonly outputs: readonly [{ - readonly internalType: "bool"; - readonly name: ""; - readonly type: "bool"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }]; - readonly name: "mint"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "ownerOf"; - readonly outputs: readonly [{ - readonly internalType: "address"; - readonly name: ""; - readonly type: "address"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "safeTransferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }, { - readonly internalType: "bytes"; - readonly name: "data"; - readonly type: "bytes"; - }]; - readonly name: "safeTransferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }, { - readonly internalType: "bool"; - readonly name: "approved"; - readonly type: "bool"; - }]; - readonly name: "setApprovalForAll"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "index"; - readonly type: "uint256"; - }]; - readonly name: "tokenByIndex"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "index"; - readonly type: "uint256"; - }]; - readonly name: "tokenOfOwnerByIndex"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly []; - readonly name: "totalSupply"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "transferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }]; - static createInterface(): Tes_abiInterface; - static connect(address: string, runner?: ContractRunner | null): Tes_abi; -} -//# sourceMappingURL=Tes_abi__factory.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi-types/factories/Tes_abi__factory.d.ts.map b/lib.esm/abi-types/factories/Tes_abi__factory.d.ts.map deleted file mode 100644 index 5abc35679..000000000 --- a/lib.esm/abi-types/factories/Tes_abi__factory.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes_abi__factory.d.ts","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/Tes_abi__factory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAY,cAAc,EAAa,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAuW/D,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAQ;IAC3B,MAAM,CAAC,eAAe,IAAI,gBAAgB;IAG1C,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO;CAGzE"} \ No newline at end of file diff --git a/lib.esm/abi-types/factories/Tes_abi__factory.js b/lib.esm/abi-types/factories/Tes_abi__factory.js deleted file mode 100644 index fa0ef0747..000000000 --- a/lib.esm/abi-types/factories/Tes_abi__factory.js +++ /dev/null @@ -1,370 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, Interface } from "../../corebc.js"; -const _abi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "approved", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "Approval", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "operator", - type: "address", - }, - { - indexed: false, - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "ApprovalForAll", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "to", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "Transfer", - type: "event", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "approve", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "balanceOf", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256[]", - name: "ids", - type: "uint256[]", - }, - ], - name: "batchOwnerOf", - outputs: [ - { - internalType: "address[]", - name: "", - type: "address[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "getApproved", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "operator", - type: "address", - }, - ], - name: "isApprovedForAll", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - ], - name: "mint", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "ownerOf", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - { - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "setApprovalForAll", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "index", - type: "uint256", - }, - ], - name: "tokenByIndex", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "uint256", - name: "index", - type: "uint256", - }, - ], - name: "tokenOfOwnerByIndex", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "totalSupply", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "transferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, -]; -export class Tes_abi__factory { - static abi = _abi; - static createInterface() { - return new Interface(_abi); - } - static connect(address, runner) { - return new Contract(address, _abi, runner); - } -} -//# sourceMappingURL=Tes_abi__factory.js.map \ No newline at end of file diff --git a/lib.esm/abi-types/factories/Tes_abi__factory.js.map b/lib.esm/abi-types/factories/Tes_abi__factory.js.map deleted file mode 100644 index e85ea92b7..000000000 --- a/lib.esm/abi-types/factories/Tes_abi__factory.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes_abi__factory.js","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/Tes_abi__factory.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,OAAO,EAAE,QAAQ,EAAkB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGtE,MAAM,IAAI,GAAG;IACX;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,MAAM;gBACpB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,MAAM;aACb;SACF;QACD,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,S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O,IAAI,SAAS,CAAC,IAAI,CAAqB,CAAC;IACjD,CAAC;IACD,MAAM,CAAC,OAAO,CAAC,OAAe,EAAE,MAA8B;QAC5D,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAuB,CAAC;IACnE,CAAC"} \ No newline at end of file diff --git a/lib.esm/abi-types/factories/index.d.ts b/lib.esm/abi-types/factories/index.d.ts deleted file mode 100644 index e6b4dbcc0..000000000 --- a/lib.esm/abi-types/factories/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { Tes__factory } from "./Tes__factory.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi-types/factories/index.d.ts.map b/lib.esm/abi-types/factories/index.d.ts.map deleted file mode 100644 index 2727001fd..000000000 --- a/lib.esm/abi-types/factories/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"} \ No newline at end of file diff --git a/lib.esm/abi-types/factories/index.js b/lib.esm/abi-types/factories/index.js deleted file mode 100644 index aec5242f0..000000000 --- a/lib.esm/abi-types/factories/index.js +++ /dev/null @@ -1,5 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export { Tes__factory } from "./Tes__factory.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.esm/abi-types/factories/index.js.map b/lib.esm/abi-types/factories/index.js.map deleted file mode 100644 index a0c44e814..000000000 --- a/lib.esm/abi-types/factories/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"} \ No newline at end of file diff --git a/lib.esm/abi-types/index.d.ts b/lib.esm/abi-types/index.d.ts deleted file mode 100644 index ca4fb7b40..000000000 --- a/lib.esm/abi-types/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type { Tes } from "./Tes.js"; -export * as factories from "./factories/index.js"; -export { Tes__factory } from "./factories/Tes__factory.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi-types/index.d.ts.map b/lib.esm/abi-types/index.d.ts.map deleted file mode 100644 index 90d11b2fc..000000000 --- a/lib.esm/abi-types/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/abi-types/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC"} \ No newline at end of file diff --git a/lib.esm/abi-types/index.js b/lib.esm/abi-types/index.js deleted file mode 100644 index cb04736a0..000000000 --- a/lib.esm/abi-types/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export * as factories from "./factories/index.js"; -export { Tes__factory } from "./factories/Tes__factory.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.esm/abi-types/index.js.map b/lib.esm/abi-types/index.js.map deleted file mode 100644 index 9c9c7ed92..000000000 --- a/lib.esm/abi-types/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/abi-types/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC"} \ No newline at end of file diff --git a/lib.esm/abi/abi-coder.d.ts b/lib.esm/abi/abi-coder.d.ts deleted file mode 100644 index 1350031d4..000000000 --- a/lib.esm/abi/abi-coder.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * When sending values to or receiving values from a [[Contract]], the - * data is generally encoded using the [ABI standard](link-solc-abi). - * - * The AbiCoder provides a utility to encode values to ABI data and - * decode values from ABI data. - * - * Most of the time, developers should favour the [[Contract]] class, - * which further abstracts a lot of the finer details of ABI data. - * - * @_section api/abi/abi-coder:ABI Encoding - */ -import { Result } from "./coders/abstract-coder.js"; -import { ParamType } from "./fragments.js"; -import type { BytesLike, CallExceptionAction, CallExceptionError } from "../utils/index.js"; -/** - * About AbiCoder - */ -export declare class AbiCoder { - #private; - /** - * Get the default values for the given %%types%%. - * - * For example, a ``uint`` is by default ``0`` and ``bool`` - * is by default ``false``. - */ - getDefaultValue(types: ReadonlyArray): Result; - /** - * Encode the %%values%% as the %%types%% into ABI data. - * - * @returns DataHexstring - */ - encode(types: ReadonlyArray, values: ReadonlyArray): string; - /** - * Decode the ABI %%data%% as the %%types%% into values. - * - * If %%loose%% decoding is enabled, then strict padding is - * not enforced. Some older versions of Solidity incorrectly - * padded event data emitted from ``external`` functions. - */ - decode(types: ReadonlyArray, data: BytesLike, loose?: boolean): Result; - /** - * Returns the shared singleton instance of a default [[AbiCoder]]. - * - * On the first call, the instance is created internally. - */ - static defaultAbiCoder(): AbiCoder; - /** - * Returns an corebc-compatible [[CallExceptionError]] Error for the given - * result %%data%% for the [[CallExceptionAction]] %%action%% against - * the Transaction %%tx%%. - */ - static getBuiltinCallException(action: CallExceptionAction, tx: { - to?: null | string; - from?: null | string; - data?: string; - }, data: null | BytesLike): CallExceptionError; -} -//# sourceMappingURL=abi-coder.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/abi-coder.d.ts.map b/lib.esm/abi/abi-coder.d.ts.map deleted file mode 100644 index a86e1aca8..000000000 --- a/lib.esm/abi/abi-coder.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abi-coder.d.ts","sourceRoot":"","sources":["../../src.ts/abi/abi-coder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAiB,MAAM,EAAU,MAAM,4BAA4B,CAAC;AAU3E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAEnB,MAAM,mBAAmB,CAAC;AA8F3B;;GAEG;AACH,qBAAa,QAAQ;;IA2DnB;;;;;OAKG;IACH,eAAe,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM;IAQjE;;;;OAIG;IACH,MAAM,CACJ,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EACxC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GACzB,MAAM;IAeT;;;;;;OAMG;IACH,MAAM,CACJ,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EACxC,IAAI,EAAE,SAAS,EACf,KAAK,CAAC,EAAE,OAAO,GACd,MAAM;IAQT;;;;OAIG;IACH,MAAM,CAAC,eAAe,IAAI,QAAQ;IAOlC;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAC5B,MAAM,EAAE,mBAAmB,EAC3B,EAAE,EAAE;QAAE,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAC/D,IAAI,EAAE,IAAI,GAAG,SAAS,GACrB,kBAAkB;CAQtB"} \ No newline at end of file diff --git a/lib.esm/abi/abi-coder.js b/lib.esm/abi/abi-coder.js deleted file mode 100644 index 38be576e3..000000000 --- a/lib.esm/abi/abi-coder.js +++ /dev/null @@ -1,204 +0,0 @@ -/** - * When sending values to or receiving values from a [[Contract]], the - * data is generally encoded using the [ABI standard](link-solc-abi). - * - * The AbiCoder provides a utility to encode values to ABI data and - * decode values from ABI data. - * - * Most of the time, developers should favour the [[Contract]] class, - * which further abstracts a lot of the finer details of ABI data. - * - * @_section api/abi/abi-coder:ABI Encoding - */ -import { assertArgumentCount, assertArgument } from "../utils/index.js"; -import { Reader, Writer } from "./coders/abstract-coder.js"; -import { AddressCoder } from "./coders/address.js"; -import { ArrayCoder } from "./coders/array.js"; -import { BooleanCoder } from "./coders/boolean.js"; -import { BytesCoder } from "./coders/bytes.js"; -import { FixedBytesCoder } from "./coders/fixed-bytes.js"; -import { NullCoder } from "./coders/null.js"; -import { NumberCoder } from "./coders/number.js"; -import { StringCoder } from "./coders/string.js"; -import { TupleCoder } from "./coders/tuple.js"; -import { ParamType } from "./fragments.js"; -import { getAddress } from "../address/index.js"; -import { getBytes, hexlify, makeError } from "../utils/index.js"; -// https://docs.soliditylang.org/en/v0.8.17/control-structures.html -const PanicReasons = new Map(); -PanicReasons.set(0x00, "GENERIC_PANIC"); -PanicReasons.set(0x01, "ASSERT_FALSE"); -PanicReasons.set(0x11, "OVERFLOW"); -PanicReasons.set(0x12, "DIVIDE_BY_ZERO"); -PanicReasons.set(0x21, "ENUM_RANGE_ERROR"); -PanicReasons.set(0x22, "BAD_STORAGE_DATA"); -PanicReasons.set(0x31, "STACK_UNDERFLOW"); -PanicReasons.set(0x32, "ARRAY_RANGE_ERROR"); -PanicReasons.set(0x41, "OUT_OF_MEMORY"); -PanicReasons.set(0x51, "UNINITIALIZED_FUNCTION_CALL"); -const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); -const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); -let defaultCoder = null; -function getBuiltinCallException(action, tx, data, abiCoder) { - let message = "missing revert data"; - let reason = null; - const invocation = null; - let revert = null; - if (data) { - message = "execution reverted"; - const bytes = getBytes(data); - data = hexlify(data); - if (bytes.length === 0) { - message += " (no data present; likely require(false) occurred"; - reason = "require(false)"; - } - else if (bytes.length % 32 !== 4) { - message += " (could not decode reason; invalid data length)"; - } - else if (hexlify(bytes.slice(0, 4)) === "0x08c379a0") { - // Error(string) - try { - reason = abiCoder.decode(["string"], bytes.slice(4))[0]; - revert = { - signature: "Error(string)", - name: "Error", - args: [reason], - }; - message += `: ${JSON.stringify(reason)}`; - } - catch (error) { - message += " (could not decode reason; invalid string data)"; - } - } - else if (hexlify(bytes.slice(0, 4)) === "0x4e487b71") { - // Panic(uint256) - try { - const code = Number(abiCoder.decode(["uint256"], bytes.slice(4))[0]); - revert = { - signature: "Panic(uint256)", - name: "Panic", - args: [code], - }; - reason = `Panic due to ${PanicReasons.get(code) || "UNKNOWN"}(${code})`; - message += `: ${reason}`; - } - catch (error) { - message += " (could not decode panic code)"; - } - } - else { - message += " (unknown custom error)"; - } - } - const transaction = { - to: tx.to ? getAddress(tx.to) : null, - data: tx.data || "0x", - }; - if (tx.from) { - transaction.from = getAddress(tx.from); - } - return makeError(message, "CALL_EXCEPTION", { - action, - data, - reason, - transaction, - invocation, - revert, - }); -} -/** - * About AbiCoder - */ -export class AbiCoder { - #getCoder(param) { - if (param.isArray()) { - return new ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name); - } - if (param.isTuple()) { - return new TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name); - } - switch (param.baseType) { - case "address": - return new AddressCoder(param.name); - case "bool": - return new BooleanCoder(param.name); - case "string": - return new StringCoder(param.name); - case "bytes": - return new BytesCoder(param.name); - case "": - return new NullCoder(param.name); - } - // u?int[0-9]* - let match = param.type.match(paramTypeNumber); - if (match) { - let size = parseInt(match[2] || "256"); - assertArgument(size !== 0 && size <= 256 && size % 8 === 0, "invalid " + match[1] + " bit length", "param", param); - return new NumberCoder(size / 8, match[1] === "int", param.name); - } - // bytes[0-9]+ - match = param.type.match(paramTypeBytes); - if (match) { - let size = parseInt(match[1]); - assertArgument(size !== 0 && size <= 32, "invalid bytes length", "param", param); - return new FixedBytesCoder(size, param.name); - } - assertArgument(false, "invalid type", "type", param.type); - } - /** - * Get the default values for the given %%types%%. - * - * For example, a ``uint`` is by default ``0`` and ``bool`` - * is by default ``false``. - */ - getDefaultValue(types) { - const coders = types.map((type) => this.#getCoder(ParamType.from(type))); - const coder = new TupleCoder(coders, "_"); - return coder.defaultValue(); - } - /** - * Encode the %%values%% as the %%types%% into ABI data. - * - * @returns DataHexstring - */ - encode(types, values) { - assertArgumentCount(values.length, types.length, "types/values length mismatch"); - const coders = types.map((type) => this.#getCoder(ParamType.from(type))); - const coder = new TupleCoder(coders, "_"); - const writer = new Writer(); - coder.encode(writer, values); - return writer.data; - } - /** - * Decode the ABI %%data%% as the %%types%% into values. - * - * If %%loose%% decoding is enabled, then strict padding is - * not enforced. Some older versions of Solidity incorrectly - * padded event data emitted from ``external`` functions. - */ - decode(types, data, loose) { - const coders = types.map((type) => this.#getCoder(ParamType.from(type))); - const coder = new TupleCoder(coders, "_"); - return coder.decode(new Reader(data, loose)); - } - /** - * Returns the shared singleton instance of a default [[AbiCoder]]. - * - * On the first call, the instance is created internally. - */ - static defaultAbiCoder() { - if (defaultCoder == null) { - defaultCoder = new AbiCoder(); - } - return defaultCoder; - } - /** - * Returns an corebc-compatible [[CallExceptionError]] Error for the given - * result %%data%% for the [[CallExceptionAction]] %%action%% against - * the Transaction %%tx%%. - */ - static getBuiltinCallException(action, tx, data) { - return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder()); - } -} -//# sourceMappingURL=abi-coder.js.map \ No newline at end of file diff --git a/lib.esm/abi/abi-coder.js.map b/lib.esm/abi/abi-coder.js.map deleted file mode 100644 index d79f4b139..000000000 --- a/lib.esm/abi/abi-coder.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abi-coder.js","sourceRoot":"","sources":["../../src.ts/abi/abi-coder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAS,MAAM,EAAU,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,YAAY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S,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACzE,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAE1C,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QAC5B,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC7B,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CACJ,KAAwC,EACxC,IAAe,EACf,KAAe;QAEf,MAAM,MAAM,GAAiB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAC9C,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CACrC,CAAC;QACF,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC1C,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,eAAe;QACpB,IAAI,YAAY,IAAI,IAAI,EAAE;YACxB,YAAY,GAAG,IAAI,QAAQ,EAAE,CAAC;SAC/B;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAC5B,MAA2B,EAC3B,EAA+D,EAC/D,IAAsB;QAEtB,OAAO,uBAAuB,CAC5B,MAAM,EACN,EAAE,EACF,IAAI,EACJ,QAAQ,CAAC,eAAe,EAAE,CAC3B,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/abi/bytes32.d.ts b/lib.esm/abi/bytes32.d.ts deleted file mode 100644 index 73455cb5d..000000000 --- a/lib.esm/abi/bytes32.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * About bytes32 strings... - * - * @_docloc: api/utils:Bytes32 Strings - */ -import type { BytesLike } from "../utils/index.js"; -/** - * Encodes %%text%% as a Bytes32 string. - */ -export declare function encodeBytes32String(text: string): string; -/** - * Encodes the Bytes32-encoded %%bytes%% into a string. - */ -export declare function decodeBytes32String(_bytes: BytesLike): string; -//# sourceMappingURL=bytes32.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/bytes32.d.ts.map b/lib.esm/abi/bytes32.d.ts.map deleted file mode 100644 index 09513605d..000000000 --- a/lib.esm/abi/bytes32.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bytes32.d.ts","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWxD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAmB7D"} \ No newline at end of file diff --git a/lib.esm/abi/bytes32.js b/lib.esm/abi/bytes32.js deleted file mode 100644 index 95f635d3f..000000000 --- a/lib.esm/abi/bytes32.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * About bytes32 strings... - * - * @_docloc: api/utils:Bytes32 Strings - */ -import { getBytes, toUtf8Bytes, toUtf8String, zeroPadBytes, } from "../utils/index.js"; -/** - * Encodes %%text%% as a Bytes32 string. - */ -export function encodeBytes32String(text) { - // Get the bytes - const bytes = toUtf8Bytes(text); - // Check we have room for null-termination - if (bytes.length > 31) { - throw new Error("bytes32 string must be less than 32 bytes"); - } - // Zero-pad (implicitly null-terminates) - return zeroPadBytes(bytes, 32); -} -/** - * Encodes the Bytes32-encoded %%bytes%% into a string. - */ -export function decodeBytes32String(_bytes) { - const data = getBytes(_bytes, "bytes"); - // Must be 32 bytes with a null-termination - if (data.length !== 32) { - throw new Error("invalid bytes32 - not 32 bytes long"); - } - if (data[31] !== 0) { - throw new Error("invalid bytes32 string - no null terminator"); - } - // Find the null termination - let length = 31; - while (data[length - 1] === 0) { - length--; - } - // Determine the string value - return toUtf8String(data.slice(0, length)); -} -//# sourceMappingURL=bytes32.js.map \ No newline at end of file diff --git a/lib.esm/abi/bytes32.js.map b/lib.esm/abi/bytes32.js.map deleted file mode 100644 index e7c66bfee..000000000 --- a/lib.esm/abi/bytes32.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bytes32.js","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,YAAY,GACb,MAAM,mBAAmB,CAAC;AAI3B;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,gBAAgB;IAChB,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAEhC,0CAA0C;IAC1C,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC9D;IAED,wCAAwC;IACxC,OAAO,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAiB;IACnD,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC,2CAA2C;IAC3C,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KACxD;IACD,IAAI,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;KAChE;IAED,4BAA4B;IAC5B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE;QAC7B,MAAM,EAAE,CAAC;KACV;IAED,6BAA6B;IAC7B,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC7C,CAAC"} \ No newline at end of file diff --git a/lib.esm/abi/coders/abstract-coder.d.ts b/lib.esm/abi/coders/abstract-coder.d.ts deleted file mode 100644 index 53d1481b3..000000000 --- a/lib.esm/abi/coders/abstract-coder.d.ts +++ /dev/null @@ -1,117 +0,0 @@ -import type { BigNumberish, BytesLike } from "../../utils/index.js"; -/** - * @_ignore: - */ -export declare const WordSize: number; -/** - * A [[Result]] is a sub-class of Array, which allows accessing any - * of its values either positionally by its index or, if keys are - * provided by its name. - * - * @_docloc: api/abi - */ -export declare class Result extends Array { - #private; - [K: string | number]: any; - /** - * @private - */ - constructor(...args: Array); - /** - * Returns the Result as a normal Array. - * - * This will throw if there are any outstanding deferred - * errors. - */ - toArray(): Array; - /** - * Returns the Result as an Object with each name-value pair. - * - * This will throw if any value is unnamed, or if there are - * any outstanding deferred errors. - */ - toObject(): Record; - /** - * @_ignore - */ - slice(start?: number | undefined, end?: number | undefined): Result; - /** - * @_ignore - */ - filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result; - /** - * Returns the value for %%name%%. - * - * Since it is possible to have a key whose name conflicts with - * a method on a [[Result]] or its superclass Array, or any - * JavaScript keyword, this ensures all named values are still - * accessible by name. - */ - getValue(name: string): any; - /** - * Creates a new [[Result]] for %%items%% with each entry - * also accessible by its corresponding name in %%keys%%. - */ - static fromItems(items: Array, keys?: Array): Result; -} -/** - * Returns all errors found in a [[Result]]. - * - * Since certain errors encountered when creating a [[Result]] do - * not impact the ability to continue parsing data, they are - * deferred until they are actually accessed. Hence a faulty string - * in an Event that is never used does not impact the program flow. - * - * However, sometimes it may be useful to access, identify or - * validate correctness of a [[Result]]. - * - * @_docloc api/abi - */ -export declare function checkResultErrors(result: Result): Array<{ - path: Array; - error: Error; -}>; -/** - * @_ignore - */ -export declare abstract class Coder { - readonly name: string; - readonly type: string; - readonly localName: string; - readonly dynamic: boolean; - constructor(name: string, type: string, localName: string, dynamic: boolean); - _throwError(message: string, value: any): never; - abstract encode(writer: Writer, value: any): number; - abstract decode(reader: Reader): any; - abstract defaultValue(): any; -} -/** - * @_ignore - */ -export declare class Writer { - #private; - constructor(); - get data(): string; - get length(): number; - appendWriter(writer: Writer): number; - writeBytes(value: BytesLike): number; - writeValue(value: BigNumberish): number; - writeUpdatableValue(): (value: BigNumberish) => void; -} -/** - * @_ignore - */ -export declare class Reader { - #private; - readonly allowLoose: boolean; - constructor(data: BytesLike, allowLoose?: boolean); - get data(): string; - get dataLength(): number; - get consumed(): number; - get bytes(): Uint8Array; - subReader(offset: number): Reader; - readBytes(length: number, loose?: boolean): Uint8Array; - readValue(): bigint; - readIndex(): number; -} -//# sourceMappingURL=abstract-coder.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/coders/abstract-coder.d.ts.map b/lib.esm/abi/coders/abstract-coder.d.ts.map deleted file mode 100644 index 3141c016e..000000000 --- a/lib.esm/abi/coders/abstract-coder.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-coder.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/abstract-coder.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAW,CAAC;AAiBnC;;;;;;GAMG;AACH,qBAAa,MAAO,SAAQ,KAAK,CAAC,GAAG,CAAC;;IAGpC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAE1B;;OAEG;gBACS,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;IAkG/B;;;;;OAKG;IACH,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC;IAWrB;;;;;OA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GAAG,GAAG,MAAM;IACnD,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;IAEpC,QAAQ,CAAC,YAAY,IAAI,GAAG;CAC7B;AAED;;GAEG;AACH,qBAAa,MAAM;;;IAUjB,IAAI,IAAI,IAAI,MAAM,CAEjB;IACD,IAAI,MAAM,IAAI,MAAM,CAEnB;IAQD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAKpC,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAUpC,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM;IAMvC,mBAAmB,IAAI,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI;CAQrD;AAED;;GAEG;AACH,qBAAa,MAAM;;IAKjB,QAAQ,CAAC,UAAU,EAAG,OAAO,CAAC;gBAKlB,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO;IAQjD,IAAI,IAAI,IAAI,MAAM,CAEjB;IACD,IAAI,UAAU,IAAI,MAAM,CAEvB;IACD,IAAI,QAAQ,IAAI,MAAM,CAErB;IACD,IAAI,KAAK,IAAI,UAAU,CAEtB;IAuBD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAKjC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU;IAQtD,SAAS,IAAI,MAAM;IAInB,SAAS,IAAI,MAAM;CAGpB"} \ No newline at end of file diff --git a/lib.esm/abi/coders/abstract-coder.js b/lib.esm/abi/coders/abstract-coder.js deleted file mode 100644 index ac1945dac..000000000 --- a/lib.esm/abi/coders/abstract-coder.js +++ /dev/null @@ -1,408 +0,0 @@ -import { defineProperties, concat, getBytesCopy, getNumber, hexlify, toBeArray, toBigInt, toNumber, assert, assertArgument, } from "../../utils/index.js"; -/** - * @_ignore: - */ -export const WordSize = 32; -const Padding = new Uint8Array(WordSize); -// Properties used to immediate pass through to the underlying object -// - `then` is used to detect if an object is a Promise for await -const passProperties = ["then"]; -const _guard = {}; -function throwError(name, error) { - const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`); - wrapped.error = error; - throw wrapped; -} -/** - * A [[Result]] is a sub-class of Array, which allows accessing any - * of its values either positionally by its index or, if keys are - * provided by its name. - * - * @_docloc: api/abi - */ -export class Result extends Array { - #names; - /** - * @private - */ - constructor(...args) { - // To properly sub-class Array so the other built-in - // functions work, the constructor has to behave fairly - // well. So, in the event we are created via fromItems() - // we build the read-only Result object we want, but on - // any other input, we use the default constructor - // constructor(guard: any, items: Array, keys?: Array); - const guard = args[0]; - let items = args[1]; - let names = (args[2] || []).slice(); - let wrap = true; - if (guard !== _guard) { - items = args; - names = []; - wrap = false; - } - // Can't just pass in ...items since an array of length 1 - // is a special case in the super. - super(items.length); - items.forEach((item, index) => { - this[index] = item; - }); - // Find all unique keys - const nameCounts = names.reduce((accum, name) => { - if (typeof name === "string") { - accum.set(name, (accum.get(name) || 0) + 1); - } - return accum; - }, new Map()); - // Remove any key thats not unique - this.#names = Object.freeze(items.map((item, index) => { - const name = names[index]; - if (name != null && nameCounts.get(name) === 1) { - return name; - } - return null; - })); - if (!wrap) { - return; - } - // A wrapped Result is immutable - Object.freeze(this); - // Proxy indices and names so we can trap deferred errors - return new Proxy(this, { - get: (target, prop, receiver) => { - if (typeof prop === "string") { - // Index accessor - if (prop.match(/^[0-9]+$/)) { - const index = getNumber(prop, "%index"); - if (index < 0 || index >= this.length) { - throw new RangeError("out of result range"); - } - const item = target[index]; - if (item instanceof Error) { - throwError(`index ${index}`, item); - } - return item; - } - // Pass important checks (like `then` for Promise) through - if (passProperties.indexOf(prop) >= 0) { - return Reflect.get(target, prop, receiver); - } - const value = target[prop]; - if (value instanceof Function) { - // Make sure functions work with private variables - // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding - return function (...args) { - return value.apply(this === receiver ? target : this, args); - }; - } - else if (!(prop in target)) { - // Possible name accessor - return target.getValue.apply(this === receiver ? target : this, [ - prop, - ]); - } - } - return Reflect.get(target, prop, receiver); - }, - }); - } - /** - * Returns the Result as a normal Array. - * - * This will throw if there are any outstanding deferred - * errors. - */ - toArray() { - const result = []; - this.forEach((item, index) => { - if (item instanceof Error) { - throwError(`index ${index}`, item); - } - result.push(item); - }); - return result; - } - /** - * Returns the Result as an Object with each name-value pair. - * - * This will throw if any value is unnamed, or if there are - * any outstanding deferred errors. - */ - toObject() { - return this.#names.reduce((accum, name, index) => { - assert(name != null, "value at index ${ index } unnamed", "UNSUPPORTED_OPERATION", { - operation: "toObject()", - }); - // Add values for names that don't conflict - if (!(name in accum)) { - accum[name] = this.getValue(name); - } - return accum; - }, {}); - } - /** - * @_ignore - */ - slice(start, end) { - if (start == null) { - start = 0; - } - if (start < 0) { - start += this.length; - if (start < 0) { - start = 0; - } - } - if (end == null) { - end = this.length; - } - if (end < 0) { - end += this.length; - if (end < 0) { - end = 0; - } - } - if (end > this.length) { - end = this.length; - } - const result = [], names = []; - for (let i = start; i < end; i++) { - result.push(this[i]); - names.push(this.#names[i]); - } - return new Result(_guard, result, names); - } - /** - * @_ignore - */ - filter(callback, thisArg) { - const result = [], names = []; - for (let i = 0; i < this.length; i++) { - const item = this[i]; - if (item instanceof Error) { - throwError(`index ${i}`, item); - } - if (callback.call(thisArg, item, i, this)) { - result.push(item); - names.push(this.#names[i]); - } - } - return new Result(_guard, result, names); - } - /** - * Returns the value for %%name%%. - * - * Since it is possible to have a key whose name conflicts with - * a method on a [[Result]] or its superclass Array, or any - * JavaScript keyword, this ensures all named values are still - * accessible by name. - */ - getValue(name) { - const index = this.#names.indexOf(name); - if (index === -1) { - return undefined; - } - const value = this[index]; - if (value instanceof Error) { - throwError(`property ${JSON.stringify(name)}`, value.error); - } - return value; - } - /** - * Creates a new [[Result]] for %%items%% with each entry - * also accessible by its corresponding name in %%keys%%. - */ - static fromItems(items, keys) { - return new Result(_guard, items, keys); - } -} -/** - * Returns all errors found in a [[Result]]. - * - * Since certain errors encountered when creating a [[Result]] do - * not impact the ability to continue parsing data, they are - * deferred until they are actually accessed. Hence a faulty string - * in an Event that is never used does not impact the program flow. - * - * However, sometimes it may be useful to access, identify or - * validate correctness of a [[Result]]. - * - * @_docloc api/abi - */ -export function checkResultErrors(result) { - // Find the first error (if any) - const errors = []; - const checkErrors = function (path, object) { - if (!Array.isArray(object)) { - return; - } - for (let key in object) { - const childPath = path.slice(); - childPath.push(key); - try { - checkErrors(childPath, object[key]); - } - catch (error) { - errors.push({ path: childPath, error: error }); - } - } - }; - checkErrors([], result); - return errors; -} -function getValue(value) { - let bytes = toBeArray(value); - assert(bytes.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { - buffer: bytes, - length: WordSize, - offset: bytes.length, - }); - if (bytes.length !== WordSize) { - bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes])); - } - return bytes; -} -/** - * @_ignore - */ -export class Coder { - // The coder name: - // - address, uint256, tuple, array, etc. - name; - // The fully expanded type, including composite types: - // - address, uint256, tuple(address,bytes), uint256[3][4][], etc. - type; - // The localName bound in the signature, in this example it is "baz": - // - tuple(address foo, uint bar) baz - localName; - // Whether this type is dynamic: - // - Dynamic: bytes, string, address[], tuple(boolean[]), etc. - // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8) - dynamic; - constructor(name, type, localName, dynamic) { - defineProperties(this, { name, type, localName, dynamic }, { - name: "string", - type: "string", - localName: "string", - dynamic: "boolean", - }); - } - _throwError(message, value) { - assertArgument(false, message, this.localName, value); - } -} -/** - * @_ignore - */ -export class Writer { - // An array of WordSize lengthed objects to concatenation - #data; - #dataLength; - constructor() { - this.#data = []; - this.#dataLength = 0; - } - get data() { - return concat(this.#data); - } - get length() { - return this.#dataLength; - } - #writeData(data) { - this.#data.push(data); - this.#dataLength += data.length; - return data.length; - } - appendWriter(writer) { - return this.#writeData(getBytesCopy(writer.data)); - } - // Arrayish item; pad on the right to *nearest* WordSize - writeBytes(value) { - let bytes = getBytesCopy(value); - const paddingOffset = bytes.length % WordSize; - if (paddingOffset) { - bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)])); - } - return this.#writeData(bytes); - } - // Numeric item; pad on the left *to* WordSize - writeValue(value) { - return this.#writeData(getValue(value)); - } - // Inserts a numeric place-holder, returning a callback that can - // be used to asjust the value later - writeUpdatableValue() { - const offset = this.#data.length; - this.#data.push(Padding); - this.#dataLength += WordSize; - return (value) => { - this.#data[offset] = getValue(value); - }; - } -} -/** - * @_ignore - */ -export class Reader { - // Allows incomplete unpadded data to be read; otherwise an error - // is raised if attempting to overrun the buffer. This is required - // to deal with an old Solidity bug, in which event data for - // external (not public thoguh) was tightly packed. - allowLoose; - #data; - #offset; - constructor(data, allowLoose) { - defineProperties(this, { allowLoose: !!allowLoose }); - this.#data = getBytesCopy(data); - this.#offset = 0; - } - get data() { - return hexlify(this.#data); - } - get dataLength() { - return this.#data.length; - } - get consumed() { - return this.#offset; - } - get bytes() { - return new Uint8Array(this.#data); - } - #peekBytes(offset, length, loose) { - let alignedLength = Math.ceil(length / WordSize) * WordSize; - if (this.#offset + alignedLength > this.#data.length) { - if (this.allowLoose && - loose && - this.#offset + length <= this.#data.length) { - alignedLength = length; - } - else { - assert(false, "data out-of-bounds", "BUFFER_OVERRUN", { - buffer: getBytesCopy(this.#data), - length: this.#data.length, - offset: this.#offset + alignedLength, - }); - } - } - return this.#data.slice(this.#offset, this.#offset + alignedLength); - } - // Create a sub-reader with the same underlying data, but offset - subReader(offset) { - return new Reader(this.#data.slice(this.#offset + offset), this.allowLoose); - } - // Read bytes - readBytes(length, loose) { - let bytes = this.#peekBytes(0, length, !!loose); - this.#offset += bytes.length; - // @TODO: Make sure the length..end bytes are all 0? - return bytes.slice(0, length); - } - // Read a numeric values - readValue() { - return toBigInt(this.readBytes(WordSize)); - } - readIndex() { - return toNumber(this.readBytes(WordSize)); - } -} -//# sourceMappingURL=abstract-coder.js.map \ No newline at end of file diff --git a/lib.esm/abi/coders/abstract-coder.js.map b/lib.esm/abi/coders/abstract-coder.js.map deleted file mode 100644 index 04154794b..000000000 --- a/lib.esm/abi/coders/abstract-coder.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-coder.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/abstract-coder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,MAAM,EACN,YAAY,EACZ,SAAS,EACT,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,cAAc,GACf,MAAM,sBAAsB,CAAC;AAI9B;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAW,EAAE,CAAC;AACnC,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC;AAEzC,qEAAqE;AACrE,iEAAiE;AACjE,MAAM,cAAc,GAAG,CAAC,MAAM,CAAC,CAAC;AAEhC,MAAM,MAAM,GAAG,EAAE,CAAC;AAElB,SAAS,UAAU,CAAC,IAAY,EAAE,KAAY;IAC5C,MAAM,OAAO,GAAG,IAAI,KAAK,CACvB,0DAA0D,IAAI,EAAE,CACjE,CAAC;IACI,OAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;IAC7B,MAAM,OAAO,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,OAAO,MAAO,SAAQ,KAAU;IAC3B,MAAM,CAA+B;IAI9C;;OAEG;IACH,YAAY,GAAG,IAAgB;QAC7B,oDAAoD;QACpD,uDAAuD;QACvD,wDAAwD;QACxD,uDAAuD;QACvD,kDAAkD;QAElD,2EAA2E;QAC3E,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,KAAK,GAAe,IAAI,CAAC,CAAC,CAAC,CAAC;QAChC,IAAI,KAAK,GAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QAE1D,IAAI,IAAI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,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,SAAS;QACP,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5C,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/abi/coders/address.d.ts b/lib.esm/abi/coders/address.d.ts deleted file mode 100644 index 8befac03a..000000000 --- a/lib.esm/abi/coders/address.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class AddressCoder extends Coder { - constructor(localName: string); - defaultValue(): string; - encode(writer: Writer, _value: string | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/coders/address.d.ts.map b/lib.esm/abi/coders/address.d.ts.map deleted file mode 100644 index 89cabff49..000000000 --- a/lib.esm/abi/coders/address.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/address.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBACzB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM;IAUtD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/lib.esm/abi/coders/address.js b/lib.esm/abi/coders/address.js deleted file mode 100644 index 44c0cfcfc..000000000 --- a/lib.esm/abi/coders/address.js +++ /dev/null @@ -1,29 +0,0 @@ -import { getAddress } from "../../address/index.js"; -import { toBeHex } from "../../utils/maths.js"; -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -/** - * @_ignore - */ -export class AddressCoder extends Coder { - constructor(localName) { - super("address", "address", localName, false); - } - defaultValue() { - return "0x0000000000000000000000000000000000000000"; - } - encode(writer, _value) { - let value = Typed.dereference(_value, "string"); - try { - value = getAddress(value); - } - catch (error) { - return this._throwError(error.message, _value); - } - return writer.writeValue(value); - } - decode(reader) { - return getAddress(toBeHex(reader.readValue(), 22)); - } -} -//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/lib.esm/abi/coders/address.js.map b/lib.esm/abi/coders/address.js.map deleted file mode 100644 index 5fe22a1b1..000000000 --- a/lib.esm/abi/coders/address.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"address.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YAAY,SAAiB;QAC3B,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,YAAY;QACV,OAAO,4CAA4C,CAAC;IACtD,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsB;QAC3C,IAAI,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAChD,IAAI;YACF,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;SAC3B;QAAC,OAAO,KAAU,EAAE;YACnB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAChD;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACrD,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/abi/coders/anonymous.d.ts b/lib.esm/abi/coders/anonymous.d.ts deleted file mode 100644 index 554bf03f0..000000000 --- a/lib.esm/abi/coders/anonymous.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * Clones the functionality of an existing Coder, but without a localName - * - * @_ignore - */ -export declare class AnonymousCoder extends Coder { - private coder; - constructor(coder: Coder); - defaultValue(): any; - encode(writer: Writer, value: any): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=anonymous.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/coders/anonymous.d.ts.map b/lib.esm/abi/coders/anonymous.d.ts.map deleted file mode 100644 index 75c762afb..000000000 --- a/lib.esm/abi/coders/anonymous.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"anonymous.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/anonymous.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,OAAO,CAAC,KAAK,CAAQ;gBAET,KAAK,EAAE,KAAK;IAKxB,YAAY,IAAI,GAAG;IAInB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAI1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/lib.esm/abi/coders/anonymous.js b/lib.esm/abi/coders/anonymous.js deleted file mode 100644 index b6d953261..000000000 --- a/lib.esm/abi/coders/anonymous.js +++ /dev/null @@ -1,23 +0,0 @@ -import { Coder } from "./abstract-coder.js"; -/** - * Clones the functionality of an existing Coder, but without a localName - * - * @_ignore - */ -export class AnonymousCoder extends Coder { - coder; - constructor(coder) { - super(coder.name, coder.type, "_", coder.dynamic); - this.coder = coder; - } - defaultValue() { - return this.coder.defaultValue(); - } - encode(writer, value) { - return this.coder.encode(writer, value); - } - decode(reader) { - return this.coder.decode(reader); - } -} -//# sourceMappingURL=anonymous.js.map \ No newline at end of file diff --git a/lib.esm/abi/coders/anonymous.js.map b/lib.esm/abi/coders/anonymous.js.map deleted file mode 100644 index a1c36e195..000000000 --- a/lib.esm/abi/coders/anonymous.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"anonymous.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/anonymous.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC/B,KAAK,CAAQ;IAErB,YAAY,KAAY;QACtB,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/abi/coders/array.d.ts b/lib.esm/abi/coders/array.d.ts deleted file mode 100644 index 954c4e17e..000000000 --- a/lib.esm/abi/coders/array.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder, Result, Writer } from "./abstract-coder.js"; -import type { Reader } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare function pack(writer: Writer, coders: ReadonlyArray, values: Array | { - [name: string]: any; -}): number; -/** - * @_ignore - */ -export declare function unpack(reader: Reader, coders: ReadonlyArray): Result; -/** - * @_ignore - */ -export declare class ArrayCoder extends Coder { - readonly coder: Coder; - readonly length: number; - constructor(coder: Coder, length: number, localName: string); - defaultValue(): Array; - encode(writer: Writer, _value: Array | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=array.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/coders/array.d.ts.map b/lib.esm/abi/coders/array.d.ts.map deleted file mode 100644 index 9875b8e9e..000000000 --- a/lib.esm/abi/coders/array.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/array.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAY,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD;;GAEG;AACH,wBAAgB,IAAI,CAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,EAC5B,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAC3C,MAAM,CAuER;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,MAAM,CAmD3E;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,KAAK,EAAG,KAAK,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;gBAEb,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAO3D,YAAY,IAAI,KAAK,CAAC,GAAG,CAAC;IAW1B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,MAAM;IA4B1D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CA4B5B"} \ No newline at end of file diff --git a/lib.esm/abi/coders/array.js b/lib.esm/abi/coders/array.js deleted file mode 100644 index dad291ae6..000000000 --- a/lib.esm/abi/coders/array.js +++ /dev/null @@ -1,165 +0,0 @@ -import { defineProperties, isError, assert, assertArgument, assertArgumentCount, } from "../../utils/index.js"; -import { Typed } from "../typed.js"; -import { Coder, Result, WordSize, Writer } from "./abstract-coder.js"; -import { AnonymousCoder } from "./anonymous.js"; -/** - * @_ignore - */ -export function pack(writer, coders, values) { - let arrayValues = []; - if (Array.isArray(values)) { - arrayValues = values; - } - else if (values && typeof values === "object") { - let unique = {}; - arrayValues = coders.map((coder) => { - const name = coder.localName; - assert(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); - assert(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); - unique[name] = true; - return values[name]; - }); - } - else { - assertArgument(false, "invalid tuple value", "tuple", values); - } - assertArgument(coders.length === arrayValues.length, "types/value length mismatch", "tuple", values); - let staticWriter = new Writer(); - let dynamicWriter = new Writer(); - let updateFuncs = []; - coders.forEach((coder, index) => { - let value = arrayValues[index]; - if (coder.dynamic) { - // Get current dynamic offset (for the future pointer) - let dynamicOffset = dynamicWriter.length; - // Encode the dynamic value into the dynamicWriter - coder.encode(dynamicWriter, value); - // Prepare to populate the correct offset once we are done - let updateFunc = staticWriter.writeUpdatableValue(); - updateFuncs.push((baseOffset) => { - updateFunc(baseOffset + dynamicOffset); - }); - } - else { - coder.encode(staticWriter, value); - } - }); - // Backfill all the dynamic offsets, now that we know the static length - updateFuncs.forEach((func) => { - func(staticWriter.length); - }); - let length = writer.appendWriter(staticWriter); - length += writer.appendWriter(dynamicWriter); - return length; -} -/** - * @_ignore - */ -export function unpack(reader, coders) { - let values = []; - let keys = []; - // A reader anchored to this base - let baseReader = reader.subReader(0); - coders.forEach((coder) => { - let value = null; - if (coder.dynamic) { - let offset = reader.readIndex(); - let offsetReader = baseReader.subReader(offset); - try { - value = coder.decode(offsetReader); - } - catch (error) { - // Cannot recover from this - if (isError(error, "BUFFER_OVERRUN")) { - throw error; - } - value = error; - value.baseType = coder.name; - value.name = coder.localName; - value.type = coder.type; - } - } - else { - try { - value = coder.decode(reader); - } - catch (error) { - // Cannot recover from this - if (isError(error, "BUFFER_OVERRUN")) { - throw error; - } - value = error; - value.baseType = coder.name; - value.name = coder.localName; - value.type = coder.type; - } - } - if (value == undefined) { - throw new Error("investigate"); - } - values.push(value); - keys.push(coder.localName || null); - }); - return Result.fromItems(values, keys); -} -/** - * @_ignore - */ -export class ArrayCoder extends Coder { - coder; - length; - constructor(coder, length, localName) { - const type = coder.type + "[" + (length >= 0 ? length : "") + "]"; - const dynamic = length === -1 || coder.dynamic; - super("array", type, localName, dynamic); - defineProperties(this, { coder, length }); - } - defaultValue() { - // Verifies the child coder is valid (even if the array is dynamic or 0-length) - const defaultChild = this.coder.defaultValue(); - const result = []; - for (let i = 0; i < this.length; i++) { - result.push(defaultChild); - } - return result; - } - encode(writer, _value) { - const value = Typed.dereference(_value, "array"); - if (!Array.isArray(value)) { - this._throwError("expected array value", value); - } - let count = this.length; - if (count === -1) { - count = value.length; - writer.writeValue(value.length); - } - assertArgumentCount(value.length, count, "coder array" + (this.localName ? " " + this.localName : "")); - let coders = []; - for (let i = 0; i < value.length; i++) { - coders.push(this.coder); - } - return pack(writer, coders, value); - } - decode(reader) { - let count = this.length; - if (count === -1) { - count = reader.readIndex(); - // Check that there is *roughly* enough data to ensure - // stray random data is not being read as a length. Each - // slot requires at least 32 bytes for their value (or 32 - // bytes as a link to the data). This could use a much - // tighter bound, but we are erroring on the side of safety. - assert(count * WordSize <= reader.dataLength, "insufficient data length", "BUFFER_OVERRUN", { - buffer: reader.bytes, - offset: count * WordSize, - length: reader.dataLength, - }); - } - let coders = []; - for (let i = 0; i < count; i++) { - coders.push(new AnonymousCoder(this.coder)); - } - return unpack(reader, coders); - } -} -//# sourceMappingURL=array.js.map \ No newline at end of file diff --git a/lib.esm/abi/coders/array.js.map b/lib.esm/abi/coders/array.js.map deleted file mode 100644 index 9879b08ce..000000000 --- a/lib.esm/abi/coders/array.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/array.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,OAAO,EACP,MAAM,EACN,cAAc,EACd,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIhD;;GAEG;AACH,MAAM,UAAU,IAAI,CAClB,MAAc,EACd,MAA4B,EAC5B,MAA4C;IAE5C,IAAI,WAAW,GAAe,EAAE,CAAC;IAEjC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACzB,WAAW,GAAG,MAAM,CAAC;KACtB;SAAM,IAAI,MAAM,IAAI,OAAO,MAA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C,CAAC,CAAC,EAAE,CAAC,CAC7D,CAAC;QAEF,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACzB;QAED,OAAO,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QACxB,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YAChB,KAAK,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;YAE3B,sDAAsD;YACtD,wDAAwD;YACxD,yDAAyD;YACzD,sDAAsD;YACtD,4DAA4D;YAC5D,MAAM,CACJ,KAAK,GAAG,QAAQ,IAAI,MAAM,CAAC,UAAU,EACrC,0BAA0B,EAC1B,gBAAgB,EAChB;gBACE,MAAM,EAAE,MAAM,CAAC,KAAK;gBACpB,MAAM,EAAE,KAAK,GAAG,QAAQ;gBACxB,MAAM,EAAE,MAAM,CAAC,UAAU;aAC1B,CACF,CAAC;SACH;QACD,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;SAC7C;QAED,OAAO,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/abi/coders/boolean.d.ts b/lib.esm/abi/coders/boolean.d.ts deleted file mode 100644 index f073e37ee..000000000 --- a/lib.esm/abi/coders/boolean.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class BooleanCoder extends Coder { - constructor(localName: string); - defaultValue(): boolean; - encode(writer: Writer, _value: boolean | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=boolean.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/coders/boolean.d.ts.map b/lib.esm/abi/coders/boolean.d.ts.map deleted file mode 100644 index 8f22ce499..000000000 --- a/lib.esm/abi/coders/boolean.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBACzB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,OAAO;IAIvB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM;IAKvD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/lib.esm/abi/coders/boolean.js b/lib.esm/abi/coders/boolean.js deleted file mode 100644 index 3992319f7..000000000 --- a/lib.esm/abi/coders/boolean.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -/** - * @_ignore - */ -export class BooleanCoder extends Coder { - constructor(localName) { - super("bool", "bool", localName, false); - } - defaultValue() { - return false; - } - encode(writer, _value) { - const value = Typed.dereference(_value, "bool"); - return writer.writeValue(value ? 1 : 0); - } - decode(reader) { - return !!reader.readValue(); - } -} -//# sourceMappingURL=boolean.js.map \ No newline at end of file diff --git a/lib.esm/abi/coders/boolean.js.map b/lib.esm/abi/coders/boolean.js.map deleted file mode 100644 index b3b412254..000000000 --- a/lib.esm/abi/coders/boolean.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YAAY,SAAiB;QAC3B,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,YAAY;QACV,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAuB;QAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IAC9B,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/abi/coders/bytes.d.ts b/lib.esm/abi/coders/bytes.d.ts deleted file mode 100644 index 1e554582f..000000000 --- a/lib.esm/abi/coders/bytes.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class DynamicBytesCoder extends Coder { - constructor(type: string, localName: string); - defaultValue(): string; - encode(writer: Writer, value: any): number; - decode(reader: Reader): any; -} -/** - * @_ignore - */ -export declare class BytesCoder extends DynamicBytesCoder { - constructor(localName: string); - decode(reader: Reader): any; -} -//# sourceMappingURL=bytes.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/coders/bytes.d.ts.map b/lib.esm/abi/coders/bytes.d.ts.map deleted file mode 100644 index d765084b7..000000000 --- a/lib.esm/abi/coders/bytes.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/bytes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAI3C,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAO1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,iBAAiB;gBACnC,SAAS,EAAE,MAAM;IAI7B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/lib.esm/abi/coders/bytes.js b/lib.esm/abi/coders/bytes.js deleted file mode 100644 index 01aad879d..000000000 --- a/lib.esm/abi/coders/bytes.js +++ /dev/null @@ -1,34 +0,0 @@ -import { getBytesCopy, hexlify } from "../../utils/index.js"; -import { Coder } from "./abstract-coder.js"; -/** - * @_ignore - */ -export class DynamicBytesCoder extends Coder { - constructor(type, localName) { - super(type, type, localName, true); - } - defaultValue() { - return "0x"; - } - encode(writer, value) { - value = getBytesCopy(value); - let length = writer.writeValue(value.length); - length += writer.writeBytes(value); - return length; - } - decode(reader) { - return reader.readBytes(reader.readIndex(), true); - } -} -/** - * @_ignore - */ -export class BytesCoder extends DynamicBytesCoder { - constructor(localName) { - super("bytes", localName); - } - decode(reader) { - return hexlify(super.decode(reader)); - } -} -//# sourceMappingURL=bytes.js.map \ No newline at end of file diff --git a/lib.esm/abi/coders/bytes.js.map b/lib.esm/abi/coders/bytes.js.map deleted file mode 100644 index ba865bb25..000000000 --- a/lib.esm/abi/coders/bytes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/bytes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,IAAY,EAAE,SAAiB;QACzC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC/B,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IAC/C,YAAY,SAAiB;QAC3B,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACvC,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/abi/coders/fixed-bytes.d.ts b/lib.esm/abi/coders/fixed-bytes.d.ts deleted file mode 100644 index 5c485fef6..000000000 --- a/lib.esm/abi/coders/fixed-bytes.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { BytesLike } from "../../utils/index.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class FixedBytesCoder extends Coder { - readonly size: number; - constructor(size: number, localName: string); - defaultValue(): string; - encode(writer: Writer, _value: BytesLike | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=fixed-bytes.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/coders/fixed-bytes.d.ts.map b/lib.esm/abi/coders/fixed-bytes.d.ts.map deleted file mode 100644 index cca02a1ac..000000000 --- a/lib.esm/abi/coders/fixed-bytes.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fixed-bytes.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/fixed-bytes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAM3C,YAAY,IAAI,MAAM;IAOtB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM;IAQzD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/lib.esm/abi/coders/fixed-bytes.js b/lib.esm/abi/coders/fixed-bytes.js deleted file mode 100644 index 5e782c6e6..000000000 --- a/lib.esm/abi/coders/fixed-bytes.js +++ /dev/null @@ -1,28 +0,0 @@ -import { defineProperties, getBytesCopy, hexlify } from "../../utils/index.js"; -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -/** - * @_ignore - */ -export class FixedBytesCoder extends Coder { - size; - constructor(size, localName) { - let name = "bytes" + String(size); - super(name, name, localName, false); - defineProperties(this, { size }, { size: "number" }); - } - defaultValue() { - return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0, 2 + this.size * 2); - } - encode(writer, _value) { - let data = getBytesCopy(Typed.dereference(_value, this.type)); - if (data.length !== this.size) { - this._throwError("incorrect data length", _value); - } - return writer.writeBytes(data); - } - decode(reader) { - return hexlify(reader.readBytes(this.size)); - } -} -//# sourceMappingURL=fixed-bytes.js.map \ No newline at end of file diff --git a/lib.esm/abi/coders/fixed-bytes.js.map b/lib.esm/abi/coders/fixed-bytes.js.map deleted file mode 100644 index b0b8e537d..000000000 --- a/lib.esm/abi/coders/fixed-bytes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fixed-bytes.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/fixed-bytes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAM5C;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,IAAI,CAAU;IAEvB,YAAY,IAAY,EAAE,SAAiB;QACzC,IAAI,IAAI,GAAG,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAClC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACpC,gBAAgB,CAAkB,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,YAAY;QACV,OAAO,oEAAoE,CAAC,SAAS,CACnF,CAAC,EACD,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CAClB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAyB;QAC9C,IAAI,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,EAAE;YAC7B,IAAI,CAAC,WAAW,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;SACnD;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/abi/coders/null.d.ts b/lib.esm/abi/coders/null.d.ts deleted file mode 100644 index 5df5da342..000000000 --- a/lib.esm/abi/coders/null.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class NullCoder extends Coder { - constructor(localName: string); - defaultValue(): null; - encode(writer: Writer, value: any): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=null.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/coders/null.d.ts.map b/lib.esm/abi/coders/null.d.ts.map deleted file mode 100644 index 5b43f1d78..000000000 --- a/lib.esm/abi/coders/null.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"null.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/null.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI1D;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;gBACtB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,IAAI;IAIpB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAO1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAI5B"} \ No newline at end of file diff --git a/lib.esm/abi/coders/null.js b/lib.esm/abi/coders/null.js deleted file mode 100644 index 5b7d867a4..000000000 --- a/lib.esm/abi/coders/null.js +++ /dev/null @@ -1,24 +0,0 @@ -import { Coder } from "./abstract-coder.js"; -const Empty = new Uint8Array([]); -/** - * @_ignore - */ -export class NullCoder extends Coder { - constructor(localName) { - super("null", "", localName, false); - } - defaultValue() { - return null; - } - encode(writer, value) { - if (value != null) { - this._throwError("not null", value); - } - return writer.writeBytes(Empty); - } - decode(reader) { - reader.readBytes(0); - return null; - } -} -//# sourceMappingURL=null.js.map \ No newline at end of file diff --git a/lib.esm/abi/coders/null.js.map b/lib.esm/abi/coders/null.js.map deleted file mode 100644 index cb4ab0c33..000000000 --- a/lib.esm/abi/coders/null.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"null.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/null.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AAEjC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAClC,YAAY,SAAiB;QAC3B,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC/B,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;SACrC;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/abi/coders/number.d.ts b/lib.esm/abi/coders/number.d.ts deleted file mode 100644 index 822cc6df2..000000000 --- a/lib.esm/abi/coders/number.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { BigNumberish } from "../../utils/index.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class NumberCoder extends Coder { - readonly size: number; - readonly signed: boolean; - constructor(size: number, signed: boolean, localName: string); - defaultValue(): number; - encode(writer: Writer, _value: BigNumberish | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=number.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/coders/number.d.ts.map b/lib.esm/abi/coders/number.d.ts.map deleted file mode 100644 index b9ef16d8a..000000000 --- a/lib.esm/abi/coders/number.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/number.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAY,MAAM,qBAAqB,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAQ1D;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAG,OAAO,CAAC;gBAEd,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM;IAW5D,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,KAAK,GAAG,MAAM;IAkB5D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAS5B"} \ No newline at end of file diff --git a/lib.esm/abi/coders/number.js b/lib.esm/abi/coders/number.js deleted file mode 100644 index aead59be7..000000000 --- a/lib.esm/abi/coders/number.js +++ /dev/null @@ -1,45 +0,0 @@ -import { defineProperties, fromTwos, getBigInt, mask, toTwos, } from "../../utils/index.js"; -import { Typed } from "../typed.js"; -import { Coder, WordSize } from "./abstract-coder.js"; -const BN_0 = BigInt(0); -const BN_1 = BigInt(1); -const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -/** - * @_ignore - */ -export class NumberCoder extends Coder { - size; - signed; - constructor(size, signed, localName) { - const name = (signed ? "int" : "uint") + size * 8; - super(name, name, localName, false); - defineProperties(this, { size, signed }, { size: "number", signed: "boolean" }); - } - defaultValue() { - return 0; - } - encode(writer, _value) { - let value = getBigInt(Typed.dereference(_value, this.type)); - // Check bounds are safe for encoding - let maxUintValue = mask(BN_MAX_UINT256, WordSize * 8); - if (this.signed) { - let bounds = mask(maxUintValue, this.size * 8 - 1); - if (value > bounds || value < -(bounds + BN_1)) { - this._throwError("value out-of-bounds", _value); - } - value = toTwos(value, 8 * WordSize); - } - else if (value < BN_0 || value > mask(maxUintValue, this.size * 8)) { - this._throwError("value out-of-bounds", _value); - } - return writer.writeValue(value); - } - decode(reader) { - let value = mask(reader.readValue(), this.size * 8); - if (this.signed) { - value = fromTwos(value, this.size * 8); - } - return value; - } -} -//# sourceMappingURL=number.js.map \ No newline at end of file diff --git a/lib.esm/abi/coders/number.js.map b/lib.esm/abi/coders/number.js.map deleted file mode 100644 index 99df3d6e2..000000000 --- a/lib.esm/abi/coders/number.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/number.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,MAAM,GACP,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMtD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,cAAc,GAAG,MAAM,CAC3B,oEAAoE,CACrE,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,IAAI,CAAU;IACd,MAAM,CAAW;IAE1B,YAAY,IAAY,EAAE,MAAe,EAAE,SAAiB;QAC1D,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;QAClD,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAEpC,gBAAgB,CACd,IAAI,EACJ,EAAE,IAAI,EAAE,MAAM,EAAE,EAChB,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,CACtC,CAAC;IACJ,CAAC;IAED,YAAY;QACV,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAA4B;QACjD,IAAI,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAE5D,qCAAqC;QACrC,IAAI,YAAY,GAAG,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC;QACtD,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,IAAI,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACnD,IAAI,KAAK,GAAG,MAAM,IAAI,KAAK,GAAG,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE;gBAC9C,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;aACjD;YACD,KAAK,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC;SACrC;aAAM,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE;YACpE,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;SACjD;QAED,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAEpD,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;SACxC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/abi/coders/string.d.ts b/lib.esm/abi/coders/string.d.ts deleted file mode 100644 index 8e1c63593..000000000 --- a/lib.esm/abi/coders/string.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Typed } from "../typed.js"; -import { DynamicBytesCoder } from "./bytes.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class StringCoder extends DynamicBytesCoder { - constructor(localName: string); - defaultValue(): string; - encode(writer: Writer, _value: string | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=string.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/coders/string.d.ts.map b/lib.esm/abi/coders/string.d.ts.map deleted file mode 100644 index 38618a702..000000000 --- a/lib.esm/abi/coders/string.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/string.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,WAAY,SAAQ,iBAAiB;gBACpC,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM;IAOtD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/lib.esm/abi/coders/string.js b/lib.esm/abi/coders/string.js deleted file mode 100644 index cd8c4bd5e..000000000 --- a/lib.esm/abi/coders/string.js +++ /dev/null @@ -1,21 +0,0 @@ -import { toUtf8Bytes, toUtf8String } from "../../utils/utf8.js"; -import { Typed } from "../typed.js"; -import { DynamicBytesCoder } from "./bytes.js"; -/** - * @_ignore - */ -export class StringCoder extends DynamicBytesCoder { - constructor(localName) { - super("string", localName); - } - defaultValue() { - return ""; - } - encode(writer, _value) { - return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, "string"))); - } - decode(reader) { - return toUtf8String(super.decode(reader)); - } -} -//# sourceMappingURL=string.js.map \ No newline at end of file diff --git a/lib.esm/abi/coders/string.js.map b/lib.esm/abi/coders/string.js.map deleted file mode 100644 index 2ffbcff34..000000000 --- a/lib.esm/abi/coders/string.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAI/C;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAChD,YAAY,SAAiB;QAC3B,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC7B,CAAC;IAED,YAAY;QACV,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsB;QAC3C,OAAO,KAAK,CAAC,MAAM,CACjB,MAAM,EACN,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CACjD,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5C,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/abi/coders/tuple.d.ts b/lib.esm/abi/coders/tuple.d.ts deleted file mode 100644 index fe3ec0328..000000000 --- a/lib.esm/abi/coders/tuple.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class TupleCoder extends Coder { - readonly coders: ReadonlyArray; - constructor(coders: Array, localName: string); - defaultValue(): any; - encode(writer: Writer, _value: Array | { - [name: string]: any; - } | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=tuple.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/coders/tuple.d.ts.map b/lib.esm/abi/coders/tuple.d.ts.map deleted file mode 100644 index de1068222..000000000 --- a/lib.esm/abi/coders/tuple.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tuple.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/tuple.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,MAAM,EAAG,aAAa,CAAC,KAAK,CAAC,CAAC;gBAE3B,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM;IAiBnD,YAAY,IAAI,GAAG;IA0CnB,MAAM,CACJ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,KAAK,GACnD,MAAM;IAKT,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/lib.esm/abi/coders/tuple.js b/lib.esm/abi/coders/tuple.js deleted file mode 100644 index d399f31e3..000000000 --- a/lib.esm/abi/coders/tuple.js +++ /dev/null @@ -1,65 +0,0 @@ -import { defineProperties } from "../../utils/properties.js"; -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import { pack, unpack } from "./array.js"; -/** - * @_ignore - */ -export class TupleCoder extends Coder { - coders; - constructor(coders, localName) { - let dynamic = false; - const types = []; - coders.forEach((coder) => { - if (coder.dynamic) { - dynamic = true; - } - types.push(coder.type); - }); - const type = "tuple(" + types.join(",") + ")"; - super("tuple", type, localName, dynamic); - defineProperties(this, { - coders: Object.freeze(coders.slice()), - }); - } - defaultValue() { - const values = []; - this.coders.forEach((coder) => { - values.push(coder.defaultValue()); - }); - // We only output named properties for uniquely named coders - const uniqueNames = this.coders.reduce((accum, coder) => { - const name = coder.localName; - if (name) { - if (!accum[name]) { - accum[name] = 0; - } - accum[name]++; - } - return accum; - }, {}); - // Add named values - this.coders.forEach((coder, index) => { - let name = coder.localName; - if (!name || uniqueNames[name] !== 1) { - return; - } - if (name === "length") { - name = "_length"; - } - if (values[name] != null) { - return; - } - values[name] = values[index]; - }); - return Object.freeze(values); - } - encode(writer, _value) { - const value = Typed.dereference(_value, "tuple"); - return pack(writer, this.coders, value); - } - decode(reader) { - return unpack(reader, this.coders); - } -} -//# sourceMappingURL=tuple.js.map \ No newline at end of file diff --git a/lib.esm/abi/coders/tuple.js.map b/lib.esm/abi/coders/tuple.js.map deleted file mode 100644 index f5cc76c99..000000000 --- a/lib.esm/abi/coders/tuple.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tuple.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/tuple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAI1C;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC1B,MAAM,CAAwB;IAEvC,YAAY,MAAoB,EAAE,SAAiB;QACjD,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,KAAK,GAAkB,EAAE,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACvB,IAAI,KAA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C,KAAK,CAAC,EAAE;gBACpC,OAAO;aACR;YAED,IAAI,IAAI,KAAK,QAAQ,EAAE;gBACrB,IAAI,GAAG,SAAS,CAAC;aAClB;YAED,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE;gBACxB,OAAO;aACR;YAED,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,CACJ,MAAc,EACd,MAAoD;QAEpD,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/abi/fragments.d.ts b/lib.esm/abi/fragments.d.ts deleted file mode 100644 index 6d88c3596..000000000 --- a/lib.esm/abi/fragments.d.ts +++ /dev/null @@ -1,372 +0,0 @@ -/** - * About frgaments... - * - * @_subsection api/abi/abi-coder:Fragments [about-fragments] - */ -/** - * A type description in a JSON API. - */ -export interface JsonFragmentType { - /** - * The parameter name. - */ - readonly name?: string; - /** - * If the parameter is indexed. - */ - readonly indexed?: boolean; - /** - * The type of the parameter. - */ - readonly type?: string; - /** - * The internal Solidity type. - */ - readonly internalType?: string; - /** - * The components for a tuple. - */ - readonly components?: ReadonlyArray; -} -/** - * A fragment for a method, event or error in a JSON API. - */ -export interface JsonFragment { - /** - * The name of the error, event, function, etc. - */ - readonly name?: string; - /** - * The type of the fragment (e.g. ``event``, ``"function"``, etc.) - */ - readonly type?: string; - /** - * If the event is anonymous. - */ - readonly anonymous?: boolean; - /** - * If the function is payable. - */ - readonly payable?: boolean; - /** - * If the function is constant. - */ - readonly constant?: boolean; - /** - * The mutability state of the function. - */ - readonly stateMutability?: string; - /** - * The input parameters. - */ - readonly inputs?: ReadonlyArray; - /** - * The output parameters. - */ - readonly outputs?: ReadonlyArray; - /** - * The energy limit to use when sending a transaction for this function. - */ - readonly energy?: string; -} -/** - * The format to serialize the output as. - */ -export type FormatType = "sighash" | "minimal" | "full" | "json"; -/** - * When [walking](ParamType-walk) a [[ParamType]], this is called - * on each component. - */ -export type ParamTypeWalkFunc = (type: string, value: any) => any; -/** - * When [walking asynchronously](ParamType-walkAsync) a [[ParamType]], - * this is called on each component. - */ -export type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise; -/** - * Each input and output of a [[Fragment]] is an Array of **PAramType**. - */ -export declare class ParamType { - #private; - /** - * The local name of the parameter (or ``""`` if unbound) - */ - readonly name: string; - /** - * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, - * ``"uint256[3][]"``) - */ - readonly type: string; - /** - * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) - */ - readonly baseType: string; - /** - * True if the parameters is indexed. - * - * For non-indexable types this is ``null``. - */ - readonly indexed: null | boolean; - /** - * The components for the tuple. - * - * For non-tuple types this is ``null``. - */ - readonly components: null | ReadonlyArray; - /** - * The array length, or ``-1`` for dynamic-lengthed arrays. - * - * For non-array types this is ``null``. - */ - readonly arrayLength: null | number; - /** - * The type of each child in the array. - * - * For non-array types this is ``null``. - */ - readonly arrayChildren: null | ParamType; - /** - * @private - */ - constructor(guard: any, name: string, type: string, baseType: string, indexed: null | boolean, components: null | ReadonlyArray, arrayLength: null | number, arrayChildren: null | ParamType); - /** - * Return a string representation of this type. - * - * For example, - * - * ``sighash" => "(uint256,address)"`` - * - * ``"minimal" => "tuple(uint256,address) indexed"`` - * - * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` - */ - format(format?: FormatType): string; - /** - * Returns true if %%this%% is an Array type. - * - * This provides a type gaurd ensuring that [[arrayChildren]] - * and [[arrayLength]] are non-null. - */ - isArray(): this is ParamType & { - arrayChildren: ParamType; - arrayLength: number; - }; - /** - * Returns true if %%this%% is a Tuple type. - * - * This provides a type gaurd ensuring that [[components]] - * is non-null. - */ - isTuple(): this is ParamType & { - components: ReadonlyArray; - }; - /** - * Returns true if %%this%% is an Indexable type. - * - * This provides a type gaurd ensuring that [[indexed]] - * is non-null. - */ - isIndexable(): this is ParamType & { - indexed: boolean; - }; - /** - * Walks the **ParamType** with %%value%%, calling %%process%% - * on each type, destructing the %%value%% recursively. - */ - walk(value: any, process: ParamTypeWalkFunc): any; - /** - * Walks the **ParamType** with %%value%%, asynchronously calling - * %%process%% on each type, destructing the %%value%% recursively. - * - * This can be used to resolve ENS naes by walking and resolving each - * ``"address"`` type. - */ - walkAsync(value: any, process: ParamTypeWalkAsyncFunc): Promise; - /** - * Creates a new **ParamType** for %%obj%%. - * - * If %%allowIndexed%% then the ``indexed`` keyword is permitted, - * otherwise the ``indexed`` keyword will throw an error. - */ - static from(obj: any, allowIndexed?: boolean): ParamType; - /** - * Returns true if %%value%% is a **ParamType**. - */ - static isParamType(value: any): value is ParamType; -} -/** - * The type of a [[Fragment]]. - */ -export type FragmentType = "constructor" | "error" | "event" | "fallback" | "function" | "struct"; -/** - * An abstract class to represent An individual fragment from a parse ABI. - */ -export declare abstract class Fragment { - /** - * The type of the fragment. - */ - readonly type: FragmentType; - /** - * The inputs for the fragment. - */ - readonly inputs: ReadonlyArray; - /** - * @private - */ - constructor(guard: any, type: FragmentType, inputs: ReadonlyArray); - /** - * Returns a string representation of this fragment. - */ - abstract format(format?: FormatType): string; - /** - * Creates a new **Fragment** for %%obj%%, wich can be any supported - * ABI frgament type. - */ - static from(obj: any): Fragment; - /** - * Returns true if %%value%% is a [[ConstructorFragment]]. - */ - static isConstructor(value: any): value is ConstructorFragment; - /** - * Returns true if %%value%% is an [[ErrorFragment]]. - */ - static isError(value: any): value is ErrorFragment; - /** - * Returns true if %%value%% is an [[EventFragment]]. - */ - static isEvent(value: any): value is EventFragment; - /** - * Returns true if %%value%% is a [[FunctionFragment]]. - */ - static isFunction(value: any): value is FunctionFragment; - /** - * Returns true if %%value%% is a [[StructFragment]]. - */ - static isStruct(value: any): value is StructFragment; -} -/** - * An abstract class to represent An individual fragment - * which has a name from a parse ABI. - */ -export declare abstract class NamedFragment extends Fragment { - /** - * The name of the fragment. - */ - readonly name: string; - /** - * @private - */ - constructor(guard: any, type: FragmentType, name: string, inputs: ReadonlyArray); -} -/** - * A Fragment which represents a //Custom Error//. - */ -export declare class ErrorFragment extends NamedFragment { - /** - * @private - */ - constructor(guard: any, name: string, inputs: ReadonlyArray); - /** - * The Custom Error selector. - */ - get selector(): string; - format(format?: FormatType): string; - static from(obj: any): ErrorFragment; - static isFragment(value: any): value is ErrorFragment; -} -/** - * A Fragment which represents an Event. - */ -export declare class EventFragment extends NamedFragment { - readonly anonymous: boolean; - /** - * @private - */ - constructor(guard: any, name: string, inputs: ReadonlyArray, anonymous: boolean); - /** - * The Event topic hash. - */ - get topicHash(): string; - format(format?: FormatType): string; - static getTopicHash(name: string, params?: Array): string; - static from(obj: any): EventFragment; - static isFragment(value: any): value is EventFragment; -} -/** - * A Fragment which represents a constructor. - */ -export declare class ConstructorFragment extends Fragment { - readonly payable: boolean; - readonly energy: null | bigint; - /** - * @private - */ - constructor(guard: any, type: FragmentType, inputs: ReadonlyArray, payable: boolean, energy: null | bigint); - format(format?: FormatType): string; - static from(obj: any): ConstructorFragment; - static isFragment(value: any): value is ConstructorFragment; -} -/** - * A Fragment which represents a method. - */ -export declare class FallbackFragment extends Fragment { - /** - * If the function can be sent value during invocation. - */ - readonly payable: boolean; - constructor(guard: any, inputs: ReadonlyArray, payable: boolean); - format(format?: FormatType): string; - static from(obj: any): FallbackFragment; - static isFragment(value: any): value is FallbackFragment; -} -/** - * A Fragment which represents a method. - */ -export declare class FunctionFragment extends NamedFragment { - /** - * If the function is constant (e.g. ``pure`` or ``view`` functions). - */ - readonly constant: boolean; - /** - * The returned types for the result of calling this function. - */ - readonly outputs: ReadonlyArray; - /** - * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` - * or ``pure``) - */ - readonly stateMutability: "payable" | "nonpayable" | "view" | "pure"; - /** - * If the function can be sent value during invocation. - */ - readonly payable: boolean; - /** - * The amount of energy to send when calling this function - */ - readonly energy: null | bigint; - /** - * @private - */ - constructor(guard: any, name: string, stateMutability: "payable" | "nonpayable" | "view" | "pure", inputs: ReadonlyArray, outputs: ReadonlyArray, energy: null | bigint); - /** - * The Function selector. - */ - get selector(): string; - format(format?: FormatType): string; - static getSelector(name: string, params?: Array): string; - static from(obj: any): FunctionFragment; - static isFragment(value: any): value is FunctionFragment; -} -/** - * A Fragment which represents a structure. - */ -export declare class StructFragment extends NamedFragment { - /** - * @private - */ - constructor(guard: any, name: string, inputs: ReadonlyArray); - format(): string; - static from(obj: any): StructFragment; - static isFragment(value: any): value is FunctionFragment; -} -//# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/fragments.d.ts.map b/lib.esm/abi/fragments.d.ts.map deleted file mode 100644 index c3f678ffe..000000000 --- a/lib.esm/abi/fragments.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../src.ts/abi/fragments.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,gBAAgB,CA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EAAE,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,MAAM,EAC3D,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,EAChC,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,EACjC,MAAM,EAAE,IAAI,GAAG,MAAM;IAgBvB;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM;IA6CnC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM;IAa7D,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,gBAAgB;IA+DvC,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAGzD;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,aAAa;IAC/C;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC;IAKtE,MAAM,IAAI,MAAM;IAIhB,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc;IAiBrC,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAGzD"} \ No newline at end of file diff --git a/lib.esm/abi/fragments.js b/lib.esm/abi/fragments.js deleted file mode 100644 index 943f442a8..000000000 --- a/lib.esm/abi/fragments.js +++ /dev/null @@ -1,1270 +0,0 @@ -/** - * About frgaments... - * - * @_subsection api/abi/abi-coder:Fragments [about-fragments] - */ -var _a; -import { defineProperties, getBigInt, getNumber, assert, assertPrivate, assertArgument, } from "../utils/index.js"; -import { id } from "../hash/index.js"; -// [ "a", "b" ] => { "a": 1, "b": 1 } -function setify(items) { - const result = new Set(); - items.forEach((k) => result.add(k)); - return Object.freeze(result); -} -// Visibility Keywords -const _kwVisib = "constant external internal payable private public pure view"; -const KwVisib = setify(_kwVisib.split(" ")); -const _kwTypes = "constructor error event fallback function receive struct"; -const KwTypes = setify(_kwTypes.split(" ")); -const _kwModifiers = "calldata memory storage payable indexed"; -const KwModifiers = setify(_kwModifiers.split(" ")); -const _kwOther = "tuple returns"; -// All Keywords -const _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(" "); -const Keywords = setify(_keywords.split(" ")); -// Single character tokens -const SimpleTokens = { - "(": "OPEN_PAREN", - ")": "CLOSE_PAREN", - "[": "OPEN_BRACKET", - "]": "CLOSE_BRACKET", - ",": "COMMA", - "@": "AT", -}; -// Parser regexes to consume the next token -const regexWhitespacePrefix = new RegExp("^(\\s*)"); -const regexNumberPrefix = new RegExp("^([0-9]+)"); -const regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"); -// Parser regexs to check validity -const regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"); -const regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"); -class TokenString { - #offset; - #tokens; - get offset() { - return this.#offset; - } - get length() { - return this.#tokens.length - this.#offset; - } - constructor(tokens) { - this.#offset = 0; - this.#tokens = tokens.slice(); - } - clone() { - return new _a(this.#tokens); - } - reset() { - this.#offset = 0; - } - #subTokenString(from = 0, to = 0) { - return new _a(this.#tokens.slice(from, to).map((t) => { - return Object.freeze(Object.assign({}, t, { - match: t.match - from, - linkBack: t.linkBack - from, - linkNext: t.linkNext - from, - })); - })); - } - // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens - popKeyword(allowed) { - const top = this.peek(); - if (top.type !== "KEYWORD" || !allowed.has(top.text)) { - throw new Error(`expected keyword ${top.text}`); - } - return this.pop().text; - } - // Pops and returns the value of the next token if it is `type`; throws if out of tokens - popType(type) { - if (this.peek().type !== type) { - throw new Error(`expected ${type}; got ${JSON.stringify(this.peek())}`); - } - return this.pop().text; - } - // Pops and returns a "(" TOKENS ")" - popParen() { - const top = this.peek(); - if (top.type !== "OPEN_PAREN") { - throw new Error("bad start"); - } - const result = this.#subTokenString(this.#offset + 1, top.match + 1); - this.#offset = top.match + 1; - return result; - } - // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" - popParams() { - const top = this.peek(); - if (top.type !== "OPEN_PAREN") { - throw new Error("bad start"); - } - const result = []; - while (this.#offset < top.match - 1) { - const link = this.peek().linkNext; - result.push(this.#subTokenString(this.#offset + 1, link)); - this.#offset = link; - } - this.#offset = top.match + 1; - return result; - } - // Returns the top Token, throwing if out of tokens - peek() { - if (this.#offset >= this.#tokens.length) { - throw new Error("out-of-bounds"); - } - return this.#tokens[this.#offset]; - } - // Returns the next value, if it is a keyword in `allowed` - peekKeyword(allowed) { - const top = this.peekType("KEYWORD"); - return top != null && allowed.has(top) ? top : null; - } - // Returns the value of the next token if it is `type` - peekType(type) { - if (this.length === 0) { - return null; - } - const top = this.peek(); - return top.type === type ? top.text : null; - } - // Returns the next token; throws if out of tokens - pop() { - const result = this.peek(); - this.#offset++; - return result; - } - toString() { - const tokens = []; - for (let i = this.#offset; i < this.#tokens.length; i++) { - const token = this.#tokens[i]; - tokens.push(`${token.type}:${token.text}`); - } - return ``; - } -} -_a = TokenString; -function lex(text) { - const tokens = []; - const throwError = (message) => { - const token = offset < text.length ? JSON.stringify(text[offset]) : "$EOI"; - throw new Error(`invalid token ${token} at ${offset}: ${message}`); - }; - let brackets = []; - let commas = []; - let offset = 0; - while (offset < text.length) { - // Strip off any leading whitespace - let cur = text.substring(offset); - let match = cur.match(regexWhitespacePrefix); - if (match) { - offset += match[1].length; - cur = text.substring(offset); - } - const token = { - depth: brackets.length, - linkBack: -1, - linkNext: -1, - match: -1, - type: "", - text: "", - offset, - value: -1, - }; - tokens.push(token); - let type = SimpleTokens[cur[0]] || ""; - if (type) { - token.type = type; - token.text = cur[0]; - offset++; - if (type === "OPEN_PAREN") { - brackets.push(tokens.length - 1); - commas.push(tokens.length - 1); - } - else if (type == "CLOSE_PAREN") { - if (brackets.length === 0) { - throwError("no matching open bracket"); - } - token.match = brackets.pop(); - tokens[token.match].match = tokens.length - 1; - token.depth--; - token.linkBack = commas.pop(); - tokens[token.linkBack].linkNext = tokens.length - 1; - } - else if (type === "COMMA") { - token.linkBack = commas.pop(); - tokens[token.linkBack].linkNext = tokens.length - 1; - commas.push(tokens.length - 1); - } - else if (type === "OPEN_BRACKET") { - token.type = "BRACKET"; - } - else if (type === "CLOSE_BRACKET") { - // Remove the CLOSE_BRACKET - let suffix = tokens.pop().text; - if (tokens.length > 0 && tokens[tokens.length - 1].type === "NUMBER") { - const value = tokens.pop().text; - suffix = value + suffix; - tokens[tokens.length - 1].value = - getNumber(value); - } - if (tokens.length === 0 || - tokens[tokens.length - 1].type !== "BRACKET") { - throw new Error("missing opening bracket"); - } - tokens[tokens.length - 1].text += suffix; - } - continue; - } - match = cur.match(regexIdPrefix); - if (match) { - token.text = match[1]; - offset += token.text.length; - if (Keywords.has(token.text)) { - token.type = "KEYWORD"; - continue; - } - if (token.text.match(regexType)) { - token.type = "TYPE"; - continue; - } - token.type = "ID"; - continue; - } - match = cur.match(regexNumberPrefix); - if (match) { - token.text = match[1]; - token.type = "NUMBER"; - offset += token.text.length; - continue; - } - throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`); - } - return new TokenString(tokens.map((t) => Object.freeze(t))); -} -// Check only one of `allowed` is in `set` -function allowSingle(set, allowed) { - let included = []; - for (const key in allowed.keys()) { - if (set.has(key)) { - included.push(key); - } - } - if (included.length > 1) { - throw new Error(`conflicting types: ${included.join(", ")}`); - } -} -// Functions to process a Solidity Signature TokenString from left-to-right for... -// ...the name with an optional type, returning the name -function consumeName(type, tokens) { - if (tokens.peekKeyword(KwTypes)) { - const keyword = tokens.pop().text; - if (keyword !== type) { - throw new Error(`expected ${type}, got ${keyword}`); - } - } - return tokens.popType("ID"); -} -// ...all keywords matching allowed, returning the keywords -function consumeKeywords(tokens, allowed) { - const keywords = new Set(); - while (true) { - const keyword = tokens.peekType("KEYWORD"); - if (keyword == null || (allowed && !allowed.has(keyword))) { - break; - } - tokens.pop(); - if (keywords.has(keyword)) { - throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`); - } - keywords.add(keyword); - } - return Object.freeze(keywords); -} -// ...all visibility keywords, returning the coalesced mutability -function consumeMutability(tokens) { - let modifiers = consumeKeywords(tokens, KwVisib); - // Detect conflicting modifiers - allowSingle(modifiers, setify("constant payable nonpayable".split(" "))); - allowSingle(modifiers, setify("pure view payable nonpayable".split(" "))); - // Process mutability states - if (modifiers.has("view")) { - return "view"; - } - if (modifiers.has("pure")) { - return "pure"; - } - if (modifiers.has("payable")) { - return "payable"; - } - if (modifiers.has("nonpayable")) { - return "nonpayable"; - } - // Process legacy `constant` last - if (modifiers.has("constant")) { - return "view"; - } - return "nonpayable"; -} -// ...a parameter list, returning the ParamType list -function consumeParams(tokens, allowIndexed) { - return tokens.popParams().map((t) => ParamType.from(t, allowIndexed)); -} -// ...a energy limit, returning a BigNumber or null if none -function consumeEnergy(tokens) { - if (tokens.peekType("AT")) { - tokens.pop(); - if (tokens.peekType("NUMBER")) { - return getBigInt(tokens.pop().text); - } - throw new Error("invalid energy"); - } - return null; -} -function consumeEoi(tokens) { - if (tokens.length) { - throw new Error(`unexpected tokens: ${tokens.toString()}`); - } -} -const regexArrayType = new RegExp(/^(.*)\[([0-9]*)\]$/); -function verifyBasicType(type) { - const match = type.match(regexType); - assertArgument(match, "invalid type", "type", type); - if (type === "uint") { - return "uint256"; - } - if (type === "int") { - return "int256"; - } - if (match[2]) { - // bytesXX - const length = parseInt(match[2]); - assertArgument(length !== 0 && length <= 32, "invalid bytes length", "type", type); - } - else if (match[3]) { - // intXX or uintXX - const size = parseInt(match[3]); - assertArgument(size !== 0 && size <= 256 && size % 8 === 0, "invalid numeric width", "type", type); - } - return type; -} -// Make the Fragment constructors effectively private -const _guard = {}; -const internal = Symbol.for("_corebc_internal"); -const ParamTypeInternal = "_ParamTypeInternal"; -const ErrorFragmentInternal = "_ErrorInternal"; -const EventFragmentInternal = "_EventInternal"; -const ConstructorFragmentInternal = "_ConstructorInternal"; -const FallbackFragmentInternal = "_FallbackInternal"; -const FunctionFragmentInternal = "_FunctionInternal"; -const StructFragmentInternal = "_StructInternal"; -/** - * Each input and output of a [[Fragment]] is an Array of **PAramType**. - */ -export class ParamType { - /** - * The local name of the parameter (or ``""`` if unbound) - */ - name; - /** - * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, - * ``"uint256[3][]"``) - */ - type; - /** - * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) - */ - baseType; - /** - * True if the parameters is indexed. - * - * For non-indexable types this is ``null``. - */ - indexed; - /** - * The components for the tuple. - * - * For non-tuple types this is ``null``. - */ - components; - /** - * The array length, or ``-1`` for dynamic-lengthed arrays. - * - * For non-array types this is ``null``. - */ - arrayLength; - /** - * The type of each child in the array. - * - * For non-array types this is ``null``. - */ - arrayChildren; - /** - * @private - */ - constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) { - assertPrivate(guard, _guard, "ParamType"); - Object.defineProperty(this, internal, { value: ParamTypeInternal }); - if (components) { - components = Object.freeze(components.slice()); - } - if (baseType === "array") { - if (arrayLength == null || arrayChildren == null) { - throw new Error(""); - } - } - else if (arrayLength != null || arrayChildren != null) { - throw new Error(""); - } - if (baseType === "tuple") { - if (components == null) { - throw new Error(""); - } - } - else if (components != null) { - throw new Error(""); - } - defineProperties(this, { - name, - type, - baseType, - indexed, - components, - arrayLength, - arrayChildren, - }); - } - /** - * Return a string representation of this type. - * - * For example, - * - * ``sighash" => "(uint256,address)"`` - * - * ``"minimal" => "tuple(uint256,address) indexed"`` - * - * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` - */ - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - let result = { - type: this.baseType === "tuple" ? "tuple" : this.type, - name: this.name || undefined, - }; - if (typeof this.indexed === "boolean") { - result.indexed = this.indexed; - } - if (this.isTuple()) { - result.components = this.components.map((c) => JSON.parse(c.format(format))); - } - return JSON.stringify(result); - } - let result = ""; - // Array - if (this.isArray()) { - result += this.arrayChildren.format(format); - result += `[${this.arrayLength < 0 ? "" : String(this.arrayLength)}]`; - } - else { - if (this.isTuple()) { - if (format !== "sighash") { - result += this.type; - } - result += - "(" + - this.components - .map((comp) => comp.format(format)) - .join(format === "full" ? ", " : ",") + - ")"; - } - else { - result += this.type; - } - } - if (format !== "sighash") { - if (this.indexed === true) { - result += " indexed"; - } - if (format === "full" && this.name) { - result += " " + this.name; - } - } - return result; - } - /* - * Returns true if %%value%% is an Array type. - * - * This provides a type gaurd ensuring that the - * [[arrayChildren]] and [[arrayLength]] are non-null. - */ - //static isArray(value: any): value is { arrayChildren: ParamType, arrayLength: number } { - // return value && (value.baseType === "array") - //} - /** - * Returns true if %%this%% is an Array type. - * - * This provides a type gaurd ensuring that [[arrayChildren]] - * and [[arrayLength]] are non-null. - */ - isArray() { - return this.baseType === "array"; - } - /** - * Returns true if %%this%% is a Tuple type. - * - * This provides a type gaurd ensuring that [[components]] - * is non-null. - */ - isTuple() { - return this.baseType === "tuple"; - } - /** - * Returns true if %%this%% is an Indexable type. - * - * This provides a type gaurd ensuring that [[indexed]] - * is non-null. - */ - isIndexable() { - return this.indexed != null; - } - /** - * Walks the **ParamType** with %%value%%, calling %%process%% - * on each type, destructing the %%value%% recursively. - */ - walk(value, process) { - if (this.isArray()) { - if (!Array.isArray(value)) { - throw new Error("invalid array value"); - } - if (this.arrayLength !== -1 && value.length !== this.arrayLength) { - throw new Error("array is wrong length"); - } - const _this = this; - return value.map((v) => _this.arrayChildren.walk(v, process)); - } - if (this.isTuple()) { - if (!Array.isArray(value)) { - throw new Error("invalid tuple value"); - } - if (value.length !== this.components.length) { - throw new Error("array is wrong length"); - } - const _this = this; - return value.map((v, i) => _this.components[i].walk(v, process)); - } - return process(this.type, value); - } - #walkAsync(promises, value, process, setValue) { - if (this.isArray()) { - if (!Array.isArray(value)) { - throw new Error("invalid array value"); - } - if (this.arrayLength !== -1 && value.length !== this.arrayLength) { - throw new Error("array is wrong length"); - } - const childType = this.arrayChildren; - const result = value.slice(); - result.forEach((value, index) => { - childType.#walkAsync(promises, value, process, (value) => { - result[index] = value; - }); - }); - setValue(result); - return; - } - if (this.isTuple()) { - const components = this.components; - // Convert the object into an array - let result; - if (Array.isArray(value)) { - result = value.slice(); - } - else { - if (value == null || typeof value !== "object") { - throw new Error("invalid tuple value"); - } - result = components.map((param) => { - if (!param.name) { - throw new Error("cannot use object value with unnamed components"); - } - if (!(param.name in value)) { - throw new Error(`missing value for component ${param.name}`); - } - return value[param.name]; - }); - } - if (result.length !== this.components.length) { - throw new Error("array is wrong length"); - } - result.forEach((value, index) => { - components[index].#walkAsync(promises, value, process, (value) => { - result[index] = value; - }); - }); - setValue(result); - return; - } - const result = process(this.type, value); - if (result.then) { - promises.push((async function () { - setValue(await result); - })()); - } - else { - setValue(result); - } - } - /** - * Walks the **ParamType** with %%value%%, asynchronously calling - * %%process%% on each type, destructing the %%value%% recursively. - * - * This can be used to resolve ENS naes by walking and resolving each - * ``"address"`` type. - */ - async walkAsync(value, process) { - const promises = []; - const result = [value]; - this.#walkAsync(promises, value, process, (value) => { - result[0] = value; - }); - if (promises.length) { - await Promise.all(promises); - } - return result[0]; - } - /** - * Creates a new **ParamType** for %%obj%%. - * - * If %%allowIndexed%% then the ``indexed`` keyword is permitted, - * otherwise the ``indexed`` keyword will throw an error. - */ - static from(obj, allowIndexed) { - if (ParamType.isParamType(obj)) { - return obj; - } - if (typeof obj === "string") { - return ParamType.from(lex(obj), allowIndexed); - } - else if (obj instanceof TokenString) { - let type = "", baseType = ""; - let comps = null; - if (consumeKeywords(obj, setify(["tuple"])).has("tuple") || - obj.peekType("OPEN_PAREN")) { - // Tuple - baseType = "tuple"; - comps = obj.popParams().map((t) => ParamType.from(t)); - type = `tuple(${comps.map((c) => c.format()).join(",")})`; - } - else { - // Normal - type = verifyBasicType(obj.popType("TYPE")); - baseType = type; - } - // Check for Array - let arrayChildren = null; - let arrayLength = null; - while (obj.length && obj.peekType("BRACKET")) { - const bracket = obj.pop(); //arrays[i]; - arrayChildren = new ParamType(_guard, "", type, baseType, null, comps, arrayLength, arrayChildren); - arrayLength = bracket.value; - type += bracket.text; - baseType = "array"; - comps = null; - } - let indexed = null; - const keywords = consumeKeywords(obj, KwModifiers); - if (keywords.has("indexed")) { - if (!allowIndexed) { - throw new Error(""); - } - indexed = true; - } - const name = obj.peekType("ID") ? obj.pop().text : ""; - if (obj.length) { - throw new Error("leftover tokens"); - } - return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren); - } - const name = obj.name; - assertArgument(!name || (typeof name === "string" && name.match(regexId)), "invalid name", "obj.name", name); - let indexed = obj.indexed; - if (indexed != null) { - assertArgument(allowIndexed, "parameter cannot be indexed", "obj.indexed", obj.indexed); - indexed = !!indexed; - } - let type = obj.type; - let arrayMatch = type.match(regexArrayType); - if (arrayMatch) { - const arrayLength = parseInt(arrayMatch[2] || "-1"); - const arrayChildren = ParamType.from({ - type: arrayMatch[1], - components: obj.components, - }); - return new ParamType(_guard, name || "", type, "array", indexed, null, arrayLength, arrayChildren); - } - if (type === "tuple" || - type.startsWith("tuple(" /* fix: ) */) || - type.startsWith("(" /* fix: ) */)) { - const comps = obj.components != null - ? obj.components.map((c) => ParamType.from(c)) - : null; - const tuple = new ParamType(_guard, name || "", type, "tuple", indexed, comps, null, null); - // @TODO: use lexer to validate and normalize type - return tuple; - } - type = verifyBasicType(obj.type); - return new ParamType(_guard, name || "", type, type, indexed, null, null, null); - } - /** - * Returns true if %%value%% is a **ParamType**. - */ - static isParamType(value) { - return value && value[internal] === ParamTypeInternal; - } -} -/** - * An abstract class to represent An individual fragment from a parse ABI. - */ -export class Fragment { - /** - * The type of the fragment. - */ - type; - /** - * The inputs for the fragment. - */ - inputs; - /** - * @private - */ - constructor(guard, type, inputs) { - assertPrivate(guard, _guard, "Fragment"); - inputs = Object.freeze(inputs.slice()); - defineProperties(this, { type, inputs }); - } - /** - * Creates a new **Fragment** for %%obj%%, wich can be any supported - * ABI frgament type. - */ - static from(obj) { - if (typeof obj === "string") { - // Try parsing JSON... - try { - Fragment.from(JSON.parse(obj)); - } - catch (e) { } - // ...otherwise, use the human-readable lexer - return Fragment.from(lex(obj)); - } - if (obj instanceof TokenString) { - // Human-readable ABI (already lexed) - const type = obj.peekKeyword(KwTypes); - switch (type) { - case "constructor": - return ConstructorFragment.from(obj); - case "error": - return ErrorFragment.from(obj); - case "event": - return EventFragment.from(obj); - case "fallback": - case "receive": - return FallbackFragment.from(obj); - case "function": - return FunctionFragment.from(obj); - case "struct": - return StructFragment.from(obj); - } - } - else if (typeof obj === "object") { - // JSON ABI - switch (obj.type) { - case "constructor": - return ConstructorFragment.from(obj); - case "error": - return ErrorFragment.from(obj); - case "event": - return EventFragment.from(obj); - case "fallback": - case "receive": - return FallbackFragment.from(obj); - case "function": - return FunctionFragment.from(obj); - case "struct": - return StructFragment.from(obj); - } - assert(false, `unsupported type: ${obj.type}`, "UNSUPPORTED_OPERATION", { - operation: "Fragment.from", - }); - } - assertArgument(false, "unsupported frgament object", "obj", obj); - } - /** - * Returns true if %%value%% is a [[ConstructorFragment]]. - */ - static isConstructor(value) { - return ConstructorFragment.isFragment(value); - } - /** - * Returns true if %%value%% is an [[ErrorFragment]]. - */ - static isError(value) { - return ErrorFragment.isFragment(value); - } - /** - * Returns true if %%value%% is an [[EventFragment]]. - */ - static isEvent(value) { - return EventFragment.isFragment(value); - } - /** - * Returns true if %%value%% is a [[FunctionFragment]]. - */ - static isFunction(value) { - return FunctionFragment.isFragment(value); - } - /** - * Returns true if %%value%% is a [[StructFragment]]. - */ - static isStruct(value) { - return StructFragment.isFragment(value); - } -} -/** - * An abstract class to represent An individual fragment - * which has a name from a parse ABI. - */ -export class NamedFragment extends Fragment { - /** - * The name of the fragment. - */ - name; - /** - * @private - */ - constructor(guard, type, name, inputs) { - super(guard, type, inputs); - assertArgument(typeof name === "string" && name.match(regexId), "invalid identifier", "name", name); - inputs = Object.freeze(inputs.slice()); - defineProperties(this, { name }); - } -} -function joinParams(format, params) { - return ("(" + - params.map((p) => p.format(format)).join(format === "full" ? ", " : ",") + - ")"); -} -/** - * A Fragment which represents a //Custom Error//. - */ -export class ErrorFragment extends NamedFragment { - /** - * @private - */ - constructor(guard, name, inputs) { - super(guard, "error", name, inputs); - Object.defineProperty(this, internal, { value: ErrorFragmentInternal }); - } - /** - * The Custom Error selector. - */ - get selector() { - return id(this.format("sighash")).substring(0, 10); - } - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "error", - name: this.name, - inputs: this.inputs.map((input) => JSON.parse(input.format(format))), - }); - } - const result = []; - if (format !== "sighash") { - result.push("error"); - } - result.push(this.name + joinParams(format, this.inputs)); - return result.join(" "); - } - static from(obj) { - if (ErrorFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return ErrorFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("error", obj); - const inputs = consumeParams(obj); - consumeEoi(obj); - return new ErrorFragment(_guard, name, inputs); - } - return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); - } - static isFragment(value) { - return value && value[internal] === ErrorFragmentInternal; - } -} -/** - * A Fragment which represents an Event. - */ -export class EventFragment extends NamedFragment { - anonymous; - /** - * @private - */ - constructor(guard, name, inputs, anonymous) { - super(guard, "event", name, inputs); - Object.defineProperty(this, internal, { value: EventFragmentInternal }); - defineProperties(this, { anonymous }); - } - /** - * The Event topic hash. - */ - get topicHash() { - return id(this.format("sighash")); - } - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "event", - anonymous: this.anonymous, - name: this.name, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - }); - } - const result = []; - if (format !== "sighash") { - result.push("event"); - } - result.push(this.name + joinParams(format, this.inputs)); - if (format !== "sighash" && this.anonymous) { - result.push("anonymous"); - } - return result.join(" "); - } - static getTopicHash(name, params) { - params = (params || []).map((p) => ParamType.from(p)); - const fragment = new EventFragment(_guard, name, params, false); - return fragment.topicHash; - } - static from(obj) { - if (EventFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return EventFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("event", obj); - const inputs = consumeParams(obj, true); - const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has("anonymous"); - consumeEoi(obj); - return new EventFragment(_guard, name, inputs, anonymous); - } - return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous); - } - static isFragment(value) { - return value && value[internal] === EventFragmentInternal; - } -} -/** - * A Fragment which represents a constructor. - */ -export class ConstructorFragment extends Fragment { - payable; - energy; - /** - * @private - */ - constructor(guard, type, inputs, payable, energy) { - super(guard, type, inputs); - Object.defineProperty(this, internal, { - value: ConstructorFragmentInternal, - }); - defineProperties(this, { payable, energy }); - } - format(format) { - assert(format != null && format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" }); - if (format === "json") { - return JSON.stringify({ - type: "constructor", - stateMutability: this.payable ? "payable" : "undefined", - payable: this.payable, - energy: this.energy != null ? this.energy : undefined, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - }); - } - const result = [`constructor${joinParams(format, this.inputs)}`]; - result.push(this.payable ? "payable" : "nonpayable"); - if (this.energy != null) { - result.push(`@${this.energy.toString()}`); - } - return result.join(" "); - } - static from(obj) { - if (ConstructorFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return ConstructorFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - consumeKeywords(obj, setify(["constructor"])); - const inputs = consumeParams(obj); - const payable = !!consumeKeywords(obj, setify(["payable"])).has("payable"); - const energy = consumeEnergy(obj); - consumeEoi(obj); - return new ConstructorFragment(_guard, "constructor", inputs, payable, energy); - } - return new ConstructorFragment(_guard, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, obj.energy != null ? obj.energy : null); - } - static isFragment(value) { - return value && value[internal] === ConstructorFragmentInternal; - } -} -/** - * A Fragment which represents a method. - */ -export class FallbackFragment extends Fragment { - /** - * If the function can be sent value during invocation. - */ - payable; - constructor(guard, inputs, payable) { - super(guard, "fallback", inputs); - Object.defineProperty(this, internal, { value: FallbackFragmentInternal }); - defineProperties(this, { payable }); - } - format(format) { - const type = this.inputs.length === 0 ? "receive" : "fallback"; - if (format === "json") { - const stateMutability = this.payable ? "payable" : "nonpayable"; - return JSON.stringify({ type, stateMutability }); - } - return `${type}()${this.payable ? " payable" : ""}`; - } - static from(obj) { - if (FallbackFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return FallbackFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const errorObj = obj.toString(); - const topIsValid = obj.peekKeyword(setify(["fallback", "receive"])); - assertArgument(topIsValid, "type must be fallback or receive", "obj", errorObj); - const type = obj.popKeyword(setify(["fallback", "receive"])); - // receive() - if (type === "receive") { - const inputs = consumeParams(obj); - assertArgument(inputs.length === 0, `receive cannot have arguments`, "obj.inputs", inputs); - consumeKeywords(obj, setify(["payable"])); - consumeEoi(obj); - return new FallbackFragment(_guard, [], true); - } - // fallback() [payable] - // fallback(bytes) [payable] returns (bytes) - let inputs = consumeParams(obj); - if (inputs.length) { - assertArgument(inputs.length === 1 && inputs[0].type === "bytes", "invalid fallback inputs", "obj.inputs", inputs.map((i) => i.format("minimal")).join(", ")); - } - else { - inputs = [ParamType.from("bytes")]; - } - const mutability = consumeMutability(obj); - assertArgument(mutability === "nonpayable" || mutability === "payable", "fallback cannot be constants", "obj.stateMutability", mutability); - if (consumeKeywords(obj, setify(["returns"])).has("returns")) { - const outputs = consumeParams(obj); - assertArgument(outputs.length === 1 && outputs[0].type === "bytes", "invalid fallback outputs", "obj.outputs", outputs.map((i) => i.format("minimal")).join(", ")); - } - consumeEoi(obj); - return new FallbackFragment(_guard, inputs, mutability === "payable"); - } - if (obj.type === "receive") { - return new FallbackFragment(_guard, [], true); - } - if (obj.type === "fallback") { - const inputs = [ParamType.from("bytes")]; - const payable = obj.stateMutability === "payable"; - return new FallbackFragment(_guard, inputs, payable); - } - assertArgument(false, "invalid fallback description", "obj", obj); - } - static isFragment(value) { - return value && value[internal] === FallbackFragmentInternal; - } -} -/** - * A Fragment which represents a method. - */ -export class FunctionFragment extends NamedFragment { - /** - * If the function is constant (e.g. ``pure`` or ``view`` functions). - */ - constant; - /** - * The returned types for the result of calling this function. - */ - outputs; - /** - * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` - * or ``pure``) - */ - stateMutability; - /** - * If the function can be sent value during invocation. - */ - payable; - /** - * The amount of energy to send when calling this function - */ - energy; - /** - * @private - */ - constructor(guard, name, stateMutability, inputs, outputs, energy) { - super(guard, "function", name, inputs); - Object.defineProperty(this, internal, { value: FunctionFragmentInternal }); - outputs = Object.freeze(outputs.slice()); - const constant = stateMutability === "view" || stateMutability === "pure"; - const payable = stateMutability === "payable"; - defineProperties(this, { - constant, - energy, - outputs, - payable, - stateMutability, - }); - } - /** - * The Function selector. - */ - get selector() { - return id(this.format("sighash")).substring(0, 10); - } - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "function", - name: this.name, - constant: this.constant, - stateMutability: this.stateMutability !== "nonpayable" - ? this.stateMutability - : undefined, - payable: this.payable, - energy: this.energy != null ? this.energy : undefined, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - outputs: this.outputs.map((o) => JSON.parse(o.format(format))), - }); - } - const result = []; - if (format !== "sighash") { - result.push("function"); - } - result.push(this.name + joinParams(format, this.inputs)); - if (format !== "sighash") { - if (this.stateMutability !== "nonpayable") { - result.push(this.stateMutability); - } - if (this.outputs && this.outputs.length) { - result.push("returns"); - result.push(joinParams(format, this.outputs)); - } - if (this.energy != null) { - result.push(`@${this.energy.toString()}`); - } - } - return result.join(" "); - } - static getSelector(name, params) { - params = (params || []).map((p) => ParamType.from(p)); - const fragment = new FunctionFragment(_guard, name, "view", params, [], null); - return fragment.selector; - } - static from(obj) { - if (FunctionFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return FunctionFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("function", obj); - const inputs = consumeParams(obj); - const mutability = consumeMutability(obj); - let outputs = []; - if (consumeKeywords(obj, setify(["returns"])).has("returns")) { - outputs = consumeParams(obj); - } - const energy = consumeEnergy(obj); - consumeEoi(obj); - return new FunctionFragment(_guard, name, mutability, inputs, outputs, energy); - } - let stateMutability = obj.stateMutability; - // Use legacy Solidity ABI logic if stateMutability is missing - if (stateMutability == null) { - stateMutability = "payable"; - if (typeof obj.constant === "boolean") { - stateMutability = "view"; - if (!obj.constant) { - stateMutability = "payable"; - if (typeof obj.payable === "boolean" && !obj.payable) { - stateMutability = "nonpayable"; - } - } - } - else if (typeof obj.payable === "boolean" && !obj.payable) { - stateMutability = "nonpayable"; - } - } - // @TODO: verifyState for stateMutability (e.g. throw if - // payable: false but stateMutability is "nonpayable") - return new FunctionFragment(_guard, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], obj.energy != null ? obj.energy : null); - } - static isFragment(value) { - return value && value[internal] === FunctionFragmentInternal; - } -} -/** - * A Fragment which represents a structure. - */ -export class StructFragment extends NamedFragment { - /** - * @private - */ - constructor(guard, name, inputs) { - super(guard, "struct", name, inputs); - Object.defineProperty(this, internal, { value: StructFragmentInternal }); - } - format() { - throw new Error("@TODO"); - } - static from(obj) { - if (typeof obj === "string") { - return StructFragment.from(lex(obj)); - } - else if (obj instanceof TokenString) { - const name = consumeName("struct", obj); - const inputs = consumeParams(obj); - consumeEoi(obj); - return new StructFragment(_guard, name, inputs); - } - return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); - } - static isFragment(value) { - return value && value[internal] === StructFragmentInternal; - } -} -//# sourceMappingURL=fragments.js.map \ No newline at end of file diff --git a/lib.esm/abi/fragments.js.map b/lib.esm/abi/fragments.js.map deleted file mode 100644 index c2305b912..000000000 --- a/lib.esm/abi/fragments.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../../src.ts/abi/fragments.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,MAAM,EACN,aAAa,EACb,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAkGtC,qCAAqC;AACrC,SAAS,MAAM,CAAC,KAAoB;IAClC,MAAM,MAAM,GAAgB,IAAI,GAAG,EAAE,CAAC;IACtC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,sBAAsB;AACtB,MAAM,QAAQ,GAAG,6DAA6D,CAAC;AAC/E,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAE5C,MAAM,QAAQ,GAAG,0DAA0D,CAAC;AAC5E,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAE5C,MAAM,YAAY,GAAG,yCAAyC,CAAC;AAC/D,MAAM,WAAW,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAEpD,MAAM,QAAQ,GAAG,eAAe,CAAC;AAEjC,eAAe;AACf,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,Y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CAAC,KAAK,sBAAsB,CAAC;IAC7D,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/abi/index.d.ts b/lib.esm/abi/index.d.ts deleted file mode 100644 index ce0ddb016..000000000 --- a/lib.esm/abi/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Explain about ABI here... - * - * @_section api/abi:Application Binary Interface [about-abi] - * @_navTitle: ABI - */ -export { AbiCoder } from "./abi-coder.js"; -export { decodeBytes32String, encodeBytes32String } from "./bytes32.js"; -export { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, NamedFragment, ParamType, StructFragment, } from "./fragments.js"; -export { checkResultErrors, Indexed, Interface, ErrorDescription, LogDescription, TransactionDescription, Result, } from "./interface.js"; -export { Typed } from "./typed.js"; -export type { JsonFragment, JsonFragmentType, FormatType, FragmentType, ParamTypeWalkAsyncFunc, ParamTypeWalkFunc, } from "./fragments.js"; -export type { InterfaceAbi } from "./interface.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/index.d.ts.map b/lib.esm/abi/index.d.ts.map deleted file mode 100644 index 4eb1a4ab8..000000000 --- a/lib.esm/abi/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,MAAM,GACP,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/lib.esm/abi/index.js b/lib.esm/abi/index.js deleted file mode 100644 index 0144c83ef..000000000 --- a/lib.esm/abi/index.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Explain about ABI here... - * - * @_section api/abi:Application Binary Interface [about-abi] - * @_navTitle: ABI - */ -////// -export { AbiCoder } from "./abi-coder.js"; -export { decodeBytes32String, encodeBytes32String } from "./bytes32.js"; -export { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, NamedFragment, ParamType, StructFragment, } from "./fragments.js"; -export { checkResultErrors, Indexed, Interface, ErrorDescription, LogDescription, TransactionDescription, Result, } from "./interface.js"; -export { Typed } from "./typed.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.esm/abi/index.js.map b/lib.esm/abi/index.js.map deleted file mode 100644 index 906989cb2..000000000 --- a/lib.esm/abi/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM;AACN,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,MAAM,GACP,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"} \ No newline at end of file diff --git a/lib.esm/abi/interface.d.ts b/lib.esm/abi/interface.d.ts deleted file mode 100644 index 62b24ebe4..000000000 --- a/lib.esm/abi/interface.d.ts +++ /dev/null @@ -1,270 +0,0 @@ -/** - * About Interface - * - * @_subsection api/abi:Interfaces [interfaces] - */ -import { AbiCoder } from "./abi-coder.js"; -import { checkResultErrors, Result } from "./coders/abstract-coder.js"; -import { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, ParamType } from "./fragments.js"; -import { Typed } from "./typed.js"; -import type { BigNumberish, BytesLike, CallExceptionError, CallExceptionTransaction } from "../utils/index.js"; -import type { JsonFragment } from "./fragments.js"; -export { checkResultErrors, Result }; -export declare class LogDescription { - readonly fragment: EventFragment; - readonly name: string; - readonly signature: string; - readonly topic: string; - readonly args: Result; - constructor(fragment: EventFragment, topic: string, args: Result); -} -export declare class TransactionDescription { - readonly fragment: FunctionFragment; - readonly name: string; - readonly args: Result; - readonly signature: string; - readonly selector: string; - readonly value: bigint; - constructor(fragment: FunctionFragment, selector: string, args: Result, value: bigint); -} -export declare class ErrorDescription { - readonly fragment: ErrorFragment; - readonly name: string; - readonly args: Result; - readonly signature: string; - readonly selector: string; - constructor(fragment: ErrorFragment, selector: string, args: Result); -} -export declare class Indexed { - readonly hash: null | string; - readonly _isIndexed: boolean; - static isIndexed(value: any): value is Indexed; - constructor(hash: null | string); -} -/** - * @TODO - */ -export type InterfaceAbi = string | ReadonlyArray; -/** - * An Interface abstracts many of the low-level details for - * encoding and decoding the data on the blockchain. - * - * An ABI provides information on how to encode data to send to - * a Contract, how to decode the results and events and how to - * interpret revert errors. - * - * The ABI can be specified by [any supported format](InterfaceAbi). - */ -export declare class Interface { - #private; - /** - * All the Contract ABI members (i.e. methods, events, errors, etc). - */ - readonly fragments: ReadonlyArray; - /** - * The Contract constructor. - */ - readonly deploy: ConstructorFragment; - /** - * The Fallback method, if any. - */ - readonly fallback: null | FallbackFragment; - /** - * If receiving xcb is supported. - */ - readonly receive: boolean; - /** - * Create a new Interface for the %%fragments%%. - */ - constructor(fragments: InterfaceAbi); - /** - * Returns the entire Human-Readable ABI, as an array of - * signatures, optionally as %%minimal%% strings, which - * removes parameter names and unneceesary spaces. - */ - format(minimal?: boolean): Array; - /** - * Return the JSON-encoded ABI. This is the format Solidiy - * returns. - */ - formatJson(): string; - /** - * The ABI coder that will be used to encode and decode binary - * data. - */ - getAbiCoder(): AbiCoder; - /** - * Get the function name for %%key%%, which may be a function selector, - * function name or function signature that belongs to the ABI. - */ - getFunctionName(key: string): string; - /** - * Returns true if %%key%% (a function selector, function name or - * function signature) is present in the ABI. - * - * In the case of a function name, the name may be ambiguous, so - * accessing the [[FunctionFragment]] may require refinement. - */ - hasFunction(key: string): boolean; - /** - * Get the [[FunctionFragment]] for %%key%%, which may be a function - * selector, function name or function signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple functions match by name. - * - * If the %%key%% and %%values%% do not refine to a single function in - * the ABI, this will throw. - */ - getFunction(key: string, values?: Array): null | FunctionFragment; - /** - * Iterate over all functions, calling %%callback%%, sorted by their name. - */ - forEachFunction(callback: (func: FunctionFragment, index: number) => void): void; - /** - * Get the event name for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - */ - getEventName(key: string): string; - /** - * Returns true if %%key%% (an event topic hash, event name or - * event signature) is present in the ABI. - * - * In the case of an event name, the name may be ambiguous, so - * accessing the [[EventFragment]] may require refinement. - */ - hasEvent(key: string): boolean; - /** - * Get the [[EventFragment]] for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple events match by name. - * - * If the %%key%% and %%values%% do not refine to a single event in - * the ABI, this will throw. - */ - getEvent(key: string, values?: Array): null | EventFragment; - /** - * Iterate over all events, calling %%callback%%, sorted by their name. - */ - forEachEvent(callback: (func: EventFragment, index: number) => void): void; - /** - * Get the [[ErrorFragment]] for %%key%%, which may be an error - * selector, error name or error signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple errors match by name. - * - * If the %%key%% and %%values%% do not refine to a single error in - * the ABI, this will throw. - */ - getError(key: string, values?: Array): null | ErrorFragment; - /** - * Iterate over all errors, calling %%callback%%, sorted by their name. - */ - forEachError(callback: (func: ErrorFragment, index: number) => void): void; - _decodeParams(params: ReadonlyArray, data: BytesLike): Result; - _encodeParams(params: ReadonlyArray, values: ReadonlyArray): string; - /** - * Encodes a ``tx.data`` object for deploying the Contract with - * the %%values%% as the constructor arguments. - */ - encodeDeploy(values?: ReadonlyArray): string; - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified error (see [[getError]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeErrorResult(fragment: ErrorFragment | string, data: BytesLike): Result; - /** - * Encodes the transaction revert data for a call result that - * reverted from the the Contract with the sepcified %%error%% - * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeErrorResult(fragment: ErrorFragment | string, values?: ReadonlyArray): string; - /** - * Decodes the %%data%% from a transaction ``tx.data`` for - * the function specified (see [[getFunction]] for valid values - * for %%fragment%%). - * - * Most developers should prefer the [[parseTransaction]] method - * instead, which will automatically detect the fragment. - */ - decodeFunctionData(fragment: FunctionFragment | string, data: BytesLike): Result; - /** - * Encodes the ``tx.data`` for a transaction that calls the function - * specified (see [[getFunction]] for valid values for %%fragment%%) with - * the %%values%%. - */ - encodeFunctionData(fragment: FunctionFragment | string, values?: ReadonlyArray): string; - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeFunctionResult(fragment: FunctionFragment | string, data: BytesLike): Result; - makeError(_data: BytesLike, tx: CallExceptionTransaction): CallExceptionError; - /** - * Encodes the result data (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values - * for %%fragment%%) with %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeFunctionResult(fragment: FunctionFragment | string, values?: ReadonlyArray): string; - encodeFilterTopics(fragment: EventFragment | string, values: ReadonlyArray): Array>; - encodeEventLog(fragment: EventFragment | string, values: ReadonlyArray): { - data: string; - topics: Array; - }; - decodeEventLog(fragment: EventFragment | string, data: BytesLike, topics?: ReadonlyArray): Result; - /** - * Parses a transaction, finding the matching function and extracts - * the parameter values along with other useful function details. - * - * If the matching function cannot be found, return null. - */ - parseTransaction(tx: { - data: string; - value?: BigNumberish; - }): null | TransactionDescription; - parseCallResult(data: BytesLike): Result; - /** - * Parses a receipt log, finding the matching event and extracts - * the parameter values along with other useful event details. - * - * If the matching event cannot be found, returns null. - */ - parseLog(log: { - topics: Array; - data: string; - }): null | LogDescription; - /** - * Parses a revert data, finding the matching error and extracts - * the parameter values along with other useful error details. - * - * If the matching event cannot be found, returns null. - */ - parseError(data: BytesLike): null | ErrorDescription; - /** - * Creates a new [[Interface]] from the ABI %%value%%. - * - * The %%value%% may be provided as an existing [[Interface]] object, - * a JSON-encoded ABI or any Human-Readable ABI format. - */ - static from(value: InterfaceAbi | Interface): Interface; -} -//# sourceMappingURL=interface.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/interface.d.ts.map b/lib.esm/abi/interface.d.ts.map deleted file mode 100644 index 763cd7ac3..000000000 --- a/lib.esm/abi/interface.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src.ts/abi/inter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QAAQ,EAAE,aAAa,GAAG,MAAM,EAChC,IAAI,EAAE,SAAS,EACf,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAC7B,MAAM;IAgFT;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,EAAE;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,YAAY,CAAC;KACtB,GAAG,IAAI,GAAG,sBAAsB;IAcjC,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;IAIxC;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE;QACZ,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,IAAI,GAAG,cAAc;IAkBzB;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,gBAAgB;IAapD;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,SAAS;CAmBxD"} \ No newline at end of file diff --git a/lib.esm/abi/interface.js b/lib.esm/abi/interface.js deleted file mode 100644 index 7334605ad..000000000 --- a/lib.esm/abi/interface.js +++ /dev/null @@ -1,1030 +0,0 @@ -/** - * About Interface - * - * @_subsection api/abi:Interfaces [interfaces] - */ -import { id } from "../hash/index.js"; -import { concat, dataSlice, getBigInt, getBytes, getBytesCopy, hexlify, zeroPadValue, isHexString, defineProperties, assertArgument, toBeHex, assert, } from "../utils/index.js"; -import { AbiCoder } from "./abi-coder.js"; -import { checkResultErrors, Result } from "./coders/abstract-coder.js"; -import { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, } from "./fragments.js"; -import { Typed } from "./typed.js"; -import { sha256 } from "../crypto/sha3.js"; -export { checkResultErrors, Result }; -export class LogDescription { - fragment; - name; - signature; - topic; - args; - constructor(fragment, topic, args) { - const name = fragment.name, signature = fragment.format(); - defineProperties(this, { - fragment, - name, - signature, - topic, - args, - }); - } -} -export class TransactionDescription { - fragment; - name; - args; - signature; - selector; - value; - constructor(fragment, selector, args, value) { - const name = fragment.name, signature = fragment.format(); - defineProperties(this, { - fragment, - name, - args, - signature, - selector, - value, - }); - } -} -export class ErrorDescription { - fragment; - name; - args; - signature; - selector; - constructor(fragment, selector, args) { - const name = fragment.name, signature = fragment.format(); - defineProperties(this, { - fragment, - name, - args, - signature, - selector, - }); - } -} -export class Indexed { - hash; - _isIndexed; - static isIndexed(value) { - return !!(value && value._isIndexed); - } - constructor(hash) { - defineProperties(this, { hash, _isIndexed: true }); - } -} -// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require -const PanicReasons = { - "0": "generic panic", - "1": "assert(false)", - "17": "arithmetic overflow", - "18": "division or modulo by zero", - "33": "enum overflow", - "34": "invalid encoded storage byte array accessed", - "49": "out-of-bounds array access; popping on an empty array", - "50": "out-of-bounds access of an array or bytesN", - "65": "out of memory", - "81": "uninitialized function", -}; -const BuiltinErrors = { - "0x08c379a0": { - signature: "Error(string)", - name: "Error", - inputs: ["string"], - reason: (message) => { - return `reverted with reason string ${JSON.stringify(message)}`; - }, - }, - "0x4e487b71": { - signature: "Panic(uint256)", - name: "Panic", - inputs: ["uint256"], - reason: (code) => { - let reason = "unknown panic code"; - if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) { - reason = PanicReasons[code.toString()]; - } - return `reverted with panic code 0x${code.toString(16)} (${reason})`; - }, - }, -}; -/** - * An Interface abstracts many of the low-level details for - * encoding and decoding the data on the blockchain. - * - * An ABI provides information on how to encode data to send to - * a Contract, how to decode the results and events and how to - * interpret revert errors. - * - * The ABI can be specified by [any supported format](InterfaceAbi). - */ -export class Interface { - /** - * All the Contract ABI members (i.e. methods, events, errors, etc). - */ - fragments; - /** - * The Contract constructor. - */ - deploy; - /** - * The Fallback method, if any. - */ - fallback; - /** - * If receiving xcb is supported. - */ - receive; - #errors; - #events; - #functions; - // #structs: Map; - #abiCoder; - /** - * Create a new Interface for the %%fragments%%. - */ - constructor(fragments) { - let abi = []; - if (typeof fragments === "string") { - abi = JSON.parse(fragments); - } - else { - abi = fragments; - } - this.#functions = new Map(); - this.#errors = new Map(); - this.#events = new Map(); - // this.#structs = new Map(); - const frags = []; - for (const a of abi) { - try { - frags.push(Fragment.from(a)); - } - catch (error) { - console.log("EE", error); - } - } - defineProperties(this, { - fragments: Object.freeze(frags), - }); - let fallback = null; - let receive = false; - this.#abiCoder = this.getAbiCoder(); - // Add all fragments by their signature - this.fragments.forEach((fragment, index) => { - let bucket; - switch (fragment.type) { - case "constructor": - if (this.deploy) { - console.log("duplicate definition - constructor"); - return; - } - //checkNames(fragment, "input", fragment.inputs); - defineProperties(this, { - deploy: fragment, - }); - return; - case "fallback": - if (fragment.inputs.length === 0) { - receive = true; - } - else { - assertArgument(!fallback || - fragment.payable !== fallback.payable, "conflicting fallback fragments", `fragments[${index}]`, fragment); - fallback = fragment; - receive = fallback.payable; - } - return; - case "function": - //checkNames(fragment, "input", fragment.inputs); - //checkNames(fragment, "output", (fragment).outputs); - bucket = this.#functions; - break; - case "event": - //checkNames(fragment, "input", fragment.inputs); - bucket = this.#events; - break; - case "error": - bucket = this.#errors; - break; - default: - return; - } - // Two identical entries; ignore it - const signature = fragment.format(); - if (bucket.has(signature)) { - return; - } - bucket.set(signature, fragment); - }); - // If we do not have a constructor add a default - if (!this.deploy) { - defineProperties(this, { - deploy: ConstructorFragment.from("constructor()"), - }); - } - defineProperties(this, { fallback, receive }); - } - /** - * Returns the entire Human-Readable ABI, as an array of - * signatures, optionally as %%minimal%% strings, which - * removes parameter names and unneceesary spaces. - */ - format(minimal) { - const format = minimal ? "minimal" : "full"; - const abi = this.fragments.map((f) => f.format(format)); - return abi; - } - /** - * Return the JSON-encoded ABI. This is the format Solidiy - * returns. - */ - formatJson() { - const abi = this.fragments.map((f) => f.format("json")); - // We need to re-bundle the JSON fragments a bit - return JSON.stringify(abi.map((j) => JSON.parse(j))); - } - /** - * The ABI coder that will be used to encode and decode binary - * data. - */ - getAbiCoder() { - return AbiCoder.defaultAbiCoder(); - } - // Find a function definition by any means necessary (unless it is ambiguous) - #getFunction(key, values, forceUnique) { - // Selector - if (isHexString(key)) { - const selector = key.toLowerCase(); - for (const fragment of this.#functions.values()) { - if (selector === fragment.selector) { - return fragment; - } - } - return null; - } - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of this.#functions) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - if (values) { - const lastValue = values.length > 0 ? values[values.length - 1] : null; - let valueLength = values.length; - let allowOptions = true; - if (Typed.isTyped(lastValue) && lastValue.type === "overrides") { - allowOptions = false; - valueLength--; - } - // Remove all matches that don't have a compatible length. The args - // may contain an overrides, so the match may have n or n - 1 parameters - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs.length; - if (inputs !== valueLength && - (!allowOptions || inputs !== valueLength - 1)) { - matching.splice(i, 1); - } - } - // Remove all matches that don't match the Typed signature - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs; - for (let j = 0; j < values.length; j++) { - // Not a typed value - if (!Typed.isTyped(values[j])) { - continue; - } - // We are past the inputs - if (j >= inputs.length) { - if (values[j].type === "overrides") { - continue; - } - matching.splice(i, 1); - break; - } - // Make sure the value type matches the input type - if (values[j].type !== inputs[j].baseType) { - matching.splice(i, 1); - break; - } - } - } - } - // We found a single matching signature with an overrides, but the - // last value is something that cannot possibly be an options - if (matching.length === 1 && - values && - values.length !== matching[0].inputs.length) { - const lastArg = values[values.length - 1]; - if (lastArg == null || - Array.isArray(lastArg) || - typeof lastArg !== "object") { - matching.splice(0, 1); - } - } - if (matching.length === 0) { - return null; - } - if (matching.length > 1 && forceUnique) { - const matchStr = matching - .map((m) => JSON.stringify(m.format())) - .join(", "); - assertArgument(false, `ambiguous function description (i.e. matches ${matchStr})`, "key", key); - } - return matching[0]; - } - // Normalize the signature and lookup the function - const result = this.#functions.get(FunctionFragment.from(key).format()); - if (result) { - return result; - } - return null; - } - /** - * Get the function name for %%key%%, which may be a function selector, - * function name or function signature that belongs to the ABI. - */ - getFunctionName(key) { - const fragment = this.#getFunction(key, null, false); - assertArgument(fragment, "no matching function", "key", key); - return fragment.name; - } - /** - * Returns true if %%key%% (a function selector, function name or - * function signature) is present in the ABI. - * - * In the case of a function name, the name may be ambiguous, so - * accessing the [[FunctionFragment]] may require refinement. - */ - hasFunction(key) { - return !!this.#getFunction(key, null, false); - } - /** - * Get the [[FunctionFragment]] for %%key%%, which may be a function - * selector, function name or function signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple functions match by name. - * - * If the %%key%% and %%values%% do not refine to a single function in - * the ABI, this will throw. - */ - getFunction(key, values) { - return this.#getFunction(key, values || null, true); - } - /** - * Iterate over all functions, calling %%callback%%, sorted by their name. - */ - forEachFunction(callback) { - const names = Array.from(this.#functions.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#functions.get(name), i); - } - } - // Find an event definition by any means necessary (unless it is ambiguous) - #getEvent(key, values, forceUnique) { - // EventTopic - if (isHexString(key)) { - const eventTopic = key.toLowerCase(); - for (const fragment of this.#events.values()) { - if (eventTopic === fragment.topicHash) { - return fragment; - } - } - return null; - } - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of this.#events) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - if (values) { - // Remove all matches that don't have a compatible length. - for (let i = matching.length - 1; i >= 0; i--) { - if (matching[i].inputs.length < values.length) { - matching.splice(i, 1); - } - } - // Remove all matches that don't match the Typed signature - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs; - for (let j = 0; j < values.length; j++) { - // Not a typed value - if (!Typed.isTyped(values[j])) { - continue; - } - // Make sure the value type matches the input type - if (values[j].type !== inputs[j].baseType) { - matching.splice(i, 1); - break; - } - } - } - } - if (matching.length === 0) { - return null; - } - if (matching.length > 1 && forceUnique) { - const matchStr = matching - .map((m) => JSON.stringify(m.format())) - .join(", "); - assertArgument(false, `ambiguous event description (i.e. matches ${matchStr})`, "key", key); - } - return matching[0]; - } - // Normalize the signature and lookup the function - const result = this.#events.get(EventFragment.from(key).format()); - if (result) { - return result; - } - return null; - } - /** - * Get the event name for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - */ - getEventName(key) { - const fragment = this.#getEvent(key, null, false); - assertArgument(fragment, "no matching event", "key", key); - return fragment.name; - } - /** - * Returns true if %%key%% (an event topic hash, event name or - * event signature) is present in the ABI. - * - * In the case of an event name, the name may be ambiguous, so - * accessing the [[EventFragment]] may require refinement. - */ - hasEvent(key) { - return !!this.#getEvent(key, null, false); - } - /** - * Get the [[EventFragment]] for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple events match by name. - * - * If the %%key%% and %%values%% do not refine to a single event in - * the ABI, this will throw. - */ - getEvent(key, values) { - return this.#getEvent(key, values || null, true); - } - /** - * Iterate over all events, calling %%callback%%, sorted by their name. - */ - forEachEvent(callback) { - const names = Array.from(this.#events.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#events.get(name), i); - } - } - /** - * Get the [[ErrorFragment]] for %%key%%, which may be an error - * selector, error name or error signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple errors match by name. - * - * If the %%key%% and %%values%% do not refine to a single error in - * the ABI, this will throw. - */ - getError(key, values) { - if (isHexString(key)) { - const selector = key.toLowerCase(); - if (BuiltinErrors[selector]) { - return ErrorFragment.from(BuiltinErrors[selector].signature); - } - for (const fragment of this.#errors.values()) { - if (selector === fragment.selector) { - return fragment; - } - } - return null; - } - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of this.#errors) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - if (matching.length === 0) { - if (key === "Error") { - return ErrorFragment.from("error Error(string)"); - } - if (key === "Panic") { - return ErrorFragment.from("error Panic(uint256)"); - } - return null; - } - else if (matching.length > 1) { - const matchStr = matching - .map((m) => JSON.stringify(m.format())) - .join(", "); - assertArgument(false, `ambiguous error description (i.e. ${matchStr})`, "name", key); - } - return matching[0]; - } - // Normalize the signature and lookup the function - key = ErrorFragment.from(key).format(); - if (key === "Error(string)") { - return ErrorFragment.from("error Error(string)"); - } - if (key === "Panic(uint256)") { - return ErrorFragment.from("error Panic(uint256)"); - } - const result = this.#errors.get(key); - if (result) { - return result; - } - return null; - } - /** - * Iterate over all errors, calling %%callback%%, sorted by their name. - */ - forEachError(callback) { - const names = Array.from(this.#errors.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#errors.get(name), i); - } - } - // Get the 4-byte selector used by Solidity to identify a function - /* - getSelector(fragment: ErrorFragment | FunctionFragment): string { - if (typeof(fragment) === "string") { - const matches: Array = [ ]; - - try { matches.push(this.getFunction(fragment)); } catch (error) { } - try { matches.push(this.getError(fragment)); } catch (_) { } - - if (matches.length === 0) { - logger.throwArgumentError("unknown fragment", "key", fragment); - } else if (matches.length > 1) { - logger.throwArgumentError("ambiguous fragment matches function and error", "key", fragment); - } - - fragment = matches[0]; - } - - return dataSlice(id(fragment.format()), 0, 4); - } - */ - // Get the 32-byte topic hash used by Solidity to identify an event - /* - getEventTopic(fragment: EventFragment): string { - //if (typeof(fragment) === "string") { fragment = this.getEvent(eventFragment); } - return id(fragment.format()); - } - */ - _decodeParams(params, data) { - return this.#abiCoder.decode(params, data); - } - _encodeParams(params, values) { - return this.#abiCoder.encode(params, values); - } - /** - * Encodes a ``tx.data`` object for deploying the Contract with - * the %%values%% as the constructor arguments. - */ - encodeDeploy(values) { - return this._encodeParams(this.deploy.inputs, values || []); - } - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified error (see [[getError]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeErrorResult(fragment, data) { - if (typeof fragment === "string") { - const f = this.getError(fragment); - assertArgument(f, "unknown error", "fragment", fragment); - fragment = f; - } - assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, "data", data); - return this._decodeParams(fragment.inputs, dataSlice(data, 4)); - } - /** - * Encodes the transaction revert data for a call result that - * reverted from the the Contract with the sepcified %%error%% - * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeErrorResult(fragment, values) { - if (typeof fragment === "string") { - const f = this.getError(fragment); - assertArgument(f, "unknown error", "fragment", fragment); - fragment = f; - } - return concat([ - fragment.selector, - this._encodeParams(fragment.inputs, values || []), - ]); - } - /** - * Decodes the %%data%% from a transaction ``tx.data`` for - * the function specified (see [[getFunction]] for valid values - * for %%fragment%%). - * - * Most developers should prefer the [[parseTransaction]] method - * instead, which will automatically detect the fragment. - */ - decodeFunctionData(fragment, data) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, "data", data); - return this._decodeParams(fragment.inputs, dataSlice(data, 4)); - } - /** - * Encodes the ``tx.data`` for a transaction that calls the function - * specified (see [[getFunction]] for valid values for %%fragment%%) with - * the %%values%%. - */ - encodeFunctionData(fragment, values) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - return concat([ - fragment.selector, - this._encodeParams(fragment.inputs, values || []), - ]); - } - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeFunctionResult(fragment, data) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - let message = "invalid length for result data"; - const bytes = getBytesCopy(data); - if (bytes.length % 32 === 0) { - try { - return this.#abiCoder.decode(fragment.outputs, bytes); - } - catch (error) { - message = "could not decode result data"; - } - } - // Call returned data with no error, but the data is junk - assert(false, message, "BAD_DATA", { - value: hexlify(bytes), - info: { method: fragment.name, signature: fragment.format() }, - }); - } - makeError(_data, tx) { - const data = getBytes(_data, "data"); - const error = AbiCoder.getBuiltinCallException("call", tx, data); - // Not a built-in error; try finding a custom error - const customPrefix = "execution reverted (unknown custom error)"; - if (error.message.startsWith(customPrefix)) { - const selector = hexlify(data.slice(0, 4)); - const ef = this.getError(selector); - if (ef) { - try { - const args = this.#abiCoder.decode(ef.inputs, data.slice(4)); - error.revert = { - name: ef.name, - signature: ef.format(), - args, - }; - error.reason = error.revert.signature; - error.message = `execution reverted: ${error.reason}`; - } - catch (e) { - error.message = `execution reverted (coult not decode custom error)`; - } - } - } - // Add the invocation, if available - const parsed = this.parseTransaction(tx); - if (parsed) { - error.invocation = { - method: parsed.name, - signature: parsed.signature, - args: parsed.args, - }; - } - return error; - } - /** - * Encodes the result data (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values - * for %%fragment%%) with %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeFunctionResult(fragment, values) { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - return hexlify(this.#abiCoder.encode(fragment.outputs, values || [])); - } - /* - spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> { - const promises: Array> = [ ]; - const process = function(type: ParamType, value: any): any { - if (type.baseType === "array") { - return descend(type.child - } - if (type. === "address") { - } - }; - - const descend = function (inputs: Array, values: ReadonlyArray) { - if (inputs.length !== values.length) { throw new Error("length mismatch"); } - }; - - const result: Array = [ ]; - values.forEach((value, index) => { - if (value == null) { - topics.push(null); - } else if (param.baseType === "array" || param.baseType === "tuple") { - logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); - } else if (Array.isArray(value)) { - topics.push(value.map((value) => encodeTopic(param, value))); - } else { - topics.push(encodeTopic(param, value)); - } - }); - } - */ - // Create the filter for the event with search criteria (e.g. for xcb_filterLog) - encodeFilterTopics(fragment, values) { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - assertArgument(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - assert(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, "UNEXPECTED_ARGUMENT", { count: values.length, expectedCount: fragment.inputs.length }); - const topics = []; - if (!fragment.anonymous) { - topics.push(fragment.topicHash); - } - // @TODO: Use the coders for this; to properly support tuples, etc. - const encodeTopic = (param, value) => { - if (param.type === "string") { - return id(value); - } - else if (param.type === "bytes") { - return sha256(hexlify(value)); - } - if (param.type === "bool" && typeof value === "boolean") { - value = value ? "0x01" : "0x00"; - } - if (param.type.match(/^u?int/)) { - value = toBeHex(value); - } - // Check addresses are valid - if (param.type === "address") { - this.#abiCoder.encode(["address"], [value]); - } - return zeroPadValue(hexlify(value), 32); - //@TOOD should probably be return toHex(value, 32) - }; - values.forEach((value, index) => { - const param = fragment.inputs[index]; - if (!param.indexed) { - assertArgument(value == null, "cannot filter non-indexed parameters; must be null", "contract." + param.name, value); - return; - } - if (value == null) { - topics.push(null); - } - else if (param.baseType === "array" || param.baseType === "tuple") { - assertArgument(false, "filtering with tuples or arrays not supported", "contract." + param.name, value); - } - else if (Array.isArray(value)) { - topics.push(value.map((value) => encodeTopic(param, value))); - } - else { - topics.push(encodeTopic(param, value)); - } - }); - // Trim off trailing nulls - while (topics.length && topics[topics.length - 1] === null) { - topics.pop(); - } - return topics; - } - encodeEventLog(fragment, values) { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - assertArgument(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - const topics = []; - const dataTypes = []; - const dataValues = []; - if (!fragment.anonymous) { - topics.push(fragment.topicHash); - } - assertArgument(values.length === fragment.inputs.length, "event arguments/values mismatch", "values", values); - fragment.inputs.forEach((param, index) => { - const value = values[index]; - if (param.indexed) { - if (param.type === "string") { - topics.push(id(value)); - } - else if (param.type === "bytes") { - topics.push(sha256(value)); - } - else if (param.baseType === "tuple" || param.baseType === "array") { - // @TODO - throw new Error("not implemented"); - } - else { - topics.push(this.#abiCoder.encode([param.type], [value])); - } - } - else { - dataTypes.push(param); - dataValues.push(value); - } - }); - return { - data: this.#abiCoder.encode(dataTypes, dataValues), - topics: topics, - }; - } - // Decode a filter for the event and the search criteria - decodeEventLog(fragment, data, topics) { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - assertArgument(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - if (topics != null && !fragment.anonymous) { - const eventTopic = fragment.topicHash; - assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, "fragment/topic mismatch", "topics[0]", topics[0]); - topics = topics.slice(1); - } - const indexed = []; - const nonIndexed = []; - const dynamic = []; - fragment.inputs.forEach((param, index) => { - if (param.indexed) { - if (param.type === "string" || - param.type === "bytes" || - param.baseType === "tuple" || - param.baseType === "array") { - indexed.push(ParamType.from({ type: "bytes32", name: param.name })); - dynamic.push(true); - } - else { - indexed.push(param); - dynamic.push(false); - } - } - else { - nonIndexed.push(param); - dynamic.push(false); - } - }); - const resultIndexed = topics != null ? this.#abiCoder.decode(indexed, concat(topics)) : null; - const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true); - //const result: (Array & { [ key: string ]: any }) = [ ]; - const values = []; - const keys = []; - let nonIndexedIndex = 0, indexedIndex = 0; - fragment.inputs.forEach((param, index) => { - let value = null; - if (param.indexed) { - if (resultIndexed == null) { - value = new Indexed(null); - } - else if (dynamic[index]) { - value = new Indexed(resultIndexed[indexedIndex++]); - } - else { - try { - value = resultIndexed[indexedIndex++]; - } - catch (error) { - value = error; - } - } - } - else { - try { - value = resultNonIndexed[nonIndexedIndex++]; - } - catch (error) { - value = error; - } - } - values.push(value); - keys.push(param.name || null); - }); - return Result.fromItems(values, keys); - } - /** - * Parses a transaction, finding the matching function and extracts - * the parameter values along with other useful function details. - * - * If the matching function cannot be found, return null. - */ - parseTransaction(tx) { - const data = getBytes(tx.data, "tx.data"); - const value = getBigInt(tx.value != null ? tx.value : 0, "tx.value"); - const fragment = this.getFunction(hexlify(data.slice(0, 4))); - if (!fragment) { - return null; - } - const args = this.#abiCoder.decode(fragment.inputs, data.slice(4)); - return new TransactionDescription(fragment, fragment.selector, args, value); - } - parseCallResult(data) { - throw new Error("@TODO"); - } - /** - * Parses a receipt log, finding the matching event and extracts - * the parameter values along with other useful event details. - * - * If the matching event cannot be found, returns null. - */ - parseLog(log) { - const fragment = this.getEvent(log.topics[0]); - if (!fragment || fragment.anonymous) { - return null; - } - // @TODO: If anonymous, and the only method, and the input count matches, should we parse? - // Probably not, because just because it is the only event in the ABI does - // not mean we have the full ABI; maybe just a fragment? - return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics)); - } - /** - * Parses a revert data, finding the matching error and extracts - * the parameter values along with other useful error details. - * - * If the matching event cannot be found, returns null. - */ - parseError(data) { - const hexData = hexlify(data); - const fragment = this.getError(dataSlice(hexData, 0, 4)); - if (!fragment) { - return null; - } - const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4)); - return new ErrorDescription(fragment, fragment.selector, args); - } - /** - * Creates a new [[Interface]] from the ABI %%value%%. - * - * The %%value%% may be provided as an existing [[Interface]] object, - * a JSON-encoded ABI or any Human-Readable ABI format. - */ - static from(value) { - // Already an Interface, which is immutable - if (value instanceof Interface) { - return value; - } - // JSON - if (typeof value === "string") { - return new Interface(JSON.parse(value)); - } - // Maybe an interface from an older version, or from a symlinked copy - if (typeof value.format === "function") { - return new Interface(value.format("json")); - } - // Array of fragments - return new Interface(value); - } -} -//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/lib.esm/abi/interface.js.map b/lib.esm/abi/interface.js.map deleted file mode 100644 index 44978446b..000000000 --- a/lib.esm/abi/interface.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src.ts/abi/interface.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EACL,MAAM,EACN,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,OAAO,EACP,MAAM,GACP,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,aAAa,EAEb,QAAQ,EACR,gBAAgB,EAChB,SAAS,GACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAUnC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC;AAErC,MAAM,OAAO,cAAc;IAChB,QAAQ,CAAiB;IACzB,IAAI,CAAU;IACd,SAAS,CAAU;IACnB,KAAK,CAAU;IACf,IAAI,CAAU;IAEvB,YAAY,QAAuB,EAAE,KAAa,EAAE,IAAY;QAC9D,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EACxB,SAAS,GAAG,QAA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i/typed.d.ts +++ /dev/null @@ -1,172 +0,0 @@ -/** - * A Typed object allows a value to have its type explicitly - * specified. - * - * For example, in Solidity, the value ``45`` could represent a - * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent - * a ``bytes2`` or ``bytes``. - * - * Since JavaScript has no meaningful way to explicitly inform any - * APIs which what the type is, this allows transparent interoperation - * with Soldity. - * - * @_subsection: api/abi:Typed Values - */ -import type { Addressable } from "../address/index.js"; -import type { BigNumberish, BytesLike } from "../utils/index.js"; -import type { Result } from "./coders/abstract-coder.js"; -export interface TypedNumber extends Typed { - value: number; - defaultValue(): number; - minValue(): number; - maxValue(): number; -} -export interface TypedBigInt extends Typed { - value: bigint; - defaultValue(): bigint; - minValue(): bigint; - maxValue(): bigint; -} -export interface TypedData extends Typed { - value: string; - defaultValue(): string; -} -export interface TypedString extends Typed { - value: string; - defaultValue(): string; -} -export declare class Typed { - #private; - readonly type: string; - readonly value: any; - readonly _typedSymbol: Symbol; - constructor(gaurd: any, type: string, value: any, options?: any); - format(): string; - defaultValue(): string | number | bigint | Result; - minValue(): string | number | bigint; - maxValue(): string | number | bigint; - isBigInt(): this is TypedBigInt; - isData(): this is TypedData; - isString(): this is TypedString; - get tupleName(): null | string; - get arrayLength(): null | number; - static from(type: string, value: any): Typed; - static uint8(v: BigNumberish): Typed; - static uint16(v: BigNumberish): Typed; - static uint24(v: BigNumberish): Typed; - static uint32(v: BigNumberish): Typed; - static uint40(v: BigNumberish): Typed; - static uint48(v: BigNumberish): Typed; - static uint56(v: BigNumberish): Typed; - static uint64(v: BigNumberish): Typed; - static uint72(v: BigNumberish): Typed; - static uint80(v: BigNumberish): Typed; - static uint88(v: BigNumberish): Typed; - static uint96(v: BigNumberish): Typed; - static uint104(v: BigNumberish): Typed; - static uint112(v: BigNumberish): Typed; - static uint120(v: BigNumberish): Typed; - static uint128(v: BigNumberish): Typed; - static uint136(v: BigNumberish): Typed; - static uint144(v: BigNumberish): Typed; - static uint152(v: BigNumberish): Typed; - static uint160(v: BigNumberish): Typed; - static uint168(v: BigNumberish): Typed; - static uint176(v: BigNumberish): Typed; - static uint184(v: BigNumberish): Typed; - static uint192(v: BigNumberish): Typed; - static uint200(v: BigNumberish): Typed; - static uint208(v: BigNumberish): Typed; - static uint216(v: BigNumberish): Typed; - static uint224(v: BigNumberish): Typed; - static uint232(v: BigNumberish): Typed; - static uint240(v: BigNumberish): Typed; - static uint248(v: BigNumberish): Typed; - static uint256(v: BigNumberish): Typed; - static uint(v: BigNumberish): Typed; - static int8(v: BigNumberish): Typed; - static int16(v: BigNumberish): Typed; - static int24(v: BigNumberish): Typed; - static int32(v: BigNumberish): Typed; - static int40(v: BigNumberish): Typed; - static int48(v: BigNumberish): Typed; - static int56(v: BigNumberish): Typed; - static int64(v: BigNumberish): Typed; - static int72(v: BigNumberish): Typed; - static int80(v: BigNumberish): Typed; - static int88(v: BigNumberish): Typed; - static int96(v: BigNumberish): Typed; - static int104(v: BigNumberish): Typed; - static int112(v: BigNumberish): Typed; - static int120(v: BigNumberish): Typed; - static int128(v: BigNumberish): Typed; - static int136(v: BigNumberish): Typed; - static int144(v: BigNumberish): Typed; - static int152(v: BigNumberish): Typed; - static int160(v: BigNumberish): Typed; - static int168(v: BigNumberish): Typed; - static int176(v: BigNumberish): Typed; - static int184(v: BigNumberish): Typed; - static int192(v: BigNumberish): Typed; - static int200(v: BigNumberish): Typed; - static int208(v: BigNumberish): Typed; - static int216(v: BigNumberish): Typed; - static int224(v: BigNumberish): Typed; - static int232(v: BigNumberish): Typed; - static int240(v: BigNumberish): Typed; - static int248(v: BigNumberish): Typed; - static int256(v: BigNumberish): Typed; - static int(v: BigNumberish): Typed; - static bytes1(v: BytesLike): Typed; - static bytes2(v: BytesLike): Typed; - static bytes3(v: BytesLike): Typed; - static bytes4(v: BytesLike): Typed; - static bytes5(v: BytesLike): Typed; - static bytes6(v: BytesLike): Typed; - static bytes7(v: BytesLike): Typed; - static bytes8(v: BytesLike): Typed; - static bytes9(v: BytesLike): Typed; - static bytes10(v: BytesLike): Typed; - static bytes11(v: BytesLike): Typed; - static bytes12(v: BytesLike): Typed; - static bytes13(v: BytesLike): Typed; - static bytes14(v: BytesLike): Typed; - static bytes15(v: BytesLike): Typed; - static bytes16(v: BytesLike): Typed; - static bytes17(v: BytesLike): Typed; - static bytes18(v: BytesLike): Typed; - static bytes19(v: BytesLike): Typed; - static bytes20(v: BytesLike): Typed; - static bytes21(v: BytesLike): Typed; - static bytes22(v: BytesLike): Typed; - static bytes23(v: BytesLike): Typed; - static bytes24(v: BytesLike): Typed; - static bytes25(v: BytesLike): Typed; - static bytes26(v: BytesLike): Typed; - static bytes27(v: BytesLike): Typed; - static bytes28(v: BytesLike): Typed; - static bytes29(v: BytesLike): Typed; - static bytes30(v: BytesLike): Typed; - static bytes31(v: BytesLike): Typed; - static bytes32(v: BytesLike): Typed; - static address(v: string | Addressable): Typed; - static bool(v: any): Typed; - static bytes(v: BytesLike): Typed; - static string(v: string): Typed; - static array(v: Array, dynamic?: null | boolean): Typed; - static tuple(v: Array | Record, name?: string): Typed; - static overrides(v: Record): Typed; - /** - * Returns true only if %%value%% is a [[Typed]] instance. - */ - static isTyped(value: any): value is Typed; - /** - * If the value is a [[Typed]] instance, validates the underlying value - * and returns it, otherwise returns value directly. - * - * This is useful for functions that with to accept either a [[Typed]] - * object or values. - */ - static dereference(value: Typed | T, type: string): T; -} -//# sourceMappingURL=typed.d.ts.map \ No newline at end of file diff --git a/lib.esm/abi/typed.d.ts.map b/lib.esm/abi/typed.d.ts.map deleted file mode 100644 index 552156f75..000000000 --- a/lib.esm/abi/typed.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"typed.d.ts","sourceRoot":"","sources":["../../src.ts/abi/typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,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,EAAE,MAAM,GAAG,WAAW,GAAG,KAAK;IAG9C,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,GAAG,KAAK;IAG1B,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,KAAK;IAGjC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,KAAK;IAI/B,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,IAAI,GAAG,OAAO,GAAG,KAAK;IAKpE,MAAM,CAAC,KAAK,CACV,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,KAAK,CAAC,EACnD,IAAI,CAAC,EAAE,MAAM,GACZ,KAAK;IAKR,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK;IAI/C;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,KAAK;IAI1C;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;CASzD"} \ No newline at end of file diff --git a/lib.esm/abi/typed.js b/lib.esm/abi/typed.js deleted file mode 100644 index 7316d7736..000000000 --- a/lib.esm/abi/typed.js +++ /dev/null @@ -1,444 +0,0 @@ -/** - * A Typed object allows a value to have its type explicitly - * specified. - * - * For example, in Solidity, the value ``45`` could represent a - * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent - * a ``bytes2`` or ``bytes``. - * - * Since JavaScript has no meaningful way to explicitly inform any - * APIs which what the type is, this allows transparent interoperation - * with Soldity. - * - * @_subsection: api/abi:Typed Values - */ -import { assertPrivate, defineProperties } from "../utils/index.js"; -const _gaurd = {}; -function n(value, width) { - let signed = false; - if (width < 0) { - signed = true; - width *= -1; - } - // @TODO: Check range is valid for value - return new Typed(_gaurd, `${signed ? "" : "u"}int${width}`, value, { - signed, - width, - }); -} -function b(value, size) { - // @TODO: Check range is valid for value - return new Typed(_gaurd, `bytes${size ? size : ""}`, value, { size }); -} -const _typedSymbol = Symbol.for("_corebc_typed"); -export class Typed { - type; - value; - #options; - _typedSymbol; - constructor(gaurd, type, value, options) { - if (options == null) { - options = null; - } - assertPrivate(_gaurd, gaurd, "Typed"); - defineProperties(this, { _typedSymbol, type, value }); - this.#options = options; - // Check the value is valid - this.format(); - } - format() { - if (this.type === "array") { - throw new Error(""); - } - else if (this.type === "dynamicArray") { - throw new Error(""); - } - else if (this.type === "tuple") { - return `tuple(${this.value.map((v) => v.format()).join(",")})`; - } - return this.type; - } - defaultValue() { - return 0; - } - minValue() { - return 0; - } - maxValue() { - return 0; - } - isBigInt() { - return !!this.type.match(/^u?int[0-9]+$/); - } - isData() { - return this.type.startsWith("bytes"); - } - isString() { - return this.type === "string"; - } - get tupleName() { - if (this.type !== "tuple") { - throw TypeError("not a tuple"); - } - return this.#options; - } - // Returns the length of this type as an array - // - `null` indicates the length is unforced, it could be dynamic - // - `-1` indicates the length is dynamic - // - any other value indicates it is a static array and is its length - get arrayLength() { - if (this.type !== "array") { - throw TypeError("not an array"); - } - if (this.#options === true) { - return -1; - } - if (this.#options === false) { - return this.value.length; - } - return null; - } - static from(type, value) { - return new Typed(_gaurd, type, value); - } - static uint8(v) { - return n(v, 8); - } - static uint16(v) { - return n(v, 16); - } - static uint24(v) { - return n(v, 24); - } - static uint32(v) { - return n(v, 32); - } - static uint40(v) { - return n(v, 40); - } - static uint48(v) { - return n(v, 48); - } - static uint56(v) { - return n(v, 56); - } - static uint64(v) { - return n(v, 64); - } - static uint72(v) { - return n(v, 72); - } - static uint80(v) { - return n(v, 80); - } - static uint88(v) { - return n(v, 88); - } - static uint96(v) { - return n(v, 96); - } - static uint104(v) { - return n(v, 104); - } - static uint112(v) { - return n(v, 112); - } - static uint120(v) { - return n(v, 120); - } - static uint128(v) { - return n(v, 128); - } - static uint136(v) { - return n(v, 136); - } - static uint144(v) { - return n(v, 144); - } - static uint152(v) { - return n(v, 152); - } - static uint160(v) { - return n(v, 160); - } - static uint168(v) { - return n(v, 168); - } - static uint176(v) { - return n(v, 176); - } - static uint184(v) { - return n(v, 184); - } - static uint192(v) { - return n(v, 192); - } - static uint200(v) { - return n(v, 200); - } - static uint208(v) { - return n(v, 208); - } - static uint216(v) { - return n(v, 216); - } - static uint224(v) { - return n(v, 224); - } - static uint232(v) { - return n(v, 232); - } - static uint240(v) { - return n(v, 240); - } - static uint248(v) { - return n(v, 248); - } - static uint256(v) { - return n(v, 256); - } - static uint(v) { - return n(v, 256); - } - static int8(v) { - return n(v, -8); - } - static int16(v) { - return n(v, -16); - } - static int24(v) { - return n(v, -24); - } - static int32(v) { - return n(v, -32); - } - static int40(v) { - return n(v, -40); - } - static int48(v) { - return n(v, -48); - } - static int56(v) { - return n(v, -56); - } - static int64(v) { - return n(v, -64); - } - static int72(v) { - return n(v, -72); - } - static int80(v) { - return n(v, -80); - } - static int88(v) { - return n(v, -88); - } - static int96(v) { - return n(v, -96); - } - static int104(v) { - return n(v, -104); - } - static int112(v) { - return n(v, -112); - } - static int120(v) { - return n(v, -120); - } - static int128(v) { - return n(v, -128); - } - static int136(v) { - return n(v, -136); - } - static int144(v) { - return n(v, -144); - } - static int152(v) { - return n(v, -152); - } - static int160(v) { - return n(v, -160); - } - static int168(v) { - return n(v, -168); - } - static int176(v) { - return n(v, -176); - } - static int184(v) { - return n(v, -184); - } - static int192(v) { - return n(v, -192); - } - static int200(v) { - return n(v, -200); - } - static int208(v) { - return n(v, -208); - } - static int216(v) { - return n(v, -216); - } - static int224(v) { - return n(v, -224); - } - static int232(v) { - return n(v, -232); - } - static int240(v) { - return n(v, -240); - } - static int248(v) { - return n(v, -248); - } - static int256(v) { - return n(v, -256); - } - static int(v) { - return n(v, -256); - } - static bytes1(v) { - return b(v, 1); - } - static bytes2(v) { - return b(v, 2); - } - static bytes3(v) { - return b(v, 3); - } - static bytes4(v) { - return b(v, 4); - } - static bytes5(v) { - return b(v, 5); - } - static bytes6(v) { - return b(v, 6); - } - static bytes7(v) { - return b(v, 7); - } - static bytes8(v) { - return b(v, 8); - } - static bytes9(v) { - return b(v, 9); - } - static bytes10(v) { - return b(v, 10); - } - static bytes11(v) { - return b(v, 11); - } - static bytes12(v) { - return b(v, 12); - } - static bytes13(v) { - return b(v, 13); - } - static bytes14(v) { - return b(v, 14); - } - static bytes15(v) { - return b(v, 15); - } - static bytes16(v) { - return b(v, 16); - } - static bytes17(v) { - return b(v, 17); - } - static bytes18(v) { - return b(v, 18); - } - static bytes19(v) { - return b(v, 19); - } - static bytes20(v) { - return b(v, 20); - } - static bytes21(v) { - return b(v, 21); - } - static bytes22(v) { - return b(v, 22); - } - static bytes23(v) { - return b(v, 23); - } - static bytes24(v) { - return b(v, 24); - } - static bytes25(v) { - return b(v, 25); - } - static bytes26(v) { - return b(v, 26); - } - static bytes27(v) { - return b(v, 27); - } - static bytes28(v) { - return b(v, 28); - } - static bytes29(v) { - return b(v, 29); - } - static bytes30(v) { - return b(v, 30); - } - static bytes31(v) { - return b(v, 31); - } - static bytes32(v) { - return b(v, 32); - } - static address(v) { - return new Typed(_gaurd, "address", v); - } - static bool(v) { - return new Typed(_gaurd, "bool", !!v); - } - static bytes(v) { - return new Typed(_gaurd, "bytes", v); - } - static string(v) { - return new Typed(_gaurd, "string", v); - } - static array(v, dynamic) { - throw new Error("not implemented yet"); - return new Typed(_gaurd, "array", v, dynamic); - } - static tuple(v, name) { - throw new Error("not implemented yet"); - return new Typed(_gaurd, "tuple", v, name); - } - static overrides(v) { - return new Typed(_gaurd, "overrides", Object.assign({}, v)); - } - /** - * Returns true only if %%value%% is a [[Typed]] instance. - */ - static isTyped(value) { - return value && value._typedSymbol === _typedSymbol; - } - /** - * If the value is a [[Typed]] instance, validates the underlying value - * and returns it, otherwise returns value directly. - * - * This is useful for functions that with to accept either a [[Typed]] - * object or values. - */ - static dereference(value, type) { - if (Typed.isTyped(value)) { - if (value.type !== type) { - throw new Error(`invalid type: expecetd ${type}, got ${value.type}`); - } - return value.value; - } - return value; - } -} -//# sourceMappingURL=typed.js.map \ No newline at end of file diff --git a/lib.esm/abi/typed.js.map b/lib.esm/abi/typed.js.map deleted file mode 100644 index d12f2b336..000000000 --- a/lib.esm/abi/typed.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"typed.js","sourceRoot":"","sources":["../../src.ts/abi/typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAOpE,MAAM,MAAM,GAAG,EAAE,CAAC;AAElB,SAAS,CAAC,CAAC,KAAmB,EAAE,KAAa;IAC3C,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,KAAK,GAAG,CAAC,EAAE;QACb,MAAM,GAAG,IAAI,CAAC;QACd,KAAK,IAAI,CAAC,CAAC,CAAC;KACb;IAED,wCAAwC;IACxC,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,EAAE,EAAE,KAAK,EAAE;QACjE,MAAM;QACN,KAAK;KACN,CAAC,CAAC;AACL,CAAC;AAED,SAAS,CAAC,CAAC,KAAgB,EAAE,IAAa;IACxC,wCAAwC;IACxC,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE,QAAQ,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AACxE,CAAC;AA0BD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAEjD,MAAM,OAAO,KAAK;IACP,IAA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A0B,IAAI,SAAS,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;aACtE;YACD,OAAO,KAAK,CAAC,KAAK,CAAC;SACpB;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/address/checks.d.ts b/lib.esm/address/checks.d.ts deleted file mode 100644 index 865b0aca9..000000000 --- a/lib.esm/address/checks.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { Addressable, AddressLike } from "./index.js"; -/** - * Returns true if %%value%% is an object which implements the - * [[Addressable]] interface. - * - * @example: - * // Wallets and AbstractSigner sub-classes - * isAddressable(Wallet.createRandom()) - * //_result: - * - * // Contracts - * contract = new Contract("dai.tokens.corebc.eth", [ ], provider) - * isAddressable(contract) - * //_result: - */ -export declare function isAddressable(value: any): value is Addressable; -/** - * Returns true if %%value%% is a valid address. - * - * @example: - * // Valid address - * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") - * //_result: - * - * // Valid ICAP address - * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") - * //_result: - * - * // Invalid checksum - * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") - * //_result: - * - * // Invalid ICAP checksum - * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") - * //_result: - * - * // Not an address (an ENS name requires a provided and an - * // asynchronous API to access) - * isAddress("ricmoo.eth") - * //_result: - */ -export declare function isAddress(value: any): value is string; -/** - * Resolves to an address for the %%target%%, which may be any - * supported address type, an [[Addressable]] or a Promise which - * resolves to an address. - * - * If an ENS name is provided, but that name has not been correctly - * configured a [[UnconfiguredNameError]] is thrown. - * - * @example: - * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" - * - * // Addresses are return synchronously - * resolveAddress(addr, provider) - * //_result: - * - * // Address promises are resolved asynchronously - * resolveAddress(Promise.resolve(addr)) - * //_result: - * - * - * // Addressable objects are resolved asynchronously - * contract = new Contract(addr, [ ]) - * resolveAddress(contract, provider) - * //_result: - * - * // Unconfigured ENS names reject - * resolveAddress("nothing-here.ricmoo.eth", provider) - * //_error: - * - * // ENS names require a NameResolver object passed in - * // (notice the provider was omitted) - * resolveAddress("nothing-here.ricmoo.eth") - * //_error: - */ -export declare function resolveAddress(target: AddressLike): string | Promise; -//# sourceMappingURL=checks.d.ts.map \ No newline at end of file diff --git a/lib.esm/address/checks.d.ts.map b/lib.esm/address/checks.d.ts.map deleted file mode 100644 index 936fbc09c..000000000 --- a/lib.esm/address/checks.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src.ts/address/checks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAc,MAAM,YAAY,CAAC;AAElE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,WAAW,CAE9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAMrD;AA2BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAe5E"} \ No newline at end of file diff --git a/lib.esm/address/checks.js b/lib.esm/address/checks.js deleted file mode 100644 index 9569278c4..000000000 --- a/lib.esm/address/checks.js +++ /dev/null @@ -1,111 +0,0 @@ -import { assert, assertArgument } from "../utils/index.js"; -import { getAddress } from "./index.js"; -/** - * Returns true if %%value%% is an object which implements the - * [[Addressable]] interface. - * - * @example: - * // Wallets and AbstractSigner sub-classes - * isAddressable(Wallet.createRandom()) - * //_result: - * - * // Contracts - * contract = new Contract("dai.tokens.corebc.eth", [ ], provider) - * isAddressable(contract) - * //_result: - */ -export function isAddressable(value) { - return value && typeof value.getAddress === "function"; -} -/** - * Returns true if %%value%% is a valid address. - * - * @example: - * // Valid address - * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") - * //_result: - * - * // Valid ICAP address - * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") - * //_result: - * - * // Invalid checksum - * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") - * //_result: - * - * // Invalid ICAP checksum - * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") - * //_result: - * - * // Not an address (an ENS name requires a provided and an - * // asynchronous API to access) - * isAddress("ricmoo.eth") - * //_result: - */ -export function isAddress(value) { - try { - getAddress(value); - return true; - } - catch (error) { } - return false; -} -async function checkAddress(target, promise) { - const result = await promise; - if (result == null || - result === "0x0000000000000000000000000000000000000000") { - assert(typeof target !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target }); - assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target); - } - return getAddress(result); -} -/** - * Resolves to an address for the %%target%%, which may be any - * supported address type, an [[Addressable]] or a Promise which - * resolves to an address. - * - * If an ENS name is provided, but that name has not been correctly - * configured a [[UnconfiguredNameError]] is thrown. - * - * @example: - * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" - * - * // Addresses are return synchronously - * resolveAddress(addr, provider) - * //_result: - * - * // Address promises are resolved asynchronously - * resolveAddress(Promise.resolve(addr)) - * //_result: - * - * - * // Addressable objects are resolved asynchronously - * contract = new Contract(addr, [ ]) - * resolveAddress(contract, provider) - * //_result: - * - * // Unconfigured ENS names reject - * resolveAddress("nothing-here.ricmoo.eth", provider) - * //_error: - * - * // ENS names require a NameResolver object passed in - * // (notice the provider was omitted) - * resolveAddress("nothing-here.ricmoo.eth") - * //_error: - */ -export function resolveAddress(target) { - if (typeof target === "string") { - return getAddress(target); - // assert(resolver != null, "ENS resolution requires a provider", - // "UNSUPPORTED_OPERATION", { operation: "resolveName" }); - // return checkAddress(target, resolver.resolveName(target)); - } - else if (isAddressable(target)) { - return checkAddress(target, target.getAddress()); - } - else if (target && typeof target.then === "function") { - return checkAddress(target, target); - } - assertArgument(false, "unsupported addressable value", "target", target); -} -//# sourceMappingURL=checks.js.map \ No newline at end of file diff --git a/lib.esm/address/checks.js.map b/lib.esm/address/checks.js.map deleted file mode 100644 index 4a4a16b57..000000000 --- a/lib.esm/address/checks.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../src.ts/address/checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAA4B,UAAU,EAAE,MAAM,YAAY,CAAC;AAElE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,KAAU;IACtC,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,UAAU,KAAK,UAAU,CAAC;AACzD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,SAAS,CAAC,KAAU;IAClC,IAAI;QACF,UAAU,CAAC,KAAK,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,KAAK,EAAE,GAAE;IAClB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,KAAK,UAAU,YAAY,CACzB,MAAW,EACX,OAA+B;IAE/B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC;IAC7B,IACE,MAAM,IAAI,IAAI;QACd,MAAM,KAAK,4CAA4C,EACvD;QACA,MAAM,CACJ,OAAO,MAAM,KAAK,QAAQ,EAC1B,mBAAmB,EACnB,mBAAmB,EACnB,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CAAC;QACF,cAAc,CACZ,KAAK,EACL,+DAA+D,EAC/D,QAAQ,EACR,MAAM,CACP,CAAC;KACH;IACD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,cAAc,CAAC,MAAmB;IAChD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;QAE1B,iEAAiE;QACjE,8DAA8D;QAE9D,6DAA6D;KAC9D;SAAM,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;QAChC,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;KAClD;SAAM,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE;QACtD,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACrC;IAED,cAAc,CAAC,KAAK,EAAE,+BAA+B,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC3E,CAAC"} \ No newline at end of file diff --git a/lib.esm/address/contract-address.d.ts b/lib.esm/address/contract-address.d.ts deleted file mode 100644 index 5aaa076ad..000000000 --- a/lib.esm/address/contract-address.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { BigNumberish, BytesLike } from "../utils/index.js"; -/** - * Returns the address that would result from a ``CREATE`` for %%tx%%. - * - * This can be used to compute the address a contract will be - * deployed to by an EOA when sending a deployment transaction (i.e. - * when the ``to`` address is ``null``). - * - * This can also be used to compute the address a contract will be - * deployed to by a contract, by using the contract's address as the - * ``to`` and the contract's nonce. - * - * @example - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; - * nonce = 5; - * - * getCreateAddress({ from, nonce }); - * //_result: - */ -export declare function getCreateAddress(tx: { - from: string; - nonce: BigNumberish; -}): string; -/** - * Returns the address that would result from a ``CREATE2`` operation - * with the given %%from%%, %%salt%% and %%initCodeHash%%. - - * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. - * - * @example - * // The address of the contract - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" - * - * // The salt - * salt = id("HelloWorld") - * - * getCreate2Address(from, salt, initCodeHash) - * //_result: - */ -export declare function getCreate2Address(from: string, salt: BytesLike, initCodeHash: BytesLike): string; -//# sourceMappingURL=contract-address.d.ts.map \ No newline at end of file diff --git a/lib.esm/address/contract-address.d.ts.map b/lib.esm/address/contract-address.d.ts.map deleted file mode 100644 index 8511ac269..000000000 --- a/lib.esm/address/contract-address.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contract-address.d.ts","sourceRoot":"","sources":["../../src.ts/address/contract-address.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAQjE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,YAAY,CAAC;CACrB,GAAG,MAAM,CAcT;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,SAAS,GACtB,MAAM,CAoBR"} \ No newline at end of file diff --git a/lib.esm/address/contract-address.js b/lib.esm/address/contract-address.js deleted file mode 100644 index 62fbbff5f..000000000 --- a/lib.esm/address/contract-address.js +++ /dev/null @@ -1,75 +0,0 @@ -import { concat, -// dataSlice, -getBigInt, -// encodeRlp - } from "../utils/index.js"; -import { getAddress } from "./index.js"; -import { sha256 } from "../crypto/sha3.js"; -import { hexDataLength, hexDataSlice } from "../utils/data.js"; -import { Logger } from "../logger/logger.js"; -import { removeHexPrefix } from "../transaction/address.js"; -import { calculateCheckSum } from "./index.js"; -const logger = new Logger("contract-address/0.0.1"); -/** - * Returns the address that would result from a ``CREATE`` for %%tx%%. - * - * This can be used to compute the address a contract will be - * deployed to by an EOA when sending a deployment transaction (i.e. - * when the ``to`` address is ``null``). - * - * This can also be used to compute the address a contract will be - * deployed to by a contract, by using the contract's address as the - * ``to`` and the contract's nonce. - * - * @example - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; - * nonce = 5; - * - * getCreateAddress({ from, nonce }); - * //_result: - */ -export function getCreateAddress(tx) { - const from = getAddress(tx.from); - const nonce = getBigInt(tx.nonce, "tx.nonce"); - let nonceHex = nonce.toString(16); - if (nonceHex === "0") { - nonceHex = "0x"; - } - else if (nonceHex.length % 2) { - nonceHex = "0x0" + nonceHex; - } - else { - nonceHex = "0x" + nonceHex; - } - return getAddress(from); -} -/** - * Returns the address that would result from a ``CREATE2`` operation - * with the given %%from%%, %%salt%% and %%initCodeHash%%. - - * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. - * - * @example - * // The address of the contract - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" - * - * // The salt - * salt = id("HelloWorld") - * - * getCreate2Address(from, salt, initCodeHash) - * //_result: - */ -export function getCreate2Address(from, salt, initCodeHash) { - if (hexDataLength(salt) !== 32) { - logger.throwArgumentError("salt must be 32 bytes", "salt", salt); - } - if (hexDataLength(initCodeHash) !== 32) { - logger.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash); - } - const val = hexDataSlice(sha256(concat(["0xff", getAddress(from), salt, initCodeHash])), 12); - console.log({ "contract-address/74=>should be string": val }); - const prefix = from.substring(2, 4); - const checksum = calculateCheckSum(val, prefix); - return "0x" + prefix + checksum + removeHexPrefix(val); -} -//# sourceMappingURL=contract-address.js.map \ No newline at end of file diff --git a/lib.esm/address/contract-address.js.map b/lib.esm/address/contract-address.js.map deleted file mode 100644 index ff61592a9..000000000 --- a/lib.esm/address/contract-address.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contract-address.js","sourceRoot":"","sources":["../../src.ts/address/contract-address.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM;AACN,cAAc;AACd,SAAS;AACT,eAAe;EAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,OAAO,EAAE,MAAM,EA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CAAC;KACH;IAED,MAAM,GAAG,GAAG,YAAY,CACtB,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,EAC9D,EAAE,CACH,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,EAAE,uCAAuC,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAChD,OAAO,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;AACzD,CAAC"} \ No newline at end of file diff --git a/lib.esm/address/index.d.ts b/lib.esm/address/index.d.ts deleted file mode 100644 index 180d9faa2..000000000 --- a/lib.esm/address/index.d.ts +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Addresses are a fundamental part of interacting with Core. They - * represent the gloabal identity of Externally Owned Accounts (accounts - * backed by a private key) and contracts. - * - * The Core Naming Service (CNS) provides an interconnected ecosystem - * of contracts, standards and libraries which enable looking up an - * address for an ENS name. - * - * These functions help convert between various formats, validate - * addresses and safely resolve ENS names. - * - * @_section: api/address:Addresses [about-addresses] - */ -/** - * An interface for objects which have an address, and can - * resolve it asyncronously. - * - * This allows objects such as [[Signer]] or [[Contract]] to - * be used most places an address can be, for example getting - * the [balance](Provider-getBalance). - */ -export interface Addressable { - /** - * Get the object address. - */ - getAddress(): Promise; -} -/** - * Anything that can be used to return or resolve an address. - */ -export type AddressLike = string | Promise | Addressable; -/** - * An interface for any object which can resolve an ENS name. - */ -export interface NameResolver { -} -import { BigNumberish } from "../bigNumber/bigNumber.js"; -declare function calculateCheckSum(_address: string, _prefix: string): string; -/** - * Returns a normalized and checksumed address for %%address%%. - * This accepts non-checksum addresses, checksum addresses and - * [[getIcapAddress]] formats. - * - * The checksum in Core uses the capitalization (upper-case - * vs lower-case) of the characters within an address to encode - * its checksum, which offers, on average, a checksum of 15-bits. - * - * If %%address%% contains both upper-case and lower-case, it is - * assumed to already be a checksum address and its checksum is - * validated, and if the address fails its expected checksum an - * error is thrown. - * - * If you wish the checksum of %%address%% to be ignore, it should - * be converted to lower-case (i.e. ``.toLowercase()``) before - * being passed in. This should be a very rare situation though, - * that you wish to bypass the safegaurds in place to protect - * against an address that has been incorrectly copied from another - * source. - * - * @example: - * // Adds the checksum (via upper-casing specific letters) - * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") - * //_result: - * - * // Converts ICAP address and adds checksum - * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); - * //_result: - * - * // Throws an error if an address contains mixed case, - * // but the checksum fails - * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") - * //_error: - */ -declare function getAddress(address: string): string; -/** - * The [ICAP Address format](link-icap) format is an early checksum - * format which attempts to be compatible with the banking - * industry [IBAN format](link-wiki-iban) for bank accounts. - * - * It is no longer common or a recommended format. - * - * @example: - * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); - * //_result: - * - * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); - * //_result: - * - * // Throws an error if the ICAP checksum is wrong - * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); - * //_error: - */ -declare function getIcapAddress(address: string): string; -declare function networkIdToPrefix(networkId: number): string; -declare function getContractAddress(transaction: { - from: string; - nonce: BigNumberish; -}): string; -export { getAddress, getIcapAddress, calculateCheckSum, networkIdToPrefix, getContractAddress, }; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.esm/address/index.d.ts.map b/lib.esm/address/index.d.ts.map deleted file mode 100644 index 3dc38445f..000000000 --- a/lib.esm/address/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/address/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,YAAY;CAQ5B;AAED,OAAO,EAAa,YAAY,EAAE,MAAM,2BAA2B,CAAC;AA8BpE,iBAAS,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAkBpE;AA0CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAoB3C;AACD;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAO/C;AAED,iBAAS,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAWpD;AAED,iBAAS,kBAAkB,CAAC,WAAW,EAAE;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,YAAY,CAAC;CACrB,UAmBA;AAED,OAAO,EACL,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,CAAC"} \ No newline at end of file diff --git a/lib.esm/address/index.js b/lib.esm/address/index.js deleted file mode 100644 index 87b6fd155..000000000 --- a/lib.esm/address/index.js +++ /dev/null @@ -1,198 +0,0 @@ -/** - * Addresses are a fundamental part of interacting with Core. They - * represent the gloabal identity of Externally Owned Accounts (accounts - * backed by a private key) and contracts. - * - * The Core Naming Service (CNS) provides an interconnected ecosystem - * of contracts, standards and libraries which enable looking up an - * address for an ENS name. - * - * These functions help convert between various formats, validate - * addresses and safely resolve ENS names. - * - * @_section: api/address:Addresses [about-addresses] - */ -null; -import { BigNumber } from "../bigNumber/bigNumber.js"; -import { encode } from "../crypto/rlp.js"; -import { sha256 } from "../crypto/sha3.js"; -import { Logger } from "../logger/logger.js"; -import { arrayify, getBytes, hexDataSlice, hexlify, stripZeros, } from "../utils/data.js"; -const logger = new Logger("address/0.0.1"); -const precompiledAddresses = [ - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000001", - "0000000000000000000000000000000000000000000000000000000000000002", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000005", - "0000000000000000000000000000000000000000000000000000000000000006", - "0000000000000000000000000000000000000000000000000000000000000007", - "0000000000000000000000000000000000000000000000000000000000000008", - "0000000000000000000000000000000000000000000000000000000000000009", -]; -function removeHexPrefix(val) { - return val.substring(0, 2) === "0x" ? val.substring(2) : val; -} -function calculateCheckSum(_address, _prefix) { - const address = getBytes("0x" + _address.replace("0x", "")); - const prefix = getBytes("0x" + _prefix.replace("0x", "")); - const tmpConcated = new Uint8Array([...address, ...prefix]); - const hexedConcat = hexlify(tmpConcated).replace("0x", "") + "00"; - const mods = Array.from(hexedConcat.toUpperCase(), (c) => { - const charCode = c.charCodeAt(0); - return charCode > 64 && charCode < 91 - ? (charCode - 55).toString() - : (charCode - 48).toString(); - }).join(""); - const bigVal = BigInt(mods); - const val97 = BigInt(97); - const val98 = BigInt(98); - const remainder = bigVal % val97; - const checkSum = val98 - remainder; - const result = checkSum > 9 ? checkSum.toString() : "0" + checkSum.toString(); - return result; -} -// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number -// Create lookup table -const ibanLookup = {}; -for (let i = 0; i < 10; i++) { - ibanLookup[String(i)] = String(i); -} -for (let i = 0; i < 26; i++) { - ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); -} -// How many decimal digits can we process? (for 64-bit float, this is 15) -// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER)); -const safeDigits = 15; -function ibanChecksum(address) { - address = address.toUpperCase(); - address = address.substring(4) + address.substring(0, 2) + "00"; - let expanded = address - .split("") - .map((c) => { - return ibanLookup[c]; - }) - .join(""); - // Javascript can handle integers safely up to 15 (decimal) digits - while (expanded.length >= safeDigits) { - let block = expanded.substring(0, safeDigits); - expanded = (parseInt(block, 10) % 97) + expanded.substring(block.length); - } - let checksum = String(98 - (parseInt(expanded, 10) % 97)); - while (checksum.length < 2) { - checksum = "0" + checksum; - } - return checksum; -} -/** - * Returns a normalized and checksumed address for %%address%%. - * This accepts non-checksum addresses, checksum addresses and - * [[getIcapAddress]] formats. - * - * The checksum in Core uses the capitalization (upper-case - * vs lower-case) of the characters within an address to encode - * its checksum, which offers, on average, a checksum of 15-bits. - * - * If %%address%% contains both upper-case and lower-case, it is - * assumed to already be a checksum address and its checksum is - * validated, and if the address fails its expected checksum an - * error is thrown. - * - * If you wish the checksum of %%address%% to be ignore, it should - * be converted to lower-case (i.e. ``.toLowercase()``) before - * being passed in. This should be a very rare situation though, - * that you wish to bypass the safegaurds in place to protect - * against an address that has been incorrectly copied from another - * source. - * - * @example: - * // Adds the checksum (via upper-casing specific letters) - * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") - * //_result: - * - * // Converts ICAP address and adds checksum - * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); - * //_result: - * - * // Throws an error if an address contains mixed case, - * // but the checksum fails - * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") - * //_error: - */ -function getAddress(address) { - if (typeof address !== "string") { - logger.throwArgumentError("invalid address", "address", address); - } - if (!address.match(/^(0x)?[0-9a-fA-F]{44}$/)) { - logger.throwArgumentError("invalid address", "address", address); - } - const raw = removeHexPrefix(address); - if (precompiledAddresses.includes(raw)) { - return "0x" + raw; - } - const prefix = raw.substring(0, 2); - const val = raw.substring(4); - const checksum = calculateCheckSum(val, prefix); - if (checksum !== raw.substring(2, 4)) { - logger.throwArgumentError("bad address checksum", "address", address); - } - return "0x" + prefix + checksum + val; -} -/** - * The [ICAP Address format](link-icap) format is an early checksum - * format which attempts to be compatible with the banking - * industry [IBAN format](link-wiki-iban) for bank accounts. - * - * It is no longer common or a recommended format. - * - * @example: - * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); - * //_result: - * - * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); - * //_result: - * - * // Throws an error if the ICAP checksum is wrong - * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); - * //_error: - */ -function getIcapAddress(address) { - //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase(); - let base36 = BigInt(getAddress(address)).toString(36).toUpperCase(); - while (base36.length < 30) { - base36 = "0" + base36; - } - return "XE" + ibanChecksum("XE00" + base36) + base36; -} -function networkIdToPrefix(networkId) { - if (networkId == 1) { - return "cb"; - } - else if (networkId == 3 || networkId == 4) { - return "ab"; - } - else if (networkId > 10 || networkId == 0) { - return "ce"; - } - else { - logger.throwArgumentError("bad networkId", "networkId", networkId); - return ""; - } -} -function getContractAddress(transaction) { - let from = null; - try { - from = getAddress(transaction.from); - } - catch (error) { - logger.throwArgumentError("missing from address", "transaction", transaction); - } - const nonce = stripZeros(arrayify(BigNumber.from(transaction.nonce).toHexString())); - const val = hexDataSlice(sha256(encode([from, nonce])), 12); - const prefix = from.substring(2, 4); - const checksum = calculateCheckSum(val, prefix); - return "0x" + prefix + checksum + removeHexPrefix(val); -} -export { getAddress, getIcapAddress, calculateCheckSum, networkIdToPrefix, getContractAddress, }; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.esm/address/index.js.map b/lib.esm/address/index.js.map deleted file mode 100644 index efd08d3dc..000000000 --- a/lib.esm/address/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/address/index.ts"],"names":[],"mappings":"A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B,EACjB,kBAAkB,GACnB,CAAC"} \ No newline at end of file diff --git a/lib.esm/bigNumber/bigNumber.d.ts b/lib.esm/bigNumber/bigNumber.d.ts deleted file mode 100644 index 089132488..000000000 --- a/lib.esm/bigNumber/bigNumber.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Bytes, Hexable } from "../utils/data.js"; -export type BigNumberish = BigNumber | Bytes | bigint | string | number; -export declare function isBigNumberish(value: any): value is BigNumberish; -export declare class BigNumber implements Hexable { - readonly _hex: string; - readonly _isBigNumber: boolean; - constructor(constructorGuard: any, hex: string); - fromTwos(value: number): BigNumber; - toTwos(value: number): BigNumber; - abs(): BigNumber; - add(other: BigNumberish): BigNumber; - sub(other: BigNumberish): BigNumber; - div(other: BigNumberish): BigNumber; - mul(other: BigNumberish): BigNumber; - mod(other: BigNumberish): BigNumber; - pow(other: BigNumberish): BigNumber; - and(other: BigNumberish): BigNumber; - or(other: BigNumberish): BigNumber; - xor(other: BigNumberish): BigNumber; - mask(value: number): BigNumber; - shl(value: number): BigNumber; - shr(value: number): BigNumber; - eq(other: BigNumberish): boolean; - lt(other: BigNumberish): boolean; - lte(other: BigNumberish): boolean; - gt(other: BigNumberish): boolean; - gte(other: BigNumberish): boolean; - isNegative(): boolean; - isZero(): boolean; - toNumber(): number; - toBigInt(): bigint; - toString(): string; - toHexString(): string; - toJSON(key?: string): any; - static from(value: any): BigNumber; - static isBigNumber(value: any): value is BigNumber; -} -export declare function _base36To16(value: string): string; -export declare function _base16To36(value: string): string; -//# sourceMappingURL=bigNumber.d.ts.map \ No newline at end of file diff --git a/lib.esm/bigNumber/bigNumber.d.ts.map b/lib.esm/bigNumber/bigNumber.d.ts.map deleted file mode 100644 index d71c9db78..000000000 --- a/lib.esm/bigNumber/bigNumber.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bigNumber.d.ts","sourceRoot":"","sources":["../../src.ts/bigNumber/bigNumber.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,KAA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G,OAAO;IAIjC,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAIhC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAIjC,UAAU,IAAI,OAAO;IAIrB,MAAM,IAAI,OAAO;IAIjB,QAAQ,IAAI,MAAM;IAUlB,QAAQ,IAAI,MAAM;IAclB,QAAQ,IAAI,MAAM;IA2BlB,WAAW,IAAI,MAAM;IAIrB,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG;IAIzB,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS;IAyElC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS;CAGnD;AA6ED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD"} \ No newline at end of file diff --git a/lib.esm/bigNumber/bigNumber.js b/lib.esm/bigNumber/bigNumber.js deleted file mode 100644 index c23a5ab53..000000000 --- a/lib.esm/bigNumber/bigNumber.js +++ /dev/null @@ -1,313 +0,0 @@ -"use strict"; -/** - * BigNumber - * - * A wrapper around the BN.js object. We use the BN.js library - * because it is used by elliptic, so it is required regardless. - * - */ -import _BN from "bn.js"; -import { Logger } from "../logger/logger.js"; -import { isBytes, hexlify, isHexString, } from "../utils/data.js"; -var BN = _BN.BN; -const logger = new Logger("bigNumber/0.0.1"); -const _constructorGuard = {}; -const MAX_SAFE = 0x1fffffffffffff; -export function isBigNumberish(value) { - return (value != null && - (BigNumber.isBigNumber(value) || - (typeof value === "number" && value % 1 === 0) || - (typeof value === "string" && !!value.match(/^-?[0-9]+$/)) || - isHexString(value) || - typeof value === "bigint" || - isBytes(value))); -} -// Only warn about passing 10 into radix once -let _warnedToStringRadix = false; -export class BigNumber { - _hex; - _isBigNumber; - constructor(constructorGuard, hex) { - logger.checkNew(new.target, BigNumber); - if (constructorGuard !== _constructorGuard) { - logger.throwError("cannot call constructor directly; use BigNumber.from", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "new (BigNumber)", - }); - } - this._hex = hex; - this._isBigNumber = true; - Object.freeze(this); - } - fromTwos(value) { - return toBigNumber(toBN(this).fromTwos(value)); - } - toTwos(value) { - return toBigNumber(toBN(this).toTwos(value)); - } - abs() { - if (this._hex[0] === "-") { - return BigNumber.from(this._hex.substring(1)); - } - return this; - } - add(other) { - return toBigNumber(toBN(this).add(toBN(other))); - } - sub(other) { - return toBigNumber(toBN(this).sub(toBN(other))); - } - div(other) { - const o = BigNumber.from(other); - if (o.isZero()) { - throwFault("division by zero", "div"); - } - return toBigNumber(toBN(this).div(toBN(other))); - } - mul(other) { - return toBigNumber(toBN(this).mul(toBN(other))); - } - mod(other) { - const value = toBN(other); - if (value.isNeg()) { - throwFault("cannot modulo negative values", "mod"); - } - return toBigNumber(toBN(this).umod(value)); - } - pow(other) { - const value = toBN(other); - if (value.isNeg()) { - throwFault("cannot raise to negative values", "pow"); - } - return toBigNumber(toBN(this).pow(value)); - } - and(other) { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'and' negative values", "and"); - } - return toBigNumber(toBN(this).and(value)); - } - or(other) { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'or' negative values", "or"); - } - return toBigNumber(toBN(this).or(value)); - } - xor(other) { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'xor' negative values", "xor"); - } - return toBigNumber(toBN(this).xor(value)); - } - mask(value) { - if (this.isNegative() || value < 0) { - throwFault("cannot mask negative values", "mask"); - } - return toBigNumber(toBN(this).maskn(value)); - } - shl(value) { - if (this.isNegative() || value < 0) { - throwFault("cannot shift negative values", "shl"); - } - return toBigNumber(toBN(this).shln(value)); - } - shr(value) { - if (this.isNegative() || value < 0) { - throwFault("cannot shift negative values", "shr"); - } - return toBigNumber(toBN(this).shrn(value)); - } - eq(other) { - return toBN(this).eq(toBN(other)); - } - lt(other) { - return toBN(this).lt(toBN(other)); - } - lte(other) { - return toBN(this).lte(toBN(other)); - } - gt(other) { - return toBN(this).gt(toBN(other)); - } - gte(other) { - return toBN(this).gte(toBN(other)); - } - isNegative() { - return this._hex[0] === "-"; - } - isZero() { - return toBN(this).isZero(); - } - toNumber() { - try { - return toBN(this).toNumber(); - } - catch (error) { - throwFault("overflow", "toNumber", this.toString()); - } - // @ts-ignore - return null; - } - toBigInt() { - try { - return BigInt(this.toString()); - } - catch (e) { } - return logger.throwError("this platform does not support BigInt", Logger.errors.UNSUPPORTED_OPERATION, { - value: this.toString(), - }); - } - toString() { - // Lots of people expect this, which we do not support, so check (See: #889) - if (arguments.length > 0) { - if (arguments[0] === 10) { - if (!_warnedToStringRadix) { - _warnedToStringRadix = true; - logger.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); - } - } - else if (arguments[0] === 16) { - logger.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger.errors.UNEXPECTED_ARGUMENT, {}); - } - else { - logger.throwError("BigNumber.toString does not accept parameters", Logger.errors.UNEXPECTED_ARGUMENT, {}); - } - } - return toBN(this).toString(10); - } - toHexString() { - return this._hex; - } - toJSON(key) { - return { type: "BigNumber", hex: this.toHexString() }; - } - static from(value) { - if (value instanceof BigNumber) { - return value; - } - if (typeof value === "string") { - if (value.match(/^-?0x[0-9a-f]+$/i)) { - return new BigNumber(_constructorGuard, toHex(value)); - } - if (value.match(/^-?[0-9]+$/)) { - return new BigNumber(_constructorGuard, toHex(new BN(value))); - } - return logger.throwArgumentError("invalid BigNumber string", "value", value); - } - if (typeof value === "number") { - if (value % 1) { - throwFault("underflow", "BigNumber.from", value); - } - if (value >= MAX_SAFE || value <= -MAX_SAFE) { - throwFault("overflow", "BigNumber.from", value); - } - return BigNumber.from(String(value)); - } - const anyValue = value; - if (typeof anyValue === "bigint") { - return BigNumber.from(anyValue.toString()); - } - if (isBytes(anyValue)) { - return BigNumber.from(hexlify(anyValue)); - } - if (anyValue) { - // Hexable interface (takes priority) - if (anyValue.toHexString) { - const hex = anyValue.toHexString(); - if (typeof hex === "string") { - return BigNumber.from(hex); - } - } - else { - // For now, handle legacy JSON-ified values (goes away in v6) - let hex = anyValue._hex; - // New-form JSON - if (hex == null && anyValue.type === "BigNumber") { - hex = anyValue.hex; - } - if (typeof hex === "string") { - if (isHexString(hex) || - (hex[0] === "-" && isHexString(hex.substring(1)))) { - return BigNumber.from(hex); - } - } - } - } - return logger.throwArgumentError("invalid BigNumber value", "value", value); - } - static isBigNumber(value) { - return !!(value && value._isBigNumber); - } -} -// Normalize the hex string -// @ts-ignore -function toHex(value) { - // For BN, call on the hex string - if (typeof value !== "string") { - return toHex(value.toString(16)); - } - // If negative, prepend the negative sign to the normalized positive value - if (value[0] === "-") { - // Strip off the negative sign - value = value.substring(1); - // Cannot have multiple negative signs (e.g. "--0x04") - if (value[0] === "-") { - logger.throwArgumentError("invalid hex", "value", value); - } - // Call toHex on the positive component - value = toHex(value); - // Do not allow "-0x00" - if (value === "0x00") { - return value; - } - // Negate the value - return "-" + value; - } - // Add a "0x" prefix if missing - if (value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - // Normalize zero - if (value === "0x") { - return "0x00"; - } - // Make the string even length - if (value.length % 2) { - value = "0x0" + value.substring(2); - } - // Trim to smallest even-length string - while (value.length > 4 && value.substring(0, 4) === "0x00") { - value = "0x" + value.substring(4); - } - return value; -} -// @ts-ignore -function toBigNumber(value) { - return BigNumber.from(toHex(value)); -} -// @ts-ignore -function toBN(value) { - const hex = BigNumber.from(value).toHexString(); - if (hex[0] === "-") { - return new BN("-" + hex.substring(3), 16); - } - return new BN(hex.substring(2), 16); -} -function throwFault(fault, operation, value) { - const params = { fault: fault, operation: operation }; - if (value != null) { - params.value = value; - } - return logger.throwError(fault, Logger.errors.NUMERIC_FAULT, params); -} -// value should have no prefix -export function _base36To16(value) { - return new BN(value, 36).toString(16); -} -// value should have no prefix -export function _base16To36(value) { - return new BN(value, 16).toString(36); -} -//# sourceMappingURL=bigNumber.js.map \ No newline at end of file diff --git a/lib.esm/bigNumber/bigNumber.js.map b/lib.esm/bigNumber/bigNumber.js.map deleted file mode 100644 index d8e318d8c..000000000 --- a/lib.esm/bigNumber/bigNumber.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bigNumber.js","sourceRoot":"","sources":["../../src.ts/bigNumber/bigNumber.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;;;;GAMG;AAEH,OAAO,GAAG,MAAM,OAAO,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAGL,OAAO,EACP,OAAO,EACP,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAC1B,IAAO,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC;AAEnB,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAE7C,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AAIlC,MAAM,UAAU,cAAc,CAAC,KAAU;IACvC,OAAO,CACL,KAAK,IAAI,IAAI;QACb,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC;YAC3B,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;YAC9C,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAC1D,WAAW,CAAC,KAAK,CAAC;YAClB,OAAO,KAAK,KAAK,QAAQ;YACzB,OAAO,CAAC,KAAK,CAAC,CAAC,CAClB,CAAC;AACJ,CAAC;AAED,6CAA6C;AAC7C,IAAI,oBAAoB,GAAG,KAAK,CAAC;AAEjC,MAAM,OAAO,SAAS;IACX,IAAI,CAAS;IACb,YAAY,CAAU;IAE/B,Y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AO,IAAI,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,UAAU,CAAC,KAAa,EAAE,SAAiB,EAAE,KAAW;IAC/D,MAAM,MAAM,GAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;IAC3D,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;KACtB;IAED,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AACvE,CAAC;AAED,8BAA8B;AAC9B,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,OAAO,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACxC,CAAC;AAED,8BAA8B;AAC9B,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,OAAO,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACxC,CAAC"} \ No newline at end of file diff --git a/lib.esm/constants/addresses.d.ts b/lib.esm/constants/addresses.d.ts deleted file mode 100644 index a32d6be03..000000000 --- a/lib.esm/constants/addresses.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * A constant for the zero address. - * - * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) - */ -export declare const ZeroAddress: string; -//# sourceMappingURL=addresses.d.ts.map \ No newline at end of file diff --git a/lib.esm/constants/addresses.d.ts.map b/lib.esm/constants/addresses.d.ts.map deleted file mode 100644 index a67118b65..000000000 --- a/lib.esm/constants/addresses.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAqD,CAAC"} \ No newline at end of file diff --git a/lib.esm/constants/addresses.js b/lib.esm/constants/addresses.js deleted file mode 100644 index 45345cb6e..000000000 --- a/lib.esm/constants/addresses.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * A constant for the zero address. - * - * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) - */ -export const ZeroAddress = "0x0000000000000000000000000000000000000000"; -//# sourceMappingURL=addresses.js.map \ No newline at end of file diff --git a/lib.esm/constants/addresses.js.map b/lib.esm/constants/addresses.js.map deleted file mode 100644 index 97fc7dc5f..000000000 --- a/lib.esm/constants/addresses.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW,4CAA4C,CAAC"} \ No newline at end of file diff --git a/lib.esm/constants/hashes.d.ts b/lib.esm/constants/hashes.d.ts deleted file mode 100644 index 784df7156..000000000 --- a/lib.esm/constants/hashes.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * A constant for the zero hash. - * - * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) - */ -export declare const ZeroHash: string; -//# sourceMappingURL=hashes.d.ts.map \ No newline at end of file diff --git a/lib.esm/constants/hashes.d.ts.map b/lib.esm/constants/hashes.d.ts.map deleted file mode 100644 index ef1df7d58..000000000 --- a/lib.esm/constants/hashes.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hashes.d.ts","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,MAC+C,CAAC"} \ No newline at end of file diff --git a/lib.esm/constants/hashes.js b/lib.esm/constants/hashes.js deleted file mode 100644 index 95bca98a9..000000000 --- a/lib.esm/constants/hashes.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * A constant for the zero hash. - * - * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) - */ -export const ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000"; -//# sourceMappingURL=hashes.js.map \ No newline at end of file diff --git a/lib.esm/constants/hashes.js.map b/lib.esm/constants/hashes.js.map deleted file mode 100644 index bfb490d60..000000000 --- a/lib.esm/constants/hashes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GACnB,oEAAoE,CAAC"} \ No newline at end of file diff --git a/lib.esm/constants/index.d.ts b/lib.esm/constants/index.d.ts deleted file mode 100644 index ba9ae1821..000000000 --- a/lib.esm/constants/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Some common constants useful for Core. - * - * @_section: api/constants: Constants [about-constants] - */ -export { ZeroAddress } from "./addresses.js"; -export { ZeroHash } from "./hashes.js"; -export { N, NegativeOne, Zero, One, Two, OrePerXCB, MaxUint256, MinInt256, MaxInt256, } from "./numbers.js"; -export { CoreSymbol, MessagePrefix } from "./strings.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.esm/constants/index.d.ts.map b/lib.esm/constants/index.d.ts.map deleted file mode 100644 index 0c26e029d..000000000 --- a/lib.esm/constants/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/constants/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,CAAC,EACD,WAAW,EACX,IAAI,EACJ,GAAG,EACH,GAAG,EACH,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/lib.esm/constants/index.js b/lib.esm/constants/index.js deleted file mode 100644 index aed133686..000000000 --- a/lib.esm/constants/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Some common constants useful for Core. - * - * @_section: api/constants: Constants [about-constants] - */ -export { ZeroAddress } from "./addresses.js"; -export { ZeroHash } from "./hashes.js"; -export { N, NegativeOne, Zero, One, Two, OrePerXCB, MaxUint256, MinInt256, MaxInt256, } from "./numbers.js"; -export { CoreSymbol, MessagePrefix } from "./strings.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.esm/constants/index.js.map b/lib.esm/constants/index.js.map deleted file mode 100644 index 054324d76..000000000 --- a/lib.esm/constants/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/constants/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,CAAC,EACD,WAAW,EACX,IAAI,EACJ,GAAG,EACH,GAAG,EACH,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/lib.esm/constants/numbers.d.ts b/lib.esm/constants/numbers.d.ts deleted file mode 100644 index ac92f9623..000000000 --- a/lib.esm/constants/numbers.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * A constant for the order N for the secp256k1 curve. - * - * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) - */ -export declare const N: bigint; -/** - * A constant for the number of ore in a single xcb. - * - * (**i.e.** ``1000000000000000000n``) - */ -export declare const OrePerXCB: bigint; -/** - * A constant for the maximum value for a ``uint256``. - * - * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) - */ -export declare const MaxUint256: bigint; -/** - * A constant for the minimum value for an ``int256``. - * - * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) - */ -export declare const MinInt256: bigint; -/** - * A constant for the maximum value for an ``int256``. - * - * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) - */ -export declare const MaxInt256: bigint; -export declare const NegativeOne: bigint; -export declare const Zero: bigint; -export declare const One: bigint; -export declare const Two: bigint; -//# sourceMappingURL=numbers.d.ts.map \ No newline at end of file diff --git a/lib.esm/constants/numbers.d.ts.map b/lib.esm/constants/numbers.d.ts.map deleted file mode 100644 index 7e7f487f7..000000000 --- a/lib.esm/constants/numbers.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src.ts/constants/numbers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,CAAC,EAAE,MAEf,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAAsC,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAExB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAEZ,CAAC;AAEb;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAEvB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAiC,CAAC;AAC5D,eAAO,MAAM,IAAI,EAAE,MAAgC,CAAC;AACpD,eAAO,MAAM,GAAG,EAAE,MAAgC,CAAC;AACnD,eAAO,MAAM,GAAG,EAAE,MAAgC,CAAC"} \ No newline at end of file diff --git a/lib.esm/constants/numbers.js b/lib.esm/constants/numbers.js deleted file mode 100644 index 6f3d47e93..000000000 --- a/lib.esm/constants/numbers.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * A constant for the order N for the secp256k1 curve. - * - * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) - */ -export const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); -/** - * A constant for the number of ore in a single xcb. - * - * (**i.e.** ``1000000000000000000n``) - */ -export const OrePerXCB = BigInt("1000000000000000000"); -/** - * A constant for the maximum value for a ``uint256``. - * - * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) - */ -export const MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -/** - * A constant for the minimum value for an ``int256``. - * - * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) - */ -export const MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * - BigInt(-1); -/** - * A constant for the maximum value for an ``int256``. - * - * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) - */ -export const MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -export const NegativeOne = /*#__PURE__*/ BigInt(-1); -export const Zero = /*#__PURE__*/ BigInt(0); -export const One = /*#__PURE__*/ BigInt(1); -export const Two = /*#__PURE__*/ BigInt(2); -//# sourceMappingURL=numbers.js.map \ No newline at end of file diff --git a/lib.esm/constants/numbers.js.map b/lib.esm/constants/numbers.js.map deleted file mode 100644 index 3f13321b5..000000000 --- a/lib.esm/constants/numbers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../src.ts/constants/numbers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,CAAC,GAAW,MAAM,CAC7B,oEAAoE,CACrE,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAW,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAW,MAAM,CACtC,oEAAoE,CACrE,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GACpB,MAAM,CAAC,oEAAoE,CAAC;IAC5E,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAEb;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAW,MAAM,CACrC,oEAAoE,CACrE,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAW,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5D,MAAM,CAAC,MAAM,IAAI,GAAW,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACpD,MAAM,CAAC,MAAM,GAAG,GAAW,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACnD,MAAM,CAAC,MAAM,GAAG,GAAW,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.esm/constants/strings.d.ts b/lib.esm/constants/strings.d.ts deleted file mode 100644 index 164253121..000000000 --- a/lib.esm/constants/strings.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * A constant for the core symbol (normalized using NFKC). - * - * (**i.e.** ``"\\u039e"``) - */ -export declare const CoreSymbol: string; -/** - * A constant for the [[link-eip-191]] personal message prefix. - * - * (**i.e.** ``"\\x19Core Signed Message:\\n"``) - */ -export declare const MessagePrefix: string; -//# sourceMappingURL=strings.d.ts.map \ No newline at end of file diff --git a/lib.esm/constants/strings.d.ts.map b/lib.esm/constants/strings.d.ts.map deleted file mode 100644 index 788cc8ce6..000000000 --- a/lib.esm/constants/strings.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src.ts/constants/strings.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAAiB,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,MAAqC,CAAC"} \ No newline at end of file diff --git a/lib.esm/constants/strings.js b/lib.esm/constants/strings.js deleted file mode 100644 index d2ff152ab..000000000 --- a/lib.esm/constants/strings.js +++ /dev/null @@ -1,14 +0,0 @@ -// NFKC (composed) // (decomposed) -/** - * A constant for the core symbol (normalized using NFKC). - * - * (**i.e.** ``"\\u039e"``) - */ -export const CoreSymbol = "\u039e"; // "\uD835\uDF63"; -/** - * A constant for the [[link-eip-191]] personal message prefix. - * - * (**i.e.** ``"\\x19Core Signed Message:\\n"``) - */ -export const MessagePrefix = "\x19Core Signed Message:\n"; -//# sourceMappingURL=strings.js.map \ No newline at end of file diff --git a/lib.esm/constants/strings.js.map b/lib.esm/constants/strings.js.map deleted file mode 100644 index 5b867e346..000000000 --- a/lib.esm/constants/strings.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src.ts/constants/strings.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAE9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAW,QAAQ,CAAC,CAAC,kBAAkB;AAE9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAW,4BAA4B,CAAC"} \ No newline at end of file diff --git a/lib.esm/contract/contract.d.ts b/lib.esm/contract/contract.d.ts deleted file mode 100644 index b7a2cd009..000000000 --- a/lib.esm/contract/contract.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Indexed, Interface } from "../abi/index.js"; -import { Log, TransactionResponse } from "../providers/provider.js"; -import { ContractTransactionResponse, EventLog } from "./wrappers.js"; -import type { EventFragment, FunctionFragment, InterfaceAbi, ParamType } from "../abi/index.js"; -import type { Addressable } from "../address/index.js"; -import type { EventEmitterable, Listener } from "../utils/index.js"; -import type { BlockTag, ContractRunner } from "../providers/index.js"; -import type { ContractEventName, ContractInterface, ContractMethod, ContractEvent, ContractTransaction, WrappedFallback } from "./types.js"; -/** - * @_ignore: - */ -export declare function copyOverrides(arg: any, allowed?: Array): Promise>; -/** - * @_ignore: - */ -export declare function resolveArgs(_runner: null | ContractRunner, inputs: ReadonlyArray, args: Array): Promise>; -declare const internal: unique symbol; -export declare class BaseContract implements Addressable, EventEmitterable { - readonly target: string | Addressable; - readonly interface: Interface; - readonly runner: null | ContractRunner; - readonly filters: Record; - readonly [internal]: any; - readonly fallback: null | WrappedFallback; - constructor(target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner, _deployTx?: null | TransactionResponse); - connect(runner: null | ContractRunner): BaseContract; - getAddress(): Promise; - getDeployedCode(): Promise; - waitForDeployment(): Promise; - deploymentTransaction(): null | ContractTransactionResponse; - getFunction(key: string | FunctionFragment): T; - getEvent(key: string | EventFragment): ContractEvent; - queryTransaction(hash: string): Promise>; - queryFilter(event: ContractEventName, fromBlock?: BlockTag, toBlock?: BlockTag): Promise>; - on(event: ContractEventName, listener: Listener): Promise; - once(event: ContractEventName, listener: Listener): Promise; - emit(event: ContractEventName, ...args: Array): Promise; - listenerCount(event?: ContractEventName): Promise; - listeners(event?: ContractEventName): Promise>; - off(event: ContractEventName, listener?: Listener): Promise; - removeAllListeners(event?: ContractEventName): Promise; - addListener(event: ContractEventName, listener: Listener): Promise; - removeListener(event: ContractEventName, listener: Listener): Promise; - static buildClass(abi: InterfaceAbi): new (target: string, runner?: null | ContractRunner) => BaseContract & Omit; - static from(target: string, abi: InterfaceAbi, runner?: null | ContractRunner): BaseContract & Omit; - static isIndexed(value: any): value is Indexed; -} -declare const Contract_base: new (target: string, abi: InterfaceAbi, runner?: ContractRunner | null | undefined) => BaseContract & Omit; -export declare class Contract extends Contract_base { -} -export {}; -//# sourceMappingURL=contract.d.ts.map \ No newline at end of file diff --git a/lib.esm/contract/contract.d.ts.map b/lib.esm/contract/contract.d.ts.map deleted file mode 100644 index d2114f9d0..000000000 --- a/lib.esm/contract/contract.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contract.d.ts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KAAK,IAAI,OAAO;CAG/C;;AAUD,qBAAa,QAAS,SAAQ,aAAe;CAAG"} \ No newline at end of file diff --git a/lib.esm/contract/contract.js b/lib.esm/contract/contract.js deleted file mode 100644 index 9b6b6db26..000000000 --- a/lib.esm/contract/contract.js +++ /dev/null @@ -1,784 +0,0 @@ -import { Indexed, Interface, Typed } from "../abi/index.js"; -import { resolveAddress } from "../address/checks.js"; -import { copyRequest, Log, } from "../providers/provider.js"; -import { defineProperties, isCallException, isHexString, resolveProperties, makeError, assert, assertArgument, } from "../utils/index.js"; -import { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionResponse, EventLog, } from "./wrappers.js"; -const BN_0 = BigInt(0); -function canCall(value) { - return value && typeof value.call === "function"; -} -function canEstimate(value) { - return value && typeof value.estimateEnergy === "function"; -} -function canResolve(value) { - return value && typeof value.resolveName === "function"; -} -function canSend(value) { - return value && typeof value.sendTransaction === "function"; -} -class PreparedTopicFilter { - #filter; - fragment; - constructor(contract, fragment, args) { - defineProperties(this, { fragment }); - if (fragment.inputs.length < args.length) { - throw new Error("too many arguments"); - } - // Recursively descend into args and resolve any addresses - this.#filter = (async function () { - const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => { - const arg = args[index]; - if (arg == null) { - return null; - } - return param.walkAsync(args[index], (type, value) => { - if (type === "address") { - return resolveAddress(value); - } - return value; - }); - })); - return contract.interface.encodeFilterTopics(fragment, resolvedArgs); - })(); - } - getTopicFilter() { - return this.#filter; - } -} -// A = Arguments passed in as a tuple -// R = The result type of the call (i.e. if only one return type, -// the qualified type, otherwise Result) -// D = The type the default call will return (i.e. R for view/pure, -// TransactionResponse otherwise) -//export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> { -function getRunner(value, feature) { - if (value == null) { - return null; - } - if (typeof value[feature] === "function") { - return value; - } - if (value.provider && typeof value.provider[feature] === "function") { - return value.provider; - } - return null; -} -function getProvider(value) { - if (value == null) { - return null; - } - return value.provider || null; -} -/** - * @_ignore: - */ -export async function copyOverrides(arg, allowed) { - // Create a shallow copy (we'll deep-ify anything needed during normalizing) - const overrides = copyRequest(Typed.dereference(arg, "overrides")); - assertArgument(overrides.to == null || (allowed || []).indexOf("to") >= 0, "cannot override to", "overrides.to", overrides.to); - assertArgument(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); - // Resolve any from - if (overrides.from) { - overrides.from = await resolveAddress(overrides.from); - } - return overrides; -} -/** - * @_ignore: - */ -export async function resolveArgs(_runner, inputs, args) { - // Recursively descend into args and resolve any addresses - return await Promise.all(inputs.map((param, index) => { - return param.walkAsync(args[index], (type, value) => { - value = Typed.dereference(value, type); - if (type === "address") { - return resolveAddress(value); - } - return value; - }); - })); -} -function buildWrappedFallback(contract) { - const populateTransaction = async function (overrides) { - // If an overrides was passed in, copy it and normalize the values - const tx = (await copyOverrides(overrides, ["data"])); - tx.to = await contract.getAddress(); - const iface = contract.interface; - // Only allow payable contracts to set non-zero value - const payable = iface.receive || (iface.fallback && iface.fallback.payable); - assertArgument(payable || (tx.value || BN_0) === BN_0, "cannot send value to non-payable contract", "overrides.value", tx.value); - // Only allow fallback contracts to set non-empty data - assertArgument(iface.fallback || (tx.data || "0x") === "0x", "cannot send data to receive-only contract", "overrides.data", tx.data); - return tx; - }; - const staticCall = async function (overrides) { - const runner = getRunner(contract.runner, "call"); - assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); - const tx = await populateTransaction(overrides); - try { - return await runner.call(tx); - } - catch (error) { - if (isCallException(error) && error.data) { - throw contract.interface.makeError(error.data, tx); - } - throw error; - } - }; - const send = async function (overrides) { - const runner = contract.runner; - assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); - const tx = await runner.sendTransaction(await populateTransaction(overrides)); - const provider = getProvider(contract.runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - return new ContractTransactionResponse(contract.interface, provider, tx); - }; - const estimateEnergy = async function (overrides) { - const runner = getRunner(contract.runner, "estimateEnergy"); - assert(canEstimate(runner), "contract runner does not support energy estimation", "UNSUPPORTED_OPERATION", { operation: "estimateEnergy" }); - return await runner.estimateEnergy(await populateTransaction(overrides)); - }; - const method = async (overrides) => { - return await send(overrides); - }; - defineProperties(method, { - _contract: contract, - estimateEnergy, - populateTransaction, - send, - staticCall, - }); - return method; -} -function buildWrappedMethod(contract, key) { - const getFragment = function (...args) { - const fragment = contract.interface.getFunction(key, args); - assert(fragment, "no matching fragment in getFragment", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }; - const populateTransaction = async function (...args) { - const fragment = getFragment(...args); - // If an overrides was passed in, copy it and normalize the values - let overrides = {}; - if (fragment.inputs.length + 1 === args.length) { - overrides = await copyOverrides(args.pop()); - } - if (fragment.inputs.length !== args.length) { - throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); - } - const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args); - return Object.assign({}, overrides, await resolveProperties({ - to: contract.getAddress(), - data: contract.interface.encodeFunctionData(fragment, resolvedArgs), - })); - }; - const staticCall = async function (...args) { - const result = await staticCallResult(...args); - if (result.length === 1) { - return result[0]; - } - return result; - }; - const send = async function (...args) { - const runner = contract.runner; - assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); - const tx = await runner.sendTransaction(await populateTransaction(...args)); - const provider = getProvider(contract.runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - return new ContractTransactionResponse(contract.interface, provider, tx); - }; - const estimateEnergy = async function (...args) { - const runner = getRunner(contract.runner, "estimateEnergy"); - assert(canEstimate(runner), "contract runner does not support energy estimation", "UNSUPPORTED_OPERATION", { operation: "estimateEnergy" }); - return await runner.estimateEnergy(await populateTransaction(...args)); - }; - const staticCallResult = async function (...args) { - const runner = getRunner(contract.runner, "call"); - assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); - const tx = await populateTransaction(...args); - let result = "0x"; - try { - result = await runner.call(tx); - } - catch (error) { - if (isCallException(error) && error.data) { - throw contract.interface.makeError(error.data, tx); - } - throw error; - } - const fragment = getFragment(...args); - return contract.interface.decodeFunctionResult(fragment, result); - }; - const method = async (...args) => { - const fragment = getFragment(...args); - if (fragment.constant) { - return await staticCall(...args); - } - return await send(...args); - }; - defineProperties(method, { - name: contract.interface.getFunctionName(key), - _contract: contract, - _key: key, - getFragment, - estimateEnergy, - populateTransaction, - send, - staticCall, - staticCallResult, - }); - // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) - Object.defineProperty(method, "fragment", { - configurable: false, - enumerable: true, - get: () => { - const fragment = contract.interface.getFunction(key); - assert(fragment, "no matching fragment in defineProperty", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }, - }); - return method; -} -function buildWrappedEvent(contract, key) { - const getFragment = function (...args) { - const fragment = contract.interface.getEvent(key, args); - assert(fragment, "no matching fragment in", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }; - const method = function (...args) { - return new PreparedTopicFilter(contract, getFragment(...args), args); - }; - defineProperties(method, { - name: contract.interface.getEventName(key), - _contract: contract, - _key: key, - getFragment, - }); - // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) - Object.defineProperty(method, "fragment", { - configurable: false, - enumerable: true, - get: () => { - const fragment = contract.interface.getEvent(key); - assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - return fragment; - }, - }); - return method; -} -// The combination of TypeScrype, Private Fields and Proxies makes -// the world go boom; so we hide variables with some trickery keeping -// a symbol attached to each BaseContract which its sub-class (even -// via a Proxy) can reach and use to look up its internal values. -const internal = Symbol.for("_corebcInternal_contract"); -const internalValues = new WeakMap(); -function setInternal(contract, values) { - internalValues.set(contract[internal], values); -} -function getInternal(contract) { - return internalValues.get(contract[internal]); -} -function isDeferred(value) { - return (value && - typeof value === "object" && - "getTopicFilter" in value && - typeof value.getTopicFilter === "function" && - value.fragment); -} -async function getSubInfo(contract, event) { - let topics; - let fragment = null; - // Convert named events to topicHash and get the fragment for - // events which need deconstructing. - if (Array.isArray(event)) { - const topicHashify = function (name) { - if (isHexString(name, 32)) { - return name; - } - const fragment = contract.interface.getEvent(name); - assertArgument(fragment, "unknown fragment", "name", name); - return fragment.topicHash; - }; - // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` - topics = event.map((e) => { - if (e == null) { - return null; - } - if (Array.isArray(e)) { - return e.map(topicHashify); - } - return topicHashify(e); - }); - } - else if (event === "*") { - topics = [null]; - } - else if (typeof event === "string") { - if (isHexString(event, 32)) { - // Topic Hash - topics = [event]; - } - else { - // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` - fragment = contract.interface.getEvent(event); - assertArgument(fragment, "unknown fragment", "event", event); - topics = [fragment.topicHash]; - } - } - else if (isDeferred(event)) { - // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)` - topics = await event.getTopicFilter(); - } - else if ("fragment" in event) { - // ContractEvent; e.g. `contract.filter.Transfer` - fragment = event.fragment; - topics = [fragment.topicHash]; - } - else { - assertArgument(false, "unknown event name", "event", event); - } - // Normalize topics and sort TopicSets - topics = topics.map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values()); - if (items.length === 1) { - return items[0]; - } - items.sort(); - return items; - } - return t.toLowerCase(); - }); - const tag = topics - .map((t) => { - if (t == null) { - return "null"; - } - if (Array.isArray(t)) { - return t.join("|"); - } - return t; - }) - .join("&"); - return { fragment, tag, topics }; -} -async function hasSub(contract, event) { - const { subs } = getInternal(contract); - return subs.get((await getSubInfo(contract, event)).tag) || null; -} -async function getSub(contract, operation, event) { - // Make sure our runner can actually subscribe to events - const provider = getProvider(contract.runner); - assert(provider, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation }); - const { fragment, tag, topics } = await getSubInfo(contract, event); - const { addr, subs } = getInternal(contract); - let sub = subs.get(tag); - if (!sub) { - const address = addr ? addr : contract; - const filter = { address, topics }; - const listener = (log) => { - let foundFragment = fragment; - if (foundFragment == null) { - try { - foundFragment = contract.interface.getEvent(log.topics[0]); - } - catch (error) { } - } - // If fragment is null, we do not deconstruct the args to emit - if (foundFragment) { - const _foundFragment = foundFragment; - const args = fragment - ? contract.interface.decodeEventLog(fragment, log.data, log.topics) - : []; - emit(contract, event, args, (listener) => { - return new ContractEventPayload(contract, listener, event, _foundFragment, log); - }); - } - else { - emit(contract, event, [], (listener) => { - return new ContractUnknownEventPayload(contract, listener, event, log); - }); - } - }; - let starting = []; - const start = () => { - if (starting.length) { - return; - } - starting.push(provider.on(filter, listener)); - }; - const stop = async () => { - if (starting.length == 0) { - return; - } - let started = starting; - starting = []; - await Promise.all(started); - provider.off(filter, listener); - }; - sub = { tag, listeners: [], start, stop }; - subs.set(tag, sub); - } - return sub; -} -// We use this to ensure one emit resolves before firing the next to -// ensure correct ordering (note this cannot throw and just adds the -// notice to the event queu using setTimeout). -let lastEmit = Promise.resolve(); -async function _emit(contract, event, args, payloadFunc) { - await lastEmit; - const sub = await hasSub(contract, event); - if (!sub) { - return false; - } - const count = sub.listeners.length; - sub.listeners = sub.listeners.filter(({ listener, once }) => { - const passArgs = Array.from(args); - if (payloadFunc) { - passArgs.push(payloadFunc(once ? null : listener)); - } - try { - listener.call(contract, ...passArgs); - } - catch (error) { } - return !once; - }); - return count > 0; -} -async function emit(contract, event, args, payloadFunc) { - try { - await lastEmit; - } - catch (error) { } - const resultPromise = _emit(contract, event, args, payloadFunc); - lastEmit = resultPromise; - return await resultPromise; -} -const passProperties = ["then"]; -export class BaseContract { - target; - interface; - runner; - filters; - [internal]; - fallback; - constructor(target, abi, runner, _deployTx) { - if (runner == null) { - runner = null; - } - const iface = Interface.from(abi); - defineProperties(this, { target, runner, interface: iface }); - Object.defineProperty(this, internal, { value: {} }); - let addrPromise; - let addr = null; - let deployTx = null; - if (_deployTx) { - const provider = getProvider(runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx); - } - let subs = new Map(); - // Resolve the target as the address - if (typeof target === "string") { - if (isHexString(target)) { - addr = target; - addrPromise = Promise.resolve(target); - } - else { - const resolver = getRunner(runner, "resolveName"); - if (!canResolve(resolver)) { - throw makeError("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", { - operation: "resolveName", - }); - } - addrPromise = resolver.resolveName(target).then((addr) => { - if (addr == null) { - throw new Error("TODO"); - } - getInternal(this).addr = addr; - return addr; - }); - } - } - else { - addrPromise = target.getAddress().then((addr) => { - if (addr == null) { - throw new Error("TODO"); - } - getInternal(this).addr = addr; - return addr; - }); - } - // Set our private values - setInternal(this, { addrPromise, addr, deployTx, subs }); - // Add the event filters - const filters = new Proxy({}, { - get: (target, _prop, receiver) => { - // Pass important checks (like `then` for Promise) through - if (passProperties.indexOf(_prop) >= 0) { - return Reflect.get(target, _prop, receiver); - } - const prop = String(_prop); - const result = this.getEvent(prop); - if (result) { - return result; - } - throw new Error(`unknown contract event: ${prop}`); - }, - has: (target, prop) => { - // Pass important checks (like `then` for Promise) through - if (passProperties.indexOf(prop) >= 0) { - return Reflect.has(target, prop); - } - return (Reflect.has(target, prop) || this.interface.hasEvent(String(prop))); - }, - }); - defineProperties(this, { filters }); - defineProperties(this, { - fallback: iface.receive || iface.fallback ? buildWrappedFallback(this) : null, - }); - // Return a Proxy that will respond to functions - return new Proxy(this, { - get: (target, _prop, receiver) => { - if (_prop in target || passProperties.indexOf(_prop) >= 0) { - return Reflect.get(target, _prop, receiver); - } - const prop = String(_prop); - const result = target.getFunction(prop); - if (result) { - return result; - } - throw new Error(`unknown contract method: ${prop}`); - }, - has: (target, prop) => { - if (prop in target || passProperties.indexOf(prop) >= 0) { - return Reflect.has(target, prop); - } - return target.interface.hasFunction(String(prop)); - }, - }); - } - connect(runner) { - return new BaseContract(this.target, this.interface, runner); - } - async getAddress() { - return await getInternal(this).addrPromise; - } - async getDeployedCode() { - const provider = getProvider(this.runner); - assert(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" }); - const code = await provider.getCode(await this.getAddress()); - if (code === "0x") { - return null; - } - return code; - } - async waitForDeployment() { - // We have the deployement transaction; just use that (throws if deployement fails) - const deployTx = this.deploymentTransaction(); - if (deployTx) { - await deployTx.wait(); - return this; - } - // Check for code - const code = await this.getDeployedCode(); - if (code != null) { - return this; - } - // Make sure we can subscribe to a provider event - const provider = getProvider(this.runner); - assert(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }); - return new Promise((resolve, reject) => { - const checkCode = async () => { - try { - const code = await this.getDeployedCode(); - if (code != null) { - return resolve(this); - } - provider.once("block", checkCode); - } - catch (error) { - reject(error); - } - }; - checkCode(); - }); - } - deploymentTransaction() { - return getInternal(this).deployTx; - } - getFunction(key) { - if (typeof key !== "string") { - key = key.format(); - } - const func = buildWrappedMethod(this, key); - return func; - } - getEvent(key) { - if (typeof key !== "string") { - key = key.format(); - } - return buildWrappedEvent(this, key); - } - async queryTransaction(hash) { - // Is this useful? - throw new Error("@TODO"); - } - async queryFilter(event, fromBlock, toBlock) { - if (fromBlock == null) { - fromBlock = 0; - } - if (toBlock == null) { - toBlock = "latest"; - } - const { addr, addrPromise } = getInternal(this); - const address = addr ? addr : await addrPromise; - const { fragment, topics } = await getSubInfo(this, event); - const filter = { address, topics, fromBlock, toBlock }; - const provider = getProvider(this.runner); - assert(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); - return (await provider.getLogs(filter)).map((log) => { - let foundFragment = fragment; - if (foundFragment == null) { - try { - foundFragment = this.interface.getEvent(log.topics[0]); - } - catch (error) { } - } - if (foundFragment) { - return new EventLog(log, this.interface, foundFragment); - } - else { - return new Log(log, provider); - } - }); - } - async on(event, listener) { - const sub = await getSub(this, "on", event); - sub.listeners.push({ listener, once: false }); - sub.start(); - return this; - } - async once(event, listener) { - const sub = await getSub(this, "once", event); - sub.listeners.push({ listener, once: true }); - sub.start(); - return this; - } - async emit(event, ...args) { - return await emit(this, event, args, null); - } - async listenerCount(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return 0; - } - return sub.listeners.length; - } - const { subs } = getInternal(this); - let total = 0; - for (const { listeners } of subs.values()) { - total += listeners.length; - } - return total; - } - async listeners(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return []; - } - return sub.listeners.map(({ listener }) => listener); - } - const { subs } = getInternal(this); - let result = []; - for (const { listeners } of subs.values()) { - result = result.concat(listeners.map(({ listener }) => listener)); - } - return result; - } - async off(event, listener) { - const sub = await hasSub(this, event); - if (!sub) { - return this; - } - if (listener) { - const index = sub.listeners - .map(({ listener }) => listener) - .indexOf(listener); - if (index >= 0) { - sub.listeners.splice(index, 1); - } - } - if (listener == null || sub.listeners.length === 0) { - sub.stop(); - getInternal(this).subs.delete(sub.tag); - } - return this; - } - async removeAllListeners(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return this; - } - sub.stop(); - getInternal(this).subs.delete(sub.tag); - } - else { - const { subs } = getInternal(this); - for (const { tag, stop } of subs.values()) { - stop(); - subs.delete(tag); - } - } - return this; - } - // Alias for "on" - async addListener(event, listener) { - return await this.on(event, listener); - } - // Alias for "off" - async removeListener(event, listener) { - return await this.off(event, listener); - } - static buildClass(abi) { - class CustomContract extends BaseContract { - constructor(address, runner = null) { - super(address, abi, runner); - } - } - return CustomContract; - } - static from(target, abi, runner) { - if (runner == null) { - runner = null; - } - const contract = new this(target, abi, runner); - return contract; - } - static isIndexed(value) { - return Indexed.isIndexed(value); - } -} -function _ContractBase() { - return BaseContract; -} -export class Contract extends _ContractBase() { -} -//# sourceMappingURL=contract.js.map \ No newline at end of file diff --git a/lib.esm/contract/contract.js.map b/lib.esm/contract/contract.js.map deleted file mode 100644 index 2e68642f6..000000000 --- a/lib.esm/contract/contract.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src.ts/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,WAAW,EACX,GAAG,GAEJ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,MAAM,EACN,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,QAAQ,GACT,MAAM,eAAe,CAAC;AAgCvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAkBvB,SAAS,OAAO,CAAC,KAAU;IACzB,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnD,CAAC;AAED,SAAS,WAAW,CAAC,KAAU;IAC7B,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,cAAc,KAAK,UAAU,CAAC;AAC7D,CAAC;AAED,SAAS,UAAU,CAAC,KAAU;IAC5B,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,WAAW,KAAK,UAAU,CAAC;AAC1D,CAAC;AAED,SAAS,OAAO,CAAC,KAAU;IACzB,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,eAAe,KAAK,UAAU,CAAC;AAC9D,CAAC;AAED,MAAM,mBAAmB;IACvB,OAAO,CAAuB;IACrB,QAAQ,CAAiB;IAElC,YACE,QAAsB,EACtB,QAAuB,EACvB,IAAgB;QAEhB,gBAAgB,CAAsB,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC1D,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,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S,CAAC,KAAU;QACzB,OAAO,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACF;AAED,SAAS,aAAa;IAKpB,OAAO,YAAmB,CAAC;AAC7B,CAAC;AAED,MAAM,OAAO,QAAS,SAAQ,aAAa,EAAE;CAAG"} \ No newline at end of file diff --git a/lib.esm/contract/factory.d.ts b/lib.esm/contract/factory.d.ts deleted file mode 100644 index f58d98552..000000000 --- a/lib.esm/contract/factory.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Interface } from "../abi/index.js"; -import { BaseContract } from "./contract.js"; -import type { InterfaceAbi } from "../abi/index.js"; -import type { ContractRunner } from "../providers/index.js"; -import type { BytesLike } from "../utils/index.js"; -import type { ContractInterface, ContractMethodArgs, ContractDeployTransaction } from "./types.js"; -import type { ContractTransactionResponse } from "./wrappers.js"; -export declare class ContractFactory = Array, I = BaseContract> { - readonly interface: Interface; - readonly bytecode: string; - readonly runner: null | ContractRunner; - constructor(abi: Interface | InterfaceAbi, bytecode: BytesLike | { - object: string; - }, runner?: null | ContractRunner); - getDeployTransaction(...args: ContractMethodArgs): Promise; - deploy(...args: ContractMethodArgs): Promise>; - connect(runner: null | ContractRunner): ContractFactory; - static fromSolidity = Array, I = ContractInterface>(output: any, runner?: ContractRunner): ContractFactory; -} -//# sourceMappingURL=factory.d.ts.map \ No newline at end of file diff --git a/lib.esm/contract/factory.d.ts.map b/lib.esm/contract/factory.d.ts.map deleted file mode 100644 index 600026a1b..000000000 --- a/lib.esm/contract/factory.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src.ts/contract/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C,OAAO,EAAE,YAAY,EAA8B,MAAM,eAAe,CAAC;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,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AAC,EAAE,CAAC,CAAC;CAkBzB"} \ No newline at end of file diff --git a/lib.esm/contract/factory.js b/lib.esm/contract/factory.js deleted file mode 100644 index 420d4fc09..000000000 --- a/lib.esm/contract/factory.js +++ /dev/null @@ -1,83 +0,0 @@ -import { Interface } from "../abi/index.js"; -import { getCreateAddress } from "../address/contract-address.js"; -import { concat, defineProperties, getBytes, hexlify, assert, assertArgument, } from "../utils/index.js"; -import { BaseContract, copyOverrides, resolveArgs } from "./contract.js"; -import { isBytes } from "../utils/data.js"; -// A = Arguments to the constructor -// I = Interface of deployed contracts -export class ContractFactory { - interface; - bytecode; - runner; - constructor(abi, bytecode, runner) { - const iface = Interface.from(abi); - // Dereference Solidity bytecode objects and allow a missing `0x`-prefix - if (bytecode instanceof Uint8Array) { - bytecode = hexlify(getBytes(bytecode)); - } - else if (typeof bytecode === "string") { - bytecode = bytecode; - } - else if (isBytes(bytecode)) { - bytecode = hexlify(bytecode); - } - else if (bytecode && typeof bytecode.object === "string") { - // Allow the bytecode object from the Solidity compiler - bytecode = bytecode.object; - } - else { - // Crash in the next verification step - bytecode = "!"; - } - defineProperties(this, { - // @ts-ignore - bytecode, - interface: iface, - runner: runner || null, - }); - } - async getDeployTransaction(...args) { - let overrides = {}; - const fragment = this.interface.deploy; - if (fragment.inputs.length + 1 === args.length) { - overrides = await copyOverrides(args.pop()); - } - if (fragment.inputs.length !== args.length) { - throw new Error("incorrect number of arguments to constructor"); - } - const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args); - const data = concat([ - this.bytecode, - this.interface.encodeDeploy(resolvedArgs), - ]); - return Object.assign({}, overrides, { data }); - } - async deploy(...args) { - const tx = await this.getDeployTransaction(...args); - assert(this.runner && typeof this.runner.sendTransaction === "function", "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", { - operation: "sendTransaction", - }); - const sentTx = await this.runner.sendTransaction(tx); - const address = getCreateAddress(sentTx); - return new BaseContract(address, this.interface, this.runner, sentTx); - } - connect(runner) { - return new ContractFactory(this.interface, this.bytecode, runner); - } - static fromSolidity(output, runner) { - assertArgument(output != null, "bad compiler output", "output", output); - if (typeof output === "string") { - output = JSON.parse(output); - } - const abi = output.abi; - let bytecode = ""; - if (output.bytecode) { - bytecode = output.bytecode; - } - else if (output.evm && output.evm.bytecode) { - bytecode = output.evm.bytecode; - } - return new this(abi, bytecode, runner); - } -} -//# sourceMappingURL=factory.js.map \ No newline at end of file diff --git a/lib.esm/contract/factory.js.map b/lib.esm/contract/factory.js.map deleted file mode 100644 index a8cba5661..000000000 --- a/lib.esm/contract/factory.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src.ts/contract/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,QAAQ,EACR,OAAO,EACP,MAAM,EACN,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAYzE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,mCAAmC;AACnC,sCAAsC;AACtC,MAAM,OAAO,eAAe;IAIjB,SAAS,CAAa;IACtB,QAAQ,CAAU;IAClB,MAAM,CAAyB;IAExC,YACE,GAA6B,EAC7B,QAAwC,EACxC,MAA8B;QAE9B,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAElC,wEAAwE;QACxE,IAAI,QAAQ,YAAY,UAAU,EAAE;YAClC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;SACxC;aAAM,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;YACvC,QAAQ,GAAG,QAAQ,CAAC;SACrB;aAAM,IA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,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/contract/index.d.ts b/lib.esm/contract/index.d.ts deleted file mode 100644 index 8be93dacb..000000000 --- a/lib.esm/contract/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * About contracts... - * - * @_section: api/contract:Contracts [about-contracts] - */ -export { BaseContract, Contract } from "./contract.js"; -export { ContractFactory } from "./factory.js"; -export { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, } from "./wrappers.js"; -export type { BaseContractMethod, ConstantContractMethod, PostfixOverrides, ContractEvent, ContractEventArgs, ContractEventName, ContractDeployTransaction, ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, DeferredTopicFilter, Overrides, WrappedFallback, } from "./types.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.esm/contract/index.d.ts.map b/lib.esm/contract/index.d.ts.map deleted file mode 100644 index ce8d05bb5..000000000 --- a/lib.esm/contract/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,EACzB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,SAAS,EACT,eAAe,GAChB,MAAM,YAAY,CAAC"} \ No newline at end of file diff --git a/lib.esm/contract/index.js b/lib.esm/contract/index.js deleted file mode 100644 index 6e93aee67..000000000 --- a/lib.esm/contract/index.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * About contracts... - * - * @_section: api/contract:Contracts [about-contracts] - */ -export { BaseContract, Contract } from "./contract.js"; -export { ContractFactory } from "./factory.js"; -export { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, } from "./wrappers.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.esm/contract/index.js.map b/lib.esm/contract/index.js.map deleted file mode 100644 index d8d2fec14..000000000 --- a/lib.esm/contract/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,QAAQ,GACT,MAAM,eAAe,CAAC"} \ No newline at end of file diff --git a/lib.esm/contract/types.d.ts b/lib.esm/contract/types.d.ts deleted file mode 100644 index cf836c128..000000000 --- a/lib.esm/contract/types.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -import type { EventFragment, FunctionFragment, Result, Typed } from "../abi/index.js"; -import type { TransactionRequest, PreparedTransactionRequest, TopicFilter } from "../providers/index.js"; -import type { ContractTransactionResponse } from "./wrappers.js"; -export type ContractEventName = string | ContractEvent | TopicFilter | DeferredTopicFilter; -export interface ContractInterface { - [name: string]: BaseContractMethod; -} -export interface DeferredTopicFilter { - getTopicFilter(): Promise; - fragment: EventFragment; -} -export interface ContractTransaction extends PreparedTransactionRequest { - to: string; - data: string; - from?: string; -} -export interface ContractDeployTransaction extends Omit { -} -export interface Overrides extends Omit { -} -export type PostfixOverrides> = A | [...A, Overrides]; -export type ContractMethodArgs> = PostfixOverrides<{ - [I in keyof A]-?: A[I] | Typed; -}>; -export interface BaseContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { - (...args: ContractMethodArgs): Promise; - name: string; - fragment: FunctionFragment; - getFragment(...args: ContractMethodArgs): FunctionFragment; - populateTransaction(...args: ContractMethodArgs): Promise; - staticCall(...args: ContractMethodArgs): Promise; - send(...args: ContractMethodArgs): Promise; - estimateEnergy(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; -} -export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> extends BaseContractMethod { -} -export interface ConstantContractMethod, R = any> extends ContractMethod { -} -export type ContractEventArgs> = { - [I in keyof A]?: A[I] | Typed | null; -}; -export interface ContractEvent = Array> { - (...args: ContractEventArgs): DeferredTopicFilter; - name: string; - fragment: EventFragment; - getFragment(...args: ContractEventArgs): EventFragment; -} -export interface WrappedFallback { - (overrides?: Omit): Promise; - populateTransaction(overrides?: Omit): Promise; - staticCall(overrides?: Omit): Promise; - send(overrides?: Omit): Promise; - estimateEnergy(overrides?: Omit): Promise; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/lib.esm/contract/types.d.ts.map b/lib.esm/contract/types.d.ts.map deleted file mode 100644 index d0dd8e022..000000000 --- a/lib.esm/contract/types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src.ts/contract/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,KAAK,EACN,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,e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AM,WAAW,aAAa,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;IAC9D,CAAC,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,mBAAmB,CAAC;IAErD,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,EAAE,aAAa,CAAC;IACxB,WAAW,CAAC,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC;CAC3D;AAED,MAAM,WAAW,eAAe;IAC9B,CACE,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GACzC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAExC,mBAAmB,CACjB,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GACzC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChC,UAAU,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxE,IAAI,CACF,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GACzC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACxC,cAAc,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7E"} \ No newline at end of file diff --git a/lib.esm/contract/types.js b/lib.esm/contract/types.js deleted file mode 100644 index 718fd38ae..000000000 --- a/lib.esm/contract/types.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/lib.esm/contract/types.js.map b/lib.esm/contract/types.js.map deleted file mode 100644 index 595591811..000000000 --- a/lib.esm/contract/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src.ts/contract/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.esm/contract/wrappers.d.ts b/lib.esm/contract/wrappers.d.ts deleted file mode 100644 index 184e06900..000000000 --- a/lib.esm/contract/wrappers.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Block, Log, TransactionReceipt, TransactionResponse } from "../providers/provider.js"; -import { EventPayload } from "../utils/index.js"; -import type { EventFragment, Interface, Result } from "../abi/index.js"; -import type { Listener } from "../utils/index.js"; -import type { Provider } from "../providers/index.js"; -import type { BaseContract } from "./contract.js"; -import type { ContractEventName } from "./types.js"; -export declare class EventLog extends Log { - readonly interface: Interface; - readonly fragment: EventFragment; - readonly args: Result; - constructor(log: Log, iface: Interface, fragment: EventFragment); - get eventName(): string; - get eventSignature(): string; -} -export declare class ContractTransactionReceipt extends TransactionReceipt { - #private; - constructor(iface: Interface, provider: Provider, tx: TransactionReceipt); - get logs(): Array; -} -export declare class ContractTransactionResponse extends TransactionResponse { - #private; - constructor(iface: Interface, provider: Provider, tx: TransactionResponse); - wait(confirms?: number): Promise; -} -export declare class ContractUnknownEventPayload extends EventPayload { - readonly log: Log; - constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, log: Log); - getBlock(): Promise; - getTransaction(): Promise; - getTransactionReceipt(): Promise; -} -export declare class ContractEventPayload extends ContractUnknownEventPayload { - readonly fragment: EventFragment; - readonly log: EventLog; - readonly args: Result; - constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, fragment: EventFragment, _log: Log); - get eventName(): string; - get eventSignature(): string; -} -//# sourceMappingURL=wrappers.d.ts.map \ No newline at end of file diff --git a/lib.esm/contract/wrappers.d.ts.map b/lib.esm/contract/wrappers.d.ts.map deleted file mode 100644 index aa2542479..000000000 --- a/lib.esm/contract/wrappers.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wrappers.d.ts","sourceRoot":"","sources":["../../src.ts/contract/wrappers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,GAA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AG,CAAC;gBAGjB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,IAAI,GAAG,QAAQ,EACzB,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,GAAG;IAMJ,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC;IAI1B,cAAc,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAI9C,qBAAqB,IAAI,OAAO,CAAC,kBAAkB,CAAC;CAG3D;AAED,qBAAa,oBAAqB,SAAQ,2BAA2B;IACnE,SAAiB,QAAQ,EAAE,aAAa,CAAC;IACzC,SAAiB,GAAG,EAAE,QAAQ,CAAC;IAC/B,SAAiB,IAAI,EAAE,MAAM,CAAC;gBAG5B,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,IAAI,GAAG,QAAQ,EACzB,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,GAAG;IAgBX,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,cAAc,IAAI,MAAM,CAE3B;CACF"} \ No newline at end of file diff --git a/lib.esm/contract/wrappers.js b/lib.esm/contract/wrappers.js deleted file mode 100644 index bef7ba87d..000000000 --- a/lib.esm/contract/wrappers.js +++ /dev/null @@ -1,82 +0,0 @@ -import { Log, TransactionReceipt, TransactionResponse, } from "../providers/provider.js"; -import { defineProperties, EventPayload } from "../utils/index.js"; -export class EventLog extends Log { - interface; - fragment; - args; - constructor(log, iface, fragment) { - super(log, log.provider); - const args = iface.decodeEventLog(fragment, log.data, log.topics); - defineProperties(this, { args, fragment, interface: iface }); - } - get eventName() { - return this.fragment.name; - } - get eventSignature() { - return this.fragment.format(); - } -} -export class ContractTransactionReceipt extends TransactionReceipt { - #iface; - constructor(iface, provider, tx) { - super(tx, provider); - this.#iface = iface; - } - get logs() { - return super.logs.map((log) => { - const fragment = log.topics.length - ? this.#iface.getEvent(log.topics[0]) - : null; - if (fragment) { - return new EventLog(log, this.#iface, fragment); - } - else { - return log; - } - }); - } -} -export class ContractTransactionResponse extends TransactionResponse { - #iface; - constructor(iface, provider, tx) { - super(tx, provider); - this.#iface = iface; - } - async wait(confirms) { - const receipt = await super.wait(); - if (receipt == null) { - return null; - } - return new ContractTransactionReceipt(this.#iface, this.provider, receipt); - } -} -export class ContractUnknownEventPayload extends EventPayload { - log; - constructor(contract, listener, filter, log) { - super(contract, listener, filter); - defineProperties(this, { log }); - } - async getBlock() { - return await this.log.getBlock(); - } - async getTransaction() { - return await this.log.getTransaction(); - } - async getTransactionReceipt() { - return await this.log.getTransactionReceipt(); - } -} -export class ContractEventPayload extends ContractUnknownEventPayload { - constructor(contract, listener, filter, fragment, _log) { - super(contract, listener, filter, new EventLog(_log, contract.interface, fragment)); - const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics); - defineProperties(this, { args, fragment }); - } - get eventName() { - return this.fragment.name; - } - get eventSignature() { - return this.fragment.format(); - } -} -//# sourceMappingURL=wrappers.js.map \ No newline at end of file diff --git a/lib.esm/contract/wrappers.js.map b/lib.esm/contract/wrappers.js.map deleted file mode 100644 index e79ad385a..000000000 --- a/lib.esm/contract/wrappers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wrappers.js","sourceRoot":"","sources":["../../src.ts/contract/wrappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,GAAG,EACH,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AASnE,MAAM,OAAO,QAAS,SAAQ,GAAG;IACtB,SAAS,CAAa;IACtB,QAAQ,CAAiB;IACzB,IAAI,CAAU;IAEvB,YAAY,GAAQ,EAAE,KAAgB,EAAE,QAAuB;QAC7D,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACzB,MAAM,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,EAAE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AI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IAChC,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/corebc.d.ts b/lib.esm/corebc.d.ts deleted file mode 100644 index 04ae175d8..000000000 --- a/lib.esm/corebc.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -export { version } from "./_version.js"; -export { publicToAddress } from "./transaction/address.js"; -export { decodeBytes32String, encodeBytes32String, AbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FallbackFragment, FunctionFragment, NamedFragment, ParamType, StructFragment, checkResultErrors, ErrorDescription, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from "./abi/index.js"; -export { getAddress, networkIdToPrefix } from "./address/index.js"; -export { getCreate2Address, getCreateAddress, } from "./address/contract-address.js"; -export { isAddressable, isAddress, resolveAddress } from "./address/checks.js"; -export { ZeroAddress, OrePerXCB, MaxUint256, MinInt256, MaxInt256, N, ZeroHash, CoreSymbol, MessagePrefix, } from "./constants/index.js"; -export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, EventLog, } from "./contract/index.js"; -export { computeHmac, randomBytes, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Ed448Goldilock, Signature, SigningKey, keccak256, } from "./crypto/index.js"; -export { id, hashMessage, verifyMessage, solidityPacked, solidityPackedSha256, TypedDataEncoder, verifyTypedData, } from "./hash/index.js"; -export { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, NonceManager, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, CloudflareProvider, InfuraProvider, InfuraWebSocketProvider, PocketProvider, QuickNodeProvider, IpcSocketProvider, SocketProvider, WebSocketProvider, Network, FeeDataNetworkPlugin, EnergyCostPlugin, NetworkPlugin, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketSubscriber, UnmanagedSubscriber, copyRequest, showThrottleMessage, } from "./providers/index.js"; -export { accessListify, computeAddress, recoverAddress, Transaction, } from "./transaction/index.js"; -export { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, resolveProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, EventPayload, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatXCB, parseXCB, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp, uuidV4, arrayify, hexConcat, } from "./utils/index.js"; -export { Mnemonic, BaseWallet, HDNodeWallet, Wallet, defaultPath, getAccountPath, getIndexedAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./wallet/index.js"; -export { BigNumber } from "./bigNumber/bigNumber.js"; -export { Wordlist, LangEn, WordlistOwl, WordlistOwlA, wordlists, } from "./wordlists/index.js"; -export type { JsonFragment, JsonFragmentType, FormatType, FragmentType, InterfaceAbi, ParamTypeWalkFunc, ParamTypeWalkAsyncFunc, } from "./abi/index.js"; -export type { Addressable, AddressLike, NameResolver, } from "./address/index.js"; -export type { ConstantContractMethod, ContractEvent, ContractEventArgs, ContractEventName, ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, DeferredTopicFilter, Overrides, BaseContractMethod, ContractDeployTransaction, PostfixOverrides, WrappedFallback, } from "./contract/index.js"; -export type { ProgressCallback, SignatureLike } from "./crypto/index.js"; -export type { TypedDataDomain, TypedDataField } from "./hash/index.js"; -export type { Provider, Signer, AbstractProviderPlugin, BlockParams, BlockTag, ContractRunner, DebugEventBrowserProvider, Eip1193Provider, EventFilter, Filter, FilterByBlockHash, EnergyCostParameters, JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcTransactionRequest, LogParams, MinedBlock, MinedTransactionResponse, Networkish, OrphanFilter, PerformActionFilter, PerformActionRequest, PerformActionTransaction, PreparedTransactionRequest, ProviderEvent, Subscriber, Subscription, TopicFilter, TransactionReceiptParams, TransactionRequest, TransactionResponseParams, WebSocketCreator, WebSocketLike, } from "./providers/index.js"; -export type { AccessList, AccessListish, AccessListEntry, TransactionLike, } from "./transaction/index.js"; -export type { BytesLike, BigNumberish, Numeric, ErrorCode, FixedFormat, Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, RlpStructuredData, GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc, CoreBCError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CodedCoreBCError, CallExceptionAction, CallExceptionTransaction, EventEmitterable, Listener, } from "./utils/index.js"; -export type { CrowdsaleAccount, KeystoreAccount, EncryptOptions, } from "./wallet/index.js"; -//# sourceMappingURL=corebc.d.ts.map \ No newline at end of file diff --git a/lib.esm/corebc.d.ts.map b/lib.esm/corebc.d.ts.map deleted file mode 100644 index d023fbd11..000000000 --- a/lib.esm/corebc.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file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nB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,aAAa,EACb,UAAU,EACV,YAAY,EACZ,WAAW,EACX,wBAAwB,EACxB,kBAAkB,EAClB,yBAAyB,EACzB,gBAAgB,EAChB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,UAAU,EACV,aAAa,EACb,eAAe,EACf,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACV,SAAS,EACT,YAAY,EACZ,OAAO,EACP,SAAS,EACT,WAAW,EACX,aAAa,EACb,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,mBAAmB,CAAC"} \ No newline at end of file diff --git a/lib.esm/corebc.js b/lib.esm/corebc.js deleted file mode 100644 index d8cb46b04..000000000 --- a/lib.esm/corebc.js +++ /dev/null @@ -1,17 +0,0 @@ -export { version } from "./_version.js"; -export { publicToAddress } from "./transaction/address.js"; -export { decodeBytes32String, encodeBytes32String, AbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FallbackFragment, FunctionFragment, NamedFragment, ParamType, StructFragment, checkResultErrors, ErrorDescription, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from "./abi/index.js"; -export { getAddress, networkIdToPrefix } from "./address/index.js"; -export { getCreate2Address, getCreateAddress, } from "./address/contract-address.js"; -export { isAddressable, isAddress, resolveAddress } from "./address/checks.js"; -export { ZeroAddress, OrePerXCB, MaxUint256, MinInt256, MaxInt256, N, ZeroHash, CoreSymbol, MessagePrefix, } from "./constants/index.js"; -export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, EventLog, } from "./contract/index.js"; -export { computeHmac, randomBytes, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Ed448Goldilock, Signature, SigningKey, keccak256, } from "./crypto/index.js"; -export { id, hashMessage, verifyMessage, solidityPacked, solidityPackedSha256, TypedDataEncoder, verifyTypedData, } from "./hash/index.js"; -export { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, NonceManager, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, CloudflareProvider, InfuraProvider, InfuraWebSocketProvider, PocketProvider, QuickNodeProvider, IpcSocketProvider, SocketProvider, WebSocketProvider, Network, FeeDataNetworkPlugin, EnergyCostPlugin, NetworkPlugin, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketSubscriber, UnmanagedSubscriber, copyRequest, showThrottleMessage, } from "./providers/index.js"; -export { accessListify, computeAddress, recoverAddress, Transaction, } from "./transaction/index.js"; -export { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, resolveProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, EventPayload, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatXCB, parseXCB, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp, uuidV4, arrayify, hexConcat, } from "./utils/index.js"; -export { Mnemonic, BaseWallet, HDNodeWallet, Wallet, defaultPath, getAccountPath, getIndexedAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./wallet/index.js"; -export { BigNumber } from "./bigNumber/bigNumber.js"; -export { Wordlist, LangEn, WordlistOwl, WordlistOwlA, wordlists, } from "./wordlists/index.js"; -//# sourceMappingURL=corebc.js.map \ No newline at end of file diff --git a/lib.esm/corebc.js.map b/lib.esm/corebc.js.map deleted file mode 100644 index c8fa02a9b..000000000 --- a/lib.esm/corebc.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"corebc.js","sourceRoot":"","sources":["../src.ts/corebc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,QAAQ,EACR,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,SAAS,EACT,cAAc,EACd,MAAM,EACN,sBAAsB,EACtB,KAAK,GACN,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEnE,OAAO,EACL,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,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YAAY,EACZ,YAAY,EACZ,MAAM,EACN,UAAU,EACV,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,WAAW,EACX,WAAW,EACX,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,SAAS,EACT,eAAe,EACf,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,SAAS,EACT,OAAO,EACP,SAAS,EACT,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,WAAW,EACX,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,SAAS,EACT,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,GACV,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,MAAM,EACN,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,OAAO,EACL,QAAQ,EACR,MAAM,EACN,WAAW,EACX,YAAY,EACZ,SAAS,GACV,MAAM,sBAAsB,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/browser-ed448.d.ts b/lib.esm/crypto/browser-ed448.d.ts deleted file mode 100644 index 7aee3772e..000000000 --- a/lib.esm/crypto/browser-ed448.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import ed448 from "bcrypto/lib/ed448-browser.js"; -export default ed448; -//# sourceMappingURL=browser-ed448.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/browser-ed448.d.ts.map b/lib.esm/crypto/browser-ed448.d.ts.map deleted file mode 100644 index ac87af8f7..000000000 --- a/lib.esm/crypto/browser-ed448.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"browser-ed448.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/browser-ed448.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,8BAA8B,CAAC;AACjD,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/browser-ed448.js b/lib.esm/crypto/browser-ed448.js deleted file mode 100644 index 3f7f3f0cb..000000000 --- a/lib.esm/crypto/browser-ed448.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -// @ts-ignore -import ed448 from "bcrypto/lib/ed448-browser.js"; -export default ed448; -//# sourceMappingURL=browser-ed448.js.map \ No newline at end of file diff --git a/lib.esm/crypto/browser-ed448.js.map b/lib.esm/crypto/browser-ed448.js.map deleted file mode 100644 index 3adaf1126..000000000 --- a/lib.esm/crypto/browser-ed448.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"browser-ed448.js","sourceRoot":"","sources":["../../src.ts/crypto/browser-ed448.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,aAAa;AACb,OAAO,KAAK,MAAM,8BAA8B,CAAC;AACjD,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/browser-sha3.d.ts b/lib.esm/crypto/browser-sha3.d.ts deleted file mode 100644 index 3b83a4fbb..000000000 --- a/lib.esm/crypto/browser-sha3.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { BytesLike } from "../utils/data.js"; -import { SupportedAlgorithm } from "./sha3.js"; -export declare function ripemd160(data: BytesLike): string; -export declare function sha256(data: BytesLike): string; -export declare function sha512(data: BytesLike): string; -export declare function computeHmac(algorithm: SupportedAlgorithm, key: BytesLike, data: BytesLike): string; -//# sourceMappingURL=browser-sha3.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/browser-sha3.d.ts.map b/lib.esm/crypto/browser-sha3.d.ts.map deleted file mode 100644 index e40fa9ffd..000000000 --- a/lib.esm/crypto/browser-sha3.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"browser-sha3.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/browser-sha3.ts"],"names":[],"mappings":"AAQA,OAAO,EAAY,SAAS,EAAW,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAI/C,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAIjD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAI9C;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAI9C;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,kBAAkB,EAC7B,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,SAAS,GACd,MAAM,CAkBR"} \ No newline at end of file diff --git a/lib.esm/crypto/browser-sha3.js b/lib.esm/crypto/browser-sha3.js deleted file mode 100644 index 03a54384e..000000000 --- a/lib.esm/crypto/browser-sha3.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -// @ts-ignore -import _ripemd160 from "bcrypto/lib/ripemd160-browser"; -// @ts-ignore -import sha3 from "bcrypto/lib/sha3-browser.js"; -import { Logger } from "../logger/logger.js"; -import { arrayify, hexlify } from "../utils/data.js"; -import { SupportedAlgorithm } from "./sha3.js"; -const logger = new Logger("corebc-crypto/browser-sha3/0.0.1"); -export function ripemd160(data) { - const d = Buffer.from(arrayify(data)); - const h = _ripemd160.digest(d); - return hexlify(h); -} -export function sha256(data) { - const d = Buffer.from(arrayify(data)); - const h = sha3.digest(d, 256); - return hexlify(h); -} -export function sha512(data) { - const d = Buffer.from(arrayify(data)); - const h = sha3.digest(d, 512); - return hexlify(h); -} -export function computeHmac(algorithm, key, data) { - const d = Buffer.from(arrayify(data)); - const k = Buffer.from(arrayify(key)); - if (algorithm === SupportedAlgorithm.sha256) { - return hexlify(sha3.mac(d, k, 256)); - } - else if (algorithm === SupportedAlgorithm.sha512) { - return hexlify(sha3.mac(d, k, 512)); - } - logger.throwError("unsupported algorithm - " + algorithm, Logger.errors.UNSUPPORTED_OPERATION, { - operation: "computeHmac", - algorithm: algorithm, - }); - return ""; -} -//# sourceMappingURL=browser-sha3.js.map \ No newline at end of file diff --git a/lib.esm/crypto/browser-sha3.js.map b/lib.esm/crypto/browser-sha3.js.map deleted file mode 100644 index 27c4fbaa2..000000000 --- a/lib.esm/crypto/browser-sha3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"browser-sha3.js","sourceRoot":"","sources":["../../src.ts/crypto/browser-sha3.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,aAAa;AACb,OAAO,UAAU,MAAM,+BAA+B,CAAC;AACvD,aAAa;AACb,OAAO,IAAI,MAAM,6BAA6B,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAa,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,kCAAkC,CAAC,CAAC;AAE9D,MAAM,UAAU,SAAS,CAAC,IAAe;IACvC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC/B,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAAe;IACpC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9B,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAAe;IACpC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9B,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,SAA6B,EAC7B,GAAc,EACd,IAAe;IAEf,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,IAAI,SAAS,KAAK,kBAAkB,CAAC,MAAM,EAAE;QAC3C,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;KACrC;SAAM,IAAI,SAAS,KAAK,kBAAkB,CAAC,MAAM,EAAE;QAClD,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;KACrC;IAED,MAAM,CAAC,UAAU,CACf,0BAA0B,GAAG,SAAS,EACtC,MAAM,CAAC,MAAM,CAAC,qBAAqB,EACnC;QACE,SAAS,EAAE,aAAa;QACxB,SAAS,EAAE,SAAS;KACrB,CACF,CAAC;IACF,OAAO,EAAE,CAAC;AACZ,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/crypto-browser.d.ts b/lib.esm/crypto/crypto-browser.d.ts deleted file mode 100644 index c1f839009..000000000 --- a/lib.esm/crypto/crypto-browser.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import ed448 from "./browser-ed448.js"; -export { ed448 }; -export { Ed448Goldilock } from "./ed448goldilock-browser.js"; -declare global { - interface Window { - } - const window: Window; - const self: Window; -} -export interface CryptoHasher { - update(data: Uint8Array): CryptoHasher; - digest(): Uint8Array; -} -export declare function createHash(algo: string): CryptoHasher; -export declare function createHmac(_algo: string, key: Uint8Array): CryptoHasher; -export declare function pbkdf2Sync(password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, _algo: "sha256" | "sha512"): Uint8Array; -export declare function randomBytes(length: number): Uint8Array; -//# sourceMappingURL=crypto-browser.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/crypto-browser.d.ts.map b/lib.esm/crypto/crypto-browser.d.ts.map deleted file mode 100644 index 74fb87c78..000000000 --- a/lib.esm/crypto/crypto-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"crypto-browser.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/crypto-browser.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,oBAAoB,CAAC;AAGvC,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;KAAG;IAEnB,MAAM,MAAM,EAAE,MAAM,CAAC;IAErB,MAAM,IAAI,EAAE,MAAM,CAAC;CACpB;AAkBD,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAAC;IACvC,MAAM,IAAI,UAAU,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAYrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,GAAG,YAAY,CAIvE;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,UAAU,EACpB,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,QAAQ,GAAG,QAAQ,GACzB,UAAU,CAIZ;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAoBtD"} \ No newline at end of file diff --git a/lib.esm/crypto/crypto-browser.js b/lib.esm/crypto/crypto-browser.js deleted file mode 100644 index 1697aceef..000000000 --- a/lib.esm/crypto/crypto-browser.js +++ /dev/null @@ -1,57 +0,0 @@ -/* Browser Crypto Shims */ -import { hmac } from "@noble/hashes/hmac"; -import { pbkdf2 } from "@noble/hashes/pbkdf2"; -import { sha256 } from "@noble/hashes/sha256"; -import { sha512 } from "@noble/hashes/sha512"; -import { sha3_256, sha3_512 } from "@noble/hashes/sha3"; -import ed448 from "./browser-ed448.js"; -import { assert, assertArgument } from "../utils/index.js"; -export { ed448 }; -export { Ed448Goldilock } from "./ed448goldilock-browser.js"; -function getGlobal() { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw new Error("unable to locate global object"); -} -const anyGlobal = getGlobal(); -const crypto = anyGlobal.crypto || anyGlobal.msCrypto; -export function createHash(algo) { - switch (algo) { - case "sha256": - return sha256.create(); - case "sha512": - return sha512.create(); - case "sha3-256": - return sha3_256.create(); - case "sha3-512": - return sha3_512.create(); - } - assertArgument(false, "invalid hashing algorithm name", "algorithm", algo); -} -export function createHmac(_algo, key) { - const algo = { sha256, sha512 }[_algo]; - assertArgument(algo != null, "invalid hmac algorithm", "algorithm", _algo); - return hmac.create(algo, key); -} -export function pbkdf2Sync(password, salt, iterations, keylen, _algo) { - const algo = { sha256, sha512 }[_algo]; - assertArgument(algo != null, "invalid pbkdf2 algorithm", "algorithm", _algo); - return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen }); -} -export function randomBytes(length) { - assert(crypto != null, "platform does not support secure random numbers", "UNSUPPORTED_OPERATION", { - operation: "randomBytes", - }); - assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, "invalid length", "length", length); - const result = new Uint8Array(length); - crypto.getRandomValues(result); - return result; -} -//# sourceMappingURL=crypto-browser.js.map \ No newline at end of file diff --git a/lib.esm/crypto/crypto-browser.js.map b/lib.esm/crypto/crypto-browser.js.map deleted file mode 100644 index 2b85d47e0..000000000 --- a/lib.esm/crypto/crypto-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"crypto-browser.js","sourceRoot":"","sources":["../../src.ts/crypto/crypto-browser.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,MAAM,oBAAoB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAU7D,SAAS,SAAS;IAChB,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC/B,OAAO,IAAI,CAAC;KACb;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC;KACf;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC;KACf;IACD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AAC9B,MAAM,MAAM,GAAQ,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC,Q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,CAAC;IAEF,cAAc,CACZ,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,IAAI,IAAI,EACxD,gBAAgB,EAChB,QAAQ,EACR,MAAM,CACP,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/crypto.d.ts b/lib.esm/crypto/crypto.d.ts deleted file mode 100644 index 56e369d6c..000000000 --- a/lib.esm/crypto/crypto.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import ed448 from "./ed448.js"; -export { ed448 }; -export { Ed448Goldilock } from "./ed448goldilock.js"; -export { createHash, createHmac, pbkdf2Sync, randomBytes } from "crypto"; -//# sourceMappingURL=crypto.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/crypto.d.ts.map b/lib.esm/crypto/crypto.d.ts.map deleted file mode 100644 index a472d84a5..000000000 --- a/lib.esm/crypto/crypto.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/crypto.js b/lib.esm/crypto/crypto.js deleted file mode 100644 index 76c6f3a16..000000000 --- a/lib.esm/crypto/crypto.js +++ /dev/null @@ -1,5 +0,0 @@ -import ed448 from "./ed448.js"; -export { ed448 }; -export { Ed448Goldilock } from "./ed448goldilock.js"; -export { createHash, createHmac, pbkdf2Sync, randomBytes } from "crypto"; -//# sourceMappingURL=crypto.js.map \ No newline at end of file diff --git a/lib.esm/crypto/crypto.js.map b/lib.esm/crypto/crypto.js.map deleted file mode 100644 index 5b22aa525..000000000 --- a/lib.esm/crypto/crypto.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src.ts/crypto/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/ed448.d.ts b/lib.esm/crypto/ed448.d.ts deleted file mode 100644 index 5dfe597f9..000000000 --- a/lib.esm/crypto/ed448.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import ed448 from "bcrypto/lib/ed448.js"; -export default ed448; -//# sourceMappingURL=ed448.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/ed448.d.ts.map b/lib.esm/crypto/ed448.d.ts.map deleted file mode 100644 index 19085a96e..000000000 --- a/lib.esm/crypto/ed448.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ed448.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,sBAAsB,CAAC;AAEzC,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/ed448.js b/lib.esm/crypto/ed448.js deleted file mode 100644 index 48ace1601..000000000 --- a/lib.esm/crypto/ed448.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -// @ts-ignore -import ed448 from "bcrypto/lib/ed448.js"; -export default ed448; -//# sourceMappingURL=ed448.js.map \ No newline at end of file diff --git a/lib.esm/crypto/ed448.js.map b/lib.esm/crypto/ed448.js.map deleted file mode 100644 index 2b5a73716..000000000 --- a/lib.esm/crypto/ed448.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448.js","sourceRoot":"","sources":["../../src.ts/crypto/ed448.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,aAAa;AACb,OAAO,KAAK,MAAM,sBAAsB,CAAC;AAEzC,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/ed448goldilock-browser.d.ts b/lib.esm/crypto/ed448goldilock-browser.d.ts deleted file mode 100644 index 675f772fa..000000000 --- a/lib.esm/crypto/ed448goldilock-browser.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export declare class Ed448Goldilock { - static _channel: any; - static generatePrivateKey(): any; - static getPublicKeyFromPrivateKey(privateKey: string): string; - static signWithPrivateKey(privateKey: string, msg: string): string; - static signWithPrivateKeyNConcatPubkey(privateKey: string, msg: string): string; - static verifySignature(msgHash: string, signedMsg: string, pubKey: string): boolean; - static SHA512Hash(password: string, salt: string): string; - static concatenateAndHex(prefix: number, key: string, index: number, salt: string): string; - static addScalar(a: string, b: string): string; - static seedToExtendedPrivate(seed: string): string; - static childPrivateToPrivate(s: string, index: number): string; - static HDWalletGenerateKeyFromSeed(seed: string, index: number): string; -} -//# sourceMappingURL=ed448goldilock-browser.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/ed448goldilock-browser.d.ts.map b/lib.esm/crypto/ed448goldilock-browser.d.ts.map deleted file mode 100644 index 754f2764a..000000000 --- a/lib.esm/crypto/ed448goldilock-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448goldilock-browser.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ed448goldilock-browser.ts"],"names":[],"mappings":"AAOA,qBAAa,cAAc;IACzB,MAAM,CAAC,QAAQ,MAAS;IAExB,MAAM,CAAC,kBAAkB;IAMzB,MAAM,CAAC,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAc7D,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAqBlE,MAAM,CAAC,+BAA+B,CACpC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,GACV,MAAM;IAMT,MAAM,CAAC,eAAe,CACpB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,OAAO;IAIV,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAQzD,MAAM,CAAC,iBAAiB,CACtB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,MAAM;IAaT,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM;IAc9C,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiBlD,MAAM,CAAC,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAgBrD,MAAM,CAAC,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;CASxE"} \ No newline at end of file diff --git a/lib.esm/crypto/ed448goldilock-browser.js b/lib.esm/crypto/ed448goldilock-browser.js deleted file mode 100644 index 5449803c2..000000000 --- a/lib.esm/crypto/ed448goldilock-browser.js +++ /dev/null @@ -1,119 +0,0 @@ -// @ts-ignore -import ed448 from "./browser-ed448.js"; -// @ts-ignore -import pbkdf2 from "./pbkdf2-browser.js"; -// @ts-ignore -import SHA3_512 from "bcrypto/lib/sha3-512.js"; -export class Ed448Goldilock { - static _channel = ed448; - static generatePrivateKey() { - var privateKey = ed448.privateKeyGenerate(); - privateKey[56] &= 0x7f; - return privateKey; - } - static getPublicKeyFromPrivateKey(privateKey) { - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var scalar = secret.slice(0, 56); - scalar[0] &= 0xfc; - scalar[55] |= 0x80; - var publicKey = this._channel.publicKeyFromScalar(scalar); - return Buffer.from(publicKey).toString("hex"); - } - else { - var publicKey = this._channel.publicKeyCreate(secret); - return Buffer.from(publicKey).toString("hex"); - } - } - static signWithPrivateKey(privateKey, msg) { - var msgToSign = Buffer.from(msg, "hex"); - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var prefix = secret.slice(0, 57); - prefix[0] &= 0xfc; - prefix[56] = 0; - prefix[55] |= 0x80; - var scalar = prefix.slice(0, 56); - var signedMessage = this._channel.signWithScalar(msgToSign, scalar, prefix); - return Buffer.from(signedMessage).toString("hex"); - } - else { - var signedMessage = this._channel.sign(msgToSign, secret); - return Buffer.from(signedMessage).toString("hex"); - } - } - static signWithPrivateKeyNConcatPubkey(privateKey, msg) { - var signedMessage = Ed448Goldilock.signWithPrivateKey(privateKey, msg); - var publicKey = Ed448Goldilock.getPublicKeyFromPrivateKey(privateKey); - return signedMessage + publicKey; - } - static verifySignature(msgHash, signedMsg, pubKey) { - return this._channel.verify(msgHash, signedMsg, pubKey); - } - static SHA512Hash(password, salt) { - var p1 = Buffer.from(password, "hex"); - var s1 = Buffer.from(salt, "hex"); - return Buffer.from(pbkdf2.derive(SHA3_512, p1, s1, 2048, 57)).toString("hex"); - } - static concatenateAndHex(prefix, key, index, salt) { - var ind = Buffer.alloc(4); - var p = Buffer.alloc(1); - p[0] = prefix % 256; - var j = index; - for (let i = 0; i < 4; i++) { - ind[i] = j % 256; - j = Math.floor(j / 256); - } - var t = p.toString("hex") + key + ind.toString("hex"); - return Ed448Goldilock.SHA512Hash(t, salt); - } - static addScalar(a, b) { - var a1 = Buffer.from(a, "hex"); - var b1 = Buffer.from(b.substr(0, 106) + "00000000", "hex"); - b1[0] &= 0xfc; - var c = Buffer.alloc(57); - var hold = 0; - for (let i = 0; i < 57; i++) { - hold += a1[i] + b1[i]; - c[i] = hold % 256; - hold = Math.floor(hold / 256); - } - return c.toString("hex"); - } - static seedToExtendedPrivate(seed) { - var s1 = Ed448Goldilock.SHA512Hash(seed, "6d6e656d6f6e6963666f72746865636861696e"); - var s2 = Ed448Goldilock.SHA512Hash(seed, "6d6e656d6f6e6963666f727468656b6579"); - var b = Buffer.from(s2, "hex"); - b[56] |= 0x80; - b[55] |= 0x80; - b[55] &= 0xbf; - var s3 = b.toString("hex"); - return s1 + s3; - } - static childPrivateToPrivate(s, index) { - var s0 = s.substr(0, 114); - var s1 = s.substr(114, 228); - var r0, r1; - if (index >= 0x80000000) { - r0 = Ed448Goldilock.concatenateAndHex(1, s1, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(0, s1, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } - else { - var pub = Ed448Goldilock.getPublicKeyFromPrivateKey(s1); - r0 = Ed448Goldilock.concatenateAndHex(3, pub, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(2, pub, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } - } - static HDWalletGenerateKeyFromSeed(seed, index) { - var m = Ed448Goldilock.seedToExtendedPrivate(seed); - var k1 = Ed448Goldilock.childPrivateToPrivate(m, 0x80000000 + 44); - var k2 = Ed448Goldilock.childPrivateToPrivate(k1, 0x80000000 + 654); - var k3 = Ed448Goldilock.childPrivateToPrivate(k2, 0x80000000 + 0); - var k4 = Ed448Goldilock.childPrivateToPrivate(k3, 0x80000000 + 0); - var k5 = Ed448Goldilock.childPrivateToPrivate(k4, index); - return k5.substr(114, 228); - } -} -//# sourceMappingURL=ed448goldilock-browser.js.map \ No newline at end of file diff --git a/lib.esm/crypto/ed448goldilock-browser.js.map b/lib.esm/crypto/ed448goldilock-browser.js.map deleted file mode 100644 index 0c86f3ffe..000000000 --- a/lib.esm/crypto/ed448goldilock-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448goldilock-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GAAG,CAAC,CAAC;QACpE,IAAI,EAAE,GAAG,cAAc,CAAC,qBAAqB,CAAC,EAAE,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC;QAClE,IAAI,EAAE,GAAG,cAAc,CAAC,qBAAqB,CAAC,EAAE,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC;QAClE,IAAI,EAAE,GAAG,cAAc,CAAC,qBAAqB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACzD,OAAO,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/ed448goldilock.d.ts b/lib.esm/crypto/ed448goldilock.d.ts deleted file mode 100644 index 737cae0a1..000000000 --- a/lib.esm/crypto/ed448goldilock.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export declare class Ed448Goldilock { - static _channel: any; - static generatePrivateKey(): any; - static getPublicKeyFromPrivateKey(privateKey: string): string; - static signWithPrivateKey(privateKey: string, msg: string): string; - static signWithPrivateKeyNConcatPubkey(privateKey: string, msg: string): string; - static verifySignature(msgHash: string, signedMsg: string, pubKey: string): boolean; - static SHA512Hash(password: string, salt: string): string; - static concatenateAndHex(prefix: number, key: string, index: number, salt: string): string; - static addScalar(a: string, b: string): string; - static seedToExtendedPrivate(seed: string): string; - static childPrivateToPrivate(s: string, index: number): string; - static HDWalletGenerateKeyFromSeed(seed: string, index: number): string; -} -//# sourceMappingURL=ed448goldilock.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/ed448goldilock.d.ts.map b/lib.esm/crypto/ed448goldilock.d.ts.map deleted file mode 100644 index 34092c2fe..000000000 --- a/lib.esm/crypto/ed448goldilock.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448goldilock.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ed448goldilock.ts"],"names":[],"mappings":"AAOA,qBAAa,cAAc;IACzB,MAAM,CAAC,QAAQ,MAAS;IAExB,MAAM,CAAC,kBAAkB;IAMzB,MAAM,CAAC,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAc7D,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAqBlE,MAAM,CAAC,+BAA+B,CACpC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,GACV,MAAM;IAMT,MAAM,CAAC,eAAe,CACpB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,OAAO;IAIV,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAQzD,MAAM,CAAC,iBAAiB,CACtB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,MAAM;IAaT,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM;IAc9C,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiBlD,MAAM,CAAC,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAgBrD,MAAM,CAAC,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;CASxE"} \ No newline at end of file diff --git a/lib.esm/crypto/ed448goldilock.js b/lib.esm/crypto/ed448goldilock.js deleted file mode 100644 index 33142b5e7..000000000 --- a/lib.esm/crypto/ed448goldilock.js +++ /dev/null @@ -1,119 +0,0 @@ -// @ts-ignore -import ed448 from "bcrypto/lib/ed448.js"; -// @ts-ignore -import pbkdf2 from "bcrypto/lib/pbkdf2.js"; -// @ts-ignore -import SHA3_512 from "bcrypto/lib/sha3-512.js"; -export class Ed448Goldilock { - static _channel = ed448; - static generatePrivateKey() { - var privateKey = ed448.privateKeyGenerate(); - privateKey[56] &= 0x7f; - return privateKey; - } - static getPublicKeyFromPrivateKey(privateKey) { - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var scalar = secret.slice(0, 56); - scalar[0] &= 0xfc; - scalar[55] |= 0x80; - var publicKey = this._channel.publicKeyFromScalar(scalar); - return Buffer.from(publicKey).toString("hex"); - } - else { - var publicKey = this._channel.publicKeyCreate(secret); - return Buffer.from(publicKey).toString("hex"); - } - } - static signWithPrivateKey(privateKey, msg) { - var msgToSign = Buffer.from(msg, "hex"); - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var prefix = secret.slice(0, 57); - prefix[0] &= 0xfc; - prefix[56] = 0; - prefix[55] |= 0x80; - var scalar = prefix.slice(0, 56); - var signedMessage = this._channel.signWithScalar(msgToSign, scalar, prefix); - return Buffer.from(signedMessage).toString("hex"); - } - else { - var signedMessage = this._channel.sign(msgToSign, secret); - return Buffer.from(signedMessage).toString("hex"); - } - } - static signWithPrivateKeyNConcatPubkey(privateKey, msg) { - var signedMessage = Ed448Goldilock.signWithPrivateKey(privateKey, msg); - var publicKey = Ed448Goldilock.getPublicKeyFromPrivateKey(privateKey); - return signedMessage + publicKey; - } - static verifySignature(msgHash, signedMsg, pubKey) { - return this._channel.verify(msgHash, signedMsg, pubKey); - } - static SHA512Hash(password, salt) { - var p1 = Buffer.from(password, "hex"); - var s1 = Buffer.from(salt, "hex"); - return Buffer.from(pbkdf2.derive(SHA3_512, p1, s1, 2048, 57)).toString("hex"); - } - static concatenateAndHex(prefix, key, index, salt) { - var ind = Buffer.alloc(4); - var p = Buffer.alloc(1); - p[0] = prefix % 256; - var j = index; - for (let i = 0; i < 4; i++) { - ind[i] = j % 256; - j = Math.floor(j / 256); - } - var t = p.toString("hex") + key + ind.toString("hex"); - return Ed448Goldilock.SHA512Hash(t, salt); - } - static addScalar(a, b) { - var a1 = Buffer.from(a, "hex"); - var b1 = Buffer.from(b.substr(0, 106) + "00000000", "hex"); - b1[0] &= 0xfc; - var c = Buffer.alloc(57); - var hold = 0; - for (let i = 0; i < 57; i++) { - hold += a1[i] + b1[i]; - c[i] = hold % 256; - hold = Math.floor(hold / 256); - } - return c.toString("hex"); - } - static seedToExtendedPrivate(seed) { - var s1 = Ed448Goldilock.SHA512Hash(seed, "6d6e656d6f6e6963666f72746865636861696e"); - var s2 = Ed448Goldilock.SHA512Hash(seed, "6d6e656d6f6e6963666f727468656b6579"); - var b = Buffer.from(s2, "hex"); - b[56] |= 0x80; - b[55] |= 0x80; - b[55] &= 0xbf; - var s3 = b.toString("hex"); - return s1 + s3; - } - static childPrivateToPrivate(s, index) { - var s0 = s.substr(0, 114); - var s1 = s.substr(114, 228); - var r0, r1; - if (index >= 0x80000000) { - r0 = Ed448Goldilock.concatenateAndHex(1, s1, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(0, s1, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } - else { - var pub = Ed448Goldilock.getPublicKeyFromPrivateKey(s1); - r0 = Ed448Goldilock.concatenateAndHex(3, pub, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(2, pub, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } - } - static HDWalletGenerateKeyFromSeed(seed, index) { - var m = Ed448Goldilock.seedToExtendedPrivate(seed); - var k1 = Ed448Goldilock.childPrivateToPrivate(m, 0x80000000 + 44); - var k2 = Ed448Goldilock.childPrivateToPrivate(k1, 0x80000000 + 654); - var k3 = Ed448Goldilock.childPrivateToPrivate(k2, 0x80000000 + 0); - var k4 = Ed448Goldilock.childPrivateToPrivate(k3, 0x80000000 + 0); - var k5 = Ed448Goldilock.childPrivateToPrivate(k4, index); - return k5.substr(114, 228); - } -} -//# sourceMappingURL=ed448goldilock.js.map \ No newline at end of file diff --git a/lib.esm/crypto/ed448goldilock.js.map b/lib.esm/crypto/ed448goldilock.js.map deleted file mode 100644 index 778ebc095..000000000 --- a/lib.esm/crypto/ed448goldilock.js.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CAAC,qBAAqB,CAAC,EAAE,EAAE,UAAU,GAAG,GAAG,CAAC,CAAC;QACpE,IAAI,EAAE,GAAG,cAAc,CAAC,qBAAqB,CAAC,EAAE,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC;QAClE,IAAI,EAAE,GAAG,cAAc,CAAC,qBAAqB,CAAC,EAAE,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC;QAClE,IAAI,EAAE,GAAG,cAAc,CAAC,qBAAqB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACzD,OAAO,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/hmac.d.ts b/lib.esm/crypto/hmac.d.ts deleted file mode 100644 index 4c5e3227d..000000000 --- a/lib.esm/crypto/hmac.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { BytesLike } from "../utils/index.js"; -/** - * Return the HMAC for %%data%% using the %%key%% key with the underlying - * %%algo%% used for compression. - * - * @example: - * key = id("some-secret") - * - * // Compute the HMAC - * computeHmac("sha256", key, "0x1337") - * //_result: - * - * // To compute the HMAC of UTF-8 data, the data must be - * // converted to UTF-8 bytes - * computeHmac("sha256", key, toUtf8Bytes("Hello World")) - * //_result: - * - */ -export declare function computeHmac(algorithm: "sha256" | "sha512", _key: BytesLike, _data: BytesLike): string; -export declare namespace computeHmac { - var _: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike; - var lock: () => void; - var register: (func: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike) => void; -} -//# sourceMappingURL=hmac.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/hmac.d.ts.map b/lib.esm/crypto/hmac.d.ts.map deleted file mode 100644 index 49d9b637c..000000000 --- a/lib.esm/crypto/hmac.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/hmac.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAcnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAC9B,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,SAAS,GACf,MAAM,CAIR;yBARe,WAAW"} \ No newline at end of file diff --git a/lib.esm/crypto/hmac.js b/lib.esm/crypto/hmac.js deleted file mode 100644 index 2c3d0f7e1..000000000 --- a/lib.esm/crypto/hmac.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * An **HMAC** enables verification that a given key was used - * to authenticate a payload. - * - * See: [[link-wiki-hmac]] - * - * @_subsection: api/crypto:HMAC [about-hmac] - */ -import { createHmac } from "./crypto.js"; -import { getBytes, hexlify } from "../utils/index.js"; -let locked = false; -const _computeHmac = function (algorithm, key, data) { - return createHmac(algorithm, key).update(data).digest(); -}; -let __computeHmac = _computeHmac; -/** - * Return the HMAC for %%data%% using the %%key%% key with the underlying - * %%algo%% used for compression. - * - * @example: - * key = id("some-secret") - * - * // Compute the HMAC - * computeHmac("sha256", key, "0x1337") - * //_result: - * - * // To compute the HMAC of UTF-8 data, the data must be - * // converted to UTF-8 bytes - * computeHmac("sha256", key, toUtf8Bytes("Hello World")) - * //_result: - * - */ -export function computeHmac(algorithm, _key, _data) { - const key = getBytes(_key, "key"); - const data = getBytes(_data, "data"); - return hexlify(__computeHmac(algorithm, key, data)); -} -computeHmac._ = _computeHmac; -computeHmac.lock = function () { - locked = true; -}; -computeHmac.register = function (func) { - if (locked) { - throw new Error("computeHmac is locked"); - } - __computeHmac = func; -}; -Object.freeze(computeHmac); -//# sourceMappingURL=hmac.js.map \ No newline at end of file diff --git a/lib.esm/crypto/hmac.js.map b/lib.esm/crypto/hmac.js.map deleted file mode 100644 index e854d8821..000000000 --- a/lib.esm/crypto/hmac.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hmac.js","sourceRoot":"","sources":["../../src.ts/crypto/hmac.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAItD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,UACnB,SAA8B,EAC9B,GAAe,EACf,IAAgB;IAEhB,OAAO,UAAU,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC1D,CAAC,CAAC;AAEF,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,WAAW,CACzB,SAA8B,EAC9B,IAAe,EACf,KAAgB;IAEhB,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,aAAa,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACtD,CAAC;AACD,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAG;IACjB,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC,CAAC;AACF,WAAW,CAAC,QAAQ,GAAG,UACrB,IAIc;IAEd,IAAI,MAAM,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAC1C;IACD,aAAa,GAAG,IAAI,CAAC;AACvB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/index.d.ts b/lib.esm/crypto/index.d.ts deleted file mode 100644 index 0730e25c8..000000000 --- a/lib.esm/crypto/index.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A fundamental building block of Core is the underlying - * cryptographic primitives. - * - * @_section: api/crypto:Cryptographic Functions [about-crypto] - */ -import { computeHmac } from "./hmac.js"; -import { ripemd160 } from "./ripemd160.js"; -import { pbkdf2 } from "./pbkdf2.js"; -import { randomBytes } from "./random.js"; -import { scrypt, scryptSync } from "./scrypt.js"; -import { sha256, sha512 } from "./sha3.js"; -import { Ed448Goldilock } from "./crypto.js"; -import { keccak256 } from "./keccak.js"; -export { computeHmac, randomBytes, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, keccak256, Ed448Goldilock, }; -export { SigningKey } from "./signing-key.js"; -export { Signature } from "./signature.js"; -declare function lock(): void; -export { lock }; -export type { ProgressCallback } from "./scrypt.js"; -export type { SignatureLike } from "./signature.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/index.d.ts.map b/lib.esm/crypto/index.d.ts.map deleted file mode 100644 index 153bb6fd7..000000000 --- a/lib.esm/crypto/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,cAAc,GACf,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,iBAAS,IAAI,IAAI,IAAI,CAUpB;AAED,OAAO,EAAE,IAAI,EAAE,CAAC;AAKhB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/index.js b/lib.esm/crypto/index.js deleted file mode 100644 index 95c2fdfce..000000000 --- a/lib.esm/crypto/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * A fundamental building block of Core is the underlying - * cryptographic primitives. - * - * @_section: api/crypto:Cryptographic Functions [about-crypto] - */ -null; -// We import all these so we can export lock() -import { computeHmac } from "./hmac.js"; -import { ripemd160 } from "./ripemd160.js"; -import { pbkdf2 } from "./pbkdf2.js"; -import { randomBytes } from "./random.js"; -import { scrypt, scryptSync } from "./scrypt.js"; -import { sha256, sha512 } from "./sha3.js"; -import { Ed448Goldilock } from "./crypto.js"; -import { keccak256 } from "./keccak.js"; -export { computeHmac, randomBytes, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, keccak256, Ed448Goldilock, }; -export { SigningKey } from "./signing-key.js"; -export { Signature } from "./signature.js"; -function lock() { - computeHmac.lock(); - pbkdf2.lock(); - randomBytes.lock(); - ripemd160.lock(); - scrypt.lock(); - scryptSync.lock(); - sha256.lock(); - sha512.lock(); - randomBytes.lock(); -} -export { lock }; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.esm/crypto/index.js.map b/lib.esm/crypto/index.js.map deleted file mode 100644 index 747390a20..000000000 --- a/lib.esm/crypto/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,IAAI,CAAC;AAEL,8CAA8C;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,cAAc,GACf,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,SAAS,IAAI;IACX,WAAW,CAAC,IAAI,EAAE,CAAC;IACnB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,WAAW,CAAC,IAAI,EAAE,CAAC;IACnB,SAAS,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,UAAU,CAAC,IAAI,EAAE,CAAC;IAClB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,WAAW,CAAC,IAAI,EAAE,CAAC;AACrB,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/keccak.d.ts b/lib.esm/crypto/keccak.d.ts deleted file mode 100644 index 533f46dc6..000000000 --- a/lib.esm/crypto/keccak.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Cryptographic hashing functions - * - * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] - */ -import type { BytesLike } from "../utils/index.js"; -/** - * Compute the cryptographic KECCAK256 hash of %%data%%. - * - * The %%data%% **must** be a data representation, to compute the - * hash of UTF-8 data use the [[id]] function. - * - * @returns DataHexstring - * @example: - * keccak256("0x") - * //_result: - * - * keccak256("0x1337") - * //_result: - * - * keccak256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - * // Strings are assumed to be DataHexString, otherwise it will - * // throw. To hash UTF-8 data, see the note above. - * keccak256("Hello World") - * //_error: - */ -export declare function keccak256(_data: BytesLike): string; -export declare namespace keccak256 { - var _: (data: Uint8Array) => Uint8Array; - var lock: () => void; - var register: (func: (data: Uint8Array) => BytesLike) => void; -} -//# sourceMappingURL=keccak.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/keccak.d.ts.map b/lib.esm/crypto/keccak.d.ts.map deleted file mode 100644 index 2f0a88fb1..000000000 --- a/lib.esm/crypto/keccak.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keccak.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/keccak.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAUnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGlD;yBAHe,SAAS"} \ No newline at end of file diff --git a/lib.esm/crypto/keccak.js b/lib.esm/crypto/keccak.js deleted file mode 100644 index b22f2aafc..000000000 --- a/lib.esm/crypto/keccak.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Cryptographic hashing functions - * - * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] - */ -import { keccak_256 } from "@noble/hashes/sha3"; -import { getBytes, hexlify } from "../utils/index.js"; -let locked = false; -const _keccak256 = function (data) { - return keccak_256(data); -}; -let __keccak256 = _keccak256; -/** - * Compute the cryptographic KECCAK256 hash of %%data%%. - * - * The %%data%% **must** be a data representation, to compute the - * hash of UTF-8 data use the [[id]] function. - * - * @returns DataHexstring - * @example: - * keccak256("0x") - * //_result: - * - * keccak256("0x1337") - * //_result: - * - * keccak256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - * // Strings are assumed to be DataHexString, otherwise it will - * // throw. To hash UTF-8 data, see the note above. - * keccak256("Hello World") - * //_error: - */ -export function keccak256(_data) { - const data = getBytes(_data, "data"); - return hexlify(__keccak256(data)); -} -keccak256._ = _keccak256; -keccak256.lock = function () { - locked = true; -}; -keccak256.register = function (func) { - if (locked) { - throw new TypeError("keccak256 is locked"); - } - __keccak256 = func; -}; -Object.freeze(keccak256); -//# sourceMappingURL=keccak.js.map \ No newline at end of file diff --git a/lib.esm/crypto/keccak.js.map b/lib.esm/crypto/keccak.js.map deleted file mode 100644 index de46c417c..000000000 --- a/lib.esm/crypto/keccak.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keccak.js","sourceRoot":"","sources":["../../src.ts/crypto/keccak.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAItD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAAG,UAAU,IAAgB;IAC3C,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC,CAAC;AAEF,IAAI,WAAW,GAAoC,UAAU,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,SAAS,CAAC,KAAgB;IACxC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACpC,CAAC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG;IACf,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC,CAAC;AACF,SAAS,CAAC,QAAQ,GAAG,UAAU,IAAqC;IAClE,IAAI,MAAM,EAAE;QACV,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAC5C;IACD,WAAW,GAAG,IAAI,CAAC;AACrB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/pbkdf2-browser.d.ts b/lib.esm/crypto/pbkdf2-browser.d.ts deleted file mode 100644 index 31ae18ebe..000000000 --- a/lib.esm/crypto/pbkdf2-browser.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import pbkdf2 from "bcrypto/lib/pbkdf2-browser.js"; -export default pbkdf2; -//# sourceMappingURL=pbkdf2-browser.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/pbkdf2-browser.d.ts.map b/lib.esm/crypto/pbkdf2-browser.d.ts.map deleted file mode 100644 index a7519b4b4..000000000 --- a/lib.esm/crypto/pbkdf2-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pbkdf2-browser.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2-browser.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/pbkdf2-browser.js b/lib.esm/crypto/pbkdf2-browser.js deleted file mode 100644 index 8550191c1..000000000 --- a/lib.esm/crypto/pbkdf2-browser.js +++ /dev/null @@ -1,4 +0,0 @@ -// @ts-ignore -import pbkdf2 from "bcrypto/lib/pbkdf2-browser.js"; -export default pbkdf2; -//# sourceMappingURL=pbkdf2-browser.js.map \ No newline at end of file diff --git a/lib.esm/crypto/pbkdf2-browser.js.map b/lib.esm/crypto/pbkdf2-browser.js.map deleted file mode 100644 index a393105da..000000000 --- a/lib.esm/crypto/pbkdf2-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pbkdf2-browser.js","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2-browser.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,OAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/pbkdf2.d.ts b/lib.esm/crypto/pbkdf2.d.ts deleted file mode 100644 index 400e9744f..000000000 --- a/lib.esm/crypto/pbkdf2.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * A **Password-Based Key-Derivation Function** is designed to create - * a sequence of bytes suitible as a **key** from a human-rememberable - * password. - * - * @_subsection: api/crypto:Passwords [about-pbkdf] - */ -import type { BytesLike } from "../utils/index.js"; -/** - * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using - * the %%salt%% and using %%iterations%% of %%algo%%. - * - * This PBKDF is outdated and should not be used in new projects, but is - * required to decrypt older files. - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the PBKDF2 - * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") - * //_result: - */ -export declare function pbkdf2(_password: BytesLike, _salt: BytesLike, iterations: number, keylen: number, algo: "sha256" | "sha512"): string; -export declare namespace pbkdf2 { - var _: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike; - var lock: () => void; - var register: (func: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike) => void; -} -//# sourceMappingURL=pbkdf2.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/pbkdf2.d.ts.map b/lib.esm/crypto/pbkdf2.d.ts.map deleted file mode 100644 index 99323c18c..000000000 --- a/lib.esm/crypto/pbkdf2.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pbkdf2.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAgBnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CACpB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,QAAQ,GAAG,QAAQ,GACxB,MAAM,CAIR;yBAVe,MAAM"} \ No newline at end of file diff --git a/lib.esm/crypto/pbkdf2.js b/lib.esm/crypto/pbkdf2.js deleted file mode 100644 index 2718db2cd..000000000 --- a/lib.esm/crypto/pbkdf2.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * A **Password-Based Key-Derivation Function** is designed to create - * a sequence of bytes suitible as a **key** from a human-rememberable - * password. - * - * @_subsection: api/crypto:Passwords [about-pbkdf] - */ -import { pbkdf2Sync } from "./crypto.js"; -import { getBytes, hexlify } from "../utils/index.js"; -let locked = false; -const _pbkdf2 = function (password, salt, iterations, keylen, algo) { - return pbkdf2Sync(password, salt, iterations, keylen, algo); -}; -let __pbkdf2 = _pbkdf2; -/** - * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using - * the %%salt%% and using %%iterations%% of %%algo%%. - * - * This PBKDF is outdated and should not be used in new projects, but is - * required to decrypt older files. - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the PBKDF2 - * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") - * //_result: - */ -export function pbkdf2(_password, _salt, iterations, keylen, algo) { - const password = getBytes(_password, "password"); - const salt = getBytes(_salt, "salt"); - return hexlify(__pbkdf2(password, salt, iterations, keylen, algo)); -} -pbkdf2._ = _pbkdf2; -pbkdf2.lock = function () { - locked = true; -}; -pbkdf2.register = function (func) { - if (locked) { - throw new Error("pbkdf2 is locked"); - } - __pbkdf2 = func; -}; -Object.freeze(pbkdf2); -//# sourceMappingURL=pbkdf2.js.map \ No newline at end of file diff --git a/lib.esm/crypto/pbkdf2.js.map b/lib.esm/crypto/pbkdf2.js.map deleted file mode 100644 index bf6be91b3..000000000 --- a/lib.esm/crypto/pbkdf2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pbkdf2.js","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAItD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,OAAO,GAAG,UACd,QAAoB,EACpB,IAAgB,EAChB,UAAkB,EAClB,MAAc,EACd,IAAyB;IAEzB,OAAO,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AAC9D,CAAC,CAAC;AAEF,IAAI,QAAQ,GAAG,OAAO,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,MAAM,CACpB,SAAoB,EACpB,KAAgB,EAChB,UAAkB,EAClB,MAAc,EACd,IAAyB;IAEzB,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACjD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACrE,CAAC;AACD,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC;AACnB,MAAM,CAAC,IAAI,GAAG;IACZ,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC,CAAC;AACF,MAAM,CAAC,QAAQ,GAAG,UAChB,IAMc;IAEd,IAAI,MAAM,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KACrC;IACD,QAAQ,GAAG,IAAI,CAAC;AAClB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/random.d.ts b/lib.esm/crypto/random.d.ts deleted file mode 100644 index fd9378000..000000000 --- a/lib.esm/crypto/random.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Return %%length%% bytes of cryptographically secure random data. - * - * @example: - * randomBytes(8) - * //_result: - */ -export declare function randomBytes(length: number): Uint8Array; -export declare namespace randomBytes { - var _: (length: number) => Uint8Array; - var lock: () => void; - var register: (func: (length: number) => Uint8Array) => void; -} -//# sourceMappingURL=random.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/random.d.ts.map b/lib.esm/crypto/random.d.ts.map deleted file mode 100644 index a907fd7ef..000000000 --- a/lib.esm/crypto/random.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAEtD;yBAFe,WAAW"} \ No newline at end of file diff --git a/lib.esm/crypto/random.js b/lib.esm/crypto/random.js deleted file mode 100644 index 5252676fe..000000000 --- a/lib.esm/crypto/random.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * A **Cryptographically Secure Random Value** is one that has been - * generated with additional care take to prevent side-channels - * from allowing others to detect it and prevent others from through - * coincidence generate the same values. - * - * @_subsection: api/crypto:Random Values [about-crypto-random] - */ -import { randomBytes as crypto_random } from "./crypto.js"; -let locked = false; -const _randomBytes = function (length) { - return new Uint8Array(crypto_random(length)); -}; -let __randomBytes = _randomBytes; -/** - * Return %%length%% bytes of cryptographically secure random data. - * - * @example: - * randomBytes(8) - * //_result: - */ -export function randomBytes(length) { - return __randomBytes(length); -} -randomBytes._ = _randomBytes; -randomBytes.lock = function () { - locked = true; -}; -randomBytes.register = function (func) { - if (locked) { - throw new Error("randomBytes is locked"); - } - __randomBytes = func; -}; -Object.freeze(randomBytes); -//# sourceMappingURL=random.js.map \ No newline at end of file diff --git a/lib.esm/crypto/random.js.map b/lib.esm/crypto/random.js.map deleted file mode 100644 index aa9ee631c..000000000 --- a/lib.esm/crypto/random.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"random.js","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAE3D,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,UAAU,MAAc;IAC3C,OAAO,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAG;IACjB,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC,CAAC;AACF,WAAW,CAAC,QAAQ,GAAG,UAAU,IAAoC;IACnE,IAAI,MAAM,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAC1C;IACD,aAAa,GAAG,IAAI,CAAC;AACvB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/ripemd160.d.ts b/lib.esm/crypto/ripemd160.d.ts deleted file mode 100644 index 27b7b4a1c..000000000 --- a/lib.esm/crypto/ripemd160.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { BytesLike } from "../utils/index.js"; -/** - * Compute the cryptographic RIPEMD-160 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * ripemd160("0x") - * //_result: - * - * ripemd160("0x1337") - * //_result: - * - * ripemd160(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ -export declare function ripemd160(_data: BytesLike): string; -export declare namespace ripemd160 { - var _: (data: Uint8Array) => Uint8Array; - var lock: () => void; - var register: (func: (data: Uint8Array) => BytesLike) => void; -} -//# sourceMappingURL=ripemd160.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/ripemd160.d.ts.map b/lib.esm/crypto/ripemd160.d.ts.map deleted file mode 100644 index 2eb29db41..000000000 --- a/lib.esm/crypto/ripemd160.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ripemd160.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ripemd160.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAUnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGlD;yBAHe,SAAS"} \ No newline at end of file diff --git a/lib.esm/crypto/ripemd160.js b/lib.esm/crypto/ripemd160.js deleted file mode 100644 index e099b22d9..000000000 --- a/lib.esm/crypto/ripemd160.js +++ /dev/null @@ -1,40 +0,0 @@ -import { ripemd160 as noble_ripemd160 } from "@noble/hashes/ripemd160"; -import { getBytes, hexlify } from "../utils/index.js"; -let locked = false; -const _ripemd160 = function (data) { - return noble_ripemd160(data); -}; -let __ripemd160 = _ripemd160; -/** - * Compute the cryptographic RIPEMD-160 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * ripemd160("0x") - * //_result: - * - * ripemd160("0x1337") - * //_result: - * - * ripemd160(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ -export function ripemd160(_data) { - const data = getBytes(_data, "data"); - return hexlify(__ripemd160(data)); -} -ripemd160._ = _ripemd160; -ripemd160.lock = function () { - locked = true; -}; -ripemd160.register = function (func) { - if (locked) { - throw new TypeError("ripemd160 is locked"); - } - __ripemd160 = func; -}; -Object.freeze(ripemd160); -//# sourceMappingURL=ripemd160.js.map \ No newline at end of file diff --git a/lib.esm/crypto/ripemd160.js.map b/lib.esm/crypto/ripemd160.js.map deleted file mode 100644 index c28940fc9..000000000 --- a/lib.esm/crypto/ripemd160.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ripemd160.js","sourceRoot":"","sources":["../../src.ts/crypto/ripemd160.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAItD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAAG,UAAU,IAAgB;IAC3C,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,IAAI,WAAW,GAAoC,UAAU,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,SAAS,CAAC,KAAgB;IACxC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACpC,CAAC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG;IACf,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC,CAAC;AACF,SAAS,CAAC,QAAQ,GAAG,UAAU,IAAqC;IAClE,IAAI,MAAM,EAAE;QACV,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAC5C;IACD,WAAW,GAAG,IAAI,CAAC;AACrB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/rlp.d.ts b/lib.esm/crypto/rlp.d.ts deleted file mode 100644 index 42970ab48..000000000 --- a/lib.esm/crypto/rlp.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { BytesLike } from "../utils/data.js"; -export declare function encode(object: any): string; -export declare function decode(data: BytesLike): any; -//# sourceMappingURL=rlp.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/rlp.d.ts.map b/lib.esm/crypto/rlp.d.ts.map deleted file mode 100644 index 6c9570fb1..000000000 --- a/lib.esm/crypto/rlp.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/rlp.ts"],"names":[],"mappings":"AAGA,OAAO,EAAY,SAAS,EAAwB,MAAM,kBAAkB,CAAC;AA+D7E,wBAAgB,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAE1C;AAkHD,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,GAAG,CAO3C"} \ No newline at end of file diff --git a/lib.esm/crypto/rlp.js b/lib.esm/crypto/rlp.js deleted file mode 100644 index 946c27b0d..000000000 --- a/lib.esm/crypto/rlp.js +++ /dev/null @@ -1,119 +0,0 @@ -"use strict"; -import { Logger } from "../logger/logger.js"; -import { arrayify, hexlify, isBytesLike } from "../utils/data.js"; -const logger = new Logger("rlp/0.0.1"); -function arrayifyInteger(value) { - const result = []; - while (value) { - // @ts-ignore - result.unshift(value & 0xff); - value >>= 8; - } - return result; -} -function unarrayifyInteger(data, offset, length) { - let result = 0; - for (let i = 0; i < length; i++) { - result = result * 256 + data[offset + i]; - } - return result; -} -function _encode(object) { - if (Array.isArray(object)) { - let payload = []; - object.forEach(function (child) { - payload = payload.concat(_encode(child)); - }); - if (payload.length <= 55) { - payload.unshift(0xc0 + payload.length); - return payload; - } - const length = arrayifyInteger(payload.length); - length.unshift(0xf7 + length.length); - return length.concat(payload); - } - if (!isBytesLike(object)) { - logger.throwArgumentError("RLP object must be BytesLike", "object", object); - } - const data = Array.prototype.slice.call(arrayify(object)); - if (data.length === 1 && data[0] <= 0x7f) { - return data; - } - else if (data.length <= 55) { - data.unshift(0x80 + data.length); - return data; - } - const length = arrayifyInteger(data.length); - length.unshift(0xb7 + length.length); - return length.concat(data); -} -export function encode(object) { - return hexlify(_encode(object)); -} -function _decodeChildren(data, offset, childOffset, length) { - const result = []; - while (childOffset < offset + 1 + length) { - const decoded = _decode(data, childOffset); - result.push(decoded.result); - childOffset += decoded.consumed; - if (childOffset > offset + 1 + length) { - logger.throwError("child data too short", Logger.errors.BUFFER_OVERRUN, {}); - } - } - return { consumed: 1 + length, result: result }; -} -// returns { consumed: number, result: Object } -function _decode(data, offset) { - if (data.length === 0) { - logger.throwError("data too short", Logger.errors.BUFFER_OVERRUN, {}); - } - // Array with extra length prefix - if (data[offset] >= 0xf8) { - const lengthLength = data[offset] - 0xf7; - if (offset + 1 + lengthLength > data.length) { - logger.throwError("data short segment too short", Logger.errors.BUFFER_OVERRUN, {}); - } - const length = unarrayifyInteger(data, offset + 1, lengthLength); - if (offset + 1 + lengthLength + length > data.length) { - logger.throwError("data long segment too short", Logger.errors.BUFFER_OVERRUN, {}); - } - return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); - } - else if (data[offset] >= 0xc0) { - const length = data[offset] - 0xc0; - if (offset + 1 + length > data.length) { - logger.throwError("data array too short", Logger.errors.BUFFER_OVERRUN, {}); - } - return _decodeChildren(data, offset, offset + 1, length); - } - else if (data[offset] >= 0xb8) { - const lengthLength = data[offset] - 0xb7; - if (offset + 1 + lengthLength > data.length) { - logger.throwError("data array too short", Logger.errors.BUFFER_OVERRUN, {}); - } - const length = unarrayifyInteger(data, offset + 1, lengthLength); - if (offset + 1 + lengthLength + length > data.length) { - logger.throwError("data array too short", Logger.errors.BUFFER_OVERRUN, {}); - } - const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); - return { consumed: 1 + lengthLength + length, result: result }; - } - else if (data[offset] >= 0x80) { - const length = data[offset] - 0x80; - if (offset + 1 + length > data.length) { - logger.throwError("data too short", Logger.errors.BUFFER_OVERRUN, {}); - } - const result = hexlify(data.slice(offset + 1, offset + 1 + length)); - return { consumed: 1 + length, result: result }; - } - return { consumed: 1, result: hexlify(data[offset]) }; -} -export function decode(data) { - const bytes = arrayify(data); - const decoded = _decode(bytes, 0); - if (decoded.consumed !== bytes.length) { - logger.throwArgumentError("invalid rlp data", "data", data); - } - return decoded.result; -} -//# sourceMappingURL=rlp.js.map \ No newline at end of file diff --git a/lib.esm/crypto/rlp.js.map b/lib.esm/crypto/rlp.js.map deleted file mode 100644 index 3b158f9a4..000000000 --- a/lib.esm/crypto/rlp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp.js","sourceRoot":"","sources":["../../src.ts/crypto/rlp.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAa,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE7E,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvC,SAAS,eAAe,CAAC,KAAa;IACpC,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,OAAO,KAAK,EAAE;QACZ,aAAa;QACb,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;QA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AAC,EAAE,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QACpE,OAAO,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;KACjD;IACD,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAAe;IACpC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAClC,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK,CAAC,MAAM,EAAE;QACrC,MAAM,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;KAC7D;IACD,OAAO,OAAO,CAAC,MAAM,CAAC;AACxB,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/scrypt.d.ts b/lib.esm/crypto/scrypt.d.ts deleted file mode 100644 index b0e678f52..000000000 --- a/lib.esm/crypto/scrypt.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -import type { BytesLike } from "../utils/index.js"; -/** - * A callback during long-running operations to update any - * UI or provide programatic access to the progress. - * - * The %%percent%% is a value between ``0`` and ``1``. - * - * @_docloc: api/crypto:Passwords - */ -export type ProgressCallback = (percent: number) => void; -/** - * The [[link-wiki-scrypt]] uses a memory and cpu hard method of - * derivation to increase the resource cost to brute-force a password - * for a given key. - * - * This means this algorithm is intentionally slow, and can be tuned to - * become slower. As computation and memory speed improve over time, - * increasing the difficulty maintains the cost of an attacker. - * - * For example, if a target time of 5 seconds is used, a legitimate user - * which knows their password requires only 5 seconds to unlock their - * account. A 6 character password has 68 billion possibilities, which - * would require an attacker to invest over 10,000 years of CPU time. This - * is of course a crude example (as password generally aren't random), - * but demonstrates to value of imposing large costs to decryption. - * - * For this reason, if building a UI which involved decrypting or - * encrypting datsa using scrypt, it is recommended to use a - * [[ProgressCallback]] (as event short periods can seem lik an eternity - * if the UI freezes). Including the phrase //"decrypting"// in the UI - * can also help, assuring the user their waiting is for a good reason. - * - * @_docloc: api/crypto:Passwords - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the scrypt - * scrypt(passwordBytes, salt, 1024, 8, 1, 16) - * //_result: - */ -export declare function scrypt(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback): Promise; -export declare namespace scrypt { - var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, onProgress?: ProgressCallback | undefined) => Promise; - var lock: () => void; - var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback | undefined) => Promise) => void; -} -/** - * Provides a synchronous variant of [[scrypt]]. - * - * This will completely lock up and freeze the UI in a browser and will - * prevent any event loop from progressing. For this reason, it is - * preferred to use the [async variant](scrypt). - * - * @_docloc: api/crypto:Passwords - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the scrypt - * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) - * //_result: - */ -export declare function scryptSync(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number): string; -export declare namespace scryptSync { - var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => Uint8Array; - var lock: () => void; - var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => BytesLike) => void; -} -//# sourceMappingURL=scrypt.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/scrypt.d.ts.map b/lib.esm/crypto/scrypt.d.ts.map deleted file mode 100644 index b8a706e0e..000000000 --- a/lib.esm/crypto/scrypt.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scrypt.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/scrypt.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AA6CzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,MAAM,CAC1B,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,SAAS,EAChB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAIjB;yBAZqB,MAAM;;;;;AAmC5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,SAAS,EAChB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,GACZ,MAAM,CAIR;yBAXe,UAAU"} \ No newline at end of file diff --git a/lib.esm/crypto/scrypt.js b/lib.esm/crypto/scrypt.js deleted file mode 100644 index 1ee42ee88..000000000 --- a/lib.esm/crypto/scrypt.js +++ /dev/null @@ -1,103 +0,0 @@ -import { scrypt as _nobleSync, scryptAsync as _nobleAsync, } from "@noble/hashes/scrypt"; -import { getBytes, hexlify as H } from "../utils/index.js"; -let lockedSync = false, lockedAsync = false; -const _scryptAsync = async function (passwd, salt, N, r, p, dkLen, onProgress) { - return await _nobleAsync(passwd, salt, { N, r, p, dkLen, onProgress }); -}; -const _scryptSync = function (passwd, salt, N, r, p, dkLen) { - return _nobleSync(passwd, salt, { N, r, p, dkLen }); -}; -let __scryptAsync = _scryptAsync; -let __scryptSync = _scryptSync; -/** - * The [[link-wiki-scrypt]] uses a memory and cpu hard method of - * derivation to increase the resource cost to brute-force a password - * for a given key. - * - * This means this algorithm is intentionally slow, and can be tuned to - * become slower. As computation and memory speed improve over time, - * increasing the difficulty maintains the cost of an attacker. - * - * For example, if a target time of 5 seconds is used, a legitimate user - * which knows their password requires only 5 seconds to unlock their - * account. A 6 character password has 68 billion possibilities, which - * would require an attacker to invest over 10,000 years of CPU time. This - * is of course a crude example (as password generally aren't random), - * but demonstrates to value of imposing large costs to decryption. - * - * For this reason, if building a UI which involved decrypting or - * encrypting datsa using scrypt, it is recommended to use a - * [[ProgressCallback]] (as event short periods can seem lik an eternity - * if the UI freezes). Including the phrase //"decrypting"// in the UI - * can also help, assuring the user their waiting is for a good reason. - * - * @_docloc: api/crypto:Passwords - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the scrypt - * scrypt(passwordBytes, salt, 1024, 8, 1, 16) - * //_result: - */ -export async function scrypt(_passwd, _salt, N, r, p, dkLen, progress) { - const passwd = getBytes(_passwd, "passwd"); - const salt = getBytes(_salt, "salt"); - return H(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress)); -} -scrypt._ = _scryptAsync; -scrypt.lock = function () { - lockedAsync = true; -}; -scrypt.register = function (func) { - if (lockedAsync) { - throw new Error("scrypt is locked"); - } - __scryptAsync = func; -}; -Object.freeze(scrypt); -/** - * Provides a synchronous variant of [[scrypt]]. - * - * This will completely lock up and freeze the UI in a browser and will - * prevent any event loop from progressing. For this reason, it is - * preferred to use the [async variant](scrypt). - * - * @_docloc: api/crypto:Passwords - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the scrypt - * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) - * //_result: - */ -export function scryptSync(_passwd, _salt, N, r, p, dkLen) { - const passwd = getBytes(_passwd, "passwd"); - const salt = getBytes(_salt, "salt"); - return H(__scryptSync(passwd, salt, N, r, p, dkLen)); -} -scryptSync._ = _scryptSync; -scryptSync.lock = function () { - lockedSync = true; -}; -scryptSync.register = function (func) { - if (lockedSync) { - throw new Error("scryptSync is locked"); - } - __scryptSync = func; -}; -Object.freeze(scryptSync); -//# sourceMappingURL=scrypt.js.map \ No newline at end of file diff --git a/lib.esm/crypto/scrypt.js.map b/lib.esm/crypto/scrypt.js.map deleted file mode 100644 index a652d1f16..000000000 --- a/lib.esm/crypto/scrypt.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scrypt.js","sourceRoot":"","sources":["../../src.ts/crypto/scrypt.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,IAAI,UAAU,EACpB,WAAW,IAAI,WAAW,GAC3B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,QAAQ,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAc3D,IAAI,UAAU,GAAG,KAAK,EACpB,WAAW,GAAG,KAAK,CAAC;AAEtB,MAAM,YAAY,GAAG,KAAK,WACxB,MAAkB,EAClB,IAAgB,EAChB,CAAS,EACT,CAAS,EACT,CAAS,EACT,KAAa,EACb,UAA6B;IAE7B,OAAO,MAAM,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AACzE,CAAC,CAAC;AACF,MAAM,WAAW,GAAG,UAClB,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Q,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AACvD,CAAC;AACD,UAAU,CAAC,CAAC,GAAG,WAAW,CAAC;AAC3B,UAAU,CAAC,IAAI,GAAG;IAChB,UAAU,GAAG,IAAI,CAAC;AACpB,CAAC,CAAC;AACF,UAAU,CAAC,QAAQ,GAAG,UACpB,IAOc;IAEd,IAAI,UAAU,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;KACzC;IACD,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/sha3.d.ts b/lib.esm/crypto/sha3.d.ts deleted file mode 100644 index e9130d128..000000000 --- a/lib.esm/crypto/sha3.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { BytesLike } from "../utils/data.js"; -/** - * Compute the cryptographic SHA2-256 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha256("0x") - * //_result: - * - * sha256("0x1337") - * //_result: - * - * sha256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ -export declare enum SupportedAlgorithm { - sha256 = "sha256", - sha512 = "sha512" -} -export declare function ripemd160(data: BytesLike): string; -export declare function sha256(data: BytesLike): string; -export declare namespace sha256 { - var _: (data: Uint8Array) => string; - var lock: () => void; - var register: (func: (data: Uint8Array) => BytesLike) => void; -} -export declare function legacySha256(data: BytesLike): string; -export declare function computeHmac(algorithm: SupportedAlgorithm, key: BytesLike, data: BytesLike): string; -/** - * Compute the cryptographic SHA2-512 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha512("0x") - * //_result: - * - * sha512("0x1337") - * //_result: - * - * sha512(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - */ -export declare function sha512(data: BytesLike): string; -export declare namespace sha512 { - var _: (data: Uint8Array) => string; - var lock: () => void; - var register: (func: (data: Uint8Array) => BytesLike) => void; -} -//# sourceMappingURL=sha3.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/sha3.d.ts.map b/lib.esm/crypto/sha3.d.ts.map deleted file mode 100644 index 62d2f90aa..000000000 --- a/lib.esm/crypto/sha3.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha3.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/sha3.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,SAAS,EAAqB,MAAM,kBAAkB,CAAC;AAgC1E;;;;;;;;;;;;;;;;GAgBG;AACH,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAYjD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAU9C;yBAVe,MAAM;;;;;AAYtB,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAIpD;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,kBAAkB,EAC7B,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,SAAS,GACd,MAAM,CAkBR;AAcD;;;;;;;;;;;;;;;GAeG;AAEH,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAU9C;yBAVe,MAAM"} \ No newline at end of file diff --git a/lib.esm/crypto/sha3.js b/lib.esm/crypto/sha3.js deleted file mode 100644 index e8b7c001b..000000000 --- a/lib.esm/crypto/sha3.js +++ /dev/null @@ -1,139 +0,0 @@ -import { Logger } from "../logger/logger.js"; -import { arrayify, getBytes, hexlify } from "../utils/data.js"; -import { createHash, createHmac } from "./crypto.js"; -import { Buffer } from "buffer"; -const logger = new Logger("sha3/0.0.1"); -const _sha256 = function (data) { - let v = "0x" + - createHash("sha3-256") - .update(Buffer.from(arrayify(data))) - .digest("hex"); - return v; -}; -const _sha512 = function (data) { - let v = "0x" + - createHash("sha3-512") - .update(Buffer.from(arrayify(data))) - .digest("hex"); - return v; -}; -// @ts-ignore -let __sha256 = _sha256; -// @ts-ignore -let __sha512 = _sha512; -let locked256 = false, locked512 = false; -/** - * Compute the cryptographic SHA2-256 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha256("0x") - * //_result: - * - * sha256("0x1337") - * //_result: - * - * sha256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ -export var SupportedAlgorithm; -(function (SupportedAlgorithm) { - SupportedAlgorithm["sha256"] = "sha256"; - SupportedAlgorithm["sha512"] = "sha512"; -})(SupportedAlgorithm || (SupportedAlgorithm = {})); -export function ripemd160(data) { - let createdHash = "0x" + - createHash("ripemd160") - .update(Buffer.from(arrayify(data))) - .digest("hex"); - const v = "0x" + createdHash; - if (typeof createdHash !== "string") { - createdHash = hexlify(createdHash); - return createdHash; - } - return v; -} -export function sha256(data) { - let createdHash = createHash("sha3-256") - .update(Buffer.from(arrayify(data))) - .digest("hex"); - const v = "0x" + createdHash; - if (typeof createdHash !== "string") { - createdHash = hexlify(createdHash); - return createdHash; - } - return v; -} -export function legacySha256(data) { - const _data = getBytes(data, "data"); - const hexlified = hexlify(createHash("sha256").update(_data).digest()); - return hexlified; -} -export function computeHmac(algorithm, key, data) { - const d = Buffer.from(arrayify(data)); - const k = Buffer.from(arrayify(key)); - if (algorithm === SupportedAlgorithm.sha256) { - return "0x" + createHmac("sha3-256", k).update(d).digest("hex"); - } - else if (algorithm === SupportedAlgorithm.sha512) { - return "0x" + createHmac("sha3-512", k).update(d).digest("hex"); - } - logger.throwError("unsupported algorithm - " + algorithm, Logger.errors.UNSUPPORTED_OPERATION, { - operation: "computeHmac", - algorithm: algorithm, - }); - return ""; -} -sha256._ = _sha256; -sha256.lock = function () { - locked256 = true; -}; -sha256.register = function (func) { - if (locked256) { - throw new Error("sha256 is locked"); - } - __sha256 = func; -}; -Object.freeze(sha256); -/** - * Compute the cryptographic SHA2-512 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha512("0x") - * //_result: - * - * sha512("0x1337") - * //_result: - * - * sha512(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - */ -export function sha512(data) { - let createdHash = createHash("sha3-512") - .update(Buffer.from(arrayify(data))) - .digest("hex"); - const v = "0x" + createdHash; - if (typeof createdHash !== "string") { - createdHash = hexlify(createdHash); - return createdHash; - } - return v; -} -sha512._ = _sha512; -sha512.lock = function () { - locked512 = true; -}; -sha512.register = function (func) { - if (locked512) { - throw new Error("sha512 is locked"); - } - __sha512 = func; -}; -Object.freeze(sha256); -//# sourceMappingURL=sha3.js.map \ No newline at end of file diff --git a/lib.esm/crypto/sha3.js.map b/lib.esm/crypto/sha3.js.map deleted file mode 100644 index f88ea2a25..000000000 --- a/lib.esm/crypto/sha3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha3.js","sourceRoot":"","sources":["../../src.ts/crypto/sha3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAa,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC;AAExC,MAAM,OAAO,GAAG,UAAU,IAAgB;IACxC,IAAI,CAAC,GACH,IAAI;QACJ,UAAU,CAAC,UAAU,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MAAM,CAAC,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.esm/crypto/signature.d.ts b/lib.esm/crypto/signature.d.ts deleted file mode 100644 index 075005c42..000000000 --- a/lib.esm/crypto/signature.d.ts +++ /dev/null @@ -1,131 +0,0 @@ -import type { BigNumberish, BytesLike } from "../utils/index.js"; -/** - * A SignatureLike - * - * @_docloc: api/crypto:Signing - */ -export type SignatureLike = string; -/** - * A Signature @TODO - * - * - * @_docloc: api/crypto:Signing - */ -export declare class Signature { - #private; - /** - * The ``r`` value for a signautre. - * - * This represents the ``x`` coordinate of a "reference" or - * challenge point, from which the ``y`` can be computed. - */ - get r(): string; - set r(value: BytesLike); - /** - * The ``s`` value for a signature. - */ - get s(): string; - set s(_value: BytesLike); - /** - * The ``v`` value for a signature. - * - * Since a given ``x`` value for ``r`` has two possible values for - * its correspondin ``y``, the ``v`` indicates which of the two ``y`` - * values to use. - * - * It is normalized to the values ``27`` or ``28`` for legacy - * purposes. - */ - get v(): 27 | 28; - set v(value: BigNumberish); - /** - * The EIP-155 ``v`` for legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get networkV(): null | bigint; - /** - * The chain ID for EIP-155 legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get legacynetworkId(): null | bigint; - /** - * The ``yParity`` for the signature. - * - * See ``v`` for more details on how this value is used. - */ - get yParity(): 0 | 1; - /** - * The [[link-eip-2098]] compact representation of the ``yParity`` - * and ``s`` compacted into a single ``bytes32``. - */ - get yParityAndS(): string; - /** - * The [[link-eip-2098]] compact representation. - */ - get compactSerialized(): string; - /** - * The serialized representation. - */ - get serialized(): string; - /** - * @private - */ - constructor(guard: any, r: string, s: string, v: 27 | 28); - /** - * Returns a new identical [[Signature]]. - */ - clone(): Signature; - /** - * Returns a representation that is compatible with ``JSON.stringify``. - */ - toJSON(): any; - /** - * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. - * - * @example: - * Signature.getnetworkId(45) - * //_result: - * - * Signature.getnetworkId(46) - * //_result: - */ - static getnetworkId(v: BigNumberish): bigint; - /** - * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. - * - * Legacy transactions which use [[link-eip-155]] hijack the ``v`` - * property to include the chain ID. - * - * @example: - * Signature.getnetworkIdV(5, 27) - * //_result: - * - * Signature.getnetworkIdV(5, 28) - * //_result: - * - */ - static getnetworkIdV(networkId: BigNumberish, v: 27 | 28): bigint; - /** - * Compute the normalized legacy transaction ``v`` from a ``yParirty``, - * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. - * - * @example: - * // The values 0 and 1 imply v is actually yParity - * Signature.getNormalizedV(0) - * //_result: - * - * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) - * Signature.getNormalizedV(27) - * //_result: - * - * // Legacy EIP-155 transaction (i.e. >= 35) - * Signature.getNormalizedV(46) - * //_result: - * - * // Invalid values throw - * Signature.getNormalizedV(5) - * //_error: - */ - static getNormalizedV(v: BigNumberish): 27 | 28; -} -//# sourceMappingURL=signature.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/signature.d.ts.map b/lib.esm/crypto/signature.d.ts.map deleted file mode 100644 index 83d7e9f37..000000000 --- a/lib.esm/crypto/signature.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signature.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAcjE;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC;;;;;GAKG;AACH,qBAAa,SAAS;;IAMpB;;;;;OAKG;IACH,IAAI,CAAC,IAAI,MAAM,CAEd;IACD,IAAI,CAAC,CAAC,KAAK,EAAE,SAAS,EAGrB;IAED;;OAEG;IACH,IAAI,CAAC,IAAI,MAAM,CAEd;IACD,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,EAUtB;IAED;;;;;;;;;OASG;IACH,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAEf;IACD,IAAI,CAAC,CAAC,KAAK,EAAE,YAAY,EAIxB;IAED;;;OAGG;IACH,IAAI,QAAQ,IAAI,IAAI,GAAG,MAAM,CAE5B;IAED;;;OAGG;IACH,IAAI,eAAe,IAAI,IAAI,GAAG,MAAM,CAMnC;IAED;;;;OAIG;IACH,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,CAEnB;IAED;;;OAGG;IACH,IAAI,WAAW,IAAI,MAAM,CAOxB;IAED;;OAEG;IACH,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE;IAYxD;;OAEG;IACH,KAAK,IAAI,SAAS;IAQlB;;OAEG;IACH,MAAM,IAAI,GAAG;IAWb;;;;;;;;;OASG;IACH,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM;IAc5C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,MAAM;IAIjE;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,YAAY,GAAG,EAAE,GAAG,EAAE;CAwBhD"} \ No newline at end of file diff --git a/lib.esm/crypto/signature.js b/lib.esm/crypto/signature.js deleted file mode 100644 index b682de18f..000000000 --- a/lib.esm/crypto/signature.js +++ /dev/null @@ -1,221 +0,0 @@ -import { concat, dataLength, getBigInt, getBytes, getNumber, hexlify, assertArgument, assertPrivate, } from "../utils/index.js"; -// Constants -const BN_0 = BigInt(0); -const BN_1 = BigInt(1); -const BN_2 = BigInt(2); -const BN_27 = BigInt(27); -const BN_28 = BigInt(28); -const BN_35 = BigInt(35); -const _guard = {}; -/** - * A Signature @TODO - * - * - * @_docloc: api/crypto:Signing - */ -export class Signature { - #r; - #s; - #v; - #networkV; - /** - * The ``r`` value for a signautre. - * - * This represents the ``x`` coordinate of a "reference" or - * challenge point, from which the ``y`` can be computed. - */ - get r() { - return this.#r; - } - set r(value) { - assertArgument(dataLength(value) === 32, "invalid r", "value", value); - this.#r = hexlify(value); - } - /** - * The ``s`` value for a signature. - */ - get s() { - return this.#s; - } - set s(_value) { - assertArgument(dataLength(_value) === 32, "invalid s", "value", _value); - const value = hexlify(_value); - assertArgument(parseInt(value.substring(0, 3)) < 8, "non-canonical s", "value", value); - this.#s = value; - } - /** - * The ``v`` value for a signature. - * - * Since a given ``x`` value for ``r`` has two possible values for - * its correspondin ``y``, the ``v`` indicates which of the two ``y`` - * values to use. - * - * It is normalized to the values ``27`` or ``28`` for legacy - * purposes. - */ - get v() { - return this.#v; - } - set v(value) { - const v = getNumber(value, "value"); - assertArgument(v === 27 || v === 28, "invalid v", "v", value); - this.#v = v; - } - /** - * The EIP-155 ``v`` for legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get networkV() { - return this.#networkV; - } - /** - * The chain ID for EIP-155 legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get legacynetworkId() { - const v = this.networkV; - if (v == null) { - return null; - } - return Signature.getnetworkId(v); - } - /** - * The ``yParity`` for the signature. - * - * See ``v`` for more details on how this value is used. - */ - get yParity() { - return this.v === 27 ? 0 : 1; - } - /** - * The [[link-eip-2098]] compact representation of the ``yParity`` - * and ``s`` compacted into a single ``bytes32``. - */ - get yParityAndS() { - // The EIP-2098 compact representation - const yParityAndS = getBytes(this.s); - if (this.yParity) { - yParityAndS[0] |= 0x80; - } - return hexlify(yParityAndS); - } - /** - * The [[link-eip-2098]] compact representation. - */ - get compactSerialized() { - return concat([this.r, this.yParityAndS]); - } - /** - * The serialized representation. - */ - get serialized() { - return concat([this.r, this.s, this.yParity ? "0x1c" : "0x1b"]); - } - /** - * @private - */ - constructor(guard, r, s, v) { - assertPrivate(guard, _guard, "Signature"); - this.#r = r; - this.#s = s; - this.#v = v; - this.#networkV = null; - } - [Symbol.for("nodejs.util.inspect.custom")]() { - return `Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`; - } - /** - * Returns a new identical [[Signature]]. - */ - clone() { - const clone = new Signature(_guard, this.r, this.s, this.v); - if (this.networkV) { - clone.#networkV = this.networkV; - } - return clone; - } - /** - * Returns a representation that is compatible with ``JSON.stringify``. - */ - toJSON() { - const networkV = this.networkV; - return { - _type: "signature", - networkV: networkV != null ? networkV.toString() : null, - r: this.r, - s: this.s, - v: this.v, - }; - } - /** - * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. - * - * @example: - * Signature.getnetworkId(45) - * //_result: - * - * Signature.getnetworkId(46) - * //_result: - */ - static getnetworkId(v) { - const bv = getBigInt(v, "v"); - // The v is not an EIP-155 v, so it is the unspecified chain ID - if (bv == BN_27 || bv == BN_28) { - return BN_0; - } - // Bad value for an EIP-155 v - assertArgument(bv >= BN_35, "invalid EIP-155 v", "v", v); - return (bv - BN_35) / BN_2; - } - /** - * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. - * - * Legacy transactions which use [[link-eip-155]] hijack the ``v`` - * property to include the chain ID. - * - * @example: - * Signature.getnetworkIdV(5, 27) - * //_result: - * - * Signature.getnetworkIdV(5, 28) - * //_result: - * - */ - static getnetworkIdV(networkId, v) { - return getBigInt(networkId) * BN_2 + BigInt(35 + v - 27); - } - /** - * Compute the normalized legacy transaction ``v`` from a ``yParirty``, - * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. - * - * @example: - * // The values 0 and 1 imply v is actually yParity - * Signature.getNormalizedV(0) - * //_result: - * - * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) - * Signature.getNormalizedV(27) - * //_result: - * - * // Legacy EIP-155 transaction (i.e. >= 35) - * Signature.getNormalizedV(46) - * //_result: - * - * // Invalid values throw - * Signature.getNormalizedV(5) - * //_error: - */ - static getNormalizedV(v) { - const bv = getBigInt(v); - if (bv === BN_0 || bv === BN_27) { - return 27; - } - if (bv === BN_1 || bv === BN_28) { - return 28; - } - assertArgument(bv >= BN_35, "invalid v", "v", v); - // Otherwise, EIP-155 v means odd is 27 and even is 28 - return bv & BN_1 ? 27 : 28; - } -} -//# sourceMappingURL=signature.js.map \ No newline at end of file diff --git a/lib.esm/crypto/signature.js.map b/lib.esm/crypto/signature.js.map deleted file mode 100644 index 6e14c4119..000000000 --- a/lib.esm/crypto/signature.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src.ts/crypto/signature.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,SAAS,EACT,QAAQ,EACR,SAAS,EACT,OAAO,EACP,cAAc,EACd,aAAa,GACd,MAAM,mBAAmB,CAAC;AAI3B,YAAY;AACZ,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AACzB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AACzB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEzB,MAAM,MAAM,GAAG,EAAE,CAAC;AAWlB;;;;;GAKG;AACH,MAAM,OAAO,SAAS;IACpB,EAAE,CAAS;IACX,EAAE,CAAS;IACX,EAAE,CAAU;IACZ,SAAS,CAAgB;IAEzB;;;;;OAKG;IACH,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IACD,IAAI,CAAC,CAAC,KAAgB;QACpB,cAAc,CAAC,UAAU,CAAC,KAAK,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;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,cAAc,CAAC,CAAe;QACnC,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QAExB,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,KAAK,EAAE;YAC/B,OAAO,EAAE,CAAC;SACX;QACD,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,KAAK,EAAE;YAC/B,OAAO,EAAE,CAAC;SACX;QAED,cAAc,CAAC,EAAE,IAAI,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QAEjD,sDAAsD;QACtD,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7B,CAAC;CAUF"} \ No newline at end of file diff --git a/lib.esm/crypto/signing-key.d.ts b/lib.esm/crypto/signing-key.d.ts deleted file mode 100644 index a030dac26..000000000 --- a/lib.esm/crypto/signing-key.d.ts +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Add details about signing here. - * - * @_subsection: api/crypto:Signing [about-signing] - */ -import type { BytesLike } from "../utils/index.js"; -import type { SignatureLike } from "./index.js"; -/** - * A **SigningKey** provides high-level access to the elliptic curve - * cryptography (ECC) operations and key management. - */ -export declare class SigningKey { - #private; - /** - * Creates a new **SigningKey** for %%privateKey%%. - */ - constructor(privateKey: BytesLike); - /** - * The private key. - */ - get privateKey(): string; - /** - * The uncompressed public key. - * - * This will always begin with the prefix ``0x04`` and be 132 - * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). - */ - get publicKey(): string; - /** - * The compressed public key. - * - * This will always begin with either the prefix ``0x02`` or ``0x03`` - * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal - * nibbles) - */ - get compressedPublicKey(): string; - /** - * Return the signature of the signed %%digest%%. - */ - sign(digest: BytesLike): string; - /** - * Returns the [[link-wiki-ecdh]] shared secret between this - * private key and the %%other%% key. - * - * The %%other%% key may be any type of key, a raw public key, - * a compressed/uncompressed pubic key or aprivate key. - * - * Best practice is usually to use a cryptographic hash on the - * returned value before using it as a symetric secret. - * - * @example: - * sign1 = new SigningKey(id("some-secret-1")) - * sign2 = new SigningKey(id("some-secret-2")) - * - * // Notice that privA.computeSharedSecret(pubB)... - * sign1.computeSharedSecret(sign2.publicKey) - * //_result: - * - * // ...is equal to privB.computeSharedSecret(pubA). - * sign2.computeSharedSecret(sign1.publicKey) - * //_result: - */ - computeSharedSecret(other: BytesLike): string; - /** - * Compute the public key for %%key%%, optionally %%compressed%%. - * - * The %%key%% may be any type of key, a raw public key, a - * compressed/uncompressed public key or private key. - * - * @example: - * sign = new SigningKey(id("some-secret")); - * - * // Compute the uncompressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey) - * //_result: - * - * // Compute the compressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey, true) - * //_result: - * - * // Compute the uncompressed public key - * SigningKey.computePublicKey(sign.publicKey, false); - * //_result: - * - * // Compute the Compressed a public key - * SigningKey.computePublicKey(sign.publicKey, true); - * //_result: - */ - static computePublicKey(key: BytesLike, compressed?: boolean): string; - /** - * Returns the public key for the private key which produced the - * %%signature%% for the given %%digest%%. - * - * @example: - * key = new SigningKey(id("some-secret")) - * digest = id("hello world") - * sig = key.sign(digest) - * - * // Notice the signer public key... - * key.publicKey - * //_result: - * - * // ...is equal to the recovered public key - * SigningKey.recoverPublicKey(digest, sig) - * //_result: - * - */ - static recoverPublicKey(digest: BytesLike, signature: SignatureLike): string; - /** - * Returns the point resulting from adding the ellipic curve points - * %%p0%% and %%p1%%. - * - * This is not a common function most developers should require, but - * can be useful for certain privacy-specific techniques. - * - * For example, it is used by [[HDNodeWallet]] to compute child - * addresses from parent public keys and chain codes. - */ - static addPoints(p0: BytesLike, p1: BytesLike, compressed?: boolean): string; -} -//# sourceMappingURL=signing-key.d.ts.map \ No newline at end of file diff --git a/lib.esm/crypto/signing-key.d.ts.map b/lib.esm/crypto/signing-key.d.ts.map deleted file mode 100644 index b5aea9127..000000000 --- a/lib.esm/crypto/signing-key.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signing-key.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAYhD;;;GAGG;AACH,qBAAa,UAAU;;IAGrB;;OAEG;gBACS,UAAU,EAAE,SAAS;IAcjC;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;;;;OAKG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;;;;;OAMG;IACH,IAAI,mBAAmB,IAAI,MAAM,CAEhC;IAED;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM;IAmC/B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAU7C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;IAkBrE;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM;IAqB5E;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;CAS7E"} \ No newline at end of file diff --git a/lib.esm/crypto/signing-key.js b/lib.esm/crypto/signing-key.js deleted file mode 100644 index 2c80bace6..000000000 --- a/lib.esm/crypto/signing-key.js +++ /dev/null @@ -1,203 +0,0 @@ -/** - * Add details about signing here. - * - * @_subsection: api/crypto:Signing [about-signing] - */ -import * as secp256k1 from "@noble/secp256k1"; -import { dataLength, getBytes, getBytesCopy, hexlify, assertArgument, } from "../utils/index.js"; -import { arrayify, hexConcat } from "../utils/data.js"; -import { Logger } from "../logger/logger.js"; -import { ed448 } from "./crypto.js"; -import { Buffer } from "buffer"; -const logger = new Logger("signing-key/0.0.1"); -//const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); -// Make noble-secp256k1 sync -/** - * A **SigningKey** provides high-level access to the elliptic curve - * cryptography (ECC) operations and key management. - */ -export class SigningKey { - #privateKey; - /** - * Creates a new **SigningKey** for %%privateKey%%. - */ - constructor(privateKey) { - let tmp = privateKey; - if (typeof tmp === "string" && tmp.startsWith("0x")) { - tmp = tmp.replace("0x", ""); - } - assertArgument(dataLength("0x" + tmp) === 57, "invalid private key", "privateKey", "[REDACTED]"); - this.#privateKey = hexlify("0x" + tmp); - } - /** - * The private key. - */ - get privateKey() { - return this.#privateKey; - } - /** - * The uncompressed public key. - * - * This will always begin with the prefix ``0x04`` and be 132 - * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). - */ - get publicKey() { - return SigningKey.computePublicKey(this.#privateKey); - } - /** - * The compressed public key. - * - * This will always begin with either the prefix ``0x02`` or ``0x03`` - * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal - * nibbles) - */ - get compressedPublicKey() { - return SigningKey.computePublicKey(this.#privateKey, true); - } - /** - * Return the signature of the signed %%digest%%. - */ - sign(digest) { - const key = getBytesCopy(this.#privateKey); - assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); - const keyBuffer = new Uint8Array(arrayify(key)); - if (keyBuffer.length !== 57) { - logger.throwArgumentError("invalid private key", "key", "[REDACTED]"); - } - const digestBuffer = new Uint8Array(arrayify(digest)); - if (digestBuffer.length !== 32) { - logger.throwArgumentError("bad digest length", "digest", digest); - } - if (keyBuffer[56] > 127) { - const prefix = keyBuffer.slice(0, 57); - prefix[0] &= 0xfc; - prefix[55] |= 0x80; - prefix[56] = 0; - const scalar = prefix.slice(0, 56); - const bufferDigest = Buffer.from(digestBuffer); - const bufferPrfx = Buffer.from(prefix); - const bufferScalar = Buffer.from(scalar); - const sig = ed448.signWithScalar(bufferDigest, bufferScalar, bufferPrfx); - const hexlified = hexlify(sig); - return hexConcat([hexlified, this.publicKey]); - } - const sig = ed448.sign(Buffer.from(digestBuffer), Buffer.from(keyBuffer)); - const hexlified = hexlify(sig); - return hexConcat([hexlified, this.publicKey]); - } - /** - * Returns the [[link-wiki-ecdh]] shared secret between this - * private key and the %%other%% key. - * - * The %%other%% key may be any type of key, a raw public key, - * a compressed/uncompressed pubic key or aprivate key. - * - * Best practice is usually to use a cryptographic hash on the - * returned value before using it as a symetric secret. - * - * @example: - * sign1 = new SigningKey(id("some-secret-1")) - * sign2 = new SigningKey(id("some-secret-2")) - * - * // Notice that privA.computeSharedSecret(pubB)... - * sign1.computeSharedSecret(sign2.publicKey) - * //_result: - * - * // ...is equal to privB.computeSharedSecret(pubA). - * sign2.computeSharedSecret(sign1.publicKey) - * //_result: - */ - computeSharedSecret(other) { - const pubKey = SigningKey.computePublicKey(other); - return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey))); - } - /** - * Compute the public key for %%key%%, optionally %%compressed%%. - * - * The %%key%% may be any type of key, a raw public key, a - * compressed/uncompressed public key or private key. - * - * @example: - * sign = new SigningKey(id("some-secret")); - * - * // Compute the uncompressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey) - * //_result: - * - * // Compute the compressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey, true) - * //_result: - * - * // Compute the uncompressed public key - * SigningKey.computePublicKey(sign.publicKey, false); - * //_result: - * - * // Compute the Compressed a public key - * SigningKey.computePublicKey(sign.publicKey, true); - * //_result: - */ - static computePublicKey(key, compressed) { - const bytes = Buffer.from(arrayify(key)); - if (bytes.length !== 57) { - logger.throwArgumentError("invalid private key", "key", "[REDACTED]"); - } - if (bytes[56] > 127) { - const scalar = bytes.slice(0, 56); - scalar[0] &= 0xfc; - scalar[55] |= 0x80; - const pub = ed448.publicKeyFromScalar(scalar); - return hexlify(pub); - } - const pub = ed448.publicKeyCreate(bytes); - return hexlify(pub); - } - /** - * Returns the public key for the private key which produced the - * %%signature%% for the given %%digest%%. - * - * @example: - * key = new SigningKey(id("some-secret")) - * digest = id("hello world") - * sig = key.sign(digest) - * - * // Notice the signer public key... - * key.publicKey - * //_result: - * - * // ...is equal to the recovered public key - * SigningKey.recoverPublicKey(digest, sig) - * //_result: - * - */ - static recoverPublicKey(digest, signature) { - assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); - const digestBuffer = Buffer.from(arrayify(digest)); - const sigBuffer = Buffer.from(arrayify(signature)); - if (sigBuffer.length !== 171) { - logger.throwArgumentError("invalid signature", "signature", signature); - } - const sig = sigBuffer.slice(0, 114); - const pub = sigBuffer.slice(114); - if (ed448.verify(digestBuffer, sig, pub)) { - return hexlify(pub); - } - logger.throwArgumentError("invalid signature", "signature", signature); - return ""; - } - /** - * Returns the point resulting from adding the ellipic curve points - * %%p0%% and %%p1%%. - * - * This is not a common function most developers should require, but - * can be useful for certain privacy-specific techniques. - * - * For example, it is used by [[HDNodeWallet]] to compute child - * addresses from parent public keys and chain codes. - */ - static addPoints(p0, p1, compressed) { - const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2)); - const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2)); - return "0x" + pub0.add(pub1).toHex(!!compressed); - } -} -//# sourceMappingURL=signing-key.js.map \ No newline at end of file diff --git a/lib.esm/crypto/signing-key.js.map b/lib.esm/crypto/signing-key.js.map deleted file mode 100644 index 833310939..000000000 --- a/lib.esm/crypto/signing-key.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signing-key.js","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mapp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,SAAS,CAAC,EAAa,EAAE,EAAa,EAAE,UAAoB;QACjE,MAAM,IAAI,GAAG,SAAS,CAAC,eAAe,CAAC,OAAO,CAC5C,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAC7C,CAAC;QACF,MAAM,IAAI,GAAG,SAAS,CAAC,eAAe,CAAC,OAAO,CAC5C,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAC7C,CAAC;QACF,OAAO,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/hash/id.d.ts b/lib.esm/hash/id.d.ts deleted file mode 100644 index c55374a67..000000000 --- a/lib.esm/hash/id.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * A simple hashing function which operates on UTF-8 strings to - * compute an 32-byte identifier. - * - * - * @example: - * id("hello world") - * //_result: - */ -export declare function id(value: string, useKeccak?: boolean): string; -//# sourceMappingURL=id.d.ts.map \ No newline at end of file diff --git a/lib.esm/hash/id.d.ts.map b/lib.esm/hash/id.d.ts.map deleted file mode 100644 index 140f79634..000000000 --- a/lib.esm/hash/id.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../src.ts/hash/id.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,wBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAK7D"} \ No newline at end of file diff --git a/lib.esm/hash/id.js b/lib.esm/hash/id.js deleted file mode 100644 index d8a62e96f..000000000 --- a/lib.esm/hash/id.js +++ /dev/null @@ -1,19 +0,0 @@ -import { keccak256 } from "../crypto/keccak.js"; -import { sha256 } from "../crypto/sha3.js"; -import { toUtf8Bytes } from "../utils/index.js"; -/** - * A simple hashing function which operates on UTF-8 strings to - * compute an 32-byte identifier. - * - * - * @example: - * id("hello world") - * //_result: - */ -export function id(value, useKeccak) { - if (useKeccak) { - return keccak256(toUtf8Bytes(value)); - } - return sha256(toUtf8Bytes(value)); -} -//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/lib.esm/hash/id.js.map b/lib.esm/hash/id.js.map deleted file mode 100644 index a49ed54d7..000000000 --- a/lib.esm/hash/id.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"id.js","sourceRoot":"","sources":["../../src.ts/hash/id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,UAAU,EAAE,CAAC,KAAa,EAAE,SAAmB;IACnD,IAAI,SAAS,EAAE;QACb,OAAO,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;KACtC;IACD,OAAO,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AACpC,CAAC"} \ No newline at end of file diff --git a/lib.esm/hash/index.d.ts b/lib.esm/hash/index.d.ts deleted file mode 100644 index a9ba6fa23..000000000 --- a/lib.esm/hash/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * About hashing here... - * - * @_section: api/hashing:Hashing Utilities [about-hashing] - */ -export { id } from "./id.js"; -export { hashMessage, verifyMessage } from "./message.js"; -export { solidityPacked, solidityPackedSha256 } from "./solidity.js"; -export { TypedDataEncoder, verifyTypedData } from "./typed-data.js"; -export type { TypedDataDomain, TypedDataField } from "./typed-data.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.esm/hash/index.d.ts.map b/lib.esm/hash/index.d.ts.map deleted file mode 100644 index 70eb7509e..000000000 --- a/lib.esm/hash/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/lib.esm/hash/index.js b/lib.esm/hash/index.js deleted file mode 100644 index bd803eab7..000000000 --- a/lib.esm/hash/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * About hashing here... - * - * @_section: api/hashing:Hashing Utilities [about-hashing] - */ -export { id } from "./id.js"; -export { hashMessage, verifyMessage } from "./message.js"; -export { solidityPacked, solidityPackedSha256 } from "./solidity.js"; -export { TypedDataEncoder, verifyTypedData } from "./typed-data.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.esm/hash/index.js.map b/lib.esm/hash/index.js.map deleted file mode 100644 index dafc8e110..000000000 --- a/lib.esm/hash/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/lib.esm/hash/message.d.ts b/lib.esm/hash/message.d.ts deleted file mode 100644 index c7776facd..000000000 --- a/lib.esm/hash/message.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { SignatureLike } from "../crypto/index.js"; -/** - * Computes the [[link-eip-191]] personal-sign message digest to sign. - * - * - * If %%message%% is a string, it is converted to its UTF-8 bytes - * first. To compute the digest of a [[DataHexString]], it must be converted - * to [bytes](getBytes). - * - * @example: - * hashMessage("Hello World") - * //_result: - * - * // Hashes the SIX (6) string characters, i.e. - * // [ "0", "x", "4", "2", "4", "3" ] - * hashMessage("0x4243") - * //_result: - * - * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... - * hashMessage(getBytes("0x4243")) - * //_result: - * - * // ...which is equal to using data - * hashMessage(new Uint8Array([ 0x42, 0x43 ])) - * //_result: - * - */ -export declare function hashMessage(message: Uint8Array | string): string; -/** - * Return the address of the private key that produced - * the signature %%sig%% during signing for %%message%%. - */ -export declare function verifyMessage(message: Uint8Array | string, sig: SignatureLike, prefix: string): string; -//# sourceMappingURL=message.d.ts.map \ No newline at end of file diff --git a/lib.esm/hash/message.d.ts.map b/lib.esm/hash/message.d.ts.map deleted file mode 100644 index 76c7dfa70..000000000 --- a/lib.esm/hash/message.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src.ts/hash/message.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC3D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAWhE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,UAAU,GAAG,MAAM,EAC5B,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,MAAM,GACb,MAAM,CAGR"} \ No newline at end of file diff --git a/lib.esm/hash/message.js b/lib.esm/hash/message.js deleted file mode 100644 index d7e0be54c..000000000 --- a/lib.esm/hash/message.js +++ /dev/null @@ -1,49 +0,0 @@ -import { MessagePrefix } from "../constants/index.js"; -import { recoverAddress } from "../transaction/index.js"; -import { concat, toUtf8Bytes } from "../utils/index.js"; -import { sha256 } from "../crypto/index.js"; -/** - * Computes the [[link-eip-191]] personal-sign message digest to sign. - * - * - * If %%message%% is a string, it is converted to its UTF-8 bytes - * first. To compute the digest of a [[DataHexString]], it must be converted - * to [bytes](getBytes). - * - * @example: - * hashMessage("Hello World") - * //_result: - * - * // Hashes the SIX (6) string characters, i.e. - * // [ "0", "x", "4", "2", "4", "3" ] - * hashMessage("0x4243") - * //_result: - * - * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... - * hashMessage(getBytes("0x4243")) - * //_result: - * - * // ...which is equal to using data - * hashMessage(new Uint8Array([ 0x42, 0x43 ])) - * //_result: - * - */ -export function hashMessage(message) { - if (typeof message === "string") { - message = toUtf8Bytes(message); - } - return sha256(concat([ - toUtf8Bytes(MessagePrefix), - toUtf8Bytes(String(message.length)), - message, - ])); -} -/** - * Return the address of the private key that produced - * the signature %%sig%% during signing for %%message%%. - */ -export function verifyMessage(message, sig, prefix) { - const digest = hashMessage(message); - return recoverAddress(digest, sig, prefix); -} -//# sourceMappingURL=message.js.map \ No newline at end of file diff --git a/lib.esm/hash/message.js.map b/lib.esm/hash/message.js.map deleted file mode 100644 index e1e6e7853..000000000 --- a/lib.esm/hash/message.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src.ts/hash/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,MAAM,EAAiB,MAAM,oBAAoB,CAAC;AAC3D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,WAAW,CAAC,OAA4B;IACtD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;KAChC;IACD,OAAO,MAAM,CACX,MAAM,CAAC;QACL,WAAW,CAAC,aAAa,CAAC;QAC1B,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,OAAO;KACR,CAAC,CACH,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,OAA4B,EAC5B,GAAkB,EAClB,MAAc;IAEd,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC"} \ No newline at end of file diff --git a/lib.esm/hash/solidity.d.ts b/lib.esm/hash/solidity.d.ts deleted file mode 100644 index f6e66a454..000000000 --- a/lib.esm/hash/solidity.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Computes the [[link-solc-packed]] representation of %%values%% - * respectively to their %%types%%. - * - * @example: - * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" - * solidityPacked([ "address", "uint" ], [ addr, 45 ]); - * //_result: - */ -export declare function solidityPacked(types: ReadonlyArray, values: ReadonlyArray): string; -/** - * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% - * respectively to their %%types%%. - * - * @example: - * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" - * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); - * //_result: - */ -export declare function solidityPackedSha256(types: ReadonlyArray, values: ReadonlyArray): string; -//# sourceMappingURL=solidity.d.ts.map \ No newline at end of file diff --git a/lib.esm/hash/solidity.d.ts.map b/lib.esm/hash/solidity.d.ts.map deleted file mode 100644 index 251b44140..000000000 --- a/lib.esm/hash/solidity.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"solidity.d.ts","sourceRoot":"","sources":["../../src.ts/hash/solidity.ts"],"names":[],"mappings":"AA8GA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GACzB,MAAM,CAaR;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GACzB,MAAM,CAER"} \ No newline at end of file diff --git a/lib.esm/hash/solidity.js b/lib.esm/hash/solidity.js deleted file mode 100644 index b9b2c6199..000000000 --- a/lib.esm/hash/solidity.js +++ /dev/null @@ -1,94 +0,0 @@ -import { getAddress } from "../address/index.js"; -import { sha256 as _sha256 } from "../crypto/index.js"; -import { concat, dataLength, getBytes, hexlify, toBeArray, toTwos, toUtf8Bytes, zeroPadBytes, zeroPadValue, assertArgument, } from "../utils/index.js"; -const regexBytes = new RegExp("^bytes([0-9]+)$"); -const regexNumber = new RegExp("^(u?int)([0-9]*)$"); -const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); -function _pack(type, value, isArray) { - switch (type) { - case "address": - if (isArray) { - return getBytes(zeroPadValue(value, 32)); - } - return getBytes(getAddress(value)); - case "string": - return toUtf8Bytes(value); - case "bytes": - return getBytes(value); - case "bool": - value = !!value ? "0x01" : "0x00"; - if (isArray) { - return getBytes(zeroPadValue(value, 32)); - } - return getBytes(value); - } - let match = type.match(regexNumber); - if (match) { - let signed = match[1] === "int"; - let size = parseInt(match[2] || "256"); - assertArgument((!match[2] || match[2] === String(size)) && - size % 8 === 0 && - size !== 0 && - size <= 256, "invalid number type", "type", type); - if (isArray) { - size = 256; - } - if (signed) { - value = toTwos(value, size); - } - return getBytes(zeroPadValue(toBeArray(value), size / 8)); - } - match = type.match(regexBytes); - if (match) { - const size = parseInt(match[1]); - assertArgument(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type); - assertArgument(dataLength(value) === size, `invalid value for ${type}`, "value", value); - if (isArray) { - return getBytes(zeroPadBytes(value, 32)); - } - return value; - } - match = type.match(regexArray); - if (match && Array.isArray(value)) { - const baseType = match[1]; - const count = parseInt(match[2] || String(value.length)); - assertArgument(count === value.length, `invalid array length for ${type}`, "value", value); - const result = []; - value.forEach(function (value) { - result.push(_pack(baseType, value, true)); - }); - return getBytes(concat(result)); - } - assertArgument(false, "invalid type", "type", type); -} -// @TODO: Array Enum -/** - * Computes the [[link-solc-packed]] representation of %%values%% - * respectively to their %%types%%. - * - * @example: - * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" - * solidityPacked([ "address", "uint" ], [ addr, 45 ]); - * //_result: - */ -export function solidityPacked(types, values) { - assertArgument(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values); - const tight = []; - types.forEach(function (type, index) { - tight.push(_pack(type, values[index])); - }); - return hexlify(concat(tight)); -} -/** - * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% - * respectively to their %%types%%. - * - * @example: - * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" - * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); - * //_result: - */ -export function solidityPackedSha256(types, values) { - return _sha256(solidityPacked(types, values)); -} -//# sourceMappingURL=solidity.js.map \ No newline at end of file diff --git a/lib.esm/hash/solidity.js.map b/lib.esm/hash/solidity.js.map deleted file mode 100644 index 717efa4cf..000000000 --- a/lib.esm/hash/solidity.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"solidity.js","sourceRoot":"","sources":["../../src.ts/hash/solidity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,MAAM,EACN,UAAU,EACV,QAAQ,EACR,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/hash/typed-data.d.ts deleted file mode 100644 index 76130b694..000000000 --- a/lib.esm/hash/typed-data.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import type { BigNumberish, BytesLike } from "../utils/index.js"; -export interface TypedDataDomain { - name?: null | string; - version?: null | string; - networkId?: null | BigNumberish; - verifyingContract?: null | string; - salt?: null | BytesLike; -} -export interface TypedDataField { - name: string; - type: string; -} -export declare class TypedDataEncoder { - #private; - readonly primaryType: string; - get types(): Record>; - constructor(types: Record>); - getEncoder(type: string): (value: any) => string; - encodeType(name: string): string; - encodeData(type: string, value: any): string; - hashStruct(name: string, value: Record): string; - encode(value: Record): string; - hash(value: Record): string; - _visit(type: string, value: any, callback: (type: string, data: any) => any): any; - visit(value: Record, callback: (type: string, data: any) => any): any; - static from(types: Record>): TypedDataEncoder; - static getPrimaryType(types: Record>): string; - static hashStruct(name: string, types: Record>, value: Record): string; - static hashDomain(domain: TypedDataDomain): string; - static encode(domain: TypedDataDomain, types: Record>, value: Record): string; - static hash(domain: TypedDataDomain, types: Record>, value: Record): string; - static resolveNames(domain: TypedDataDomain, types: Record>, value: Record, resolveName: (name: string) => Promise): Promise<{ - domain: TypedDataDomain; - value: any; - }>; - static getPayload(domain: TypedDataDomain, types: Record>, value: Record): any; -} -/** - * Compute the address used to sign the typed data for the %%signature%%. - */ -export declare function verifyTypedData(domain: TypedDataDomain, types: Record>, value: Record, signature: string, prefix: string): string; -//# sourceMappingURL=typed-data.d.ts.map \ No newline at end of file diff --git a/lib.esm/hash/typed-data.d.ts.map b/lib.esm/hash/typed-data.d.ts.map deleted file mode 100644 index fc4135d06..000000000 --- a/lib.esm/hash/typed-data.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"typed-data.d.ts","sourceRoot":"","sources":["../../src.ts/hash/typed-data.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAYjE,MAAM,WAAW,eAAe;IAC9B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AC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC;IAsDnD,MAAM,CAAC,UAAU,CACf,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,GAAG;CAkEP;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,MAAM,CAMR"} \ No newline at end of file diff --git a/lib.esm/hash/typed-data.js b/lib.esm/hash/typed-data.js deleted file mode 100644 index f0ec2784b..000000000 --- a/lib.esm/hash/typed-data.js +++ /dev/null @@ -1,422 +0,0 @@ -import { getAddress } from "../address/index.js"; -import { recoverAddress } from "../transaction/index.js"; -import { concat, defineProperties, getBigInt, getBytes, hexlify, isHexString, mask, toBeHex, toQuantity, toTwos, zeroPadValue, assertArgument, } from "../utils/index.js"; -import { id } from "./id.js"; -import { sha256 } from "../crypto/index.js"; -const padding = new Uint8Array(32); -padding.fill(0); -const BN__1 = BigInt(-1); -const BN_0 = BigInt(0); -const BN_1 = BigInt(1); -const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -function hexPadRight(value) { - const bytes = getBytes(value); - const padOffset = bytes.length % 32; - if (padOffset) { - return concat([bytes, padding.slice(padOffset)]); - } - return hexlify(bytes); -} -const hexTrue = toBeHex(BN_1, 32); -const hexFalse = toBeHex(BN_0, 32); -const domainFieldTypes = { - name: "string", - version: "string", - networkId: "uint256", - verifyingContract: "address", - salt: "bytes32", -}; -const domainFieldNames = [ - "name", - "version", - "networkId", - "verifyingContract", - "salt", -]; -function checkString(key) { - return function (value) { - assertArgument(typeof value === "string", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); - return value; - }; -} -const domainChecks = { - name: checkString("name"), - version: checkString("version"), - networkId: function (_value) { - const value = getBigInt(_value, "domain.networkId"); - assertArgument(value >= 0, "invalid chain ID", "domain.networkId", _value); - if (Number.isSafeInteger(value)) { - return Number(value); - } - return toQuantity(value); - }, - verifyingContract: function (value) { - try { - return getAddress(value).toLowerCase(); - } - catch (error) { } - assertArgument(false, `invalid domain value "verifyingContract"`, "domain.verifyingContract", value); - }, - salt: function (value) { - const bytes = getBytes(value, "domain.salt"); - assertArgument(bytes.length === 32, `invalid domain value "salt"`, "domain.salt", value); - return hexlify(bytes); - }, -}; -function getBaseEncoder(type) { - // intXX and uintXX - { - const match = type.match(/^(u?)int(\d*)$/); - if (match) { - const signed = match[1] === ""; - const width = parseInt(match[2] || "256"); - assertArgument(width % 8 === 0 && - width !== 0 && - width <= 256 && - (match[2] == null || match[2] === String(width)), "invalid numeric width", "type", type); - const boundsUpper = mask(BN_MAX_UINT256, signed ? width - 1 : width); - const boundsLower = signed ? (boundsUpper + BN_1) * BN__1 : BN_0; - return function (_value) { - const value = getBigInt(_value, "value"); - assertArgument(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, "value", value); - return toBeHex(signed ? toTwos(value, 256) : value, 32); - }; - } - } - // bytesXX - { - const match = type.match(/^bytes(\d+)$/); - if (match) { - const width = parseInt(match[1]); - assertArgument(width !== 0 && width <= 32 && match[1] === String(width), "invalid bytes width", "type", type); - return function (value) { - const bytes = getBytes(value); - assertArgument(bytes.length === width, `invalid length for ${type}`, "value", value); - return hexPadRight(value); - }; - } - } - switch (type) { - case "address": - return function (value) { - return zeroPadValue(getAddress(value), 32); - }; - case "bool": - return function (value) { - return !value ? hexFalse : hexTrue; - }; - case "bytes": - return function (value) { - return sha256(value); - }; - case "string": - return function (value) { - return id(value); - }; - } - return null; -} -function encodeType(name, fields) { - return `${name}(${fields - .map(({ name, type }) => type + " " + name) - .join(",")})`; -} -export class TypedDataEncoder { - primaryType; - #types; - get types() { - return JSON.parse(this.#types); - } - #fullTypes; - #encoderCache; - constructor(types) { - this.#types = JSON.stringify(types); - this.#fullTypes = new Map(); - this.#encoderCache = new Map(); - // Link struct types to their direct child structs - const links = new Map(); - // Link structs to structs which contain them as a child - const parents = new Map(); - // Link all subtypes within a given struct - const subtypes = new Map(); - Object.keys(types).forEach((type) => { - links.set(type, new Set()); - parents.set(type, []); - subtypes.set(type, new Set()); - }); - for (const name in types) { - const uniqueNames = new Set(); - for (const field of types[name]) { - // Check each field has a unique name - assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types); - uniqueNames.add(field.name); - // Get the base type (drop any array specifiers) - const baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1] || null; - assertArgument(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", types); - // Is this a base encoding type? - const encoder = getBaseEncoder(baseType); - if (encoder) { - continue; - } - assertArgument(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", types); - // Add linkage - parents.get(baseType).push(name); - links.get(name).add(baseType); - } - } - // Deduce the primary type - const primaryTypes = Array.from(parents.keys()).filter((n) => parents.get(n).length === 0); - assertArgument(primaryTypes.length !== 0, "missing primary type", "types", types); - assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes - .map((t) => JSON.stringify(t)) - .join(", ")}`, "types", types); - defineProperties(this, { primaryType: primaryTypes[0] }); - // Check for circular type references - function checkCircular(type, found) { - assertArgument(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", types); - found.add(type); - for (const child of links.get(type)) { - if (!parents.has(child)) { - continue; - } - // Recursively check children - checkCircular(child, found); - // Mark all ancestors as having this decendant - for (const subtype of found) { - subtypes.get(subtype).add(child); - } - } - found.delete(type); - } - checkCircular(this.primaryType, new Set()); - // Compute each fully describe type - for (const [name, set] of subtypes) { - const st = Array.from(set); - st.sort(); - this.#fullTypes.set(name, encodeType(name, types[name]) + - st.map((t) => encodeType(t, types[t])).join("")); - } - } - getEncoder(type) { - let encoder = this.#encoderCache.get(type); - if (!encoder) { - encoder = this.#getEncoder(type); - this.#encoderCache.set(type, encoder); - } - return encoder; - } - #getEncoder(type) { - // Basic encoder type (address, bool, uint256, etc) - { - const encoder = getBaseEncoder(type); - if (encoder) { - return encoder; - } - } - // Array - const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); - if (match) { - const subtype = match[1]; - const subEncoder = this.getEncoder(subtype); - return (value) => { - assertArgument(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value); - let result = value.map(subEncoder); - if (this.#fullTypes.has(subtype)) { - result = result.map(sha256); - } - return sha256(concat(result)); - }; - } - // Struct - const fields = this.types[type]; - if (fields) { - const encodedType = id(this.#fullTypes.get(type)); - return (value) => { - const values = fields.map(({ name, type }) => { - const result = this.getEncoder(type)(value[name]); - if (this.#fullTypes.has(type)) { - return sha256(result); - } - return result; - }); - values.unshift(encodedType); - return concat(values); - }; - } - assertArgument(false, `unknown type: ${type}`, "type", type); - } - encodeType(name) { - const result = this.#fullTypes.get(name); - assertArgument(result, `unknown type: ${JSON.stringify(name)}`, "name", name); - return result; - } - encodeData(type, value) { - return this.getEncoder(type)(value); - } - hashStruct(name, value) { - return sha256(this.encodeData(name, value)); - } - encode(value) { - return this.encodeData(this.primaryType, value); - } - hash(value) { - return this.hashStruct(this.primaryType, value); - } - _visit(type, value, callback) { - // Basic encoder type (address, bool, uint256, etc) - { - const encoder = getBaseEncoder(type); - if (encoder) { - return callback(type, value); - } - } - // Array - const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); - if (match) { - assertArgument(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value); - return value.map((v) => this._visit(match[1], v, callback)); - } - // Struct - const fields = this.types[type]; - if (fields) { - return fields.reduce((accum, { name, type }) => { - accum[name] = this._visit(type, value[name], callback); - return accum; - }, {}); - } - assertArgument(false, `unknown type: ${type}`, "type", type); - } - visit(value, callback) { - return this._visit(this.primaryType, value, callback); - } - static from(types) { - return new TypedDataEncoder(types); - } - static getPrimaryType(types) { - return TypedDataEncoder.from(types).primaryType; - } - static hashStruct(name, types, value) { - return TypedDataEncoder.from(types).hashStruct(name, value); - } - static hashDomain(domain) { - const domainFields = []; - for (const name in domain) { - if (domain[name] == null) { - continue; - } - const type = domainFieldTypes[name]; - assertArgument(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); - domainFields.push({ name, type }); - } - domainFields.sort((a, b) => { - return (domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name)); - }); - return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); - } - static encode(domain, types, value) { - return concat([ - "0x1901", - TypedDataEncoder.hashDomain(domain), - TypedDataEncoder.from(types).hash(value), - ]); - } - static hash(domain, types, value) { - return sha256(TypedDataEncoder.encode(domain, types, value)); - } - // Replaces all address types with ENS names with their looked up address - static async resolveNames(domain, types, value, resolveName) { - // Make a copy to isolate it from the object passed in - domain = Object.assign({}, domain); - // Allow passing null to ignore value - for (const key in domain) { - if (domain[key] == null) { - delete domain[key]; - } - } - // Look up all ENS names - const ensCache = {}; - // Do we need to look up the domain's verifyingContract? - if (domain.verifyingContract && - !isHexString(domain.verifyingContract, 20)) { - ensCache[domain.verifyingContract] = "0x"; - } - // We are going to use the encoder to visit all the base values - const encoder = TypedDataEncoder.from(types); - // Get a list of all the addresses - encoder.visit(value, (type, value) => { - if (type === "address" && !isHexString(value, 20)) { - ensCache[value] = "0x"; - } - return value; - }); - // Lookup each name - for (const name in ensCache) { - ensCache[name] = await resolveName(name); - } - // Replace the domain verifyingContract if needed - if (domain.verifyingContract && ensCache[domain.verifyingContract]) { - domain.verifyingContract = ensCache[domain.verifyingContract]; - } - // Replace all ENS names with their address - value = encoder.visit(value, (type, value) => { - if (type === "address" && ensCache[value]) { - return ensCache[value]; - } - return value; - }); - return { domain, value }; - } - static getPayload(domain, types, value) { - // Validate the domain fields - TypedDataEncoder.hashDomain(domain); - // Derive the EIP712Domain Struct reference type - const domainValues = {}; - const domainTypes = []; - domainFieldNames.forEach((name) => { - const value = domain[name]; - if (value == null) { - return; - } - domainValues[name] = domainChecks[name](value); - domainTypes.push({ name, type: domainFieldTypes[name] }); - }); - const encoder = TypedDataEncoder.from(types); - const typesWithDomain = Object.assign({}, types); - assertArgument(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types); - typesWithDomain.EIP712Domain = domainTypes; - // Validate the data structures and types - encoder.encode(value); - return { - types: typesWithDomain, - domain: domainValues, - primaryType: encoder.primaryType, - message: encoder.visit(value, (type, value) => { - // bytes - if (type.match(/^bytes(\d*)/)) { - return hexlify(getBytes(value)); - } - // uint or int - if (type.match(/^u?int/)) { - return getBigInt(value).toString(); - } - switch (type) { - case "address": - return value.toLowerCase(); - case "bool": - return !!value; - case "string": - assertArgument(typeof value === "string", "invalid string", "value", value); - return value; - } - assertArgument(false, "unsupported type", "type", type); - }), - }; - } -} -/** - * Compute the address used to sign the typed data for the %%signature%%. - */ -export function verifyTypedData(domain, types, value, signature, prefix) { - return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature, prefix); -} -//# sourceMappingURL=typed-data.js.map \ No newline at end of file diff --git a/lib.esm/hash/typed-data.js.map b/lib.esm/hash/typed-data.js.map deleted file mode 100644 index c7200f018..000000000 --- a/lib.esm/hash/typed-data.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"typed-data.js","sourceRoot":"","sources":["../../src.ts/hash/typed-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACL,MAAM,EACN,gBA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 --- a/lib.esm/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * The Application Programming Interface (API) is the collection of - * functions, classes and types offered by the CoreBC library. - * - * @_section: api:Application Programming Interface [about-api] - * @_navTitle: API - */ -import { Buffer } from "buffer"; -export { Buffer }; -import * as corebc from "./corebc.js"; -export { corebc }; -export * from "./corebc.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.esm/index.d.ts.map b/lib.esm/index.d.ts.map deleted file mode 100644 index 5841be6e6..000000000 --- a/lib.esm/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,cAAc,aAAa,CAAC"} \ No newline at end of file diff --git a/lib.esm/index.js b/lib.esm/index.js deleted file mode 100644 index 45f378b72..000000000 --- a/lib.esm/index.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * The Application Programming Interface (API) is the collection of - * functions, classes and types offered by the CoreBC library. - * - * @_section: api:Application Programming Interface [about-api] - * @_navTitle: API - */ -import { Buffer } from "buffer"; -export { Buffer }; -import * as corebc from "./corebc.js"; -export { corebc }; -export * from "./corebc.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.esm/index.js.map b/lib.esm/index.js.map deleted file mode 100644 index af4e10759..000000000 --- a/lib.esm/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,cAAc,aAAa,CAAC"} \ No newline at end of file diff --git a/lib.esm/logger/logger.d.ts b/lib.esm/logger/logger.d.ts deleted file mode 100644 index df72240a3..000000000 --- a/lib.esm/logger/logger.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -export declare enum LogLevel { - DEBUG = "DEBUG", - INFO = "INFO", - WARNING = "WARNING", - ERROR = "ERROR", - OFF = "OFF" -} -export declare enum ErrorCode { - UNKNOWN_ERROR = "UNKNOWN_ERROR", - NOT_IMPLEMENTED = "NOT_IMPLEMENTED", - UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", - NETWORK_ERROR = "NETWORK_ERROR", - SERVER_ERROR = "SERVER_ERROR", - TIMEOUT = "TIMEOUT", - BUFFER_OVERRUN = "BUFFER_OVERRUN", - NUMERIC_FAULT = "NUMERIC_FAULT", - MISSING_NEW = "MISSING_NEW", - INVALID_ARGUMENT = "INVALID_ARGUMENT", - MISSING_ARGUMENT = "MISSING_ARGUMENT", - UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", - CALL_EXCEPTION = "CALL_EXCEPTION", - INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", - NONCE_EXPIRED = "NONCE_EXPIRED", - REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", - UNPREDICTABLE_ENERGY_LIMIT = "UNPREDICTABLE_ENERGY_LIMIT", - TRANSACTION_REPLACED = "TRANSACTION_REPLACED" -} -export declare class Logger { - readonly version: string; - static errors: typeof ErrorCode; - static levels: typeof LogLevel; - constructor(version: string); - _log(logLevel: LogLevel, args: Array): void; - debug(...args: Array): void; - info(...args: Array): void; - warn(...args: Array): void; - makeError(message: string, code?: ErrorCode, params?: any): Error; - throwError(message: string, code?: ErrorCode, params?: any): never; - throwArgumentError(message: string, name: string, value: any): never; - assert(condition: any, message: string, code?: ErrorCode, params?: any): void; - assertArgument(condition: any, message: string, name: string, value: any): void; - checkNormalize(message?: string): void; - checkSafeUint53(value: number, message?: string): void; - checkArgumentCount(count: number, expectedCount: number, message?: string): void; - checkNew(target: any, kind: any): void; - checkAbstract(target: any, kind: any): void; - static globalLogger(): Logger; - static setCensorship(censorship: boolean, permanent?: boolean): void; - static setLogLevel(logLevel: LogLevel): void; - static from(version: string): Logger; -} -//# sourceMappingURL=logger.d.ts.map \ No newline at end of file diff --git a/lib.esm/logger/logger.d.ts.map b/lib.esm/logger/logger.d.ts.map deleted file mode 100644 index f1ca4504f..000000000 --- a/lib.esm/logger/logger.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src.ts/logger/logger.ts"],"names":[],"mappings":"AAmDA,oBAAY,QAAQ;IAClB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,GAAG,QAAQ;CACZ;AAED,oBAAY,SAAS;IAKnB,aAAa,kBAAkB;IAG/B,eAAe,oBAAoB;IAInC,qBAAqB,0BAA0B;IAI/C,aAAa,kBAAkB;IAG/B,YAAY,iBAAiB;IAG7B,OAAO,YAAY;IAMnB,cAAc,mBAAmB;IAKjC,aAAa,kBAAkB;IAO/B,WAAW,gBAAgB;IAK3B,gBAAgB,qBAAqB;IAKrC,gBAAgB,qBAAqB;IAKrC,mBAAmB,wBAAwB;IAa3C,cAAc,mBAAmB;IAIjC,kBAAkB,uBAAuB;IAIzC,aAAa,kBAAkB;IAI/B,uBAAuB,4BAA4B;IAInD,0BAA0B,+BAA+B;IAQzD,oBAAoB,yBAAyB;CAC9C;AAID,qBAAa,MAAM;IACjB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAW;IAEnC,MAAM,CAAC,MAAM,mBAAa;IAE1B,MAAM,CAAC,MAAM,kBAAY;gBAEb,OAAO,EAAE,MAAM;IAQ3B,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,I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AM,CAAC,YAAY,IAAI,MAAM;IAO7B,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI;IA4BpE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAS5C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAGrC"} \ No newline at end of file diff --git a/lib.esm/logger/logger.js b/lib.esm/logger/logger.js deleted file mode 100644 index fcc9c082e..000000000 --- a/lib.esm/logger/logger.js +++ /dev/null @@ -1,329 +0,0 @@ -"use strict"; -let _permanentCensorErrors = false; -let _censorErrors = false; -const LogLevels = { - debug: 1, - default: 2, - info: 2, - warning: 3, - error: 4, - off: 5, -}; -let _logLevel = LogLevels["default"]; -let _globalLogger = null; -function _checkNormalize() { - try { - const missing = []; - // Make sure all forms of normalization are supported - ["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => { - try { - if ("test".normalize(form) !== "test") { - throw new Error("bad normalize"); - } - } - catch (error) { - missing.push(form); - } - }); - if (missing.length) { - throw new Error("missing " + missing.join(", ")); - } - if (String.fromCharCode(0xe9).normalize("NFD") !== - String.fromCharCode(0x65, 0x0301)) { - throw new Error("broken implementation"); - } - } - catch (error) { - return error.message; - } - return null; -} -const _normalizeError = _checkNormalize(); -export var LogLevel; -(function (LogLevel) { - LogLevel["DEBUG"] = "DEBUG"; - LogLevel["INFO"] = "INFO"; - LogLevel["WARNING"] = "WARNING"; - LogLevel["ERROR"] = "ERROR"; - LogLevel["OFF"] = "OFF"; -})(LogLevel || (LogLevel = {})); -export var ErrorCode; -(function (ErrorCode) { - /////////////////// - // Generic Errors - // Unknown Error - ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; - // Not Implemented - ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED"; - // Unsupported Operation - // - operation - ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION"; - // Network Error (i.e. Core Network, such as an invalid network ID) - // - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown) - ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR"; - // Some sort of bad response from the server - ErrorCode["SERVER_ERROR"] = "SERVER_ERROR"; - // Timeout - ErrorCode["TIMEOUT"] = "TIMEOUT"; - /////////////////// - // Operational Errors - // Buffer Overrun - ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN"; - // Numeric Fault - // - operation: the operation being executed - // - fault: the reason this faulted - ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT"; - /////////////////// - // Argument Errors - // Missing new operator to an object - // - name: The name of the class - ErrorCode["MISSING_NEW"] = "MISSING_NEW"; - // Invalid argument (e.g. value is incompatible with type) to a function: - // - argument: The argument name that was invalid - // - value: The value of the argument - ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT"; - // Missing argument to a function: - // - count: The number of arguments received - // - expectedCount: The number of arguments expected - ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT"; - // Too many arguments - // - count: The number of arguments received - // - expectedCount: The number of arguments expected - ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT"; - /////////////////// - // Blockchain Errors - // Call exception - // - transaction: the transaction - // - address?: the contract address - // - args?: The arguments passed into the function - // - method?: The Solidity method signature - // - errorSignature?: The EIP848 error signature - // - errorArgs?: The EIP848 error parameters - // - reason: The reason (only for EIP848 "Error(string)") - ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION"; - // Insufficient funds (< value + energyLimit * energyPrice) - // - transaction: the transaction attempted - ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; - // Nonce has already been used - // - transaction: the transaction attempted - ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED"; - // The replacement fee for the transaction is too low - // - transaction: the transaction attempted - ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED"; - // The energy limit could not be estimated - // - transaction: the transaction passed to estimateEnergy - ErrorCode["UNPREDICTABLE_ENERGY_LIMIT"] = "UNPREDICTABLE_ENERGY_LIMIT"; - // The transaction was replaced by one with a higher energy price - // - reason: "cancelled", "replaced" or "repriced" - // - cancelled: true if reason == "cancelled" or reason == "replaced") - // - hash: original transaction hash - // - replacement: the full TransactionsResponse for the replacement - // - receipt: the receipt of the replacement - ErrorCode["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED"; -})(ErrorCode || (ErrorCode = {})); -const HEX = "0123456789abcdef"; -export class Logger { - version = "0.0.1"; - static errors = ErrorCode; - static levels = LogLevel; - constructor(version) { - Object.defineProperty(this, "version", { - enumerable: true, - value: version, - writable: false, - }); - } - _log(logLevel, args) { - const level = logLevel.toLowerCase(); - if (LogLevels[level] == null) { - this.throwArgumentError("invalid log level name", "logLevel", logLevel); - } - if (_logLevel > LogLevels[level]) { - return; - } - console.log.apply(console, args); - } - debug(...args) { - this._log(Logger.levels.DEBUG, args); - } - info(...args) { - this._log(Logger.levels.INFO, args); - } - warn(...args) { - this._log(Logger.levels.WARNING, args); - } - makeError(message, code, params) { - // Errors are being censored - if (_censorErrors) { - return this.makeError("censored error", code, {}); - } - if (!code) { - code = Logger.errors.UNKNOWN_ERROR; - } - if (!params) { - params = {}; - } - const messageDetails = []; - Object.keys(params).forEach((key) => { - const value = params[key]; - try { - if (value instanceof Uint8Array) { - let hex = ""; - for (let i = 0; i < value.length; i++) { - hex += HEX[value[i] >> 4]; - hex += HEX[value[i] & 0x0f]; - } - messageDetails.push(key + "=Uint8Array(0x" + hex + ")"); - } - else { - messageDetails.push(key + "=" + JSON.stringify(value)); - } - } - catch (error) { - messageDetails.push(key + "=" + JSON.stringify(params[key].toString())); - } - }); - messageDetails.push(`code=${code}`); - messageDetails.push(`version=${this.version}`); - const reason = message; - if (messageDetails.length) { - message += " (" + messageDetails.join(", ") + ")"; - } - // @TODO: Any?? - const error = new Error(message); - error.reason = reason; - error.code = code; - Object.keys(params).forEach(function (key) { - error[key] = params[key]; - }); - return error; - } - throwError(message, code, params) { - throw this.makeError(message, code, params); - } - throwArgumentError(message, name, value) { - return this.throwError(message, Logger.errors.INVALID_ARGUMENT, { - argument: name, - value: value, - }); - } - assert(condition, message, code, params) { - if (!!condition) { - return; - } - this.throwError(message, code, params); - } - assertArgument(condition, message, name, value) { - if (!!condition) { - return; - } - this.throwArgumentError(message, name, value); - } - checkNormalize(message) { - if (message == null) { - message = "platform missing String.prototype.normalize"; - } - if (_normalizeError) { - this.throwError("platform missing String.prototype.normalize", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "String.prototype.normalize", - form: _normalizeError, - }); - } - } - checkSafeUint53(value, message) { - if (typeof value !== "number") { - return; - } - if (message == null) { - message = "value not safe"; - } - if (value < 0 || value >= 0x1fffffffffffff) { - this.throwError(message, Logger.errors.NUMERIC_FAULT, { - operation: "checkSafeInteger", - fault: "out-of-safe-range", - value: value, - }); - } - if (value % 1) { - this.throwError(message, Logger.errors.NUMERIC_FAULT, { - operation: "checkSafeInteger", - fault: "non-integer", - value: value, - }); - } - } - checkArgumentCount(count, expectedCount, message) { - if (message) { - message = ": " + message; - } - else { - message = ""; - } - if (count < expectedCount) { - this.throwError("missing argument" + message, Logger.errors.MISSING_ARGUMENT, { - count: count, - expectedCount: expectedCount, - }); - } - if (count > expectedCount) { - this.throwError("too many arguments" + message, Logger.errors.UNEXPECTED_ARGUMENT, { - count: count, - expectedCount: expectedCount, - }); - } - } - checkNew(target, kind) { - if (target === Object || target == null) { - this.throwError("missing new", Logger.errors.MISSING_NEW, { - name: kind.name, - }); - } - } - checkAbstract(target, kind) { - if (target === kind) { - this.throwError("cannot instantiate abstract class " + - JSON.stringify(kind.name) + - " directly; use a sub-class", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" }); - } - else if (target === Object || target == null) { - this.throwError("missing new", Logger.errors.MISSING_NEW, { - name: kind.name, - }); - } - } - static globalLogger() { - if (!_globalLogger) { - _globalLogger = new Logger("logger/0.0.1"); - } - return _globalLogger; - } - static setCensorship(censorship, permanent) { - if (!censorship && permanent) { - this.globalLogger().throwError("cannot permanently disable censorship", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "setCensorship", - }); - } - if (_permanentCensorErrors) { - if (!censorship) { - return; - } - this.globalLogger().throwError("error censorship permanent", Logger.errors.UNSUPPORTED_OPERATION, { - operation: "setCensorship", - }); - } - _censorErrors = !!censorship; - _permanentCensorErrors = !!permanent; - } - static setLogLevel(logLevel) { - const level = LogLevels[logLevel.toLowerCase()]; - if (level == null) { - Logger.globalLogger().warn("invalid log level - " + logLevel); - return; - } - _logLevel = level; - } - static from(version) { - return new Logger(version); - } -} -//# sourceMappingURL=logger.js.map \ No newline at end of file diff --git a/lib.esm/logger/logger.js.map b/lib.esm/logger/logger.js.map deleted file mode 100644 index 179f9e643..000000000 --- a/lib.esm/logger/logger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src.ts/logger/logger.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,sBAAsB,GAAG,KAAK,CAAC;AACnC,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B,MAAM,SAAS,GAA+B;IAC5C,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,CAAC;CACP,CAAC;AACF,IAAI,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;AAErC,IAAI,aAAa,GAAQ,IAAI,CAAC;AAE9B,SAAS,eAAe;IACtB,IAAI;QACF,MAAM,OAAO,GAAkB,EAAE,CAAC;QAElC,qDAAqD;QACrD,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC9C,IAAI;gBACF,IAAI,MAAM,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AAU,EAAE;gBACf,OAAO;aACR;YACD,IAAI,CAAC,YAAY,EAAE,CAAC,UAAU,CAC5B,4BAA4B,EAC5B,MAAM,CAAC,MAAM,CAAC,qBAAqB,EACnC;gBACE,SAAS,EAAE,eAAe;aAC3B,CACF,CAAC;SACH;QAED,aAAa,GAAG,CAAC,CAAC,UAAU,CAAC;QAC7B,sBAAsB,GAAG,CAAC,CAAC,SAAS,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,QAAkB;QACnC,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QAChD,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,MAAM,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,sBAAsB,GAAG,QAAQ,CAAC,CAAC;YAC9D,OAAO;SACR;QACD,SAAS,GAAG,KAAK,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,OAAe;QACzB,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC"} \ No newline at end of file diff --git a/lib.esm/package.json b/lib.esm/package.json deleted file mode 100644 index 04a5cfd61..000000000 --- a/lib.esm/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "browser": { - "./crypto/crypto.js": "./crypto/crypto-browser.js", - "./providers/provider-ipcsocket.js": "./providers/provider-ipcsocket-browser.js", - "./providers/ws.js": "./providers/ws-browser.js", - "./utils/base64.js": "./utils/base64-browser.js", - "./utils/geturl.js": "./utils/geturl-browser.js", - "./wordlists/wordlists.js": "./wordlists/wordlists-browser.js" - }, - "sideEffects": false, - "type": "module" -} diff --git a/lib.esm/providers/abstract-provider.d.ts b/lib.esm/providers/abstract-provider.d.ts deleted file mode 100644 index 79ee0dee3..000000000 --- a/lib.esm/providers/abstract-provider.d.ts +++ /dev/null @@ -1,211 +0,0 @@ -/** - * About Subclassing the Provider... - * - * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] - */ -import { FetchRequest } from "../utils/index.js"; -import { Network } from "./network.js"; -import { Block, FeeData, Log, TransactionReceipt, TransactionResponse } from "./provider.js"; -import type { AddressLike } from "../address/index.js"; -import type { BigNumberish } from "../utils/index.js"; -import type { Listener } from "../utils/index.js"; -import type { Networkish } from "./network.js"; -import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; -import type { BlockTag, EventFilter, Filter, FilterByBlockHash, OrphanFilter, PreparedTransactionRequest, Provider, ProviderEvent, TransactionRequest } from "./provider.js"; -export type DebugEventAbstractProvider = { - action: "sendCcipReadFetchRequest"; - request: FetchRequest; - index: number; - urls: Array; -} | { - action: "receiveCcipReadFetchResult"; - request: FetchRequest; - result: any; -} | { - action: "receiveCcipReadFetchError"; - request: FetchRequest; - result: any; -} | { - action: "sendCcipReadCall"; - transaction: { - to: string; - data: string; - }; -} | { - action: "receiveCcipReadCallResult"; - transaction: { - to: string; - data: string; - }; - result: string; -} | { - action: "receiveCcipReadCallError"; - transaction: { - to: string; - data: string; - }; - error: Error; -}; -export type Subscription = { - type: "block" | "close" | "debug" | "error" | "network" | "pending"; - tag: string; -} | { - type: "transaction"; - tag: string; - hash: string; -} | { - type: "event"; - tag: string; - filter: EventFilter; -} | { - type: "orphan"; - tag: string; - filter: OrphanFilter; -}; -export interface Subscriber { - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; - pollingInterval?: number; -} -export declare class UnmanagedSubscriber implements Subscriber { - name: string; - constructor(name: string); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -export interface AbstractProviderPlugin { - readonly name: string; - connect(provider: AbstractProvider): AbstractProviderPlugin; -} -export type PerformActionFilter = { - address?: string | Array; - topics?: Array>; - fromBlock?: BlockTag; - toBlock?: BlockTag; -} | { - address?: string | Array; - topics?: Array>; - blockHash?: string; -}; -export interface PerformActionTransaction extends PreparedTransactionRequest { - to?: string; - from?: string; -} -export type PerformActionRequest = { - method: "broadcastTransaction"; - signedTransaction: string; -} | { - method: "call"; - transaction: PerformActionTransaction; - blockTag: BlockTag; -} | { - method: "networkId"; -} | { - method: "estimateEnergy"; - transaction: PerformActionTransaction; -} | { - method: "getBalance"; - address: string; - blockTag: BlockTag; -} | { - method: "getBlock"; - blockTag: BlockTag; - includeTransactions: boolean; -} | { - method: "getBlock"; - blockHash: string; - includeTransactions: boolean; -} | { - method: "getBlockNumber"; -} | { - method: "getCode"; - address: string; - blockTag: BlockTag; -} | { - method: "getEnergyPrice"; -} | { - method: "getLogs"; - filter: PerformActionFilter; -} | { - method: "getStorage"; - address: string; - position: bigint; - blockTag: BlockTag; -} | { - method: "getTransaction"; - hash: string; -} | { - method: "getTransactionCount"; - address: string; - blockTag: BlockTag; -} | { - method: "getTransactionReceipt"; - hash: string; -} | { - method: "getTransactionResult"; - hash: string; -}; -export declare class AbstractProvider implements Provider { - #private; - constructor(_network?: "any" | Networkish); - get provider(): this; - get plugins(): Array; - attachPlugin(plugin: AbstractProviderPlugin): this; - getPlugin(name: string): null | T; - get disableCcipRead(): boolean; - set disableCcipRead(value: boolean); - ccipReadFetch(tx: PerformActionTransaction, calldata: string, urls: Array): Promise; - _wrapBlock(value: BlockParams, network: Network): Block; - _wrapLog(value: LogParams, network: Network): Log; - _wrapTransactionReceipt(value: TransactionReceiptParams, network: Network): TransactionReceipt; - _wrapTransactionResponse(tx: TransactionResponseParams, network: Network): TransactionResponse; - _detectNetwork(): Promise; - _perform(req: PerformActionRequest): Promise; - getBlockNumber(): Promise; - _getAddress(address: AddressLike): string | Promise; - _getBlockTag(blockTag?: BlockTag): string | Promise; - _getFilter(filter: Filter | FilterByBlockHash): PerformActionFilter | Promise; - _getTransactionRequest(_request: TransactionRequest): PerformActionTransaction | Promise; - getNetwork(): Promise; - getEnergyPrice(): Promise; - getFeeData(): Promise; - estimateEnergy(_tx: TransactionRequest): Promise; - call(_tx: TransactionRequest): Promise; - getBalance(address: AddressLike, blockTag?: BlockTag): Promise; - getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise; - getCode(address: AddressLike, blockTag?: BlockTag): Promise; - getStorage(address: AddressLike, _position: BigNumberish, blockTag?: BlockTag): Promise; - broadcastTransaction(signedTx: string): Promise; - getBlock(block: BlockTag | string, prefetchTxs?: boolean): Promise; - getTransaction(hash: string): Promise; - getTransactionReceipt(hash: string): Promise; - getTransactionResult(hash: string): Promise; - getLogs(_filter: Filter | FilterByBlockHash): Promise>; - _getProvider(networkId: number): AbstractProvider; - waitForTransaction(hash: string, _confirms?: null | number, timeout?: null | number): Promise; - waitForBlock(blockTag?: BlockTag): Promise; - _clearTimeout(timerId: number): void; - _setTimeout(_func: () => void, timeout?: number): number; - _forEachSubscriber(func: (s: Subscriber) => void): void; - _getSubscriber(sub: Subscription): Subscriber; - _recoverSubscriber(oldSub: Subscriber, newSub: Subscriber): void; - on(event: ProviderEvent, listener: Listener): Promise; - once(event: ProviderEvent, listener: Listener): Promise; - emit(event: ProviderEvent, ...args: Array): Promise; - listenerCount(event?: ProviderEvent): Promise; - listeners(event?: ProviderEvent): Promise>; - off(event: ProviderEvent, listener?: Listener): Promise; - removeAllListeners(event?: ProviderEvent): Promise; - addListener(event: ProviderEvent, listener: Listener): Promise; - removeListener(event: ProviderEvent, listener: Listener): Promise; - destroy(): void; - get paused(): boolean; - set paused(pause: boolean); - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -//# sourceMappingURL=abstract-provider.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/abstract-provider.d.ts.map b/lib.esm/providers/abstract-provider.d.ts.map deleted file mode 100644 index ca3a7ea53..000000000 --- a/lib.esm/providers/abstract-provider.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/abstract-provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,EAaL,YAAY,EAOb,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EAAE,OAAO,EAAE,MA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AAI,OAAO,CAEpB;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,EAUxB;IAED,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IA+BtC,MAAM,IAAI,IAAI;CAqBf"} \ No newline at end of file diff --git a/lib.esm/providers/abstract-provider.js b/lib.esm/providers/abstract-provider.js deleted file mode 100644 index 52658839f..000000000 --- a/lib.esm/providers/abstract-provider.js +++ /dev/null @@ -1,1235 +0,0 @@ -/** - * About Subclassing the Provider... - * - * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] - */ -// @TODO -// Event coalescence -// When we register an event with an async value (e.g. address is a Signer -// or ENS name), we need to add it immeidately for the Event API, but also -// need time to resolve the address. Upon resolving the address, we need to -// migrate the listener to the static event. We also need to maintain a map -// of Signer/ENS name to address so we can sync respond to listenerCount. -import { resolveAddress } from "../address/checks.js"; -import { Transaction } from "../transaction/index.js"; -import { concat, dataLength, dataSlice, hexlify, isHexString, getBigInt, getBytes, getNumber, isCallException, makeError, assert, assertArgument, FetchRequest, toBeArray, toQuantity, defineProperties, EventPayload, resolveProperties, toUtf8String, } from "../utils/index.js"; -import { formatBlock, formatLog, formatTransactionReceipt, formatTransactionResponse, } from "./format.js"; -import { Network } from "./network.js"; -import { copyRequest, Block, FeeData, Log, TransactionReceipt, TransactionResponse, } from "./provider.js"; -import { PollingBlockSubscriber, PollingEventSubscriber, PollingOrphanSubscriber, PollingTransactionSubscriber, } from "./subscriber-polling.js"; -const MAX_CCIP_REDIRECTS = 10; -function isPromise(value) { - return value && typeof value.then === "function"; -} -function getTag(prefix, value) { - return (prefix + - ":" + - JSON.stringify(value, (k, v) => { - if (v == null) { - return "null"; - } - if (typeof v === "bigint") { - return `bigint:${v.toString()}`; - } - if (typeof v === "string") { - return v.toLowerCase(); - } - // Sort object keys - if (typeof v === "object" && !Array.isArray(v)) { - const keys = Object.keys(v); - keys.sort(); - return keys.reduce((accum, key) => { - accum[key] = v[key]; - return accum; - }, {}); - } - return v; - })); -} -export class UnmanagedSubscriber { - name; - constructor(name) { - defineProperties(this, { name }); - } - start() { } - stop() { } - pause(dropWhilePaused) { } - resume() { } -} -function copy(value) { - return JSON.parse(JSON.stringify(value)); -} -function concisify(items) { - items = Array.from(new Set(items).values()); - items.sort(); - return items; -} -async function getSubscription(_event, provider) { - if (_event == null) { - throw new Error("invalid event"); - } - // Normalize topic array info an EventFilter - if (Array.isArray(_event)) { - _event = { topics: _event }; - } - if (typeof _event === "string") { - switch (_event) { - case "block": - case "pending": - case "debug": - case "error": - case "network": { - return { type: _event, tag: _event }; - } - } - } - if (isHexString(_event, 32)) { - const hash = _event.toLowerCase(); - return { type: "transaction", tag: getTag("tx", { hash }), hash }; - } - if (_event.orphan) { - const event = _event; - // @TODO: Should lowercase and whatnot things here instead of copy... - return { - type: "orphan", - tag: getTag("orphan", event), - filter: copy(event), - }; - } - if (_event.address || _event.topics) { - const event = _event; - const filter = { - topics: (event.topics || []).map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - return concisify(t.map((t) => t.toLowerCase())); - } - return t.toLowerCase(); - }), - }; - if (event.address) { - const addresses = []; - const promises = []; - const addAddress = (addr) => { - if (isHexString(addr)) { - addresses.push(addr); - } - else { - promises.push((async () => { - addresses.push(await resolveAddress(addr)); - })()); - } - }; - if (Array.isArray(event.address)) { - event.address.forEach(addAddress); - } - else { - addAddress(event.address); - } - if (promises.length) { - await Promise.all(promises); - } - filter.address = concisify(addresses.map((a) => a.toLowerCase())); - } - return { filter, tag: getTag("event", filter), type: "event" }; - } - assertArgument(false, "unknown ProviderEvent", "event", _event); -} -function getTime() { - return new Date().getTime(); -} -export class AbstractProvider { - #subs; - #plugins; - // null=unpaused, true=paused+dropWhilePaused, false=paused - #pausedState; - #networkPromise; - #anyNetwork; - #performCache; - // The most recent block number if running an event or -1 if no "block" event - #lastBlockNumber; - #nextTimer; - #timers; - #disableCcipRead; - // @TODO: This should be a () => Promise so network can be - // done when needed; or rely entirely on _detectNetwork? - constructor(_network) { - if (_network === "any") { - this.#anyNetwork = true; - this.#networkPromise = null; - } - else if (_network) { - const network = Network.from(_network); - this.#anyNetwork = false; - this.#networkPromise = Promise.resolve(network); - setTimeout(() => { - this.emit("network", network, null); - }, 0); - } - else { - this.#anyNetwork = false; - this.#networkPromise = null; - } - this.#lastBlockNumber = -1; - this.#performCache = new Map(); - this.#subs = new Map(); - this.#plugins = new Map(); - this.#pausedState = null; - this.#nextTimer = 1; - this.#timers = new Map(); - this.#disableCcipRead = false; - } - get provider() { - return this; - } - get plugins() { - return Array.from(this.#plugins.values()); - } - attachPlugin(plugin) { - if (this.#plugins.get(plugin.name)) { - throw new Error(`cannot replace existing plugin: ${plugin.name} `); - } - this.#plugins.set(plugin.name, plugin.connect(this)); - return this; - } - getPlugin(name) { - return this.#plugins.get(name) || null; - } - get disableCcipRead() { - return this.#disableCcipRead; - } - set disableCcipRead(value) { - this.#disableCcipRead = !!value; - } - // Shares multiple identical requests made during the same 250ms - async #perform(req) { - // Create a tag - const tag = getTag(req.method, req); - let perform = this.#performCache.get(tag); - if (!perform) { - perform = this._perform(req); - this.#performCache.set(tag, perform); - setTimeout(() => { - if (this.#performCache.get(tag) === perform) { - this.#performCache.delete(tag); - } - }, 250); - } - return await perform; - } - async ccipReadFetch(tx, calldata, urls) { - if (this.disableCcipRead || urls.length === 0 || tx.to == null) { - return null; - } - const sender = tx.to.toLowerCase(); - const data = calldata.toLowerCase(); - const errorMessages = []; - for (let i = 0; i < urls.length; i++) { - const url = urls[i]; - // URL expansion - const href = url.replace("{sender}", sender).replace("{data}", data); - // If no {data} is present, use POST; otherwise GET - //const json: string | null = (url.indexOf("{data}") >= 0) ? null: JSON.stringify({ data, sender }); - //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { - // value.status = response.statusCode; - // return value; - //}); - const request = new FetchRequest(href); - if (url.indexOf("{data}") === -1) { - request.body = { data, sender }; - } - this.emit("debug", { - action: "sendCcipReadFetchRequest", - request, - index: i, - urls, - }); - let errorMessage = "unknown error"; - const resp = await request.send(); - try { - const result = resp.bodyJson; - if (result.data) { - this.emit("debug", { - action: "receiveCcipReadFetchResult", - request, - result, - }); - return result.data; - } - if (result.message) { - errorMessage = result.message; - } - this.emit("debug", { - action: "receiveCcipReadFetchError", - request, - result, - }); - } - catch (error) { } - // 4xx indicates the result is not present; stop - assert(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, "OFFCHAIN_FAULT", { - reason: "404_MISSING_RESOURCE", - transaction: tx, - info: { url, errorMessage }, - }); - // 5xx indicates server issue; try the next url - errorMessages.push(errorMessage); - } - assert(false, `error encountered during CCIP fetch: ${errorMessages - .map((m) => JSON.stringify(m)) - .join(", ")}`, "OFFCHAIN_FAULT", { - reason: "500_SERVER_ERROR", - transaction: tx, - info: { urls, errorMessages }, - }); - } - _wrapBlock(value, network) { - return new Block(formatBlock(value), this); - } - _wrapLog(value, network) { - return new Log(formatLog(value), this); - } - _wrapTransactionReceipt(value, network) { - return new TransactionReceipt(formatTransactionReceipt(value), this); - } - _wrapTransactionResponse(tx, network) { - return new TransactionResponse(formatTransactionResponse(tx), this); - } - _detectNetwork() { - assert(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", { - operation: "_detectNetwork", - }); - } - // Sub-classes should override this and handle PerformActionRequest requests, calling - // the super for any unhandled actions. - async _perform(req) { - assert(false, `unsupported method: ${req.method}`, "UNSUPPORTED_OPERATION", { - operation: req.method, - info: req, - }); - } - // State - async getBlockNumber() { - const blockNumber = getNumber(await this.#perform({ method: "getBlockNumber" }), "%response"); - if (this.#lastBlockNumber >= 0) { - this.#lastBlockNumber = blockNumber; - } - return blockNumber; - } - _getAddress(address) { - return resolveAddress(address); - } - _getBlockTag(blockTag) { - if (blockTag == null) { - return "latest"; - } - switch (blockTag) { - case "earliest": - return "0x0"; - case "latest": - case "pending": - case "safe": - case "finalized": - return blockTag; - } - if (isHexString(blockTag)) { - if (isHexString(blockTag, 32)) { - return blockTag; - } - return toQuantity(blockTag); - } - if (typeof blockTag === "bigint") { - blockTag = getNumber(blockTag, "blockTag"); - } - if (typeof blockTag === "number") { - if (blockTag >= 0) { - return toQuantity(blockTag); - } - if (this.#lastBlockNumber >= 0) { - return toQuantity(this.#lastBlockNumber + blockTag); - } - return this.getBlockNumber().then((b) => toQuantity(b + blockTag)); - } - assertArgument(false, "invalid blockTag", "blockTag", blockTag); - } - _getFilter(filter) { - // Create a canonical representation of the topics - const topics = (filter.topics || []).map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - return concisify(t.map((t) => t.toLowerCase())); - } - return t.toLowerCase(); - }); - const blockHash = "blockHash" in filter ? filter.blockHash : undefined; - const resolve = (_address, fromBlock, toBlock) => { - let address = undefined; - switch (_address.length) { - case 0: - break; - case 1: - address = _address[0]; - break; - default: - _address.sort(); - address = _address; - } - if (blockHash) { - if (fromBlock != null || toBlock != null) { - throw new Error("invalid filter"); - } - } - const filter = {}; - if (address) { - filter.address = address; - } - if (topics.length) { - filter.topics = topics; - } - if (fromBlock) { - filter.fromBlock = fromBlock; - } - if (toBlock) { - filter.toBlock = toBlock; - } - if (blockHash) { - filter.blockHash = blockHash; - } - return filter; - }; - // Addresses could be async (ENS names or Addressables) - let address = []; - if (filter.address) { - if (Array.isArray(filter.address)) { - for (const addr of filter.address) { - address.push(this._getAddress(addr)); - } - } - else { - address.push(this._getAddress(filter.address)); - } - } - let fromBlock = undefined; - if ("fromBlock" in filter) { - fromBlock = this._getBlockTag(filter.fromBlock); - } - let toBlock = undefined; - if ("toBlock" in filter) { - toBlock = this._getBlockTag(filter.toBlock); - } - if (address.filter((a) => typeof a !== "string").length || - (fromBlock != null && typeof fromBlock !== "string") || - (toBlock != null && typeof toBlock !== "string")) { - return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result) => { - return resolve(result[0], result[1], result[2]); - }); - } - return resolve(address, fromBlock, toBlock); - } - _getTransactionRequest(_request) { - const request = copyRequest(_request); - const promises = []; - ["to", "from"].forEach((key) => { - if (request[key] == null) { - return; - } - const addr = resolveAddress(request[key]); - if (isPromise(addr)) { - promises.push((async function () { - request[key] = await addr; - })()); - } - else { - request[key] = addr; - } - }); - if (request.blockTag != null) { - const blockTag = this._getBlockTag(request.blockTag); - if (isPromise(blockTag)) { - promises.push((async function () { - request.blockTag = await blockTag; - })()); - } - else { - request.blockTag = blockTag; - } - } - if (promises.length) { - return (async function () { - await Promise.all(promises); - return request; - })(); - } - return request; - } - async getNetwork() { - // No explicit network was set and this is our first time - if (this.#networkPromise == null) { - // Detect the current network (shared with all calls) - const detectNetwork = this._detectNetwork().then((network) => { - this.emit("network", network, null); - return network; - }, (error) => { - // Reset the networkPromise on failure, so we will try again - if (this.#networkPromise === detectNetwork) { - this.#networkPromise = null; - } - throw error; - }); - this.#networkPromise = detectNetwork; - return (await detectNetwork).clone(); - } - const networkPromise = this.#networkPromise; - const [expected, actual] = await Promise.all([ - networkPromise, - this._detectNetwork(), // The actual connected network - ]); - if (expected.networkId !== actual.networkId) { - if (this.#anyNetwork) { - // The "any" network can change, so notify listeners - this.emit("network", actual, expected); - // Update the network if something else hasn't already changed it - if (this.#networkPromise === networkPromise) { - this.#networkPromise = Promise.resolve(actual); - } - } - else { - // Otherwise, we do not allow changes to the underlying network - assert(false, `network changed: ${expected.networkId} => ${actual.networkId} `, "NETWORK_ERROR", { - event: "changed", - }); - } - } - return expected.clone(); - } - async getEnergyPrice() { - const { energyPrice } = await resolveProperties({ - block: this.getBlock("latest"), - energyPrice: (async () => { - try { - const energyPrice = await this.#perform({ method: "getEnergyPrice" }); - return getBigInt(energyPrice, "%response"); - } - catch (error) { } - return null; - })(), - }); - return new FeeData(energyPrice); - } - async getFeeData() { - const { energyPrice } = await resolveProperties({ - block: this.getBlock("latest"), - energyPrice: (async () => { - try { - const energyPrice = await this.#perform({ method: "getEnergyPrice" }); - return getBigInt(energyPrice, "%response"); - } - catch (error) { } - return null; - })(), - }); - return new FeeData(energyPrice); - } - async estimateEnergy(_tx) { - let tx = this._getTransactionRequest(_tx); - if (isPromise(tx)) { - tx = await tx; - } - return getBigInt(await this.#perform({ - method: "estimateEnergy", - transaction: tx, - }), "%response"); - } - async #call(tx, blockTag, attempt) { - assert(attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", { - reason: "TOO_MANY_REDIRECTS", - transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }), - }); - // This came in as a PerformActionTransaction, so to/from are safe; we can cast - const transaction = copyRequest(tx); - try { - return hexlify(await this._perform({ method: "call", transaction, blockTag })); - } - catch (error) { - // CCIP Read OffchainLookup - if (!this.disableCcipRead && - isCallException(error) && - error.data && - attempt >= 0 && - blockTag === "latest" && - transaction.to != null && - dataSlice(error.data, 0, 4) === "0x556f1830") { - const data = error.data; - const txSender = await resolveAddress(transaction.to); - // Parse the CCIP Read Arguments - let ccipArgs; - try { - ccipArgs = parseOffchainLookup(dataSlice(error.data, 4)); - } - catch (error) { - assert(false, error.message, "OFFCHAIN_FAULT", { - reason: "BAD_DATA", - transaction, - info: { data }, - }); - } - // Check the sender of the OffchainLookup matches the transaction - assert(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), "CCIP Read sender mismatch", "CALL_EXCEPTION", { - action: "call", - data, - reason: "OffchainLookup", - transaction: transaction, - invocation: null, - revert: { - signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", - name: "OffchainLookup", - args: ccipArgs.errorArgs, - }, - }); - const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls); - assert(ccipResult != null, "CCIP Read failed to fetch data", "OFFCHAIN_FAULT", { - reason: "FETCH_FAILED", - transaction, - info: { data: error.data, errorArgs: ccipArgs.errorArgs }, - }); - const tx = { - to: txSender, - data: concat([ - ccipArgs.selector, - encodeBytes([ccipResult, ccipArgs.extraData]), - ]), - }; - this.emit("debug", { action: "sendCcipReadCall", transaction: tx }); - try { - const result = await this.#call(tx, blockTag, attempt + 1); - this.emit("debug", { - action: "receiveCcipReadCallResult", - transaction: Object.assign({}, tx), - result, - }); - return result; - } - catch (error) { - this.emit("debug", { - action: "receiveCcipReadCallError", - transaction: Object.assign({}, tx), - error, - }); - throw error; - } - } - throw error; - } - } - async #checkNetwork(promise) { - const { value } = await resolveProperties({ - network: this.getNetwork(), - value: promise, - }); - return value; - } - async call(_tx) { - const { tx, blockTag } = await resolveProperties({ - tx: this._getTransactionRequest(_tx), - blockTag: this._getBlockTag(_tx.blockTag), - }); - return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1)); - } - // Account - async #getAccountValue(request, _address, _blockTag) { - let address = this._getAddress(_address); - let blockTag = this._getBlockTag(_blockTag); - if (typeof address !== "string" || typeof blockTag !== "string") { - [address, blockTag] = await Promise.all([address, blockTag]); - } - return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag }))); - } - async getBalance(address, blockTag) { - return getBigInt(await this.#getAccountValue({ method: "getBalance" }, address, blockTag), "%response"); - } - async getTransactionCount(address, blockTag) { - return getNumber(await this.#getAccountValue({ method: "getTransactionCount" }, address, blockTag), "%response"); - } - async getCode(address, blockTag) { - return hexlify(await this.#getAccountValue({ method: "getCode" }, address, blockTag)); - } - async getStorage(address, _position, blockTag) { - const position = getBigInt(_position, "position"); - return hexlify(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag)); - } - // Write - async broadcastTransaction(signedTx) { - const { blockNumber, hash, network } = await resolveProperties({ - blockNumber: this.getBlockNumber(), - hash: this._perform({ - method: "broadcastTransaction", - signedTransaction: signedTx, - }), - network: this.getNetwork(), - }); - const tx = Transaction.from(signedTx); - if (tx.hash !== hash) { - throw new Error("@TODO: the returned hash did not match"); - } - return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber); - } - async #getBlock(block, includeTransactions) { - // @TODO: Add CustomBlockPlugin check - if (isHexString(block, 32)) { - return await this.#perform({ - method: "getBlock", - blockHash: block, - includeTransactions, - }); - } - let blockTag = this._getBlockTag(block); - if (typeof blockTag !== "string") { - blockTag = await blockTag; - } - return await this.#perform({ - method: "getBlock", - blockTag, - includeTransactions, - }); - } - // Queries - async getBlock(block, prefetchTxs) { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#getBlock(block, !!prefetchTxs), - }); - if (params == null) { - return null; - } - return this._wrapBlock(params, network); - } - async getTransaction(hash) { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#perform({ method: "getTransaction", hash }), - }); - if (params == null) { - return null; - } - return this._wrapTransactionResponse(params, network); - } - async getTransactionReceipt(hash) { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#perform({ method: "getTransactionReceipt", hash }), - }); - if (params == null) { - return null; - } - // Some backends did not backfill the effectiveEnergyPrice into old transactions - // in the receipt, so we look it up manually and inject it. - if (params.energyPrice == null && params.effectiveEnergyPrice == null) { - const tx = await this.#perform({ method: "getTransaction", hash }); - if (tx == null) { - throw new Error("report this; could not find tx or effectiveEnergyPrice"); - } - params.effectiveEnergyPrice = tx.energyPrice; - } - return this._wrapTransactionReceipt(params, network); - } - async getTransactionResult(hash) { - const { result } = await resolveProperties({ - network: this.getNetwork(), - result: this.#perform({ method: "getTransactionResult", hash }), - }); - if (result == null) { - return null; - } - return hexlify(result); - } - // Bloom-filter Queries - async getLogs(_filter) { - let filter = this._getFilter(_filter); - if (isPromise(filter)) { - filter = await filter; - } - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#perform({ method: "getLogs", filter }), - }); - return params.map((p) => this._wrapLog(p, network)); - } - // ENS - _getProvider(networkId) { - assert(false, "provider cannot connect to target network", "UNSUPPORTED_OPERATION", { - operation: "_getProvider()", - }); - } - async waitForTransaction(hash, _confirms, timeout) { - const confirms = _confirms != null ? _confirms : 1; - if (confirms === 0) { - return this.getTransactionReceipt(hash); - } - return new Promise(async (resolve, reject) => { - let timer = null; - const listener = async (blockNumber) => { - try { - const receipt = await this.getTransactionReceipt(hash); - if (receipt != null) { - if (blockNumber - receipt.blockNumber + 1 >= confirms) { - resolve(receipt); - //this.off("block", listener); - if (timer) { - clearTimeout(timer); - timer = null; - } - return; - } - } - } - catch (error) { - console.log("EEE", error); - } - this.once("block", listener); - }; - if (timeout != null) { - timer = setTimeout(() => { - if (timer == null) { - return; - } - timer = null; - this.off("block", listener); - reject(makeError("timeout", "TIMEOUT", { reason: "timeout" })); - }, timeout); - } - listener(await this.getBlockNumber()); - }); - } - async waitForBlock(blockTag) { - assert(false, "not implemented yet", "NOT_IMPLEMENTED", { - operation: "waitForBlock", - }); - } - _clearTimeout(timerId) { - const timer = this.#timers.get(timerId); - if (!timer) { - return; - } - if (timer.timer) { - clearTimeout(timer.timer); - } - this.#timers.delete(timerId); - } - _setTimeout(_func, timeout) { - if (timeout == null) { - timeout = 0; - } - const timerId = this.#nextTimer++; - const func = () => { - this.#timers.delete(timerId); - _func(); - }; - if (this.paused) { - this.#timers.set(timerId, { timer: null, func, time: timeout }); - } - else { - const timer = setTimeout(func, timeout); - this.#timers.set(timerId, { timer, func, time: getTime() }); - } - return timerId; - } - _forEachSubscriber(func) { - for (const sub of this.#subs.values()) { - func(sub.subscriber); - } - } - // Event API; sub-classes should override this; any supported - // event filter will have been munged into an EventFilter - _getSubscriber(sub) { - switch (sub.type) { - case "debug": - case "error": - case "network": - return new UnmanagedSubscriber(sub.type); - case "block": - return new PollingBlockSubscriber(this); - case "event": - return new PollingEventSubscriber(this, sub.filter); - case "transaction": - return new PollingTransactionSubscriber(this, sub.hash); - case "orphan": - return new PollingOrphanSubscriber(this, sub.filter); - } - throw new Error(`unsupported event: ${sub.type}`); - } - _recoverSubscriber(oldSub, newSub) { - for (const sub of this.#subs.values()) { - if (sub.subscriber === oldSub) { - if (sub.started) { - sub.subscriber.stop(); - } - sub.subscriber = newSub; - if (sub.started) { - newSub.start(); - } - if (this.#pausedState != null) { - newSub.pause(this.#pausedState); - } - break; - } - } - } - async #hasSub(event, emitArgs) { - let sub = await getSubscription(event, this); - // This is a log that is removing an existing log; we actually want - // to emit an orphan event for the removed log - if (sub.type === "event" && - emitArgs && - emitArgs.length > 0 && - emitArgs[0].removed === true) { - sub = await getSubscription({ orphan: "drop-log", log: emitArgs[0] }, this); - } - return this.#subs.get(sub.tag) || null; - } - async #getSub(event) { - const subscription = await getSubscription(event, this); - // Prevent tampering with our tag in any subclass' _getSubscriber - const tag = subscription.tag; - let sub = this.#subs.get(tag); - if (!sub) { - const subscriber = this._getSubscriber(subscription); - const addressableMap = new WeakMap(); - const nameMap = new Map(); - sub = { - subscriber, - tag, - addressableMap, - nameMap, - started: false, - listeners: [], - }; - this.#subs.set(tag, sub); - } - return sub; - } - async on(event, listener) { - const sub = await this.#getSub(event); - sub.listeners.push({ listener, once: false }); - if (!sub.started) { - sub.subscriber.start(); - sub.started = true; - if (this.#pausedState != null) { - sub.subscriber.pause(this.#pausedState); - } - } - return this; - } - async once(event, listener) { - const sub = await this.#getSub(event); - sub.listeners.push({ listener, once: true }); - if (!sub.started) { - sub.subscriber.start(); - sub.started = true; - if (this.#pausedState != null) { - sub.subscriber.pause(this.#pausedState); - } - } - return this; - } - async emit(event, ...args) { - const sub = await this.#hasSub(event, args); - // If there is not subscription or if a recent emit removed - // the last of them (which also deleted the sub) do nothing - if (!sub || sub.listeners.length === 0) { - return false; - } - const count = sub.listeners.length; - sub.listeners = sub.listeners.filter(({ listener, once }) => { - const payload = new EventPayload(this, once ? null : listener, event); - try { - listener.call(this, ...args, payload); - } - catch (error) { } - return !once; - }); - if (sub.listeners.length === 0) { - if (sub.started) { - sub.subscriber.stop(); - } - this.#subs.delete(sub.tag); - } - return count > 0; - } - async listenerCount(event) { - if (event) { - const sub = await this.#hasSub(event); - if (!sub) { - return 0; - } - return sub.listeners.length; - } - let total = 0; - for (const { listeners } of this.#subs.values()) { - total += listeners.length; - } - return total; - } - async listeners(event) { - if (event) { - const sub = await this.#hasSub(event); - if (!sub) { - return []; - } - return sub.listeners.map(({ listener }) => listener); - } - let result = []; - for (const { listeners } of this.#subs.values()) { - result = result.concat(listeners.map(({ listener }) => listener)); - } - return result; - } - async off(event, listener) { - const sub = await this.#hasSub(event); - if (!sub) { - return this; - } - if (listener) { - const index = sub.listeners - .map(({ listener }) => listener) - .indexOf(listener); - if (index >= 0) { - sub.listeners.splice(index, 1); - } - } - if (!listener || sub.listeners.length === 0) { - if (sub.started) { - sub.subscriber.stop(); - } - this.#subs.delete(sub.tag); - } - return this; - } - async removeAllListeners(event) { - if (event) { - const { tag, started, subscriber } = await this.#getSub(event); - if (started) { - subscriber.stop(); - } - this.#subs.delete(tag); - } - else { - for (const [tag, { started, subscriber }] of this.#subs) { - if (started) { - subscriber.stop(); - } - this.#subs.delete(tag); - } - } - return this; - } - // Alias for "on" - async addListener(event, listener) { - return await this.on(event, listener); - } - // Alias for "off" - async removeListener(event, listener) { - return this.off(event, listener); - } - // Sub-classes should override this to shutdown any sockets, etc. - // but MUST call this super.shutdown. - destroy() { - // Stop all listeners - this.removeAllListeners(); - // Shut down all tiemrs - for (const timerId of this.#timers.keys()) { - this._clearTimeout(timerId); - } - } - get paused() { - return this.#pausedState != null; - } - set paused(pause) { - if (!!pause === this.paused) { - return; - } - if (this.paused) { - this.resume(); - } - else { - this.pause(false); - } - } - pause(dropWhilePaused) { - this.#lastBlockNumber = -1; - if (this.#pausedState != null) { - if (this.#pausedState == !!dropWhilePaused) { - return; - } - assert(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", { - operation: "pause", - }); - } - this._forEachSubscriber((s) => s.pause(dropWhilePaused)); - this.#pausedState = !!dropWhilePaused; - for (const timer of this.#timers.values()) { - // Clear the timer - if (timer.timer) { - clearTimeout(timer.timer); - } - // Remaining time needed for when we become unpaused - timer.time = getTime() - timer.time; - } - } - resume() { - if (this.#pausedState == null) { - return; - } - this._forEachSubscriber((s) => s.resume()); - this.#pausedState = null; - for (const timer of this.#timers.values()) { - // Remaining time when we were paused - let timeout = timer.time; - if (timeout < 0) { - timeout = 0; - } - // Start time (in cause paused, so we con compute remaininf time) - timer.time = getTime(); - // Start the timer - setTimeout(timer.func, timeout); - } - } -} -function _parseString(result, start) { - try { - const bytes = _parseBytes(result, start); - if (bytes) { - return toUtf8String(bytes); - } - } - catch (error) { } - return null; -} -function _parseBytes(result, start) { - if (result === "0x") { - return null; - } - try { - const offset = getNumber(dataSlice(result, start, start + 32)); - const length = getNumber(dataSlice(result, offset, offset + 32)); - return dataSlice(result, offset + 32, offset + 32 + length); - } - catch (error) { } - return null; -} -function numPad(value) { - const result = toBeArray(value); - if (result.length > 32) { - throw new Error("internal; should not happen"); - } - const padded = new Uint8Array(32); - padded.set(result, 32 - result.length); - return padded; -} -function bytesPad(value) { - if (value.length % 32 === 0) { - return value; - } - const result = new Uint8Array(Math.ceil(value.length / 32) * 32); - result.set(value); - return result; -} -const empty = new Uint8Array([]); -// ABI Encodes a series of (bytes, bytes, ...) -function encodeBytes(datas) { - const result = []; - let byteCount = 0; - // Add place-holders for pointers as we add items - for (let i = 0; i < datas.length; i++) { - result.push(empty); - byteCount += 32; - } - for (let i = 0; i < datas.length; i++) { - const data = getBytes(datas[i]); - // Update the bytes offset - result[i] = numPad(byteCount); - // The length and padded value of data - result.push(numPad(data.length)); - result.push(bytesPad(data)); - byteCount += 32 + Math.ceil(data.length / 32) * 32; - } - return concat(result); -} -const zeros = "0x0000000000000000000000000000000000000000000000000000000000000000"; -function parseOffchainLookup(data) { - const result = { - sender: "", - urls: [], - calldata: "", - selector: "", - extraData: "", - errorArgs: [], - }; - assert(dataLength(data) >= 5 * 32, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", { - reason: "insufficient OffchainLookup data", - }); - const sender = dataSlice(data, 0, 32); - assert(dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup sender", - }); - result.sender = dataSlice(sender, 12); - // Read the URLs from the response - try { - const urls = []; - const urlsOffset = getNumber(dataSlice(data, 32, 64)); - const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32)); - const urlsData = dataSlice(data, urlsOffset + 32); - for (let u = 0; u < urlsLength; u++) { - const url = _parseString(urlsData, u * 32); - if (url == null) { - throw new Error("abort"); - } - urls.push(url); - } - result.urls = urls; - } - catch (error) { - assert(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup urls", - }); - } - // Get the CCIP calldata to forward - try { - const calldata = _parseBytes(data, 64); - if (calldata == null) { - throw new Error("abort"); - } - result.calldata = calldata; - } - catch (error) { - assert(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup calldata", - }); - } - // Get the callbackSelector (bytes4) - assert(dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup callbaackSelector", - }); - result.selector = dataSlice(data, 96, 100); - // Get the extra data to send back to the contract as context - try { - const extraData = _parseBytes(data, 128); - if (extraData == null) { - throw new Error("abort"); - } - result.extraData = extraData; - } - catch (error) { - assert(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup extraData", - }); - } - result.errorArgs = "sender,urls,calldata,selector,extraData" - .split(/,/) - .map((k) => result[k]); - return result; -} -//# sourceMappingURL=abstract-provider.js.map \ No newline at end of file diff --git a/lib.esm/providers/abstract-provider.js.map b/lib.esm/providers/abstract-provider.js.map deleted file mode 100644 index bedba9197..000000000 --- a/lib.esm/providers/abstract-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-provider.js","sourceRoot":"","sources":["../../src.ts/providers/abstract-provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,QAAQ;AACR,oBAAoB;AACpB,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,sB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EAAE,iCAAiC;SAC1C,CAAC,CAAC;KACJ;IAED,oCAAoC;IACpC,MAAM,CACJ,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EACrD,0CAA0C,EAC1C,gBAAgB,EAChB;QACE,MAAM,EAAE,0CAA0C;KACnD,CACF,CAAC;IACF,MAAM,CAAC,QAAQ,GAAG,SAAS,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IAE3C,6DAA6D;IAC7D,IAAI;QACF,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACzC,IAAI,SAAS,IAAI,IAAI,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;SAC1B;QACD,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;KAC9B;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,CAAC,KAAK,EAAE,kCAAkC,EAAE,gBAAgB,EAAE;YAClE,MAAM,EAAE,kCAAkC;SAC3C,CAAC,CAAC;KACJ;IAED,MAAM,CAAC,SAAS,GAAG,yCAAyC;SACzD,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAO,MAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhC,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/lib.esm/providers/abstract-signer.d.ts b/lib.esm/providers/abstract-signer.d.ts deleted file mode 100644 index ab4997033..000000000 --- a/lib.esm/providers/abstract-signer.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -import type { Signer } from "./signer.js"; -export declare abstract class AbstractSigner

implements Signer { - readonly provider: P; - constructor(provider?: P); - abstract getAddress(): Promise; - abstract connect(provider: null | Provider): Signer; - getNonce(blockTag?: BlockTag): Promise; - populateCall(tx: TransactionRequest): Promise>; - populateTransaction(tx: TransactionRequest): Promise>; - estimateEnergy(tx: TransactionRequest): Promise; - call(tx: TransactionRequest): Promise; - resolveName(name: string): Promise; - sendTransaction(tx: TransactionRequest): Promise; - abstract signTransaction(tx: TransactionRequest): Promise; - abstract signMessage(message: string | Uint8Array): Promise; - abstract signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -export declare class VoidSigner extends AbstractSigner { - #private; - readonly address: string; - constructor(address: string, provider?: null | Provider); - getAddress(): Promise; - connect(provider: null | Provider): VoidSigner; - signTransaction(tx: TransactionRequest): Promise; - signMessage(message: string | Uint8Array): Promise; - signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -//# sourceMappingURL=abstract-signer.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/abstract-signer.d.ts.map b/lib.esm/providers/abstract-signer.d.ts.map deleted file mode 100644 index 41b30b933..000000000 --- a/lib.esm/providers/abstract-signer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-signer.d.ts","sourceRoot":"","sources":["../../src.ts/providers/abstract-signer.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAuC1C,8BAAsB,cAAc,CAClC,CAAC,SAAS,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAC3C,YAAW,MAAM;IAEjB,QAAQ,CAAC,QAAQ,EAAG,CAAC,CAAC;gBAEV,QAAQ,CAAC,EAA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AU,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,UAAU;IAUxC,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1D,aAAa,CACjB,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC;CAGnB"} \ No newline at end of file diff --git a/lib.esm/providers/abstract-signer.js b/lib.esm/providers/abstract-signer.js deleted file mode 100644 index 92efcede8..000000000 --- a/lib.esm/providers/abstract-signer.js +++ /dev/null @@ -1,128 +0,0 @@ -/** - * About Abstract Signer and subclassing - * - * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer] - */ -import { resolveAddress } from "../address/checks.js"; -import { getAddress } from "../address/index.js"; -import { Transaction } from "../transaction/index.js"; -import { defineProperties, getBigInt, resolveProperties, assert, assertArgument, } from "../utils/index.js"; -import { copyRequest } from "./provider.js"; -function checkProvider(signer, operation) { - if (signer.provider) { - return signer.provider; - } - assert(false, "missing provider", "UNSUPPORTED_OPERATION", { operation }); -} -async function populate(signer, tx) { - let pop = copyRequest(tx); - if (pop.to != null) { - pop.to = resolveAddress(pop.to); - } - if (pop.from != null) { - const from = pop.from; - pop.from = Promise.all([signer.getAddress(), resolveAddress(from)]).then(([address, from]) => { - assertArgument(address.toLowerCase() === from.toLowerCase(), "transaction from mismatch", "tx.from", from); - return address; - }); - } - else { - pop.from = signer.getAddress(); - } - return await resolveProperties(pop); -} -export class AbstractSigner { - provider; - constructor(provider) { - defineProperties(this, { provider: provider || null }); - } - async getNonce(blockTag) { - return checkProvider(this, "getTransactionCount").getTransactionCount(await this.getAddress(), blockTag); - } - async populateCall(tx) { - const pop = await populate(this, tx); - return pop; - } - async populateTransaction(tx) { - const provider = checkProvider(this, "populateTransaction"); - const pop = await populate(this, tx); - if (pop.nonce == null) { - pop.nonce = await this.getNonce("pending"); - } - if (pop.energyLimit == null) { - pop.energyLimit = await this.estimateEnergy(pop); - } - // Populate the chain ID - const network = await this.provider.getNetwork(); - if (pop.networkId != null) { - const networkId = getBigInt(pop.networkId); - assertArgument(networkId === network.networkId, "transaction networkId mismatch", "tx.networkId", tx.networkId); - } - else { - pop.networkId = network.networkId; - } - // We need to get fee data to determine things - const feeData = await provider.getFeeData(); - // We need to auto-detect the intended type of this transaction... - if (feeData.energyPrice != null) { - // Network doesn't support EIP-1559... - // Populate missing fee data - if (pop.energyPrice == null) { - pop.energyPrice = feeData.energyPrice; - } - } - else { - // getFeeData has failed us. - assert(false, "failed to get consistent fee data", "UNSUPPORTED_OPERATION", { - operation: "signer.getFeeData", - }); - } - //@TOOD: Don't await all over the place; save them up for - // the end for better batching - return await resolveProperties(pop); - } - async estimateEnergy(tx) { - return checkProvider(this, "estimateEnergy").estimateEnergy(await this.populateCall(tx)); - } - async call(tx) { - return checkProvider(this, "call").call(await this.populateCall(tx)); - } - async resolveName(name) { - return getAddress(name); - } - async sendTransaction(tx) { - const provider = checkProvider(this, "sendTransaction"); - const pop = await this.populateTransaction(tx); - delete pop.from; - const txObj = Transaction.from(pop); - return await provider.broadcastTransaction(await this.signTransaction(txObj)); - } -} -export class VoidSigner extends AbstractSigner { - address; - constructor(address, provider) { - super(provider); - defineProperties(this, { address }); - } - async getAddress() { - return this.address; - } - connect(provider) { - return new VoidSigner(this.address, provider); - } - #throwUnsupported(suffix, operation) { - assert(false, `VoidSigner cannot sign ${suffix}`, "UNSUPPORTED_OPERATION", { - operation, - }); - } - async signTransaction(tx) { - this.#throwUnsupported("transactions", "signTransaction"); - } - async signMessage(message) { - this.#throwUnsupported("messages", "signMessage"); - } - async signTypedData(domain, types, value) { - this.#throwUnsupported("typed-data", "signTypedData"); - } -} -//# sourceMappingURL=abstract-signer.js.map \ No newline at end of file diff --git a/lib.esm/providers/abstract-signer.js.map b/lib.esm/providers/abstract-signer.js.map deleted file mode 100644 index bbc9565e9..000000000 --- a/lib.esm/providers/abstract-signer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-signer.js","sourceRoot":"","sources":["../../src.ts/providers/abstract-signer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,MAAM,EACN,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAa5C,SAAS,aAAa,CAAC,MAAsB,EAAE,SAAiB;IAC9D,IAAI,MAAM,CAAC,QAAQ,EAAE;QACnB,OAAO,MAAM,CAAC,QAAQ,CAAC;KACxB;IACD,MAAM,CAAC,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED,KAAK,UAAU,QAAQ,CACrB,MAAsB,EACtB,EAAsB;IAEtB,IAAI,GAAG,GAAQ,WAAW,CAAC,EAAE,CAAC,CAAC;IAE/B,IAAI,GAAG,CAAC,EAAE,IAAI,IAAI,EAAE;QAClB,GAAG,CAAC,EAAE,GAAG,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;KACjC;IAED,IAAI,GAAG,CAAC,IAAI,IAAI,IAAI,EAAE;QACpB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACtB,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM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,EAAE,iBAAiB,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAA4B;QAC5C,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,MAAuB,EACvB,KAA4C,EAC5C,KAA0B;QAE1B,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;IACxD,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/community.d.ts b/lib.esm/providers/community.d.ts deleted file mode 100644 index a61908d27..000000000 --- a/lib.esm/providers/community.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * There are many awesome community services that provide Core - * nodes both for developers just starting out and for large-scale - * communities. - * - * @_section: api/providers/thirdparty: Community Providers [thirdparty] - */ -/** - * Providers which offer community credentials should extend this - * to notify any interested consumers whether community credentials - * are in-use. - */ -export interface CommunityResourcable { - /** - * Returns true of the instance is connected using the community - * credentials. - */ - isCommunityResource(): boolean; -} -/** - * Displays a warning in tht console when the community resource is - * being used too heavily by the app, recommending the developer - * acquire their own credentials instead of using the community - * credentials. - * - * The notification will only occur once per service. - */ -export declare function showThrottleMessage(service: string): void; -//# sourceMappingURL=community.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/community.d.ts.map b/lib.esm/providers/community.d.ts.map deleted file mode 100644 index f8a2a68bc..000000000 --- a/lib.esm/providers/community.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"community.d.ts","sourceRoot":"","sources":["../../src.ts/providers/community.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,mBAAmB,IAAI,OAAO,CAAC;CAChC;AAKD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CA4BzD"} \ No newline at end of file diff --git a/lib.esm/providers/community.js b/lib.esm/providers/community.js deleted file mode 100644 index a18edb5fb..000000000 --- a/lib.esm/providers/community.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * There are many awesome community services that provide Core - * nodes both for developers just starting out and for large-scale - * communities. - * - * @_section: api/providers/thirdparty: Community Providers [thirdparty] - */ -// Show the throttle message only once per service -const shown = new Set(); -/** - * Displays a warning in tht console when the community resource is - * being used too heavily by the app, recommending the developer - * acquire their own credentials instead of using the community - * credentials. - * - * The notification will only occur once per service. - */ -export function showThrottleMessage(service) { - if (shown.has(service)) { - return; - } - shown.add(service); - console.log("========= NOTICE ========="); - console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`); - console.log(""); - console.log("The default API keys for each service are provided as a highly-throttled,"); - console.log("community resource for low-traffic projects and early prototyping."); - console.log(""); - console.log("While your application will continue to function, we highly recommended"); - console.log("signing up for your own API keys to improve performance, increase your"); - console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."); - console.log(""); -} -//# sourceMappingURL=community.js.map \ No newline at end of file diff --git a/lib.esm/providers/community.js.map b/lib.esm/providers/community.js.map deleted file mode 100644 index 8dbe2326d..000000000 --- a/lib.esm/providers/community.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"community.js","sourceRoot":"","sources":["../../src.ts/providers/community.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,kDAAkD;AAClD,MAAM,KAAK,GAAgB,IAAI,GAAG,EAAE,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe;IACjD,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QACtB,OAAO;KACR;IACD,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEnB,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CACT,6BAA6B,OAAO,sCAAsC,CAC3E,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CACT,2EAA2E,CAC5E,CAAC;IACF,OAAO,CAAC,GAAG,CACT,oEAAoE,CACrE,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CACT,yEAAyE,CAC1E,CAAC;IACF,OAAO,CAAC,GAAG,CACT,wEAAwE,CACzE,CAAC;IACF,OAAO,CAAC,GAAG,CACT,+EAA+E,CAChF,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/lib.esm/providers/contracts.d.ts b/lib.esm/providers/contracts.d.ts deleted file mode 100644 index 187f28cce..000000000 --- a/lib.esm/providers/contracts.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -export interface ContractRunner { - provider: null | Provider; - estimateEnergy?: (tx: TransactionRequest) => Promise; - call?: (tx: TransactionRequest) => Promise; - resolveName?: (name: string) => Promise; - sendTransaction?: (tx: TransactionRequest) => Promise; -} -//# sourceMappingURL=contracts.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/contracts.d.ts.map b/lib.esm/providers/contracts.d.ts.map deleted file mode 100644 index 085cff0c7..000000000 --- a/lib.esm/providers/contracts.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src.ts/providers/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC;IAG1B,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAG7D,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAGnD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAGvD,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC5E"} \ No newline at end of file diff --git a/lib.esm/providers/contracts.js b/lib.esm/providers/contracts.js deleted file mode 100644 index 202a39eb5..000000000 --- a/lib.esm/providers/contracts.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=contracts.js.map \ No newline at end of file diff --git a/lib.esm/providers/contracts.js.map b/lib.esm/providers/contracts.js.map deleted file mode 100644 index 42ac4de89..000000000 --- a/lib.esm/providers/contracts.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src.ts/providers/contracts.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.esm/providers/default-provider.d.ts b/lib.esm/providers/default-provider.d.ts deleted file mode 100644 index 657919cb1..000000000 --- a/lib.esm/providers/default-provider.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { AbstractProvider } from "./abstract-provider.js"; -import type { Networkish } from "./network.js"; -import { WebSocketLike } from "./provider-websocket.js"; -export declare function getDefaultProvider(network: string | Networkish | WebSocketLike, options?: any): AbstractProvider; -//# sourceMappingURL=default-provider.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/default-provider.d.ts.map b/lib.esm/providers/default-provider.d.ts.map deleted file mode 100644 index a7b02c6c0..000000000 --- a/lib.esm/providers/default-provider.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"default-provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAUxD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,EAC5C,OAAO,CAAC,EAAE,GAAG,GACZ,gBAAgB,CA6FlB"} \ No newline at end of file diff --git a/lib.esm/providers/default-provider.js b/lib.esm/providers/default-provider.js deleted file mode 100644 index 11ac97df6..000000000 --- a/lib.esm/providers/default-provider.js +++ /dev/null @@ -1,98 +0,0 @@ -import { assert } from "../utils/index.js"; -import { AnkrProvider } from "./provider-ankr.js"; -import { AlchemyProvider } from "./provider-alchemy.js"; -import { CloudflareProvider } from "./provider-cloudflare.js"; -import { InfuraProvider } from "./provider-infura.js"; -//import { PocketProvider } from "./provider-pocket.js"; -import { QuickNodeProvider } from "./provider-quicknode.js"; -import { FallbackProvider } from "./provider-fallback.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import { WebSocketProvider } from "./provider-websocket.js"; -function isWebSocketLike(value) { - return (value && - typeof value.send === "function" && - typeof value.close === "function"); -} -export function getDefaultProvider(network, options) { - if (options == null) { - options = {}; - } - if (typeof network === "string" && network.match(/^https?:/)) { - return new JsonRpcProvider(network); - } - if ((typeof network === "string" && network.match(/^wss?:/)) || - isWebSocketLike(network)) { - return new WebSocketProvider(network); - } - const providers = []; - if (options.alchemy !== "-") { - try { - providers.push(new AlchemyProvider(network, options.alchemy)); - } - catch (error) { - console.log(error); - } - } - if (options.ankr !== "-" && options.ankr != null) { - try { - providers.push(new AnkrProvider(network, options.ankr)); - } - catch (error) { - console.log(error); - } - } - if (options.cloudflare !== "-") { - try { - providers.push(new CloudflareProvider(network)); - } - catch (error) { - console.log(error); - } - } - if (options.infura !== "-") { - try { - let projectId = options.infura; - let projectSecret = undefined; - if (typeof projectId === "object") { - projectSecret = projectId.projectSecret; - projectId = projectId.projectId; - } - providers.push(new InfuraProvider(network, projectId, projectSecret)); - } - catch (error) { - console.log(error); - } - } - /* - if (options.pocket !== "-") { - try { - let appId = options.pocket; - let secretKey: undefined | string = undefined; - let loadBalancer: undefined | boolean = undefined; - if (typeof(appId) === "object") { - loadBalancer = !!appId.loadBalancer; - secretKey = appId.secretKey; - appId = appId.appId; - } - providers.push(new PocketProvider(network, appId, secretKey, loadBalancer)); - } catch (error) { console.log(error); } - } - */ - if (options.quicknode !== "-") { - try { - let token = options.quicknode; - providers.push(new QuickNodeProvider(network, token)); - } - catch (error) { - console.log(error); - } - } - assert(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", { - operation: "getDefaultProvider", - }); - if (providers.length === 1) { - return providers[0]; - } - return new FallbackProvider(providers); -} -//# sourceMappingURL=default-provider.js.map \ No newline at end of file diff --git a/lib.esm/providers/default-provider.js.map b/lib.esm/providers/default-provider.js.map deleted file mode 100644 index f38d5acf6..000000000 --- a/lib.esm/providers/default-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"default-provider.js","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,wDAAwD;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAM5D,SAAS,eAAe,CAAC,KAAU;IACjC,OAAO,CACL,KAAK;QACL,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU;QACh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ACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACpB;KACF;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,GAAG,EAAE;QAC1B,IAAI;YACF,IAAI,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;YAC/B,IAAI,aAAa,GAAuB,SAAS,CAAC;YAClD,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;gBACjC,aAAa,GAAG,SAAS,CAAC,aAAa,CAAC;gBACxC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC;aACjC;YACD,SAAS,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,OAAO,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC;SACvE;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACpB;KACF;IACD;;;;;;;;;;;;;;IAcA;IACA,IAAI,OAAO,CAAC,SAAS,KAAK,GAAG,EAAE;QAC7B,IAAI;YACF,IAAI,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC;YAC9B,SAAS,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;SACvD;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACpB;KACF;IAED,MAAM,CACJ,SAAS,CAAC,MAAM,EAChB,6BAA6B,EAC7B,uBAAuB,EACvB;QACE,SAAS,EAAE,oBAAoB;KAChC,CACF,CAAC;IAEF,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1B,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;KACrB;IAED,OAAO,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC;AACzC,CAAC"} \ No newline at end of file diff --git a/lib.esm/providers/format.d.ts b/lib.esm/providers/format.d.ts deleted file mode 100644 index e088632a0..000000000 --- a/lib.esm/providers/format.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; -export type FormatFunc = (value: any) => any; -export declare function allowNull(format: FormatFunc, nullValue?: any): FormatFunc; -export declare function arrayOf(format: FormatFunc): FormatFunc; -export declare function object(format: Record, altNames?: Record>): FormatFunc; -export declare function formatBoolean(value: any): boolean; -export declare function formatData(value: string): string; -export declare function formatHash(value: any): string; -export declare function formatUint256(value: any): string; -export declare function formatLog(value: any): LogParams; -export declare function formatBlock(value: any): BlockParams; -export declare function formatReceiptLog(value: any): LogParams; -export declare function formatTransactionReceipt(value: any): TransactionReceiptParams; -export declare function formatTransactionResponse(value: any): TransactionResponseParams; -//# sourceMappingURL=format.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/format.d.ts.map b/lib.esm/providers/format.d.ts.map deleted file mode 100644 index da5b2ee35..000000000 --- a/lib.esm/providers/format.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src.ts/providers/format.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,iBAAiB,CAAC;AAIzB,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;AAE7C,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,UAAU,CAOzE;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAOtD;AAKD,wBAAgB,MAAM,CACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GACvC,UAAU,CA+BZ;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAejD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGhD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAG7C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAKhD;AAmBD,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAE/C;AAoBD,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,WAAW,CAWnD;AAkBD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAEtD;AA6BD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,wBAAwB,CAE7E;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,GAAG,GACT,yBAAyB,CA0G3B"} \ No newline at end of file diff --git a/lib.esm/providers/format.js b/lib.esm/providers/format.js deleted file mode 100644 index 5e3f5cd93..000000000 --- a/lib.esm/providers/format.js +++ /dev/null @@ -1,250 +0,0 @@ -/** - * @_ignore - */ -import { getAddress } from "../address/index.js"; -import { getCreateAddress } from "../address/contract-address.js"; -import { accessListify } from "../transaction/index.js"; -import { getBigInt, getNumber, hexlify, isHexString, zeroPadValue, assert, assertArgument, } from "../utils/index.js"; -const BN_0 = BigInt(0); -export function allowNull(format, nullValue) { - return function (value) { - if (value == null) { - return nullValue; - } - return format(value); - }; -} -export function arrayOf(format) { - return (array) => { - if (!Array.isArray(array)) { - throw new Error("not an array"); - } - return array.map((i) => format(i)); - }; -} -// Requires an object which matches a fleet of other formatters -// Any FormatFunc may return `undefined` to have the value omitted -// from the result object. Calls preserve `this`. -export function object(format, altNames) { - return (value) => { - const result = {}; - for (const key in format) { - let srcKey = key; - if (altNames && key in altNames && !(srcKey in value)) { - for (const altKey of altNames[key]) { - if (altKey in value) { - srcKey = altKey; - break; - } - } - } - try { - const nv = format[key](value[srcKey]); - if (nv !== undefined) { - result[key] = nv; - } - } - catch (error) { - const message = error instanceof Error ? error.message : "not-an-error"; - assert(false, `invalid value for value.${key} (${message})`, "BAD_DATA", { value }); - } - } - return result; - }; -} -export function formatBoolean(value) { - switch (value) { - case true: - case "true": - return true; - case false: - case "false": - return false; - } - assertArgument(false, `invalid boolean; ${JSON.stringify(value)}`, "value", value); -} -export function formatData(value) { - assertArgument(isHexString(value, true), "invalid data", "value", value); - return value; -} -export function formatHash(value) { - assertArgument(isHexString(value, 32), "invalid hash", "value", value); - return value; -} -export function formatUint256(value) { - if (!isHexString(value)) { - throw new Error("invalid uint256"); - } - return zeroPadValue(value, 32); -} -const _formatLog = object({ - address: getAddress, - blockHash: formatHash, - blockNumber: getNumber, - data: formatData, - index: getNumber, - removed: allowNull(formatBoolean, false), - topics: arrayOf(formatHash), - transactionHash: formatHash, - transactionIndex: getNumber, -}, { - index: ["logIndex"], -}); -export function formatLog(value) { - return _formatLog(value); -} -const _formatBlock = object({ - hash: allowNull(formatHash), - parentHash: formatHash, - number: getNumber, - timestamp: getNumber, - nonce: allowNull(formatData), - difficulty: getBigInt, - energyLimit: getBigInt, - energyUsed: getBigInt, - miner: allowNull(getAddress), - extraData: formatData, - baseFeePerEnergy: allowNull(getBigInt), -}); -export function formatBlock(value) { - const result = _formatBlock(value); - result.transactions = value.transactions.map((tx) => { - if (typeof tx === "string") { - return tx; - } - return formatTransactionResponse(tx); - }); - return result; -} -const _formatReceiptLog = object({ - transactionIndex: getNumber, - blockNumber: getNumber, - transactionHash: formatHash, - address: getAddress, - topics: arrayOf(formatHash), - data: formatData, - index: getNumber, - blockHash: formatHash, -}, { - index: ["logIndex"], -}); -export function formatReceiptLog(value) { - return _formatReceiptLog(value); -} -const _formatTransactionReceipt = object({ - to: allowNull(getAddress, null), - from: allowNull(getAddress, null), - contractAddress: allowNull(getAddress, null), - // should be allowNull(hash), but broken-EIP-658 support is handled in receipt - index: getNumber, - root: allowNull(hexlify), - energyUsed: getBigInt, - logsBloom: allowNull(formatData), - blockHash: formatHash, - hash: formatHash, - logs: arrayOf(formatReceiptLog), - blockNumber: getNumber, - //confirmations: allowNull(getNumber, null), - cumulativeEnergyUsed: getBigInt, - effectiveEnergyPrice: allowNull(getBigInt), - status: allowNull(getNumber), - type: allowNull(getNumber, 0), -}, { - effectiveEnergyPrice: ["energyPrice"], - hash: ["transactionHash"], - index: ["transactionIndex"], -}); -export function formatTransactionReceipt(value) { - return _formatTransactionReceipt(value); -} -export function formatTransactionResponse(value) { - // Some clients (TestRPC) do strange things like return 0x0 for the - // 0 address; correct this to be a real address - if (value.to && !getAddress(value.to) && getBigInt(value.to) === BN_0) { - value.to = "0x0000000000000000000000000000000000000000"; - } - const result = object({ - hash: formatHash, - type: (value) => { - if (value === "0x" || value == null) { - return 0; - } - return getNumber(value); - }, - accessList: allowNull(accessListify, null), - blockHash: allowNull(formatHash, null), - blockNumber: allowNull(getNumber, null), - transactionIndex: allowNull(getNumber, null), - //confirmations: allowNull(getNumber, null), - from: getAddress, - maxFeePerEnergy: allowNull(getBigInt), - energyLimit: getBigInt, - to: allowNull(getAddress, null), - value: getBigInt, - nonce: getNumber, - data: formatData, - creates: allowNull(getAddress, null), - networkId: allowNull(getBigInt, null), - }, { - data: ["input"], - energyLimit: ["energy"], - })(value); - // If to and creates are empty, populate the creates from the value - if (result.to == null && result.creates == null) { - result.creates = getCreateAddress(result); - } - // Compute the signature - if (value.signature) { - result.signature = value.signature; - } - else { - result.signature = value; - } - // Some backends omit networkId on legacy transactions, but we can compute it - if (result.networkId == null) { - const networkId = result.signature.legacynetworkId; - if (networkId != null) { - result.networkId = networkId; - } - } - // @TODO: check networkId - /* - if (value.networkId != null) { - let networkId = value.networkId; - - if (isHexString(networkId)) { - networkId = BigNumber.from(networkId).toNumber(); - } - - result.networkId = networkId; - - } else { - let networkId = value.networkId; - - // geth-etc returns networkId - if (networkId == null && result.v == null) { - networkId = value.networkId; - } - - if (isHexString(networkId)) { - networkId = BigNumber.from(networkId).toNumber(); - } - - if (typeof(networkId) !== "number" && result.v != null) { - networkId = (result.v - 35) / 2; - if (networkId < 0) { networkId = 0; } - networkId = parseInt(networkId); - } - - if (typeof(networkId) !== "number") { networkId = 0; } - - result.networkId = networkId; - } - */ - // 0x0000... should actually be null - if (result.blockHash && getBigInt(result.blockHash) === BN_0) { - result.blockHash = null; - } - return result; -} -//# sourceMappingURL=format.js.map \ No newline at end of file diff --git a/lib.esm/providers/format.js.map b/lib.esm/providers/format.js.map deleted file mode 100644 index a2c3b85a5..000000000 --- a/lib.esm/providers/format.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src.ts/providers/format.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EACL,SAAS,EACT,SAAS,EACT,OAAO,EACP,WAAW,EACX,YAAY,EACZ,MAAM,EACN,cAAc,GACf,MAAM,mBAAmB,CAAC;AAS3B,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAIvB,MAAM,UAAU,SAAS,CAAC,MAAkB,EAAE,SAAe;IAC3D,OAAO,UAAU,KAAU;QACzB,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,MAAkB;IACxC,OAAO,CAAC,KAAU,EAAE,EAAE;QACpB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACzB,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;SACjC;QACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;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;IACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAgCI;IAEJ,oCAAoC;IACpC,IAAI,MAAM,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QAC5D,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC;KACzB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/lib.esm/providers/formatting.d.ts b/lib.esm/providers/formatting.d.ts deleted file mode 100644 index 82736fe7c..000000000 --- a/lib.esm/providers/formatting.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * About provider formatting? - * - * @_section: api/providers/formatting:Formatting [provider-formatting] - */ -export interface BlockParams { - hash?: null | string; - number: number; - timestamp: number; - parentHash: string; - nonce: string; - difficulty: bigint; - energyLimit: bigint; - energyUsed: bigint; - miner: string; - extraData: string; - baseFeePerEnergy: null | bigint; - transactions: ReadonlyArray; -} -export interface LogParams { - transactionHash: string; - blockHash: string; - blockNumber: number; - removed: boolean; - address: string; - data: string; - topics: ReadonlyArray; - index: number; - transactionIndex: number; -} -export interface TransactionReceiptParams { - to: null | string; - from: string; - contractAddress: null | string; - hash: string; - index: number; - blockHash: string; - blockNumber: number; - logsBloom: string; - logs: ReadonlyArray; - energyUsed: bigint; - cumulativeEnergyUsed: bigint; - energyPrice?: null | bigint; - effectiveEnergyPrice?: null | bigint; - type: number; - status: null | number; - root: null | string; -} -export interface TransactionResponseParams { - blockNumber: null | number; - blockHash: null | string; - hash: string; - index: number; - type: number; - to: null | string; - from: string; - nonce: number; - energyLimit: bigint; - energyPrice: bigint; - data: string; - value: bigint; - networkId: bigint; - signature: string; -} -//# sourceMappingURL=formatting.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/formatting.d.ts.map b/lib.esm/providers/formatting.d.ts.map deleted file mode 100644 index 65b377ed3..000000000 --- a/lib.esm/providers/formatting.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"form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ACnB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErC,IAAI,EAAE,MAAM,CAAC;IAEb,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;IACtB,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;CACrB;AAmBD,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,IAAI,GAAG,MAAM,CAAC;IAC3B,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;IAEzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,MAAM,CAAC;IAEb,EAAE,EAAE,IAAI,GAAG,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,EAAE,MAAM,CAAC;IAEd,WAAW,EAAE,MAAM,CAAC;IAEpB,WAAW,EAAE,MAAM,CAAC;IAEpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,MAAM,CAAC;CACnB"} \ No newline at end of file diff --git a/lib.esm/providers/formatting.js b/lib.esm/providers/formatting.js deleted file mode 100644 index 553a878b1..000000000 --- a/lib.esm/providers/formatting.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * About provider formatting? - * - * @_section: api/providers/formatting:Formatting [provider-formatting] - */ -export {}; -//# sourceMappingURL=formatting.js.map \ No newline at end of file diff --git a/lib.esm/providers/formatting.js.map b/lib.esm/providers/formatting.js.map deleted file mode 100644 index aafcc300d..000000000 --- a/lib.esm/providers/formatting.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"formatting.js","sourceRoot":"","sources":["../../src.ts/providers/formatting.ts"],"names":[],"mappings":"AAAA;;;;GAIG"} \ No newline at end of file diff --git a/lib.esm/providers/index.d.ts b/lib.esm/providers/index.d.ts deleted file mode 100644 index 7e80c01e9..000000000 --- a/lib.esm/providers/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * About providers. - * - * @_section: api/providers:Providers [about-providers] - */ -export { AbstractProvider, UnmanagedSubscriber } from "./abstract-provider.js"; -export { AbstractSigner, VoidSigner } from "./abstract-signer.js"; -export { showThrottleMessage } from "./community.js"; -export { getDefaultProvider } from "./default-provider.js"; -export { Network } from "./network.js"; -export { NonceManager } from "./signer-noncemanager.js"; -export { NetworkPlugin, EnergyCostPlugin, FeeDataNetworkPlugin, } from "./plugins-network.js"; -export { Block, FeeData, Log, TransactionReceipt, TransactionResponse, copyRequest, } from "./provider.js"; -export { FallbackProvider } from "./provider-fallback.js"; -export { JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, } from "./provider-jsonrpc.js"; -export { BrowserProvider } from "./provider-browser.js"; -export { AlchemyProvider } from "./provider-alchemy.js"; -export { AnkrProvider } from "./provider-ankr.js"; -export { CloudflareProvider } from "./provider-cloudflare.js"; -export { InfuraProvider, InfuraWebSocketProvider } from "./provider-infura.js"; -export { PocketProvider } from "./provider-pocket.js"; -export { QuickNodeProvider } from "./provider-quicknode.js"; -import { IpcSocketProvider } from "./provider-ipcsocket.js"; -export { IpcSocketProvider }; -export { SocketProvider } from "./provider-socket.js"; -export { WebSocketProvider } from "./provider-websocket.js"; -export { SocketSubscriber, SocketBlockSubscriber, SocketPendingSubscriber, SocketEventSubscriber, } from "./provider-socket.js"; -export type { Subscription, Subscriber, AbstractProviderPlugin, PerformActionFilter, PerformActionTransaction, PerformActionRequest, } from "./abstract-provider.js"; -export type { ContractRunner } from "./contracts.js"; -export type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams, } from "./formatting.js"; -export type { Networkish } from "./network.js"; -export type { EnergyCostParameters } from "./plugins-network.js"; -export type { BlockTag, TransactionRequest, PreparedTransactionRequest, EventFilter, Filter, FilterByBlockHash, OrphanFilter, ProviderEvent, TopicFilter, Provider, MinedBlock, MinedTransactionResponse, } from "./provider.js"; -export type { DebugEventBrowserProvider, Eip1193Provider, } from "./provider-browser.js"; -export type { JsonRpcPayload, JsonRpcResult, JsonRpcError, JsonRpcApiProviderOptions, JsonRpcTransactionRequest, } from "./provider-jsonrpc.js"; -export type { WebSocketCreator, WebSocketLike } from "./provider-websocket.js"; -export type { Signer } from "./signer.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/index.d.ts.map b/lib.esm/providers/index.d.ts.map deleted file mode 100644 index 206142646..000000000 --- a/lib.esm/providers/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/providers/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,KAAK,EACL,OAAO,EACP,GAAG,EACH,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,GAEZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAA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ACZ,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE/E,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/lib.esm/providers/index.js b/lib.esm/providers/index.js deleted file mode 100644 index 8ffd323f7..000000000 --- a/lib.esm/providers/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * About providers. - * - * @_section: api/providers:Providers [about-providers] - */ -export { AbstractProvider, UnmanagedSubscriber } from "./abstract-provider.js"; -export { AbstractSigner, VoidSigner } from "./abstract-signer.js"; -export { showThrottleMessage } from "./community.js"; -export { getDefaultProvider } from "./default-provider.js"; -export { Network } from "./network.js"; -export { NonceManager } from "./signer-noncemanager.js"; -export { NetworkPlugin, EnergyCostPlugin, FeeDataNetworkPlugin, } from "./plugins-network.js"; -export { Block, FeeData, Log, TransactionReceipt, TransactionResponse, copyRequest, -//resolveTransactionRequest, - } from "./provider.js"; -export { FallbackProvider } from "./provider-fallback.js"; -export { JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, } from "./provider-jsonrpc.js"; -export { BrowserProvider } from "./provider-browser.js"; -export { AlchemyProvider } from "./provider-alchemy.js"; -export { AnkrProvider } from "./provider-ankr.js"; -export { CloudflareProvider } from "./provider-cloudflare.js"; -export { InfuraProvider, InfuraWebSocketProvider } from "./provider-infura.js"; -export { PocketProvider } from "./provider-pocket.js"; -export { QuickNodeProvider } from "./provider-quicknode.js"; -import { IpcSocketProvider } from "./provider-ipcsocket.js"; /*-browser*/ -export { IpcSocketProvider }; -export { SocketProvider } from "./provider-socket.js"; -export { WebSocketProvider } from "./provider-websocket.js"; -export { SocketSubscriber, SocketBlockSubscriber, SocketPendingSubscriber, SocketEventSubscriber, } from "./provider-socket.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.esm/providers/index.js.map b/lib.esm/providers/index.js.map deleted file mode 100644 index ffbe9183d..000000000 --- a/lib.esm/providers/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/providers/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,KAAK,EACL,OAAO,EACP,GAAG,EACH,kBAAkB,EAClB,mBAAmB,EACnB,WAAW;AACX,4BAA4B;EAC7B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC,CAAC,YAAY;AACzE,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC"} \ No newline at end of file diff --git a/lib.esm/providers/network.d.ts b/lib.esm/providers/network.d.ts deleted file mode 100644 index eb935dd8b..000000000 --- a/lib.esm/providers/network.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -import type { BigNumberish } from "../utils/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { NetworkPlugin } from "./plugins-network.js"; -/** - * A Networkish can be used to allude to a Network, by specifing: - * - a [[Network]] object - * - a well-known (or registered) network name - * - a well-known (or registered) chain ID - * - an object with sufficient details to describe a network - */ -export type Networkish = Network | number | bigint | string | { - name?: string; - networkId?: number; - ensAddress?: string; - ensNetwork?: number; -}; -export declare class Network { - #private; - constructor(name: string, networkId: BigNumberish); - toJSON(): any; - /** - * The network common name. - * - * This is the canonical name, as networks migh have multiple - * names. - */ - get name(): string; - set name(value: string); - /** - * The network chain ID. - */ - get networkId(): bigint; - set networkId(value: BigNumberish); - /** - * Returns true if %%other%% matches this network. Any chain ID - * must match, and if no chain ID is present, the name must match. - * - * This method does not currently check for additional properties, - * such as ENS address or plug-in compatibility. - */ - matches(other: Networkish): boolean; - /** - * Returns the list of plugins currently attached to this Network. - */ - get plugins(): Array; - /** - * Attach a new %%plugin%% to this Network. The network name - * must be unique, excluding any fragment. - */ - attachPlugin(plugin: NetworkPlugin): this; - /** - * Return the plugin, if any, matching %%name%% exactly. Plugins - * with fragments will not be returned unless %%name%% includes - * a fragment. - */ - getPlugin(name: string): null | T; - /** - * Gets a list of all plugins that match %%name%%, with otr without - * a fragment. - */ - getPlugins(basename: string): Array; - /** - * Create a copy of this Network. - */ - clone(): Network; - /** - * Compute the intrinsic energy required for a transaction. - * - * A EnergyCostPlugin can be attached to override the default - * values. - */ - computeIntrinsicEnergy(tx: TransactionLike): number; - /** - * Returns a new Network for the %%network%% name or networkId. - */ - static from(network?: Networkish): Network; - /** - * Register %%nameOrnetworkId%% with a function which returns - * an instance of a Network representing that chain. - */ - static register(nameOrnetworkId: string | number | bigint, networkFunc: () => Network): void; -} -//# sourceMappingURL=network.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/network.d.ts.map b/lib.esm/providers/network.d.ts.map deleted file mode 100644 index a62904576..000000000 --- a/lib.esm/providers/network.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src.ts/providers/network.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAClB,OAAO,GACP,MAAM,GACN,MAAM,GACN,MAAM,GACN;IACE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAiBN,qBAAa,OAAO;;gBAMN,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY;IAMjD,MAAM,IAAI,GAAG;IAIb;;;;;OAKG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IACD,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IACD,IAAI,SAAS,CAAC,KAAK,EAAE,YAAY,EAEhC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO;IAmCnC;;OAEG;IACH,IAAI,OAAO,IAAI,KAAK,CAAC,aAAa,CAAC,CAElC;IAED;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAQzC;;;;OAIG;IACH,SAAS,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC;IAI1E;;;OAGG;IACH,UAAU,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,EAChD,QAAQ,EAAE,MAAM,GACf,KAAK,CAAC,CAAC,CAAC;IAMX;;OAEG;IACH,KAAK,IAAI,OAAO;IAQhB;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,EAAE,eAAe,GAAG,MAAM;IAuBnD;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO;IAyD1C;;;OAGG;IACH,MAAM,CAAC,QAAQ,CACb,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EACzC,WAAW,EAAE,MAAM,OAAO,GACzB,IAAI;CAeR"} \ No newline at end of file diff --git a/lib.esm/providers/network.js b/lib.esm/providers/network.js deleted file mode 100644 index e5b74e6a1..000000000 --- a/lib.esm/providers/network.js +++ /dev/null @@ -1,249 +0,0 @@ -/** - * About networks - * - * @_subsection: api/providers:Networks [networks] - */ -import { getBigInt, assertArgument } from "../utils/index.js"; -import { EnergyCostPlugin } from "./plugins-network.js"; -/* * * * -// Networks which operation against an L2 can use this plugin to -// specify how to access L1, for the purpose of resolving ENS, -// for example. -export class LayerOneConnectionPlugin extends NetworkPlugin { - readonly provider!: Provider; -*/ -// Networks or clients with a higher need for security (such as clients -// that may automatically make CCIP requests without user interaction) -// can use this plugin to anonymize requests or intercept CCIP requests -// to notify and/or receive authorization from the user -const Networks = new Map(); -export class Network { - #name; - #networkId; - #plugins; - constructor(name, networkId) { - this.#name = name; - this.#networkId = getBigInt(networkId); - this.#plugins = new Map(); - } - toJSON() { - return { name: this.name, networkId: String(this.networkId) }; - } - /** - * The network common name. - * - * This is the canonical name, as networks migh have multiple - * names. - */ - get name() { - return this.#name; - } - set name(value) { - this.#name = value; - } - /** - * The network chain ID. - */ - get networkId() { - return this.#networkId; - } - set networkId(value) { - this.#networkId = getBigInt(value, "networkId"); - } - /** - * Returns true if %%other%% matches this network. Any chain ID - * must match, and if no chain ID is present, the name must match. - * - * This method does not currently check for additional properties, - * such as ENS address or plug-in compatibility. - */ - matches(other) { - if (other == null) { - return false; - } - if (typeof other === "string") { - try { - return this.networkId === getBigInt(other); - } - catch (error) { } - return this.name === other; - } - if (typeof other === "number" || typeof other === "bigint") { - try { - return this.networkId === getBigInt(other); - } - catch (error) { } - return false; - } - if (typeof other === "object") { - if (other.networkId != null) { - try { - return this.networkId === getBigInt(other.networkId); - } - catch (error) { } - return false; - } - if (other.name != null) { - return this.name === other.name; - } - return false; - } - return false; - } - /** - * Returns the list of plugins currently attached to this Network. - */ - get plugins() { - return Array.from(this.#plugins.values()); - } - /** - * Attach a new %%plugin%% to this Network. The network name - * must be unique, excluding any fragment. - */ - attachPlugin(plugin) { - if (this.#plugins.get(plugin.name)) { - throw new Error(`cannot replace existing plugin: ${plugin.name} `); - } - this.#plugins.set(plugin.name, plugin.clone()); - return this; - } - /** - * Return the plugin, if any, matching %%name%% exactly. Plugins - * with fragments will not be returned unless %%name%% includes - * a fragment. - */ - getPlugin(name) { - return this.#plugins.get(name) || null; - } - /** - * Gets a list of all plugins that match %%name%%, with otr without - * a fragment. - */ - getPlugins(basename) { - return (this.plugins.filter((p) => p.name.split("#")[0] === basename)); - } - /** - * Create a copy of this Network. - */ - clone() { - const clone = new Network(this.name, this.networkId); - this.plugins.forEach((plugin) => { - clone.attachPlugin(plugin.clone()); - }); - return clone; - } - /** - * Compute the intrinsic energy required for a transaction. - * - * A EnergyCostPlugin can be attached to override the default - * values. - */ - computeIntrinsicEnergy(tx) { - const costs = this.getPlugin("org.corebc.plugins.network.EnergyCost") || new EnergyCostPlugin(); - let energy = costs.txBase; - if (tx.to == null) { - energy += costs.txCreate; - } - if (tx.data) { - for (let i = 2; i < tx.data.length; i += 2) { - if (tx.data.substring(i, i + 2) === "00") { - energy += costs.txDataZero; - } - else { - energy += costs.txDataNonzero; - } - } - } - return energy; - } - /** - * Returns a new Network for the %%network%% name or networkId. - */ - static from(network) { - injectCommonNetworks(); - // Default network - if (network == null) { - return Network.from("mainnet"); - } - // Canonical name or chain ID - if (typeof network === "number") { - network = BigInt(network); - } - if (typeof network === "string" || typeof network === "bigint") { - const networkFunc = Networks.get(network); - if (networkFunc) { - return networkFunc(); - } - if (typeof network === "bigint") { - return new Network("unknown", network); - } - assertArgument(false, "unknown network", "network", network); - } - // Clonable with network-like abilities - if (typeof network.clone === "function") { - const clone = network.clone(); - //if (typeof(network.name) !== "string" || typeof(network.networkId) !== "number") { - //} - return clone; - } - // Networkish - if (typeof network === "object") { - assertArgument(typeof network.name === "string" && - typeof network.networkId === "number", "invalid network object name or networkId", "network", network); - const custom = new Network(network.name, network.networkId); - //if ((network).layerOneConnection) { - // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection)); - //} - return custom; - } - assertArgument(false, "invalid network", "network", network); - } - /** - * Register %%nameOrnetworkId%% with a function which returns - * an instance of a Network representing that chain. - */ - static register(nameOrnetworkId, networkFunc) { - if (typeof nameOrnetworkId === "number") { - nameOrnetworkId = BigInt(nameOrnetworkId); - } - const existing = Networks.get(nameOrnetworkId); - if (existing) { - assertArgument(false, `conflicting network for ${JSON.stringify(existing.name)}`, "nameOrnetworkId", nameOrnetworkId); - } - Networks.set(nameOrnetworkId, networkFunc); - } -} -// See: https://chainlist.org -let injected = false; -function injectCommonNetworks() { - if (injected) { - return; - } - injected = true; - /// Register popular Core networks - function registerEth(name, networkId, options) { - const func = function () { - const network = new Network(name, networkId); - network.attachPlugin(new EnergyCostPlugin()); - return network; - }; - // Register the network by name and chain ID - Network.register(name, func); - Network.register(networkId, func); - if (options.altNames) { - options.altNames.forEach((name) => { - Network.register(name, func); - }); - } - } - registerEth("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] }); - registerEth("ropsten", 3, { ensNetwork: 3 }); - registerEth("rinkeby", 4, { ensNetwork: 4 }); - registerEth("goerli", 5, { ensNetwork: 5 }); - registerEth("kovan", 42, { ensNetwork: 42 }); - registerEth("sepolia", 11155111, {}); - registerEth("classic", 61, {}); - registerEth("classicKotti", 6, {}); - registerEth("xdai", 100, { ensNetwork: 1 }); -} -//# sourceMappingURL=network.js.map \ No newline at end of file diff --git a/lib.esm/providers/network.js.map b/lib.esm/providers/network.js.map deleted file mode 100644 index c22eeb2e6..000000000 --- a/lib.esm/providers/network.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src.ts/providers/network.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AA2BxD;;;;;;EAME;AAEF,uEAAuE;AACvE,sEAAsE;AACtE,uEAAuE;AACvE,uDAAuD;AAEvD,MAAM,QAAQ,GAAwC,IAAI,GAAG,EAAE,CAAC;AAEhE,MAAM,OAAO,OAAO;IAClB,KAAK,CAAS;IACd,UAAU,CAAS;IAEnB,QAAQ,CAA6B;IAErC,YAAY,IAAY,EAAE,SAAuB;QAC/C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;IAC5B,CAAC;IAED,MAAM;QACJ,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,C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AAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7C,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;IAErC,WAAW,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC/B,WAAW,CAAC,cAAc,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEnC,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;AAC9C,CAAC"} \ No newline at end of file diff --git a/lib.esm/providers/pagination.d.ts b/lib.esm/providers/pagination.d.ts deleted file mode 100644 index a772a85c2..000000000 --- a/lib.esm/providers/pagination.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface PaginationResult extends Array { - next(): Promise>; - totalResults: null | number; - done: boolean; -} -//# sourceMappingURL=pagination.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/pagination.d.ts.map b/lib.esm/providers/pagination.d.ts.map deleted file mode 100644 index 5479c9c0a..000000000 --- a/lib.esm/providers/pagination.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src.ts/providers/pagination.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IACnD,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IAGrC,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC;IAE5B,IAAI,EAAE,OAAO,CAAC;CACf"} \ No newline at end of file diff --git a/lib.esm/providers/pagination.js b/lib.esm/providers/pagination.js deleted file mode 100644 index dad94f2fa..000000000 --- a/lib.esm/providers/pagination.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=pagination.js.map \ No newline at end of file diff --git a/lib.esm/providers/pagination.js.map b/lib.esm/providers/pagination.js.map deleted file mode 100644 index d08e925cb..000000000 --- a/lib.esm/providers/pagination.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src.ts/providers/pagination.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.esm/providers/plugin-fallback.d.ts b/lib.esm/providers/plugin-fallback.d.ts deleted file mode 100644 index 10009e4b3..000000000 --- a/lib.esm/providers/plugin-fallback.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { AbstractProviderPlugin } from "./abstract-provider.js"; -import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; -export declare const PluginIdFallbackProvider = "org.corebc.plugins.provider.QualifiedPlugin"; -export declare class CheckQualifiedPlugin implements AbstractProviderPlugin { - name: string; - constructor(); - connect(provider: AbstractProvider): CheckQualifiedPlugin; - isQualified(action: PerformActionRequest, result: any): boolean; -} -export declare class PossiblyPrunedTransactionPlugin extends CheckQualifiedPlugin { - isQualified(action: PerformActionRequest, result: any): boolean; -} -//# sourceMappingURL=plugin-fallback.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/plugin-fallback.d.ts.map b/lib.esm/providers/plugin-fallback.d.ts.map deleted file mode 100644 index 6d2023762..000000000 --- a/lib.esm/providers/plugin-fallback.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugin-fallback.d.ts","sourceRoot":"","sources":["../../src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,wBAAwB,gDACU,CAAC;AAEhD,qBAAa,oBAAqB,YAAW,sBAAsB;IACzD,IAAI,EAAE,MAAM,CAAC;;IAQrB,OAAO,CAAC,QAAQ,EAAE,gBAAgB,GAAG,oBAAoB;IAMzD,WAAW,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;CAGhE;AAED,qBAAa,+BAAgC,SAAQ,oBAAoB;IACvE,WAAW,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;CAWhE"} \ No newline at end of file diff --git a/lib.esm/providers/plugin-fallback.js b/lib.esm/providers/plugin-fallback.js deleted file mode 100644 index fa51d1555..000000000 --- a/lib.esm/providers/plugin-fallback.js +++ /dev/null @@ -1,29 +0,0 @@ -import { defineProperties } from "../utils/index.js"; -export const PluginIdFallbackProvider = "org.corebc.plugins.provider.QualifiedPlugin"; -export class CheckQualifiedPlugin { - constructor() { - defineProperties(this, { - name: PluginIdFallbackProvider, - }); - } - connect(provider) { - return this; - } - // Retruns true if this value should be considered qualified for - // inclusion in the quorum. - isQualified(action, result) { - return true; - } -} -export class PossiblyPrunedTransactionPlugin extends CheckQualifiedPlugin { - isQualified(action, result) { - if (action.method === "getTransaction" || - action.method === "getTransactionReceipt") { - if (result == null) { - return false; - } - } - return super.isQualified(action, result); - } -} -//# sourceMappingURL=plugin-fallback.js.map \ No newline at end of file diff --git a/lib.esm/providers/plugin-fallback.js.map b/lib.esm/providers/plugin-fallback.js.map deleted file mode 100644 index 14309ecb9..000000000 --- a/lib.esm/providers/plugin-fallback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugin-fallback.js","sourceRoot":"","sources":["../../src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAOrD,MAAM,CAAC,MAAM,wBAAwB,GACnC,6CAA6C,CAAC;AAEhD,MAAM,OAAO,oBAAoB;IAG/B;QACE,gBAAgB,CAAuB,IAAI,EAAE;YAC3C,IAAI,EAAE,wBAAwB;SAC/B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,QAA0B;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gEAAgE;IAChE,2BAA2B;IAC3B,WAAW,CAAC,MAA4B,EAAE,MAAW;QACnD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,OAAO,+BAAgC,SAAQ,oBAAoB;IACvE,WAAW,CAAC,MAA4B,EAAE,MAAW;QACnD,IACE,MAAM,CAAC,MAAM,KAAK,gBAAgB;YAClC,MAAM,CAAC,MAAM,KAAK,uBAAuB,EACzC;YACA,IAAI,MAAM,IAAI,IAAI,EAAE;gBAClB,OAAO,KAAK,CAAC;aACd;SACF;QACD,OAAO,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/plugins-network.d.ts b/lib.esm/providers/plugins-network.d.ts deleted file mode 100644 index 80364b3ad..000000000 --- a/lib.esm/providers/plugins-network.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { FeeData, Provider } from "./provider.js"; -export declare class NetworkPlugin { - readonly name: string; - constructor(name: string); - clone(): NetworkPlugin; -} -export type EnergyCostParameters = { - txBase?: number; - txCreate?: number; - txDataZero?: number; - txDataNonzero?: number; - txAccessListStorageKey?: number; - txAccessListAddress?: number; -}; -export declare class EnergyCostPlugin extends NetworkPlugin implements EnergyCostParameters { - readonly effectiveBlock: number; - readonly txBase: number; - readonly txCreate: number; - readonly txDataZero: number; - readonly txDataNonzero: number; - readonly txAccessListStorageKey: number; - readonly txAccessListAddress: number; - constructor(effectiveBlock?: number, costs?: EnergyCostParameters); - clone(): EnergyCostPlugin; -} -export declare class FeeDataNetworkPlugin extends NetworkPlugin { - #private; - get feeDataFunc(): (provider: Provider) => Promise; - constructor(feeDataFunc: (provider: Provider) => Promise); - getFeeData(provider: Provider): Promise; - clone(): FeeDataNetworkPlugin; -} -//# sourceMappingURL=plugins-network.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/plugins-network.d.ts.map b/lib.esm/providers/plugins-network.d.ts.map deleted file mode 100644 index 7c9b9b3c7..000000000 --- a/lib.esm/providers/plug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C;IAK3D,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAItD,KAAK,IAAI,oBAAoB;CAG9B"} \ No newline at end of file diff --git a/lib.esm/providers/plugins-network.js b/lib.esm/providers/plugins-network.js deleted file mode 100644 index b99f976a2..000000000 --- a/lib.esm/providers/plugins-network.js +++ /dev/null @@ -1,80 +0,0 @@ -import { defineProperties } from "../utils/properties.js"; -import { assertArgument } from "../utils/index.js"; -export class NetworkPlugin { - name; - constructor(name) { - defineProperties(this, { name }); - } - clone() { - return new NetworkPlugin(this.name); - } -} -export class EnergyCostPlugin extends NetworkPlugin { - effectiveBlock; - txBase; - txCreate; - txDataZero; - txDataNonzero; - txAccessListStorageKey; - txAccessListAddress; - constructor(effectiveBlock, costs) { - if (effectiveBlock == null) { - effectiveBlock = 0; - } - super(`org.corebc.network.plugins.EnergyCost#${effectiveBlock || 0}`); - const props = { effectiveBlock }; - function set(name, nullish) { - let value = (costs || {})[name]; - if (value == null) { - value = nullish; - } - assertArgument(typeof value === "number", `invalud value for ${name}`, "costs", costs); - props[name] = value; - } - set("txBase", 21000); - set("txCreate", 32000); - set("txDataZero", 4); - set("txDataNonzero", 16); - set("txAccessListStorageKey", 1900); - set("txAccessListAddress", 2400); - defineProperties(this, props); - } - clone() { - return new EnergyCostPlugin(this.effectiveBlock, this); - } -} -export class FeeDataNetworkPlugin extends NetworkPlugin { - #feeDataFunc; - get feeDataFunc() { - return this.#feeDataFunc; - } - constructor(feeDataFunc) { - super("org.corebc.plugins.network.FeeData"); - this.#feeDataFunc = feeDataFunc; - } - async getFeeData(provider) { - return await this.#feeDataFunc(provider); - } - clone() { - return new FeeDataNetworkPlugin(this.#feeDataFunc); - } -} -/* -export class CustomBlockNetworkPlugin extends NetworkPlugin { - readonly #blockFunc: (provider: Provider, block: BlockParams) => Block; - readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block; - - async getBlock(provider: Provider, block: BlockParams): Promise> { - return await this.#blockFunc(provider, block); - } - - async getBlockions(provider: Provider, block: BlockParams): Promise> { - return await this.#blockWithTxsFunc(provider, block); - } - - clone(): CustomBlockNetworkPlugin { - return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc); - } -} -*/ -//# sourceMappingURL=plugins-network.js.map \ No newline at end of file diff --git a/lib.esm/providers/plugins-network.js.map b/lib.esm/providers/plugins-network.js.map deleted file mode 100644 index 4f149be02..000000000 --- a/lib.esm/providers/plugins-network.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugins-network.js","sourceRoot":"","sources":["../../src.ts/providers/plugins-network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,MAAM,OAAO,aAAa;IACf,IAAI,CAAU;IAEvB,YAAY,IAAY;QACtB,gBAAgB,CAAgB,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,KAAK;QACH,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;CAKF;AAcD,MAAM,OAAO,gBACX,SAAQ,aAAa;IAGZ,cAAc,CAAU;IAExB,MAAM,CAAU;IAChB,QAAQ,CAAU;IAClB,UAAU,CAAU;IACpB,aAAa,CAAU;IACvB,sBAAsB,CAAU;IAChC,mBAAmB,CAAU;IAEtC,YAAY,cAAuB,EAAE,KAA4B;QAC/D,IAAI,cAAc,IAAI,IAAI,EAAE;YAC1B,cAAc,GAAG,CAAC,CAAC;SACpB;QACD,KAAK,CAAC,yCAAyC,cAAc,IAAI,CAAC,EAAE,CAAC,CAAC;QAEtE,MAAM,KAAK,GAA2B,EAAE,cAAc,EAAE,CAAC;QACzD,SAAS,GAAG,CAAC,IAAgC,EAAE,OAAe;YAC5D,IAAI,KAAK,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,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ib.esm/providers/provider-alchemy.d.ts deleted file mode 100644 index 17af0df46..000000000 --- a/lib.esm/providers/provider-alchemy.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * About Alchemy - * - * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] - */ -import { FetchRequest } from "../utils/index.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -/** - * The **AlchemyProvider** connects to the [[link-alchemy]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-alchemy-signup). - * - * @_docloc: api/providers/thirdparty - */ -export declare class AlchemyProvider extends JsonRpcProvider implements CommunityResourcable { - readonly apiKey: string; - constructor(_network?: Networkish, apiKey?: null | string); - _getProvider(networkId: number): AbstractProvider; - _perform(req: PerformActionRequest): Promise; - isCommunityResource(): boolean; - static getRequest(network: Network, apiKey?: string): FetchRequest; -} -//# sourceMappingURL=provider-alchemy.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/provider-alchemy.d.ts.map b/lib.esm/providers/provider-alchemy.d.ts.map deleted file mode 100644 index f2eec176b..000000000 --- a/lib.esm/providers/provider-alchemy.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-alchemy.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-alchemy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAKL,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA8B/C;;;;;;;;;;GAUG;AACH,qBAAa,eACX,SAAQ,eACR,YAAW,oBAAoB;IAE/B,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;gBAEb,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAezD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAO3C,QAAQ,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IA2CvD,mBAAmB,IAAI,OAAO;IAI9B,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY;CAmBnE"} \ No newline at end of file diff --git a/lib.esm/providers/provider-alchemy.js b/lib.esm/providers/provider-alchemy.js deleted file mode 100644 index b5dea5337..000000000 --- a/lib.esm/providers/provider-alchemy.js +++ /dev/null @@ -1,118 +0,0 @@ -/** - * About Alchemy - * - * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] - */ -import { defineProperties, resolveProperties, assert, assertArgument, FetchRequest, } from "../utils/index.js"; -import { showThrottleMessage } from "./community.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; -function getHost(name) { - switch (name) { - case "mainnet": - return "eth-mainnet.alchemyapi.io"; - case "goerli": - return "eth-goerli.g.alchemy.com"; - case "sepolia": - return "eth-sepolia.g.alchemy.com"; - case "arbitrum": - return "arb-mainnet.g.alchemy.com"; - case "arbitrum-goerli": - return "arb-goerli.g.alchemy.com"; - case "matic": - return "polygon-mainnet.g.alchemy.com"; - case "matic-mumbai": - return "polygon-mumbai.g.alchemy.com"; - case "optimism": - return "opt-mainnet.g.alchemy.com"; - case "optimism-goerli": - return "opt-goerli.g.alchemy.com"; - } - assertArgument(false, "unsupported network", "network", name); -} -/** - * The **AlchemyProvider** connects to the [[link-alchemy]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-alchemy-signup). - * - * @_docloc: api/providers/thirdparty - */ -export class AlchemyProvider extends JsonRpcProvider { - apiKey; - constructor(_network, apiKey) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (apiKey == null) { - apiKey = defaultApiKey; - } - const request = AlchemyProvider.getRequest(network, apiKey); - super(request, network, { staticNetwork: network }); - defineProperties(this, { apiKey }); - } - _getProvider(networkId) { - try { - return new AlchemyProvider(networkId, this.apiKey); - } - catch (error) { } - return super._getProvider(networkId); - } - async _perform(req) { - // https://docs.alchemy.com/reference/trace-transaction - if (req.method === "getTransactionResult") { - const { trace, tx } = await resolveProperties({ - trace: this.send("trace_transaction", [req.hash]), - tx: this.getTransaction(req.hash), - }); - if (trace == null || tx == null) { - return null; - } - let data; - let error = false; - try { - data = trace[0].result.output; - error = trace[0].error === "Reverted"; - } - catch (error) { } - if (data) { - assert(!error, "an error occurred during transaction executions", "CALL_EXCEPTION", { - action: "getTransactionResult", - data, - reason: null, - transaction: tx, - invocation: null, - revert: null, // @TODO - }); - return data; - } - assert(false, "could not parse trace result", "BAD_DATA", { - value: trace, - }); - } - return await super._perform(req); - } - isCommunityResource() { - return this.apiKey === defaultApiKey; - } - static getRequest(network, apiKey) { - if (apiKey == null) { - apiKey = defaultApiKey; - } - const request = new FetchRequest(`https:/\/${getHost(network.name)}/v2/${apiKey}`); - request.allowGzip = true; - if (apiKey === defaultApiKey) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("alchemy"); - return true; - }; - } - return request; - } -} -//# sourceMappingURL=provider-alchemy.js.map \ No newline at end of file diff --git a/lib.esm/providers/provider-alchemy.js.map b/lib.esm/providers/provider-alchemy.js.map deleted file mode 100644 index 4b801874e..000000000 --- a/lib.esm/providers/provider-alchemy.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-alchemy.js","sourceRoot":"","sources":["../../src.ts/providers/provider-alchemy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,cAAc,EACd,YAAY,GACb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AASxD,MAAM,aAAa,GAAG,kCAAkC,CAAC;AAEzD,SAAS,OAAO,CAAC,IAAY;IAC3B,QAAQ,IAAI,EAAE;QACZ,KAAK,SAAS;YACZ,OAAO,2BAA2B,CAAC;QACrC,KAAK,QAAQ;YACX,OAAO,0BAA0B,CAAC;QACpC,KAAK,SAAS;YACZ,OAAO,2BAA2B,CAAC;QAErC,KAAK,UAAU;YACb,OAAO,2BAA2B,CAAC;QACrC,KAAK,iBAAiB;YACpB,OAAO,0BAA0B,CAAC;QACpC,KAAK,OAAO;YACV,OAAO,+BAA+B,CAAC;QACzC,KAAK,cAAc;YACjB,OAAO,8BAA8B,CAAC;QACxC,KAAK,UAAU;YACb,OAAO,2BAA2B,CAAC;QACrC,KAAK,iBAAiB;YACpB,OAAO,0BAA0B,CAAC;KACrC;IAED,cAAc,CAAC,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,eACX,SAAQ,eAAe;IAGd,MAAM,CAAU;IAEzB,YAAY,QAAqB,EAAE,MAAsB;QACvD,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,SAAS,CAAC;SACtB;QACD,MAAM,OAAO,GAAG,OAAO,CAA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AO,KAAK,EAAE,GAAE;YAElB,IAAI,IAAI,EAAE;gBACR,MAAM,CACJ,CAAC,KAAK,EACN,iDAAiD,EACjD,gBAAgB,EAChB;oBACE,MAAM,EAAE,sBAAsB;oBAC9B,IAAI;oBACJ,MAAM,EAAE,IAAI;oBACZ,WAAW,EAAE,EAAE;oBACf,UAAU,EAAE,IAAI;oBAChB,MAAM,EAAE,IAAI,EAAE,QAAQ;iBACvB,CACF,CAAC;gBACF,OAAO,IAAI,CAAC;aACb;YAED,MAAM,CAAC,KAAK,EAAE,8BAA8B,EAAE,UAAU,EAAE;gBACxD,KAAK,EAAE,KAAK;aACb,CAAC,CAAC;SACJ;QAED,OAAO,MAAM,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,mBAAmB;QACjB,OAAO,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,OAAgB,EAAE,MAAe;QACjD,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,MAAM,GAAG,aAAa,CAAC;SACxB;QAED,MAAM,OAAO,GAAG,IAAI,YAAY,CAC9B,YAAY,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,MAAM,EAAE,CACjD,CAAC;QACF,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QAEzB,IAAI,MAAM,KAAK,aAAa,EAAE;YAC5B,OAAO,CAAC,SAAS,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACvD,mBAAmB,CAAC,SAAS,CAAC,CAAC;gBAC/B,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;SACH;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/provider-ankr.d.ts b/lib.esm/providers/provider-ankr.d.ts deleted file mode 100644 index 77af5a3a0..000000000 --- a/lib.esm/providers/provider-ankr.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * [[link-ankr]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Polygon (``matic``) - * - Arbitrum (``arbitrum``) - * - * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] - */ -import { FetchRequest } from "../utils/index.js"; -import { AbstractProvider } from "./abstract-provider.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -import type { JsonRpcError, JsonRpcPayload } from "./provider-jsonrpc.js"; -/** - * The **AnkrProvider** connects to the [[link-ankr]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-ankr-signup). - */ -export declare class AnkrProvider extends JsonRpcProvider implements CommunityResourcable { - /** - * The API key for the Ankr connection. - */ - readonly apiKey: string; - /** - * Create a new **AnkrProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network?: Networkish, apiKey?: null | string); - _getProvider(networkId: number): AbstractProvider; - /** - * Returns a prepared request for connecting to %%network%% with - * %%apiKey%%. - */ - static getRequest(network: Network, apiKey?: null | string): FetchRequest; - getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error; - isCommunityResource(): boolean; -} -//# sourceMappingURL=provider-ankr.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/provider-ankr.d.ts.map b/lib.esm/providers/provider-ankr.d.ts.map deleted file mode 100644 index 45cfc5423..000000000 --- a/lib.esm/providers/provider-ankr.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ankr.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ankr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAoB1E;;;;;;;;GAQG;AACH,qBAAa,YACX,SAAQ,eACR,YAAW,oBAAoB;IAE/B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAEzB;;;;;OAKG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAkBzD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAOjD;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;IAoBzE,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,GAAG,KAAK;IAchE,mBAAmB,IAAI,OAAO;CAG/B"} \ No newline at end of file diff --git a/lib.esm/providers/provider-ankr.js b/lib.esm/providers/provider-ankr.js deleted file mode 100644 index 1480fe920..000000000 --- a/lib.esm/providers/provider-ankr.js +++ /dev/null @@ -1,105 +0,0 @@ -/** - * [[link-ankr]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Polygon (``matic``) - * - Arbitrum (``arbitrum``) - * - * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] - */ -import { defineProperties, FetchRequest, assertArgument, } from "../utils/index.js"; -import { showThrottleMessage } from "./community.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -const defaultApiKey = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; -function getHost(name) { - switch (name) { - case "mainnet": - return "rpc.ankr.com/eth"; - case "goerli": - return "rpc.ankr.com/xcb_goerli"; - case "matic": - return "rpc.ankr.com/polygon"; - case "arbitrum": - return "rpc.ankr.com/arbitrum"; - } - assertArgument(false, "unsupported network", "network", name); -} -/** - * The **AnkrProvider** connects to the [[link-ankr]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-ankr-signup). - */ -export class AnkrProvider extends JsonRpcProvider { - /** - * The API key for the Ankr connection. - */ - apiKey; - /** - * Create a new **AnkrProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network, apiKey) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (apiKey == null) { - apiKey = defaultApiKey; - } - // Ankr does not support filterId, so we force polling - const options = { polling: true, staticNetwork: network }; - const request = AnkrProvider.getRequest(network, apiKey); - super(request, network, options); - defineProperties(this, { apiKey }); - } - _getProvider(networkId) { - try { - return new AnkrProvider(networkId, this.apiKey); - } - catch (error) { } - return super._getProvider(networkId); - } - /** - * Returns a prepared request for connecting to %%network%% with - * %%apiKey%%. - */ - static getRequest(network, apiKey) { - if (apiKey == null) { - apiKey = defaultApiKey; - } - const request = new FetchRequest(`https:/\/${getHost(network.name)}/${apiKey}`); - request.allowGzip = true; - if (apiKey === defaultApiKey) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("AnkrProvider"); - return true; - }; - } - return request; - } - getRpcError(payload, error) { - if (payload.method === "xcb_sendRawTransaction") { - if (error && - error.error && - error.error.message === "INTERNAL_ERROR: could not replace existing tx") { - error.error.message = "replacement transaction underpriced"; - } - } - return super.getRpcError(payload, error); - } - isCommunityResource() { - return this.apiKey === defaultApiKey; - } -} -//# sourceMappingURL=provider-ankr.js.map \ No newline at end of file diff --git a/lib.esm/providers/provider-ankr.js.map b/lib.esm/providers/provider-ankr.js.map deleted file mode 100644 index 57ac6a154..000000000 --- a/lib.esm/providers/provider-ankr.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ankr.js","sourceRoot":"","sources":["../../src.ts/providers/provider-ankr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,GACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAMxD,MAAM,aAAa,GACjB,kEAAkE,CAAC;AAErE,SAAS,OAAO,CAAC,IAAY;IAC3B,QAAQ,IAAI,EAAE;QACZ,KAAK,SAAS;YACZ,OAAO,kBAAkB,CAAC;QAC5B,KAAK,QAAQ;YACX,OAAO,yBAAyB,CAAC;QACnC,KAAK,OAAO;YACV,OAAO,sBAAsB,CAAC;QAChC,KAAK,UAAU;YACb,OAAO,uBAAuB,CAAC;KAClC;IAED,cAAc,CAAC,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,YACX,SAAQ,eAAe;IAGvB;;OAEG;IACM,MAAM,CAAU;IAEzB;;;;;OAKG;IACH,YAAY,QAAqB,EAAE,MAAsB;QACvD,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,SAAS,CAAC;SACtB;QACD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,MAAM,GAAG,aAAa,CAAC;SACxB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,+CAA+C,EACvE;gBACA,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,qCAAqC,CAAC;aAC7D;SACF;QAED,OAAO,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,mBAAmB;QACjB,OAAO,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC;IACvC,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/provider-browser.d.ts b/lib.esm/providers/provider-browser.d.ts deleted file mode 100644 index 2e917663a..000000000 --- a/lib.esm/providers/provider-browser.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { JsonRpcApiPollingProvider } from "./provider-jsonrpc.js"; -import type { JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcSigner } from "./provider-jsonrpc.js"; -import type { Networkish } from "./network.js"; -export interface Eip1193Provider { - request(request: { - method: string; - params?: Array | Record; - }): Promise; -} -export type DebugEventBrowserProvider = { - action: "sendEip1193Payload"; - payload: { - method: string; - params: Array; - }; -} | { - action: "receiveEip1193Result"; - result: any; -} | { - action: "receiveEip1193Error"; - error: Error; -}; -export declare class BrowserProvider extends JsonRpcApiPollingProvider { - #private; - constructor(core: Eip1193Provider, network?: Networkish); - send(method: string, params: Array | Record): Promise; - _send(payload: JsonRpcPayload | Array): Promise>; - getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error; - hasSigner(address: number | string): Promise; - getSigner(address?: number | string): Promise; -} -//# sourceMappingURL=provider-browser.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/provider-browser.d.ts.map b/lib.esm/providers/provider-browser.d.ts.map deleted file mode 100644 index cf224c60e..000000000 --- a/lib.esm/providers/provider-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-browser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAA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OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAkBnE"} \ No newline at end of file diff --git a/lib.esm/providers/provider-browser.js b/lib.esm/providers/provider-browser.js deleted file mode 100644 index 82c9272af..000000000 --- a/lib.esm/providers/provider-browser.js +++ /dev/null @@ -1,87 +0,0 @@ -import { assertArgument } from "../utils/index.js"; -import { JsonRpcApiPollingProvider } from "./provider-jsonrpc.js"; -export class BrowserProvider extends JsonRpcApiPollingProvider { - #request; - constructor(core, network) { - super(network, { batchMaxCount: 1 }); - this.#request = async (method, params) => { - const payload = { method, params }; - this.emit("debug", { action: "sendEip1193Request", payload }); - try { - const result = await core.request(payload); - this.emit("debug", { action: "receiveEip1193Result", result }); - return result; - } - catch (e) { - const error = new Error(e.message); - error.code = e.code; - error.data = e.data; - error.payload = payload; - this.emit("debug", { action: "receiveEip1193Error", error }); - throw error; - } - }; - } - async send(method, params) { - await this._start(); - return await super.send(method, params); - } - async _send(payload) { - assertArgument(!Array.isArray(payload), "EIP-1193 does not support batch request", "payload", payload); - try { - const result = await this.#request(payload.method, payload.params || []); - return [{ id: payload.id, result }]; - } - catch (e) { - return [ - { - id: payload.id, - error: { code: e.code, data: e.data, message: e.message }, - }, - ]; - } - } - getRpcError(payload, error) { - error = JSON.parse(JSON.stringify(error)); - // EIP-1193 gives us some machine-readable error codes, so rewrite - // them into - switch (error.error.code || -1) { - case 4001: - error.error.message = `corebc-user-denied: ${error.error.message}`; - break; - case 4200: - error.error.message = `corebc-unsupported: ${error.error.message}`; - break; - } - return super.getRpcError(payload, error); - } - async hasSigner(address) { - if (address == null) { - address = 0; - } - const accounts = await this.send("xcb_accounts", []); - if (typeof address === "number") { - return accounts.length > address; - } - address = address.toLowerCase(); - return (accounts.filter((a) => a.toLowerCase() === address).length !== 0); - } - async getSigner(address) { - if (address == null) { - address = 0; - } - if (!(await this.hasSigner(address))) { - try { - //const resp = - await this.#request("xcb_requestAccounts", []); - //console.log("RESP", resp); - } - catch (error) { - const payload = error.payload; - throw this.getRpcError(payload, { id: payload.id, error }); - } - } - return await super.getSigner(address); - } -} -//# sourceMappingURL=provider-browser.js.map \ No newline at end of file diff --git a/lib.esm/providers/provider-browser.js.map b/lib.esm/providers/provider-browser.js.map deleted file mode 100644 index fd4f140d8..000000000 --- a/lib.esm/providers/provider-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-browser.js","sourceRoot":"","sources":["../../src.ts/providers/provider-browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AA+BlE,MAAM,OAAO,eAAgB,SAAQ,yBAAyB;IAC5D,QAAQ,CAGU;IAElB,YAAY,IAAqB,EAAE,OAAoB;QACrD,KAAK,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC;QAErC,IAAI,CAAC,QAAQ,GAAG,KAAK,EACnB,MAAc,EACd,MAAwC,EACxC,EAAE;YACF,MAAM,OAAO,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,CAAC,CAAC;YAC9D,IAAI;gBACF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC3C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,CAAC,CAAC;gBAC/D,OAAO,MAAM,CAAC;aACf;YAAC,OAAO,CAAM,EAAE;gBACf,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBAC7B,KAAM,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;gBACrB,KAAM,CAAC,IAAI,GAAG,CAA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C,WAAW,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;aAC5D;SACF;QAED,OAAO,MAAM,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/provider-cloudflare.d.ts b/lib.esm/providers/provider-cloudflare.d.ts deleted file mode 100644 index 869651f44..000000000 --- a/lib.esm/providers/provider-cloudflare.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * About Cloudflare - * - * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] - */ -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { Networkish } from "./network.js"; -/** - * About Cloudflare... - */ -export declare class CloudflareProvider extends JsonRpcProvider { - constructor(_network?: Networkish); -} -//# sourceMappingURL=provider-cloudflare.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/provider-cloudflare.d.ts.map b/lib.esm/providers/provider-cloudflare.d.ts.map deleted file mode 100644 index e70790a60..000000000 --- a/lib.esm/providers/provider-cloudflare.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-cloudflare.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-cloudflare.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,eAAe;gBACzC,QAAQ,CAAC,EAAE,UAAU;CAalC"} \ No newline at end of file diff --git a/lib.esm/providers/provider-cloudflare.js b/lib.esm/providers/provider-cloudflare.js deleted file mode 100644 index e74cb2f58..000000000 --- a/lib.esm/providers/provider-cloudflare.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * About Cloudflare - * - * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] - */ -import { assertArgument } from "../utils/index.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -/** - * About Cloudflare... - */ -export class CloudflareProvider extends JsonRpcProvider { - constructor(_network) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - assertArgument(network.name === "mainnet", "unsupported network", "network", _network); - super("https://cloudflare-eth.com/", network, { staticNetwork: network }); - } -} -//# sourceMappingURL=provider-cloudflare.js.map \ No newline at end of file diff --git a/lib.esm/providers/provider-cloudflare.js.map b/lib.esm/providers/provider-cloudflare.js.map deleted file mode 100644 index faa23f6e1..000000000 --- a/lib.esm/providers/provider-cloudflare.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-cloudflare.js","sourceRoot":"","sources":["../../src.ts/providers/provider-cloudflare.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,eAAe;IACrD,YAAY,QAAqB;QAC/B,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,SAAS,CAAC;SACtB;QACD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,cAAc,CACZ,OAAO,CAAC,IAAI,KAAK,SAAS,EAC1B,qBAAqB,EACrB,SAAS,EACT,QAAQ,CACT,CAAC;QACF,KAAK,CAAC,6BAA6B,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/provider-fallback.d.ts b/lib.esm/providers/provider-fallback.d.ts deleted file mode 100644 index bf814a2ff..000000000 --- a/lib.esm/providers/provider-fallback.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { AbstractProvider } from "./abstract-provider.js"; -import { Network } from "./network.js"; -import type { PerformActionRequest } from "./abstract-provider.js"; -import type { Networkish } from "./network.js"; -/** - * A configuration entry for how to use a [[Provider]]. - */ -export interface FallbackProviderConfig { - provider: AbstractProvider; - stallTimeout?: number; - priority?: number; - weight?: number; -} -/** - * The statistics and state maintained for a [[Provider]]. - */ -export interface FallbackProviderState extends Required { - blockNumber: number; - requests: number; - errorResponses: number; - lateResponses: number; - outOfSync: number; - unsupportedEvents: number; - rollingDuration: number; - score: number; -} -/** - * Additional options to configure a [[FallbackProvider]]. - */ -export type FallbackProviderOptions = { - quorum: number; - eventQuorum: number; - eventWorkers: number; -}; -/** - * A Fallback Provider. - * - */ -export declare class FallbackProvider extends AbstractProvider { - #private; - readonly quorum: number; - readonly eventQuorum: number; - readonly eventWorkers: number; - constructor(providers: Array, network?: Networkish); - get providerConfigs(): Array; - _detectNetwork(): Promise; - _translatePerform(provider: AbstractProvider, req: PerformActionRequest): Promise; - _perform(req: PerformActionRequest): Promise; - destroy(): Promise; -} -//# sourceMappingURL=provider-fallback.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/provider-fallback.d.ts.map b/lib.esm/providers/provider-fallback.d.ts.map deleted file mode 100644 index 16b3b607f..000000000 --- a/lib.esm/providers/provider-fallback.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-fallback.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-fallback.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAiC/C;;GAEG;AACH,MAAM,WAAW,sBAAsB;IAErC,QAAQ,EAAE,gBAAgB,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} \ No newline at end of file diff --git a/lib.esm/providers/provider-fallback.js b/lib.esm/providers/provider-fallback.js deleted file mode 100644 index b7bbad61c..000000000 --- a/lib.esm/providers/provider-fallback.js +++ /dev/null @@ -1,541 +0,0 @@ -/** - * Explain all the nitty-gritty about the **FallbackProvider**. - * - * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider] - */ -import { getBigInt, getNumber, assert, assertArgument, } from "../utils/index.js"; -import { AbstractProvider } from "./abstract-provider.js"; -import { Network } from "./network.js"; -const BN_1 = BigInt("1"); -const BN_2 = BigInt("2"); -function shuffle(array) { - for (let i = array.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - const tmp = array[i]; - array[i] = array[j]; - array[j] = tmp; - } -} -function stall(duration) { - return new Promise((resolve) => { - setTimeout(resolve, duration); - }); -} -function getTime() { - return new Date().getTime(); -} -function stringify(value) { - return JSON.stringify(value, (key, value) => { - if (typeof value === "bigint") { - return { type: "bigint", value: value.toString() }; - } - return value; - }); -} -const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 }; -const defaultState = { - blockNumber: -2, - requests: 0, - lateResponses: 0, - errorResponses: 0, - outOfSync: -1, - unsupportedEvents: 0, - rollingDuration: 0, - score: 0, - _network: null, - _updateNumber: null, - _totalTime: 0, -}; -async function waitForSync(config, blockNumber) { - while (config.blockNumber < 0 || config.blockNumber < blockNumber) { - if (!config._updateNumber) { - config._updateNumber = (async () => { - const blockNumber = await config.provider.getBlockNumber(); - if (blockNumber > config.blockNumber) { - config.blockNumber = blockNumber; - } - config._updateNumber = null; - })(); - } - await config._updateNumber; - config.outOfSync++; - } -} -function _normalize(value) { - if (value == null) { - return "null"; - } - if (Array.isArray(value)) { - return "[" + value.map(_normalize).join(",") + "]"; - } - if (typeof value === "object" && typeof value.toJSON === "function") { - return _normalize(value.toJSON()); - } - switch (typeof value) { - case "boolean": - case "symbol": - return value.toString(); - case "bigint": - case "number": - return BigInt(value).toString(); - case "string": - return JSON.stringify(value); - case "object": { - const keys = Object.keys(value); - keys.sort(); - return ("{" + - keys - .map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`) - .join(",") + - "}"); - } - } - console.log("Could not serialize", value); - throw new Error("Hmm..."); -} -function normalizeResult(value) { - if ("error" in value) { - const error = value.error; - return { tag: _normalize(error), value: error }; - } - const result = value.result; - return { tag: _normalize(result), value: result }; -} -// This strategy picks the highest weight result, as long as the weight is -// equal to or greater than quorum -function checkQuorum(quorum, results) { - const tally = new Map(); - for (const { value, tag, weight } of results) { - const t = tally.get(tag) || { value, weight: 0 }; - t.weight += weight; - tally.set(tag, t); - } - let best = null; - for (const r of tally.values()) { - if (r.weight >= quorum && (!best || r.weight > best.weight)) { - best = r; - } - } - if (best) { - return best.value; - } - return undefined; -} -function getMedian(quorum, results) { - let resultWeight = 0; - const errorMap = new Map(); - let bestError = null; - const values = []; - for (const { value, tag, weight } of results) { - if (value instanceof Error) { - const e = errorMap.get(tag) || { value, weight: 0 }; - e.weight += weight; - errorMap.set(tag, e); - if (bestError == null || e.weight > bestError.weight) { - bestError = e; - } - } - else { - values.push(BigInt(value)); - resultWeight += weight; - } - } - if (resultWeight < quorum) { - // We have quorum for an error - if (bestError && bestError.weight >= quorum) { - return bestError.value; - } - // We do not have quorum for a result - return undefined; - } - // Get the sorted values - values.sort((a, b) => (a < b ? -1 : b > a ? 1 : 0)); - const mid = Math.floor(values.length / 2); - // Odd-length; take the middle value - if (values.length % 2) { - return values[mid]; - } - // Even length; take the ceiling of the mean of the center two values - return (values[mid - 1] + values[mid] + BN_1) / BN_2; -} -function getAnyResult(quorum, results) { - // If any value or error meets quorum, that is our preferred result - const result = checkQuorum(quorum, results); - if (result !== undefined) { - return result; - } - // Otherwise, do we have any result? - for (const r of results) { - if (r.value) { - return r.value; - } - } - // Nope! - return undefined; -} -function getFuzzyMode(quorum, results) { - if (quorum === 1) { - return getNumber(getMedian(quorum, results), "%internal"); - } - const tally = new Map(); - const add = (result, weight) => { - const t = tally.get(result) || { result, weight: 0 }; - t.weight += weight; - tally.set(result, t); - }; - for (const { weight, value } of results) { - const r = getNumber(value); - add(r - 1, weight); - add(r, weight); - add(r + 1, weight); - } - let bestWeight = 0; - let bestResult = undefined; - for (const { weight, result } of tally.values()) { - // Use this result, if this result meets quorum and has either: - // - a better weight - // - or equal weight, but the result is larger - if (weight >= quorum && - (weight > bestWeight || - (bestResult != null && weight === bestWeight && result > bestResult))) { - bestWeight = weight; - bestResult = result; - } - } - return bestResult; -} -/** - * A Fallback Provider. - * - */ -export class FallbackProvider extends AbstractProvider { - quorum; - eventQuorum; - eventWorkers; - #configs; - #height; - #initialSyncPromise; - constructor(providers, network) { - super(network); - this.#configs = providers.map((p) => { - if (p instanceof AbstractProvider) { - return Object.assign({ provider: p }, defaultConfig, defaultState); - } - else { - return Object.assign({}, defaultConfig, p, defaultState); - } - }); - this.#height = -2; - this.#initialSyncPromise = null; - this.quorum = 2; //Math.ceil(providers.length / 2); - this.eventQuorum = 1; - this.eventWorkers = 1; - assertArgument(this.quorum <= this.#configs.reduce((a, c) => a + c.weight, 0), "quorum exceed provider wieght", "quorum", this.quorum); - } - get providerConfigs() { - return this.#configs.map((c) => { - const result = Object.assign({}, c); - for (const key in result) { - if (key[0] === "_") { - delete result[key]; - } - } - return result; - }); - } - async _detectNetwork() { - return Network.from(getBigInt(await this._perform({ method: "networkId" }))); - } - // @TODO: Add support to select providers to be the event subscriber - //_getSubscriber(sub: Subscription): Subscriber { - // throw new Error("@TODO"); - //} - async _translatePerform(provider, req) { - switch (req.method) { - case "broadcastTransaction": - return await provider.broadcastTransaction(req.signedTransaction); - case "call": - return await provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag })); - case "networkId": - return (await provider.getNetwork()).networkId; - case "estimateEnergy": - return await provider.estimateEnergy(req.transaction); - case "getBalance": - return await provider.getBalance(req.address, req.blockTag); - case "getBlock": { - const block = "blockHash" in req ? req.blockHash : req.blockTag; - return await provider.getBlock(block, req.includeTransactions); - } - case "getBlockNumber": - return await provider.getBlockNumber(); - case "getCode": - return await provider.getCode(req.address, req.blockTag); - case "getEnergyPrice": - return (await provider.getFeeData()).energyPrice; - case "getLogs": - return await provider.getLogs(req.filter); - case "getStorage": - return await provider.getStorage(req.address, req.position, req.blockTag); - case "getTransaction": - return await provider.getTransaction(req.hash); - case "getTransactionCount": - return await provider.getTransactionCount(req.address, req.blockTag); - case "getTransactionReceipt": - return await provider.getTransactionReceipt(req.hash); - case "getTransactionResult": - return await provider.getTransactionResult(req.hash); - } - } - // Grab the next (random) config that is not already part of - // the running set - #getNextConfig(running) { - // @TODO: Maybe do a check here to favour (heavily) providers that - // do not require waitForSync and disfavour providers that - // seem down-ish or are behaving slowly - const configs = Array.from(running).map((r) => r.config); - // Shuffle the states, sorted by priority - const allConfigs = this.#configs.slice(); - shuffle(allConfigs); - allConfigs.sort((a, b) => b.priority - a.priority); - for (const config of allConfigs) { - if (configs.indexOf(config) === -1) { - return config; - } - } - return null; - } - // Adds a new runner (if available) to running. - #addRunner(running, req) { - const config = this.#getNextConfig(running); - // No runners available - if (config == null) { - return null; - } - // Create a new runner - const runner = { - config, - result: null, - didBump: false, - perform: null, - staller: null, - }; - const now = getTime(); - // Start performing this operation - runner.perform = (async () => { - try { - config.requests++; - const result = await this._translatePerform(config.provider, req); - runner.result = { result }; - } - catch (error) { - config.errorResponses++; - runner.result = { error }; - } - const dt = getTime() - now; - config._totalTime += dt; - config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt; - runner.perform = null; - })(); - // Start a staller; when this times out, it's time to force - // kicking off another runner because we are taking too long - runner.staller = (async () => { - await stall(config.stallTimeout); - runner.staller = null; - })(); - running.add(runner); - return runner; - } - // Initializes the blockNumber and network for each runner and - // blocks until initialized - async #initialSync() { - let initialSync = this.#initialSyncPromise; - if (!initialSync) { - const promises = []; - this.#configs.forEach((config) => { - promises.push(waitForSync(config, 0)); - promises.push((async () => { - config._network = await config.provider.getNetwork(); - })()); - }); - this.#initialSyncPromise = initialSync = (async () => { - // Wait for all providers to have a block number and network - await Promise.all(promises); - // Check all the networks match - let networkId = null; - for (const config of this.#configs) { - const network = config._network; - if (networkId == null) { - networkId = network.networkId; - } - else if (network.networkId !== networkId) { - assert(false, "cannot mix providers on different networks", "UNSUPPORTED_OPERATION", { - operation: "new FallbackProvider", - }); - } - } - })(); - } - await initialSync; - } - async #checkQuorum(running, req) { - // Get all the result objects - const results = []; - for (const runner of running) { - if (runner.result != null) { - const { tag, value } = normalizeResult(runner.result); - results.push({ tag, value, weight: runner.config.weight }); - } - } - // Are there enough results to event meet quorum? - if (results.reduce((a, r) => a + r.weight, 0) < this.quorum) { - return undefined; - } - switch (req.method) { - case "getBlockNumber": { - // We need to get the bootstrap block height - if (this.#height === -2) { - this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.map((c) => ({ - value: c.blockNumber, - tag: getNumber(c.blockNumber).toString(), - weight: c.weight, - }))))); - } - // Find the mode across all the providers, allowing for - // a little drift between block heights - const mode = getFuzzyMode(this.quorum, results); - if (mode === undefined) { - return undefined; - } - if (mode > this.#height) { - this.#height = mode; - } - return this.#height; - } - case "getEnergyPrice": - case "estimateEnergy": - return getMedian(this.quorum, results); - case "getBlock": - // Pending blocks are in the mempool and already - // quite untrustworthy; just grab anything - if ("blockTag" in req && req.blockTag === "pending") { - return getAnyResult(this.quorum, results); - } - return checkQuorum(this.quorum, results); - case "call": - case "networkId": - case "getBalance": - case "getTransactionCount": - case "getCode": - case "getStorage": - case "getTransaction": - case "getTransactionReceipt": - case "getLogs": - return checkQuorum(this.quorum, results); - case "broadcastTransaction": - return getAnyResult(this.quorum, results); - } - assert(false, "unsupported method", "UNSUPPORTED_OPERATION", { - operation: `_perform(${stringify(req.method)})`, - }); - } - async #waitForQuorum(running, req) { - if (running.size === 0) { - throw new Error("no runners?!"); - } - // Any promises that are interesting to watch for; an expired stall - // or a successful perform - const interesting = []; - let newRunners = 0; - for (const runner of running) { - // No responses, yet; keep an eye on it - if (runner.perform) { - interesting.push(runner.perform); - } - // Still stalling... - if (runner.staller) { - interesting.push(runner.staller); - continue; - } - // This runner has already triggered another runner - if (runner.didBump) { - continue; - } - // Got a response (result or error) or stalled; kick off another runner - runner.didBump = true; - newRunners++; - } - // Check if we have reached quorum on a result (or error) - const value = await this.#checkQuorum(running, req); - if (value !== undefined) { - if (value instanceof Error) { - throw value; - } - return value; - } - // Add any new runners, because a staller timed out or a result - // or error response came in. - for (let i = 0; i < newRunners; i++) { - this.#addRunner(running, req); - } - // All providers have returned, and we have no result - assert(interesting.length > 0, "quorum not met", "SERVER_ERROR", { - request: "%sub-requests", - info: { - request: req, - results: Array.from(running).map((r) => stringify(r.result)), - }, - }); - // Wait for someone to either complete its perform or stall out - await Promise.race(interesting); - // This is recursive, but at worst case the depth is 2x the - // number of providers (each has a perform and a staller) - return await this.#waitForQuorum(running, req); - } - async _perform(req) { - // Broadcasting a transaction is rare (ish) and already incurs - // a cost on the user, so spamming is safe-ish. Just send it to - // every backend. - if (req.method === "broadcastTransaction") { - const results = await Promise.all(this.#configs.map(async ({ provider, weight }) => { - try { - const result = await provider._perform(req); - return Object.assign(normalizeResult({ result }), { weight }); - } - catch (error) { - return Object.assign(normalizeResult({ error }), { weight }); - } - })); - const result = getAnyResult(this.quorum, results); - assert(result !== undefined, "problem multi-broadcasting", "SERVER_ERROR", { - request: "%sub-requests", - info: { request: req, results: results.map(stringify) }, - }); - if (result instanceof Error) { - throw result; - } - return result; - } - await this.#initialSync(); - // Bootstrap enough runners to meet quorum - const running = new Set(); - for (let i = 0; i < this.quorum; i++) { - this.#addRunner(running, req); - } - const result = await this.#waitForQuorum(running, req); - // Track requests sent to a provider that are still - // outstanding after quorum has been otherwise found - for (const runner of running) { - if (runner.perform && runner.result == null) { - runner.config.lateResponses++; - } - } - return result; - } - async destroy() { - for (const { provider } of this.#configs) { - provider.destroy(); - } - super.destroy(); - } -} -//# sourceMappingURL=provider-fallback.js.map \ No newline at end of file diff --git a/lib.esm/providers/provider-fallback.js.map b/lib.esm/providers/provider-fallback.js.map deleted file mode 100644 index cd73d69c1..000000000 --- a/lib.esm/providers/provider-fallback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-fallback.js","sourceRoot":"","sources":["../../src.ts/providers/provider-fallback.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,SAAS,EACT,SAAS,EACT,MAAM,EACN,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAKvC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAEzB,SAAS,OAAO,CAAU,KAAe;IACvC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QACzC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACrB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;KAChB;AACH,CAAC;AAED,SAAS,KAAK,CAAC,QAAgB;IAC7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,OAAO;IACd,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,SAAS,CAAC,KAAU;IAC3B,OAAO,I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,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;aACxD,CACF,CAAC;YACF,IAAI,MAAM,YAAY,KAAK,EAAE;gBAC3B,MAAM,MAAM,CAAC;aACd;YACD,OAAO,MAAM,CAAC;SACf;QAED,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QAE1B,0CAA0C;QAC1C,MAAM,OAAO,GAAqB,IAAI,GAAG,EAAE,CAAC;QAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;SAC/B;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAEvD,mDAAmD;QACnD,oDAAoD;QACpD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC5B,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE;gBAC3C,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;aAC/B;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,KAAK,MAAM,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,QAAQ,EAAE;YACxC,QAAQ,CAAC,OAAO,EAAE,CAAC;SACpB;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/provider-infura.d.ts b/lib.esm/providers/provider-infura.d.ts deleted file mode 100644 index e09baec46..000000000 --- a/lib.esm/providers/provider-infura.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -/** - * [[link-infura]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Sepolia Testnet (``sepolia``) - * - Arbitrum (``arbitrum``) - * - Arbitrum Goerli Testnet (``arbitrum-goerli``) - * - Optimism (``optimism``) - * - Optimism Goerli Testnet (``optimism-goerli``) - * - Polygon (``matic``) - * - Polygon Mumbai Testnet (``matic-mumbai``) - * - * @_subsection: api/providers/thirdparty:INFURA [providers-infura] - */ -import { FetchRequest } from "../utils/index.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import { WebSocketProvider } from "./provider-websocket.js"; -import type { AbstractProvider } from "./abstract-provider.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -/** - * The **InfuraWebSocketProvider** connects to the [[link-infura]] - * WebSocket end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-infura-signup). - */ -export declare class InfuraWebSocketProvider extends WebSocketProvider implements CommunityResourcable { - /** - * The Project ID for the INFURA connection. - */ - readonly projectId: string; - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - readonly projectSecret: null | string; - /** - * Creates a new **InfuraWebSocketProvider**. - */ - constructor(network?: Networkish, projectId?: string); - isCommunityResource(): boolean; -} -/** - * The **InfuraProvider** connects to the [[link-infura]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-infura-signup). - */ -export declare class InfuraProvider extends JsonRpcProvider implements CommunityResourcable { - /** - * The Project ID for the INFURA connection. - */ - readonly projectId: string; - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - readonly projectSecret: null | string; - /** - * Creates a new **InfuraProvider**. - */ - constructor(_network?: Networkish, projectId?: null | string, projectSecret?: null | string); - _getProvider(networkId: number): AbstractProvider; - isCommunityResource(): boolean; - /** - * Creates a new **InfuraWebSocketProvider**. - */ - static getWebSocketProvider(network?: Networkish, projectId?: string): InfuraWebSocketProvider; - /** - * Returns a prepared request for connecting to %%network%% - * with %%projectId%% and %%projectSecret%%. - */ - static getRequest(network: Network, projectId?: null | string, projectSecret?: null | string): FetchRequest; -} -//# sourceMappingURL=provider-infura.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/provider-infura.d.ts.map b/lib.esm/providers/provider-infura.d.ts.map deleted file mode 100644 index cc3baf59e..000000000 --- a/lib.esm/providers/provider-infura.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-infura.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-infura.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAEL,YAAY,EAGb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA8B/C;;;;;;;;GAQG;AACH,qBAAa,uBACX,SAAQ,iBACR,YAAW,oBAAoB;IAE/B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAG,MAAM,CAAC;IAE5B;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAG,IAAI,GAAG,MAAM,CAAC;IAEvC;;OAEG;gBACS,OAAO,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM;IAoBpD,mBAAmB,IAAI,OAAO;CAG/B;AAED;;;;;;;;GAQG;AACH,qBAAa,cACX,SAAQ,eACR,YAAW,oBAAoB;IAE/B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAG,MAAM,CAAC;IAE5B;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAG,IAAI,GAAG,MAAM,CAAC;IAEvC;;OAEG;gBAED,QAAQ,CAAC,EAAE,UAAU,EACrB,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,EACzB,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM;IAuB/B,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAOjD,mBAAmB,IAAI,OAAO;IAI9B;;OAEG;IACH,MAAM,CAAC,oBAAoB,CACzB,OAAO,CAAC,EAAE,UAAU,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,uBAAuB;IAI1B;;;OAGG;IACH,MAAM,CAAC,UAAU,CACf,OAAO,EAAE,OAAO,EAChB,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,EACzB,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,GAC5B,YAAY;CAyBhB"} \ No newline at end of file diff --git a/lib.esm/providers/provider-infura.js b/lib.esm/providers/provider-infura.js deleted file mode 100644 index 8c697d112..000000000 --- a/lib.esm/providers/provider-infura.js +++ /dev/null @@ -1,167 +0,0 @@ -/** - * [[link-infura]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Sepolia Testnet (``sepolia``) - * - Arbitrum (``arbitrum``) - * - Arbitrum Goerli Testnet (``arbitrum-goerli``) - * - Optimism (``optimism``) - * - Optimism Goerli Testnet (``optimism-goerli``) - * - Polygon (``matic``) - * - Polygon Mumbai Testnet (``matic-mumbai``) - * - * @_subsection: api/providers/thirdparty:INFURA [providers-infura] - */ -import { defineProperties, FetchRequest, assert, assertArgument, } from "../utils/index.js"; -import { showThrottleMessage } from "./community.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import { WebSocketProvider } from "./provider-websocket.js"; -const defaultProjectId = "84842078b09946638c03157f83405213"; -function getHost(name) { - switch (name) { - case "mainnet": - return "mainnet.infura.io"; - case "goerli": - return "goerli.infura.io"; - case "sepolia": - return "sepolia.infura.io"; - case "arbitrum": - return "arbitrum-mainnet.infura.io"; - case "arbitrum-goerli": - return "arbitrum-goerli.infura.io"; - case "matic": - return "polygon-mainnet.infura.io"; - case "matic-mumbai": - return "polygon-mumbai.infura.io"; - case "optimism": - return "optimism-mainnet.infura.io"; - case "optimism-goerli": - return "optimism-goerli.infura.io"; - } - assertArgument(false, "unsupported network", "network", name); -} -/** - * The **InfuraWebSocketProvider** connects to the [[link-infura]] - * WebSocket end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-infura-signup). - */ -export class InfuraWebSocketProvider extends WebSocketProvider { - /** - * The Project ID for the INFURA connection. - */ - projectId; - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - projectSecret; - /** - * Creates a new **InfuraWebSocketProvider**. - */ - constructor(network, projectId) { - const provider = new InfuraProvider(network, projectId); - const req = provider._getConnection(); - assert(!req.credentials, "INFURA WebSocket project secrets unsupported", "UNSUPPORTED_OPERATION", { operation: "InfuraProvider.getWebSocketProvider()" }); - const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); - super(url, network); - defineProperties(this, { - projectId: provider.projectId, - projectSecret: provider.projectSecret, - }); - } - isCommunityResource() { - return this.projectId === defaultProjectId; - } -} -/** - * The **InfuraProvider** connects to the [[link-infura]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-infura-signup). - */ -export class InfuraProvider extends JsonRpcProvider { - /** - * The Project ID for the INFURA connection. - */ - projectId; - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - projectSecret; - /** - * Creates a new **InfuraProvider**. - */ - constructor(_network, projectId, projectSecret) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (projectId == null) { - projectId = defaultProjectId; - } - if (projectSecret == null) { - projectSecret = null; - } - const request = InfuraProvider.getRequest(network, projectId, projectSecret); - super(request, network, { staticNetwork: network }); - defineProperties(this, { projectId, projectSecret }); - } - _getProvider(networkId) { - try { - return new InfuraProvider(networkId, this.projectId, this.projectSecret); - } - catch (error) { } - return super._getProvider(networkId); - } - isCommunityResource() { - return this.projectId === defaultProjectId; - } - /** - * Creates a new **InfuraWebSocketProvider**. - */ - static getWebSocketProvider(network, projectId) { - return new InfuraWebSocketProvider(network, projectId); - } - /** - * Returns a prepared request for connecting to %%network%% - * with %%projectId%% and %%projectSecret%%. - */ - static getRequest(network, projectId, projectSecret) { - if (projectId == null) { - projectId = defaultProjectId; - } - if (projectSecret == null) { - projectSecret = null; - } - const request = new FetchRequest(`https:/\/${getHost(network.name)}/v3/${projectId}`); - request.allowGzip = true; - if (projectSecret) { - request.setCredentials("", projectSecret); - } - if (projectId === defaultProjectId) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("InfuraProvider"); - return true; - }; - } - return request; - } -} -//# sourceMappingURL=provider-infura.js.map \ No newline at end of file diff --git a/lib.esm/providers/provider-infura.js.map b/lib.esm/providers/provider-infura.js.map deleted file mode 100644 index 7e20ecc38..000000000 --- a/lib.esm/providers/provider-infura.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-infura.js","sourceRoot":"","sources":["../../src.ts/providers/provider-infura.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,MAAM,EACN,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAA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,SAAS,KAAK,gBAAgB,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,oBAAoB,CACzB,OAAoB,EACpB,SAAkB;QAElB,OAAO,IAAI,uBAAuB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,UAAU,CACf,OAAgB,EAChB,SAAyB,EACzB,aAA6B;QAE7B,IAAI,SAAS,IAAI,IAAI,EAAE;YACrB,SAAS,GAAG,gBAAgB,CAAC;SAC9B;QACD,IAAI,aAAa,IAAI,IAAI,EAAE;YACzB,aAAa,GAAG,IAAI,CAAC;SACtB;QAED,MAAM,OAAO,GAAG,IAAI,YAAY,CAC9B,YAAY,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,SAAS,EAAE,CACpD,CAAC;QACF,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QACzB,IAAI,aAAa,EAAE;YACjB,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;SAC3C;QAED,IAAI,SAAS,KAAK,gBAAgB,EAAE;YAClC,OAAO,CAAC,SAAS,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACvD,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;gBACtC,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;SACH;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/provider-ipcsocket-browser.d.ts b/lib.esm/providers/provider-ipcsocket-browser.d.ts deleted file mode 100644 index 6aae787dc..000000000 --- a/lib.esm/providers/provider-ipcsocket-browser.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const IpcSocketProvider: undefined; -export { IpcSocketProvider }; -//# sourceMappingURL=provider-ipcsocket-browser.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/provider-ipcsocket-browser.d.ts.map b/lib.esm/providers/provider-ipcsocket-browser.d.ts.map deleted file mode 100644 index e49cd58d3..000000000 --- a/lib.esm/providers/provider-ipcsocket-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ipcsocket-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket-browser.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,iBAAiB,WAAY,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,CAAC"} \ No newline at end of file diff --git a/lib.esm/providers/provider-ipcsocket-browser.js b/lib.esm/providers/provider-ipcsocket-browser.js deleted file mode 100644 index d94074ea4..000000000 --- a/lib.esm/providers/provider-ipcsocket-browser.js +++ /dev/null @@ -1,3 +0,0 @@ -const IpcSocketProvider = undefined; -export { IpcSocketProvider }; -//# sourceMappingURL=provider-ipcsocket-browser.js.map \ No newline at end of file diff --git a/lib.esm/providers/provider-ipcsocket-browser.js.map b/lib.esm/providers/provider-ipcsocket-browser.js.map deleted file mode 100644 index 1df6d95ae..000000000 --- a/lib.esm/providers/provider-ipcsocket-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ipcsocket-browser.js","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket-browser.ts"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,CAAC"} \ No newline at end of file diff --git a/lib.esm/providers/provider-ipcsocket.d.ts b/lib.esm/providers/provider-ipcsocket.d.ts deleted file mode 100644 index a9ee3bfc9..000000000 --- a/lib.esm/providers/provider-ipcsocket.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -import { SocketProvider } from "./provider-socket.js"; -import type { Socket } from "net"; -import type { Networkish } from "./network.js"; -export declare class IpcSocketProvider extends SocketProvider { - #private; - get socket(): Socket; - constructor(path: string, network?: Networkish); - destroy(): void; - _write(message: string): Promise; -} -//# sourceMappingURL=provider-ipcsocket.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/provider-ipcsocket.d.ts.map b/lib.esm/providers/provider-ipcsocket.d.ts.map deleted file mode 100644 index 91d6287d7..000000000 --- a/lib.esm/providers/provider-ipcsocket.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ipcsocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAuB/C,qBAAa,iBAAkB,SAAQ,cAAc;;IAEnD,IAAI,MAAM,IAAI,MAAM,CAEnB;gBAEW,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU;IA8B9C,OAAO,IAAI,IAAI;IAOT,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C"} \ No newline at end of file diff --git a/lib.esm/providers/provider-ipcsocket.js b/lib.esm/providers/provider-ipcsocket.js deleted file mode 100644 index fc2401006..000000000 --- a/lib.esm/providers/provider-ipcsocket.js +++ /dev/null @@ -1,59 +0,0 @@ -import { connect } from "net"; -import { SocketProvider } from "./provider-socket.js"; -// @TODO: Is this sufficient? Is this robust? Will newlines occur between -// all payloads and only between payloads? -function splitBuffer(data) { - const messages = []; - let lastStart = 0; - while (true) { - const nl = data.indexOf(10, lastStart); - if (nl === -1) { - break; - } - messages.push(data.subarray(lastStart, nl).toString().trim()); - lastStart = nl + 1; - } - return { messages, remaining: data.subarray(lastStart) }; -} -export class IpcSocketProvider extends SocketProvider { - #socket; - get socket() { - return this.#socket; - } - constructor(path, network) { - super(network); - this.#socket = connect(path); - this.socket.on("ready", async () => { - try { - await this._start(); - } - catch (error) { - console.log("failed to start IpcSocketProvider", error); - // @TODO: Now what? Restart? - } - }); - let response = Buffer.alloc(0); - this.socket.on("data", (data) => { - response = Buffer.concat([response, data]); - const { messages, remaining } = splitBuffer(response); - messages.forEach((message) => { - this._processMessage(message); - }); - response = remaining; - }); - this.socket.on("end", () => { - this.emit("close"); - this.socket.destroy(); - this.socket.end(); - }); - } - destroy() { - this.socket.destroy(); - this.socket.end(); - super.destroy(); - } - async _write(message) { - this.socket.write(message); - } -} -//# sourceMappingURL=provider-ipcsocket.js.map \ No newline at end of file diff --git a/lib.esm/providers/provider-ipcsocket.js.map b/lib.esm/providers/provider-ipcsocket.js.map deleted file mode 100644 index 8095f3bf5..000000000 --- a/lib.esm/providers/provider-ipcsocket.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ipcsocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAKtD,yEAAyE;AACzE,0CAA0C;AAC1C,SAAS,WAAW,CAAC,IAAY;IAI/B,MAAM,QAAQ,GAAkB,EAAE,CAAC;IAEnC,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,OAAO,IAAI,EAAE;QACX,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;QACvC,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE;YACb,MAAM;SACP;QACD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9D,SAAS,GAAG,EAAE,GAAG,CAAC,CAAC;KACpB;IAED,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;AAC3D,CAAC;AAED,MAAM,OAAO,iBAAkB,SAAQ,cAAc;IACnD,OAAO,CA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C,MAAM,CAAC,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QAElB,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAe;QAC1B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/provider-jsonrpc.d.ts b/lib.esm/providers/provider-jsonrpc.d.ts deleted file mode 100644 index f4dc34d1e..000000000 --- a/lib.esm/providers/provider-jsonrpc.d.ts +++ /dev/null @@ -1,267 +0,0 @@ -/** - * About JSON-RPC... - * - * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] - */ -import { FetchRequest } from "../utils/index.js"; -import { AbstractProvider } from "./abstract-provider.js"; -import { AbstractSigner } from "./abstract-signer.js"; -import { Network } from "./network.js"; -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { PerformActionRequest, Subscriber, Subscription } from "./abstract-provider.js"; -import type { Networkish } from "./network.js"; -import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -import type { Signer } from "./signer.js"; -/** - * A JSON-RPC payload, which are sent to a JSON-RPC server. - */ -export type JsonRpcPayload = { - id: number; - method: string; - params: Array | Record; - jsonrpc: "2.0"; -}; -/** - * A JSON-RPC result, which are returned on success from a JSON-RPC server. - */ -export type JsonRpcResult = { - id: number; - result: any; -}; -/** - * A JSON-RPC error, which are returned on failure from a JSON-RPC server. - */ -export type JsonRpcError = { - id: number; - error: { - code: number; - message?: string; - data?: any; - }; -}; -/** - * When subscribing to the ``"debug"`` event, the [[Listener]] will - * receive this object as the first parameter. - */ -export type DebugEventJsonRpcApiProvider = { - action: "sendRpcPayload"; - payload: JsonRpcPayload | Array; -} | { - action: "receiveRpcResult"; - result: Array; -} | { - action: "receiveRpcError"; - error: Error; -}; -/** - * Options for configuring a [[JsonRpcApiProvider]]. Much of this - * is targetted towards sub-classes, which often will not expose - * any of these options to their consumers. - * - * **``polling``** - use the polling strategy is used immediately - * for events; otherwise, attempt to use filters and fall back onto - * polling (default: ``false``) - * - * **``staticNetwork``** - do not request chain ID on requests to - * validate the underlying chain has not changed (default: ``null``) - * - * This should **ONLY** be used if it is **certain** that the network - * cannot change, such as when using INFURA (since the URL dictates the - * network). If the network is assumed static and it does change, this - * can have tragic consequences. For example, this **CANNOT** be used - * with MetaMask, since the used can select a new network from the - * drop-down at any time. - * - * **``batchStallTime``** - how long (ms) to aggregate requests into a - * single batch. ``0`` indicates batching will only encompass the current - * event loop. If ``batchMaxCount = 1``, this is ignored. (default: ``10``) - * - * **``batchMaxSize``** - target maximum size (bytes) to allow per batch - * request (default: 1Mb) - * - * **``batchMaxCount``** - maximum number of requests to allow in a batch. - * If ``batchMaxCount = 1``, then batching is disabled. (default: ``100``) - */ -export type JsonRpcApiProviderOptions = { - polling?: boolean; - staticNetwork?: null | Network; - batchStallTime?: number; - batchMaxSize?: number; - batchMaxCount?: number; -}; -export interface JsonRpcTransactionRequest { - from?: string; - to?: string; - data?: string; - networkId?: string; - type?: string; - energy?: string; - energyPrice?: string; - nonce?: string; - value?: string; - accessList?: Array<{ - address: string; - storageKeys: Array; - }>; -} -export declare class JsonRpcSigner extends AbstractSigner { - address: string; - constructor(provider: JsonRpcApiProvider, address: string); - connect(provider: null | Provider): Signer; - getAddress(): Promise; - populateTransaction(tx: TransactionRequest): Promise>; - sendUncheckedTransaction(_tx: TransactionRequest): Promise; - sendTransaction(tx: TransactionRequest): Promise; - signTransaction(_tx: TransactionRequest): Promise; - signMessage(_message: string | Uint8Array): Promise; - signTypedData(domain: TypedDataDomain, types: Record>, _value: Record): Promise; - unlock(password: string): Promise; - _legacySignMessage(_message: string | Uint8Array): Promise; -} -/** - * The JsonRpcApiProvider is an abstract class and **MUST** be - * sub-classed. - * - * It provides the base for all JSON-RPC-based Provider interaction. - * - * Sub-classing Notes: - * - a sub-class MUST override _send - * - a sub-class MUST call the `_start()` method once connected - */ -export declare abstract class JsonRpcApiProvider extends AbstractProvider { - #private; - constructor(network?: Networkish, options?: JsonRpcApiProviderOptions); - /** - * Returns the value associated with the option %%key%%. - * - * Sub-classes can use this to inquire about configuration options. - */ - _getOption(key: K): JsonRpcApiProviderOptions[K]; - /** - * Gets the [[Network]] this provider has committed to. On each call, the network - * is detected, and if it has changed, the call will reject. - */ - get _network(): Network; - /** - * Sends a JSON-RPC %%payload%% (or a batch) to the underlying channel. - * - * Sub-classes **MUST** override this. - */ - abstract _send(payload: JsonRpcPayload | Array): Promise>; - /** - * Resolves to the non-normalized value by performing %%req%%. - * - * Sub-classes may override this to modify behavior of actions, - * and should generally call ``super._perform`` as a fallback. - */ - _perform(req: PerformActionRequest): Promise; - /** - * Sub-classes may override this; it detects the *actual* network that - * we are **currently** connected to. - * - * Keep in mind that [[send]] may only be used once [[ready]], otherwise the - * _send primitive must be used instead. - */ - _detectNetwork(): Promise; - /** - * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls - * will be passed to [[_send]] from [[send]]. If it is overridden, then - * ``super._start()`` **MUST** be called. - * - * Calling it multiple times is safe and has no effect. - */ - _start(): void; - /** - * Resolves once the [[_start]] has been called. This can be used in - * sub-classes to defer sending data until the connection has been - * established. - */ - _waitUntilReady(): Promise; - /** - * Return a Subscriber that will manage the %%sub%%. - * - * Sub-classes may override this to modify the behavior of - * subscription management. - */ - _getSubscriber(sub: Subscription): Subscriber; - /** - * Returns true only if the [[_start]] has been called. - */ - get ready(): boolean; - /** - * Returns %%tx%% as a normalized JSON-RPC transaction request, - * which has all values hexlified and any numeric values converted - * to Quantity values. - */ - getRpcTransaction(tx: TransactionRequest): JsonRpcTransactionRequest; - /** - * Returns the request method and arguments required to perform - * %%req%%. - */ - getRpcRequest(req: PerformActionRequest): null | { - method: string; - args: Array; - }; - /** - * Returns an CoreBC-style Error for the given JSON-RPC error - * %%payload%%, coalescing the various strings and error shapes - * that different nodes return, coercing them into a machine-readable - * standardized error. - */ - getRpcError(payload: JsonRpcPayload, _error: JsonRpcError): Error; - /** - * Requests the %%method%% with %%params%% via the JSON-RPC protocol - * over the underlying channel. This can be used to call methods - * on the backend that do not have a high-level API within the Provider - * API. - * - * This method queues requests according to the batch constraints - * in the options, assigns the request a unique ID. - * - * **Do NOT override** this method in sub-classes; instead - * override [[_send]] or force the options values in the - * call to the constructor to modify this method's behavior. - */ - send(method: string, params: Array | Record): Promise; - /** - * Resolves to the [[Signer]] account for %%address%% managed by - * the client. - * - * If the %%address%% is a number, it is used as an index in the - * the accounts from [[listAccounts]]. - * - * This can only be used on clients which manage accounts (such as - * Geth with imported account or MetaMask). - * - * Throws if the account doesn't exist. - */ - getSigner(address?: number | string): Promise; - listAccounts(): Promise>; -} -export declare abstract class JsonRpcApiPollingProvider extends JsonRpcApiProvider { - #private; - constructor(network?: Networkish, options?: JsonRpcApiProviderOptions); - _getSubscriber(sub: Subscription): Subscriber; - /** - * The polling interval (default: 4000 ms) - */ - get pollingInterval(): number; - set pollingInterval(value: number); -} -/** - * The JsonRpcProvider is one of the most common Providers, - * which performs all operations over HTTP (or HTTPS) requests. - * - * Events are processed by polling the backend for the current block - * number; when it advances, all block-base events are then checked - * for updates. - */ -export declare class JsonRpcProvider extends JsonRpcApiPollingProvider { - #private; - constructor(url?: string | FetchRequest, network?: Networkish, options?: JsonRpcApiProviderOptions); - _getConnection(): FetchRequest; - send(method: string, params: Array | Record): Promise; - _send(payload: JsonRpcPayload | Array): Promise>; -} -//# sourceMappingURL=provider-jsonrpc.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/provider-jsonrpc.d.ts.map b/lib.esm/providers/provider-jsonrpc.d.ts.map deleted file mode 100644 index 5e8ed8fa0..000000000 --- a/lib.esm/providers/provider-jsonrpc.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-jsonrpc.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-jsonrp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;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,CAE5B;IACD,IAAI,eAAe,CAAC,KAAK,EAAE,MAAM,EAUhC;CACF;AAED;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,yBAAyB;;gBAI1D,GAAG,CAAC,EAAE,MAAM,GAAG,YAAY,EAC3B,OAAO,CAAC,EAAE,UAAU,EACpB,OAAO,CAAC,EAAE,yBAAyB;IAcrC,cAAc,IAAI,YAAY;IAIxB,IAAI,CACR,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACvC,OAAO,CAAC,GAAG,CAAC;IAST,KAAK,CACT,OAAO,EAAE,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAC9C,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;CAgBjC"} \ No newline at end of file diff --git a/lib.esm/providers/provider-jsonrpc.js b/lib.esm/providers/provider-jsonrpc.js deleted file mode 100644 index e29e1c653..000000000 --- a/lib.esm/providers/provider-jsonrpc.js +++ /dev/null @@ -1,853 +0,0 @@ -/** - * About JSON-RPC... - * - * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] - */ -// @TODO: -// - Add the batching API -import { AbiCoder } from "../abi/index.js"; -import { getAddress } from "../address/index.js"; -import { TypedDataEncoder } from "../hash/index.js"; -import { defineProperties, getBigInt, hexlify, isHexString, toQuantity, toUtf8Bytes, makeError, assert, assertArgument, FetchRequest, resolveProperties, } from "../utils/index.js"; -import { AbstractProvider, UnmanagedSubscriber } from "./abstract-provider.js"; -import { AbstractSigner } from "./abstract-signer.js"; -import { Network } from "./network.js"; -import { FilterIdEventSubscriber, FilterIdPendingSubscriber, } from "./subscriber-filterid.js"; -import { PollingEventSubscriber } from "./subscriber-polling.js"; -import { resolveAddress } from "../address/checks.js"; -const Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g); -//const Methods = "getAddress,then".split(/,/g); -function deepCopy(value) { - if (value == null || Primitive.indexOf(typeof value) >= 0) { - return value; - } - // Keep any Addressable - if (typeof value.getAddress === "function") { - return value; - } - if (Array.isArray(value)) { - return value.map(deepCopy); - } - if (typeof value === "object") { - return Object.keys(value).reduce((accum, key) => { - accum[key] = value[key]; - return accum; - }, {}); - } - throw new Error(`should not happen: ${value} (${typeof value})`); -} -function stall(duration) { - return new Promise((resolve) => { - setTimeout(resolve, duration); - }); -} -function getLowerCase(value) { - if (value) { - return value.toLowerCase(); - } - return value; -} -function isPollable(value) { - return value && typeof value.pollingInterval === "number"; -} -const defaultOptions = { - polling: false, - staticNetwork: null, - batchStallTime: 10, - batchMaxSize: 1 << 20, - batchMaxCount: 100, // 100 requests -}; -// @TODO: Unchecked Signers -export class JsonRpcSigner extends AbstractSigner { - address; - constructor(provider, address) { - super(provider); - address = getAddress(address); - defineProperties(this, { address }); - } - connect(provider) { - assert(false, "cannot reconnect JsonRpcSigner", "UNSUPPORTED_OPERATION", { - operation: "signer.connect", - }); - } - async getAddress() { - return this.address; - } - // JSON-RPC will automatially fill in nonce, etc. so we just check from - async populateTransaction(tx) { - return await this.populateCall(tx); - } - // Returns just the hash of the transaction after sent, which is what - // the bare JSON-RPC API does; - async sendUncheckedTransaction(_tx) { - const tx = deepCopy(_tx); - const promises = []; - // Make sure the from matches the sender - if (tx.from) { - const _from = tx.from; - promises.push((async () => { - const from = await resolveAddress(_from); - assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); - tx.from = from; - })()); - } - else { - tx.from = this.address; - } - // The JSON-RPC for xcb_sendTransaction uses 90000 energy; if the user - // wishes to use this, it is easy to specify explicitly, otherwise - // we look it up for them. - if (tx.energyLimit == null) { - promises.push((async () => { - tx.energyLimit = await this.provider.estimateEnergy({ - ...tx, - from: this.address, - }); - })()); - } - // The address may be an ENS name or Addressable - if (tx.to != null) { - const _to = tx.to; - promises.push((async () => { - tx.to = await resolveAddress(_to); - })()); - } - // Wait until all of our properties are filled in - if (promises.length) { - await Promise.all(promises); - } - const hexTx = this.provider.getRpcTransaction(tx); - return this.provider.send("xcb_sendTransaction", [hexTx]); - } - async sendTransaction(tx) { - // This cannot be mined any earlier than any recent block - const blockNumber = await this.provider.getBlockNumber(); - // Send the transaction - const hash = await this.sendUncheckedTransaction(tx); - // Unfortunately, JSON-RPC only provides and opaque transaction hash - // for a response, and we need the actual transaction, so we poll - // for it; it should show up very quickly - return await new Promise((resolve, reject) => { - const timeouts = [1000, 100]; - const checkTx = async () => { - // Try getting the transaction - const tx = await this.provider.getTransaction(hash); - if (tx != null) { - resolve(tx.replaceableTransaction(blockNumber)); - return; - } - // Wait another 4 seconds - this.provider._setTimeout(() => { - checkTx(); - }, timeouts.pop() || 4000); - }; - checkTx(); - }); - } - async signTransaction(_tx) { - const tx = deepCopy(_tx); - // Make sure the from matches the sender - if (tx.from) { - const from = await resolveAddress(tx.from); - assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); - tx.from = from; - } - else { - tx.from = this.address; - } - const hexTx = this.provider.getRpcTransaction(tx); - return await this.provider.send("xcb_signTransaction", [hexTx]); - } - async signMessage(_message) { - const message = typeof _message === "string" ? toUtf8Bytes(_message) : _message; - return await this.provider.send("personal_sign", [ - hexlify(message), - this.address.toLowerCase(), - ]); - } - async signTypedData(domain, types, _value) { - const value = deepCopy(_value); - // Populate any ENS names (in-place) - const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (value) => { - const address = await resolveAddress(value); - assertArgument(address != null, "TypedData does not support null address", "value", value); - return address; - }); - return await this.provider.send("xcb_signTypedData_v4", [ - this.address.toLowerCase(), - JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value)), - ]); - } - async unlock(password) { - return this.provider.send("personal_unlockAccount", [ - this.address.toLowerCase(), - password, - null, - ]); - } - async _legacySignMessage(_message) { - const message = typeof _message === "string" ? toUtf8Bytes(_message) : _message; - return await this.provider.send("xcb_sign", [ - this.address.toLowerCase(), - hexlify(message), - ]); - } -} -/** - * The JsonRpcApiProvider is an abstract class and **MUST** be - * sub-classed. - * - * It provides the base for all JSON-RPC-based Provider interaction. - * - * Sub-classing Notes: - * - a sub-class MUST override _send - * - a sub-class MUST call the `_start()` method once connected - */ -export class JsonRpcApiProvider extends AbstractProvider { - #options; - // The next ID to use for the JSON-RPC ID field - #nextId; - // Payloads are queued and triggered in batches using the drainTimer - #payloads; - #drainTimer; - #notReady; - #network; - #scheduleDrain() { - if (this.#drainTimer) { - return; - } - // If we aren't using batching, no hard in sending it immeidately - const stallTime = this._getOption("batchMaxCount") === 1 - ? 0 - : this._getOption("batchStallTime"); - this.#drainTimer = setTimeout(() => { - this.#drainTimer = null; - const payloads = this.#payloads; - this.#payloads = []; - while (payloads.length) { - // Create payload batches that satisfy our batch constraints - const batch = [payloads.shift()]; - while (payloads.length) { - if (batch.length === this.#options.batchMaxCount) { - break; - } - batch.push(payloads.shift()); - const bytes = JSON.stringify(batch.map((p) => p.payload)); - if (bytes.length > this.#options.batchMaxSize) { - payloads.unshift(batch.pop()); - break; - } - } - // Process the result to each payload - (async () => { - const payload = batch.length === 1 ? batch[0].payload : batch.map((p) => p.payload); - this.emit("debug", { action: "sendRpcPayload", payload }); - try { - // console.log({payload}) - const result = await this._send(payload); - // console.log({result}) - this.emit("debug", { action: "receiveRpcResult", result }); - // Process results in batch order - for (const { resolve, reject, payload } of batch) { - // Find the matching result - const resp = result.filter((r) => r.id === payload.id)[0]; - // No result; the node failed us in unexpected ways - if (resp == null) { - return reject(makeError("no response from server", "BAD_DATA", { - value: result, - info: { payload }, - })); - } - // The response is an error - if ("error" in resp) { - return reject(this.getRpcError(payload, resp)); - } - // All good; send the result - resolve(resp.result); - } - } - catch (error) { - this.emit("debug", { action: "receiveRpcError", error }); - for (const { reject } of batch) { - // @TODO: augment the error with the payload - reject(error); - } - } - })(); - } - }, stallTime); - } - constructor(network, options) { - super(network); - this.#nextId = 1; - this.#options = Object.assign({}, defaultOptions, options || {}); - this.#payloads = []; - this.#drainTimer = null; - this.#network = null; - { - let resolve = null; - const promise = new Promise((_resolve) => { - resolve = _resolve; - }); - this.#notReady = { promise, resolve }; - } - // Make sure any static network is compatbile with the provided netwrok - const staticNetwork = this._getOption("staticNetwork"); - if (staticNetwork) { - assertArgument(network == null || staticNetwork.matches(network), "staticNetwork MUST match network object", "options", options); - this.#network = staticNetwork; - } - } - /** - * Returns the value associated with the option %%key%%. - * - * Sub-classes can use this to inquire about configuration options. - */ - _getOption(key) { - return this.#options[key]; - } - /** - * Gets the [[Network]] this provider has committed to. On each call, the network - * is detected, and if it has changed, the call will reject. - */ - get _network() { - assert(this.#network, "network is not available yet", "NETWORK_ERROR"); - return this.#network; - } - /* - { - assert(false, "sub-classes must override _send", "UNSUPPORTED_OPERATION", { - operation: "jsonRpcApiProvider._send" - }); - } - */ - /** - * Resolves to the non-normalized value by performing %%req%%. - * - * Sub-classes may override this to modify behavior of actions, - * and should generally call ``super._perform`` as a fallback. - */ - async _perform(req) { - const request = this.getRpcRequest(req); - if (request != null) { - return await this.send(request.method, request.args); - } - return super._perform(req); - } - /** - * Sub-classes may override this; it detects the *actual* network that - * we are **currently** connected to. - * - * Keep in mind that [[send]] may only be used once [[ready]], otherwise the - * _send primitive must be used instead. - */ - async _detectNetwork() { - const network = this._getOption("staticNetwork"); - if (network) { - return network; - } - // If we are ready, use ``send``, which enabled requests to be batched - if (this.ready) { - return Network.from(getBigInt(await this.send("xcb_networkId", []))); - } - // We are not ready yet; use the primitive _send - const payload = { - id: this.#nextId++, - method: "xcb_networkId", - params: [], - jsonrpc: "2.0", - }; - this.emit("debug", { action: "sendRpcPayload", payload }); - let result; - try { - result = (await this._send(payload))[0]; - } - catch (error) { - this.emit("debug", { action: "receiveRpcError", error }); - throw error; - } - this.emit("debug", { action: "receiveRpcResult", result }); - if ("result" in result) { - return Network.from(getBigInt(result.result)); - } - throw this.getRpcError(payload, result); - } - /** - * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls - * will be passed to [[_send]] from [[send]]. If it is overridden, then - * ``super._start()`` **MUST** be called. - * - * Calling it multiple times is safe and has no effect. - */ - _start() { - if (this.#notReady == null || this.#notReady.resolve == null) { - return; - } - this.#notReady.resolve(); - this.#notReady = null; - (async () => { - // Bootstrap the network - while (this.#network == null) { - try { - this.#network = await this._detectNetwork(); - } - catch (error) { - console.log("JsonRpcProvider failed to startup; retry in 1s"); - await stall(1000); - } - } - // Start dispatching requests - this.#scheduleDrain(); - })(); - } - /** - * Resolves once the [[_start]] has been called. This can be used in - * sub-classes to defer sending data until the connection has been - * established. - */ - async _waitUntilReady() { - if (this.#notReady == null) { - return; - } - return await this.#notReady.promise; - } - /** - * Return a Subscriber that will manage the %%sub%%. - * - * Sub-classes may override this to modify the behavior of - * subscription management. - */ - _getSubscriber(sub) { - // Pending Filters aren't availble via polling - if (sub.type === "pending") { - return new FilterIdPendingSubscriber(this); - } - if (sub.type === "event") { - if (this._getOption("polling")) { - return new PollingEventSubscriber(this, sub.filter); - } - return new FilterIdEventSubscriber(this, sub.filter); - } - // Orphaned Logs are handled automatically, by the filter, since - // logs with removed are emitted by it - if (sub.type === "orphan" && sub.filter.orphan === "drop-log") { - return new UnmanagedSubscriber("orphan"); - } - return super._getSubscriber(sub); - } - /** - * Returns true only if the [[_start]] has been called. - */ - get ready() { - return this.#notReady == null; - } - /** - * Returns %%tx%% as a normalized JSON-RPC transaction request, - * which has all values hexlified and any numeric values converted - * to Quantity values. - */ - getRpcTransaction(tx) { - const result = {}; - // JSON-RPC now requires numeric values to be "quantity" values - [ - "networkId", - "energyLimit", - "energyPrice", - "type", - "nonce", - "value", - ].forEach((key) => { - if (tx[key] == null) { - return; - } - let dstKey = key; - if (key === "energyLimit") { - dstKey = "energy"; - } - result[dstKey] = toQuantity(getBigInt(tx[key], `tx.${key}`)); - }); - // Make sure addresses and data are lowercase - ["from", "to", "data"].forEach((key) => { - if (tx[key] == null) { - return; - } - result[key] = hexlify(tx[key]); - }); - return result; - } - /** - * Returns the request method and arguments required to perform - * %%req%%. - */ - getRpcRequest(req) { - switch (req.method) { - case "networkId": - return { method: "xcb_networkId", args: [] }; - case "getBlockNumber": - return { method: "xcb_blockNumber", args: [] }; - case "getEnergyPrice": - return { method: "xcb_energyPrice", args: [] }; - case "getBalance": { - return { - method: "xcb_getBalance", - args: [getLowerCase(req.address), req.blockTag], - }; - } - case "getTransactionCount": - return { - method: "xcb_getTransactionCount", - args: [getLowerCase(req.address), req.blockTag], - }; - case "getCode": - return { - method: "xcb_getCode", - args: [getLowerCase(req.address), req.blockTag], - }; - case "getStorage": - return { - method: "xcb_getStorageAt", - args: [ - getLowerCase(req.address), - "0x" + req.position.toString(16), - req.blockTag, - ], - }; - case "broadcastTransaction": - return { - method: "xcb_sendRawTransaction", - args: [req.signedTransaction], - }; - case "getBlock": - if ("blockTag" in req) { - return { - method: "xcb_getBlockByNumber", - args: [req.blockTag, !!req.includeTransactions], - }; - } - else if ("blockHash" in req) { - return { - method: "xcb_getBlockByHash", - args: [req.blockHash, !!req.includeTransactions], - }; - } - break; - case "getTransaction": - return { - method: "xcb_getTransactionByHash", - args: [req.hash], - }; - case "getTransactionReceipt": - return { - method: "xcb_getTransactionReceipt", - args: [req.hash], - }; - case "call": - return { - method: "xcb_call", - args: [this.getRpcTransaction(req.transaction), req.blockTag], - }; - case "estimateEnergy": { - return { - method: "xcb_estimateEnergy", - args: [this.getRpcTransaction(req.transaction)], - }; - } - case "getLogs": - if (req.filter && req.filter.address != null) { - if (Array.isArray(req.filter.address)) { - req.filter.address = req.filter.address.map(getLowerCase); - } - else { - req.filter.address = getLowerCase(req.filter.address); - } - } - return { method: "xcb_getLogs", args: [req.filter] }; - } - return null; - } - /** - * Returns an CoreBC-style Error for the given JSON-RPC error - * %%payload%%, coalescing the various strings and error shapes - * that different nodes return, coercing them into a machine-readable - * standardized error. - */ - getRpcError(payload, _error) { - const { method } = payload; - const { error } = _error; - if (method === "xcb_estimateEnergy" && error.message) { - const msg = error.message; - if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) { - return makeError("insufficient funds", "INSUFFICIENT_FUNDS", { - transaction: payload.params[0], - info: { payload, error }, - }); - } - } - if (method === "xcb_call" || method === "xcb_estimateEnergy") { - const result = spelunkData(error); - const e = AbiCoder.getBuiltinCallException(method === "xcb_call" ? "call" : "estimateEnergy", payload.params[0], result ? result.data : null); - e.info = { error, payload }; - return e; - } - // Only estimateEnergy and call can return arbitrary contract-defined text, so now we - // we can process text safely. - const message = JSON.stringify(spelunkMessage(error)); - if (typeof error.message === "string" && - error.message.match(/user denied|corebc-user-denied/i)) { - const actionMap = { - xcb_sign: "signMessage", - personal_sign: "signMessage", - xcb_signTypedData_v4: "signTypedData", - xcb_signTransaction: "signTransaction", - xcb_sendTransaction: "sendTransaction", - xcb_requestAccounts: "requestAccess", - wallet_requestAccounts: "requestAccess", - }; - return makeError(`user rejected action`, "ACTION_REJECTED", { - action: actionMap[method] || "unknown", - reason: "rejected", - info: { payload, error }, - }); - } - if (method === "xcb_sendRawTransaction" || - method === "xcb_sendTransaction") { - const transaction = payload.params[0]; - if (message.match(/insufficient funds|base fee exceeds energy limit/i)) { - return makeError("insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { - transaction, - info: { error }, - }); - } - if (message.match(/nonce/i) && message.match(/too low/i)) { - return makeError("nonce has already been used", "NONCE_EXPIRED", { - transaction, - info: { error }, - }); - } - // "replacement transaction underpriced" - if (message.match(/replacement transaction/i) && - message.match(/underpriced/i)) { - return makeError("replacement fee too low", "REPLACEMENT_UNDERPRICED", { - transaction, - info: { error }, - }); - } - if (message.match(/only replay-protected/i)) { - return makeError("legacy pre-eip-155 transactions not supported", "UNSUPPORTED_OPERATION", { - operation: method, - info: { transaction, info: { error } }, - }); - } - } - if (message.match(/the method .* does not exist/i)) { - return makeError("unsupported operation", "UNSUPPORTED_OPERATION", { - operation: payload.method, - info: { error }, - }); - } - return makeError("could not coalesce error", "UNKNOWN_ERROR", { error }); - } - /** - * Requests the %%method%% with %%params%% via the JSON-RPC protocol - * over the underlying channel. This can be used to call methods - * on the backend that do not have a high-level API within the Provider - * API. - * - * This method queues requests according to the batch constraints - * in the options, assigns the request a unique ID. - * - * **Do NOT override** this method in sub-classes; instead - * override [[_send]] or force the options values in the - * call to the constructor to modify this method's behavior. - */ - send(method, params) { - // @TODO: cache networkId?? purge on switch_networks - const id = this.#nextId++; - const promise = new Promise((resolve, reject) => { - this.#payloads.push({ - resolve, - reject, - payload: { method, params, id, jsonrpc: "2.0" }, - }); - }); - // If there is not a pending drainTimer, set one - this.#scheduleDrain(); - return promise; - } - /** - * Resolves to the [[Signer]] account for %%address%% managed by - * the client. - * - * If the %%address%% is a number, it is used as an index in the - * the accounts from [[listAccounts]]. - * - * This can only be used on clients which manage accounts (such as - * Geth with imported account or MetaMask). - * - * Throws if the account doesn't exist. - */ - async getSigner(address) { - if (address == null) { - address = 0; - } - const accountsPromise = this.send("xcb_accounts", []); - // Account index - if (typeof address === "number") { - const accounts = await accountsPromise; - if (address >= accounts.length) { - throw new Error("no such account"); - } - return new JsonRpcSigner(this, accounts[address]); - } - const { accounts } = await resolveProperties({ - network: this.getNetwork(), - accounts: accountsPromise, - }); - // Account address - address = getAddress(address); - for (const account of accounts) { - if (getAddress(account) === address) { - return new JsonRpcSigner(this, address); - } - } - throw new Error("invalid account"); - } - async listAccounts() { - const accounts = await this.send("xcb_accounts", []); - return accounts.map((a) => new JsonRpcSigner(this, a)); - } -} -export class JsonRpcApiPollingProvider extends JsonRpcApiProvider { - #pollingInterval; - constructor(network, options) { - super(network, options); - this.#pollingInterval = 4000; - } - _getSubscriber(sub) { - const subscriber = super._getSubscriber(sub); - if (isPollable(subscriber)) { - subscriber.pollingInterval = this.#pollingInterval; - } - return subscriber; - } - /** - * The polling interval (default: 4000 ms) - */ - get pollingInterval() { - return this.#pollingInterval; - } - set pollingInterval(value) { - if (!Number.isInteger(value) || value < 0) { - throw new Error("invalid interval"); - } - this.#pollingInterval = value; - this._forEachSubscriber((sub) => { - if (isPollable(sub)) { - sub.pollingInterval = this.#pollingInterval; - } - }); - } -} -/** - * The JsonRpcProvider is one of the most common Providers, - * which performs all operations over HTTP (or HTTPS) requests. - * - * Events are processed by polling the backend for the current block - * number; when it advances, all block-base events are then checked - * for updates. - */ -export class JsonRpcProvider extends JsonRpcApiPollingProvider { - #connect; - constructor(url, network, options) { - if (url == null) { - url = "http://localhost:8545"; - } - super(network, options); - if (typeof url === "string") { - this.#connect = new FetchRequest(url); - } - else { - this.#connect = url.clone(); - } - } - _getConnection() { - return this.#connect.clone(); - } - async send(method, params) { - // All requests are over HTTP, so we can just start handling requests - // We do this here rather than the constructor so that we don't send any - // requests to the network (i.e. xcb_networkId) until we absolutely have to. - await this._start(); - return await super.send(method, params); - } - async _send(payload) { - // Configure a POST connection for the requested method - const request = this._getConnection(); - request.body = JSON.stringify(payload); - request.setHeader("content-type", "application/json"); - const response = await request.send(); - response.assertOk(); - let resp = response.bodyJson; - if (!Array.isArray(resp)) { - resp = [resp]; - } - return resp; - } -} -function spelunkData(value) { - if (value == null) { - return null; - } - // These *are* the droids we're looking for. - if (typeof value.message === "string" && - value.message.match("reverted") && - isHexString(value.data)) { - return { message: value.message, data: value.data }; - } - // Spelunk further... - if (typeof value === "object") { - for (const key in value) { - const result = spelunkData(value[key]); - if (result) { - return result; - } - } - return null; - } - // Might be a JSON string we can further descend... - if (typeof value === "string") { - try { - return spelunkData(JSON.parse(value)); - } - catch (error) { } - } - return null; -} -function _spelunkMessage(value, result) { - if (value == null) { - return; - } - // These *are* the droids we're looking for. - if (typeof value.message === "string") { - result.push(value.message); - } - // Spelunk further... - if (typeof value === "object") { - for (const key in value) { - _spelunkMessage(value[key], result); - } - } - // Might be a JSON string we can further descend... - if (typeof value === "string") { - try { - return _spelunkMessage(JSON.parse(value), result); - } - catch (error) { } - } -} -function spelunkMessage(value) { - const result = []; - _spelunkMessage(value, result); - return result; -} -//# sourceMappingURL=provider-jsonrpc.js.map \ No newline at end of file diff --git a/lib.esm/providers/provider-jsonrpc.js.map b/lib.esm/providers/provider-jsonrpc.js.map deleted file mode 100644 index 41365ec80..000000000 --- a/lib.esm/providers/provider-jsonrpc.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-jsonrpc.js","sourceRoot":"","sources":["../../src.ts/providers/provider-jsonrpc.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,SAAS;AACT,yBAAyB;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,OAAO,EACP,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,EACT,MAAM,EACN,cAAc,EACd,YAAY,EACZ,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAiBjE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAItD,MAAM,SAAS,GAAG,8CAA8C,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC7E,gDAAgD;AAChD,SAAS,QAAQ,CAAU,KAAQ;IACjC,IAAI,KAAK,IAAI,IAAI,IAAI,SAAS,CAAC,OAAO,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE;QACzD,OAAO,KAAK,CAAC;KACd;IAED,uBAAuB;IACvB,IAAI,OAAa,KAA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,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;YACvC,IAAI,MAAM,EAAE;gBACV,OAAO,MAAM,CAAC;aACf;SACF;QACD,OAAO,IAAI,CAAC;KACb;IAED,mDAAmD;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,IAAI;YACF,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;SACvC;QAAC,OAAO,KAAK,EAAE,GAAE;KACnB;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,eAAe,CAAC,KAAU,EAAE,MAAqB;IACxD,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO;KACR;IAED,4CAA4C;IAC5C,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE;QACrC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC5B;IAED,qBAAqB;IACrB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;YACvB,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;SACrC;KACF;IAED,mDAAmD;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,IAAI;YACF,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;SACnD;QAAC,OAAO,KAAK,EAAE,GAAE;KACnB;AACH,CAAC;AAED,SAAS,cAAc,CAAC,KAAU;IAChC,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/lib.esm/providers/provider-pocket.d.ts b/lib.esm/providers/provider-pocket.d.ts deleted file mode 100644 index 01b2fd311..000000000 --- a/lib.esm/providers/provider-pocket.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * [[link-pocket]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Polygon (``matic``) - * - Arbitrum (``arbitrum``) - * - * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] - */ -import { FetchRequest } from "../utils/index.js"; -import { AbstractProvider } from "./abstract-provider.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -/** - * The **PocketProvider** connects to the [[link-pocket]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-pocket-signup). - */ -export declare class PocketProvider extends JsonRpcProvider implements CommunityResourcable { - /** - * The Application ID for the Pocket connection. - */ - readonly applicationId: string; - /** - * The Application Secret for making authenticated requests - * to the Pocket connection. - */ - readonly applicationSecret: null | string; - /** - * Create a new **PocketProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network?: Networkish, applicationId?: null | string, applicationSecret?: null | string); - _getProvider(networkId: number): AbstractProvider; - /** - * Returns a prepared request for connecting to %%network%% with - * %%applicationId%%. - */ - static getRequest(network: Network, applicationId?: null | string, applicationSecret?: null | string): FetchRequest; - isCommunityResource(): boolean; -} -//# sourceMappingURL=provider-pocket.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/provider-pocket.d.ts.map b/lib.esm/providers/provider-pocket.d.ts.map deleted file mode 100644 index fc500ed76..000000000 --- a/lib.esm/providers/provider-pocket.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-pocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-pocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAoB/C;;;;;;;;GAQG;AACH,qBAAa,cACX,SAAQ,eACR,YAAW,oBAAoB;IAE/B;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAG,MAAM,CAAC;IAEhC;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAG,IAAI,GAAG,MAAM,CAAC;IAE3C;;;;;OAKG;gBAED,QAAQ,CAAC,EAAE,UAAU,EACrB,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,EAC7B,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM;IA4BnC,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAWjD;;;OAGG;IACH,MAAM,CAAC,UAAU,CACf,OAAO,EAAE,OAAO,EAChB,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,EAC7B,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM,GAChC,YAAY;IAwBf,mBAAmB,IAAI,OAAO;CAG/B"} \ No newline at end of file diff --git a/lib.esm/providers/provider-pocket.js b/lib.esm/providers/provider-pocket.js deleted file mode 100644 index 5f4d5cd44..000000000 --- a/lib.esm/providers/provider-pocket.js +++ /dev/null @@ -1,108 +0,0 @@ -/** - * [[link-pocket]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Polygon (``matic``) - * - Arbitrum (``arbitrum``) - * - * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] - */ -import { defineProperties, FetchRequest, assertArgument, } from "../utils/index.js"; -import { showThrottleMessage } from "./community.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -const defaultApplicationId = "62e1ad51b37b8e00394bda3b"; -function getHost(name) { - switch (name) { - case "mainnet": - return "eth-mainnet.gateway.pokt.network"; - case "goerli": - return "eth-goerli.gateway.pokt.network"; - case "matic": - return "poly-mainnet.gateway.pokt.network"; - case "matic-mumbai": - return "polygon-mumbai-rpc.gateway.pokt.network"; - } - assertArgument(false, "unsupported network", "network", name); -} -/** - * The **PocketProvider** connects to the [[link-pocket]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-pocket-signup). - */ -export class PocketProvider extends JsonRpcProvider { - /** - * The Application ID for the Pocket connection. - */ - applicationId; - /** - * The Application Secret for making authenticated requests - * to the Pocket connection. - */ - applicationSecret; - /** - * Create a new **PocketProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network, applicationId, applicationSecret) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (applicationId == null) { - applicationId = defaultApplicationId; - } - if (applicationSecret == null) { - applicationSecret = null; - } - const options = { staticNetwork: network }; - const request = PocketProvider.getRequest(network, applicationId, applicationSecret); - super(request, network, options); - defineProperties(this, { - applicationId, - applicationSecret, - }); - } - _getProvider(networkId) { - try { - return new PocketProvider(networkId, this.applicationId, this.applicationSecret); - } - catch (error) { } - return super._getProvider(networkId); - } - /** - * Returns a prepared request for connecting to %%network%% with - * %%applicationId%%. - */ - static getRequest(network, applicationId, applicationSecret) { - if (applicationId == null) { - applicationId = defaultApplicationId; - } - const request = new FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`); - request.allowGzip = true; - if (applicationSecret) { - request.setCredentials("", applicationSecret); - } - if (applicationId === defaultApplicationId) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("PocketProvider"); - return true; - }; - } - return request; - } - isCommunityResource() { - return this.applicationId === defaultApplicationId; - } -} -//# sourceMappingURL=provider-pocket.js.map \ No newline at end of file diff --git a/lib.esm/providers/provider-pocket.js.map b/lib.esm/providers/provider-pocket.js.map deleted file mode 100644 index 2212d4b8b..000000000 --- a/lib.esm/providers/provider-pocket.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-pocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-pocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,GACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAKxD,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAExD,SAAS,OAAO,CAAC,IAAY;IAC3B,QAAQ,IAAI,EAAE;QACZ,KAAK,SAAS;YACZ,OAAO,kCAAkC,CAAC;QAC5C,KAAK,QAAQ;YACX,OAAO,iCAAiC,CAAC;QAE3C,KAAK,OAAO;YACV,OAAO,mCAAmC,CAAC;QAC7C,KAAK,cAAc;YACjB,OAAO,yCAAyC,CAAC;KACpD;IAED,cAAc,CAAC,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,cACX,SAAQ,eAAe;IAGvB;;OAEG;IACM,aAAa,CAAU;IAEhC;;;OAGG;IACM,iBAAiB,CAAiB;IAE3C;;;;;OAKG;IACH,YACE,QAAqB,EACrB,aAA6B,EAC7B,iBAAiC;QAEjC,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,SAAS,CAAC;SACtB;QACD,MA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OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACvD,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;gBACtC,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;SACH;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,mBAAmB;QACjB,OAAO,IAAI,CAAC,aAAa,KAAK,oBAAoB,CAAC;IACrD,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/provider-quicknode.d.ts b/lib.esm/providers/provider-quicknode.d.ts deleted file mode 100644 index 610dc234a..000000000 --- a/lib.esm/providers/provider-quicknode.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * [[link-quicknode]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Arbitrum (``arbitrum``) - * - Arbitrum Goerli Testnet (``arbitrum-goerli``) - * - Optimism (``optimism``) - * - Optimism Goerli Testnet (``optimism-goerli``) - * - Polygon (``matic``) - * - Polygon Mumbai Testnet (``matic-mumbai``) - * - * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] - */ -import { FetchRequest } from "../utils/index.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { AbstractProvider } from "./abstract-provider.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -/** - * The **QuickNodeProvider** connects to the [[link-quicknode]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API token is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-quicknode). - */ -export declare class QuickNodeProvider extends JsonRpcProvider implements CommunityResourcable { - /** - * The API token. - */ - readonly token: string; - /** - * Creates a new **QuickNodeProvider**. - */ - constructor(_network?: Networkish, token?: null | string); - _getProvider(networkId: number): AbstractProvider; - isCommunityResource(): boolean; - /** - * Returns a new request prepared for %%network%% and the - * %%token%%. - */ - static getRequest(network: Network, token?: null | string): FetchRequest; -} -//# sourceMappingURL=provider-quicknode.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/provider-quicknode.d.ts.map b/lib.esm/providers/provider-quicknode.d.ts.map deleted file mode 100644 index 8b27f9f9d..000000000 --- a/lib.esm/providers/provider-quicknode.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-quicknode.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-quicknode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAEL,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA0B/C;;;;;;;;GAQG;AACH,qBAAa,iBACX,SAAQ,eACR,YAAW,oBAAoB;IAE/B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAG,MAAM,CAAC;IAExB;;OAEG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM;IAexD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAOjD,mBAAmB,IAAI,OAAO;IAI9B;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;CAoBzE"} \ No newline at end of file diff --git a/lib.esm/providers/provider-quicknode.js b/lib.esm/providers/provider-quicknode.js deleted file mode 100644 index 0adfb3696..000000000 --- a/lib.esm/providers/provider-quicknode.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * [[link-quicknode]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Arbitrum (``arbitrum``) - * - Arbitrum Goerli Testnet (``arbitrum-goerli``) - * - Optimism (``optimism``) - * - Optimism Goerli Testnet (``optimism-goerli``) - * - Polygon (``matic``) - * - Polygon Mumbai Testnet (``matic-mumbai``) - * - * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] - */ -import { defineProperties, FetchRequest, assertArgument, } from "../utils/index.js"; -import { showThrottleMessage } from "./community.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -const defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb"; -function getHost(name) { - switch (name) { - case "mainnet": - return "corebc.quiknode.pro"; - case "arbitrum": - return "corebc.arbitrum-mainnet.quiknode.pro"; - case "arbitrum-goerli": - return "corebc.arbitrum-goerli.quiknode.pro"; - case "matic": - return "corebc.matic.quiknode.pro"; - case "matic-mumbai": - return "corebc.matic-testnet.quiknode.pro"; - case "optimism": - return "corebc.optimism.quiknode.pro"; - case "optimism-goerli": - return "corebc.optimism-goerli.quiknode.pro"; - } - assertArgument(false, "unsupported network", "network", name); -} -/** - * The **QuickNodeProvider** connects to the [[link-quicknode]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API token is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-quicknode). - */ -export class QuickNodeProvider extends JsonRpcProvider { - /** - * The API token. - */ - token; - /** - * Creates a new **QuickNodeProvider**. - */ - constructor(_network, token) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (token == null) { - token = defaultToken; - } - const request = QuickNodeProvider.getRequest(network, token); - super(request, network, { staticNetwork: network }); - defineProperties(this, { token }); - } - _getProvider(networkId) { - try { - return new QuickNodeProvider(networkId, this.token); - } - catch (error) { } - return super._getProvider(networkId); - } - isCommunityResource() { - return this.token === defaultToken; - } - /** - * Returns a new request prepared for %%network%% and the - * %%token%%. - */ - static getRequest(network, token) { - if (token == null) { - token = defaultToken; - } - const request = new FetchRequest(`https:/\/${getHost(network.name)}/${token}`); - request.allowGzip = true; - //if (projectSecret) { request.setCredentials("", projectSecret); } - if (token === defaultToken) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("QuickNodeProvider"); - return true; - }; - } - return request; - } -} -//# sourceMappingURL=provider-quicknode.js.map \ No newline at end of file diff --git a/lib.esm/providers/provider-quicknode.js.map b/lib.esm/providers/provider-quicknode.js.map deleted file mode 100644 index 67dd7e1a5..000000000 --- a/lib.esm/providers/provider-quicknode.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-quicknode.js","sourceRoot":"","sources":["../../src.ts/providers/provider-quicknode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAMxD,MAAM,YAAY,GAAG,0CAA0C,CAAC;AAEhE,SAAS,OAAO,CAAC,IAAY;IAC3B,QAAQ,IAAI,EAAE;QACZ,KAAK,SAAS;YACZ,OAAO,qBAAqB,CAAC;QAE/B,KAAK,UAAU;YACb,OAAO,sCAAsC,CAAC;QAChD,KAAK,iBAAiB;YACpB,OAAO,qCAAqC,CAAC;QAC/C,KAAK,OAAO;YACV,OAAO,2BAA2B,CAAC;QACrC,KAAK,cAAc;YACjB,OAAO,mCAAmC,CAAC;QAC7C,KAAK,UAAU;YACb,OAAO,8BAA8B,CAAC;QACxC,KAAK,iBAAiB;YACpB,OAAO,qCAAqC,CAAC;KAChD;IAED,cAAc,CAAC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;QACzB,mEAAmE;QAEnE,IAAI,KAAK,KAAK,YAAY,EAAE;YAC1B,OAAO,CAAC,SAAS,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACvD,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;gBACzC,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;SACH;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/provider-socket.d.ts b/lib.esm/providers/provider-socket.d.ts deleted file mode 100644 index 7ee5054ce..000000000 --- a/lib.esm/providers/provider-socket.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Generic long-lived socket provider. - * - * Sub-classing notes - * - a sub-class MUST call the `_start()` method once connected - * - a sub-class MUST override the `_write(string)` method - * - a sub-class MUST call `_processMessage(string)` for each message - * - * @_subsection: api/providers/abstract-provider - */ -import { JsonRpcApiProvider } from "./provider-jsonrpc.js"; -import type { Subscriber, Subscription } from "./abstract-provider.js"; -import type { EventFilter } from "./provider.js"; -import type { JsonRpcError, JsonRpcPayload, JsonRpcResult } from "./provider-jsonrpc.js"; -import type { Networkish } from "./network.js"; -export declare class SocketSubscriber implements Subscriber { - #private; - get filter(): Array; - constructor(provider: SocketProvider, filter: Array); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; - _handleMessage(message: any): void; - _emit(provider: SocketProvider, message: any): Promise; -} -export declare class SocketBlockSubscriber extends SocketSubscriber { - constructor(provider: SocketProvider); - _emit(provider: SocketProvider, message: any): Promise; -} -export declare class SocketPendingSubscriber extends SocketSubscriber { - constructor(provider: SocketProvider); - _emit(provider: SocketProvider, message: any): Promise; -} -export declare class SocketEventSubscriber extends SocketSubscriber { - #private; - get logFilter(): EventFilter; - constructor(provider: SocketProvider, filter: EventFilter); - _emit(provider: SocketProvider, message: any): Promise; -} -/** - * SocketProvider... - * - */ -export declare class SocketProvider extends JsonRpcApiProvider { - #private; - constructor(network?: Networkish); - _getSubscriber(sub: Subscription): Subscriber; - _register(filterId: number | string, subscriber: SocketSubscriber): void; - _send(payload: JsonRpcPayload | Array): Promise>; - _processMessage(message: string): Promise; - _write(message: string): Promise; -} -//# sourceMappingURL=provider-socket.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/provider-socket.d.ts.map b/lib.esm/providers/provider-socket.d.ts.map deleted file mode 100644 index bdbc5029a..000000000 --- a/lib.esm/providers/provider-socket.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-socket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU/C,qBAAa,gBAAiB,YAAW,UAAU;;IAIjD,IAAI,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAEvB;gBAOW,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC;IAQxD,KAAK,IAAI,IAAI;IASb,IAAI,IAAI,IAAI;IASZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAUtC,MAAM,IAAI,IAAI;IAId,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI;IAqB5B,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE;AAED,qBAAa,qBAAsB,SAAQ,gBAAgB;gBAC7C,QAAQ,EAAE,cAAc;IAI9B,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE;AAED,qBAAa,uBAAwB,SAAQ,gBAAgB;gBAC/C,QAAQ,EAAE,cAAc;IAI9B,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE;AAED,qBAAa,qBAAsB,SAAQ,gBAAgB;;IAEzD,IAAI,SAAS,IAAI,WAAW,CAE3B;gBAEW,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW;IAKnD,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAMnE;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,kBAAkB;;gBAiBxC,OAAO,CAAC,EAAE,UAAU;IAiBhC,cAAc,CAAC,GAAG,EAAE,YAAY,GAAG,UAAU;IAoB7C,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,gBAAgB,GAAG,IAAI;IAWlE,KAAK,CACT,OAAO,EAAE,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAC9C,OAAO,CAAC,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC,CAAC;IAyCzC,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoC/C,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C"} \ No newline at end of file diff --git a/lib.esm/providers/provider-socket.js b/lib.esm/providers/provider-socket.js deleted file mode 100644 index 5c002948b..000000000 --- a/lib.esm/providers/provider-socket.js +++ /dev/null @@ -1,225 +0,0 @@ -/** - * Generic long-lived socket provider. - * - * Sub-classing notes - * - a sub-class MUST call the `_start()` method once connected - * - a sub-class MUST override the `_write(string)` method - * - a sub-class MUST call `_processMessage(string)` for each message - * - * @_subsection: api/providers/abstract-provider - */ -import { UnmanagedSubscriber } from "./abstract-provider.js"; -import { assert, assertArgument, makeError } from "../utils/index.js"; -import { JsonRpcApiProvider } from "./provider-jsonrpc.js"; -export class SocketSubscriber { - #provider; - #filter; - get filter() { - return JSON.parse(this.#filter); - } - #filterId; - #paused; - #emitPromise; - constructor(provider, filter) { - this.#provider = provider; - this.#filter = JSON.stringify(filter); - this.#filterId = null; - this.#paused = null; - this.#emitPromise = null; - } - start() { - this.#filterId = this.#provider - .send("xcb_subscribe", this.filter) - .then((filterId) => { - this.#provider._register(filterId, this); - return filterId; - }); - } - stop() { - this.#filterId.then((filterId) => { - this.#provider.send("xcb_unsubscribe", [filterId]); - }); - this.#filterId = null; - } - // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs - // and resume - pause(dropWhilePaused) { - assert(dropWhilePaused, "preserve logs while paused not supported by SocketSubscriber yet", "UNSUPPORTED_OPERATION", { operation: "pause(false)" }); - this.#paused = !!dropWhilePaused; - } - resume() { - this.#paused = null; - } - _handleMessage(message) { - if (this.#filterId == null) { - return; - } - if (this.#paused === null) { - let emitPromise = this.#emitPromise; - if (emitPromise == null) { - emitPromise = this._emit(this.#provider, message); - } - else { - emitPromise = emitPromise.then(async () => { - await this._emit(this.#provider, message); - }); - } - this.#emitPromise = emitPromise.then(() => { - if (this.#emitPromise === emitPromise) { - this.#emitPromise = null; - } - }); - } - } - async _emit(provider, message) { - throw new Error("sub-classes must implemente this; _emit"); - } -} -export class SocketBlockSubscriber extends SocketSubscriber { - constructor(provider) { - super(provider, ["newHeads"]); - } - async _emit(provider, message) { - provider.emit("block", parseInt(message.number)); - } -} -export class SocketPendingSubscriber extends SocketSubscriber { - constructor(provider) { - super(provider, ["newPendingTransactions"]); - } - async _emit(provider, message) { - provider.emit("pending", message); - } -} -export class SocketEventSubscriber extends SocketSubscriber { - #logFilter; - get logFilter() { - return JSON.parse(this.#logFilter); - } - constructor(provider, filter) { - super(provider, ["logs", filter]); - this.#logFilter = JSON.stringify(filter); - } - async _emit(provider, message) { - provider.emit(this.logFilter, provider._wrapLog(message, provider._network)); - } -} -/** - * SocketProvider... - * - */ -export class SocketProvider extends JsonRpcApiProvider { - #callbacks; - // Maps each filterId to its subscriber - #subs; - // If any events come in before a subscriber has finished - // registering, queue them - #pending; - constructor(network) { - super(network, { batchMaxCount: 1 }); - this.#callbacks = new Map(); - this.#subs = new Map(); - this.#pending = new Map(); - } - // This value is only valid after _start has been called - /* - get _network(): Network { - if (this.#network == null) { - throw new Error("this shouldn't happen"); - } - return this.#network.clone(); - } - */ - _getSubscriber(sub) { - switch (sub.type) { - case "close": - return new UnmanagedSubscriber("close"); - case "block": - return new SocketBlockSubscriber(this); - case "pending": - return new SocketPendingSubscriber(this); - case "event": - return new SocketEventSubscriber(this, sub.filter); - case "orphan": - // Handled auto-matically within AbstractProvider - // when the log.removed = true - if (sub.filter.orphan === "drop-log") { - return new UnmanagedSubscriber("drop-log"); - } - } - return super._getSubscriber(sub); - } - _register(filterId, subscriber) { - this.#subs.set(filterId, subscriber); - const pending = this.#pending.get(filterId); - if (pending) { - for (const message of pending) { - subscriber._handleMessage(message); - } - this.#pending.delete(filterId); - } - } - async _send(payload) { - // WebSocket provider doesn't accept batches - assertArgument(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload); - // @TODO: stringify payloads here and store to prevent mutations - // Prepare a promise to respond to - const promise = new Promise((resolve, reject) => { - this.#callbacks.set(payload.id, { payload, resolve, reject }); - }); - // Wait until the socket is connected before writing to it - await this._waitUntilReady(); - // Write the request to the socket - await this._write(JSON.stringify(payload)); - return [await promise]; - } - // Sub-classes must call this once they are connected - /* - async _start(): Promise { - if (this.#ready) { return; } - - for (const { payload } of this.#callbacks.values()) { - await this._write(JSON.stringify(payload)); - } - - this.#ready = (async function() { - await super._start(); - })(); - } - */ - // Sub-classes must call this for each message - async _processMessage(message) { - const result = (JSON.parse(message)); - if ("id" in result) { - const callback = this.#callbacks.get(result.id); - if (callback == null) { - this.emit("error", makeError("received result for unknown id", "UNKNOWN_ERROR", { - reasonCode: "UNKNOWN_ID", - result, - })); - return; - } - this.#callbacks.delete(result.id); - callback.resolve(result); - } - else if (result.method === "xcb_subscription") { - const filterId = result.params.subscription; - const subscriber = this.#subs.get(filterId); - if (subscriber) { - subscriber._handleMessage(result.params.result); - } - else { - let pending = this.#pending.get(filterId); - if (pending == null) { - pending = []; - this.#pending.set(filterId, pending); - } - pending.push(result.params.result); - } - } - } - async _write(message) { - throw new Error("sub-classes must override this"); - } -} -//# sourceMappingURL=provider-socket.js.map \ No newline at end of file diff --git a/lib.esm/providers/provider-socket.js.map b/lib.esm/providers/provider-socket.js.map deleted file mode 100644 index 05cc4e35a..000000000 --- a/lib.esm/providers/provider-socket.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-socket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAmB3D,MAAM,OAAO,gBAAgB;IAC3B,SAAS,CAAiB;IAE1B,OAAO,CAAS;IAChB,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,SAAS,CAAkC;IAC3C,OAAO,CAAiB;IAExB,YAAY,CAAuB;IAEnC,YAAY,QAAwB,EAAE,MAAkB;QACtD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,I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AM,CAAC,OAAe;QAC1B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/provider-websocket.d.ts b/lib.esm/providers/provider-websocket.d.ts deleted file mode 100644 index 9938502d0..000000000 --- a/lib.esm/providers/provider-websocket.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { SocketProvider } from "./provider-socket.js"; -import type { Networkish } from "./network.js"; -export interface WebSocketLike { - onopen: null | ((...args: Array) => any); - onmessage: null | ((...args: Array) => any); - onerror: null | ((...args: Array) => any); - readyState: number; - send(payload: any): void; - close(code?: number, reason?: string): void; -} -export type WebSocketCreator = () => WebSocketLike; -export declare class WebSocketProvider extends SocketProvider { - #private; - get websocket(): WebSocketLike; - constructor(url: string | WebSocketLike | WebSocketCreator, network?: Networkish); - _write(message: string): Promise; - destroy(): Promise; -} -//# sourceMappingURL=provider-websocket.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/provider-websocket.d.ts.map b/lib.esm/providers/provider-websocket.d.ts.map deleted file mode 100644 index a60b262ca..000000000 --- a/lib.esm/providers/provider-websocket.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-websocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-websocket.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IAC9C,SAAS,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IACjD,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IAE/C,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,aAAa,CAAC;AAEnD,qBAAa,iBAAkB,SAAQ,cAAc;;IAInD,IAAI,SAAS,IAAI,aAAa,CAK7B;gBAGC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,gBAAgB,EAC9C,OAAO,CAAC,EAAE,UAAU;IA8ChB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAO/B"} \ No newline at end of file diff --git a/lib.esm/providers/provider-websocket.js b/lib.esm/providers/provider-websocket.js deleted file mode 100644 index b984a7416..000000000 --- a/lib.esm/providers/provider-websocket.js +++ /dev/null @@ -1,68 +0,0 @@ -import { WebSocket as _WebSocket } from "./ws.js"; /*-browser*/ -import { SocketProvider } from "./provider-socket.js"; -export class WebSocketProvider extends SocketProvider { - #connect; - #websocket; - get websocket() { - if (this.#websocket == null) { - throw new Error("websocket closed"); - } - return this.#websocket; - } - constructor(url, network) { - super(network); - if (typeof url === "string") { - this.#connect = () => { - return new _WebSocket(url); - }; - this.#websocket = this.#connect(); - } - else if (typeof url === "function") { - this.#connect = url; - this.#websocket = url(); - } - else { - this.#connect = null; - this.#websocket = url; - } - this.websocket.onopen = async () => { - try { - await this._start(); - this.resume(); - } - catch (error) { - console.log("failed to start WebsocketProvider", error); - // @TODO: now what? Attempt reconnect? - } - }; - this.websocket.onmessage = (message) => { - this._processMessage(message.data); - }; - /* - this.websocket.onclose = (event) => { - // @TODO: What event.code should we reconnect on? - const reconnect = false; - if (reconnect) { - this.pause(true); - if (this.#connect) { - this.#websocket = this.#connect(); - this.#websocket.onopen = ... - // @TODO: this requires the super class to rebroadcast; move it there - } - this._reconnect(); - } - }; - */ - } - async _write(message) { - this.websocket.send(message); - } - async destroy() { - if (this.#websocket != null) { - this.#websocket.close(); - this.#websocket = null; - } - super.destroy(); - } -} -//# sourceMappingURL=provider-websocket.js.map \ No newline at end of file diff --git a/lib.esm/providers/provider-websocket.js.map b/lib.esm/providers/provider-websocket.js.map deleted file mode 100644 index 59ba33c17..000000000 --- a/lib.esm/providers/provider-websocket.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-websocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-websocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC,CAAC,YAAY;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAiBtD,MAAM,OAAO,iBAAkB,SAAQ,cAAc;IACnD,QAAQ,CAA0B;IAElC,UAAU,CAAuB;IACjC,IAAI,SAAS;QACX,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;SACrC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,YACE,GAA8C,EAC9C,OAAoB;QAEpB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC3B,IAAI,CAAC,QAAQ,GAAG,GAAG,EAAE;gBACnB,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;YAC7B,CAAC,CAAC;YACF,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;SACnC;aAAM,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;YACpC,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;YACpB,IAAI,CAAC,UAAU,GAAG,GAAG,EAAE,CAAC;SACzB;aAAM;YACL,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;SACvB;QAED,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,KAAK,IAAI,EAAE;YACjC,IAAI;gBACF,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;gBACpB,IAAI,CAAC,MAAM,EAAE,CAAC;aACf;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;gBACxD,sCAAsC;aACvC;QACH,CAAC,CAAC;QAEF,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,CAAC,OAAyB,EAAE,EAAE;YACvD,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC,CAAC;QACF;;;;;;;;;;;;;;MAcF;IACA,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAe;QAC1B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE;YAC3B,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;SACxB;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/provider.d.ts b/lib.esm/providers/provider.d.ts deleted file mode 100644 index 68556f754..000000000 --- a/lib.esm/providers/provider.d.ts +++ /dev/null @@ -1,623 +0,0 @@ -import type { AddressLike, NameResolver } from "../address/index.js"; -import type { BigNumberish, EventEmitterable } from "../utils/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { ContractRunner } from "./contracts.js"; -import type { Network } from "./network.js"; -export type BlockTag = BigNumberish | string; -import { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; -/** - * A **FeeData** wraps all the fee-related values associated with - * the network. - */ -export declare class FeeData { - /** - * The energy price for legacy networks. - */ - readonly energyPrice: null | bigint; - constructor(energyPrice?: null | bigint); - /** - * Returns a JSON-friendly value. - */ - toJSON(): any; -} -export interface TransactionRequest { - type?: null | number; - to?: null | AddressLike; - from?: null | AddressLike; - nonce?: null | number; - energyLimit?: null | BigNumberish; - energyPrice?: null | BigNumberish; - data?: null | string; - value?: null | BigNumberish; - networkId?: null | BigNumberish; - customData?: any; - blockTag?: BlockTag; - enableCcipRead?: boolean; -} -export interface PreparedTransactionRequest { - to?: AddressLike; - from?: AddressLike; - nonce?: number; - energyLimit?: bigint; - energyPrice?: bigint; - data?: string; - value?: bigint; - networkId?: bigint; - customData?: any; - blockTag?: BlockTag; - enableCcipRead?: boolean; -} -export declare function copyRequest(req: TransactionRequest): PreparedTransactionRequest; -/** - * An Interface to indicate a [[Block]] has been included in the - * blockchain. This asserts a Type Guard that necessary properties - * are non-null. - * - * Before a block is included, it is a //pending// block. - */ -export interface MinedBlock extends Block { - readonly number: number; - readonly hash: string; - readonly timestamp: number; - readonly date: Date; - readonly miner: string; -} -/** - * A **Block** represents the data associated with a full block on - * Core. - */ -export declare class Block implements BlockParams, Iterable { - #private; - /** - * The provider connected to the block used to fetch additional details - * if necessary. - */ - readonly provider: Provider; - /** - * The block number, sometimes called the block height. This is a - * sequential number that is one higher than the parent block. - */ - readonly number: number; - /** - * The block hash. - */ - readonly hash: null | string; - /** - * The timestamp for this block, which is the number of seconds since - * epoch that this block was included. - */ - readonly timestamp: number; - /** - * The block hash of the parent block. - */ - readonly parentHash: string; - /** - * The nonce. - * - * On legacy networks, this is the random number inserted which - * permitted the difficulty target to be reached. - */ - readonly nonce: string; - /** - * The difficulty target. - * - * On legacy networks, this is the proof-of-work target required - * for a block to meet the protocol rules to be included. - * - * On modern networks, this is a random number arrived at using - * randao. @TODO: Find links? - */ - readonly difficulty: bigint; - /** - * The total energy limit for this block. - */ - readonly energyLimit: bigint; - /** - * The total energy used in this block. - */ - readonly energyUsed: bigint; - /** - * The miner coinbase address, wihch receives any subsidies for - * including this block. - */ - readonly miner: string; - /** - * Any extra data the validator wished to include. - */ - readonly extraData: string; - /** - * The base fee per energy that all transactions in this block were - * charged. - * - * This adjusts after each block, depending on how congested the network - * is. - */ - readonly baseFeePerEnergy: null | bigint; - /** - * Create a new **Block** object. - * - * This should generally not be necessary as the unless implementing a - * low-level library. - */ - constructor(block: BlockParams, provider: Provider); - /** - * Returns the list of transaction hashes. - */ - get transactions(): ReadonlyArray; - /** - * Returns the complete transactions for blocks which - * prefetched them, by passing ``true`` to %%prefetchTxs%% - * into [[provider_getBlock]]. - */ - get prefetchedTransactions(): Array; - /** - * Returns a JSON-friendly value. - */ - toJSON(): any; - [Symbol.iterator](): Iterator; - /** - * The number of transactions in this block. - */ - get length(): number; - /** - * The [[link-js-date]] this block was included at. - */ - get date(): null | Date; - /** - * Get the transaction at %%indexe%% within this block. - */ - getTransaction(indexOrHash: number | string): Promise; - getPrefetchedTransaction(indexOrHash: number | string): TransactionResponse; - /** - * Has this block been mined. - * - * If true, the block has been typed-gaurded that all mined - * properties are non-null. - */ - isMined(): this is MinedBlock; - /** - * - */ - isLondon(): this is Block & { - baseFeePerEnergy: bigint; - }; - orphanedEvent(): OrphanFilter; -} -export declare class Log implements LogParams { - readonly provider: Provider; - readonly transactionHash: string; - readonly blockHash: string; - readonly blockNumber: number; - readonly removed: boolean; - readonly address: string; - readonly data: string; - readonly topics: ReadonlyArray; - readonly index: number; - readonly transactionIndex: number; - constructor(log: LogParams, provider: Provider); - toJSON(): any; - getBlock(): Promise; - getTransaction(): Promise; - getTransactionReceipt(): Promise; - removedEvent(): OrphanFilter; -} -export declare class TransactionReceipt implements TransactionReceiptParams, Iterable { - #private; - readonly provider: Provider; - readonly to: null | string; - readonly from: string; - readonly contractAddress: null | string; - readonly hash: string; - readonly index: number; - readonly blockHash: string; - readonly blockNumber: number; - readonly logsBloom: string; - readonly energyUsed: bigint; - readonly cumulativeEnergyUsed: bigint; - readonly energyPrice: bigint; - readonly type: number; - readonly status: null | number; - readonly root: null | string; - constructor(tx: TransactionReceiptParams, provider: Provider); - get logs(): ReadonlyArray; - toJSON(): any; - get length(): number; - [Symbol.iterator](): Iterator; - get fee(): bigint; - getBlock(): Promise; - getTransaction(): Promise; - getResult(): Promise; - confirmations(): Promise; - removedEvent(): OrphanFilter; - reorderedEvent(other?: TransactionResponse): OrphanFilter; -} -export interface MinedTransactionResponse extends TransactionResponse { - blockNumber: number; - blockHash: string; - date: Date; -} -export declare class TransactionResponse implements TransactionLike, TransactionResponseParams { - #private; - /** - * The provider this is connected to, which will influence how its - * methods will resolve its async inspection methods. - */ - readonly provider: Provider; - /** - * The block number of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - readonly blockNumber: null | number; - /** - * The blockHash of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - readonly blockHash: null | string; - /** - * The index within the block that this transaction resides at. - */ - readonly index: number; - /** - * The transaction hash. - */ - readonly hash: string; - /** - * The [[link-eip-2718]] transaction envelope type. This is - * ``0`` for legacy transactions types. - */ - readonly type: number; - /** - * The receiver of this transaction. - * - * If ``null``, then the transaction is an initcode transaction. - * This means the result of executing the [[data]] will be deployed - * as a new contract on chain (assuming it does not revert) and the - * address may be computed using [[getCreateAddress]]. - */ - readonly to: null | string; - /** - * The sender of this transaction. It is implicitly computed - * from the transaction pre-image hash (as the digest) and the - * [[signature]] using ecrecover. - */ - readonly from: string; - /** - * The nonce, which is used to prevent replay attacks and offer - * a method to ensure transactions from a given sender are explicitly - * ordered. - * - * When sending a transaction, this must be equal to the number of - * transactions ever sent by [[from]]. - */ - readonly nonce: number; - /** - * The maximum units of energy this transaction can consume. If execution - * exceeds this, the entries transaction is reverted and the sender - * is charged for the full amount, despite not state changes being made. - */ - readonly energyLimit: bigint; - /** - * The energy price can have various values, depending on the network. - * - * In modern networks, for transactions that are included this is - * the //effective energy price// (the fee per energy that was actually - * charged), while for transactions that have not been included yet - * is the [[maxFeePerEnergy]]. - * - * For legacy transactions, or transactions on legacy networks, this - * is the fee that will be charged per unit of energy the transaction - * consumes. - */ - readonly energyPrice: bigint; - /** - * The data. - */ - readonly data: string; - /** - * The value, in ore. Use [[formatXCB]] to format this value - * as xcb. - */ - readonly value: bigint; - /** - * The chain ID. - */ - readonly networkId: bigint; - /** - * The signature. - */ - readonly signature: string; - /** - * Create a new TransactionResponse with %%tx%% parameters - * connected to %%provider%%. - */ - constructor(tx: TransactionResponseParams, provider: Provider); - /** - * Returns a JSON representation of this transaction. - */ - toJSON(): any; - /** - * Resolves to the Block that this transaction was included in. - * - * This will return null if the transaction has not been included yet. - */ - getBlock(): Promise; - /** - * Resolves to this transaction being re-requested from the - * provider. This can be used if you have an unmined transaction - * and wish to get an up-to-date populated instance. - */ - getTransaction(): Promise; - /** - * Resolves once this transaction has been mined and has - * %%confirms%% blocks including it (default: ``1``) with an - * optional %%timeout%%. - * - * This can resolve to ``null`` only if %%confirms%% is ``0`` - * and the transaction has not been mined, otherwise this will - * wait until enough confirmations have completed. - */ - wait(_confirms?: number, _timeout?: number): Promise; - /** - * Returns ``true`` if this transaction has been included. - * - * This is effective only as of the time the TransactionResponse - * was instantiated. To get up-to-date information, use - * [[getTransaction]]. - * - * This provides a Type Guard that this transaction will have - * non-null property values for properties that are null for - * unmined transactions. - */ - isMined(): this is MinedTransactionResponse; - /** - * Returns true if the transaction is a legacy (i.e. ``type == 0``) - * transaction. - * - * This provides a Type Guard that this transaction will have - * the ``null``-ness for hardfork-specific properties set correctly. - */ - isLegacy(): this is TransactionResponse & { - accessList: null; - maxFeePerEnergy: null; - maxPriorityFeePerEnergy: null; - }; - /** - * Returns a filter which can be used to listen for orphan events - * that evict this transaction. - */ - removedEvent(): OrphanFilter; - /** - * Returns a filter which can be used to listen for orphan events - * that re-order this event against %%other%%. - */ - reorderedEvent(other?: TransactionResponse): OrphanFilter; - /** - * Returns a new TransactionResponse instance which has the ability to - * detect (and throw an error) if the transaction is replaced, which - * will begin scanning at %%startBlock%%. - * - * This should generally not be used by developers and is intended - * primarily for internal use. Setting an incorrect %%startBlock%% can - * have devastating performance consequences if used incorrectly. - */ - replaceableTransaction(startBlock: number): TransactionResponse; -} -/** - * An Orphan Filter allows detecting when an orphan block has - * resulted in dropping a block or transaction or has resulted - * in transactions changing order. - * - * Not currently fully supported. - */ -export type OrphanFilter = { - orphan: "drop-block"; - hash: string; - number: number; -} | { - orphan: "drop-transaction"; - tx: { - hash: string; - blockHash: string; - blockNumber: number; - }; - other?: { - hash: string; - blockHash: string; - blockNumber: number; - }; -} | { - orphan: "reorder-transaction"; - tx: { - hash: string; - blockHash: string; - blockNumber: number; - }; - other?: { - hash: string; - blockHash: string; - blockNumber: number; - }; -} | { - orphan: "drop-log"; - log: { - transactionHash: string; - blockHash: string; - blockNumber: number; - address: string; - data: string; - topics: ReadonlyArray; - index: number; - }; -}; -/** - * A **TopicFilter** provides a struture to define bloom-filter - * queries. - * - * Each field that is ``null`` matches **any** value, a field that is - * a ``string`` must match exactly that value and and ``array`` is - * effectively an ``OR``-ed set, where any one of those values must - * match. - */ -export type TopicFilter = Array>; -export interface EventFilter { - address?: AddressLike | Array; - topics?: TopicFilter; -} -export interface Filter extends EventFilter { - fromBlock?: BlockTag; - toBlock?: BlockTag; -} -export interface FilterByBlockHash extends EventFilter { - blockHash?: string; -} -export type ProviderEvent = string | Array> | EventFilter | OrphanFilter; -/** - * A **Provider** is the primary method to interact with the read-only - * content on Core. - * - * It allows access to details about accounts, blocks and transactions - * and the ability to query event logs and simulate contract execution. - * - * Account data includes the [balance](getBalance), - * [transaction count](getTransactionCount), [code](getCode) and - * [state trie storage](getStorage). - * - * Simulating execution can be used to [call](call), - * [estimate energy](estimateEnergy) and - * [get transaction results](getTransactionResult). - * - * The [[broadcastTransaction]] is the only method which allows updating - * the blockchain, but it is usually accessed by a [[Signer]], since a - * private key must be used to sign the transaction before it can be - * broadcast. - */ -export interface Provider extends ContractRunner, EventEmitterable, NameResolver { - /** - * The provider iteself. - * - * This is part of the necessary API for executing a contract, as - * it provides a common property on any [[ContractRunner]] that - * can be used to access the read-only portion of the runner. - */ - provider: this; - /** - * Shutdown any resources this provider is using. No additional - * calls should be made to this provider after calling this. - */ - destroy(): void; - /** - * Get the current block number. - */ - getBlockNumber(): Promise; - /** - * Get the connected [[Network]]. - */ - getNetwork(): Promise; - /** - * Get the best guess at the recommended [[FeeData]]. - */ - getFeeData(): Promise; - /** - * Get the account balance (in ore) of %%address%%. If %%blockTag%% - * is specified and the node supports archive access for that - * %%blockTag%%, the balance is as of that [[BlockTag]]. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getBalance(address: AddressLike, blockTag?: BlockTag): Promise; - /** - * Get the number of transactions ever sent for %%address%%, which - * is used as the ``nonce`` when sending a transaction. If - * %%blockTag%% is specified and the node supports archive access - * for that %%blockTag%%, the transaction count is as of that - * [[BlockTag]]. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise; - /** - * Get the bytecode for %%address%%. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getCode(address: AddressLike, blockTag?: BlockTag): Promise; - /** - * Get the storage slot value for %%address%% at slot %%position%%. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getStorage(address: AddressLike, position: BigNumberish, blockTag?: BlockTag): Promise; - /** - * Estimates the amount of energy required to executre %%tx%%. - */ - estimateEnergy(tx: TransactionRequest): Promise; - /** - * Simulate the execution of %%tx%%. If the call reverts, it will - * throw a [[CallExceptionError]] which includes the revert data. - */ - call(tx: TransactionRequest): Promise; - /** - * Broadcasts the %%signedTx%% to the network, adding it to the - * memory pool of any node for which the transaction meets the - * rebroadcast requirements. - */ - broadcastTransaction(signedTx: string): Promise; - /** - * Resolves to the block for %%blockHashOrBlockTag%%. - * - * If %%prefetchTxs%%, and the backend supports including transactions - * with block requests, all transactions will be included and the - * [[Block]] object will not need to make remote calls for getting - * transactions. - */ - getBlock(blockHashOrBlockTag: BlockTag | string, prefetchTxs?: boolean): Promise; - /** - * Resolves to the transaction for %%hash%%. - * - * If the transaction is unknown or on pruning nodes which - * discard old transactions this resolves to ``null``. - */ - getTransaction(hash: string): Promise; - /** - * Resolves to the transaction receipt for %%hash%%, if mined. - * - * If the transaction has not been mined, is unknown or on - * pruning nodes which discard old transactions this resolves to - * ``null``. - */ - getTransactionReceipt(hash: string): Promise; - /** - * Resolves to the result returned by the executions of %%hash%%. - * - * This is only supported on nodes with archive access and with - * the necessary debug APIs enabled. - */ - getTransactionResult(hash: string): Promise; - /** - * Resolves to the list of Logs that match %%filter%% - */ - getLogs(filter: Filter | FilterByBlockHash): Promise>; - /** - * Resolves to the address configured for the %%ensName%% or - * ``null`` if unconfigured. - */ - /** - * Waits until the transaction %%hash%% is mined and has %%confirms%% - * confirmations. - */ - waitForTransaction(hash: string, confirms?: number, timeout?: number): Promise; - /** - * Resolves to the block at %%blockTag%% once it has been mined. - * - * This can be useful for waiting some number of blocks by using - * the ``currentBlockNumber + N``. - */ - waitForBlock(blockTag?: BlockTag): Promise; -} -//# sourceMappingURL=provider.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/provider.d.ts.map b/lib.esm/providers/provider.d.ts.map deleted file mode 100644 index fdfa52655..000000000 --- a/lib.esm/providers/provider.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC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diff --git a/lib.esm/providers/provider.js b/lib.esm/providers/provider.js deleted file mode 100644 index e475de66c..000000000 --- a/lib.esm/providers/provider.js +++ /dev/null @@ -1,948 +0,0 @@ -import { defineProperties, getBigInt, getNumber, hexlify, resolveProperties, assert, assertArgument, isError, makeError, } from "../utils/index.js"; -const BN_0 = BigInt(0); -// ----------------------- -function getValue(value) { - if (value == null) { - return null; - } - return value; -} -function toJson(value) { - if (value == null) { - return null; - } - return value.toString(); -} -// @TODO? implements Required -/** - * A **FeeData** wraps all the fee-related values associated with - * the network. - */ -export class FeeData { - /** - * The energy price for legacy networks. - */ - energyPrice; - constructor(energyPrice) { - defineProperties(this, { - energyPrice: getValue(energyPrice), - }); - } - /** - * Returns a JSON-friendly value. - */ - toJSON() { - const { energyPrice } = this; - return { - _type: "FeeData", - energyPrice: toJson(energyPrice), - }; - } -} -export function copyRequest(req) { - const result = {}; - // These could be addresses, ENS names or Addressables - if (req.to) { - result.to = req.to; - } - if (req.from) { - result.from = req.from; - } - if (req.data) { - result.data = hexlify(req.data); - } - const bigIntKeys = "networkId,energyLimit,energyPrice,value".split(/,/); - for (const key of bigIntKeys) { - if (!(key in req) || req[key] == null) { - continue; - } - result[key] = getBigInt(req[key], `request.${key}`); - } - const numberKeys = "type,nonce".split(/,/); - for (const key of numberKeys) { - if (!(key in req) || req[key] == null) { - continue; - } - result[key] = getNumber(req[key], `request.${key}`); - } - if ("blockTag" in req) { - result.blockTag = req.blockTag; - } - if ("enableCcipRead" in req) { - result.enableCcipReadEnabled = !!req.enableCcipRead; - } - if ("customData" in req) { - result.customData = req.customData; - } - return result; -} -/** - * A **Block** represents the data associated with a full block on - * Core. - */ -export class Block { - /** - * The provider connected to the block used to fetch additional details - * if necessary. - */ - provider; - /** - * The block number, sometimes called the block height. This is a - * sequential number that is one higher than the parent block. - */ - number; - /** - * The block hash. - */ - hash; - /** - * The timestamp for this block, which is the number of seconds since - * epoch that this block was included. - */ - timestamp; - /** - * The block hash of the parent block. - */ - parentHash; - /** - * The nonce. - * - * On legacy networks, this is the random number inserted which - * permitted the difficulty target to be reached. - */ - nonce; - /** - * The difficulty target. - * - * On legacy networks, this is the proof-of-work target required - * for a block to meet the protocol rules to be included. - * - * On modern networks, this is a random number arrived at using - * randao. @TODO: Find links? - */ - difficulty; - /** - * The total energy limit for this block. - */ - energyLimit; - /** - * The total energy used in this block. - */ - energyUsed; - /** - * The miner coinbase address, wihch receives any subsidies for - * including this block. - */ - miner; - /** - * Any extra data the validator wished to include. - */ - extraData; - /** - * The base fee per energy that all transactions in this block were - * charged. - * - * This adjusts after each block, depending on how congested the network - * is. - */ - baseFeePerEnergy; - #transactions; - /** - * Create a new **Block** object. - * - * This should generally not be necessary as the unless implementing a - * low-level library. - */ - constructor(block, provider) { - this.#transactions = block.transactions.map((tx) => { - if (typeof tx !== "string") { - return new TransactionResponse(tx, provider); - } - return tx; - }); - defineProperties(this, { - provider, - hash: getValue(block.hash), - number: block.number, - timestamp: block.timestamp, - parentHash: block.parentHash, - nonce: block.nonce, - difficulty: block.difficulty, - energyLimit: block.energyLimit, - energyUsed: block.energyUsed, - miner: block.miner, - extraData: block.extraData, - baseFeePerEnergy: getValue(block.baseFeePerEnergy), - }); - } - /** - * Returns the list of transaction hashes. - */ - get transactions() { - return this.#transactions.map((tx) => { - if (typeof tx === "string") { - return tx; - } - return tx.hash; - }); - } - /** - * Returns the complete transactions for blocks which - * prefetched them, by passing ``true`` to %%prefetchTxs%% - * into [[provider_getBlock]]. - */ - get prefetchedTransactions() { - const txs = this.#transactions.slice(); - // Doesn't matter... - if (txs.length === 0) { - return []; - } - // Make sure we prefetched the transactions - assert(typeof txs[0] === "object", "transactions were not prefetched with block request", "UNSUPPORTED_OPERATION", { - operation: "transactionResponses()", - }); - return txs; - } - /** - * Returns a JSON-friendly value. - */ - toJSON() { - const { baseFeePerEnergy, difficulty, extraData, energyLimit, energyUsed, hash, miner, nonce, number, parentHash, timestamp, transactions, } = this; - return { - _type: "Block", - baseFeePerEnergy: toJson(baseFeePerEnergy), - difficulty: toJson(difficulty), - extraData, - energyLimit: toJson(energyLimit), - energyUsed: toJson(energyUsed), - hash, - miner, - nonce, - number, - parentHash, - timestamp, - transactions, - }; - } - [Symbol.iterator]() { - let index = 0; - const txs = this.transactions; - return { - next: () => { - if (index < this.length) { - return { - value: txs[index++], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - /** - * The number of transactions in this block. - */ - get length() { - return this.#transactions.length; - } - /** - * The [[link-js-date]] this block was included at. - */ - get date() { - if (this.timestamp == null) { - return null; - } - return new Date(this.timestamp * 1000); - } - /** - * Get the transaction at %%indexe%% within this block. - */ - async getTransaction(indexOrHash) { - // Find the internal value by its index or hash - let tx = undefined; - if (typeof indexOrHash === "number") { - tx = this.#transactions[indexOrHash]; - } - else { - const hash = indexOrHash.toLowerCase(); - for (const v of this.#transactions) { - if (typeof v === "string") { - if (v !== hash) { - continue; - } - tx = v; - break; - } - else { - if (v.hash === hash) { - continue; - } - tx = v; - break; - } - } - } - if (tx == null) { - throw new Error("no such tx"); - } - if (typeof tx === "string") { - return await this.provider.getTransaction(tx); - } - else { - return tx; - } - } - getPrefetchedTransaction(indexOrHash) { - const txs = this.prefetchedTransactions; - if (typeof indexOrHash === "number") { - return txs[indexOrHash]; - } - indexOrHash = indexOrHash.toLowerCase(); - for (const tx of txs) { - if (tx.hash === indexOrHash) { - return tx; - } - } - assertArgument(false, "no matching transaction", "indexOrHash", indexOrHash); - } - /** - * Has this block been mined. - * - * If true, the block has been typed-gaurded that all mined - * properties are non-null. - */ - isMined() { - return !!this.hash; - } - /** - * - */ - isLondon() { - return !!this.baseFeePerEnergy; - } - orphanedEvent() { - if (!this.isMined()) { - throw new Error(""); - } - return createOrphanedBlockFilter(this); - } -} -////////////////////// -// Log -export class Log { - provider; - transactionHash; - blockHash; - blockNumber; - removed; - address; - data; - topics; - index; - transactionIndex; - constructor(log, provider) { - this.provider = provider; - const topics = Object.freeze(log.topics.slice()); - defineProperties(this, { - transactionHash: log.transactionHash, - blockHash: log.blockHash, - blockNumber: log.blockNumber, - removed: log.removed, - address: log.address, - data: log.data, - topics, - index: log.index, - transactionIndex: log.transactionIndex, - }); - } - toJSON() { - const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex, } = this; - return { - _type: "log", - address, - blockHash, - blockNumber, - data, - index, - removed, - topics, - transactionHash, - transactionIndex, - }; - } - async getBlock() { - const block = await this.provider.getBlock(this.blockHash); - assert(!!block, "failed to find transaction", "UNKNOWN_ERROR", {}); - return block; - } - async getTransaction() { - const tx = await this.provider.getTransaction(this.transactionHash); - assert(!!tx, "failed to find transaction", "UNKNOWN_ERROR", {}); - return tx; - } - async getTransactionReceipt() { - const receipt = await this.provider.getTransactionReceipt(this.transactionHash); - assert(!!receipt, "failed to find transaction receipt", "UNKNOWN_ERROR", {}); - return receipt; - } - removedEvent() { - return createRemovedLogFilter(this); - } -} -////////////////////// -// Transaction Receipt -/* -export interface LegacyTransactionReceipt { - byzantium: false; - status: null; - root: string; -} - -export interface ByzantiumTransactionReceipt { - byzantium: true; - status: number; - root: null; -} -*/ -export class TransactionReceipt { - provider; - to; - from; - contractAddress; - hash; - index; - blockHash; - blockNumber; - logsBloom; - energyUsed; - cumulativeEnergyUsed; - energyPrice; - type; - //readonly byzantium!: boolean; - status; - root; - #logs; - constructor(tx, provider) { - this.#logs = Object.freeze(tx.logs.map((log) => { - return new Log(log, provider); - })); - defineProperties(this, { - provider, - to: tx.to, - from: tx.from, - contractAddress: tx.contractAddress, - hash: tx.hash, - index: tx.index, - blockHash: tx.blockHash, - blockNumber: tx.blockNumber, - logsBloom: tx.logsBloom, - energyUsed: tx.energyUsed, - cumulativeEnergyUsed: tx.cumulativeEnergyUsed, - energyPrice: (tx.effectiveEnergyPrice || tx.energyPrice), - //byzantium: tx.byzantium, - status: tx.status, - root: tx.root, - }); - } - get logs() { - return this.#logs; - } - toJSON() { - const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium, - status, root, } = this; - return { - _type: "TransactionReceipt", - blockHash, - blockNumber, - //byzantium, - contractAddress, - cumulativeEnergyUsed: toJson(this.cumulativeEnergyUsed), - from, - energyPrice: toJson(this.energyPrice), - energyUsed: toJson(this.energyUsed), - hash, - index, - logs, - logsBloom, - root, - status, - to, - }; - } - get length() { - return this.logs.length; - } - [Symbol.iterator]() { - let index = 0; - return { - next: () => { - if (index < this.length) { - return { value: this.logs[index++], done: false }; - } - return { value: undefined, done: true }; - }, - }; - } - get fee() { - return this.energyUsed * this.energyPrice; - } - async getBlock() { - const block = await this.provider.getBlock(this.blockHash); - if (block == null) { - throw new Error("TODO"); - } - return block; - } - async getTransaction() { - const tx = await this.provider.getTransaction(this.hash); - if (tx == null) { - throw new Error("TODO"); - } - return tx; - } - async getResult() { - return await this.provider.getTransactionResult(this.hash); - } - async confirmations() { - return (await this.provider.getBlockNumber()) - this.blockNumber + 1; - } - removedEvent() { - return createRemovedTransactionFilter(this); - } - reorderedEvent(other) { - assert(!other || other.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }); - return createReorderedTransactionFilter(this, other); - } -} -/* -export type ReplacementDetectionSetup = { - to: string; - from: string; - value: bigint; - data: string; - nonce: number; - block: number; -}; -*/ -export class TransactionResponse { - /** - * The provider this is connected to, which will influence how its - * methods will resolve its async inspection methods. - */ - provider; - /** - * The block number of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - blockNumber; - /** - * The blockHash of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - blockHash; - /** - * The index within the block that this transaction resides at. - */ - index; - /** - * The transaction hash. - */ - hash; - /** - * The [[link-eip-2718]] transaction envelope type. This is - * ``0`` for legacy transactions types. - */ - type; - /** - * The receiver of this transaction. - * - * If ``null``, then the transaction is an initcode transaction. - * This means the result of executing the [[data]] will be deployed - * as a new contract on chain (assuming it does not revert) and the - * address may be computed using [[getCreateAddress]]. - */ - to; - /** - * The sender of this transaction. It is implicitly computed - * from the transaction pre-image hash (as the digest) and the - * [[signature]] using ecrecover. - */ - from; - /** - * The nonce, which is used to prevent replay attacks and offer - * a method to ensure transactions from a given sender are explicitly - * ordered. - * - * When sending a transaction, this must be equal to the number of - * transactions ever sent by [[from]]. - */ - nonce; - /** - * The maximum units of energy this transaction can consume. If execution - * exceeds this, the entries transaction is reverted and the sender - * is charged for the full amount, despite not state changes being made. - */ - energyLimit; - /** - * The energy price can have various values, depending on the network. - * - * In modern networks, for transactions that are included this is - * the //effective energy price// (the fee per energy that was actually - * charged), while for transactions that have not been included yet - * is the [[maxFeePerEnergy]]. - * - * For legacy transactions, or transactions on legacy networks, this - * is the fee that will be charged per unit of energy the transaction - * consumes. - */ - energyPrice; - /** - * The data. - */ - data; - /** - * The value, in ore. Use [[formatXCB]] to format this value - * as xcb. - */ - value; - /** - * The chain ID. - */ - networkId; - /** - * The signature. - */ - signature; - #startBlock; - /** - * Create a new TransactionResponse with %%tx%% parameters - * connected to %%provider%%. - */ - constructor(tx, provider) { - this.provider = provider; - this.blockNumber = tx.blockNumber != null ? tx.blockNumber : null; - this.blockHash = tx.blockHash != null ? tx.blockHash : null; - this.hash = tx.hash; - this.index = tx.index; - this.from = tx.from; - this.to = tx.to || null; - this.energyLimit = tx.energyLimit; - this.nonce = tx.nonce; - this.data = tx.data; - this.value = tx.value; - this.energyPrice = tx.energyPrice; - this.networkId = tx.networkId; - this.signature = tx.signature; - this.#startBlock = -1; - } - /** - * Returns a JSON representation of this transaction. - */ - toJSON() { - const { index, hash, type, to, from, nonce, data, signature } = this; - return { - _type: "TransactionReceipt", - networkId: toJson(this.networkId), - data, - from, - energyLimit: toJson(this.energyLimit), - energyPrice: toJson(this.energyPrice), - hash, - nonce, - signature, - to, - index, - type, - value: toJson(this.value), - }; - } - /** - * Resolves to the Block that this transaction was included in. - * - * This will return null if the transaction has not been included yet. - */ - async getBlock() { - let blockNumber = this.blockNumber; - if (blockNumber == null) { - const tx = await this.getTransaction(); - if (tx) { - blockNumber = tx.blockNumber; - } - } - if (blockNumber == null) { - return null; - } - const block = this.provider.getBlock(blockNumber); - if (block == null) { - throw new Error("TODO"); - } - return block; - } - /** - * Resolves to this transaction being re-requested from the - * provider. This can be used if you have an unmined transaction - * and wish to get an up-to-date populated instance. - */ - async getTransaction() { - return this.provider.getTransaction(this.hash); - } - /** - * Resolves once this transaction has been mined and has - * %%confirms%% blocks including it (default: ``1``) with an - * optional %%timeout%%. - * - * This can resolve to ``null`` only if %%confirms%% is ``0`` - * and the transaction has not been mined, otherwise this will - * wait until enough confirmations have completed. - */ - async wait(_confirms, _timeout) { - const confirms = _confirms == null ? 1 : _confirms; - const timeout = _timeout == null ? 0 : _timeout; - let startBlock = this.#startBlock; - let nextScan = -1; - let stopScanning = startBlock === -1 ? true : false; - const checkReplacement = async () => { - // Get the current transaction count for this sender - if (stopScanning) { - return null; - } - const { blockNumber, nonce } = await resolveProperties({ - blockNumber: this.provider.getBlockNumber(), - nonce: this.provider.getTransactionCount(this.from), - }); - // No transaction or our nonce has not been mined yet; but we - // can start scanning later when we do start - if (nonce < this.nonce) { - startBlock = blockNumber; - return; - } - // We were mined; no replacement - if (stopScanning) { - return null; - } - const mined = await this.getTransaction(); - if (mined && mined.blockNumber != null) { - return; - } - // We were replaced; start scanning for that transaction - // Starting to scan; look back a few extra blocks for safety - if (nextScan === -1) { - nextScan = startBlock - 3; - if (nextScan < this.#startBlock) { - nextScan = this.#startBlock; - } - } - while (nextScan <= blockNumber) { - // Get the next block to scan - if (stopScanning) { - return null; - } - const block = await this.provider.getBlock(nextScan, true); - // This should not happen; but we'll try again shortly - if (block == null) { - return; - } - // We were mined; no replacement - for (const hash of block) { - if (hash === this.hash) { - return; - } - } - // Search for the transaction that replaced us - for (let i = 0; i < block.length; i++) { - const tx = await block.getTransaction(i); - if (tx.from === this.from && tx.nonce === this.nonce) { - // Get the receipt - if (stopScanning) { - return null; - } - const receipt = await this.provider.getTransactionReceipt(tx.hash); - // This should not happen; but we'll try again shortly - if (receipt == null) { - return; - } - // We will retry this on the next block (this case could be optimized) - if (blockNumber - receipt.blockNumber + 1 < confirms) { - return; - } - // The reason we were replaced - let reason = "replaced"; - if (tx.data === this.data && - tx.to === this.to && - tx.value === this.value) { - reason = "repriced"; - } - else if (tx.data === "0x" && - tx.from === tx.to && - tx.value === BN_0) { - reason = "cancelled"; - } - assert(false, "transaction was replaced", "TRANSACTION_REPLACED", { - cancelled: reason === "replaced" || reason === "cancelled", - reason, - replacement: tx.replaceableTransaction(startBlock), - hash: tx.hash, - receipt, - }); - } - } - nextScan++; - } - return; - }; - const receipt = await this.provider.getTransactionReceipt(this.hash); - if (receipt) { - if ((await receipt.confirmations()) >= confirms) { - return receipt; - } - } - else { - // Check for a replacement; throws if a replacement was found - await checkReplacement(); - // Allow null only when the confirms is 0 - if (confirms === 0) { - return null; - } - } - const waiter = new Promise((resolve, reject) => { - // List of things to cancel when we have a result (one way or the other) - const cancellers = []; - const cancel = () => { - cancellers.forEach((c) => c()); - }; - // On cancel, stop scanning for replacements - cancellers.push(() => { - stopScanning = true; - }); - // Set up any timeout requested - if (timeout > 0) { - const timer = setTimeout(() => { - cancel(); - reject(makeError("wait for transaction timeout", "TIMEOUT")); - }, timeout); - cancellers.push(() => { - clearTimeout(timer); - }); - } - const txListener = async (receipt) => { - // Done; return it! - if ((await receipt.confirmations()) >= confirms) { - cancel(); - resolve(receipt); - } - }; - cancellers.push(() => { - this.provider.off(this.hash, txListener); - }); - this.provider.on(this.hash, txListener); - // We support replacement detection; start checking - if (startBlock >= 0) { - const replaceListener = async () => { - try { - // Check for a replacement; this throws only if one is found - await checkReplacement(); - } - catch (error) { - // We were replaced (with enough confirms); re-throw the error - if (isError(error, "TRANSACTION_REPLACED")) { - cancel(); - reject(error); - return; - } - } - // Rescheudle a check on the next block - if (!stopScanning) { - this.provider.once("block", replaceListener); - } - }; - cancellers.push(() => { - this.provider.off("block", replaceListener); - }); - this.provider.once("block", replaceListener); - } - }); - return await waiter; - } - /** - * Returns ``true`` if this transaction has been included. - * - * This is effective only as of the time the TransactionResponse - * was instantiated. To get up-to-date information, use - * [[getTransaction]]. - * - * This provides a Type Guard that this transaction will have - * non-null property values for properties that are null for - * unmined transactions. - */ - isMined() { - return this.blockHash != null; - } - /** - * Returns true if the transaction is a legacy (i.e. ``type == 0``) - * transaction. - * - * This provides a Type Guard that this transaction will have - * the ``null``-ness for hardfork-specific properties set correctly. - */ - isLegacy() { - return this.type === 0; - } - /** - * Returns a filter which can be used to listen for orphan events - * that evict this transaction. - */ - removedEvent() { - assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - return createRemovedTransactionFilter(this); - } - /** - * Returns a filter which can be used to listen for orphan events - * that re-order this event against %%other%%. - */ - reorderedEvent(other) { - assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - assert(!other || other.isMined(), "unmined 'other' transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - return createReorderedTransactionFilter(this, other); - } - /** - * Returns a new TransactionResponse instance which has the ability to - * detect (and throw an error) if the transaction is replaced, which - * will begin scanning at %%startBlock%%. - * - * This should generally not be used by developers and is intended - * primarily for internal use. Setting an incorrect %%startBlock%% can - * have devastating performance consequences if used incorrectly. - */ - replaceableTransaction(startBlock) { - assertArgument(Number.isInteger(startBlock) && startBlock >= 0, "invalid startBlock", "startBlock", startBlock); - const tx = new TransactionResponse(this, this.provider); - tx.#startBlock = startBlock; - return tx; - } -} -function createOrphanedBlockFilter(block) { - return { orphan: "drop-block", hash: block.hash, number: block.number }; -} -function createReorderedTransactionFilter(tx, other) { - return { orphan: "reorder-transaction", tx, other }; -} -function createRemovedTransactionFilter(tx) { - return { orphan: "drop-transaction", tx }; -} -function createRemovedLogFilter(log) { - return { - orphan: "drop-log", - log: { - transactionHash: log.transactionHash, - blockHash: log.blockHash, - blockNumber: log.blockNumber, - address: log.address, - data: log.data, - topics: Object.freeze(log.topics.slice()), - index: log.index, - }, - }; -} -//# sourceMappingURL=provider.js.map \ No newline at end of file diff --git a/lib.esm/providers/provider.js.map b/lib.esm/providers/provider.js.map deleted file mode 100644 index 495ffeeb3..000000000 --- a/lib.esm/providers/provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src.ts/providers/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,OAAO,EACP,iBAAiB,EACjB,MAAM,EACN,cAAc,EACd,OAAO,EACP,SAAS,GACV,MAAM,mBAAmB,CAAC;AAS3B,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAWvB,0BAA0B;AAE1B,SAAS,QAAQ,CAAI,KAA2B;IAC9C,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,MAAM,CAAC,KAAoB;IAClC,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC;AAED,0DAA0D;AAE1D;;;GAGG;AACH,MAAM,OAAO,OAAO;IAClB;;OAEG;IACM,WAAW,CAAiB;IAErC,YAAY,WAA2B;QACrC,gBAAgB,CAAU,IAAI,EAAE;YAC9B,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC;SACnC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAC7B,OAAO;YACL,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC;SACjC,CAAC;IACJ,CAAC;CACF;AA4CD,MAAM,UAAU,WAAW,CACzB,GAAuB;IAEvB,MAAM,MAAM,GAAQ,EAAE,CAAC;IA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AAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;AAC1E,CAAC;AAED,SAAS,gCAAgC,CACvC,EAA4D,EAC5D,KAAgE;IAEhE,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;AACtD,CAAC;AAED,SAAS,8BAA8B,CAAC,EAIvC;IACC,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC;AAC5C,CAAC;AAED,SAAS,sBAAsB,CAAC,GAQ/B;IACC,OAAO;QACL,MAAM,EAAE,UAAU;QAClB,GAAG,EAAE;YACH,eAAe,EAAE,GAAG,CAAC,eAAe;YACpC,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACzC,KAAK,EAAE,GAAG,CAAC,KAAK;SACjB;KACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/lib.esm/providers/signer-noncemanager.d.ts b/lib.esm/providers/signer-noncemanager.d.ts deleted file mode 100644 index 31eae80ab..000000000 --- a/lib.esm/providers/signer-noncemanager.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { AbstractSigner } from "./abstract-signer.js"; -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -import type { Signer } from "./signer.js"; -export declare class NonceManager extends AbstractSigner { - #private; - signer: Signer; - constructor(signer: Signer); - getAddress(): Promise; - connect(provider: null | Provider): NonceManager; - getNonce(blockTag?: BlockTag): Promise; - increment(): void; - reset(): void; - sendTransaction(tx: TransactionRequest): Promise; - signTransaction(tx: TransactionRequest): Promise; - signMessage(message: string | Uint8Array): Promise; - signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -//# sourceMappingURL=signer-noncemanager.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/signer-noncemanager.d.ts.map b/lib.esm/providers/signer-noncemanager.d.ts.map deleted file mode 100644 index 9f69385c3..000000000 --- a/lib.esm/providers/signer-noncemanager.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signer-noncemanager.d.ts","sourceRoot":"","sources":["../../src.ts/providers/signer-noncemanager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,qBAAa,YAAa,SAAQ,cAAc;;IAC9C,MAAM,EAAG,MAAM,CAAC;gBAKJ,MAAM,EAAE,MAAM;IAQpB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,YAAY;IAI1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAapD,SAAS,IAAI,IAAI;IAIjB,KAAK,IAAI,IAAI;IAKP,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAY3E,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1D,aAAa,CACX,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC;CAGnB"} \ No newline at end of file diff --git a/lib.esm/providers/signer-noncemanager.js b/lib.esm/providers/signer-noncemanager.js deleted file mode 100644 index 0d34551c1..000000000 --- a/lib.esm/providers/signer-noncemanager.js +++ /dev/null @@ -1,55 +0,0 @@ -import { defineProperties } from "../utils/index.js"; -import { AbstractSigner } from "./abstract-signer.js"; -export class NonceManager extends AbstractSigner { - signer; - #noncePromise; - #delta; - constructor(signer) { - super(signer.provider); - defineProperties(this, { signer }); - this.#noncePromise = null; - this.#delta = 0; - } - async getAddress() { - return this.signer.getAddress(); - } - connect(provider) { - return new NonceManager(this.signer.connect(provider)); - } - async getNonce(blockTag) { - if (blockTag === "pending") { - if (this.#noncePromise == null) { - this.#noncePromise = super.getNonce("pending"); - } - const delta = this.#delta; - return (await this.#noncePromise) + delta; - } - return super.getNonce(blockTag); - } - increment() { - this.#delta++; - } - reset() { - this.#delta = 0; - this.#noncePromise = null; - } - async sendTransaction(tx) { - const noncePromise = this.getNonce("pending"); - this.increment(); - tx = await this.signer.populateTransaction(tx); - tx.nonce = await noncePromise; - // @TODO: Maybe handle interesting/recoverable errors? - // Like don't increment if the tx was certainly not sent - return await this.signer.sendTransaction(tx); - } - signTransaction(tx) { - return this.signer.signTransaction(tx); - } - signMessage(message) { - return this.signer.signMessage(message); - } - signTypedData(domain, types, value) { - return this.signer.signTypedData(domain, types, value); - } -} -//# sourceMappingURL=signer-noncemanager.js.map \ No newline at end of file diff --git a/lib.esm/providers/signer-noncemanager.js.map b/lib.esm/providers/signer-noncemanager.js.map deleted file mode 100644 index 03a4f51cb..000000000 --- a/lib.esm/providers/signer-noncemanager.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signer-noncemanager.js","sourceRoot":"","sources":["../../src.ts/providers/signer-noncemanager.ts"],"names":[],"mappings":"AAAA,OAA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AC1C,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,CAAC,SAAS,EAAE,CAAC;QAEjB,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;QAC/C,EAAE,CAAC,KAAK,GAAG,MAAM,YAAY,CAAC;QAE9B,sDAAsD;QACtD,wDAAwD;QACxD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,eAAe,CAAC,EAAsB;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,WAAW,CAAC,OAA4B;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,aAAa,CACX,MAAuB,EACvB,KAA4C,EAC5C,KAA0B;QAE1B,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/signer.d.ts b/lib.esm/providers/signer.d.ts deleted file mode 100644 index a6383a32f..000000000 --- a/lib.esm/providers/signer.d.ts +++ /dev/null @@ -1,118 +0,0 @@ -import type { Addressable, NameResolver } from "../address/index.js"; -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { ContractRunner } from "./contracts.js"; -import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -/** - * A Signer represents an account on the Core Blockchain, and is most often - * backed by a private key represented by a mnemonic or residing on a Hardware Wallet. - * - * The API remains abstract though, so that it can deal with more advanced exotic - * Signing entities, such as Smart Contract Wallets or Virtual Wallets (where the - * private key may not be known). - */ -export interface Signer extends Addressable, ContractRunner, NameResolver { - /** - * The [[Provider]] attached to this Signer (if any). - */ - provider: null | Provider; - /** - * Returns a new instance of this Signer connected to //provider// or detached - * from any Provider if null. - */ - connect(provider: null | Provider): Signer; - /** - * Get the address of the Signer. - */ - getAddress(): Promise; - /** - * Gets the next nonce required for this Signer to send a transaction. - * - * @param blockTag - The blocktag to base the transaction count on, keep in mind - * many nodes do not honour this value and silently ignore it [default: ``"latest"``] - */ - getNonce(blockTag?: BlockTag): Promise; - /** - * Prepares a {@link TransactionRequest} for calling: - * - resolves ``to`` and ``from`` addresses - * - if ``from`` is specified , check that it matches this Signer - * - * @param tx - The call to prepare - */ - populateCall(tx: TransactionRequest): Promise>; - /** - * Prepares a {@link TransactionRequest} for sending to the network by - * populating any missing properties: - * - resolves ``to`` and ``from`` addresses - * - if ``from`` is specified , check that it matches this Signer - * - populates ``nonce`` via ``signer.getNonce("pending")`` - * - populates ``energyLimit`` via ``signer.estimateEnergy(tx)`` - * - populates ``networkId`` via ``signer.provider.getNetwork()`` - * - populates ``type`` and relevant fee data for that type (``energyPrice`` - * for legacy transactions, ``maxFeePerEnergy`` for EIP-1559, etc) - * - * @note Some Signer implementations may skip populating properties that - * are populated downstream; for example JsonRpcSigner defers to the - * node to populate the nonce and fee data. - * - * @param tx - The call to prepare - */ - populateTransaction(tx: TransactionRequest): Promise>; - /** - * Estimates the required energy required to execute //tx// on the Blockchain. This - * will be the expected amount a transaction will require as its ``energyLimit`` - * to successfully run all the necessary computations and store the needed state - * that the transaction intends. - * - * Keep in mind that this is **best efforts**, since the state of the Blockchain - * is in flux, which could affect transaction energy requirements. - * - * @throws UNPREDICTABLE_ENERGY_LIMIT A transaction that is believed by the node to likely - * fail will throw an error during energy estimation. This could indicate that it - * will actually fail or that the circumstances are simply too complex for the - * node to take into account. In these cases, a manually determined ``energyLimit`` - * will need to be made. - */ - estimateEnergy(tx: TransactionRequest): Promise; - /** - * Evaluates the //tx// by running it against the current Blockchain state. This - * cannot change state and has no cost in xcb, as it is effectively simulating - * execution. - * - * This can be used to have the Blockchain perform computations based on its state - * (e.g. running a Contract's getters) or to simulate the effect of a transaction - * before actually performing an operation. - */ - call(tx: TransactionRequest): Promise; - /** - * Resolves an ENS Name to an address. - */ - resolveName(name: string): Promise; - /** - * Signs %%tx%%, returning the fully signed transaction. This does not - * populate any additional properties within the transaction. - */ - signTransaction(tx: TransactionRequest): Promise; - /** - * Sends %%tx%% to the Network. The ``signer.populateTransaction(tx)`` - * is called first to ensure all necessary properties for the - * transaction to be valid have been popualted first. - */ - sendTransaction(tx: TransactionRequest): Promise; - /** - * Signers an [[link-eip-191]] prefixed personal message. - * - * If the %%message%% is a string, it is signed as UTF-8 encoded bytes. It is **not** - * interpretted as a [[BytesLike]]; so the string ``"0x1234"`` is signed as six - * characters, **not** two bytes. - * - * To sign that example as two bytes, the Uint8Array should be used - * (i.e. ``new Uint8Array([ 0x12, 0x34 ])``). - */ - signMessage(message: string | Uint8Array): Promise; - /** - * Signs the [[link-eip-712]] typed data. - */ - signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -//# sourceMappingURL=signer.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/signer.d.ts.map b/lib.esm/providers/signer.d.ts.map deleted file mode 100644 index 4dff87bbe..000000000 --- a/lib.esm/providers/signer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src.ts/providers/signer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAEvB;;;;;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,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB"} \ No newline at end of file diff --git a/lib.esm/providers/signer.js b/lib.esm/providers/signer.js deleted file mode 100644 index 7c8f9901a..000000000 --- a/lib.esm/providers/signer.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=signer.js.map \ No newline at end of file diff --git a/lib.esm/providers/signer.js.map b/lib.esm/providers/signer.js.map deleted file mode 100644 index 68d48a837..000000000 --- a/lib.esm/providers/signer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../src.ts/providers/signer.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib.esm/providers/subscriber-connection.d.ts b/lib.esm/providers/subscriber-connection.d.ts deleted file mode 100644 index b235e3b46..000000000 --- a/lib.esm/providers/subscriber-connection.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Subscriber } from "./abstract-provider.js"; -import type { Provider } from "./provider.js"; -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export interface ConnectionRpcProvider extends Provider { - _subscribe(param: Array, processFunc: (result: any) => void): number; - _unsubscribe(filterId: number): void; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class BlockConnectionSubscriber implements Subscriber { - #private; - constructor(provider: ConnectionRpcProvider); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -//# sourceMappingURL=subscriber-connection.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/subscriber-connection.d.ts.map b/lib.esm/providers/subscriber-connection.d.ts.map deleted file mode 100644 index 2f88c6893..000000000 --- a/lib.esm/providers/subscriber-connection.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-connection.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-connection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,QAAQ;IAErD,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,CAAC;IAC1E,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,UAAU;;gBAQ9C,QAAQ,EAAE,qBAAqB;IAO3C,KAAK,IAAI,IAAI;IAiBb,IAAI,IAAI,IAAI;IAYZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAOtC,MAAM,IAAI,IAAI;CAGf"} \ No newline at end of file diff --git a/lib.esm/providers/subscriber-connection.js b/lib.esm/providers/subscriber-connection.js deleted file mode 100644 index e56ac1eec..000000000 --- a/lib.esm/providers/subscriber-connection.js +++ /dev/null @@ -1,52 +0,0 @@ -import { getNumber } from "../utils/index.js"; -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export class BlockConnectionSubscriber { - #provider; - #blockNumber; - #running; - #filterId; - constructor(provider) { - this.#provider = provider; - this.#blockNumber = -2; - this.#running = false; - this.#filterId = null; - } - start() { - if (this.#running) { - return; - } - this.#running = true; - this.#filterId = this.#provider._subscribe(["newHeads"], (result) => { - const blockNumber = getNumber(result.number); - const initial = this.#blockNumber === -2 ? blockNumber : this.#blockNumber + 1; - for (let b = initial; b <= blockNumber; b++) { - this.#provider.emit("block", b); - } - this.#blockNumber = blockNumber; - }); - } - stop() { - if (!this.#running) { - return; - } - this.#running = false; - if (this.#filterId != null) { - this.#provider._unsubscribe(this.#filterId); - this.#filterId = null; - } - } - pause(dropWhilePaused) { - if (dropWhilePaused) { - this.#blockNumber = -2; - } - this.stop(); - } - resume() { - this.start(); - } -} -//# sourceMappingURL=subscriber-connection.js.map \ No newline at end of file diff --git a/lib.esm/providers/subscriber-connection.js.map b/lib.esm/providers/subscriber-connection.js.map deleted file mode 100644 index eb4860edb..000000000 --- a/lib.esm/providers/subscriber-connection.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-connection.js","sourceRoot":"","sources":["../../src.ts/providers/subscriber-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAkB9C;;;;GAIG;AACH,MAAM,OAAO,yBAAyB;IACpC,SAAS,CAAwB;IACjC,YAAY,CAAS;IAErB,QAAQ,CAAU;IAElB,SAAS,CAAgB;IAEzB,YAAY,QAA+B;QACzC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO;SACR;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,MAAW,EAAE,EAAE;YACvE,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC7C,MAAM,OAAO,GACX,IAAI,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;YACjE,KAAK,IAAI,CAAC,GAAG,OAAO,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC,EAAE,EAAE;gBAC3C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;aACjC;YACD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI;QACF,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO;SACR;QACD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAEtB,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE;YAC1B,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;SACvB;IACH,CAAC;IAED,KAAK,CAAC,eAAyB;QAC7B,IAAI,eAAe,EAAE;YACnB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;SACxB;QACD,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/subscriber-filterid.d.ts b/lib.esm/providers/subscriber-filterid.d.ts deleted file mode 100644 index 3e58a6871..000000000 --- a/lib.esm/providers/subscriber-filterid.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; -import type { EventFilter } from "./provider.js"; -import type { JsonRpcApiProvider } from "./provider-jsonrpc.js"; -/** - * Some backends support subscribing to events using a Filter ID. - * - * When subscribing with this technique, the node issues a unique - * //Filter ID//. At this point the node dedicates resources to - * the filter, so that periodic calls to follow up on the //Filter ID// - * will receive any events since the last call. - * - * @_docloc: api/providers/abstract-provider - */ -export declare class FilterIdSubscriber implements Subscriber { - #private; - constructor(provider: JsonRpcApiProvider); - _subscribe(provider: JsonRpcApiProvider): Promise; - _emitResults(provider: AbstractProvider, result: Array): Promise; - _recover(provider: AbstractProvider): Subscriber; - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -/** - * A **FilterIdSubscriber** for receiving contract events. - * - * @_docloc: api/providers/abstract-provider - */ -export declare class FilterIdEventSubscriber extends FilterIdSubscriber { - #private; - constructor(provider: JsonRpcApiProvider, filter: EventFilter); - _recover(provider: AbstractProvider): Subscriber; - _subscribe(provider: JsonRpcApiProvider): Promise; - _emitResults(provider: JsonRpcApiProvider, results: Array): Promise; -} -/** - * A **FilterIdSubscriber** for receiving pending transactions events. - * - * @_docloc: api/providers/abstract-provider - */ -export declare class FilterIdPendingSubscriber extends FilterIdSubscriber { - _subscribe(provider: JsonRpcApiProvider): Promise; - _emitResults(provider: JsonRpcApiProvider, results: Array): Promise; -} -//# sourceMappingURL=subscriber-filterid.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/subscriber-filterid.d.ts.map b/lib.esm/providers/subscriber-filterid.d.ts.map deleted file mode 100644 index b2d81a26c..000000000 --- a/lib.esm/providers/subscriber-filterid.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-filterid.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-filterid.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAMhE;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,YAAW,UAAU;;gBAYvC,QAAQ,EAAE,kBAAkB;IAaxC,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3E,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU;IAkEhD,KAAK,IAAI,IAAI;IASb,IAAI,IAAI,IAAI;IAWZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAOtC,MAAM,IAAI,IAAI;CAGf;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,kBAAkB;;gBAGjD,QAAQ,EAAE,kBAAkB,EAAE,MAAM,EAAE,WAAW;IAK7D,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU;IAI1C,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAKzD,YAAY,CAChB,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAClB,OAAO,CAAC,IAAI,CAAC;CAKjB;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,kBAAkB;IACzD,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,YAAY,CAChB,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAClB,OAAO,CAAC,IAAI,CAAC;CAKjB"} \ No newline at end of file diff --git a/lib.esm/providers/subscriber-filterid.js b/lib.esm/providers/subscriber-filterid.js deleted file mode 100644 index c8a64534d..000000000 --- a/lib.esm/providers/subscriber-filterid.js +++ /dev/null @@ -1,158 +0,0 @@ -import { isError } from "../utils/index.js"; -import { PollingEventSubscriber } from "./subscriber-polling.js"; -function copy(obj) { - return JSON.parse(JSON.stringify(obj)); -} -/** - * Some backends support subscribing to events using a Filter ID. - * - * When subscribing with this technique, the node issues a unique - * //Filter ID//. At this point the node dedicates resources to - * the filter, so that periodic calls to follow up on the //Filter ID// - * will receive any events since the last call. - * - * @_docloc: api/providers/abstract-provider - */ -export class FilterIdSubscriber { - #provider; - #filterIdPromise; - #poller; - #running; - #network; - #hault; - constructor(provider) { - this.#provider = provider; - this.#filterIdPromise = null; - this.#poller = this.#poll.bind(this); - this.#running = false; - this.#network = null; - this.#hault = false; - } - _subscribe(provider) { - throw new Error("subclasses must override this"); - } - _emitResults(provider, result) { - throw new Error("subclasses must override this"); - } - _recover(provider) { - throw new Error("subclasses must override this"); - } - async #poll(blockNumber) { - try { - // Subscribe if necessary - if (this.#filterIdPromise == null) { - this.#filterIdPromise = this._subscribe(this.#provider); - } - // Get the Filter ID - let filterId = null; - try { - filterId = await this.#filterIdPromise; - } - catch (error) { - if (!isError(error, "UNSUPPORTED_OPERATION") || - error.operation !== "xcb_newFilter") { - throw error; - } - } - // The backend does not support Filter ID; downgrade to - // polling - if (filterId == null) { - this.#filterIdPromise = null; - this.#provider._recoverSubscriber(this, this._recover(this.#provider)); - return; - } - const network = await this.#provider.getNetwork(); - if (!this.#network) { - this.#network = network; - } - if (this.#network.networkId !== network.networkId) { - throw new Error("chaid changed"); - } - if (this.#hault) { - return; - } - const result = await this.#provider.send("xcb_getFilterChanges", [ - filterId, - ]); - await this._emitResults(this.#provider, result); - } - catch (error) { - console.log("@TODO", error); - } - this.#provider.once("block", this.#poller); - } - #teardown() { - const filterIdPromise = this.#filterIdPromise; - if (filterIdPromise) { - this.#filterIdPromise = null; - filterIdPromise.then((filterId) => { - this.#provider.send("xcb_uninstallFilter", [filterId]); - }); - } - } - start() { - if (this.#running) { - return; - } - this.#running = true; - this.#poll(-2); - } - stop() { - if (!this.#running) { - return; - } - this.#running = false; - this.#hault = true; - this.#teardown(); - this.#provider.off("block", this.#poller); - } - pause(dropWhilePaused) { - if (dropWhilePaused) { - this.#teardown(); - } - this.#provider.off("block", this.#poller); - } - resume() { - this.start(); - } -} -/** - * A **FilterIdSubscriber** for receiving contract events. - * - * @_docloc: api/providers/abstract-provider - */ -export class FilterIdEventSubscriber extends FilterIdSubscriber { - #event; - constructor(provider, filter) { - super(provider); - this.#event = copy(filter); - } - _recover(provider) { - return new PollingEventSubscriber(provider, this.#event); - } - async _subscribe(provider) { - const filterId = await provider.send("xcb_newFilter", [this.#event]); - return filterId; - } - async _emitResults(provider, results) { - for (const result of results) { - provider.emit(this.#event, provider._wrapLog(result, provider._network)); - } - } -} -/** - * A **FilterIdSubscriber** for receiving pending transactions events. - * - * @_docloc: api/providers/abstract-provider - */ -export class FilterIdPendingSubscriber extends FilterIdSubscriber { - async _subscribe(provider) { - return await provider.send("xcb_newPendingTransactionFilter", []); - } - async _emitResults(provider, results) { - for (const result of results) { - provider.emit("pending", result); - } - } -} -//# sourceMappingURL=subscriber-filterid.js.map \ No newline at end of file diff --git a/lib.esm/providers/subscriber-filterid.js.map b/lib.esm/providers/subscriber-filterid.js.map deleted file mode 100644 index 066dc3391..000000000 --- a/lib.esm/providers/subscriber-filterid.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-filterid.js","sourceRoot":"","sources":["../../src.ts/providers/subscriber-filterid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAOjE,SAAS,IAAI,CAAC,GAAQ;IACpB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,kBAAkB;IAC7B,SAAS,CAAqB;IAE9B,gBAAgB,CAAyB;IACzC,OAAO,CAA+B;IAEtC,QAAQ,CAAU;IAElB,QAAQ,CAAiB;IAEzB,MAAM,CAAU;IAEhB,YAAY,QAA4B;QACtC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAErC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAEtB,IAAI,CAAC,QAAQ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;QAC3C,OAAO,MAAM,QAAQ,CAAC,IAAI,CAAC,iCAAiC,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,QAA4B,EAC5B,OAAmB;QAEnB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC5B,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;SAClC;IACH,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/subscriber-polling.d.ts b/lib.esm/providers/subscriber-polling.d.ts deleted file mode 100644 index fcf4a8070..000000000 --- a/lib.esm/providers/subscriber-polling.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; -import type { EventFilter, OrphanFilter, ProviderEvent } from "./provider.js"; -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare function getPollingSubscriber(provider: AbstractProvider, event: ProviderEvent): Subscriber; -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class PollingBlockSubscriber implements Subscriber { - #private; - constructor(provider: AbstractProvider); - get pollingInterval(): number; - set pollingInterval(value: number); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class OnBlockSubscriber implements Subscriber { - #private; - constructor(provider: AbstractProvider); - _poll(blockNumber: number, provider: AbstractProvider): Promise; - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class PollingOrphanSubscriber extends OnBlockSubscriber { - #private; - constructor(provider: AbstractProvider, filter: OrphanFilter); - _poll(blockNumber: number, provider: AbstractProvider): Promise; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class PollingTransactionSubscriber extends OnBlockSubscriber { - #private; - constructor(provider: AbstractProvider, hash: string); - _poll(blockNumber: number, provider: AbstractProvider): Promise; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class PollingEventSubscriber implements Subscriber { - #private; - constructor(provider: AbstractProvider, filter: EventFilter); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -//# sourceMappingURL=subscriber-polling.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/subscriber-polling.d.ts.map b/lib.esm/providers/subscriber-polling.d.ts.map deleted file mode 100644 index 9082a53d0..000000000 --- a/lib.esm/providers/subscriber-polling.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-polling.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-polling.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAM9E;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,aAAa,GACnB,UAAU,CAYZ;AAID;;;;GAIG;AACH,qBAAa,sBAAuB,YAAW,UAAU;;gBAU3C,QAAQ,EAAE,gBAAgB;IAQtC,IAAI,eAAe,IAAI,MAAM,CAE5B;IACD,IAAI,eAAe,CAAC,KAAK,EAAE,MAAM,EAEhC;IA2CD,KAAK,IAAI,IAAI;IAWb,IAAI,IAAI,IAAI;IAQZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAOtC,MAAM,IAAI,IAAI;CAGf;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW,UAAU;;gBAKtC,QAAQ,EAAE,gBAAgB;IAQhC,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3E,KAAK,IAAI,IAAI;IAUb,IAAI,IAAI,IAAI;IASZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAGtC,MAAM,IAAI,IAAI;CAGf;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,iBAAiB;;gBAGhD,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY;IAKtD,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAI5E;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,iBAAiB;;gBAGrD,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM;IAK9C,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAM5E;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,YAAW,UAAU;;gBAW3C,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW;IAmC3D,KAAK,IAAI,IAAI;IAcb,IAAI,IAAI,IAAI;IASZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAOtC,MAAM,IAAI,IAAI;CAGf"} \ No newline at end of file diff --git a/lib.esm/providers/subscriber-polling.js b/lib.esm/providers/subscriber-polling.js deleted file mode 100644 index bf6e01161..000000000 --- a/lib.esm/providers/subscriber-polling.js +++ /dev/null @@ -1,248 +0,0 @@ -import { assert, isHexString } from "../utils/index.js"; -function copy(obj) { - return JSON.parse(JSON.stringify(obj)); -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export function getPollingSubscriber(provider, event) { - if (event === "block") { - return new PollingBlockSubscriber(provider); - } - if (isHexString(event, 32)) { - return new PollingTransactionSubscriber(provider, event); - } - assert(false, "unsupported polling event", "UNSUPPORTED_OPERATION", { - operation: "getPollingSubscriber", - info: { event }, - }); -} -// @TODO: refactor this -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export class PollingBlockSubscriber { - #provider; - #poller; - #interval; - // The most recent block we have scanned for events. The value -2 - // indicates we still need to fetch an initial block number - #blockNumber; - constructor(provider) { - this.#provider = provider; - this.#poller = null; - this.#interval = 4000; - this.#blockNumber = -2; - } - get pollingInterval() { - return this.#interval; - } - set pollingInterval(value) { - this.#interval = value; - } - async #poll() { - try { - const blockNumber = await this.#provider.getBlockNumber(); - // Bootstrap poll to setup our initial block number - if (this.#blockNumber === -2) { - this.#blockNumber = blockNumber; - return; - } - // @TODO: Put a cap on the maximum number of events per loop? - if (blockNumber !== this.#blockNumber) { - for (let b = this.#blockNumber + 1; b <= blockNumber; b++) { - // We have been stopped - if (this.#poller == null) { - return; - } - await this.#provider.emit("block", b); - } - this.#blockNumber = blockNumber; - } - } - catch (error) { - // @TODO: Minor bump, add an "error" event to let subscribers - // know things went awry. - //console.log(error); - } - // We have been stopped - if (this.#poller == null) { - return; - } - this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); - } - start() { - if (this.#poller) { - return; - } - this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); - this.#poll(); - } - stop() { - if (!this.#poller) { - return; - } - this.#provider._clearTimeout(this.#poller); - this.#poller = null; - } - pause(dropWhilePaused) { - this.stop(); - if (dropWhilePaused) { - this.#blockNumber = -2; - } - } - resume() { - this.start(); - } -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export class OnBlockSubscriber { - #provider; - #poll; - #running; - constructor(provider) { - this.#provider = provider; - this.#running = false; - this.#poll = (blockNumber) => { - this._poll(blockNumber, this.#provider); - }; - } - async _poll(blockNumber, provider) { - throw new Error("sub-classes must override this"); - } - start() { - if (this.#running) { - return; - } - this.#running = true; - this.#poll(-2); - this.#provider.on("block", this.#poll); - } - stop() { - if (!this.#running) { - return; - } - this.#running = false; - this.#provider.off("block", this.#poll); - } - pause(dropWhilePaused) { - this.stop(); - } - resume() { - this.start(); - } -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export class PollingOrphanSubscriber extends OnBlockSubscriber { - #filter; - constructor(provider, filter) { - super(provider); - this.#filter = copy(filter); - } - async _poll(blockNumber, provider) { - throw new Error("@TODO"); - console.log(this.#filter); - } -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export class PollingTransactionSubscriber extends OnBlockSubscriber { - #hash; - constructor(provider, hash) { - super(provider); - this.#hash = hash; - } - async _poll(blockNumber, provider) { - const tx = await provider.getTransactionReceipt(this.#hash); - if (tx) { - provider.emit(this.#hash, tx); - } - } -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export class PollingEventSubscriber { - #provider; - #filter; - #poller; - #running; - // The most recent block we have scanned for events. The value -2 - // indicates we still need to fetch an initial block number - #blockNumber; - constructor(provider, filter) { - this.#provider = provider; - this.#filter = copy(filter); - this.#poller = this.#poll.bind(this); - this.#running = false; - this.#blockNumber = -2; - } - async #poll(blockNumber) { - // The initial block hasn't been determined yet - if (this.#blockNumber === -2) { - return; - } - const filter = copy(this.#filter); - filter.fromBlock = this.#blockNumber + 1; - filter.toBlock = blockNumber; - const logs = await this.#provider.getLogs(filter); - // No logs could just mean the node has not indexed them yet, - // so we keep a sliding window of 60 blocks to keep scanning - if (logs.length === 0) { - if (this.#blockNumber < blockNumber - 60) { - this.#blockNumber = blockNumber - 60; - } - return; - } - this.#blockNumber = blockNumber; - for (const log of logs) { - this.#provider.emit(this.#filter, log); - } - } - start() { - if (this.#running) { - return; - } - this.#running = true; - if (this.#blockNumber === -2) { - this.#provider.getBlockNumber().then((blockNumber) => { - this.#blockNumber = blockNumber; - }); - } - this.#provider.on("block", this.#poller); - } - stop() { - if (!this.#running) { - return; - } - this.#running = false; - this.#provider.off("block", this.#poller); - } - pause(dropWhilePaused) { - this.stop(); - if (dropWhilePaused) { - this.#blockNumber = -2; - } - } - resume() { - this.start(); - } -} -//# sourceMappingURL=subscriber-polling.js.map \ No newline at end of file diff --git a/lib.esm/providers/subscriber-polling.js.map b/lib.esm/providers/subscriber-polling.js.map deleted file mode 100644 index 858d03c8c..000000000 --- a/lib.esm/providers/subscriber-polling.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-polling.js","sourceRoot":"","sources":["../../src.ts/providers/subscriber-polling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKxD,SAAS,IAAI,CAAC,GAAQ;IACpB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAA0B,EAC1B,KAAoB;IAEpB,IAAI,KAAK,KAAK,OAAO,EAAE;QACrB,OAAO,IAAI,sBAAsB,CAAC,QAAQ,CAAC,CAAC;KAC7C;IACD,IAAI,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE;QAC1B,OAAO,IAAI,4BAA4B,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;KAC1D;IAED,MAAM,CAAC,KAAK,EAAE,2BAA2B,EAAE,uBAAuB,EAAE;QAClE,SAAS,EAAE,sBAAsB;QACjC,IAAI,EAAE,EAAE,KAAK,EAAE;KAChB,CAAC,CAAC;AACL,CAAC;AAED,uBAAuB;AAEvB;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IACjC,SAAS,CAAmB;IAC5B,OAAO,CAAgB;IAEvB,SAAS,CAAS;IAElB,iEAAiE;IACjE,2DAA2D;IAC3D,YAAY,CAAS;IAErB,YAAY,QAA0B;QACpC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;IACzB,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACD,IA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Q,EAAE;YACjB,OAAO;SACR;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,IAAI,CAAC,YAAY,KAAK,CAAC,CAAC,EAAE;YAC5B,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE;gBACnD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;YAClC,CAAC,CAAC,CAAC;SACJ;QACD,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI;QACF,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO;SACR;QACD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAEtB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,eAAyB;QAC7B,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAI,eAAe,EAAE;YACnB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;SACxB;IACH,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/providers/ws-browser.d.ts b/lib.esm/providers/ws-browser.d.ts deleted file mode 100644 index d92720422..000000000 --- a/lib.esm/providers/ws-browser.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const _WebSocket: any; -export { _WebSocket as WebSocket }; -//# sourceMappingURL=ws-browser.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/ws-browser.d.ts.map b/lib.esm/providers/ws-browser.d.ts.map deleted file mode 100644 index 63da59ec3..000000000 --- a/lib.esm/providers/ws-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ws-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/ws-browser.ts"],"names":[],"mappings":"AAaA,QAAA,MAAM,UAAU,KAAwB,CAAC;AAEzC,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC"} \ No newline at end of file diff --git a/lib.esm/providers/ws-browser.js b/lib.esm/providers/ws-browser.js deleted file mode 100644 index b5cca5638..000000000 --- a/lib.esm/providers/ws-browser.js +++ /dev/null @@ -1,15 +0,0 @@ -function getGlobal() { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw new Error("unable to locate global object"); -} -const _WebSocket = getGlobal().WebSocket; -export { _WebSocket as WebSocket }; -//# sourceMappingURL=ws-browser.js.map \ No newline at end of file diff --git a/lib.esm/providers/ws-browser.js.map b/lib.esm/providers/ws-browser.js.map deleted file mode 100644 index 5b8b6ffc7..000000000 --- a/lib.esm/providers/ws-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ws-browser.js","sourceRoot":"","sources":["../../src.ts/providers/ws-browser.ts"],"names":[],"mappings":"AAAA,SAAS,SAAS;IAChB,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC/B,OAAO,IAAI,CAAC;KACb;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC;KACf;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC;KACf;IACD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,GAAG,SAAS,EAAE,CAAC,SAAS,CAAC;AAEzC,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC"} \ No newline at end of file diff --git a/lib.esm/providers/ws.d.ts b/lib.esm/providers/ws.d.ts deleted file mode 100644 index 75d53b7d4..000000000 --- a/lib.esm/providers/ws.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { WebSocket } from "ws"; -//# sourceMappingURL=ws.d.ts.map \ No newline at end of file diff --git a/lib.esm/providers/ws.d.ts.map b/lib.esm/providers/ws.d.ts.map deleted file mode 100644 index c424f8d82..000000000 --- a/lib.esm/providers/ws.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src.ts/providers/ws.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC"} \ No newline at end of file diff --git a/lib.esm/providers/ws.js b/lib.esm/providers/ws.js deleted file mode 100644 index 3fcc8f78b..000000000 --- a/lib.esm/providers/ws.js +++ /dev/null @@ -1,2 +0,0 @@ -export { WebSocket } from "ws"; -//# sourceMappingURL=ws.js.map \ No newline at end of file diff --git a/lib.esm/providers/ws.js.map b/lib.esm/providers/ws.js.map deleted file mode 100644 index 717e091c5..000000000 --- a/lib.esm/providers/ws.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ws.js","sourceRoot":"","sources":["../../src.ts/providers/ws.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC"} \ No newline at end of file diff --git a/lib.esm/transaction/accesslist.d.ts b/lib.esm/transaction/accesslist.d.ts deleted file mode 100644 index aac12cccf..000000000 --- a/lib.esm/transaction/accesslist.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { AccessList, AccessListish } from "./index.js"; -/** - * Returns a [[AccessList]] from any corebcsupported access-list structure. - */ -export declare function accessListify(value: AccessListish): AccessList; -//# sourceMappingURL=accesslist.d.ts.map \ No newline at end of file diff --git a/lib.esm/transaction/accesslist.d.ts.map b/lib.esm/transaction/accesslist.d.ts.map deleted file mode 100644 index 4bd8ae700..000000000 --- a/lib.esm/transaction/accesslist.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"accesslist.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/accesslist.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAoB5D;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CA+C9D"} \ No newline at end of file diff --git a/lib.esm/transaction/accesslist.js b/lib.esm/transaction/accesslist.js deleted file mode 100644 index c80bab54c..000000000 --- a/lib.esm/transaction/accesslist.js +++ /dev/null @@ -1,37 +0,0 @@ -import { getAddress } from "../address/index.js"; -import { assertArgument, isHexString } from "../utils/index.js"; -function accessSetify(addr, storageKeys) { - return { - address: getAddress(addr), - storageKeys: storageKeys.map((storageKey, index) => { - assertArgument(isHexString(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey); - return storageKey.toLowerCase(); - }), - }; -} -/** - * Returns a [[AccessList]] from any corebcsupported access-list structure. - */ -export function accessListify(value) { - if (Array.isArray(value)) { - return value.map((set, index) => { - if (Array.isArray(set)) { - assertArgument(set.length === 2, "invalid slot set", `value[${index}]`, set); - return accessSetify(set[0], set[1]); - } - assertArgument(set != null && typeof set === "object", "invalid address-slot set", "value", value); - return accessSetify(set.address, set.storageKeys); - }); - } - assertArgument(value != null && typeof value === "object", "invalid access list", "value", value); - const result = Object.keys(value).map((addr) => { - const storageKeys = value[addr].reduce((accum, storageKey) => { - accum[storageKey] = true; - return accum; - }, {}); - return accessSetify(addr, Object.keys(storageKeys).sort()); - }); - result.sort((a, b) => a.address.localeCompare(b.address)); - return result; -} -//# sourceMappingURL=accesslist.js.map \ No newline at end of file diff --git a/lib.esm/transaction/accesslist.js.map b/lib.esm/transaction/accesslist.js.map deleted file mode 100644 index 2dd1473cd..000000000 --- a/lib.esm/transaction/accesslist.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"accesslist.js","sourceRoot":"","sources":["../../src.ts/transaction/accesslist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAI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EAAE,EAAE;QAC9B,MAAM,WAAW,GAAyB,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAC1D,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;YACpB,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;YACzB,OAAO,KAAK,CAAC;QACf,CAAC,EACqB,EAAE,CACzB,CAAC;QACF,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IACL,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/lib.esm/transaction/address.d.ts b/lib.esm/transaction/address.d.ts deleted file mode 100644 index 5abba54e2..000000000 --- a/lib.esm/transaction/address.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { SigningKey } from "../crypto/index.js"; -import type { SignatureLike } from "../crypto/index.js"; -import type { BytesLike } from "../utils/index.js"; -/** - * Returns the address for the %%key%%. - * - * The key may be any standard form of public key or a private key. - */ -export declare function removeHexPrefix(val: string): string; -export declare function publicToAddress(key: BytesLike | string, prefix: string): string; -export declare function computeAddress(key: string | SigningKey, prefix: string): string; -/** - * Returns the recovered address for the private key that was - * used to sign %%digest%% that resulted in %%signature%%. - */ -export declare function recoverAddress(digest: BytesLike, signature: SignatureLike, prefix: string): string; -export declare function extractPrefix(address: string): string; -//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/lib.esm/transaction/address.d.ts.map b/lib.esm/transaction/address.d.ts.map deleted file mode 100644 index 620aa31e9..000000000 --- a/lib.esm/transaction/address.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/address.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD;;;;GAIG;AAEH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,SAAS,GAAG,MAAM,EACvB,MAAM,EAAE,MAAM,GACb,MAAM,CAIR;AAED,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,GAAG,UAAU,EACxB,MAAM,EAAE,MAAM,GACb,MAAM,CAQR;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,MAAM,GACb,MAAM,CAIR;AACD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGrD"} \ No newline at end of file diff --git a/lib.esm/transaction/address.js b/lib.esm/transaction/address.js deleted file mode 100644 index e8d851762..000000000 --- a/lib.esm/transaction/address.js +++ /dev/null @@ -1,41 +0,0 @@ -import { getAddress } from "../address/index.js"; -import { sha256, SigningKey } from "../crypto/index.js"; -import { arrayify, hexDataSlice } from "../utils/data.js"; -import { calculateCheckSum } from "../address/index.js"; -/** - * Returns the address for the %%key%%. - * - * The key may be any standard form of public key or a private key. - */ -export function removeHexPrefix(val) { - return val.substring(0, 2) === "0x" ? val.substring(2) : val; -} -export function publicToAddress(key, prefix) { - const val = hexDataSlice(sha256(key), 12); - const checksum = calculateCheckSum(val, prefix); - return "0x" + prefix + checksum + removeHexPrefix(val); -} -export function computeAddress(key, prefix) { - let pubkey; - if (typeof key === "string") { - pubkey = SigningKey.computePublicKey(key, false); - } - else { - pubkey = key.publicKey; - } - return publicToAddress(pubkey, prefix); // getAddress(sha256("0x" + pubkey.substring(4)).substring(26)); -} -/** - * Returns the recovered address for the private key that was - * used to sign %%digest%% that resulted in %%signature%%. - */ -export function recoverAddress(digest, signature, prefix) { - // return computeAddress(SigningKey.recoverPublicKey(digest, signature)); - const publicKey = SigningKey.recoverPublicKey(arrayify(digest), signature); - return publicToAddress(publicKey, prefix); -} -export function extractPrefix(address) { - address = getAddress(address); - return address.substring(2, 4); -} -//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/lib.esm/transaction/address.js.map b/lib.esm/transaction/address.js.map deleted file mode 100644 index 0705f5862..000000000 --- a/lib.esm/transaction/address.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src.ts/transaction/address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIxD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;GAIG;AAEH,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,GAAuB,EACvB,MAAc;IAEd,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAChD,OAAO,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,GAAwB,EACxB,MAAc;IAEd,IAAI,MAAc,CAAC;IACnB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,MAAM,GAAG,UAAU,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;KAClD;SAAM;QACL,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC;KACxB;IACD,OAAO,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,gEAAgE;AAC1G,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAiB,EACjB,SAAwB,EACxB,MAAc;IAEd,yEAAyE;IACzE,MAAM,SAAS,GAAG,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;IAC3E,OAAO,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AACD,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAC9B,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACjC,CAAC"} \ No newline at end of file diff --git a/lib.esm/transaction/index.d.ts b/lib.esm/transaction/index.d.ts deleted file mode 100644 index 01bca63fa..000000000 --- a/lib.esm/transaction/index.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Transactions.. - * - * @_section api/transaction:Transactions [about-transactions] - */ -/** - * A single [[AccessList]] entry of storage keys (slots) for an address. - */ -export type AccessListEntry = { - address: string; - storageKeys: Array; -}; -/** - * An ordered collection of [[AccessList]] entries. - */ -export type AccessList = Array; -/** - * Any corebc-supported access list structure. - */ -export type AccessListish = AccessList | Array<[string, Array]> | Record>; -export { accessListify } from "./accesslist.js"; -export { computeAddress, recoverAddress } from "./address.js"; -export { Transaction } from "./transaction.js"; -export type { TransactionLike } from "./transaction.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.esm/transaction/index.d.ts.map b/lib.esm/transaction/index.d.ts.map deleted file mode 100644 index 304612964..000000000 --- a/lib.esm/transaction/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,KAAK,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAC9B,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"} \ No newline at end of file diff --git a/lib.esm/transaction/index.js b/lib.esm/transaction/index.js deleted file mode 100644 index 31c86a1e7..000000000 --- a/lib.esm/transaction/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Transactions.. - * - * @_section api/transaction:Transactions [about-transactions] - */ -null; -export { accessListify } from "./accesslist.js"; -export { computeAddress, recoverAddress } from "./address.js"; -export { Transaction } from "./transaction.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.esm/transaction/index.js.map b/lib.esm/transaction/index.js.map deleted file mode 100644 index f1f5d64df..000000000 --- a/lib.esm/transaction/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/transaction/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,IAAI,CAAC;AAoBL,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"} \ No newline at end of file diff --git a/lib.esm/transaction/transaction.d.ts b/lib.esm/transaction/transaction.d.ts deleted file mode 100644 index 83340f6b5..000000000 --- a/lib.esm/transaction/transaction.d.ts +++ /dev/null @@ -1,169 +0,0 @@ -import { Signature } from "../crypto/index.js"; -import type { BigNumberish, BytesLike } from "../utils/index.js"; -import type { SignatureLike } from "../crypto/index.js"; -export interface TransactionLike { - /** - * The recipient address or ``null`` for an ``init`` transaction. - */ - to?: null | A; - /** - * The sender. - */ - from?: null | A; - /** - * The nonce. - */ - nonce?: null | number; - /** - * The maximum amount of energy that can be used. - */ - energyLimit?: null | BigNumberish; - /** - * The energy price for legacy and berlin transactions. - */ - energyPrice?: null | BigNumberish; - /** - * The data. - */ - data?: null | string; - /** - * The value (in ore) to send. - */ - value?: null | BigNumberish; - /** - * The chain ID the transaction is valid on. - */ - networkId?: null | BigNumberish; - /** - * The transaction hash. - */ - hash?: null | string; - /** - * The signature provided by the sender. - */ - signature?: null | SignatureLike; -} -/** - * A **Transaction** describes an operation to be executed on - * Core by an Externally Owned Account (EOA). It includes - * who (the [[to]] address), what (the [[data]]) and how much (the - * [[value]] in corebc) the operation should entail. - * - * @example: - * tx = new Transaction() - * //_result: - * - * tx.data = "0x1234"; - * //_result: - */ -export declare class Transaction implements TransactionLike { - #private; - /** - * The ``to`` address for the transaction or ``null`` if the - * transaction is an ``init`` transaction. - */ - get to(): null | string; - set to(value: null | string); - /** - * The transaction nonce. - */ - get nonce(): number; - set nonce(value: BigNumberish); - /** - * The energy limit. - */ - get energyLimit(): bigint; - set energyLimit(value: BigNumberish); - /** - * The energy price. - * - * On legacy networks this defines the fee that will be paid. On - * EIP-1559 networks, this should be ``null``. - */ - get energyPrice(): null | bigint; - set energyPrice(value: null | BigNumberish); - /** - * The transaction data. For ``init`` transactions this is the - * deployment code. - */ - get data(): string; - set data(value: BytesLike); - /** - * The amount of xcb (in ore) to send in this transactions. - */ - get value(): bigint; - set value(value: BigNumberish); - /** - * The chain ID this transaction is valid on. - */ - get networkId(): bigint; - set networkId(value: BigNumberish); - /** - * If signed, the signature for this transaction. - */ - get signature(): null | string; - set signature(value: null | SignatureLike); - /** - * Creates a new Transaction with default values. - */ - constructor(); - /** - * The transaction hash, if signed. Otherwise, ``null``. - */ - get hash(): null | string; - /** - * The pre-image hash of this transaction. - * - * This is the digest that a [[Signer]] must sign to authorize - * this transaction. - */ - get unsignedHash(): string; - /** - * The sending address, if signed. Otherwise, ``null``. - */ - get from(): null | string; - /** - * The public key of the sender, if signed. Otherwise, ``null``. - */ - get fromPublicKey(): null | string; - /** - * Returns true if signed. - * - * This provides a Type Guard that properties requiring a signed - * transaction are non-null. - */ - isSigned(): this is Transaction & { - type: number; - typeName: string; - from: string; - signature: Signature; - }; - /** - * The serialized transaction. - * - * This throws if the transaction is unsigned. For the pre-image, - * use [[unsignedSerialized]]. - */ - get serialized(): string; - /** - * The transaction pre-image. - * - * The hash of this is the digest which needs to be signed to - * authorize this transaction. - */ - get unsignedSerialized(): string; - /** - * Create a copy of this transaciton. - */ - clone(): Transaction; - /** - * Return a JSON-friendly object. - */ - toJSON(): any; - /** - * Create a **Transaction** from a serialized transaction or a - * Transaction-like object. - */ - static from(tx?: string | TransactionLike): Transaction; -} -//# sourceMappingURL=transaction.d.ts.map \ No newline at end of file diff --git a/lib.esm/transaction/transaction.d.ts.map b/lib.esm/transaction/transaction.d.ts.map deleted file mode 100644 index f298b00da..000000000 --- a/lib.esm/transaction/transaction.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transaction.d.ts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AAE,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,WAAW;CA6DhE"} \ No newline at end of file diff --git a/lib.esm/transaction/transaction.js b/lib.esm/transaction/transaction.js deleted file mode 100644 index dcdd2acdb..000000000 --- a/lib.esm/transaction/transaction.js +++ /dev/null @@ -1,365 +0,0 @@ -import { getAddress } from "../address/index.js"; -import { sha256, SigningKey } from "../crypto/index.js"; -import { getBytes, getBigInt, getNumber, hexlify, assert, assertArgument, } from "../utils/index.js"; -import { recoverAddress } from "./address.js"; -import { checkProperties } from "../utils/properties.js"; -import { arrayify, stripZeros } from "../utils/data.js"; -import { Logger } from "../logger/logger.js"; -import * as RLP from "../crypto/rlp.js"; -import { BigNumber } from "../bigNumber/bigNumber.js"; -import { networkIdToPrefix } from "../address/index.js"; -const logger = new Logger("transaction/0.0.1"); -const BN_0 = BigInt(0); -function handleAddress(value) { - if (value === "0x") { - return null; - } - return getAddress(value); -} -function parse(data) { - const handleNumber = (value) => { - // @ts-ignore - if (value === "0x") { - return BigNumber.from(0); - } - return BigNumber.from(value); - }; - const transaction = RLP.decode(data); - if (transaction.length !== 7 && transaction.length !== 8) { - logger.throwArgumentError("invalid raw transaction", "data", data); - } - const isSigned = transaction.length === 8; - const tx = { - nonce: Number(handleNumber(transaction[0])), - energyPrice: handleNumber(transaction[1]).toBigInt(), - energyLimit: handleNumber(transaction[2]).toBigInt(), - networkId: handleNumber(transaction[isSigned ? 3 : 6]).toBigInt(), - to: handleAddress(transaction[isSigned ? 4 : 3]), - value: handleNumber(transaction[isSigned ? 5 : 4]).toBigInt(), - data: transaction[isSigned ? 6 : 5], - }; - if (transaction.length === 8) { - const prefix = networkIdToPrefix(Number(tx.networkId)); - const digest = sha256(serialize(tx)); - tx.hash = sha256(serialize(tx, transaction[7])); - tx.from = recoverAddress(digest, transaction[7], prefix); - tx.signature = transaction[7]; - } - return tx; -} -const unsignedTransactionFields = [ - { name: "nonce", maxLength: 32, numeric: true }, - { name: "energyPrice", maxLength: 32, numeric: true }, - { name: "energyLimit", maxLength: 32, numeric: true }, - { name: "to", length: 22 }, - { name: "value", maxLength: 32, numeric: true }, - { name: "data" }, - { name: "networkId", maxLength: 32, numeric: true }, -]; -const transactionFields = [ - { name: "nonce", maxLength: 32, numeric: true }, - { name: "energyPrice", maxLength: 32, numeric: true }, - { name: "energyLimit", maxLength: 32, numeric: true }, - { name: "networkId", maxLength: 32, numeric: true }, - { name: "to", length: 22 }, - { name: "value", maxLength: 32, numeric: true }, - { name: "data" }, -]; -const allowedTransactionKeys = { - networkId: true, - data: true, - energyLimit: true, - energyPrice: true, - nonce: true, - to: true, - value: true, -}; -function serialize(transaction, signature) { - checkProperties(transaction, allowedTransactionKeys); - const raw = []; - (!!signature ? transactionFields : unsignedTransactionFields).forEach(function ({ numeric, maxLength, name, length }) { - let value = transaction[name] || []; - const options = {}; - if (numeric) { - options.hexPad = "left"; - } - const tmpHexlified = hexlify(value, options); - value = arrayify(tmpHexlified); - // Fixed-width field - if (length && value.length !== length && value.length > 0) { - logger.throwArgumentError("invalid length for " + name, "transaction:" + name, value); - } - // Variable-width (with a maximum) - if (maxLength) { - value = stripZeros(value); - if (value.length > maxLength) { - logger.throwArgumentError("invalid length for " + name, "transaction:" + name, value); - } - } - const hexlified = hexlify(value); - raw.push(hexlified); - }); - if (!!signature) { - raw.push(hexlify(signature)); - } - const finalValue = RLP.encode(raw); - return finalValue; -} -/** - * A **Transaction** describes an operation to be executed on - * Core by an Externally Owned Account (EOA). It includes - * who (the [[to]] address), what (the [[data]]) and how much (the - * [[value]] in corebc) the operation should entail. - * - * @example: - * tx = new Transaction() - * //_result: - * - * tx.data = "0x1234"; - * //_result: - */ -export class Transaction { - #to; - #data; - #nonce; - #energyLimit; - #energyPrice; - #value; - #networkId; - #sig; - /** - * The ``to`` address for the transaction or ``null`` if the - * transaction is an ``init`` transaction. - */ - get to() { - return this.#to; - } - set to(value) { - this.#to = value == null ? null : getAddress(value); - } - /** - * The transaction nonce. - */ - get nonce() { - return this.#nonce; - } - set nonce(value) { - this.#nonce = getNumber(value, "value"); - } - /** - * The energy limit. - */ - get energyLimit() { - return this.#energyLimit; - } - set energyLimit(value) { - this.#energyLimit = getBigInt(value); - } - /** - * The energy price. - * - * On legacy networks this defines the fee that will be paid. On - * EIP-1559 networks, this should be ``null``. - */ - get energyPrice() { - const value = this.#energyPrice; - if (value == null) { - return BN_0; - } - return value; - } - set energyPrice(value) { - this.#energyPrice = value == null ? null : getBigInt(value, "energyPrice"); - } - /** - * The transaction data. For ``init`` transactions this is the - * deployment code. - */ - get data() { - return this.#data; - } - set data(value) { - this.#data = hexlify(value); - } - /** - * The amount of xcb (in ore) to send in this transactions. - */ - get value() { - return this.#value; - } - set value(value) { - this.#value = getBigInt(value, "value"); - } - /** - * The chain ID this transaction is valid on. - */ - get networkId() { - return this.#networkId; - } - set networkId(value) { - this.#networkId = getBigInt(value); - } - /** - * If signed, the signature for this transaction. - */ - get signature() { - return this.#sig || null; - } - set signature(value) { - this.#sig = value == null ? null : value; - } - /** - * Creates a new Transaction with default values. - */ - constructor() { - this.#to = null; - this.#nonce = 0; - this.#energyLimit = BigInt(0); - this.#energyPrice = null; - this.#data = "0x"; - this.#value = BigInt(0); - this.#networkId = BigInt(0); - this.#sig = null; - } - /** - * The transaction hash, if signed. Otherwise, ``null``. - */ - get hash() { - if (this.signature == null) { - return null; - } - return sha256(this.serialized); - } - /** - * The pre-image hash of this transaction. - * - * This is the digest that a [[Signer]] must sign to authorize - * this transaction. - */ - get unsignedHash() { - return sha256(this.unsignedSerialized); - } - /** - * The sending address, if signed. Otherwise, ``null``. - */ - get from() { - if (this.signature == null) { - return null; - } - const prefix = networkIdToPrefix(Number(this.#networkId)); - return recoverAddress(this.unsignedHash, this.signature, prefix); - } - /** - * The public key of the sender, if signed. Otherwise, ``null``. - */ - get fromPublicKey() { - if (this.signature == null) { - return null; - } - return SigningKey.recoverPublicKey(this.unsignedHash, this.signature); - } - /** - * Returns true if signed. - * - * This provides a Type Guard that properties requiring a signed - * transaction are non-null. - */ - isSigned() { - //isSigned(): this is SignedTransaction { - return this.signature != null; - } - /** - * The serialized transaction. - * - * This throws if the transaction is unsigned. For the pre-image, - * use [[unsignedSerialized]]. - */ - get serialized() { - assert(this.signature != null, "cannot serialize unsigned transaction; maybe you meant .unsignedSerialized", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); - return serialize(this, this.signature); - } - /** - * The transaction pre-image. - * - * The hash of this is the digest which needs to be signed to - * authorize this transaction. - */ - get unsignedSerialized() { - return serialize(this); - } - /** - * Create a copy of this transaciton. - */ - clone() { - return Transaction.from(this); - } - /** - * Return a JSON-friendly object. - */ - toJSON() { - const s = (v) => { - if (v == null) { - return null; - } - return v.toString(); - }; - return { - to: this.to, - data: this.data, - nonce: this.nonce, - energyLimit: s(this.energyLimit), - energyPrice: s(this.energyPrice), - value: s(this.value), - networkId: s(this.networkId), - sig: this.signature ? this.signature : null, - }; - } - /** - * Create a **Transaction** from a serialized transaction or a - * Transaction-like object. - */ - static from(tx) { - if (tx == null) { - return new Transaction(); - } - if (typeof tx === "string") { - const payload = getBytes(tx); - return Transaction.from(parse(payload)); - } - const result = new Transaction(); - if (tx.to != null) { - result.to = tx.to; - } - if (tx.nonce != null) { - result.nonce = tx.nonce; - } - if (tx.energyLimit != null) { - result.energyLimit = tx.energyLimit; - } - if (tx.energyPrice != null) { - result.energyPrice = tx.energyPrice; - } - if (tx.data != null) { - result.data = tx.data; - } - if (tx.value != null) { - result.value = tx.value; - } - if (tx.networkId != null) { - result.networkId = tx.networkId; - } - if (tx.signature != null) { - result.signature = tx.signature; - } - if (tx.hash != null) { - assertArgument(result.isSigned(), "unsigned transaction cannot define hash", "tx", tx); - assertArgument(result.hash === tx.hash, "hash mismatch", "tx", tx); - } - if (tx.from != null) { - assertArgument(result.isSigned(), "unsigned transaction cannot define from", "tx", tx); - assertArgument(result.from.toLowerCase() === (tx.from || "").toLowerCase(), "from mismatch", "tx", tx); - } - return result; - } -} -//# sourceMappingURL=transaction.js.map \ No newline at end of file diff --git a/lib.esm/transaction/transaction.js.map b/lib.esm/transaction/transaction.js.map deleted file mode 100644 index 1bb4188ba..000000000 --- a/lib.esm/transaction/transaction.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src.ts/transaction/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAa,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EACL,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,EACP,MAAM,EACN,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI9C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAe,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAE/C,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAqDvB,SAAS,aAAa,CAAC,KAAa;IAClC,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC;AAED,SAAS,KAAK,CAAC,IAAe;IAC5B,MAAM,YAAY,GAAG,CAAC,KAAa,EAAa,EAAE;QAChD,aAAa;QACb,IAAI,KAAK,KAAK,IAAI,EAAE;YAClB,OAAO,SAAS,C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M,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC;SACjC;QAED,IAAI,EAAE,CAAC,IAAI,IAAI,IAAI,EAAE;YACnB,cAAc,CACZ,MAAM,CAAC,QAAQ,EAAE,EACjB,yCAAyC,EACzC,IAAI,EACJ,EAAE,CACH,CAAC;YACF,cAAc,CAAC,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;SACpE;QAED,IAAI,EAAE,CAAC,IAAI,IAAI,IAAI,EAAE;YACnB,cAAc,CACZ,MAAM,CAAC,QAAQ,EAAE,EACjB,yCAAyC,EACzC,IAAI,EACJ,EAAE,CACH,CAAC;YACF,cAAc,CACZ,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,EAC3D,eAAe,EACf,IAAI,EACJ,EAAE,CACH,CAAC;SACH;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/utils/base58.d.ts b/lib.esm/utils/base58.d.ts deleted file mode 100644 index 8b377936b..000000000 --- a/lib.esm/utils/base58.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * The [Base58 Encoding](link-base58) scheme allows a **numeric** value - * to be encoded as a compact string using a radix of 58 using only - * alpha-numeric characters. Confusingly similar characters are omitted - * (i.e. ``"l0O"``). - * - * Note that Base58 encodes a **numeric** value, not arbitrary bytes, - * since any zero-bytes on the left would get removed. To mitigate this - * issue most schemes that use Base58 choose specific high-order values - * to ensure non-zero prefixes. - * - * @_subsection: api/utils:Base58 Encoding [about-base58] - */ -import type { BytesLike } from "./index.js"; -/** - * Encode %%value%% as a Base58-encoded string. - */ -export declare function encodeBase58(_value: BytesLike): string; -/** - * Decode the Base58-encoded %%value%%. - */ -export declare function decodeBase58(value: string): bigint; -//# sourceMappingURL=base58.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/base58.d.ts.map b/lib.esm/utils/base58.d.ts.map deleted file mode 100644 index 21386c9f3..000000000 --- a/lib.esm/utils/base58.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base58.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base58.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAoB5C;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAQtD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOlD"} \ No newline at end of file diff --git a/lib.esm/utils/base58.js b/lib.esm/utils/base58.js deleted file mode 100644 index 3d68086b6..000000000 --- a/lib.esm/utils/base58.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * The [Base58 Encoding](link-base58) scheme allows a **numeric** value - * to be encoded as a compact string using a radix of 58 using only - * alpha-numeric characters. Confusingly similar characters are omitted - * (i.e. ``"l0O"``). - * - * Note that Base58 encodes a **numeric** value, not arbitrary bytes, - * since any zero-bytes on the left would get removed. To mitigate this - * issue most schemes that use Base58 choose specific high-order values - * to ensure non-zero prefixes. - * - * @_subsection: api/utils:Base58 Encoding [about-base58] - */ -import { getBytes } from "./data.js"; -import { assertArgument } from "./errors.js"; -import { toBigInt } from "./maths.js"; -const Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; -let Lookup = null; -function getAlpha(letter) { - if (Lookup == null) { - Lookup = {}; - for (let i = 0; i < Alphabet.length; i++) { - Lookup[Alphabet[i]] = BigInt(i); - } - } - const result = Lookup[letter]; - assertArgument(result != null, `invalid base58 value`, "letter", letter); - return result; -} -const BN_0 = BigInt(0); -const BN_58 = BigInt(58); -/** - * Encode %%value%% as a Base58-encoded string. - */ -export function encodeBase58(_value) { - let value = toBigInt(getBytes(_value)); - let result = ""; - while (value) { - result = Alphabet[Number(value % BN_58)] + result; - value /= BN_58; - } - return result; -} -/** - * Decode the Base58-encoded %%value%%. - */ -export function decodeBase58(value) { - let result = BN_0; - for (let i = 0; i < value.length; i++) { - result *= BN_58; - result += getAlpha(value[i]); - } - return result; -} -//# sourceMappingURL=base58.js.map \ No newline at end of file diff --git a/lib.esm/utils/base58.js.map b/lib.esm/utils/base58.js.map deleted file mode 100644 index 902b9c1a1..000000000 --- a/lib.esm/utils/base58.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base58.js","sourceRoot":"","sources":["../../src.ts/utils/base58.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,MAAM,QAAQ,GAAG,4DAA4D,CAAC;AAC9E,IAAI,MAAM,GAAkC,IAAI,CAAC;AAEjD,SAAS,QAAQ,CAAC,MAAc;IAC9B,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,MAAM,GAAG,EAAE,CAAC;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;SACjC;KACF;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9B,cAAc,CAAC,MAAM,IAAI,IAAI,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAiB;IAC5C,IAAI,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACvC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,KAAK,EAAE;QACZ,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC;QAClD,KAAK,IAAI,KAAK,CAAC;KAChB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,IAAI,KAAK,CAAC;QAChB,MAAM,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;KAC9B;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/base64-browser.d.ts b/lib.esm/utils/base64-browser.d.ts deleted file mode 100644 index ea96c442c..000000000 --- a/lib.esm/utils/base64-browser.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { BytesLike } from "./data.js"; -export declare function decodeBase64(textData: string): Uint8Array; -export declare function encodeBase64(_data: BytesLike): string; -//# sourceMappingURL=base64-browser.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/base64-browser.d.ts.map b/lib.esm/utils/base64-browser.d.ts.map deleted file mode 100644 index 83a734cd1..000000000 --- a/lib.esm/utils/base64-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base64-browser.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base64-browser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAOzD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAOrD"} \ No newline at end of file diff --git a/lib.esm/utils/base64-browser.js b/lib.esm/utils/base64-browser.js deleted file mode 100644 index b9b98a35c..000000000 --- a/lib.esm/utils/base64-browser.js +++ /dev/null @@ -1,19 +0,0 @@ -// utils/base64-browser -import { getBytes } from "./data.js"; -export function decodeBase64(textData) { - textData = atob(textData); - const data = new Uint8Array(textData.length); - for (let i = 0; i < textData.length; i++) { - data[i] = textData.charCodeAt(i); - } - return getBytes(data); -} -export function encodeBase64(_data) { - const data = getBytes(_data); - let textData = ""; - for (let i = 0; i < data.length; i++) { - textData += String.fromCharCode(data[i]); - } - return btoa(textData); -} -//# sourceMappingURL=base64-browser.js.map \ No newline at end of file diff --git a/lib.esm/utils/base64-browser.js.map b/lib.esm/utils/base64-browser.js.map deleted file mode 100644 index 97d3b6382..000000000 --- a/lib.esm/utils/base64-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base64-browser.js","sourceRoot":"","sources":["../../src.ts/utils/base64-browser.ts"],"names":[],"mappings":"AAAA,uBAAuB;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAIrC,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,IAAI,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KAClC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAgB;IAC3C,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,QAAQ,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1C;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC;AACxB,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/base64.d.ts b/lib.esm/utils/base64.d.ts deleted file mode 100644 index 0cab53288..000000000 --- a/lib.esm/utils/base64.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { BytesLike } from "./data.js"; -/** - * Decodes the base-64 encoded %%value%%. - * - * @example: - * // The decoded value is always binary data... - * result = decodeBase64("SGVsbG8gV29ybGQhIQ==") - * //_result: - * - * // ...use toUtf8String to convert it to a string. - * toUtf8String(result) - * //_result: - * - * // Decoding binary data - * decodeBase64("EjQ=") - * //_result: - */ -export declare function decodeBase64(value: string): Uint8Array; -/** - * Encodes %%data%% as a base-64 encoded string. - * - * @example: - * // Encoding binary data as a hexstring - * encodeBase64("0x1234") - * //_result: - * - * // Encoding binary data as a Uint8Array - * encodeBase64(new Uint8Array([ 0x12, 0x34 ])) - * //_result: - * - * // The input MUST be data... - * encodeBase64("Hello World!!") - * //_error: - * - * // ...use toUtf8Bytes for this. - * encodeBase64(toUtf8Bytes("Hello World!!")) - * //_result: - */ -export declare function encodeBase64(data: BytesLike): string; -//# sourceMappingURL=base64.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/base64.d.ts.map b/lib.esm/utils/base64.d.ts.map deleted file mode 100644 index 34656262c..000000000 --- a/lib.esm/utils/base64.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base64.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAEtD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAEpD"} \ No newline at end of file diff --git a/lib.esm/utils/base64.js b/lib.esm/utils/base64.js deleted file mode 100644 index ac07c084e..000000000 --- a/lib.esm/utils/base64.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * [Base64 encoding](link-wiki-base64) using 6-bit words to encode - * arbitrary bytes into a string using 65 printable symbols, the - * upper-case and lower-case alphabet, the digits ``0`` through ``9``, - * ``"+"`` and ``"/"`` with the ``"="`` used for padding. - * - * @_subsection: api/utils:Base64 Encoding [about-base64] - */ -import { getBytes, getBytesCopy } from "./data.js"; -/** - * Decodes the base-64 encoded %%value%%. - * - * @example: - * // The decoded value is always binary data... - * result = decodeBase64("SGVsbG8gV29ybGQhIQ==") - * //_result: - * - * // ...use toUtf8String to convert it to a string. - * toUtf8String(result) - * //_result: - * - * // Decoding binary data - * decodeBase64("EjQ=") - * //_result: - */ -export function decodeBase64(value) { - return getBytesCopy(Buffer.from(value, "base64")); -} -/** - * Encodes %%data%% as a base-64 encoded string. - * - * @example: - * // Encoding binary data as a hexstring - * encodeBase64("0x1234") - * //_result: - * - * // Encoding binary data as a Uint8Array - * encodeBase64(new Uint8Array([ 0x12, 0x34 ])) - * //_result: - * - * // The input MUST be data... - * encodeBase64("Hello World!!") - * //_error: - * - * // ...use toUtf8Bytes for this. - * encodeBase64(toUtf8Bytes("Hello World!!")) - * //_result: - */ -export function encodeBase64(data) { - return Buffer.from(getBytes(data)).toString("base64"); -} -//# sourceMappingURL=base64.js.map \ No newline at end of file diff --git a/lib.esm/utils/base64.js.map b/lib.esm/utils/base64.js.map deleted file mode 100644 index ef3938faf..000000000 --- a/lib.esm/utils/base64.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src.ts/utils/base64.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAInD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,YAAY,CAAC,IAAe;IAC1C,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACxD,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/data.d.ts b/lib.esm/utils/data.d.ts deleted file mode 100644 index 59cca6eba..000000000 --- a/lib.esm/utils/data.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/** - * A [[HexString]] whose length is even, which ensures it is a valid - * representation of binary data. - */ -export type DataHexString = string; -/** - * A string which is prefixed with ``0x`` and followed by any number - * of case-agnostic hexadecimal characters. - * - * It must match the regular expression ``/0x[0-9A-Fa-f]*\/``. - */ -export type HexString = string; -/** - * An object that can be used to represent binary data. - */ -export type Bytes = ArrayLike; -export type BytesLike = Bytes | string; -export type DataOptions = { - allowMissingPrefix?: boolean; - hexPad?: "left" | "right" | null; -}; -export interface Hexable { - toHexString(): string; -} -export declare function isBytes(value: any): value is Bytes; -/** - * Get a typed Uint8Array for %%value%%. If already a Uint8Array - * the original %%value%% is returned; if a copy is required use - * [[getBytesCopy]]. - * - * @see: getBytesCopy - */ -export declare function getBytes(value: BytesLike, name?: string): Uint8Array; -/** - * Get a typed Uint8Array for %%value%%, creating a copy if necessary - * to prevent any modifications of the returned value from being - * reflected elsewhere. - * - * @see: getBytes - */ -export declare function getBytesCopy(value: BytesLike, name?: string): Uint8Array; -/** - * Returns true if %%value%% is a valid [[HexString]]. - * - * If %%length%% is ``true`` or a //number//, it also checks that - * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) - * bytes of data (e.g. ``0x1234`` is 2 bytes). - */ -export declare function isHexString(value: any, length?: number | boolean): value is `0x${string}`; -/** - * Returns true if %%value%% is a valid representation of arbitrary - * data (i.e. a valid [[DataHexString]] or a Uint8Array). - */ -export declare function isBytesLike(value: any): value is BytesLike; -/** - * Returns a [[DataHexString]] representation of %%data%%. - */ -export declare function hexlify(value: BytesLike | Hexable | number | bigint, options?: DataOptions): string; -/** - * Returns a [[DataHexString]] by concatenating all values - * within %%data%%. - */ -export declare function concat(items: ReadonlyArray): string; -export declare function hexDataSlice(data: BytesLike, offset: number, endOffset?: number): string; -export declare function hexDataLength(data: BytesLike): number | null; -/** - * Returns the length of %%data%%, in bytes. - */ -export declare function dataLength(data: BytesLike): number; -/** - * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% - * offset to the %%end%% offset. - * - * By default %%start%% is 0 and %%end%% is the length of %%data%%. - */ -export declare function dataSlice(data: BytesLike, start?: number, end?: number): string; -/** - * Return the [[DataHexString]] result by stripping all **leading** - ** zero bytes from %%data%%. - */ -export declare function stripZerosLeft(data: BytesLike): string; -/** - * Return the [[DataHexString]] of %%data%% padded on the **left** - * to %%length%% bytes. - * - * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is - * thrown. - * - * This pads data the same as **values** are in Solidity - * (e.g. ``uint128``). - */ -export declare function zeroPadValue(data: BytesLike, length: number): string; -/** - * Return the [[DataHexString]] of %%data%% padded on the **right** - * to %%length%% bytes. - * - * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is - * thrown. - * - * This pads data the same as **bytes** are in Solidity - * (e.g. ``bytes16``). - */ -export declare function zeroPadBytes(data: BytesLike, length: number): string; -export declare function stripZeros(value: BytesLike): Uint8Array; -export declare function arrayify(value: BytesLike | Hexable | number, options?: DataOptions): Uint8Array; -export declare function hexConcat(items: ReadonlyArray): string; -//# sourceMappingURL=data.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/data.d.ts.map b/lib.esm/utils/data.d.ts.map deleted file mode 100644 index b82bf731e..000000000 --- a/lib.esm/utils/data.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src.ts/utils/data.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAEtC,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvC,MAAM,MAAM,WAAW,GAAG;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CAClC,CAAC;AACF,MAAM,WAAW,OAAO;IACtB,WAAW,IAAI,MAAM,CAAC;CACvB;AASD,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,KAAK,CAsBlD;AA2BD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAEpE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAExE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,GAAG,EACV,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GACxB,KAAK,IAAI,KAAK,MAAM,EAAE,CAaxB;AAED;;;GAGG;AACH,wBAAgB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No newline at end of file diff --git a/lib.esm/utils/data.js b/lib.esm/utils/data.js deleted file mode 100644 index f53e97149..000000000 --- a/lib.esm/utils/data.js +++ /dev/null @@ -1,366 +0,0 @@ -/** - * Some data helpers. - * - * - * @_subsection api/utils:Data Helpers [about-data] - */ -import { Logger } from "../logger/logger.js"; -import { assert, assertArgument } from "./errors.js"; -const logger = new Logger("utils/data/0.0.1"); -function isHexable(value) { - return !!value.toHexString; -} -function isInteger(value) { - return typeof value === "number" && value == value && value % 1 === 0; -} -export function isBytes(value) { - if (value == null) { - return false; - } - if (value.constructor === Uint8Array) { - return true; - } - if (typeof value === "string") { - return false; - } - if (!isInteger(value.length) || value.length < 0) { - return false; - } - for (let i = 0; i < value.length; i++) { - const v = value[i]; - if (!isInteger(v) || v < 0 || v >= 256) { - return false; - } - } - return true; -} -function _getBytes(value, name, copy) { - if (value instanceof Uint8Array) { - if (copy) { - return new Uint8Array(value); - } - return value; - } - if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) { - const result = new Uint8Array((value.length - 2) / 2); - let offset = 2; - for (let i = 0; i < result.length; i++) { - result[i] = parseInt(value.substring(offset, offset + 2), 16); - offset += 2; - } - return result; - } - assertArgument(false, "invalid BytesLike value", name || "value", value); -} -/** - * Get a typed Uint8Array for %%value%%. If already a Uint8Array - * the original %%value%% is returned; if a copy is required use - * [[getBytesCopy]]. - * - * @see: getBytesCopy - */ -export function getBytes(value, name) { - return _getBytes(value, name, false); -} -/** - * Get a typed Uint8Array for %%value%%, creating a copy if necessary - * to prevent any modifications of the returned value from being - * reflected elsewhere. - * - * @see: getBytes - */ -export function getBytesCopy(value, name) { - return _getBytes(value, name, true); -} -/** - * Returns true if %%value%% is a valid [[HexString]]. - * - * If %%length%% is ``true`` or a //number//, it also checks that - * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) - * bytes of data (e.g. ``0x1234`` is 2 bytes). - */ -export function isHexString(value, length) { - if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { - return false; - } - if (typeof length === "number" && value.length !== 2 + 2 * length) { - return false; - } - if (length === true && value.length % 2 !== 0) { - return false; - } - return true; -} -/** - * Returns true if %%value%% is a valid representation of arbitrary - * data (i.e. a valid [[DataHexString]] or a Uint8Array). - */ -export function isBytesLike(value) { - return isHexString(value, true) || value instanceof Uint8Array; -} -const HexCharacters = "0123456789abcdef"; -/** - * Returns a [[DataHexString]] representation of %%data%%. - */ -export function hexlify(value, options) { - if (!options) { - options = {}; - } - if (typeof value === "string") { - if (value.includes(",") && value.startsWith("0x")) { - const v = value - .replace("0x", "") - .split(",") - .map((item) => Number(item)); - // @ts-ignore - value = new Uint8Array(v); - } - } - if (typeof value === "number") { - logger.checkSafeUint53(value, "invalid hexlify value"); - let hex = ""; - while (value) { - hex = HexCharacters[value & 0xf] + hex; - value = Math.floor(value / 16); - } - if (hex.length) { - if (hex.length % 2) { - hex = "0" + hex; - } - return "0x" + hex; - } - return "0x00"; - } - if (typeof value === "bigint") { - value = value.toString(16); - if (value.length % 2) { - return "0x0" + value; - } - return "0x" + value; - } - if (options.allowMissingPrefix && - typeof value === "string" && - value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - if (isHexable(value)) { - return value.toHexString(); - } - if (isHexString(value)) { - if (value.length % 2) { - if (options.hexPad === "left") { - value = "0x0" + value.substring(2); - } - else if (options.hexPad === "right") { - value += "0"; - } - else { - logger.throwArgumentError("hex data is odd-length", "value", value); - } - } - return value.toLowerCase(); - } - if (isBytes(value)) { - let result = "0x"; - for (let i = 0; i < value.length; i++) { - let v = value[i]; - result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; - } - return result; - } - return logger.throwArgumentError("invalid hexlify value", "value", value); -} -/** - * Returns a [[DataHexString]] by concatenating all values - * within %%data%%. - */ -export function concat(items) { - return "0x" + items.map((d) => hexlify(d).substring(2)).join(""); -} -export function hexDataSlice(data, offset, endOffset) { - if (typeof data !== "string") { - data = hexlify(data); - } - else if (!isHexString(data) || data.length % 2) { - logger.throwArgumentError("invalid hexData", "value", data); - } - offset = 2 + 2 * offset; - if (endOffset != null) { - return "0x" + data.substring(offset, 2 + 2 * endOffset); - } - return "0x" + data.substring(offset); -} -export function hexDataLength(data) { - if (typeof data !== "string") { - data = hexlify(data); - } - else if (!isHexString(data) || data.length % 2) { - return null; - } - return (data.length - 2) / 2; -} -/** - * Returns the length of %%data%%, in bytes. - */ -export function dataLength(data) { - if (isHexString(data, true)) { - return (data.length - 2) / 2; - } - return getBytes(data).length; -} -/** - * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% - * offset to the %%end%% offset. - * - * By default %%start%% is 0 and %%end%% is the length of %%data%%. - */ -export function dataSlice(data, start, end) { - const bytes = getBytes(data); - if (end != null && end > bytes.length) { - assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { - buffer: bytes, - length: bytes.length, - offset: end, - }); - } - return hexlify(bytes.slice(start == null ? 0 : start, end == null ? bytes.length : end)); -} -/** - * Return the [[DataHexString]] result by stripping all **leading** - ** zero bytes from %%data%%. - */ -export function stripZerosLeft(data) { - let bytes = hexlify(data).substring(2); - while (bytes.startsWith("00")) { - bytes = bytes.substring(2); - } - return "0x" + bytes; -} -function zeroPad(data, length, left) { - const bytes = getBytes(data); - assert(length >= bytes.length, "padding exceeds data length", "BUFFER_OVERRUN", { - buffer: new Uint8Array(bytes), - length: length, - offset: length + 1, - }); - const result = new Uint8Array(length); - result.fill(0); - if (left) { - result.set(bytes, length - bytes.length); - } - else { - result.set(bytes, 0); - } - return hexlify(result); -} -/** - * Return the [[DataHexString]] of %%data%% padded on the **left** - * to %%length%% bytes. - * - * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is - * thrown. - * - * This pads data the same as **values** are in Solidity - * (e.g. ``uint128``). - */ -export function zeroPadValue(data, length) { - return zeroPad(data, length, true); -} -/** - * Return the [[DataHexString]] of %%data%% padded on the **right** - * to %%length%% bytes. - * - * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is - * thrown. - * - * This pads data the same as **bytes** are in Solidity - * (e.g. ``bytes16``). - */ -export function zeroPadBytes(data, length) { - return zeroPad(data, length, false); -} -export function stripZeros(value) { - let result = arrayify(value); - if (result.length === 0) { - return result; - } - // Find the first non-zero entry - let start = 0; - while (start < result.length && result[start] === 0) { - start++; - } - // If we started with zeros, strip them - if (start) { - result = result.slice(start); - } - return result; -} -export function arrayify(value, options) { - if (!options) { - options = {}; - } - if (typeof value === "number") { - logger.checkSafeUint53(value, "invalid arrayify value"); - const result = []; - while (value) { - // @ts-ignore - result.unshift(value & 0xff); - value = parseInt(String(value / 256)); - } - if (result.length === 0) { - result.push(0); - } - return addSlice(new Uint8Array(result)); - } - if (options.allowMissingPrefix && - typeof value === "string" && - value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - if (isHexable(value)) { - value = value.toHexString(); - } - if (isHexString(value)) { - let hex = value.substring(2); - if (hex.length % 2) { - if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); - } - else if (options.hexPad === "right") { - hex += "0"; - } - else { - logger.throwArgumentError("hex data is odd-length", "value", value); - } - } - const result = []; - for (let i = 0; i < hex.length; i += 2) { - // @ts-ignore - result.push(parseInt(hex.substring(i, i + 2), 16)); - } - return addSlice(new Uint8Array(result)); - } - if (isBytes(value)) { - return addSlice(new Uint8Array(value)); - } - return logger.throwArgumentError("invalid arrayify value", "value", value); -} -function addSlice(array) { - // @ts-ignore - if (array.slice) { - return array; - } - array.slice = function () { - const args = Array.prototype.slice.call(arguments); - return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args))); - }; - return array; -} -export function hexConcat(items) { - let result = "0x"; - items.forEach((item) => { - result += hexlify(item).substring(2); - }); - return result; -} -//# sourceMappingURL=data.js.map \ No newline at end of file diff --git a/lib.esm/utils/data.js.map b/lib.esm/utils/data.js.map deleted file mode 100644 index 10c3eb703..000000000 --- a/lib.esm/utils/data.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"data.js","sour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,QAAQ,CAAC,KAAiB;IACjC,aAAa;IACb,IAAI,KAAK,CAAC,KAAK,EAAE;QACf,OAAO,KAAK,CAAC;KACd;IAED,KAAK,CAAC,KAAK,GAAG;QACZ,MAAM,IAAI,GAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxD,OAAO,QAAQ,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5E,CAAC,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAA+B;IACvD,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/errors.d.ts b/lib.esm/utils/errors.d.ts deleted file mode 100644 index 130aa0621..000000000 --- a/lib.esm/utils/errors.d.ts +++ /dev/null @@ -1,486 +0,0 @@ -/** - * About Errors. - * - * @_section: api/utils/errors:Errors [about-errors] - */ -import type { TransactionRequest, TransactionReceipt, TransactionResponse } from "../providers/index.js"; -import type { FetchRequest, FetchResponse } from "./fetch.js"; -export type ErrorInfo = Omit; -/** - * All errors emitted by corebc have an **ErrorCode** to help - * identify and coalesce errors to simplfy programatic analysis. - * - * Each **ErrorCode** is the %%code%% proerty of a coresponding - * [[corebcError]]. - * - * **Generic Errors** - * - * **``"UNKNOWN_ERROR"``** - see [[UnknownError]] - * - * **``"NOT_IMPLEMENTED"``** - see [[NotImplementedError]] - * - * **``"UNSUPPORTED_OPERATION"``** - see [[UnsupportedOperationError]] - * - * **``"NETWORK_ERROR"``** - see [[NetworkError]] - * - * **``"SERVER_ERROR"``** - see [[ServerError]] - * - * **``"TIMEOUT"``** - see [[TimeoutError]] - * - * **``"BAD_DATA"``** - see [[BadDataError]] - * - * **``"CANCELLED"``** - see [[CancelledError]] - * - * **Operational Errors** - * - * **``"BUFFER_OVERRUN"``** - see [[BufferOverrunError]] - * - * **``"NUMERIC_FAULT"``** - see [[NumericFaultError]] - * - * **Argument Errors** - * - * **``"INVALID_ARGUMENT"``** - see [[InvalidArgumentError]] - * - * **``"MISSING_ARGUMENT"``** - see [[MissingArgumentError]] - * - * **``"UNEXPECTED_ARGUMENT"``** - see [[UnexpectedArgumentError]] - * - * **``"VALUE_MISMATCH"``** - //unused// - * - * **Blockchain Errors** - * - * **``"CALL_EXCEPTION"``** - see [[CallExceptionError]] - * - * **``"INSUFFICIENT_FUNDS"``** - see [[InsufficientFundsError]] - * - * **``"NONCE_EXPIRED"``** - see [[NonceExpiredError]] - * - * **``"REPLACEMENT_UNDERPRICED"``** - see [[ReplacementUnderpricedError]] - * - * **``"TRANSACTION_REPLACED"``** - see [[TransactionReplacedError]] - * - * **``"UNCONFIGURED_NAME"``** - see [[UnconfiguredNameError]] - * - * **``"OFFCHAIN_FAULT"``** - see [[OffchainFaultError]] - * - * **User Interaction Errors** - * - * **``"ACTION_REJECTED"``** - see [[ActionRejectedError]] - */ -export type ErrorCode = "UNKNOWN_ERROR" | "NOT_IMPLEMENTED" | "UNSUPPORTED_OPERATION" | "NETWORK_ERROR" | "SERVER_ERROR" | "TIMEOUT" | "BAD_DATA" | "CANCELLED" | "BUFFER_OVERRUN" | "NUMERIC_FAULT" | "INVALID_ARGUMENT" | "MISSING_ARGUMENT" | "UNEXPECTED_ARGUMENT" | "VALUE_MISMATCH" | "CALL_EXCEPTION" | "INSUFFICIENT_FUNDS" | "NONCE_EXPIRED" | "REPLACEMENT_UNDERPRICED" | "TRANSACTION_REPLACED" | "UNCONFIGURED_NAME" | "OFFCHAIN_FAULT" | "ACTION_REJECTED"; -/** - * All errors in corebc include properties to assist in - * machine-readable errors. - */ -export interface CoreBCError extends Error { - /** - * The string error code. - */ - code: ErrorCode; - /** - * Additional info regarding the error that may be useful. - * - * This is generally helpful mostly for human-based debugging. - */ - info?: Record; - /** - * Any related error. - */ - error?: Error; -} -/** - * This Error is a catch-all for when there is no way for corebc to - * know what the underlying problem is. - */ -export interface UnknownError extends CoreBCError<"UNKNOWN_ERROR"> { - [key: string]: any; -} -/** - * This Error is mostly used as a stub for functionality that is - * intended for the future, but is currently not implemented. - */ -export interface NotImplementedError extends CoreBCError<"NOT_IMPLEMENTED"> { - /** - * The attempted operation. - */ - operation: string; -} -/** - * This Error indicates that the attempted operation is not supported. - * - * This could range from a specifc JSON-RPC end-point not supporting - * a feature to a specific configuration of an object prohibiting the - * operation. - * - * For example, a [[Wallet]] with no connected [[Provider]] is unable - * to send a transaction. - */ -export interface UnsupportedOperationError extends CoreBCError<"UNSUPPORTED_OPERATION"> { - /** - * The attempted operation. - */ - operation: string; -} -export interface NetworkError extends CoreBCError<"NETWORK_ERROR"> { - event: string; -} -/** - * This Error indicates there was a problem fetching a resource from - * a server. - */ -export interface ServerError extends CoreBCError<"SERVER_ERROR"> { - /** - * The requested resource. - */ - request: FetchRequest | string; - /** - * The response received from the server, if available. - */ - response?: FetchResponse; -} -/** - * This Error indicates that the timeout duration has expired and - * that the operation has been implicitly cancelled. - * - * The side-effect of the operation may still occur, as this - * generally means a request has been sent and there has simply - * been no response to indicate whether it was processed or not. - */ -export interface TimeoutError extends CoreBCError<"TIMEOUT"> { - /** - * The attempted operation. - */ - operation: string; - /** - * The reason. - */ - reason: string; - /** - * The resource request, if available. - */ - request?: FetchRequest; -} -/** - * This Error indicates that a provided set of data cannot - * be correctly interpretted. - */ -export interface BadDataError extends CoreBCError<"BAD_DATA"> { - /** - * The data. - */ - value: any; -} -/** - * This Error indicates that the operation was cancelled by a - * programmatic call, for example to ``cancel()``. - */ -export interface CancelledError extends CoreBCError<"CANCELLED"> { -} -/** - * This Error indicates an attempt was made to read outside the bounds - * of protected data. - * - * Most operations in corebc are protected by bounds checks, to mitigate - * exploits when parsing data. - */ -export interface BufferOverrunError extends CoreBCError<"BUFFER_OVERRUN"> { - /** - * The buffer that was overrun. - */ - buffer: Uint8Array; - /** - * The length of the buffer. - */ - length: number; - /** - * The offset that was requested. - */ - offset: number; -} -/** - * This Error indicates an operation which would result in incorrect - * arithmetic output has occurred. - * - * For example, trying to divide by zero or using a ``uint8`` to store - * a negative value. - */ -export interface NumericFaultError extends CoreBCError<"NUMERIC_FAULT"> { - /** - * The attempted operation. - */ - operation: string; - /** - * The fault reported. - */ - fault: string; - /** - * The value the operation was attempted against. - */ - value: any; -} -/** - * This Error indicates an incorrect type or value was passed to - * a function or method. - */ -export interface InvalidArgumentError extends CoreBCError<"INVALID_ARGUMENT"> { - /** - * The name of the argument. - */ - argument: string; - /** - * The value that was provided. - */ - value: any; - info?: Record; -} -/** - * This Error indicates there were too few arguments were provided. - */ -export interface MissingArgumentError extends CoreBCError<"MISSING_ARGUMENT"> { - /** - * The number of arguments received. - */ - count: number; - /** - * The number of arguments expected. - */ - expectedCount: number; -} -/** - * This Error indicates too many arguments were provided. - */ -export interface UnexpectedArgumentError extends CoreBCError<"UNEXPECTED_ARGUMENT"> { - /** - * The number of arguments received. - */ - count: number; - /** - * The number of arguments expected. - */ - expectedCount: number; -} -/** - * The action that resulted in the error. - */ -export type CallExceptionAction = "call" | "estimateEnergy" | "getTransactionResult" | "unknown"; -/** - * The related transaction that caused the error. - */ -export type CallExceptionTransaction = { - to: null | string; - from?: string; - data: string; -}; -/** - * This **Error** indicates a transaction reverted. - */ -export interface CallExceptionError extends CoreBCError<"CALL_EXCEPTION"> { - /** - * The action being performed when the revert was encountered. - */ - action: CallExceptionAction; - /** - * The revert data returned. - */ - data: null | string; - /** - * A human-readable representation of data, if possible. - */ - reason: null | string; - /** - * The transaction that triggered the exception. - */ - transaction: CallExceptionTransaction; - /** - * The contract invocation details, if available. - */ - invocation: null | { - method: string; - signature: string; - args: Array; - }; - /** - * The built-in or custom revert error, if available - */ - revert: null | { - signature: string; - name: string; - args: Array; - }; -} -/** - * The sending account has insufficient funds to cover the - * entire transaction cost. - */ -export interface InsufficientFundsError extends CoreBCError<"INSUFFICIENT_FUNDS"> { - /** - * The transaction. - */ - transaction: TransactionRequest; -} -/** - * The sending account has already used this nonce in a - * transaction that has been included. - */ -export interface NonceExpiredError extends CoreBCError<"NONCE_EXPIRED"> { - /** - * The transaction. - */ - transaction: TransactionRequest; -} -/** - * A CCIP-read exception, which cannot be recovered from or - * be further processed. - */ -export interface OffchainFaultError extends CoreBCError<"OFFCHAIN_FAULT"> { - /** - * The transaction. - */ - transaction?: TransactionRequest; - /** - * The reason the CCIP-read failed. - */ - reason: string; -} -/** - * An attempt was made to replace a transaction, but with an - * insufficient additional fee to afford evicting the old - * transaction from the memory pool. - */ -export interface ReplacementUnderpricedError extends CoreBCError<"REPLACEMENT_UNDERPRICED"> { - /** - * The transaction. - */ - transaction: TransactionRequest; -} -/** - * A pending transaction was replaced by another. - */ -export interface TransactionReplacedError extends CoreBCError<"TRANSACTION_REPLACED"> { - /** - * If the transaction was cancelled, such that the original - * effects of the transaction cannot be assured. - */ - cancelled: boolean; - /** - * The reason the transaction was replaced. - */ - reason: "repriced" | "cancelled" | "replaced"; - /** - * The hash of the replaced transaction. - */ - hash: string; - /** - * The transaction that replaced the transaction. - */ - replacement: TransactionResponse; - /** - * The receipt of the transaction that replace the transaction. - */ - receipt: TransactionReceipt; -} -/** - * This Error indicates an ENS name was used, but the name has not - * been configured. - * - * This could indicate an ENS name is unowned or that the current - * address being pointed to is the [[ZeroAddress]]. - */ -export interface UnconfiguredNameError extends CoreBCError<"UNCONFIGURED_NAME"> { - /** - * The ENS name that was requested - */ - value: string; -} -/** - * This Error indicates a request was rejected by the user. - * - * In most clients (such as MetaMask), when an operation requires user - * authorization (such as ``signer.sendTransaction``), the client - * presents a dialog box to the user. If the user denies the request - * this error is thrown. - */ -export interface ActionRejectedError extends CoreBCError<"ACTION_REJECTED"> { - /** - * The requested action. - */ - action: "requestAccess" | "sendTransaction" | "signMessage" | "signTransaction" | "signTypedData" | "unknown"; - /** - * The reason the action was rejected. - * - * If there is already a pending request, some clients may indicate - * there is already a ``"pending"`` action. This prevents an app - * from spamming the user. - */ - reason: "expired" | "rejected" | "pending"; -} -/** - * A conditional type that transforms the [[ErrorCode]] T into - * its corebcError type. - * - * @flatworm-skip-docs - */ -export type CodedCoreBCError = T extends "UNKNOWN_ERROR" ? UnknownError : T extends "NOT_IMPLEMENTED" ? NotImplementedError : T extends "UNSUPPORTED_OPERATION" ? UnsupportedOperationError : T extends "NETWORK_ERROR" ? NetworkError : T extends "SERVER_ERROR" ? ServerError : T extends "TIMEOUT" ? TimeoutError : T extends "BAD_DATA" ? BadDataError : T extends "CANCELLED" ? CancelledError : T extends "BUFFER_OVERRUN" ? BufferOverrunError : T extends "NUMERIC_FAULT" ? NumericFaultError : T extends "INVALID_ARGUMENT" ? InvalidArgumentError : T extends "MISSING_ARGUMENT" ? MissingArgumentError : T extends "UNEXPECTED_ARGUMENT" ? UnexpectedArgumentError : T extends "CALL_EXCEPTION" ? CallExceptionError : T extends "INSUFFICIENT_FUNDS" ? InsufficientFundsError : T extends "NONCE_EXPIRED" ? NonceExpiredError : T extends "OFFCHAIN_FAULT" ? OffchainFaultError : T extends "REPLACEMENT_UNDERPRICED" ? ReplacementUnderpricedError : T extends "TRANSACTION_REPLACED" ? TransactionReplacedError : T extends "UNCONFIGURED_NAME" ? UnconfiguredNameError : T extends "ACTION_REJECTED" ? ActionRejectedError : never; -/** - * Returns true if the %%error%% matches an error thrown by corebc - * that matches the error %%code%%. - * - * In TypeScript envornoments, this can be used to check that %%error%% - * matches an corebcError type, which means the expected properties will - * be set. - * - * @See [ErrorCodes](api:ErrorCode) - * @example - * try { - * // code.... - * } catch (e) { - * if (isError(e, "CALL_EXCEPTION")) { - * // The Type Guard has validated this object - * console.log(e.data); - * } - * } - */ -export declare function isError>(error: any, code: K): error is T; -/** - * Returns true if %%error%% is a [[CallExceptionError]. - */ -export declare function isCallException(error: any): error is CallExceptionError; -/** - * Returns a new Error configured to the format corebc emits errors, with - * the %%message%%, [[api:ErrorCode]] %%code%% and additioanl properties - * for the corresponding corebcError. - * - * Each error in corebc includes the version of corebc, a - * machine-readable [[ErrorCode]], and depneding on %%code%%, additional - * required properties. The error message will also include the %%meeage%%, - * corebc version, %%code%% and all aditional properties, serialized. - */ -export declare function makeError>(message: string, code: K, info?: ErrorInfo): T; -/** - * Throws an corebcError with %%message%%, %%code%% and additional error - * %%info%% when %%check%% is falsish.. - * - * @see [[api:makeError]] - */ -export declare function assert>(check: unknown, message: string, code: K, info?: ErrorInfo): asserts check; -/** - * A simple helper to simply ensuring provided arguments match expected - * constraints, throwing if not. - * - * In TypeScript environments, the %%check%% has been asserted true, so - * any further code does not need additional compile-time checks. - */ -export declare function assertArgument(check: unknown, message: string, name: string, value: unknown): asserts check; -export declare function assertArgumentCount(count: number, expectedCount: number, message?: string): void; -/** - * Throws if the normalization %%form%% is not supported. - */ -export declare function assertNormalize(form: string): void; -/** - * Many classes use file-scoped values to guard the constructor, - * making it effectively private. This facilitates that pattern - * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, - * throwing if not, indicating the %%className%% if provided. - */ -export declare function assertPrivate(givenGuard: any, guard: any, className?: string): void; -//# sourceMappingURL=errors.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/errors.d.ts.map b/lib.esm/utils/errors.d.ts.map deleted file mode 100644 index de9bc0ec5..000000000 --- a/lib.esm/utils/errors.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src.ts/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,YAA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end of file diff --git a/lib.esm/utils/errors.js b/lib.esm/utils/errors.js deleted file mode 100644 index 68fee1383..000000000 --- a/lib.esm/utils/errors.js +++ /dev/null @@ -1,215 +0,0 @@ -/** - * About Errors. - * - * @_section: api/utils/errors:Errors [about-errors] - */ -import { version } from "../_version.js"; -import { defineProperties } from "./properties.js"; -function stringify(value) { - if (value == null) { - return "null"; - } - if (Array.isArray(value)) { - return "[ " + value.map(stringify).join(", ") + " ]"; - } - if (value instanceof Uint8Array) { - const HEX = "0123456789abcdef"; - let result = "0x"; - for (let i = 0; i < value.length; i++) { - result += HEX[value[i] >> 4]; - result += HEX[value[i] & 0xf]; - } - return result; - } - if (typeof value === "object" && typeof value.toJSON === "function") { - return stringify(value.toJSON()); - } - switch (typeof value) { - case "boolean": - case "symbol": - return value.toString(); - case "bigint": - return BigInt(value).toString(); - case "number": - return value.toString(); - case "string": - return JSON.stringify(value); - case "object": { - const keys = Object.keys(value); - keys.sort(); - return ("{ " + - keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + - " }"); - } - } - return `[ COULD NOT SERIALIZE ]`; -} -/** - * Returns true if the %%error%% matches an error thrown by corebc - * that matches the error %%code%%. - * - * In TypeScript envornoments, this can be used to check that %%error%% - * matches an corebcError type, which means the expected properties will - * be set. - * - * @See [ErrorCodes](api:ErrorCode) - * @example - * try { - * // code.... - * } catch (e) { - * if (isError(e, "CALL_EXCEPTION")) { - * // The Type Guard has validated this object - * console.log(e.data); - * } - * } - */ -export function isError(error, code) { - return error && error.code === code; -} -/** - * Returns true if %%error%% is a [[CallExceptionError]. - */ -export function isCallException(error) { - return isError(error, "CALL_EXCEPTION"); -} -/** - * Returns a new Error configured to the format corebc emits errors, with - * the %%message%%, [[api:ErrorCode]] %%code%% and additioanl properties - * for the corresponding corebcError. - * - * Each error in corebc includes the version of corebc, a - * machine-readable [[ErrorCode]], and depneding on %%code%%, additional - * required properties. The error message will also include the %%meeage%%, - * corebc version, %%code%% and all aditional properties, serialized. - */ -export function makeError(message, code, info) { - { - const details = []; - if (info) { - if ("message" in info || "code" in info || "name" in info) { - throw new Error(`value will overwrite populated values: ${stringify(info)}`); - } - for (const key in info) { - const value = info[key]; - // try { - details.push(key + "=" + stringify(value)); - // } catch (error: any) { - // console.log("MMM", error.message); - // details.push(key + "=[could not serialize object]"); - // } - } - } - details.push(`code=${code}`); - details.push(`version=${version}`); - if (details.length) { - message += " (" + details.join(", ") + ")"; - } - } - let error; - switch (code) { - case "INVALID_ARGUMENT": - error = new TypeError(message); - break; - case "NUMERIC_FAULT": - case "BUFFER_OVERRUN": - error = new RangeError(message); - break; - default: - error = new Error(message); - } - defineProperties(error, { code }); - if (info) { - Object.assign(error, info); - } - return error; -} -/** - * Throws an corebcError with %%message%%, %%code%% and additional error - * %%info%% when %%check%% is falsish.. - * - * @see [[api:makeError]] - */ -export function assert(check, message, code, info) { - if (!check) { - throw makeError(message, code, info); - } -} -/** - * A simple helper to simply ensuring provided arguments match expected - * constraints, throwing if not. - * - * In TypeScript environments, the %%check%% has been asserted true, so - * any further code does not need additional compile-time checks. - */ -export function assertArgument(check, message, name, value) { - assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); -} -export function assertArgumentCount(count, expectedCount, message) { - if (message == null) { - message = ""; - } - if (message) { - message = ": " + message; - } - assert(count >= expectedCount, "missing arguemnt" + message, "MISSING_ARGUMENT", { - count: count, - expectedCount: expectedCount, - }); - assert(count <= expectedCount, "too many arguemnts" + message, "UNEXPECTED_ARGUMENT", { - count: count, - expectedCount: expectedCount, - }); -} -const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => { - try { - // General test for normalize - /* c8 ignore start */ - if ("test".normalize(form) !== "test") { - throw new Error("bad"); - } - /* c8 ignore stop */ - if (form === "NFD") { - const check = String.fromCharCode(0xe9).normalize("NFD"); - const expected = String.fromCharCode(0x65, 0x0301); - /* c8 ignore start */ - if (check !== expected) { - throw new Error("broken"); - } - /* c8 ignore stop */ - } - accum.push(form); - } - catch (error) { } - return accum; -}, []); -/** - * Throws if the normalization %%form%% is not supported. - */ -export function assertNormalize(form) { - assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", { - operation: "String.prototype.normalize", - info: { form }, - }); -} -/** - * Many classes use file-scoped values to guard the constructor, - * making it effectively private. This facilitates that pattern - * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, - * throwing if not, indicating the %%className%% if provided. - */ -export function assertPrivate(givenGuard, guard, className) { - if (className == null) { - className = ""; - } - if (givenGuard !== guard) { - let method = className, operation = "new"; - if (className) { - method += "."; - operation += " " + className; - } - assert(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", { - operation, - }); - } -} -//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/lib.esm/utils/errors.js.map b/lib.esm/utils/errors.js.map deleted file mode 100644 index 6e25e80da..000000000 --- a/lib.esm/utils/errors.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src.ts/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAYnD,SAAS,SAAS,CAAC,KAAU;IAC3B,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,MAAM,CAAC;KACf;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,OAAO,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;KACtD;IAED,IAAI,KAAK,YAAY,UAAU,EAAE;QAC/B,MAAM,GAAG,GAAG,kBAAkB,CAAC;QAC/B,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,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ACpB,SAAS,GAAG,KAAK,CAAC;QACpB,IAAI,SAAS,EAAE;YACb,MAAM,IAAI,GAAG,CAAC;YACd,SAAS,IAAI,GAAG,GAAG,SAAS,CAAC;SAC9B;QACD,MAAM,CACJ,KAAK,EACL,4BAA4B,MAAM,eAAe,EACjD,uBAAuB,EACvB;YACE,SAAS;SACV,CACF,CAAC;KACH;AACH,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/events.d.ts b/lib.esm/utils/events.d.ts deleted file mode 100644 index 5da088923..000000000 --- a/lib.esm/utils/events.d.ts +++ /dev/null @@ -1,77 +0,0 @@ -/** - * A callback function called when a an event is triggered. - */ -export type Listener = (...args: Array) => void; -/** - * An **EventEmitterable** behaves similar to an EventEmitter - * except provides async access to its methods. - * - * An EventEmitter implements the observer pattern. - */ -export interface EventEmitterable { - /** - * Registers a %%listener%% that is called whenever the - * %%event%% occurs until unregistered. - */ - on(event: T, listener: Listener): Promise; - /** - * Registers a %%listener%% that is called the next time - * %%event%% occurs. - */ - once(event: T, listener: Listener): Promise; - /** - * Triggers each listener for %%event%% with the %%args%%. - */ - emit(event: T, ...args: Array): Promise; - /** - * Resolves to the number of listeners for %%event%%. - */ - listenerCount(event?: T): Promise; - /** - * Resolves to the listeners for %%event%%. - */ - listeners(event?: T): Promise>; - /** - * Unregister the %%listener%% for %%event%%. If %%listener%% - * is unspecified, all listeners are unregistered. - */ - off(event: T, listener?: Listener): Promise; - /** - * Unregister all listeners for %%event%%. - */ - removeAllListeners(event?: T): Promise; - /** - * Alias for [[on]]. - */ - addListener(event: T, listener: Listener): Promise; - /** - * Alias for [[off]]. - */ - removeListener(event: T, listener: Listener): Promise; -} -/** - * When an [[EventEmitterable]] triggers a [[Listener]], the - * callback always ahas one additional argument passed, which is - * an **EventPayload**. - */ -export declare class EventPayload { - #private; - /** - * The event filter. - */ - readonly filter: T; - /** - * The **EventEmitterable**. - */ - readonly emitter: EventEmitterable; - /** - * Create a new **EventPayload** for %%emitter%% with - * the %%listener%% and for %%filter%%. - */ - constructor(emitter: EventEmitterable, listener: null | Listener, filter: T); - /** - * Unregister the triggered listener for future events. - */ - removeListener(): Promise; -} -//# sourceMappingURL=events.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/events.d.ts.map b/lib.esm/utils/events.d.ts.map deleted file mode 100644 index 13c18f4ef..000000000 --- a/lib.esm/utils/events.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src.ts/utils/events.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC;;;OAGG;IACH,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtD;;OAEG;IACH,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1C;;OAEG;IACH,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE/C;;;OAGG;IACH,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;OAEG;IACH,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzD;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED;;;;GAIG;AACH,qBAAa,YAAY,CAAC,CAAC;;IACzB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,CAAC,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAIvC;;;OAGG;gBAED,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAC5B,QAAQ,EAAE,IAAI,GAAG,QAAQ,EACzB,MAAM,EAAE,CAAC;IAMX;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAMtC"} \ No newline at end of file diff --git a/lib.esm/utils/events.js b/lib.esm/utils/events.js deleted file mode 100644 index adace5470..000000000 --- a/lib.esm/utils/events.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Explain events... - * - * @_section api/utils/events:Events [about-events] - */ -import { defineProperties } from "./properties.js"; -/** - * When an [[EventEmitterable]] triggers a [[Listener]], the - * callback always ahas one additional argument passed, which is - * an **EventPayload**. - */ -export class EventPayload { - /** - * The event filter. - */ - filter; - /** - * The **EventEmitterable**. - */ - emitter; - #listener; - /** - * Create a new **EventPayload** for %%emitter%% with - * the %%listener%% and for %%filter%%. - */ - constructor(emitter, listener, filter) { - this.#listener = listener; - defineProperties(this, { emitter, filter }); - } - /** - * Unregister the triggered listener for future events. - */ - async removeListener() { - if (this.#listener == null) { - return; - } - await this.emitter.off(this.filter, this.#listener); - } -} -//# sourceMappingURL=events.js.map \ No newline at end of file diff --git a/lib.esm/utils/events.js.map b/lib.esm/utils/events.js.map deleted file mode 100644 index 77522ecb1..000000000 --- a/lib.esm/utils/events.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src.ts/utils/events.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AA+DnD;;;;GAIG;AACH,MAAM,OAAO,YAAY;IACvB;;OAEG;IACM,MAAM,CAAK;IAEpB;;OAEG;IACM,OAAO,CAAuB;IAE9B,SAAS,CAAkB;IAEpC;;;OAGG;IACH,YACE,OAA4B,EAC5B,QAAyB,EACzB,MAAS;QAET,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,gBAAgB,CAAoB,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc;QAClB,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE;YAC1B,OAAO;SACR;QACD,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/utils/fetch.d.ts b/lib.esm/utils/fetch.d.ts deleted file mode 100644 index 7d226ccc0..000000000 --- a/lib.esm/utils/fetch.d.ts +++ /dev/null @@ -1,327 +0,0 @@ -export type GetUrlResponse = { - statusCode: number; - statusMessage: string; - headers: Record; - body: null | Uint8Array; -}; -export type FetchThrottleParams = { - maxAttempts?: number; - slotInterval?: number; -}; -/** - * Called before any network request, allowing updated headers (e.g. Bearer tokens), etc. - */ -export type FetchPreflightFunc = (req: FetchRequest) => Promise; -/** - * Called on the response, allowing client-based throttling logic or post-processing. - */ -export type FetchProcessFunc = (req: FetchRequest, resp: FetchResponse) => Promise; -/** - * Called prior to each retry; return true to retry, false to abort. - */ -export type FetchRetryFunc = (req: FetchRequest, resp: FetchResponse, attempt: number) => Promise; -/** - * Called on Gateway URLs. - */ -export type FetchGatewayFunc = (url: string, signal?: FetchCancelSignal) => Promise; -/** - * Used to perform a fetch; use this to override the underlying network - * fetch layer. In NodeJS, the default uses the "http" and "https" libraries - * and in the browser ``fetch`` is used. If you wish to use Axios, this is - * how you would register it. - */ -export type FetchGetUrlFunc = (req: FetchRequest, signal?: FetchCancelSignal) => Promise; -/** - * @_ignore - */ -export declare class FetchCancelSignal { - #private; - constructor(request: FetchRequest); - addListener(listener: () => void): void; - get cancelled(): boolean; - checkSignal(): void; -} -/** - * Represents a request for a resource using a URI. - * - * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, - * and ``IPFS:``. - * - * Additional schemes can be added globally using [[registerGateway]]. - * - * @example: - * req = new FetchRequest("https://www.ricmoo.com") - * resp = await req.send() - * resp.body.length - * //_result: - */ -export declare class FetchRequest implements Iterable<[key: string, value: string]> { - #private; - /** - * The fetch URI to requrest. - */ - get url(): string; - set url(url: string); - /** - * The fetch body, if any, to send as the request body. //(default: null)// - * - * When setting a body, the intrinsic ``Content-Type`` is automatically - * set and will be used if **not overridden** by setting a custom - * header. - * - * If %%body%% is null, the body is cleared (along with the - * intrinsic ``Content-Type``) and the . - * - * If %%body%% is a string, the intrincis ``Content-Type`` is set to - * ``text/plain``. - * - * If %%body%% is a Uint8Array, the intrincis ``Content-Type`` is set to - * ``application/octet-stream``. - * - * If %%body%% is any other object, the intrincis ``Content-Type`` is - * set to ``application/json``. - */ - get body(): null | Uint8Array; - set body(body: null | string | Readonly | Readonly); - /** - * Returns true if the request has a body. - */ - hasBody(): this is FetchRequest & { - body: Uint8Array; - }; - /** - * The HTTP method to use when requesting the URI. If no method - * has been explicitly set, then ``GET`` is used if the body is - * null and ``POST`` otherwise. - */ - get method(): string; - set method(method: null | string); - /** - * The headers that will be used when requesting the URI. All - * keys are lower-case. - * - * This object is a copy, so any chnages will **NOT** be reflected - * in the ``FetchRequest``. - * - * To set a header entry, use the ``setHeader`` method. - */ - get headers(): Record; - /** - * Get the header for %%key%%, ignoring case. - */ - getHeader(key: string): string; - /** - * Set the header for %%key%% to %%value%%. All values are coerced - * to a string. - */ - setHeader(key: string, value: string | number): void; - /** - * Clear all headers, resetting all intrinsic headers. - */ - clearHeaders(): void; - [Symbol.iterator](): Iterator<[key: string, value: string]>; - /** - * The value that will be sent for the ``Authorization`` header. - * - * To set the credentials, use the ``setCredentials`` method. - */ - get credentials(): null | string; - /** - * Sets an ``Authorization`` for %%username%% with %%password%%. - */ - setCredentials(username: string, password: string): void; - /** - * Enable and request gzip-encoded responses. The response will - * automatically be decompressed. //(default: true)// - */ - get allowGzip(): boolean; - set allowGzip(value: boolean); - /** - * Allow ``Authentication`` credentials to be sent over insecure - * channels. //(default: false)// - */ - get allowInsecureAuthentication(): boolean; - set allowInsecureAuthentication(value: boolean); - /** - * The timeout (in milliseconds) to wait for a complere response. - * //(default: 5 minutes)// - */ - get timeout(): number; - set timeout(timeout: number); - /** - * This function is called prior to each request, for example - * during a redirection or retry in case of server throttling. - * - * This offers an opportunity to populate headers or update - * content before sending a request. - */ - get preflightFunc(): null | FetchPreflightFunc; - set preflightFunc(preflight: null | FetchPreflightFunc); - /** - * This function is called after each response, offering an - * opportunity to provide client-level throttling or updating - * response data. - * - * Any error thrown in this causes the ``send()`` to throw. - * - * To schedule a retry attempt (assuming the maximum retry limit - * has not been reached), use [[response.throwThrottleError]]. - */ - get processFunc(): null | FetchProcessFunc; - set processFunc(process: null | FetchProcessFunc); - /** - * This function is called on each retry attempt. - */ - get retryFunc(): null | FetchRetryFunc; - set retryFunc(retry: null | FetchRetryFunc); - /** - * Create a new FetchRequest instance with default values. - * - * Once created, each property may be set before issuing a - * ``.send()`` to make the request. - */ - constructor(url: string); - toString(): string; - /** - * Update the throttle parameters used to determine maximum - * attempts and exponential-backoff properties. - */ - setThrottleParams(params: FetchThrottleParams): void; - /** - * Resolves to the response by sending the request. - */ - send(): Promise; - /** - * Cancels the inflight response, causing a ``CANCELLED`` - * error to be rejected from the [[send]]. - */ - cancel(): void; - /** - * Returns a new [[FetchRequest]] that represents the redirection - * to %%location%%. - */ - redirect(location: string): FetchRequest; - /** - * Create a new copy of this request. - */ - clone(): FetchRequest; - /** - * Locks all static configuration for gateways and FetchGetUrlFunc - * registration. - */ - static lockConfig(): void; - /** - * Get the current Gateway function for %%scheme%%. - */ - static getGateway(scheme: string): null | FetchGatewayFunc; - /** - * Use the %%func%% when fetching URIs using %%scheme%%. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGateway(scheme: string, func: FetchGatewayFunc): void; - /** - * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGetUrl(getUrl: FetchGetUrlFunc): void; - /** - * Creates a function that can "fetch" data URIs. - * - * Note that this is automatically done internally to support - * data URIs, so it is not necessary to register it. - * - * This is not generally something that is needed, but may - * be useful in a wrapper to perfom custom data URI functionality. - */ - static createDataGateway(): FetchGatewayFunc; - /** - * Creates a function that will fetch IPFS (unvalidated) from - * a custom gateway baseUrl. - * - * The default IPFS gateway used internally is - * ``"https:/\/gateway.ipfs.io/ipfs/"``. - */ - static createIpfsGatewayFunc(baseUrl: string): FetchGatewayFunc; -} -/** - * The response for a FetchREquest. - */ -export declare class FetchResponse implements Iterable<[key: string, value: string]> { - #private; - toString(): string; - /** - * The response status code. - */ - get statusCode(): number; - /** - * The response status message. - */ - get statusMessage(): string; - /** - * The response headers. All keys are lower-case. - */ - get headers(): Record; - /** - * The response body, or ``null`` if there was no body. - */ - get body(): null | Readonly; - /** - * The response body as a UTF-8 encoded string, or the empty - * string (i.e. ``""``) if there was no body. - * - * An error is thrown if the body is invalid UTF-8 data. - */ - get bodyText(): string; - /** - * The response body, decoded as JSON. - * - * An error is thrown if the body is invalid JSON-encoded data - * or if there was no body. - */ - get bodyJson(): any; - [Symbol.iterator](): Iterator<[key: string, value: string]>; - constructor(statusCode: number, statusMessage: string, headers: Readonly>, body: null | Uint8Array, request?: FetchRequest); - /** - * Return a Response with matching headers and body, but with - * an error status code (i.e. 599) and %%message%% with an - * optional %%error%%. - */ - makeServerError(message?: string, error?: Error): FetchResponse; - /** - * If called within a [request.processFunc](FetchRequest-processFunc) - * call, causes the request to retry as if throttled for %%stall%% - * milliseconds. - */ - throwThrottleError(message?: string, stall?: number): never; - /** - * Get the header value for %%key%%, ignoring case. - */ - getHeader(key: string): string; - /** - * Returns true of the response has a body. - */ - hasBody(): this is FetchResponse & { - body: Uint8Array; - }; - /** - * The request made for this response. - */ - get request(): null | FetchRequest; - /** - * Returns true if this response was a success statusCode. - */ - ok(): boolean; - /** - * Throws a ``SERVER_ERROR`` if this response is not ok. - */ - assertOk(): void; -} -//# sourceMappingURL=fetch.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/fetch.d.ts.map b/lib.esm/utils/fetch.d.ts.map deleted file mode 100644 index 1319c39a1..000000000 --- a/lib.esm/utils/fetch.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src.ts/utils/fetch.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,IAAI,GAAG,UAAU,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AACF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,GAAG,EAAE,YAAY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IAAI,IAAI,IAAI,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,CAEtC;IAED;;;;;OAKG;IACH,IAAI,QAAQ,IAAI,MAAM,CAcrB;IAED;;;;;OAKG;IACH,IAAI,QAAQ,IAAI,GAAG,CAclB;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;gBAmBzD,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACzC,IAAI,EAAE,IAAI,GAAG,UAAU,EACvB,OAAO,CAAC,EAAE,YAAY;IAiBxB;;;;OAIG;IACH,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,aAAa;IAmB/D;;;;OAIG;IACH,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK;IAmB3D;;OAEG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI9B;;OAEG;IACH,OAAO,IAAI,IAAI,IAAI,aAAa,GAAG;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE;IAIvD;;OAEG;IACH,IAAI,OAAO,IAAI,IAAI,GAAG,YAAY,CAEjC;IAED;;OAEG;IACH,EAAE,IAAI,OAAO;IAQb;;OAEG;IACH,QAAQ,IAAI,IAAI;CAcjB"} \ No newline at end of file diff --git a/lib.esm/utils/fetch.js b/lib.esm/utils/fetch.js deleted file mode 100644 index 2e5e5ab8e..000000000 --- a/lib.esm/utils/fetch.js +++ /dev/null @@ -1,825 +0,0 @@ -/** - * Explain fetching here... - * - * @_section api/utils/fetching:Fetching Web Content [about-fetch] - */ -import { decodeBase64, encodeBase64 } from "./base64.js"; -import { hexlify } from "./data.js"; -import { assert, assertArgument } from "./errors.js"; -import { defineProperties } from "./properties.js"; -import { toUtf8Bytes, toUtf8String } from "./utf8.js"; -import { getUrl } from "./geturl.js"; -const MAX_ATTEMPTS = 12; -const SLOT_INTERVAL = 250; -// The global FetchGetUrlFunc implementation. -let getUrlFunc = getUrl; -const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); -const reIpfs = new RegExp("^ipfs://(ipfs/)?(.*)$", "i"); -// If locked, new Gateways cannot be added -let locked = false; -// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs -async function dataGatewayFunc(url, signal) { - try { - const match = url.match(reData); - if (!match) { - throw new Error("invalid data"); - } - return new FetchResponse(200, "OK", { - "content-type": match[1] || "text/plain", - }, match[2] ? decodeBase64(match[3]) : unpercent(match[3])); - } - catch (error) { - return new FetchResponse(599, "BAD REQUEST (invalid data: URI)", {}, null, new FetchRequest(url)); - } -} -/** - * Returns a [[FetchGatewayFunc]] for fetching content from a standard - * IPFS gateway hosted at %%baseUrl%%. - */ -function getIpfsGatewayFunc(baseUrl) { - async function gatewayIpfs(url, signal) { - try { - const match = url.match(reIpfs); - if (!match) { - throw new Error("invalid link"); - } - return new FetchRequest(`${baseUrl}${match[2]}`); - } - catch (error) { - return new FetchResponse(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new FetchRequest(url)); - } - } - return gatewayIpfs; -} -const Gateways = { - data: dataGatewayFunc, - ipfs: getIpfsGatewayFunc("https://gateway.ipfs.io/ipfs/"), -}; -const fetchSignals = new WeakMap(); -/** - * @_ignore - */ -export class FetchCancelSignal { - #listeners; - #cancelled; - constructor(request) { - this.#listeners = []; - this.#cancelled = false; - fetchSignals.set(request, () => { - if (this.#cancelled) { - return; - } - this.#cancelled = true; - for (const listener of this.#listeners) { - setTimeout(() => { - listener(); - }, 0); - } - this.#listeners = []; - }); - } - addListener(listener) { - assert(!this.#cancelled, "singal already cancelled", "UNSUPPORTED_OPERATION", { - operation: "fetchCancelSignal.addCancelListener", - }); - this.#listeners.push(listener); - } - get cancelled() { - return this.#cancelled; - } - checkSignal() { - assert(!this.cancelled, "cancelled", "CANCELLED", {}); - } -} -// Check the signal, throwing if it is cancelled -function checkSignal(signal) { - if (signal == null) { - throw new Error("missing signal; should not happen"); - } - signal.checkSignal(); - return signal; -} -/** - * Represents a request for a resource using a URI. - * - * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, - * and ``IPFS:``. - * - * Additional schemes can be added globally using [[registerGateway]]. - * - * @example: - * req = new FetchRequest("https://www.ricmoo.com") - * resp = await req.send() - * resp.body.length - * //_result: - */ -export class FetchRequest { - #allowInsecure; - #gzip; - #headers; - #method; - #timeout; - #url; - #body; - #bodyType; - #creds; - // Hooks - #preflight; - #process; - #retry; - #signal; - #throttle; - /** - * The fetch URI to requrest. - */ - get url() { - return this.#url; - } - set url(url) { - this.#url = String(url); - } - /** - * The fetch body, if any, to send as the request body. //(default: null)// - * - * When setting a body, the intrinsic ``Content-Type`` is automatically - * set and will be used if **not overridden** by setting a custom - * header. - * - * If %%body%% is null, the body is cleared (along with the - * intrinsic ``Content-Type``) and the . - * - * If %%body%% is a string, the intrincis ``Content-Type`` is set to - * ``text/plain``. - * - * If %%body%% is a Uint8Array, the intrincis ``Content-Type`` is set to - * ``application/octet-stream``. - * - * If %%body%% is any other object, the intrincis ``Content-Type`` is - * set to ``application/json``. - */ - get body() { - if (this.#body == null) { - return null; - } - return new Uint8Array(this.#body); - } - set body(body) { - if (body == null) { - this.#body = undefined; - this.#bodyType = undefined; - } - else if (typeof body === "string") { - this.#body = toUtf8Bytes(body); - this.#bodyType = "text/plain"; - } - else if (body instanceof Uint8Array) { - this.#body = body; - this.#bodyType = "application/octet-stream"; - } - else if (typeof body === "object") { - this.#body = toUtf8Bytes(JSON.stringify(body)); - this.#bodyType = "application/json"; - } - else { - throw new Error("invalid body"); - } - } - /** - * Returns true if the request has a body. - */ - hasBody() { - return this.#body != null; - } - /** - * The HTTP method to use when requesting the URI. If no method - * has been explicitly set, then ``GET`` is used if the body is - * null and ``POST`` otherwise. - */ - get method() { - if (this.#method) { - return this.#method; - } - if (this.hasBody()) { - return "POST"; - } - return "GET"; - } - set method(method) { - if (method == null) { - method = ""; - } - this.#method = String(method).toUpperCase(); - } - /** - * The headers that will be used when requesting the URI. All - * keys are lower-case. - * - * This object is a copy, so any chnages will **NOT** be reflected - * in the ``FetchRequest``. - * - * To set a header entry, use the ``setHeader`` method. - */ - get headers() { - const headers = Object.assign({}, this.#headers); - if (this.#creds) { - headers["authorization"] = `Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`; - } - if (this.allowGzip) { - headers["accept-encoding"] = "gzip"; - } - if (headers["content-type"] == null && this.#bodyType) { - headers["content-type"] = this.#bodyType; - } - if (this.body) { - headers["content-length"] = String(this.body.length); - } - return headers; - } - /** - * Get the header for %%key%%, ignoring case. - */ - getHeader(key) { - return this.headers[key.toLowerCase()]; - } - /** - * Set the header for %%key%% to %%value%%. All values are coerced - * to a string. - */ - setHeader(key, value) { - this.#headers[String(key).toLowerCase()] = String(value); - } - /** - * Clear all headers, resetting all intrinsic headers. - */ - clearHeaders() { - this.#headers = {}; - } - [Symbol.iterator]() { - const headers = this.headers; - const keys = Object.keys(headers); - let index = 0; - return { - next: () => { - if (index < keys.length) { - const key = keys[index++]; - return { - value: [key, headers[key]], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - /** - * The value that will be sent for the ``Authorization`` header. - * - * To set the credentials, use the ``setCredentials`` method. - */ - get credentials() { - return this.#creds || null; - } - /** - * Sets an ``Authorization`` for %%username%% with %%password%%. - */ - setCredentials(username, password) { - assertArgument(!username.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"); - this.#creds = `${username}:${password}`; - } - /** - * Enable and request gzip-encoded responses. The response will - * automatically be decompressed. //(default: true)// - */ - get allowGzip() { - return this.#gzip; - } - set allowGzip(value) { - this.#gzip = !!value; - } - /** - * Allow ``Authentication`` credentials to be sent over insecure - * channels. //(default: false)// - */ - get allowInsecureAuthentication() { - return !!this.#allowInsecure; - } - set allowInsecureAuthentication(value) { - this.#allowInsecure = !!value; - } - /** - * The timeout (in milliseconds) to wait for a complere response. - * //(default: 5 minutes)// - */ - get timeout() { - return this.#timeout; - } - set timeout(timeout) { - assertArgument(timeout >= 0, "timeout must be non-zero", "timeout", timeout); - this.#timeout = timeout; - } - /** - * This function is called prior to each request, for example - * during a redirection or retry in case of server throttling. - * - * This offers an opportunity to populate headers or update - * content before sending a request. - */ - get preflightFunc() { - return this.#preflight || null; - } - set preflightFunc(preflight) { - this.#preflight = preflight; - } - /** - * This function is called after each response, offering an - * opportunity to provide client-level throttling or updating - * response data. - * - * Any error thrown in this causes the ``send()`` to throw. - * - * To schedule a retry attempt (assuming the maximum retry limit - * has not been reached), use [[response.throwThrottleError]]. - */ - get processFunc() { - return this.#process || null; - } - set processFunc(process) { - this.#process = process; - } - /** - * This function is called on each retry attempt. - */ - get retryFunc() { - return this.#retry || null; - } - set retryFunc(retry) { - this.#retry = retry; - } - /** - * Create a new FetchRequest instance with default values. - * - * Once created, each property may be set before issuing a - * ``.send()`` to make the request. - */ - constructor(url) { - this.#url = String(url); - this.#allowInsecure = false; - this.#gzip = true; - this.#headers = {}; - this.#method = ""; - this.#timeout = 300000; - this.#throttle = { - slotInterval: SLOT_INTERVAL, - maxAttempts: MAX_ATTEMPTS, - }; - } - toString() { - return ``; - } - /** - * Update the throttle parameters used to determine maximum - * attempts and exponential-backoff properties. - */ - setThrottleParams(params) { - if (params.slotInterval != null) { - this.#throttle.slotInterval = params.slotInterval; - } - if (params.maxAttempts != null) { - this.#throttle.maxAttempts = params.maxAttempts; - } - } - async #send(attempt, expires, delay, _request, _response) { - if (attempt >= this.#throttle.maxAttempts) { - return _response.makeServerError("exceeded maximum retry limit"); - } - assert(getTime() <= expires, "timeout", "TIMEOUT", { - operation: "request.send", - reason: "timeout", - request: _request, - }); - if (delay > 0) { - await wait(delay); - } - let req = this.clone(); - const scheme = (req.url.split(":")[0] || "").toLowerCase(); - // Process any Gateways - if (scheme in Gateways) { - const result = await Gateways[scheme](req.url, checkSignal(_request.#signal)); - if (result instanceof FetchResponse) { - let response = result; - if (this.processFunc) { - checkSignal(_request.#signal); - try { - response = await this.processFunc(req, response); - } - catch (error) { - // Something went wrong during processing; throw a 5xx server error - if (error.throttle == null || typeof error.stall !== "number") { - response - .makeServerError("error in post-processing function", error) - .assertOk(); - } - // Ignore throttling - } - } - return response; - } - req = result; - } - // We have a preflight function; update the request - if (this.preflightFunc) { - req = await this.preflightFunc(req); - } - const resp = await getUrlFunc(req, checkSignal(_request.#signal)); - let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); - if (response.statusCode === 301 || response.statusCode === 302) { - // Redirect - try { - const location = response.headers.location || ""; - return req - .redirect(location) - .#send(attempt + 1, expires, 0, _request, response); - } - catch (error) { } - // Things won't get any better on another attempt; abort - return response; - } - else if (response.statusCode === 429) { - // Throttle - if (this.retryFunc == null || - (await this.retryFunc(req, response, attempt))) { - const retryAfter = response.headers["retry-after"]; - let delay = this.#throttle.slotInterval * - Math.trunc(Math.random() * Math.pow(2, attempt)); - if (typeof retryAfter === "string" && - retryAfter.match(/^[1-9][0-9]*$/)) { - delay = parseInt(retryAfter); - } - return req - .clone() - .#send(attempt + 1, expires, delay, _request, response); - } - } - if (this.processFunc) { - checkSignal(_request.#signal); - try { - response = await this.processFunc(req, response); - } - catch (error) { - // Something went wrong during processing; throw a 5xx server error - if (error.throttle == null || typeof error.stall !== "number") { - response - .makeServerError("error in post-processing function", error) - .assertOk(); - } - // Throttle - let delay = this.#throttle.slotInterval * - Math.trunc(Math.random() * Math.pow(2, attempt)); - if (error.stall >= 0) { - delay = error.stall; - } - return req - .clone() - .#send(attempt + 1, expires, delay, _request, response); - } - } - return response; - } - /** - * Resolves to the response by sending the request. - */ - send() { - assert(this.#signal == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); - this.#signal = new FetchCancelSignal(this); - return this.#send(0, getTime() + this.timeout, 0, this, new FetchResponse(0, "", {}, null, this)); - } - /** - * Cancels the inflight response, causing a ``CANCELLED`` - * error to be rejected from the [[send]]. - */ - cancel() { - assert(this.#signal != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); - const signal = fetchSignals.get(this); - if (!signal) { - throw new Error("missing signal; should not happen"); - } - signal(); - } - /** - * Returns a new [[FetchRequest]] that represents the redirection - * to %%location%%. - */ - redirect(location) { - // Redirection; for now we only support absolute locataions - const current = this.url.split(":")[0].toLowerCase(); - const target = location.split(":")[0].toLowerCase(); - // Don't allow redirecting: - // - non-GET requests - // - downgrading the security (e.g. https => http) - // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?] - assert(this.method === "GET" && - (current !== "https" || target !== "http") && - location.match(/^https?:/), `unsupported redirect`, "UNSUPPORTED_OPERATION", { - operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})`, - }); - // Create a copy of this request, with a new URL - const req = new FetchRequest(location); - req.method = "GET"; - req.allowGzip = this.allowGzip; - req.timeout = this.timeout; - req.#headers = Object.assign({}, this.#headers); - if (this.#body) { - req.#body = new Uint8Array(this.#body); - } - req.#bodyType = this.#bodyType; - // Do not forward credentials unless on the same domain; only absolute - //req.allowInsecure = false; - // paths are currently supported; may want a way to specify to forward? - //setStore(req.#props, "creds", getStore(this.#pros, "creds")); - return req; - } - /** - * Create a new copy of this request. - */ - clone() { - const clone = new FetchRequest(this.url); - // Preserve "default method" (i.e. null) - clone.#method = this.#method; - // Preserve "default body" with type, copying the Uint8Array is present - if (this.#body) { - clone.#body = this.#body; - } - clone.#bodyType = this.#bodyType; - // Preserve "default headers" - clone.#headers = Object.assign({}, this.#headers); - // Credentials is readonly, so we copy internally - clone.#creds = this.#creds; - if (this.allowGzip) { - clone.allowGzip = true; - } - clone.timeout = this.timeout; - if (this.allowInsecureAuthentication) { - clone.allowInsecureAuthentication = true; - } - clone.#preflight = this.#preflight; - clone.#process = this.#process; - clone.#retry = this.#retry; - return clone; - } - /** - * Locks all static configuration for gateways and FetchGetUrlFunc - * registration. - */ - static lockConfig() { - locked = true; - } - /** - * Get the current Gateway function for %%scheme%%. - */ - static getGateway(scheme) { - return Gateways[scheme.toLowerCase()] || null; - } - /** - * Use the %%func%% when fetching URIs using %%scheme%%. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGateway(scheme, func) { - scheme = scheme.toLowerCase(); - if (scheme === "http" || scheme === "https") { - throw new Error(`cannot intercept ${scheme}; use registerGetUrl`); - } - if (locked) { - throw new Error("gateways locked"); - } - Gateways[scheme] = func; - } - /** - * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGetUrl(getUrl) { - if (locked) { - throw new Error("gateways locked"); - } - getUrlFunc = getUrl; - } - /** - * Creates a function that can "fetch" data URIs. - * - * Note that this is automatically done internally to support - * data URIs, so it is not necessary to register it. - * - * This is not generally something that is needed, but may - * be useful in a wrapper to perfom custom data URI functionality. - */ - static createDataGateway() { - return dataGatewayFunc; - } - /** - * Creates a function that will fetch IPFS (unvalidated) from - * a custom gateway baseUrl. - * - * The default IPFS gateway used internally is - * ``"https:/\/gateway.ipfs.io/ipfs/"``. - */ - static createIpfsGatewayFunc(baseUrl) { - return getIpfsGatewayFunc(baseUrl); - } -} -/** - * The response for a FetchREquest. - */ -export class FetchResponse { - #statusCode; - #statusMessage; - #headers; - #body; - #request; - #error; - toString() { - return ``; - } - /** - * The response status code. - */ - get statusCode() { - return this.#statusCode; - } - /** - * The response status message. - */ - get statusMessage() { - return this.#statusMessage; - } - /** - * The response headers. All keys are lower-case. - */ - get headers() { - return Object.assign({}, this.#headers); - } - /** - * The response body, or ``null`` if there was no body. - */ - get body() { - return this.#body == null ? null : new Uint8Array(this.#body); - } - /** - * The response body as a UTF-8 encoded string, or the empty - * string (i.e. ``""``) if there was no body. - * - * An error is thrown if the body is invalid UTF-8 data. - */ - get bodyText() { - try { - return this.#body == null ? "" : toUtf8String(this.#body); - } - catch (error) { - assert(false, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { - operation: "bodyText", - info: { response: this }, - }); - } - } - /** - * The response body, decoded as JSON. - * - * An error is thrown if the body is invalid JSON-encoded data - * or if there was no body. - */ - get bodyJson() { - try { - return JSON.parse(this.bodyText); - } - catch (error) { - assert(false, "response body is not valid JSON", "UNSUPPORTED_OPERATION", { - operation: "bodyJson", - info: { response: this }, - }); - } - } - [Symbol.iterator]() { - const headers = this.headers; - const keys = Object.keys(headers); - let index = 0; - return { - next: () => { - if (index < keys.length) { - const key = keys[index++]; - return { - value: [key, headers[key]], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - constructor(statusCode, statusMessage, headers, body, request) { - this.#statusCode = statusCode; - this.#statusMessage = statusMessage; - this.#headers = Object.keys(headers).reduce((accum, k) => { - accum[k.toLowerCase()] = String(headers[k]); - return accum; - }, {}); - this.#body = body == null ? null : new Uint8Array(body); - this.#request = request || null; - this.#error = { message: "" }; - } - /** - * Return a Response with matching headers and body, but with - * an error status code (i.e. 599) and %%message%% with an - * optional %%error%%. - */ - makeServerError(message, error) { - let statusMessage; - if (!message) { - message = `${this.statusCode} ${this.statusMessage}`; - statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`; - } - else { - statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; - } - const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined); - response.#error = { message, error }; - return response; - } - /** - * If called within a [request.processFunc](FetchRequest-processFunc) - * call, causes the request to retry as if throttled for %%stall%% - * milliseconds. - */ - throwThrottleError(message, stall) { - if (stall == null) { - stall = -1; - } - else { - assertArgument(Number.isInteger(stall) && stall >= 0, "invalid stall timeout", "stall", stall); - } - const error = new Error(message || "throttling requests"); - defineProperties(error, { stall, throttle: true }); - throw error; - } - /** - * Get the header value for %%key%%, ignoring case. - */ - getHeader(key) { - return this.headers[key.toLowerCase()]; - } - /** - * Returns true of the response has a body. - */ - hasBody() { - return this.#body != null; - } - /** - * The request made for this response. - */ - get request() { - return this.#request; - } - /** - * Returns true if this response was a success statusCode. - */ - ok() { - return (this.#error.message === "" && - this.statusCode >= 200 && - this.statusCode < 300); - } - /** - * Throws a ``SERVER_ERROR`` if this response is not ok. - */ - assertOk() { - if (this.ok()) { - return; - } - let { message, error } = this.#error; - if (message === "") { - message = `server response ${this.statusCode} ${this.statusMessage}`; - } - assert(false, message, "SERVER_ERROR", { - request: this.request || "unknown request", - response: this, - error, - }); - } -} -function getTime() { - return new Date().getTime(); -} -function unpercent(value) { - return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { - return String.fromCharCode(parseInt(code, 16)); - })); -} -function wait(delay) { - return new Promise((resolve) => setTimeout(resolve, delay)); -} -//# sourceMappingURL=fetch.js.map \ No newline at end of file diff --git a/lib.esm/utils/fetch.js.map b/lib.esm/utils/fetch.js.map deleted file mode 100644 index 6676d58de..000000000 --- a/lib.esm/utils/fetch.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src.ts/utils/fetch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAsDrC,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,aAAa,GAAG,GAAG,C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O,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QACrC,IAAI,OAAO,KAAK,EAAE,EAAE;YAClB,OAAO,GAAG,mBAAmB,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;SACtE;QACD,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE;YACrC,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,iBAAiB;YAC1C,QAAQ,EAAE,IAAI;YACd,KAAK;SACN,CAAC,CAAC;IACL,CAAC;CACF;AAED,SAAS,OAAO;IACd,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,WAAW,CAChB,KAAK,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACnD,OAAO,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,SAAS,IAAI,CAAC,KAAa;IACzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAC9D,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/fixednumber.d.ts b/lib.esm/utils/fixednumber.d.ts deleted file mode 100644 index c8a28f158..000000000 --- a/lib.esm/utils/fixednumber.d.ts +++ /dev/null @@ -1,252 +0,0 @@ -import type { BigNumberish, BytesLike } from "./index.js"; -/** - * A description of a fixed-point arithmetic field. - * - * When specifying the fixed format, the values override the default of - * a ``fixed128x18``, which implies a signed 128-bit value with 18 - * decimals of precision. - * - * The alias ``fixed`` and ``ufixed`` can be used for ``fixed128x18`` and - * ``ufixed128x18`` respectively. - * - * When a fixed format string begins with a ``u``, it indicates the field - * is unsigned, so any negative values will overflow. The first number - * indicates the bit-width and the second number indicates the decimal - * precision. - * - * When a ``number`` is used for a fixed format, it indicates the number - * of decimal places, and the default width and signed-ness will be used. - * - * The bit-width must be byte aligned and the decimals can be at most 80. - */ -export type FixedFormat = number | string | { - signed?: boolean; - width?: number; - decimals?: number; -}; -/** - * A FixedNumber represents a value over its [[FixedFormat]] - * arithmetic field. - * - * A FixedNumber can be used to perform math, losslessly, on - * values which have decmial places. - * - * A FixedNumber has a fixed bit-width to store values in, and stores all - * values internally by multiplying the value by 10 raised to the power of - * %%decimals%%. - * - * If operations are performed that cause a value to grow too high (close to - * positive infinity) or too low (close to negative infinity), the value - * is said to //overflow//. - * - * For example, an 8-bit signed value, with 0 decimals may only be within - * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become - * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. - * - * Many operation have a normal and //unsafe// variant. The normal variant - * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// - * variant will silently allow overflow, corrupting its value value. - * - * If operations are performed that cause a value to become too small - * (close to zero), the value loses precison and is said to //underflow//. - * - * For example, an value with 1 decimal place may store a number as small - * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit - * into 1 decimal place, so underflow occurs which means precision is lost - * and the value becomes ``0``. - * - * Some operations have a normal and //signalling// variant. The normal - * variant will silently ignore underflow, while the //signalling// variant - * will thow a [[NumericFaultError]] on underflow. - */ -export declare class FixedNumber { - #private; - /** - * The specific fixed-point arithmetic field for this value. - */ - readonly format: string; - /** - * This is a property so console.log shows a human-meaningful value. - * - * @private - */ - readonly _value: string; - /** - * @private - */ - constructor(guard: any, value: bigint, format: any); - /** - * If true, negative values are permitted, otherwise only - * positive values and zero are allowed. - */ - get signed(): boolean; - /** - * The number of bits available to store the value. - */ - get width(): number; - /** - * The number of decimal places in the fixed-point arithment field. - */ - get decimals(): number; - /** - * The value as an integer, based on the smallest unit the - * [[decimals]] allow. - */ - get value(): bigint; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%, ignoring overflow. - */ - addUnsafe(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - add(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%, ignoring overflow. - */ - subUnsafe(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - sub(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%, ignoring overflow and underflow (precision loss). - */ - mulUnsafe(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - mul(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs or if underflow (precision loss) occurs. - */ - mulSignal(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - divUnsafe(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - div(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%. A [[NumericFaultError]] is thrown if underflow - * (precision loss) occurs. - */ - divSignal(other: FixedNumber): FixedNumber; - /** - * Returns a comparison result between %%this%% and %%other%%. - * - * This is suitable for use in sorting, where ``-1`` implies %%this%% - * is smaller, ``1`` implies %%other%% is larger and ``0`` implies - * both are equal. - */ - cmp(other: FixedNumber): number; - /** - * Returns true if %%other%% is equal to %%this%%. - */ - eq(other: FixedNumber): boolean; - /** - * Returns true if %%other%% is less than to %%this%%. - */ - lt(other: FixedNumber): boolean; - /** - * Returns true if %%other%% is less than or equal to %%this%%. - */ - lte(other: FixedNumber): boolean; - /** - * Returns true if %%other%% is greater than to %%this%%. - */ - gt(other: FixedNumber): boolean; - /** - * Returns true if %%other%% is greater than or equal to %%this%%. - */ - gte(other: FixedNumber): boolean; - /** - * Returns a new [[FixedNumber]] which is the largest **integer** - * that is less than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - floor(): FixedNumber; - /** - * Returns a new [[FixedNumber]] which is the smallest **integer** - * that is greater than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - ceiling(): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the decimal component - * rounded up on ties at %%decimals%% places. - */ - round(decimals?: number): FixedNumber; - /** - * Returns true if %%this%% is equal to ``0``. - */ - isZero(): boolean; - /** - * Returns true if %%this%% is less than ``0``. - */ - isNegative(): boolean; - /** - * Returns the string representation of %%this%%. - */ - toString(): string; - /** - * Returns a float approximation. - * - * Due to IEEE 754 precission (or lack thereof), this function - * can only return an approximation and most values will contain - * rounding errors. - */ - toUnsafeFloat(): number; - /** - * Return a new [[FixedNumber]] with the same value but has had - * its field set to %%format%%. - * - * This will throw if the value cannot fit into %%format%%. - */ - toFormat(format: FixedFormat): FixedNumber; - /** - * Creates a new [[FixedNumber]] for %%value%% divided by - * %%decimal%% places with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% (once adjusted - * for %%decimals%%) cannot fit in %%format%%, either due to overflow - * or underflow (precision loss). - */ - static fromValue(_value: BigNumberish, decimals?: number, _format?: FixedFormat): FixedNumber; - /** - * Creates a new [[FixedNumber]] for %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%%, either due to overflow or underflow (precision loss). - */ - static fromString(_value: string, _format?: FixedFormat): FixedNumber; - /** - * Creates a new [[FixedNumber]] with the big-endian representation - * %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%% due to overflow. - */ - static fromBytes(_value: BytesLike, _format?: FixedFormat): FixedNumber; -} -//# sourceMappingURL=fixednumber.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/fixednumber.d.ts.map b/lib.esm/utils/fixednumber.d.ts.map deleted file mode 100644 index 2f8afd8ab..000000000 --- a/lib.esm/utils/fixednumber.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fixednumber.d.ts","sourceRoot":"","sources":["../../src.ts/utils/fixednumber.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA4C1D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,MAAM,GACN;IACE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAoJN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,WAAW;;IACtB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAUzB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAMzB;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG;IAclD;;;OAGG;IACH,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;;OAGG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IA2CD;;;OAGG;IACH,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW;IAI1C;;;;OAIG;IACH,GAAG,CAAC,KAAK,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H,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW;IAI1C;;;;;;;OAOG;IACH,MAAM,CAAC,SAAS,CACd,MAAM,EAAE,YAAY,EACpB,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,WAAW,GACpB,WAAW;IA8Bd;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW;IAyCrE;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW;CAYxE"} \ No newline at end of file diff --git a/lib.esm/utils/fixednumber.js b/lib.esm/utils/fixednumber.js deleted file mode 100644 index 8bbe59fbb..000000000 --- a/lib.esm/utils/fixednumber.js +++ /dev/null @@ -1,583 +0,0 @@ -var _a; -/** - * About fixed-point math... - * - * @_section: api/utils/fixed-point-math:Fixed-Point Maths [about-fixed-point-math] - */ -import { getBytes } from "./data.js"; -import { assert, assertArgument, assertPrivate } from "./errors.js"; -import { getBigInt, fromTwos, mask, toBigInt } from "./maths.js"; -import { defineProperties } from "./properties.js"; -const BN_N1 = BigInt(-1); -const BN_0 = BigInt(0); -const BN_1 = BigInt(1); -const BN_5 = BigInt(5); -const _guard = {}; -// Constant to pull zeros from for multipliers -let Zeros = "0000"; -while (Zeros.length < 80) { - Zeros += Zeros; -} -// Returns a string "1" followed by decimal "0"s -function getTens(decimals) { - let result = Zeros; - while (result.length < decimals) { - result += result; - } - return BigInt("1" + result.substring(0, decimals)); -} -function checkValue(val, format, safeOp) { - const width = BigInt(format.width); - if (format.signed) { - const limit = BN_1 << (width - BN_1); - assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { - operation: safeOp, - fault: "overflow", - value: val, - }); - if (val > BN_0) { - val = fromTwos(mask(val, width), width); - } - else { - val = -fromTwos(mask(-val, width), width); - } - } - else { - const limit = BN_1 << width; - assert(safeOp == null || (val >= 0 && val < limit), "overflow", "NUMERIC_FAULT", { - operation: safeOp, - fault: "overflow", - value: val, - }); - val = ((val % limit) + limit) % limit & (limit - BN_1); - } - return val; -} -function getFormat(value) { - if (typeof value === "number") { - value = `fixed128x${value}`; - } - let signed = true; - let width = 128; - let decimals = 18; - if (typeof value === "string") { - // Parse the format string - if (value === "fixed") { - // defaults... - } - else if (value === "ufixed") { - signed = false; - } - else { - const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); - assertArgument(match, "invalid fixed format", "format", value); - signed = match[1] !== "u"; - width = parseInt(match[2]); - decimals = parseInt(match[3]); - } - } - else if (value) { - // Extract the values from the object - const v = value; - const check = (key, type, defaultValue) => { - if (v[key] == null) { - return defaultValue; - } - assertArgument(typeof v[key] === type, "invalid fixed format (" + key + " not " + type + ")", "format." + key, v[key]); - return v[key]; - }; - signed = check("signed", "boolean", signed); - width = check("width", "number", width); - decimals = check("decimals", "number", decimals); - } - assertArgument(width % 8 === 0, "invalid FixedNumber width (not byte aligned)", "format.width", width); - assertArgument(decimals <= 80, "invalid FixedNumber decimals (too large)", "format.decimals", decimals); - const name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); - return { signed, width, decimals, name }; -} -function toString(val, decimals) { - let negative = ""; - if (val < BN_0) { - negative = "-"; - val *= BN_N1; - } - let str = val.toString(); - // No decimal point for whole values - if (decimals === 0) { - return negative + str; - } - // Pad out to the whole component (including a whole digit) - while (str.length <= decimals) { - str = Zeros + str; - } - // Insert the decimal point - const index = str.length - decimals; - str = str.substring(0, index) + "." + str.substring(index); - // Trim the whole component (leaving at least one 0) - while (str[0] === "0" && str[1] !== ".") { - str = str.substring(1); - } - // Trim the decimal component (leaving at least one 0) - while (str[str.length - 1] === "0" && str[str.length - 2] !== ".") { - str = str.substring(0, str.length - 1); - } - return negative + str; -} -/** - * A FixedNumber represents a value over its [[FixedFormat]] - * arithmetic field. - * - * A FixedNumber can be used to perform math, losslessly, on - * values which have decmial places. - * - * A FixedNumber has a fixed bit-width to store values in, and stores all - * values internally by multiplying the value by 10 raised to the power of - * %%decimals%%. - * - * If operations are performed that cause a value to grow too high (close to - * positive infinity) or too low (close to negative infinity), the value - * is said to //overflow//. - * - * For example, an 8-bit signed value, with 0 decimals may only be within - * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become - * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. - * - * Many operation have a normal and //unsafe// variant. The normal variant - * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// - * variant will silently allow overflow, corrupting its value value. - * - * If operations are performed that cause a value to become too small - * (close to zero), the value loses precison and is said to //underflow//. - * - * For example, an value with 1 decimal place may store a number as small - * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit - * into 1 decimal place, so underflow occurs which means precision is lost - * and the value becomes ``0``. - * - * Some operations have a normal and //signalling// variant. The normal - * variant will silently ignore underflow, while the //signalling// variant - * will thow a [[NumericFaultError]] on underflow. - */ -export class FixedNumber { - /** - * The specific fixed-point arithmetic field for this value. - */ - format; - #format; - // The actual value (accounting for decimals) - #val; - // A base-10 value to multiple values by to maintain the magnitude - #tens; - /** - * This is a property so console.log shows a human-meaningful value. - * - * @private - */ - _value; - // Use this when changing this file to get some typing info, - // but then switch to any to mask the internal type - //constructor(guard: any, value: bigint, format: _FixedFormat) { - /** - * @private - */ - constructor(guard, value, format) { - assertPrivate(guard, _guard, "FixedNumber"); - this.#val = value; - this.#format = format; - const _value = toString(value, format.decimals); - defineProperties(this, { format: format.name, _value }); - this.#tens = getTens(format.decimals); - } - /** - * If true, negative values are permitted, otherwise only - * positive values and zero are allowed. - */ - get signed() { - return this.#format.signed; - } - /** - * The number of bits available to store the value. - */ - get width() { - return this.#format.width; - } - /** - * The number of decimal places in the fixed-point arithment field. - */ - get decimals() { - return this.#format.decimals; - } - /** - * The value as an integer, based on the smallest unit the - * [[decimals]] allow. - */ - get value() { - return this.#val; - } - #checkFormat(other) { - assertArgument(this.format === other.format, "incompatible format; use fixedNumber.toFormat", "other", other); - } - #checkValue(val, safeOp) { - /* - const width = BigInt(this.width); - if (this.signed) { - const limit = (BN_1 << (width - BN_1)); - assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { - operation: safeOp, fault: "overflow", value: val - }); - - if (val > BN_0) { - val = fromTwos(mask(val, width), width); - } else { - val = -fromTwos(mask(-val, width), width); - } - - } else { - const masked = mask(val, width); - assert(safeOp == null || (val >= 0 && val === masked), "overflow", "NUMERIC_FAULT", { - operation: safeOp, fault: "overflow", value: val - }); - val = masked; - } - */ - val = checkValue(val, this.#format, safeOp); - return new _a(_guard, val, this.#format); - } - #add(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue(this.#val + o.#val, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%, ignoring overflow. - */ - addUnsafe(other) { - return this.#add(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - add(other) { - return this.#add(other, "add"); - } - #sub(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue(this.#val - o.#val, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%, ignoring overflow. - */ - subUnsafe(other) { - return this.#sub(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - sub(other) { - return this.#sub(other, "sub"); - } - #mul(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%, ignoring overflow and underflow (precision loss). - */ - mulUnsafe(other) { - return this.#mul(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - mul(other) { - return this.#mul(other, "mul"); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs or if underflow (precision loss) occurs. - */ - mulSignal(other) { - this.#checkFormat(other); - const value = this.#val * other.#val; - assert(value % this.#tens === BN_0, "precision lost during signalling mul", "NUMERIC_FAULT", { - operation: "mulSignal", - fault: "underflow", - value: this, - }); - return this.#checkValue(value / this.#tens, "mulSignal"); - } - #div(o, safeOp) { - assert(o.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { - operation: "div", - fault: "divide-by-zero", - value: this, - }); - this.#checkFormat(o); - return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - divUnsafe(other) { - return this.#div(other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - div(other) { - return this.#div(other, "div"); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%. A [[NumericFaultError]] is thrown if underflow - * (precision loss) occurs. - */ - divSignal(other) { - assert(other.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { - operation: "div", - fault: "divide-by-zero", - value: this, - }); - this.#checkFormat(other); - const value = this.#val * this.#tens; - assert(value % other.#val === BN_0, "precision lost during signalling div", "NUMERIC_FAULT", { - operation: "divSignal", - fault: "underflow", - value: this, - }); - return this.#checkValue(value / other.#val, "divSignal"); - } - /** - * Returns a comparison result between %%this%% and %%other%%. - * - * This is suitable for use in sorting, where ``-1`` implies %%this%% - * is smaller, ``1`` implies %%other%% is larger and ``0`` implies - * both are equal. - */ - cmp(other) { - let a = this.value, b = other.value; - // Coerce a and b to the same magnitude - const delta = this.decimals - other.decimals; - if (delta > 0) { - b *= getTens(delta); - } - else if (delta < 0) { - a *= getTens(-delta); - } - // Comnpare - if (a < b) { - return -1; - } - if (a > b) { - return -1; - } - return 0; - } - /** - * Returns true if %%other%% is equal to %%this%%. - */ - eq(other) { - return this.cmp(other) === 0; - } - /** - * Returns true if %%other%% is less than to %%this%%. - */ - lt(other) { - return this.cmp(other) < 0; - } - /** - * Returns true if %%other%% is less than or equal to %%this%%. - */ - lte(other) { - return this.cmp(other) <= 0; - } - /** - * Returns true if %%other%% is greater than to %%this%%. - */ - gt(other) { - return this.cmp(other) > 0; - } - /** - * Returns true if %%other%% is greater than or equal to %%this%%. - */ - gte(other) { - return this.cmp(other) >= 0; - } - /** - * Returns a new [[FixedNumber]] which is the largest **integer** - * that is less than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - floor() { - let val = this.#val; - if (this.#val < BN_0) { - val -= this.#tens - BN_1; - } - val = (this.#val / this.#tens) * this.#tens; - return this.#checkValue(val, "floor"); - } - /** - * Returns a new [[FixedNumber]] which is the smallest **integer** - * that is greater than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - ceiling() { - let val = this.#val; - if (this.#val > BN_0) { - val += this.#tens - BN_1; - } - val = (this.#val / this.#tens) * this.#tens; - return this.#checkValue(val, "ceiling"); - } - /** - * Returns a new [[FixedNumber]] with the decimal component - * rounded up on ties at %%decimals%% places. - */ - round(decimals) { - if (decimals == null) { - decimals = 0; - } - // Not enough precision to not already be rounded - if (decimals >= this.decimals) { - return this; - } - const delta = this.decimals - decimals; - const bump = BN_5 * getTens(delta - 1); - let value = this.value + bump; - const tens = getTens(delta); - value = (value / tens) * tens; - checkValue(value, this.#format, "round"); - return new _a(_guard, value, this.#format); - } - /** - * Returns true if %%this%% is equal to ``0``. - */ - isZero() { - return this.#val === BN_0; - } - /** - * Returns true if %%this%% is less than ``0``. - */ - isNegative() { - return this.#val < BN_0; - } - /** - * Returns the string representation of %%this%%. - */ - toString() { - return this._value; - } - /** - * Returns a float approximation. - * - * Due to IEEE 754 precission (or lack thereof), this function - * can only return an approximation and most values will contain - * rounding errors. - */ - toUnsafeFloat() { - return parseFloat(this.toString()); - } - /** - * Return a new [[FixedNumber]] with the same value but has had - * its field set to %%format%%. - * - * This will throw if the value cannot fit into %%format%%. - */ - toFormat(format) { - return _a.fromString(this.toString(), format); - } - /** - * Creates a new [[FixedNumber]] for %%value%% divided by - * %%decimal%% places with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% (once adjusted - * for %%decimals%%) cannot fit in %%format%%, either due to overflow - * or underflow (precision loss). - */ - static fromValue(_value, decimals, _format) { - if (decimals == null) { - decimals = 0; - } - const format = getFormat(_format); - let value = getBigInt(_value, "value"); - const delta = decimals - format.decimals; - if (delta > 0) { - const tens = getTens(delta); - assert(value % tens === BN_0, "value loses precision for format", "NUMERIC_FAULT", { - operation: "fromValue", - fault: "underflow", - value: _value, - }); - value /= tens; - } - else if (delta < 0) { - value *= getTens(-delta); - } - checkValue(value, format, "fromValue"); - return new _a(_guard, value, format); - } - /** - * Creates a new [[FixedNumber]] for %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%%, either due to overflow or underflow (precision loss). - */ - static fromString(_value, _format) { - const match = _value.match(/^(-?)([0-9]*)\.?([0-9]*)$/); - assertArgument(match && match[2].length + match[3].length > 0, "invalid FixedNumber string value", "value", _value); - const format = getFormat(_format); - let whole = match[2] || "0", decimal = match[3] || ""; - // Pad out the decimals - while (decimal.length < format.decimals) { - decimal += Zeros; - } - // Check precision is safe - assert(decimal.substring(format.decimals).match(/^0*$/), "too many decimals for format", "NUMERIC_FAULT", { - operation: "fromString", - fault: "underflow", - value: _value, - }); - // Remove extra padding - decimal = decimal.substring(0, format.decimals); - const value = BigInt(match[1] + whole + decimal); - checkValue(value, format, "fromString"); - return new _a(_guard, value, format); - } - /** - * Creates a new [[FixedNumber]] with the big-endian representation - * %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%% due to overflow. - */ - static fromBytes(_value, _format) { - let value = toBigInt(getBytes(_value, "value")); - const format = getFormat(_format); - if (format.signed) { - value = fromTwos(value, format.width); - } - checkValue(value, format, "fromBytes"); - return new _a(_guard, value, format); - } -} -_a = FixedNumber; -//const f1 = FixedNumber.fromString("12.56", "fixed16x2"); -//const f2 = FixedNumber.fromString("0.3", "fixed16x2"); -//console.log(f1.divSignal(f2)); -//const BUMP = FixedNumber.from("0.5"); -//# sourceMappingURL=fixednumber.js.map \ No newline at end of file diff --git a/lib.esm/utils/fixednumber.js.map b/lib.esm/utils/fixednumber.js.map deleted file mode 100644 index e3d37998c..000000000 --- a/lib.esm/utils/fixednumber.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fixednumber.js","sourceRoot":"","sources":["../../src.ts/utils/fixednumber.ts"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAInD,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAEvB,MAAM,MAAM,GAAG,EAAE,CAAC;AAElB,8CAA8C;AAC9C,IAAI,KAAK,GAAG,MAAM,CAAC;AACnB,OAAO,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;IACxB,KAAK,IAAI,KAAK,CAAC;CAChB;AAED,gDAAgD;AAChD,SAAS,OAAO,CAAC,QAAgB;IAC/B,IAAI,MAAM,GAAG,KAAK,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AAS,EAAE,YAAY;YACvB,KAAK,EAAE,WAAW;YAClB,KAAK,EAAE,MAAM;SACd,CACF,CAAC;QAEF,uBAAuB;QACvB,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEhD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,OAAO,CAAC,CAAC;QAEjD,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QAExC,OAAO,IAAI,EAAW,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,CAAC,MAAiB,EAAE,OAAqB;QACvD,IAAI,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAElC,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;SACvC;QAED,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QAEvC,OAAO,IAAI,EAAW,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;CACF;;AAED,0DAA0D;AAC1D,wDAAwD;AACxD,gCAAgC;AAChC,uCAAuC"} \ No newline at end of file diff --git a/lib.esm/utils/geturl-browser.d.ts b/lib.esm/utils/geturl-browser.d.ts deleted file mode 100644 index 133a13813..000000000 --- a/lib.esm/utils/geturl-browser.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; -declare global { - class Headers { - constructor(values: Array<[string, string]>); - forEach(func: (v: string, k: string) => void): void; - } - class Response { - status: number; - statusText: string; - headers: Headers; - arrayBuffer(): Promise; - } - type FetchInit = { - method?: string; - headers?: Headers; - body?: Uint8Array; - }; - function fetch(url: string, init: FetchInit): Promise; -} -export declare function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Promise; -//# sourceMappingURL=geturl-browser.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/geturl-browser.d.ts.map b/lib.esm/utils/geturl-browser.d.ts.map deleted file mode 100644 index 852575bca..000000000 --- a/lib.esm/utils/geturl-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geturl-browser.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl-browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,OAAO,CAAC,MAAM,CAAC;IAEb,MAAM,OAAO;oBACC,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;KACpD;IAGD,MAAM,QAAQ;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;KACpC;IAED,KAAK,SAAS,GAAG;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,UAAU,CAAC;KACnB,CAAC;IAEF,SAAS,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACjE;AAID,wBAAsB,MAAM,CAC1B,GAAG,EAAE,YAAY,EACjB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CA0DrC"} \ No newline at end of file diff --git a/lib.esm/utils/geturl-browser.js b/lib.esm/utils/geturl-browser.js deleted file mode 100644 index ce5379c0a..000000000 --- a/lib.esm/utils/geturl-browser.js +++ /dev/null @@ -1,47 +0,0 @@ -import { assert } from "./errors.js"; -// @TODO: timeout is completely ignored; start a Promise.any with a reject? -// @ts-ignore -export async function getUrl(req, _signal) { - const protocol = req.url.split(":")[0].toLowerCase(); - assert(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { - info: { protocol }, - operation: "request", - }); - assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { - operation: "request", - }); - let signal = undefined; - if (_signal) { - const controller = new AbortController(); - signal = controller.signal; - _signal.addListener(() => { - controller.abort(); - }); - } - const init = { - method: req.method, - headers: new Headers(Array.from(req)), - body: req.body || undefined, - signal, - }; - try { - const resp = await fetch(req.url, init); - const headers = {}; - resp.headers.forEach((value, key) => { - headers[key.toLowerCase()] = value; - }); - const respBody = await resp.arrayBuffer(); - const body = respBody == null ? null : new Uint8Array(respBody); - return { - statusCode: resp.status, - statusMessage: resp.statusText, - headers, - body, - }; - } - catch (error) { - console.log({ error }); - return undefined; - } -} -//# sourceMappingURL=geturl-browser.js.map \ No newline at end of file diff --git a/lib.esm/utils/geturl-browser.js.map b/lib.esm/utils/geturl-browser.js.map deleted file mode 100644 index ba0c9a601..000000000 --- a/lib.esm/utils/geturl-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geturl-browser.js","sourceRoot":"","sources":["../../src.ts/utils/geturl-browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAgCrC,2EAA2E;AAC3E,aAAa;AACb,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,GAAiB,EACjB,OAA2B;IAE3B,MAAM,QAAQ,GAAG,GAAG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,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC;QAEhE,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,MAAM;YACvB,aAAa,EAAE,IAAI,CAAC,UAAU;YAC9B,OAAO;YACP,IAAI;SACL,CAAC;KACH;IAAC,OAAO,KAAU,EAAE;QACnB,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACvB,OAAO,SAAS,CAAC;KAClB;AACH,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/geturl.d.ts b/lib.esm/utils/geturl.d.ts deleted file mode 100644 index a4252134f..000000000 --- a/lib.esm/utils/geturl.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; -/** - * @_ignore: - */ -export declare function getUrl(req: FetchRequest, signal?: FetchCancelSignal): Promise; -//# sourceMappingURL=geturl.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/geturl.d.ts.map b/lib.esm/utils/geturl.d.ts.map deleted file mode 100644 index 8cde884db..000000000 --- a/lib.esm/utils/geturl.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geturl.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAsB,MAAM,CAC1B,GAAG,EAAE,YAAY,EACjB,MAAM,CAAC,EAAE,iBAAiB,GACzB,OAAO,CAAC,cAAc,CAAC,CAqGzB"} \ No newline at end of file diff --git a/lib.esm/utils/geturl.js b/lib.esm/utils/geturl.js deleted file mode 100644 index 075e332d0..000000000 --- a/lib.esm/utils/geturl.js +++ /dev/null @@ -1,80 +0,0 @@ -import http from "http"; -import https from "https"; -import { gunzipSync } from "zlib"; -import { assert } from "./errors.js"; -import { getBytes } from "./data.js"; -/** - * @_ignore: - */ -export async function getUrl(req, signal) { - const protocol = req.url.split(":")[0].toLowerCase(); - assert(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { - info: { protocol }, - operation: "request", - }); - assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { - operation: "request", - }); - const method = req.method; - const headers = Object.assign({}, req.headers); - const options = { method, headers }; - const request = (protocol === "http" ? http : https).request(req.url, options); - request.setTimeout(req.timeout); - const body = req.body; - if (body) { - request.write(Buffer.from(body)); - } - request.end(); - return new Promise((resolve, reject) => { - // @TODO: Node 15 added AbortSignal; once we drop support for - // Node14, we can add that in here too - request.once("response", (resp) => { - const statusCode = resp.statusCode || 0; - const statusMessage = resp.statusMessage || ""; - const headers = Object.keys(resp.headers || {}).reduce((accum, name) => { - let value = resp.headers[name] || ""; - if (Array.isArray(value)) { - value = value.join(", "); - } - accum[name] = value; - return accum; - }, {}); - let body = null; - //resp.setEncoding("utf8"); - resp.on("data", (chunk) => { - if (signal) { - try { - signal.checkSignal(); - } - catch (error) { - return reject(error); - } - } - if (body == null) { - body = chunk; - } - else { - const newBody = new Uint8Array(body.length + chunk.length); - newBody.set(body, 0); - newBody.set(chunk, body.length); - body = newBody; - } - }); - resp.on("end", () => { - if (headers["content-encoding"] === "gzip" && body) { - body = getBytes(gunzipSync(body)); - } - resolve({ statusCode, statusMessage, headers, body }); - }); - resp.on("error", (error) => { - //@TODO: Should this just return nornal response with a server error? - error.response = { statusCode, statusMessage, headers, body }; - reject(error); - }); - }); - request.on("error", (error) => { - reject(error); - }); - }); -} -//# sourceMappingURL=geturl.js.map \ No newline at end of file diff --git a/lib.esm/utils/geturl.js.map b/lib.esm/utils/geturl.js.map deleted file mode 100644 index e88ed76b4..000000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leted file mode 100644 index 40183df8b..000000000 --- a/lib.esm/utils/index.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * There are many simple utilities required to interact with - * Core and to simplify the library, without increasing - * the library dependencies for simple functions. - * - * @_section api/utils:Utilities [about-utils] - */ -export { decodeBase58, encodeBase58 } from "./base58.js"; -export { decodeBase64, encodeBase64 } from "./base64.js"; -export { getBytes, getBytesCopy, isHexString, isBytesLike, hexlify, concat, dataLength, dataSlice, stripZerosLeft, zeroPadValue, zeroPadBytes, arrayify, hexConcat, } from "./data.js"; -export { isCallException, isError, assert, assertArgument, assertArgumentCount, assertPrivate, assertNormalize, makeError, } from "./errors.js"; -export { EventPayload } from "./events.js"; -export { FetchRequest, FetchResponse, FetchCancelSignal } from "./fetch.js"; -export { FixedNumber } from "./fixednumber.js"; -export { fromTwos, toTwos, mask, getBigInt, getNumber, getUint, toBigInt, toNumber, toBeHex, toBeArray, toQuantity, } from "./maths.js"; -export { resolveProperties, defineProperties } from "./properties.js"; -export { decodeRlp } from "./rlp-decode.js"; -export { encodeRlp } from "./rlp-encode.js"; -export { formatXCB, parseXCB, formatUnits, parseUnits } from "./units.js"; -export { toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, } from "./utf8.js"; -export { uuidV4 } from "./uuid.js"; -export type { BytesLike } from "./data.js"; -export type { ErrorCode, CoreBCError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CallExceptionAction, CallExceptionTransaction, CodedCoreBCError, } from "./errors.js"; -export type { EventEmitterable, Listener } from "./events.js"; -export type { GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc, } from "./fetch.js"; -export type { FixedFormat } from "./fixednumber.js"; -export type { BigNumberish, Numeric } from "./maths.js"; -export type { RlpStructuredData } from "./rlp.js"; -export type { Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, } from "./utf8.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/index.d.ts.map b/lib.esm/utils/index.d.ts.map deleted file mode 100644 index 2efd33012..000000000 --- a/lib.esm/utils/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,WAAW,EACX,OAAO,EACP,MAAM,EACN,UAAU,EACV,SAAS,EACT,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,SAAS,GACV,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,eAAe,EACf,OAAO,EACP,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,SAAS,EACT,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB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js deleted file mode 100644 index 00f5ed0b6..000000000 --- a/lib.esm/utils/index.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * There are many simple utilities required to interact with - * Core and to simplify the library, without increasing - * the library dependencies for simple functions. - * - * @_section api/utils:Utilities [about-utils] - */ -export { decodeBase58, encodeBase58 } from "./base58.js"; -export { decodeBase64, encodeBase64 } from "./base64.js"; -export { getBytes, getBytesCopy, isHexString, isBytesLike, hexlify, concat, dataLength, dataSlice, stripZerosLeft, zeroPadValue, zeroPadBytes, arrayify, hexConcat, } from "./data.js"; -export { isCallException, isError, assert, assertArgument, assertArgumentCount, assertPrivate, assertNormalize, makeError, } from "./errors.js"; -export { EventPayload } from "./events.js"; -export { FetchRequest, FetchResponse, FetchCancelSignal } from "./fetch.js"; -export { FixedNumber } from "./fixednumber.js"; -export { fromTwos, toTwos, mask, getBigInt, getNumber, getUint, toBigInt, toNumber, toBeHex, toBeArray, toQuantity, } from "./maths.js"; -export { resolveProperties, defineProperties } from "./properties.js"; -export { decodeRlp } from "./rlp-decode.js"; -export { encodeRlp } from "./rlp-encode.js"; -export { formatXCB, parseXCB, formatUnits, parseUnits } from "./units.js"; -export { toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, } from "./utf8.js"; -export { uuidV4 } from "./uuid.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.esm/utils/index.js.map b/lib.esm/utils/index.js.map deleted file mode 100644 index ba6e458d0..000000000 --- a/lib.esm/utils/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,WAAW,EACX,OAAO,EACP,MAAM,EACN,UAAU,EACV,SAAS,EACT,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,SAAS,GACV,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,eAAe,EACf,OAAO,EACP,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,SAAS,EACT,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE1E,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,cAAc,GACf,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/maths.d.ts b/lib.esm/utils/maths.d.ts deleted file mode 100644 index e1fd19522..000000000 --- a/lib.esm/utils/maths.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -import type { BytesLike } from "./data.js"; -/** - * Any type that can be used where a numeric value is needed. - */ -export type Numeric = number | bigint; -/** - * Any type that can be used where a big number is needed. - */ -export type BigNumberish = string | Numeric; -/** - * Convert %%value%% from a twos-compliment representation of %%width%% - * bits to its value. - * - * If the highest bit is ``1``, the result will be negative. - */ -export declare function fromTwos(_value: BigNumberish, _width: Numeric): bigint; -/** - * Convert %%value%% to a twos-compliment representation of - * %%width%% bits. - * - * The result will always be positive. - */ -export declare function toTwos(_value: BigNumberish, _width: Numeric): bigint; -/** - * Mask %%value%% with a bitmask of %%bits%% ones. - */ -export declare function mask(_value: BigNumberish, _bits: Numeric): bigint; -/** - * Gets a BigInt from %%value%%. If it is an invalid value for - * a BigInt, then an ArgumentError will be thrown for %%name%%. - */ -export declare function getBigInt(value: BigNumberish, name?: string): bigint; -export declare function getUint(value: BigNumberish, name?: string): bigint; -export declare function toBigInt(value: BigNumberish | Uint8Array): bigint; -/** - * Gets a //number// from %%value%%. If it is an invalid value for - * a //number//, then an ArgumentError will be thrown for %%name%%. - */ -export declare function getNumber(value: BigNumberish, name?: string): number; -/** - * Converts %%value%% to a number. If %%value%% is a Uint8Array, it - * is treated as Big Endian data. Throws if the value is not safe. - */ -export declare function toNumber(value: BigNumberish | Uint8Array): number; -/** - * Converts %%value%% to a Big Endian hexstring, optionally padded to - * %%width%% bytes. - */ -export declare function toBeHex(_value: BigNumberish, _width?: Numeric): string; -/** - * Converts %%value%% to a Big Endian Uint8Array. - */ -export declare function toBeArray(_value: BigNumberish): Uint8Array; -/** - * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. - * - * A //Quantity// does not have and leading 0 values unless the value is - * the literal value `0x0`. This is most commonly used for JSSON-RPC - * numeric values. - */ -export declare function toQuantity(value: BytesLike | BigNumberish): string; -//# sourceMappingURL=maths.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/maths.d.ts.map b/lib.esm/utils/maths.d.ts.map deleted file mode 100644 index 375586bed..000000000 --- a/lib.esm/utils/maths.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"maths.d.ts","sourceRoot":"","sources":["../../src.ts/utils/maths.ts"],"names":[],"mappings":"AAQA,OAAO,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"} \ No newline at end of file diff --git a/lib.esm/utils/maths.js b/lib.esm/utils/maths.js deleted file mode 100644 index 0c99f2808..000000000 --- a/lib.esm/utils/maths.js +++ /dev/null @@ -1,220 +0,0 @@ -/** - * Some mathematic operations. - * - * @_subsection: api/utils:Math Helpers [about-maths] - */ -import { hexlify, isBytesLike } from "./data.js"; -import { assert, assertArgument } from "./errors.js"; -const BN_0 = BigInt(0); -const BN_1 = BigInt(1); -//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1; -// IEEE 754 support 53-bits of mantissa -const maxValue = 0x1fffffffffffff; -/** - * Convert %%value%% from a twos-compliment representation of %%width%% - * bits to its value. - * - * If the highest bit is ``1``, the result will be negative. - */ -export function fromTwos(_value, _width) { - const value = getUint(_value, "value"); - const width = BigInt(getNumber(_width, "width")); - assert(value >> width === BN_0, "overflow", "NUMERIC_FAULT", { - operation: "fromTwos", - fault: "overflow", - value: _value, - }); - // Top bit set; treat as a negative value - if (value >> (width - BN_1)) { - const mask = (BN_1 << width) - BN_1; - return -((~value & mask) + BN_1); - } - return value; -} -/** - * Convert %%value%% to a twos-compliment representation of - * %%width%% bits. - * - * The result will always be positive. - */ -export function toTwos(_value, _width) { - let value = getBigInt(_value, "value"); - const width = BigInt(getNumber(_width, "width")); - const limit = BN_1 << (width - BN_1); - if (value < BN_0) { - value = -value; - assert(value <= limit, "too low", "NUMERIC_FAULT", { - operation: "toTwos", - fault: "overflow", - value: _value, - }); - const mask = (BN_1 << width) - BN_1; - return (~value & mask) + BN_1; - } - else { - assert(value < limit, "too high", "NUMERIC_FAULT", { - operation: "toTwos", - fault: "overflow", - value: _value, - }); - } - return value; -} -/** - * Mask %%value%% with a bitmask of %%bits%% ones. - */ -export function mask(_value, _bits) { - const value = getUint(_value, "value"); - const bits = BigInt(getNumber(_bits, "bits")); - return value & ((BN_1 << bits) - BN_1); -} -/** - * Gets a BigInt from %%value%%. If it is an invalid value for - * a BigInt, then an ArgumentError will be thrown for %%name%%. - */ -export function getBigInt(value, name) { - switch (typeof value) { - case "bigint": - return value; - case "number": - assertArgument(Number.isInteger(value), "underflow", name || "value", value); - assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return BigInt(value); - case "string": - try { - if (value === "") { - throw new Error("empty string"); - } - if (value[0] === "-" && value[1] !== "-") { - return -BigInt(value.substring(1)); - } - return BigInt(value); - } - catch (e) { - assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || "value", value); - } - } - assertArgument(false, "invalid BigNumberish value", name || "value", value); -} -export function getUint(value, name) { - const result = getBigInt(value, name); - assert(result >= BN_0, "unsigned value cannot be negative", "NUMERIC_FAULT", { - fault: "overflow", - operation: "getUint", - value, - }); - return result; -} -const Nibbles = "0123456789abcdef"; -/* - * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it - * is treated as Big Endian data. - */ -export function toBigInt(value) { - if (value instanceof Uint8Array) { - let result = "0x0"; - for (const v of value) { - result += Nibbles[v >> 4]; - result += Nibbles[v & 0x0f]; - } - return BigInt(result); - } - return getBigInt(value); -} -/** - * Gets a //number// from %%value%%. If it is an invalid value for - * a //number//, then an ArgumentError will be thrown for %%name%%. - */ -export function getNumber(value, name) { - switch (typeof value) { - case "bigint": - assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return Number(value); - case "number": - assertArgument(Number.isInteger(value), "underflow", name || "value", value); - assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return value; - case "string": - try { - if (value === "") { - throw new Error("empty string"); - } - return getNumber(BigInt(value), name); - } - catch (e) { - assertArgument(false, `invalid numeric string: ${e.message}`, name || "value", value); - } - } - assertArgument(false, "invalid numeric value", name || "value", value); -} -/** - * Converts %%value%% to a number. If %%value%% is a Uint8Array, it - * is treated as Big Endian data. Throws if the value is not safe. - */ -export function toNumber(value) { - return getNumber(toBigInt(value)); -} -/** - * Converts %%value%% to a Big Endian hexstring, optionally padded to - * %%width%% bytes. - */ -export function toBeHex(_value, _width) { - const value = getUint(_value, "value"); - let result = value.toString(16); - if (_width == null) { - // Ensure the value is of even length - if (result.length % 2) { - result = "0" + result; - } - } - else { - const width = getNumber(_width, "width"); - assert(width * 2 >= result.length, `value exceeds width (${width} bits)`, "NUMERIC_FAULT", { - operation: "toBeHex", - fault: "overflow", - value: _value, - }); - // Pad the value to the required width - while (result.length < width * 2) { - result = "0" + result; - } - } - return "0x" + result; -} -/** - * Converts %%value%% to a Big Endian Uint8Array. - */ -export function toBeArray(_value) { - const value = getUint(_value, "value"); - if (value === BN_0) { - return new Uint8Array([]); - } - let hex = value.toString(16); - if (hex.length % 2) { - hex = "0" + hex; - } - const result = new Uint8Array(hex.length / 2); - for (let i = 0; i < result.length; i++) { - const offset = i * 2; - result[i] = parseInt(hex.substring(offset, offset + 2), 16); - } - return result; -} -/** - * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. - * - * A //Quantity// does not have and leading 0 values unless the value is - * the literal value `0x0`. This is most commonly used for JSSON-RPC - * numeric values. - */ -export function toQuantity(value) { - let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring(2); - while (result.startsWith("0")) { - result = result.substring(1); - } - if (result === "") { - result = "0"; - } - return "0x" + result; -} -//# sourceMappingURL=maths.js.map \ No newline at end of file diff --git a/lib.esm/utils/maths.js.map b/lib.esm/utils/maths.js.map deleted file mode 100644 index 16ed7f6e1..000000000 --- a/lib.esm/utils/maths.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"maths.js","sourceRoot":"","sources":["../../src.ts/utils/maths.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAcrD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAEvB,iDAAiD;AAEjD,uCAAuC;AACv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G,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KAC7D;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAA+B;IACxD,IAAI,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAC3E,CAAC,CACF,CAAC;IACF,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC7B,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KAC9B;IACD,IAAI,MAAM,KAAK,EAAE,EAAE;QACjB,MAAM,GAAG,GAAG,CAAC;KACd;IACD,OAAO,IAAI,GAAG,MAAM,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/properties.d.ts b/lib.esm/utils/properties.d.ts deleted file mode 100644 index f7871cc89..000000000 --- a/lib.esm/utils/properties.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Resolves to a new object that is a copy of %%value%%, but with all - * values resolved. - */ -export declare function resolveProperties(value: { - [P in keyof T]: T[P] | Promise; -}): Promise; -/** - * Assigns the %%values%% to %%target%% as read-only values. - * - * It %%types%% is specified, the values are checked. - */ -export declare function defineProperties(target: T, values: { - [K in keyof T]?: T[K]; -}, types?: { - [K in keyof T]?: string; -}): void; -export declare function checkProperties(object: any, properties: { - [name: string]: boolean; -}): void; -//# sourceMappingURL=properties.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/properties.d.ts.map b/lib.esm/utils/properties.d.ts.map deleted file mode 100644 index 2520af8fb..000000000 --- a/lib.esm/utils/properties.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src.ts/utils/properties.ts"],"names":[],"mappings":"AAiCA;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE;KAC/C,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACrC,GAAG,OAAO,CAAC,CAAC,CAAC,CAYb;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,MAAM,EAAE,CAAC,EACT,MAAM,EAAE;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAAE,EACjC,KAAK,CAAC,EAAE;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM;CAAE,GAClC,IAAI,CAeN;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,GAAG,EACX,UAAU,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GACtC,IAAI,CAcN"} \ No newline at end of file diff --git a/lib.esm/utils/properties.js b/lib.esm/utils/properties.js deleted file mode 100644 index c5b23d630..000000000 --- a/lib.esm/utils/properties.js +++ /dev/null @@ -1,70 +0,0 @@ -import { Logger } from "../logger/logger.js"; -/** - * Property helper functions. - * - * @_subsection api/utils:Properties [about-properties] - */ -const logger = new Logger("utils/properties/0.0.1"); -function checkType(value, type, name) { - const types = type.split("|").map((t) => t.trim()); - for (let i = 0; i < types.length; i++) { - switch (type) { - case "any": - return; - case "bigint": - case "boolean": - case "number": - case "string": - if (typeof value === type) { - return; - } - } - } - const error = new Error(`invalid value for type ${type}`); - error.code = "INVALID_ARGUMENT"; - error.argument = `value.${name}`; - error.value = value; - throw error; -} -/** - * Resolves to a new object that is a copy of %%value%%, but with all - * values resolved. - */ -export async function resolveProperties(value) { - const keys = Object.keys(value); - const results = await Promise.all(keys.map((k) => Promise.resolve(value[k]))); - return results.reduce((accum, v, index) => { - accum[keys[index]] = v; - return accum; - }, {}); -} -/** - * Assigns the %%values%% to %%target%% as read-only values. - * - * It %%types%% is specified, the values are checked. - */ -export function defineProperties(target, values, types) { - for (let key in values) { - let value = values[key]; - const type = types ? types[key] : null; - if (type) { - checkType(value, type, key); - } - Object.defineProperty(target, key, { - enumerable: true, - value, - writable: false, - }); - } -} -export function checkProperties(object, properties) { - if (!object || typeof object !== "object") { - logger.throwArgumentError("invalid object", "object", object); - } - Object.keys(object).forEach((key) => { - if (!properties[key]) { - logger.throwArgumentError("invalid object key - " + key, "transaction:" + key, object); - } - }); -} -//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/lib.esm/utils/properties.js.map b/lib.esm/utils/properties.js.map deleted file mode 100644 index b5e7f94a0..000000000 --- a/lib.esm/utils/properties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src.ts/utils/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAEpD,SAAS,SAAS,CAAC,KAAU,EAAE,IAAY,EAAE,IAAY;IACvD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,QAAQ,IAAI,EAAE;YACZ,KAAK,KAAK;gBACR,OAAO;YACT,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ;gBACX,IAAI,OAAO,KAAK,KAAK,IAAI,EAAE;oBACzB,OAAO;iBACR;SACJ;KACF;IAED,MAA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K;YACL,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;KACJ;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,MAAW,EACX,UAAuC;IAEvC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QACzC,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KAC/D;IAED,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAClC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YACpB,MAAM,CAAC,kBAAkB,CACvB,uBAAuB,GAAG,GAAG,EAC7B,cAAc,GAAG,GAAG,EACpB,MAAM,CACP,CAAC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/rlp-decode.d.ts b/lib.esm/utils/rlp-decode.d.ts deleted file mode 100644 index b77b08b9c..000000000 --- a/lib.esm/utils/rlp-decode.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { BytesLike, RlpStructuredData } from "./index.js"; -/** - * Decodes %%data%% into the structured data it represents. - */ -export declare function decodeRlp(_data: BytesLike): RlpStructuredData; -//# sourceMappingURL=rlp-decode.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/rlp-decode.d.ts.map b/lib.esm/utils/rlp-decode.d.ts.map deleted file mode 100644 index b82126ab8..000000000 --- a/lib.esm/utils/rlp-decode.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp-decode.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp-decode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAyH/D;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,iBAAiB,CAU7D"} \ No newline at end of file diff --git a/lib.esm/utils/rlp-decode.js b/lib.esm/utils/rlp-decode.js deleted file mode 100644 index 9a842bb43..000000000 --- a/lib.esm/utils/rlp-decode.js +++ /dev/null @@ -1,84 +0,0 @@ -import { hexlify } from "./data.js"; -import { assert, assertArgument } from "./errors.js"; -import { getBytes } from "./data.js"; -function hexlifyByte(value) { - let result = value.toString(16); - while (result.length < 2) { - result = "0" + result; - } - return "0x" + result; -} -function unarrayifyInteger(data, offset, length) { - let result = 0; - for (let i = 0; i < length; i++) { - result = result * 256 + data[offset + i]; - } - return result; -} -function _decodeChildren(data, offset, childOffset, length) { - const result = []; - while (childOffset < offset + 1 + length) { - const decoded = _decode(data, childOffset); - result.push(decoded.result); - childOffset += decoded.consumed; - assert(childOffset <= offset + 1 + length, "child data too short", "BUFFER_OVERRUN", { - buffer: data, - length, - offset, - }); - } - return { consumed: 1 + length, result: result }; -} -// returns { consumed: number, result: Object } -function _decode(data, offset) { - assert(data.length !== 0, "data too short", "BUFFER_OVERRUN", { - buffer: data, - length: 0, - offset: 1, - }); - const checkOffset = (offset) => { - assert(offset <= data.length, "data short segment too short", "BUFFER_OVERRUN", { - buffer: data, - length: data.length, - offset, - }); - }; - // Array with extra length prefix - if (data[offset] >= 0xf8) { - const lengthLength = data[offset] - 0xf7; - checkOffset(offset + 1 + lengthLength); - const length = unarrayifyInteger(data, offset + 1, lengthLength); - checkOffset(offset + 1 + lengthLength + length); - return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); - } - else if (data[offset] >= 0xc0) { - const length = data[offset] - 0xc0; - checkOffset(offset + 1 + length); - return _decodeChildren(data, offset, offset + 1, length); - } - else if (data[offset] >= 0xb8) { - const lengthLength = data[offset] - 0xb7; - checkOffset(offset + 1 + lengthLength); - const length = unarrayifyInteger(data, offset + 1, lengthLength); - checkOffset(offset + 1 + lengthLength + length); - const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); - return { consumed: 1 + lengthLength + length, result: result }; - } - else if (data[offset] >= 0x80) { - const length = data[offset] - 0x80; - checkOffset(offset + 1 + length); - const result = hexlify(data.slice(offset + 1, offset + 1 + length)); - return { consumed: 1 + length, result: result }; - } - return { consumed: 1, result: hexlifyByte(data[offset]) }; -} -/** - * Decodes %%data%% into the structured data it represents. - */ -export function decodeRlp(_data) { - const data = getBytes(_data, "data"); - const decoded = _decode(data, 0); - assertArgument(decoded.consumed === data.length, "unexpected junk after rlp payload", "data", _data); - return decoded.result; -} -//# sourceMappingURL=rlp-decode.js.map \ No newline at end of file diff --git a/lib.esm/utils/rlp-decode.js.map b/lib.esm/utils/rlp-decode.js.map deleted file mode 100644 index 18b3f3d8a..000000000 --- a/lib.esm/utils/rlp-decode.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp-decode.js","sourceRoot":"","sources":["../../src.ts/utils/rlp-decode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAIrC,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACxB,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;KACvB;IACD,OAAO,IAAI,GAAG,MAAM,CAAC;AACvB,CAAC;AAED,SAAS,iBAAiB,CACxB,IAAgB,EAChB,MAAc,EACd,MAAc;IAEd,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/B,MAAM,GAAG,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KAC1C;IACD,OAAO,MAAM,CAAC;AAChB,CAAC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AC,IAAI,IAAI,EAAE;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QACnC,WAAW,CAAC,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;QAEjC,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QACpE,OAAO,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;KACjD;IAED,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,KAAgB;IACxC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACjC,cAAc,CACZ,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC,MAAM,EAChC,mCAAmC,EACnC,MAAM,EACN,KAAK,CACN,CAAC;IACF,OAAO,OAAO,CAAC,MAAM,CAAC;AACxB,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/rlp-encode.d.ts b/lib.esm/utils/rlp-encode.d.ts deleted file mode 100644 index 9c3d024ac..000000000 --- a/lib.esm/utils/rlp-encode.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { RlpStructuredData } from "./rlp.js"; -/** - * Encodes %%object%% as an RLP-encoded [[DataHexString]]. - */ -export declare function encodeRlp(object: RlpStructuredData): string; -//# sourceMappingURL=rlp-encode.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/rlp-encode.d.ts.map b/lib.esm/utils/rlp-encode.d.ts.map deleted file mode 100644 index 3fa6ef0ba..000000000 --- a/lib.esm/utils/rlp-encode.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp-encode.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp-encode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAgDlD;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAO3D"} \ No newline at end of file diff --git a/lib.esm/utils/rlp-encode.js b/lib.esm/utils/rlp-encode.js deleted file mode 100644 index a4e938225..000000000 --- a/lib.esm/utils/rlp-encode.js +++ /dev/null @@ -1,48 +0,0 @@ -import { getBytes } from "./data.js"; -function arrayifyInteger(value) { - const result = []; - while (value) { - result.unshift(value & 0xff); - value >>= 8; - } - return result; -} -function _encode(object) { - if (Array.isArray(object)) { - let payload = []; - object.forEach(function (child) { - payload = payload.concat(_encode(child)); - }); - if (payload.length <= 55) { - payload.unshift(0xc0 + payload.length); - return payload; - } - const length = arrayifyInteger(payload.length); - length.unshift(0xf7 + length.length); - return length.concat(payload); - } - const data = Array.prototype.slice.call(getBytes(object, "object")); - if (data.length === 1 && data[0] <= 0x7f) { - return data; - } - else if (data.length <= 55) { - data.unshift(0x80 + data.length); - return data; - } - const length = arrayifyInteger(data.length); - length.unshift(0xb7 + length.length); - return length.concat(data); -} -const nibbles = "0123456789abcdef"; -/** - * Encodes %%object%% as an RLP-encoded [[DataHexString]]. - */ -export function encodeRlp(object) { - let result = "0x"; - for (const v of _encode(object)) { - result += nibbles[v >> 4]; - result += nibbles[v & 0xf]; - } - return result; -} -//# sourceMappingURL=rlp-encode.js.map \ No newline at end of file diff --git a/lib.esm/utils/rlp-encode.js.map b/lib.esm/utils/rlp-encode.js.map deleted file mode 100644 index f586be932..000000000 --- a/lib.esm/utils/rlp-encode.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp-encode.js","sourceRoot":"","sources":["../../src.ts/utils/rlp-encode.ts"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AI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;KACb;IAED,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAErC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,OAAO,GAAG,kBAAkB,CAAC;AAEnC;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,MAAyB;IACjD,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;QAC/B,MAAM,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1B,MAAM,IAAI,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;KAC5B;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/rlp.d.ts b/lib.esm/utils/rlp.d.ts deleted file mode 100644 index 6ef450115..000000000 --- a/lib.esm/utils/rlp.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * The [[link-rlp]] (RLP) encoding is used throughout Core - * to serialize nested structures of Arrays and data. - * - * @_subsection api/utils:Recursive-Length Prefix [about-rlp] - */ -export { decodeRlp } from "./rlp-decode.js"; -export { encodeRlp } from "./rlp-encode.js"; -/** - * An RLP-encoded structure. - */ -export type RlpStructuredData = string | Array; -//# sourceMappingURL=rlp.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/rlp.d.ts.map b/lib.esm/utils/rlp.d.ts.map deleted file mode 100644 index c5043abd3..000000000 --- a/lib.esm/utils/rlp.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/rlp.js b/lib.esm/utils/rlp.js deleted file mode 100644 index 35543b4a9..000000000 --- a/lib.esm/utils/rlp.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * The [[link-rlp]] (RLP) encoding is used throughout Core - * to serialize nested structures of Arrays and data. - * - * @_subsection api/utils:Recursive-Length Prefix [about-rlp] - */ -export { decodeRlp } from "./rlp-decode.js"; -export { encodeRlp } from "./rlp-encode.js"; -//# sourceMappingURL=rlp.js.map \ No newline at end of file diff --git a/lib.esm/utils/rlp.js.map b/lib.esm/utils/rlp.js.map deleted file mode 100644 index 6ad8eda8d..000000000 --- a/lib.esm/utils/rlp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp.js","sourceRoot":"","sources":["../../src.ts/utils/rlp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/units.d.ts b/lib.esm/utils/units.d.ts deleted file mode 100644 index dfb7a32a6..000000000 --- a/lib.esm/utils/units.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { BigNumberish, Numeric } from "../utils/index.js"; -/** - * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal - * places. The %%unit%% may be the number of decimal places or the name of - * a unit - * - */ -export declare function formatUnits(value: BigNumberish, unit?: string | Numeric): string; -/** - * Converts the //decimal string// %%value%% to a BigInt, assuming - * %%unit%% decimal places. The %%unit%% may the number of decimal places - * or the name of a unit. - */ -export declare const scientificToDecimal: (num: string | number) => string | number; -export declare const trimDecimals: (n: string, decimals?: number) => string; -export declare function parseUnits(value: string, unit?: string | Numeric): bigint; -/** - * Converts %%value%% into a //decimal string// using 18 decimal places. - */ -export declare function formatXCB(ore: BigNumberish): string; -/** - * Converts the //decimal string// %%xcb%% to a BigInt, using 18 - * decimal places. - */ -export declare function parseXCB(xcb: string): bigint; -//# sourceMappingURL=units.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/units.d.ts.map b/lib.esm/utils/units.d.ts.map deleted file mode 100644 index 3db242e6c..000000000 --- a/lib.esm/utils/units.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src.ts/utils/units.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAwB/D;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,YAAY,EACnB,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GACtB,MAAM,CAWR;AAED;;;;GAIG;AAEH,eAAO,MAAM,mBAAmB,QAAS,MAAM,GAAG,MAAM,oBA6CvD,CAAC;AACF,eAAO,MAAM,YAAY,MAAO,MAAM,8BAQrC,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAsBzE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAEnD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C"} \ No newline at end of file diff --git a/lib.esm/utils/units.js b/lib.esm/utils/units.js deleted file mode 100644 index a4b26e5d7..000000000 --- a/lib.esm/utils/units.js +++ /dev/null @@ -1,151 +0,0 @@ -/** - * Most interactions with Core requires integer values, which use - * the smallest magnitude unit. - * - * For example, imagine dealing with dollars and cents. Since dollars - * are divisible, non-integer values are possible, such as ``$10.77``. - * By using the smallest indivisible unit (i.e. cents), the value can - * be kept as the integer ``1077``. - * - * When receiving decimal input from the user (as a decimal string), - * the value should be converted to an integer and when showing a user - * a value, the integer value should be converted to a decimal string. - * - * This creates a clear distinction, between values to be used by code - * (integers) and values used for display logic to users (decimals). - * - * The native unit in Core, //Core// is divisible to 18 decimal places, - * where each individual unit is called a //ore//. - * - * @_subsection api/utils:Unit Conversion [about-units] - */ -import { assertArgument } from "./errors.js"; -import { FixedNumber } from "./fixednumber.js"; -import { getNumber } from "./maths.js"; -const names = [ - ///Ore, the smallest and atomic amount of Core - "ore", - ///fecore, 1000 ore - "fecore", - ///Picore, one million ore - "picore", - ///Nacore, one billion ore. Typically a reasonable unit to measure energy prices. - "nacore", - ///Μcore, 10^12 ore or 1 μCore - "mcore", - ///micore, 10^15 ore or 1 mcore - "micore", - "core", -]; -/** - * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal - * places. The %%unit%% may be the number of decimal places or the name of - * a unit - * - */ -export function formatUnits(value, unit) { - let decimals = 18; - if (typeof unit === "string") { - const index = names.indexOf(unit); - assertArgument(index >= 0, "invalid unit", "unit", unit); - decimals = 3 * index; - } - else if (unit != null) { - decimals = getNumber(unit, "unit"); - } - return FixedNumber.fromValue(value, decimals, { decimals }).toString(); -} -/** - * Converts the //decimal string// %%value%% to a BigInt, assuming - * %%unit%% decimal places. The %%unit%% may the number of decimal places - * or the name of a unit. - */ -export const scientificToDecimal = (num) => { - // @ts-ignore - var nsign = Math.sign(num); - //remove the sign - // @ts-ignore - num = Math.abs(num); - //if the number is in scientific notation remove it - // @ts-ignore - if (/\d+\.?\d*e[\+\-]*\d+/i.test(num)) { - var zero = "0", - // @ts-ignore - parts = String(num).toLowerCase().split("e"), //split into coeff and exponent - e = parts.pop(), //store the exponential part - // @ts-ignore - l = Math.abs(e), //get the number of zeros - // @ts-ignore - sign = e / l, coeff_array = parts[0].split("."); - if (sign === -1) { - l = l - coeff_array[0].length; - if (l < 0) { - // @ts-ignore - num = - coeff_array[0].slice(0, l) + - "." + - coeff_array[0].slice(l) + - (coeff_array.length === 2 ? coeff_array[1] : ""); - } - else { - // @ts-ignore - num = zero + "." + new Array(l + 1).join(zero) + coeff_array.join(""); - } - } - else { - var dec = coeff_array[1]; - if (dec) - l = l - dec.length; - if (l < 0) { - // @ts-ignore - num = coeff_array[0] + dec.slice(0, l) + "." + dec.slice(l); - } - else { - // @ts-ignore - num = coeff_array.join("") + new Array(l + 1).join(zero); - } - } - } - // @ts-ignore - return nsign < 0 ? "-" + num : num; -}; -export const trimDecimals = (n, decimals = 18) => { - n += ""; - if (n.indexOf(".") === -1) - return n; - const arr = n.split("."); - const fraction = arr[1].substr(0, decimals); - return arr[0] + "." + fraction; -}; -export function parseUnits(value, unit) { - assertArgument(typeof value === "string", "value must be a string", "value", value); - if (value.includes("e")) { - value = scientificToDecimal(value).toString(); - } - let decimals = 18; - if (typeof unit === "string") { - const index = names.indexOf(unit); - assertArgument(index >= 0, "invalid unit", "unit", unit); - decimals = 3 * index; - value = trimDecimals(value, decimals); - } - else if (unit != null) { - decimals = getNumber(unit, "unit"); - value = trimDecimals(value, decimals); - } - return FixedNumber.fromString(value, { decimals }).value; -} -/** - * Converts %%value%% into a //decimal string// using 18 decimal places. - */ -export function formatXCB(ore) { - return formatUnits(ore, 18); -} -/** - * Converts the //decimal string// %%xcb%% to a BigInt, using 18 - * decimal places. - */ -export function parseXCB(xcb) { - return parseUnits(xcb, 18); -} -//# sourceMappingURL=units.js.map \ No newline at end of file diff --git a/lib.esm/utils/units.js.map b/lib.esm/utils/units.js.map deleted file mode 100644 index 163c94963..000000000 --- a/lib.esm/utils/units.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"units.js","sourceRoot":"","sources":["../../src.ts/utils/units.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;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,KAAK,QAAQ,EAAE;QAC5B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClC,cAAc,CAAC,KAAK,IAAI,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QACzD,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC;QACrB,KAAK,GAAG,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;KACvC;SAAM,IAAI,IAAI,IAAI,IAAI,EAAE;QACvB,QAAQ,GAAG,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACnC,KAAK,GAAG,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;KACvC;IAED,OAAO,WAAW,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,GAAiB;IACzC,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,OAAO,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/utf8.d.ts b/lib.esm/utils/utf8.d.ts deleted file mode 100644 index 7bb87cc7d..000000000 --- a/lib.esm/utils/utf8.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -import type { BytesLike } from "./index.js"; -/** - * The stanard normalization forms. - */ -export type UnicodeNormalizationForm = "NFC" | "NFD" | "NFKC" | "NFKD"; -/** - * When using the UTF-8 error API the following errors can be intercepted - * and processed as the %%reason%% passed to the [[Utf8ErrorFunc]]. - * - * **``"UNEXPECTED_CONTINUE"``** - a continuation byte was present where there - * was nothing to continue. - * - * **``"BAD_PREFIX"``** - an invalid (non-continuation) byte to start a - * UTF-8 codepoint was found. - * - * **``"OVERRUN"``** - the string is too short to process the expected - * codepoint length. - * - * **``"MISSING_CONTINUE"``** - a missing continuation byte was expected but - * not found. The %%offset%% indicates the index the continuation byte - * was expected at. - * - * **``"OUT_OF_RANGE"``** - the computed code point is outside the range - * for UTF-8. The %%badCodepoint%% indicates the computed codepoint, which was - * outside the valid UTF-8 range. - * - * **``"UTF16_SURROGATE"``** - the UTF-8 strings contained a UTF-16 surrogate - * pair. The %%badCodepoint%% is the computed codepoint, which was inside the - * UTF-16 surrogate range. - * - * **``"OVERLONG"``** - the string is an overlong representation. The - * %%badCodepoint%% indicates the computed codepoint, which has already - * been bounds checked. - * - * - * @returns string - */ -export type Utf8ErrorReason = "UNEXPECTED_CONTINUE" | "BAD_PREFIX" | "OVERRUN" | "MISSING_CONTINUE" | "OUT_OF_RANGE" | "UTF16_SURROGATE" | "OVERLONG"; -/** - * A callback that can be used with [[toUtf8String]] to analysis or - * recovery from invalid UTF-8 data. - * - * Parsing UTF-8 data is done through a simple Finite-State Machine (FSM) - * which calls the ``Utf8ErrorFunc`` if a fault is detected. - * - * The %%reason%% indicates where in the FSM execution the fault - * occurred and the %%offset%% indicates where the input failed. - * - * The %%bytes%% represents the raw UTF-8 data that was provided and - * %%output%% is the current array of UTF-8 code-points, which may - * be updated by the ``Utf8ErrorFunc``. - * - * The value of the %%badCodepoint%% depends on the %%reason%%. See - * [[Utf8ErrorReason]] for details. - * - * The function should return the number of bytes that should be skipped - * when control resumes to the FSM. - */ -export type Utf8ErrorFunc = (reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array, badCodepoint?: number) => number; -/** - * A handful of popular, built-in UTF-8 error handling strategies. - * - * **``"error"``** - throws on ANY illegal UTF-8 sequence or - * non-canonical (overlong) codepoints (this is the default) - * - * **``"ignore"``** - silently drops any illegal UTF-8 sequence - * and accepts non-canonical (overlong) codepoints - * - * **``"replace"``** - replace any illegal UTF-8 sequence with the - * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts - * non-canonical (overlong) codepoints - * - * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> - */ -export declare const Utf8ErrorFuncs: Readonly>; -/** - * Returns the UTF-8 byte representation of %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ -export declare function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array; -/** - * Returns the string represented by the UTF-8 data %%bytes%%. - * - * When %%onError%% function is specified, it is called on UTF-8 - * errors allowing recovery using the [[Utf8ErrorFunc]] API. - * (default: [error](Utf8ErrorFuncs)) - */ -export declare function toUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string; -/** - * Returns the UTF-8 code-points for %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ -export declare function toUtf8CodePoints(str: string, form?: UnicodeNormalizationForm): Array; -//# sourceMappingURL=utf8.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/utf8.d.ts.map b/lib.esm/utils/utf8.d.ts.map deleted file mode 100644 index f79c87b2e..000000000 --- a/lib.esm/utils/utf8.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utf8.d.ts","sourceRoot":"","sources":["../../src.ts/utils/utf8.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAI5C;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,eAAe,GACvB,qBAAqB,GACrB,YAAY,GACZ,SAAS,GACT,kBAAkB,GAClB,cAAc,GACd,iBAAiB,GACjB,UAAU,CAAC;AAEf;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EACrB,YAAY,CAAC,EAAE,MAAM,KAClB,MAAM,CAAC;AAwEZ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CACnC,MAAM,CAAC,OAAO,GAAG,QAAQ,GAAG,SAAS,EAAE,aAAa,CAAC,CAKrD,CAAC;AA2GH;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,wBAAwB,GAC9B,UAAU,CAwCZ;AAkBD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAChB,OAAO,CAAC,EAAE,aAAa,GACtB,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,wBAAwB,GAC9B,KAAK,CAAC,MAAM,CAAC,CAEf"} \ No newline at end of file diff --git a/lib.esm/utils/utf8.js b/lib.esm/utils/utf8.js deleted file mode 100644 index 316eec228..000000000 --- a/lib.esm/utils/utf8.js +++ /dev/null @@ -1,220 +0,0 @@ -/** - * Using strings in Core (or any security-basd system) requires - * additional care. These utilities attempt to mitigate some of the - * safety issues as well as provide the ability to recover and analyse - * strings. - * - * @_subsection api/utils:Strings and UTF-8 [about-strings] - */ -import { getBytes } from "./data.js"; -import { assertArgument, assertNormalize } from "./errors.js"; -function errorFunc(reason, offset, bytes, output, badCodepoint) { - assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); -} -function ignoreFunc(reason, offset, bytes, output, badCodepoint) { - // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes - if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { - let i = 0; - for (let o = offset + 1; o < bytes.length; o++) { - if (bytes[o] >> 6 !== 0x02) { - break; - } - i++; - } - return i; - } - // This byte runs us past the end of the string, so just jump to the end - // (but the first byte was read already read and therefore skipped) - if (reason === "OVERRUN") { - return bytes.length - offset - 1; - } - // Nothing to skip - return 0; -} -function replaceFunc(reason, offset, bytes, output, badCodepoint) { - // Overlong representations are otherwise "valid" code points; just non-deistingtished - if (reason === "OVERLONG") { - assertArgument(typeof badCodepoint === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint); - output.push(badCodepoint); - return 0; - } - // Put the replacement character into the output - output.push(0xfffd); - // Otherwise, process as if ignoring errors - return ignoreFunc(reason, offset, bytes, output, badCodepoint); -} -/** - * A handful of popular, built-in UTF-8 error handling strategies. - * - * **``"error"``** - throws on ANY illegal UTF-8 sequence or - * non-canonical (overlong) codepoints (this is the default) - * - * **``"ignore"``** - silently drops any illegal UTF-8 sequence - * and accepts non-canonical (overlong) codepoints - * - * **``"replace"``** - replace any illegal UTF-8 sequence with the - * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts - * non-canonical (overlong) codepoints - * - * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> - */ -export const Utf8ErrorFuncs = Object.freeze({ - error: errorFunc, - ignore: ignoreFunc, - replace: replaceFunc, -}); -// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 -function getUtf8CodePoints(_bytes, onError) { - if (onError == null) { - onError = Utf8ErrorFuncs.error; - } - const bytes = getBytes(_bytes, "bytes"); - const result = []; - let i = 0; - // Invalid bytes are ignored - while (i < bytes.length) { - const c = bytes[i++]; - // 0xxx xxxx - if (c >> 7 === 0) { - result.push(c); - continue; - } - // Multibyte; how many bytes left for this character? - let extraLength = null; - let overlongMask = null; - // 110x xxxx 10xx xxxx - if ((c & 0xe0) === 0xc0) { - extraLength = 1; - overlongMask = 0x7f; - // 1110 xxxx 10xx xxxx 10xx xxxx - } - else if ((c & 0xf0) === 0xe0) { - extraLength = 2; - overlongMask = 0x7ff; - // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx - } - else if ((c & 0xf8) === 0xf0) { - extraLength = 3; - overlongMask = 0xffff; - } - else { - if ((c & 0xc0) === 0x80) { - i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); - } - else { - i += onError("BAD_PREFIX", i - 1, bytes, result); - } - continue; - } - // Do we have enough bytes in our data? - if (i - 1 + extraLength >= bytes.length) { - i += onError("OVERRUN", i - 1, bytes, result); - continue; - } - // Remove the length prefix from the char - let res = c & ((1 << (8 - extraLength - 1)) - 1); - for (let j = 0; j < extraLength; j++) { - let nextChar = bytes[i]; - // Invalid continuation byte - if ((nextChar & 0xc0) != 0x80) { - i += onError("MISSING_CONTINUE", i, bytes, result); - res = null; - break; - } - res = (res << 6) | (nextChar & 0x3f); - i++; - } - // See above loop for invalid continuation byte - if (res === null) { - continue; - } - // Maximum code point - if (res > 0x10ffff) { - i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); - continue; - } - // Reserved for UTF-16 surrogate halves - if (res >= 0xd800 && res <= 0xdfff) { - i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); - continue; - } - // Check for overlong sequences (more bytes than needed) - if (res <= overlongMask) { - i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); - continue; - } - result.push(res); - } - return result; -} -// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array -/** - * Returns the UTF-8 byte representation of %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ -export function toUtf8Bytes(str, form) { - if (form != null) { - assertNormalize(form); - str = str.normalize(form); - } - let result = []; - for (let i = 0; i < str.length; i++) { - const c = str.charCodeAt(i); - if (c < 0x80) { - result.push(c); - } - else if (c < 0x800) { - result.push((c >> 6) | 0xc0); - result.push((c & 0x3f) | 0x80); - } - else if ((c & 0xfc00) == 0xd800) { - i++; - const c2 = str.charCodeAt(i); - assertArgument(i < str.length && (c2 & 0xfc00) === 0xdc00, "invalid surrogate pair", "str", str); - // Surrogate Pair - const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); - result.push((pair >> 18) | 0xf0); - result.push(((pair >> 12) & 0x3f) | 0x80); - result.push(((pair >> 6) & 0x3f) | 0x80); - result.push((pair & 0x3f) | 0x80); - } - else { - result.push((c >> 12) | 0xe0); - result.push(((c >> 6) & 0x3f) | 0x80); - result.push((c & 0x3f) | 0x80); - } - } - return new Uint8Array(result); -} -//export -function _toUtf8String(codePoints) { - return codePoints - .map((codePoint) => { - if (codePoint <= 0xffff) { - return String.fromCharCode(codePoint); - } - codePoint -= 0x10000; - return String.fromCharCode(((codePoint >> 10) & 0x3ff) + 0xd800, (codePoint & 0x3ff) + 0xdc00); - }) - .join(""); -} -/** - * Returns the string represented by the UTF-8 data %%bytes%%. - * - * When %%onError%% function is specified, it is called on UTF-8 - * errors allowing recovery using the [[Utf8ErrorFunc]] API. - * (default: [error](Utf8ErrorFuncs)) - */ -export function toUtf8String(bytes, onError) { - return _toUtf8String(getUtf8CodePoints(bytes, onError)); -} -/** - * Returns the UTF-8 code-points for %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ -export function toUtf8CodePoints(str, form) { - return getUtf8CodePoints(toUtf8Bytes(str, form)); -} -//# sourceMappingURL=utf8.js.map \ No newline at end of file diff --git a/lib.esm/utils/utf8.js.map b/lib.esm/utils/utf8.js.map deleted file mode 100644 index 1d7607145..000000000 --- a/lib.esm/utils/utf8.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utf8.js","sourceRoot":"","sources":["../../src.ts/utils/utf8.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAgF9D,SAAS,SAAS,CAChB,MAAuB,EACvB,MAAc,EACd,KAAiB,EACjB,MAAqB,EACrB,YAAqB;IAErB,cAAc,CACZ,KAAK,EACL,+BAA+B,MAAM,KAAK,MAAM,EAAE,EAClD,OAAO,EACP,KAAK,CACN,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CACjB,MAAuB,EACvB,MAAc,EACd,KAAiB,EACjB,MAAqB,EACrB,YAAqB;IAErB,u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AO,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;SACvC;QACD,SAAS,IAAI,OAAO,CAAC;QACrB,OAAO,MAAM,CAAC,YAAY,CACxB,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,GAAG,MAAM,EACpC,CAAC,SAAS,GAAG,KAAK,CAAC,GAAG,MAAM,CAC7B,CAAC;IACJ,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAgB,EAChB,OAAuB;IAEvB,OAAO,aAAa,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAW,EACX,IAA+B;IAE/B,OAAO,iBAAiB,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACnD,CAAC"} \ No newline at end of file diff --git a/lib.esm/utils/uuid.d.ts b/lib.esm/utils/uuid.d.ts deleted file mode 100644 index 7b7465157..000000000 --- a/lib.esm/utils/uuid.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { BytesLike } from "./index.js"; -/** - * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. - * - * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) - */ -export declare function uuidV4(randomBytes: BytesLike): string; -//# sourceMappingURL=uuid.d.ts.map \ No newline at end of file diff --git a/lib.esm/utils/uuid.d.ts.map b/lib.esm/utils/uuid.d.ts.map deleted file mode 100644 index f3cf307c6..000000000 --- a/lib.esm/utils/uuid.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src.ts/utils/uuid.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAqBrD"} \ No newline at end of file diff --git a/lib.esm/utils/uuid.js b/lib.esm/utils/uuid.js deleted file mode 100644 index a6a459551..000000000 --- a/lib.esm/utils/uuid.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Explain UUID and link to RFC here. - * - * @_subsection: api/utils:UUID [about-uuid] - */ -import { getBytes, hexlify } from "./data.js"; -/** - * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. - * - * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) - */ -export function uuidV4(randomBytes) { - const bytes = getBytes(randomBytes, "randomBytes"); - // Section: 4.1.3: - // - time_hi_and_version[12:16] = 0b0100 - bytes[6] = (bytes[6] & 0x0f) | 0x40; - // Section 4.4 - // - clock_seq_hi_and_reserved[6] = 0b0 - // - clock_seq_hi_and_reserved[7] = 0b1 - bytes[8] = (bytes[8] & 0x3f) | 0x80; - const value = hexlify(bytes); - return [ - value.substring(2, 10), - value.substring(10, 14), - value.substring(14, 18), - value.substring(18, 22), - value.substring(22, 34), - ].join("-"); -} -//# sourceMappingURL=uuid.js.map \ No newline at end of file diff --git a/lib.esm/utils/uuid.js.map b/lib.esm/utils/uuid.js.map deleted file mode 100644 index 62520202c..000000000 --- a/lib.esm/utils/uuid.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../src.ts/utils/uuid.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAI9C;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,WAAsB;IAC3C,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAEnD,kBAAkB;IAClB,wCAAwC;IACxC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEpC,cAAc;IACd,uCAAuC;IACvC,uCAAuC;IACvC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEpC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAE7B,OAAO;QACL,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC;QACtB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;KACxB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC"} \ No newline at end of file diff --git a/lib.esm/wallet/base-wallet.d.ts b/lib.esm/wallet/base-wallet.d.ts deleted file mode 100644 index a788c67b2..000000000 --- a/lib.esm/wallet/base-wallet.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { AbstractSigner } from "../providers/index.js"; -import { SigningKey } from "../crypto/index.js"; -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { Provider, TransactionRequest } from "../providers/index.js"; -/** - * The **BaseWallet** is a stream-lined implementation of a - * [[Signer]] that operates with a private key. - * - * It is preferred to use the [[Wallet]] class, as it offers - * additional functionality and simplifies loading a variety - * of JSON formats, Mnemonic Phrases, etc. - * - * This class may be of use for those attempting to implement - * a minimal Signer. - */ -export declare class BaseWallet extends AbstractSigner { - #private; - /** - * The wallet address. - */ - readonly address: string; - readonly prefix: string; - /** - * Creates a new BaseWallet for %%privateKey%%, optionally - * connected to %%provider%%. - * - * If %%provider%% is not specified, only offline methods can - * be used. - */ - constructor({ signingKey, prefix, provider, }: { - signingKey: SigningKey; - prefix: string; - provider?: null | Provider; - }); - /** - * The [[SigningKey]] used for signing payloads. - */ - get signingKey(): SigningKey; - /** - * The private key for this wallet. - */ - get privateKey(): string; - getAddress(): Promise; - connect(provider: null | Provider): BaseWallet; - signTransaction(tx: TransactionRequest): Promise; - signMessage(message: string | Uint8Array): Promise; - /** - * Returns the signature for %%message%% signed with this wallet. - */ - signMessageSync(message: string | Uint8Array): string; - signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -//# sourceMappingURL=base-wallet.d.ts.map \ No newline at end of file diff --git a/lib.esm/wallet/base-wallet.d.ts.map b/lib.esm/wallet/base-wallet.d.ts.map deleted file mode 100644 index dc25c591a..000000000 --- a/lib.esm/wallet/base-wallet.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base-wallet.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/base-wallet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AASvD,OAAO,EAAU,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG1E;;;;;;;;;;GAUG;AACH,qBAAa,UAAW,SAAQ,cAAc;;IAC5C;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAIxB;;;;;;OAMG;gBACS,EACV,UAAU,EACV,MAAM,EACN,QAAQ,GACT,EAAE;QACD,UAAU,EAAE,UAAU,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,CAAC;KAC5B;IAmBD;;OAEG;IACH,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAEK,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,UAAU;IAQxC,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgCxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAMhE;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM;IAI/C,aAAa,CACjB,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC;CAiCnB"} \ No newline at end of file diff --git a/lib.esm/wallet/base-wallet.js b/lib.esm/wallet/base-wallet.js deleted file mode 100644 index 043a56468..000000000 --- a/lib.esm/wallet/base-wallet.js +++ /dev/null @@ -1,117 +0,0 @@ -import { getAddress } from "../address/index.js"; -import { hashMessage, TypedDataEncoder } from "../hash/index.js"; -import { AbstractSigner } from "../providers/index.js"; -import { computeAddress, Transaction } from "../transaction/index.js"; -import { defineProperties, resolveProperties, assert, assertArgument, } from "../utils/index.js"; -import { sha256 } from "../crypto/index.js"; -/** - * The **BaseWallet** is a stream-lined implementation of a - * [[Signer]] that operates with a private key. - * - * It is preferred to use the [[Wallet]] class, as it offers - * additional functionality and simplifies loading a variety - * of JSON formats, Mnemonic Phrases, etc. - * - * This class may be of use for those attempting to implement - * a minimal Signer. - */ -export class BaseWallet extends AbstractSigner { - /** - * The wallet address. - */ - address; - prefix; - #signingKey; - /** - * Creates a new BaseWallet for %%privateKey%%, optionally - * connected to %%provider%%. - * - * If %%provider%% is not specified, only offline methods can - * be used. - */ - constructor({ signingKey, prefix, provider, }) { - super(provider); - this.prefix = prefix; - assertArgument(signingKey && typeof signingKey.sign === "function", "invalid signingKey key", "signingKey", "[ REDACTED ]"); - this.#signingKey = signingKey; - const address = computeAddress(this.#signingKey, prefix); - defineProperties(this, { address }); - } - // Store private values behind getters to reduce visibility - // in console.log - /** - * The [[SigningKey]] used for signing payloads. - */ - get signingKey() { - return this.#signingKey; - } - /** - * The private key for this wallet. - */ - get privateKey() { - return this.signingKey.privateKey; - } - async getAddress() { - return this.address; - } - connect(provider) { - return new BaseWallet({ - signingKey: this.#signingKey, - prefix: this.prefix, - provider, - }); - } - async signTransaction(tx) { - // Replace any Addressable or ENS name with an address - const { to, from } = await resolveProperties({ - to: tx.to || undefined, - from: tx.from || undefined, - }); - if (to != null) { - tx.to = to; - } - if (from != null) { - tx.from = from; - } - if (tx.from != null) { - assertArgument(getAddress(tx.from) === this.address, "transaction from address mismatch", "tx.from", tx.from); - delete tx.from; - } - // Build the transaction - const btx = Transaction.from(tx); - const unSignedSerialized = btx.unsignedSerialized; - const unsignedHash = sha256(unSignedSerialized); - // sha256(btx.unsignedSerialized) - btx.signature = this.signingKey.sign(unsignedHash); - return btx.serialized; - } - async signMessage(message) { - return this.signMessageSync(message); - } - // @TODO: Add a secialized signTx and signTyped sync that enforces - // all parameters are known? - /** - * Returns the signature for %%message%% signed with this wallet. - */ - signMessageSync(message) { - return this.signingKey.sign(hashMessage(message)); - } - async signTypedData(domain, types, value) { - // Populate any ENS names - const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (name) => { - // @TODO: this should use resolveName; addresses don't - // need a provider - assert(this.provider != null, "cannot resolve ENS names without a provider", "UNSUPPORTED_OPERATION", { - operation: "resolveName", - info: { name }, - }); - const address = getAddress(name); - assert(address != null, "unconfigured ENS name", "UNCONFIGURED_NAME", { - value: name, - }); - return address; - }); - return this.signingKey.sign(TypedDataEncoder.hash(populated.domain, types, populated.value)); - } -} -//# sourceMappingURL=base-wallet.js.map \ No newline at end of file diff --git a/lib.esm/wallet/base-wallet.js.map b/lib.esm/wallet/base-wallet.js.map deleted file mode 100644 index 78e0a5d58..000000000 --- a/lib.esm/wallet/base-wallet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base-wallet.js","sourceRoot":"","sources":["../../src.ts/wallet/base-wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAc,MAAM,oBAAoB,CAAC;AAKxD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,UAAW,SAAQ,cAAc;IAC5C;;OAEG;IACM,OAAO,CAAU;IACjB,MAAM,CAAS;IAEf,WAAW,CAAa;IAEjC;;;;;;OAMG;IACH,YAAY,EACV,UAAU,EACV,MAAM,EACN,QAAQ,GAKT;QACC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,cAAc,CACZ,UAAU,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,UAAU,EACnD,wBAAwB,EACxB,YAAY,EACZ,cAAc,CACf,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QACzD,gBAAgB,CAAa,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,2DAA2D;IAC3D,iBAAiB;IAEjB;;OAEG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACZ,OAAO,IA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AU,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAA4B;QAC5C,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED,kEAAkE;IAClE,4BAA4B;IAC5B;;OAEG;IACH,eAAe,CAAC,OAA4B;QAC1C,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,MAAuB,EACvB,KAA4C,EAC5C,KAA0B;QAE1B,yBAAyB;QACzB,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,YAAY,CACnD,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAK,EAAE,IAAY,EAAE,EAAE;YACrB,sDAAsD;YACtD,yBAAyB;YAEzB,MAAM,CACJ,IAAI,CAAC,QAAQ,IAAI,IAAI,EACrB,6CAA6C,EAC7C,uBAAuB,EACvB;gBACE,SAAS,EAAE,aAAa;gBACxB,IAAI,EAAE,EAAE,IAAI,EAAE;aACf,CACF,CAAC;YAEF,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;YACjC,MAAM,CAAC,OAAO,IAAI,IAAI,EAAE,uBAAuB,EAAE,mBAAmB,EAAE;gBACpE,KAAK,EAAE,IAAI;aACZ,CAAC,CAAC;YAEH,OAAO,OAAO,CAAC;QACjB,CAAC,CACF,CAAC;QAEF,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CACzB,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAChE,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/wallet/english_words.d.ts b/lib.esm/wallet/english_words.d.ts deleted file mode 100644 index fec60c704..000000000 --- a/lib.esm/wallet/english_words.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const englishWords = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; -//# sourceMappingURL=english_words.d.ts.map \ No newline at end of file diff --git a/lib.esm/wallet/english_words.d.ts.map b/lib.esm/wallet/english_words.d.ts.map deleted file mode 100644 index 15a3e8323..000000000 --- a/lib.esm/wallet/english_words.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"english_words.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/english_words.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,i0VACuyV,CAAC"} \ No newline at end of file diff --git a/lib.esm/wallet/english_words.js b/lib.esm/wallet/english_words.js deleted file mode 100644 index d8579d386..000000000 --- a/lib.esm/wallet/english_words.js +++ /dev/null @@ -1,2 +0,0 @@ -export const englishWords = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; -//# sourceMappingURL=english_words.js.map \ No newline at end of file diff --git a/lib.esm/wallet/english_words.js.map b/lib.esm/wallet/english_words.js.map deleted file mode 100644 index 5fcb938ce..000000000 --- a/lib.esm/wallet/english_words.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"english_words.js","sourceRoot":"","sources":["../../src.ts/wallet/english_words.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GACvB,8zVAA8zV,CAAC"} \ No newline at end of file diff --git a/lib.esm/wallet/hdwallet.d.ts b/lib.esm/wallet/hdwallet.d.ts deleted file mode 100644 index 7c96fb8a0..000000000 --- a/lib.esm/wallet/hdwallet.d.ts +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Explain HD Wallets.. - * - * @_subsection: api/wallet:HD Wallets [hd-wallets] - */ -import { SigningKey } from "../crypto/index.js"; -import { BaseWallet } from "./base-wallet.js"; -import { Mnemonic } from "./mnemonic.js"; -import type { ProgressCallback } from "../crypto/index.js"; -import type { Provider } from "../providers/index.js"; -import type { Numeric } from "../utils/index.js"; -import type { Wordlist } from "../wordlists/index.js"; -/** - * The default derivation path for Core HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) - */ -export declare const defaultPath: string; -/** - * An **HDNodeWallet** is a [[Signer]] backed by the private key derived - * from an HD Node using the [[link-bip-32]] stantard. - * - * An HD Node forms a hierarchal structure with each HD Node having a - * private key and the ability to derive child HD Nodes, defined by - * a path indicating the index of each child. - */ -export declare class HDNodeWallet extends BaseWallet { - #private; - /** - * The compressed public key. - */ - readonly publicKey: string; - prefix: string; - /** - * The fingerprint. - * - * A fingerprint allows quick qay to detect parent and child nodes, - * but developers should be prepared to deal with collisions as it - * is only 4 bytes. - */ - readonly fingerprint: string; - /** - * The parent fingerprint. - */ - readonly parentFingerprint: string; - /** - * The mnemonic used to create this HD Node, if available. - * - * Sources such as extended keys do not encode the mnemonic, in - * which case this will be ``null``. - */ - readonly mnemonic: null | Mnemonic; - /** - * The derivation path of this wallet. - * - * Since extended keys do not provider full path details, this - * may be ``null``, if instantiated from a source that does not - * enocde it. - */ - readonly path: null | string; - /** - * The child index of this wallet. Values over ``2 *\* 31`` indicate - * the node is hardened. - */ - readonly index: number; - /** - * The depth of this wallet, which is the number of components - * in its path. - */ - readonly depth: number; - /** - * @private - */ - constructor({ guard, seed, signingKey, parentFingerprint, path, index, depth, mnemonic, provider, prefix, }: { - guard: any; - seed: string; - signingKey: SigningKey; - parentFingerprint: string; - path: null | string; - index: number; - depth: number; - mnemonic: null | Mnemonic; - provider: null | Provider; - prefix: string; - }); - connect(provider: null | Provider): HDNodeWallet; - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise; - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password: Uint8Array | string): string; - /** - * Returns true if this wallet has a path, providing a Type Guard - * that the path is non-null. - */ - hasPath(): this is { - path: string; - }; - /** - * Return the child for %%index%%. - */ - deriveChild(_index: number): HDNodeWallet; - /** - * Return the HDNode for %%path%% from this node. - */ - derivePath(path: string): HDNodeWallet; - /** - * Creates a new random HDNode. - */ - static createRandom(prefix: string, password?: string, path?: string, wordlist?: Wordlist): HDNodeWallet; - /** - * Create am HD Node from %%mnemonic%%. - */ - static fromMnemonic(mnemonic: Mnemonic, prefix: string, path?: string): HDNodeWallet; - static mnemonicToSeed(mnemonic: string, password?: string): string; - /** - * Creates an HD Node from a mnemonic %%phrase%%. - */ - static fromPhrase({ phrase, prefix, password, path, wordlist, }: { - phrase: string; - prefix: string; - password?: string; - path?: string; - wordlist?: Wordlist; - }): HDNodeWallet; - /** - * Creates an HD Node from a %%seed%%. - */ - static fromSeed({ seed, prefix, path, }: { - seed: string; - prefix: string; - path?: string; - }): HDNodeWallet; -} -/** - * Returns the [[link-bip-32]] path for the acount at %%index%%. - * - * This is the pattern used by wallets like Ledger. - * - * There is also an [alternate pattern](getIndexedAccountPath) used by - * some software. - */ -export declare function getAccountPath(_index: Numeric): string; -/** - * Returns the path using an alternative pattern for deriving accounts, - * at %%index%%. - * - * This derivation path uses the //index// component rather than the - * //account// component to derive sequential accounts. - * - * This is the pattern used by wallets like MetaMask. - */ -export declare function getIndexedAccountPath(_index: Numeric): string; -//# sourceMappingURL=hdwallet.d.ts.map \ No newline at end of file diff --git a/lib.esm/wallet/hdwallet.d.ts.map b/lib.esm/wallet/hdwallet.d.ts.map deleted file mode 100644 index cc249d4de..000000000 --- a/lib.esm/wallet/hdwallet.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hdwallet.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/hdwallet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAA0B,UAAU,EAAU,MAAM,oBAAoB,CAAC;AAUhF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAMzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAetD;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,MAAY,CAAC;AAiFvC;;;;;;;GAOG;AACH,qBAAa,YAAa,SAAQ,UAAU;;IAC1C;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAG,MAAM,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;O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js deleted file mode 100644 index 2a67913b7..000000000 --- a/lib.esm/wallet/hdwallet.js +++ /dev/null @@ -1,366 +0,0 @@ -/** - * Explain HD Wallets.. - * - * @_subsection: api/wallet:HD Wallets [hd-wallets] - */ -import { randomBytes, ripemd160, SigningKey, sha256 } from "../crypto/index.js"; -import { dataSlice, defineProperties, getNumber, assertPrivate, assertArgument, } from "../utils/index.js"; -import { LangEn } from "../wordlists/lang-en.js"; -import { BaseWallet } from "./base-wallet.js"; -import { Mnemonic } from "./mnemonic.js"; -import { encryptKeystoreJson, encryptKeystoreJsonSync, } from "./json-keystore.js"; -import { Ed448Goldilock } from "../crypto/crypto.js"; -import { mnemonicToSeed } from "./mnemonicToSeed.js"; -// import { arrayify, -// // hexDataSlice -// } from "../utils/data.js"; -// function sha512Hash(password: BytesLike, salt: BytesLike): Uint8Array { -// const p = getBytes(password); -// const s = getBytes(salt); -// return getBytes(pbkdf2(p, s, 2048, 57, "sha512")); -// } -/** - * The default derivation path for Core HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) - */ -export const defaultPath = "m"; -// "Bitcoin seed" -// const MasterSecret = new Uint8Array([66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100]); -const HardenedBit = 0x80000000; -// function addScalar(a: Uint8Array, b: Uint8Array): Uint8Array { -// b = getBytes(concat([b.slice(0, 53), "0x00000000"])); -// b[0] &= 0xfc; -// const c = new Uint8Array(57); -// let hold = 0; -// for (let i = 0; i < 57; i++) { -// hold += a[i] + b[i]; -// c[i] = hold % 256; -// hold = Math.floor(hold / 256); -// } -// return c; -// }; -const _guard = {}; -function derivePath(node, path) { - const components = path.split("/"); - assertArgument(components.length > 0 && (components[0] === "m" || node.depth > 0), "invalid path", "path", path); - if (components[0] === "m") { - components.shift(); - } - let result = node; - for (let i = 0; i < components.length; i++) { - const component = components[i]; - if (component.match(/^[0-9]+'$/)) { - const index = parseInt(component.substring(0, component.length - 1)); - assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component); - result = result.deriveChild(HardenedBit + index); - } - else if (component.match(/^[0-9]+$/)) { - const index = parseInt(component); - assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component); - result = result.deriveChild(index); - } - else { - assertArgument(false, "invalid path component", `path[${i}]`, component); - } - } - return result; -} -/** - * An **HDNodeWallet** is a [[Signer]] backed by the private key derived - * from an HD Node using the [[link-bip-32]] stantard. - * - * An HD Node forms a hierarchal structure with each HD Node having a - * private key and the ability to derive child HD Nodes, defined by - * a path indicating the index of each child. - */ -export class HDNodeWallet extends BaseWallet { - /** - * The compressed public key. - */ - publicKey; - prefix; - /** - * The fingerprint. - * - * A fingerprint allows quick qay to detect parent and child nodes, - * but developers should be prepared to deal with collisions as it - * is only 4 bytes. - */ - fingerprint; - /** - * The parent fingerprint. - */ - parentFingerprint; - /** - * The mnemonic used to create this HD Node, if available. - * - * Sources such as extended keys do not encode the mnemonic, in - * which case this will be ``null``. - */ - mnemonic; - #seed; - /** - * The derivation path of this wallet. - * - * Since extended keys do not provider full path details, this - * may be ``null``, if instantiated from a source that does not - * enocde it. - */ - path; - /** - * The child index of this wallet. Values over ``2 *\* 31`` indicate - * the node is hardened. - */ - index; - /** - * The depth of this wallet, which is the number of components - * in its path. - */ - depth; - /** - * @private - */ - constructor({ guard, seed, signingKey, parentFingerprint, path, index, depth, mnemonic, provider, prefix, }) { - super({ - signingKey, - prefix, - provider, - }); - assertPrivate(guard, _guard, "HDNodeWallet"); - defineProperties(this, { publicKey: signingKey.publicKey }); - this.prefix = prefix; - this.#seed = seed; - const fingerprint = dataSlice(ripemd160(sha256(this.publicKey)), 0, 4); - defineProperties(this, { - parentFingerprint, - fingerprint, - path, - index, - depth, - }); - defineProperties(this, { mnemonic }); - } - connect(provider) { - return new HDNodeWallet({ - guard: _guard, - signingKey: this.signingKey, - parentFingerprint: this.parentFingerprint, - path: this.path, - index: this.index, - depth: this.depth, - seed: this.#seed, - mnemonic: this.mnemonic, - provider, - prefix: this.prefix, - }); - } - #account() { - const account = { - address: this.address, - privateKey: this.privateKey, - }; - const m = this.mnemonic; - if (this.path && m && m.wordlist.locale === "en" && m.password === "") { - account.mnemonic = { - path: this.path, - locale: "en", - entropy: m.entropy, - }; - } - return account; - } - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - async encrypt(password, progressCallback) { - return await encryptKeystoreJson(this.#account(), password, { - progressCallback, - }); - } - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password) { - return encryptKeystoreJsonSync(this.#account(), password); - } - /** - * Returns true if this wallet has a path, providing a Type Guard - * that the path is non-null. - */ - hasPath() { - return this.path != null; - } - /** - * Return the child for %%index%%. - */ - deriveChild(_index) { - const newPrivateKey = Ed448Goldilock.HDWalletGenerateKeyFromSeed(this.#seed, Number(_index)); - const newSigningKey = new SigningKey(newPrivateKey); - // Base path - let path = this.path; - if (path) { - path += "/" + (_index & ~HardenedBit); - if (_index & HardenedBit) { - path += "'"; - } - } - return new HDNodeWallet({ - guard: _guard, - signingKey: newSigningKey, - parentFingerprint: this.fingerprint, - path, - index: _index, - seed: this.#seed, - depth: this.depth + 1, - mnemonic: this.mnemonic, - provider: this.provider, - prefix: this.prefix, - }); - } - /** - * Return the HDNode for %%path%% from this node. - */ - derivePath(path) { - return derivePath(this, path); - } - static #fromSeed({ _seed, mnemonic, prefix, path, }) { - const extendetPrivateKey = Ed448Goldilock.HDWalletGenerateKeyFromSeed(_seed, 0); - const signingKey = new SigningKey(extendetPrivateKey); - // console.log({ privateKey, thisKey: signingKey.privateKey,len:tmp.privateKey.length }) - return new HDNodeWallet({ - seed: _seed, - guard: _guard, - signingKey, - parentFingerprint: "0x00000000", - path: path || defaultPath, - index: 0, - depth: 0, - mnemonic, - provider: null, - prefix, - }); - } - /** - * Creates a new random HDNode. - */ - static createRandom(prefix, password, path, wordlist) { - if (password == null) { - password = ""; - } - if (path == null) { - path = defaultPath; - } - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - const mnemonic = Mnemonic.fromEntropy(randomBytes(32), password, wordlist); - return HDNodeWallet.#fromSeed({ - _seed: mnemonic.computeSeed(), - mnemonic, - prefix, - }).derivePath(path); - } - /** - * Create am HD Node from %%mnemonic%%. - */ - static fromMnemonic(mnemonic, prefix, path) { - if (!path) { - path = defaultPath; - } - return HDNodeWallet.#fromSeed({ - _seed: mnemonic.computeSeed(), - mnemonic, - prefix, - }).derivePath(path); - } - static mnemonicToSeed(mnemonic, password) { - const seed = mnemonicToSeed(mnemonic, password); - return seed; - } - /** - * Creates an HD Node from a mnemonic %%phrase%%. - */ - static fromPhrase({ phrase, prefix, password, path, wordlist, }) { - if (!password) { - password = ""; - } - if (!path) { - path = defaultPath; - } - if (!wordlist) { - wordlist = LangEn.wordlist(); - } - const mnemonic = Mnemonic.fromPhrase({ phrase, password, wordlist }); - const _seed = mnemonic.computeSeed(); - return HDNodeWallet.#fromSeed({ - _seed, - mnemonic, - prefix, - }).derivePath(path); - } - /** - * Creates an HD Node from a %%seed%%. - */ - static fromSeed({ seed, prefix, path, }) { - return HDNodeWallet.#fromSeed({ - _seed: seed, - mnemonic: null, - path: path || defaultPath, - prefix, - }); - } -} -/* -export class HDNodeWalletManager { - #root: HDNodeWallet; - - constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) { - if (password == null) { password = ""; } - if (path == null) { path = "m/44'/60'/0'/0"; } - if (locale == null) { locale = LangEn.wordlist(); } - this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale); - } - - getSigner(index?: number): HDNodeWallet { - return this.#root.deriveChild((index == null) ? 0: index); - } -} -*/ -/** - * Returns the [[link-bip-32]] path for the acount at %%index%%. - * - * This is the pattern used by wallets like Ledger. - * - * There is also an [alternate pattern](getIndexedAccountPath) used by - * some software. - */ -export function getAccountPath(_index) { - const index = getNumber(_index, "index"); - assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); - return `m/44'/60'/${index}'/0/0`; -} -/** - * Returns the path using an alternative pattern for deriving accounts, - * at %%index%%. - * - * This derivation path uses the //index// component rather than the - * //account// component to derive sequential accounts. - * - * This is the pattern used by wallets like MetaMask. - */ -export function getIndexedAccountPath(_index) { - const index = getNumber(_index, "index"); - assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); - return `m/44'/60'/0'/0/${index}`; -} -//# sourceMappingURL=hdwallet.js.map \ No newline at end of file diff --git a/lib.esm/wallet/hdwallet.js.map b/lib.esm/wallet/hdwallet.js.map deleted file mode 100644 index 340f202a2..000000000 --- a/lib.esm/wallet/hdwallet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hdwallet.js","sourceRoot":"","sources":["../../src.ts/wallet/hdwallet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,qBAAqB;AACrB,uBAAuB;AACvB,kCAAkC;AAElC,0EAA0E;AAC1E,oCAAoC;AACpC,gCAAgC;AAChC,yDAAyD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SACP,CAAC,CAAC;IACL,CAAC;CACF;AAED;;;;;;;;;;;;;;;EAeE;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,MAAe;IAC5C,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,cAAc,CACZ,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,WAAW,EACjC,uBAAuB,EACvB,OAAO,EACP,KAAK,CACN,CAAC;IACF,OAAO,aAAa,KAAK,OAAO,CAAC;AACnC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAe;IACnD,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,cAAc,CACZ,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,WAAW,EACjC,uBAAuB,EACvB,OAAO,EACP,KAAK,CACN,CAAC;IACF,OAAO,kBAAkB,KAAK,EAAE,CAAC;AACnC,CAAC"} \ No newline at end of file diff --git a/lib.esm/wallet/index.d.ts b/lib.esm/wallet/index.d.ts deleted file mode 100644 index d3db8f37c..000000000 --- a/lib.esm/wallet/index.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * When interacting with Core, it is necessary to use a private - * key authenticate actions by signing a payload. - * - * Wallets are the simplest way to expose the concept of an - * //Externally Owner Account// (EOA) as it wraps a private key - * and supports high-level methods to sign common types of interaction - * and send transactions. - * - * The class most developers will want to use is [[Wallet]], which - * can load a private key directly or from any common wallet format. - * - * The [[HDNodeWallet]] can be used when it is necessary to access - * low-level details of how an HD wallets are derived, exported - * or imported. - * - * @_section: api/wallet:Wallets [about-wallets] - */ -export { BaseWallet } from "./base-wallet.js"; -export { defaultPath, getAccountPath, getIndexedAccountPath, HDNodeWallet, } from "./hdwallet.js"; -export { isCrowdsaleJson, decryptCrowdsaleJson } from "./json-crowdsale.js"; -export { isKeystoreJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./json-keystore.js"; -export { Mnemonic } from "./mnemonic.js"; -export { Wallet } from "./wallet.js"; -export type { CrowdsaleAccount } from "./json-crowdsale.js"; -export type { KeystoreAccount, EncryptOptions } from "./json-keystore.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.esm/wallet/index.d.ts.map b/lib.esm/wallet/index.d.ts.map deleted file mode 100644 index fc93212da..000000000 --- a/lib.esm/wallet/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACL,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"} \ No newline at end of file diff --git a/lib.esm/wallet/index.js b/lib.esm/wallet/index.js deleted file mode 100644 index 593a62238..000000000 --- a/lib.esm/wallet/index.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * When interacting with Core, it is necessary to use a private - * key authenticate actions by signing a payload. - * - * Wallets are the simplest way to expose the concept of an - * //Externally Owner Account// (EOA) as it wraps a private key - * and supports high-level methods to sign common types of interaction - * and send transactions. - * - * The class most developers will want to use is [[Wallet]], which - * can load a private key directly or from any common wallet format. - * - * The [[HDNodeWallet]] can be used when it is necessary to access - * low-level details of how an HD wallets are derived, exported - * or imported. - * - * @_section: api/wallet:Wallets [about-wallets] - */ -export { BaseWallet } from "./base-wallet.js"; -export { defaultPath, getAccountPath, getIndexedAccountPath, HDNodeWallet, } from "./hdwallet.js"; -export { isCrowdsaleJson, decryptCrowdsaleJson } from "./json-crowdsale.js"; -export { isKeystoreJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./json-keystore.js"; -export { Mnemonic } from "./mnemonic.js"; -export { Wallet } from "./wallet.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.esm/wallet/index.js.map b/lib.esm/wallet/index.js.map deleted file mode 100644 index 8828a0625..000000000 --- a/lib.esm/wallet/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/wallet/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACL,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/lib.esm/wallet/json-crowdsale.d.ts b/lib.esm/wallet/json-crowdsale.d.ts deleted file mode 100644 index 65b5f0251..000000000 --- a/lib.esm/wallet/json-crowdsale.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * The data stored within a JSON Crowdsale wallet is fairly - * minimal. - */ -export type CrowdsaleAccount = { - privateKey: string; - address: string; -}; -/** - * Returns true if %%json%% is a valid JSON Crowdsale wallet. - */ -export declare function isCrowdsaleJson(json: string): boolean; -/** - * Before Core launched, it was necessary to create a wallet - * format for backers to use, which would be used to receive xcb - * as a reward for contributing to the project. - * - * The [[link-crowdsale]] format is now obsolete, but it is still - * useful to support and the additional code is fairly trivial as - * all the primitives required are used through core portions of - * the library. - */ -export declare function decryptCrowdsaleJson(json: string, _password: string | Uint8Array): CrowdsaleAccount; -//# sourceMappingURL=json-crowdsale.d.ts.map \ No newline at end of file diff --git a/lib.esm/wallet/json-crowdsale.d.ts.map b/lib.esm/wallet/json-crowdsale.d.ts.map deleted file mode 100644 index 4514aef1b..000000000 --- a/lib.esm/wallet/json-crowdsale.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-crowdsale.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/json-crowdsale.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAAG,UAAU,GAC7B,gBAAgB,CAmClB"} \ No newline at end of file diff --git a/lib.esm/wallet/json-crowdsale.js b/lib.esm/wallet/json-crowdsale.js deleted file mode 100644 index fddef7c1f..000000000 --- a/lib.esm/wallet/json-crowdsale.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @_subsection: api/wallet:JSON Wallets [json-wallets] - */ -// @ts-ignore -import pkg from "aes-js"; -const { CBC, pkcs7Strip } = pkg; -import { getAddress } from "../address/index.js"; -import { pbkdf2 } from "../crypto/index.js"; -import { id } from "../hash/index.js"; -import { getBytes, assertArgument } from "../utils/index.js"; -import { getPassword, looseArrayify, spelunk } from "./utils.js"; -/** - * Returns true if %%json%% is a valid JSON Crowdsale wallet. - */ -export function isCrowdsaleJson(json) { - try { - const data = JSON.parse(json); - if (data.encseed) { - return true; - } - } - catch (error) { } - return false; -} -/** - * Before Core launched, it was necessary to create a wallet - * format for backers to use, which would be used to receive xcb - * as a reward for contributing to the project. - * - * The [[link-crowdsale]] format is now obsolete, but it is still - * useful to support and the additional code is fairly trivial as - * all the primitives required are used through core portions of - * the library. - */ -export function decryptCrowdsaleJson(json, _password) { - const data = JSON.parse(json); - const password = getPassword(_password); - // Core Address - const address = getAddress(spelunk(data, "ethaddr:string!")); - // Encrypted Seed - const encseed = looseArrayify(spelunk(data, "encseed:string!")); - assertArgument(encseed && encseed.length % 16 === 0, "invalid encseed", "json", json); - const key = getBytes(pbkdf2(password, password, 2000, 32, "sha256")).slice(0, 16); - const iv = encseed.slice(0, 16); - const encryptedSeed = encseed.slice(16); - // Decrypt the seed - const aesCbc = new CBC(key, iv); - const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed))); - // This wallet format is weird... Convert the binary encoded hex to a string. - let seedHex = ""; - for (let i = 0; i < seed.length; i++) { - seedHex += String.fromCharCode(seed[i]); - } - return { address, privateKey: id(seedHex) }; -} -//# sourceMappingURL=json-crowdsale.js.map \ No newline at end of file diff --git a/lib.esm/wallet/json-crowdsale.js.map b/lib.esm/wallet/json-crowdsale.js.map deleted file mode 100644 index 8ea45fac9..000000000 --- a/lib.esm/wallet/json-crowdsale.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-crowdsale.js","sourceRoot":"","sources":["../../src.ts/wallet/json-crowdsale.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,aAAa;AACb,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,GAAG,CAA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C;IAEF,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChC,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAExC,mBAAmB;IACnB,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAEjE,6EAA6E;IAC7E,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,OAAO,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KACzC;IAED,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;AAC9C,CAAC"} \ No newline at end of file diff --git a/lib.esm/wallet/json-keystore.d.ts b/lib.esm/wallet/json-keystore.d.ts deleted file mode 100644 index 363fd7956..000000000 --- a/lib.esm/wallet/json-keystore.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -import type { ProgressCallback } from "../crypto/index.js"; -import type { BytesLike } from "../utils/index.js"; -/** - * The contents of a JSON Keystore Wallet. - */ -export type KeystoreAccount = { - address: string; - privateKey: string; - mnemonic?: { - path?: string; - locale?: string; - entropy: string; - }; -}; -/** - * The parameters to use when encrypting a JSON Keystore Wallet. - */ -export type EncryptOptions = { - progressCallback?: ProgressCallback; - iv?: BytesLike; - entropy?: BytesLike; - client?: string; - salt?: BytesLike; - uuid?: string; - scrypt?: { - N?: number; - r?: number; - p?: number; - }; -}; -/** - * Returns true if %%json%% is a valid JSON Keystore Wallet. - */ -export declare function isKeystoreJson(json: string): boolean; -/** - * Returns the account details for the JSON Keystore Wallet %%json%% - * using %%password%%. - * - * It is preferred to use the [async version](decryptKeystoreJson) - * instead, which allows a [[ProgressCallback]] to keep the user informed - * as to the decryption status. - * - * This method will block the event loop (freezing all UI) until decryption - * is complete, which can take quite some time, depending on the wallet - * paramters and platform. - */ -export declare function decryptKeystoreJsonSync(json: string, _password: string | Uint8Array): KeystoreAccount; -/** - * Resolves to the decrypted JSON Keystore Wallet %%json%% using the - * %%password%%. - * - * If provided, %%progress%% will be called periodically during the - * decrpytion to provide feedback, and if the function returns - * ``false`` will halt decryption. - * - * The %%progressCallback%% will **always** receive ``0`` before - * decryption begins and ``1`` when complete. - */ -export declare function decryptKeystoreJson(json: string, _password: string | Uint8Array, progress?: ProgressCallback): Promise; -/** - * Return the JSON Keystore Wallet for %%account%% encrypted with - * %%password%%. - * - * The %%options%% can be used to tune the password-based key - * derivation function parameters, explicitly set the random values - * used. Any provided [[ProgressCallback]] is ignord. - */ -export declare function encryptKeystoreJsonSync(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): string; -/** - * Resolved to the JSON Keystore Wallet for %%account%% encrypted - * with %%password%%. - * - * The %%options%% can be used to tune the password-based key - * derivation function parameters, explicitly set the random values - * used and provide a [[ProgressCallback]] to receive periodic updates - * on the completion status.. - */ -export declare function encryptKeystoreJson(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): Promise; -//# sourceMappingURL=json-keystore.d.ts.map \ No newline at end of file diff --git a/lib.esm/wallet/json-keystore.d.ts.map b/lib.esm/wallet/json-keystore.d.ts.map deleted file mode 100644 index a56cc644a..000000000 --- a/lib.esm/wallet/json-keystore.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-keystore.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/json-keystore.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;A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mBAAmB,CACvC,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,MAAM,GAAG,UAAU,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,CAiBjB"} \ No newline at end of file diff --git a/lib.esm/wallet/json-keystore.js b/lib.esm/wallet/json-keystore.js deleted file mode 100644 index 0866d3b6a..000000000 --- a/lib.esm/wallet/json-keystore.js +++ /dev/null @@ -1,316 +0,0 @@ -/** - * The JSON Wallet formats allow a simple way to store the private - * keys needed in Core along with related information and allows - * for extensible forms of encryption. - * - * These utilities facilitate decrypting and encrypting the most common - * JSON Wallet formats. - * - * @_subsection: api/wallet:JSON Wallets [json-wallets] - */ -// @ts-ignore -import pkg from "aes-js"; -const { CTR } = pkg; -import { getAddress } from "../address/index.js"; -import { pbkdf2, randomBytes, scrypt, scryptSync, sha256, } from "../crypto/index.js"; -import { concat, getBytes, hexlify, uuidV4, assert, assertArgument, } from "../utils/index.js"; -import { getPassword, spelunk, zpad } from "./utils.js"; -import { version } from "../_version.js"; -import { computeAddress, extractPrefix } from "../transaction/address.js"; -const defaultPath = "m/44'/60'/0'/0/0"; -/** - * Returns true if %%json%% is a valid JSON Keystore Wallet. - */ -export function isKeystoreJson(json) { - try { - const data = JSON.parse(json); - const version = data.version != null ? parseInt(data.version) : 0; - if (version === 3) { - return true; - } - } - catch (error) { } - return false; -} -function decrypt(data, key, ciphertext) { - const cipher = spelunk(data, "crypto.cipher:string"); - if (cipher === "aes-128-ctr") { - const iv = spelunk(data, "crypto.cipherparams.iv:data!"); - const aesCtr = new CTR(key, iv); - return hexlify(aesCtr.decrypt(ciphertext)); - } - assert(false, "unsupported cipher", "UNSUPPORTED_OPERATION", { - operation: "decrypt", - }); -} -function getAccount(data, _key) { - const key = getBytes(_key); - const ciphertext = spelunk(data, "crypto.ciphertext:data!"); - const computedMAC = hexlify(sha256(concat([key.slice(16, 32), ciphertext]))).substring(2); - assertArgument(computedMAC === spelunk(data, "crypto.mac:string!").toLowerCase(), "incorrect password", "password", "[ REDACTED ]"); - const privateKey = decrypt(data, key.slice(0, 16), ciphertext); - const address = getAddress(data.address); - const prefix = extractPrefix(address); - if (computeAddress(privateKey, prefix) !== address) { - throw new Error("address mismatch"); - } - if (data.address) { - let check = data.address.toLowerCase(); - if (!check.startsWith("0x")) { - check = "0x" + check; - } - assertArgument(getAddress(check) === address, "keystore address/privateKey mismatch", "address", data.address); - } - const account = { address, privateKey }; - // Version 0.1 x-corebc metadata must contain an encrypted mnemonic phrase - const version = spelunk(data, "x-corebc.version:string"); - if (version === "0.1") { - const mnemonicKey = key.slice(32, 64); - const mnemonicCiphertext = spelunk(data, "x-corebc.mnemonicCiphertext:data!"); - const mnemonicIv = spelunk(data, "x-corebc.mnemonicCounter:data!"); - const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); - account.mnemonic = { - path: spelunk(data, "x-corebc.path:string") || defaultPath, - locale: spelunk(data, "x-corebc.locale:string") || "en", - entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext))), - }; - } - return account; -} -function getDecryptKdfParams(data) { - const kdf = spelunk(data, "crypto.kdf:string"); - if (kdf && typeof kdf === "string") { - if (kdf.toLowerCase() === "scrypt") { - const salt = spelunk(data, "crypto.kdfparams.salt:data!"); - const N = spelunk(data, "crypto.kdfparams.n:int!"); - const r = spelunk(data, "crypto.kdfparams.r:int!"); - const p = spelunk(data, "crypto.kdfparams.p:int!"); - // Make sure N is a power of 2 - assertArgument(N > 0 && (N & (N - 1)) === 0, "invalid kdf.N", "kdf.N", N); - assertArgument(r > 0 && p > 0, "invalid kdf", "kdf", kdf); - const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); - assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dflen", dkLen); - return { name: "scrypt", salt, N, r, p, dkLen: 64 }; - } - else if (kdf.toLowerCase() === "pbkdf2") { - const salt = spelunk(data, "crypto.kdfparams.salt:data!"); - const prf = spelunk(data, "crypto.kdfparams.prf:string!"); - const algorithm = prf.split("-").pop(); - assertArgument(algorithm === "sha256" || algorithm === "sha512", "invalid kdf.pdf", "kdf.pdf", prf); - const count = spelunk(data, "crypto.kdfparams.c:int!"); - const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); - assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dklen", dkLen); - return { name: "pbkdf2", salt, count, dkLen, algorithm }; - } - } - assertArgument(false, "unsupported key-derivation function", "kdf", kdf); -} -/** - * Returns the account details for the JSON Keystore Wallet %%json%% - * using %%password%%. - * - * It is preferred to use the [async version](decryptKeystoreJson) - * instead, which allows a [[ProgressCallback]] to keep the user informed - * as to the decryption status. - * - * This method will block the event loop (freezing all UI) until decryption - * is complete, which can take quite some time, depending on the wallet - * paramters and platform. - */ -export function decryptKeystoreJsonSync(json, _password) { - const data = JSON.parse(json); - const password = getPassword(_password); - const params = getDecryptKdfParams(data); - if (params.name === "pbkdf2") { - const { salt, count, dkLen, algorithm } = params; - const key = pbkdf2(password, salt, count, dkLen, algorithm); - return getAccount(data, key); - } - assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { - params, - }); - const { salt, N, r, p, dkLen } = params; - const key = scryptSync(password, salt, N, r, p, dkLen); - return getAccount(data, key); -} -function stall(duration) { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, duration); - }); -} -/** - * Resolves to the decrypted JSON Keystore Wallet %%json%% using the - * %%password%%. - * - * If provided, %%progress%% will be called periodically during the - * decrpytion to provide feedback, and if the function returns - * ``false`` will halt decryption. - * - * The %%progressCallback%% will **always** receive ``0`` before - * decryption begins and ``1`` when complete. - */ -export async function decryptKeystoreJson(json, _password, progress) { - const data = JSON.parse(json); - const password = getPassword(_password); - const params = getDecryptKdfParams(data); - if (params.name === "pbkdf2") { - if (progress) { - progress(0); - await stall(0); - } - const { salt, count, dkLen, algorithm } = params; - const key = pbkdf2(password, salt, count, dkLen, algorithm); - if (progress) { - progress(1); - await stall(0); - } - return getAccount(data, key); - } - assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { - params, - }); - const { salt, N, r, p, dkLen } = params; - const key = await scrypt(password, salt, N, r, p, dkLen, progress); - return getAccount(data, key); -} -function getEncryptKdfParams(options) { - // Check/generate the salt - const salt = options.salt != null - ? getBytes(options.salt, "options.salt") - : randomBytes(32); - // Override the scrypt password-based key derivation function parameters - let N = 1 << 17, r = 8, p = 1; - if (options.scrypt) { - if (options.scrypt.N) { - N = options.scrypt.N; - } - if (options.scrypt.r) { - r = options.scrypt.r; - } - if (options.scrypt.p) { - p = options.scrypt.p; - } - } - assertArgument(typeof N === "number" && - N > 0 && - Number.isSafeInteger(N) && - (BigInt(N) & BigInt(N - 1)) === BigInt(0), "invalid scrypt N parameter", "options.N", N); - assertArgument(typeof r === "number" && r > 0 && Number.isSafeInteger(r), "invalid scrypt r parameter", "options.r", r); - assertArgument(typeof p === "number" && p > 0 && Number.isSafeInteger(p), "invalid scrypt p parameter", "options.p", p); - return { name: "scrypt", dkLen: 32, salt, N, r, p }; -} -function _encryptKeystore(key, kdf, account, options) { - const privateKey = getBytes(account.privateKey, "privateKey"); - // Override initialization vector - const iv = options.iv != null ? getBytes(options.iv, "options.iv") : randomBytes(16); - assertArgument(iv.length === 16, "invalid options.iv length", "options.iv", options.iv); - // Override the uuid - const uuidRandom = options.uuid != null - ? getBytes(options.uuid, "options.uuid") - : randomBytes(16); - assertArgument(uuidRandom.length === 16, "invalid options.uuid length", "options.uuid", options.iv); - // This will be used to encrypt the wallet (as per Web3 secret storage) - // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) - // - 32 bytes AES key to encrypt mnemonic with (required here to be corebc Wallet) - const derivedKey = key.slice(0, 16); - const macPrefix = key.slice(16, 32); - // Encrypt the private key - const aesCtr = new CTR(derivedKey, iv); - const ciphertext = getBytes(aesCtr.encrypt(privateKey)); - // Compute the message authentication code, used to check the password - const mac = sha256(concat([macPrefix, ciphertext])); - const data = { - address: account.address.substring(2).toLowerCase(), - id: uuidV4(uuidRandom), - version: 3, - Crypto: { - cipher: "aes-128-ctr", - cipherparams: { - iv: hexlify(iv).substring(2), - }, - ciphertext: hexlify(ciphertext).substring(2), - kdf: "scrypt", - kdfparams: { - salt: hexlify(kdf.salt).substring(2), - n: kdf.N, - dklen: 32, - p: kdf.p, - r: kdf.r, - }, - mac: mac.substring(2), - }, - }; - // If we have a mnemonic, encrypt it into the JSON wallet - if (account.mnemonic) { - const client = options.client != null ? options.client : `corebc/${version}`; - const path = account.mnemonic.path || defaultPath; - const locale = account.mnemonic.locale || "en"; - const mnemonicKey = key.slice(32, 64); - const entropy = getBytes(account.mnemonic.entropy, "account.mnemonic.entropy"); - const mnemonicIv = randomBytes(16); - const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); - const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy)); - const now = new Date(); - const timestamp = now.getUTCFullYear() + - "-" + - zpad(now.getUTCMonth() + 1, 2) + - "-" + - zpad(now.getUTCDate(), 2) + - "T" + - zpad(now.getUTCHours(), 2) + - "-" + - zpad(now.getUTCMinutes(), 2) + - "-" + - zpad(now.getUTCSeconds(), 2) + - ".0Z"; - const gethFilename = "UTC--" + timestamp + "--" + data.address; - data["x-corebc"] = { - client, - gethFilename, - path, - locale, - mnemonicCounter: hexlify(mnemonicIv).substring(2), - mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2), - version: "0.1", - }; - } - return JSON.stringify(data); -} -/** - * Return the JSON Keystore Wallet for %%account%% encrypted with - * %%password%%. - * - * The %%options%% can be used to tune the password-based key - * derivation function parameters, explicitly set the random values - * used. Any provided [[ProgressCallback]] is ignord. - */ -export function encryptKeystoreJsonSync(account, password, options) { - if (options == null) { - options = {}; - } - const passwordBytes = getPassword(password); - const kdf = getEncryptKdfParams(options); - const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64); - return _encryptKeystore(getBytes(key), kdf, account, options); -} -/** - * Resolved to the JSON Keystore Wallet for %%account%% encrypted - * with %%password%%. - * - * The %%options%% can be used to tune the password-based key - * derivation function parameters, explicitly set the random values - * used and provide a [[ProgressCallback]] to receive periodic updates - * on the completion status.. - */ -export async function encryptKeystoreJson(account, password, options) { - if (options == null) { - options = {}; - } - const passwordBytes = getPassword(password); - const kdf = getEncryptKdfParams(options); - const key = await scrypt(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback); - return _encryptKeystore(getBytes(key), kdf, account, options); -} -//# sourceMappingURL=json-keystore.js.map \ No newline at end of file diff --git a/lib.esm/wallet/json-keystore.js.map b/lib.esm/wallet/json-keystore.js.map deleted file mode 100644 index 3cb75b2b5..000000000 --- a/lib.esm/wallet/json-keystore.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-keystore.js","sourceRoot":"","sources":["../../src.ts/wallet/json-keystore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,aAAa;AACb,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACL,MAAM,EACN,WAAW,EACX,MAAM,EACN,UAAU,EACV,MAAM,GACP,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,EACN,MAAM,EACN,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKxD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1E,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAgCvC;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,IAAI;QACF,MAAM,IAAI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G,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACzE,OAAO,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAAwB,EACxB,QAA6B,EAC7B,OAAwB;IAExB,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,GAAG,EAAE,CAAC;KACd;IAED,MAAM,aAAa,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,GAAG,GAAG,MAAM,MAAM,CACtB,aAAa,EACb,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,CAAC,EACL,GAAG,CAAC,CAAC,EACL,GAAG,CAAC,CAAC,EACL,EAAE,EACF,OAAO,CAAC,gBAAgB,CACzB,CAAC;IACF,OAAO,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC"} \ No newline at end of file diff --git a/lib.esm/wallet/mnemonic.d.ts b/lib.esm/wallet/mnemonic.d.ts deleted file mode 100644 index 64ef1a10e..000000000 --- a/lib.esm/wallet/mnemonic.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -import type { BytesLike } from "../utils/index.js"; -import type { Wordlist } from "../wordlists/index.js"; -/** - * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] - * seeds and convert between phrases and entropy. - */ -export declare class Mnemonic { - /** - * The mnemonic phrase of 12, 15, 18, 21 or 24 words. - * - * Use the [[wordlist]] ``split`` method to get the individual words. - */ - readonly phrase: string; - /** - * The password used for this mnemonic. If no password is used this - * is the empty string (i.e. ``""``) as per the specification. - */ - readonly password: string; - /** - * The wordlist for this mnemonic. - */ - readonly wordlist: Wordlist; - /** - * The underlying entropy which the mnemonic encodes. - */ - readonly entropy: string; - /** - * @private - */ - constructor(guard: any, entropy: string, phrase: string, password?: null | string, wordlist?: null | Wordlist); - /** - * Returns the seed for the mnemonic. - */ - computeSeed(): string; - /** - * Creates a new Mnemonic for the %%phrase%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromPhrase({ phrase, password, wordlist, }: { - phrase: string; - password?: null | string; - wordlist?: null | Wordlist; - }): Mnemonic; - /** - * Create a new **Mnemonic** from the %%entropy%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromEntropy(_entropy: BytesLike, password?: null | string, wordlist?: null | Wordlist): Mnemonic; - /** - * Returns the phrase for %%mnemonic%%. - */ - static entropyToPhrase(_entropy: BytesLike, wordlist?: null | Wordlist): string; - /** - * Returns the entropy for %%phrase%%. - */ - static phraseToEntropy(phrase: string, wordlist?: null | Wordlist): string; - /** - * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. - * - * This checks all the provided words belong to the %%wordlist%%, - * that the length is valid and the checksum is correct. - */ - static isValidMnemonic(phrase: string, wordlist?: null | Wordlist): boolean; -} -//# sourceMappingURL=mnemonic.d.ts.map \ No newline at end of file diff --git a/lib.esm/wallet/mnemonic.d.ts.map b/lib.esm/wallet/mnemonic.d.ts.map deleted file mode 100644 index 82d411a3d..000000000 --- a/lib.esm/wallet/mnemonic.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mnemonic.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/mnemonic.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AA6HtD;;;GAGG;AACH,qBAAa,QAAQ;IACnB;;;;OAIG;IACH,QAA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ib.esm/wallet/mnemonic.js deleted file mode 100644 index afcc4470b..000000000 --- a/lib.esm/wallet/mnemonic.js +++ /dev/null @@ -1,166 +0,0 @@ -import { defineProperties, getBytes, hexlify, assertNormalize, assertPrivate, assertArgument, } from "../utils/index.js"; -import { LangEn } from "../wordlists/lang-en.js"; -import { legacySha256 } from "../crypto/sha3.js"; -import { mnemonicToSeed } from "./mnemonicToSeed.js"; -// Returns a byte with the MSB bits set -function getUpperMask(bits) { - return (((1 << bits) - 1) << (8 - bits)) & 0xff; -} -// Returns a byte with the LSB bits set -function getLowerMask(bits) { - return ((1 << bits) - 1) & 0xff; -} -function mnemonicToEntropy(mnemonic, wordlist) { - assertNormalize("NFKD"); - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - const words = wordlist.split(mnemonic); - assertArgument(words.length % 3 === 0 && words.length >= 12 && words.length <= 24, "invalid mnemonic length", "mnemonic", "[ REDACTED ]"); - const entropy = new Uint8Array(Math.ceil((11 * words.length) / 8)); - let offset = 0; - for (let i = 0; i < words.length; i++) { - let index = wordlist.getWordIndex(words[i].normalize("NFKD")); - assertArgument(index >= 0, `invalid mnemonic word at index ${i}`, "mnemonic", "[ REDACTED ]"); - for (let bit = 0; bit < 11; bit++) { - if (index & (1 << (10 - bit))) { - entropy[offset >> 3] |= 1 << (7 - (offset % 8)); - } - offset++; - } - } - const entropyBits = (32 * words.length) / 3; - const checksumBits = words.length / 3; - const checksumMask = getUpperMask(checksumBits); - const checksum = getBytes(legacySha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; - assertArgument(checksum === (entropy[entropy.length - 1] & checksumMask), "invalid mnemonic checksum", "mnemonic", "[ REDACTED ]"); - return hexlify(entropy.slice(0, entropyBits / 8)); -} -function entropyToMnemonic(entropy, wordlist) { - assertArgument(entropy.length % 4 === 0 && entropy.length >= 16 && entropy.length <= 32, "invalid entropy size", "entropy", "[ REDACTED ]"); - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - const indices = [0]; - let remainingBits = 11; - for (let i = 0; i < entropy.length; i++) { - // Consume the whole byte (with still more to go) - if (remainingBits > 8) { - indices[indices.length - 1] <<= 8; - indices[indices.length - 1] |= entropy[i]; - remainingBits -= 8; - // This byte will complete an 11-bit index - } - else { - indices[indices.length - 1] <<= remainingBits; - indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); - // Start the next word - indices.push(entropy[i] & getLowerMask(8 - remainingBits)); - remainingBits += 3; - } - } - // Compute the checksum bits - const checksumBits = entropy.length / 4; - const checksum = parseInt(legacySha256(entropy).substring(2, 4), 16) & - getUpperMask(checksumBits); - // Shift the checksum into the word indices - indices[indices.length - 1] <<= checksumBits; - indices[indices.length - 1] |= checksum >> (8 - checksumBits); - return wordlist.join(indices.map((index) => wordlist.getWord(index))); -} -const _guard = {}; -/** - * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] - * seeds and convert between phrases and entropy. - */ -export class Mnemonic { - /** - * The mnemonic phrase of 12, 15, 18, 21 or 24 words. - * - * Use the [[wordlist]] ``split`` method to get the individual words. - */ - phrase; - /** - * The password used for this mnemonic. If no password is used this - * is the empty string (i.e. ``""``) as per the specification. - */ - password; - /** - * The wordlist for this mnemonic. - */ - wordlist; - /** - * The underlying entropy which the mnemonic encodes. - */ - entropy; - /** - * @private - */ - constructor(guard, entropy, phrase, password, wordlist) { - if (password == null) { - password = ""; - } - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - assertPrivate(guard, _guard, "Mnemonic"); - defineProperties(this, { phrase, password, wordlist, entropy }); - } - /** - * Returns the seed for the mnemonic. - */ - computeSeed() { - return mnemonicToSeed(this.phrase, this.password); - } - /** - * Creates a new Mnemonic for the %%phrase%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromPhrase({ phrase, password, wordlist, }) { - // Normalize the case and space; throws if invalid - const entropy = mnemonicToEntropy(phrase, wordlist); - phrase = entropyToMnemonic(getBytes(entropy), wordlist); - return new Mnemonic(_guard, entropy, phrase, password, wordlist); - } - /** - * Create a new **Mnemonic** from the %%entropy%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromEntropy(_entropy, password, wordlist) { - const entropy = getBytes(_entropy, "entropy"); - const phrase = entropyToMnemonic(entropy, wordlist); - return new Mnemonic(_guard, hexlify(entropy), phrase, password, wordlist); - } - /** - * Returns the phrase for %%mnemonic%%. - */ - static entropyToPhrase(_entropy, wordlist) { - const entropy = getBytes(_entropy, "entropy"); - return entropyToMnemonic(entropy, wordlist); - } - /** - * Returns the entropy for %%phrase%%. - */ - static phraseToEntropy(phrase, wordlist) { - return mnemonicToEntropy(phrase, wordlist); - } - /** - * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. - * - * This checks all the provided words belong to the %%wordlist%%, - * that the length is valid and the checksum is correct. - */ - static isValidMnemonic(phrase, wordlist) { - try { - mnemonicToEntropy(phrase, wordlist); - return true; - } - catch (error) { } - return false; - } -} -//# sourceMappingURL=mnemonic.js.map \ No newline at end of file diff --git a/lib.esm/wallet/mnemonic.js.map b/lib.esm/wallet/mnemonic.js.map deleted file mode 100644 index 65921f68f..000000000 --- a/lib.esm/wallet/mnemonic.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mnemonic.js","sourceRoot":"","sources":["../../src.ts/wallet/mnemonic.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,OAAO,EACP,eAAe,EACf,aAAa,EACb,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAIjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,uCAAuC;AACvC,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAA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CAChB,QAAmB,EACnB,QAAwB,EACxB,QAA0B;QAE1B,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC9C,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACpD,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC5E,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,eAAe,CACpB,QAAmB,EACnB,QAA0B;QAE1B,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC9C,OAAO,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,MAAc,EAAE,QAA0B;QAC/D,OAAO,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,MAAc,EAAE,QAA0B;QAC/D,IAAI;YACF,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC;SACb;QAAC,OAAO,KAAK,EAAE,GAAE;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/wallet/mnemonicToSeed.d.ts b/lib.esm/wallet/mnemonicToSeed.d.ts deleted file mode 100644 index ee0ed82a0..000000000 --- a/lib.esm/wallet/mnemonicToSeed.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function mnemonicToSeed(mnemonic: string, password?: string): string; -//# sourceMappingURL=mnemonicToSeed.d.ts.map \ No newline at end of file diff --git a/lib.esm/wallet/mnemonicToSeed.d.ts.map b/lib.esm/wallet/mnemonicToSeed.d.ts.map deleted file mode 100644 index fa7e673dc..000000000 --- a/lib.esm/wallet/mnemonicToSeed.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mnemonicToSeed.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/mnemonicToSeed.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAM1E"} \ No newline at end of file diff --git a/lib.esm/wallet/mnemonicToSeed.js b/lib.esm/wallet/mnemonicToSeed.js deleted file mode 100644 index 6e88e1f96..000000000 --- a/lib.esm/wallet/mnemonicToSeed.js +++ /dev/null @@ -1,22 +0,0 @@ -import { pbkdf2Sync } from "../crypto/crypto.js"; -import utf8 from "utf8"; -export function mnemonicToSeed(mnemonic, password) { - if (!password) { - password = ""; - } - const t = generateSeed(mnemonic, password); - return t.goldilock; -} -const generateSeed = (mnemonic, password) => { - const goldilockSaltPrefix = "mnemonic"; - const aesSaltPrefix = "mnemonicfortheAESkey"; - const goldilockSalt = utf8.encode(goldilockSaltPrefix + password); - const aesSalt = utf8.encode(aesSaltPrefix + password); - const goldilockKey = pbkdf2Sync(Buffer.from(mnemonic), goldilockSalt, 2048, 64, "sha512"); - const aesKeySeed = pbkdf2Sync(Buffer.from(mnemonic), aesSalt, 2048, 64, "sha512"); - return { - aes: aesKeySeed.toString("hex"), - goldilock: goldilockKey.toString("hex"), - }; -}; -//# sourceMappingURL=mnemonicToSeed.js.map \ No newline at end of file diff --git a/lib.esm/wallet/mnemonicToSeed.js.map b/lib.esm/wallet/mnemonicToSeed.js.map deleted file mode 100644 index 262290427..000000000 --- a/lib.esm/wallet/mnemonicToSeed.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mnemonicToSeed.js","sourceRoot":"","sources":["../../src.ts/wallet/mnemonicToSeed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,QAAiB;IAChE,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,EAAE,CAAC;KACf;IACD,MAAM,CAAC,GAAG,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,YAAY,GAAG,CAAC,QAAgB,EAAE,QAAiB,EAAE,EAAE;IAC3D,MAAM,mBAAmB,GAAG,UAAU,CAAC;IACvC,MAAM,aAAa,GAAG,sBAAsB,CAAC;IAE7C,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,mBAAmB,GAAG,QAAQ,CAAC,CAAC;IAClE,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,GAAG,QAAQ,CAAC,CAAC;IAEtD,MAAM,YAAY,GAAG,UAAU,CAC7B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EACrB,aAAa,EACb,IAAI,EACJ,EAAE,EACF,QAAQ,CACT,CAAC;IAEF,MAAM,UAAU,GAAG,UAAU,CAC3B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EACrB,OAAO,EACP,IAAI,EACJ,EAAE,EACF,QAAQ,CACT,CAAC;IAEF,OAAO;QACL,GAAG,EAAE,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC/B,SAAS,EAAE,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC;KACxC,CAAC;AACJ,CAAC,CAAC"} \ No newline at end of file diff --git a/lib.esm/wallet/utils.d.ts b/lib.esm/wallet/utils.d.ts deleted file mode 100644 index 0d4baabe8..000000000 --- a/lib.esm/wallet/utils.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @_ignore - */ -export declare function looseArrayify(hexString: string): Uint8Array; -export declare function zpad(value: String | number, length: number): String; -export declare function getPassword(password: string | Uint8Array): Uint8Array; -export declare function spelunk(object: any, _path: string): T; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/lib.esm/wallet/utils.d.ts.map b/lib.esm/wallet/utils.d.ts.map deleted file mode 100644 index 4c02cc44f..000000000 --- a/lib.esm/wallet/utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAK3D;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMnE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAKrE;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAoExD"} \ No newline at end of file diff --git a/lib.esm/wallet/utils.js b/lib.esm/wallet/utils.js deleted file mode 100644 index 342f28b5b..000000000 --- a/lib.esm/wallet/utils.js +++ /dev/null @@ -1,142 +0,0 @@ -/** - * @_ignore - */ -import { getBytesCopy, assertArgument, toUtf8Bytes } from "../utils/index.js"; -export function looseArrayify(hexString) { - if (typeof hexString === "string" && !hexString.startsWith("0x")) { - hexString = "0x" + hexString; - } - return getBytesCopy(hexString); -} -export function zpad(value, length) { - value = String(value); - while (value.length < length) { - value = "0" + value; - } - return value; -} -export function getPassword(password) { - if (typeof password === "string") { - return toUtf8Bytes(password, "NFKC"); - } - return getBytesCopy(password); -} -export function spelunk(object, _path) { - const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i); - assertArgument(match != null, "invalid path", "path", _path); - const path = match[1]; - const type = match[3]; - const reqd = match[4] === "!"; - let cur = object; - for (const comp of path.toLowerCase().split(".")) { - // Search for a child object with a case-insensitive matching key - if (Array.isArray(cur)) { - if (!comp.match(/^[0-9]+$/)) { - break; - } - cur = cur[parseInt(comp)]; - } - else if (typeof cur === "object") { - let found = null; - for (const key in cur) { - if (key.toLowerCase() === comp) { - found = cur[key]; - break; - } - } - cur = found; - } - else { - cur = null; - } - if (cur == null) { - break; - } - } - assertArgument(!reqd || cur != null, "missing required value", "path", path); - if (type && cur != null) { - if (type === "int") { - if (typeof cur === "string" && cur.match(/^-?[0-9]+$/)) { - return parseInt(cur); - } - else if (Number.isSafeInteger(cur)) { - return cur; - } - } - if (type === "number") { - if (typeof cur === "string" && cur.match(/^-?[0-9.]*$/)) { - return parseFloat(cur); - } - } - if (type === "data") { - if (typeof cur === "string") { - return looseArrayify(cur); - } - } - if (type === "array" && Array.isArray(cur)) { - return cur; - } - if (type === typeof cur) { - return cur; - } - assertArgument(false, `wrong type found for ${type} `, "path", path); - } - return cur; -} -/* -export function follow(object: any, path: string): null | string { - let currentChild = object; - - for (const comp of path.toLowerCase().split('/')) { - - // Search for a child object with a case-insensitive matching key - let matchingChild = null; - for (const key in currentChild) { - if (key.toLowerCase() === comp) { - matchingChild = currentChild[key]; - break; - } - } - - if (matchingChild === null) { return null; } - - currentChild = matchingChild; - } - - return currentChild; -} - -// "path/to/something:type!" -export function followRequired(data: any, path: string): string { - const value = follow(data, path); - if (value != null) { return value; } - return logger.throwArgumentError("invalid value", `data:${ path }`, - JSON.stringify(data)); -} -*/ -// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) -/* -export function uuidV4(randomBytes: BytesLike): string { - const bytes = getBytes(randomBytes, "randomBytes"); - - // Section: 4.1.3: - // - time_hi_and_version[12:16] = 0b0100 - bytes[6] = (bytes[6] & 0x0f) | 0x40; - - // Section 4.4 - // - clock_seq_hi_and_reserved[6] = 0b0 - // - clock_seq_hi_and_reserved[7] = 0b1 - bytes[8] = (bytes[8] & 0x3f) | 0x80; - - const value = hexlify(bytes); - - return [ - value.substring(2, 10), - value.substring(10, 14), - value.substring(14, 18), - value.substring(18, 22), - value.substring(22, 34), - ].join("-"); -} -*/ -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/lib.esm/wallet/utils.js.map b/lib.esm/wallet/utils.js.map deleted file mode 100644 index 6bf9e19de..000000000 --- a/lib.esm/wallet/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src.ts/wallet/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE9E,MAAM,UAAU,aAAa,CAAC,SAAiB;IAC7C,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QAChE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;KAC9B;IACD,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,KAAsB,EAAE,MAAc;IACzD,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB,OAAO,KAAK,CAAC,MAAM,GAAG,MAAM,EAAE;QAC5B,KAAK,GAAG,GAAG,GAAG,KAAK,CAAC;KACrB;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,QAA6B;IACvD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;QAChC,OAAO,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;KACtC;IACD,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,OAAO,CAAI,MAAW,EAAE,KAAa;IACnD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;IAChE,cAAc,CAAC,KAAK,IAAI,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAE7D,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CA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AAC,EAAE;gBACpC,OAAO,GAAG,CAAC;aACZ;SACF;QAED,IAAI,IAAI,KAAK,QAAQ,EAAE;YACrB,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;gBACvD,OAAoB,UAAU,CAAC,GAAG,CAAE,CAAC;aACtC;SACF;QAED,IAAI,IAAI,KAAK,MAAM,EAAE;YACnB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;gBAC3B,OAAoB,aAAa,CAAC,GAAG,CAAE,CAAC;aACzC;SACF;QAED,IAAI,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC1C,OAAoB,GAAI,CAAC;SAC1B;QACD,IAAI,IAAI,KAAK,OAAO,GAAG,EAAE;YACvB,OAAO,GAAG,CAAC;SACZ;QAED,cAAc,CAAC,KAAK,EAAE,wBAAwB,IAAI,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;KACtE;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BE;AACF,0DAA0D;AAC1D;;;;;;;;;;;;;;;;;;;;;;;EAuBE"} \ No newline at end of file diff --git a/lib.esm/wallet/wallet.d.ts b/lib.esm/wallet/wallet.d.ts deleted file mode 100644 index 384cb372f..000000000 --- a/lib.esm/wallet/wallet.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { SigningKey } from "../crypto/index.js"; -import { BaseWallet } from "./base-wallet.js"; -import { HDNodeWallet } from "./hdwallet.js"; -import type { ProgressCallback } from "../crypto/index.js"; -import type { Provider } from "../providers/index.js"; -/** - * A **Wallet** manages a single private key which is used to sign - * transactions, messages and other common payloads. - * - * This class is generally the main entry point for developers - * that wish to use a private key directly, as it can create - * instances from a large variety of common sources, including - * raw private key, [[link-bip-39]] mnemonics and encrypte JSON - * wallets. - */ -export declare class Wallet extends BaseWallet { - #private; - /** - * Create a new wallet for the %%privateKey%% or %%signingKey%%, optionally connected - * to %%provider%%. - */ - constructor({ key, prefix, provider, }: { - key: string | SigningKey; - prefix: string; - provider?: null | Provider; - }); - connect(provider: null | Provider): Wallet; - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise; - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password: Uint8Array | string): string; - /** - * Creates (asynchronously) a **Wallet** by decrypting the %%json%% - * with %%password%%. - * - * If %%progress%% is provided, it is called periodically during - * decryption so that any UI can be updated. - */ - static fromEncryptedJson(json: string, password: Uint8Array | string, progress?: ProgressCallback): Promise; - /** - * Creates a **Wallet** by decrypting the %%json%% with %%password%%. - * - * The [[fromEncryptedJson]] method is preferred, as this method - * will lock up and freeze the UI during decryption, which may take - * some time. - */ - static fromEncryptedJsonSync(json: string, password: Uint8Array | string): HDNodeWallet | Wallet; - /** - * Creates a new random [[HDNodeWallet]] using the avavilable - * [cryptographic random source](randomBytes). - * - * If there is no crytographic random source, this will throw. - */ - static createRandom(prefix: string, provider?: null | Provider): HDNodeWallet; - /** - * Creates a [[HDNodeWallet]] for %%phrase%%. - */ - static fromPhrase({ phrase, prefix, provider, password, }: { - phrase: string; - prefix: string; - provider?: Provider; - password?: string; - }): HDNodeWallet; - static fromSeed({ seed, prefix, provider, path, }: { - seed: string; - prefix: string; - path?: string; - provider?: Provider; - }): HDNodeWallet; -} -//# sourceMappingURL=wallet.d.ts.map \ No newline at end of file diff --git a/lib.esm/wallet/wallet.d.ts.map b/lib.esm/wallet/wallet.d.ts.map deleted file mode 100644 index edbeaa1bd..000000000 --- a/lib.esm/w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AKG;IACH,MAAM,CAAC,YAAY,CACjB,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GACzB,YAAY;IAaf;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,EAChB,MAAM,EACN,MAAM,EACN,QAAQ,EACR,QAAQ,GACT,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,YAAY;IAWhB,MAAM,CAAC,QAAQ,CAAC,EACd,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,IAAI,GACL,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,QAAQ,CAAC;KACrB,GAAG,YAAY;CAWjB"} \ No newline at end of file diff --git a/lib.esm/wallet/wallet.js b/lib.esm/wallet/wallet.js deleted file mode 100644 index 3ad84da77..000000000 --- a/lib.esm/wallet/wallet.js +++ /dev/null @@ -1,180 +0,0 @@ -import { SigningKey } from "../crypto/index.js"; -import { assertArgument } from "../utils/index.js"; -import { BaseWallet } from "./base-wallet.js"; -import { defaultPath, HDNodeWallet } from "./hdwallet.js"; -import { decryptCrowdsaleJson, isCrowdsaleJson } from "./json-crowdsale.js"; -import { decryptKeystoreJson, decryptKeystoreJsonSync, encryptKeystoreJson, encryptKeystoreJsonSync, isKeystoreJson, } from "./json-keystore.js"; -import { Mnemonic } from "./mnemonic.js"; -import { extractPrefix } from "../transaction/address.js"; -function stall(duration) { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, duration); - }); -} -/** - * A **Wallet** manages a single private key which is used to sign - * transactions, messages and other common payloads. - * - * This class is generally the main entry point for developers - * that wish to use a private key directly, as it can create - * instances from a large variety of common sources, including - * raw private key, [[link-bip-39]] mnemonics and encrypte JSON - * wallets. - */ -export class Wallet extends BaseWallet { - /** - * Create a new wallet for the %%privateKey%% or %%signingKey%%, optionally connected - * to %%provider%%. - */ - constructor({ key, prefix, provider, }) { - if (typeof key === "string" && !key.startsWith("0x")) { - key = "0x" + key; - } - let signingKey = typeof key === "string" ? new SigningKey(key) : key; - super({ - signingKey, - prefix, - provider, - }); - } - connect(provider) { - return new Wallet({ - key: this.signingKey, - prefix: this.prefix, - provider, - }); - } - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - async encrypt(password, progressCallback) { - const account = { address: this.address, privateKey: this.privateKey }; - return await encryptKeystoreJson(account, password, { progressCallback }); - } - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password) { - const account = { address: this.address, privateKey: this.privateKey }; - return encryptKeystoreJsonSync(account, password); - } - static #fromAccount(account) { - assertArgument(account, "invalid JSON wallet", "json", "[ REDACTED ]"); - const address = account.address; - const prefix = extractPrefix(address); - if ("mnemonic" in account && - account.mnemonic && - account.mnemonic.locale === "en") { - const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy); - const wallet = HDNodeWallet.fromMnemonic(mnemonic, prefix, account.mnemonic.path); - if (wallet.address === account.address && - wallet.privateKey === account.privateKey) { - return wallet; - } - console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key"); - } - const wallet = new Wallet({ - key: account.privateKey, - prefix, - }); - assertArgument(wallet.address === account.address, "address/privateKey mismatch", "json", "[ REDACTED ]"); - return wallet; - } - /** - * Creates (asynchronously) a **Wallet** by decrypting the %%json%% - * with %%password%%. - * - * If %%progress%% is provided, it is called periodically during - * decryption so that any UI can be updated. - */ - static async fromEncryptedJson(json, password, progress) { - let account = null; - if (isKeystoreJson(json)) { - account = await decryptKeystoreJson(json, password, progress); - } - else if (isCrowdsaleJson(json)) { - if (progress) { - progress(0); - await stall(0); - } - account = decryptCrowdsaleJson(json, password); - if (progress) { - progress(1); - await stall(0); - } - } - return Wallet.#fromAccount(account); - } - /** - * Creates a **Wallet** by decrypting the %%json%% with %%password%%. - * - * The [[fromEncryptedJson]] method is preferred, as this method - * will lock up and freeze the UI during decryption, which may take - * some time. - */ - static fromEncryptedJsonSync(json, password) { - let account = null; - if (isKeystoreJson(json)) { - account = decryptKeystoreJsonSync(json, password); - } - else if (isCrowdsaleJson(json)) { - account = decryptCrowdsaleJson(json, password); - } - else { - assertArgument(false, "invalid JSON wallet", "json", "[ REDACTED ]"); - } - return Wallet.#fromAccount(account); - } - /** - * Creates a new random [[HDNodeWallet]] using the avavilable - * [cryptographic random source](randomBytes). - * - * If there is no crytographic random source, this will throw. - */ - static createRandom(prefix, provider) { - const wallet = HDNodeWallet.createRandom(prefix, undefined, undefined, undefined); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } - /** - * Creates a [[HDNodeWallet]] for %%phrase%%. - */ - static fromPhrase({ phrase, prefix, provider, password, }) { - const wallet = HDNodeWallet.fromPhrase({ - phrase, - prefix, - password, - }); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } - static fromSeed({ seed, prefix, provider, path, }) { - const wallet = HDNodeWallet.fromSeed({ - seed, - prefix, - path: path || defaultPath, - }); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } -} -//# sourceMappingURL=wallet.js.map \ No newline at end of file diff --git a/lib.esm/wallet/wallet.js.map b/lib.esm/wallet/wallet.js.map deleted file mode 100644 index ba08710a9..000000000 --- a/lib.esm/wallet/wallet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../src.ts/wallet/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;A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AO,GAAG,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;SAChD;aAAM;YACL,cAAc,CAAC,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;SACtE;QAED,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CACjB,MAAc,EACd,QAA0B;QAE1B,MAAM,MAAM,GAAG,YAAY,CAAC,YAAY,CACtC,MAAM,EACN,SAAS,EACT,SAAS,EACT,SAAS,CACV,CAAC;QACF,IAAI,QAAQ,EAAE;YACZ,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;SACjC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,EAChB,MAAM,EACN,MAAM,EACN,QAAQ,EACR,QAAQ,GAMT;QACC,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC;YACrC,MAAM;YACN,MAAM;YACN,QAAQ;SACT,CAAC,CAAC;QACH,IAAI,QAAQ,EAAE;YACZ,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;SACjC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,CAAC,QAAQ,CAAC,EACd,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,IAAI,GAML;QACC,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC;YACnC,IAAI;YACJ,MAAM;YACN,IAAI,EAAE,IAAI,IAAI,WAAW;SAC1B,CAAC,CAAC;QACH,IAAI,QAAQ,EAAE;YACZ,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;SACjC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/wordlists/bit-reader.d.ts b/lib.esm/wordlists/bit-reader.d.ts deleted file mode 100644 index 1aa849530..000000000 --- a/lib.esm/wordlists/bit-reader.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * @_ignore - */ -export declare function decodeBits(width: number, data: string): Array; -//# sourceMappingURL=bit-reader.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/bit-reader.d.ts.map b/lib.esm/wordlists/bit-reader.d.ts.map deleted file mode 100644 index 904904c46..000000000 --- a/lib.esm/wordlists/bit-reader.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bit-reader.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/bit-reader.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CA8BrE"} \ No newline at end of file diff --git a/lib.esm/wordlists/bit-reader.js b/lib.esm/wordlists/bit-reader.js deleted file mode 100644 index 724ac7817..000000000 --- a/lib.esm/wordlists/bit-reader.js +++ /dev/null @@ -1,32 +0,0 @@ -const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; -/** - * @_ignore - */ -export function decodeBits(width, data) { - const maxValue = (1 << width) - 1; - const result = []; - let accum = 0, bits = 0, flood = 0; - for (let i = 0; i < data.length; i++) { - // Accumulate 6 bits of data - accum = (accum << 6) | Base64.indexOf(data[i]); - bits += 6; - // While we have enough for a word... - while (bits >= width) { - // ...read the word - const value = accum >> (bits - width); - accum &= (1 << (bits - width)) - 1; - bits -= width; - // A value of 0 indicates we exceeded maxValue, it - // floods over into the next value - if (value === 0) { - flood += maxValue; - } - else { - result.push(value + flood); - flood = 0; - } - } - } - return result; -} -//# sourceMappingURL=bit-reader.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/bit-reader.js.map b/lib.esm/wordlists/bit-reader.js.map deleted file mode 100644 index f7ee6ddba..000000000 --- a/lib.esm/wordlists/bit-reader.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bit-reader.js","sourceRoot":"","sources":["../../src.ts/wordlists/bit-reader.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GACV,kEAAkE,CAAC;AAErE;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,IAAY;IACpD,MAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,IAAI,KAAK,GAAG,CAAC,EACX,IAAI,GAAG,CAAC,EACR,KAAK,GAAG,CAAC,CAAC;IACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,4BAA4B;QAC5B,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,IAAI,IAAI,CAAC,CAAC;QAEV,qCAAqC;QACrC,OAAO,IAAI,IAAI,KAAK,EAAE;YACpB,mBAAmB;YACnB,MAAM,KAAK,GAAG,KAAK,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;YACtC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,IAAI,KAAK,CAAC;YAEd,kDAAkD;YAClD,kCAAkC;YAClC,IAAI,KAAK,KAAK,CAAC,EAAE;gBACf,KAAK,IAAI,QAAQ,CAAC;aACnB;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;gBAC3B,KAAK,GAAG,CAAC,CAAC;aACX;SACF;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/lib.esm/wordlists/decode-owl.d.ts b/lib.esm/wordlists/decode-owl.d.ts deleted file mode 100644 index 8822086bb..000000000 --- a/lib.esm/wordlists/decode-owl.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @_ignore - */ -export declare function decode(data: string, subs: string): Array; -/** - * @_ignore - */ -export declare function decodeOwl(data: string): Array; -//# sourceMappingURL=decode-owl.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/decode-owl.d.ts.map b/lib.esm/wordlists/decode-owl.d.ts.map deleted file mode 100644 index ce10ef2ad..000000000 --- a/lib.esm/wordlists/decode-owl.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decode-owl.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owl.ts"],"names":[],"mappings":"AAuBA;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CA4BhE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAOrD"} \ No newline at end of file diff --git a/lib.esm/wordlists/decode-owl.js b/lib.esm/wordlists/decode-owl.js deleted file mode 100644 index fe636fde6..000000000 --- a/lib.esm/wordlists/decode-owl.js +++ /dev/null @@ -1,55 +0,0 @@ -import { assertArgument } from "../utils/index.js"; -const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; -const Word = /^[a-z]*$/i; -function unfold(words, sep) { - let initial = 97; - return words.reduce((accum, word) => { - if (word === sep) { - initial++; - } - else if (word.match(Word)) { - accum.push(String.fromCharCode(initial) + word); - } - else { - initial = 97; - accum.push(word); - } - return accum; - }, []); -} -/** - * @_ignore - */ -export function decode(data, subs) { - // Replace all the substitutions with their expanded form - for (let i = subsChrs.length - 1; i >= 0; i--) { - data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); - } - // Get all tle clumps; each suffix, first-increment and second-increment - const clumps = []; - const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => { - if (semi) { - for (let i = parseInt(semi); i >= 0; i--) { - clumps.push(";"); - } - } - else { - clumps.push(item.toLowerCase()); - } - return ""; - }); - /* c8 ignore start */ - if (leftover) { - throw new Error(`leftovers: ${JSON.stringify(leftover)}`); - } - /* c8 ignore stop */ - return unfold(unfold(clumps, ";"), ":"); -} -/** - * @_ignore - */ -export function decodeOwl(data) { - assertArgument(data[0] === "0", "unsupported auwl data", "data", data); - return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length)); -} -//# sourceMappingURL=decode-owl.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/decode-owl.js.map b/lib.esm/wordlists/decode-owl.js.map deleted file mode 100644 index 35bb4d0d1..000000000 --- a/lib.esm/wordlists/decode-owl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decode-owl.js","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AACjD,MAAM,IAAI,GAAG,WAAW,CAAC;AAEzB,SAAS,MAAM,CAAC,KAAoB,EAAE,GAAW;IAC/C,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,OAAO,KAAK,CAAC,MAAM,CACjB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACd,IAAI,IAAI,KAAK,GAAG,EAAE;YAChB,OAAO,EAAE,CAAC;SACX;aAAM,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YAC3B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;SACjD;aAAM;YACL,OAAO,GAAG,EAAE,CAAC;YACb,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAClB;QACD,OAAO,KAAK,CAAC;IACf,CAAC,EACc,EAAE,C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GAAG,EAAE,uBAAuB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAEvE,OAAO,MAAM,CACX,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,EACvC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAC3C,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/lib.esm/wordlists/decode-owla.d.ts b/lib.esm/wordlists/decode-owla.d.ts deleted file mode 100644 index 479e6c54a..000000000 --- a/lib.esm/wordlists/decode-owla.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * @_ignore - */ -export declare function decodeOwlA(data: string, accents: string): Array; -//# sourceMappingURL=decode-owla.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/decode-owla.d.ts.map b/lib.esm/wordlists/decode-owla.d.ts.map deleted file mode 100644 index da8636365..000000000 --- a/lib.esm/wordlists/decode-owla.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decode-owla.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owla.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CA4BvE"} \ No newline at end of file diff --git a/lib.esm/wordlists/decode-owla.js b/lib.esm/wordlists/decode-owla.js deleted file mode 100644 index 0bae6acf6..000000000 --- a/lib.esm/wordlists/decode-owla.js +++ /dev/null @@ -1,28 +0,0 @@ -import { assertArgument } from "../utils/index.js"; -import { decodeBits } from "./bit-reader.js"; -import { decodeOwl } from "./decode-owl.js"; -/** - * @_ignore - */ -export function decodeOwlA(data, accents) { - let words = decodeOwl(data).join(","); - // Inject the accents - accents.split(/,/g).forEach((accent) => { - const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); - assertArgument(match !== null, "internal error parsing accents", "accents", accents); - let posOffset = 0; - const positions = decodeBits(parseInt(match[3]), match[4]); - const charCode = parseInt(match[2]); - const regex = new RegExp(`([${match[1]}])`, "g"); - words = words.replace(regex, (all, letter) => { - const rem = --positions[posOffset]; - if (rem === 0) { - letter = String.fromCharCode(letter.charCodeAt(0), charCode); - posOffset++; - } - return letter; - }); - }); - return words.split(","); -} -//# sourceMappingURL=decode-owla.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/decode-owla.js.map b/lib.esm/wordlists/decode-owla.js.map deleted file mode 100644 index 044e6bd43..000000000 --- a/lib.esm/wordlists/decode-owla.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decode-owla.js","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owla.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,OAAe;IACtD,IAAI,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEtC,qBAAqB;IACrB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAC5D,cAAc,CACZ,KAAK,KAAK,IAAI,EACd,gCAAgC,EAChC,SAAS,EACT,OAAO,CACR,CAAC;QAEF,IAAI,SAAS,GAAG,CAAC,CAAC;QAClB,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACjD,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YAC3C,MAAM,GAAG,GAAG,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;YACnC,IAAI,GAAG,KAAK,CAAC,EAAE;gBACb,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;gBAC7D,SAAS,EAAE,CAAC;aACb;YACD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC"} \ No newline at end of file diff --git a/lib.esm/wordlists/enwords.d.ts b/lib.esm/wordlists/enwords.d.ts deleted file mode 100644 index 8600e64a2..000000000 --- a/lib.esm/wordlists/enwords.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const enWords = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; -//# sourceMappingURL=enwords.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/enwords.d.ts.map b/lib.esm/wordlists/enwords.d.ts.map deleted file mode 100644 index 95d94c6d6..000000000 --- a/lib.esm/wordlists/enwords.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"enwords.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/enwords.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,i0VAC4yV,CAAC"} \ No newline at end of file diff --git a/lib.esm/wordlists/enwords.js b/lib.esm/wordlists/enwords.js deleted file mode 100644 index 157adbfd2..000000000 --- a/lib.esm/wordlists/enwords.js +++ /dev/null @@ -1,2 +0,0 @@ -export const enWords = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; -//# sourceMappingURL=enwords.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/enwords.js.map b/lib.esm/wordlists/enwords.js.map deleted file mode 100644 index 9210b1461..000000000 --- a/lib.esm/wordlists/enwords.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"enwords.js","sourceRoot":"","sources":["../../src.ts/wordlists/enwords.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAClB,8zVAA8zV,CAAC"} \ No newline at end of file diff --git a/lib.esm/wordlists/generation/encode-latin.d.ts b/lib.esm/wordlists/generation/encode-latin.d.ts deleted file mode 100644 index a646e8246..000000000 --- a/lib.esm/wordlists/generation/encode-latin.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export declare class BitWriter { - #private; - readonly width: number; - constructor(width: number); - write(value: number): void; - get length(): number; - get data(): string; -} -export interface AccentSet { - accent: number; - follows: string; - positions: Array; - positionsLength: number; - positionData: string; - positionDataLength: number; -} -export declare function extractAccents(words: Array): { - accents: Array; - words: Array; -}; -export declare function encodeOwl(words: Array): { - subs: string; - data: string; -}; -//# sourceMappingURL=encode-latin.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/generation/encode-latin.d.ts.map b/lib.esm/wordlists/generation/encode-latin.d.ts.map deleted file mode 100644 index 87eca3714..000000000 --- a/lib.esm/wordlists/generation/encode-latin.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encode-latin.d.ts","sourceRoot":"","sources":["../../../src.ts/wordlists/generation/encode-latin.ts"],"names":[],"mappings":"AAyIA,qBAAa,SAAS;;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAKX,KAAK,EAAE,MAAM;IAMzB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAW1B,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,IAAI,IAAI,MAAM,CA8BjB;CACF;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAWD,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;IACpD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB,CA+FA;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAmDA"} \ No newline at end of file diff --git a/lib.esm/wordlists/generation/encode-latin.js b/lib.esm/wordlists/generation/encode-latin.js deleted file mode 100644 index bc04cf064..000000000 --- a/lib.esm/wordlists/generation/encode-latin.js +++ /dev/null @@ -1,357 +0,0 @@ -// OWL Data Format -// -// The Official WordList data format exported by this encoder -// encodes sorted latin-1 words (letters only) based on the -// fact that sorted words have prefixes with substantial -// overlap. -// -// For example, the words: -// [ Another, Apple, Apricot, Bread ] -// could be folded once with a single special character, such -// as ":" to yield: -// [ nother, pple, pricot, :, read ]. -// The First letter has been removed, but can be inferred by -// starting at A and incrementing to the next letter when ":" -// is encountered. -// -// The fold operation can be repeated for large sets as even within -// each folded set, there is substatial overlap in prefix. With the -// second special symbol ";", we get: -// [ ; x 13, other, :, ple, ricot, :, ; x 18, ead ] -// which can be further compressed by using numbers instead of the -// special character: -// [ 13, other, :, ple, ricot, :, 18, ead ] -// and to keep all values within a single byte, we only allow a -// maximum value of 10 (using 0 through 9 to represent 1 through 10), -// we get: -// [ 9, 2, other, :, ple, ricot, :, 9, 7, ead ] -// and we use camel-case to imply the bounrary, giving the final string: -// "92Other:PleRicot:97Ead" -// -// Once the entire latin-1 set has been collapsed, we use the remaining -// printable characters (except " and \, which require 2 bytes to represent -// in string) to substiture for the most common 2-letter pairs of letters -// in the string. -// -// OWLA Accent Format -// -// OWLA first removes all accents, and encodes that data using the OWL -// data format and encodes the accents as a base-64 series of 6-bit -// packed bits representing the distance from one followed letter to the -// next. -// -// For example, the acute accent in a given language may follow either -// a or e, in which case the follow-set is "ae". Each letter in the entire -// set is indexed, so the set of words with the accents: -// "thisA/ppleDoe/sNotMa/tterToMe/" -// " 1^ 2^ 3^ 4^ 5^ 6^ " <-- follow-set members, ALL a's and e's -// which gives the positions: -// [ 0, 2, 3, 4, 6 ] -// which then reduce to the distances -// [ 0, 2, 1, 1, 2 ] -// each of which fit into a 2-bit value, so this can be encoded as the -// base-64 encoded string: -// 00 10 01 01 10 = 001001 1010xx -// -// The base-64 set used has all number replaced with their -// shifted-counterparts to prevent comflicting with the numbers used in -// the fold operation to indicate the number of ";". -import fs from "fs"; -import { id } from "../../hash/id.js"; -import { decodeOwl } from "../decode-owl.js"; -import { decodeOwlA } from "../decode-owla.js"; -const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; -const Word = /^[a-z'`]*$/i; -function fold(words, sep) { - const output = []; - let initial = 97; - for (const word of words) { - if (word.match(Word)) { - while (initial < word.charCodeAt(0)) { - initial++; - output.push(sep); - } - output.push(word.substring(1)); - } - else { - initial = 97; - output.push(word); - } - } - return output; -} -function camelcase(words) { - return words - .map((word) => { - if (word.match(Word)) { - return word[0].toUpperCase() + word.substring(1); - } - else { - return word; - } - }) - .join(""); -} -//let cc = 0, ce = 0; -/* -function getChar(c: string): string { - //if (c === "e") { ce++; } - if (c >= 'a' && c <= 'z') { return c; } - if (c.charCodeAt(1)) { - throw new Error(`bad char: "${ c }"`); - } - //cc++; - return ""; - if (c.charCodeAt(0) === 768) { return "`"; } - if (c.charCodeAt(0) === 769) { return "'"; } - if (c.charCodeAt(0) === 771) { return "~"; } - throw new Error(`Unsupported character: ${ c } (${ c.charCodeAt(0) }, ${ c.charCodeAt(1) })`); -} -function mangle(text: string): { word: string, special: string } { - const result: Array = [ ]; - for (let i = 0; i < text.length; i++) { - const c = getChar(text[i]); - result.push(c); - } - - const word = result.join(""); - if (word[1] >= 'a' && word[1] <= 'z') { return { word, special: " " }; } - return { word: word[0] + word.substring(2), special: word[1] }; -} -*/ -/* - Store: [ accent ][ targets ][ rle data; base64-tail ] - ` ae 3, 100 = (63, 37), 15 - ~ n 63, 64 = (63, 1), 27 -*/ -const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; -export class BitWriter { - width; - #data; - #bitLength; - constructor(width) { - this.width = width; - this.#data = []; - this.#bitLength = 0; - } - write(value) { - const maxValue = (1 << this.width) - 1; - while (value > maxValue) { - this.#data.push(0); - this.#bitLength += this.width; - value -= maxValue; - } - this.#data.push(value); - this.#bitLength += this.width; - } - get length() { - return 1 + Math.trunc((this.#bitLength + 5) / 6); - } - get data() { - let result = String(this.width); - let bits = 0; - let accum = 0; - const data = this.#data.slice(); - let bitMod = this.#bitLength % 6; - while (bitMod !== 0 && bitMod < 6) { - data.push(0); - bitMod += this.width; - } - for (const value of data) { - accum <<= this.width; - accum |= value; - bits += this.width; - if (bits < 6) { - continue; - } - result += Base64[accum >> (bits - 6)]; - bits -= 6; - accum &= (1 << bits) - 1; - } - if (result.length !== this.length) { - throw new Error(`Hmm: ${this.length} ${result.length} ${result}`); - } - return result; - } -} -function sorted(text) { - const letters = text.split(""); - letters.sort(); - return letters.join(""); -} -// if (c.charCodeAt(0) === 768) { return "`"; } -// if (c.charCodeAt(0) === 769) { return "'"; } -// if (c.charCodeAt(0) === 771) { return "~"; } -export function extractAccents(words) { - // Build a list that maps accents to the letters it can follow - const followsMap = new Map(); - for (const word of words) { - for (let i = 0; i < word.length; i++) { - const c = word[i]; - if (c >= "a" && c <= "z") { - continue; - } - // Make sure this positions and codepoint make sense - if (c.charCodeAt(1)) { - throw new Error(`unsupported codepoint: "${c}"`); - } - if (i === 0) { - throw new Error(`unmatched accent: ${c}`); - } - const ac = c.charCodeAt(0), lastLetter = word[i - 1]; - const follows = followsMap.get(ac) || ""; - if (follows.indexOf(lastLetter) === -1) { - followsMap.set(ac, sorted(follows + lastLetter)); - } - } - } - // Build the positions of each follow-set for those accents - const positionsMap = new Map(); - for (const [accent, follows] of followsMap) { - let count = 0; - for (const word of words) { - for (let i = 0; i < word.length; i++) { - const c = word[i], ac = c.charCodeAt(0); - if (follows.indexOf(c) >= 0) { - count++; - } - if (ac === accent) { - const pos = positionsMap.get(ac) || []; - pos.push(count); - positionsMap.set(ac, pos); - } - } - } - } - const accents = []; - for (const [accent, follows] of followsMap) { - let last = -1; - const positions = (positionsMap.get(accent) || []).map((value, index) => { - const delta = value - last; - last = value; - if (index === 0) { - return value; - } - return delta; - }); - // Find the best encoding of the position data - let positionData = ""; - for (let i = 2; i < 7; i++) { - const bitWriter = new BitWriter(i); - for (const p of positions) { - bitWriter.write(p); - } - if (positionData === "" || bitWriter.length < positionData.length) { - positionData = bitWriter.data; - } - } - const positionsLength = positions.length; - const positionDataLength = positionData.length; - accents.push({ - accent, - follows, - positions, - positionsLength, - positionData, - positionDataLength, - }); - } - words = words.map((word) => { - let result = ""; - for (let i = 0; i < word.length; i++) { - const c = word[i]; - if (c >= "a" && c <= "z") { - result += c; - } - } - return result; - }); - return { accents, words }; -} -// Encode Official WordList -export function encodeOwl(words) { - // Fold the sorted words by indicating delta for the first 2 letters - let data = camelcase(fold(fold(words, ":"), ";")); - // Replace semicolons with counts (e.g. ";;;" with "3") - data = data.replace(/(;+)/g, (all, semis) => { - let result = ""; - while (semis.length) { - let count = semis.length; - if (count > 10) { - count = 10; - } - result += String(count - 1); - semis = semis.substring(count); - } - return result; - }); - // Finds the best option for a shortcut replacement using the - // unused ascii7 characters - function findBest() { - const tally = {}; - const l = 2; - for (let i = l; i < data.length; i++) { - const key = data.substring(i - l, i); - tally[key] = (tally[key] || 0) + 1; - } - const sorted = Object.keys(tally).map((text) => { - return { - text, - count: tally[text], - save: tally[text] * (text.length - 1), - }; - }); - sorted.sort((a, b) => b.save - a.save); - return sorted[0].text; - } - // Make substitutions - let subs = ""; - for (let i = 0; i < subsChrs.length; i++) { - const n = subsChrs[i], o = findBest(); - subs += o; - data = data.split(o).join(n); - } - return { data, subs }; -} -// Returns either: -// - OWL data for accent-free latin-1: { data, accentds: "" } -// - OWLA data for accented latin-1: { data, accents } -function encodeWords(_words) { - const { accents, words } = extractAccents(_words); - const { data, subs } = encodeOwl(words); - const accentData = accents - .map(({ accent, follows, positionData }) => { - return `${follows}${accent}${positionData}`; - }) - .join(","); - return { - data: `0${subs}${data}`, - accents: accentData, - }; -} -// CLI -const content = fs.readFileSync(process.argv[2]).toString(); -const words = content.split("\n").filter(Boolean); -const { data, accents } = encodeWords(words); -if (accents) { - const rec = decodeOwlA(data, accents); - console.log("DATA: ", JSON.stringify(data)); - console.log("ACCENTS: ", JSON.stringify(accents)); - console.log("LENGTH: ", data.length); - console.log("CHECKSUM: ", id(content)); - console.log("RATIO: ", Math.trunc((100 * data.length) / content.length) + "%"); - if (rec.join("\n") !== words.join("\n")) { - throw new Error("no match!"); - } -} -else { - const rec = decodeOwl(data); - console.log("DATA: ", JSON.stringify(data)); - console.log("LENGTH: ", data.length); - console.log("CHECKSUM: ", id(content)); - console.log("RATIO: ", Math.trunc((100 * data.length) / content.length) + "%"); - if (rec.join("\n") !== words.join("\n")) { - throw new Error("no match!"); - } -} -//# sourceMappingURL=encode-latin.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/generation/encode-latin.js.map b/lib.esm/wordlists/generation/encode-latin.js.map deleted file mode 100644 index 5c0d5733a..000000000 --- a/lib.esm/wordlists/generation/encode-latin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encode-latin.js","sourceRoot":"","sources":["../../../src.ts/wordlists/generation/encode-latin.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,EAAE;AACF,6DAA6D;AAC7D,2DAA2D;AAC3D,wDAAwD;AACxD,WAAW;AACX,EAAE;AACF,0BAA0B;AAC1B,uCAAuC;AACvC,6DAA6D;AAC7D,mBAAmB;AACnB,uCAAuC;AACvC,4DAA4D;AAC5D,6DAA6D;AAC7D,kBAAkB;AAClB,EAAE;AACF,mEAAmE;AACnE,mEAAmE;AACnE,qCAAqC;AACrC,qDAAqD;AACrD,kEAAkE;AAClE,qBAAqB;AACrB,6CAA6C;AAC7C,+DAA+D;AAC/D,qEAAqE;AACrE,UAAU;AACV,iDAAiD;AACjD,wEAAwE;AACxE,6BAA6B;AAC7B,EAAE;AACF,uEAAuE;AACvE,2EAA2E;AAC3E,yEAAyE;A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AC,GAAG,GAAG,CACvD,CAAC;IACF,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;KAC9B;CACF"} \ No newline at end of file diff --git a/lib.esm/wordlists/index.d.ts b/lib.esm/wordlists/index.d.ts deleted file mode 100644 index 04a911c83..000000000 --- a/lib.esm/wordlists/index.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * A Wordlist is a set of 2048 words used to encode private keys - * (or other binary data) that is easier for humans to write down, - * transcribe and dictate. - * - * The [[link-bip-39]] standard includes several checksum bits, - * depending on the size of the mnemonic phrase. - * - * A mnemonic phrase may be 12, 15, 18, 21 or 24 words long. For - * most purposes 12 word mnemonics should be used, as including - * additional words increases the difficulty and potential for - * mistakes and does not offer any effective improvement on security. - * - * There are a variety of [[link-bip39-wordlists]] for different - * languages, but for maximal compatibility, the - * [English Wordlist](LangEn) is recommended. - * - * @_section: api/wordlists:Wordlists [about-wordlists] - */ -export { Wordlist } from "./wordlist.js"; -export { LangEn } from "./lang-en.js"; -export { WordlistOwl } from "./wordlist-owl.js"; -export { WordlistOwlA } from "./wordlist-owla.js"; -export { wordlists } from "./wordlists.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/index.d.ts.map b/lib.esm/wordlists/index.d.ts.map deleted file mode 100644 index ecd1d4b63..000000000 --- a/lib.esm/wordlists/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/lib.esm/wordlists/index.js b/lib.esm/wordlists/index.js deleted file mode 100644 index e3571e6f4..000000000 --- a/lib.esm/wordlists/index.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * A Wordlist is a set of 2048 words used to encode private keys - * (or other binary data) that is easier for humans to write down, - * transcribe and dictate. - * - * The [[link-bip-39]] standard includes several checksum bits, - * depending on the size of the mnemonic phrase. - * - * A mnemonic phrase may be 12, 15, 18, 21 or 24 words long. For - * most purposes 12 word mnemonics should be used, as including - * additional words increases the difficulty and potential for - * mistakes and does not offer any effective improvement on security. - * - * There are a variety of [[link-bip39-wordlists]] for different - * languages, but for maximal compatibility, the - * [English Wordlist](LangEn) is recommended. - * - * @_section: api/wordlists:Wordlists [about-wordlists] - */ -export { Wordlist } from "./wordlist.js"; -export { LangEn } from "./lang-en.js"; -export { WordlistOwl } from "./wordlist-owl.js"; -export { WordlistOwlA } from "./wordlist-owla.js"; -export { wordlists } from "./wordlists.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/index.js.map b/lib.esm/wordlists/index.js.map deleted file mode 100644 index 6865131ac..000000000 --- a/lib.esm/wordlists/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/wordlists/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/lib.esm/wordlists/lang-cz.d.ts b/lib.esm/wordlists/lang-cz.d.ts deleted file mode 100644 index c199d4fad..000000000 --- a/lib.esm/wordlists/lang-cz.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -/** - * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangCz extends WordlistOwl { - /** - * Creates a new instance of the Czech language Wordlist. - * - * Using the constructor should be unnecessary, instead use the - * [[wordlist]] singleton method. - * - * @_ignore: - */ - constructor(); - /** - * Returns a singleton instance of a ``LangCz``, creating it - * if this is the first time being called. - */ - static wordlist(): LangCz; -} -//# sourceMappingURL=lang-cz.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/lang-cz.d.ts.map b/lib.esm/wordlists/lang-cz.d.ts.map deleted file mode 100644 index 0db7b336b..000000000 --- a/lib.esm/wordlists/lang-cz.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-cz.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-cz.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;OAOG;;IAKH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/lib.esm/wordlists/lang-cz.js b/lib.esm/wordlists/lang-cz.js deleted file mode 100644 index 71eff6bd9..000000000 --- a/lib.esm/wordlists/lang-cz.js +++ /dev/null @@ -1,33 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -const words = "0itatkastcenaovo$taouleraeki&chor*teci%enbalodaeladet'!Chn=0Di#%E%^1Resa2Rese3CeT'#0EjKohol0Pu)%0A&sDul#Ekdo)Ke)Ti#Ul|3}aOgan%0FaltI$@tPi,%TmaTronom0LasL{i#Ol0Tobus4Yl:B#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a+0Lod Omal RavaR( Rud#Rvu1A^An C`]N (NoOv&Y/l Zav(1I/aR! 0B'.Br0Ed~EnkuEs_aOnR!Uk'odYk"; -const checksum = "0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a"; -let wordlist = null; -/** - * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export class LangCz extends WordlistOwl { - /** - * Creates a new instance of the Czech language Wordlist. - * - * Using the constructor should be unnecessary, instead use the - * [[wordlist]] singleton method. - * - * @_ignore: - */ - constructor() { - super("cz", words, checksum); - } - /** - * Returns a singleton instance of a ``LangCz``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist == null) { - wordlist = new LangCz(); - } - return wordlist; - } -} -//# sourceMappingURL=lang-cz.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/lang-cz.js.map b/lib.esm/wordlists/lang-cz.js.map deleted file mode 100644 index 0b5b98019..000000000 --- a/lib.esm/wordlists/lang-cz.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-cz.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-cz.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,KAAK,GACT,q9NAAq9N,CAAC;AACx9N,MAAM,QAAQ,GACZ,oEAAoE,CAAC;AAEvE,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;;;;;OAOG;IACH;QACE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACb,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SACzB;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/wordlists/lang-en.d.ts b/lib.esm/wordlists/lang-en.d.ts deleted file mode 100644 index 87a3234bb..000000000 --- a/lib.esm/wordlists/lang-en.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -/** - * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangEn extends WordlistOwl { - /** - * Creates a new instance of the English language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langEn]] should suffice. - * - * @_ignore: - */ - constructor(); - /** - * Returns a singleton instance of a ``LangEn``, creating it - * if this is the first time being called. - */ - static wordlist(): LangEn; -} -//# sourceMappingURL=lang-en.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/lang-en.d.ts.map b/lib.esm/wordlists/lang-en.d.ts.map deleted file mode 100644 index c43c99b64..000000000 --- a/lib.esm/wordlists/lang-en.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-en.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-en.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;OAOG;;IAKH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/lib.esm/wordlists/lang-en.js b/lib.esm/wordlists/lang-en.js deleted file mode 100644 index 50fb33fa1..000000000 --- a/lib.esm/wordlists/lang-en.js +++ /dev/null @@ -1,33 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -const words = "0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOnomy0GeItUca>1F%t0G1GhtTh 2BowD E@r-EgSe0B?kBodyBra)Er+Ot]PloyPow Pty0Ab!A@DD![D%'EmyErgyF%)Ga+G(eH<)JoyLi,OughR-hRollSu*T Ti*TryVelope1Isode0U$Uip0AA'OdeOs]R%Upt0CapeSayS&)Ta>0Ern$H-s1Id&)IlOkeOl=1A@Amp!Ce[Ch<+C.eCludeCu'Ecu>Erci'Hau,Hib.I!I,ItOt-PM&'Mu}Pa@Po'Pro=Pul'0ChCludeComeC*a'DexD-a>Do%Du,ryFN Noc|PutQuirySSue0Em1Ory:CketGu?RZz3AlousAns~yWel9BInKeUr}yY5D+I)MpNg!Ni%Nk/:Ng?oo3EnEp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ueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO"; -const checksum = "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"; -let wordlist = null; -/** - * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export class LangEn extends WordlistOwl { - /** - * Creates a new instance of the English language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langEn]] should suffice. - * - * @_ignore: - */ - constructor() { - super("en", words, checksum); - } - /** - * Returns a singleton instance of a ``LangEn``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist == null) { - wordlist = new LangEn(); - } - return wordlist; - } -} -//# sourceMappingURL=lang-en.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/lang-en.js.map b/lib.esm/wordlists/lang-en.js.map deleted file mode 100644 index 196a6442d..000000000 --- a/lib.esm/wordlists/lang-en.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-en.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-en.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,KAAK,GACT,u3LAAu3L,CAAC;AAC13L,MAAM,QAAQ,GACZ,oEAAoE,CAAC;AAEvE,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;;;;;OAOG;IACH;QACE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACb,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SACzB;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/wordlists/lang-es.d.ts b/lib.esm/wordlists/lang-es.d.ts deleted file mode 100644 index 7e51683e7..000000000 --- a/lib.esm/wordlists/lang-es.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { WordlistOwlA } from "./wordlist-owla.js"; -/** - * The [[link-bip39-es]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangEs extends WordlistOwlA { - /** - * Creates a new instance of the Spanish language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langEs]] should suffice. - * - * @_ignore: - */ - constructor(); - /** - * Returns a singleton instance of a ``LangEs``, creating it - * if this is the first time being called. - */ - static wordlist(): LangEs; -} -//# sourceMappingURL=lang-es.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/lang-es.d.ts.map b/lib.esm/wordlists/lang-es.d.ts.map deleted file mode 100644 index 1f4b7bb34..000000000 --- a/lib.esm/wordlists/lang-es.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-es.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-es.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAWlD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,YAAY;IACtC;;;;;;;OAOG;;IAKH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/lib.esm/wordlists/lang-es.js b/lib.esm/wordlists/lang-es.js deleted file mode 100644 index 7e2116d3f..000000000 --- a/lib.esm/wordlists/lang-es.js +++ /dev/null @@ -1,34 +0,0 @@ -import { WordlistOwlA } from "./wordlist-owla.js"; -const words = "0arertoiotadonoaRteirroenaNonaLsolocoiliaralaorrenadaChoN$n0A>Dom,EjaI!#Oga&O'Or#RazoR*Ue=U<0Ab Adem@CeLe%OmoRa!RozUn0DazD$GeLaM,#S,)T^0AlAnceA+EEl]`E`EstruzI.I<2ErU{U'0Af[nArO)Uc Uf_Ul:BaB^|eH@IleJ Lanz/c.LdeMbuN>Nd-oRb(>RnizR+Scu]S#nSu[Tal]T!@T*Tu%UlZ 3BeBid/=S SoSt@3|oEnNgo2An>OqueUsa2ABi`BoCaCi`DaDegaIn//!oLsaMb-{dNi#N}saiRdeRr SqueTeTinVe{Zal2AvoAzoEchaEveIl=In>IsaOcaOmaOnceO)UjaUs>U#2CeoCleE'EyFan{F.HoIt_L#Rbuj(l(+Sc TacaZ.:Bal=BezaBi`B[CaoDav!D,aErFeI{ImanJaJ.LLam Lc$L&Li{dLleLm/^LvoMaMb$Mel=Mi'Mp}c!Nd?Nel-gu+Nic-#N-.ObaOsPazPi%nPo)Pt Puch((b.RcelRe%Rg(i'RneRpe%R+R%SaS>S!oSpaS#rT^ceT_U{lUsaZo3Bol]D!D+Ld/eb_LoAmpuAnc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OfeoOmpaOn>OpaO)OzoU>Ue'Ufa2B!@BoEr#MbaM^NelNic(bin(ismoR'T^:0Ic 9C!a0B[l0I{dIrIv!; - join(words: Array): string; - /** - * Returns a singleton instance of a ``LangJa``, creating it - * if this is the first time being called. - */ - static wordlist(): LangJa; -} -//# sourceMappingURL=lang-ja.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/lang-ja.d.ts.map b/lib.esm/wordlists/lang-ja.d.ts.map deleted file mode 100644 index f4acbfdf3..000000000 --- a/lib.esm/wordlists/lang-ja.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-ja.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ja.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA6IzC;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAClC;;;;;;;OAOG;;IAKH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAW9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAKpC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIlC;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/lib.esm/wordlists/lang-ja.js b/lib.esm/wordlists/lang-ja.js deleted file mode 100644 index 6dc7001f6..000000000 --- a/lib.esm/wordlists/lang-ja.js +++ /dev/null @@ -1,157 +0,0 @@ -import { id } from "../hash/index.js"; -import { hexlify, assertArgument, toUtf8Bytes, toUtf8String, } from "../utils/index.js"; -import { Wordlist } from "./wordlist.js"; -const data = [ - // 4-kana words - "AQRASRAGBAGUAIRAHBAghAURAdBAdcAnoAMEAFBAFCBKFBQRBSFBCXBCDBCHBGFBEQBpBBpQBIkBHNBeOBgFBVCBhB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UJDJIBgQDIUJTRDJFEqDSJQSJFSJQIJFSOPeZtSJFZJHCJXQfXCTDEqFGJBSJFGJBOfXGJBcqXGJHNJDGJRLiJEJfXEqEJFEJPEFpBEJYJBZJFYBwXUJYiJMEBYJZJyTYTONJXpQMFXFpeGIDdpJFstXpJFcPDLBVSJRLHQJqXLJFZJFIJBNJDIJBUqXIBkFDJIJEJPTIYJGWRIJeQPDIJeEfHIJFsJXOqGDSFHXEJqXgJCsJCgGQJqXgdQYJEgFMFNBgJFcqDVJwXUJVJFZJchIgJCCxOEJqXxOwXUJyDJBVRuscisciJBiJBieUtqXiJFDJkiFsJXQUGEZJcUJFsJXZtXIrXZDZJDrZJFNJDZJFstXvJFQqXvJFCJEsJXQJqkhkNGBbDJdTRbYJMEBlDwXUJMEFiJFcfXNJDRcNJWMTBLJXC", - // 8-kana words - "BraFUtHBFSJFdbNBLJXVJQoYJNEBSJBEJfHSJHwXUJCJdAZJMGjaFVJXEJPNJBlEJfFiJFpFbFEJqIJBVJCrIBdHiJhOPFChvJVJZJNJWxGFNIFLueIBQJqUHEJfUFstOZJDrlXEASJRlXVJXSFwVJNJWD", - // 9-kana words - "QJEJNNJDQJEJIBSFQJEJxegBQJEJfHEPSJBmXEJFSJCDEJqXLXNJFQqXIcQsFNJFIFEJqXUJgFsJXIJBUJEJfHNFvJxEqXNJnXUJFQqD", - // 10-kana words - "IJBEJqXZJ", -]; -// Maps each character into its kana value (the index) -const mapping = "~~AzB~X~a~KN~Q~D~S~C~G~E~Y~p~L~I~O~eH~g~V~hxyumi~~U~~Z~~v~~s~~dkoblPjfnqwMcRTr~W~~~F~~~~~Jt"; -let _wordlist = null; -function hex(word) { - return hexlify(toUtf8Bytes(word)); -} -const KiYoKu = "0xe3818de38284e3818f"; -const KyoKu = "0xe3818de38283e3818f"; -function toString(data) { - return toUtf8String(new Uint8Array(data)); -} -function loadWords() { - if (_wordlist !== null) { - return _wordlist; - } - const wordlist = []; - // Transforms for normalizing (sort is a not quite UTF-8) - const transform = {}; - // Delete the diacritic marks - transform[toString([227, 130, 154])] = false; - transform[toString([227, 130, 153])] = false; - // Some simple transforms that sort out most of the order - transform[toString([227, 130, 133])] = toString([227, 130, 134]); - transform[toString([227, 129, 163])] = toString([227, 129, 164]); - transform[toString([227, 130, 131])] = toString([227, 130, 132]); - transform[toString([227, 130, 135])] = toString([227, 130, 136]); - // Normalize words using the transform - function normalize(word) { - let result = ""; - for (let i = 0; i < word.length; i++) { - let kana = word[i]; - const target = transform[kana]; - if (target === false) { - continue; - } - if (target) { - kana = target; - } - result += kana; - } - return result; - } - // Sort how the Japanese list is sorted - function sortJapanese(a, b) { - a = normalize(a); - b = normalize(b); - if (a < b) { - return -1; - } - if (a > b) { - return 1; - } - return 0; - } - // Load all the words - for (let length = 3; length <= 9; length++) { - const d = data[length - 3]; - for (let offset = 0; offset < d.length; offset += length) { - const word = []; - for (let i = 0; i < length; i++) { - const k = mapping.indexOf(d[offset + i]); - word.push(227); - word.push(k & 0x40 ? 130 : 129); - word.push((k & 0x3f) + 128); - } - wordlist.push(toString(word)); - } - } - wordlist.sort(sortJapanese); - // For some reason kyoku and kiyoku are flipped in node (!!). - // The order SHOULD be: - // - kyoku - // - kiyoku - // This should ignore "if", but that doesn't work here?? - /* c8 ignore start */ - if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) { - const tmp = wordlist[442]; - wordlist[442] = wordlist[443]; - wordlist[443] = tmp; - } - /* c8 ignore stop */ - // Verify the computed list matches the official list - /* istanbul ignore if */ - const checksum = id(wordlist.join("\n") + "\n"); - /* c8 ignore start */ - if (checksum !== - "0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600") { - throw new Error("BIP39 Wordlist for ja (Japanese) FAILED"); - } - /* c8 ignore stop */ - _wordlist = wordlist; - return wordlist; -} -let wordlist = null; -/** - * The [[link-bip39-ja]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export class LangJa extends Wordlist { - /** - * Creates a new instance of the Japanese language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langJa]] should suffice. - * - * @_ignore: - */ - constructor() { - super("ja"); - } - getWord(index) { - const words = loadWords(); - assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); - return words[index]; - } - getWordIndex(word) { - return loadWords().indexOf(word); - } - split(phrase) { - //logger.assertNormalize(); - return phrase.split(/(?:\u3000| )+/g); - } - join(words) { - return words.join("\u3000"); - } - /** - * Returns a singleton instance of a ``LangJa``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist == null) { - wordlist = new LangJa(); - } - return wordlist; - } -} -//# sourceMappingURL=lang-ja.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/lang-ja.js.map b/lib.esm/wordlists/lang-ja.js.map deleted file mode 100644 index 5e722af6f..000000000 --- a/lib.esm/wordlists/lang-ja.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-ja.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ja.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EACL,OAAO,EACP,cAAc,EACd,WAAW,EACX,YAAY,GACb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,IAAI,GAAG;IACX,eAAe;IACf,orEAAorE;IAEprE,eAAe;IACf,ssGAAssG;IAEtsG,eAAe;IACf,4uDAA4uD;IAE5uD,eAAe;IACf,olBAAolB;IAEplB,eAAe;IACf,4JAA4J;IAE5J,eAAe;IACf,0GAA0G;IAE1G,gBAAgB;IAChB,WAAW;CACZ,CAAC;AAEF,sDAAsD;AACtD,MAAM,OAAO,GACX,6FAA6F,CAAC;AAEhG,IAAI,SAAS,GAAyB,IAAI,CAAC;AAE3C,SAAS,GAAG,CAAC,IAAY;IACvB,OAAO,OAAO,CAAC,WAAW,CAAC,IAAI,CAA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;;GAIG;AACH,MAAM,OAAO,MAAO,SAAQ,QAAQ;IAClC;;;;;;;OAOG;IACH;QACE,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAED,OAAO,CAAC,KAAa;QACnB,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;QAC1B,cAAc,CACZ,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAClC,uBAAuB,KAAK,EAAE,EAC9B,OAAO,EACP,KAAK,CACN,CAAC;QACF,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAED,YAAY,CAAC,IAAY;QACvB,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,MAAc;QAClB,2BAA2B;QAC3B,OAAO,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,KAAoB;QACvB,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACb,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SACzB;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/wordlists/lang-ko.d.ts b/lib.esm/wordlists/lang-ko.d.ts deleted file mode 100644 index 4329e0556..000000000 --- a/lib.esm/wordlists/lang-ko.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Wordlist } from "./wordlist.js"; -/** - * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangKo extends Wordlist { - /** - * Creates a new instance of the Korean language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langKo]] should suffice. - * - * @_ignore: - */ - constructor(); - getWord(index: number): string; - getWordIndex(word: string): number; - /** - * Returns a singleton instance of a ``LangKo``, creating it - * if this is the first time being called. - */ - static wordlist(): LangKo; -} -//# sourceMappingURL=lang-ko.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/lang-ko.d.ts.map b/lib.esm/wordlists/lang-ko.d.ts.map deleted file mode 100644 index 8b8d34088..000000000 --- a/lib.esm/wordlists/lang-ko.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-ko.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ko.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAqEzC;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAClC;;;;;;;OAOG;;IAKH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAW9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/lib.esm/wordlists/lang-ko.js b/lib.esm/wordlists/lang-ko.js deleted file mode 100644 index eea75d97c..000000000 --- a/lib.esm/wordlists/lang-ko.js +++ /dev/null @@ -1,90 +0,0 @@ -import { id } from "../hash/index.js"; -import { assertArgument, toUtf8String } from "../utils/index.js"; -import { Wordlist } from "./wordlist.js"; -const data = [ - "OYAa", - "ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMbAX3JTAX3QbAYLn3AZLgvAZrSUAZvAcAZ8AaAZ8AbAZ8AnAZ8HnAZ8LgAZ8MYAZ8MgAZ8OnAaAboAaDTrAaFTrAaJTrAaJboAaLVoAaMXvAaOl8AaSeoAbAUoAbAg8AbAl4AbGn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LnMnSgOg6ATFg", - "HUDlGnrQXrJTrHgLnrAcJYMb8DULc8LTvFgGnCk3Mg8JbAnLX4QYvFYHnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb", - "AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl", -]; -const codes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; -function getHangul(code) { - if (code >= 40) { - code = code + 168 - 40; - } - else if (code >= 19) { - code = code + 97 - 19; - } - return toUtf8String(new Uint8Array([225, (code >> 6) + 132, (code & 0x3f) + 128])); -} -let _wordlist = null; -function loadWords() { - if (_wordlist != null) { - return _wordlist; - } - const wordlist = []; - data.forEach((data, length) => { - length += 4; - for (let i = 0; i < data.length; i += length) { - let word = ""; - for (let j = 0; j < length; j++) { - word += getHangul(codes.indexOf(data[i + j])); - } - wordlist.push(word); - } - }); - wordlist.sort(); - // Verify the computed list matches the official list - /* istanbul ignore if */ - const checksum = id(wordlist.join("\n") + "\n"); - /* c8 ignore start */ - if (checksum !== - "0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a") { - throw new Error("BIP39 Wordlist for ko (Korean) FAILED"); - } - /* c8 ignore stop */ - _wordlist = wordlist; - return wordlist; -} -let wordlist = null; -/** - * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export class LangKo extends Wordlist { - /** - * Creates a new instance of the Korean language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langKo]] should suffice. - * - * @_ignore: - */ - constructor() { - super("ko"); - } - getWord(index) { - const words = loadWords(); - assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); - return words[index]; - } - getWordIndex(word) { - return loadWords().indexOf(word); - } - /** - * Returns a singleton instance of a ``LangKo``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist == null) { - wordlist = new LangKo(); - } - return wordlist; - } -} -//# sourceMappingURL=lang-ko.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/lang-ko.js.map b/lib.esm/wordlists/lang-ko.js.map deleted file mode 100644 index a756d46ea..000000000 --- a/lib.esm/wordlists/lang-ko.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-ko.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ko.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,IAAI,GAAG;IACX,MAAM;IACN,y5JAAy5J;IACz5J,8lIAA8lI;IAC9lI,i8BAAi8B;IACj8B,koCAAkoC;IACloC,yaAAya;IACza,gHAAgH;IAChH,+EAA+E;CAChF,CAAC;AAEF,MAAM,KAAK,GACT,wEAAwE,CAAC;AAE3E,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,IAAI,IAAI,EAAE,EAAE;QACd,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;KACxB;SAAM,IAAI,IAAI,IAAI,EAAE,EAAE;QACrB,IAAI,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC;KACvB;IAED,OAAO,YAAY,CACjB,IAAI,UAAU,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAC9D,CAAC;AACJ,CAAC;AAED,IAAI,SAAS,GAAyB,IAAI,CAAC;AAE3C,SAAS,SAAS;IAChB,IAAI,SAAS,IAAI,IAAI,EAAE;QACrB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,QAAQ,GAAkB,E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K,CACN,CAAC;QACF,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAED,YAAY,CAAC,IAAY;QACvB,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACb,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SACzB;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/wordlists/lang-pt.d.ts b/lib.esm/wordlists/lang-pt.d.ts deleted file mode 100644 index f218013c6..000000000 --- a/lib.esm/wordlists/lang-pt.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -/** - * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangPt extends WordlistOwl { - /** - * Creates a new instance of the Portuguese language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langPt]] should suffice. - * - * @_ignore: - */ - constructor(); - /** - * Returns a singleton instance of a ``LangPt``, creating it - * if this is the first time being called. - */ - static wordlist(): LangPt; -} -//# sourceMappingURL=lang-pt.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/lang-pt.d.ts.map b/lib.esm/wordlists/lang-pt.d.ts.map deleted file mode 100644 index c979f9c09..000000000 --- a/lib.esm/wordlists/lang-pt.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-pt.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-pt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;OAOG;;IAKH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/lib.esm/wordlists/lang-pt.js b/lib.esm/wordlists/lang-pt.js deleted file mode 100644 index 515515cef..000000000 --- a/lib.esm/wordlists/lang-pt.js +++ /dev/null @@ -1,33 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -const words = "0arad!ototealirertainrasoent hoandoaR#riareha!aroele'oronul0Aca%AixoAl A%rDuz'El]Er$IsmoO$ Rum S-&T(i&TigoVo[=0F&.Il#P' S?S* So&/Sun$Tr&0Ac#Adu+Al/A[f E End(Er_EuIng'Ir?IvoOl{oRac Revi=RizU&Um0Di$rM-.R>o+TismoT|@Tu 0Ali An%Ar@Ent&Es,I?Is Ul,1Ila1Ar E=Ei%Ulejo:B BosaC&]uCh `C@GagemI+c>~/Se#S)n%Ta)Te=rTidaTomTuc Unil]3B(IjoIr^IsebolLd!eLezaLgaLisc Ndi$Ng&aNz(RimbauRl*d>_Sou_XigaZ(_3CoCu=En&Foc&Furc G|naLhe%Mest[Mo$rOlog@OmboOsf(aPol Rr-$Scoi$Sne$SpoSsex$TolaZ _2Ind#OcoOque 2A$BagemC#CejoChec]Ico.L^LetimL]LoMb{oNdeNecoNi)Rb~h>d>e&R+c]V*oXe?2AncoAsaAvezaEuIgaIl/Inc OaOchu+Onze O$Uxo2C]DismoF LeRacoScaS$Z*a:Bimb Rn{oRpe%R['>)zRv&/SacoScaSeb[S%loS~oT a)Tiv UleUs?U%l V&oV(na3BolaDil]G}]Lebr L~ Nou+N,N%ioRc Rr#R%'oRvejaTimV^2Aco)Al{aAm#Ap^ArmeAticeAveEfeEg^E'oEqueIco%If[In`oOc&/Ov(UmboU.Uva0CatrizCl}eD!eD['aEn%Gcui$Rurg@T 2A[zaE_Ic OneUbe2A=Ag'Ba@B($rBr C^El/Ent_E,Gum`oIb'IfaIo%L L{aLh(Lid'Lme@L}oLunaM<=Mb* M-.MitivaMov(MplexoMumNc]N=rNec.Nfu,Ng` Nhec(Njug Nsum'Nt+$Nvi%Op( P{oPi?PoQue%lRagemRdi&Rne)R}h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p[s>[&Rt'Sp'oS%n$:B`aBle%Bu^C/G `aLh(LoLvezMdioRef>j>+xaTuagemUr*oXativoXis)3Atr&C(Ci=Cl#Dio,IaIm Lef}eLh#Mp(oN-%N,rN.Rm&RnoRr-oSeSou+St#ToXtu+Xugo3A+G`aJoloMbr MidezNgi=N%'oRagemT~ 5Al]C]L( LiceM^Mil/N`Ntu+Pe%R>ci=RneioRqueRr!>$S.UcaUp{aX*a2Ab&/Acej Adu$rAfeg Aje$AmaAnc ApoAs{oAt?Av E*oEm(Epid EvoIagemIboIcicloId-%Ilog@Ind!eIploItur Iunf&Oc Ombe)OvaUnfoUque2B~ CquesaT` T|i&:7V 3Bigo0HaId!eIf|me3Olog@SoTigaUbu0A=InaUfru':C*aDi G o,I=,LaL-%Lid!eLo[sN)gemQu{oRe)Rr(Sc~ Sil]S,u+Z Zio3A=D Ge.Ic~ L{oLhiceLu=Nce=rNdav&N( Nt[Rb&Rd!eRe?Rg}h>m`/RnizRs R%n%SpaSti=T|i&3Adu$AgemAj Atu+Br?D{aDr @ElaGaG-%Gi G| L ejoNcoNhe)NilOle)R!>tudeSi.S$Tr&V{oZ*/5A=rArG&L<%LeibolL)gemLumo,Nt!e5L$Vuz`a::D[zRope3QueRe.Rife3Ng ::Ng#Rp 3BuL?9Mb Olog@5Mbi="; -const checksum = "0x2219000926df7b50d8aa0a3d495826b988287df4657fbd100e6fe596c8f737ac"; -let wordlist = null; -/** - * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export class LangPt extends WordlistOwl { - /** - * Creates a new instance of the Portuguese language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langPt]] should suffice. - * - * @_ignore: - */ - constructor() { - super("pt", words, checksum); - } - /** - * Returns a singleton instance of a ``LangPt``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist == null) { - wordlist = new LangPt(); - } - return wordlist; - } -} -//# sourceMappingURL=lang-pt.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/lang-pt.js.map b/lib.esm/wordlists/lang-pt.js.map deleted file mode 100644 index 3c5b6e42b..000000000 --- a/lib.esm/wordlists/lang-pt.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-pt.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-pt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,KAAK,GACT,s0OAAs0O,CAAC;AACz0O,MAAM,QAAQ,GACZ,oEAAoE,CAAC;AAEvE,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;;;;;OAOG;IACH;QACE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACb,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SACzB;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/wordlists/lang-zh.d.ts b/lib.esm/wordlists/lang-zh.d.ts deleted file mode 100644 index 5d0c14c7c..000000000 --- a/lib.esm/wordlists/lang-zh.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Wordlist } from "./wordlist.js"; -/** - * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for - * [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangZh extends Wordlist { - /** - * Creates a new instance of the Chinese language Wordlist for - * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified - * or traditional, respectively. - * - * This should be unnecessary most of the time as the exported - * [[langZhCn]] and [[langZhTw]] should suffice. - * - * @_ignore: - */ - constructor(dialect: string); - getWord(index: number): string; - getWordIndex(word: string): number; - split(phrase: string): Array; - /** - * Returns a singleton instance of a ``LangZh`` for %%dialect%%, - * creating it if this is the first time being called. - * - * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or - * traditional, respectively. - */ - static wordlist(dialect: string): LangZh; -} -//# sourceMappingURL=lang-zh.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/lang-zh.d.ts.map b/lib.esm/wordlists/lang-zh.d.ts.map deleted file mode 100644 index 8dd1943aa..000000000 --- a/lib.esm/wordlists/lang-zh.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-zh.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-zh.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA+DzC;;;;;GAKG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAClC;;;;;;;;;OASG;gBACS,OAAO,EAAE,MAAM;IAI3B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAW9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAKpC;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAMzC"} \ No newline at end of file diff --git a/lib.esm/wordlists/lang-zh.js b/lib.esm/wordlists/lang-zh.js deleted file mode 100644 index efc68db8b..000000000 --- a/lib.esm/wordlists/lang-zh.js +++ /dev/null @@ -1,95 +0,0 @@ -import { id } from "../hash/index.js"; -import { assertArgument, toUtf8String } from "../utils/index.js"; -import { Wordlist } from "./wordlist.js"; -const data = "}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN> 2), - 128 + codes.indexOf(data[i * 3 + 1]), - 128 + codes.indexOf(data[i * 3 + 2]), - ]; - if (locale === "zh_tw") { - const common = s % 4; - for (let i = common; i < 3; i++) { - bytes[i] = - codes.indexOf(deltaData[deltaOffset++]) + (i == 0 ? 228 : 128); - } - } - wordlist.push(toUtf8String(new Uint8Array(bytes))); - } - // Verify the computed list matches the official list - const checksum = id(wordlist.join("\n") + "\n"); - /* c8 ignore start */ - if (checksum !== Checks[locale]) { - throw new Error(`BIP39 Wordlist for ${locale} (Chinese) FAILED`); - } - /* c8 ignore stop */ - _wordlist[locale] = wordlist; - return wordlist; -} -const wordlists = {}; -/** - * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for - * [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export class LangZh extends Wordlist { - /** - * Creates a new instance of the Chinese language Wordlist for - * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified - * or traditional, respectively. - * - * This should be unnecessary most of the time as the exported - * [[langZhCn]] and [[langZhTw]] should suffice. - * - * @_ignore: - */ - constructor(dialect) { - super("zh_" + dialect); - } - getWord(index) { - const words = loadWords(this.locale); - assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); - return words[index]; - } - getWordIndex(word) { - return loadWords(this.locale).indexOf(word); - } - split(phrase) { - phrase = phrase.replace(/(?:\u3000| )+/g, ""); - return phrase.split(""); - } - /** - * Returns a singleton instance of a ``LangZh`` for %%dialect%%, - * creating it if this is the first time being called. - * - * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or - * traditional, respectively. - */ - static wordlist(dialect) { - if (wordlists[dialect] == null) { - wordlists[dialect] = new LangZh(dialect); - } - return wordlists[dialect]; - } -} -//# sourceMappingURL=lang-zh.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/lang-zh.js.map b/lib.esm/wordlists/lang-zh.js.map deleted file mode 100644 index 4d8be371e..000000000 --- a/lib.esm/wordlists/lang-zh.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-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ACF,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAED,YAAY,CAAC,IAAY;QACvB,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,MAAc;QAClB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;QAC9C,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAe;QAC7B,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE;YAC9B,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;SAC1C;QACD,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/wordlists/wordlist-owl.d.ts b/lib.esm/wordlists/wordlist-owl.d.ts deleted file mode 100644 index 3a831f7cf..000000000 --- a/lib.esm/wordlists/wordlist-owl.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Wordlist } from "./wordlist.js"; -/** - * An OWL format Wordlist is an encoding method that exploits - * the general locality of alphabetically sorted words to - * achieve a simple but effective means of compression. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on ASCII-7 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ -export declare class WordlistOwl extends Wordlist { - #private; - /** - * Creates a new Wordlist for %%locale%% using the OWL %%data%% - * and validated against the %%checksum%%. - */ - constructor(locale: string, data: string, checksum: string); - get _data(): string; - _decodeWords(): Array; - getWord(index: number): string; - getWordIndex(word: string): number; -} -//# sourceMappingURL=wordlist-owl.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/wordlist-owl.d.ts.map b/lib.esm/wordlists/wordlist-owl.d.ts.map deleted file mode 100644 index c0dcec9e9..000000000 --- a/lib.esm/wordlists/wordlist-owl.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist-owl.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owl.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,qBAAa,WAAY,SAAQ,QAAQ;;IAIvC;;;OAGG;gBACS,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAO1D,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC;IAsB7B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAW9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGnC"} \ No newline at end of file diff --git a/lib.esm/wordlists/wordlist-owl.js b/lib.esm/wordlists/wordlist-owl.js deleted file mode 100644 index 3444ca545..000000000 --- a/lib.esm/wordlists/wordlist-owl.js +++ /dev/null @@ -1,62 +0,0 @@ -// Use the encode-latin.js script to create the necessary -// data files to be consumed by this class -import { id } from "../hash/index.js"; -import { assertArgument } from "../utils/index.js"; -import { decodeOwl } from "./decode-owl.js"; -import { Wordlist } from "./wordlist.js"; -/** - * An OWL format Wordlist is an encoding method that exploits - * the general locality of alphabetically sorted words to - * achieve a simple but effective means of compression. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on ASCII-7 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ -export class WordlistOwl extends Wordlist { - #data; - #checksum; - /** - * Creates a new Wordlist for %%locale%% using the OWL %%data%% - * and validated against the %%checksum%%. - */ - constructor(locale, data, checksum) { - super(locale); - this.#data = data; - this.#checksum = checksum; - this.#words = null; - } - get _data() { - return this.#data; - } - _decodeWords() { - return decodeOwl(this.#data); - } - #words; - #loadWords() { - if (this.#words == null) { - const words = this._decodeWords(); - // Verify the computed list matches the official list - const checksum = id(words.join("\n") + "\n", true); - /* c8 ignore start */ - if (checksum !== this.#checksum) { - throw new Error(`BIP39 Wordlist for ${this.locale} FffffAILED`); - } - /* c8 ignore stop */ - this.#words = words; - } - return this.#words; - } - getWord(index) { - const words = this.#loadWords(); - assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); - return words[index]; - } - getWordIndex(word) { - return this.#loadWords().indexOf(word); - } -} -//# sourceMappingURL=wordlist-owl.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/wordlist-owl.js.map b/lib.esm/wordlists/wordlist-owl.js.map deleted file mode 100644 index 34f540c0f..000000000 --- a/lib.esm/wordlists/wordlist-owl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist-owl.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owl.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,0CAA0C;AAE1C,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,WAAY,SAAQ,QAAQ;IACvC,KAAK,CAAS;IACd,SAAS,CAAS;IAElB;;;OAGG;IACH,YAAY,MAAc,EAAE,IAAY,EAAE,QAAgB;QACxD,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,YAAY;QACV,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,CAAuB;IAC7B,UAAU;QACR,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE;YACvB,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;YAElC,qDAAqD;YACrD,MAAM,QAAQ,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC;YACnD,qBAAqB;YACrB,IAAI,QAAQ,KAAK,IAAI,CAAC,SAAS,EAAE;gBAC/B,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,CAAC,MAAM,aAAa,CAAC,CAAC;aACjE;YACD,oBAAoB;YAEpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;SACrB;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,OAAO,CAAC,KAAa;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAChC,cAAc,CACZ,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAClC,uBAAuB,KAAK,EAAE,EAC9B,OAAO,EACP,KAAK,CACN,CAAC;QACF,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAED,YAAY,CAAC,IAAY;QACvB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/wordlists/wordlist-owla.d.ts b/lib.esm/wordlists/wordlist-owla.d.ts deleted file mode 100644 index d86086b6e..000000000 --- a/lib.esm/wordlists/wordlist-owla.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -/** - * An OWL-A format Wordlist extends the OWL format to add an - * overlay onto an OWL format Wordlist to support diacritic - * marks. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on latin-1 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ -export declare class WordlistOwlA extends WordlistOwl { - #private; - constructor(locale: string, data: string, accent: string, checksum: string); - get _accent(): string; - _decodeWords(): Array; -} -//# sourceMappingURL=wordlist-owla.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/wordlist-owla.d.ts.map b/lib.esm/wordlists/wordlist-owla.d.ts.map deleted file mode 100644 index a02c1dff5..000000000 --- a/lib.esm/wordlists/wordlist-owla.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist-owla.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owla.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;;;;;;;;;GAWG;AACH,qBAAa,YAAa,SAAQ,WAAW;;gBAG/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAK1E,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC;CAG9B"} \ No newline at end of file diff --git a/lib.esm/wordlists/wordlist-owla.js b/lib.esm/wordlists/wordlist-owla.js deleted file mode 100644 index 89249dea2..000000000 --- a/lib.esm/wordlists/wordlist-owla.js +++ /dev/null @@ -1,28 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -import { decodeOwlA } from "./decode-owla.js"; -/** - * An OWL-A format Wordlist extends the OWL format to add an - * overlay onto an OWL format Wordlist to support diacritic - * marks. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on latin-1 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ -export class WordlistOwlA extends WordlistOwl { - #accent; - constructor(locale, data, accent, checksum) { - super(locale, data, checksum); - this.#accent = accent; - } - get _accent() { - return this.#accent; - } - _decodeWords() { - return decodeOwlA(this._data, this._accent); - } -} -//# sourceMappingURL=wordlist-owla.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/wordlist-owla.js.map b/lib.esm/wordlists/wordlist-owla.js.map deleted file mode 100644 index fc0603c94..000000000 --- a/lib.esm/wordlists/wordlist-owla.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist-owla.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owla.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C,OAAO,CAAS;IAEhB,YAAY,MAAc,EAAE,IAAY,EAAE,MAAc,EAAE,QAAgB;QACxE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,YAAY;QACV,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/wordlists/wordlist.d.ts b/lib.esm/wordlists/wordlist.d.ts deleted file mode 100644 index 081decc72..000000000 --- a/lib.esm/wordlists/wordlist.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * A Wordlist represents a collection of language-specific - * words used to encode and devoce [[link-bip-39]] encoded data - * by mapping words to 11-bit values and vice versa. - */ -export declare abstract class Wordlist { - locale: string; - /** - * Creates a new Wordlist instance. - * - * Sub-classes MUST call this if they provide their own constructor, - * passing in the locale string of the language. - * - * Generally there is no need to create instances of a Wordlist, - * since each language-specific Wordlist creates an instance and - * there is no state kept internally, so they are safe to share. - */ - constructor(locale: string); - /** - * Sub-classes may override this to provide a language-specific - * method for spliting %%phrase%% into individual words. - * - * By default, %%phrase%% is split using any sequences of - * white-space as defined by regular expressions (i.e. ``/\s+/``). - */ - split(phrase: string): Array; - /** - * Sub-classes may override this to provider a language-specific - * method for joining %%words%% into a phrase. - * - * By default, %%words%% are joined by a single space. - */ - join(words: Array): string; - /** - * Maps an 11-bit value into its coresponding word in the list. - * - * Sub-classes MUST override this. - */ - abstract getWord(index: number): string; - /** - * Maps a word to its corresponding 11-bit value. - * - * Sub-classes MUST override this. - */ - abstract getWordIndex(word: string): number; - static check(wordlist: Wordlist): string; -} -//# sourceMappingURL=wordlist.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/wordlist.d.ts.map b/lib.esm/wordlists/wordlist.d.ts.map deleted file mode 100644 index ef52e4565..000000000 --- a/lib.esm/wordlists/wordlist.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,8BAAsB,QAAQ;IAC5B,MAAM,EAAG,MAAM,CAAC;IAEhB;;;;;;;;;OASG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAIpC;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIlC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAEvC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAC3C,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM;CAYzC"} \ No newline at end of file diff --git a/lib.esm/wordlists/wordlist.js b/lib.esm/wordlists/wordlist.js deleted file mode 100644 index b7ae2c64f..000000000 --- a/lib.esm/wordlists/wordlist.js +++ /dev/null @@ -1,55 +0,0 @@ -import { id } from "../hash/id.js"; -import { defineProperties } from "../utils/index.js"; -/** - * A Wordlist represents a collection of language-specific - * words used to encode and devoce [[link-bip-39]] encoded data - * by mapping words to 11-bit values and vice versa. - */ -export class Wordlist { - locale; - /** - * Creates a new Wordlist instance. - * - * Sub-classes MUST call this if they provide their own constructor, - * passing in the locale string of the language. - * - * Generally there is no need to create instances of a Wordlist, - * since each language-specific Wordlist creates an instance and - * there is no state kept internally, so they are safe to share. - */ - constructor(locale) { - defineProperties(this, { locale }); - } - /** - * Sub-classes may override this to provide a language-specific - * method for spliting %%phrase%% into individual words. - * - * By default, %%phrase%% is split using any sequences of - * white-space as defined by regular expressions (i.e. ``/\s+/``). - */ - split(phrase) { - return phrase.toLowerCase().split(/\s+/g); - } - /** - * Sub-classes may override this to provider a language-specific - * method for joining %%words%% into a phrase. - * - * By default, %%words%% are joined by a single space. - */ - join(words) { - return words.join(" "); - } - static check(wordlist) { - const words = []; - for (let i = 0; i < 2048; i++) { - const word = wordlist.getWord(i); - /* istanbul ignore if */ - if (i !== wordlist.getWordIndex(word)) { - return "0x"; - } - words.push(word); - } - return id(words.join("\n") + "\n"); - } -} -//# sourceMappingURL=wordlist.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/wordlist.js.map b/lib.esm/wordlists/wordlist.js.map deleted file mode 100644 index 9c0fcaec2..000000000 --- a/lib.esm/wordlists/wordlist.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,MAAM,OAAgB,QAAQ;IAC5B,MAAM,CAAU;IAEhB;;;;;;;;;OASG;IACH,YAAY,MAAc;QACxB,gBAAgB,CAAW,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAc;QAClB,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,KAAoB;QACvB,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAeD,MAAM,CAAC,KAAK,CAAC,QAAkB;QAC7B,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;YAC7B,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACjC,wBAAwB;YACxB,IAAI,CAAC,KAAK,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;gBACrC,OAAO,IAAI,CAAC;aACb;YACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAClB;QACD,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACrC,CAAC;CACF"} \ No newline at end of file diff --git a/lib.esm/wordlists/wordlists-browser.d.ts b/lib.esm/wordlists/wordlists-browser.d.ts deleted file mode 100644 index d0dbd19c9..000000000 --- a/lib.esm/wordlists/wordlists-browser.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Wordlist } from "./wordlist.js"; -export declare const wordlists: Record; -//# sourceMappingURL=wordlists-browser.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/wordlists-browser.d.ts.map b/lib.esm/wordlists/wordlists-browser.d.ts.map deleted file mode 100644 index 4cd923879..000000000 --- a/lib.esm/wordlists/wordlists-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists-browser.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAE9C,CAAC"} \ No newline at end of file diff --git a/lib.esm/wordlists/wordlists-browser.js b/lib.esm/wordlists/wordlists-browser.js deleted file mode 100644 index 9129fa29b..000000000 --- a/lib.esm/wordlists/wordlists-browser.js +++ /dev/null @@ -1,5 +0,0 @@ -import { LangEn } from "./lang-en.js"; -export const wordlists = { - en: LangEn.wordlist(), -}; -//# sourceMappingURL=wordlists-browser.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/wordlists-browser.js.map b/lib.esm/wordlists/wordlists-browser.js.map deleted file mode 100644 index 997302999..000000000 --- a/lib.esm/wordlists/wordlists-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists-browser.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItC,MAAM,CAAC,MAAM,SAAS,GAA6B;IACjD,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;CACtB,CAAC"} \ No newline at end of file diff --git a/lib.esm/wordlists/wordlists-extra.d.ts b/lib.esm/wordlists/wordlists-extra.d.ts deleted file mode 100644 index 7e15a233f..000000000 --- a/lib.esm/wordlists/wordlists-extra.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export { LangCz } from "./lang-cz.js"; -export { LangEs } from "./lang-es.js"; -export { LangFr } from "./lang-fr.js"; -export { LangJa } from "./lang-ja.js"; -export { LangKo } from "./lang-ko.js"; -export { LangIt } from "./lang-it.js"; -export { LangPt } from "./lang-pt.js"; -export { LangZh } from "./lang-zh.js"; -//# sourceMappingURL=wordlists-extra.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/wordlists-extra.d.ts.map b/lib.esm/wordlists/wordlists-extra.d.ts.map deleted file mode 100644 index 66c6c92cd..000000000 --- a/lib.esm/wordlists/wordlists-extra.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists-extra.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-extra.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/lib.esm/wordlists/wordlists-extra.js b/lib.esm/wordlists/wordlists-extra.js deleted file mode 100644 index 47e509eb0..000000000 --- a/lib.esm/wordlists/wordlists-extra.js +++ /dev/null @@ -1,9 +0,0 @@ -export { LangCz } from "./lang-cz.js"; -export { LangEs } from "./lang-es.js"; -export { LangFr } from "./lang-fr.js"; -export { LangJa } from "./lang-ja.js"; -export { LangKo } from "./lang-ko.js"; -export { LangIt } from "./lang-it.js"; -export { LangPt } from "./lang-pt.js"; -export { LangZh } from "./lang-zh.js"; -//# sourceMappingURL=wordlists-extra.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/wordlists-extra.js.map b/lib.esm/wordlists/wordlists-extra.js.map deleted file mode 100644 index 61bd82063..000000000 --- a/lib.esm/wordlists/wordlists-extra.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists-extra.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-extra.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/lib.esm/wordlists/wordlists.d.ts b/lib.esm/wordlists/wordlists.d.ts deleted file mode 100644 index ab8b0308c..000000000 --- a/lib.esm/wordlists/wordlists.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { Wordlist } from "./wordlist.js"; -/** - * The available Wordlists by their - * [ISO 639-1 Language Code](link-wiki-iso639). - * - * (**i.e.** [cz](LangCz), [en](LangEn), [es](LangEs), [fr](LangFr), - * [ja](LangJa), [ko](LangKo), [it](LangIt), [pt](LangPt), - * [zh_cn](LangZh), [zh_tw](LangZh)) - * - * The dist files (in the ``/dist`` folder) have had all languages - * except English stripped out, which reduces the library size by - * about 80kb. If required, they are available by importing the - * included ``wordlists-extra.min.js`` file. - */ -export declare const wordlists: Record; -//# sourceMappingURL=wordlists.d.ts.map \ No newline at end of file diff --git a/lib.esm/wordlists/wordlists.d.ts.map b/lib.esm/wordlists/wordlists.d.ts.map deleted file mode 100644 index 15f92fcf6..000000000 --- a/lib.esm/wordlists/wordlists.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAW9C,CAAC"} \ No newline at end of file diff --git a/lib.esm/wordlists/wordlists.js b/lib.esm/wordlists/wordlists.js deleted file mode 100644 index 45fd2d71e..000000000 --- a/lib.esm/wordlists/wordlists.js +++ /dev/null @@ -1,35 +0,0 @@ -import { LangCz } from "./lang-cz.js"; -import { LangEn } from "./lang-en.js"; -import { LangEs } from "./lang-es.js"; -import { LangFr } from "./lang-fr.js"; -import { LangJa } from "./lang-ja.js"; -import { LangKo } from "./lang-ko.js"; -import { LangIt } from "./lang-it.js"; -import { LangPt } from "./lang-pt.js"; -import { LangZh } from "./lang-zh.js"; -/** - * The available Wordlists by their - * [ISO 639-1 Language Code](link-wiki-iso639). - * - * (**i.e.** [cz](LangCz), [en](LangEn), [es](LangEs), [fr](LangFr), - * [ja](LangJa), [ko](LangKo), [it](LangIt), [pt](LangPt), - * [zh_cn](LangZh), [zh_tw](LangZh)) - * - * The dist files (in the ``/dist`` folder) have had all languages - * except English stripped out, which reduces the library size by - * about 80kb. If required, they are available by importing the - * included ``wordlists-extra.min.js`` file. - */ -export const wordlists = { - cz: LangCz.wordlist(), - en: LangEn.wordlist(), - es: LangEs.wordlist(), - fr: LangFr.wordlist(), - it: LangIt.wordlist(), - pt: LangPt.wordlist(), - ja: LangJa.wordlist(), - ko: LangKo.wordlist(), - zh_cn: LangZh.wordlist("cn"), - zh_tw: LangZh.wordlist("tw"), -}; -//# sourceMappingURL=wordlists.js.map \ No newline at end of file diff --git a/lib.esm/wordlists/wordlists.js.map b/lib.esm/wordlists/wordlists.js.map deleted file mode 100644 index c3fa83e3f..000000000 --- a/lib.esm/wordlists/wordlists.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,SAAS,GAA6B;IACjD,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;CAC7B,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index 10b3ca86d..de76d9f52 100644 --- a/package.json +++ b/package.json @@ -1,128 +1,153 @@ { - "name": "corebc", - "version": "0.4.1", - "author": "CorePass", - "description": "A complete and compact CoreBC library, for Dapps, wallets and any other tools.", - "browser": { - "./lib.esm/crypto/crypto.js": "./lib.esm/crypto/crypto-browser.js", - "./lib.esm/providers/provider-ipcsocket.js": "./lib.esm/providers/provider-ipcsocket-browser.js", - "./lib.esm/providers/ws.js": "./lib.esm/providers/ws-browser.js", - "./lib.esm/utils/base64.js": "./lib.esm/utils/base64-browser.js", - "./lib.esm/utils/geturl.js": "./lib.esm/utils/geturl-browser.js", - "./lib.esm/crypto/ed448goldilock.js": "./lib.esm/crypto/ed448goldilock-browser.js", - "./src.ts/crypto/ed448goldilock.ts": "./src.ts/crypto/ed448goldilock-browser.ts", - "./lib.esm/wordlists/wordlists.js": "./lib.esm/wordlists/wordlists-browser.js" - }, - "dependencies": { - "@noble/hashes": "1.3.2", - "@noble/secp256k1": "2.0.0", - "@types/node": "20.6.4", - "aes-js": "3.1.2", - "bcrypto": "^5.4.0", - "bn.js": "^5.2.1", - "buffer": "^6.0.3", - "tslib": "2.6.2", - "utf8": "^3.0.0", - "ws": "8.14.2" - }, - "devDependencies": { - "@rollup/plugin-node-resolve": "15.2.3", - "@types/bn.js": "^5.1.2", - "@types/mocha": "10.0.2", - "@types/semver": "7.5.3", - "@types/utf8": "^3.0.1", - "c8": "8.0.1", - "mocha": "10.2.0", - "npm-run-all": "^4.1.5", - "prettier": "^3.0.3", - "rollup": "4.0.2", - "semver": "7.5.4", - "typescript": "5.2.2", - "uglify-js": "3.17.4" - }, - "engines": { - "node": ">=14.0.0" - }, - "exports": { - ".": { - "import": "./lib.esm/index.js", - "default": "./lib.commonjs/index.js" - }, - "./abi": { - "import": "./lib.esm/abi/index.js", - "default": "./lib.commonjs/abi/index.js" - }, - "./address": { - "import": "./lib.esm/address/index.js", - "default": "./lib.commonjs/address/index.js" - }, - "./constants": { - "import": "./lib.esm/constants/index.js", - "default": "./lib.commonjs/constants/index.js" - }, - "./contract": { - "import": "./lib.esm/contract/index.js", - "default": "./lib.commonjs/contract/index.js" - }, - "./crypto": { - "import": "./lib.esm/crypto/index.js", - "default": "./lib.commonjs/crypto/index.js" - }, - "./hash": { - "import": "./lib.esm/hash/index.js", - "default": "./lib.commonjs/hash/index.js" - }, - "./providers": { - "import": "./lib.esm/providers/index.js", - "default": "./lib.commonjs/providers/index.js" - }, - "./transaction": { - "import": "./lib.esm/transaction/index.js", - "default": "./lib.commonjs/transaction/index.js" - }, - "./utils": { - "import": "./lib.esm/utils/index.js", - "default": "./lib.commonjs/utils/index.js" - }, - "./wallet": { - "import": "./lib.esm/wallet/index.js", - "default": "./lib.commonjs/wallet/index.js" - }, - "./wordlists": { - "import": "./lib.esm/wordlists/index.js", - "default": "./lib.commonjs/wordlists/index.js" - } - }, - "license": "CORE", - "main": "./lib.commonjs/index.js", - "module": "./lib.esm/index.js", - "publishConfig": { - "access": "public", - "tag": "latest" - }, - "scripts": { - "_build-dist": "rollup -c && uglifyjs ./dist/corebc.js -o ./dist/corebc.min.js && uglifyjs ./dist/corebc.umd.js -o ./dist/corebc.umd.min.js && uglifyjs ./dist/wordlists-extra.js -o ./dist/wordlists-extra.min.js", - "_dist-stats": "gzip -k9f -S '.gz' ./dist/corebc.min.js && gzip -k9f -S '.gz' ./dist/corebc.umd.min.js && gzip -k9f -S '.gz' ./dist/wordlists-extra.min.js && du -hs ./dist/*.gz && echo '' && du -hs ./dist/*.js", - "auto-build": "npm run build -- -w", - "build": "tsc --project tsconfig.esm.json", - "build-all": "npm run build && npm run build-commonjs && npm run build-dist && npm run build-types", - "build-clean": "npm run clean && npm run build && node lib.esm/_admin/update-version.js && node lib.esm/_admin/update-changelog.js && npm run build-all && npm run _build-dist && npm run _dist-stats", - "build-commonjs": "tsc --project tsconfig.commonjs.json", - "build-dist": "npm run build && npm run _build-dist && npm run _dist-stats", - "build-types": "tsc --project tsconfig.types.json", - "clean": "rm -rf dist lib.esm lib.commonjs types && cp -r misc/basedirs/* .", - "clean-test": "npm run clean && npm run build && npm run test", - "format": "run-p format:*", - "format:prettier": "run-s \" lint:prettier --write \"", - "lint": "run-p lint:*", - "lint:prettier": "prettier \"src.ts/**/*.(md|json|yml|ts|tsx|html|css|js)\" --ignore-path .gitignore --check", - "stats": "echo 'Dependencies' && npm ls --all --omit=dev", - "test": "npm run test-esm", - "test-commonjs": "mocha ./lib.commonjs/_tests/test-*.js", - "test-coverage": "c8 -o output -r lcov -r text mocha --no-colo ./lib.esm/_tests/test-*.js | tee output/summary.txt", - "test-esm": "mocha ./lib.esm/_tests/test-*.js" - }, - "sideEffects": false, - "type": "module", - "types": "./types/index.d.ts" + "name": "corebc", + "version": "1.0.0", + "author": "CorePass", + "description": "A complete and compact CoreBC library, for Dapps, wallets and any other tools.", + "browser": { + "./lib.esm/crypto/crypto.js": "./lib.esm/crypto/crypto-browser.js", + "./lib.esm/providers/provider-ipcsocket.js": "./lib.esm/providers/provider-ipcsocket-browser.js", + "./lib.esm/providers/ws.js": "./lib.esm/providers/ws-browser.js", + "./lib.esm/utils/base64.js": "./lib.esm/utils/base64-browser.js", + "./lib.esm/utils/geturl.js": "./lib.esm/utils/geturl-browser.js", + "./lib.esm/crypto/ed448goldilock.js": "./lib.esm/crypto/ed448goldilock-browser.js", + "./src.ts/crypto/ed448goldilock.ts": "./src.ts/crypto/ed448goldilock-browser.ts", + "./lib.esm/wordlists/wordlists.js": "./lib.esm/wordlists/wordlists-browser.js" + }, + "dependencies": { + "@noble/hashes": "2.4.0", + "@types/node": "26.4.1", + "aes-js": "3.1.2", + "bcrypto": "^5.5.2", + "bn.js": "^5.2.5", + "buffer": "^6.0.3", + "tslib": "2.8.1", + "utf8": "^3.0.0", + "ws": "8.21.3" + }, + "devDependencies": { + "@rollup/plugin-commonjs": "^29.0.0", + "@rollup/plugin-inject": "^5.0.5", + "@rollup/plugin-node-resolve": "16.0.3", + "@types/bn.js": "^5.2.0", + "@types/mocha": "10.0.10", + "@types/semver": "7.8.0", + "@types/utf8": "^3.0.3", + "c8": "12.0.0", + "mocha": "12.0.0", + "prettier": "^3.9.6", + "rollup": "4.63.1", + "semver": "7.8.5", + "typescript": "7.0.2", + "uglify-js": "3.19.3" + }, + "engines": { + "node": ">=22.12.0" + }, + "exports": { + ".": { + "import": "./lib.esm/index.js", + "default": "./lib.commonjs/index.js" + }, + "./abi": { + "import": "./lib.esm/abi/index.js", + "default": "./lib.commonjs/abi/index.js" + }, + "./address": { + "import": "./lib.esm/address/index.js", + "default": "./lib.commonjs/address/index.js" + }, + "./constants": { + "import": "./lib.esm/constants/index.js", + "default": "./lib.commonjs/constants/index.js" + }, + "./contract": { + "import": "./lib.esm/contract/index.js", + "default": "./lib.commonjs/contract/index.js" + }, + "./crypto": { + "import": "./lib.esm/crypto/index.js", + "default": "./lib.commonjs/crypto/index.js" + }, + "./hash": { + "import": "./lib.esm/hash/index.js", + "default": "./lib.commonjs/hash/index.js" + }, + "./providers": { + "import": "./lib.esm/providers/index.js", + "default": "./lib.commonjs/providers/index.js" + }, + "./transaction": { + "import": "./lib.esm/transaction/index.js", + "default": "./lib.commonjs/transaction/index.js" + }, + "./utils": { + "import": "./lib.esm/utils/index.js", + "default": "./lib.commonjs/utils/index.js" + }, + "./wallet": { + "import": "./lib.esm/wallet/index.js", + "default": "./lib.commonjs/wallet/index.js" + }, + "./wordlists": { + "import": "./lib.esm/wordlists/index.js", + "default": "./lib.commonjs/wordlists/index.js" + }, + "./cip": { + "import": "./lib.esm/cip/index.js", + "default": "./lib.commonjs/cip/index.js" + }, + "./ipfs": { + "import": "./lib.esm/ipfs/index.js", + "default": "./lib.commonjs/ipfs/index.js" + } + }, + "license": "CORE", + "main": "./lib.commonjs/index.js", + "module": "./lib.esm/index.js", + "publishConfig": { + "access": "public", + "tag": "latest" + }, + "scripts": { + "_build-dist": "rollup -c && uglifyjs ./dist/corebc.js -o ./dist/corebc.min.js && uglifyjs ./dist/corebc.umd.js -o ./dist/corebc.umd.min.js && uglifyjs ./dist/wordlists-extra.js -o ./dist/wordlists-extra.min.js", + "_dist-stats": "gzip -k9f -S '.gz' ./dist/corebc.min.js && gzip -k9f -S '.gz' ./dist/corebc.umd.min.js && gzip -k9f -S '.gz' ./dist/wordlists-extra.min.js && du -hs ./dist/*.gz && echo '' && du -hs ./dist/*.js", + "auto-build": "npm run build -- -w", + "build": "node scripts/prepare-build.mjs && tsc --project tsconfig.esm.json", + "build-all": "npm run build && npm run build-commonjs && npm run _build-dist && npm run build-types", + "build-clean": "npm run clean && npm run build-all", + "build-commonjs": "node scripts/build-commonjs.mjs", + "build-dist": "npm run build && npm run _build-dist && npm run _dist-stats", + "build-types": "tsc --project tsconfig.types.json", + "clean": "node scripts/clean.mjs", + "clean-test": "npm run clean && npm run build-all && npm test", + "format": "prettier --write src.ts scripts package.json tsconfig*.json rollup.config.mjs .github README.md CONTRIBUTING.md CHANGELOG.md .prettierrc.json", + "lint": "prettier --check src.ts scripts package.json tsconfig*.json rollup.config.mjs .github README.md CONTRIBUTING.md CHANGELOG.md .prettierrc.json", + "stats": "echo 'Dependencies' && npm ls --all --omit=dev", + "test": "npm run test-esm && npm run test-commonjs", + "test-commonjs": "mocha ./lib.commonjs/_tests/test-*.js", + "test-coverage": "c8 -o output -r lcov -r text npm run test-esm", + "test-esm": "mocha ./lib.esm/_tests/test-*.js", + "check": "npm run build-all && npm run lint && npm test && npm run test-package", + "test-package": "node scripts/test-package.mjs", + "prepack": "npm run build-all" + }, + "sideEffects": false, + "type": "module", + "types": "./types/index.d.ts", + "files": [ + "lib.esm", + "lib.commonjs", + "types", + "dist", + "src.ts", + "!**/_admin/**", + "!**/_tests/**" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/CorePass/corebc.js.git" + }, + "bugs": { + "url": "https://github.com/CorePass/corebc.js/issues" + } } diff --git a/rollup.config.mjs b/rollup.config.mjs index c151833e1..e266ba067 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,50 +1,64 @@ - -import { nodeResolve } from '@rollup/plugin-node-resolve'; +import inject from "@rollup/plugin-inject"; +import commonjs from "@rollup/plugin-commonjs"; +import { nodeResolve } from "@rollup/plugin-node-resolve"; function getConfig(opts) { - if (opts == null) { opts = { }; } + if (opts == null) { + opts = {}; + } - const file = `./dist/corebc${ (opts.suffix || "") }.js`; - const exportConditions = [ "default", "module", "import" ]; - const mainFields = [ "module", "main" ]; - if (opts.browser) { mainFields.unshift("browser"); } + const file = `./dist/corebc${opts.suffix || ""}.js`; + const exportConditions = ["default", "module", "import"]; + const mainFields = ["module", "main"]; + if (opts.browser) { + mainFields.unshift("browser"); + } - return { - input: "./lib.esm/index.js", - output: { - file, - banner: "const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !== 'undefined' ? window: typeof global !== 'undefined' ? global: typeof self !== 'undefined' ? self: {});", - name: (opts.name || undefined), - format: (opts.format || "esm"), - sourcemap: true - }, - context: "__$G", - treeshake: true, - plugins: [ nodeResolve({ - exportConditions, - mainFields, - modulesOnly: true, - preferBuiltins: false - }) ], - }; + return { + input: "./lib.esm/index.js", + output: { + file, + banner: + "const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !== 'undefined' ? window: typeof global !== 'undefined' ? global: typeof self !== 'undefined' ? self: {});", + name: opts.name || undefined, + format: opts.format || "esm", + sourcemap: true, + }, + context: "__$G", + treeshake: true, + plugins: [ + nodeResolve({ + exportConditions, + mainFields, + browser: true, + preferBuiltins: false, + }), + commonjs(), + inject({ Buffer: ["buffer", "Buffer"] }), + ], + }; } export default [ - getConfig({ browser: true }), - getConfig({ browser: true, suffix: ".umd", format: "umd", name: "corebc" }), - { - input: "./lib.esm/wordlists/wordlists-extra.js", - output: { - file: "./dist/wordlists-extra.js", - format: "esm", - sourcemap: true - }, - treeshake: true, - plugins: [ nodeResolve({ - exportConditions: [ "default", "module", "import" ], - mainFields: [ "browser", "module", "main" ], - modulesOnly: true, - preferBuiltins: false - }) ], - } + getConfig({ browser: true }), + getConfig({ browser: true, suffix: ".umd", format: "umd", name: "corebc" }), + { + input: "./lib.esm/wordlists/wordlists-extra.js", + output: { + file: "./dist/wordlists-extra.js", + format: "esm", + sourcemap: true, + }, + treeshake: true, + plugins: [ + nodeResolve({ + exportConditions: ["default", "module", "import"], + mainFields: ["browser", "module", "main"], + browser: true, + preferBuiltins: false, + }), + commonjs(), + inject({ Buffer: ["buffer", "Buffer"] }), + ], + }, ]; diff --git a/scripts/build-commonjs.mjs b/scripts/build-commonjs.mjs new file mode 100644 index 000000000..633a50adf --- /dev/null +++ b/scripts/build-commonjs.mjs @@ -0,0 +1,28 @@ +import { readdir, mkdir, writeFile, copyFile } from "node:fs/promises"; +import { rollup } from "rollup"; +const input = (await readdir("lib.esm", { recursive: true })) + .filter((name) => name.endsWith(".js") && !name.startsWith("_admin/")) + .map((name) => `lib.esm/${name}`); +const bundle = await rollup({ + input, + external: (id) => !id.startsWith(".") && !id.startsWith("/"), +}); +await bundle.write({ + dir: "lib.commonjs", + format: "cjs", + exports: "named", + preserveModules: true, + preserveModulesRoot: "lib.esm", + sourcemap: true, +}); +await bundle.close(); +await writeFile( + "lib.commonjs/package.json", + JSON.stringify({ type: "commonjs" }), +); +for (const name of await readdir("lib.esm", { recursive: true })) { + if (!/\.d\.ts(?:\.map)?$/.test(name) || name.startsWith("_admin/")) continue; + const dest = `lib.commonjs/${name}`; + await mkdir(dest.slice(0, dest.lastIndexOf("/")), { recursive: true }); + await copyFile(`lib.esm/${name}`, dest); +} diff --git a/scripts/clean.mjs b/scripts/clean.mjs new file mode 100644 index 000000000..d8a9b9dbf --- /dev/null +++ b/scripts/clean.mjs @@ -0,0 +1,4 @@ +import { rm } from "node:fs/promises"; +for (const dir of ["dist", "lib.esm", "lib.commonjs", "types"]) { + await rm(dir, { recursive: true, force: true }); +} diff --git a/scripts/prepare-build.mjs b/scripts/prepare-build.mjs new file mode 100644 index 000000000..1da0d75d6 --- /dev/null +++ b/scripts/prepare-build.mjs @@ -0,0 +1,17 @@ +import { mkdir, readFile, writeFile } from "node:fs/promises"; +const pkg = JSON.parse(await readFile("package.json", "utf8")); +const browser = Object.fromEntries( + Object.entries(pkg.browser) + .filter(([key]) => key.startsWith("./lib.esm/")) + .map(([key, value]) => [ + key.replace("./lib.esm/", "./"), + value.replace("./lib.esm/", "./"), + ]), +); +for (const dir of ["lib.esm", "lib.commonjs", "dist", "types"]) + await mkdir(dir, { recursive: true }); +await writeFile( + "lib.esm/package.json", + JSON.stringify({ type: "module", sideEffects: false, browser }, null, "\t") + + "\n", +); diff --git a/scripts/test-browser.mjs b/scripts/test-browser.mjs new file mode 100644 index 000000000..7ffe28d2b --- /dev/null +++ b/scripts/test-browser.mjs @@ -0,0 +1,37 @@ +import { readFile } from "node:fs/promises"; +import vm from "node:vm"; +import { webcrypto } from "node:crypto"; +for (const file of ["dist/corebc.umd.js", "dist/corebc.umd.min.js"]) { + const context = vm.createContext({ + crypto: webcrypto, + console, + TextEncoder, + TextDecoder, + setTimeout, + clearTimeout, + AbortController, + fetch, + URL, + }); + vm.runInContext( + "globalThis.self = globalThis; globalThis.window = globalThis;", + context, + ); + vm.runInContext(await readFile(file, "utf8"), context, { filename: file }); + vm.runInContext( + ` + const key = new corebc.SigningKey("01".repeat(57)); + const digest = corebc.sha256("0x1234"); + if (corebc.SigningKey.recoverPublicKey(digest, key.sign(digest)) !== key.publicKey) throw new Error("browser signature mismatch"); + const wallet = corebc.Wallet.createRandom(corebc.networkIdToPrefix(3)); + if (wallet.address.length !== 46) throw new Error("invalid browser wallet"); + const account = { address: wallet.address, privateKey: wallet.privateKey }; + const json = corebc.encryptKeystoreJsonSync(account, "test", { scrypt: { N: 16, r: 1, p: 1 } }); + if (corebc.decryptKeystoreJsonSync(json, "test").privateKey !== wallet.privateKey) throw new Error("browser keystore mismatch"); + const known = corebc.Wallet.fromPhrase({ phrase: "better artwork flavor fish solve deer orient spread adapt doll attack hour sort copper super income bacon engine skate ill similar wink crack club", password: "111111", prefix: corebc.networkIdToPrefix(3) }); + if (known.address !== "0xab38254e30777140469a3aa168df81182d3d61f9843f") throw new Error("browser mnemonic mismatch"); + `, + context, + ); +} +console.log("Browser bundle checks passed"); diff --git a/scripts/test-package.mjs b/scripts/test-package.mjs new file mode 100644 index 000000000..a5bd4e8ca --- /dev/null +++ b/scripts/test-package.mjs @@ -0,0 +1,74 @@ +import assert from "node:assert/strict"; +import { execFileSync } from "node:child_process"; +import { mkdtemp, readFile, writeFile, rm } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import { join, resolve } from "node:path"; + +const pkg = JSON.parse(await readFile("package.json", "utf8")); +const temp = await mkdtemp(join(tmpdir(), "corebc-package-")); +try { + const [packed] = JSON.parse( + execFileSync( + "npm", + ["pack", "--ignore-scripts", "--json", "--pack-destination", temp], + { encoding: "utf8" }, + ), + ); + assert.ok( + !packed.files.some(({ path }) => /(?:^|\/)_(tests|admin)\//.test(path)), + ); + await writeFile( + join(temp, "package.json"), + '{"private":true,"type":"module"}', + ); + execFileSync( + "npm", + ["install", "--no-audit", "--no-fund", join(temp, packed.filename)], + { cwd: temp, stdio: "pipe" }, + ); + for (const mode of ["module", "commonjs"]) { + const code = + (mode === "module" + ? `import { version } from "corebc"; if (version !== ${JSON.stringify(pkg.version)}) throw new Error("version mismatch");\n` + : `if (require("corebc").version !== ${JSON.stringify(pkg.version)}) throw new Error("version mismatch");\n`) + + Object.keys(pkg.exports) + .map((key) => { + const name = "corebc" + (key === "." ? "" : key.slice(1)); + return mode === "module" + ? `await import(${JSON.stringify(name)});` + : `require(${JSON.stringify(name)});`; + }) + .join("\n"); + execFileSync(process.execPath, ["--input-type=" + mode, "-e", code], { + cwd: temp, + stdio: "pipe", + }); + } + // Compile consumer imports against both package export conditions. + const consumer = + 'import { Wallet, Cip150MetadataContract, IpfsGateway } from "corebc";\nimport { Cip151Lifecycle } from "corebc/cip";\nvoid [Wallet, Cip150MetadataContract, IpfsGateway, new Cip151Lifecycle()];\n'; + for (const ext of ["mts", "cts"]) { + const filename = join(temp, `consumer.${ext}`); + await writeFile(filename, consumer); + execFileSync( + resolve("node_modules/.bin/tsc"), + [ + "--ignoreConfig", + "--noEmit", + "--strict", + "--module", + "nodenext", + "--target", + "es2022", + filename, + ], + { cwd: temp, stdio: "inherit" }, + ); + } + await import("./test-browser.mjs"); + console.log( + `Package smoke checks passed: ${packed.files.length} files, ${packed.size} bytes; ESM, CommonJS, declarations and browser bundles.`, + ); +} finally { + await rm(temp, { recursive: true, force: true }); +} diff --git a/src.ts/_tests/blockchain-data.ts b/src.ts/_tests/blockchain-data.ts index 2a96b4b50..92e13dad1 100644 --- a/src.ts/_tests/blockchain-data.ts +++ b/src.ts/_tests/blockchain-data.ts @@ -1,354 +1,354 @@ export type TestBlockchainNetwork = "mainnet" | "goerli"; export interface TestBlockchainAddress { - test: string; - address: string; - code?: string; - nonce?: number; - name?: string; - balance?: bigint; - storage?: Record; + test: string; + address: string; + code?: string; + nonce?: number; + name?: string; + balance?: bigint; + storage?: Record; } export interface TestBlockchainBlock { - test: string; - hash: string; - parentHash: string; - number: number; - timestamp: number; - nonce: string; - difficulty: bigint; - energyLimit: bigint; - energyUsed: bigint; - miner: string; - extraData: string; - transactions: Array; + test: string; + hash: string; + parentHash: string; + number: number; + timestamp: number; + nonce: string; + difficulty: bigint; + energyLimit: bigint; + energyUsed: bigint; + miner: string; + extraData: string; + transactions: Array; - baseFeePerEnergy?: bigint; + baseFeePerEnergy?: bigint; } export interface TestBlockchainTransaction { - test: string; - hash: string; - blockHash: string; - blockNumber: number; - // index: number, - type: number; - from: string; - energyPrice: bigint; - energyLimit: bigint; - to: string; - value: bigint; - nonce: number; - data: string; - signature: { - r: string; - s: string; - yParity: 0 | 1; - v: number; - networkV: null | bigint; - }; - creates: null | string; - networkId: bigint; + test: string; + hash: string; + blockHash: string; + blockNumber: number; + // index: number, + type: number; + from: string; + energyPrice: bigint; + energyLimit: bigint; + to: string; + value: bigint; + nonce: number; + data: string; + signature: { + r: string; + s: string; + yParity: 0 | 1; + v: number; + networkV: null | bigint; + }; + creates: null | string; + networkId: bigint; - accessList?: Array>>; + accessList?: Array>>; } export interface TestBlockchainReceipt { - test: string; - //byzantium: true, - blockHash: string; - blockNumber: number; - type: number; - contractAddress: null | string; - cumulativeEnergyUsed: bigint; - from: string; - energyUsed: bigint; - energyPrice: bigint; - logs: Array<{ - address: string; - blockHash: string; - blockNumber: number; - data: string; - index: number; - topics: Array; - transactionHash: string; - transactionIndex: number; - }>; - logsBloom: string; - root: null | string; - status: null | number; - to: string; - hash: string; - index: number; + test: string; + //byzantium: true, + blockHash: string; + blockNumber: number; + type: number; + contractAddress: null | string; + cumulativeEnergyUsed: bigint; + from: string; + energyUsed: bigint; + energyPrice: bigint; + logs: Array<{ + address: string; + blockHash: string; + blockNumber: number; + data: string; + index: number; + topics: Array; + transactionHash: string; + transactionIndex: number; + }>; + logsBloom: string; + root: null | string; + status: null | number; + to: string; + hash: string; + index: number; } export const testAddress: Record< - TestBlockchainNetwork, - Array + TestBlockchainNetwork, + Array > = { - mainnet: [ - { - test: "old-account", - address: "0xAC1639CF97a3A46D431e6d1216f576622894cBB5", - balance: BigInt("4813414100000000"), - nonce: 3, - code: "0x", - }, - { - test: "TheDAO-splitter-contract", - address: "0x3474627D4F63A678266BC17171D87f8570936622", - code: "0x606060405260e060020a60003504630b3ed5368114602e57806337b0574a14605257806356fa47f0146062575b005b602c6004356000546101009004600160a060020a03908116339091161460bb575b50565b60005460ff166060908152602090f35b602c60043560005460ff1615609657600160a060020a038116600034606082818181858883f193505050501515604f576002565b33600160a060020a0316600034606082818181858883f193505050501515604f576002565b600080546101009004600160a060020a03169082606082818181858883f193505050501515604f57600256", - storage: { - "0": "0x0000000000000000000000b2682160c482eb985ec9f3e364eec0a904c44c2300", - }, - }, - { - test: "ricmoo.firefly.eth", - address: "0x8ba1f109551bD432803012645Ac136ddd64DBA72", - name: "ricmoo.firefly.eth", - }, - ], - goerli: [], + mainnet: [ + { + test: "old-account", + address: "0xAC1639CF97a3A46D431e6d1216f576622894cBB5", + balance: BigInt("4813414100000000"), + nonce: 3, + code: "0x", + }, + { + test: "TheDAO-splitter-contract", + address: "0x3474627D4F63A678266BC17171D87f8570936622", + code: "0x606060405260e060020a60003504630b3ed5368114602e57806337b0574a14605257806356fa47f0146062575b005b602c6004356000546101009004600160a060020a03908116339091161460bb575b50565b60005460ff166060908152602090f35b602c60043560005460ff1615609657600160a060020a038116600034606082818181858883f193505050501515604f576002565b33600160a060020a0316600034606082818181858883f193505050501515604f576002565b600080546101009004600160a060020a03169082606082818181858883f193505050501515604f57600256", + storage: { + "0": "0x0000000000000000000000b2682160c482eb985ec9f3e364eec0a904c44c2300", + }, + }, + { + test: "ricmoo.firefly.eth", + address: "0x8ba1f109551bD432803012645Ac136ddd64DBA72", + name: "ricmoo.firefly.eth", + }, + ], + goerli: [], }; export const testBlock: Record< - TestBlockchainNetwork, - Array + TestBlockchainNetwork, + Array > = { - mainnet: [ - { - test: "old-homestead-block", - hash: "0x3d6122660cc824376f11ee842f83addc3525e2dd6756b9bcf0affa6aa88cf741", - parentHash: - "0xb495a1d7e6663152ae92708da4843337b958146015a2802f4193a410044698c9", - number: 3, - timestamp: 1438270048, - nonce: "0x2e9344e0cbde83ce", - difficulty: BigInt(17154715646), - energyLimit: BigInt("0x1388"), - energyUsed: BigInt("0"), - miner: "0x5088D623ba0fcf0131E0897a91734A4D83596AA0", - extraData: - "0x476574682f76312e302e302d66633739643332642f6c696e75782f676f312e34", - transactions: [], - }, - { - test: "london-block", - number: 14413999, - hash: "0x6c79356d40ebb6ed63dc19f5d407f8f1c876047b59dc1a4598cce0e64dcabec5", - parentHash: - "0xbf09b0e215f247a5066d19ece5b4c66960771d45fae62985e8d751fb1adcfe2f", - timestamp: 1647654576, - nonce: "0xb4bc9979af5369fe", - difficulty: BigInt("12841513359509721"), - energyLimit: BigInt("30087914"), - energyUsed: BigInt("2008910"), - miner: "0x2A20380DcA5bC24D052acfbf79ba23e988ad0050", - extraData: "0x706f6f6c696e2e636f6d21f7092f019bb92a76", - baseFeePerEnergy: BigInt("40911884304"), - transactions: [ - "0x1c3a398933db10634631f54b435c40c8805c13f12bbac7c3dab858ca44213fa2", - "0xd98947cbdd892cc7f679c903903e6d18a5c5afb19e94437beba79372ad71c347", - "0x4d66190deb55b5820cb0ce9adb972f646fa0f3e64eaeee674bbf3d054bf3d883", - "0x9db7bd5f4c91d6103c714bcbc35df3dc708daa668aaef7449b589dbd3be24dac", - "0x126a43ae4ade4b7fc5c8ac9ebd3dbcf7314f63c60f2804fb49aa25b5c7d80bb1", - "0x82a90aa4b3b1b7873b117c3ff1ca7165ae34b2fc0788cc0cbfd41805d588590d", - "0x7f694a6a9972457753ed3dec164f17272b1c8b1da4eab149df95e31a3e72f606", - "0xdce1cba1ff33f0c23881087d49de3b34fe84c8a6883f3edd75b04fc23e458aac", - "0xbe1c69f825279cebef42d1f0e07397dcddef7fb278b0195e295ede3e156836c4", - "0x1d2f007b3c0f894403973a30e5ffaa78589f873d963e9554c6bb1bd7a3127245", - "0x9c8c78191cf4ae9ae8eee1165153eabe24dbd8b9509b83d5f0caeea85251bb2f", - "0x42e956f4b3dd6535359b272a0d2dab995c364cb48baaf8d0a1981995f3f8c808", - "0xdc2c2e99393e24d5dc66e38665fa1d1ff007d92088ef3fd2549545fdbe862ef6", - "0xaad7be28fffd2e77e8e40bf57f2ac140aa8283ec93c7f3f61a82c79405602f53", - "0x4735f1421b7b30283e87e0799e82e54307d3e5ba14cd54ad8420b57577489a71", - "0x0b9d6aa23aa439b41e86595f2ad91f498adffa3e6e7cb26ac7d73252e59fd3de", - "0xcd93e19bd5d5c5a834fec613116fa01f46eddfd2faa20ef302271b874b9d812a", - "0x5bf1976574a637f5ac0b8bda1a792fa16cc7ce9624d32e9bd6bd9aa6a8f19d2f", - "0x2e778da4f66f10f7b681b605635c6599cdbeea167fc1c4396a097aef5d06de61", - "0xd5fd68eebc4c870ccda081786a74c75c250e9e2d8269b8935edb3adb11b80bb2", - "0x2aec42a11c1d8c1e5198d54aacbc6bebb09bcd5e78f6af81ea09d65c9064734a", - "0xbea2e364ea4959ec438d9ccc2d2f7120c7eaba3b177cc0d7df8ff65d866ef89f", - "0xf48bbb0f838353060da4126a555ce532abf497a9d1108001afffaac513a59ddf", - "0xf5664e4372cce62733a6610efb7701a4a0e552d81f8caa764d8474b3070c6617", - "0x9d3732ddbd20610008ff737da2f61120734a1cbfa864374bcbcf10051e6048cb", - "0xc4d0df5bc6fa51b34ac3c898866d779d4e51a6be4d13be1ec3084b7229b03b47", - "0x90c86ec98b8ad98049b4ee54cb3aa72c5ae743077b830e8a294aa5dc47a1fb18", - ], - }, - ], - goerli: [], + mainnet: [ + { + test: "old-homestead-block", + hash: "0x3d6122660cc824376f11ee842f83addc3525e2dd6756b9bcf0affa6aa88cf741", + parentHash: + "0xb495a1d7e6663152ae92708da4843337b958146015a2802f4193a410044698c9", + number: 3, + timestamp: 1438270048, + nonce: "0x2e9344e0cbde83ce", + difficulty: BigInt(17154715646), + energyLimit: BigInt("0x1388"), + energyUsed: BigInt("0"), + miner: "0x5088D623ba0fcf0131E0897a91734A4D83596AA0", + extraData: + "0x476574682f76312e302e302d66633739643332642f6c696e75782f676f312e34", + transactions: [], + }, + { + test: "london-block", + number: 14413999, + hash: "0x6c79356d40ebb6ed63dc19f5d407f8f1c876047b59dc1a4598cce0e64dcabec5", + parentHash: + "0xbf09b0e215f247a5066d19ece5b4c66960771d45fae62985e8d751fb1adcfe2f", + timestamp: 1647654576, + nonce: "0xb4bc9979af5369fe", + difficulty: BigInt("12841513359509721"), + energyLimit: BigInt("30087914"), + energyUsed: BigInt("2008910"), + miner: "0x2A20380DcA5bC24D052acfbf79ba23e988ad0050", + extraData: "0x706f6f6c696e2e636f6d21f7092f019bb92a76", + baseFeePerEnergy: BigInt("40911884304"), + transactions: [ + "0x1c3a398933db10634631f54b435c40c8805c13f12bbac7c3dab858ca44213fa2", + "0xd98947cbdd892cc7f679c903903e6d18a5c5afb19e94437beba79372ad71c347", + "0x4d66190deb55b5820cb0ce9adb972f646fa0f3e64eaeee674bbf3d054bf3d883", + "0x9db7bd5f4c91d6103c714bcbc35df3dc708daa668aaef7449b589dbd3be24dac", + "0x126a43ae4ade4b7fc5c8ac9ebd3dbcf7314f63c60f2804fb49aa25b5c7d80bb1", + "0x82a90aa4b3b1b7873b117c3ff1ca7165ae34b2fc0788cc0cbfd41805d588590d", + "0x7f694a6a9972457753ed3dec164f17272b1c8b1da4eab149df95e31a3e72f606", + "0xdce1cba1ff33f0c23881087d49de3b34fe84c8a6883f3edd75b04fc23e458aac", + "0xbe1c69f825279cebef42d1f0e07397dcddef7fb278b0195e295ede3e156836c4", + "0x1d2f007b3c0f894403973a30e5ffaa78589f873d963e9554c6bb1bd7a3127245", + "0x9c8c78191cf4ae9ae8eee1165153eabe24dbd8b9509b83d5f0caeea85251bb2f", + "0x42e956f4b3dd6535359b272a0d2dab995c364cb48baaf8d0a1981995f3f8c808", + "0xdc2c2e99393e24d5dc66e38665fa1d1ff007d92088ef3fd2549545fdbe862ef6", + "0xaad7be28fffd2e77e8e40bf57f2ac140aa8283ec93c7f3f61a82c79405602f53", + "0x4735f1421b7b30283e87e0799e82e54307d3e5ba14cd54ad8420b57577489a71", + "0x0b9d6aa23aa439b41e86595f2ad91f498adffa3e6e7cb26ac7d73252e59fd3de", + "0xcd93e19bd5d5c5a834fec613116fa01f46eddfd2faa20ef302271b874b9d812a", + "0x5bf1976574a637f5ac0b8bda1a792fa16cc7ce9624d32e9bd6bd9aa6a8f19d2f", + "0x2e778da4f66f10f7b681b605635c6599cdbeea167fc1c4396a097aef5d06de61", + "0xd5fd68eebc4c870ccda081786a74c75c250e9e2d8269b8935edb3adb11b80bb2", + "0x2aec42a11c1d8c1e5198d54aacbc6bebb09bcd5e78f6af81ea09d65c9064734a", + "0xbea2e364ea4959ec438d9ccc2d2f7120c7eaba3b177cc0d7df8ff65d866ef89f", + "0xf48bbb0f838353060da4126a555ce532abf497a9d1108001afffaac513a59ddf", + "0xf5664e4372cce62733a6610efb7701a4a0e552d81f8caa764d8474b3070c6617", + "0x9d3732ddbd20610008ff737da2f61120734a1cbfa864374bcbcf10051e6048cb", + "0xc4d0df5bc6fa51b34ac3c898866d779d4e51a6be4d13be1ec3084b7229b03b47", + "0x90c86ec98b8ad98049b4ee54cb3aa72c5ae743077b830e8a294aa5dc47a1fb18", + ], + }, + ], + goerli: [], }; export const testTransaction: Record< - TestBlockchainNetwork, - Array + TestBlockchainNetwork, + Array > = { - mainnet: [ - { - test: "legacy", - hash: "0xccc90ab97a74c952fb3376c4a3efb566a58a10df62eb4d44a61e106fcf10ec61", - blockHash: - "0x9653f180a5720f3634816eb945a6d722adee52cc47526f6357ac10adaf368135", - blockNumber: 4097745, - // index: 18, - type: 0, - from: "0x32DEF047DeFd076DB21A2D759aff2A591c972248", - energyPrice: BigInt("0x4a817c800"), - energyLimit: BigInt("0x3d090"), - to: "0x6fC21092DA55B392b045eD78F4732bff3C580e2c", - value: BigInt("0x186cc6acd4b0000"), - nonce: 0, - data: "0xf2c298be000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000067269636d6f6f0000000000000000000000000000000000000000000000000000", - signature: { - r: "0x1e5605197a03e3f0a168f14749168dfeefc44c9228312dacbffdcbbb13263265", - s: "0x269c3e5b3558267ad91b0a887d51f9f10098771c67b82ea6cb74f29638754f54", - yParity: 1, - v: 28, - networkV: BigInt(38), - }, - creates: null, - networkId: BigInt(1), - }, - { - test: "EIP-1559", - hash: "0x8ff41d0ba5d239acc8c123ff12451a2c15721c838f657e583d355999af4a4349", - blockHash: - "0x9d4c3bef68e119841281105da96beb1c7252f357340d7a3355236b3332b197b0", - blockNumber: 12966000, - // index: 185, - type: 2, - from: "0x5afFBa12E9332bbc0E221c8E7BEf7CB7cfB3F281", - to: "0x2258CcD34ae29E6B199b6CD64eb2aEF157df7CdE", - energyLimit: BigInt("21000"), - nonce: 2, - data: "0x", - value: BigInt("1100000000000000"), - energyPrice: BigInt("70578812137"), - networkId: BigInt(1), - signature: { - r: "0xdd26e5478d0aa84e334a0393d335ab24b83de8ecae9290305f15ab884ded246c", - s: "0x6494b4f61b0d9a5a82ecb86d72b301f859f404f0bec9682bbfff619903ecfbe2", - yParity: 1, - v: 28, - networkV: null, - }, - creates: null, - accessList: [], - }, - ], - goerli: [], + mainnet: [ + { + test: "legacy", + hash: "0xccc90ab97a74c952fb3376c4a3efb566a58a10df62eb4d44a61e106fcf10ec61", + blockHash: + "0x9653f180a5720f3634816eb945a6d722adee52cc47526f6357ac10adaf368135", + blockNumber: 4097745, + // index: 18, + type: 0, + from: "0x32DEF047DeFd076DB21A2D759aff2A591c972248", + energyPrice: BigInt("0x4a817c800"), + energyLimit: BigInt("0x3d090"), + to: "0x6fC21092DA55B392b045eD78F4732bff3C580e2c", + value: BigInt("0x186cc6acd4b0000"), + nonce: 0, + data: "0xf2c298be000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000067269636d6f6f0000000000000000000000000000000000000000000000000000", + signature: { + r: "0x1e5605197a03e3f0a168f14749168dfeefc44c9228312dacbffdcbbb13263265", + s: "0x269c3e5b3558267ad91b0a887d51f9f10098771c67b82ea6cb74f29638754f54", + yParity: 1, + v: 28, + networkV: BigInt(38), + }, + creates: null, + networkId: BigInt(1), + }, + { + test: "EIP-1559", + hash: "0x8ff41d0ba5d239acc8c123ff12451a2c15721c838f657e583d355999af4a4349", + blockHash: + "0x9d4c3bef68e119841281105da96beb1c7252f357340d7a3355236b3332b197b0", + blockNumber: 12966000, + // index: 185, + type: 2, + from: "0x5afFBa12E9332bbc0E221c8E7BEf7CB7cfB3F281", + to: "0x2258CcD34ae29E6B199b6CD64eb2aEF157df7CdE", + energyLimit: BigInt("21000"), + nonce: 2, + data: "0x", + value: BigInt("1100000000000000"), + energyPrice: BigInt("70578812137"), + networkId: BigInt(1), + signature: { + r: "0xdd26e5478d0aa84e334a0393d335ab24b83de8ecae9290305f15ab884ded246c", + s: "0x6494b4f61b0d9a5a82ecb86d72b301f859f404f0bec9682bbfff619903ecfbe2", + yParity: 1, + v: 28, + networkV: null, + }, + creates: null, + accessList: [], + }, + ], + goerli: [], }; export const testReceipt: Record< - TestBlockchainNetwork, - Array + TestBlockchainNetwork, + Array > = { - mainnet: [ - { - test: "legacy", - //byzantium: false, - blockHash: - "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", - blockNumber: 0x3c92b5, - type: 0, - contractAddress: null, - cumulativeEnergyUsed: BigInt(0x1cca2e), - from: "0x18C6045651826824FEBBD39d8560584078d1b247", - energyUsed: BigInt(0x14bb7), - energyPrice: BigInt(4100000000), - logs: [ - { - address: "0x314159265dD8dbb310642f98f50C066173C1259b", - blockHash: - "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", - blockNumber: 0x3c92b5, - data: "0x00000000000000000000000018c6045651826824febbd39d8560584078d1b247", - index: 0x1a, - topics: [ - "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", - "0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae", - "0xf0106919d12469348e14ad6a051d0656227e1aba2fefed41737fdf78421b20e1", - ], - transactionHash: - "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", - transactionIndex: 0x39, - }, - { - address: "0x6090A6e47849629b7245Dfa1Ca21D94cd15878Ef", - blockHash: - "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", - blockNumber: 0x3c92b5, - data: "0x000000000000000000000000000000000000000000000000002386f26fc1000000000000000000000000000000000000000000000000000000000000595a32ce", - index: 0x1b, - topics: [ - "0x0f0c27adfd84b60b6f456b0e87cdccb1e5fb9603991588d87fa99f5b6b61e670", - "0xf0106919d12469348e14ad6a051d0656227e1aba2fefed41737fdf78421b20e1", - "0x00000000000000000000000018c6045651826824febbd39d8560584078d1b247", - ], - transactionHash: - "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", - transactionIndex: 0x39, - }, - ], - logsBloom: - "0x00000000000000040000000000100000010000000000000040000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000200000010000000004000000000000000000000000000000000002000000000000000000000000400000000020000000000000000000000000000000000000004000000000000000000000000000000000000000000000000801000000000000000000000020000000000040000000040000000000000000002000000004000000000000000000000000000000000000000000000010000000000000000000000000000000000200000000000000000", - root: "0x9b550a9a640ce50331b64504ef87aaa7e2aaf97344acb6ff111f879b319d2590", - // Should be null for pre-byzantium, but some nodes have backfilled it - status: 1, - to: "0x6090A6e47849629b7245Dfa1Ca21D94cd15878Ef", - hash: "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", - index: 0x39, - }, - { - test: "byzantium", - //byzantium: true, - blockHash: - "0x34e5a6cfbdbb84f7625df1de69d218ade4da72f4a2558064a156674e72e976c9", - blockNumber: 0x444f76, - type: 0, - contractAddress: null, - cumulativeEnergyUsed: BigInt(0x15bfe7), - from: "0x18C6045651826824FEBBD39d8560584078d1b247", - energyUsed: BigInt(0x1b968), - energyPrice: BigInt(1000000000), - logs: [ - { - address: "0xb90E64082D00437e65A76d4c8187596BC213480a", - blockHash: - "0x34e5a6cfbdbb84f7625df1de69d218ade4da72f4a2558064a156674e72e976c9", - blockNumber: 0x444f76, - data: "0x", - index: 0x10, - topics: [ - "0x748d071d1992ee1bfe7a39058114d0a50d5798fe8eb3a9bfb4687f024629a2ce", - "0x5574aa58f7191ccab6de6cf75fe2ea0484f010b852fdd8c6b7ae151d6c2f4b83", - ], - transactionHash: - "0x7f1c6a58dc880438236d0b0a4ae166e9e9a038dbea8ec074149bd8b176332cac", - transactionIndex: 0x1e, - }, - ], - logsBloom: - "0x00000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000200000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000800000000000000000800000000000000000000000000000000000000", - root: null, - status: 1, - to: "0xb90E64082D00437e65A76d4c8187596BC213480a", - hash: "0x7f1c6a58dc880438236d0b0a4ae166e9e9a038dbea8ec074149bd8b176332cac", - index: 0x1e, - }, - ], - goerli: [], + mainnet: [ + { + test: "legacy", + //byzantium: false, + blockHash: + "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", + blockNumber: 0x3c92b5, + type: 0, + contractAddress: null, + cumulativeEnergyUsed: BigInt(0x1cca2e), + from: "0x18C6045651826824FEBBD39d8560584078d1b247", + energyUsed: BigInt(0x14bb7), + energyPrice: BigInt(4100000000), + logs: [ + { + address: "0x314159265dD8dbb310642f98f50C066173C1259b", + blockHash: + "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", + blockNumber: 0x3c92b5, + data: "0x00000000000000000000000018c6045651826824febbd39d8560584078d1b247", + index: 0x1a, + topics: [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae", + "0xf0106919d12469348e14ad6a051d0656227e1aba2fefed41737fdf78421b20e1", + ], + transactionHash: + "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", + transactionIndex: 0x39, + }, + { + address: "0x6090A6e47849629b7245Dfa1Ca21D94cd15878Ef", + blockHash: + "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", + blockNumber: 0x3c92b5, + data: "0x000000000000000000000000000000000000000000000000002386f26fc1000000000000000000000000000000000000000000000000000000000000595a32ce", + index: 0x1b, + topics: [ + "0x0f0c27adfd84b60b6f456b0e87cdccb1e5fb9603991588d87fa99f5b6b61e670", + "0xf0106919d12469348e14ad6a051d0656227e1aba2fefed41737fdf78421b20e1", + "0x00000000000000000000000018c6045651826824febbd39d8560584078d1b247", + ], + transactionHash: + "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", + transactionIndex: 0x39, + }, + ], + logsBloom: + "0x00000000000000040000000000100000010000000000000040000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000200000010000000004000000000000000000000000000000000002000000000000000000000000400000000020000000000000000000000000000000000000004000000000000000000000000000000000000000000000000801000000000000000000000020000000000040000000040000000000000000002000000004000000000000000000000000000000000000000000000010000000000000000000000000000000000200000000000000000", + root: "0x9b550a9a640ce50331b64504ef87aaa7e2aaf97344acb6ff111f879b319d2590", + // Should be null for pre-byzantium, but some nodes have backfilled it + status: 1, + to: "0x6090A6e47849629b7245Dfa1Ca21D94cd15878Ef", + hash: "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", + index: 0x39, + }, + { + test: "byzantium", + //byzantium: true, + blockHash: + "0x34e5a6cfbdbb84f7625df1de69d218ade4da72f4a2558064a156674e72e976c9", + blockNumber: 0x444f76, + type: 0, + contractAddress: null, + cumulativeEnergyUsed: BigInt(0x15bfe7), + from: "0x18C6045651826824FEBBD39d8560584078d1b247", + energyUsed: BigInt(0x1b968), + energyPrice: BigInt(1000000000), + logs: [ + { + address: "0xb90E64082D00437e65A76d4c8187596BC213480a", + blockHash: + "0x34e5a6cfbdbb84f7625df1de69d218ade4da72f4a2558064a156674e72e976c9", + blockNumber: 0x444f76, + data: "0x", + index: 0x10, + topics: [ + "0x748d071d1992ee1bfe7a39058114d0a50d5798fe8eb3a9bfb4687f024629a2ce", + "0x5574aa58f7191ccab6de6cf75fe2ea0484f010b852fdd8c6b7ae151d6c2f4b83", + ], + transactionHash: + "0x7f1c6a58dc880438236d0b0a4ae166e9e9a038dbea8ec074149bd8b176332cac", + transactionIndex: 0x1e, + }, + ], + logsBloom: + "0x00000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000200000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000800000000000000000800000000000000000000000000000000000000", + root: null, + status: 1, + to: "0xb90E64082D00437e65A76d4c8187596BC213480a", + hash: "0x7f1c6a58dc880438236d0b0a4ae166e9e9a038dbea8ec074149bd8b176332cac", + index: 0x1e, + }, + ], + goerli: [], }; export const networkNames: Array = ["mainnet", "goerli"]; export function networkFeatureAtBlock(feature: string, block: number): boolean { - switch (feature) { - case "byzantium": - return block >= 4370000; - default: - break; - } - throw new Error(`unknown feature: ${feature}`); + switch (feature) { + case "byzantium": + return block >= 4370000; + default: + break; + } + throw new Error(`unknown feature: ${feature}`); } diff --git a/src.ts/_tests/create-provider.ts b/src.ts/_tests/create-provider.ts index f104fbb02..66ee75665 100644 --- a/src.ts/_tests/create-provider.ts +++ b/src.ts/_tests/create-provider.ts @@ -1,150 +1,150 @@ import { - AlchemyProvider, - InfuraProvider, - PocketProvider, - QuickNodeProvider, - FallbackProvider, - isError, + AlchemyProvider, + InfuraProvider, + PocketProvider, + QuickNodeProvider, + FallbackProvider, + isError, } from "../index.js"; import type { AbstractProvider } from "../index.js"; interface ProviderCreator { - name: string; - networks: Array; - create: (network: string) => null | AbstractProvider; + name: string; + networks: Array; + create: (network: string) => null | AbstractProvider; } const ethNetworks = ["default", "mainnet", "goerli"]; //const maticNetworks = [ "matic", "maticmum" ]; const ProviderCreators: Array = [ - { - name: "AlchemyProvider", - networks: ethNetworks, - create: function (network: string) { - return new AlchemyProvider(network, "YrPw6SWb20vJDRFkhWq8aKnTQ8JRNRHM"); - }, - }, - { - name: "InfuraProvider", - networks: ethNetworks, - create: function (network: string) { - return new InfuraProvider(network, "49a0efa3aaee4fd99797bfa94d8ce2f1"); - }, - }, - { - name: "InfuraWebsocketProvider", - networks: ethNetworks, - create: function (network: string) { - return InfuraProvider.getWebSocketProvider( - network, - "49a0efa3aaee4fd99797bfa94d8ce2f1", - ); - }, - }, - { - name: "PocketProvider", - networks: ethNetworks, - create: function (network: string) { - return new PocketProvider(network); - }, - }, - { - name: "QuickNodeProvider", - networks: ethNetworks, - create: function (network: string) { - return new QuickNodeProvider(network); - }, - }, - { - name: "FallbackProvider", - networks: ethNetworks, - create: function (network: string) { - const providers: Array = []; - for (const providerName of [ - "AlchemyProvider", - "AnkrProvider", - "InfuraProvider", - ]) { - const provider = getProvider(providerName, network); - if (provider) { - providers.push(provider); - } - } - if (providers.length === 0) { - throw new Error("UNSUPPORTED NETWORK"); - } - return new FallbackProvider(providers); - }, - }, + { + name: "AlchemyProvider", + networks: ethNetworks, + create: function (network: string) { + return new AlchemyProvider(network, "YrPw6SWb20vJDRFkhWq8aKnTQ8JRNRHM"); + }, + }, + { + name: "InfuraProvider", + networks: ethNetworks, + create: function (network: string) { + return new InfuraProvider(network, "49a0efa3aaee4fd99797bfa94d8ce2f1"); + }, + }, + { + name: "InfuraWebsocketProvider", + networks: ethNetworks, + create: function (network: string) { + return InfuraProvider.getWebSocketProvider( + network, + "49a0efa3aaee4fd99797bfa94d8ce2f1", + ); + }, + }, + { + name: "PocketProvider", + networks: ethNetworks, + create: function (network: string) { + return new PocketProvider(network); + }, + }, + { + name: "QuickNodeProvider", + networks: ethNetworks, + create: function (network: string) { + return new QuickNodeProvider(network); + }, + }, + { + name: "FallbackProvider", + networks: ethNetworks, + create: function (network: string) { + const providers: Array = []; + for (const providerName of [ + "AlchemyProvider", + "AnkrProvider", + "InfuraProvider", + ]) { + const provider = getProvider(providerName, network); + if (provider) { + providers.push(provider); + } + } + if (providers.length === 0) { + throw new Error("UNSUPPORTED NETWORK"); + } + return new FallbackProvider(providers); + }, + }, ]; let setup = false; const cleanup: Array<() => void> = []; export function setupProviders(): void { - after(function () { - for (const func of cleanup) { - func(); - } - }); - setup = true; + after(function () { + for (const func of cleanup) { + func(); + } + }); + setup = true; } export const providerNames = Object.freeze(ProviderCreators.map((c) => c.name)); function getCreator(provider: string): null | ProviderCreator { - const creators = ProviderCreators.filter((c) => c.name === provider); - if (creators.length === 1) { - return creators[0]; - } - return null; + const creators = ProviderCreators.filter((c) => c.name === provider); + if (creators.length === 1) { + return creators[0]; + } + return null; } export function getProviderNetworks(provider: string): Array { - const creator = getCreator(provider); - if (creator) { - return creator.networks; - } - return []; + const creator = getCreator(provider); + if (creator) { + return creator.networks; + } + return []; } export function getProvider( - provider: string, - network: string, + provider: string, + network: string, ): null | AbstractProvider { - if (setup == false) { - throw new Error("MUST CALL setupProviders in root context"); - } + if (setup == false) { + throw new Error("MUST CALL setupProviders in root context"); + } - const creator = getCreator(provider); - try { - if (creator) { - const provider = creator.create(network); - if (provider) { - cleanup.push(() => { - provider.destroy(); - }); - } - return provider; - } - } catch (error) { - if (!isError(error, "INVALID_ARGUMENT")) { - throw error; - } - } - return null; + const creator = getCreator(provider); + try { + if (creator) { + const provider = creator.create(network); + if (provider) { + cleanup.push(() => { + provider.destroy(); + }); + } + return provider; + } + } catch (error) { + if (!isError(error, "INVALID_ARGUMENT")) { + throw error; + } + } + return null; } export function checkProvider(provider: string, network: string): boolean { - const creator = getCreator(provider); - return creator != null; + const creator = getCreator(provider); + return creator != null; } export function connect(network: string): AbstractProvider { - const provider = getProvider("InfuraProvider", network); - if (provider == null) { - throw new Error(`could not connect to ${network}`); - } - return provider; + const provider = getProvider("InfuraProvider", network); + if (provider == null) { + throw new Error(`could not connect to ${network}`); + } + return provider; } diff --git a/src.ts/_tests/test-cip.ts b/src.ts/_tests/test-cip.ts new file mode 100644 index 000000000..b6109ce71 --- /dev/null +++ b/src.ts/_tests/test-cip.ts @@ -0,0 +1,187 @@ +import assert from "node:assert/strict"; +import { + Interface, + Cip150MetadataContract, + Cip151Lifecycle, + Cip152LabCertificate, + CustomUnitToken, + cip150Abi, + customUnitAbi, + IpfsGateway, +} from "../index.js"; +import type { TransactionRequest } from "../providers/index.js"; +const address = "0xab38254e30777140469a3aa168df81182d3d61f9843f"; + +describe("CIP metadata and custom units", () => { + it("uses Unix seconds and exact inclusive lifecycle boundaries", () => { + const lifecycle = new Cip151Lifecycle({ + tokenExpiration: "9007199254740993", + tradingStop: "0", + }); + assert.equal(lifecycle.isExpiredAt(9007199254740992n), false); + assert.equal(lifecycle.isExpiredAt(9007199254740993n), true); + assert.equal(lifecycle.isTradingStoppedAt(0n), true); + assert.equal(new Cip151Lifecycle().isExpiredAt(1n), false); + for (const value of ["-1", "1.5", "1e3", " 1", "NaN"]) + assert.throws(() => new Cip151Lifecycle({ tokenExpiration: value })); + }); + it("validates and copies lab measurements", () => { + const input = { moisture: { value: 12, unit: "%" } }; + const lab = new Cip152LabCertificate(input); + input.moisture.value = 99; + assert.equal(lab.measurements.moisture.value, 12); + for (const json of [ + null, + [], + { x: {} }, + { x: { value: true } }, + { x: { value: Infinity } }, + { x: { value: 1, unit: 3 } }, + ]) + assert.throws(() => new Cip152LabCertificate(json)); + }); + it("encodes CIP-150 calls and preserves block references", async () => { + const abi = new Interface(cip150Abi); + const values: Record = { + tokenExpiration: "100", + lab: "ipfs://QmExample/lab.json", + }; + const calls: string[] = []; + const metadata = new Cip150MetadataContract(address, { + provider: null, + call: async (tx: TransactionRequest) => { + assert.equal(tx.blockTag, 42); + const parsed = abi.parseTransaction({ data: tx.data! })!; + calls.push(parsed.name); + const key = parsed.args.length ? parsed.args[0] : ""; + const result: Record = { + listMetadataKeys: [Object.keys(values)], + metadataCount: [2n], + getMetadataByIndex: ["tokenExpiration", "100"], + hasMetadataKey: [Object.hasOwn(values, key)], + getMetadataValue: [values[key]], + isMetadataSealed: [true], + }; + return abi.encodeFunctionResult(parsed.fragment, result[parsed.name]); + }, + }); + assert.equal(await metadata.count(42), 2n); + assert.deepEqual(await metadata.getByIndex(0n, 42), { + key: "tokenExpiration", + value: "100", + }); + assert.equal((await metadata.readAll(42))[0].sealed, true); + assert.equal((await metadata.readAll(42, false))[0].sealed, undefined); + assert.equal((await metadata.readLifecycle(42)).tokenExpiration, 100n); + const gateway = new IpfsGateway({ + fetch: async () => new Response('{"pH":{"value":7}}'), + }); + assert.equal( + (await metadata.readLabCertificate(gateway, 42))!.measurements.pH.value, + 7, + ); + values.lab = "ipfs://QmExample/wrong.json"; + await assert.rejects(metadata.readLabCertificate(gateway, 42), /lab.json/); + delete values.lab; + assert.equal(await metadata.readLabCertificate(gateway, 42), null); + await assert.rejects(metadata.setValue("x", "y"), /sendTransaction/); + assert.ok(calls.includes("isMetadataSealed")); + }); + it("discovers custom units and retains balances beyond Number precision", async () => { + const abi = new Interface(customUnitAbi); + const canonical = 9007199254740993n; + const token = new CustomUnitToken(address, { + provider: null, + call: async (tx) => { + assert.equal(tx.blockTag, 10); + const parsed = abi.parseTransaction({ data: tx.data! })!; + const result: Record = { + supportsUnit: [parsed.args.length > 0 && parsed.args[0] === "units"], + supportedUnits: [["units", "kg"]], + preferredUnit: ["kg"], + balanceOf: [canonical], + balanceOfUnit: [canonical * 3n], + }; + if (parsed.name === "balanceOfUnit") assert.equal(parsed.args[1], "kg"); + return abi.encodeFunctionResult(parsed.fragment, result[parsed.name]); + }, + }); + assert.equal((await token.discover(10))!.supports("kg"), true); + const balance = await token.balance(address, undefined, 10); + assert.equal(balance.multiplierNumerator, canonical * 3n); + assert.equal(balance.multiplierDenominator, canonical); + assert.equal(await token.supportsUnit(" ", 10), false); + assert.throws(() => token.balanceOfUnit(address, " ")); + }); +}); + +describe("IPFS gateway", () => { + it("resolves references and rejects unsupported schemes and traversal", () => { + const gateway = new IpfsGateway(); + for (const ref of [ + "ipfs://QmExample/lab.json", + "/ipfs/QmExample/lab.json", + "QmExample/lab.json", + "ipfs://ipfs/QmExample/lab.json", + ]) + assert.equal( + gateway.resolve(ref).href, + "https://ipf.sk/QmExample/lab.json", + ); + assert.equal( + gateway.resolve("https://example.com/lab.json").href, + "https://example.com/lab.json", + ); + for (const ref of ["", "file:///tmp/lab.json", "QmExample/../lab.json"]) + assert.throws(() => gateway.resolve(ref)); + assert.throws(() => new IpfsGateway({ maxResponseBytes: 0 })); + assert.throws( + () => new IpfsGateway({ template: "ftp://example.com/{cid}" }), + ); + }); + it("bounds streamed bodies and cancels oversized responses", async () => { + let cancelled = false; + const gateway = new IpfsGateway({ + maxResponseBytes: 4, + fetch: async () => + new Response( + new ReadableStream({ + start(c) { + c.enqueue(new Uint8Array(5)); + }, + cancel() { + cancelled = true; + }, + }), + ), + }); + await assert.rejects(gateway.readJson("QmExample"), /exceeds/); + assert.equal(cancelled, true); + }); + it("rejects HTTP errors and invalid JSON", async () => { + await assert.rejects( + new IpfsGateway({ + fetch: async () => new Response("no", { status: 404 }), + }).readJson("QmExample"), + /404/, + ); + await assert.rejects( + new IpfsGateway({ fetch: async () => new Response("not json") }).readJson( + "QmExample", + ), + SyntaxError, + ); + }); + it("aborts stalled requests", async () => { + const gateway = new IpfsGateway({ + timeoutMs: 5, + fetch: async (_url, init) => + new Promise((_resolve, reject) => + init!.signal!.addEventListener("abort", () => + reject(new Error("aborted")), + ), + ), + }); + await assert.rejects(gateway.readJson("QmExample"), /aborted/); + }); +}); diff --git a/src.ts/_tests/test-contract.ts b/src.ts/_tests/test-contract.ts index c92c7f2f2..2dcbec7c8 100644 --- a/src.ts/_tests/test-contract.ts +++ b/src.ts/_tests/test-contract.ts @@ -1,153 +1,156 @@ import { - getDefaultProvider, - Wallet, - Transaction, - SigningKey, - BaseWallet, - verifyMessage, - isAddressable, + getDefaultProvider, + Wallet, + Transaction, + SigningKey, + BaseWallet, + verifyMessage, + isAddressable, } from "../corebc.js"; import assert from "assert"; import { networkIdToPrefix } from "../address/index.js"; const TIMEOUT_PERIOD = 120000; const tesSignedTransaction = - "0xf8ce800a830f423f0496ce276773ac97d16855a3c8faa45399136b56d419486081c880b8ab54bc60412c90c104a89865a43c33f335836bcb473f0cd477ecb2c82e6310676c87b708e3971d009b4a04e518f12454c3ee1aebc19a6b7df00076b834b692b7432611f3dafff0f422dfbae722ba4b989cfc82fee2e539fbbf21d652ea587df59e8421a3a8bc8ca2ba35033598954c54e10c00315484db568379ce94f9c894e3e6e4c7ee216676b713ca892d9b26746ae902a772e217a6a8bb493ce2bb313cf0cb66e76765d4c45ec6b68600"; + "0xf8ce800a830f423f0496ce276773ac97d16855a3c8faa45399136b56d419486081c880b8ab54bc60412c90c104a89865a43c33f335836bcb473f0cd477ecb2c82e6310676c87b708e3971d009b4a04e518f12454c3ee1aebc19a6b7df00076b834b692b7432611f3dafff0f422dfbae722ba4b989cfc82fee2e539fbbf21d652ea587df59e8421a3a8bc8ca2ba35033598954c54e10c00315484db568379ce94f9c894e3e6e4c7ee216676b713ca892d9b26746ae902a772e217a6a8bb493ce2bb313cf0cb66e76765d4c45ec6b68600"; const testWalletPhrase = - "better artwork flavor fish solve deer orient spread adapt doll attack hour sort copper super income bacon engine skate ill similar wink crack club"; + "better artwork flavor fish solve deer orient spread adapt doll attack hour sort copper super income bacon engine skate ill similar wink crack club"; const testSeed = - "ec372b08ffc451a5dd991c68006aa01a033a6a391e0e72d5690c13cff719fdcb2502812dbf5f32a6df828cd22d77a36405bb15bb2637b7e77f99fa60f00d3560"; + "ec372b08ffc451a5dd991c68006aa01a033a6a391e0e72d5690c13cff719fdcb2502812dbf5f32a6df828cd22d77a36405bb15bb2637b7e77f99fa60f00d3560"; const tesPrivateKey = - "69bb68c3a00a0cd9cbf2cab316476228c758329bbfe0b1759e8634694a9497afea05bcbf24e2aa0627eac4240484bb71de646a9296872a3c0e"; + "69bb68c3a00a0cd9cbf2cab316476228c758329bbfe0b1759e8634694a9497afea05bcbf24e2aa0627eac4240484bb71de646a9296872a3c0e"; const testAddress = "0xab38254e30777140469a3aa168df81182d3d61f9843f"; const testPublicKey = - "0x484ed765af56534f1c98c0f3ac9fb460fbf5c3cf582e54a6cdfc319986ce1bb875d3afcc9c336764348c96264dfeef9565364d7e8e14e9aa80"; -const provider = getDefaultProvider("https://xcbapi.corecoin.cc/"); + "0x484ed765af56534f1c98c0f3ac9fb460fbf5c3cf582e54a6cdfc319986ce1bb875d3afcc9c336764348c96264dfeef9565364d7e8e14e9aa80"; +const provider = getDefaultProvider( + process.env.COREBC_RPC_URL || "https://xcbapi.corecoin.cc/", +); const mnemonicWallet = Wallet.fromPhrase({ - phrase: testWalletPhrase, - password: "111111", - prefix: networkIdToPrefix(3), + phrase: testWalletPhrase, + password: "111111", + prefix: networkIdToPrefix(3), }); const mnemonicWalletWithoutPassKey = Wallet.fromPhrase({ - phrase: testWalletPhrase, - prefix: networkIdToPrefix(3), + phrase: testWalletPhrase, + prefix: networkIdToPrefix(3), }); -console.log(mnemonicWalletWithoutPassKey.publicKey); + const wallet = Wallet.fromSeed({ - prefix: networkIdToPrefix(3), - seed: testSeed, - provider, + prefix: networkIdToPrefix(3), + seed: testSeed, + provider, }); const seedWallet = Wallet.fromSeed({ - prefix: networkIdToPrefix(3), - seed: testSeed, + prefix: networkIdToPrefix(3), + seed: testSeed, }); const signingKey = new SigningKey(tesPrivateKey); const baseWalletAddress = "0xab03a5fd22b9bee8b8ab877c86e0a2c21765e1d5bfc5"; const baseWallet = new BaseWallet({ - signingKey, - prefix: networkIdToPrefix(3), - provider, + signingKey, + prefix: networkIdToPrefix(3), + provider, }); const randomWallet = Wallet.createRandom(networkIdToPrefix(3), provider); const transaction = Transaction.from({ - to: "0xce276773ac97d16855a3c8faa45399136b56d4194860", - value: 200n, - nonce: 0, - energyLimit: 999999n, - energyPrice: 10n, - networkId: 4, + to: "0xce276773ac97d16855a3c8faa45399136b56d4194860", + value: 200n, + nonce: 0, + energyLimit: 999999n, + energyPrice: 10n, + networkId: 4, }); describe("Test wallet creation", function () { - it("can generate a random wallet", function () { - assert.equal( - randomWallet.mnemonic?.phrase.split(" ").length, - 24, - "mismatch in phrase length", - ); + after(() => provider.destroy()); + it("can generate a random wallet", function () { + assert.equal(mnemonicWalletWithoutPassKey.publicKey.length, 116); + assert.equal( + randomWallet.mnemonic?.phrase.split(" ").length, + 24, + "mismatch in phrase length", + ); - assert.equal( - isAddressable(randomWallet), - true, - "random wallet is not addressable", - ); - }); + assert.equal( + isAddressable(randomWallet), + true, + "random wallet is not addressable", + ); + }); }); describe("Test getting data from blockchain and calling smart contract", function () { - it("can currectly sign a transaction", async function () { - this.timeout(TIMEOUT_PERIOD); - const tx = await baseWallet.signTransaction(transaction); - assert.equal(tx, tesSignedTransaction, "sign transaction failed"); - }); - it("can currectly get signer from signed transaction", async function () { - this.timeout(TIMEOUT_PERIOD); - const message = "my message"; - const signedMessage = await baseWallet.signMessage(message); - const address = verifyMessage(message, signedMessage, networkIdToPrefix(3)); - assert.equal( - address, - baseWalletAddress, - "get address from signed message failed", - ); - }); - it("can get feeData ", async function () { - this.timeout(TIMEOUT_PERIOD); - const feeData = await provider.getFeeData(); - assert.equal( - feeData.energyPrice, - 1000000000n, - "mismatch in expected energy price", - ); - }); - it("can generate wallet", function () { - assert.equal( - mnemonicWallet.address.length, - 46, - "mismatch in address length", - ); - assert.equal( - mnemonicWallet.publicKey, - testPublicKey, - "mismatch in public key", - ); - assert.equal( - mnemonicWallet.address, - testAddress, - "mismatch in generated address", - ); - assert.equal( - seedWallet.address.length, - 46, - "mismatch in address length for seed wallet", - ); - assert.equal( - seedWallet.publicKey, - testPublicKey, - "mismatch in public key for seed wallet", - ); - assert.equal( - seedWallet.address, - testAddress, - "mismatch in seed length for seed wallet", - ); - assert.equal( - wallet.address.length, - 46, - "mismatch in address length for wallet", - ); - assert.equal( - wallet.publicKey, - testPublicKey, - "mismatch in public key for wallet", - ); - assert.equal( - wallet.address, - testAddress, - "mismatch in seed length for wallet", - ); - }); + it("can correctly sign a transaction", async function () { + this.timeout(TIMEOUT_PERIOD); + const tx = await baseWallet.signTransaction(transaction); + assert.equal(tx, tesSignedTransaction, "sign transaction failed"); + }); + it("can correctly get signer from signed transaction", async function () { + this.timeout(TIMEOUT_PERIOD); + const message = "my message"; + const signedMessage = await baseWallet.signMessage(message); + const address = verifyMessage(message, signedMessage, networkIdToPrefix(3)); + assert.equal( + address, + baseWalletAddress, + "get address from signed message failed", + ); + }); + (process.env.COREBC_RPC_URL ? it : it.skip)( + "can get fee data", + async function () { + this.timeout(TIMEOUT_PERIOD); + const feeData = await provider.getFeeData(); + assert.ok(feeData.energyPrice !== null && feeData.energyPrice >= 0n); + }, + ); + it("can generate wallet", function () { + assert.equal( + mnemonicWallet.address.length, + 46, + "mismatch in address length", + ); + assert.equal( + mnemonicWallet.publicKey, + testPublicKey, + "mismatch in public key", + ); + assert.equal( + mnemonicWallet.address, + testAddress, + "mismatch in generated address", + ); + assert.equal( + seedWallet.address.length, + 46, + "mismatch in address length for seed wallet", + ); + assert.equal( + seedWallet.publicKey, + testPublicKey, + "mismatch in public key for seed wallet", + ); + assert.equal( + seedWallet.address, + testAddress, + "mismatch in seed length for seed wallet", + ); + assert.equal( + wallet.address.length, + 46, + "mismatch in address length for wallet", + ); + assert.equal( + wallet.publicKey, + testPublicKey, + "mismatch in public key for wallet", + ); + assert.equal( + wallet.address, + testAddress, + "mismatch in seed length for wallet", + ); + }); }); diff --git a/src.ts/_tests/test-crypto.ts b/src.ts/_tests/test-crypto.ts new file mode 100644 index 000000000..b66ebf3bc --- /dev/null +++ b/src.ts/_tests/test-crypto.ts @@ -0,0 +1,62 @@ +import assert from "node:assert/strict"; +import { + SigningKey, + getBytes, + sha256, + ripemd160, + scryptSync, + scrypt, + keccak256, +} from "../index.js"; +import { createHash } from "../crypto/crypto-browser.js"; + +describe("updated crypto dependencies", () => { + it("matches standard hash and scrypt vectors", async () => { + assert.equal( + sha256("0x"), + "0xa7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a", + ); + assert.equal(ripemd160("0x"), "0x9c1185a5c5e9fc54612808977ee8f548b2258d31"); + assert.equal( + keccak256("0x"), + "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + ); + const expected = "0x77d6576238657b203b19ca42c18a0497"; + assert.equal(scryptSync("0x", "0x", 16, 1, 1, 16), expected); + assert.equal(await scrypt("0x", "0x", 16, 1, 1, 16), expected); + assert.deepEqual( + createHash("sha256").update(new Uint8Array()).digest(), + getBytes( + "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + ), + ); + }); + it("copies byte private keys and validates lengths", () => { + const bytes = new Uint8Array(57).fill(1); + const key = new SigningKey(bytes); + bytes.fill(2); + assert.equal(key.privateKey, "0x" + "01".repeat(57)); + for (const length of [0, 32, 56, 58]) + assert.throws(() => new SigningKey(new Uint8Array(length))); + assert.throws(() => key.sign("0x00")); + }); + it("signs, rejects tampering and derives symmetric Ed448 secrets in both key modes", () => { + const a = new SigningKey("01".repeat(57)); + const b = new SigningKey("02".repeat(56) + "80"); + const digest = sha256("0x1234"); + for (const key of [a, b]) { + const sig = key.sign(digest); + assert.equal(SigningKey.recoverPublicKey(digest, sig), key.publicKey); + assert.throws(() => SigningKey.recoverPublicKey(sha256("0x1235"), sig)); + } + assert.equal( + a.computeSharedSecret(b.publicKey), + b.computeSharedSecret(a.publicKey), + ); + assert.equal( + SigningKey.addPoints(a.publicKey, b.publicKey), + SigningKey.addPoints(b.publicKey, a.publicKey), + ); + assert.throws(() => a.computeSharedSecret("0x00")); + }); +}); diff --git a/src.ts/_tests/test-keystore.ts b/src.ts/_tests/test-keystore.ts new file mode 100644 index 000000000..dccfe38f4 --- /dev/null +++ b/src.ts/_tests/test-keystore.ts @@ -0,0 +1,63 @@ +import assert from "node:assert/strict"; +import { + Wallet, + networkIdToPrefix, + encryptKeystoreJsonSync, + encryptKeystoreJson, + decryptKeystoreJsonSync, + decryptKeystoreJson, +} from "../index.js"; + +describe("AES keystores", () => { + const wallet = Wallet.fromSeed({ + seed: "01".repeat(64), + prefix: networkIdToPrefix(3), + }); + const account = { address: wallet.address, privateKey: wallet.privateKey }; + const options = { scrypt: { N: 16, r: 1, p: 1 } }; + it("round-trips Ed448 keys with sync and async encryption", async () => { + for (const json of [ + encryptKeystoreJsonSync(account, "test", options), + await encryptKeystoreJson(account, "test", options), + ]) { + assert.deepEqual(decryptKeystoreJsonSync(json, "test"), account); + assert.deepEqual(await decryptKeystoreJson(json, "test"), account); + assert.throws( + () => decryptKeystoreJsonSync(json, "wrong"), + /incorrect password/, + ); + const changed = JSON.parse(json); + changed.Crypto.mac = "00".repeat(32); + await assert.rejects( + decryptKeystoreJson(JSON.stringify(changed), "test"), + /incorrect password/, + ); + } + }); + it("rejects unsafe KDF parameters before allocating work", () => { + for (const scrypt of [ + { N: 0 }, + { N: 1 }, + { N: 2 ** 32 }, + { r: 0 }, + { p: 2 ** 30 }, + { N: 1048576, r: 8 }, + ]) + assert.throws( + () => encryptKeystoreJsonSync(account, "test", { scrypt }), + /unsafe/, + ); + const data = JSON.parse(encryptKeystoreJsonSync(account, "test", options)); + data.Crypto.kdfparams.n = 2 ** 32; + assert.throws( + () => decryptKeystoreJsonSync(JSON.stringify(data), "test"), + /unsafe/, + ); + data.Crypto.kdf = "pbkdf2"; + Object.assign(data.Crypto.kdfparams, { c: 10000001, prf: "hmac-sha256" }); + assert.throws( + () => decryptKeystoreJsonSync(JSON.stringify(data), "test"), + /unsafe/, + ); + }); +}); diff --git a/src.ts/_tests/types.ts b/src.ts/_tests/types.ts index 50a53748f..9fdaaa951 100644 --- a/src.ts/_tests/types.ts +++ b/src.ts/_tests/types.ts @@ -1,142 +1,142 @@ export type TestCaseAbiVerbose = - | { - type: "address" | "hexstring" | "number" | "string"; - value: string; - } - | { - type: "boolean"; - value: boolean; - } - | { - type: "array"; - value: Array; - } - | { - type: "object"; - value: Array; - }; + | { + type: "address" | "hexstring" | "number" | "string"; + value: string; + } + | { + type: "boolean"; + value: boolean; + } + | { + type: "array"; + value: Array; + } + | { + type: "object"; + value: Array; + }; export interface TestCaseAbi { - name: string; - type: string; - value: any; - verbose: TestCaseAbiVerbose; - bytecode: string; - encoded: string; + name: string; + type: string; + value: any; + verbose: TestCaseAbiVerbose; + bytecode: string; + encoded: string; } ///////////////////////////// // address export interface TestCaseAccount { - name: string; - privateKey: string; - address: string; - icap: string; + name: string; + privateKey: string; + address: string; + icap: string; } export type TestCaseCreate = { - sender: string; - creates: Array<{ - name: string; - nonce: number; - address: string; - }>; + sender: string; + creates: Array<{ + name: string; + nonce: number; + address: string; + }>; }; export type TestCaseCreate2 = { - sender: string; - creates: Array<{ - name: string; - salt: string; - initCode: string; - initCodeHash: string; - address: string; - }>; + sender: string; + creates: Array<{ + name: string; + salt: string; + initCode: string; + initCodeHash: string; + address: string; + }>; }; ///////////////////////////// // crypto export interface TestCaseHash { - name: string; - data: string; - sha256: string; - sha512: string; - ripemd160: string; + name: string; + data: string; + sha256: string; + sha512: string; + ripemd160: string; } export interface TestCasePbkdf { - name: string; - password: string; - salt: string; - dkLen: number; - pbkdf2: { - iterations: number; - algorithm: "sha256" | "sha512"; - key: string; - }; - scrypt: { - N: number; - r: number; - p: number; - key: string; - }; + name: string; + password: string; + salt: string; + dkLen: number; + pbkdf2: { + iterations: number; + algorithm: "sha256" | "sha512"; + key: string; + }; + scrypt: { + N: number; + r: number; + p: number; + key: string; + }; } export interface TestCaseHmac { - name: string; - data: string; - key: string; - algorithm: "sha256" | "sha512"; - hmac: string; + name: string; + data: string; + key: string; + algorithm: "sha256" | "sha512"; + hmac: string; } ///////////////////////////// // hash export interface TestCaseHash { - name: string; - data: string; - sha256: string; - sha512: string; - ripemd160: string; + name: string; + data: string; + sha256: string; + sha512: string; + ripemd160: string; } export interface TestCaseTypedDataDomain { - name?: string; - version?: string; - networkId?: number; - verifyingContract?: string; - salt?: string; + name?: string; + version?: string; + networkId?: number; + verifyingContract?: string; + salt?: string; } export interface TestCaseTypedDataType { - name: string; - type: string; + name: string; + type: string; } export interface TestCaseTypedData { - name: string; + name: string; - domain: TestCaseTypedDataDomain; - primaryType: string; - types: Record>; - data: any; + domain: TestCaseTypedDataDomain; + primaryType: string; + types: Record>; + data: any; - encoded: string; - digest: string; + encoded: string; + digest: string; - privateKey?: string; - signature?: string; + privateKey?: string; + signature?: string; } export interface TestCaseSolidityHash { - name: string; - types: Array; - ripemd160: string; - sha256: string; - values: Array; + name: string; + types: Array; + ripemd160: string; + sha256: string; + values: Array; } ///////////////////////////// @@ -145,98 +145,98 @@ export interface TestCaseSolidityHash { export type NestedHexString = string | Array; export interface TestCaseRlp { - name: string; - encoded: string; - decoded: NestedHexString; + name: string; + encoded: string; + decoded: NestedHexString; } ///////////////////////////// // transaction export interface TestCaseTransactionTx { - to?: string; - nonce?: number; - energyLimit?: string; + to?: string; + nonce?: number; + energyLimit?: string; - energyPrice?: string; - maxFeePerEnergy?: string; + energyPrice?: string; + maxFeePerEnergy?: string; - data?: string; - value?: string; + data?: string; + value?: string; - accessList?: Array<{ address: string; storageKeys: Array }>; + accessList?: Array<{ address: string; storageKeys: Array }>; - networkId?: string; + networkId?: string; } export interface TestCaseTransactionSig { - r: string; - s: string; - v: string; + r: string; + s: string; + v: string; } export interface TestCaseTransaction { - name: string; - transaction: TestCaseTransactionTx; - privateKey: string; + name: string; + transaction: TestCaseTransactionTx; + privateKey: string; - unsignedLegacy: string; - signedLegacy: string; - unsignedEip155: string; - signedEip155: string; - unsignedBerlin: string; - signedBerlin: string; - unsignedLondon: string; - signedLondon: string; + unsignedLegacy: string; + signedLegacy: string; + unsignedEip155: string; + signedEip155: string; + unsignedBerlin: string; + signedBerlin: string; + unsignedLondon: string; + signedLondon: string; - signatureLegacy: TestCaseTransactionSig; - signatureEip155: TestCaseTransactionSig; - signatureBerlin: TestCaseTransactionSig; - signatureLondon: TestCaseTransactionSig; + signatureLegacy: TestCaseTransactionSig; + signatureEip155: TestCaseTransactionSig; + signatureBerlin: TestCaseTransactionSig; + signatureLondon: TestCaseTransactionSig; } ///////////////////////////// // wallet export interface TestCaseMnemonicNode { - path: string; - chainCode: string; - depth: number; - index: number; - parentFingerprint: string; - fingerprint: string; - publicKey: string; - privateKey: string; - xpriv: string; - xpub: string; + path: string; + chainCode: string; + depth: number; + index: number; + parentFingerprint: string; + fingerprint: string; + publicKey: string; + privateKey: string; + xpriv: string; + xpub: string; } export interface TestCaseMnemonic { - name: string; - phrase: string; - phraseHash: string; - password: string; - locale: string; - entropy: string; - seed: string; - nodes: Array; + name: string; + phrase: string; + phraseHash: string; + password: string; + locale: string; + entropy: string; + seed: string; + nodes: Array; } export interface TestCaseWallet { - name: string; - filename: string; - type: string; - address: string; - password: string; - content: string; + name: string; + filename: string; + type: string; + address: string; + password: string; + content: string; } ///////////////////////////// // wordlists export interface TestCaseWordlist { - name: string; - filename: string; - locale: string; - content: string; + name: string; + filename: string; + locale: string; + content: string; } diff --git a/src.ts/_version.ts b/src.ts/_version.ts index a49459bed..ee08390dc 100644 --- a/src.ts/_version.ts +++ b/src.ts/_version.ts @@ -1,6 +1,2 @@ -/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ - -/** - * The current version of corebc. - */ -export const version: string = "6.4.0"; +/** The current version of corebc; keep in sync with package.json. */ +export const version: string = "1.0.0"; diff --git a/src.ts/abi-types/Tes.ts b/src.ts/abi-types/Tes.ts index 031514d63..f5162db0a 100644 --- a/src.ts/abi-types/Tes.ts +++ b/src.ts/abi-types/Tes.ts @@ -2,447 +2,447 @@ /* tslint:disable */ /* eslint-disable */ import type { - BaseContract, - BigNumberish, - BytesLike, - FunctionFragment, - Result, - Interface, - EventFragment, - AddressLike, - ContractRunner, - ContractMethod, - Listener, + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, } from "../corebc.js"; import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedLogDescription, - TypedListener, - TypedContractMethod, + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, } from "./common.js"; export interface TesInterface extends Interface { - getFunction( - nameOrSignature: - | "approve" - | "balanceOf" - | "batchOwnerOf" - | "getApproved" - | "isApprovedForAll" - | "mint" - | "ownerOf" - | "safeTransferFrom(address,address,uint256)" - | "safeTransferFrom(address,address,uint256,bytes)" - | "setApprovalForAll" - | "tokenByIndex" - | "tokenOfOwnerByIndex" - | "totalSupply" - | "transferFrom", - ): FunctionFragment; - - getEvent( - nameOrSignatureOrTopic: "Approval" | "ApprovalForAll" | "Transfer", - ): EventFragment; - - encodeFunctionData( - functionFragment: "approve", - values: [AddressLike, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: "balanceOf", - values: [AddressLike], - ): string; - encodeFunctionData( - functionFragment: "batchOwnerOf", - values: [BigNumberish[]], - ): string; - encodeFunctionData( - functionFragment: "getApproved", - values: [BigNumberish], - ): string; - encodeFunctionData( - functionFragment: "isApprovedForAll", - values: [AddressLike, AddressLike], - ): string; - encodeFunctionData(functionFragment: "mint", values: [AddressLike]): string; - encodeFunctionData( - functionFragment: "ownerOf", - values: [BigNumberish], - ): string; - encodeFunctionData( - functionFragment: "safeTransferFrom(address,address,uint256)", - values: [AddressLike, AddressLike, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: "safeTransferFrom(address,address,uint256,bytes)", - values: [AddressLike, AddressLike, BigNumberish, BytesLike], - ): string; - encodeFunctionData( - functionFragment: "setApprovalForAll", - values: [AddressLike, boolean], - ): string; - encodeFunctionData( - functionFragment: "tokenByIndex", - values: [BigNumberish], - ): string; - encodeFunctionData( - functionFragment: "tokenOfOwnerByIndex", - values: [AddressLike, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: "totalSupply", - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: "transferFrom", - values: [AddressLike, AddressLike, BigNumberish], - ): string; - - decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; - decodeFunctionResult( - functionFragment: "batchOwnerOf", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "getApproved", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "isApprovedForAll", - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "ownerOf", data: BytesLike): Result; - decodeFunctionResult( - functionFragment: "safeTransferFrom(address,address,uint256)", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "safeTransferFrom(address,address,uint256,bytes)", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "setApprovalForAll", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "tokenByIndex", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "tokenOfOwnerByIndex", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "totalSupply", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "transferFrom", - data: BytesLike, - ): Result; + getFunction( + nameOrSignature: + | "approve" + | "balanceOf" + | "batchOwnerOf" + | "getApproved" + | "isApprovedForAll" + | "mint" + | "ownerOf" + | "safeTransferFrom(address,address,uint256)" + | "safeTransferFrom(address,address,uint256,bytes)" + | "setApprovalForAll" + | "tokenByIndex" + | "tokenOfOwnerByIndex" + | "totalSupply" + | "transferFrom", + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: "Approval" | "ApprovalForAll" | "Transfer", + ): EventFragment; + + encodeFunctionData( + functionFragment: "approve", + values: [AddressLike, BigNumberish], + ): string; + encodeFunctionData( + functionFragment: "balanceOf", + values: [AddressLike], + ): string; + encodeFunctionData( + functionFragment: "batchOwnerOf", + values: [BigNumberish[]], + ): string; + encodeFunctionData( + functionFragment: "getApproved", + values: [BigNumberish], + ): string; + encodeFunctionData( + functionFragment: "isApprovedForAll", + values: [AddressLike, AddressLike], + ): string; + encodeFunctionData(functionFragment: "mint", values: [AddressLike]): string; + encodeFunctionData( + functionFragment: "ownerOf", + values: [BigNumberish], + ): string; + encodeFunctionData( + functionFragment: "safeTransferFrom(address,address,uint256)", + values: [AddressLike, AddressLike, BigNumberish], + ): string; + encodeFunctionData( + functionFragment: "safeTransferFrom(address,address,uint256,bytes)", + values: [AddressLike, AddressLike, BigNumberish, BytesLike], + ): string; + encodeFunctionData( + functionFragment: "setApprovalForAll", + values: [AddressLike, boolean], + ): string; + encodeFunctionData( + functionFragment: "tokenByIndex", + values: [BigNumberish], + ): string; + encodeFunctionData( + functionFragment: "tokenOfOwnerByIndex", + values: [AddressLike, BigNumberish], + ): string; + encodeFunctionData( + functionFragment: "totalSupply", + values?: undefined, + ): string; + encodeFunctionData( + functionFragment: "transferFrom", + values: [AddressLike, AddressLike, BigNumberish], + ): string; + + decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "batchOwnerOf", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "getApproved", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "isApprovedForAll", + data: BytesLike, + ): Result; + decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "ownerOf", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "safeTransferFrom(address,address,uint256)", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "safeTransferFrom(address,address,uint256,bytes)", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "setApprovalForAll", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "tokenByIndex", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "tokenOfOwnerByIndex", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "totalSupply", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "transferFrom", + data: BytesLike, + ): Result; } export namespace ApprovalEvent { - export type InputTuple = [ - owner: AddressLike, - approved: AddressLike, - tokenId: BigNumberish, - ]; - export type OutputTuple = [owner: string, approved: string, tokenId: bigint]; - export interface OutputObject { - owner: string; - approved: string; - tokenId: bigint; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; + export type InputTuple = [ + owner: AddressLike, + approved: AddressLike, + tokenId: BigNumberish, + ]; + export type OutputTuple = [owner: string, approved: string, tokenId: bigint]; + export interface OutputObject { + owner: string; + approved: string; + tokenId: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; } export namespace ApprovalForAllEvent { - export type InputTuple = [ - owner: AddressLike, - operator: AddressLike, - approved: boolean, - ]; - export type OutputTuple = [ - owner: string, - operator: string, - approved: boolean, - ]; - export interface OutputObject { - owner: string; - operator: string; - approved: boolean; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; + export type InputTuple = [ + owner: AddressLike, + operator: AddressLike, + approved: boolean, + ]; + export type OutputTuple = [ + owner: string, + operator: string, + approved: boolean, + ]; + export interface OutputObject { + owner: string; + operator: string; + approved: boolean; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; } export namespace TransferEvent { - export type InputTuple = [ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - ]; - export type OutputTuple = [from: string, to: string, tokenId: bigint]; - export interface OutputObject { - from: string; - to: string; - tokenId: bigint; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; + export type InputTuple = [ + from: AddressLike, + to: AddressLike, + tokenId: BigNumberish, + ]; + export type OutputTuple = [from: string, to: string, tokenId: bigint]; + export interface OutputObject { + from: string; + to: string; + tokenId: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; } export interface Tes extends BaseContract { - connect(runner?: ContractRunner | null): BaseContract; - attach(addressOrName: AddressLike): this; - deployed(): Promise; - - interface: TesInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on( - event: TCEvent, - listener: TypedListener, - ): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once( - event: TCEvent, - listener: TypedListener, - ): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners( - event: TCEvent, - ): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners( - event?: TCEvent, - ): Promise; - - approve: TypedContractMethod< - [to: AddressLike, tokenId: BigNumberish], - [void], - "nonpayable" - >; - - balanceOf: TypedContractMethod<[owner: AddressLike], [bigint], "view">; - - batchOwnerOf: TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - - getApproved: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - - isApprovedForAll: TypedContractMethod< - [owner: AddressLike, operator: AddressLike], - [boolean], - "view" - >; - - mint: TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - - ownerOf: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - - "safeTransferFrom(address,address,uint256)": TypedContractMethod< - [from: AddressLike, to: AddressLike, tokenId: BigNumberish], - [void], - "nonpayable" - >; - - "safeTransferFrom(address,address,uint256,bytes)": TypedContractMethod< - [ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike, - ], - [void], - "nonpayable" - >; - - setApprovalForAll: TypedContractMethod< - [operator: AddressLike, approved: boolean], - [void], - "nonpayable" - >; - - tokenByIndex: TypedContractMethod<[index: BigNumberish], [bigint], "view">; - - tokenOfOwnerByIndex: TypedContractMethod< - [owner: AddressLike, index: BigNumberish], - [bigint], - "view" - >; - - totalSupply: TypedContractMethod<[], [bigint], "view">; - - transferFrom: TypedContractMethod< - [from: AddressLike, to: AddressLike, tokenId: BigNumberish], - [void], - "nonpayable" - >; - - getFunction( - key: string | FunctionFragment, - ): T; - - getFunction( - nameOrSignature: "approve", - ): TypedContractMethod< - [to: AddressLike, tokenId: BigNumberish], - [void], - "nonpayable" - >; - getFunction( - nameOrSignature: "balanceOf", - ): TypedContractMethod<[owner: AddressLike], [bigint], "view">; - getFunction( - nameOrSignature: "batchOwnerOf", - ): TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - getFunction( - nameOrSignature: "getApproved", - ): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction( - nameOrSignature: "isApprovedForAll", - ): TypedContractMethod< - [owner: AddressLike, operator: AddressLike], - [boolean], - "view" - >; - getFunction( - nameOrSignature: "mint", - ): TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - getFunction( - nameOrSignature: "ownerOf", - ): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction( - nameOrSignature: "safeTransferFrom(address,address,uint256)", - ): TypedContractMethod< - [from: AddressLike, to: AddressLike, tokenId: BigNumberish], - [void], - "nonpayable" - >; - getFunction( - nameOrSignature: "safeTransferFrom(address,address,uint256,bytes)", - ): TypedContractMethod< - [ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike, - ], - [void], - "nonpayable" - >; - getFunction( - nameOrSignature: "setApprovalForAll", - ): TypedContractMethod< - [operator: AddressLike, approved: boolean], - [void], - "nonpayable" - >; - getFunction( - nameOrSignature: "tokenByIndex", - ): TypedContractMethod<[index: BigNumberish], [bigint], "view">; - getFunction( - nameOrSignature: "tokenOfOwnerByIndex", - ): TypedContractMethod< - [owner: AddressLike, index: BigNumberish], - [bigint], - "view" - >; - getFunction( - nameOrSignature: "totalSupply", - ): TypedContractMethod<[], [bigint], "view">; - getFunction( - nameOrSignature: "transferFrom", - ): TypedContractMethod< - [from: AddressLike, to: AddressLike, tokenId: BigNumberish], - [void], - "nonpayable" - >; - - getEvent( - key: "Approval", - ): TypedContractEvent< - ApprovalEvent.InputTuple, - ApprovalEvent.OutputTuple, - ApprovalEvent.OutputObject - >; - getEvent( - key: "ApprovalForAll", - ): TypedContractEvent< - ApprovalForAllEvent.InputTuple, - ApprovalForAllEvent.OutputTuple, - ApprovalForAllEvent.OutputObject - >; - getEvent( - key: "Transfer", - ): TypedContractEvent< - TransferEvent.InputTuple, - TransferEvent.OutputTuple, - TransferEvent.OutputObject - >; - - filters: { - "Approval(address,address,uint256)": TypedContractEvent< - ApprovalEvent.InputTuple, - ApprovalEvent.OutputTuple, - ApprovalEvent.OutputObject - >; - Approval: TypedContractEvent< - ApprovalEvent.InputTuple, - ApprovalEvent.OutputTuple, - ApprovalEvent.OutputObject - >; - - "ApprovalForAll(address,address,bool)": TypedContractEvent< - ApprovalForAllEvent.InputTuple, - ApprovalForAllEvent.OutputTuple, - ApprovalForAllEvent.OutputObject - >; - ApprovalForAll: TypedContractEvent< - ApprovalForAllEvent.InputTuple, - ApprovalForAllEvent.OutputTuple, - ApprovalForAllEvent.OutputObject - >; - - "Transfer(address,address,uint256)": TypedContractEvent< - TransferEvent.InputTuple, - TransferEvent.OutputTuple, - TransferEvent.OutputObject - >; - Transfer: TypedContractEvent< - TransferEvent.InputTuple, - TransferEvent.OutputTuple, - TransferEvent.OutputObject - >; - }; + connect(runner?: ContractRunner | null): BaseContract; + attach(addressOrName: AddressLike): this; + deployed(): Promise; + + interface: TesInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined, + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined, + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener, + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener, + ): Promise; + + once( + event: TCEvent, + listener: TypedListener, + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener, + ): Promise; + + listeners( + event: TCEvent, + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent, + ): Promise; + + approve: TypedContractMethod< + [to: AddressLike, tokenId: BigNumberish], + [void], + "nonpayable" + >; + + balanceOf: TypedContractMethod<[owner: AddressLike], [bigint], "view">; + + batchOwnerOf: TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; + + getApproved: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; + + isApprovedForAll: TypedContractMethod< + [owner: AddressLike, operator: AddressLike], + [boolean], + "view" + >; + + mint: TypedContractMethod<[to: AddressLike], [void], "nonpayable">; + + ownerOf: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; + + "safeTransferFrom(address,address,uint256)": TypedContractMethod< + [from: AddressLike, to: AddressLike, tokenId: BigNumberish], + [void], + "nonpayable" + >; + + "safeTransferFrom(address,address,uint256,bytes)": TypedContractMethod< + [ + from: AddressLike, + to: AddressLike, + tokenId: BigNumberish, + data: BytesLike, + ], + [void], + "nonpayable" + >; + + setApprovalForAll: TypedContractMethod< + [operator: AddressLike, approved: boolean], + [void], + "nonpayable" + >; + + tokenByIndex: TypedContractMethod<[index: BigNumberish], [bigint], "view">; + + tokenOfOwnerByIndex: TypedContractMethod< + [owner: AddressLike, index: BigNumberish], + [bigint], + "view" + >; + + totalSupply: TypedContractMethod<[], [bigint], "view">; + + transferFrom: TypedContractMethod< + [from: AddressLike, to: AddressLike, tokenId: BigNumberish], + [void], + "nonpayable" + >; + + getFunction( + key: string | FunctionFragment, + ): T; + + getFunction( + nameOrSignature: "approve", + ): TypedContractMethod< + [to: AddressLike, tokenId: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "balanceOf", + ): TypedContractMethod<[owner: AddressLike], [bigint], "view">; + getFunction( + nameOrSignature: "batchOwnerOf", + ): TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; + getFunction( + nameOrSignature: "getApproved", + ): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; + getFunction( + nameOrSignature: "isApprovedForAll", + ): TypedContractMethod< + [owner: AddressLike, operator: AddressLike], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "mint", + ): TypedContractMethod<[to: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "ownerOf", + ): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; + getFunction( + nameOrSignature: "safeTransferFrom(address,address,uint256)", + ): TypedContractMethod< + [from: AddressLike, to: AddressLike, tokenId: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "safeTransferFrom(address,address,uint256,bytes)", + ): TypedContractMethod< + [ + from: AddressLike, + to: AddressLike, + tokenId: BigNumberish, + data: BytesLike, + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setApprovalForAll", + ): TypedContractMethod< + [operator: AddressLike, approved: boolean], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "tokenByIndex", + ): TypedContractMethod<[index: BigNumberish], [bigint], "view">; + getFunction( + nameOrSignature: "tokenOfOwnerByIndex", + ): TypedContractMethod< + [owner: AddressLike, index: BigNumberish], + [bigint], + "view" + >; + getFunction( + nameOrSignature: "totalSupply", + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "transferFrom", + ): TypedContractMethod< + [from: AddressLike, to: AddressLike, tokenId: BigNumberish], + [void], + "nonpayable" + >; + + getEvent( + key: "Approval", + ): TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + getEvent( + key: "ApprovalForAll", + ): TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + getEvent( + key: "Transfer", + ): TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + + filters: { + "Approval(address,address,uint256)": TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + Approval: TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + + "ApprovalForAll(address,address,bool)": TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + ApprovalForAll: TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + + "Transfer(address,address,uint256)": TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + Transfer: TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + }; } diff --git a/src.ts/abi-types/Tes_abi.ts b/src.ts/abi-types/Tes_abi.ts index 5639c55e8..38c007b26 100644 --- a/src.ts/abi-types/Tes_abi.ts +++ b/src.ts/abi-types/Tes_abi.ts @@ -2,447 +2,447 @@ /* tslint:disable */ /* eslint-disable */ import type { - BaseContract, - BigNumberish, - BytesLike, - FunctionFragment, - Result, - Interface, - EventFragment, - AddressLike, - ContractRunner, - ContractMethod, - Listener, + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, } from "../corebc.js"; import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedLogDescription, - TypedListener, - TypedContractMethod, + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, } from "./common.js"; export interface Tes_abiInterface extends Interface { - getFunction( - nameOrSignature: - | "approve" - | "balanceOf" - | "batchOwnerOf" - | "getApproved" - | "isApprovedForAll" - | "mint" - | "ownerOf" - | "safeTransferFrom(address,address,uint256)" - | "safeTransferFrom(address,address,uint256,bytes)" - | "setApprovalForAll" - | "tokenByIndex" - | "tokenOfOwnerByIndex" - | "totalSupply" - | "transferFrom", - ): FunctionFragment; - - getEvent( - nameOrSignatureOrTopic: "Approval" | "ApprovalForAll" | "Transfer", - ): EventFragment; - - encodeFunctionData( - functionFragment: "approve", - values: [AddressLike, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: "balanceOf", - values: [AddressLike], - ): string; - encodeFunctionData( - functionFragment: "batchOwnerOf", - values: [BigNumberish[]], - ): string; - encodeFunctionData( - functionFragment: "getApproved", - values: [BigNumberish], - ): string; - encodeFunctionData( - functionFragment: "isApprovedForAll", - values: [AddressLike, AddressLike], - ): string; - encodeFunctionData(functionFragment: "mint", values: [AddressLike]): string; - encodeFunctionData( - functionFragment: "ownerOf", - values: [BigNumberish], - ): string; - encodeFunctionData( - functionFragment: "safeTransferFrom(address,address,uint256)", - values: [AddressLike, AddressLike, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: "safeTransferFrom(address,address,uint256,bytes)", - values: [AddressLike, AddressLike, BigNumberish, BytesLike], - ): string; - encodeFunctionData( - functionFragment: "setApprovalForAll", - values: [AddressLike, boolean], - ): string; - encodeFunctionData( - functionFragment: "tokenByIndex", - values: [BigNumberish], - ): string; - encodeFunctionData( - functionFragment: "tokenOfOwnerByIndex", - values: [AddressLike, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: "totalSupply", - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: "transferFrom", - values: [AddressLike, AddressLike, BigNumberish], - ): string; - - decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; - decodeFunctionResult( - functionFragment: "batchOwnerOf", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "getApproved", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "isApprovedForAll", - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "ownerOf", data: BytesLike): Result; - decodeFunctionResult( - functionFragment: "safeTransferFrom(address,address,uint256)", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "safeTransferFrom(address,address,uint256,bytes)", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "setApprovalForAll", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "tokenByIndex", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "tokenOfOwnerByIndex", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "totalSupply", - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: "transferFrom", - data: BytesLike, - ): Result; + getFunction( + nameOrSignature: + | "approve" + | "balanceOf" + | "batchOwnerOf" + | "getApproved" + | "isApprovedForAll" + | "mint" + | "ownerOf" + | "safeTransferFrom(address,address,uint256)" + | "safeTransferFrom(address,address,uint256,bytes)" + | "setApprovalForAll" + | "tokenByIndex" + | "tokenOfOwnerByIndex" + | "totalSupply" + | "transferFrom", + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: "Approval" | "ApprovalForAll" | "Transfer", + ): EventFragment; + + encodeFunctionData( + functionFragment: "approve", + values: [AddressLike, BigNumberish], + ): string; + encodeFunctionData( + functionFragment: "balanceOf", + values: [AddressLike], + ): string; + encodeFunctionData( + functionFragment: "batchOwnerOf", + values: [BigNumberish[]], + ): string; + encodeFunctionData( + functionFragment: "getApproved", + values: [BigNumberish], + ): string; + encodeFunctionData( + functionFragment: "isApprovedForAll", + values: [AddressLike, AddressLike], + ): string; + encodeFunctionData(functionFragment: "mint", values: [AddressLike]): string; + encodeFunctionData( + functionFragment: "ownerOf", + values: [BigNumberish], + ): string; + encodeFunctionData( + functionFragment: "safeTransferFrom(address,address,uint256)", + values: [AddressLike, AddressLike, BigNumberish], + ): string; + encodeFunctionData( + functionFragment: "safeTransferFrom(address,address,uint256,bytes)", + values: [AddressLike, AddressLike, BigNumberish, BytesLike], + ): string; + encodeFunctionData( + functionFragment: "setApprovalForAll", + values: [AddressLike, boolean], + ): string; + encodeFunctionData( + functionFragment: "tokenByIndex", + values: [BigNumberish], + ): string; + encodeFunctionData( + functionFragment: "tokenOfOwnerByIndex", + values: [AddressLike, BigNumberish], + ): string; + encodeFunctionData( + functionFragment: "totalSupply", + values?: undefined, + ): string; + encodeFunctionData( + functionFragment: "transferFrom", + values: [AddressLike, AddressLike, BigNumberish], + ): string; + + decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "batchOwnerOf", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "getApproved", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "isApprovedForAll", + data: BytesLike, + ): Result; + decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "ownerOf", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "safeTransferFrom(address,address,uint256)", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "safeTransferFrom(address,address,uint256,bytes)", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "setApprovalForAll", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "tokenByIndex", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "tokenOfOwnerByIndex", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "totalSupply", + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: "transferFrom", + data: BytesLike, + ): Result; } export namespace ApprovalEvent { - export type InputTuple = [ - owner: AddressLike, - approved: AddressLike, - tokenId: BigNumberish, - ]; - export type OutputTuple = [owner: string, approved: string, tokenId: bigint]; - export interface OutputObject { - owner: string; - approved: string; - tokenId: bigint; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; + export type InputTuple = [ + owner: AddressLike, + approved: AddressLike, + tokenId: BigNumberish, + ]; + export type OutputTuple = [owner: string, approved: string, tokenId: bigint]; + export interface OutputObject { + owner: string; + approved: string; + tokenId: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; } export namespace ApprovalForAllEvent { - export type InputTuple = [ - owner: AddressLike, - operator: AddressLike, - approved: boolean, - ]; - export type OutputTuple = [ - owner: string, - operator: string, - approved: boolean, - ]; - export interface OutputObject { - owner: string; - operator: string; - approved: boolean; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; + export type InputTuple = [ + owner: AddressLike, + operator: AddressLike, + approved: boolean, + ]; + export type OutputTuple = [ + owner: string, + operator: string, + approved: boolean, + ]; + export interface OutputObject { + owner: string; + operator: string; + approved: boolean; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; } export namespace TransferEvent { - export type InputTuple = [ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - ]; - export type OutputTuple = [from: string, to: string, tokenId: bigint]; - export interface OutputObject { - from: string; - to: string; - tokenId: bigint; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; + export type InputTuple = [ + from: AddressLike, + to: AddressLike, + tokenId: BigNumberish, + ]; + export type OutputTuple = [from: string, to: string, tokenId: bigint]; + export interface OutputObject { + from: string; + to: string; + tokenId: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; } export interface Tes_abi extends BaseContract { - connect(runner?: ContractRunner | null): BaseContract; - attach(addressOrName: AddressLike): this; - deployed(): Promise; - - interface: Tes_abiInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on( - event: TCEvent, - listener: TypedListener, - ): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once( - event: TCEvent, - listener: TypedListener, - ): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners( - event: TCEvent, - ): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners( - event?: TCEvent, - ): Promise; - - approve: TypedContractMethod< - [to: AddressLike, tokenId: BigNumberish], - [void], - "nonpayable" - >; - - balanceOf: TypedContractMethod<[owner: AddressLike], [bigint], "view">; - - batchOwnerOf: TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - - getApproved: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - - isApprovedForAll: TypedContractMethod< - [owner: AddressLike, operator: AddressLike], - [boolean], - "view" - >; - - mint: TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - - ownerOf: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - - "safeTransferFrom(address,address,uint256)": TypedContractMethod< - [from: AddressLike, to: AddressLike, tokenId: BigNumberish], - [void], - "nonpayable" - >; - - "safeTransferFrom(address,address,uint256,bytes)": TypedContractMethod< - [ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike, - ], - [void], - "nonpayable" - >; - - setApprovalForAll: TypedContractMethod< - [operator: AddressLike, approved: boolean], - [void], - "nonpayable" - >; - - tokenByIndex: TypedContractMethod<[index: BigNumberish], [bigint], "view">; - - tokenOfOwnerByIndex: TypedContractMethod< - [owner: AddressLike, index: BigNumberish], - [bigint], - "view" - >; - - totalSupply: TypedContractMethod<[], [bigint], "view">; - - transferFrom: TypedContractMethod< - [from: AddressLike, to: AddressLike, tokenId: BigNumberish], - [void], - "nonpayable" - >; - - getFunction( - key: string | FunctionFragment, - ): T; - - getFunction( - nameOrSignature: "approve", - ): TypedContractMethod< - [to: AddressLike, tokenId: BigNumberish], - [void], - "nonpayable" - >; - getFunction( - nameOrSignature: "balanceOf", - ): TypedContractMethod<[owner: AddressLike], [bigint], "view">; - getFunction( - nameOrSignature: "batchOwnerOf", - ): TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - getFunction( - nameOrSignature: "getApproved", - ): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction( - nameOrSignature: "isApprovedForAll", - ): TypedContractMethod< - [owner: AddressLike, operator: AddressLike], - [boolean], - "view" - >; - getFunction( - nameOrSignature: "mint", - ): TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - getFunction( - nameOrSignature: "ownerOf", - ): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction( - nameOrSignature: "safeTransferFrom(address,address,uint256)", - ): TypedContractMethod< - [from: AddressLike, to: AddressLike, tokenId: BigNumberish], - [void], - "nonpayable" - >; - getFunction( - nameOrSignature: "safeTransferFrom(address,address,uint256,bytes)", - ): TypedContractMethod< - [ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike, - ], - [void], - "nonpayable" - >; - getFunction( - nameOrSignature: "setApprovalForAll", - ): TypedContractMethod< - [operator: AddressLike, approved: boolean], - [void], - "nonpayable" - >; - getFunction( - nameOrSignature: "tokenByIndex", - ): TypedContractMethod<[index: BigNumberish], [bigint], "view">; - getFunction( - nameOrSignature: "tokenOfOwnerByIndex", - ): TypedContractMethod< - [owner: AddressLike, index: BigNumberish], - [bigint], - "view" - >; - getFunction( - nameOrSignature: "totalSupply", - ): TypedContractMethod<[], [bigint], "view">; - getFunction( - nameOrSignature: "transferFrom", - ): TypedContractMethod< - [from: AddressLike, to: AddressLike, tokenId: BigNumberish], - [void], - "nonpayable" - >; - - getEvent( - key: "Approval", - ): TypedContractEvent< - ApprovalEvent.InputTuple, - ApprovalEvent.OutputTuple, - ApprovalEvent.OutputObject - >; - getEvent( - key: "ApprovalForAll", - ): TypedContractEvent< - ApprovalForAllEvent.InputTuple, - ApprovalForAllEvent.OutputTuple, - ApprovalForAllEvent.OutputObject - >; - getEvent( - key: "Transfer", - ): TypedContractEvent< - TransferEvent.InputTuple, - TransferEvent.OutputTuple, - TransferEvent.OutputObject - >; - - filters: { - "Approval(address,address,uint256)": TypedContractEvent< - ApprovalEvent.InputTuple, - ApprovalEvent.OutputTuple, - ApprovalEvent.OutputObject - >; - Approval: TypedContractEvent< - ApprovalEvent.InputTuple, - ApprovalEvent.OutputTuple, - ApprovalEvent.OutputObject - >; - - "ApprovalForAll(address,address,bool)": TypedContractEvent< - ApprovalForAllEvent.InputTuple, - ApprovalForAllEvent.OutputTuple, - ApprovalForAllEvent.OutputObject - >; - ApprovalForAll: TypedContractEvent< - ApprovalForAllEvent.InputTuple, - ApprovalForAllEvent.OutputTuple, - ApprovalForAllEvent.OutputObject - >; - - "Transfer(address,address,uint256)": TypedContractEvent< - TransferEvent.InputTuple, - TransferEvent.OutputTuple, - TransferEvent.OutputObject - >; - Transfer: TypedContractEvent< - TransferEvent.InputTuple, - TransferEvent.OutputTuple, - TransferEvent.OutputObject - >; - }; + connect(runner?: ContractRunner | null): BaseContract; + attach(addressOrName: AddressLike): this; + deployed(): Promise; + + interface: Tes_abiInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined, + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined, + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener, + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener, + ): Promise; + + once( + event: TCEvent, + listener: TypedListener, + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener, + ): Promise; + + listeners( + event: TCEvent, + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent, + ): Promise; + + approve: TypedContractMethod< + [to: AddressLike, tokenId: BigNumberish], + [void], + "nonpayable" + >; + + balanceOf: TypedContractMethod<[owner: AddressLike], [bigint], "view">; + + batchOwnerOf: TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; + + getApproved: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; + + isApprovedForAll: TypedContractMethod< + [owner: AddressLike, operator: AddressLike], + [boolean], + "view" + >; + + mint: TypedContractMethod<[to: AddressLike], [void], "nonpayable">; + + ownerOf: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; + + "safeTransferFrom(address,address,uint256)": TypedContractMethod< + [from: AddressLike, to: AddressLike, tokenId: BigNumberish], + [void], + "nonpayable" + >; + + "safeTransferFrom(address,address,uint256,bytes)": TypedContractMethod< + [ + from: AddressLike, + to: AddressLike, + tokenId: BigNumberish, + data: BytesLike, + ], + [void], + "nonpayable" + >; + + setApprovalForAll: TypedContractMethod< + [operator: AddressLike, approved: boolean], + [void], + "nonpayable" + >; + + tokenByIndex: TypedContractMethod<[index: BigNumberish], [bigint], "view">; + + tokenOfOwnerByIndex: TypedContractMethod< + [owner: AddressLike, index: BigNumberish], + [bigint], + "view" + >; + + totalSupply: TypedContractMethod<[], [bigint], "view">; + + transferFrom: TypedContractMethod< + [from: AddressLike, to: AddressLike, tokenId: BigNumberish], + [void], + "nonpayable" + >; + + getFunction( + key: string | FunctionFragment, + ): T; + + getFunction( + nameOrSignature: "approve", + ): TypedContractMethod< + [to: AddressLike, tokenId: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "balanceOf", + ): TypedContractMethod<[owner: AddressLike], [bigint], "view">; + getFunction( + nameOrSignature: "batchOwnerOf", + ): TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; + getFunction( + nameOrSignature: "getApproved", + ): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; + getFunction( + nameOrSignature: "isApprovedForAll", + ): TypedContractMethod< + [owner: AddressLike, operator: AddressLike], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "mint", + ): TypedContractMethod<[to: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "ownerOf", + ): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; + getFunction( + nameOrSignature: "safeTransferFrom(address,address,uint256)", + ): TypedContractMethod< + [from: AddressLike, to: AddressLike, tokenId: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "safeTransferFrom(address,address,uint256,bytes)", + ): TypedContractMethod< + [ + from: AddressLike, + to: AddressLike, + tokenId: BigNumberish, + data: BytesLike, + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setApprovalForAll", + ): TypedContractMethod< + [operator: AddressLike, approved: boolean], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "tokenByIndex", + ): TypedContractMethod<[index: BigNumberish], [bigint], "view">; + getFunction( + nameOrSignature: "tokenOfOwnerByIndex", + ): TypedContractMethod< + [owner: AddressLike, index: BigNumberish], + [bigint], + "view" + >; + getFunction( + nameOrSignature: "totalSupply", + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "transferFrom", + ): TypedContractMethod< + [from: AddressLike, to: AddressLike, tokenId: BigNumberish], + [void], + "nonpayable" + >; + + getEvent( + key: "Approval", + ): TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + getEvent( + key: "ApprovalForAll", + ): TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + getEvent( + key: "Transfer", + ): TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + + filters: { + "Approval(address,address,uint256)": TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + Approval: TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + + "ApprovalForAll(address,address,bool)": TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + ApprovalForAll: TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + + "Transfer(address,address,uint256)": TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + Transfer: TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + }; } diff --git a/src.ts/abi-types/common.ts b/src.ts/abi-types/common.ts index 2aee3c6dc..f7556774a 100644 --- a/src.ts/abi-types/common.ts +++ b/src.ts/abi-types/common.ts @@ -5,132 +5,121 @@ /* tslint:disable */ /* eslint-disable */ import type { - FunctionFragment, - Typed, - EventFragment, - ContractTransaction, - ContractTransactionResponse, - DeferredTopicFilter, - EventLog, - TransactionRequest, - LogDescription, + FunctionFragment, + Typed, + EventFragment, + ContractTransaction, + ContractTransactionResponse, + DeferredTopicFilter, + EventLog, + TransactionRequest, + LogDescription, } from "../corebc.js"; -export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> - extends DeferredTopicFilter {} +export interface TypedDeferredTopicFilter< + _TCEvent extends TypedContractEvent, +> extends DeferredTopicFilter {} export interface TypedContractEvent< - InputTuple extends Array = any, - OutputTuple extends Array = any, - OutputObject = any, + InputTuple extends Array = any, + OutputTuple extends Array = any, + OutputObject = any, > { - ( - ...args: Partial - ): TypedDeferredTopicFilter< - TypedContractEvent - >; - name: string; - fragment: EventFragment; - getFragment(...args: Partial): EventFragment; + ( + ...args: Partial + ): TypedDeferredTopicFilter< + TypedContractEvent + >; + name: string; + fragment: EventFragment; + getFragment(...args: Partial): EventFragment; } -type __TypechainAOutputTuple = T extends TypedContractEvent< - infer _U, - infer W -> - ? W - : never; -type __TypechainOutputObject = T extends TypedContractEvent< - infer _U, - infer _W, - infer V -> - ? V - : never; - -export interface TypedEventLog - extends Omit { - args: __TypechainAOutputTuple & __TypechainOutputObject; +type __TypechainAOutputTuple = + T extends TypedContractEvent ? W : never; +type __TypechainOutputObject = + T extends TypedContractEvent ? V : never; + +export interface TypedEventLog extends Omit< + EventLog, + "args" +> { + args: __TypechainAOutputTuple & __TypechainOutputObject; } -export interface TypedLogDescription - extends Omit { - args: __TypechainAOutputTuple & __TypechainOutputObject; +export interface TypedLogDescription< + TCEvent extends TypedContractEvent, +> extends Omit { + args: __TypechainAOutputTuple & __TypechainOutputObject; } export type TypedListener = ( - ...listenerArg: [ - ...__TypechainAOutputTuple, - TypedEventLog, - ...undefined[], - ] + ...listenerArg: [ + ...__TypechainAOutputTuple, + TypedEventLog, + ...undefined[], + ] ) => void; export type MinCoreBCFactory = { - deploy(...a: ARGS[]): Promise; + deploy(...a: ARGS[]): Promise; }; -export type GetContractTypeFromFactory = F extends MinCoreBCFactory< - infer C, - any -> - ? C - : never; -export type GetARGsTypeFromFactory = F extends MinCoreBCFactory - ? Parameters - : never; +export type GetContractTypeFromFactory = + F extends MinCoreBCFactory ? C : never; +export type GetARGsTypeFromFactory = + F extends MinCoreBCFactory ? Parameters : never; export type StateMutability = "nonpayable" | "payable" | "view"; export type BaseOverrides = Omit; export type NonPayableOverrides = Omit< - BaseOverrides, - "value" | "blockTag" | "enableCcipRead" + BaseOverrides, + "value" | "blockTag" | "enableCcipRead" >; export type PayableOverrides = Omit< - BaseOverrides, - "blockTag" | "enableCcipRead" + BaseOverrides, + "blockTag" | "enableCcipRead" >; export type ViewOverrides = Omit; export type Overrides = S extends "nonpayable" - ? NonPayableOverrides - : S extends "payable" - ? PayableOverrides - : ViewOverrides; + ? NonPayableOverrides + : S extends "payable" + ? PayableOverrides + : ViewOverrides; export type PostfixOverrides, S extends StateMutability> = - | A - | [...A, Overrides]; + A | [...A, Overrides]; export type ContractMethodArgs< - A extends Array, - S extends StateMutability, + A extends Array, + S extends StateMutability, > = PostfixOverrides<{ [I in keyof A]-?: A[I] | Typed }, S>; export type DefaultReturnType = R extends Array ? R[0] : R; // export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { export interface TypedContractMethod< - A extends Array = Array, - R = any, - S extends StateMutability = "payable", + A extends Array = Array, + R = any, + S extends StateMutability = "payable", > { - ( - ...args: ContractMethodArgs - ): S extends "view" - ? Promise> - : Promise; + ( + ...args: ContractMethodArgs + ): S extends "view" + ? Promise> + : Promise; - name: string; + name: string; - fragment: FunctionFragment; + fragment: FunctionFragment; - getFragment(...args: ContractMethodArgs): FunctionFragment; + getFragment(...args: ContractMethodArgs): FunctionFragment; - populateTransaction( - ...args: ContractMethodArgs - ): Promise; - staticCall(...args: ContractMethodArgs): Promise>; - send(...args: ContractMethodArgs): Promise; - estimateGas(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; + populateTransaction( + ...args: ContractMethodArgs + ): Promise; + staticCall(...args: ContractMethodArgs): Promise>; + send(...args: ContractMethodArgs): Promise; + estimateGas(...args: ContractMethodArgs): Promise; + staticCallResult(...args: ContractMethodArgs): Promise; } diff --git a/src.ts/abi-types/factories/Tes__factory.ts b/src.ts/abi-types/factories/Tes__factory.ts index 8eca4cb60..bd57a1633 100644 --- a/src.ts/abi-types/factories/Tes__factory.ts +++ b/src.ts/abi-types/factories/Tes__factory.ts @@ -6,368 +6,368 @@ import { Contract, ContractRunner, Interface } from "../../corebc.js"; import type { Tes, TesInterface } from "../Tes.js"; const _abi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "approved", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "Approval", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "operator", - type: "address", - }, - { - indexed: false, - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "ApprovalForAll", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "to", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "Transfer", - type: "event", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "approve", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "balanceOf", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256[]", - name: "ids", - type: "uint256[]", - }, - ], - name: "batchOwnerOf", - outputs: [ - { - internalType: "address[]", - name: "", - type: "address[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "getApproved", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "operator", - type: "address", - }, - ], - name: "isApprovedForAll", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - ], - name: "mint", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "ownerOf", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - { - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "setApprovalForAll", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "index", - type: "uint256", - }, - ], - name: "tokenByIndex", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "uint256", - name: "index", - type: "uint256", - }, - ], - name: "tokenOfOwnerByIndex", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "totalSupply", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "transferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "approved", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "ApprovalForAll", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256[]", + name: "ids", + type: "uint256[]", + }, + ], + name: "batchOwnerOf", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "getApproved", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "address", + name: "operator", + type: "address", + }, + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + ], + name: "mint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "ownerOf", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address", + }, + { + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "tokenByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "tokenOfOwnerByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "transferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, ] as const; export class Tes__factory { - static readonly abi = _abi; - static createInterface(): TesInterface { - return new Interface(_abi) as TesInterface; - } - static connect(address: string, runner?: ContractRunner | null): Tes { - return new Contract(address, _abi, runner) as unknown as Tes; - } + static readonly abi = _abi; + static createInterface(): TesInterface { + return new Interface(_abi) as TesInterface; + } + static connect(address: string, runner?: ContractRunner | null): Tes { + return new Contract(address, _abi, runner) as unknown as Tes; + } } diff --git a/src.ts/abi-types/factories/Tes_abi__factory.ts b/src.ts/abi-types/factories/Tes_abi__factory.ts index 5d7ed54c0..d6ee0b6db 100644 --- a/src.ts/abi-types/factories/Tes_abi__factory.ts +++ b/src.ts/abi-types/factories/Tes_abi__factory.ts @@ -6,368 +6,368 @@ import { Contract, ContractRunner, Interface } from "../../corebc.js"; import type { Tes_abi, Tes_abiInterface } from "../Tes_abi.js"; const _abi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "approved", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "Approval", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "operator", - type: "address", - }, - { - indexed: false, - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "ApprovalForAll", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "to", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "Transfer", - type: "event", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "approve", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "balanceOf", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256[]", - name: "ids", - type: "uint256[]", - }, - ], - name: "batchOwnerOf", - outputs: [ - { - internalType: "address[]", - name: "", - type: "address[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "getApproved", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "operator", - type: "address", - }, - ], - name: "isApprovedForAll", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - ], - name: "mint", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "ownerOf", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - { - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "setApprovalForAll", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "index", - type: "uint256", - }, - ], - name: "tokenByIndex", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "uint256", - name: "index", - type: "uint256", - }, - ], - name: "tokenOfOwnerByIndex", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "totalSupply", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "transferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "approved", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "ApprovalForAll", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256[]", + name: "ids", + type: "uint256[]", + }, + ], + name: "batchOwnerOf", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "getApproved", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "address", + name: "operator", + type: "address", + }, + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + ], + name: "mint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "ownerOf", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address", + }, + { + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "tokenByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "tokenOfOwnerByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "transferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, ] as const; export class Tes_abi__factory { - static readonly abi = _abi; - static createInterface(): Tes_abiInterface { - return new Interface(_abi) as Tes_abiInterface; - } - static connect(address: string, runner?: ContractRunner | null): Tes_abi { - return new Contract(address, _abi, runner) as unknown as Tes_abi; - } + static readonly abi = _abi; + static createInterface(): Tes_abiInterface { + return new Interface(_abi) as Tes_abiInterface; + } + static connect(address: string, runner?: ContractRunner | null): Tes_abi { + return new Contract(address, _abi, runner) as unknown as Tes_abi; + } } diff --git a/src.ts/abi/abi-coder.ts b/src.ts/abi/abi-coder.ts index d84ad2182..e45eecb22 100644 --- a/src.ts/abi/abi-coder.ts +++ b/src.ts/abi/abi-coder.ts @@ -29,10 +29,10 @@ import { getAddress } from "../address/index.js"; import { getBytes, hexlify, makeError } from "../utils/index.js"; import type { - BytesLike, - CallExceptionAction, - CallExceptionError, - CallExceptionTransaction, + BytesLike, + CallExceptionAction, + CallExceptionError, + CallExceptionTransaction, } from "../utils/index.js"; // https://docs.soliditylang.org/en/v0.8.17/control-structures.html @@ -54,224 +54,224 @@ const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); let defaultCoder: null | AbiCoder = null; function getBuiltinCallException( - action: CallExceptionAction, - tx: { to?: null | string; from?: null | string; data?: string }, - data: null | BytesLike, - abiCoder: AbiCoder, + action: CallExceptionAction, + tx: { to?: null | string; from?: null | string; data?: string }, + data: null | BytesLike, + abiCoder: AbiCoder, ): CallExceptionError { - let message = "missing revert data"; + let message = "missing revert data"; - let reason: null | string = null; - const invocation = null; - let revert: null | { signature: string; name: string; args: Array } = - null; + let reason: null | string = null; + const invocation = null; + let revert: null | { signature: string; name: string; args: Array } = + null; - if (data) { - message = "execution reverted"; + if (data) { + message = "execution reverted"; - const bytes = getBytes(data); - data = hexlify(data); + const bytes = getBytes(data); + data = hexlify(data); - if (bytes.length === 0) { - message += " (no data present; likely require(false) occurred"; - reason = "require(false)"; - } else if (bytes.length % 32 !== 4) { - message += " (could not decode reason; invalid data length)"; - } else if (hexlify(bytes.slice(0, 4)) === "0x08c379a0") { - // Error(string) - try { - reason = abiCoder.decode(["string"], bytes.slice(4))[0]; - revert = { - signature: "Error(string)", - name: "Error", - args: [reason], - }; - message += `: ${JSON.stringify(reason)}`; - } catch (error) { - message += " (could not decode reason; invalid string data)"; - } - } else if (hexlify(bytes.slice(0, 4)) === "0x4e487b71") { - // Panic(uint256) - try { - const code = Number(abiCoder.decode(["uint256"], bytes.slice(4))[0]); - revert = { - signature: "Panic(uint256)", - name: "Panic", - args: [code], - }; - reason = `Panic due to ${PanicReasons.get(code) || "UNKNOWN"}(${code})`; - message += `: ${reason}`; - } catch (error) { - message += " (could not decode panic code)"; - } - } else { - message += " (unknown custom error)"; - } - } + if (bytes.length === 0) { + message += " (no data present; likely require(false) occurred"; + reason = "require(false)"; + } else if (bytes.length % 32 !== 4) { + message += " (could not decode reason; invalid data length)"; + } else if (hexlify(bytes.slice(0, 4)) === "0x08c379a0") { + // Error(string) + try { + reason = abiCoder.decode(["string"], bytes.slice(4))[0]; + revert = { + signature: "Error(string)", + name: "Error", + args: [reason], + }; + message += `: ${JSON.stringify(reason)}`; + } catch (error) { + message += " (could not decode reason; invalid string data)"; + } + } else if (hexlify(bytes.slice(0, 4)) === "0x4e487b71") { + // Panic(uint256) + try { + const code = Number(abiCoder.decode(["uint256"], bytes.slice(4))[0]); + revert = { + signature: "Panic(uint256)", + name: "Panic", + args: [code], + }; + reason = `Panic due to ${PanicReasons.get(code) || "UNKNOWN"}(${code})`; + message += `: ${reason}`; + } catch (error) { + message += " (could not decode panic code)"; + } + } else { + message += " (unknown custom error)"; + } + } - const transaction: CallExceptionTransaction = { - to: tx.to ? getAddress(tx.to) : null, - data: tx.data || "0x", - }; - if (tx.from) { - transaction.from = getAddress(tx.from); - } + const transaction: CallExceptionTransaction = { + to: tx.to ? getAddress(tx.to) : null, + data: tx.data || "0x", + }; + if (tx.from) { + transaction.from = getAddress(tx.from); + } - return makeError(message, "CALL_EXCEPTION", { - action, - data, - reason, - transaction, - invocation, - revert, - }); + return makeError(message, "CALL_EXCEPTION", { + action, + data, + reason, + transaction, + invocation, + revert, + }); } /** * About AbiCoder */ export class AbiCoder { - #getCoder(param: ParamType): Coder { - if (param.isArray()) { - return new ArrayCoder( - this.#getCoder(param.arrayChildren), - param.arrayLength, - param.name, - ); - } + #getCoder(param: ParamType): Coder { + if (param.isArray()) { + return new ArrayCoder( + this.#getCoder(param.arrayChildren), + param.arrayLength, + param.name, + ); + } - if (param.isTuple()) { - return new TupleCoder( - param.components.map((c) => this.#getCoder(c)), - param.name, - ); - } + if (param.isTuple()) { + return new TupleCoder( + param.components.map((c) => this.#getCoder(c)), + param.name, + ); + } - switch (param.baseType) { - case "address": - return new AddressCoder(param.name); - case "bool": - return new BooleanCoder(param.name); - case "string": - return new StringCoder(param.name); - case "bytes": - return new BytesCoder(param.name); - case "": - return new NullCoder(param.name); - } + switch (param.baseType) { + case "address": + return new AddressCoder(param.name); + case "bool": + return new BooleanCoder(param.name); + case "string": + return new StringCoder(param.name); + case "bytes": + return new BytesCoder(param.name); + case "": + return new NullCoder(param.name); + } - // u?int[0-9]* - let match = param.type.match(paramTypeNumber); - if (match) { - let size = parseInt(match[2] || "256"); - assertArgument( - size !== 0 && size <= 256 && size % 8 === 0, - "invalid " + match[1] + " bit length", - "param", - param, - ); - return new NumberCoder(size / 8, match[1] === "int", param.name); - } + // u?int[0-9]* + let match = param.type.match(paramTypeNumber); + if (match) { + let size = parseInt(match[2] || "256"); + assertArgument( + size !== 0 && size <= 256 && size % 8 === 0, + "invalid " + match[1] + " bit length", + "param", + param, + ); + return new NumberCoder(size / 8, match[1] === "int", param.name); + } - // bytes[0-9]+ - match = param.type.match(paramTypeBytes); - if (match) { - let size = parseInt(match[1]); - assertArgument( - size !== 0 && size <= 32, - "invalid bytes length", - "param", - param, - ); - return new FixedBytesCoder(size, param.name); - } + // bytes[0-9]+ + match = param.type.match(paramTypeBytes); + if (match) { + let size = parseInt(match[1]); + assertArgument( + size !== 0 && size <= 32, + "invalid bytes length", + "param", + param, + ); + return new FixedBytesCoder(size, param.name); + } - assertArgument(false, "invalid type", "type", param.type); - } + assertArgument(false, "invalid type", "type", param.type); + } - /** - * Get the default values for the given %%types%%. - * - * For example, a ``uint`` is by default ``0`` and ``bool`` - * is by default ``false``. - */ - getDefaultValue(types: ReadonlyArray): Result { - const coders: Array = types.map((type) => - this.#getCoder(ParamType.from(type)), - ); - const coder = new TupleCoder(coders, "_"); - return coder.defaultValue(); - } + /** + * Get the default values for the given %%types%%. + * + * For example, a ``uint`` is by default ``0`` and ``bool`` + * is by default ``false``. + */ + getDefaultValue(types: ReadonlyArray): Result { + const coders: Array = types.map((type) => + this.#getCoder(ParamType.from(type)), + ); + const coder = new TupleCoder(coders, "_"); + return coder.defaultValue(); + } - /** - * Encode the %%values%% as the %%types%% into ABI data. - * - * @returns DataHexstring - */ - encode( - types: ReadonlyArray, - values: ReadonlyArray, - ): string { - assertArgumentCount( - values.length, - types.length, - "types/values length mismatch", - ); + /** + * Encode the %%values%% as the %%types%% into ABI data. + * + * @returns DataHexstring + */ + encode( + types: ReadonlyArray, + values: ReadonlyArray, + ): string { + assertArgumentCount( + values.length, + types.length, + "types/values length mismatch", + ); - const coders = types.map((type) => this.#getCoder(ParamType.from(type))); - const coder = new TupleCoder(coders, "_"); + const coders = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); - const writer = new Writer(); - coder.encode(writer, values); - return writer.data; - } + const writer = new Writer(); + coder.encode(writer, values); + return writer.data; + } - /** - * Decode the ABI %%data%% as the %%types%% into values. - * - * If %%loose%% decoding is enabled, then strict padding is - * not enforced. Some older versions of Solidity incorrectly - * padded event data emitted from ``external`` functions. - */ - decode( - types: ReadonlyArray, - data: BytesLike, - loose?: boolean, - ): Result { - const coders: Array = types.map((type) => - this.#getCoder(ParamType.from(type)), - ); - const coder = new TupleCoder(coders, "_"); - return coder.decode(new Reader(data, loose)); - } + /** + * Decode the ABI %%data%% as the %%types%% into values. + * + * If %%loose%% decoding is enabled, then strict padding is + * not enforced. Some older versions of Solidity incorrectly + * padded event data emitted from ``external`` functions. + */ + decode( + types: ReadonlyArray, + data: BytesLike, + loose?: boolean, + ): Result { + const coders: Array = types.map((type) => + this.#getCoder(ParamType.from(type)), + ); + const coder = new TupleCoder(coders, "_"); + return coder.decode(new Reader(data, loose)); + } - /** - * Returns the shared singleton instance of a default [[AbiCoder]]. - * - * On the first call, the instance is created internally. - */ - static defaultAbiCoder(): AbiCoder { - if (defaultCoder == null) { - defaultCoder = new AbiCoder(); - } - return defaultCoder; - } + /** + * Returns the shared singleton instance of a default [[AbiCoder]]. + * + * On the first call, the instance is created internally. + */ + static defaultAbiCoder(): AbiCoder { + if (defaultCoder == null) { + defaultCoder = new AbiCoder(); + } + return defaultCoder; + } - /** - * Returns an corebc-compatible [[CallExceptionError]] Error for the given - * result %%data%% for the [[CallExceptionAction]] %%action%% against - * the Transaction %%tx%%. - */ - static getBuiltinCallException( - action: CallExceptionAction, - tx: { to?: null | string; from?: null | string; data?: string }, - data: null | BytesLike, - ): CallExceptionError { - return getBuiltinCallException( - action, - tx, - data, - AbiCoder.defaultAbiCoder(), - ); - } + /** + * Returns an corebc-compatible [[CallExceptionError]] Error for the given + * result %%data%% for the [[CallExceptionAction]] %%action%% against + * the Transaction %%tx%%. + */ + static getBuiltinCallException( + action: CallExceptionAction, + tx: { to?: null | string; from?: null | string; data?: string }, + data: null | BytesLike, + ): CallExceptionError { + return getBuiltinCallException( + action, + tx, + data, + AbiCoder.defaultAbiCoder(), + ); + } } diff --git a/src.ts/abi/bytes32.ts b/src.ts/abi/bytes32.ts index e694cb6e5..09f2d5af0 100644 --- a/src.ts/abi/bytes32.ts +++ b/src.ts/abi/bytes32.ts @@ -5,10 +5,10 @@ */ import { - getBytes, - toUtf8Bytes, - toUtf8String, - zeroPadBytes, + getBytes, + toUtf8Bytes, + toUtf8String, + zeroPadBytes, } from "../utils/index.js"; import type { BytesLike } from "../utils/index.js"; @@ -17,38 +17,38 @@ import type { BytesLike } from "../utils/index.js"; * Encodes %%text%% as a Bytes32 string. */ export function encodeBytes32String(text: string): string { - // Get the bytes - const bytes = toUtf8Bytes(text); + // Get the bytes + const bytes = toUtf8Bytes(text); - // Check we have room for null-termination - if (bytes.length > 31) { - throw new Error("bytes32 string must be less than 32 bytes"); - } + // Check we have room for null-termination + if (bytes.length > 31) { + throw new Error("bytes32 string must be less than 32 bytes"); + } - // Zero-pad (implicitly null-terminates) - return zeroPadBytes(bytes, 32); + // Zero-pad (implicitly null-terminates) + return zeroPadBytes(bytes, 32); } /** * Encodes the Bytes32-encoded %%bytes%% into a string. */ export function decodeBytes32String(_bytes: BytesLike): string { - const data = getBytes(_bytes, "bytes"); - - // Must be 32 bytes with a null-termination - if (data.length !== 32) { - throw new Error("invalid bytes32 - not 32 bytes long"); - } - if (data[31] !== 0) { - throw new Error("invalid bytes32 string - no null terminator"); - } - - // Find the null termination - let length = 31; - while (data[length - 1] === 0) { - length--; - } - - // Determine the string value - return toUtf8String(data.slice(0, length)); + const data = getBytes(_bytes, "bytes"); + + // Must be 32 bytes with a null-termination + if (data.length !== 32) { + throw new Error("invalid bytes32 - not 32 bytes long"); + } + if (data[31] !== 0) { + throw new Error("invalid bytes32 string - no null terminator"); + } + + // Find the null termination + let length = 31; + while (data[length - 1] === 0) { + length--; + } + + // Determine the string value + return toUtf8String(data.slice(0, length)); } diff --git a/src.ts/abi/coders/abstract-coder.ts b/src.ts/abi/coders/abstract-coder.ts index 8cced79cd..06cc97777 100644 --- a/src.ts/abi/coders/abstract-coder.ts +++ b/src.ts/abi/coders/abstract-coder.ts @@ -1,14 +1,14 @@ import { - defineProperties, - concat, - getBytesCopy, - getNumber, - hexlify, - toBeArray, - toBigInt, - toNumber, - assert, - assertArgument, + defineProperties, + concat, + getBytesCopy, + getNumber, + hexlify, + toBeArray, + toBigInt, + toNumber, + assert, + assertArgument, } from "../../utils/index.js"; import type { BigNumberish, BytesLike } from "../../utils/index.js"; @@ -26,11 +26,11 @@ const passProperties = ["then"]; const _guard = {}; function throwError(name: string, error: Error): never { - const wrapped = new Error( - `deferred error during ABI decoding triggered accessing ${name}`, - ); - (wrapped).error = error; - throw wrapped; + const wrapped = new Error( + `deferred error during ABI decoding triggered accessing ${name}`, + ); + (wrapped).error = error; + throw wrapped; } /** @@ -41,248 +41,248 @@ function throwError(name: string, error: Error): never { * @_docloc: api/abi */ export class Result extends Array { - readonly #names: ReadonlyArray; - - [K: string | number]: any; - - /** - * @private - */ - constructor(...args: Array) { - // To properly sub-class Array so the other built-in - // functions work, the constructor has to behave fairly - // well. So, in the event we are created via fromItems() - // we build the read-only Result object we want, but on - // any other input, we use the default constructor - - // constructor(guard: any, items: Array, keys?: Array); - const guard = args[0]; - let items: Array = args[1]; - let names: Array = (args[2] || []).slice(); - - let wrap = true; - if (guard !== _guard) { - items = args; - names = []; - wrap = false; - } - - // Can't just pass in ...items since an array of length 1 - // is a special case in the super. - super(items.length); - items.forEach((item, index) => { - this[index] = item; - }); - - // Find all unique keys - const nameCounts = names.reduce( - (accum, name) => { - if (typeof name === "string") { - accum.set(name, (accum.get(name) || 0) + 1); - } - return accum; - }, - >new Map(), - ); - - // Remove any key thats not unique - this.#names = Object.freeze( - items.map((item, index) => { - const name = names[index]; - if (name != null && nameCounts.get(name) === 1) { - return name; - } - return null; - }), - ); - - if (!wrap) { - return; - } - - // A wrapped Result is immutable - Object.freeze(this); - - // Proxy indices and names so we can trap deferred errors - return new Proxy(this, { - get: (target, prop, receiver) => { - if (typeof prop === "string") { - // Index accessor - if (prop.match(/^[0-9]+$/)) { - const index = getNumber(prop, "%index"); - if (index < 0 || index >= this.length) { - throw new RangeError("out of result range"); - } - - const item = target[index]; - if (item instanceof Error) { - throwError(`index ${index}`, item); - } - return item; - } - - // Pass important checks (like `then` for Promise) through - if (passProperties.indexOf(prop) >= 0) { - return Reflect.get(target, prop, receiver); - } - - const value = target[prop]; - if (value instanceof Function) { - // Make sure functions work with private variables - // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding - return function (this: any, ...args: Array) { - return value.apply(this === receiver ? target : this, args); - }; - } else if (!(prop in target)) { - // Possible name accessor - return target.getValue.apply(this === receiver ? target : this, [ - prop, - ]); - } - } - - return Reflect.get(target, prop, receiver); - }, - }); - } - - /** - * Returns the Result as a normal Array. - * - * This will throw if there are any outstanding deferred - * errors. - */ - toArray(): Array { - const result: Array = []; - this.forEach((item, index) => { - if (item instanceof Error) { - throwError(`index ${index}`, item); - } - result.push(item); - }); - return result; - } - - /** - * Returns the Result as an Object with each name-value pair. - * - * This will throw if any value is unnamed, or if there are - * any outstanding deferred errors. - */ - toObject(): Record { - return this.#names.reduce( - (accum, name, index) => { - assert( - name != null, - "value at index ${ index } unnamed", - "UNSUPPORTED_OPERATION", - { - operation: "toObject()", - }, - ); - - // Add values for names that don't conflict - if (!(name in accum)) { - accum[name] = this.getValue(name); - } - - return accum; - }, - >{}, - ); - } - - /** - * @_ignore - */ - slice(start?: number | undefined, end?: number | undefined): Result { - if (start == null) { - start = 0; - } - if (start < 0) { - start += this.length; - if (start < 0) { - start = 0; - } - } - - if (end == null) { - end = this.length; - } - if (end < 0) { - end += this.length; - if (end < 0) { - end = 0; - } - } - if (end > this.length) { - end = this.length; - } - - const result: any = [], - names: any = []; - for (let i = start; i < end; i++) { - result.push(this[i]); - names.push(this.#names[i]); - } - - return new Result(_guard, result, names); - } - - /** - * @_ignore - */ - filter( - callback: (el: any, index: number, array: Result) => boolean, - thisArg?: any, - ): Result { - const result: any = [], - names: any = []; - for (let i = 0; i < this.length; i++) { - const item = this[i]; - if (item instanceof Error) { - throwError(`index ${i}`, item); - } - - if (callback.call(thisArg, item, i, this)) { - result.push(item); - names.push(this.#names[i]); - } - } - - return new Result(_guard, result, names); - } - - /** - * Returns the value for %%name%%. - * - * Since it is possible to have a key whose name conflicts with - * a method on a [[Result]] or its superclass Array, or any - * JavaScript keyword, this ensures all named values are still - * accessible by name. - */ - getValue(name: string): any { - const index = this.#names.indexOf(name); - if (index === -1) { - return undefined; - } - - const value = this[index]; - - if (value instanceof Error) { - throwError(`property ${JSON.stringify(name)}`, (value).error); - } - - return value; - } - - /** - * Creates a new [[Result]] for %%items%% with each entry - * also accessible by its corresponding name in %%keys%%. - */ - static fromItems(items: Array, keys?: Array): Result { - return new Result(_guard, items, keys); - } + readonly #names: ReadonlyArray; + + [K: string | number]: any; + + /** + * @private + */ + constructor(...args: Array) { + // To properly sub-class Array so the other built-in + // functions work, the constructor has to behave fairly + // well. So, in the event we are created via fromItems() + // we build the read-only Result object we want, but on + // any other input, we use the default constructor + + // constructor(guard: any, items: Array, keys?: Array); + const guard = args[0]; + let items: Array = args[1]; + let names: Array = (args[2] || []).slice(); + + let wrap = true; + if (guard !== _guard) { + items = args; + names = []; + wrap = false; + } + + // Can't just pass in ...items since an array of length 1 + // is a special case in the super. + super(items.length); + items.forEach((item, index) => { + this[index] = item; + }); + + // Find all unique keys + const nameCounts = names.reduce( + (accum, name) => { + if (typeof name === "string") { + accum.set(name, (accum.get(name) || 0) + 1); + } + return accum; + }, + >new Map(), + ); + + // Remove any key thats not unique + this.#names = Object.freeze( + items.map((item, index) => { + const name = names[index]; + if (name != null && nameCounts.get(name) === 1) { + return name; + } + return null; + }), + ); + + if (!wrap) { + return; + } + + // A wrapped Result is immutable + Object.freeze(this); + + // Proxy indices and names so we can trap deferred errors + return new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof prop === "string") { + // Index accessor + if (prop.match(/^[0-9]+$/)) { + const index = getNumber(prop, "%index"); + if (index < 0 || index >= this.length) { + throw new RangeError("out of result range"); + } + + const item = target[index]; + if (item instanceof Error) { + throwError(`index ${index}`, item); + } + return item; + } + + // Pass important checks (like `then` for Promise) through + if (passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + + const value = target[prop]; + if (value instanceof Function) { + // Make sure functions work with private variables + // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding + return function (this: any, ...args: Array) { + return value.apply(this === receiver ? target : this, args); + }; + } else if (!(prop in target)) { + // Possible name accessor + return target.getValue.apply(this === receiver ? target : this, [ + prop, + ]); + } + } + + return Reflect.get(target, prop, receiver); + }, + }); + } + + /** + * Returns the Result as a normal Array. + * + * This will throw if there are any outstanding deferred + * errors. + */ + toArray(): Array { + const result: Array = []; + this.forEach((item, index) => { + if (item instanceof Error) { + throwError(`index ${index}`, item); + } + result.push(item); + }); + return result; + } + + /** + * Returns the Result as an Object with each name-value pair. + * + * This will throw if any value is unnamed, or if there are + * any outstanding deferred errors. + */ + toObject(): Record { + return this.#names.reduce( + (accum, name, index) => { + assert( + name != null, + "value at index ${ index } unnamed", + "UNSUPPORTED_OPERATION", + { + operation: "toObject()", + }, + ); + + // Add values for names that don't conflict + if (!(name in accum)) { + accum[name] = this.getValue(name); + } + + return accum; + }, + >{}, + ); + } + + /** + * @_ignore + */ + slice(start?: number | undefined, end?: number | undefined): Result { + if (start == null) { + start = 0; + } + if (start < 0) { + start += this.length; + if (start < 0) { + start = 0; + } + } + + if (end == null) { + end = this.length; + } + if (end < 0) { + end += this.length; + if (end < 0) { + end = 0; + } + } + if (end > this.length) { + end = this.length; + } + + const result: any = [], + names: any = []; + for (let i = start; i < end; i++) { + result.push(this[i]); + names.push(this.#names[i]); + } + + return new Result(_guard, result, names); + } + + /** + * @_ignore + */ + filter( + callback: (el: any, index: number, array: Result) => boolean, + thisArg?: any, + ): Result { + const result: any = [], + names: any = []; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${i}`, item); + } + + if (callback.call(thisArg, item, i, this)) { + result.push(item); + names.push(this.#names[i]); + } + } + + return new Result(_guard, result, names); + } + + /** + * Returns the value for %%name%%. + * + * Since it is possible to have a key whose name conflicts with + * a method on a [[Result]] or its superclass Array, or any + * JavaScript keyword, this ensures all named values are still + * accessible by name. + */ + getValue(name: string): any { + const index = this.#names.indexOf(name); + if (index === -1) { + return undefined; + } + + const value = this[index]; + + if (value instanceof Error) { + throwError(`property ${JSON.stringify(name)}`, (value).error); + } + + return value; + } + + /** + * Creates a new [[Result]] for %%items%% with each entry + * also accessible by its corresponding name in %%keys%%. + */ + static fromItems(items: Array, keys?: Array): Result { + return new Result(_guard, items, keys); + } } /** @@ -299,226 +299,226 @@ export class Result extends Array { * @_docloc api/abi */ export function checkResultErrors( - result: Result, + result: Result, ): Array<{ path: Array; error: Error }> { - // Find the first error (if any) - const errors: Array<{ path: Array; error: Error }> = []; - - const checkErrors = function ( - path: Array, - object: any, - ): void { - if (!Array.isArray(object)) { - return; - } - for (let key in object) { - const childPath = path.slice(); - childPath.push(key); - - try { - checkErrors(childPath, object[key]); - } catch (error: any) { - errors.push({ path: childPath, error: error }); - } - } - }; - checkErrors([], result); - - return errors; + // Find the first error (if any) + const errors: Array<{ path: Array; error: Error }> = []; + + const checkErrors = function ( + path: Array, + object: any, + ): void { + if (!Array.isArray(object)) { + return; + } + for (let key in object) { + const childPath = path.slice(); + childPath.push(key); + + try { + checkErrors(childPath, object[key]); + } catch (error: any) { + errors.push({ path: childPath, error: error }); + } + } + }; + checkErrors([], result); + + return errors; } function getValue(value: BigNumberish): Uint8Array { - let bytes = toBeArray(value); + let bytes = toBeArray(value); - assert(bytes.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { - buffer: bytes, - length: WordSize, - offset: bytes.length, - }); + assert(bytes.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { + buffer: bytes, + length: WordSize, + offset: bytes.length, + }); - if (bytes.length !== WordSize) { - bytes = getBytesCopy( - concat([Padding.slice(bytes.length % WordSize), bytes]), - ); - } + if (bytes.length !== WordSize) { + bytes = getBytesCopy( + concat([Padding.slice(bytes.length % WordSize), bytes]), + ); + } - return bytes; + return bytes; } /** * @_ignore */ export abstract class Coder { - // The coder name: - // - address, uint256, tuple, array, etc. - readonly name!: string; - - // The fully expanded type, including composite types: - // - address, uint256, tuple(address,bytes), uint256[3][4][], etc. - readonly type!: string; - - // The localName bound in the signature, in this example it is "baz": - // - tuple(address foo, uint bar) baz - readonly localName!: string; - - // Whether this type is dynamic: - // - Dynamic: bytes, string, address[], tuple(boolean[]), etc. - // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8) - readonly dynamic!: boolean; - - constructor(name: string, type: string, localName: string, dynamic: boolean) { - defineProperties( - this, - { name, type, localName, dynamic }, - { - name: "string", - type: "string", - localName: "string", - dynamic: "boolean", - }, - ); - } - - _throwError(message: string, value: any): never { - assertArgument(false, message, this.localName, value); - } - - abstract encode(writer: Writer, value: any): number; - abstract decode(reader: Reader): any; - - abstract defaultValue(): any; + // The coder name: + // - address, uint256, tuple, array, etc. + readonly name!: string; + + // The fully expanded type, including composite types: + // - address, uint256, tuple(address,bytes), uint256[3][4][], etc. + readonly type!: string; + + // The localName bound in the signature, in this example it is "baz": + // - tuple(address foo, uint bar) baz + readonly localName!: string; + + // Whether this type is dynamic: + // - Dynamic: bytes, string, address[], tuple(boolean[]), etc. + // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8) + readonly dynamic!: boolean; + + constructor(name: string, type: string, localName: string, dynamic: boolean) { + defineProperties( + this, + { name, type, localName, dynamic }, + { + name: "string", + type: "string", + localName: "string", + dynamic: "boolean", + }, + ); + } + + _throwError(message: string, value: any): never { + assertArgument(false, message, this.localName, value); + } + + abstract encode(writer: Writer, value: any): number; + abstract decode(reader: Reader): any; + + abstract defaultValue(): any; } /** * @_ignore */ export class Writer { - // An array of WordSize lengthed objects to concatenation - #data: Array; - #dataLength: number; - - constructor() { - this.#data = []; - this.#dataLength = 0; - } - - get data(): string { - return concat(this.#data) as string; - } - get length(): number { - return this.#dataLength; - } - - #writeData(data: Uint8Array): number { - this.#data.push(data); - this.#dataLength += data.length; - return data.length; - } - - appendWriter(writer: Writer): number { - return this.#writeData(getBytesCopy(writer.data)); - } - - // Arrayish item; pad on the right to *nearest* WordSize - writeBytes(value: BytesLike): number { - let bytes = getBytesCopy(value); - const paddingOffset = bytes.length % WordSize; - if (paddingOffset) { - bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)])); - } - return this.#writeData(bytes); - } - - // Numeric item; pad on the left *to* WordSize - writeValue(value: BigNumberish): number { - return this.#writeData(getValue(value)); - } - - // Inserts a numeric place-holder, returning a callback that can - // be used to asjust the value later - writeUpdatableValue(): (value: BigNumberish) => void { - const offset = this.#data.length; - this.#data.push(Padding); - this.#dataLength += WordSize; - return (value: BigNumberish) => { - this.#data[offset] = getValue(value); - }; - } + // An array of WordSize lengthed objects to concatenation + #data: Array; + #dataLength: number; + + constructor() { + this.#data = []; + this.#dataLength = 0; + } + + get data(): string { + return concat(this.#data) as string; + } + get length(): number { + return this.#dataLength; + } + + #writeData(data: Uint8Array): number { + this.#data.push(data); + this.#dataLength += data.length; + return data.length; + } + + appendWriter(writer: Writer): number { + return this.#writeData(getBytesCopy(writer.data)); + } + + // Arrayish item; pad on the right to *nearest* WordSize + writeBytes(value: BytesLike): number { + let bytes = getBytesCopy(value); + const paddingOffset = bytes.length % WordSize; + if (paddingOffset) { + bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)])); + } + return this.#writeData(bytes); + } + + // Numeric item; pad on the left *to* WordSize + writeValue(value: BigNumberish): number { + return this.#writeData(getValue(value)); + } + + // Inserts a numeric place-holder, returning a callback that can + // be used to asjust the value later + writeUpdatableValue(): (value: BigNumberish) => void { + const offset = this.#data.length; + this.#data.push(Padding); + this.#dataLength += WordSize; + return (value: BigNumberish) => { + this.#data[offset] = getValue(value); + }; + } } /** * @_ignore */ export class Reader { - // Allows incomplete unpadded data to be read; otherwise an error - // is raised if attempting to overrun the buffer. This is required - // to deal with an old Solidity bug, in which event data for - // external (not public thoguh) was tightly packed. - readonly allowLoose!: boolean; - - readonly #data: Uint8Array; - #offset: number; - - constructor(data: BytesLike, allowLoose?: boolean) { - defineProperties(this, { allowLoose: !!allowLoose }); - - this.#data = getBytesCopy(data); - - this.#offset = 0; - } - - get data(): string { - return hexlify(this.#data); - } - get dataLength(): number { - return this.#data.length; - } - get consumed(): number { - return this.#offset; - } - get bytes(): Uint8Array { - return new Uint8Array(this.#data); - } - - #peekBytes(offset: number, length: number, loose?: boolean): Uint8Array { - let alignedLength = Math.ceil(length / WordSize) * WordSize; - if (this.#offset + alignedLength > this.#data.length) { - if ( - this.allowLoose && - loose && - this.#offset + length <= this.#data.length - ) { - alignedLength = length; - } else { - assert(false, "data out-of-bounds", "BUFFER_OVERRUN", { - buffer: getBytesCopy(this.#data), - length: this.#data.length, - offset: this.#offset + alignedLength, - }); - } - } - return this.#data.slice(this.#offset, this.#offset + alignedLength); - } - - // Create a sub-reader with the same underlying data, but offset - subReader(offset: number): Reader { - return new Reader(this.#data.slice(this.#offset + offset), this.allowLoose); - } - - // Read bytes - readBytes(length: number, loose?: boolean): Uint8Array { - let bytes = this.#peekBytes(0, length, !!loose); - this.#offset += bytes.length; - // @TODO: Make sure the length..end bytes are all 0? - return bytes.slice(0, length); - } - - // Read a numeric values - readValue(): bigint { - return toBigInt(this.readBytes(WordSize)); - } - - readIndex(): number { - return toNumber(this.readBytes(WordSize)); - } + // Allows incomplete unpadded data to be read; otherwise an error + // is raised if attempting to overrun the buffer. This is required + // to deal with an old Solidity bug, in which event data for + // external (not public thoguh) was tightly packed. + readonly allowLoose!: boolean; + + readonly #data: Uint8Array; + #offset: number; + + constructor(data: BytesLike, allowLoose?: boolean) { + defineProperties(this, { allowLoose: !!allowLoose }); + + this.#data = getBytesCopy(data); + + this.#offset = 0; + } + + get data(): string { + return hexlify(this.#data); + } + get dataLength(): number { + return this.#data.length; + } + get consumed(): number { + return this.#offset; + } + get bytes(): Uint8Array { + return new Uint8Array(this.#data); + } + + #peekBytes(offset: number, length: number, loose?: boolean): Uint8Array { + let alignedLength = Math.ceil(length / WordSize) * WordSize; + if (this.#offset + alignedLength > this.#data.length) { + if ( + this.allowLoose && + loose && + this.#offset + length <= this.#data.length + ) { + alignedLength = length; + } else { + assert(false, "data out-of-bounds", "BUFFER_OVERRUN", { + buffer: getBytesCopy(this.#data), + length: this.#data.length, + offset: this.#offset + alignedLength, + }); + } + } + return this.#data.slice(this.#offset, this.#offset + alignedLength); + } + + // Create a sub-reader with the same underlying data, but offset + subReader(offset: number): Reader { + return new Reader(this.#data.slice(this.#offset + offset), this.allowLoose); + } + + // Read bytes + readBytes(length: number, loose?: boolean): Uint8Array { + let bytes = this.#peekBytes(0, length, !!loose); + this.#offset += bytes.length; + // @TODO: Make sure the length..end bytes are all 0? + return bytes.slice(0, length); + } + + // Read a numeric values + readValue(): bigint { + return toBigInt(this.readBytes(WordSize)); + } + + readIndex(): number { + return toNumber(this.readBytes(WordSize)); + } } diff --git a/src.ts/abi/coders/address.ts b/src.ts/abi/coders/address.ts index da51d008c..b105d1192 100644 --- a/src.ts/abi/coders/address.ts +++ b/src.ts/abi/coders/address.ts @@ -10,25 +10,25 @@ import type { Reader, Writer } from "./abstract-coder.js"; * @_ignore */ export class AddressCoder extends Coder { - constructor(localName: string) { - super("address", "address", localName, false); - } + constructor(localName: string) { + super("address", "address", localName, false); + } - defaultValue(): string { - return "0x0000000000000000000000000000000000000000"; - } + defaultValue(): string { + return "0x0000000000000000000000000000000000000000"; + } - encode(writer: Writer, _value: string | Typed): number { - let value = Typed.dereference(_value, "string"); - try { - value = getAddress(value); - } catch (error: any) { - return this._throwError(error.message, _value); - } - return writer.writeValue(value); - } + encode(writer: Writer, _value: string | Typed): number { + let value = Typed.dereference(_value, "string"); + try { + value = getAddress(value); + } catch (error: any) { + return this._throwError(error.message, _value); + } + return writer.writeValue(value); + } - decode(reader: Reader): any { - return getAddress(toBeHex(reader.readValue(), 22)); - } + decode(reader: Reader): any { + return getAddress(toBeHex(reader.readValue(), 22)); + } } diff --git a/src.ts/abi/coders/anonymous.ts b/src.ts/abi/coders/anonymous.ts index 98847440f..83872b55a 100644 --- a/src.ts/abi/coders/anonymous.ts +++ b/src.ts/abi/coders/anonymous.ts @@ -8,22 +8,22 @@ import type { Reader, Writer } from "./abstract-coder.js"; * @_ignore */ export class AnonymousCoder extends Coder { - private coder: Coder; + private coder: Coder; - constructor(coder: Coder) { - super(coder.name, coder.type, "_", coder.dynamic); - this.coder = coder; - } + constructor(coder: Coder) { + super(coder.name, coder.type, "_", coder.dynamic); + this.coder = coder; + } - defaultValue(): any { - return this.coder.defaultValue(); - } + defaultValue(): any { + return this.coder.defaultValue(); + } - encode(writer: Writer, value: any): number { - return this.coder.encode(writer, value); - } + encode(writer: Writer, value: any): number { + return this.coder.encode(writer, value); + } - decode(reader: Reader): any { - return this.coder.decode(reader); - } + decode(reader: Reader): any { + return this.coder.decode(reader); + } } diff --git a/src.ts/abi/coders/array.ts b/src.ts/abi/coders/array.ts index 11de7d864..fc2e52851 100644 --- a/src.ts/abi/coders/array.ts +++ b/src.ts/abi/coders/array.ts @@ -1,9 +1,9 @@ import { - defineProperties, - isError, - assert, - assertArgument, - assertArgumentCount, + defineProperties, + isError, + assert, + assertArgument, + assertArgumentCount, } from "../../utils/index.js"; import { Typed } from "../typed.js"; @@ -17,217 +17,217 @@ import type { Reader } from "./abstract-coder.js"; * @_ignore */ export function pack( - writer: Writer, - coders: ReadonlyArray, - values: Array | { [name: string]: any }, + writer: Writer, + coders: ReadonlyArray, + values: Array | { [name: string]: any }, ): number { - let arrayValues: Array = []; - - if (Array.isArray(values)) { - arrayValues = values; - } else if (values && typeof values === "object") { - let unique: { [name: string]: boolean } = {}; - - arrayValues = coders.map((coder) => { - const name = coder.localName; - assert( - name, - "cannot encode object for signature with missing names", - "INVALID_ARGUMENT", - { argument: "values", info: { coder }, value: values }, - ); - - assert( - !unique[name], - "cannot encode object for signature with duplicate names", - "INVALID_ARGUMENT", - { argument: "values", info: { coder }, value: values }, - ); - - unique[name] = true; - - return values[name]; - }); - } else { - assertArgument(false, "invalid tuple value", "tuple", values); - } - - assertArgument( - coders.length === arrayValues.length, - "types/value length mismatch", - "tuple", - values, - ); - - let staticWriter = new Writer(); - let dynamicWriter = new Writer(); - - let updateFuncs: Array<(baseOffset: number) => void> = []; - coders.forEach((coder, index) => { - let value = arrayValues[index]; - - if (coder.dynamic) { - // Get current dynamic offset (for the future pointer) - let dynamicOffset = dynamicWriter.length; - - // Encode the dynamic value into the dynamicWriter - coder.encode(dynamicWriter, value); - - // Prepare to populate the correct offset once we are done - let updateFunc = staticWriter.writeUpdatableValue(); - updateFuncs.push((baseOffset: number) => { - updateFunc(baseOffset + dynamicOffset); - }); - } else { - coder.encode(staticWriter, value); - } - }); - - // Backfill all the dynamic offsets, now that we know the static length - updateFuncs.forEach((func) => { - func(staticWriter.length); - }); - - let length = writer.appendWriter(staticWriter); - length += writer.appendWriter(dynamicWriter); - return length; + let arrayValues: Array = []; + + if (Array.isArray(values)) { + arrayValues = values; + } else if (values && typeof values === "object") { + let unique: { [name: string]: boolean } = {}; + + arrayValues = coders.map((coder) => { + const name = coder.localName; + assert( + name, + "cannot encode object for signature with missing names", + "INVALID_ARGUMENT", + { argument: "values", info: { coder }, value: values }, + ); + + assert( + !unique[name], + "cannot encode object for signature with duplicate names", + "INVALID_ARGUMENT", + { argument: "values", info: { coder }, value: values }, + ); + + unique[name] = true; + + return values[name]; + }); + } else { + assertArgument(false, "invalid tuple value", "tuple", values); + } + + assertArgument( + coders.length === arrayValues.length, + "types/value length mismatch", + "tuple", + values, + ); + + let staticWriter = new Writer(); + let dynamicWriter = new Writer(); + + let updateFuncs: Array<(baseOffset: number) => void> = []; + coders.forEach((coder, index) => { + let value = arrayValues[index]; + + if (coder.dynamic) { + // Get current dynamic offset (for the future pointer) + let dynamicOffset = dynamicWriter.length; + + // Encode the dynamic value into the dynamicWriter + coder.encode(dynamicWriter, value); + + // Prepare to populate the correct offset once we are done + let updateFunc = staticWriter.writeUpdatableValue(); + updateFuncs.push((baseOffset: number) => { + updateFunc(baseOffset + dynamicOffset); + }); + } else { + coder.encode(staticWriter, value); + } + }); + + // Backfill all the dynamic offsets, now that we know the static length + updateFuncs.forEach((func) => { + func(staticWriter.length); + }); + + let length = writer.appendWriter(staticWriter); + length += writer.appendWriter(dynamicWriter); + return length; } /** * @_ignore */ export function unpack(reader: Reader, coders: ReadonlyArray): Result { - let values: Array = []; - let keys: Array = []; - - // A reader anchored to this base - let baseReader = reader.subReader(0); - - coders.forEach((coder) => { - let value: any = null; - - if (coder.dynamic) { - let offset = reader.readIndex(); - let offsetReader = baseReader.subReader(offset); - try { - value = coder.decode(offsetReader); - } catch (error: any) { - // Cannot recover from this - if (isError(error, "BUFFER_OVERRUN")) { - throw error; - } - - value = error; - value.baseType = coder.name; - value.name = coder.localName; - value.type = coder.type; - } - } else { - try { - value = coder.decode(reader); - } catch (error: any) { - // Cannot recover from this - if (isError(error, "BUFFER_OVERRUN")) { - throw error; - } - - value = error; - value.baseType = coder.name; - value.name = coder.localName; - value.type = coder.type; - } - } - - if (value == undefined) { - throw new Error("investigate"); - } - - values.push(value); - keys.push(coder.localName || null); - }); - - return Result.fromItems(values, keys); + let values: Array = []; + let keys: Array = []; + + // A reader anchored to this base + let baseReader = reader.subReader(0); + + coders.forEach((coder) => { + let value: any = null; + + if (coder.dynamic) { + let offset = reader.readIndex(); + let offsetReader = baseReader.subReader(offset); + try { + value = coder.decode(offsetReader); + } catch (error: any) { + // Cannot recover from this + if (isError(error, "BUFFER_OVERRUN")) { + throw error; + } + + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } else { + try { + value = coder.decode(reader); + } catch (error: any) { + // Cannot recover from this + if (isError(error, "BUFFER_OVERRUN")) { + throw error; + } + + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + + if (value == undefined) { + throw new Error("investigate"); + } + + values.push(value); + keys.push(coder.localName || null); + }); + + return Result.fromItems(values, keys); } /** * @_ignore */ export class ArrayCoder extends Coder { - readonly coder!: Coder; - readonly length!: number; - - constructor(coder: Coder, length: number, localName: string) { - const type = coder.type + "[" + (length >= 0 ? length : "") + "]"; - const dynamic = length === -1 || coder.dynamic; - super("array", type, localName, dynamic); - defineProperties(this, { coder, length }); - } - - defaultValue(): Array { - // Verifies the child coder is valid (even if the array is dynamic or 0-length) - const defaultChild = this.coder.defaultValue(); - - const result: Array = []; - for (let i = 0; i < this.length; i++) { - result.push(defaultChild); - } - return result; - } - - encode(writer: Writer, _value: Array | Typed): number { - const value = Typed.dereference(_value, "array"); - - if (!Array.isArray(value)) { - this._throwError("expected array value", value); - } - - let count = this.length; - - if (count === -1) { - count = value.length; - writer.writeValue(value.length); - } - - assertArgumentCount( - value.length, - count, - "coder array" + (this.localName ? " " + this.localName : ""), - ); - - let coders = []; - for (let i = 0; i < value.length; i++) { - coders.push(this.coder); - } - - return pack(writer, coders, value); - } - - decode(reader: Reader): any { - let count = this.length; - if (count === -1) { - count = reader.readIndex(); - - // Check that there is *roughly* enough data to ensure - // stray random data is not being read as a length. Each - // slot requires at least 32 bytes for their value (or 32 - // bytes as a link to the data). This could use a much - // tighter bound, but we are erroring on the side of safety. - assert( - count * WordSize <= reader.dataLength, - "insufficient data length", - "BUFFER_OVERRUN", - { - buffer: reader.bytes, - offset: count * WordSize, - length: reader.dataLength, - }, - ); - } - let coders = []; - for (let i = 0; i < count; i++) { - coders.push(new AnonymousCoder(this.coder)); - } - - return unpack(reader, coders); - } + readonly coder!: Coder; + readonly length!: number; + + constructor(coder: Coder, length: number, localName: string) { + const type = coder.type + "[" + (length >= 0 ? length : "") + "]"; + const dynamic = length === -1 || coder.dynamic; + super("array", type, localName, dynamic); + defineProperties(this, { coder, length }); + } + + defaultValue(): Array { + // Verifies the child coder is valid (even if the array is dynamic or 0-length) + const defaultChild = this.coder.defaultValue(); + + const result: Array = []; + for (let i = 0; i < this.length; i++) { + result.push(defaultChild); + } + return result; + } + + encode(writer: Writer, _value: Array | Typed): number { + const value = Typed.dereference(_value, "array"); + + if (!Array.isArray(value)) { + this._throwError("expected array value", value); + } + + let count = this.length; + + if (count === -1) { + count = value.length; + writer.writeValue(value.length); + } + + assertArgumentCount( + value.length, + count, + "coder array" + (this.localName ? " " + this.localName : ""), + ); + + let coders = []; + for (let i = 0; i < value.length; i++) { + coders.push(this.coder); + } + + return pack(writer, coders, value); + } + + decode(reader: Reader): any { + let count = this.length; + if (count === -1) { + count = reader.readIndex(); + + // Check that there is *roughly* enough data to ensure + // stray random data is not being read as a length. Each + // slot requires at least 32 bytes for their value (or 32 + // bytes as a link to the data). This could use a much + // tighter bound, but we are erroring on the side of safety. + assert( + count * WordSize <= reader.dataLength, + "insufficient data length", + "BUFFER_OVERRUN", + { + buffer: reader.bytes, + offset: count * WordSize, + length: reader.dataLength, + }, + ); + } + let coders = []; + for (let i = 0; i < count; i++) { + coders.push(new AnonymousCoder(this.coder)); + } + + return unpack(reader, coders); + } } diff --git a/src.ts/abi/coders/boolean.ts b/src.ts/abi/coders/boolean.ts index 92a4d6dc2..e5fbb9812 100644 --- a/src.ts/abi/coders/boolean.ts +++ b/src.ts/abi/coders/boolean.ts @@ -7,20 +7,20 @@ import type { Reader, Writer } from "./abstract-coder.js"; * @_ignore */ export class BooleanCoder extends Coder { - constructor(localName: string) { - super("bool", "bool", localName, false); - } + constructor(localName: string) { + super("bool", "bool", localName, false); + } - defaultValue(): boolean { - return false; - } + defaultValue(): boolean { + return false; + } - encode(writer: Writer, _value: boolean | Typed): number { - const value = Typed.dereference(_value, "bool"); - return writer.writeValue(value ? 1 : 0); - } + encode(writer: Writer, _value: boolean | Typed): number { + const value = Typed.dereference(_value, "bool"); + return writer.writeValue(value ? 1 : 0); + } - decode(reader: Reader): any { - return !!reader.readValue(); - } + decode(reader: Reader): any { + return !!reader.readValue(); + } } diff --git a/src.ts/abi/coders/bytes.ts b/src.ts/abi/coders/bytes.ts index cd604edad..5b8541194 100644 --- a/src.ts/abi/coders/bytes.ts +++ b/src.ts/abi/coders/bytes.ts @@ -8,35 +8,35 @@ import type { Reader, Writer } from "./abstract-coder.js"; * @_ignore */ export class DynamicBytesCoder extends Coder { - constructor(type: string, localName: string) { - super(type, type, localName, true); - } - - defaultValue(): string { - return "0x"; - } - - encode(writer: Writer, value: any): number { - value = getBytesCopy(value); - let length = writer.writeValue(value.length); - length += writer.writeBytes(value); - return length; - } - - decode(reader: Reader): any { - return reader.readBytes(reader.readIndex(), true); - } + constructor(type: string, localName: string) { + super(type, type, localName, true); + } + + defaultValue(): string { + return "0x"; + } + + encode(writer: Writer, value: any): number { + value = getBytesCopy(value); + let length = writer.writeValue(value.length); + length += writer.writeBytes(value); + return length; + } + + decode(reader: Reader): any { + return reader.readBytes(reader.readIndex(), true); + } } /** * @_ignore */ export class BytesCoder extends DynamicBytesCoder { - constructor(localName: string) { - super("bytes", localName); - } + constructor(localName: string) { + super("bytes", localName); + } - decode(reader: Reader): any { - return hexlify(super.decode(reader)); - } + decode(reader: Reader): any { + return hexlify(super.decode(reader)); + } } diff --git a/src.ts/abi/coders/fixed-bytes.ts b/src.ts/abi/coders/fixed-bytes.ts index ef9142d11..203310027 100644 --- a/src.ts/abi/coders/fixed-bytes.ts +++ b/src.ts/abi/coders/fixed-bytes.ts @@ -11,30 +11,30 @@ import type { Reader, Writer } from "./abstract-coder.js"; * @_ignore */ export class FixedBytesCoder extends Coder { - readonly size!: number; - - constructor(size: number, localName: string) { - let name = "bytes" + String(size); - super(name, name, localName, false); - defineProperties(this, { size }, { size: "number" }); - } - - defaultValue(): string { - return "0x0000000000000000000000000000000000000000000000000000000000000000".substring( - 0, - 2 + this.size * 2, - ); - } - - encode(writer: Writer, _value: BytesLike | Typed): number { - let data = getBytesCopy(Typed.dereference(_value, this.type)); - if (data.length !== this.size) { - this._throwError("incorrect data length", _value); - } - return writer.writeBytes(data); - } - - decode(reader: Reader): any { - return hexlify(reader.readBytes(this.size)); - } + readonly size!: number; + + constructor(size: number, localName: string) { + let name = "bytes" + String(size); + super(name, name, localName, false); + defineProperties(this, { size }, { size: "number" }); + } + + defaultValue(): string { + return "0x0000000000000000000000000000000000000000000000000000000000000000".substring( + 0, + 2 + this.size * 2, + ); + } + + encode(writer: Writer, _value: BytesLike | Typed): number { + let data = getBytesCopy(Typed.dereference(_value, this.type)); + if (data.length !== this.size) { + this._throwError("incorrect data length", _value); + } + return writer.writeBytes(data); + } + + decode(reader: Reader): any { + return hexlify(reader.readBytes(this.size)); + } } diff --git a/src.ts/abi/coders/null.ts b/src.ts/abi/coders/null.ts index f70dd0bcc..eabae5e85 100644 --- a/src.ts/abi/coders/null.ts +++ b/src.ts/abi/coders/null.ts @@ -7,23 +7,23 @@ const Empty = new Uint8Array([]); * @_ignore */ export class NullCoder extends Coder { - constructor(localName: string) { - super("null", "", localName, false); - } + constructor(localName: string) { + super("null", "", localName, false); + } - defaultValue(): null { - return null; - } + defaultValue(): null { + return null; + } - encode(writer: Writer, value: any): number { - if (value != null) { - this._throwError("not null", value); - } - return writer.writeBytes(Empty); - } + encode(writer: Writer, value: any): number { + if (value != null) { + this._throwError("not null", value); + } + return writer.writeBytes(Empty); + } - decode(reader: Reader): any { - reader.readBytes(0); - return null; - } + decode(reader: Reader): any { + reader.readBytes(0); + return null; + } } diff --git a/src.ts/abi/coders/number.ts b/src.ts/abi/coders/number.ts index 5688faea6..8f0641e30 100644 --- a/src.ts/abi/coders/number.ts +++ b/src.ts/abi/coders/number.ts @@ -1,9 +1,9 @@ import { - defineProperties, - fromTwos, - getBigInt, - mask, - toTwos, + defineProperties, + fromTwos, + getBigInt, + mask, + toTwos, } from "../../utils/index.js"; import { Typed } from "../typed.js"; @@ -16,56 +16,56 @@ import type { Reader, Writer } from "./abstract-coder.js"; const BN_0 = BigInt(0); const BN_1 = BigInt(1); const BN_MAX_UINT256 = BigInt( - "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", ); /** * @_ignore */ export class NumberCoder extends Coder { - readonly size!: number; - readonly signed!: boolean; + readonly size!: number; + readonly signed!: boolean; - constructor(size: number, signed: boolean, localName: string) { - const name = (signed ? "int" : "uint") + size * 8; - super(name, name, localName, false); + constructor(size: number, signed: boolean, localName: string) { + const name = (signed ? "int" : "uint") + size * 8; + super(name, name, localName, false); - defineProperties( - this, - { size, signed }, - { size: "number", signed: "boolean" }, - ); - } + defineProperties( + this, + { size, signed }, + { size: "number", signed: "boolean" }, + ); + } - defaultValue(): number { - return 0; - } + defaultValue(): number { + return 0; + } - encode(writer: Writer, _value: BigNumberish | Typed): number { - let value = getBigInt(Typed.dereference(_value, this.type)); + encode(writer: Writer, _value: BigNumberish | Typed): number { + let value = getBigInt(Typed.dereference(_value, this.type)); - // Check bounds are safe for encoding - let maxUintValue = mask(BN_MAX_UINT256, WordSize * 8); - if (this.signed) { - let bounds = mask(maxUintValue, this.size * 8 - 1); - if (value > bounds || value < -(bounds + BN_1)) { - this._throwError("value out-of-bounds", _value); - } - value = toTwos(value, 8 * WordSize); - } else if (value < BN_0 || value > mask(maxUintValue, this.size * 8)) { - this._throwError("value out-of-bounds", _value); - } + // Check bounds are safe for encoding + let maxUintValue = mask(BN_MAX_UINT256, WordSize * 8); + if (this.signed) { + let bounds = mask(maxUintValue, this.size * 8 - 1); + if (value > bounds || value < -(bounds + BN_1)) { + this._throwError("value out-of-bounds", _value); + } + value = toTwos(value, 8 * WordSize); + } else if (value < BN_0 || value > mask(maxUintValue, this.size * 8)) { + this._throwError("value out-of-bounds", _value); + } - return writer.writeValue(value); - } + return writer.writeValue(value); + } - decode(reader: Reader): any { - let value = mask(reader.readValue(), this.size * 8); + decode(reader: Reader): any { + let value = mask(reader.readValue(), this.size * 8); - if (this.signed) { - value = fromTwos(value, this.size * 8); - } + if (this.signed) { + value = fromTwos(value, this.size * 8); + } - return value; - } + return value; + } } diff --git a/src.ts/abi/coders/string.ts b/src.ts/abi/coders/string.ts index a728187f2..56918c0bf 100644 --- a/src.ts/abi/coders/string.ts +++ b/src.ts/abi/coders/string.ts @@ -9,22 +9,22 @@ import type { Reader, Writer } from "./abstract-coder.js"; * @_ignore */ export class StringCoder extends DynamicBytesCoder { - constructor(localName: string) { - super("string", localName); - } + constructor(localName: string) { + super("string", localName); + } - defaultValue(): string { - return ""; - } + defaultValue(): string { + return ""; + } - encode(writer: Writer, _value: string | Typed): number { - return super.encode( - writer, - toUtf8Bytes(Typed.dereference(_value, "string")), - ); - } + encode(writer: Writer, _value: string | Typed): number { + return super.encode( + writer, + toUtf8Bytes(Typed.dereference(_value, "string")), + ); + } - decode(reader: Reader): any { - return toUtf8String(super.decode(reader)); - } + decode(reader: Reader): any { + return toUtf8String(super.decode(reader)); + } } diff --git a/src.ts/abi/coders/tuple.ts b/src.ts/abi/coders/tuple.ts index eadf393d5..688f1cdca 100644 --- a/src.ts/abi/coders/tuple.ts +++ b/src.ts/abi/coders/tuple.ts @@ -11,76 +11,76 @@ import type { Reader, Writer } from "./abstract-coder.js"; * @_ignore */ export class TupleCoder extends Coder { - readonly coders!: ReadonlyArray; + readonly coders!: ReadonlyArray; - constructor(coders: Array, localName: string) { - let dynamic = false; - const types: Array = []; - coders.forEach((coder) => { - if (coder.dynamic) { - dynamic = true; - } - types.push(coder.type); - }); - const type = "tuple(" + types.join(",") + ")"; + constructor(coders: Array, localName: string) { + let dynamic = false; + const types: Array = []; + coders.forEach((coder) => { + if (coder.dynamic) { + dynamic = true; + } + types.push(coder.type); + }); + const type = "tuple(" + types.join(",") + ")"; - super("tuple", type, localName, dynamic); - defineProperties(this, { - coders: Object.freeze(coders.slice()), - }); - } + super("tuple", type, localName, dynamic); + defineProperties(this, { + coders: Object.freeze(coders.slice()), + }); + } - defaultValue(): any { - const values: any = []; - this.coders.forEach((coder) => { - values.push(coder.defaultValue()); - }); + defaultValue(): any { + const values: any = []; + this.coders.forEach((coder) => { + values.push(coder.defaultValue()); + }); - // We only output named properties for uniquely named coders - const uniqueNames = this.coders.reduce( - (accum, coder) => { - const name = coder.localName; - if (name) { - if (!accum[name]) { - accum[name] = 0; - } - accum[name]++; - } - return accum; - }, - <{ [name: string]: number }>{}, - ); + // We only output named properties for uniquely named coders + const uniqueNames = this.coders.reduce( + (accum, coder) => { + const name = coder.localName; + if (name) { + if (!accum[name]) { + accum[name] = 0; + } + accum[name]++; + } + return accum; + }, + <{ [name: string]: number }>{}, + ); - // Add named values - this.coders.forEach((coder: Coder, index: number) => { - let name = coder.localName; - if (!name || uniqueNames[name] !== 1) { - return; - } + // Add named values + this.coders.forEach((coder: Coder, index: number) => { + let name = coder.localName; + if (!name || uniqueNames[name] !== 1) { + return; + } - if (name === "length") { - name = "_length"; - } + if (name === "length") { + name = "_length"; + } - if (values[name] != null) { - return; - } + if (values[name] != null) { + return; + } - values[name] = values[index]; - }); + values[name] = values[index]; + }); - return Object.freeze(values); - } + return Object.freeze(values); + } - encode( - writer: Writer, - _value: Array | { [name: string]: any } | Typed, - ): number { - const value = Typed.dereference(_value, "tuple"); - return pack(writer, this.coders, value); - } + encode( + writer: Writer, + _value: Array | { [name: string]: any } | Typed, + ): number { + const value = Typed.dereference(_value, "tuple"); + return pack(writer, this.coders, value); + } - decode(reader: Reader): any { - return unpack(reader, this.coders); - } + decode(reader: Reader): any { + return unpack(reader, this.coders); + } } diff --git a/src.ts/abi/fragments.ts b/src.ts/abi/fragments.ts index f1100120b..db3bba47f 100644 --- a/src.ts/abi/fragments.ts +++ b/src.ts/abi/fragments.ts @@ -5,12 +5,12 @@ */ import { - defineProperties, - getBigInt, - getNumber, - assert, - assertPrivate, - assertArgument, + defineProperties, + getBigInt, + getNumber, + assert, + assertPrivate, + assertArgument, } from "../utils/index.js"; import { id } from "../hash/index.js"; @@ -18,103 +18,103 @@ import { id } from "../hash/index.js"; * A type description in a JSON API. */ export interface JsonFragmentType { - /** - * The parameter name. - */ - readonly name?: string; - - /** - * If the parameter is indexed. - */ - readonly indexed?: boolean; - - /** - * The type of the parameter. - */ - readonly type?: string; - - /** - * The internal Solidity type. - */ - readonly internalType?: string; - - /** - * The components for a tuple. - */ - readonly components?: ReadonlyArray; + /** + * The parameter name. + */ + readonly name?: string; + + /** + * If the parameter is indexed. + */ + readonly indexed?: boolean; + + /** + * The type of the parameter. + */ + readonly type?: string; + + /** + * The internal Solidity type. + */ + readonly internalType?: string; + + /** + * The components for a tuple. + */ + readonly components?: ReadonlyArray; } /** * A fragment for a method, event or error in a JSON API. */ export interface JsonFragment { - /** - * The name of the error, event, function, etc. - */ - readonly name?: string; - - /** - * The type of the fragment (e.g. ``event``, ``"function"``, etc.) - */ - readonly type?: string; - - /** - * If the event is anonymous. - */ - readonly anonymous?: boolean; - - /** - * If the function is payable. - */ - readonly payable?: boolean; - - /** - * If the function is constant. - */ - readonly constant?: boolean; - - /** - * The mutability state of the function. - */ - readonly stateMutability?: string; - - /** - * The input parameters. - */ - readonly inputs?: ReadonlyArray; - - /** - * The output parameters. - */ - readonly outputs?: ReadonlyArray; - - /** - * The energy limit to use when sending a transaction for this function. - */ - readonly energy?: string; + /** + * The name of the error, event, function, etc. + */ + readonly name?: string; + + /** + * The type of the fragment (e.g. ``event``, ``"function"``, etc.) + */ + readonly type?: string; + + /** + * If the event is anonymous. + */ + readonly anonymous?: boolean; + + /** + * If the function is payable. + */ + readonly payable?: boolean; + + /** + * If the function is constant. + */ + readonly constant?: boolean; + + /** + * The mutability state of the function. + */ + readonly stateMutability?: string; + + /** + * The input parameters. + */ + readonly inputs?: ReadonlyArray; + + /** + * The output parameters. + */ + readonly outputs?: ReadonlyArray; + + /** + * The energy limit to use when sending a transaction for this function. + */ + readonly energy?: string; } /** * The format to serialize the output as. */ export type FormatType = - // Bare formatting, as is needed for computing a sighash of an event or function - | "sighash" + // Bare formatting, as is needed for computing a sighash of an event or function + | "sighash" - // Human-Readable with Minimal spacing and without names (compact human-readable) - | "minimal" + // Human-Readable with Minimal spacing and without names (compact human-readable) + | "minimal" - // Human-Readable with nice spacing, including all names - | "full" + // Human-Readable with nice spacing, including all names + | "full" - // JSON-format a la Solidity - | "json"; + // JSON-format a la Solidity + | "json"; // [ "a", "b" ] => { "a": 1, "b": 1 } function setify(items: Array): ReadonlySet { - const result: Set = new Set(); - items.forEach((k) => result.add(k)); - return Object.freeze(result); + const result: Set = new Set(); + items.forEach((k) => result.add(k)); + return Object.freeze(result); } // Visibility Keywords @@ -135,12 +135,12 @@ const Keywords = setify(_keywords.split(" ")); // Single character tokens const SimpleTokens: Record = { - "(": "OPEN_PAREN", - ")": "CLOSE_PAREN", - "[": "OPEN_BRACKET", - "]": "CLOSE_BRACKET", - ",": "COMMA", - "@": "AT", + "(": "OPEN_PAREN", + ")": "CLOSE_PAREN", + "[": "OPEN_BRACKET", + "]": "CLOSE_BRACKET", + ",": "COMMA", + "@": "AT", }; // Parser regexes to consume the next token @@ -151,424 +151,424 @@ const regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"); // Parser regexs to check validity const regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"); const regexType = new RegExp( - "^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$", + "^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$", ); /** * @ignore: */ type Token = Readonly<{ - // Type of token (e.g. TYPE, KEYWORD, NUMBER, etc) - type: string; + // Type of token (e.g. TYPE, KEYWORD, NUMBER, etc) + type: string; - // Offset into the original source code - offset: number; + // Offset into the original source code + offset: number; - // Actual text content of the token - text: string; + // Actual text content of the token + text: string; - // The parenthesis depth - depth: number; + // The parenthesis depth + depth: number; - // If a parenthesis, the offset (in tokens) that balances it - match: number; + // If a parenthesis, the offset (in tokens) that balances it + match: number; - // For parenthesis and commas, the offset (in tokens) to the - // previous/next parenthesis or comma in the list - linkBack: number; - linkNext: number; + // For parenthesis and commas, the offset (in tokens) to the + // previous/next parenthesis or comma in the list + linkBack: number; + linkNext: number; - // If a BRACKET, the value inside - value: number; + // If a BRACKET, the value inside + value: number; }>; class TokenString { - #offset: number; - #tokens: ReadonlyArray; - - get offset(): number { - return this.#offset; - } - get length(): number { - return this.#tokens.length - this.#offset; - } - - constructor(tokens: ReadonlyArray) { - this.#offset = 0; - this.#tokens = tokens.slice(); - } - - clone(): TokenString { - return new TokenString(this.#tokens); - } - reset(): void { - this.#offset = 0; - } - - #subTokenString(from: number = 0, to: number = 0): TokenString { - return new TokenString( - this.#tokens.slice(from, to).map((t) => { - return Object.freeze( - Object.assign({}, t, { - match: t.match - from, - linkBack: t.linkBack - from, - linkNext: t.linkNext - from, - }), - ); - }), - ); - } - - // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens - popKeyword(allowed: ReadonlySet): string { - const top = this.peek(); - if (top.type !== "KEYWORD" || !allowed.has(top.text)) { - throw new Error(`expected keyword ${top.text}`); - } - return this.pop().text; - } - - // Pops and returns the value of the next token if it is `type`; throws if out of tokens - popType(type: string): string { - if (this.peek().type !== type) { - throw new Error(`expected ${type}; got ${JSON.stringify(this.peek())}`); - } - return this.pop().text; - } - - // Pops and returns a "(" TOKENS ")" - popParen(): TokenString { - const top = this.peek(); - if (top.type !== "OPEN_PAREN") { - throw new Error("bad start"); - } - const result = this.#subTokenString(this.#offset + 1, top.match + 1); - this.#offset = top.match + 1; - return result; - } - - // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" - popParams(): Array { - const top = this.peek(); - - if (top.type !== "OPEN_PAREN") { - throw new Error("bad start"); - } - - const result: Array = []; - - while (this.#offset < top.match - 1) { - const link = this.peek().linkNext; - result.push(this.#subTokenString(this.#offset + 1, link)); - this.#offset = link; - } - - this.#offset = top.match + 1; - - return result; - } - - // Returns the top Token, throwing if out of tokens - peek(): Token { - if (this.#offset >= this.#tokens.length) { - throw new Error("out-of-bounds"); - } - return this.#tokens[this.#offset]; - } - - // Returns the next value, if it is a keyword in `allowed` - peekKeyword(allowed: ReadonlySet): null | string { - const top = this.peekType("KEYWORD"); - return top != null && allowed.has(top) ? top : null; - } - - // Returns the value of the next token if it is `type` - peekType(type: string): null | string { - if (this.length === 0) { - return null; - } - const top = this.peek(); - return top.type === type ? top.text : null; - } - - // Returns the next token; throws if out of tokens - pop(): Token { - const result = this.peek(); - this.#offset++; - return result; - } - - toString(): string { - const tokens: Array = []; - for (let i = this.#offset; i < this.#tokens.length; i++) { - const token = this.#tokens[i]; - tokens.push(`${token.type}:${token.text}`); - } - return ``; - } + #offset: number; + #tokens: ReadonlyArray; + + get offset(): number { + return this.#offset; + } + get length(): number { + return this.#tokens.length - this.#offset; + } + + constructor(tokens: ReadonlyArray) { + this.#offset = 0; + this.#tokens = tokens.slice(); + } + + clone(): TokenString { + return new TokenString(this.#tokens); + } + reset(): void { + this.#offset = 0; + } + + #subTokenString(from: number = 0, to: number = 0): TokenString { + return new TokenString( + this.#tokens.slice(from, to).map((t) => { + return Object.freeze( + Object.assign({}, t, { + match: t.match - from, + linkBack: t.linkBack - from, + linkNext: t.linkNext - from, + }), + ); + }), + ); + } + + // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens + popKeyword(allowed: ReadonlySet): string { + const top = this.peek(); + if (top.type !== "KEYWORD" || !allowed.has(top.text)) { + throw new Error(`expected keyword ${top.text}`); + } + return this.pop().text; + } + + // Pops and returns the value of the next token if it is `type`; throws if out of tokens + popType(type: string): string { + if (this.peek().type !== type) { + throw new Error(`expected ${type}; got ${JSON.stringify(this.peek())}`); + } + return this.pop().text; + } + + // Pops and returns a "(" TOKENS ")" + popParen(): TokenString { + const top = this.peek(); + if (top.type !== "OPEN_PAREN") { + throw new Error("bad start"); + } + const result = this.#subTokenString(this.#offset + 1, top.match + 1); + this.#offset = top.match + 1; + return result; + } + + // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" + popParams(): Array { + const top = this.peek(); + + if (top.type !== "OPEN_PAREN") { + throw new Error("bad start"); + } + + const result: Array = []; + + while (this.#offset < top.match - 1) { + const link = this.peek().linkNext; + result.push(this.#subTokenString(this.#offset + 1, link)); + this.#offset = link; + } + + this.#offset = top.match + 1; + + return result; + } + + // Returns the top Token, throwing if out of tokens + peek(): Token { + if (this.#offset >= this.#tokens.length) { + throw new Error("out-of-bounds"); + } + return this.#tokens[this.#offset]; + } + + // Returns the next value, if it is a keyword in `allowed` + peekKeyword(allowed: ReadonlySet): null | string { + const top = this.peekType("KEYWORD"); + return top != null && allowed.has(top) ? top : null; + } + + // Returns the value of the next token if it is `type` + peekType(type: string): null | string { + if (this.length === 0) { + return null; + } + const top = this.peek(); + return top.type === type ? top.text : null; + } + + // Returns the next token; throws if out of tokens + pop(): Token { + const result = this.peek(); + this.#offset++; + return result; + } + + toString(): string { + const tokens: Array = []; + for (let i = this.#offset; i < this.#tokens.length; i++) { + const token = this.#tokens[i]; + tokens.push(`${token.type}:${token.text}`); + } + return ``; + } } type Writeable = { -readonly [P in keyof T]: T[P] }; function lex(text: string): TokenString { - const tokens: Array = []; - - const throwError = (message: string) => { - const token = offset < text.length ? JSON.stringify(text[offset]) : "$EOI"; - throw new Error(`invalid token ${token} at ${offset}: ${message}`); - }; - - let brackets: Array = []; - let commas: Array = []; - - let offset = 0; - while (offset < text.length) { - // Strip off any leading whitespace - let cur = text.substring(offset); - let match = cur.match(regexWhitespacePrefix); - if (match) { - offset += match[1].length; - cur = text.substring(offset); - } - - const token = { - depth: brackets.length, - linkBack: -1, - linkNext: -1, - match: -1, - type: "", - text: "", - offset, - value: -1, - }; - tokens.push(token); - - let type = SimpleTokens[cur[0]] || ""; - if (type) { - token.type = type; - token.text = cur[0]; - offset++; - - if (type === "OPEN_PAREN") { - brackets.push(tokens.length - 1); - commas.push(tokens.length - 1); - } else if (type == "CLOSE_PAREN") { - if (brackets.length === 0) { - throwError("no matching open bracket"); - } - - token.match = brackets.pop() as number; - (>tokens[token.match]).match = tokens.length - 1; - token.depth--; - - token.linkBack = commas.pop() as number; - (>tokens[token.linkBack]).linkNext = tokens.length - 1; - } else if (type === "COMMA") { - token.linkBack = commas.pop() as number; - (>tokens[token.linkBack]).linkNext = tokens.length - 1; - commas.push(tokens.length - 1); - } else if (type === "OPEN_BRACKET") { - token.type = "BRACKET"; - } else if (type === "CLOSE_BRACKET") { - // Remove the CLOSE_BRACKET - let suffix = (tokens.pop() as Token).text; - if (tokens.length > 0 && tokens[tokens.length - 1].type === "NUMBER") { - const value = (tokens.pop() as Token).text; - suffix = value + suffix; - (>tokens[tokens.length - 1]).value = - getNumber(value); - } - if ( - tokens.length === 0 || - tokens[tokens.length - 1].type !== "BRACKET" - ) { - throw new Error("missing opening bracket"); - } - (>tokens[tokens.length - 1]).text += suffix; - } - - continue; - } - - match = cur.match(regexIdPrefix); - if (match) { - token.text = match[1]; - offset += token.text.length; - - if (Keywords.has(token.text)) { - token.type = "KEYWORD"; - continue; - } - - if (token.text.match(regexType)) { - token.type = "TYPE"; - continue; - } - - token.type = "ID"; - continue; - } - - match = cur.match(regexNumberPrefix); - if (match) { - token.text = match[1]; - token.type = "NUMBER"; - offset += token.text.length; - continue; - } - - throw new Error( - `unexpected token ${JSON.stringify(cur[0])} at position ${offset}`, - ); - } - - return new TokenString(tokens.map((t) => Object.freeze(t))); + const tokens: Array = []; + + const throwError = (message: string) => { + const token = offset < text.length ? JSON.stringify(text[offset]) : "$EOI"; + throw new Error(`invalid token ${token} at ${offset}: ${message}`); + }; + + let brackets: Array = []; + let commas: Array = []; + + let offset = 0; + while (offset < text.length) { + // Strip off any leading whitespace + let cur = text.substring(offset); + let match = cur.match(regexWhitespacePrefix); + if (match) { + offset += match[1].length; + cur = text.substring(offset); + } + + const token = { + depth: brackets.length, + linkBack: -1, + linkNext: -1, + match: -1, + type: "", + text: "", + offset, + value: -1, + }; + tokens.push(token); + + let type = SimpleTokens[cur[0]] || ""; + if (type) { + token.type = type; + token.text = cur[0]; + offset++; + + if (type === "OPEN_PAREN") { + brackets.push(tokens.length - 1); + commas.push(tokens.length - 1); + } else if (type == "CLOSE_PAREN") { + if (brackets.length === 0) { + throwError("no matching open bracket"); + } + + token.match = brackets.pop() as number; + (>tokens[token.match]).match = tokens.length - 1; + token.depth--; + + token.linkBack = commas.pop() as number; + (>tokens[token.linkBack]).linkNext = tokens.length - 1; + } else if (type === "COMMA") { + token.linkBack = commas.pop() as number; + (>tokens[token.linkBack]).linkNext = tokens.length - 1; + commas.push(tokens.length - 1); + } else if (type === "OPEN_BRACKET") { + token.type = "BRACKET"; + } else if (type === "CLOSE_BRACKET") { + // Remove the CLOSE_BRACKET + let suffix = (tokens.pop() as Token).text; + if (tokens.length > 0 && tokens[tokens.length - 1].type === "NUMBER") { + const value = (tokens.pop() as Token).text; + suffix = value + suffix; + (>tokens[tokens.length - 1]).value = + getNumber(value); + } + if ( + tokens.length === 0 || + tokens[tokens.length - 1].type !== "BRACKET" + ) { + throw new Error("missing opening bracket"); + } + (>tokens[tokens.length - 1]).text += suffix; + } + + continue; + } + + match = cur.match(regexIdPrefix); + if (match) { + token.text = match[1]; + offset += token.text.length; + + if (Keywords.has(token.text)) { + token.type = "KEYWORD"; + continue; + } + + if (token.text.match(regexType)) { + token.type = "TYPE"; + continue; + } + + token.type = "ID"; + continue; + } + + match = cur.match(regexNumberPrefix); + if (match) { + token.text = match[1]; + token.type = "NUMBER"; + offset += token.text.length; + continue; + } + + throw new Error( + `unexpected token ${JSON.stringify(cur[0])} at position ${offset}`, + ); + } + + return new TokenString(tokens.map((t) => Object.freeze(t))); } // Check only one of `allowed` is in `set` function allowSingle( - set: ReadonlySet, - allowed: ReadonlySet, + set: ReadonlySet, + allowed: ReadonlySet, ): void { - let included: Array = []; - for (const key in allowed.keys()) { - if (set.has(key)) { - included.push(key); - } - } - if (included.length > 1) { - throw new Error(`conflicting types: ${included.join(", ")}`); - } + let included: Array = []; + for (const key in allowed.keys()) { + if (set.has(key)) { + included.push(key); + } + } + if (included.length > 1) { + throw new Error(`conflicting types: ${included.join(", ")}`); + } } // Functions to process a Solidity Signature TokenString from left-to-right for... // ...the name with an optional type, returning the name function consumeName(type: string, tokens: TokenString): string { - if (tokens.peekKeyword(KwTypes)) { - const keyword = tokens.pop().text; - if (keyword !== type) { - throw new Error(`expected ${type}, got ${keyword}`); - } - } - - return tokens.popType("ID"); + if (tokens.peekKeyword(KwTypes)) { + const keyword = tokens.pop().text; + if (keyword !== type) { + throw new Error(`expected ${type}, got ${keyword}`); + } + } + + return tokens.popType("ID"); } // ...all keywords matching allowed, returning the keywords function consumeKeywords( - tokens: TokenString, - allowed?: ReadonlySet, + tokens: TokenString, + allowed?: ReadonlySet, ): ReadonlySet { - const keywords: Set = new Set(); - while (true) { - const keyword = tokens.peekType("KEYWORD"); - - if (keyword == null || (allowed && !allowed.has(keyword))) { - break; - } - tokens.pop(); - - if (keywords.has(keyword)) { - throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`); - } - keywords.add(keyword); - } - - return Object.freeze(keywords); + const keywords: Set = new Set(); + while (true) { + const keyword = tokens.peekType("KEYWORD"); + + if (keyword == null || (allowed && !allowed.has(keyword))) { + break; + } + tokens.pop(); + + if (keywords.has(keyword)) { + throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`); + } + keywords.add(keyword); + } + + return Object.freeze(keywords); } // ...all visibility keywords, returning the coalesced mutability function consumeMutability( - tokens: TokenString, + tokens: TokenString, ): "payable" | "nonpayable" | "view" | "pure" { - let modifiers = consumeKeywords(tokens, KwVisib); - - // Detect conflicting modifiers - allowSingle(modifiers, setify("constant payable nonpayable".split(" "))); - allowSingle(modifiers, setify("pure view payable nonpayable".split(" "))); - - // Process mutability states - if (modifiers.has("view")) { - return "view"; - } - if (modifiers.has("pure")) { - return "pure"; - } - if (modifiers.has("payable")) { - return "payable"; - } - if (modifiers.has("nonpayable")) { - return "nonpayable"; - } - - // Process legacy `constant` last - if (modifiers.has("constant")) { - return "view"; - } - - return "nonpayable"; + let modifiers = consumeKeywords(tokens, KwVisib); + + // Detect conflicting modifiers + allowSingle(modifiers, setify("constant payable nonpayable".split(" "))); + allowSingle(modifiers, setify("pure view payable nonpayable".split(" "))); + + // Process mutability states + if (modifiers.has("view")) { + return "view"; + } + if (modifiers.has("pure")) { + return "pure"; + } + if (modifiers.has("payable")) { + return "payable"; + } + if (modifiers.has("nonpayable")) { + return "nonpayable"; + } + + // Process legacy `constant` last + if (modifiers.has("constant")) { + return "view"; + } + + return "nonpayable"; } // ...a parameter list, returning the ParamType list function consumeParams( - tokens: TokenString, - allowIndexed?: boolean, + tokens: TokenString, + allowIndexed?: boolean, ): Array { - return tokens.popParams().map((t) => ParamType.from(t, allowIndexed)); + return tokens.popParams().map((t) => ParamType.from(t, allowIndexed)); } // ...a energy limit, returning a BigNumber or null if none function consumeEnergy(tokens: TokenString): null | bigint { - if (tokens.peekType("AT")) { - tokens.pop(); - if (tokens.peekType("NUMBER")) { - return getBigInt(tokens.pop().text); - } - throw new Error("invalid energy"); - } - return null; + if (tokens.peekType("AT")) { + tokens.pop(); + if (tokens.peekType("NUMBER")) { + return getBigInt(tokens.pop().text); + } + throw new Error("invalid energy"); + } + return null; } function consumeEoi(tokens: TokenString): void { - if (tokens.length) { - throw new Error(`unexpected tokens: ${tokens.toString()}`); - } + if (tokens.length) { + throw new Error(`unexpected tokens: ${tokens.toString()}`); + } } const regexArrayType = new RegExp(/^(.*)\[([0-9]*)\]$/); function verifyBasicType(type: string): string { - const match = type.match(regexType); - assertArgument(match, "invalid type", "type", type); - if (type === "uint") { - return "uint256"; - } - if (type === "int") { - return "int256"; - } - - if (match[2]) { - // bytesXX - const length = parseInt(match[2]); - assertArgument( - length !== 0 && length <= 32, - "invalid bytes length", - "type", - type, - ); - } else if (match[3]) { - // intXX or uintXX - const size = parseInt(match[3] as string); - assertArgument( - size !== 0 && size <= 256 && size % 8 === 0, - "invalid numeric width", - "type", - type, - ); - } - - return type; + const match = type.match(regexType); + assertArgument(match, "invalid type", "type", type); + if (type === "uint") { + return "uint256"; + } + if (type === "int") { + return "int256"; + } + + if (match[2]) { + // bytesXX + const length = parseInt(match[2]); + assertArgument( + length !== 0 && length <= 32, + "invalid bytes length", + "type", + type, + ); + } else if (match[3]) { + // intXX or uintXX + const size = parseInt(match[3] as string); + assertArgument( + size !== 0 && size <= 256 && size % 8 === 0, + "invalid numeric width", + "type", + type, + ); + } + + return type; } // Make the Fragment constructors effectively private @@ -585,8 +585,8 @@ export type ParamTypeWalkFunc = (type: string, value: any) => any; * this is called on each component. */ export type ParamTypeWalkAsyncFunc = ( - type: string, - value: any, + type: string, + value: any, ) => any | Promise; const internal = Symbol.for("_corebc_internal"); @@ -603,633 +603,628 @@ const StructFragmentInternal = "_StructInternal"; * Each input and output of a [[Fragment]] is an Array of **PAramType**. */ export class ParamType { - /** - * The local name of the parameter (or ``""`` if unbound) - */ - readonly name!: string; - - /** - * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, - * ``"uint256[3][]"``) - */ - readonly type!: string; - - /** - * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) - */ - readonly baseType!: string; - - /** - * True if the parameters is indexed. - * - * For non-indexable types this is ``null``. - */ - readonly indexed!: null | boolean; - - /** - * The components for the tuple. - * - * For non-tuple types this is ``null``. - */ - readonly components!: null | ReadonlyArray; - - /** - * The array length, or ``-1`` for dynamic-lengthed arrays. - * - * For non-array types this is ``null``. - */ - readonly arrayLength!: null | number; - - /** - * The type of each child in the array. - * - * For non-array types this is ``null``. - */ - readonly arrayChildren!: null | ParamType; - - /** - * @private - */ - constructor( - guard: any, - name: string, - type: string, - baseType: string, - indexed: null | boolean, - components: null | ReadonlyArray, - arrayLength: null | number, - arrayChildren: null | ParamType, - ) { - assertPrivate(guard, _guard, "ParamType"); - Object.defineProperty(this, internal, { value: ParamTypeInternal }); - - if (components) { - components = Object.freeze(components.slice()); - } - - if (baseType === "array") { - if (arrayLength == null || arrayChildren == null) { - throw new Error(""); - } - } else if (arrayLength != null || arrayChildren != null) { - throw new Error(""); - } - - if (baseType === "tuple") { - if (components == null) { - throw new Error(""); - } - } else if (components != null) { - throw new Error(""); - } - - defineProperties(this, { - name, - type, - baseType, - indexed, - components, - arrayLength, - arrayChildren, - }); - } - - /** - * Return a string representation of this type. - * - * For example, - * - * ``sighash" => "(uint256,address)"`` - * - * ``"minimal" => "tuple(uint256,address) indexed"`` - * - * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` - */ - format(format?: FormatType): string { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - let result: any = { - type: this.baseType === "tuple" ? "tuple" : this.type, - name: this.name || undefined, - }; - if (typeof this.indexed === "boolean") { - result.indexed = this.indexed; - } - if (this.isTuple()) { - result.components = this.components.map((c) => - JSON.parse(c.format(format)), - ); - } - return JSON.stringify(result); - } - - let result = ""; - - // Array - if (this.isArray()) { - result += this.arrayChildren.format(format); - result += `[${this.arrayLength < 0 ? "" : String(this.arrayLength)}]`; - } else { - if (this.isTuple()) { - if (format !== "sighash") { - result += this.type; - } - result += - "(" + - this.components - .map((comp) => comp.format(format)) - .join(format === "full" ? ", " : ",") + - ")"; - } else { - result += this.type; - } - } - - if (format !== "sighash") { - if (this.indexed === true) { - result += " indexed"; - } - if (format === "full" && this.name) { - result += " " + this.name; - } - } - - return result; - } - - /* - * Returns true if %%value%% is an Array type. - * - * This provides a type gaurd ensuring that the - * [[arrayChildren]] and [[arrayLength]] are non-null. - */ - //static isArray(value: any): value is { arrayChildren: ParamType, arrayLength: number } { - // return value && (value.baseType === "array") - //} - - /** - * Returns true if %%this%% is an Array type. - * - * This provides a type gaurd ensuring that [[arrayChildren]] - * and [[arrayLength]] are non-null. - */ - isArray(): this is ParamType & { - arrayChildren: ParamType; - arrayLength: number; - } { - return this.baseType === "array"; - } - - /** - * Returns true if %%this%% is a Tuple type. - * - * This provides a type gaurd ensuring that [[components]] - * is non-null. - */ - isTuple(): this is ParamType & { components: ReadonlyArray } { - return this.baseType === "tuple"; - } - - /** - * Returns true if %%this%% is an Indexable type. - * - * This provides a type gaurd ensuring that [[indexed]] - * is non-null. - */ - isIndexable(): this is ParamType & { indexed: boolean } { - return this.indexed != null; - } - - /** - * Walks the **ParamType** with %%value%%, calling %%process%% - * on each type, destructing the %%value%% recursively. - */ - walk(value: any, process: ParamTypeWalkFunc): any { - if (this.isArray()) { - if (!Array.isArray(value)) { - throw new Error("invalid array value"); - } - if (this.arrayLength !== -1 && value.length !== this.arrayLength) { - throw new Error("array is wrong length"); - } - const _this = this; - return value.map((v) => _this.arrayChildren.walk(v, process)); - } - - if (this.isTuple()) { - if (!Array.isArray(value)) { - throw new Error("invalid tuple value"); - } - if (value.length !== this.components.length) { - throw new Error("array is wrong length"); - } - const _this = this; - return value.map((v, i) => _this.components[i].walk(v, process)); - } - - return process(this.type, value); - } - - #walkAsync( - promises: Array>, - value: any, - process: ParamTypeWalkAsyncFunc, - setValue: (value: any) => void, - ): void { - if (this.isArray()) { - if (!Array.isArray(value)) { - throw new Error("invalid array value"); - } - if (this.arrayLength !== -1 && value.length !== this.arrayLength) { - throw new Error("array is wrong length"); - } - const childType = this.arrayChildren; - - const result = value.slice(); - result.forEach((value, index) => { - childType.#walkAsync(promises, value, process, (value: any) => { - result[index] = value; - }); - }); - setValue(result); - return; - } - - if (this.isTuple()) { - const components = this.components; - - // Convert the object into an array - let result: Array; - if (Array.isArray(value)) { - result = value.slice(); - } else { - if (value == null || typeof value !== "object") { - throw new Error("invalid tuple value"); - } - - result = components.map((param) => { - if (!param.name) { - throw new Error("cannot use object value with unnamed components"); - } - if (!(param.name in value)) { - throw new Error(`missing value for component ${param.name}`); - } - return value[param.name]; - }); - } - - if (result.length !== this.components.length) { - throw new Error("array is wrong length"); - } - - result.forEach((value, index) => { - components[index].#walkAsync(promises, value, process, (value: any) => { - result[index] = value; - }); - }); - setValue(result); - return; - } - - const result = process(this.type, value); - if (result.then) { - promises.push( - (async function () { - setValue(await result); - })(), - ); - } else { - setValue(result); - } - } - - /** - * Walks the **ParamType** with %%value%%, asynchronously calling - * %%process%% on each type, destructing the %%value%% recursively. - * - * This can be used to resolve ENS naes by walking and resolving each - * ``"address"`` type. - */ - async walkAsync(value: any, process: ParamTypeWalkAsyncFunc): Promise { - const promises: Array> = []; - const result: [any] = [value]; - this.#walkAsync(promises, value, process, (value: any) => { - result[0] = value; - }); - if (promises.length) { - await Promise.all(promises); - } - return result[0]; - } - - /** - * Creates a new **ParamType** for %%obj%%. - * - * If %%allowIndexed%% then the ``indexed`` keyword is permitted, - * otherwise the ``indexed`` keyword will throw an error. - */ - static from(obj: any, allowIndexed?: boolean): ParamType { - if (ParamType.isParamType(obj)) { - return obj; - } - - if (typeof obj === "string") { - return ParamType.from(lex(obj), allowIndexed); - } else if (obj instanceof TokenString) { - let type = "", - baseType = ""; - let comps: null | Array = null; - - if ( - consumeKeywords(obj, setify(["tuple"])).has("tuple") || - obj.peekType("OPEN_PAREN") - ) { - // Tuple - baseType = "tuple"; - comps = obj.popParams().map((t) => ParamType.from(t)); - type = `tuple(${comps.map((c) => c.format()).join(",")})`; - } else { - // Normal - type = verifyBasicType(obj.popType("TYPE")); - baseType = type; - } - - // Check for Array - let arrayChildren: null | ParamType = null; - let arrayLength: null | number = null; - - while (obj.length && obj.peekType("BRACKET")) { - const bracket = obj.pop(); //arrays[i]; - arrayChildren = new ParamType( - _guard, - "", - type, - baseType, - null, - comps, - arrayLength, - arrayChildren, - ); - arrayLength = bracket.value; - type += bracket.text; - baseType = "array"; - comps = null; - } - - let indexed: boolean | null = null; - const keywords = consumeKeywords(obj, KwModifiers); - if (keywords.has("indexed")) { - if (!allowIndexed) { - throw new Error(""); - } - indexed = true; - } - - const name = obj.peekType("ID") ? obj.pop().text : ""; - - if (obj.length) { - throw new Error("leftover tokens"); - } - - return new ParamType( - _guard, - name, - type, - baseType, - indexed, - comps, - arrayLength, - arrayChildren, - ); - } - - const name = obj.name; - assertArgument( - !name || (typeof name === "string" && name.match(regexId)), - "invalid name", - "obj.name", - name, - ); - - let indexed = obj.indexed; - if (indexed != null) { - assertArgument( - allowIndexed, - "parameter cannot be indexed", - "obj.indexed", - obj.indexed, - ); - indexed = !!indexed; - } - - let type = obj.type; - - let arrayMatch = type.match(regexArrayType); - if (arrayMatch) { - const arrayLength = parseInt(arrayMatch[2] || "-1"); - const arrayChildren = ParamType.from({ - type: arrayMatch[1], - components: obj.components, - }); - - return new ParamType( - _guard, - name || "", - type, - "array", - indexed, - null, - arrayLength, - arrayChildren, - ); - } - - if ( - type === "tuple" || - type.startsWith("tuple(" /* fix: ) */) || - type.startsWith("(" /* fix: ) */) - ) { - const comps = - obj.components != null - ? obj.components.map((c: any) => ParamType.from(c)) - : null; - const tuple = new ParamType( - _guard, - name || "", - type, - "tuple", - indexed, - comps, - null, - null, - ); - // @TODO: use lexer to validate and normalize type - return tuple; - } - - type = verifyBasicType(obj.type); - - return new ParamType( - _guard, - name || "", - type, - type, - indexed, - null, - null, - null, - ); - } - - /** - * Returns true if %%value%% is a **ParamType**. - */ - static isParamType(value: any): value is ParamType { - return value && value[internal] === ParamTypeInternal; - } + /** + * The local name of the parameter (or ``""`` if unbound) + */ + readonly name!: string; + + /** + * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, + * ``"uint256[3][]"``) + */ + readonly type!: string; + + /** + * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) + */ + readonly baseType!: string; + + /** + * True if the parameters is indexed. + * + * For non-indexable types this is ``null``. + */ + readonly indexed!: null | boolean; + + /** + * The components for the tuple. + * + * For non-tuple types this is ``null``. + */ + readonly components!: null | ReadonlyArray; + + /** + * The array length, or ``-1`` for dynamic-lengthed arrays. + * + * For non-array types this is ``null``. + */ + readonly arrayLength!: null | number; + + /** + * The type of each child in the array. + * + * For non-array types this is ``null``. + */ + readonly arrayChildren!: null | ParamType; + + /** + * @private + */ + constructor( + guard: any, + name: string, + type: string, + baseType: string, + indexed: null | boolean, + components: null | ReadonlyArray, + arrayLength: null | number, + arrayChildren: null | ParamType, + ) { + assertPrivate(guard, _guard, "ParamType"); + Object.defineProperty(this, internal, { value: ParamTypeInternal }); + + if (components) { + components = Object.freeze(components.slice()); + } + + if (baseType === "array") { + if (arrayLength == null || arrayChildren == null) { + throw new Error(""); + } + } else if (arrayLength != null || arrayChildren != null) { + throw new Error(""); + } + + if (baseType === "tuple") { + if (components == null) { + throw new Error(""); + } + } else if (components != null) { + throw new Error(""); + } + + defineProperties(this, { + name, + type, + baseType, + indexed, + components, + arrayLength, + arrayChildren, + }); + } + + /** + * Return a string representation of this type. + * + * For example, + * + * ``sighash" => "(uint256,address)"`` + * + * ``"minimal" => "tuple(uint256,address) indexed"`` + * + * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` + */ + format(format?: FormatType): string { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + let result: any = { + type: this.baseType === "tuple" ? "tuple" : this.type, + name: this.name || undefined, + }; + if (typeof this.indexed === "boolean") { + result.indexed = this.indexed; + } + if (this.isTuple()) { + result.components = this.components.map((c) => + JSON.parse(c.format(format)), + ); + } + return JSON.stringify(result); + } + + let result = ""; + + // Array + if (this.isArray()) { + result += this.arrayChildren.format(format); + result += `[${this.arrayLength < 0 ? "" : String(this.arrayLength)}]`; + } else { + if (this.isTuple()) { + if (format !== "sighash") { + result += this.type; + } + result += + "(" + + this.components + .map((comp) => comp.format(format)) + .join(format === "full" ? ", " : ",") + + ")"; + } else { + result += this.type; + } + } + + if (format !== "sighash") { + if (this.indexed === true) { + result += " indexed"; + } + if (format === "full" && this.name) { + result += " " + this.name; + } + } + + return result; + } + + /* + * Returns true if %%value%% is an Array type. + * + * This provides a type gaurd ensuring that the + * [[arrayChildren]] and [[arrayLength]] are non-null. + */ + //static isArray(value: any): value is { arrayChildren: ParamType, arrayLength: number } { + // return value && (value.baseType === "array") + //} + + /** + * Returns true if %%this%% is an Array type. + * + * This provides a type gaurd ensuring that [[arrayChildren]] + * and [[arrayLength]] are non-null. + */ + isArray(): this is ParamType & { + arrayChildren: ParamType; + arrayLength: number; + } { + return this.baseType === "array"; + } + + /** + * Returns true if %%this%% is a Tuple type. + * + * This provides a type gaurd ensuring that [[components]] + * is non-null. + */ + isTuple(): this is ParamType & { components: ReadonlyArray } { + return this.baseType === "tuple"; + } + + /** + * Returns true if %%this%% is an Indexable type. + * + * This provides a type gaurd ensuring that [[indexed]] + * is non-null. + */ + isIndexable(): this is ParamType & { indexed: boolean } { + return this.indexed != null; + } + + /** + * Walks the **ParamType** with %%value%%, calling %%process%% + * on each type, destructing the %%value%% recursively. + */ + walk(value: any, process: ParamTypeWalkFunc): any { + if (this.isArray()) { + if (!Array.isArray(value)) { + throw new Error("invalid array value"); + } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v) => _this.arrayChildren.walk(v, process)); + } + + if (this.isTuple()) { + if (!Array.isArray(value)) { + throw new Error("invalid tuple value"); + } + if (value.length !== this.components.length) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v, i) => _this.components[i].walk(v, process)); + } + + return process(this.type, value); + } + + #walkAsync( + promises: Array>, + value: any, + process: ParamTypeWalkAsyncFunc, + setValue: (value: any) => void, + ): void { + if (this.isArray()) { + if (!Array.isArray(value)) { + throw new Error("invalid array value"); + } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const childType = this.arrayChildren; + + const result = value.slice(); + result.forEach((value, index) => { + childType.#walkAsync(promises, value, process, (value: any) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + + if (this.isTuple()) { + const components = this.components; + + // Convert the object into an array + let result: Array; + if (Array.isArray(value)) { + result = value.slice(); + } else { + if (value == null || typeof value !== "object") { + throw new Error("invalid tuple value"); + } + + result = components.map((param) => { + if (!param.name) { + throw new Error("cannot use object value with unnamed components"); + } + if (!(param.name in value)) { + throw new Error(`missing value for component ${param.name}`); + } + return value[param.name]; + }); + } + + if (result.length !== this.components.length) { + throw new Error("array is wrong length"); + } + + result.forEach((value, index) => { + components[index].#walkAsync(promises, value, process, (value: any) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + + const result = process(this.type, value); + if (result.then) { + promises.push( + (async function () { + setValue(await result); + })(), + ); + } else { + setValue(result); + } + } + + /** + * Walks the **ParamType** with %%value%%, asynchronously calling + * %%process%% on each type, destructing the %%value%% recursively. + * + * This can be used to resolve ENS naes by walking and resolving each + * ``"address"`` type. + */ + async walkAsync(value: any, process: ParamTypeWalkAsyncFunc): Promise { + const promises: Array> = []; + const result: [any] = [value]; + this.#walkAsync(promises, value, process, (value: any) => { + result[0] = value; + }); + if (promises.length) { + await Promise.all(promises); + } + return result[0]; + } + + /** + * Creates a new **ParamType** for %%obj%%. + * + * If %%allowIndexed%% then the ``indexed`` keyword is permitted, + * otherwise the ``indexed`` keyword will throw an error. + */ + static from(obj: any, allowIndexed?: boolean): ParamType { + if (ParamType.isParamType(obj)) { + return obj; + } + + if (typeof obj === "string") { + return ParamType.from(lex(obj), allowIndexed); + } else if (obj instanceof TokenString) { + let type = "", + baseType = ""; + let comps: null | Array = null; + + if ( + consumeKeywords(obj, setify(["tuple"])).has("tuple") || + obj.peekType("OPEN_PAREN") + ) { + // Tuple + baseType = "tuple"; + comps = obj.popParams().map((t) => ParamType.from(t)); + type = `tuple(${comps.map((c) => c.format()).join(",")})`; + } else { + // Normal + type = verifyBasicType(obj.popType("TYPE")); + baseType = type; + } + + // Check for Array + let arrayChildren: null | ParamType = null; + let arrayLength: null | number = null; + + while (obj.length && obj.peekType("BRACKET")) { + const bracket = obj.pop(); //arrays[i]; + arrayChildren = new ParamType( + _guard, + "", + type, + baseType, + null, + comps, + arrayLength, + arrayChildren, + ); + arrayLength = bracket.value; + type += bracket.text; + baseType = "array"; + comps = null; + } + + let indexed: boolean | null = null; + const keywords = consumeKeywords(obj, KwModifiers); + if (keywords.has("indexed")) { + if (!allowIndexed) { + throw new Error(""); + } + indexed = true; + } + + const name = obj.peekType("ID") ? obj.pop().text : ""; + + if (obj.length) { + throw new Error("leftover tokens"); + } + + return new ParamType( + _guard, + name, + type, + baseType, + indexed, + comps, + arrayLength, + arrayChildren, + ); + } + + const name = obj.name; + assertArgument( + !name || (typeof name === "string" && name.match(regexId)), + "invalid name", + "obj.name", + name, + ); + + let indexed = obj.indexed; + if (indexed != null) { + assertArgument( + allowIndexed, + "parameter cannot be indexed", + "obj.indexed", + obj.indexed, + ); + indexed = !!indexed; + } + + let type = obj.type; + + let arrayMatch = type.match(regexArrayType); + if (arrayMatch) { + const arrayLength = parseInt(arrayMatch[2] || "-1"); + const arrayChildren = ParamType.from({ + type: arrayMatch[1], + components: obj.components, + }); + + return new ParamType( + _guard, + name || "", + type, + "array", + indexed, + null, + arrayLength, + arrayChildren, + ); + } + + if ( + type === "tuple" || + type.startsWith("tuple(" /* fix: ) */) || + type.startsWith("(" /* fix: ) */) + ) { + const comps = + obj.components != null + ? obj.components.map((c: any) => ParamType.from(c)) + : null; + const tuple = new ParamType( + _guard, + name || "", + type, + "tuple", + indexed, + comps, + null, + null, + ); + // @TODO: use lexer to validate and normalize type + return tuple; + } + + type = verifyBasicType(obj.type); + + return new ParamType( + _guard, + name || "", + type, + type, + indexed, + null, + null, + null, + ); + } + + /** + * Returns true if %%value%% is a **ParamType**. + */ + static isParamType(value: any): value is ParamType { + return value && value[internal] === ParamTypeInternal; + } } /** * The type of a [[Fragment]]. */ export type FragmentType = - | "constructor" - | "error" - | "event" - | "fallback" - | "function" - | "struct"; + "constructor" | "error" | "event" | "fallback" | "function" | "struct"; /** * An abstract class to represent An individual fragment from a parse ABI. */ export abstract class Fragment { - /** - * The type of the fragment. - */ - readonly type!: FragmentType; - - /** - * The inputs for the fragment. - */ - readonly inputs!: ReadonlyArray; - - /** - * @private - */ - constructor( - guard: any, - type: FragmentType, - inputs: ReadonlyArray, - ) { - assertPrivate(guard, _guard, "Fragment"); - inputs = Object.freeze(inputs.slice()); - defineProperties(this, { type, inputs }); - } - - /** - * Returns a string representation of this fragment. - */ - abstract format(format?: FormatType): string; - - /** - * Creates a new **Fragment** for %%obj%%, wich can be any supported - * ABI frgament type. - */ - static from(obj: any): Fragment { - if (typeof obj === "string") { - // Try parsing JSON... - try { - Fragment.from(JSON.parse(obj)); - } catch (e) {} - - // ...otherwise, use the human-readable lexer - return Fragment.from(lex(obj)); - } - - if (obj instanceof TokenString) { - // Human-readable ABI (already lexed) - - const type = obj.peekKeyword(KwTypes); - - switch (type) { - case "constructor": - return ConstructorFragment.from(obj); - case "error": - return ErrorFragment.from(obj); - case "event": - return EventFragment.from(obj); - case "fallback": - case "receive": - return FallbackFragment.from(obj); - case "function": - return FunctionFragment.from(obj); - case "struct": - return StructFragment.from(obj); - } - } else if (typeof obj === "object") { - // JSON ABI - - switch (obj.type) { - case "constructor": - return ConstructorFragment.from(obj); - case "error": - return ErrorFragment.from(obj); - case "event": - return EventFragment.from(obj); - case "fallback": - case "receive": - return FallbackFragment.from(obj); - case "function": - return FunctionFragment.from(obj); - case "struct": - return StructFragment.from(obj); - } - - assert(false, `unsupported type: ${obj.type}`, "UNSUPPORTED_OPERATION", { - operation: "Fragment.from", - }); - } - - assertArgument(false, "unsupported frgament object", "obj", obj); - } - - /** - * Returns true if %%value%% is a [[ConstructorFragment]]. - */ - static isConstructor(value: any): value is ConstructorFragment { - return ConstructorFragment.isFragment(value); - } - - /** - * Returns true if %%value%% is an [[ErrorFragment]]. - */ - static isError(value: any): value is ErrorFragment { - return ErrorFragment.isFragment(value); - } - - /** - * Returns true if %%value%% is an [[EventFragment]]. - */ - static isEvent(value: any): value is EventFragment { - return EventFragment.isFragment(value); - } - - /** - * Returns true if %%value%% is a [[FunctionFragment]]. - */ - static isFunction(value: any): value is FunctionFragment { - return FunctionFragment.isFragment(value); - } - - /** - * Returns true if %%value%% is a [[StructFragment]]. - */ - static isStruct(value: any): value is StructFragment { - return StructFragment.isFragment(value); - } + /** + * The type of the fragment. + */ + readonly type!: FragmentType; + + /** + * The inputs for the fragment. + */ + readonly inputs!: ReadonlyArray; + + /** + * @private + */ + constructor( + guard: any, + type: FragmentType, + inputs: ReadonlyArray, + ) { + assertPrivate(guard, _guard, "Fragment"); + inputs = Object.freeze(inputs.slice()); + defineProperties(this, { type, inputs }); + } + + /** + * Returns a string representation of this fragment. + */ + abstract format(format?: FormatType): string; + + /** + * Creates a new **Fragment** for %%obj%%, wich can be any supported + * ABI frgament type. + */ + static from(obj: any): Fragment { + if (typeof obj === "string") { + // Try parsing JSON... + try { + Fragment.from(JSON.parse(obj)); + } catch (e) {} + + // ...otherwise, use the human-readable lexer + return Fragment.from(lex(obj)); + } + + if (obj instanceof TokenString) { + // Human-readable ABI (already lexed) + + const type = obj.peekKeyword(KwTypes); + + switch (type) { + case "constructor": + return ConstructorFragment.from(obj); + case "error": + return ErrorFragment.from(obj); + case "event": + return EventFragment.from(obj); + case "fallback": + case "receive": + return FallbackFragment.from(obj); + case "function": + return FunctionFragment.from(obj); + case "struct": + return StructFragment.from(obj); + } + } else if (typeof obj === "object") { + // JSON ABI + + switch (obj.type) { + case "constructor": + return ConstructorFragment.from(obj); + case "error": + return ErrorFragment.from(obj); + case "event": + return EventFragment.from(obj); + case "fallback": + case "receive": + return FallbackFragment.from(obj); + case "function": + return FunctionFragment.from(obj); + case "struct": + return StructFragment.from(obj); + } + + assert(false, `unsupported type: ${obj.type}`, "UNSUPPORTED_OPERATION", { + operation: "Fragment.from", + }); + } + + assertArgument(false, "unsupported frgament object", "obj", obj); + } + + /** + * Returns true if %%value%% is a [[ConstructorFragment]]. + */ + static isConstructor(value: any): value is ConstructorFragment { + return ConstructorFragment.isFragment(value); + } + + /** + * Returns true if %%value%% is an [[ErrorFragment]]. + */ + static isError(value: any): value is ErrorFragment { + return ErrorFragment.isFragment(value); + } + + /** + * Returns true if %%value%% is an [[EventFragment]]. + */ + static isEvent(value: any): value is EventFragment { + return EventFragment.isFragment(value); + } + + /** + * Returns true if %%value%% is a [[FunctionFragment]]. + */ + static isFunction(value: any): value is FunctionFragment { + return FunctionFragment.isFragment(value); + } + + /** + * Returns true if %%value%% is a [[StructFragment]]. + */ + static isStruct(value: any): value is StructFragment { + return StructFragment.isFragment(value); + } } /** @@ -1237,623 +1232,623 @@ export abstract class Fragment { * which has a name from a parse ABI. */ export abstract class NamedFragment extends Fragment { - /** - * The name of the fragment. - */ - readonly name!: string; - - /** - * @private - */ - constructor( - guard: any, - type: FragmentType, - name: string, - inputs: ReadonlyArray, - ) { - super(guard, type, inputs); - assertArgument( - typeof name === "string" && name.match(regexId), - "invalid identifier", - "name", - name, - ); - inputs = Object.freeze(inputs.slice()); - defineProperties(this, { name }); - } + /** + * The name of the fragment. + */ + readonly name!: string; + + /** + * @private + */ + constructor( + guard: any, + type: FragmentType, + name: string, + inputs: ReadonlyArray, + ) { + super(guard, type, inputs); + assertArgument( + typeof name === "string" && name.match(regexId), + "invalid identifier", + "name", + name, + ); + inputs = Object.freeze(inputs.slice()); + defineProperties(this, { name }); + } } function joinParams( - format: FormatType, - params: ReadonlyArray, + format: FormatType, + params: ReadonlyArray, ): string { - return ( - "(" + - params.map((p) => p.format(format)).join(format === "full" ? ", " : ",") + - ")" - ); + return ( + "(" + + params.map((p) => p.format(format)).join(format === "full" ? ", " : ",") + + ")" + ); } /** * A Fragment which represents a //Custom Error//. */ export class ErrorFragment extends NamedFragment { - /** - * @private - */ - constructor(guard: any, name: string, inputs: ReadonlyArray) { - super(guard, "error", name, inputs); - Object.defineProperty(this, internal, { value: ErrorFragmentInternal }); - } - - /** - * The Custom Error selector. - */ - get selector(): string { - return id(this.format("sighash")).substring(0, 10); - } - - format(format?: FormatType): string { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "error", - name: this.name, - inputs: this.inputs.map((input) => JSON.parse(input.format(format))), - }); - } - - const result: string[] = []; - if (format !== "sighash") { - result.push("error"); - } - result.push(this.name + joinParams(format, this.inputs)); - return result.join(" "); - } - - static from(obj: any): ErrorFragment { - if (ErrorFragment.isFragment(obj)) { - return obj; - } - - if (typeof obj === "string") { - return ErrorFragment.from(lex(obj)); - } else if (obj instanceof TokenString) { - const name = consumeName("error", obj); - const inputs = consumeParams(obj); - consumeEoi(obj); - - return new ErrorFragment(_guard, name, inputs); - } - - return new ErrorFragment( - _guard, - obj.name, - obj.inputs ? obj.inputs.map(ParamType.from) : [], - ); - } - - static isFragment(value: any): value is ErrorFragment { - return value && value[internal] === ErrorFragmentInternal; - } + /** + * @private + */ + constructor(guard: any, name: string, inputs: ReadonlyArray) { + super(guard, "error", name, inputs); + Object.defineProperty(this, internal, { value: ErrorFragmentInternal }); + } + + /** + * The Custom Error selector. + */ + get selector(): string { + return id(this.format("sighash")).substring(0, 10); + } + + format(format?: FormatType): string { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "error", + name: this.name, + inputs: this.inputs.map((input) => JSON.parse(input.format(format))), + }); + } + + const result: string[] = []; + if (format !== "sighash") { + result.push("error"); + } + result.push(this.name + joinParams(format, this.inputs)); + return result.join(" "); + } + + static from(obj: any): ErrorFragment { + if (ErrorFragment.isFragment(obj)) { + return obj; + } + + if (typeof obj === "string") { + return ErrorFragment.from(lex(obj)); + } else if (obj instanceof TokenString) { + const name = consumeName("error", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + + return new ErrorFragment(_guard, name, inputs); + } + + return new ErrorFragment( + _guard, + obj.name, + obj.inputs ? obj.inputs.map(ParamType.from) : [], + ); + } + + static isFragment(value: any): value is ErrorFragment { + return value && value[internal] === ErrorFragmentInternal; + } } /** * A Fragment which represents an Event. */ export class EventFragment extends NamedFragment { - readonly anonymous!: boolean; - - /** - * @private - */ - constructor( - guard: any, - name: string, - inputs: ReadonlyArray, - anonymous: boolean, - ) { - super(guard, "event", name, inputs); - Object.defineProperty(this, internal, { value: EventFragmentInternal }); - defineProperties(this, { anonymous }); - } - - /** - * The Event topic hash. - */ - get topicHash(): string { - return id(this.format("sighash")); - } - - format(format?: FormatType): string { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "event", - anonymous: this.anonymous, - name: this.name, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - }); - } - - const result: string[] = []; - if (format !== "sighash") { - result.push("event"); - } - result.push(this.name + joinParams(format, this.inputs)); - if (format !== "sighash" && this.anonymous) { - result.push("anonymous"); - } - return result.join(" "); - } - - static getTopicHash(name: string, params?: Array): string { - params = (params || []).map((p) => ParamType.from(p)); - const fragment = new EventFragment(_guard, name, params, false); - return fragment.topicHash; - } - - static from(obj: any): EventFragment { - if (EventFragment.isFragment(obj)) { - return obj; - } - - if (typeof obj === "string") { - return EventFragment.from(lex(obj)); - } else if (obj instanceof TokenString) { - const name = consumeName("event", obj); - const inputs = consumeParams(obj, true); - const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has( - "anonymous", - ); - consumeEoi(obj); - - return new EventFragment(_guard, name, inputs, anonymous); - } - - return new EventFragment( - _guard, - obj.name, - obj.inputs ? obj.inputs.map((p: any) => ParamType.from(p, true)) : [], - !!obj.anonymous, - ); - } - - static isFragment(value: any): value is EventFragment { - return value && value[internal] === EventFragmentInternal; - } + readonly anonymous!: boolean; + + /** + * @private + */ + constructor( + guard: any, + name: string, + inputs: ReadonlyArray, + anonymous: boolean, + ) { + super(guard, "event", name, inputs); + Object.defineProperty(this, internal, { value: EventFragmentInternal }); + defineProperties(this, { anonymous }); + } + + /** + * The Event topic hash. + */ + get topicHash(): string { + return id(this.format("sighash")); + } + + format(format?: FormatType): string { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "event", + anonymous: this.anonymous, + name: this.name, + inputs: this.inputs.map((i) => JSON.parse(i.format(format))), + }); + } + + const result: string[] = []; + if (format !== "sighash") { + result.push("event"); + } + result.push(this.name + joinParams(format, this.inputs)); + if (format !== "sighash" && this.anonymous) { + result.push("anonymous"); + } + return result.join(" "); + } + + static getTopicHash(name: string, params?: Array): string { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new EventFragment(_guard, name, params, false); + return fragment.topicHash; + } + + static from(obj: any): EventFragment { + if (EventFragment.isFragment(obj)) { + return obj; + } + + if (typeof obj === "string") { + return EventFragment.from(lex(obj)); + } else if (obj instanceof TokenString) { + const name = consumeName("event", obj); + const inputs = consumeParams(obj, true); + const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has( + "anonymous", + ); + consumeEoi(obj); + + return new EventFragment(_guard, name, inputs, anonymous); + } + + return new EventFragment( + _guard, + obj.name, + obj.inputs ? obj.inputs.map((p: any) => ParamType.from(p, true)) : [], + !!obj.anonymous, + ); + } + + static isFragment(value: any): value is EventFragment { + return value && value[internal] === EventFragmentInternal; + } } /** * A Fragment which represents a constructor. */ export class ConstructorFragment extends Fragment { - readonly payable!: boolean; - readonly energy!: null | bigint; - - /** - * @private - */ - constructor( - guard: any, - type: FragmentType, - inputs: ReadonlyArray, - payable: boolean, - energy: null | bigint, - ) { - super(guard, type, inputs); - Object.defineProperty(this, internal, { - value: ConstructorFragmentInternal, - }); - defineProperties(this, { payable, energy }); - } - - format(format?: FormatType): string { - assert( - format != null && format !== "sighash", - "cannot format a constructor for sighash", - "UNSUPPORTED_OPERATION", - { operation: "format(sighash)" }, - ); - - if (format === "json") { - return JSON.stringify({ - type: "constructor", - stateMutability: this.payable ? "payable" : "undefined", - payable: this.payable, - energy: this.energy != null ? this.energy : undefined, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - }); - } - - const result = [`constructor${joinParams(format, this.inputs)}`]; - result.push(this.payable ? "payable" : "nonpayable"); - if (this.energy != null) { - result.push(`@${this.energy.toString()}`); - } - return result.join(" "); - } - - static from(obj: any): ConstructorFragment { - if (ConstructorFragment.isFragment(obj)) { - return obj; - } - - if (typeof obj === "string") { - return ConstructorFragment.from(lex(obj)); - } else if (obj instanceof TokenString) { - consumeKeywords(obj, setify(["constructor"])); - const inputs = consumeParams(obj); - const payable = !!consumeKeywords(obj, setify(["payable"])).has( - "payable", - ); - const energy = consumeEnergy(obj); - consumeEoi(obj); - - return new ConstructorFragment( - _guard, - "constructor", - inputs, - payable, - energy, - ); - } - - return new ConstructorFragment( - _guard, - "constructor", - obj.inputs ? obj.inputs.map(ParamType.from) : [], - !!obj.payable, - obj.energy != null ? obj.energy : null, - ); - } - - static isFragment(value: any): value is ConstructorFragment { - return value && value[internal] === ConstructorFragmentInternal; - } + readonly payable!: boolean; + readonly energy!: null | bigint; + + /** + * @private + */ + constructor( + guard: any, + type: FragmentType, + inputs: ReadonlyArray, + payable: boolean, + energy: null | bigint, + ) { + super(guard, type, inputs); + Object.defineProperty(this, internal, { + value: ConstructorFragmentInternal, + }); + defineProperties(this, { payable, energy }); + } + + format(format?: FormatType): string { + assert( + format != null && format !== "sighash", + "cannot format a constructor for sighash", + "UNSUPPORTED_OPERATION", + { operation: "format(sighash)" }, + ); + + if (format === "json") { + return JSON.stringify({ + type: "constructor", + stateMutability: this.payable ? "payable" : "undefined", + payable: this.payable, + energy: this.energy != null ? this.energy : undefined, + inputs: this.inputs.map((i) => JSON.parse(i.format(format))), + }); + } + + const result = [`constructor${joinParams(format, this.inputs)}`]; + result.push(this.payable ? "payable" : "nonpayable"); + if (this.energy != null) { + result.push(`@${this.energy.toString()}`); + } + return result.join(" "); + } + + static from(obj: any): ConstructorFragment { + if (ConstructorFragment.isFragment(obj)) { + return obj; + } + + if (typeof obj === "string") { + return ConstructorFragment.from(lex(obj)); + } else if (obj instanceof TokenString) { + consumeKeywords(obj, setify(["constructor"])); + const inputs = consumeParams(obj); + const payable = !!consumeKeywords(obj, setify(["payable"])).has( + "payable", + ); + const energy = consumeEnergy(obj); + consumeEoi(obj); + + return new ConstructorFragment( + _guard, + "constructor", + inputs, + payable, + energy, + ); + } + + return new ConstructorFragment( + _guard, + "constructor", + obj.inputs ? obj.inputs.map(ParamType.from) : [], + !!obj.payable, + obj.energy != null ? obj.energy : null, + ); + } + + static isFragment(value: any): value is ConstructorFragment { + return value && value[internal] === ConstructorFragmentInternal; + } } /** * A Fragment which represents a method. */ export class FallbackFragment extends Fragment { - /** - * If the function can be sent value during invocation. - */ - readonly payable!: boolean; - - constructor(guard: any, inputs: ReadonlyArray, payable: boolean) { - super(guard, "fallback", inputs); - Object.defineProperty(this, internal, { value: FallbackFragmentInternal }); - defineProperties(this, { payable }); - } - - format(format?: FormatType): string { - const type = this.inputs.length === 0 ? "receive" : "fallback"; - - if (format === "json") { - const stateMutability = this.payable ? "payable" : "nonpayable"; - return JSON.stringify({ type, stateMutability }); - } - - return `${type}()${this.payable ? " payable" : ""}`; - } - - static from(obj: any): FallbackFragment { - if (FallbackFragment.isFragment(obj)) { - return obj; - } - - if (typeof obj === "string") { - return FallbackFragment.from(lex(obj)); - } else if (obj instanceof TokenString) { - const errorObj = obj.toString(); - - const topIsValid = obj.peekKeyword(setify(["fallback", "receive"])); - assertArgument( - topIsValid, - "type must be fallback or receive", - "obj", - errorObj, - ); - - const type = obj.popKeyword(setify(["fallback", "receive"])); - - // receive() - if (type === "receive") { - const inputs = consumeParams(obj); - assertArgument( - inputs.length === 0, - `receive cannot have arguments`, - "obj.inputs", - inputs, - ); - consumeKeywords(obj, setify(["payable"])); - consumeEoi(obj); - return new FallbackFragment(_guard, [], true); - } - - // fallback() [payable] - // fallback(bytes) [payable] returns (bytes) - let inputs = consumeParams(obj); - if (inputs.length) { - assertArgument( - inputs.length === 1 && inputs[0].type === "bytes", - "invalid fallback inputs", - "obj.inputs", - inputs.map((i) => i.format("minimal")).join(", "), - ); - } else { - inputs = [ParamType.from("bytes")]; - } - - const mutability = consumeMutability(obj); - assertArgument( - mutability === "nonpayable" || mutability === "payable", - "fallback cannot be constants", - "obj.stateMutability", - mutability, - ); - - if (consumeKeywords(obj, setify(["returns"])).has("returns")) { - const outputs = consumeParams(obj); - assertArgument( - outputs.length === 1 && outputs[0].type === "bytes", - "invalid fallback outputs", - "obj.outputs", - outputs.map((i) => i.format("minimal")).join(", "), - ); - } - - consumeEoi(obj); - - return new FallbackFragment(_guard, inputs, mutability === "payable"); - } - - if (obj.type === "receive") { - return new FallbackFragment(_guard, [], true); - } - - if (obj.type === "fallback") { - const inputs = [ParamType.from("bytes")]; - const payable = obj.stateMutability === "payable"; - return new FallbackFragment(_guard, inputs, payable); - } - - assertArgument(false, "invalid fallback description", "obj", obj); - } - - static isFragment(value: any): value is FallbackFragment { - return value && value[internal] === FallbackFragmentInternal; - } + /** + * If the function can be sent value during invocation. + */ + readonly payable!: boolean; + + constructor(guard: any, inputs: ReadonlyArray, payable: boolean) { + super(guard, "fallback", inputs); + Object.defineProperty(this, internal, { value: FallbackFragmentInternal }); + defineProperties(this, { payable }); + } + + format(format?: FormatType): string { + const type = this.inputs.length === 0 ? "receive" : "fallback"; + + if (format === "json") { + const stateMutability = this.payable ? "payable" : "nonpayable"; + return JSON.stringify({ type, stateMutability }); + } + + return `${type}()${this.payable ? " payable" : ""}`; + } + + static from(obj: any): FallbackFragment { + if (FallbackFragment.isFragment(obj)) { + return obj; + } + + if (typeof obj === "string") { + return FallbackFragment.from(lex(obj)); + } else if (obj instanceof TokenString) { + const errorObj = obj.toString(); + + const topIsValid = obj.peekKeyword(setify(["fallback", "receive"])); + assertArgument( + topIsValid, + "type must be fallback or receive", + "obj", + errorObj, + ); + + const type = obj.popKeyword(setify(["fallback", "receive"])); + + // receive() + if (type === "receive") { + const inputs = consumeParams(obj); + assertArgument( + inputs.length === 0, + `receive cannot have arguments`, + "obj.inputs", + inputs, + ); + consumeKeywords(obj, setify(["payable"])); + consumeEoi(obj); + return new FallbackFragment(_guard, [], true); + } + + // fallback() [payable] + // fallback(bytes) [payable] returns (bytes) + let inputs = consumeParams(obj); + if (inputs.length) { + assertArgument( + inputs.length === 1 && inputs[0].type === "bytes", + "invalid fallback inputs", + "obj.inputs", + inputs.map((i) => i.format("minimal")).join(", "), + ); + } else { + inputs = [ParamType.from("bytes")]; + } + + const mutability = consumeMutability(obj); + assertArgument( + mutability === "nonpayable" || mutability === "payable", + "fallback cannot be constants", + "obj.stateMutability", + mutability, + ); + + if (consumeKeywords(obj, setify(["returns"])).has("returns")) { + const outputs = consumeParams(obj); + assertArgument( + outputs.length === 1 && outputs[0].type === "bytes", + "invalid fallback outputs", + "obj.outputs", + outputs.map((i) => i.format("minimal")).join(", "), + ); + } + + consumeEoi(obj); + + return new FallbackFragment(_guard, inputs, mutability === "payable"); + } + + if (obj.type === "receive") { + return new FallbackFragment(_guard, [], true); + } + + if (obj.type === "fallback") { + const inputs = [ParamType.from("bytes")]; + const payable = obj.stateMutability === "payable"; + return new FallbackFragment(_guard, inputs, payable); + } + + assertArgument(false, "invalid fallback description", "obj", obj); + } + + static isFragment(value: any): value is FallbackFragment { + return value && value[internal] === FallbackFragmentInternal; + } } /** * A Fragment which represents a method. */ export class FunctionFragment extends NamedFragment { - /** - * If the function is constant (e.g. ``pure`` or ``view`` functions). - */ - readonly constant!: boolean; - - /** - * The returned types for the result of calling this function. - */ - readonly outputs!: ReadonlyArray; - - /** - * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` - * or ``pure``) - */ - readonly stateMutability!: "payable" | "nonpayable" | "view" | "pure"; - - /** - * If the function can be sent value during invocation. - */ - readonly payable!: boolean; - - /** - * The amount of energy to send when calling this function - */ - readonly energy!: null | bigint; - - /** - * @private - */ - constructor( - guard: any, - name: string, - stateMutability: "payable" | "nonpayable" | "view" | "pure", - inputs: ReadonlyArray, - outputs: ReadonlyArray, - energy: null | bigint, - ) { - super(guard, "function", name, inputs); - Object.defineProperty(this, internal, { value: FunctionFragmentInternal }); - outputs = Object.freeze(outputs.slice()); - const constant = stateMutability === "view" || stateMutability === "pure"; - const payable = stateMutability === "payable"; - defineProperties(this, { - constant, - energy, - outputs, - payable, - stateMutability, - }); - } - - /** - * The Function selector. - */ - get selector(): string { - return id(this.format("sighash")).substring(0, 10); - } - - format(format?: FormatType): string { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "function", - name: this.name, - constant: this.constant, - stateMutability: - this.stateMutability !== "nonpayable" - ? this.stateMutability - : undefined, - payable: this.payable, - energy: this.energy != null ? this.energy : undefined, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - outputs: this.outputs.map((o) => JSON.parse(o.format(format))), - }); - } - - const result: string[] = []; - - if (format !== "sighash") { - result.push("function"); - } - - result.push(this.name + joinParams(format, this.inputs)); - - if (format !== "sighash") { - if (this.stateMutability !== "nonpayable") { - result.push(this.stateMutability); - } - - if (this.outputs && this.outputs.length) { - result.push("returns"); - result.push(joinParams(format, this.outputs)); - } - - if (this.energy != null) { - result.push(`@${this.energy.toString()}`); - } - } - return result.join(" "); - } - - static getSelector(name: string, params?: Array): string { - params = (params || []).map((p) => ParamType.from(p)); - const fragment = new FunctionFragment( - _guard, - name, - "view", - params, - [], - null, - ); - return fragment.selector; - } - - static from(obj: any): FunctionFragment { - if (FunctionFragment.isFragment(obj)) { - return obj; - } - - if (typeof obj === "string") { - return FunctionFragment.from(lex(obj)); - } else if (obj instanceof TokenString) { - const name = consumeName("function", obj); - const inputs = consumeParams(obj); - const mutability = consumeMutability(obj); - - let outputs: Array = []; - if (consumeKeywords(obj, setify(["returns"])).has("returns")) { - outputs = consumeParams(obj); - } - - const energy = consumeEnergy(obj); - - consumeEoi(obj); - - return new FunctionFragment( - _guard, - name, - mutability, - inputs, - outputs, - energy, - ); - } - - let stateMutability = obj.stateMutability; - - // Use legacy Solidity ABI logic if stateMutability is missing - if (stateMutability == null) { - stateMutability = "payable"; - - if (typeof obj.constant === "boolean") { - stateMutability = "view"; - if (!obj.constant) { - stateMutability = "payable"; - if (typeof obj.payable === "boolean" && !obj.payable) { - stateMutability = "nonpayable"; - } - } - } else if (typeof obj.payable === "boolean" && !obj.payable) { - stateMutability = "nonpayable"; - } - } - - // @TODO: verifyState for stateMutability (e.g. throw if - // payable: false but stateMutability is "nonpayable") - - return new FunctionFragment( - _guard, - obj.name, - stateMutability, - obj.inputs ? obj.inputs.map(ParamType.from) : [], - obj.outputs ? obj.outputs.map(ParamType.from) : [], - obj.energy != null ? obj.energy : null, - ); - } - - static isFragment(value: any): value is FunctionFragment { - return value && value[internal] === FunctionFragmentInternal; - } + /** + * If the function is constant (e.g. ``pure`` or ``view`` functions). + */ + readonly constant!: boolean; + + /** + * The returned types for the result of calling this function. + */ + readonly outputs!: ReadonlyArray; + + /** + * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` + * or ``pure``) + */ + readonly stateMutability!: "payable" | "nonpayable" | "view" | "pure"; + + /** + * If the function can be sent value during invocation. + */ + readonly payable!: boolean; + + /** + * The amount of energy to send when calling this function + */ + readonly energy!: null | bigint; + + /** + * @private + */ + constructor( + guard: any, + name: string, + stateMutability: "payable" | "nonpayable" | "view" | "pure", + inputs: ReadonlyArray, + outputs: ReadonlyArray, + energy: null | bigint, + ) { + super(guard, "function", name, inputs); + Object.defineProperty(this, internal, { value: FunctionFragmentInternal }); + outputs = Object.freeze(outputs.slice()); + const constant = stateMutability === "view" || stateMutability === "pure"; + const payable = stateMutability === "payable"; + defineProperties(this, { + constant, + energy, + outputs, + payable, + stateMutability, + }); + } + + /** + * The Function selector. + */ + get selector(): string { + return id(this.format("sighash")).substring(0, 10); + } + + format(format?: FormatType): string { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "function", + name: this.name, + constant: this.constant, + stateMutability: + this.stateMutability !== "nonpayable" + ? this.stateMutability + : undefined, + payable: this.payable, + energy: this.energy != null ? this.energy : undefined, + inputs: this.inputs.map((i) => JSON.parse(i.format(format))), + outputs: this.outputs.map((o) => JSON.parse(o.format(format))), + }); + } + + const result: string[] = []; + + if (format !== "sighash") { + result.push("function"); + } + + result.push(this.name + joinParams(format, this.inputs)); + + if (format !== "sighash") { + if (this.stateMutability !== "nonpayable") { + result.push(this.stateMutability); + } + + if (this.outputs && this.outputs.length) { + result.push("returns"); + result.push(joinParams(format, this.outputs)); + } + + if (this.energy != null) { + result.push(`@${this.energy.toString()}`); + } + } + return result.join(" "); + } + + static getSelector(name: string, params?: Array): string { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new FunctionFragment( + _guard, + name, + "view", + params, + [], + null, + ); + return fragment.selector; + } + + static from(obj: any): FunctionFragment { + if (FunctionFragment.isFragment(obj)) { + return obj; + } + + if (typeof obj === "string") { + return FunctionFragment.from(lex(obj)); + } else if (obj instanceof TokenString) { + const name = consumeName("function", obj); + const inputs = consumeParams(obj); + const mutability = consumeMutability(obj); + + let outputs: Array = []; + if (consumeKeywords(obj, setify(["returns"])).has("returns")) { + outputs = consumeParams(obj); + } + + const energy = consumeEnergy(obj); + + consumeEoi(obj); + + return new FunctionFragment( + _guard, + name, + mutability, + inputs, + outputs, + energy, + ); + } + + let stateMutability = obj.stateMutability; + + // Use legacy Solidity ABI logic if stateMutability is missing + if (stateMutability == null) { + stateMutability = "payable"; + + if (typeof obj.constant === "boolean") { + stateMutability = "view"; + if (!obj.constant) { + stateMutability = "payable"; + if (typeof obj.payable === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + } else if (typeof obj.payable === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + + // @TODO: verifyState for stateMutability (e.g. throw if + // payable: false but stateMutability is "nonpayable") + + return new FunctionFragment( + _guard, + obj.name, + stateMutability, + obj.inputs ? obj.inputs.map(ParamType.from) : [], + obj.outputs ? obj.outputs.map(ParamType.from) : [], + obj.energy != null ? obj.energy : null, + ); + } + + static isFragment(value: any): value is FunctionFragment { + return value && value[internal] === FunctionFragmentInternal; + } } /** * A Fragment which represents a structure. */ export class StructFragment extends NamedFragment { - /** - * @private - */ - constructor(guard: any, name: string, inputs: ReadonlyArray) { - super(guard, "struct", name, inputs); - Object.defineProperty(this, internal, { value: StructFragmentInternal }); - } - - format(): string { - throw new Error("@TODO"); - } - - static from(obj: any): StructFragment { - if (typeof obj === "string") { - return StructFragment.from(lex(obj)); - } else if (obj instanceof TokenString) { - const name = consumeName("struct", obj); - const inputs = consumeParams(obj); - consumeEoi(obj); - return new StructFragment(_guard, name, inputs); - } - - return new StructFragment( - _guard, - obj.name, - obj.inputs ? obj.inputs.map(ParamType.from) : [], - ); - } - - static isFragment(value: any): value is FunctionFragment { - return value && value[internal] === StructFragmentInternal; - } + /** + * @private + */ + constructor(guard: any, name: string, inputs: ReadonlyArray) { + super(guard, "struct", name, inputs); + Object.defineProperty(this, internal, { value: StructFragmentInternal }); + } + + format(): string { + throw new Error("@TODO"); + } + + static from(obj: any): StructFragment { + if (typeof obj === "string") { + return StructFragment.from(lex(obj)); + } else if (obj instanceof TokenString) { + const name = consumeName("struct", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + return new StructFragment(_guard, name, inputs); + } + + return new StructFragment( + _guard, + obj.name, + obj.inputs ? obj.inputs.map(ParamType.from) : [], + ); + } + + static isFragment(value: any): value is FunctionFragment { + return value && value[internal] === StructFragmentInternal; + } } diff --git a/src.ts/abi/index.ts b/src.ts/abi/index.ts index 255046357..639f1b745 100644 --- a/src.ts/abi/index.ts +++ b/src.ts/abi/index.ts @@ -11,36 +11,36 @@ export { AbiCoder } from "./abi-coder.js"; export { decodeBytes32String, encodeBytes32String } from "./bytes32.js"; export { - ConstructorFragment, - ErrorFragment, - EventFragment, - FallbackFragment, - Fragment, - FunctionFragment, - NamedFragment, - ParamType, - StructFragment, + ConstructorFragment, + ErrorFragment, + EventFragment, + FallbackFragment, + Fragment, + FunctionFragment, + NamedFragment, + ParamType, + StructFragment, } from "./fragments.js"; export { - checkResultErrors, - Indexed, - Interface, - ErrorDescription, - LogDescription, - TransactionDescription, - Result, + checkResultErrors, + Indexed, + Interface, + ErrorDescription, + LogDescription, + TransactionDescription, + Result, } from "./interface.js"; export { Typed } from "./typed.js"; export type { - JsonFragment, - JsonFragmentType, - FormatType, - FragmentType, - ParamTypeWalkAsyncFunc, - ParamTypeWalkFunc, + JsonFragment, + JsonFragmentType, + FormatType, + FragmentType, + ParamTypeWalkAsyncFunc, + ParamTypeWalkFunc, } from "./fragments.js"; export type { InterfaceAbi } from "./interface.js"; diff --git a/src.ts/abi/interface.ts b/src.ts/abi/interface.ts index b1943c203..4de2cf61e 100644 --- a/src.ts/abi/interface.ts +++ b/src.ts/abi/interface.ts @@ -6,38 +6,38 @@ import { id } from "../hash/index.js"; import { - concat, - dataSlice, - getBigInt, - getBytes, - getBytesCopy, - hexlify, - zeroPadValue, - isHexString, - defineProperties, - assertArgument, - toBeHex, - assert, + concat, + dataSlice, + getBigInt, + getBytes, + getBytesCopy, + hexlify, + zeroPadValue, + isHexString, + defineProperties, + assertArgument, + toBeHex, + assert, } from "../utils/index.js"; import { AbiCoder } from "./abi-coder.js"; import { checkResultErrors, Result } from "./coders/abstract-coder.js"; import { - ConstructorFragment, - ErrorFragment, - EventFragment, - FallbackFragment, - Fragment, - FunctionFragment, - ParamType, + ConstructorFragment, + ErrorFragment, + EventFragment, + FallbackFragment, + Fragment, + FunctionFragment, + ParamType, } from "./fragments.js"; import { Typed } from "./typed.js"; import type { - BigNumberish, - BytesLike, - CallExceptionError, - CallExceptionTransaction, + BigNumberish, + BytesLike, + CallExceptionError, + CallExceptionTransaction, } from "../utils/index.js"; import type { JsonFragment } from "./fragments.js"; @@ -46,127 +46,127 @@ import { sha256 } from "../crypto/sha3.js"; export { checkResultErrors, Result }; export class LogDescription { - readonly fragment!: EventFragment; - readonly name!: string; - readonly signature!: string; - readonly topic!: string; - readonly args!: Result; - - constructor(fragment: EventFragment, topic: string, args: Result) { - const name = fragment.name, - signature = fragment.format(); - defineProperties(this, { - fragment, - name, - signature, - topic, - args, - }); - } + readonly fragment!: EventFragment; + readonly name!: string; + readonly signature!: string; + readonly topic!: string; + readonly args!: Result; + + constructor(fragment: EventFragment, topic: string, args: Result) { + const name = fragment.name, + signature = fragment.format(); + defineProperties(this, { + fragment, + name, + signature, + topic, + args, + }); + } } export class TransactionDescription { - readonly fragment!: FunctionFragment; - readonly name!: string; - readonly args!: Result; - readonly signature!: string; - readonly selector!: string; - readonly value!: bigint; - - constructor( - fragment: FunctionFragment, - selector: string, - args: Result, - value: bigint, - ) { - const name = fragment.name, - signature = fragment.format(); - defineProperties(this, { - fragment, - name, - args, - signature, - selector, - value, - }); - } + readonly fragment!: FunctionFragment; + readonly name!: string; + readonly args!: Result; + readonly signature!: string; + readonly selector!: string; + readonly value!: bigint; + + constructor( + fragment: FunctionFragment, + selector: string, + args: Result, + value: bigint, + ) { + const name = fragment.name, + signature = fragment.format(); + defineProperties(this, { + fragment, + name, + args, + signature, + selector, + value, + }); + } } export class ErrorDescription { - readonly fragment!: ErrorFragment; - readonly name!: string; - readonly args!: Result; - readonly signature!: string; - readonly selector!: string; - - constructor(fragment: ErrorFragment, selector: string, args: Result) { - const name = fragment.name, - signature = fragment.format(); - defineProperties(this, { - fragment, - name, - args, - signature, - selector, - }); - } + readonly fragment!: ErrorFragment; + readonly name!: string; + readonly args!: Result; + readonly signature!: string; + readonly selector!: string; + + constructor(fragment: ErrorFragment, selector: string, args: Result) { + const name = fragment.name, + signature = fragment.format(); + defineProperties(this, { + fragment, + name, + args, + signature, + selector, + }); + } } export class Indexed { - readonly hash!: null | string; - readonly _isIndexed!: boolean; + readonly hash!: null | string; + readonly _isIndexed!: boolean; - static isIndexed(value: any): value is Indexed { - return !!(value && value._isIndexed); - } + static isIndexed(value: any): value is Indexed { + return !!(value && value._isIndexed); + } - constructor(hash: null | string) { - defineProperties(this, { hash, _isIndexed: true }); - } + constructor(hash: null | string) { + defineProperties(this, { hash, _isIndexed: true }); + } } type ErrorInfo = { - signature: string; - inputs: Array; - name: string; - reason: (...args: Array) => string; + signature: string; + inputs: Array; + name: string; + reason: (...args: Array) => string; }; // https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require const PanicReasons: Record = { - "0": "generic panic", - "1": "assert(false)", - "17": "arithmetic overflow", - "18": "division or modulo by zero", - "33": "enum overflow", - "34": "invalid encoded storage byte array accessed", - "49": "out-of-bounds array access; popping on an empty array", - "50": "out-of-bounds access of an array or bytesN", - "65": "out of memory", - "81": "uninitialized function", + "0": "generic panic", + "1": "assert(false)", + "17": "arithmetic overflow", + "18": "division or modulo by zero", + "33": "enum overflow", + "34": "invalid encoded storage byte array accessed", + "49": "out-of-bounds array access; popping on an empty array", + "50": "out-of-bounds access of an array or bytesN", + "65": "out of memory", + "81": "uninitialized function", }; const BuiltinErrors: Record = { - "0x08c379a0": { - signature: "Error(string)", - name: "Error", - inputs: ["string"], - reason: (message: string) => { - return `reverted with reason string ${JSON.stringify(message)}`; - }, - }, - "0x4e487b71": { - signature: "Panic(uint256)", - name: "Panic", - inputs: ["uint256"], - reason: (code: bigint) => { - let reason = "unknown panic code"; - if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) { - reason = PanicReasons[code.toString()]; - } - return `reverted with panic code 0x${code.toString(16)} (${reason})`; - }, - }, + "0x08c379a0": { + signature: "Error(string)", + name: "Error", + inputs: ["string"], + reason: (message: string) => { + return `reverted with reason string ${JSON.stringify(message)}`; + }, + }, + "0x4e487b71": { + signature: "Panic(uint256)", + name: "Panic", + inputs: ["uint256"], + reason: (code: bigint) => { + let reason = "unknown panic code"; + if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) { + reason = PanicReasons[code.toString()]; + } + return `reverted with panic code 0x${code.toString(16)} (${reason})`; + }, + }, }; /* @@ -194,8 +194,7 @@ function checkNames(fragment: Fragment, type: "input" | "output", params: Array< * @TODO */ export type InterfaceAbi = - | string - | ReadonlyArray; + string | ReadonlyArray; /** * An Interface abstracts many of the low-level details for @@ -208,555 +207,555 @@ export type InterfaceAbi = * The ABI can be specified by [any supported format](InterfaceAbi). */ export class Interface { - /** - * All the Contract ABI members (i.e. methods, events, errors, etc). - */ - readonly fragments!: ReadonlyArray; - - /** - * The Contract constructor. - */ - readonly deploy!: ConstructorFragment; - - /** - * The Fallback method, if any. - */ - readonly fallback!: null | FallbackFragment; - - /** - * If receiving xcb is supported. - */ - readonly receive!: boolean; - - #errors: Map; - #events: Map; - #functions: Map; - // #structs: Map; - - #abiCoder: AbiCoder; - - /** - * Create a new Interface for the %%fragments%%. - */ - constructor(fragments: InterfaceAbi) { - let abi: ReadonlyArray = []; - if (typeof fragments === "string") { - abi = JSON.parse(fragments); - } else { - abi = fragments; - } - - this.#functions = new Map(); - this.#errors = new Map(); - this.#events = new Map(); - // this.#structs = new Map(); - - const frags: Array = []; - for (const a of abi) { - try { - frags.push(Fragment.from(a)); - } catch (error) { - console.log("EE", error); - } - } - - defineProperties(this, { - fragments: Object.freeze(frags), - }); - - let fallback: null | FallbackFragment = null; - let receive = false; - - this.#abiCoder = this.getAbiCoder(); - - // Add all fragments by their signature - this.fragments.forEach((fragment, index) => { - let bucket: Map; - switch (fragment.type) { - case "constructor": - if (this.deploy) { - console.log("duplicate definition - constructor"); - return; - } - //checkNames(fragment, "input", fragment.inputs); - defineProperties(this, { - deploy: fragment, - }); - return; - - case "fallback": - if (fragment.inputs.length === 0) { - receive = true; - } else { - assertArgument( - !fallback || - (fragment).payable !== fallback.payable, - "conflicting fallback fragments", - `fragments[${index}]`, - fragment, - ); - fallback = fragment; - receive = fallback.payable; - } - return; - - case "function": - //checkNames(fragment, "input", fragment.inputs); - //checkNames(fragment, "output", (fragment).outputs); - bucket = this.#functions; - break; - - case "event": - //checkNames(fragment, "input", fragment.inputs); - bucket = this.#events; - break; - - case "error": - bucket = this.#errors; - break; - - default: - return; - } - - // Two identical entries; ignore it - const signature = fragment.format(); - if (bucket.has(signature)) { - return; - } - - bucket.set(signature, fragment); - }); - - // If we do not have a constructor add a default - if (!this.deploy) { - defineProperties(this, { - deploy: ConstructorFragment.from("constructor()"), - }); - } - - defineProperties(this, { fallback, receive }); - } - - /** - * Returns the entire Human-Readable ABI, as an array of - * signatures, optionally as %%minimal%% strings, which - * removes parameter names and unneceesary spaces. - */ - format(minimal?: boolean): Array { - const format = minimal ? "minimal" : "full"; - const abi = this.fragments.map((f) => f.format(format)); - return abi; - } - - /** - * Return the JSON-encoded ABI. This is the format Solidiy - * returns. - */ - formatJson(): string { - const abi = this.fragments.map((f) => f.format("json")); - - // We need to re-bundle the JSON fragments a bit - return JSON.stringify(abi.map((j) => JSON.parse(j))); - } - - /** - * The ABI coder that will be used to encode and decode binary - * data. - */ - getAbiCoder(): AbiCoder { - return AbiCoder.defaultAbiCoder(); - } - - // Find a function definition by any means necessary (unless it is ambiguous) - #getFunction( - key: string, - values: null | Array, - forceUnique: boolean, - ): null | FunctionFragment { - // Selector - if (isHexString(key)) { - const selector = key.toLowerCase(); - for (const fragment of this.#functions.values()) { - if (selector === fragment.selector) { - return fragment; - } - } - return null; - } - - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching: Array = []; - for (const [name, fragment] of this.#functions) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - - if (values) { - const lastValue = values.length > 0 ? values[values.length - 1] : null; - - let valueLength = values.length; - let allowOptions = true; - if (Typed.isTyped(lastValue) && lastValue.type === "overrides") { - allowOptions = false; - valueLength--; - } - - // Remove all matches that don't have a compatible length. The args - // may contain an overrides, so the match may have n or n - 1 parameters - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs.length; - if ( - inputs !== valueLength && - (!allowOptions || inputs !== valueLength - 1) - ) { - matching.splice(i, 1); - } - } - - // Remove all matches that don't match the Typed signature - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs; - for (let j = 0; j < values.length; j++) { - // Not a typed value - if (!Typed.isTyped(values[j])) { - continue; - } - - // We are past the inputs - if (j >= inputs.length) { - if (values[j].type === "overrides") { - continue; - } - matching.splice(i, 1); - break; - } - - // Make sure the value type matches the input type - if (values[j].type !== inputs[j].baseType) { - matching.splice(i, 1); - break; - } - } - } - } - // We found a single matching signature with an overrides, but the - // last value is something that cannot possibly be an options - if ( - matching.length === 1 && - values && - values.length !== matching[0].inputs.length - ) { - const lastArg = values[values.length - 1]; - if ( - lastArg == null || - Array.isArray(lastArg) || - typeof lastArg !== "object" - ) { - matching.splice(0, 1); - } - } - - if (matching.length === 0) { - return null; - } - - if (matching.length > 1 && forceUnique) { - const matchStr = matching - .map((m) => JSON.stringify(m.format())) - .join(", "); - assertArgument( - false, - `ambiguous function description (i.e. matches ${matchStr})`, - "key", - key, - ); - } - - return matching[0]; - } - - // Normalize the signature and lookup the function - const result = this.#functions.get(FunctionFragment.from(key).format()); - if (result) { - return result; - } - - return null; - } - - /** - * Get the function name for %%key%%, which may be a function selector, - * function name or function signature that belongs to the ABI. - */ - getFunctionName(key: string): string { - const fragment = this.#getFunction(key, null, false); - assertArgument(fragment, "no matching function", "key", key); - return fragment.name; - } - - /** - * Returns true if %%key%% (a function selector, function name or - * function signature) is present in the ABI. - * - * In the case of a function name, the name may be ambiguous, so - * accessing the [[FunctionFragment]] may require refinement. - */ - hasFunction(key: string): boolean { - return !!this.#getFunction(key, null, false); - } - - /** - * Get the [[FunctionFragment]] for %%key%%, which may be a function - * selector, function name or function signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple functions match by name. - * - * If the %%key%% and %%values%% do not refine to a single function in - * the ABI, this will throw. - */ - getFunction( - key: string, - values?: Array, - ): null | FunctionFragment { - return this.#getFunction(key, values || null, true); - } - - /** - * Iterate over all functions, calling %%callback%%, sorted by their name. - */ - forEachFunction( - callback: (func: FunctionFragment, index: number) => void, - ): void { - const names = Array.from(this.#functions.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#functions.get(name), i); - } - } - - // Find an event definition by any means necessary (unless it is ambiguous) - #getEvent( - key: string, - values: null | Array, - forceUnique: boolean, - ): null | EventFragment { - // EventTopic - if (isHexString(key)) { - const eventTopic = key.toLowerCase(); - for (const fragment of this.#events.values()) { - if (eventTopic === fragment.topicHash) { - return fragment; - } - } - return null; - } - - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching: any = []; - for (const [name, fragment] of this.#events) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - - if (values) { - // Remove all matches that don't have a compatible length. - for (let i = matching.length - 1; i >= 0; i--) { - if (matching[i].inputs.length < values.length) { - matching.splice(i, 1); - } - } - - // Remove all matches that don't match the Typed signature - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs; - for (let j = 0; j < values.length; j++) { - // Not a typed value - if (!Typed.isTyped(values[j])) { - continue; - } - - // Make sure the value type matches the input type - if (values[j].type !== inputs[j].baseType) { - matching.splice(i, 1); - break; - } - } - } - } - - if (matching.length === 0) { - return null; - } - - if (matching.length > 1 && forceUnique) { - const matchStr = matching - .map((m: any) => JSON.stringify(m.format())) - .join(", "); - assertArgument( - false, - `ambiguous event description (i.e. matches ${matchStr})`, - "key", - key, - ); - } - - return matching[0]; - } - - // Normalize the signature and lookup the function - const result = this.#events.get(EventFragment.from(key).format()); - if (result) { - return result; - } - - return null; - } - - /** - * Get the event name for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - */ - getEventName(key: string): string { - const fragment = this.#getEvent(key, null, false); - assertArgument(fragment, "no matching event", "key", key); - - return fragment.name; - } - - /** - * Returns true if %%key%% (an event topic hash, event name or - * event signature) is present in the ABI. - * - * In the case of an event name, the name may be ambiguous, so - * accessing the [[EventFragment]] may require refinement. - */ - hasEvent(key: string): boolean { - return !!this.#getEvent(key, null, false); - } - - /** - * Get the [[EventFragment]] for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple events match by name. - * - * If the %%key%% and %%values%% do not refine to a single event in - * the ABI, this will throw. - */ - getEvent(key: string, values?: Array): null | EventFragment { - return this.#getEvent(key, values || null, true); - } - - /** - * Iterate over all events, calling %%callback%%, sorted by their name. - */ - forEachEvent(callback: (func: EventFragment, index: number) => void): void { - const names = Array.from(this.#events.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#events.get(name), i); - } - } - - /** - * Get the [[ErrorFragment]] for %%key%%, which may be an error - * selector, error name or error signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple errors match by name. - * - * If the %%key%% and %%values%% do not refine to a single error in - * the ABI, this will throw. - */ - getError(key: string, values?: Array): null | ErrorFragment { - if (isHexString(key)) { - const selector = key.toLowerCase(); - - if (BuiltinErrors[selector]) { - return ErrorFragment.from(BuiltinErrors[selector].signature); - } - - for (const fragment of this.#errors.values()) { - if (selector === fragment.selector) { - return fragment; - } - } - - return null; - } - - // It is a bare name, look up the function (will return null if ambiguous) - if (key.indexOf("(") === -1) { - const matching: any = []; - for (const [name, fragment] of this.#errors) { - if (name.split("(" /* fix:) */)[0] === key) { - matching.push(fragment); - } - } - - if (matching.length === 0) { - if (key === "Error") { - return ErrorFragment.from("error Error(string)"); - } - if (key === "Panic") { - return ErrorFragment.from("error Panic(uint256)"); - } - return null; - } else if (matching.length > 1) { - const matchStr = matching - .map((m: any) => JSON.stringify(m.format())) - .join(", "); - assertArgument( - false, - `ambiguous error description (i.e. ${matchStr})`, - "name", - key, - ); - } - - return matching[0]; - } - - // Normalize the signature and lookup the function - key = ErrorFragment.from(key).format(); - if (key === "Error(string)") { - return ErrorFragment.from("error Error(string)"); - } - if (key === "Panic(uint256)") { - return ErrorFragment.from("error Panic(uint256)"); - } - - const result = this.#errors.get(key); - if (result) { - return result; - } - - return null; - } - - /** - * Iterate over all errors, calling %%callback%%, sorted by their name. - */ - forEachError(callback: (func: ErrorFragment, index: number) => void): void { - const names = Array.from(this.#errors.keys()); - names.sort((a, b) => a.localeCompare(b)); - for (let i = 0; i < names.length; i++) { - const name = names[i]; - callback(this.#errors.get(name), i); - } - } - - // Get the 4-byte selector used by Solidity to identify a function - /* + /** + * All the Contract ABI members (i.e. methods, events, errors, etc). + */ + readonly fragments!: ReadonlyArray; + + /** + * The Contract constructor. + */ + readonly deploy!: ConstructorFragment; + + /** + * The Fallback method, if any. + */ + readonly fallback!: null | FallbackFragment; + + /** + * If receiving xcb is supported. + */ + readonly receive!: boolean; + + #errors: Map; + #events: Map; + #functions: Map; + // #structs: Map; + + #abiCoder: AbiCoder; + + /** + * Create a new Interface for the %%fragments%%. + */ + constructor(fragments: InterfaceAbi) { + let abi: ReadonlyArray = []; + if (typeof fragments === "string") { + abi = JSON.parse(fragments); + } else { + abi = fragments; + } + + this.#functions = new Map(); + this.#errors = new Map(); + this.#events = new Map(); + // this.#structs = new Map(); + + const frags: Array = []; + for (const a of abi) { + try { + frags.push(Fragment.from(a)); + } catch (error) { + console.log("EE", error); + } + } + + defineProperties(this, { + fragments: Object.freeze(frags), + }); + + let fallback: null | FallbackFragment = null; + let receive = false; + + this.#abiCoder = this.getAbiCoder(); + + // Add all fragments by their signature + this.fragments.forEach((fragment, index) => { + let bucket: Map; + switch (fragment.type) { + case "constructor": + if (this.deploy) { + console.log("duplicate definition - constructor"); + return; + } + //checkNames(fragment, "input", fragment.inputs); + defineProperties(this, { + deploy: fragment, + }); + return; + + case "fallback": + if (fragment.inputs.length === 0) { + receive = true; + } else { + assertArgument( + !fallback || + (fragment).payable !== fallback.payable, + "conflicting fallback fragments", + `fragments[${index}]`, + fragment, + ); + fallback = fragment; + receive = fallback.payable; + } + return; + + case "function": + //checkNames(fragment, "input", fragment.inputs); + //checkNames(fragment, "output", (fragment).outputs); + bucket = this.#functions; + break; + + case "event": + //checkNames(fragment, "input", fragment.inputs); + bucket = this.#events; + break; + + case "error": + bucket = this.#errors; + break; + + default: + return; + } + + // Two identical entries; ignore it + const signature = fragment.format(); + if (bucket.has(signature)) { + return; + } + + bucket.set(signature, fragment); + }); + + // If we do not have a constructor add a default + if (!this.deploy) { + defineProperties(this, { + deploy: ConstructorFragment.from("constructor()"), + }); + } + + defineProperties(this, { fallback, receive }); + } + + /** + * Returns the entire Human-Readable ABI, as an array of + * signatures, optionally as %%minimal%% strings, which + * removes parameter names and unneceesary spaces. + */ + format(minimal?: boolean): Array { + const format = minimal ? "minimal" : "full"; + const abi = this.fragments.map((f) => f.format(format)); + return abi; + } + + /** + * Return the JSON-encoded ABI. This is the format Solidiy + * returns. + */ + formatJson(): string { + const abi = this.fragments.map((f) => f.format("json")); + + // We need to re-bundle the JSON fragments a bit + return JSON.stringify(abi.map((j) => JSON.parse(j))); + } + + /** + * The ABI coder that will be used to encode and decode binary + * data. + */ + getAbiCoder(): AbiCoder { + return AbiCoder.defaultAbiCoder(); + } + + // Find a function definition by any means necessary (unless it is ambiguous) + #getFunction( + key: string, + values: null | Array, + forceUnique: boolean, + ): null | FunctionFragment { + // Selector + if (isHexString(key)) { + const selector = key.toLowerCase(); + for (const fragment of this.#functions.values()) { + if (selector === fragment.selector) { + return fragment; + } + } + return null; + } + + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching: Array = []; + for (const [name, fragment] of this.#functions) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + + if (values) { + const lastValue = values.length > 0 ? values[values.length - 1] : null; + + let valueLength = values.length; + let allowOptions = true; + if (Typed.isTyped(lastValue) && lastValue.type === "overrides") { + allowOptions = false; + valueLength--; + } + + // Remove all matches that don't have a compatible length. The args + // may contain an overrides, so the match may have n or n - 1 parameters + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs.length; + if ( + inputs !== valueLength && + (!allowOptions || inputs !== valueLength - 1) + ) { + matching.splice(i, 1); + } + } + + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!Typed.isTyped(values[j])) { + continue; + } + + // We are past the inputs + if (j >= inputs.length) { + if (values[j].type === "overrides") { + continue; + } + matching.splice(i, 1); + break; + } + + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + // We found a single matching signature with an overrides, but the + // last value is something that cannot possibly be an options + if ( + matching.length === 1 && + values && + values.length !== matching[0].inputs.length + ) { + const lastArg = values[values.length - 1]; + if ( + lastArg == null || + Array.isArray(lastArg) || + typeof lastArg !== "object" + ) { + matching.splice(0, 1); + } + } + + if (matching.length === 0) { + return null; + } + + if (matching.length > 1 && forceUnique) { + const matchStr = matching + .map((m) => JSON.stringify(m.format())) + .join(", "); + assertArgument( + false, + `ambiguous function description (i.e. matches ${matchStr})`, + "key", + key, + ); + } + + return matching[0]; + } + + // Normalize the signature and lookup the function + const result = this.#functions.get(FunctionFragment.from(key).format()); + if (result) { + return result; + } + + return null; + } + + /** + * Get the function name for %%key%%, which may be a function selector, + * function name or function signature that belongs to the ABI. + */ + getFunctionName(key: string): string { + const fragment = this.#getFunction(key, null, false); + assertArgument(fragment, "no matching function", "key", key); + return fragment.name; + } + + /** + * Returns true if %%key%% (a function selector, function name or + * function signature) is present in the ABI. + * + * In the case of a function name, the name may be ambiguous, so + * accessing the [[FunctionFragment]] may require refinement. + */ + hasFunction(key: string): boolean { + return !!this.#getFunction(key, null, false); + } + + /** + * Get the [[FunctionFragment]] for %%key%%, which may be a function + * selector, function name or function signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple functions match by name. + * + * If the %%key%% and %%values%% do not refine to a single function in + * the ABI, this will throw. + */ + getFunction( + key: string, + values?: Array, + ): null | FunctionFragment { + return this.#getFunction(key, values || null, true); + } + + /** + * Iterate over all functions, calling %%callback%%, sorted by their name. + */ + forEachFunction( + callback: (func: FunctionFragment, index: number) => void, + ): void { + const names = Array.from(this.#functions.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback(this.#functions.get(name), i); + } + } + + // Find an event definition by any means necessary (unless it is ambiguous) + #getEvent( + key: string, + values: null | Array, + forceUnique: boolean, + ): null | EventFragment { + // EventTopic + if (isHexString(key)) { + const eventTopic = key.toLowerCase(); + for (const fragment of this.#events.values()) { + if (eventTopic === fragment.topicHash) { + return fragment; + } + } + return null; + } + + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching: any = []; + for (const [name, fragment] of this.#events) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + + if (values) { + // Remove all matches that don't have a compatible length. + for (let i = matching.length - 1; i >= 0; i--) { + if (matching[i].inputs.length < values.length) { + matching.splice(i, 1); + } + } + + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!Typed.isTyped(values[j])) { + continue; + } + + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + + if (matching.length === 0) { + return null; + } + + if (matching.length > 1 && forceUnique) { + const matchStr = matching + .map((m: any) => JSON.stringify(m.format())) + .join(", "); + assertArgument( + false, + `ambiguous event description (i.e. matches ${matchStr})`, + "key", + key, + ); + } + + return matching[0]; + } + + // Normalize the signature and lookup the function + const result = this.#events.get(EventFragment.from(key).format()); + if (result) { + return result; + } + + return null; + } + + /** + * Get the event name for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + */ + getEventName(key: string): string { + const fragment = this.#getEvent(key, null, false); + assertArgument(fragment, "no matching event", "key", key); + + return fragment.name; + } + + /** + * Returns true if %%key%% (an event topic hash, event name or + * event signature) is present in the ABI. + * + * In the case of an event name, the name may be ambiguous, so + * accessing the [[EventFragment]] may require refinement. + */ + hasEvent(key: string): boolean { + return !!this.#getEvent(key, null, false); + } + + /** + * Get the [[EventFragment]] for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple events match by name. + * + * If the %%key%% and %%values%% do not refine to a single event in + * the ABI, this will throw. + */ + getEvent(key: string, values?: Array): null | EventFragment { + return this.#getEvent(key, values || null, true); + } + + /** + * Iterate over all events, calling %%callback%%, sorted by their name. + */ + forEachEvent(callback: (func: EventFragment, index: number) => void): void { + const names = Array.from(this.#events.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback(this.#events.get(name), i); + } + } + + /** + * Get the [[ErrorFragment]] for %%key%%, which may be an error + * selector, error name or error signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple errors match by name. + * + * If the %%key%% and %%values%% do not refine to a single error in + * the ABI, this will throw. + */ + getError(key: string, values?: Array): null | ErrorFragment { + if (isHexString(key)) { + const selector = key.toLowerCase(); + + if (BuiltinErrors[selector]) { + return ErrorFragment.from(BuiltinErrors[selector].signature); + } + + for (const fragment of this.#errors.values()) { + if (selector === fragment.selector) { + return fragment; + } + } + + return null; + } + + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching: any = []; + for (const [name, fragment] of this.#errors) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + + if (matching.length === 0) { + if (key === "Error") { + return ErrorFragment.from("error Error(string)"); + } + if (key === "Panic") { + return ErrorFragment.from("error Panic(uint256)"); + } + return null; + } else if (matching.length > 1) { + const matchStr = matching + .map((m: any) => JSON.stringify(m.format())) + .join(", "); + assertArgument( + false, + `ambiguous error description (i.e. ${matchStr})`, + "name", + key, + ); + } + + return matching[0]; + } + + // Normalize the signature and lookup the function + key = ErrorFragment.from(key).format(); + if (key === "Error(string)") { + return ErrorFragment.from("error Error(string)"); + } + if (key === "Panic(uint256)") { + return ErrorFragment.from("error Panic(uint256)"); + } + + const result = this.#errors.get(key); + if (result) { + return result; + } + + return null; + } + + /** + * Iterate over all errors, calling %%callback%%, sorted by their name. + */ + forEachError(callback: (func: ErrorFragment, index: number) => void): void { + const names = Array.from(this.#errors.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback(this.#errors.get(name), i); + } + } + + // Get the 4-byte selector used by Solidity to identify a function + /* getSelector(fragment: ErrorFragment | FunctionFragment): string { if (typeof(fragment) === "string") { const matches: Array = [ ]; @@ -777,232 +776,232 @@ export class Interface { } */ - // Get the 32-byte topic hash used by Solidity to identify an event - /* + // Get the 32-byte topic hash used by Solidity to identify an event + /* getEventTopic(fragment: EventFragment): string { //if (typeof(fragment) === "string") { fragment = this.getEvent(eventFragment); } return id(fragment.format()); } */ - _decodeParams(params: ReadonlyArray, data: BytesLike): Result { - return this.#abiCoder.decode(params, data); - } - - _encodeParams( - params: ReadonlyArray, - values: ReadonlyArray, - ): string { - return this.#abiCoder.encode(params, values); - } - - /** - * Encodes a ``tx.data`` object for deploying the Contract with - * the %%values%% as the constructor arguments. - */ - encodeDeploy(values?: ReadonlyArray): string { - return this._encodeParams(this.deploy.inputs, values || []); - } - - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified error (see [[getError]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeErrorResult(fragment: ErrorFragment | string, data: BytesLike): Result { - if (typeof fragment === "string") { - const f = this.getError(fragment); - assertArgument(f, "unknown error", "fragment", fragment); - fragment = f; - } - - assertArgument( - dataSlice(data, 0, 4) === fragment.selector, - `data signature does not match error ${fragment.name}.`, - "data", - data, - ); - - return this._decodeParams(fragment.inputs, dataSlice(data, 4)); - } - - /** - * Encodes the transaction revert data for a call result that - * reverted from the the Contract with the sepcified %%error%% - * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeErrorResult( - fragment: ErrorFragment | string, - values?: ReadonlyArray, - ): string { - if (typeof fragment === "string") { - const f = this.getError(fragment); - assertArgument(f, "unknown error", "fragment", fragment); - fragment = f; - } - - return concat([ - fragment.selector, - this._encodeParams(fragment.inputs, values || []), - ]) as string; - } - - /** - * Decodes the %%data%% from a transaction ``tx.data`` for - * the function specified (see [[getFunction]] for valid values - * for %%fragment%%). - * - * Most developers should prefer the [[parseTransaction]] method - * instead, which will automatically detect the fragment. - */ - decodeFunctionData( - fragment: FunctionFragment | string, - data: BytesLike, - ): Result { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - - assertArgument( - dataSlice(data, 0, 4) === fragment.selector, - `data signature does not match function ${fragment.name}.`, - "data", - data, - ); - - return this._decodeParams(fragment.inputs, dataSlice(data, 4)); - } - - /** - * Encodes the ``tx.data`` for a transaction that calls the function - * specified (see [[getFunction]] for valid values for %%fragment%%) with - * the %%values%%. - */ - encodeFunctionData( - fragment: FunctionFragment | string, - values?: ReadonlyArray, - ): string { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - - return concat([ - fragment.selector, - this._encodeParams(fragment.inputs, values || []), - ]) as string; - } - - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeFunctionResult( - fragment: FunctionFragment | string, - data: BytesLike, - ): Result { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - - let message = "invalid length for result data"; - - const bytes = getBytesCopy(data); - if (bytes.length % 32 === 0) { - try { - return this.#abiCoder.decode(fragment.outputs, bytes); - } catch (error) { - message = "could not decode result data"; - } - } - - // Call returned data with no error, but the data is junk - assert(false, message, "BAD_DATA", { - value: hexlify(bytes), - info: { method: fragment.name, signature: fragment.format() }, - }); - } - - makeError( - _data: BytesLike, - tx: CallExceptionTransaction, - ): CallExceptionError { - const data = getBytes(_data, "data"); - - const error = AbiCoder.getBuiltinCallException("call", tx, data); - - // Not a built-in error; try finding a custom error - const customPrefix = "execution reverted (unknown custom error)"; - if (error.message.startsWith(customPrefix)) { - const selector = hexlify(data.slice(0, 4)); - - const ef = this.getError(selector); - if (ef) { - try { - const args = this.#abiCoder.decode(ef.inputs, data.slice(4)); - error.revert = { - name: ef.name, - signature: ef.format(), - args, - }; - error.reason = error.revert.signature; - error.message = `execution reverted: ${error.reason}`; - } catch (e) { - error.message = `execution reverted (coult not decode custom error)`; - } - } - } - - // Add the invocation, if available - const parsed = this.parseTransaction(tx); - if (parsed) { - error.invocation = { - method: parsed.name, - signature: parsed.signature, - args: parsed.args, - }; - } - - return error; - } - - /** - * Encodes the result data (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values - * for %%fragment%%) with %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeFunctionResult( - fragment: FunctionFragment | string, - values?: ReadonlyArray, - ): string { - if (typeof fragment === "string") { - const f = this.getFunction(fragment); - assertArgument(f, "unknown function", "fragment", fragment); - fragment = f; - } - return hexlify(this.#abiCoder.encode(fragment.outputs, values || [])); - } - /* + _decodeParams(params: ReadonlyArray, data: BytesLike): Result { + return this.#abiCoder.decode(params, data); + } + + _encodeParams( + params: ReadonlyArray, + values: ReadonlyArray, + ): string { + return this.#abiCoder.encode(params, values); + } + + /** + * Encodes a ``tx.data`` object for deploying the Contract with + * the %%values%% as the constructor arguments. + */ + encodeDeploy(values?: ReadonlyArray): string { + return this._encodeParams(this.deploy.inputs, values || []); + } + + /** + * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the + * specified error (see [[getError]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeErrorResult(fragment: ErrorFragment | string, data: BytesLike): Result { + if (typeof fragment === "string") { + const f = this.getError(fragment); + assertArgument(f, "unknown error", "fragment", fragment); + fragment = f; + } + + assertArgument( + dataSlice(data, 0, 4) === fragment.selector, + `data signature does not match error ${fragment.name}.`, + "data", + data, + ); + + return this._decodeParams(fragment.inputs, dataSlice(data, 4)); + } + + /** + * Encodes the transaction revert data for a call result that + * reverted from the the Contract with the sepcified %%error%% + * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeErrorResult( + fragment: ErrorFragment | string, + values?: ReadonlyArray, + ): string { + if (typeof fragment === "string") { + const f = this.getError(fragment); + assertArgument(f, "unknown error", "fragment", fragment); + fragment = f; + } + + return concat([ + fragment.selector, + this._encodeParams(fragment.inputs, values || []), + ]) as string; + } + + /** + * Decodes the %%data%% from a transaction ``tx.data`` for + * the function specified (see [[getFunction]] for valid values + * for %%fragment%%). + * + * Most developers should prefer the [[parseTransaction]] method + * instead, which will automatically detect the fragment. + */ + decodeFunctionData( + fragment: FunctionFragment | string, + data: BytesLike, + ): Result { + if (typeof fragment === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + + assertArgument( + dataSlice(data, 0, 4) === fragment.selector, + `data signature does not match function ${fragment.name}.`, + "data", + data, + ); + + return this._decodeParams(fragment.inputs, dataSlice(data, 4)); + } + + /** + * Encodes the ``tx.data`` for a transaction that calls the function + * specified (see [[getFunction]] for valid values for %%fragment%%) with + * the %%values%%. + */ + encodeFunctionData( + fragment: FunctionFragment | string, + values?: ReadonlyArray, + ): string { + if (typeof fragment === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + + return concat([ + fragment.selector, + this._encodeParams(fragment.inputs, values || []), + ]) as string; + } + + /** + * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the + * specified function (see [[getFunction]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeFunctionResult( + fragment: FunctionFragment | string, + data: BytesLike, + ): Result { + if (typeof fragment === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + + let message = "invalid length for result data"; + + const bytes = getBytesCopy(data); + if (bytes.length % 32 === 0) { + try { + return this.#abiCoder.decode(fragment.outputs, bytes); + } catch (error) { + message = "could not decode result data"; + } + } + + // Call returned data with no error, but the data is junk + assert(false, message, "BAD_DATA", { + value: hexlify(bytes), + info: { method: fragment.name, signature: fragment.format() }, + }); + } + + makeError( + _data: BytesLike, + tx: CallExceptionTransaction, + ): CallExceptionError { + const data = getBytes(_data, "data"); + + const error = AbiCoder.getBuiltinCallException("call", tx, data); + + // Not a built-in error; try finding a custom error + const customPrefix = "execution reverted (unknown custom error)"; + if (error.message.startsWith(customPrefix)) { + const selector = hexlify(data.slice(0, 4)); + + const ef = this.getError(selector); + if (ef) { + try { + const args = this.#abiCoder.decode(ef.inputs, data.slice(4)); + error.revert = { + name: ef.name, + signature: ef.format(), + args, + }; + error.reason = error.revert.signature; + error.message = `execution reverted: ${error.reason}`; + } catch (e) { + error.message = `execution reverted (coult not decode custom error)`; + } + } + } + + // Add the invocation, if available + const parsed = this.parseTransaction(tx); + if (parsed) { + error.invocation = { + method: parsed.name, + signature: parsed.signature, + args: parsed.args, + }; + } + + return error; + } + + /** + * Encodes the result data (e.g. from an ``xcb_call``) for the + * specified function (see [[getFunction]] for valid values + * for %%fragment%%) with %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeFunctionResult( + fragment: FunctionFragment | string, + values?: ReadonlyArray, + ): string { + if (typeof fragment === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + return hexlify(this.#abiCoder.encode(fragment.outputs, values || [])); + } + /* spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> { const promises: Array> = [ ]; const process = function(type: ParamType, value: any): any { @@ -1031,322 +1030,322 @@ export class Interface { }); } */ - // Create the filter for the event with search criteria (e.g. for xcb_filterLog) - encodeFilterTopics( - fragment: EventFragment | string, - values: ReadonlyArray, - ): Array> { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - assertArgument(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - - assert( - values.length <= fragment.inputs.length, - `too many arguments for ${fragment.format()}`, - "UNEXPECTED_ARGUMENT", - { count: values.length, expectedCount: fragment.inputs.length }, - ); - - const topics: Array> = []; - if (!fragment.anonymous) { - topics.push(fragment.topicHash); - } - - // @TODO: Use the coders for this; to properly support tuples, etc. - const encodeTopic = (param: ParamType, value: any): string => { - if (param.type === "string") { - return id(value); - } else if (param.type === "bytes") { - return sha256(hexlify(value)); - } - - if (param.type === "bool" && typeof value === "boolean") { - value = value ? "0x01" : "0x00"; - } - - if (param.type.match(/^u?int/)) { - value = toBeHex(value); - } - - // Check addresses are valid - if (param.type === "address") { - this.#abiCoder.encode(["address"], [value]); - } - return zeroPadValue(hexlify(value), 32); - //@TOOD should probably be return toHex(value, 32) - }; - - values.forEach((value, index) => { - const param = (fragment).inputs[index]; - - if (!param.indexed) { - assertArgument( - value == null, - "cannot filter non-indexed parameters; must be null", - "contract." + param.name, - value, - ); - return; - } - - if (value == null) { - topics.push(null); - } else if (param.baseType === "array" || param.baseType === "tuple") { - assertArgument( - false, - "filtering with tuples or arrays not supported", - "contract." + param.name, - value, - ); - } else if (Array.isArray(value)) { - topics.push(value.map((value) => encodeTopic(param, value))); - } else { - topics.push(encodeTopic(param, value)); - } - }); - - // Trim off trailing nulls - while (topics.length && topics[topics.length - 1] === null) { - topics.pop(); - } - - return topics; - } - - encodeEventLog( - fragment: EventFragment | string, - values: ReadonlyArray, - ): { data: string; topics: Array } { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - assertArgument(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - - const topics: Array = []; - - const dataTypes: Array = []; - const dataValues: Array = []; - - if (!fragment.anonymous) { - topics.push(fragment.topicHash); - } - - assertArgument( - values.length === fragment.inputs.length, - "event arguments/values mismatch", - "values", - values, - ); - - fragment.inputs.forEach((param, index) => { - const value = values[index]; - if (param.indexed) { - if (param.type === "string") { - topics.push(id(value)); - } else if (param.type === "bytes") { - topics.push(sha256(value)); - } else if (param.baseType === "tuple" || param.baseType === "array") { - // @TODO - throw new Error("not implemented"); - } else { - topics.push(this.#abiCoder.encode([param.type], [value])); - } - } else { - dataTypes.push(param); - dataValues.push(value); - } - }); - - return { - data: this.#abiCoder.encode(dataTypes, dataValues), - topics: topics, - }; - } - - // Decode a filter for the event and the search criteria - decodeEventLog( - fragment: EventFragment | string, - data: BytesLike, - topics?: ReadonlyArray, - ): Result { - if (typeof fragment === "string") { - const f = this.getEvent(fragment); - assertArgument(f, "unknown event", "eventFragment", fragment); - fragment = f; - } - - if (topics != null && !fragment.anonymous) { - const eventTopic = fragment.topicHash; - assertArgument( - isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, - "fragment/topic mismatch", - "topics[0]", - topics[0], - ); - topics = topics.slice(1); - } - - const indexed: Array = []; - const nonIndexed: Array = []; - const dynamic: Array = []; - - fragment.inputs.forEach((param, index) => { - if (param.indexed) { - if ( - param.type === "string" || - param.type === "bytes" || - param.baseType === "tuple" || - param.baseType === "array" - ) { - indexed.push(ParamType.from({ type: "bytes32", name: param.name })); - dynamic.push(true); - } else { - indexed.push(param); - dynamic.push(false); - } - } else { - nonIndexed.push(param); - dynamic.push(false); - } - }); - - const resultIndexed = - topics != null ? this.#abiCoder.decode(indexed, concat(topics)) : null; - const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true); - - //const result: (Array & { [ key: string ]: any }) = [ ]; - const values: Array = []; - const keys: Array = []; - let nonIndexedIndex = 0, - indexedIndex = 0; - fragment.inputs.forEach((param, index) => { - let value: any = null; - if (param.indexed) { - if (resultIndexed == null) { - value = new Indexed(null); - } else if (dynamic[index]) { - value = new Indexed(resultIndexed[indexedIndex++]); - } else { - try { - value = resultIndexed[indexedIndex++]; - } catch (error) { - value = error; - } - } - } else { - try { - value = resultNonIndexed[nonIndexedIndex++]; - } catch (error) { - value = error; - } - } - - values.push(value); - keys.push(param.name || null); - }); - - return Result.fromItems(values, keys); - } - - /** - * Parses a transaction, finding the matching function and extracts - * the parameter values along with other useful function details. - * - * If the matching function cannot be found, return null. - */ - parseTransaction(tx: { - data: string; - value?: BigNumberish; - }): null | TransactionDescription { - const data = getBytes(tx.data, "tx.data"); - const value = getBigInt(tx.value != null ? tx.value : 0, "tx.value"); - - const fragment = this.getFunction(hexlify(data.slice(0, 4))); - - if (!fragment) { - return null; - } - - const args = this.#abiCoder.decode(fragment.inputs, data.slice(4)); - return new TransactionDescription(fragment, fragment.selector, args, value); - } - - parseCallResult(data: BytesLike): Result { - throw new Error("@TODO"); - } - - /** - * Parses a receipt log, finding the matching event and extracts - * the parameter values along with other useful event details. - * - * If the matching event cannot be found, returns null. - */ - parseLog(log: { - topics: Array; - data: string; - }): null | LogDescription { - const fragment = this.getEvent(log.topics[0]); - - if (!fragment || fragment.anonymous) { - return null; - } - - // @TODO: If anonymous, and the only method, and the input count matches, should we parse? - // Probably not, because just because it is the only event in the ABI does - // not mean we have the full ABI; maybe just a fragment? - - return new LogDescription( - fragment, - fragment.topicHash, - this.decodeEventLog(fragment, log.data, log.topics), - ); - } - - /** - * Parses a revert data, finding the matching error and extracts - * the parameter values along with other useful error details. - * - * If the matching event cannot be found, returns null. - */ - parseError(data: BytesLike): null | ErrorDescription { - const hexData = hexlify(data); - - const fragment = this.getError(dataSlice(hexData, 0, 4)); - - if (!fragment) { - return null; - } - - const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4)); - return new ErrorDescription(fragment, fragment.selector, args); - } - - /** - * Creates a new [[Interface]] from the ABI %%value%%. - * - * The %%value%% may be provided as an existing [[Interface]] object, - * a JSON-encoded ABI or any Human-Readable ABI format. - */ - static from(value: InterfaceAbi | Interface): Interface { - // Already an Interface, which is immutable - if (value instanceof Interface) { - return value; - } - - // JSON - if (typeof value === "string") { - return new Interface(JSON.parse(value)); - } - - // Maybe an interface from an older version, or from a symlinked copy - if (typeof (value).format === "function") { - return new Interface((value).format("json")); - } - - // Array of fragments - return new Interface(value); - } + // Create the filter for the event with search criteria (e.g. for xcb_filterLog) + encodeFilterTopics( + fragment: EventFragment | string, + values: ReadonlyArray, + ): Array> { + if (typeof fragment === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + + assert( + values.length <= fragment.inputs.length, + `too many arguments for ${fragment.format()}`, + "UNEXPECTED_ARGUMENT", + { count: values.length, expectedCount: fragment.inputs.length }, + ); + + const topics: Array> = []; + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + + // @TODO: Use the coders for this; to properly support tuples, etc. + const encodeTopic = (param: ParamType, value: any): string => { + if (param.type === "string") { + return id(value); + } else if (param.type === "bytes") { + return sha256(hexlify(value)); + } + + if (param.type === "bool" && typeof value === "boolean") { + value = value ? "0x01" : "0x00"; + } + + if (param.type.match(/^u?int/)) { + value = toBeHex(value); + } + + // Check addresses are valid + if (param.type === "address") { + this.#abiCoder.encode(["address"], [value]); + } + return zeroPadValue(hexlify(value), 32); + //@TOOD should probably be return toHex(value, 32) + }; + + values.forEach((value, index) => { + const param = (fragment).inputs[index]; + + if (!param.indexed) { + assertArgument( + value == null, + "cannot filter non-indexed parameters; must be null", + "contract." + param.name, + value, + ); + return; + } + + if (value == null) { + topics.push(null); + } else if (param.baseType === "array" || param.baseType === "tuple") { + assertArgument( + false, + "filtering with tuples or arrays not supported", + "contract." + param.name, + value, + ); + } else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } else { + topics.push(encodeTopic(param, value)); + } + }); + + // Trim off trailing nulls + while (topics.length && topics[topics.length - 1] === null) { + topics.pop(); + } + + return topics; + } + + encodeEventLog( + fragment: EventFragment | string, + values: ReadonlyArray, + ): { data: string; topics: Array } { + if (typeof fragment === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + + const topics: Array = []; + + const dataTypes: Array = []; + const dataValues: Array = []; + + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + + assertArgument( + values.length === fragment.inputs.length, + "event arguments/values mismatch", + "values", + values, + ); + + fragment.inputs.forEach((param, index) => { + const value = values[index]; + if (param.indexed) { + if (param.type === "string") { + topics.push(id(value)); + } else if (param.type === "bytes") { + topics.push(sha256(value)); + } else if (param.baseType === "tuple" || param.baseType === "array") { + // @TODO + throw new Error("not implemented"); + } else { + topics.push(this.#abiCoder.encode([param.type], [value])); + } + } else { + dataTypes.push(param); + dataValues.push(value); + } + }); + + return { + data: this.#abiCoder.encode(dataTypes, dataValues), + topics: topics, + }; + } + + // Decode a filter for the event and the search criteria + decodeEventLog( + fragment: EventFragment | string, + data: BytesLike, + topics?: ReadonlyArray, + ): Result { + if (typeof fragment === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + + if (topics != null && !fragment.anonymous) { + const eventTopic = fragment.topicHash; + assertArgument( + isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, + "fragment/topic mismatch", + "topics[0]", + topics[0], + ); + topics = topics.slice(1); + } + + const indexed: Array = []; + const nonIndexed: Array = []; + const dynamic: Array = []; + + fragment.inputs.forEach((param, index) => { + if (param.indexed) { + if ( + param.type === "string" || + param.type === "bytes" || + param.baseType === "tuple" || + param.baseType === "array" + ) { + indexed.push(ParamType.from({ type: "bytes32", name: param.name })); + dynamic.push(true); + } else { + indexed.push(param); + dynamic.push(false); + } + } else { + nonIndexed.push(param); + dynamic.push(false); + } + }); + + const resultIndexed = + topics != null ? this.#abiCoder.decode(indexed, concat(topics)) : null; + const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true); + + //const result: (Array & { [ key: string ]: any }) = [ ]; + const values: Array = []; + const keys: Array = []; + let nonIndexedIndex = 0, + indexedIndex = 0; + fragment.inputs.forEach((param, index) => { + let value: any = null; + if (param.indexed) { + if (resultIndexed == null) { + value = new Indexed(null); + } else if (dynamic[index]) { + value = new Indexed(resultIndexed[indexedIndex++]); + } else { + try { + value = resultIndexed[indexedIndex++]; + } catch (error) { + value = error; + } + } + } else { + try { + value = resultNonIndexed[nonIndexedIndex++]; + } catch (error) { + value = error; + } + } + + values.push(value); + keys.push(param.name || null); + }); + + return Result.fromItems(values, keys); + } + + /** + * Parses a transaction, finding the matching function and extracts + * the parameter values along with other useful function details. + * + * If the matching function cannot be found, return null. + */ + parseTransaction(tx: { + data: string; + value?: BigNumberish; + }): null | TransactionDescription { + const data = getBytes(tx.data, "tx.data"); + const value = getBigInt(tx.value != null ? tx.value : 0, "tx.value"); + + const fragment = this.getFunction(hexlify(data.slice(0, 4))); + + if (!fragment) { + return null; + } + + const args = this.#abiCoder.decode(fragment.inputs, data.slice(4)); + return new TransactionDescription(fragment, fragment.selector, args, value); + } + + parseCallResult(data: BytesLike): Result { + throw new Error("@TODO"); + } + + /** + * Parses a receipt log, finding the matching event and extracts + * the parameter values along with other useful event details. + * + * If the matching event cannot be found, returns null. + */ + parseLog(log: { + topics: Array; + data: string; + }): null | LogDescription { + const fragment = this.getEvent(log.topics[0]); + + if (!fragment || fragment.anonymous) { + return null; + } + + // @TODO: If anonymous, and the only method, and the input count matches, should we parse? + // Probably not, because just because it is the only event in the ABI does + // not mean we have the full ABI; maybe just a fragment? + + return new LogDescription( + fragment, + fragment.topicHash, + this.decodeEventLog(fragment, log.data, log.topics), + ); + } + + /** + * Parses a revert data, finding the matching error and extracts + * the parameter values along with other useful error details. + * + * If the matching event cannot be found, returns null. + */ + parseError(data: BytesLike): null | ErrorDescription { + const hexData = hexlify(data); + + const fragment = this.getError(dataSlice(hexData, 0, 4)); + + if (!fragment) { + return null; + } + + const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4)); + return new ErrorDescription(fragment, fragment.selector, args); + } + + /** + * Creates a new [[Interface]] from the ABI %%value%%. + * + * The %%value%% may be provided as an existing [[Interface]] object, + * a JSON-encoded ABI or any Human-Readable ABI format. + */ + static from(value: InterfaceAbi | Interface): Interface { + // Already an Interface, which is immutable + if (value instanceof Interface) { + return value; + } + + // JSON + if (typeof value === "string") { + return new Interface(JSON.parse(value)); + } + + // Maybe an interface from an older version, or from a symlinked copy + if (typeof (value).format === "function") { + return new Interface((value).format("json")); + } + + // Array of fragments + return new Interface(value); + } } diff --git a/src.ts/abi/typed.ts b/src.ts/abi/typed.ts index a4cfc97fb..a21eac76c 100644 --- a/src.ts/abi/typed.ts +++ b/src.ts/abi/typed.ts @@ -23,482 +23,482 @@ import type { Result } from "./coders/abstract-coder.js"; const _gaurd = {}; function n(value: BigNumberish, width: number): Typed { - let signed = false; - if (width < 0) { - signed = true; - width *= -1; - } - - // @TODO: Check range is valid for value - return new Typed(_gaurd, `${signed ? "" : "u"}int${width}`, value, { - signed, - width, - }); + let signed = false; + if (width < 0) { + signed = true; + width *= -1; + } + + // @TODO: Check range is valid for value + return new Typed(_gaurd, `${signed ? "" : "u"}int${width}`, value, { + signed, + width, + }); } function b(value: BytesLike, size?: number): Typed { - // @TODO: Check range is valid for value - return new Typed(_gaurd, `bytes${size ? size : ""}`, value, { size }); + // @TODO: Check range is valid for value + return new Typed(_gaurd, `bytes${size ? size : ""}`, value, { size }); } export interface TypedNumber extends Typed { - value: number; - defaultValue(): number; - minValue(): number; - maxValue(): number; + value: number; + defaultValue(): number; + minValue(): number; + maxValue(): number; } export interface TypedBigInt extends Typed { - value: bigint; - defaultValue(): bigint; - minValue(): bigint; - maxValue(): bigint; + value: bigint; + defaultValue(): bigint; + minValue(): bigint; + maxValue(): bigint; } export interface TypedData extends Typed { - value: string; - defaultValue(): string; + value: string; + defaultValue(): string; } export interface TypedString extends Typed { - value: string; - defaultValue(): string; + value: string; + defaultValue(): string; } const _typedSymbol = Symbol.for("_corebc_typed"); export class Typed { - readonly type!: string; - readonly value!: any; - - readonly #options: any; - - readonly _typedSymbol!: Symbol; - - constructor(gaurd: any, type: string, value: any, options?: any) { - if (options == null) { - options = null; - } - assertPrivate(_gaurd, gaurd, "Typed"); - defineProperties(this, { _typedSymbol, type, value }); - this.#options = options; - - // Check the value is valid - this.format(); - } - - format(): string { - if (this.type === "array") { - throw new Error(""); - } else if (this.type === "dynamicArray") { - throw new Error(""); - } else if (this.type === "tuple") { - return `tuple(${this.value.map((v: Typed) => v.format()).join(",")})`; - } - - return this.type; - } - - defaultValue(): string | number | bigint | Result { - return 0; - } - - minValue(): string | number | bigint { - return 0; - } - - maxValue(): string | number | bigint { - return 0; - } - - isBigInt(): this is TypedBigInt { - return !!this.type.match(/^u?int[0-9]+$/); - } - - isData(): this is TypedData { - return this.type.startsWith("bytes"); - } - - isString(): this is TypedString { - return this.type === "string"; - } - - get tupleName(): null | string { - if (this.type !== "tuple") { - throw TypeError("not a tuple"); - } - return this.#options; - } - - // Returns the length of this type as an array - // - `null` indicates the length is unforced, it could be dynamic - // - `-1` indicates the length is dynamic - // - any other value indicates it is a static array and is its length - get arrayLength(): null | number { - if (this.type !== "array") { - throw TypeError("not an array"); - } - if (this.#options === true) { - return -1; - } - if (this.#options === false) { - return (>this.value).length; - } - return null; - } - - static from(type: string, value: any): Typed { - return new Typed(_gaurd, type, value); - } - - static uint8(v: BigNumberish): Typed { - return n(v, 8); - } - static uint16(v: BigNumberish): Typed { - return n(v, 16); - } - static uint24(v: BigNumberish): Typed { - return n(v, 24); - } - static uint32(v: BigNumberish): Typed { - return n(v, 32); - } - static uint40(v: BigNumberish): Typed { - return n(v, 40); - } - static uint48(v: BigNumberish): Typed { - return n(v, 48); - } - static uint56(v: BigNumberish): Typed { - return n(v, 56); - } - static uint64(v: BigNumberish): Typed { - return n(v, 64); - } - static uint72(v: BigNumberish): Typed { - return n(v, 72); - } - static uint80(v: BigNumberish): Typed { - return n(v, 80); - } - static uint88(v: BigNumberish): Typed { - return n(v, 88); - } - static uint96(v: BigNumberish): Typed { - return n(v, 96); - } - static uint104(v: BigNumberish): Typed { - return n(v, 104); - } - static uint112(v: BigNumberish): Typed { - return n(v, 112); - } - static uint120(v: BigNumberish): Typed { - return n(v, 120); - } - static uint128(v: BigNumberish): Typed { - return n(v, 128); - } - static uint136(v: BigNumberish): Typed { - return n(v, 136); - } - static uint144(v: BigNumberish): Typed { - return n(v, 144); - } - static uint152(v: BigNumberish): Typed { - return n(v, 152); - } - static uint160(v: BigNumberish): Typed { - return n(v, 160); - } - static uint168(v: BigNumberish): Typed { - return n(v, 168); - } - static uint176(v: BigNumberish): Typed { - return n(v, 176); - } - static uint184(v: BigNumberish): Typed { - return n(v, 184); - } - static uint192(v: BigNumberish): Typed { - return n(v, 192); - } - static uint200(v: BigNumberish): Typed { - return n(v, 200); - } - static uint208(v: BigNumberish): Typed { - return n(v, 208); - } - static uint216(v: BigNumberish): Typed { - return n(v, 216); - } - static uint224(v: BigNumberish): Typed { - return n(v, 224); - } - static uint232(v: BigNumberish): Typed { - return n(v, 232); - } - static uint240(v: BigNumberish): Typed { - return n(v, 240); - } - static uint248(v: BigNumberish): Typed { - return n(v, 248); - } - static uint256(v: BigNumberish): Typed { - return n(v, 256); - } - static uint(v: BigNumberish): Typed { - return n(v, 256); - } - - static int8(v: BigNumberish): Typed { - return n(v, -8); - } - static int16(v: BigNumberish): Typed { - return n(v, -16); - } - static int24(v: BigNumberish): Typed { - return n(v, -24); - } - static int32(v: BigNumberish): Typed { - return n(v, -32); - } - static int40(v: BigNumberish): Typed { - return n(v, -40); - } - static int48(v: BigNumberish): Typed { - return n(v, -48); - } - static int56(v: BigNumberish): Typed { - return n(v, -56); - } - static int64(v: BigNumberish): Typed { - return n(v, -64); - } - static int72(v: BigNumberish): Typed { - return n(v, -72); - } - static int80(v: BigNumberish): Typed { - return n(v, -80); - } - static int88(v: BigNumberish): Typed { - return n(v, -88); - } - static int96(v: BigNumberish): Typed { - return n(v, -96); - } - static int104(v: BigNumberish): Typed { - return n(v, -104); - } - static int112(v: BigNumberish): Typed { - return n(v, -112); - } - static int120(v: BigNumberish): Typed { - return n(v, -120); - } - static int128(v: BigNumberish): Typed { - return n(v, -128); - } - static int136(v: BigNumberish): Typed { - return n(v, -136); - } - static int144(v: BigNumberish): Typed { - return n(v, -144); - } - static int152(v: BigNumberish): Typed { - return n(v, -152); - } - static int160(v: BigNumberish): Typed { - return n(v, -160); - } - static int168(v: BigNumberish): Typed { - return n(v, -168); - } - static int176(v: BigNumberish): Typed { - return n(v, -176); - } - static int184(v: BigNumberish): Typed { - return n(v, -184); - } - static int192(v: BigNumberish): Typed { - return n(v, -192); - } - static int200(v: BigNumberish): Typed { - return n(v, -200); - } - static int208(v: BigNumberish): Typed { - return n(v, -208); - } - static int216(v: BigNumberish): Typed { - return n(v, -216); - } - static int224(v: BigNumberish): Typed { - return n(v, -224); - } - static int232(v: BigNumberish): Typed { - return n(v, -232); - } - static int240(v: BigNumberish): Typed { - return n(v, -240); - } - static int248(v: BigNumberish): Typed { - return n(v, -248); - } - static int256(v: BigNumberish): Typed { - return n(v, -256); - } - static int(v: BigNumberish): Typed { - return n(v, -256); - } - - static bytes1(v: BytesLike): Typed { - return b(v, 1); - } - static bytes2(v: BytesLike): Typed { - return b(v, 2); - } - static bytes3(v: BytesLike): Typed { - return b(v, 3); - } - static bytes4(v: BytesLike): Typed { - return b(v, 4); - } - static bytes5(v: BytesLike): Typed { - return b(v, 5); - } - static bytes6(v: BytesLike): Typed { - return b(v, 6); - } - static bytes7(v: BytesLike): Typed { - return b(v, 7); - } - static bytes8(v: BytesLike): Typed { - return b(v, 8); - } - static bytes9(v: BytesLike): Typed { - return b(v, 9); - } - static bytes10(v: BytesLike): Typed { - return b(v, 10); - } - static bytes11(v: BytesLike): Typed { - return b(v, 11); - } - static bytes12(v: BytesLike): Typed { - return b(v, 12); - } - static bytes13(v: BytesLike): Typed { - return b(v, 13); - } - static bytes14(v: BytesLike): Typed { - return b(v, 14); - } - static bytes15(v: BytesLike): Typed { - return b(v, 15); - } - static bytes16(v: BytesLike): Typed { - return b(v, 16); - } - static bytes17(v: BytesLike): Typed { - return b(v, 17); - } - static bytes18(v: BytesLike): Typed { - return b(v, 18); - } - static bytes19(v: BytesLike): Typed { - return b(v, 19); - } - static bytes20(v: BytesLike): Typed { - return b(v, 20); - } - static bytes21(v: BytesLike): Typed { - return b(v, 21); - } - static bytes22(v: BytesLike): Typed { - return b(v, 22); - } - static bytes23(v: BytesLike): Typed { - return b(v, 23); - } - static bytes24(v: BytesLike): Typed { - return b(v, 24); - } - static bytes25(v: BytesLike): Typed { - return b(v, 25); - } - static bytes26(v: BytesLike): Typed { - return b(v, 26); - } - static bytes27(v: BytesLike): Typed { - return b(v, 27); - } - static bytes28(v: BytesLike): Typed { - return b(v, 28); - } - static bytes29(v: BytesLike): Typed { - return b(v, 29); - } - static bytes30(v: BytesLike): Typed { - return b(v, 30); - } - static bytes31(v: BytesLike): Typed { - return b(v, 31); - } - static bytes32(v: BytesLike): Typed { - return b(v, 32); - } - - static address(v: string | Addressable): Typed { - return new Typed(_gaurd, "address", v); - } - static bool(v: any): Typed { - return new Typed(_gaurd, "bool", !!v); - } - static bytes(v: BytesLike): Typed { - return new Typed(_gaurd, "bytes", v); - } - static string(v: string): Typed { - return new Typed(_gaurd, "string", v); - } - - static array(v: Array, dynamic?: null | boolean): Typed { - throw new Error("not implemented yet"); - return new Typed(_gaurd, "array", v, dynamic); - } - - static tuple( - v: Array | Record, - name?: string, - ): Typed { - throw new Error("not implemented yet"); - return new Typed(_gaurd, "tuple", v, name); - } - - static overrides(v: Record): Typed { - return new Typed(_gaurd, "overrides", Object.assign({}, v)); - } - - /** - * Returns true only if %%value%% is a [[Typed]] instance. - */ - static isTyped(value: any): value is Typed { - return value && value._typedSymbol === _typedSymbol; - } - - /** - * If the value is a [[Typed]] instance, validates the underlying value - * and returns it, otherwise returns value directly. - * - * This is useful for functions that with to accept either a [[Typed]] - * object or values. - */ - static dereference(value: Typed | T, type: string): T { - if (Typed.isTyped(value)) { - if (value.type !== type) { - throw new Error(`invalid type: expecetd ${type}, got ${value.type}`); - } - return value.value; - } - return value; - } + readonly type!: string; + readonly value!: any; + + readonly #options: any; + + readonly _typedSymbol!: Symbol; + + constructor(gaurd: any, type: string, value: any, options?: any) { + if (options == null) { + options = null; + } + assertPrivate(_gaurd, gaurd, "Typed"); + defineProperties(this, { _typedSymbol, type, value }); + this.#options = options; + + // Check the value is valid + this.format(); + } + + format(): string { + if (this.type === "array") { + throw new Error(""); + } else if (this.type === "dynamicArray") { + throw new Error(""); + } else if (this.type === "tuple") { + return `tuple(${this.value.map((v: Typed) => v.format()).join(",")})`; + } + + return this.type; + } + + defaultValue(): string | number | bigint | Result { + return 0; + } + + minValue(): string | number | bigint { + return 0; + } + + maxValue(): string | number | bigint { + return 0; + } + + isBigInt(): this is TypedBigInt { + return !!this.type.match(/^u?int[0-9]+$/); + } + + isData(): this is TypedData { + return this.type.startsWith("bytes"); + } + + isString(): this is TypedString { + return this.type === "string"; + } + + get tupleName(): null | string { + if (this.type !== "tuple") { + throw TypeError("not a tuple"); + } + return this.#options; + } + + // Returns the length of this type as an array + // - `null` indicates the length is unforced, it could be dynamic + // - `-1` indicates the length is dynamic + // - any other value indicates it is a static array and is its length + get arrayLength(): null | number { + if (this.type !== "array") { + throw TypeError("not an array"); + } + if (this.#options === true) { + return -1; + } + if (this.#options === false) { + return (>this.value).length; + } + return null; + } + + static from(type: string, value: any): Typed { + return new Typed(_gaurd, type, value); + } + + static uint8(v: BigNumberish): Typed { + return n(v, 8); + } + static uint16(v: BigNumberish): Typed { + return n(v, 16); + } + static uint24(v: BigNumberish): Typed { + return n(v, 24); + } + static uint32(v: BigNumberish): Typed { + return n(v, 32); + } + static uint40(v: BigNumberish): Typed { + return n(v, 40); + } + static uint48(v: BigNumberish): Typed { + return n(v, 48); + } + static uint56(v: BigNumberish): Typed { + return n(v, 56); + } + static uint64(v: BigNumberish): Typed { + return n(v, 64); + } + static uint72(v: BigNumberish): Typed { + return n(v, 72); + } + static uint80(v: BigNumberish): Typed { + return n(v, 80); + } + static uint88(v: BigNumberish): Typed { + return n(v, 88); + } + static uint96(v: BigNumberish): Typed { + return n(v, 96); + } + static uint104(v: BigNumberish): Typed { + return n(v, 104); + } + static uint112(v: BigNumberish): Typed { + return n(v, 112); + } + static uint120(v: BigNumberish): Typed { + return n(v, 120); + } + static uint128(v: BigNumberish): Typed { + return n(v, 128); + } + static uint136(v: BigNumberish): Typed { + return n(v, 136); + } + static uint144(v: BigNumberish): Typed { + return n(v, 144); + } + static uint152(v: BigNumberish): Typed { + return n(v, 152); + } + static uint160(v: BigNumberish): Typed { + return n(v, 160); + } + static uint168(v: BigNumberish): Typed { + return n(v, 168); + } + static uint176(v: BigNumberish): Typed { + return n(v, 176); + } + static uint184(v: BigNumberish): Typed { + return n(v, 184); + } + static uint192(v: BigNumberish): Typed { + return n(v, 192); + } + static uint200(v: BigNumberish): Typed { + return n(v, 200); + } + static uint208(v: BigNumberish): Typed { + return n(v, 208); + } + static uint216(v: BigNumberish): Typed { + return n(v, 216); + } + static uint224(v: BigNumberish): Typed { + return n(v, 224); + } + static uint232(v: BigNumberish): Typed { + return n(v, 232); + } + static uint240(v: BigNumberish): Typed { + return n(v, 240); + } + static uint248(v: BigNumberish): Typed { + return n(v, 248); + } + static uint256(v: BigNumberish): Typed { + return n(v, 256); + } + static uint(v: BigNumberish): Typed { + return n(v, 256); + } + + static int8(v: BigNumberish): Typed { + return n(v, -8); + } + static int16(v: BigNumberish): Typed { + return n(v, -16); + } + static int24(v: BigNumberish): Typed { + return n(v, -24); + } + static int32(v: BigNumberish): Typed { + return n(v, -32); + } + static int40(v: BigNumberish): Typed { + return n(v, -40); + } + static int48(v: BigNumberish): Typed { + return n(v, -48); + } + static int56(v: BigNumberish): Typed { + return n(v, -56); + } + static int64(v: BigNumberish): Typed { + return n(v, -64); + } + static int72(v: BigNumberish): Typed { + return n(v, -72); + } + static int80(v: BigNumberish): Typed { + return n(v, -80); + } + static int88(v: BigNumberish): Typed { + return n(v, -88); + } + static int96(v: BigNumberish): Typed { + return n(v, -96); + } + static int104(v: BigNumberish): Typed { + return n(v, -104); + } + static int112(v: BigNumberish): Typed { + return n(v, -112); + } + static int120(v: BigNumberish): Typed { + return n(v, -120); + } + static int128(v: BigNumberish): Typed { + return n(v, -128); + } + static int136(v: BigNumberish): Typed { + return n(v, -136); + } + static int144(v: BigNumberish): Typed { + return n(v, -144); + } + static int152(v: BigNumberish): Typed { + return n(v, -152); + } + static int160(v: BigNumberish): Typed { + return n(v, -160); + } + static int168(v: BigNumberish): Typed { + return n(v, -168); + } + static int176(v: BigNumberish): Typed { + return n(v, -176); + } + static int184(v: BigNumberish): Typed { + return n(v, -184); + } + static int192(v: BigNumberish): Typed { + return n(v, -192); + } + static int200(v: BigNumberish): Typed { + return n(v, -200); + } + static int208(v: BigNumberish): Typed { + return n(v, -208); + } + static int216(v: BigNumberish): Typed { + return n(v, -216); + } + static int224(v: BigNumberish): Typed { + return n(v, -224); + } + static int232(v: BigNumberish): Typed { + return n(v, -232); + } + static int240(v: BigNumberish): Typed { + return n(v, -240); + } + static int248(v: BigNumberish): Typed { + return n(v, -248); + } + static int256(v: BigNumberish): Typed { + return n(v, -256); + } + static int(v: BigNumberish): Typed { + return n(v, -256); + } + + static bytes1(v: BytesLike): Typed { + return b(v, 1); + } + static bytes2(v: BytesLike): Typed { + return b(v, 2); + } + static bytes3(v: BytesLike): Typed { + return b(v, 3); + } + static bytes4(v: BytesLike): Typed { + return b(v, 4); + } + static bytes5(v: BytesLike): Typed { + return b(v, 5); + } + static bytes6(v: BytesLike): Typed { + return b(v, 6); + } + static bytes7(v: BytesLike): Typed { + return b(v, 7); + } + static bytes8(v: BytesLike): Typed { + return b(v, 8); + } + static bytes9(v: BytesLike): Typed { + return b(v, 9); + } + static bytes10(v: BytesLike): Typed { + return b(v, 10); + } + static bytes11(v: BytesLike): Typed { + return b(v, 11); + } + static bytes12(v: BytesLike): Typed { + return b(v, 12); + } + static bytes13(v: BytesLike): Typed { + return b(v, 13); + } + static bytes14(v: BytesLike): Typed { + return b(v, 14); + } + static bytes15(v: BytesLike): Typed { + return b(v, 15); + } + static bytes16(v: BytesLike): Typed { + return b(v, 16); + } + static bytes17(v: BytesLike): Typed { + return b(v, 17); + } + static bytes18(v: BytesLike): Typed { + return b(v, 18); + } + static bytes19(v: BytesLike): Typed { + return b(v, 19); + } + static bytes20(v: BytesLike): Typed { + return b(v, 20); + } + static bytes21(v: BytesLike): Typed { + return b(v, 21); + } + static bytes22(v: BytesLike): Typed { + return b(v, 22); + } + static bytes23(v: BytesLike): Typed { + return b(v, 23); + } + static bytes24(v: BytesLike): Typed { + return b(v, 24); + } + static bytes25(v: BytesLike): Typed { + return b(v, 25); + } + static bytes26(v: BytesLike): Typed { + return b(v, 26); + } + static bytes27(v: BytesLike): Typed { + return b(v, 27); + } + static bytes28(v: BytesLike): Typed { + return b(v, 28); + } + static bytes29(v: BytesLike): Typed { + return b(v, 29); + } + static bytes30(v: BytesLike): Typed { + return b(v, 30); + } + static bytes31(v: BytesLike): Typed { + return b(v, 31); + } + static bytes32(v: BytesLike): Typed { + return b(v, 32); + } + + static address(v: string | Addressable): Typed { + return new Typed(_gaurd, "address", v); + } + static bool(v: any): Typed { + return new Typed(_gaurd, "bool", !!v); + } + static bytes(v: BytesLike): Typed { + return new Typed(_gaurd, "bytes", v); + } + static string(v: string): Typed { + return new Typed(_gaurd, "string", v); + } + + static array(v: Array, dynamic?: null | boolean): Typed { + throw new Error("not implemented yet"); + return new Typed(_gaurd, "array", v, dynamic); + } + + static tuple( + v: Array | Record, + name?: string, + ): Typed { + throw new Error("not implemented yet"); + return new Typed(_gaurd, "tuple", v, name); + } + + static overrides(v: Record): Typed { + return new Typed(_gaurd, "overrides", Object.assign({}, v)); + } + + /** + * Returns true only if %%value%% is a [[Typed]] instance. + */ + static isTyped(value: any): value is Typed { + return value && value._typedSymbol === _typedSymbol; + } + + /** + * If the value is a [[Typed]] instance, validates the underlying value + * and returns it, otherwise returns value directly. + * + * This is useful for functions that with to accept either a [[Typed]] + * object or values. + */ + static dereference(value: Typed | T, type: string): T { + if (Typed.isTyped(value)) { + if (value.type !== type) { + throw new Error(`invalid type: expecetd ${type}, got ${value.type}`); + } + return value.value; + } + return value; + } } diff --git a/src.ts/address/checks.ts b/src.ts/address/checks.ts index 165b7bf56..18ff581a2 100644 --- a/src.ts/address/checks.ts +++ b/src.ts/address/checks.ts @@ -17,7 +17,7 @@ import { Addressable, AddressLike, getAddress } from "./index.js"; * //_result: */ export function isAddressable(value: any): value is Addressable { - return value && typeof value.getAddress === "function"; + return value && typeof value.getAddress === "function"; } /** @@ -46,36 +46,36 @@ export function isAddressable(value: any): value is Addressable { * //_result: */ export function isAddress(value: any): value is string { - try { - getAddress(value); - return true; - } catch (error) {} - return false; + try { + getAddress(value); + return true; + } catch (error) {} + return false; } async function checkAddress( - target: any, - promise: Promise, + target: any, + promise: Promise, ): Promise { - const result = await promise; - if ( - result == null || - result === "0x0000000000000000000000000000000000000000" - ) { - assert( - typeof target !== "string", - "unconfigured name", - "UNCONFIGURED_NAME", - { value: target }, - ); - assertArgument( - false, - "invalid AddressLike value; did not resolve to a value address", - "target", - target, - ); - } - return getAddress(result); + const result = await promise; + if ( + result == null || + result === "0x0000000000000000000000000000000000000000" + ) { + assert( + typeof target !== "string", + "unconfigured name", + "UNCONFIGURED_NAME", + { value: target }, + ); + assertArgument( + false, + "invalid AddressLike value; did not resolve to a value address", + "target", + target, + ); + } + return getAddress(result); } /** @@ -113,18 +113,18 @@ async function checkAddress( * //_error: */ export function resolveAddress(target: AddressLike): string | Promise { - if (typeof target === "string") { - return getAddress(target); + if (typeof target === "string") { + return getAddress(target); - // assert(resolver != null, "ENS resolution requires a provider", - // "UNSUPPORTED_OPERATION", { operation: "resolveName" }); + // assert(resolver != null, "ENS resolution requires a provider", + // "UNSUPPORTED_OPERATION", { operation: "resolveName" }); - // return checkAddress(target, resolver.resolveName(target)); - } else if (isAddressable(target)) { - return checkAddress(target, target.getAddress()); - } else if (target && typeof target.then === "function") { - return checkAddress(target, target); - } + // return checkAddress(target, resolver.resolveName(target)); + } else if (isAddressable(target)) { + return checkAddress(target, target.getAddress()); + } else if (target && typeof target.then === "function") { + return checkAddress(target, target); + } - assertArgument(false, "unsupported addressable value", "target", target); + assertArgument(false, "unsupported addressable value", "target", target); } diff --git a/src.ts/address/contract-address.ts b/src.ts/address/contract-address.ts index ed49fd968..80ea2e1a9 100644 --- a/src.ts/address/contract-address.ts +++ b/src.ts/address/contract-address.ts @@ -1,8 +1,8 @@ import { - concat, - // dataSlice, - getBigInt, - // encodeRlp + concat, + // dataSlice, + getBigInt, + // encodeRlp } from "../utils/index.js"; import { getAddress } from "./index.js"; @@ -34,22 +34,22 @@ const logger = new Logger("contract-address/0.0.1"); * //_result: */ export function getCreateAddress(tx: { - from: string; - nonce: BigNumberish; + from: string; + nonce: BigNumberish; }): string { - const from = getAddress(tx.from); - const nonce = getBigInt(tx.nonce, "tx.nonce"); + const from = getAddress(tx.from); + const nonce = getBigInt(tx.nonce, "tx.nonce"); - let nonceHex = nonce.toString(16); - if (nonceHex === "0") { - nonceHex = "0x"; - } else if (nonceHex.length % 2) { - nonceHex = "0x0" + nonceHex; - } else { - nonceHex = "0x" + nonceHex; - } + let nonceHex = nonce.toString(16); + if (nonceHex === "0") { + nonceHex = "0x"; + } else if (nonceHex.length % 2) { + nonceHex = "0x0" + nonceHex; + } else { + nonceHex = "0x" + nonceHex; + } - return getAddress(from); + return getAddress(from); } /** @@ -69,27 +69,27 @@ export function getCreateAddress(tx: { * //_result: */ export function getCreate2Address( - from: string, - salt: BytesLike, - initCodeHash: BytesLike, + from: string, + salt: BytesLike, + initCodeHash: BytesLike, ): string { - if (hexDataLength(salt) !== 32) { - logger.throwArgumentError("salt must be 32 bytes", "salt", salt); - } - if (hexDataLength(initCodeHash) !== 32) { - logger.throwArgumentError( - "initCodeHash must be 32 bytes", - "initCodeHash", - initCodeHash, - ); - } + if (hexDataLength(salt) !== 32) { + logger.throwArgumentError("salt must be 32 bytes", "salt", salt); + } + if (hexDataLength(initCodeHash) !== 32) { + logger.throwArgumentError( + "initCodeHash must be 32 bytes", + "initCodeHash", + initCodeHash, + ); + } - const val = hexDataSlice( - sha256(concat(["0xff", getAddress(from), salt, initCodeHash])), - 12, - ); - console.log({ "contract-address/74=>should be string": val }); - const prefix = from.substring(2, 4); - const checksum = calculateCheckSum(val, prefix); - return "0x" + prefix + checksum + removeHexPrefix(val); + const val = hexDataSlice( + sha256(concat(["0xff", getAddress(from), salt, initCodeHash])), + 12, + ); + console.log({ "contract-address/74=>should be string": val }); + const prefix = from.substring(2, 4); + const checksum = calculateCheckSum(val, prefix); + return "0x" + prefix + checksum + removeHexPrefix(val); } diff --git a/src.ts/address/index.ts b/src.ts/address/index.ts index 3e85c302e..0a27580bb 100644 --- a/src.ts/address/index.ts +++ b/src.ts/address/index.ts @@ -24,10 +24,10 @@ null; * the [balance](Provider-getBalance). */ export interface Addressable { - /** - * Get the object address. - */ - getAddress(): Promise; + /** + * Get the object address. + */ + getAddress(): Promise; } /** @@ -39,13 +39,13 @@ export type AddressLike = string | Promise | Addressable; * An interface for any object which can resolve an ENS name. */ export interface NameResolver { - /** - * Resolve to the address for the ENS %%name%%. - * - * Resolves to ``null`` if the name is unconfigued. Use - * [[resolveAddress]] (passing this object as %%resolver%%) to - * throw for names that are unconfigured. - */ + /** + * Resolve to the address for the ENS %%name%%. + * + * Resolves to ``null`` if the name is unconfigued. Use + * [[resolveAddress]] (passing this object as %%resolver%%) to + * throw for names that are unconfigured. + */ } import { BigNumber, BigNumberish } from "../bigNumber/bigNumber.js"; @@ -53,49 +53,49 @@ import { encode } from "../crypto/rlp.js"; import { sha256 } from "../crypto/sha3.js"; import { Logger } from "../logger/logger.js"; import { - arrayify, - getBytes, - hexDataSlice, - hexlify, - stripZeros, + arrayify, + getBytes, + hexDataSlice, + hexlify, + stripZeros, } from "../utils/data.js"; const logger = new Logger("address/0.0.1"); const precompiledAddresses = [ - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000001", - "0000000000000000000000000000000000000000000000000000000000000002", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000005", - "0000000000000000000000000000000000000000000000000000000000000006", - "0000000000000000000000000000000000000000000000000000000000000007", - "0000000000000000000000000000000000000000000000000000000000000008", - "0000000000000000000000000000000000000000000000000000000000000009", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000001", + "0000000000000000000000000000000000000000000000000000000000000002", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000005", + "0000000000000000000000000000000000000000000000000000000000000006", + "0000000000000000000000000000000000000000000000000000000000000007", + "0000000000000000000000000000000000000000000000000000000000000008", + "0000000000000000000000000000000000000000000000000000000000000009", ]; function removeHexPrefix(val: string): string { - return val.substring(0, 2) === "0x" ? val.substring(2) : val; + return val.substring(0, 2) === "0x" ? val.substring(2) : val; } function calculateCheckSum(_address: string, _prefix: string): string { - const address = getBytes("0x" + _address.replace("0x", "")); - const prefix = getBytes("0x" + _prefix.replace("0x", "")); - const tmpConcated = new Uint8Array([...address, ...prefix]); - const hexedConcat = hexlify(tmpConcated).replace("0x", "") + "00"; - const mods = Array.from(hexedConcat.toUpperCase(), (c) => { - const charCode = c.charCodeAt(0); - return charCode > 64 && charCode < 91 - ? (charCode - 55).toString() - : (charCode - 48).toString(); - }).join(""); - const bigVal = BigInt(mods); - const val97 = BigInt(97); - const val98 = BigInt(98); - const remainder = bigVal % val97; - const checkSum = val98 - remainder; - const result = checkSum > 9 ? checkSum.toString() : "0" + checkSum.toString(); - return result; + const address = getBytes("0x" + _address.replace("0x", "")); + const prefix = getBytes("0x" + _prefix.replace("0x", "")); + const tmpConcated = new Uint8Array([...address, ...prefix]); + const hexedConcat = hexlify(tmpConcated).replace("0x", "") + "00"; + const mods = Array.from(hexedConcat.toUpperCase(), (c) => { + const charCode = c.charCodeAt(0); + return charCode > 64 && charCode < 91 + ? (charCode - 55).toString() + : (charCode - 48).toString(); + }).join(""); + const bigVal = BigInt(mods); + const val97 = BigInt(97); + const val98 = BigInt(98); + const remainder = bigVal % val97; + const checkSum = val98 - remainder; + const result = checkSum > 9 ? checkSum.toString() : "0" + checkSum.toString(); + return result; } // See: https://en.wikipedia.org/wiki/International_Bank_Account_Number @@ -103,10 +103,10 @@ function calculateCheckSum(_address: string, _prefix: string): string { // Create lookup table const ibanLookup: { [character: string]: string } = {}; for (let i = 0; i < 10; i++) { - ibanLookup[String(i)] = String(i); + ibanLookup[String(i)] = String(i); } for (let i = 0; i < 26; i++) { - ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); + ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); } // How many decimal digits can we process? (for 64-bit float, this is 15) @@ -114,28 +114,28 @@ for (let i = 0; i < 26; i++) { const safeDigits = 15; function ibanChecksum(address: string): string { - address = address.toUpperCase(); - address = address.substring(4) + address.substring(0, 2) + "00"; + address = address.toUpperCase(); + address = address.substring(4) + address.substring(0, 2) + "00"; - let expanded = address - .split("") - .map((c) => { - return ibanLookup[c]; - }) - .join(""); + let expanded = address + .split("") + .map((c) => { + return ibanLookup[c]; + }) + .join(""); - // Javascript can handle integers safely up to 15 (decimal) digits - while (expanded.length >= safeDigits) { - let block = expanded.substring(0, safeDigits); - expanded = (parseInt(block, 10) % 97) + expanded.substring(block.length); - } + // Javascript can handle integers safely up to 15 (decimal) digits + while (expanded.length >= safeDigits) { + let block = expanded.substring(0, safeDigits); + expanded = (parseInt(block, 10) % 97) + expanded.substring(block.length); + } - let checksum = String(98 - (parseInt(expanded, 10) % 97)); - while (checksum.length < 2) { - checksum = "0" + checksum; - } + let checksum = String(98 - (parseInt(expanded, 10) % 97)); + while (checksum.length < 2) { + checksum = "0" + checksum; + } - return checksum; + return checksum; } /** @@ -174,25 +174,25 @@ function ibanChecksum(address: string): string { * //_error: */ function getAddress(address: string): string { - if (typeof address !== "string") { - logger.throwArgumentError("invalid address", "address", address); - } + if (typeof address !== "string") { + logger.throwArgumentError("invalid address", "address", address); + } - if (!address.match(/^(0x)?[0-9a-fA-F]{44}$/)) { - logger.throwArgumentError("invalid address", "address", address); - } - const raw = removeHexPrefix(address); - if (precompiledAddresses.includes(raw)) { - return "0x" + raw; - } + if (!address.match(/^(0x)?[0-9a-fA-F]{44}$/)) { + logger.throwArgumentError("invalid address", "address", address); + } + const raw = removeHexPrefix(address); + if (precompiledAddresses.includes(raw)) { + return "0x" + raw; + } - const prefix = raw.substring(0, 2); - const val = raw.substring(4); - const checksum = calculateCheckSum(val, prefix); - if (checksum !== raw.substring(2, 4)) { - logger.throwArgumentError("bad address checksum", "address", address); - } - return "0x" + prefix + checksum + val; + const prefix = raw.substring(0, 2); + const val = raw.substring(4); + const checksum = calculateCheckSum(val, prefix); + if (checksum !== raw.substring(2, 4)) { + logger.throwArgumentError("bad address checksum", "address", address); + } + return "0x" + prefix + checksum + val; } /** * The [ICAP Address format](link-icap) format is an early checksum @@ -213,55 +213,55 @@ function getAddress(address: string): string { * //_error: */ function getIcapAddress(address: string): string { - //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase(); - let base36 = BigInt(getAddress(address)).toString(36).toUpperCase(); - while (base36.length < 30) { - base36 = "0" + base36; - } - return "XE" + ibanChecksum("XE00" + base36) + base36; + //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase(); + let base36 = BigInt(getAddress(address)).toString(36).toUpperCase(); + while (base36.length < 30) { + base36 = "0" + base36; + } + return "XE" + ibanChecksum("XE00" + base36) + base36; } function networkIdToPrefix(networkId: number): string { - if (networkId == 1) { - return "cb"; - } else if (networkId == 3 || networkId == 4) { - return "ab"; - } else if (networkId > 10 || networkId == 0) { - return "ce"; - } else { - logger.throwArgumentError("bad networkId", "networkId", networkId); - return ""; - } + if (networkId == 1) { + return "cb"; + } else if (networkId == 3 || networkId == 4) { + return "ab"; + } else if (networkId > 10 || networkId == 0) { + return "ce"; + } else { + logger.throwArgumentError("bad networkId", "networkId", networkId); + return ""; + } } function getContractAddress(transaction: { - from: string; - nonce: BigNumberish; + from: string; + nonce: BigNumberish; }) { - let from: any = null; - try { - from = getAddress(transaction.from); - } catch (error) { - logger.throwArgumentError( - "missing from address", - "transaction", - transaction, - ); - } + let from: any = null; + try { + from = getAddress(transaction.from); + } catch (error) { + logger.throwArgumentError( + "missing from address", + "transaction", + transaction, + ); + } - const nonce = stripZeros( - arrayify(BigNumber.from(transaction.nonce).toHexString()), - ); - const val = hexDataSlice(sha256(encode([from, nonce])), 12); - const prefix = from.substring(2, 4); - const checksum = calculateCheckSum(val, prefix); - return "0x" + prefix + checksum + removeHexPrefix(val); + const nonce = stripZeros( + arrayify(BigNumber.from(transaction.nonce).toHexString()), + ); + const val = hexDataSlice(sha256(encode([from, nonce])), 12); + const prefix = from.substring(2, 4); + const checksum = calculateCheckSum(val, prefix); + return "0x" + prefix + checksum + removeHexPrefix(val); } export { - getAddress, - getIcapAddress, - calculateCheckSum, - networkIdToPrefix, - getContractAddress, + getAddress, + getIcapAddress, + calculateCheckSum, + networkIdToPrefix, + getContractAddress, }; diff --git a/src.ts/bigNumber/bigNumber.ts b/src.ts/bigNumber/bigNumber.ts index 92dbb6922..e0d4a888c 100644 --- a/src.ts/bigNumber/bigNumber.ts +++ b/src.ts/bigNumber/bigNumber.ts @@ -11,11 +11,11 @@ import _BN from "bn.js"; import { Logger } from "../logger/logger.js"; import { - Bytes, - Hexable, - isBytes, - hexlify, - isHexString, + Bytes, + Hexable, + isBytes, + hexlify, + isHexString, } from "../utils/data.js"; import BN = _BN.BN; @@ -28,384 +28,384 @@ const MAX_SAFE = 0x1fffffffffffff; export type BigNumberish = BigNumber | Bytes | bigint | string | number; export function isBigNumberish(value: any): value is BigNumberish { - return ( - value != null && - (BigNumber.isBigNumber(value) || - (typeof value === "number" && value % 1 === 0) || - (typeof value === "string" && !!value.match(/^-?[0-9]+$/)) || - isHexString(value) || - typeof value === "bigint" || - isBytes(value)) - ); + return ( + value != null && + (BigNumber.isBigNumber(value) || + (typeof value === "number" && value % 1 === 0) || + (typeof value === "string" && !!value.match(/^-?[0-9]+$/)) || + isHexString(value) || + typeof value === "bigint" || + isBytes(value)) + ); } // Only warn about passing 10 into radix once let _warnedToStringRadix = false; export class BigNumber implements Hexable { - readonly _hex: string; - readonly _isBigNumber: boolean; - - constructor(constructorGuard: any, hex: string) { - logger.checkNew(new.target, BigNumber); - - if (constructorGuard !== _constructorGuard) { - logger.throwError( - "cannot call constructor directly; use BigNumber.from", - Logger.errors.UNSUPPORTED_OPERATION, - { - operation: "new (BigNumber)", - }, - ); - } - - this._hex = hex; - this._isBigNumber = true; - - Object.freeze(this); - } - - fromTwos(value: number): BigNumber { - return toBigNumber(toBN(this).fromTwos(value)); - } - - toTwos(value: number): BigNumber { - return toBigNumber(toBN(this).toTwos(value)); - } - - abs(): BigNumber { - if (this._hex[0] === "-") { - return BigNumber.from(this._hex.substring(1)); - } - return this; - } - - add(other: BigNumberish): BigNumber { - return toBigNumber(toBN(this).add(toBN(other))); - } - - sub(other: BigNumberish): BigNumber { - return toBigNumber(toBN(this).sub(toBN(other))); - } - - div(other: BigNumberish): BigNumber { - const o = BigNumber.from(other); - if (o.isZero()) { - throwFault("division by zero", "div"); - } - return toBigNumber(toBN(this).div(toBN(other))); - } - - mul(other: BigNumberish): BigNumber { - return toBigNumber(toBN(this).mul(toBN(other))); - } - - mod(other: BigNumberish): BigNumber { - const value = toBN(other); - if (value.isNeg()) { - throwFault("cannot modulo negative values", "mod"); - } - return toBigNumber(toBN(this).umod(value)); - } - - pow(other: BigNumberish): BigNumber { - const value = toBN(other); - if (value.isNeg()) { - throwFault("cannot raise to negative values", "pow"); - } - return toBigNumber(toBN(this).pow(value)); - } - - and(other: BigNumberish): BigNumber { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'and' negative values", "and"); - } - return toBigNumber(toBN(this).and(value)); - } - - or(other: BigNumberish): BigNumber { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'or' negative values", "or"); - } - return toBigNumber(toBN(this).or(value)); - } - - xor(other: BigNumberish): BigNumber { - const value = toBN(other); - if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'xor' negative values", "xor"); - } - return toBigNumber(toBN(this).xor(value)); - } - - mask(value: number): BigNumber { - if (this.isNegative() || value < 0) { - throwFault("cannot mask negative values", "mask"); - } - return toBigNumber(toBN(this).maskn(value)); - } - - shl(value: number): BigNumber { - if (this.isNegative() || value < 0) { - throwFault("cannot shift negative values", "shl"); - } - return toBigNumber(toBN(this).shln(value)); - } - - shr(value: number): BigNumber { - if (this.isNegative() || value < 0) { - throwFault("cannot shift negative values", "shr"); - } - return toBigNumber(toBN(this).shrn(value)); - } - - eq(other: BigNumberish): boolean { - return toBN(this).eq(toBN(other)); - } - - lt(other: BigNumberish): boolean { - return toBN(this).lt(toBN(other)); - } - - lte(other: BigNumberish): boolean { - return toBN(this).lte(toBN(other)); - } - - gt(other: BigNumberish): boolean { - return toBN(this).gt(toBN(other)); - } - - gte(other: BigNumberish): boolean { - return toBN(this).gte(toBN(other)); - } - - isNegative(): boolean { - return this._hex[0] === "-"; - } - - isZero(): boolean { - return toBN(this).isZero(); - } - - toNumber(): number { - try { - return toBN(this).toNumber(); - } catch (error) { - throwFault("overflow", "toNumber", this.toString()); - } - // @ts-ignore - return null; - } - - toBigInt(): bigint { - try { - return BigInt(this.toString()); - } catch (e) {} - - return logger.throwError( - "this platform does not support BigInt", - Logger.errors.UNSUPPORTED_OPERATION, - { - value: this.toString(), - }, - ); - } - - toString(): string { - // Lots of people expect this, which we do not support, so check (See: #889) - if (arguments.length > 0) { - if (arguments[0] === 10) { - if (!_warnedToStringRadix) { - _warnedToStringRadix = true; - logger.warn( - "BigNumber.toString does not accept any parameters; base-10 is assumed", - ); - } - } else if (arguments[0] === 16) { - logger.throwError( - "BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", - Logger.errors.UNEXPECTED_ARGUMENT, - {}, - ); - } else { - logger.throwError( - "BigNumber.toString does not accept parameters", - Logger.errors.UNEXPECTED_ARGUMENT, - {}, - ); - } - } - return toBN(this).toString(10); - } - - toHexString(): string { - return this._hex; - } - - toJSON(key?: string): any { - return { type: "BigNumber", hex: this.toHexString() }; - } - - static from(value: any): BigNumber { - if (value instanceof BigNumber) { - return value; - } - - if (typeof value === "string") { - if (value.match(/^-?0x[0-9a-f]+$/i)) { - return new BigNumber(_constructorGuard, toHex(value)); - } - - if (value.match(/^-?[0-9]+$/)) { - return new BigNumber(_constructorGuard, toHex(new BN(value))); - } - - return logger.throwArgumentError( - "invalid BigNumber string", - "value", - value, - ); - } - - if (typeof value === "number") { - if (value % 1) { - throwFault("underflow", "BigNumber.from", value); - } - - if (value >= MAX_SAFE || value <= -MAX_SAFE) { - throwFault("overflow", "BigNumber.from", value); - } - - return BigNumber.from(String(value)); - } - - const anyValue = value; - - if (typeof anyValue === "bigint") { - return BigNumber.from(anyValue.toString()); - } - - if (isBytes(anyValue)) { - return BigNumber.from(hexlify(anyValue)); - } - - if (anyValue) { - // Hexable interface (takes priority) - if (anyValue.toHexString) { - const hex = anyValue.toHexString(); - if (typeof hex === "string") { - return BigNumber.from(hex); - } - } else { - // For now, handle legacy JSON-ified values (goes away in v6) - let hex = anyValue._hex; - - // New-form JSON - if (hex == null && anyValue.type === "BigNumber") { - hex = anyValue.hex; - } - - if (typeof hex === "string") { - if ( - isHexString(hex) || - (hex[0] === "-" && isHexString(hex.substring(1))) - ) { - return BigNumber.from(hex); - } - } - } - } - - return logger.throwArgumentError("invalid BigNumber value", "value", value); - } - - static isBigNumber(value: any): value is BigNumber { - return !!(value && value._isBigNumber); - } + readonly _hex: string; + readonly _isBigNumber: boolean; + + constructor(constructorGuard: any, hex: string) { + logger.checkNew(new.target, BigNumber); + + if (constructorGuard !== _constructorGuard) { + logger.throwError( + "cannot call constructor directly; use BigNumber.from", + Logger.errors.UNSUPPORTED_OPERATION, + { + operation: "new (BigNumber)", + }, + ); + } + + this._hex = hex; + this._isBigNumber = true; + + Object.freeze(this); + } + + fromTwos(value: number): BigNumber { + return toBigNumber(toBN(this).fromTwos(value)); + } + + toTwos(value: number): BigNumber { + return toBigNumber(toBN(this).toTwos(value)); + } + + abs(): BigNumber { + if (this._hex[0] === "-") { + return BigNumber.from(this._hex.substring(1)); + } + return this; + } + + add(other: BigNumberish): BigNumber { + return toBigNumber(toBN(this).add(toBN(other))); + } + + sub(other: BigNumberish): BigNumber { + return toBigNumber(toBN(this).sub(toBN(other))); + } + + div(other: BigNumberish): BigNumber { + const o = BigNumber.from(other); + if (o.isZero()) { + throwFault("division by zero", "div"); + } + return toBigNumber(toBN(this).div(toBN(other))); + } + + mul(other: BigNumberish): BigNumber { + return toBigNumber(toBN(this).mul(toBN(other))); + } + + mod(other: BigNumberish): BigNumber { + const value = toBN(other); + if (value.isNeg()) { + throwFault("cannot modulo negative values", "mod"); + } + return toBigNumber(toBN(this).umod(value)); + } + + pow(other: BigNumberish): BigNumber { + const value = toBN(other); + if (value.isNeg()) { + throwFault("cannot raise to negative values", "pow"); + } + return toBigNumber(toBN(this).pow(value)); + } + + and(other: BigNumberish): BigNumber { + const value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'and' negative values", "and"); + } + return toBigNumber(toBN(this).and(value)); + } + + or(other: BigNumberish): BigNumber { + const value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'or' negative values", "or"); + } + return toBigNumber(toBN(this).or(value)); + } + + xor(other: BigNumberish): BigNumber { + const value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'xor' negative values", "xor"); + } + return toBigNumber(toBN(this).xor(value)); + } + + mask(value: number): BigNumber { + if (this.isNegative() || value < 0) { + throwFault("cannot mask negative values", "mask"); + } + return toBigNumber(toBN(this).maskn(value)); + } + + shl(value: number): BigNumber { + if (this.isNegative() || value < 0) { + throwFault("cannot shift negative values", "shl"); + } + return toBigNumber(toBN(this).shln(value)); + } + + shr(value: number): BigNumber { + if (this.isNegative() || value < 0) { + throwFault("cannot shift negative values", "shr"); + } + return toBigNumber(toBN(this).shrn(value)); + } + + eq(other: BigNumberish): boolean { + return toBN(this).eq(toBN(other)); + } + + lt(other: BigNumberish): boolean { + return toBN(this).lt(toBN(other)); + } + + lte(other: BigNumberish): boolean { + return toBN(this).lte(toBN(other)); + } + + gt(other: BigNumberish): boolean { + return toBN(this).gt(toBN(other)); + } + + gte(other: BigNumberish): boolean { + return toBN(this).gte(toBN(other)); + } + + isNegative(): boolean { + return this._hex[0] === "-"; + } + + isZero(): boolean { + return toBN(this).isZero(); + } + + toNumber(): number { + try { + return toBN(this).toNumber(); + } catch (error) { + throwFault("overflow", "toNumber", this.toString()); + } + // @ts-ignore + return null; + } + + toBigInt(): bigint { + try { + return BigInt(this.toString()); + } catch (e) {} + + return logger.throwError( + "this platform does not support BigInt", + Logger.errors.UNSUPPORTED_OPERATION, + { + value: this.toString(), + }, + ); + } + + toString(): string { + // Lots of people expect this, which we do not support, so check (See: #889) + if (arguments.length > 0) { + if (arguments[0] === 10) { + if (!_warnedToStringRadix) { + _warnedToStringRadix = true; + logger.warn( + "BigNumber.toString does not accept any parameters; base-10 is assumed", + ); + } + } else if (arguments[0] === 16) { + logger.throwError( + "BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", + Logger.errors.UNEXPECTED_ARGUMENT, + {}, + ); + } else { + logger.throwError( + "BigNumber.toString does not accept parameters", + Logger.errors.UNEXPECTED_ARGUMENT, + {}, + ); + } + } + return toBN(this).toString(10); + } + + toHexString(): string { + return this._hex; + } + + toJSON(key?: string): any { + return { type: "BigNumber", hex: this.toHexString() }; + } + + static from(value: any): BigNumber { + if (value instanceof BigNumber) { + return value; + } + + if (typeof value === "string") { + if (value.match(/^-?0x[0-9a-f]+$/i)) { + return new BigNumber(_constructorGuard, toHex(value)); + } + + if (value.match(/^-?[0-9]+$/)) { + return new BigNumber(_constructorGuard, toHex(new BN(value))); + } + + return logger.throwArgumentError( + "invalid BigNumber string", + "value", + value, + ); + } + + if (typeof value === "number") { + if (value % 1) { + throwFault("underflow", "BigNumber.from", value); + } + + if (value >= MAX_SAFE || value <= -MAX_SAFE) { + throwFault("overflow", "BigNumber.from", value); + } + + return BigNumber.from(String(value)); + } + + const anyValue = value; + + if (typeof anyValue === "bigint") { + return BigNumber.from(anyValue.toString()); + } + + if (isBytes(anyValue)) { + return BigNumber.from(hexlify(anyValue)); + } + + if (anyValue) { + // Hexable interface (takes priority) + if (anyValue.toHexString) { + const hex = anyValue.toHexString(); + if (typeof hex === "string") { + return BigNumber.from(hex); + } + } else { + // For now, handle legacy JSON-ified values (goes away in v6) + let hex = anyValue._hex; + + // New-form JSON + if (hex == null && anyValue.type === "BigNumber") { + hex = anyValue.hex; + } + + if (typeof hex === "string") { + if ( + isHexString(hex) || + (hex[0] === "-" && isHexString(hex.substring(1))) + ) { + return BigNumber.from(hex); + } + } + } + } + + return logger.throwArgumentError("invalid BigNumber value", "value", value); + } + + static isBigNumber(value: any): value is BigNumber { + return !!(value && value._isBigNumber); + } } // Normalize the hex string // @ts-ignore function toHex(value: string | BN): string { - // For BN, call on the hex string - if (typeof value !== "string") { - return toHex(value.toString(16)); - } - - // If negative, prepend the negative sign to the normalized positive value - if (value[0] === "-") { - // Strip off the negative sign - value = value.substring(1); - - // Cannot have multiple negative signs (e.g. "--0x04") - if (value[0] === "-") { - logger.throwArgumentError("invalid hex", "value", value); - } - - // Call toHex on the positive component - value = toHex(value); - - // Do not allow "-0x00" - if (value === "0x00") { - return value; - } - - // Negate the value - return "-" + value; - } - - // Add a "0x" prefix if missing - if (value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - - // Normalize zero - if (value === "0x") { - return "0x00"; - } - - // Make the string even length - if (value.length % 2) { - value = "0x0" + value.substring(2); - } - - // Trim to smallest even-length string - while (value.length > 4 && value.substring(0, 4) === "0x00") { - value = "0x" + value.substring(4); - } - - return value; + // For BN, call on the hex string + if (typeof value !== "string") { + return toHex(value.toString(16)); + } + + // If negative, prepend the negative sign to the normalized positive value + if (value[0] === "-") { + // Strip off the negative sign + value = value.substring(1); + + // Cannot have multiple negative signs (e.g. "--0x04") + if (value[0] === "-") { + logger.throwArgumentError("invalid hex", "value", value); + } + + // Call toHex on the positive component + value = toHex(value); + + // Do not allow "-0x00" + if (value === "0x00") { + return value; + } + + // Negate the value + return "-" + value; + } + + // Add a "0x" prefix if missing + if (value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + + // Normalize zero + if (value === "0x") { + return "0x00"; + } + + // Make the string even length + if (value.length % 2) { + value = "0x0" + value.substring(2); + } + + // Trim to smallest even-length string + while (value.length > 4 && value.substring(0, 4) === "0x00") { + value = "0x" + value.substring(4); + } + + return value; } // @ts-ignore function toBigNumber(value: BN): BigNumber { - return BigNumber.from(toHex(value)); + return BigNumber.from(toHex(value)); } // @ts-ignore function toBN(value: BigNumberish): BN { - const hex = BigNumber.from(value).toHexString(); - if (hex[0] === "-") { - return new BN("-" + hex.substring(3), 16); - } - return new BN(hex.substring(2), 16); + const hex = BigNumber.from(value).toHexString(); + if (hex[0] === "-") { + return new BN("-" + hex.substring(3), 16); + } + return new BN(hex.substring(2), 16); } function throwFault(fault: string, operation: string, value?: any): never { - const params: any = { fault: fault, operation: operation }; - if (value != null) { - params.value = value; - } + const params: any = { fault: fault, operation: operation }; + if (value != null) { + params.value = value; + } - return logger.throwError(fault, Logger.errors.NUMERIC_FAULT, params); + return logger.throwError(fault, Logger.errors.NUMERIC_FAULT, params); } // value should have no prefix export function _base36To16(value: string): string { - return new BN(value, 36).toString(16); + return new BN(value, 36).toString(16); } // value should have no prefix export function _base16To36(value: string): string { - return new BN(value, 16).toString(36); + return new BN(value, 16).toString(36); } diff --git a/src.ts/cip/custom-units.ts b/src.ts/cip/custom-units.ts new file mode 100644 index 000000000..22593ef63 --- /dev/null +++ b/src.ts/cip/custom-units.ts @@ -0,0 +1,96 @@ +import type { AddressLike } from "../address/index.js"; +import { Contract } from "../contract/index.js"; +import type { BlockTag, ContractRunner } from "../providers/index.js"; + +export const customUnitAbi = Object.freeze([ + "function supportsUnit(string unit) view returns (bool)", + "function supportedUnits() view returns (string[])", + "function preferredUnit() view returns (string)", + "function balanceOf(address account) view returns (uint256)", + "function balanceOfUnit(address account, string unit) view returns (uint256)", +]); +export class CustomUnitDiscovery { + readonly supportedUnits: readonly string[]; + constructor( + units: readonly string[], + readonly preferredUnit: string, + ) { + this.supportedUnits = Object.freeze([...units]); + } + get isValid(): boolean { + return ( + this.supports("units") && + this.preferredUnit !== "" && + this.supports(this.preferredUnit) + ); + } + supports(unit: string): boolean { + return this.supportedUnits.includes(unit); + } +} +/** Exact balances and multiplier ratio. A zero denominator has no multiplier. */ +export class CustomUnitBalance { + constructor( + readonly canonicalAmount: bigint, + readonly unitAmount: bigint, + readonly unit: string, + ) {} + get multiplierNumerator(): bigint { + return this.unitAmount; + } + get multiplierDenominator(): bigint { + return this.canonicalAmount; + } +} +/** Core custom-unit contract convention used by Tone and Core API. */ +export class CustomUnitToken { + readonly contract: Contract; + constructor(address: string, runner: ContractRunner) { + this.contract = new Contract(address, customUnitAbi, runner); + } + async supportsUnit(unit: string, blockTag?: BlockTag): Promise { + return ( + unit.trim() !== "" && + (await this.contract.supportsUnit(unit.trim(), { blockTag })) + ); + } + async supportedUnits(blockTag?: BlockTag): Promise { + return Object.freeze( + Array.from(await this.contract.supportedUnits({ blockTag })), + ); + } + async preferredUnit(blockTag?: BlockTag): Promise { + return (await this.contract.preferredUnit({ blockTag })).trim(); + } + async discover(blockTag?: BlockTag): Promise { + if (!(await this.supportsUnit("units", blockTag))) return null; + const discovery = new CustomUnitDiscovery( + await this.supportedUnits(blockTag), + await this.preferredUnit(blockTag), + ); + return discovery.isValid ? discovery : null; + } + canonicalBalance(account: AddressLike, blockTag?: BlockTag): Promise { + return this.contract.balanceOf(account, { blockTag }); + } + balanceOfUnit( + account: AddressLike, + unit: string, + blockTag?: BlockTag, + ): Promise { + if (!unit.trim()) throw new TypeError("unit must not be empty"); + return this.contract.balanceOfUnit(account, unit.trim(), { blockTag }); + } + async balance( + account: AddressLike, + unit?: string, + blockTag?: BlockTag, + ): Promise { + const resolved = unit?.trim() || (await this.preferredUnit(blockTag)); + const [canonical, calculated] = await Promise.all([ + this.canonicalBalance(account, blockTag), + this.balanceOfUnit(account, resolved, blockTag), + ]); + return new CustomUnitBalance(canonical, calculated, resolved); + } +} diff --git a/src.ts/cip/index.ts b/src.ts/cip/index.ts new file mode 100644 index 000000000..3346c0bf9 --- /dev/null +++ b/src.ts/cip/index.ts @@ -0,0 +1,172 @@ +import { Contract } from "../contract/index.js"; +import type { + Overrides, + ContractTransactionResponse, +} from "../contract/index.js"; +import type { BlockTag, ContractRunner } from "../providers/index.js"; +import { IpfsGateway } from "../ipfs/index.js"; + +/** On-chain interface defined by CIP-150. */ +export const cip150Abi = Object.freeze([ + "function getMetadataValue(string key) view returns (string value)", + "function hasMetadataKey(string key) view returns (bool exists)", + "function isMetadataSealed(string key) view returns (bool sealed)", + "function listMetadataKeys() view returns (string[] keys)", + "function getMetadataByIndex(uint256 index) view returns (string key, string value)", + "function metadataCount() view returns (uint256 total)", + "function setMetadataValue(string key, string value)", + "function sealMetadataKey(string key)", +]); +export interface Cip150MetadataEntry { + readonly key: string; + readonly value: string; + readonly sealed?: boolean; +} +export const cip151TokenExpirationKey = "tokenExpiration"; +export const cip151TradingStopKey = "tradingStop"; +export const cip152LabKey = "lab"; + +/** Lifecycle timestamps in exact Unix seconds; absent values impose no limit. */ +export class Cip151Lifecycle { + readonly tokenExpiration: bigint | null; + readonly tradingStop: bigint | null; + constructor(metadata: Readonly> = {}) { + const parse = (key: string): bigint | null => { + const value = metadata[key]; + if (value == null || value === "") return null; + if (!/^\d+$/.test(value)) + throw new TypeError(`${key} must be a non-negative Unix timestamp`); + return BigInt(value); + }; + this.tokenExpiration = parse(cip151TokenExpirationKey); + this.tradingStop = parse(cip151TradingStopKey); + } + isExpiredAt(seconds: bigint): boolean { + return this.tokenExpiration !== null && seconds >= this.tokenExpiration; + } + isTradingStoppedAt(seconds: bigint): boolean { + return this.tradingStop !== null && seconds >= this.tradingStop; + } +} +export interface Cip152LabMeasurement { + readonly value: string | number; + readonly unit?: string; +} +/** Validates certificate structure, not the authenticity of its issuer. */ +export class Cip152LabCertificate { + readonly measurements: Readonly>; + constructor(json: unknown) { + if (json === null || typeof json !== "object" || Array.isArray(json)) + throw new TypeError("CIP-152 lab.json must be an object"); + const measurements: Record = + Object.create(null); + for (const [key, property] of Object.entries(json)) { + if ( + !property || + typeof property !== "object" || + Array.isArray(property) || + !Object.hasOwn(property, "value") + ) + throw new TypeError(`CIP-152 property ${key} must contain a value`); + const { value, unit } = property; + if (!( + typeof value === "string" || + (typeof value === "number" && Number.isFinite(value)) + )) + throw new TypeError(`CIP-152 property ${key} has an invalid value`); + if (unit != null && typeof unit !== "string") + throw new TypeError(`CIP-152 property ${key} has an invalid unit`); + measurements[key] = Object.freeze( + unit == null ? { value } : { value, unit }, + ); + } + this.measurements = Object.freeze(measurements); + } +} +/** Typed metadata reader and writer. Writes require a signer as runner. */ +export class Cip150MetadataContract { + readonly contract: Contract; + constructor(address: string, runner: ContractRunner) { + this.contract = new Contract(address, cip150Abi, runner); + } + getValue(key: string, blockTag?: BlockTag): Promise { + return this.contract.getMetadataValue(key, { blockTag }); + } + hasKey(key: string, blockTag?: BlockTag): Promise { + return this.contract.hasMetadataKey(key, { blockTag }); + } + isSealed(key: string, blockTag?: BlockTag): Promise { + return this.contract.isMetadataSealed(key, { blockTag }); + } + async listKeys(blockTag?: BlockTag): Promise { + return Object.freeze( + Array.from(await this.contract.listMetadataKeys({ blockTag })), + ); + } + async getByIndex( + index: bigint, + blockTag?: BlockTag, + ): Promise { + const [key, value] = await this.contract.getMetadataByIndex(index, { + blockTag, + }); + return Object.freeze({ key, value }); + } + count(blockTag?: BlockTag): Promise { + return this.contract.metadataCount({ blockTag }); + } + async readAll( + blockTag?: BlockTag, + includeSealedState = true, + ): Promise { + const entries = []; + for (const key of await this.listKeys(blockTag)) { + const value = await this.getValue(key, blockTag); + entries.push( + Object.freeze( + includeSealedState + ? { key, value, sealed: await this.isSealed(key, blockTag) } + : { key, value }, + ), + ); + } + return Object.freeze(entries); + } + setValue( + key: string, + value: string, + overrides: Overrides = {}, + ): Promise { + return this.contract.setMetadataValue(key, value, overrides); + } + sealKey( + key: string, + overrides: Overrides = {}, + ): Promise { + return this.contract.sealMetadataKey(key, overrides); + } + async readLifecycle(blockTag?: BlockTag): Promise { + const metadata: Record = {}; + for (const key of [cip151TokenExpirationKey, cip151TradingStopKey]) { + if (await this.hasKey(key, blockTag)) + metadata[key] = await this.getValue(key, blockTag); + } + return new Cip151Lifecycle(metadata); + } + async readLabCertificate( + gateway: IpfsGateway, + blockTag?: BlockTag, + ): Promise { + if (!(await this.hasKey(cip152LabKey, blockTag))) return null; + const reference = await this.getValue(cip152LabKey, blockTag); + if (!gateway.resolve(reference).pathname.endsWith("/lab.json")) + throw new TypeError("CIP-152 reference must point to lab.json"); + return new Cip152LabCertificate(await gateway.readJson(reference)); + } +} +export { + CustomUnitToken, + CustomUnitBalance, + CustomUnitDiscovery, + customUnitAbi, +} from "./custom-units.js"; diff --git a/src.ts/constants/hashes.ts b/src.ts/constants/hashes.ts index bd777a13b..e61fd9062 100644 --- a/src.ts/constants/hashes.ts +++ b/src.ts/constants/hashes.ts @@ -4,4 +4,4 @@ * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) */ export const ZeroHash: string = - "0x0000000000000000000000000000000000000000000000000000000000000000"; + "0x0000000000000000000000000000000000000000000000000000000000000000"; diff --git a/src.ts/constants/index.ts b/src.ts/constants/index.ts index 658cd66b6..1c28cc972 100644 --- a/src.ts/constants/index.ts +++ b/src.ts/constants/index.ts @@ -7,14 +7,14 @@ export { ZeroAddress } from "./addresses.js"; export { ZeroHash } from "./hashes.js"; export { - N, - NegativeOne, - Zero, - One, - Two, - OrePerXCB, - MaxUint256, - MinInt256, - MaxInt256, + N, + NegativeOne, + Zero, + One, + Two, + OrePerXCB, + MaxUint256, + MinInt256, + MaxInt256, } from "./numbers.js"; export { CoreSymbol, MessagePrefix } from "./strings.js"; diff --git a/src.ts/constants/numbers.ts b/src.ts/constants/numbers.ts index a7855d6f6..2f34b2a97 100644 --- a/src.ts/constants/numbers.ts +++ b/src.ts/constants/numbers.ts @@ -4,7 +4,7 @@ * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) */ export const N: bigint = BigInt( - "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", + "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", ); /** @@ -20,7 +20,7 @@ export const OrePerXCB: bigint = BigInt("1000000000000000000"); * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) */ export const MaxUint256: bigint = BigInt( - "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", ); /** @@ -29,8 +29,8 @@ export const MaxUint256: bigint = BigInt( * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) */ export const MinInt256: bigint = - BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * - BigInt(-1); + BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * + BigInt(-1); /** * A constant for the maximum value for an ``int256``. @@ -38,7 +38,7 @@ export const MinInt256: bigint = * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) */ export const MaxInt256: bigint = BigInt( - "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", ); export const NegativeOne: bigint = /*#__PURE__*/ BigInt(-1); diff --git a/src.ts/contract/contract.ts b/src.ts/contract/contract.ts index 36ed8bc9c..59b8b3d6b 100644 --- a/src.ts/contract/contract.ts +++ b/src.ts/contract/contract.ts @@ -1,130 +1,130 @@ import { Indexed, Interface, Typed } from "../abi/index.js"; import { resolveAddress } from "../address/checks.js"; import { - copyRequest, - Log, - TransactionResponse, + copyRequest, + Log, + TransactionResponse, } from "../providers/provider.js"; import { - defineProperties, - isCallException, - isHexString, - resolveProperties, - makeError, - assert, - assertArgument, + defineProperties, + isCallException, + isHexString, + resolveProperties, + makeError, + assert, + assertArgument, } from "../utils/index.js"; import { - ContractEventPayload, - ContractUnknownEventPayload, - ContractTransactionResponse, - EventLog, + ContractEventPayload, + ContractUnknownEventPayload, + ContractTransactionResponse, + EventLog, } from "./wrappers.js"; import type { - EventFragment, - FunctionFragment, - InterfaceAbi, - ParamType, - Result, + EventFragment, + FunctionFragment, + InterfaceAbi, + ParamType, + Result, } from "../abi/index.js"; import type { Addressable } from "../address/index.js"; import type { EventEmitterable, Listener } from "../utils/index.js"; import type { - BlockTag, - ContractRunner, - Provider, - TransactionRequest, - TopicFilter, + BlockTag, + ContractRunner, + Provider, + TransactionRequest, + TopicFilter, } from "../providers/index.js"; import type { - BaseContractMethod, - ContractEventName, - ContractInterface, - ContractMethodArgs, - ContractMethod, - ContractEventArgs, - ContractEvent, - ContractTransaction, - DeferredTopicFilter, - WrappedFallback, + BaseContractMethod, + ContractEventName, + ContractInterface, + ContractMethodArgs, + ContractMethod, + ContractEventArgs, + ContractEvent, + ContractTransaction, + DeferredTopicFilter, + WrappedFallback, } from "./types.js"; const BN_0 = BigInt(0); interface ContractRunnerCaller extends ContractRunner { - call: (tx: TransactionRequest) => Promise; + call: (tx: TransactionRequest) => Promise; } interface ContractRunnerEstimater extends ContractRunner { - estimateEnergy: (tx: TransactionRequest) => Promise; + estimateEnergy: (tx: TransactionRequest) => Promise; } interface ContractRunnerSender extends ContractRunner { - sendTransaction: (tx: TransactionRequest) => Promise; + sendTransaction: (tx: TransactionRequest) => Promise; } interface ContractRunnerResolver extends ContractRunner { - resolveName: (name: string | Addressable) => Promise; + resolveName: (name: string | Addressable) => Promise; } function canCall(value: any): value is ContractRunnerCaller { - return value && typeof value.call === "function"; + return value && typeof value.call === "function"; } function canEstimate(value: any): value is ContractRunnerEstimater { - return value && typeof value.estimateEnergy === "function"; + return value && typeof value.estimateEnergy === "function"; } function canResolve(value: any): value is ContractRunnerResolver { - return value && typeof value.resolveName === "function"; + return value && typeof value.resolveName === "function"; } function canSend(value: any): value is ContractRunnerSender { - return value && typeof value.sendTransaction === "function"; + return value && typeof value.sendTransaction === "function"; } class PreparedTopicFilter implements DeferredTopicFilter { - #filter: Promise; - readonly fragment!: EventFragment; - - constructor( - contract: BaseContract, - fragment: EventFragment, - args: Array, - ) { - defineProperties(this, { fragment }); - if (fragment.inputs.length < args.length) { - throw new Error("too many arguments"); - } - - // Recursively descend into args and resolve any addresses - this.#filter = (async function () { - const resolvedArgs = await Promise.all( - fragment.inputs.map((param, index) => { - const arg = args[index]; - if (arg == null) { - return null; - } - - return param.walkAsync(args[index], (type, value) => { - if (type === "address") { - return resolveAddress(value); - } - return value; - }); - }), - ); - - return contract.interface.encodeFilterTopics(fragment, resolvedArgs); - })(); - } - - getTopicFilter(): Promise { - return this.#filter; - } + #filter: Promise; + readonly fragment!: EventFragment; + + constructor( + contract: BaseContract, + fragment: EventFragment, + args: Array, + ) { + defineProperties(this, { fragment }); + if (fragment.inputs.length < args.length) { + throw new Error("too many arguments"); + } + + // Recursively descend into args and resolve any addresses + this.#filter = (async function () { + const resolvedArgs = await Promise.all( + fragment.inputs.map((param, index) => { + const arg = args[index]; + if (arg == null) { + return null; + } + + return param.walkAsync(args[index], (type, value) => { + if (type === "address") { + return resolveAddress(value); + } + return value; + }); + }), + ); + + return contract.interface.encodeFilterTopics(fragment, resolvedArgs); + })(); + } + + getTopicFilter(): Promise { + return this.#filter; + } } // A = Arguments passed in as a tuple @@ -135,411 +135,411 @@ class PreparedTopicFilter implements DeferredTopicFilter { //export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> { function getRunner( - value: any, - feature: keyof ContractRunner, + value: any, + feature: keyof ContractRunner, ): null | T { - if (value == null) { - return null; - } - if (typeof value[feature] === "function") { - return value; - } - if (value.provider && typeof value.provider[feature] === "function") { - return value.provider; - } - return null; + if (value == null) { + return null; + } + if (typeof value[feature] === "function") { + return value; + } + if (value.provider && typeof value.provider[feature] === "function") { + return value.provider; + } + return null; } function getProvider(value: null | ContractRunner): null | Provider { - if (value == null) { - return null; - } - return value.provider || null; + if (value == null) { + return null; + } + return value.provider || null; } /** * @_ignore: */ export async function copyOverrides( - arg: any, - allowed?: Array, + arg: any, + allowed?: Array, ): Promise> { - // Create a shallow copy (we'll deep-ify anything needed during normalizing) - const overrides = copyRequest(Typed.dereference(arg, "overrides")); - - assertArgument( - overrides.to == null || (allowed || []).indexOf("to") >= 0, - "cannot override to", - "overrides.to", - overrides.to, - ); - assertArgument( - overrides.data == null || (allowed || []).indexOf("data") >= 0, - "cannot override data", - "overrides.data", - overrides.data, - ); - - // Resolve any from - if (overrides.from) { - overrides.from = await resolveAddress(overrides.from); - } - - return >overrides; + // Create a shallow copy (we'll deep-ify anything needed during normalizing) + const overrides = copyRequest(Typed.dereference(arg, "overrides")); + + assertArgument( + overrides.to == null || (allowed || []).indexOf("to") >= 0, + "cannot override to", + "overrides.to", + overrides.to, + ); + assertArgument( + overrides.data == null || (allowed || []).indexOf("data") >= 0, + "cannot override data", + "overrides.data", + overrides.data, + ); + + // Resolve any from + if (overrides.from) { + overrides.from = await resolveAddress(overrides.from); + } + + return >overrides; } /** * @_ignore: */ export async function resolveArgs( - _runner: null | ContractRunner, - inputs: ReadonlyArray, - args: Array, + _runner: null | ContractRunner, + inputs: ReadonlyArray, + args: Array, ): Promise> { - // Recursively descend into args and resolve any addresses - return await Promise.all( - inputs.map((param, index) => { - return param.walkAsync(args[index], (type, value) => { - value = Typed.dereference(value, type); - if (type === "address") { - return resolveAddress(value); - } - return value; - }); - }), - ); + // Recursively descend into args and resolve any addresses + return await Promise.all( + inputs.map((param, index) => { + return param.walkAsync(args[index], (type, value) => { + value = Typed.dereference(value, type); + if (type === "address") { + return resolveAddress(value); + } + return value; + }); + }), + ); } function buildWrappedFallback(contract: BaseContract): WrappedFallback { - const populateTransaction = async function ( - overrides?: Omit, - ): Promise { - // If an overrides was passed in, copy it and normalize the values - - const tx: ContractTransaction = ( - await copyOverrides<"data">(overrides, ["data"]) - ); - tx.to = await contract.getAddress(); - - const iface = contract.interface; - - // Only allow payable contracts to set non-zero value - const payable = iface.receive || (iface.fallback && iface.fallback.payable); - assertArgument( - payable || (tx.value || BN_0) === BN_0, - "cannot send value to non-payable contract", - "overrides.value", - tx.value, - ); - - // Only allow fallback contracts to set non-empty data - assertArgument( - iface.fallback || (tx.data || "0x") === "0x", - "cannot send data to receive-only contract", - "overrides.data", - tx.data, - ); - - return tx; - }; - - const staticCall = async function ( - overrides?: Omit, - ): Promise { - const runner = getRunner(contract.runner, "call"); - assert( - canCall(runner), - "contract runner does not support calling", - "UNSUPPORTED_OPERATION", - { operation: "call" }, - ); - - const tx = await populateTransaction(overrides); - - try { - return await runner.call(tx); - } catch (error: any) { - if (isCallException(error) && error.data) { - throw contract.interface.makeError(error.data, tx); - } - throw error; - } - }; - - const send = async function ( - overrides?: Omit, - ): Promise { - const runner = contract.runner; - assert( - canSend(runner), - "contract runner does not support sending transactions", - "UNSUPPORTED_OPERATION", - { operation: "sendTransaction" }, - ); - - const tx = await runner.sendTransaction( - await populateTransaction(overrides), - ); - const provider = getProvider(contract.runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - return new ContractTransactionResponse( - contract.interface, - provider, - tx, - ); - }; - - const estimateEnergy = async function ( - overrides?: Omit, - ): Promise { - const runner = getRunner(contract.runner, "estimateEnergy"); - assert( - canEstimate(runner), - "contract runner does not support energy estimation", - "UNSUPPORTED_OPERATION", - { operation: "estimateEnergy" }, - ); - - return await runner.estimateEnergy(await populateTransaction(overrides)); - }; - - const method = async (overrides?: Omit) => { - return await send(overrides); - }; - - defineProperties(method, { - _contract: contract, - - estimateEnergy, - populateTransaction, - send, - staticCall, - }); - - return method; + const populateTransaction = async function ( + overrides?: Omit, + ): Promise { + // If an overrides was passed in, copy it and normalize the values + + const tx: ContractTransaction = ( + await copyOverrides<"data">(overrides, ["data"]) + ); + tx.to = await contract.getAddress(); + + const iface = contract.interface; + + // Only allow payable contracts to set non-zero value + const payable = iface.receive || (iface.fallback && iface.fallback.payable); + assertArgument( + payable || (tx.value || BN_0) === BN_0, + "cannot send value to non-payable contract", + "overrides.value", + tx.value, + ); + + // Only allow fallback contracts to set non-empty data + assertArgument( + iface.fallback || (tx.data || "0x") === "0x", + "cannot send data to receive-only contract", + "overrides.data", + tx.data, + ); + + return tx; + }; + + const staticCall = async function ( + overrides?: Omit, + ): Promise { + const runner = getRunner(contract.runner, "call"); + assert( + canCall(runner), + "contract runner does not support calling", + "UNSUPPORTED_OPERATION", + { operation: "call" }, + ); + + const tx = await populateTransaction(overrides); + + try { + return await runner.call(tx); + } catch (error: any) { + if (isCallException(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + }; + + const send = async function ( + overrides?: Omit, + ): Promise { + const runner = contract.runner; + assert( + canSend(runner), + "contract runner does not support sending transactions", + "UNSUPPORTED_OPERATION", + { operation: "sendTransaction" }, + ); + + const tx = await runner.sendTransaction( + await populateTransaction(overrides), + ); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new ContractTransactionResponse( + contract.interface, + provider, + tx, + ); + }; + + const estimateEnergy = async function ( + overrides?: Omit, + ): Promise { + const runner = getRunner(contract.runner, "estimateEnergy"); + assert( + canEstimate(runner), + "contract runner does not support energy estimation", + "UNSUPPORTED_OPERATION", + { operation: "estimateEnergy" }, + ); + + return await runner.estimateEnergy(await populateTransaction(overrides)); + }; + + const method = async (overrides?: Omit) => { + return await send(overrides); + }; + + defineProperties(method, { + _contract: contract, + + estimateEnergy, + populateTransaction, + send, + staticCall, + }); + + return method; } function buildWrappedMethod< - A extends Array = Array, - R = any, - D extends R | ContractTransactionResponse = ContractTransactionResponse, + A extends Array = Array, + R = any, + D extends R | ContractTransactionResponse = ContractTransactionResponse, >(contract: BaseContract, key: string): BaseContractMethod { - const getFragment = function ( - ...args: ContractMethodArgs - ): FunctionFragment { - const fragment = contract.interface.getFunction(key, args); - assert( - fragment, - "no matching fragment in getFragment", - "UNSUPPORTED_OPERATION", - { - operation: "fragment", - }, - ); - return fragment; - }; - - const populateTransaction = async function ( - ...args: ContractMethodArgs - ): Promise { - const fragment = getFragment(...args); - - // If an overrides was passed in, copy it and normalize the values - let overrides: Omit = {}; - if (fragment.inputs.length + 1 === args.length) { - overrides = await copyOverrides(args.pop()); - } - - if (fragment.inputs.length !== args.length) { - throw new Error( - "internal error: fragment inputs doesn't match arguments; should not happen", - ); - } - - const resolvedArgs = await resolveArgs( - contract.runner, - fragment.inputs, - args, - ); - - return Object.assign( - {}, - overrides, - await resolveProperties({ - to: contract.getAddress(), - data: contract.interface.encodeFunctionData(fragment, resolvedArgs), - }), - ); - }; - - const staticCall = async function ( - ...args: ContractMethodArgs - ): Promise { - const result = await staticCallResult(...args); - if (result.length === 1) { - return result[0]; - } - return (result); - }; - - const send = async function ( - ...args: ContractMethodArgs - ): Promise { - const runner = contract.runner; - assert( - canSend(runner), - "contract runner does not support sending transactions", - "UNSUPPORTED_OPERATION", - { operation: "sendTransaction" }, - ); - - const tx = await runner.sendTransaction(await populateTransaction(...args)); - const provider = getProvider(contract.runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - return new ContractTransactionResponse( - contract.interface, - provider, - tx, - ); - }; - - const estimateEnergy = async function ( - ...args: ContractMethodArgs - ): Promise { - const runner = getRunner(contract.runner, "estimateEnergy"); - assert( - canEstimate(runner), - "contract runner does not support energy estimation", - "UNSUPPORTED_OPERATION", - { operation: "estimateEnergy" }, - ); - - return await runner.estimateEnergy(await populateTransaction(...args)); - }; - - const staticCallResult = async function ( - ...args: ContractMethodArgs - ): Promise { - const runner = getRunner(contract.runner, "call"); - assert( - canCall(runner), - "contract runner does not support calling", - "UNSUPPORTED_OPERATION", - { operation: "call" }, - ); - - const tx = await populateTransaction(...args); - - let result = "0x"; - try { - result = await runner.call(tx); - } catch (error: any) { - if (isCallException(error) && error.data) { - throw contract.interface.makeError(error.data, tx); - } - throw error; - } - - const fragment = getFragment(...args); - return contract.interface.decodeFunctionResult(fragment, result); - }; - - const method = async (...args: ContractMethodArgs) => { - const fragment = getFragment(...args); - if (fragment.constant) { - return await staticCall(...args); - } - return await send(...args); - }; - - defineProperties(method, { - name: contract.interface.getFunctionName(key), - _contract: contract, - _key: key, - - getFragment, - - estimateEnergy, - populateTransaction, - send, - staticCall, - staticCallResult, - }); - - // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) - Object.defineProperty(method, "fragment", { - configurable: false, - enumerable: true, - get: () => { - const fragment = contract.interface.getFunction(key); - assert( - fragment, - "no matching fragment in defineProperty", - "UNSUPPORTED_OPERATION", - { - operation: "fragment", - }, - ); - return fragment; - }, - }); - - return >method; + const getFragment = function ( + ...args: ContractMethodArgs + ): FunctionFragment { + const fragment = contract.interface.getFunction(key, args); + assert( + fragment, + "no matching fragment in getFragment", + "UNSUPPORTED_OPERATION", + { + operation: "fragment", + }, + ); + return fragment; + }; + + const populateTransaction = async function ( + ...args: ContractMethodArgs + ): Promise { + const fragment = getFragment(...args); + + // If an overrides was passed in, copy it and normalize the values + let overrides: Omit = {}; + if (fragment.inputs.length + 1 === args.length) { + overrides = await copyOverrides(args.pop()); + } + + if (fragment.inputs.length !== args.length) { + throw new Error( + "internal error: fragment inputs doesn't match arguments; should not happen", + ); + } + + const resolvedArgs = await resolveArgs( + contract.runner, + fragment.inputs, + args, + ); + + return Object.assign( + {}, + overrides, + await resolveProperties({ + to: contract.getAddress(), + data: contract.interface.encodeFunctionData(fragment, resolvedArgs), + }), + ); + }; + + const staticCall = async function ( + ...args: ContractMethodArgs + ): Promise { + const result = await staticCallResult(...args); + if (result.length === 1) { + return result[0]; + } + return (result); + }; + + const send = async function ( + ...args: ContractMethodArgs + ): Promise { + const runner = contract.runner; + assert( + canSend(runner), + "contract runner does not support sending transactions", + "UNSUPPORTED_OPERATION", + { operation: "sendTransaction" }, + ); + + const tx = await runner.sendTransaction(await populateTransaction(...args)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new ContractTransactionResponse( + contract.interface, + provider, + tx, + ); + }; + + const estimateEnergy = async function ( + ...args: ContractMethodArgs + ): Promise { + const runner = getRunner(contract.runner, "estimateEnergy"); + assert( + canEstimate(runner), + "contract runner does not support energy estimation", + "UNSUPPORTED_OPERATION", + { operation: "estimateEnergy" }, + ); + + return await runner.estimateEnergy(await populateTransaction(...args)); + }; + + const staticCallResult = async function ( + ...args: ContractMethodArgs + ): Promise { + const runner = getRunner(contract.runner, "call"); + assert( + canCall(runner), + "contract runner does not support calling", + "UNSUPPORTED_OPERATION", + { operation: "call" }, + ); + + const tx = await populateTransaction(...args); + + let result = "0x"; + try { + result = await runner.call(tx); + } catch (error: any) { + if (isCallException(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + + const fragment = getFragment(...args); + return contract.interface.decodeFunctionResult(fragment, result); + }; + + const method = async (...args: ContractMethodArgs) => { + const fragment = getFragment(...args); + if (fragment.constant) { + return await staticCall(...args); + } + return await send(...args); + }; + + defineProperties(method, { + name: contract.interface.getFunctionName(key), + _contract: contract, + _key: key, + + getFragment, + + estimateEnergy, + populateTransaction, + send, + staticCall, + staticCallResult, + }); + + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getFunction(key); + assert( + fragment, + "no matching fragment in defineProperty", + "UNSUPPORTED_OPERATION", + { + operation: "fragment", + }, + ); + return fragment; + }, + }); + + return >method; } function buildWrappedEvent = Array>( - contract: BaseContract, - key: string, + contract: BaseContract, + key: string, ): ContractEvent { - const getFragment = function (...args: ContractEventArgs): EventFragment { - const fragment = contract.interface.getEvent(key, args); - - assert(fragment, "no matching fragment in", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - - return fragment; - }; - - const method = function ( - ...args: ContractMethodArgs - ): PreparedTopicFilter { - return new PreparedTopicFilter(contract, getFragment(...args), args); - }; - - defineProperties(method, { - name: contract.interface.getEventName(key), - _contract: contract, - _key: key, - - getFragment, - }); - - // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) - Object.defineProperty(method, "fragment", { - configurable: false, - enumerable: true, - get: () => { - const fragment = contract.interface.getEvent(key); - - assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { - operation: "fragment", - }); - - return fragment; - }, - }); - - return >(method); + const getFragment = function (...args: ContractEventArgs): EventFragment { + const fragment = contract.interface.getEvent(key, args); + + assert(fragment, "no matching fragment in", "UNSUPPORTED_OPERATION", { + operation: "fragment", + }); + + return fragment; + }; + + const method = function ( + ...args: ContractMethodArgs + ): PreparedTopicFilter { + return new PreparedTopicFilter(contract, getFragment(...args), args); + }; + + defineProperties(method, { + name: contract.interface.getEventName(key), + _contract: contract, + _key: key, + + getFragment, + }); + + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getEvent(key); + + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + }); + + return fragment; + }, + }); + + return >(method); } type Sub = { - tag: string; - listeners: Array<{ listener: Listener; once: boolean }>; - start: () => void; - stop: () => void; + tag: string; + listeners: Array<{ listener: Listener; once: boolean }>; + start: () => void; + stop: () => void; }; // The combination of TypeScrype, Private Fields and Proxies makes @@ -549,211 +549,211 @@ type Sub = { const internal = Symbol.for("_corebcInternal_contract"); type Internal = { - addrPromise: Promise; - addr: null | string; + addrPromise: Promise; + addr: null | string; - deployTx: null | ContractTransactionResponse; + deployTx: null | ContractTransactionResponse; - subs: Map; + subs: Map; }; const internalValues: WeakMap = new WeakMap(); function setInternal(contract: BaseContract, values: Internal): void { - internalValues.set(contract[internal], values); + internalValues.set(contract[internal], values); } function getInternal(contract: BaseContract): Internal { - return internalValues.get(contract[internal]) as Internal; + return internalValues.get(contract[internal]) as Internal; } function isDeferred(value: any): value is DeferredTopicFilter { - return ( - value && - typeof value === "object" && - "getTopicFilter" in value && - typeof value.getTopicFilter === "function" && - value.fragment - ); + return ( + value && + typeof value === "object" && + "getTopicFilter" in value && + typeof value.getTopicFilter === "function" && + value.fragment + ); } async function getSubInfo( - contract: BaseContract, - event: ContractEventName, + contract: BaseContract, + event: ContractEventName, ): Promise<{ - fragment: null | EventFragment; - tag: string; - topics: TopicFilter; + fragment: null | EventFragment; + tag: string; + topics: TopicFilter; }> { - let topics: Array>; - let fragment: null | EventFragment = null; - - // Convert named events to topicHash and get the fragment for - // events which need deconstructing. - - if (Array.isArray(event)) { - const topicHashify = function (name: string): string { - if (isHexString(name, 32)) { - return name; - } - const fragment = contract.interface.getEvent(name); - assertArgument(fragment, "unknown fragment", "name", name); - return fragment.topicHash; - }; - - // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` - topics = event.map((e) => { - if (e == null) { - return null; - } - if (Array.isArray(e)) { - return e.map(topicHashify); - } - return topicHashify(e); - }); - } else if (event === "*") { - topics = [null]; - } else if (typeof event === "string") { - if (isHexString(event, 32)) { - // Topic Hash - topics = [event]; - } else { - // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` - fragment = contract.interface.getEvent(event); - assertArgument(fragment, "unknown fragment", "event", event); - topics = [fragment.topicHash]; - } - } else if (isDeferred(event)) { - // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)` - topics = await event.getTopicFilter(); - } else if ("fragment" in event) { - // ContractEvent; e.g. `contract.filter.Transfer` - fragment = event.fragment; - topics = [fragment.topicHash]; - } else { - assertArgument(false, "unknown event name", "event", event); - } - - // Normalize topics and sort TopicSets - topics = topics.map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values()); - if (items.length === 1) { - return items[0]; - } - items.sort(); - return items; - } - return t.toLowerCase(); - }); - - const tag = topics - .map((t) => { - if (t == null) { - return "null"; - } - if (Array.isArray(t)) { - return t.join("|"); - } - return t; - }) - .join("&"); - - return { fragment, tag, topics }; + let topics: Array>; + let fragment: null | EventFragment = null; + + // Convert named events to topicHash and get the fragment for + // events which need deconstructing. + + if (Array.isArray(event)) { + const topicHashify = function (name: string): string { + if (isHexString(name, 32)) { + return name; + } + const fragment = contract.interface.getEvent(name); + assertArgument(fragment, "unknown fragment", "name", name); + return fragment.topicHash; + }; + + // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` + topics = event.map((e) => { + if (e == null) { + return null; + } + if (Array.isArray(e)) { + return e.map(topicHashify); + } + return topicHashify(e); + }); + } else if (event === "*") { + topics = [null]; + } else if (typeof event === "string") { + if (isHexString(event, 32)) { + // Topic Hash + topics = [event]; + } else { + // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` + fragment = contract.interface.getEvent(event); + assertArgument(fragment, "unknown fragment", "event", event); + topics = [fragment.topicHash]; + } + } else if (isDeferred(event)) { + // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)` + topics = await event.getTopicFilter(); + } else if ("fragment" in event) { + // ContractEvent; e.g. `contract.filter.Transfer` + fragment = event.fragment; + topics = [fragment.topicHash]; + } else { + assertArgument(false, "unknown event name", "event", event); + } + + // Normalize topics and sort TopicSets + topics = topics.map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values()); + if (items.length === 1) { + return items[0]; + } + items.sort(); + return items; + } + return t.toLowerCase(); + }); + + const tag = topics + .map((t) => { + if (t == null) { + return "null"; + } + if (Array.isArray(t)) { + return t.join("|"); + } + return t; + }) + .join("&"); + + return { fragment, tag, topics }; } async function hasSub( - contract: BaseContract, - event: ContractEventName, + contract: BaseContract, + event: ContractEventName, ): Promise { - const { subs } = getInternal(contract); - return subs.get((await getSubInfo(contract, event)).tag) || null; + const { subs } = getInternal(contract); + return subs.get((await getSubInfo(contract, event)).tag) || null; } async function getSub( - contract: BaseContract, - operation: string, - event: ContractEventName, + contract: BaseContract, + operation: string, + event: ContractEventName, ): Promise { - // Make sure our runner can actually subscribe to events - const provider = getProvider(contract.runner); - assert( - provider, - "contract runner does not support subscribing", - "UNSUPPORTED_OPERATION", - { operation }, - ); - - const { fragment, tag, topics } = await getSubInfo(contract, event); - - const { addr, subs } = getInternal(contract); - - let sub = subs.get(tag); - if (!sub) { - const address: string | Addressable = addr ? addr : contract; - const filter = { address, topics }; - const listener = (log: Log) => { - let foundFragment = fragment; - if (foundFragment == null) { - try { - foundFragment = contract.interface.getEvent(log.topics[0]); - } catch (error) {} - } - - // If fragment is null, we do not deconstruct the args to emit - - if (foundFragment) { - const _foundFragment = foundFragment; - const args = fragment - ? contract.interface.decodeEventLog(fragment, log.data, log.topics) - : []; - emit(contract, event, args, (listener: null | Listener) => { - return new ContractEventPayload( - contract, - listener, - event, - _foundFragment, - log, - ); - }); - } else { - emit(contract, event, [], (listener: null | Listener) => { - return new ContractUnknownEventPayload( - contract, - listener, - event, - log, - ); - }); - } - }; - - let starting: Array> = []; - const start = () => { - if (starting.length) { - return; - } - starting.push(provider.on(filter, listener)); - }; - - const stop = async () => { - if (starting.length == 0) { - return; - } - - let started = starting; - starting = []; - await Promise.all(started); - provider.off(filter, listener); - }; - - sub = { tag, listeners: [], start, stop }; - subs.set(tag, sub); - } - return sub; + // Make sure our runner can actually subscribe to events + const provider = getProvider(contract.runner); + assert( + provider, + "contract runner does not support subscribing", + "UNSUPPORTED_OPERATION", + { operation }, + ); + + const { fragment, tag, topics } = await getSubInfo(contract, event); + + const { addr, subs } = getInternal(contract); + + let sub = subs.get(tag); + if (!sub) { + const address: string | Addressable = addr ? addr : contract; + const filter = { address, topics }; + const listener = (log: Log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = contract.interface.getEvent(log.topics[0]); + } catch (error) {} + } + + // If fragment is null, we do not deconstruct the args to emit + + if (foundFragment) { + const _foundFragment = foundFragment; + const args = fragment + ? contract.interface.decodeEventLog(fragment, log.data, log.topics) + : []; + emit(contract, event, args, (listener: null | Listener) => { + return new ContractEventPayload( + contract, + listener, + event, + _foundFragment, + log, + ); + }); + } else { + emit(contract, event, [], (listener: null | Listener) => { + return new ContractUnknownEventPayload( + contract, + listener, + event, + log, + ); + }); + } + }; + + let starting: Array> = []; + const start = () => { + if (starting.length) { + return; + } + starting.push(provider.on(filter, listener)); + }; + + const stop = async () => { + if (starting.length == 0) { + return; + } + + let started = starting; + starting = []; + await Promise.all(started); + provider.off(filter, listener); + }; + + sub = { tag, listeners: [], start, stop }; + subs.set(tag, sub); + } + return sub; } // We use this to ensure one emit resolves before firing the next to @@ -764,470 +764,470 @@ let lastEmit: Promise = Promise.resolve(); type PayloadFunc = (listener: null | Listener) => ContractUnknownEventPayload; async function _emit( - contract: BaseContract, - event: ContractEventName, - args: Array, - payloadFunc: null | PayloadFunc, + contract: BaseContract, + event: ContractEventName, + args: Array, + payloadFunc: null | PayloadFunc, ): Promise { - await lastEmit; - - const sub = await hasSub(contract, event); - if (!sub) { - return false; - } - - const count = sub.listeners.length; - sub.listeners = sub.listeners.filter(({ listener, once }) => { - const passArgs = Array.from(args); - if (payloadFunc) { - passArgs.push(payloadFunc(once ? null : listener)); - } - try { - listener.call(contract, ...passArgs); - } catch (error) {} - return !once; - }); - return count > 0; + await lastEmit; + + const sub = await hasSub(contract, event); + if (!sub) { + return false; + } + + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const passArgs = Array.from(args); + if (payloadFunc) { + passArgs.push(payloadFunc(once ? null : listener)); + } + try { + listener.call(contract, ...passArgs); + } catch (error) {} + return !once; + }); + return count > 0; } async function emit( - contract: BaseContract, - event: ContractEventName, - args: Array, - payloadFunc: null | PayloadFunc, + contract: BaseContract, + event: ContractEventName, + args: Array, + payloadFunc: null | PayloadFunc, ): Promise { - try { - await lastEmit; - } catch (error) {} + try { + await lastEmit; + } catch (error) {} - const resultPromise = _emit(contract, event, args, payloadFunc); - lastEmit = resultPromise; - return await resultPromise; + const resultPromise = _emit(contract, event, args, payloadFunc); + lastEmit = resultPromise; + return await resultPromise; } const passProperties = ["then"]; export class BaseContract - implements Addressable, EventEmitterable + implements Addressable, EventEmitterable { - readonly target!: string | Addressable; - readonly interface!: Interface; - readonly runner!: null | ContractRunner; - - readonly filters!: Record; - - readonly [internal]: any; - - readonly fallback!: null | WrappedFallback; - - constructor( - target: string | Addressable, - abi: Interface | InterfaceAbi, - runner?: null | ContractRunner, - _deployTx?: null | TransactionResponse, - ) { - if (runner == null) { - runner = null; - } - const iface = Interface.from(abi); - defineProperties(this, { target, runner, interface: iface }); - Object.defineProperty(this, internal, { value: {} }); - - let addrPromise; - let addr: any = null; - - let deployTx: null | ContractTransactionResponse = null; - if (_deployTx) { - const provider = getProvider(runner); - // @TODO: the provider can be null; make a custom dummy provider that will throw a - // meaningful error - deployTx = new ContractTransactionResponse( - this.interface, - provider, - _deployTx, - ); - } - - let subs = new Map(); - - // Resolve the target as the address - if (typeof target === "string") { - if (isHexString(target)) { - addr = target; - addrPromise = Promise.resolve(target); - } else { - const resolver = getRunner(runner, "resolveName"); - if (!canResolve(resolver)) { - throw makeError( - "contract runner does not support name resolution", - "UNSUPPORTED_OPERATION", - { - operation: "resolveName", - }, - ); - } - - addrPromise = resolver.resolveName(target).then((addr) => { - if (addr == null) { - throw new Error("TODO"); - } - getInternal(this).addr = addr; - return addr; - }); - } - } else { - addrPromise = target.getAddress().then((addr) => { - if (addr == null) { - throw new Error("TODO"); - } - getInternal(this).addr = addr; - return addr; - }); - } - - // Set our private values - setInternal(this, { addrPromise, addr, deployTx, subs }); - - // Add the event filters - const filters = new Proxy( - {}, - { - get: (target, _prop, receiver) => { - // Pass important checks (like `then` for Promise) through - if (passProperties.indexOf(_prop) >= 0) { - return Reflect.get(target, _prop, receiver); - } - - const prop = String(_prop); - - const result = this.getEvent(prop); - if (result) { - return result; - } - - throw new Error(`unknown contract event: ${prop}`); - }, - has: (target, prop) => { - // Pass important checks (like `then` for Promise) through - if (passProperties.indexOf(prop) >= 0) { - return Reflect.has(target, prop); - } - - return ( - Reflect.has(target, prop) || this.interface.hasEvent(String(prop)) - ); - }, - }, - ); - defineProperties(this, { filters }); - - defineProperties(this, { - fallback: - iface.receive || iface.fallback ? buildWrappedFallback(this) : null, - }); - - // Return a Proxy that will respond to functions - return new Proxy(this, { - get: (target, _prop, receiver) => { - if (_prop in target || passProperties.indexOf(_prop) >= 0) { - return Reflect.get(target, _prop, receiver); - } - - const prop = String(_prop); - - const result = target.getFunction(prop); - if (result) { - return result; - } - - throw new Error(`unknown contract method: ${prop}`); - }, - has: (target, prop) => { - if (prop in target || passProperties.indexOf(prop) >= 0) { - return Reflect.has(target, prop); - } - - return target.interface.hasFunction(String(prop)); - }, - }); - } - - connect(runner: null | ContractRunner): BaseContract { - return new BaseContract(this.target, this.interface, runner); - } - - async getAddress(): Promise { - return await getInternal(this).addrPromise; - } - - async getDeployedCode(): Promise { - const provider = getProvider(this.runner); - assert( - provider, - "runner does not support .provider", - "UNSUPPORTED_OPERATION", - { operation: "getDeployedCode" }, - ); - - const code = await provider.getCode(await this.getAddress()); - if (code === "0x") { - return null; - } - return code; - } - - async waitForDeployment(): Promise { - // We have the deployement transaction; just use that (throws if deployement fails) - const deployTx = this.deploymentTransaction(); - if (deployTx) { - await deployTx.wait(); - return this; - } - - // Check for code - const code = await this.getDeployedCode(); - if (code != null) { - return this; - } - - // Make sure we can subscribe to a provider event - const provider = getProvider(this.runner); - assert( - provider != null, - "contract runner does not support .provider", - "UNSUPPORTED_OPERATION", - { operation: "waitForDeployment" }, - ); - - return new Promise((resolve, reject) => { - const checkCode = async () => { - try { - const code = await this.getDeployedCode(); - if (code != null) { - return resolve(this); - } - provider.once("block", checkCode); - } catch (error) { - reject(error); - } - }; - checkCode(); - }); - } - - deploymentTransaction(): null | ContractTransactionResponse { - return getInternal(this).deployTx; - } - - getFunction( - key: string | FunctionFragment, - ): T { - if (typeof key !== "string") { - key = key.format(); - } - const func = buildWrappedMethod(this, key); - return func; - } - - getEvent(key: string | EventFragment): ContractEvent { - if (typeof key !== "string") { - key = key.format(); - } - return buildWrappedEvent(this, key); - } - - async queryTransaction(hash: string): Promise> { - // Is this useful? - throw new Error("@TODO"); - } - - async queryFilter( - event: ContractEventName, - fromBlock?: BlockTag, - toBlock?: BlockTag, - ): Promise> { - if (fromBlock == null) { - fromBlock = 0; - } - if (toBlock == null) { - toBlock = "latest"; - } - const { addr, addrPromise } = getInternal(this); - const address = addr ? addr : await addrPromise; - const { fragment, topics } = await getSubInfo(this, event); - const filter = { address, topics, fromBlock, toBlock }; - - const provider = getProvider(this.runner); - assert( - provider, - "contract runner does not have a provider", - "UNSUPPORTED_OPERATION", - { operation: "queryFilter" }, - ); - - return (await provider.getLogs(filter)).map((log) => { - let foundFragment = fragment; - if (foundFragment == null) { - try { - foundFragment = this.interface.getEvent(log.topics[0]); - } catch (error) {} - } - - if (foundFragment) { - return new EventLog(log, this.interface, foundFragment); - } else { - return new Log(log, provider); - } - }); - } - - async on(event: ContractEventName, listener: Listener): Promise { - const sub = await getSub(this, "on", event); - sub.listeners.push({ listener, once: false }); - sub.start(); - return this; - } - - async once(event: ContractEventName, listener: Listener): Promise { - const sub = await getSub(this, "once", event); - sub.listeners.push({ listener, once: true }); - sub.start(); - return this; - } - - async emit(event: ContractEventName, ...args: Array): Promise { - return await emit(this, event, args, null); - } - - async listenerCount(event?: ContractEventName): Promise { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return 0; - } - return sub.listeners.length; - } - - const { subs } = getInternal(this); - - let total = 0; - for (const { listeners } of subs.values()) { - total += listeners.length; - } - return total; - } - - async listeners(event?: ContractEventName): Promise> { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return []; - } - return sub.listeners.map(({ listener }) => listener); - } - - const { subs } = getInternal(this); - - let result: Array = []; - for (const { listeners } of subs.values()) { - result = result.concat(listeners.map(({ listener }) => listener)); - } - return result; - } - - async off(event: ContractEventName, listener?: Listener): Promise { - const sub = await hasSub(this, event); - if (!sub) { - return this; - } - - if (listener) { - const index = sub.listeners - .map(({ listener }) => listener) - .indexOf(listener); - if (index >= 0) { - sub.listeners.splice(index, 1); - } - } - - if (listener == null || sub.listeners.length === 0) { - sub.stop(); - getInternal(this).subs.delete(sub.tag); - } - - return this; - } - - async removeAllListeners(event?: ContractEventName): Promise { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return this; - } - sub.stop(); - getInternal(this).subs.delete(sub.tag); - } else { - const { subs } = getInternal(this); - for (const { tag, stop } of subs.values()) { - stop(); - subs.delete(tag); - } - } - - return this; - } - - // Alias for "on" - async addListener( - event: ContractEventName, - listener: Listener, - ): Promise { - return await this.on(event, listener); - } - - // Alias for "off" - async removeListener( - event: ContractEventName, - listener: Listener, - ): Promise { - return await this.off(event, listener); - } - - static buildClass( - abi: InterfaceAbi, - ): new ( - target: string, - runner?: null | ContractRunner, - ) => BaseContract & Omit { - class CustomContract extends BaseContract { - constructor(address: string, runner: null | ContractRunner = null) { - super(address, abi, runner); - } - } - return CustomContract as any; - } - - static from( - target: string, - abi: InterfaceAbi, - runner?: null | ContractRunner, - ): BaseContract & Omit { - if (runner == null) { - runner = null; - } - const contract = new this(target, abi, runner); - return contract as any; - } - static isIndexed(value: any): value is Indexed { - return Indexed.isIndexed(value); - } + readonly target!: string | Addressable; + readonly interface!: Interface; + readonly runner!: null | ContractRunner; + + readonly filters!: Record; + + readonly [internal]: any; + + readonly fallback!: null | WrappedFallback; + + constructor( + target: string | Addressable, + abi: Interface | InterfaceAbi, + runner?: null | ContractRunner, + _deployTx?: null | TransactionResponse, + ) { + if (runner == null) { + runner = null; + } + const iface = Interface.from(abi); + defineProperties(this, { target, runner, interface: iface }); + Object.defineProperty(this, internal, { value: {} }); + + let addrPromise; + let addr: any = null; + + let deployTx: null | ContractTransactionResponse = null; + if (_deployTx) { + const provider = getProvider(runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + deployTx = new ContractTransactionResponse( + this.interface, + provider, + _deployTx, + ); + } + + let subs = new Map(); + + // Resolve the target as the address + if (typeof target === "string") { + if (isHexString(target)) { + addr = target; + addrPromise = Promise.resolve(target); + } else { + const resolver = getRunner(runner, "resolveName"); + if (!canResolve(resolver)) { + throw makeError( + "contract runner does not support name resolution", + "UNSUPPORTED_OPERATION", + { + operation: "resolveName", + }, + ); + } + + addrPromise = resolver.resolveName(target).then((addr) => { + if (addr == null) { + throw new Error("TODO"); + } + getInternal(this).addr = addr; + return addr; + }); + } + } else { + addrPromise = target.getAddress().then((addr) => { + if (addr == null) { + throw new Error("TODO"); + } + getInternal(this).addr = addr; + return addr; + }); + } + + // Set our private values + setInternal(this, { addrPromise, addr, deployTx, subs }); + + // Add the event filters + const filters = new Proxy( + {}, + { + get: (target, _prop, receiver) => { + // Pass important checks (like `then` for Promise) through + if (passProperties.indexOf(_prop) >= 0) { + return Reflect.get(target, _prop, receiver); + } + + const prop = String(_prop); + + const result = this.getEvent(prop); + if (result) { + return result; + } + + throw new Error(`unknown contract event: ${prop}`); + }, + has: (target, prop) => { + // Pass important checks (like `then` for Promise) through + if (passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + + return ( + Reflect.has(target, prop) || this.interface.hasEvent(String(prop)) + ); + }, + }, + ); + defineProperties(this, { filters }); + + defineProperties(this, { + fallback: + iface.receive || iface.fallback ? buildWrappedFallback(this) : null, + }); + + // Return a Proxy that will respond to functions + return new Proxy(this, { + get: (target, _prop, receiver) => { + if (_prop in target || passProperties.indexOf(_prop) >= 0) { + return Reflect.get(target, _prop, receiver); + } + + const prop = String(_prop); + + const result = target.getFunction(prop); + if (result) { + return result; + } + + throw new Error(`unknown contract method: ${prop}`); + }, + has: (target, prop) => { + if (prop in target || passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + + return target.interface.hasFunction(String(prop)); + }, + }); + } + + connect(runner: null | ContractRunner): BaseContract { + return new BaseContract(this.target, this.interface, runner); + } + + async getAddress(): Promise { + return await getInternal(this).addrPromise; + } + + async getDeployedCode(): Promise { + const provider = getProvider(this.runner); + assert( + provider, + "runner does not support .provider", + "UNSUPPORTED_OPERATION", + { operation: "getDeployedCode" }, + ); + + const code = await provider.getCode(await this.getAddress()); + if (code === "0x") { + return null; + } + return code; + } + + async waitForDeployment(): Promise { + // We have the deployement transaction; just use that (throws if deployement fails) + const deployTx = this.deploymentTransaction(); + if (deployTx) { + await deployTx.wait(); + return this; + } + + // Check for code + const code = await this.getDeployedCode(); + if (code != null) { + return this; + } + + // Make sure we can subscribe to a provider event + const provider = getProvider(this.runner); + assert( + provider != null, + "contract runner does not support .provider", + "UNSUPPORTED_OPERATION", + { operation: "waitForDeployment" }, + ); + + return new Promise((resolve, reject) => { + const checkCode = async () => { + try { + const code = await this.getDeployedCode(); + if (code != null) { + return resolve(this); + } + provider.once("block", checkCode); + } catch (error) { + reject(error); + } + }; + checkCode(); + }); + } + + deploymentTransaction(): null | ContractTransactionResponse { + return getInternal(this).deployTx; + } + + getFunction( + key: string | FunctionFragment, + ): T { + if (typeof key !== "string") { + key = key.format(); + } + const func = buildWrappedMethod(this, key); + return func; + } + + getEvent(key: string | EventFragment): ContractEvent { + if (typeof key !== "string") { + key = key.format(); + } + return buildWrappedEvent(this, key); + } + + async queryTransaction(hash: string): Promise> { + // Is this useful? + throw new Error("@TODO"); + } + + async queryFilter( + event: ContractEventName, + fromBlock?: BlockTag, + toBlock?: BlockTag, + ): Promise> { + if (fromBlock == null) { + fromBlock = 0; + } + if (toBlock == null) { + toBlock = "latest"; + } + const { addr, addrPromise } = getInternal(this); + const address = addr ? addr : await addrPromise; + const { fragment, topics } = await getSubInfo(this, event); + const filter = { address, topics, fromBlock, toBlock }; + + const provider = getProvider(this.runner); + assert( + provider, + "contract runner does not have a provider", + "UNSUPPORTED_OPERATION", + { operation: "queryFilter" }, + ); + + return (await provider.getLogs(filter)).map((log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = this.interface.getEvent(log.topics[0]); + } catch (error) {} + } + + if (foundFragment) { + return new EventLog(log, this.interface, foundFragment); + } else { + return new Log(log, provider); + } + }); + } + + async on(event: ContractEventName, listener: Listener): Promise { + const sub = await getSub(this, "on", event); + sub.listeners.push({ listener, once: false }); + sub.start(); + return this; + } + + async once(event: ContractEventName, listener: Listener): Promise { + const sub = await getSub(this, "once", event); + sub.listeners.push({ listener, once: true }); + sub.start(); + return this; + } + + async emit(event: ContractEventName, ...args: Array): Promise { + return await emit(this, event, args, null); + } + + async listenerCount(event?: ContractEventName): Promise { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return 0; + } + return sub.listeners.length; + } + + const { subs } = getInternal(this); + + let total = 0; + for (const { listeners } of subs.values()) { + total += listeners.length; + } + return total; + } + + async listeners(event?: ContractEventName): Promise> { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return []; + } + return sub.listeners.map(({ listener }) => listener); + } + + const { subs } = getInternal(this); + + let result: Array = []; + for (const { listeners } of subs.values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + } + + async off(event: ContractEventName, listener?: Listener): Promise { + const sub = await hasSub(this, event); + if (!sub) { + return this; + } + + if (listener) { + const index = sub.listeners + .map(({ listener }) => listener) + .indexOf(listener); + if (index >= 0) { + sub.listeners.splice(index, 1); + } + } + + if (listener == null || sub.listeners.length === 0) { + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } + + return this; + } + + async removeAllListeners(event?: ContractEventName): Promise { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return this; + } + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } else { + const { subs } = getInternal(this); + for (const { tag, stop } of subs.values()) { + stop(); + subs.delete(tag); + } + } + + return this; + } + + // Alias for "on" + async addListener( + event: ContractEventName, + listener: Listener, + ): Promise { + return await this.on(event, listener); + } + + // Alias for "off" + async removeListener( + event: ContractEventName, + listener: Listener, + ): Promise { + return await this.off(event, listener); + } + + static buildClass( + abi: InterfaceAbi, + ): new ( + target: string, + runner?: null | ContractRunner, + ) => BaseContract & Omit { + class CustomContract extends BaseContract { + constructor(address: string, runner: null | ContractRunner = null) { + super(address, abi, runner); + } + } + return CustomContract as any; + } + + static from( + target: string, + abi: InterfaceAbi, + runner?: null | ContractRunner, + ): BaseContract & Omit { + if (runner == null) { + runner = null; + } + const contract = new this(target, abi, runner); + return contract as any; + } + static isIndexed(value: any): value is Indexed { + return Indexed.isIndexed(value); + } } function _ContractBase(): new ( - target: string, - abi: InterfaceAbi, - runner?: null | ContractRunner, + target: string, + abi: InterfaceAbi, + runner?: null | ContractRunner, ) => BaseContract & Omit { - return BaseContract as any; + return BaseContract as any; } export class Contract extends _ContractBase() {} diff --git a/src.ts/contract/factory.ts b/src.ts/contract/factory.ts index be7ff8a43..107e95459 100644 --- a/src.ts/contract/factory.ts +++ b/src.ts/contract/factory.ts @@ -1,12 +1,12 @@ import { Interface } from "../abi/index.js"; import { getCreateAddress } from "../address/contract-address.js"; import { - concat, - defineProperties, - getBytes, - hexlify, - assert, - assertArgument, + concat, + defineProperties, + getBytes, + hexlify, + assert, + assertArgument, } from "../utils/index.js"; import { BaseContract, copyOverrides, resolveArgs } from "./contract.js"; @@ -16,9 +16,9 @@ import type { ContractRunner } from "../providers/index.js"; import type { BytesLike } from "../utils/index.js"; import type { - ContractInterface, - ContractMethodArgs, - ContractDeployTransaction, + ContractInterface, + ContractMethodArgs, + ContractDeployTransaction, } from "./types.js"; import type { ContractTransactionResponse } from "./wrappers.js"; import { isBytes } from "../utils/data.js"; @@ -26,116 +26,116 @@ import { isBytes } from "../utils/data.js"; // A = Arguments to the constructor // I = Interface of deployed contracts export class ContractFactory< - A extends Array = Array, - I = BaseContract, + A extends Array = Array, + I = BaseContract, > { - readonly interface!: Interface; - readonly bytecode!: string; - readonly runner!: null | ContractRunner; - - constructor( - abi: Interface | InterfaceAbi, - bytecode: BytesLike | { object: string }, - runner?: null | ContractRunner, - ) { - const iface = Interface.from(abi); - - // Dereference Solidity bytecode objects and allow a missing `0x`-prefix - if (bytecode instanceof Uint8Array) { - bytecode = hexlify(getBytes(bytecode)); - } else if (typeof bytecode === "string") { - bytecode = bytecode; - } else if (isBytes(bytecode)) { - bytecode = hexlify(bytecode); - } else if (bytecode && typeof bytecode.object === "string") { - // Allow the bytecode object from the Solidity compiler - bytecode = (bytecode).object; - } else { - // Crash in the next verification step - bytecode = "!"; - } - - defineProperties(this, { - // @ts-ignore - bytecode, - interface: iface, - runner: runner || null, - }); - } - - async getDeployTransaction( - ...args: ContractMethodArgs - ): Promise { - let overrides: Omit = {}; - - const fragment = this.interface.deploy; - - if (fragment.inputs.length + 1 === args.length) { - overrides = await copyOverrides(args.pop()); - } - - if (fragment.inputs.length !== args.length) { - throw new Error("incorrect number of arguments to constructor"); - } - - const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args); - - const data = concat([ - this.bytecode, - this.interface.encodeDeploy(resolvedArgs), - ]) as string; - return Object.assign({}, overrides, { data }); - } - - async deploy(...args: ContractMethodArgs): Promise< - BaseContract & { - deploymentTransaction(): ContractTransactionResponse; - } & Omit - > { - const tx = await this.getDeployTransaction(...args); - - assert( - this.runner && typeof this.runner.sendTransaction === "function", - "factory runner does not support sending transactions", - "UNSUPPORTED_OPERATION", - { - operation: "sendTransaction", - }, - ); - - const sentTx = await this.runner.sendTransaction(tx); - const address = getCreateAddress(sentTx); - return new (BaseContract)( - address, - this.interface, - this.runner, - sentTx, - ); - } - - connect(runner: null | ContractRunner): ContractFactory { - return new ContractFactory(this.interface, this.bytecode, runner); - } - - static fromSolidity = Array, I = ContractInterface>( - output: any, - runner?: ContractRunner, - ): ContractFactory { - assertArgument(output != null, "bad compiler output", "output", output); - - if (typeof output === "string") { - output = JSON.parse(output); - } - - const abi = output.abi; - - let bytecode = ""; - if (output.bytecode) { - bytecode = output.bytecode; - } else if (output.evm && output.evm.bytecode) { - bytecode = output.evm.bytecode; - } - - return new this(abi, bytecode, runner); - } + readonly interface!: Interface; + readonly bytecode!: string; + readonly runner!: null | ContractRunner; + + constructor( + abi: Interface | InterfaceAbi, + bytecode: BytesLike | { object: string }, + runner?: null | ContractRunner, + ) { + const iface = Interface.from(abi); + + // Dereference Solidity bytecode objects and allow a missing `0x`-prefix + if (bytecode instanceof Uint8Array) { + bytecode = hexlify(getBytes(bytecode)); + } else if (typeof bytecode === "string") { + bytecode = bytecode; + } else if (isBytes(bytecode)) { + bytecode = hexlify(bytecode); + } else if (bytecode && typeof bytecode.object === "string") { + // Allow the bytecode object from the Solidity compiler + bytecode = (bytecode).object; + } else { + // Crash in the next verification step + bytecode = "!"; + } + + defineProperties(this, { + // @ts-ignore + bytecode, + interface: iface, + runner: runner || null, + }); + } + + async getDeployTransaction( + ...args: ContractMethodArgs + ): Promise { + let overrides: Omit = {}; + + const fragment = this.interface.deploy; + + if (fragment.inputs.length + 1 === args.length) { + overrides = await copyOverrides(args.pop()); + } + + if (fragment.inputs.length !== args.length) { + throw new Error("incorrect number of arguments to constructor"); + } + + const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args); + + const data = concat([ + this.bytecode, + this.interface.encodeDeploy(resolvedArgs), + ]) as string; + return Object.assign({}, overrides, { data }); + } + + async deploy(...args: ContractMethodArgs): Promise< + BaseContract & { + deploymentTransaction(): ContractTransactionResponse; + } & Omit + > { + const tx = await this.getDeployTransaction(...args); + + assert( + this.runner && typeof this.runner.sendTransaction === "function", + "factory runner does not support sending transactions", + "UNSUPPORTED_OPERATION", + { + operation: "sendTransaction", + }, + ); + + const sentTx = await this.runner.sendTransaction(tx); + const address = getCreateAddress(sentTx); + return new (BaseContract)( + address, + this.interface, + this.runner, + sentTx, + ); + } + + connect(runner: null | ContractRunner): ContractFactory { + return new ContractFactory(this.interface, this.bytecode, runner); + } + + static fromSolidity = Array, I = ContractInterface>( + output: any, + runner?: ContractRunner, + ): ContractFactory { + assertArgument(output != null, "bad compiler output", "output", output); + + if (typeof output === "string") { + output = JSON.parse(output); + } + + const abi = output.abi; + + let bytecode = ""; + if (output.bytecode) { + bytecode = output.bytecode; + } else if (output.evm && output.evm.bytecode) { + bytecode = output.evm.bytecode; + } + + return new this(abi, bytecode, runner); + } } diff --git a/src.ts/contract/index.ts b/src.ts/contract/index.ts index 9b2c2f849..7767f5618 100644 --- a/src.ts/contract/index.ts +++ b/src.ts/contract/index.ts @@ -8,26 +8,26 @@ export { BaseContract, Contract } from "./contract.js"; export { ContractFactory } from "./factory.js"; export { - ContractEventPayload, - ContractUnknownEventPayload, - ContractTransactionReceipt, - ContractTransactionResponse, - EventLog, + ContractEventPayload, + ContractUnknownEventPayload, + ContractTransactionReceipt, + ContractTransactionResponse, + EventLog, } from "./wrappers.js"; export type { - BaseContractMethod, - ConstantContractMethod, - PostfixOverrides, - ContractEvent, - ContractEventArgs, - ContractEventName, - ContractDeployTransaction, - ContractInterface, - ContractMethod, - ContractMethodArgs, - ContractTransaction, - DeferredTopicFilter, - Overrides, - WrappedFallback, + BaseContractMethod, + ConstantContractMethod, + PostfixOverrides, + ContractEvent, + ContractEventArgs, + ContractEventName, + ContractDeployTransaction, + ContractInterface, + ContractMethod, + ContractMethodArgs, + ContractTransaction, + DeferredTopicFilter, + Overrides, + WrappedFallback, } from "./types.js"; diff --git a/src.ts/contract/types.ts b/src.ts/contract/types.ts index 70b96b09c..48df2fd70 100644 --- a/src.ts/contract/types.ts +++ b/src.ts/contract/types.ts @@ -1,45 +1,44 @@ import type { - EventFragment, - FunctionFragment, - Result, - Typed, + EventFragment, + FunctionFragment, + Result, + Typed, } from "../abi/index.js"; import type { - TransactionRequest, - PreparedTransactionRequest, - TopicFilter, + TransactionRequest, + PreparedTransactionRequest, + TopicFilter, } from "../providers/index.js"; import type { ContractTransactionResponse } from "./wrappers.js"; // The types of events a Contract can listen for export type ContractEventName = - | string - | ContractEvent - | TopicFilter - | DeferredTopicFilter; + string | ContractEvent | TopicFilter | DeferredTopicFilter; export interface ContractInterface { - [name: string]: BaseContractMethod; + [name: string]: BaseContractMethod; } export interface DeferredTopicFilter { - getTopicFilter(): Promise; - fragment: EventFragment; + getTopicFilter(): Promise; + fragment: EventFragment; } export interface ContractTransaction extends PreparedTransactionRequest { - // These are populated by contract methods and cannot bu null - to: string; - data: string; + // These are populated by contract methods and cannot bu null + to: string; + data: string; - // These are resolved - from?: string; + // These are resolved + from?: string; } // Deployment Transactions have no `to` -export interface ContractDeployTransaction - extends Omit {} +export interface ContractDeployTransaction extends Omit< + ContractTransaction, + "to" +> {} // Overrides; cannot override `to` or `data` as Contract populates these export interface Overrides extends Omit {} @@ -47,7 +46,7 @@ export interface Overrides extends Omit {} // Arguments for methods; with an optional (n+1)th Override export type PostfixOverrides> = A | [...A, Overrides]; export type ContractMethodArgs> = PostfixOverrides<{ - [I in keyof A]-?: A[I] | Typed; + [I in keyof A]-?: A[I] | Typed; }>; // A = Arguments passed in as a tuple @@ -56,61 +55,63 @@ export type ContractMethodArgs> = PostfixOverrides<{ // D = The type the default call will return (i.e. R for view/pure, // TransactionResponse otherwise) export interface BaseContractMethod< - A extends Array = Array, - R = any, - D extends R | ContractTransactionResponse = R | ContractTransactionResponse, + A extends Array = Array, + R = any, + D extends R | ContractTransactionResponse = R | ContractTransactionResponse, > { - (...args: ContractMethodArgs): Promise; + (...args: ContractMethodArgs): Promise; - name: string; + name: string; - fragment: FunctionFragment; + fragment: FunctionFragment; - getFragment(...args: ContractMethodArgs): FunctionFragment; + getFragment(...args: ContractMethodArgs): FunctionFragment; - populateTransaction( - ...args: ContractMethodArgs - ): Promise; - staticCall(...args: ContractMethodArgs): Promise; - send(...args: ContractMethodArgs): Promise; - estimateEnergy(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; + populateTransaction( + ...args: ContractMethodArgs + ): Promise; + staticCall(...args: ContractMethodArgs): Promise; + send(...args: ContractMethodArgs): Promise; + estimateEnergy(...args: ContractMethodArgs): Promise; + staticCallResult(...args: ContractMethodArgs): Promise; } export interface ContractMethod< - A extends Array = Array, - R = any, - D extends R | ContractTransactionResponse = R | ContractTransactionResponse, + A extends Array = Array, + R = any, + D extends R | ContractTransactionResponse = R | ContractTransactionResponse, > extends BaseContractMethod {} -export interface ConstantContractMethod, R = any> - extends ContractMethod {} +export interface ConstantContractMethod< + A extends Array, + R = any, +> extends ContractMethod {} // Arguments for events; with each element optional and/or nullable export type ContractEventArgs> = { - [I in keyof A]?: A[I] | Typed | null; + [I in keyof A]?: A[I] | Typed | null; }; export interface ContractEvent = Array> { - (...args: ContractEventArgs): DeferredTopicFilter; + (...args: ContractEventArgs): DeferredTopicFilter; - name: string; + name: string; - fragment: EventFragment; - getFragment(...args: ContractEventArgs): EventFragment; + fragment: EventFragment; + getFragment(...args: ContractEventArgs): EventFragment; } export interface WrappedFallback { - ( - overrides?: Omit, - ): Promise; - - populateTransaction( - overrides?: Omit, - ): Promise; - staticCall(overrides?: Omit): Promise; - send( - overrides?: Omit, - ): Promise; - estimateEnergy(overrides?: Omit): Promise; + ( + overrides?: Omit, + ): Promise; + + populateTransaction( + overrides?: Omit, + ): Promise; + staticCall(overrides?: Omit): Promise; + send( + overrides?: Omit, + ): Promise; + estimateEnergy(overrides?: Omit): Promise; } diff --git a/src.ts/contract/wrappers.ts b/src.ts/contract/wrappers.ts index 7053d5184..ea4f7469e 100644 --- a/src.ts/contract/wrappers.ts +++ b/src.ts/contract/wrappers.ts @@ -1,8 +1,8 @@ import { - Block, - Log, - TransactionReceipt, - TransactionResponse, + Block, + Log, + TransactionReceipt, + TransactionResponse, } from "../providers/provider.js"; import { defineProperties, EventPayload } from "../utils/index.js"; @@ -14,120 +14,120 @@ import type { BaseContract } from "./contract.js"; import type { ContractEventName } from "./types.js"; export class EventLog extends Log { - readonly interface!: Interface; - readonly fragment!: EventFragment; - readonly args!: Result; - - constructor(log: Log, iface: Interface, fragment: EventFragment) { - super(log, log.provider); - const args = iface.decodeEventLog(fragment, log.data, log.topics); - defineProperties(this, { args, fragment, interface: iface }); - } - - get eventName(): string { - return this.fragment.name; - } - get eventSignature(): string { - return this.fragment.format(); - } + readonly interface!: Interface; + readonly fragment!: EventFragment; + readonly args!: Result; + + constructor(log: Log, iface: Interface, fragment: EventFragment) { + super(log, log.provider); + const args = iface.decodeEventLog(fragment, log.data, log.topics); + defineProperties(this, { args, fragment, interface: iface }); + } + + get eventName(): string { + return this.fragment.name; + } + get eventSignature(): string { + return this.fragment.format(); + } } export class ContractTransactionReceipt extends TransactionReceipt { - readonly #iface: Interface; - - constructor(iface: Interface, provider: Provider, tx: TransactionReceipt) { - super(tx, provider); - this.#iface = iface; - } - - get logs(): Array { - return super.logs.map((log) => { - const fragment = log.topics.length - ? this.#iface.getEvent(log.topics[0]) - : null; - if (fragment) { - return new EventLog(log, this.#iface, fragment); - } else { - return log; - } - }); - } + readonly #iface: Interface; + + constructor(iface: Interface, provider: Provider, tx: TransactionReceipt) { + super(tx, provider); + this.#iface = iface; + } + + get logs(): Array { + return super.logs.map((log) => { + const fragment = log.topics.length + ? this.#iface.getEvent(log.topics[0]) + : null; + if (fragment) { + return new EventLog(log, this.#iface, fragment); + } else { + return log; + } + }); + } } export class ContractTransactionResponse extends TransactionResponse { - readonly #iface: Interface; - - constructor(iface: Interface, provider: Provider, tx: TransactionResponse) { - super(tx, provider); - this.#iface = iface; - } - - async wait(confirms?: number): Promise { - const receipt = await super.wait(); - if (receipt == null) { - return null; - } - return new ContractTransactionReceipt(this.#iface, this.provider, receipt); - } + readonly #iface: Interface; + + constructor(iface: Interface, provider: Provider, tx: TransactionResponse) { + super(tx, provider); + this.#iface = iface; + } + + async wait(confirms?: number): Promise { + const receipt = await super.wait(); + if (receipt == null) { + return null; + } + return new ContractTransactionReceipt(this.#iface, this.provider, receipt); + } } export class ContractUnknownEventPayload extends EventPayload { - readonly log!: Log; - - constructor( - contract: BaseContract, - listener: null | Listener, - filter: ContractEventName, - log: Log, - ) { - super(contract, listener, filter); - defineProperties(this, { log }); - } - - async getBlock(): Promise { - return await this.log.getBlock(); - } - - async getTransaction(): Promise { - return await this.log.getTransaction(); - } - - async getTransactionReceipt(): Promise { - return await this.log.getTransactionReceipt(); - } + readonly log!: Log; + + constructor( + contract: BaseContract, + listener: null | Listener, + filter: ContractEventName, + log: Log, + ) { + super(contract, listener, filter); + defineProperties(this, { log }); + } + + async getBlock(): Promise { + return await this.log.getBlock(); + } + + async getTransaction(): Promise { + return await this.log.getTransaction(); + } + + async getTransactionReceipt(): Promise { + return await this.log.getTransactionReceipt(); + } } export class ContractEventPayload extends ContractUnknownEventPayload { - declare readonly fragment: EventFragment; - declare readonly log: EventLog; - declare readonly args: Result; - - constructor( - contract: BaseContract, - listener: null | Listener, - filter: ContractEventName, - fragment: EventFragment, - _log: Log, - ) { - super( - contract, - listener, - filter, - new EventLog(_log, contract.interface, fragment), - ); - const args = contract.interface.decodeEventLog( - fragment, - this.log.data, - this.log.topics, - ); - defineProperties(this, { args, fragment }); - } - - get eventName(): string { - return this.fragment.name; - } - - get eventSignature(): string { - return this.fragment.format(); - } + declare readonly fragment: EventFragment; + declare readonly log: EventLog; + declare readonly args: Result; + + constructor( + contract: BaseContract, + listener: null | Listener, + filter: ContractEventName, + fragment: EventFragment, + _log: Log, + ) { + super( + contract, + listener, + filter, + new EventLog(_log, contract.interface, fragment), + ); + const args = contract.interface.decodeEventLog( + fragment, + this.log.data, + this.log.topics, + ); + defineProperties(this, { args, fragment }); + } + + get eventName(): string { + return this.fragment.name; + } + + get eventSignature(): string { + return this.fragment.format(); + } } diff --git a/src.ts/corebc.ts b/src.ts/corebc.ts index 06dc13039..17036ae9a 100644 --- a/src.ts/corebc.ts +++ b/src.ts/corebc.ts @@ -2,250 +2,250 @@ export { version } from "./_version.js"; export { publicToAddress } from "./transaction/address.js"; export { - decodeBytes32String, - encodeBytes32String, - AbiCoder, - ConstructorFragment, - ErrorFragment, - EventFragment, - Fragment, - FallbackFragment, - FunctionFragment, - NamedFragment, - ParamType, - StructFragment, - checkResultErrors, - ErrorDescription, - Indexed, - Interface, - LogDescription, - Result, - TransactionDescription, - Typed, + decodeBytes32String, + encodeBytes32String, + AbiCoder, + ConstructorFragment, + ErrorFragment, + EventFragment, + Fragment, + FallbackFragment, + FunctionFragment, + NamedFragment, + ParamType, + StructFragment, + checkResultErrors, + ErrorDescription, + Indexed, + Interface, + LogDescription, + Result, + TransactionDescription, + Typed, } from "./abi/index.js"; export { getAddress, networkIdToPrefix } from "./address/index.js"; export { - getCreate2Address, - getCreateAddress, + getCreate2Address, + getCreateAddress, } from "./address/contract-address.js"; export { isAddressable, isAddress, resolveAddress } from "./address/checks.js"; export { - ZeroAddress, - OrePerXCB, - MaxUint256, - MinInt256, - MaxInt256, - N, - ZeroHash, - CoreSymbol, - MessagePrefix, + ZeroAddress, + OrePerXCB, + MaxUint256, + MinInt256, + MaxInt256, + N, + ZeroHash, + CoreSymbol, + MessagePrefix, } from "./constants/index.js"; export { - BaseContract, - Contract, - ContractFactory, - ContractEventPayload, - ContractTransactionReceipt, - ContractTransactionResponse, - ContractUnknownEventPayload, - EventLog, + BaseContract, + Contract, + ContractFactory, + ContractEventPayload, + ContractTransactionReceipt, + ContractTransactionResponse, + ContractUnknownEventPayload, + EventLog, } from "./contract/index.js"; export { - computeHmac, - randomBytes, - ripemd160, - sha256, - sha512, - pbkdf2, - scrypt, - scryptSync, - lock, - Ed448Goldilock, - Signature, - SigningKey, - keccak256, + computeHmac, + randomBytes, + ripemd160, + sha256, + sha512, + pbkdf2, + scrypt, + scryptSync, + lock, + Ed448Goldilock, + Signature, + SigningKey, + keccak256, } from "./crypto/index.js"; export { - id, - hashMessage, - verifyMessage, - solidityPacked, - solidityPackedSha256, - TypedDataEncoder, - verifyTypedData, + id, + hashMessage, + verifyMessage, + solidityPacked, + solidityPackedSha256, + TypedDataEncoder, + verifyTypedData, } from "./hash/index.js"; export { - getDefaultProvider, - Block, - FeeData, - Log, - TransactionReceipt, - TransactionResponse, - AbstractSigner, - NonceManager, - VoidSigner, - AbstractProvider, - FallbackProvider, - JsonRpcApiProvider, - JsonRpcProvider, - JsonRpcSigner, - BrowserProvider, - AlchemyProvider, - AnkrProvider, - CloudflareProvider, - InfuraProvider, - InfuraWebSocketProvider, - PocketProvider, - QuickNodeProvider, - IpcSocketProvider, - SocketProvider, - WebSocketProvider, - Network, - FeeDataNetworkPlugin, - EnergyCostPlugin, - NetworkPlugin, - SocketBlockSubscriber, - SocketEventSubscriber, - SocketPendingSubscriber, - SocketSubscriber, - UnmanagedSubscriber, - copyRequest, - showThrottleMessage, + getDefaultProvider, + Block, + FeeData, + Log, + TransactionReceipt, + TransactionResponse, + AbstractSigner, + NonceManager, + VoidSigner, + AbstractProvider, + FallbackProvider, + JsonRpcApiProvider, + JsonRpcProvider, + JsonRpcSigner, + BrowserProvider, + AlchemyProvider, + AnkrProvider, + CloudflareProvider, + InfuraProvider, + InfuraWebSocketProvider, + PocketProvider, + QuickNodeProvider, + IpcSocketProvider, + SocketProvider, + WebSocketProvider, + Network, + FeeDataNetworkPlugin, + EnergyCostPlugin, + NetworkPlugin, + SocketBlockSubscriber, + SocketEventSubscriber, + SocketPendingSubscriber, + SocketSubscriber, + UnmanagedSubscriber, + copyRequest, + showThrottleMessage, } from "./providers/index.js"; export { - accessListify, - computeAddress, - recoverAddress, - Transaction, + accessListify, + computeAddress, + recoverAddress, + Transaction, } from "./transaction/index.js"; export { - decodeBase58, - encodeBase58, - decodeBase64, - encodeBase64, - concat, - dataLength, - dataSlice, - getBytes, - getBytesCopy, - hexlify, - isHexString, - isBytesLike, - stripZerosLeft, - zeroPadBytes, - zeroPadValue, - defineProperties, - resolveProperties, - assert, - assertArgument, - assertArgumentCount, - assertNormalize, - assertPrivate, - makeError, - isCallException, - isError, - EventPayload, - FetchRequest, - FetchResponse, - FetchCancelSignal, - FixedNumber, - getBigInt, - getNumber, - getUint, - toBeArray, - toBigInt, - toBeHex, - toNumber, - toQuantity, - fromTwos, - toTwos, - mask, - formatXCB, - parseXCB, - formatUnits, - parseUnits, - toUtf8Bytes, - toUtf8CodePoints, - toUtf8String, - Utf8ErrorFuncs, - decodeRlp, - encodeRlp, - uuidV4, - arrayify, - hexConcat, + decodeBase58, + encodeBase58, + decodeBase64, + encodeBase64, + concat, + dataLength, + dataSlice, + getBytes, + getBytesCopy, + hexlify, + isHexString, + isBytesLike, + stripZerosLeft, + zeroPadBytes, + zeroPadValue, + defineProperties, + resolveProperties, + assert, + assertArgument, + assertArgumentCount, + assertNormalize, + assertPrivate, + makeError, + isCallException, + isError, + EventPayload, + FetchRequest, + FetchResponse, + FetchCancelSignal, + FixedNumber, + getBigInt, + getNumber, + getUint, + toBeArray, + toBigInt, + toBeHex, + toNumber, + toQuantity, + fromTwos, + toTwos, + mask, + formatXCB, + parseXCB, + formatUnits, + parseUnits, + toUtf8Bytes, + toUtf8CodePoints, + toUtf8String, + Utf8ErrorFuncs, + decodeRlp, + encodeRlp, + uuidV4, + arrayify, + hexConcat, } from "./utils/index.js"; export { - Mnemonic, - BaseWallet, - HDNodeWallet, - Wallet, - defaultPath, - getAccountPath, - getIndexedAccountPath, - isCrowdsaleJson, - isKeystoreJson, - decryptCrowdsaleJson, - decryptKeystoreJsonSync, - decryptKeystoreJson, - encryptKeystoreJson, - encryptKeystoreJsonSync, + Mnemonic, + BaseWallet, + HDNodeWallet, + Wallet, + defaultPath, + getAccountPath, + getIndexedAccountPath, + isCrowdsaleJson, + isKeystoreJson, + decryptCrowdsaleJson, + decryptKeystoreJsonSync, + decryptKeystoreJson, + encryptKeystoreJson, + encryptKeystoreJsonSync, } from "./wallet/index.js"; export { BigNumber } from "./bigNumber/bigNumber.js"; export { - Wordlist, - LangEn, - WordlistOwl, - WordlistOwlA, - wordlists, + Wordlist, + LangEn, + WordlistOwl, + WordlistOwlA, + wordlists, } from "./wordlists/index.js"; ///////////////////////////// // Types export type { - JsonFragment, - JsonFragmentType, - FormatType, - FragmentType, - InterfaceAbi, - ParamTypeWalkFunc, - ParamTypeWalkAsyncFunc, + JsonFragment, + JsonFragmentType, + FormatType, + FragmentType, + InterfaceAbi, + ParamTypeWalkFunc, + ParamTypeWalkAsyncFunc, } from "./abi/index.js"; export type { - Addressable, - AddressLike, - NameResolver, + Addressable, + AddressLike, + NameResolver, } from "./address/index.js"; export type { - ConstantContractMethod, - ContractEvent, - ContractEventArgs, - ContractEventName, - ContractInterface, - ContractMethod, - ContractMethodArgs, - ContractTransaction, - DeferredTopicFilter, - Overrides, - BaseContractMethod, - ContractDeployTransaction, - PostfixOverrides, - WrappedFallback, + ConstantContractMethod, + ContractEvent, + ContractEventArgs, + ContractEventName, + ContractInterface, + ContractMethod, + ContractMethodArgs, + ContractTransaction, + DeferredTopicFilter, + Overrides, + BaseContractMethod, + ContractDeployTransaction, + PostfixOverrides, + WrappedFallback, } from "./contract/index.js"; export type { ProgressCallback, SignatureLike } from "./crypto/index.js"; @@ -253,97 +253,100 @@ export type { ProgressCallback, SignatureLike } from "./crypto/index.js"; export type { TypedDataDomain, TypedDataField } from "./hash/index.js"; export type { - Provider, - Signer, - AbstractProviderPlugin, - BlockParams, - BlockTag, - ContractRunner, - DebugEventBrowserProvider, - Eip1193Provider, - EventFilter, - Filter, - FilterByBlockHash, - EnergyCostParameters, - JsonRpcApiProviderOptions, - JsonRpcError, - JsonRpcPayload, - JsonRpcResult, - JsonRpcTransactionRequest, - LogParams, - MinedBlock, - MinedTransactionResponse, - Networkish, - OrphanFilter, - PerformActionFilter, - PerformActionRequest, - PerformActionTransaction, - PreparedTransactionRequest, - ProviderEvent, - Subscriber, - Subscription, - TopicFilter, - TransactionReceiptParams, - TransactionRequest, - TransactionResponseParams, - WebSocketCreator, - WebSocketLike, + Provider, + Signer, + AbstractProviderPlugin, + BlockParams, + BlockTag, + ContractRunner, + DebugEventBrowserProvider, + Eip1193Provider, + EventFilter, + Filter, + FilterByBlockHash, + EnergyCostParameters, + JsonRpcApiProviderOptions, + JsonRpcError, + JsonRpcPayload, + JsonRpcResult, + JsonRpcTransactionRequest, + LogParams, + MinedBlock, + MinedTransactionResponse, + Networkish, + OrphanFilter, + PerformActionFilter, + PerformActionRequest, + PerformActionTransaction, + PreparedTransactionRequest, + ProviderEvent, + Subscriber, + Subscription, + TopicFilter, + TransactionReceiptParams, + TransactionRequest, + TransactionResponseParams, + WebSocketCreator, + WebSocketLike, } from "./providers/index.js"; export type { - AccessList, - AccessListish, - AccessListEntry, - TransactionLike, + AccessList, + AccessListish, + AccessListEntry, + TransactionLike, } from "./transaction/index.js"; export type { - BytesLike, - BigNumberish, - Numeric, - ErrorCode, - FixedFormat, - Utf8ErrorFunc, - UnicodeNormalizationForm, - Utf8ErrorReason, - RlpStructuredData, - GetUrlResponse, - FetchPreflightFunc, - FetchProcessFunc, - FetchRetryFunc, - FetchGatewayFunc, - FetchGetUrlFunc, - CoreBCError, - UnknownError, - NotImplementedError, - UnsupportedOperationError, - NetworkError, - ServerError, - TimeoutError, - BadDataError, - CancelledError, - BufferOverrunError, - NumericFaultError, - InvalidArgumentError, - MissingArgumentError, - UnexpectedArgumentError, - CallExceptionError, - InsufficientFundsError, - NonceExpiredError, - OffchainFaultError, - ReplacementUnderpricedError, - TransactionReplacedError, - UnconfiguredNameError, - ActionRejectedError, - CodedCoreBCError, - CallExceptionAction, - CallExceptionTransaction, - EventEmitterable, - Listener, + BytesLike, + BigNumberish, + Numeric, + ErrorCode, + FixedFormat, + Utf8ErrorFunc, + UnicodeNormalizationForm, + Utf8ErrorReason, + RlpStructuredData, + GetUrlResponse, + FetchPreflightFunc, + FetchProcessFunc, + FetchRetryFunc, + FetchGatewayFunc, + FetchGetUrlFunc, + CoreBCError, + UnknownError, + NotImplementedError, + UnsupportedOperationError, + NetworkError, + ServerError, + TimeoutError, + BadDataError, + CancelledError, + BufferOverrunError, + NumericFaultError, + InvalidArgumentError, + MissingArgumentError, + UnexpectedArgumentError, + CallExceptionError, + InsufficientFundsError, + NonceExpiredError, + OffchainFaultError, + ReplacementUnderpricedError, + TransactionReplacedError, + UnconfiguredNameError, + ActionRejectedError, + CodedCoreBCError, + CallExceptionAction, + CallExceptionTransaction, + EventEmitterable, + Listener, } from "./utils/index.js"; export type { - CrowdsaleAccount, - KeystoreAccount, - EncryptOptions, + CrowdsaleAccount, + KeystoreAccount, + EncryptOptions, } from "./wallet/index.js"; + +export * from "./cip/index.js"; +export * from "./ipfs/index.js"; diff --git a/src.ts/crypto/browser-ed448.ts b/src.ts/crypto/browser-ed448.ts index cb8965cb7..e61328ef0 100644 --- a/src.ts/crypto/browser-ed448.ts +++ b/src.ts/crypto/browser-ed448.ts @@ -1,5 +1,6 @@ -"use strict"; - +// bcrypto does not ship TypeScript declarations. // @ts-ignore -import ed448 from "bcrypto/lib/ed448-browser.js"; +import backend from "bcrypto/lib/ed448-browser.js"; +import type { Ed448Backend } from "./ed448-types.js"; +const ed448: Ed448Backend = backend; export default ed448; diff --git a/src.ts/crypto/browser-sha3.ts b/src.ts/crypto/browser-sha3.ts index f07274f2f..4e1d18b5c 100644 --- a/src.ts/crypto/browser-sha3.ts +++ b/src.ts/crypto/browser-sha3.ts @@ -1,4 +1,5 @@ -"use strict"; +import { Buffer } from "buffer"; +("use strict"); // @ts-ignore import _ripemd160 from "bcrypto/lib/ripemd160-browser"; @@ -12,43 +13,43 @@ import { SupportedAlgorithm } from "./sha3.js"; const logger = new Logger("corebc-crypto/browser-sha3/0.0.1"); export function ripemd160(data: BytesLike): string { - const d = Buffer.from(arrayify(data)); - const h = _ripemd160.digest(d); - return hexlify(h); + const d = Buffer.from(arrayify(data)); + const h = _ripemd160.digest(d); + return hexlify(h); } export function sha256(data: BytesLike): string { - const d = Buffer.from(arrayify(data)); - const h = sha3.digest(d, 256); - return hexlify(h); + const d = Buffer.from(arrayify(data)); + const h = sha3.digest(d, 256); + return hexlify(h); } export function sha512(data: BytesLike): string { - const d = Buffer.from(arrayify(data)); - const h = sha3.digest(d, 512); - return hexlify(h); + const d = Buffer.from(arrayify(data)); + const h = sha3.digest(d, 512); + return hexlify(h); } export function computeHmac( - algorithm: SupportedAlgorithm, - key: BytesLike, - data: BytesLike, + algorithm: SupportedAlgorithm, + key: BytesLike, + data: BytesLike, ): string { - const d = Buffer.from(arrayify(data)); - const k = Buffer.from(arrayify(key)); - if (algorithm === SupportedAlgorithm.sha256) { - return hexlify(sha3.mac(d, k, 256)); - } else if (algorithm === SupportedAlgorithm.sha512) { - return hexlify(sha3.mac(d, k, 512)); - } - - logger.throwError( - "unsupported algorithm - " + algorithm, - Logger.errors.UNSUPPORTED_OPERATION, - { - operation: "computeHmac", - algorithm: algorithm, - }, - ); - return ""; + const d = Buffer.from(arrayify(data)); + const k = Buffer.from(arrayify(key)); + if (algorithm === SupportedAlgorithm.sha256) { + return hexlify(sha3.mac(d, k, 256)); + } else if (algorithm === SupportedAlgorithm.sha512) { + return hexlify(sha3.mac(d, k, 512)); + } + + logger.throwError( + "unsupported algorithm - " + algorithm, + Logger.errors.UNSUPPORTED_OPERATION, + { + operation: "computeHmac", + algorithm: algorithm, + }, + ); + return ""; } diff --git a/src.ts/crypto/crypto-browser.ts b/src.ts/crypto/crypto-browser.ts index 7fc53da79..06c90c20a 100644 --- a/src.ts/crypto/crypto-browser.ts +++ b/src.ts/crypto/crypto-browser.ts @@ -1,10 +1,11 @@ /* Browser Crypto Shims */ -import { hmac } from "@noble/hashes/hmac"; -import { pbkdf2 } from "@noble/hashes/pbkdf2"; -import { sha256 } from "@noble/hashes/sha256"; -import { sha512 } from "@noble/hashes/sha512"; -import { sha3_256, sha3_512 } from "@noble/hashes/sha3"; +import { ripemd160 } from "@noble/hashes/legacy.js"; +import { hmac } from "@noble/hashes/hmac.js"; +import { pbkdf2 } from "@noble/hashes/pbkdf2.js"; +import { sha256 } from "@noble/hashes/sha2.js"; +import { sha512 } from "@noble/hashes/sha2.js"; +import { sha3_256, sha3_512 } from "@noble/hashes/sha3.js"; import ed448 from "./browser-ed448.js"; import { assert, assertArgument } from "../utils/index.js"; @@ -12,84 +13,89 @@ export { ed448 }; export { Ed448Goldilock } from "./ed448goldilock-browser.js"; declare global { - interface Window {} - // @ts-ignore - const window: Window; - // @ts-ignore - const self: Window; + interface Window {} + // @ts-ignore + const window: Window; + // @ts-ignore + const self: Window; } function getGlobal(): any { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw new Error("unable to locate global object"); + if (typeof globalThis !== "undefined") return globalThis; + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw new Error("unable to locate global object"); } const anyGlobal = getGlobal(); const crypto: any = anyGlobal.crypto || anyGlobal.msCrypto; export interface CryptoHasher { - update(data: Uint8Array): CryptoHasher; - digest(): Uint8Array; + update(data: Uint8Array): CryptoHasher; + digest(): Uint8Array; } export function createHash(algo: string): CryptoHasher { - switch (algo) { - case "sha256": - return sha256.create(); - case "sha512": - return sha512.create(); - case "sha3-256": - return sha3_256.create(); - case "sha3-512": - return sha3_512.create(); - } - assertArgument(false, "invalid hashing algorithm name", "algorithm", algo); + switch (algo) { + case "ripemd160": + return ripemd160.create(); + case "sha256": + return sha256.create(); + case "sha512": + return sha512.create(); + case "sha3-256": + return sha3_256.create(); + case "sha3-512": + return sha3_512.create(); + } + assertArgument(false, "invalid hashing algorithm name", "algorithm", algo); } export function createHmac(_algo: string, key: Uint8Array): CryptoHasher { - const algo = { sha256, sha512 }[_algo]; - assertArgument(algo != null, "invalid hmac algorithm", "algorithm", _algo); - return hmac.create(algo, key); + const algo = { sha256, sha512, "sha3-256": sha3_256, "sha3-512": sha3_512 }[ + _algo as "sha256" + ]; + assertArgument(algo != null, "invalid hmac algorithm", "algorithm", _algo); + return hmac.create(algo, key); } export function pbkdf2Sync( - password: Uint8Array, - salt: Uint8Array, - iterations: number, - keylen: number, - _algo: "sha256" | "sha512", + password: Uint8Array, + salt: Uint8Array, + iterations: number, + keylen: number, + _algo: "sha256" | "sha512", ): Uint8Array { - const algo = { sha256, sha512 }[_algo]; - assertArgument(algo != null, "invalid pbkdf2 algorithm", "algorithm", _algo); - return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen }); + const algo = { sha256, sha512 }[_algo]; + assertArgument(algo != null, "invalid pbkdf2 algorithm", "algorithm", _algo); + return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen }); } export function randomBytes(length: number): Uint8Array { - assert( - crypto != null, - "platform does not support secure random numbers", - "UNSUPPORTED_OPERATION", - { - operation: "randomBytes", - }, - ); + assert( + crypto != null, + "platform does not support secure random numbers", + "UNSUPPORTED_OPERATION", + { + operation: "randomBytes", + }, + ); - assertArgument( - Number.isInteger(length) && length > 0 && length <= 1024, - "invalid length", - "length", - length, - ); + assertArgument( + Number.isInteger(length) && length > 0 && length <= 1024, + "invalid length", + "length", + length, + ); - const result = new Uint8Array(length); - crypto.getRandomValues(result); - return result; + const result = new Uint8Array(length); + crypto.getRandomValues(result); + return result; } diff --git a/src.ts/crypto/crypto.ts b/src.ts/crypto/crypto.ts index e095a7ab7..dedc6a05d 100644 --- a/src.ts/crypto/crypto.ts +++ b/src.ts/crypto/crypto.ts @@ -1,3 +1,4 @@ +/// import ed448 from "./ed448.js"; export { ed448 }; export { Ed448Goldilock } from "./ed448goldilock.js"; diff --git a/src.ts/crypto/ed448-types.ts b/src.ts/crypto/ed448-types.ts new file mode 100644 index 000000000..a73d95102 --- /dev/null +++ b/src.ts/crypto/ed448-types.ts @@ -0,0 +1,14 @@ +import type { Buffer } from "buffer"; +/** Buffer-based bcrypto Ed448 operations used by Core signing. */ +export interface Ed448Backend { + privateKeyGenerate(): Buffer; + publicKeyCreate(key: Buffer): Buffer; + publicKeyFromScalar(scalar: Buffer): Buffer; + publicKeyVerify(key: Buffer): boolean; + publicKeyCombine(keys: Buffer[]): Buffer; + sign(message: Buffer, key: Buffer): Buffer; + signWithScalar(message: Buffer, scalar: Buffer, prefix: Buffer): Buffer; + verify(message: Buffer, signature: Buffer, publicKey: Buffer): boolean; + derive(publicKey: Buffer, key: Buffer): Buffer; + deriveWithScalar(publicKey: Buffer, scalar: Buffer): Buffer; +} diff --git a/src.ts/crypto/ed448.ts b/src.ts/crypto/ed448.ts index 6b0b62164..225fc9a8b 100644 --- a/src.ts/crypto/ed448.ts +++ b/src.ts/crypto/ed448.ts @@ -1,6 +1,6 @@ -"use strict"; - +// bcrypto does not ship TypeScript declarations. // @ts-ignore -import ed448 from "bcrypto/lib/ed448.js"; - +import backend from "bcrypto/lib/ed448.js"; +import type { Ed448Backend } from "./ed448-types.js"; +const ed448: Ed448Backend = backend; export default ed448; diff --git a/src.ts/crypto/ed448goldilock-browser.ts b/src.ts/crypto/ed448goldilock-browser.ts index a71f8898f..944683d03 100644 --- a/src.ts/crypto/ed448goldilock-browser.ts +++ b/src.ts/crypto/ed448goldilock-browser.ts @@ -1,3 +1,4 @@ +import { Buffer } from "buffer"; // @ts-ignore import ed448 from "./browser-ed448.js"; // @ts-ignore @@ -6,146 +7,150 @@ import pbkdf2 from "./pbkdf2-browser.js"; import SHA3_512 from "bcrypto/lib/sha3-512.js"; export class Ed448Goldilock { - static _channel = ed448; + static _channel = ed448; - static generatePrivateKey() { - var privateKey = ed448.privateKeyGenerate(); - privateKey[56] &= 0x7f; - return privateKey; - } + static generatePrivateKey() { + var privateKey = ed448.privateKeyGenerate(); + privateKey[56] &= 0x7f; + return privateKey; + } - static getPublicKeyFromPrivateKey(privateKey: string): string { - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var scalar = secret.slice(0, 56); - scalar[0] &= 0xfc; - scalar[55] |= 0x80; - var publicKey = this._channel.publicKeyFromScalar(scalar); - return Buffer.from(publicKey).toString("hex"); - } else { - var publicKey = this._channel.publicKeyCreate(secret); - return Buffer.from(publicKey).toString("hex"); - } - } + static getPublicKeyFromPrivateKey(privateKey: string): string { + var secret = Buffer.from(privateKey, "hex"); + if (secret[56] > 127) { + var scalar = secret.slice(0, 56); + scalar[0] &= 0xfc; + scalar[55] |= 0x80; + var publicKey = this._channel.publicKeyFromScalar(scalar); + return Buffer.from(publicKey).toString("hex"); + } else { + var publicKey = this._channel.publicKeyCreate(secret); + return Buffer.from(publicKey).toString("hex"); + } + } - static signWithPrivateKey(privateKey: string, msg: string): string { - var msgToSign = Buffer.from(msg, "hex"); - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var prefix = secret.slice(0, 57); - prefix[0] &= 0xfc; - prefix[56] = 0; - prefix[55] |= 0x80; - var scalar = prefix.slice(0, 56); - var signedMessage = this._channel.signWithScalar( - msgToSign, - scalar, - prefix, - ); - return Buffer.from(signedMessage).toString("hex"); - } else { - var signedMessage = this._channel.sign(msgToSign, secret); - return Buffer.from(signedMessage).toString("hex"); - } - } + static signWithPrivateKey(privateKey: string, msg: string): string { + var msgToSign = Buffer.from(msg, "hex"); + var secret = Buffer.from(privateKey, "hex"); + if (secret[56] > 127) { + var prefix = secret.slice(0, 57); + prefix[0] &= 0xfc; + prefix[56] = 0; + prefix[55] |= 0x80; + var scalar = prefix.slice(0, 56); + var signedMessage = this._channel.signWithScalar( + msgToSign, + scalar, + prefix, + ); + return Buffer.from(signedMessage).toString("hex"); + } else { + var signedMessage = this._channel.sign(msgToSign, secret); + return Buffer.from(signedMessage).toString("hex"); + } + } - static signWithPrivateKeyNConcatPubkey( - privateKey: string, - msg: string, - ): string { - var signedMessage = Ed448Goldilock.signWithPrivateKey(privateKey, msg); - var publicKey = Ed448Goldilock.getPublicKeyFromPrivateKey(privateKey); - return signedMessage + publicKey; - } + static signWithPrivateKeyNConcatPubkey( + privateKey: string, + msg: string, + ): string { + var signedMessage = Ed448Goldilock.signWithPrivateKey(privateKey, msg); + var publicKey = Ed448Goldilock.getPublicKeyFromPrivateKey(privateKey); + return signedMessage + publicKey; + } - static verifySignature( - msgHash: string, - signedMsg: string, - pubKey: string, - ): boolean { - return this._channel.verify(msgHash, signedMsg, pubKey); - } + static verifySignature( + msgHash: string, + signedMsg: string, + pubKey: string, + ): boolean { + return this._channel.verify( + Buffer.from(msgHash, "hex"), + Buffer.from(signedMsg, "hex"), + Buffer.from(pubKey, "hex"), + ); + } - static SHA512Hash(password: string, salt: string): string { - var p1 = Buffer.from(password, "hex"); - var s1 = Buffer.from(salt, "hex"); - return Buffer.from(pbkdf2.derive(SHA3_512, p1, s1, 2048, 57)).toString( - "hex", - ); - } + static SHA512Hash(password: string, salt: string): string { + var p1 = Buffer.from(password, "hex"); + var s1 = Buffer.from(salt, "hex"); + return Buffer.from(pbkdf2.derive(SHA3_512, p1, s1, 2048, 57)).toString( + "hex", + ); + } - static concatenateAndHex( - prefix: number, - key: string, - index: number, - salt: string, - ): string { - var ind = Buffer.alloc(4); - var p = Buffer.alloc(1); - p[0] = prefix % 256; - var j = index; - for (let i = 0; i < 4; i++) { - ind[i] = j % 256; - j = Math.floor(j / 256); - } - var t = p.toString("hex") + key + ind.toString("hex"); - return Ed448Goldilock.SHA512Hash(t, salt); - } + static concatenateAndHex( + prefix: number, + key: string, + index: number, + salt: string, + ): string { + var ind = Buffer.alloc(4); + var p = Buffer.alloc(1); + p[0] = prefix % 256; + var j = index; + for (let i = 0; i < 4; i++) { + ind[i] = j % 256; + j = Math.floor(j / 256); + } + var t = p.toString("hex") + key + ind.toString("hex"); + return Ed448Goldilock.SHA512Hash(t, salt); + } - static addScalar(a: string, b: string): string { - var a1 = Buffer.from(a, "hex"); - var b1 = Buffer.from(b.substr(0, 106) + "00000000", "hex"); - b1[0] &= 0xfc; - var c = Buffer.alloc(57); - var hold = 0; - for (let i = 0; i < 57; i++) { - hold += a1[i] + b1[i]; - c[i] = hold % 256; - hold = Math.floor(hold / 256); - } - return c.toString("hex"); - } + static addScalar(a: string, b: string): string { + var a1 = Buffer.from(a, "hex"); + var b1 = Buffer.from(b.substr(0, 106) + "00000000", "hex"); + b1[0] &= 0xfc; + var c = Buffer.alloc(57); + var hold = 0; + for (let i = 0; i < 57; i++) { + hold += a1[i] + b1[i]; + c[i] = hold % 256; + hold = Math.floor(hold / 256); + } + return c.toString("hex"); + } - static seedToExtendedPrivate(seed: string): string { - var s1 = Ed448Goldilock.SHA512Hash( - seed, - "6d6e656d6f6e6963666f72746865636861696e", - ); - var s2 = Ed448Goldilock.SHA512Hash( - seed, - "6d6e656d6f6e6963666f727468656b6579", - ); - var b = Buffer.from(s2, "hex"); - b[56] |= 0x80; - b[55] |= 0x80; - b[55] &= 0xbf; - var s3 = b.toString("hex"); - return s1 + s3; - } + static seedToExtendedPrivate(seed: string): string { + var s1 = Ed448Goldilock.SHA512Hash( + seed, + "6d6e656d6f6e6963666f72746865636861696e", + ); + var s2 = Ed448Goldilock.SHA512Hash( + seed, + "6d6e656d6f6e6963666f727468656b6579", + ); + var b = Buffer.from(s2, "hex"); + b[56] |= 0x80; + b[55] |= 0x80; + b[55] &= 0xbf; + var s3 = b.toString("hex"); + return s1 + s3; + } - static childPrivateToPrivate(s: string, index: number) { - var s0 = s.substr(0, 114); - var s1 = s.substr(114, 228); - var r0, r1; - if (index >= 0x80000000) { - r0 = Ed448Goldilock.concatenateAndHex(1, s1, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(0, s1, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } else { - var pub = Ed448Goldilock.getPublicKeyFromPrivateKey(s1); - r0 = Ed448Goldilock.concatenateAndHex(3, pub, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(2, pub, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } - } + static childPrivateToPrivate(s: string, index: number) { + var s0 = s.substr(0, 114); + var s1 = s.substr(114, 228); + var r0, r1; + if (index >= 0x80000000) { + r0 = Ed448Goldilock.concatenateAndHex(1, s1, index, s0); + r1 = Ed448Goldilock.concatenateAndHex(0, s1, index, s0); + return r0 + Ed448Goldilock.addScalar(s1, r1); + } else { + var pub = Ed448Goldilock.getPublicKeyFromPrivateKey(s1); + r0 = Ed448Goldilock.concatenateAndHex(3, pub, index, s0); + r1 = Ed448Goldilock.concatenateAndHex(2, pub, index, s0); + return r0 + Ed448Goldilock.addScalar(s1, r1); + } + } - static HDWalletGenerateKeyFromSeed(seed: string, index: number): string { - var m = Ed448Goldilock.seedToExtendedPrivate(seed); - var k1 = Ed448Goldilock.childPrivateToPrivate(m, 0x80000000 + 44); - var k2 = Ed448Goldilock.childPrivateToPrivate(k1, 0x80000000 + 654); - var k3 = Ed448Goldilock.childPrivateToPrivate(k2, 0x80000000 + 0); - var k4 = Ed448Goldilock.childPrivateToPrivate(k3, 0x80000000 + 0); - var k5 = Ed448Goldilock.childPrivateToPrivate(k4, index); - return k5.substr(114, 228); - } + static HDWalletGenerateKeyFromSeed(seed: string, index: number): string { + var m = Ed448Goldilock.seedToExtendedPrivate(seed); + var k1 = Ed448Goldilock.childPrivateToPrivate(m, 0x80000000 + 44); + var k2 = Ed448Goldilock.childPrivateToPrivate(k1, 0x80000000 + 654); + var k3 = Ed448Goldilock.childPrivateToPrivate(k2, 0x80000000 + 0); + var k4 = Ed448Goldilock.childPrivateToPrivate(k3, 0x80000000 + 0); + var k5 = Ed448Goldilock.childPrivateToPrivate(k4, index); + return k5.substr(114, 228); + } } diff --git a/src.ts/crypto/ed448goldilock.ts b/src.ts/crypto/ed448goldilock.ts index 1a000c3de..230e5666e 100644 --- a/src.ts/crypto/ed448goldilock.ts +++ b/src.ts/crypto/ed448goldilock.ts @@ -1,151 +1,156 @@ +import { Buffer } from "buffer"; // @ts-ignore -import ed448 from "bcrypto/lib/ed448.js"; +import ed448 from "./ed448.js"; // @ts-ignore import pbkdf2 from "bcrypto/lib/pbkdf2.js"; // @ts-ignore import SHA3_512 from "bcrypto/lib/sha3-512.js"; export class Ed448Goldilock { - static _channel = ed448; + static _channel = ed448; - static generatePrivateKey() { - var privateKey = ed448.privateKeyGenerate(); - privateKey[56] &= 0x7f; - return privateKey; - } + static generatePrivateKey() { + var privateKey = ed448.privateKeyGenerate(); + privateKey[56] &= 0x7f; + return privateKey; + } - static getPublicKeyFromPrivateKey(privateKey: string): string { - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var scalar = secret.slice(0, 56); - scalar[0] &= 0xfc; - scalar[55] |= 0x80; - var publicKey = this._channel.publicKeyFromScalar(scalar); - return Buffer.from(publicKey).toString("hex"); - } else { - var publicKey = this._channel.publicKeyCreate(secret); - return Buffer.from(publicKey).toString("hex"); - } - } + static getPublicKeyFromPrivateKey(privateKey: string): string { + var secret = Buffer.from(privateKey, "hex"); + if (secret[56] > 127) { + var scalar = secret.slice(0, 56); + scalar[0] &= 0xfc; + scalar[55] |= 0x80; + var publicKey = this._channel.publicKeyFromScalar(scalar); + return Buffer.from(publicKey).toString("hex"); + } else { + var publicKey = this._channel.publicKeyCreate(secret); + return Buffer.from(publicKey).toString("hex"); + } + } - static signWithPrivateKey(privateKey: string, msg: string): string { - var msgToSign = Buffer.from(msg, "hex"); - var secret = Buffer.from(privateKey, "hex"); - if (secret[56] > 127) { - var prefix = secret.slice(0, 57); - prefix[0] &= 0xfc; - prefix[56] = 0; - prefix[55] |= 0x80; - var scalar = prefix.slice(0, 56); - var signedMessage = this._channel.signWithScalar( - msgToSign, - scalar, - prefix, - ); - return Buffer.from(signedMessage).toString("hex"); - } else { - var signedMessage = this._channel.sign(msgToSign, secret); - return Buffer.from(signedMessage).toString("hex"); - } - } + static signWithPrivateKey(privateKey: string, msg: string): string { + var msgToSign = Buffer.from(msg, "hex"); + var secret = Buffer.from(privateKey, "hex"); + if (secret[56] > 127) { + var prefix = secret.slice(0, 57); + prefix[0] &= 0xfc; + prefix[56] = 0; + prefix[55] |= 0x80; + var scalar = prefix.slice(0, 56); + var signedMessage = this._channel.signWithScalar( + msgToSign, + scalar, + prefix, + ); + return Buffer.from(signedMessage).toString("hex"); + } else { + var signedMessage = this._channel.sign(msgToSign, secret); + return Buffer.from(signedMessage).toString("hex"); + } + } - static signWithPrivateKeyNConcatPubkey( - privateKey: string, - msg: string, - ): string { - var signedMessage = Ed448Goldilock.signWithPrivateKey(privateKey, msg); - var publicKey = Ed448Goldilock.getPublicKeyFromPrivateKey(privateKey); - return signedMessage + publicKey; - } + static signWithPrivateKeyNConcatPubkey( + privateKey: string, + msg: string, + ): string { + var signedMessage = Ed448Goldilock.signWithPrivateKey(privateKey, msg); + var publicKey = Ed448Goldilock.getPublicKeyFromPrivateKey(privateKey); + return signedMessage + publicKey; + } - static verifySignature( - msgHash: string, - signedMsg: string, - pubKey: string, - ): boolean { - return this._channel.verify(msgHash, signedMsg, pubKey); - } + static verifySignature( + msgHash: string, + signedMsg: string, + pubKey: string, + ): boolean { + return this._channel.verify( + Buffer.from(msgHash, "hex"), + Buffer.from(signedMsg, "hex"), + Buffer.from(pubKey, "hex"), + ); + } - static SHA512Hash(password: string, salt: string): string { - var p1 = Buffer.from(password, "hex"); - var s1 = Buffer.from(salt, "hex"); - return Buffer.from(pbkdf2.derive(SHA3_512, p1, s1, 2048, 57)).toString( - "hex", - ); - } + static SHA512Hash(password: string, salt: string): string { + var p1 = Buffer.from(password, "hex"); + var s1 = Buffer.from(salt, "hex"); + return Buffer.from(pbkdf2.derive(SHA3_512, p1, s1, 2048, 57)).toString( + "hex", + ); + } - static concatenateAndHex( - prefix: number, - key: string, - index: number, - salt: string, - ): string { - var ind = Buffer.alloc(4); - var p = Buffer.alloc(1); - p[0] = prefix % 256; - var j = index; - for (let i = 0; i < 4; i++) { - ind[i] = j % 256; - j = Math.floor(j / 256); - } - var t = p.toString("hex") + key + ind.toString("hex"); - return Ed448Goldilock.SHA512Hash(t, salt); - } + static concatenateAndHex( + prefix: number, + key: string, + index: number, + salt: string, + ): string { + var ind = Buffer.alloc(4); + var p = Buffer.alloc(1); + p[0] = prefix % 256; + var j = index; + for (let i = 0; i < 4; i++) { + ind[i] = j % 256; + j = Math.floor(j / 256); + } + var t = p.toString("hex") + key + ind.toString("hex"); + return Ed448Goldilock.SHA512Hash(t, salt); + } - static addScalar(a: string, b: string): string { - var a1 = Buffer.from(a, "hex"); - var b1 = Buffer.from(b.substr(0, 106) + "00000000", "hex"); - b1[0] &= 0xfc; - var c = Buffer.alloc(57); - var hold = 0; - for (let i = 0; i < 57; i++) { - hold += a1[i] + b1[i]; - c[i] = hold % 256; - hold = Math.floor(hold / 256); - } - return c.toString("hex"); - } + static addScalar(a: string, b: string): string { + var a1 = Buffer.from(a, "hex"); + var b1 = Buffer.from(b.substr(0, 106) + "00000000", "hex"); + b1[0] &= 0xfc; + var c = Buffer.alloc(57); + var hold = 0; + for (let i = 0; i < 57; i++) { + hold += a1[i] + b1[i]; + c[i] = hold % 256; + hold = Math.floor(hold / 256); + } + return c.toString("hex"); + } - static seedToExtendedPrivate(seed: string): string { - var s1 = Ed448Goldilock.SHA512Hash( - seed, - "6d6e656d6f6e6963666f72746865636861696e", - ); - var s2 = Ed448Goldilock.SHA512Hash( - seed, - "6d6e656d6f6e6963666f727468656b6579", - ); - var b = Buffer.from(s2, "hex"); - b[56] |= 0x80; - b[55] |= 0x80; - b[55] &= 0xbf; - var s3 = b.toString("hex"); - return s1 + s3; - } + static seedToExtendedPrivate(seed: string): string { + var s1 = Ed448Goldilock.SHA512Hash( + seed, + "6d6e656d6f6e6963666f72746865636861696e", + ); + var s2 = Ed448Goldilock.SHA512Hash( + seed, + "6d6e656d6f6e6963666f727468656b6579", + ); + var b = Buffer.from(s2, "hex"); + b[56] |= 0x80; + b[55] |= 0x80; + b[55] &= 0xbf; + var s3 = b.toString("hex"); + return s1 + s3; + } - static childPrivateToPrivate(s: string, index: number) { - var s0 = s.substr(0, 114); - var s1 = s.substr(114, 228); - var r0, r1; - if (index >= 0x80000000) { - r0 = Ed448Goldilock.concatenateAndHex(1, s1, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(0, s1, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } else { - var pub = Ed448Goldilock.getPublicKeyFromPrivateKey(s1); - r0 = Ed448Goldilock.concatenateAndHex(3, pub, index, s0); - r1 = Ed448Goldilock.concatenateAndHex(2, pub, index, s0); - return r0 + Ed448Goldilock.addScalar(s1, r1); - } - } + static childPrivateToPrivate(s: string, index: number) { + var s0 = s.substr(0, 114); + var s1 = s.substr(114, 228); + var r0, r1; + if (index >= 0x80000000) { + r0 = Ed448Goldilock.concatenateAndHex(1, s1, index, s0); + r1 = Ed448Goldilock.concatenateAndHex(0, s1, index, s0); + return r0 + Ed448Goldilock.addScalar(s1, r1); + } else { + var pub = Ed448Goldilock.getPublicKeyFromPrivateKey(s1); + r0 = Ed448Goldilock.concatenateAndHex(3, pub, index, s0); + r1 = Ed448Goldilock.concatenateAndHex(2, pub, index, s0); + return r0 + Ed448Goldilock.addScalar(s1, r1); + } + } - static HDWalletGenerateKeyFromSeed(seed: string, index: number): string { - var m = Ed448Goldilock.seedToExtendedPrivate(seed); - var k1 = Ed448Goldilock.childPrivateToPrivate(m, 0x80000000 + 44); - var k2 = Ed448Goldilock.childPrivateToPrivate(k1, 0x80000000 + 654); - var k3 = Ed448Goldilock.childPrivateToPrivate(k2, 0x80000000 + 0); - var k4 = Ed448Goldilock.childPrivateToPrivate(k3, 0x80000000 + 0); - var k5 = Ed448Goldilock.childPrivateToPrivate(k4, index); - return k5.substr(114, 228); - } + static HDWalletGenerateKeyFromSeed(seed: string, index: number): string { + var m = Ed448Goldilock.seedToExtendedPrivate(seed); + var k1 = Ed448Goldilock.childPrivateToPrivate(m, 0x80000000 + 44); + var k2 = Ed448Goldilock.childPrivateToPrivate(k1, 0x80000000 + 654); + var k3 = Ed448Goldilock.childPrivateToPrivate(k2, 0x80000000 + 0); + var k4 = Ed448Goldilock.childPrivateToPrivate(k3, 0x80000000 + 0); + var k5 = Ed448Goldilock.childPrivateToPrivate(k4, index); + return k5.substr(114, 228); + } } diff --git a/src.ts/crypto/hmac.ts b/src.ts/crypto/hmac.ts index 0ed639c93..bcb59b05b 100644 --- a/src.ts/crypto/hmac.ts +++ b/src.ts/crypto/hmac.ts @@ -14,11 +14,11 @@ import type { BytesLike } from "../utils/index.js"; let locked = false; const _computeHmac = function ( - algorithm: "sha256" | "sha512", - key: Uint8Array, - data: Uint8Array, + algorithm: "sha256" | "sha512", + key: Uint8Array, + data: Uint8Array, ): BytesLike { - return createHmac(algorithm, key).update(data).digest(); + return createHmac(algorithm, key).update(data).digest(); }; let __computeHmac = _computeHmac; @@ -41,28 +41,28 @@ let __computeHmac = _computeHmac; * */ export function computeHmac( - algorithm: "sha256" | "sha512", - _key: BytesLike, - _data: BytesLike, + algorithm: "sha256" | "sha512", + _key: BytesLike, + _data: BytesLike, ): string { - const key = getBytes(_key, "key"); - const data = getBytes(_data, "data"); - return hexlify(__computeHmac(algorithm, key, data)); + const key = getBytes(_key, "key"); + const data = getBytes(_data, "data"); + return hexlify(__computeHmac(algorithm, key, data)); } computeHmac._ = _computeHmac; computeHmac.lock = function () { - locked = true; + locked = true; }; computeHmac.register = function ( - func: ( - algorithm: "sha256" | "sha512", - key: Uint8Array, - data: Uint8Array, - ) => BytesLike, + func: ( + algorithm: "sha256" | "sha512", + key: Uint8Array, + data: Uint8Array, + ) => BytesLike, ) { - if (locked) { - throw new Error("computeHmac is locked"); - } - __computeHmac = func; + if (locked) { + throw new Error("computeHmac is locked"); + } + __computeHmac = func; }; Object.freeze(computeHmac); diff --git a/src.ts/crypto/index.ts b/src.ts/crypto/index.ts index 33bb23c04..b4d9840ce 100644 --- a/src.ts/crypto/index.ts +++ b/src.ts/crypto/index.ts @@ -18,31 +18,31 @@ import { Ed448Goldilock } from "./crypto.js"; import { keccak256 } from "./keccak.js"; export { - computeHmac, - randomBytes, - ripemd160, - sha256, - sha512, - pbkdf2, - scrypt, - scryptSync, - keccak256, - Ed448Goldilock, + computeHmac, + randomBytes, + ripemd160, + sha256, + sha512, + pbkdf2, + scrypt, + scryptSync, + keccak256, + Ed448Goldilock, }; export { SigningKey } from "./signing-key.js"; export { Signature } from "./signature.js"; function lock(): void { - computeHmac.lock(); - pbkdf2.lock(); - randomBytes.lock(); - ripemd160.lock(); - scrypt.lock(); - scryptSync.lock(); - sha256.lock(); - sha512.lock(); - randomBytes.lock(); + computeHmac.lock(); + pbkdf2.lock(); + randomBytes.lock(); + ripemd160.lock(); + scrypt.lock(); + scryptSync.lock(); + sha256.lock(); + sha512.lock(); + randomBytes.lock(); } export { lock }; diff --git a/src.ts/crypto/keccak.ts b/src.ts/crypto/keccak.ts index 4564cddb9..bf6430e3d 100644 --- a/src.ts/crypto/keccak.ts +++ b/src.ts/crypto/keccak.ts @@ -4,7 +4,7 @@ * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] */ -import { keccak_256 } from "@noble/hashes/sha3"; +import { keccak_256 } from "@noble/hashes/sha3.js"; import { getBytes, hexlify } from "../utils/index.js"; @@ -13,7 +13,7 @@ import type { BytesLike } from "../utils/index.js"; let locked = false; const _keccak256 = function (data: Uint8Array): Uint8Array { - return keccak_256(data); + return keccak_256(data); }; let __keccak256: (data: Uint8Array) => BytesLike = _keccak256; @@ -41,17 +41,17 @@ let __keccak256: (data: Uint8Array) => BytesLike = _keccak256; * //_error: */ export function keccak256(_data: BytesLike): string { - const data = getBytes(_data, "data"); - return hexlify(__keccak256(data)); + const data = getBytes(_data, "data"); + return hexlify(__keccak256(data)); } keccak256._ = _keccak256; keccak256.lock = function (): void { - locked = true; + locked = true; }; keccak256.register = function (func: (data: Uint8Array) => BytesLike) { - if (locked) { - throw new TypeError("keccak256 is locked"); - } - __keccak256 = func; + if (locked) { + throw new TypeError("keccak256 is locked"); + } + __keccak256 = func; }; Object.freeze(keccak256); diff --git a/src.ts/crypto/pbkdf2.ts b/src.ts/crypto/pbkdf2.ts index f967ee9a5..48ebbb7df 100644 --- a/src.ts/crypto/pbkdf2.ts +++ b/src.ts/crypto/pbkdf2.ts @@ -15,13 +15,13 @@ import type { BytesLike } from "../utils/index.js"; let locked = false; const _pbkdf2 = function ( - password: Uint8Array, - salt: Uint8Array, - iterations: number, - keylen: number, - algo: "sha256" | "sha512", + password: Uint8Array, + salt: Uint8Array, + iterations: number, + keylen: number, + algo: "sha256" | "sha512", ): BytesLike { - return pbkdf2Sync(password, salt, iterations, keylen, algo); + return pbkdf2Sync(password, salt, iterations, keylen, algo); }; let __pbkdf2 = _pbkdf2; @@ -47,32 +47,32 @@ let __pbkdf2 = _pbkdf2; * //_result: */ export function pbkdf2( - _password: BytesLike, - _salt: BytesLike, - iterations: number, - keylen: number, - algo: "sha256" | "sha512", + _password: BytesLike, + _salt: BytesLike, + iterations: number, + keylen: number, + algo: "sha256" | "sha512", ): string { - const password = getBytes(_password, "password"); - const salt = getBytes(_salt, "salt"); - return hexlify(__pbkdf2(password, salt, iterations, keylen, algo)); + const password = getBytes(_password, "password"); + const salt = getBytes(_salt, "salt"); + return hexlify(__pbkdf2(password, salt, iterations, keylen, algo)); } pbkdf2._ = _pbkdf2; pbkdf2.lock = function (): void { - locked = true; + locked = true; }; pbkdf2.register = function ( - func: ( - password: Uint8Array, - salt: Uint8Array, - iterations: number, - keylen: number, - algo: "sha256" | "sha512", - ) => BytesLike, + func: ( + password: Uint8Array, + salt: Uint8Array, + iterations: number, + keylen: number, + algo: "sha256" | "sha512", + ) => BytesLike, ) { - if (locked) { - throw new Error("pbkdf2 is locked"); - } - __pbkdf2 = func; + if (locked) { + throw new Error("pbkdf2 is locked"); + } + __pbkdf2 = func; }; Object.freeze(pbkdf2); diff --git a/src.ts/crypto/random.ts b/src.ts/crypto/random.ts index 5eeae96bf..dcb4e3003 100644 --- a/src.ts/crypto/random.ts +++ b/src.ts/crypto/random.ts @@ -11,7 +11,7 @@ import { randomBytes as crypto_random } from "./crypto.js"; let locked = false; const _randomBytes = function (length: number): Uint8Array { - return new Uint8Array(crypto_random(length)); + return new Uint8Array(crypto_random(length)); }; let __randomBytes = _randomBytes; @@ -24,17 +24,17 @@ let __randomBytes = _randomBytes; * //_result: */ export function randomBytes(length: number): Uint8Array { - return __randomBytes(length); + return __randomBytes(length); } randomBytes._ = _randomBytes; randomBytes.lock = function (): void { - locked = true; + locked = true; }; randomBytes.register = function (func: (length: number) => Uint8Array) { - if (locked) { - throw new Error("randomBytes is locked"); - } - __randomBytes = func; + if (locked) { + throw new Error("randomBytes is locked"); + } + __randomBytes = func; }; Object.freeze(randomBytes); diff --git a/src.ts/crypto/ripemd160.ts b/src.ts/crypto/ripemd160.ts index 00481c215..510717a5b 100644 --- a/src.ts/crypto/ripemd160.ts +++ b/src.ts/crypto/ripemd160.ts @@ -1,4 +1,4 @@ -import { ripemd160 as noble_ripemd160 } from "@noble/hashes/ripemd160"; +import { ripemd160 as noble_ripemd160 } from "@noble/hashes/legacy.js"; import { getBytes, hexlify } from "../utils/index.js"; @@ -7,7 +7,7 @@ import type { BytesLike } from "../utils/index.js"; let locked = false; const _ripemd160 = function (data: Uint8Array): Uint8Array { - return noble_ripemd160(data); + return noble_ripemd160(data); }; let __ripemd160: (data: Uint8Array) => BytesLike = _ripemd160; @@ -30,17 +30,17 @@ let __ripemd160: (data: Uint8Array) => BytesLike = _ripemd160; * */ export function ripemd160(_data: BytesLike): string { - const data = getBytes(_data, "data"); - return hexlify(__ripemd160(data)); + const data = getBytes(_data, "data"); + return hexlify(__ripemd160(data)); } ripemd160._ = _ripemd160; ripemd160.lock = function (): void { - locked = true; + locked = true; }; ripemd160.register = function (func: (data: Uint8Array) => BytesLike) { - if (locked) { - throw new TypeError("ripemd160 is locked"); - } - __ripemd160 = func; + if (locked) { + throw new TypeError("ripemd160 is locked"); + } + __ripemd160 = func; }; Object.freeze(ripemd160); diff --git a/src.ts/crypto/rlp.ts b/src.ts/crypto/rlp.ts index e1db2e03f..69b56d8bb 100644 --- a/src.ts/crypto/rlp.ts +++ b/src.ts/crypto/rlp.ts @@ -6,185 +6,185 @@ import { arrayify, BytesLike, hexlify, isBytesLike } from "../utils/data.js"; const logger = new Logger("rlp/0.0.1"); function arrayifyInteger(value: number): Array { - const result = []; - while (value) { - // @ts-ignore - result.unshift(value & 0xff); - value >>= 8; - } - return result; + const result = []; + while (value) { + // @ts-ignore + result.unshift(value & 0xff); + value >>= 8; + } + return result; } function unarrayifyInteger( - data: Uint8Array, - offset: number, - length: number, + data: Uint8Array, + offset: number, + length: number, ): number { - let result = 0; - for (let i = 0; i < length; i++) { - result = result * 256 + data[offset + i]; - } - return result; + let result = 0; + for (let i = 0; i < length; i++) { + result = result * 256 + data[offset + i]; + } + return result; } function _encode(object: Array | string): Array { - if (Array.isArray(object)) { - let payload: Array = []; - object.forEach(function (child) { - payload = payload.concat(_encode(child)); - }); + if (Array.isArray(object)) { + let payload: Array = []; + object.forEach(function (child) { + payload = payload.concat(_encode(child)); + }); - if (payload.length <= 55) { - payload.unshift(0xc0 + payload.length); - return payload; - } + if (payload.length <= 55) { + payload.unshift(0xc0 + payload.length); + return payload; + } - const length = arrayifyInteger(payload.length); - length.unshift(0xf7 + length.length); + const length = arrayifyInteger(payload.length); + length.unshift(0xf7 + length.length); - return length.concat(payload); - } + return length.concat(payload); + } - if (!isBytesLike(object)) { - logger.throwArgumentError("RLP object must be BytesLike", "object", object); - } + if (!isBytesLike(object)) { + logger.throwArgumentError("RLP object must be BytesLike", "object", object); + } - const data: Array = Array.prototype.slice.call(arrayify(object)); + const data: Array = Array.prototype.slice.call(arrayify(object)); - if (data.length === 1 && data[0] <= 0x7f) { - return data; - } else if (data.length <= 55) { - data.unshift(0x80 + data.length); - return data; - } + if (data.length === 1 && data[0] <= 0x7f) { + return data; + } else if (data.length <= 55) { + data.unshift(0x80 + data.length); + return data; + } - const length = arrayifyInteger(data.length); - length.unshift(0xb7 + length.length); + const length = arrayifyInteger(data.length); + length.unshift(0xb7 + length.length); - return length.concat(data); + return length.concat(data); } export function encode(object: any): string { - return hexlify(_encode(object)); + return hexlify(_encode(object)); } type Decoded = { - result: any; - consumed: number; + result: any; + consumed: number; }; function _decodeChildren( - data: Uint8Array, - offset: number, - childOffset: number, - length: number, + data: Uint8Array, + offset: number, + childOffset: number, + length: number, ): Decoded { - const result: any[] = []; + const result: any[] = []; - while (childOffset < offset + 1 + length) { - const decoded = _decode(data, childOffset); + while (childOffset < offset + 1 + length) { + const decoded = _decode(data, childOffset); - result.push(decoded.result); + result.push(decoded.result); - childOffset += decoded.consumed; - if (childOffset > offset + 1 + length) { - logger.throwError( - "child data too short", - Logger.errors.BUFFER_OVERRUN, - {}, - ); - } - } + childOffset += decoded.consumed; + if (childOffset > offset + 1 + length) { + logger.throwError( + "child data too short", + Logger.errors.BUFFER_OVERRUN, + {}, + ); + } + } - return { consumed: 1 + length, result: result }; + return { consumed: 1 + length, result: result }; } // returns { consumed: number, result: Object } function _decode( - data: Uint8Array, - offset: number, + data: Uint8Array, + offset: number, ): { consumed: number; result: any } { - if (data.length === 0) { - logger.throwError("data too short", Logger.errors.BUFFER_OVERRUN, {}); - } - - // Array with extra length prefix - if (data[offset] >= 0xf8) { - const lengthLength = data[offset] - 0xf7; - if (offset + 1 + lengthLength > data.length) { - logger.throwError( - "data short segment too short", - Logger.errors.BUFFER_OVERRUN, - {}, - ); - } - - const length = unarrayifyInteger(data, offset + 1, lengthLength); - if (offset + 1 + lengthLength + length > data.length) { - logger.throwError( - "data long segment too short", - Logger.errors.BUFFER_OVERRUN, - {}, - ); - } - - return _decodeChildren( - data, - offset, - offset + 1 + lengthLength, - lengthLength + length, - ); - } else if (data[offset] >= 0xc0) { - const length = data[offset] - 0xc0; - if (offset + 1 + length > data.length) { - logger.throwError( - "data array too short", - Logger.errors.BUFFER_OVERRUN, - {}, - ); - } - - return _decodeChildren(data, offset, offset + 1, length); - } else if (data[offset] >= 0xb8) { - const lengthLength = data[offset] - 0xb7; - if (offset + 1 + lengthLength > data.length) { - logger.throwError( - "data array too short", - Logger.errors.BUFFER_OVERRUN, - {}, - ); - } - - const length = unarrayifyInteger(data, offset + 1, lengthLength); - if (offset + 1 + lengthLength + length > data.length) { - logger.throwError( - "data array too short", - Logger.errors.BUFFER_OVERRUN, - {}, - ); - } - - const result = hexlify( - data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length), - ); - return { consumed: 1 + lengthLength + length, result: result }; - } else if (data[offset] >= 0x80) { - const length = data[offset] - 0x80; - if (offset + 1 + length > data.length) { - logger.throwError("data too short", Logger.errors.BUFFER_OVERRUN, {}); - } - - const result = hexlify(data.slice(offset + 1, offset + 1 + length)); - return { consumed: 1 + length, result: result }; - } - return { consumed: 1, result: hexlify(data[offset]) }; + if (data.length === 0) { + logger.throwError("data too short", Logger.errors.BUFFER_OVERRUN, {}); + } + + // Array with extra length prefix + if (data[offset] >= 0xf8) { + const lengthLength = data[offset] - 0xf7; + if (offset + 1 + lengthLength > data.length) { + logger.throwError( + "data short segment too short", + Logger.errors.BUFFER_OVERRUN, + {}, + ); + } + + const length = unarrayifyInteger(data, offset + 1, lengthLength); + if (offset + 1 + lengthLength + length > data.length) { + logger.throwError( + "data long segment too short", + Logger.errors.BUFFER_OVERRUN, + {}, + ); + } + + return _decodeChildren( + data, + offset, + offset + 1 + lengthLength, + lengthLength + length, + ); + } else if (data[offset] >= 0xc0) { + const length = data[offset] - 0xc0; + if (offset + 1 + length > data.length) { + logger.throwError( + "data array too short", + Logger.errors.BUFFER_OVERRUN, + {}, + ); + } + + return _decodeChildren(data, offset, offset + 1, length); + } else if (data[offset] >= 0xb8) { + const lengthLength = data[offset] - 0xb7; + if (offset + 1 + lengthLength > data.length) { + logger.throwError( + "data array too short", + Logger.errors.BUFFER_OVERRUN, + {}, + ); + } + + const length = unarrayifyInteger(data, offset + 1, lengthLength); + if (offset + 1 + lengthLength + length > data.length) { + logger.throwError( + "data array too short", + Logger.errors.BUFFER_OVERRUN, + {}, + ); + } + + const result = hexlify( + data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length), + ); + return { consumed: 1 + lengthLength + length, result: result }; + } else if (data[offset] >= 0x80) { + const length = data[offset] - 0x80; + if (offset + 1 + length > data.length) { + logger.throwError("data too short", Logger.errors.BUFFER_OVERRUN, {}); + } + + const result = hexlify(data.slice(offset + 1, offset + 1 + length)); + return { consumed: 1 + length, result: result }; + } + return { consumed: 1, result: hexlify(data[offset]) }; } export function decode(data: BytesLike): any { - const bytes = arrayify(data); - const decoded = _decode(bytes, 0); - if (decoded.consumed !== bytes.length) { - logger.throwArgumentError("invalid rlp data", "data", data); - } - return decoded.result; + const bytes = arrayify(data); + const decoded = _decode(bytes, 0); + if (decoded.consumed !== bytes.length) { + logger.throwArgumentError("invalid rlp data", "data", data); + } + return decoded.result; } diff --git a/src.ts/crypto/scrypt.ts b/src.ts/crypto/scrypt.ts index 5b37fddeb..e6c85dd88 100644 --- a/src.ts/crypto/scrypt.ts +++ b/src.ts/crypto/scrypt.ts @@ -1,7 +1,7 @@ import { - scrypt as _nobleSync, - scryptAsync as _nobleAsync, -} from "@noble/hashes/scrypt"; + scrypt as _nobleSync, + scryptAsync as _nobleAsync, +} from "@noble/hashes/scrypt.js"; import { getBytes, hexlify as H } from "../utils/index.js"; @@ -18,46 +18,46 @@ import type { BytesLike } from "../utils/index.js"; export type ProgressCallback = (percent: number) => void; let lockedSync = false, - lockedAsync = false; + lockedAsync = false; const _scryptAsync = async function ( - passwd: Uint8Array, - salt: Uint8Array, - N: number, - r: number, - p: number, - dkLen: number, - onProgress?: ProgressCallback, + passwd: Uint8Array, + salt: Uint8Array, + N: number, + r: number, + p: number, + dkLen: number, + onProgress?: ProgressCallback, ) { - return await _nobleAsync(passwd, salt, { N, r, p, dkLen, onProgress }); + return await _nobleAsync(passwd, salt, { N, r, p, dkLen, onProgress }); }; const _scryptSync = function ( - passwd: Uint8Array, - salt: Uint8Array, - N: number, - r: number, - p: number, - dkLen: number, + passwd: Uint8Array, + salt: Uint8Array, + N: number, + r: number, + p: number, + dkLen: number, ) { - return _nobleSync(passwd, salt, { N, r, p, dkLen }); + return _nobleSync(passwd, salt, { N, r, p, dkLen }); }; let __scryptAsync: ( - passwd: Uint8Array, - salt: Uint8Array, - N: number, - r: number, - p: number, - dkLen: number, - onProgress?: ProgressCallback, + passwd: Uint8Array, + salt: Uint8Array, + N: number, + r: number, + p: number, + dkLen: number, + onProgress?: ProgressCallback, ) => Promise = _scryptAsync; let __scryptSync: ( - passwd: Uint8Array, - salt: Uint8Array, - N: number, - r: number, - p: number, - dkLen: number, + passwd: Uint8Array, + salt: Uint8Array, + N: number, + r: number, + p: number, + dkLen: number, ) => BytesLike = _scryptSync; /** @@ -98,37 +98,37 @@ let __scryptSync: ( * //_result: */ export async function scrypt( - _passwd: BytesLike, - _salt: BytesLike, - N: number, - r: number, - p: number, - dkLen: number, - progress?: ProgressCallback, + _passwd: BytesLike, + _salt: BytesLike, + N: number, + r: number, + p: number, + dkLen: number, + progress?: ProgressCallback, ): Promise { - const passwd = getBytes(_passwd, "passwd"); - const salt = getBytes(_salt, "salt"); - return H(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress)); + const passwd = getBytes(_passwd, "passwd"); + const salt = getBytes(_salt, "salt"); + return H(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress)); } scrypt._ = _scryptAsync; scrypt.lock = function (): void { - lockedAsync = true; + lockedAsync = true; }; scrypt.register = function ( - func: ( - passwd: Uint8Array, - salt: Uint8Array, - N: number, - r: number, - p: number, - dkLen: number, - progress?: ProgressCallback, - ) => Promise, + func: ( + passwd: Uint8Array, + salt: Uint8Array, + N: number, + r: number, + p: number, + dkLen: number, + progress?: ProgressCallback, + ) => Promise, ) { - if (lockedAsync) { - throw new Error("scrypt is locked"); - } - __scryptAsync = func; + if (lockedAsync) { + throw new Error("scrypt is locked"); + } + __scryptAsync = func; }; Object.freeze(scrypt); @@ -155,34 +155,34 @@ Object.freeze(scrypt); * //_result: */ export function scryptSync( - _passwd: BytesLike, - _salt: BytesLike, - N: number, - r: number, - p: number, - dkLen: number, + _passwd: BytesLike, + _salt: BytesLike, + N: number, + r: number, + p: number, + dkLen: number, ): string { - const passwd = getBytes(_passwd, "passwd"); - const salt = getBytes(_salt, "salt"); - return H(__scryptSync(passwd, salt, N, r, p, dkLen)); + const passwd = getBytes(_passwd, "passwd"); + const salt = getBytes(_salt, "salt"); + return H(__scryptSync(passwd, salt, N, r, p, dkLen)); } scryptSync._ = _scryptSync; scryptSync.lock = function (): void { - lockedSync = true; + lockedSync = true; }; scryptSync.register = function ( - func: ( - passwd: Uint8Array, - salt: Uint8Array, - N: number, - r: number, - p: number, - dkLen: number, - ) => BytesLike, + func: ( + passwd: Uint8Array, + salt: Uint8Array, + N: number, + r: number, + p: number, + dkLen: number, + ) => BytesLike, ) { - if (lockedSync) { - throw new Error("scryptSync is locked"); - } - __scryptSync = func; + if (lockedSync) { + throw new Error("scryptSync is locked"); + } + __scryptSync = func; }; Object.freeze(scryptSync); diff --git a/src.ts/crypto/sha3.ts b/src.ts/crypto/sha3.ts index 3b812cb62..369dcdf3c 100644 --- a/src.ts/crypto/sha3.ts +++ b/src.ts/crypto/sha3.ts @@ -5,34 +5,18 @@ import { Buffer } from "buffer"; const logger = new Logger("sha3/0.0.1"); -const _sha256 = function (data: Uint8Array): string { - let v = - "0x" + - createHash("sha3-256") - .update(Buffer.from(arrayify(data))) - .digest("hex"); - return v; -}; - -const _sha512 = function (data: Uint8Array): string { - let v = - "0x" + - createHash("sha3-512") - .update(Buffer.from(arrayify(data))) - .digest("hex"); - return v; -}; - -// @ts-ignore +const _sha256 = (data: Uint8Array): string => + hexlify(createHash("sha3-256").update(data).digest()); +const _sha512 = (data: Uint8Array): string => + hexlify(createHash("sha3-512").update(data).digest()); let __sha256: (data: Uint8Array) => BytesLike = _sha256; -// @ts-ignore let __sha512: (data: Uint8Array) => BytesLike = _sha512; let locked256 = false, - locked512 = false; + locked512 = false; /** - * Compute the cryptographic SHA2-256 hash of %%data%%. + * Compute the cryptographic SHA3-256 hash of %%data%%. * * @_docloc: api/crypto:Hash Functions * @returns DataHexstring @@ -49,80 +33,62 @@ let locked256 = false, * */ export enum SupportedAlgorithm { - sha256 = "sha256", - sha512 = "sha512", + sha256 = "sha256", + sha512 = "sha512", } export function ripemd160(data: BytesLike): string { - let createdHash = - "0x" + - createHash("ripemd160") - .update(Buffer.from(arrayify(data))) - .digest("hex"); - const v = "0x" + createdHash; - if (typeof createdHash !== "string") { - createdHash = hexlify(createdHash); - return createdHash; - } - return v; + return hexlify(createHash("ripemd160").update(getBytes(data)).digest()); } export function sha256(data: BytesLike): string { - let createdHash = createHash("sha3-256") - .update(Buffer.from(arrayify(data))) - .digest("hex"); - const v = "0x" + createdHash; - if (typeof createdHash !== "string") { - createdHash = hexlify(createdHash); - return createdHash; - } - return v; + return hexlify(__sha256(getBytes(data))); } export function legacySha256(data: BytesLike): string { - const _data = getBytes(data, "data"); - const hexlified = hexlify(createHash("sha256").update(_data).digest()); - return hexlified; + const _data = getBytes(data, "data"); + const hexlified = hexlify(createHash("sha256").update(_data).digest()); + return hexlified; } export function computeHmac( - algorithm: SupportedAlgorithm, - key: BytesLike, - data: BytesLike, + algorithm: SupportedAlgorithm, + key: BytesLike, + data: BytesLike, ): string { - const d = Buffer.from(arrayify(data)); - const k = Buffer.from(arrayify(key)); - if (algorithm === SupportedAlgorithm.sha256) { - return "0x" + createHmac("sha3-256", k).update(d).digest("hex"); - } else if (algorithm === SupportedAlgorithm.sha512) { - return "0x" + createHmac("sha3-512", k).update(d).digest("hex"); - } + const d = Buffer.from(arrayify(data)); + const k = Buffer.from(arrayify(key)); + if (algorithm === SupportedAlgorithm.sha256) { + return hexlify(createHmac("sha3-256", k).update(d).digest()); + } else if (algorithm === SupportedAlgorithm.sha512) { + return hexlify(createHmac("sha3-512", k).update(d).digest()); + } - logger.throwError( - "unsupported algorithm - " + algorithm, - Logger.errors.UNSUPPORTED_OPERATION, - { - operation: "computeHmac", - algorithm: algorithm, - }, - ); - return ""; + logger.throwError( + "unsupported algorithm - " + algorithm, + Logger.errors.UNSUPPORTED_OPERATION, + { + operation: "computeHmac", + algorithm: algorithm, + }, + ); + return ""; } sha256._ = _sha256; sha256.lock = function (): void { - locked256 = true; + locked256 = true; }; sha256.register = function (func: (data: Uint8Array) => BytesLike): void { - if (locked256) { - throw new Error("sha256 is locked"); - } - __sha256 = func; + if (locked256) { + throw new Error("sha256 is locked"); + } + __sha256 = func; }; Object.freeze(sha256); /** - * Compute the cryptographic SHA2-512 hash of %%data%%. + * Compute the cryptographic SHA3-512 hash of %%data%%. * * @_docloc: api/crypto:Hash Functions * @returns DataHexstring @@ -139,24 +105,16 @@ Object.freeze(sha256); */ export function sha512(data: BytesLike): string { - let createdHash = createHash("sha3-512") - .update(Buffer.from(arrayify(data))) - .digest("hex"); - const v = "0x" + createdHash; - if (typeof createdHash !== "string") { - createdHash = hexlify(createdHash); - return createdHash; - } - return v; + return hexlify(__sha512(getBytes(data))); } sha512._ = _sha512; sha512.lock = function (): void { - locked512 = true; + locked512 = true; }; sha512.register = function (func: (data: Uint8Array) => BytesLike): void { - if (locked512) { - throw new Error("sha512 is locked"); - } - __sha512 = func; + if (locked512) { + throw new Error("sha512 is locked"); + } + __sha512 = func; }; -Object.freeze(sha256); +Object.freeze(sha512); diff --git a/src.ts/crypto/signature.ts b/src.ts/crypto/signature.ts index ce52dea42..dc178d68f 100644 --- a/src.ts/crypto/signature.ts +++ b/src.ts/crypto/signature.ts @@ -1,12 +1,12 @@ import { - concat, - dataLength, - getBigInt, - getBytes, - getNumber, - hexlify, - assertArgument, - assertPrivate, + concat, + dataLength, + getBigInt, + getBytes, + getNumber, + hexlify, + assertArgument, + assertPrivate, } from "../utils/index.js"; import type { BigNumberish, BytesLike } from "../utils/index.js"; @@ -37,243 +37,243 @@ export type SignatureLike = string; * @_docloc: api/crypto:Signing */ export class Signature { - #r: string; - #s: string; - #v: 27 | 28; - #networkV: null | bigint; + #r: string; + #s: string; + #v: 27 | 28; + #networkV: null | bigint; - /** - * The ``r`` value for a signautre. - * - * This represents the ``x`` coordinate of a "reference" or - * challenge point, from which the ``y`` can be computed. - */ - get r(): string { - return this.#r; - } - set r(value: BytesLike) { - assertArgument(dataLength(value) === 32, "invalid r", "value", value); - this.#r = hexlify(value); - } + /** + * The ``r`` value for a signautre. + * + * This represents the ``x`` coordinate of a "reference" or + * challenge point, from which the ``y`` can be computed. + */ + get r(): string { + return this.#r; + } + set r(value: BytesLike) { + assertArgument(dataLength(value) === 32, "invalid r", "value", value); + this.#r = hexlify(value); + } - /** - * The ``s`` value for a signature. - */ - get s(): string { - return this.#s; - } - set s(_value: BytesLike) { - assertArgument(dataLength(_value) === 32, "invalid s", "value", _value); - const value = hexlify(_value); - assertArgument( - parseInt(value.substring(0, 3)) < 8, - "non-canonical s", - "value", - value, - ); - this.#s = value; - } + /** + * The ``s`` value for a signature. + */ + get s(): string { + return this.#s; + } + set s(_value: BytesLike) { + assertArgument(dataLength(_value) === 32, "invalid s", "value", _value); + const value = hexlify(_value); + assertArgument( + parseInt(value.substring(0, 3)) < 8, + "non-canonical s", + "value", + value, + ); + this.#s = value; + } - /** - * The ``v`` value for a signature. - * - * Since a given ``x`` value for ``r`` has two possible values for - * its correspondin ``y``, the ``v`` indicates which of the two ``y`` - * values to use. - * - * It is normalized to the values ``27`` or ``28`` for legacy - * purposes. - */ - get v(): 27 | 28 { - return this.#v; - } - set v(value: BigNumberish) { - const v = getNumber(value, "value"); - assertArgument(v === 27 || v === 28, "invalid v", "v", value); - this.#v = v; - } + /** + * The ``v`` value for a signature. + * + * Since a given ``x`` value for ``r`` has two possible values for + * its correspondin ``y``, the ``v`` indicates which of the two ``y`` + * values to use. + * + * It is normalized to the values ``27`` or ``28`` for legacy + * purposes. + */ + get v(): 27 | 28 { + return this.#v; + } + set v(value: BigNumberish) { + const v = getNumber(value, "value"); + assertArgument(v === 27 || v === 28, "invalid v", "v", value); + this.#v = v; + } - /** - * The EIP-155 ``v`` for legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get networkV(): null | bigint { - return this.#networkV; - } + /** + * The EIP-155 ``v`` for legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get networkV(): null | bigint { + return this.#networkV; + } - /** - * The chain ID for EIP-155 legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get legacynetworkId(): null | bigint { - const v = this.networkV; - if (v == null) { - return null; - } - return Signature.getnetworkId(v); - } + /** + * The chain ID for EIP-155 legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get legacynetworkId(): null | bigint { + const v = this.networkV; + if (v == null) { + return null; + } + return Signature.getnetworkId(v); + } - /** - * The ``yParity`` for the signature. - * - * See ``v`` for more details on how this value is used. - */ - get yParity(): 0 | 1 { - return this.v === 27 ? 0 : 1; - } + /** + * The ``yParity`` for the signature. + * + * See ``v`` for more details on how this value is used. + */ + get yParity(): 0 | 1 { + return this.v === 27 ? 0 : 1; + } - /** - * The [[link-eip-2098]] compact representation of the ``yParity`` - * and ``s`` compacted into a single ``bytes32``. - */ - get yParityAndS(): string { - // The EIP-2098 compact representation - const yParityAndS = getBytes(this.s); - if (this.yParity) { - yParityAndS[0] |= 0x80; - } - return hexlify(yParityAndS); - } + /** + * The [[link-eip-2098]] compact representation of the ``yParity`` + * and ``s`` compacted into a single ``bytes32``. + */ + get yParityAndS(): string { + // The EIP-2098 compact representation + const yParityAndS = getBytes(this.s); + if (this.yParity) { + yParityAndS[0] |= 0x80; + } + return hexlify(yParityAndS); + } - /** - * The [[link-eip-2098]] compact representation. - */ - get compactSerialized(): string { - return concat([this.r, this.yParityAndS]) as string; - } + /** + * The [[link-eip-2098]] compact representation. + */ + get compactSerialized(): string { + return concat([this.r, this.yParityAndS]) as string; + } - /** - * The serialized representation. - */ - get serialized(): string { - return concat([this.r, this.s, this.yParity ? "0x1c" : "0x1b"]) as string; - } + /** + * The serialized representation. + */ + get serialized(): string { + return concat([this.r, this.s, this.yParity ? "0x1c" : "0x1b"]) as string; + } - /** - * @private - */ - constructor(guard: any, r: string, s: string, v: 27 | 28) { - assertPrivate(guard, _guard, "Signature"); - this.#r = r; - this.#s = s; - this.#v = v; - this.#networkV = null; - } + /** + * @private + */ + constructor(guard: any, r: string, s: string, v: 27 | 28) { + assertPrivate(guard, _guard, "Signature"); + this.#r = r; + this.#s = s; + this.#v = v; + this.#networkV = null; + } - [Symbol.for("nodejs.util.inspect.custom")](): string { - return `Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`; - } + [Symbol.for("nodejs.util.inspect.custom")](): string { + return `Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`; + } - /** - * Returns a new identical [[Signature]]. - */ - clone(): Signature { - const clone = new Signature(_guard, this.r, this.s, this.v); - if (this.networkV) { - clone.#networkV = this.networkV; - } - return clone; - } + /** + * Returns a new identical [[Signature]]. + */ + clone(): Signature { + const clone = new Signature(_guard, this.r, this.s, this.v); + if (this.networkV) { + clone.#networkV = this.networkV; + } + return clone; + } - /** - * Returns a representation that is compatible with ``JSON.stringify``. - */ - toJSON(): any { - const networkV = this.networkV; - return { - _type: "signature", - networkV: networkV != null ? networkV.toString() : null, - r: this.r, - s: this.s, - v: this.v, - }; - } + /** + * Returns a representation that is compatible with ``JSON.stringify``. + */ + toJSON(): any { + const networkV = this.networkV; + return { + _type: "signature", + networkV: networkV != null ? networkV.toString() : null, + r: this.r, + s: this.s, + v: this.v, + }; + } - /** - * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. - * - * @example: - * Signature.getnetworkId(45) - * //_result: - * - * Signature.getnetworkId(46) - * //_result: - */ - static getnetworkId(v: BigNumberish): bigint { - const bv = getBigInt(v, "v"); + /** + * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. + * + * @example: + * Signature.getnetworkId(45) + * //_result: + * + * Signature.getnetworkId(46) + * //_result: + */ + static getnetworkId(v: BigNumberish): bigint { + const bv = getBigInt(v, "v"); - // The v is not an EIP-155 v, so it is the unspecified chain ID - if (bv == BN_27 || bv == BN_28) { - return BN_0; - } + // The v is not an EIP-155 v, so it is the unspecified chain ID + if (bv == BN_27 || bv == BN_28) { + return BN_0; + } - // Bad value for an EIP-155 v - assertArgument(bv >= BN_35, "invalid EIP-155 v", "v", v); + // Bad value for an EIP-155 v + assertArgument(bv >= BN_35, "invalid EIP-155 v", "v", v); - return (bv - BN_35) / BN_2; - } + return (bv - BN_35) / BN_2; + } - /** - * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. - * - * Legacy transactions which use [[link-eip-155]] hijack the ``v`` - * property to include the chain ID. - * - * @example: - * Signature.getnetworkIdV(5, 27) - * //_result: - * - * Signature.getnetworkIdV(5, 28) - * //_result: - * - */ - static getnetworkIdV(networkId: BigNumberish, v: 27 | 28): bigint { - return getBigInt(networkId) * BN_2 + BigInt(35 + v - 27); - } + /** + * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. + * + * Legacy transactions which use [[link-eip-155]] hijack the ``v`` + * property to include the chain ID. + * + * @example: + * Signature.getnetworkIdV(5, 27) + * //_result: + * + * Signature.getnetworkIdV(5, 28) + * //_result: + * + */ + static getnetworkIdV(networkId: BigNumberish, v: 27 | 28): bigint { + return getBigInt(networkId) * BN_2 + BigInt(35 + v - 27); + } - /** - * Compute the normalized legacy transaction ``v`` from a ``yParirty``, - * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. - * - * @example: - * // The values 0 and 1 imply v is actually yParity - * Signature.getNormalizedV(0) - * //_result: - * - * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) - * Signature.getNormalizedV(27) - * //_result: - * - * // Legacy EIP-155 transaction (i.e. >= 35) - * Signature.getNormalizedV(46) - * //_result: - * - * // Invalid values throw - * Signature.getNormalizedV(5) - * //_error: - */ - static getNormalizedV(v: BigNumberish): 27 | 28 { - const bv = getBigInt(v); + /** + * Compute the normalized legacy transaction ``v`` from a ``yParirty``, + * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. + * + * @example: + * // The values 0 and 1 imply v is actually yParity + * Signature.getNormalizedV(0) + * //_result: + * + * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) + * Signature.getNormalizedV(27) + * //_result: + * + * // Legacy EIP-155 transaction (i.e. >= 35) + * Signature.getNormalizedV(46) + * //_result: + * + * // Invalid values throw + * Signature.getNormalizedV(5) + * //_error: + */ + static getNormalizedV(v: BigNumberish): 27 | 28 { + const bv = getBigInt(v); - if (bv === BN_0 || bv === BN_27) { - return 27; - } - if (bv === BN_1 || bv === BN_28) { - return 28; - } + if (bv === BN_0 || bv === BN_27) { + return 27; + } + if (bv === BN_1 || bv === BN_28) { + return 28; + } - assertArgument(bv >= BN_35, "invalid v", "v", v); + assertArgument(bv >= BN_35, "invalid v", "v", v); - // Otherwise, EIP-155 v means odd is 27 and even is 28 - return bv & BN_1 ? 27 : 28; - } + // Otherwise, EIP-155 v means odd is 27 and even is 28 + return bv & BN_1 ? 27 : 28; + } - /** - * Creates a new [[Signature]]. - * - * If no %%sig%% is provided, a new [[Signature]] is created - * with default values. - * - * If %%sig%% is a string, it is parsed. - */ + /** + * Creates a new [[Signature]]. + * + * If no %%sig%% is provided, a new [[Signature]] is created + * with default values. + * + * If %%sig%% is a string, it is parsed. + */ } diff --git a/src.ts/crypto/signing-key.ts b/src.ts/crypto/signing-key.ts index e86aa0d33..8e3bbf355 100644 --- a/src.ts/crypto/signing-key.ts +++ b/src.ts/crypto/signing-key.ts @@ -4,14 +4,11 @@ * @_subsection: api/crypto:Signing [about-signing] */ -import * as secp256k1 from "@noble/secp256k1"; - import { - dataLength, - getBytes, - getBytesCopy, - hexlify, - assertArgument, + dataLength, + getBytesCopy, + hexlify, + assertArgument, } from "../utils/index.js"; import type { BytesLike } from "../utils/index.js"; @@ -24,231 +21,174 @@ import { Buffer } from "buffer"; const logger = new Logger("signing-key/0.0.1"); -//const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); - -// Make noble-secp256k1 sync - /** * A **SigningKey** provides high-level access to the elliptic curve * cryptography (ECC) operations and key management. */ export class SigningKey { - #privateKey: string; - - /** - * Creates a new **SigningKey** for %%privateKey%%. - */ - constructor(privateKey: BytesLike) { - let tmp = privateKey; - if (typeof tmp === "string" && tmp.startsWith("0x")) { - tmp = tmp.replace("0x", ""); - } - assertArgument( - dataLength("0x" + tmp) === 57, - "invalid private key", - "privateKey", - "[REDACTED]", - ); - this.#privateKey = hexlify("0x" + tmp); - } - - /** - * The private key. - */ - get privateKey(): string { - return this.#privateKey; - } - - /** - * The uncompressed public key. - * - * This will always begin with the prefix ``0x04`` and be 132 - * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). - */ - get publicKey(): string { - return SigningKey.computePublicKey(this.#privateKey); - } - - /** - * The compressed public key. - * - * This will always begin with either the prefix ``0x02`` or ``0x03`` - * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal - * nibbles) - */ - get compressedPublicKey(): string { - return SigningKey.computePublicKey(this.#privateKey, true); - } - - /** - * Return the signature of the signed %%digest%%. - */ - sign(digest: BytesLike): string { - const key = getBytesCopy(this.#privateKey); - assertArgument( - dataLength(digest) === 32, - "invalid digest length", - "digest", - digest, - ); - const keyBuffer = new Uint8Array(arrayify(key)); - if (keyBuffer.length !== 57) { - logger.throwArgumentError("invalid private key", "key", "[REDACTED]"); - } - const digestBuffer = new Uint8Array(arrayify(digest)); - if (digestBuffer.length !== 32) { - logger.throwArgumentError("bad digest length", "digest", digest); - } - - if (keyBuffer[56] > 127) { - const prefix = keyBuffer.slice(0, 57); - prefix[0] &= 0xfc; - prefix[55] |= 0x80; - prefix[56] = 0; - const scalar = prefix.slice(0, 56); - const bufferDigest = Buffer.from(digestBuffer); - const bufferPrfx = Buffer.from(prefix); - const bufferScalar = Buffer.from(scalar); - const sig = ed448.signWithScalar(bufferDigest, bufferScalar, bufferPrfx); - const hexlified = hexlify(sig); - return hexConcat([hexlified, this.publicKey]); - } - const sig = ed448.sign(Buffer.from(digestBuffer), Buffer.from(keyBuffer)); - const hexlified = hexlify(sig); - return hexConcat([hexlified, this.publicKey]); - } - - /** - * Returns the [[link-wiki-ecdh]] shared secret between this - * private key and the %%other%% key. - * - * The %%other%% key may be any type of key, a raw public key, - * a compressed/uncompressed pubic key or aprivate key. - * - * Best practice is usually to use a cryptographic hash on the - * returned value before using it as a symetric secret. - * - * @example: - * sign1 = new SigningKey(id("some-secret-1")) - * sign2 = new SigningKey(id("some-secret-2")) - * - * // Notice that privA.computeSharedSecret(pubB)... - * sign1.computeSharedSecret(sign2.publicKey) - * //_result: - * - * // ...is equal to privB.computeSharedSecret(pubA). - * sign2.computeSharedSecret(sign1.publicKey) - * //_result: - */ - computeSharedSecret(other: BytesLike): string { - const pubKey = SigningKey.computePublicKey(other); - return hexlify( - secp256k1.getSharedSecret( - getBytesCopy(this.#privateKey), - getBytes(pubKey), - ), - ); - } - - /** - * Compute the public key for %%key%%, optionally %%compressed%%. - * - * The %%key%% may be any type of key, a raw public key, a - * compressed/uncompressed public key or private key. - * - * @example: - * sign = new SigningKey(id("some-secret")); - * - * // Compute the uncompressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey) - * //_result: - * - * // Compute the compressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey, true) - * //_result: - * - * // Compute the uncompressed public key - * SigningKey.computePublicKey(sign.publicKey, false); - * //_result: - * - * // Compute the Compressed a public key - * SigningKey.computePublicKey(sign.publicKey, true); - * //_result: - */ - static computePublicKey(key: BytesLike, compressed?: boolean): string { - const bytes = Buffer.from(arrayify(key)); - if (bytes.length !== 57) { - logger.throwArgumentError("invalid private key", "key", "[REDACTED]"); - } - - if (bytes[56] > 127) { - const scalar = bytes.slice(0, 56); - scalar[0] &= 0xfc; - scalar[55] |= 0x80; - const pub = ed448.publicKeyFromScalar(scalar); - return hexlify(pub); - } - - const pub = ed448.publicKeyCreate(bytes); - return hexlify(pub); - } - - /** - * Returns the public key for the private key which produced the - * %%signature%% for the given %%digest%%. - * - * @example: - * key = new SigningKey(id("some-secret")) - * digest = id("hello world") - * sig = key.sign(digest) - * - * // Notice the signer public key... - * key.publicKey - * //_result: - * - * // ...is equal to the recovered public key - * SigningKey.recoverPublicKey(digest, sig) - * //_result: - * - */ - static recoverPublicKey(digest: BytesLike, signature: SignatureLike): string { - assertArgument( - dataLength(digest) === 32, - "invalid digest length", - "digest", - digest, - ); - const digestBuffer = Buffer.from(arrayify(digest)); - const sigBuffer = Buffer.from(arrayify(signature)); - if (sigBuffer.length !== 171) { - logger.throwArgumentError("invalid signature", "signature", signature); - } - const sig = sigBuffer.slice(0, 114); - const pub = sigBuffer.slice(114); - if (ed448.verify(digestBuffer, sig, pub)) { - return hexlify(pub); - } - logger.throwArgumentError("invalid signature", "signature", signature); - return ""; - } - - /** - * Returns the point resulting from adding the ellipic curve points - * %%p0%% and %%p1%%. - * - * This is not a common function most developers should require, but - * can be useful for certain privacy-specific techniques. - * - * For example, it is used by [[HDNodeWallet]] to compute child - * addresses from parent public keys and chain codes. - */ - static addPoints(p0: BytesLike, p1: BytesLike, compressed?: boolean): string { - const pub0 = secp256k1.ProjectivePoint.fromHex( - SigningKey.computePublicKey(p0).substring(2), - ); - const pub1 = secp256k1.ProjectivePoint.fromHex( - SigningKey.computePublicKey(p1).substring(2), - ); - return "0x" + pub0.add(pub1).toHex(!!compressed); - } + #privateKey: string; + + /** + * Creates a new **SigningKey** for %%privateKey%%. + */ + constructor(privateKey: BytesLike) { + const normalized = + typeof privateKey === "string" && !privateKey.startsWith("0x") + ? "0x" + privateKey + : privateKey; + assertArgument( + dataLength(normalized) === 57, + "invalid private key", + "privateKey", + "[REDACTED]", + ); + this.#privateKey = hexlify(normalized); + } + + /** + * The private key. + */ + get privateKey(): string { + return this.#privateKey; + } + + /** The 57-byte Ed448 public key encoded as hex. */ + get publicKey(): string { + return SigningKey.computePublicKey(this.#privateKey); + } + + /** Compatibility alias: Ed448 has one 57-byte public-key encoding. */ + get compressedPublicKey(): string { + return SigningKey.computePublicKey(this.#privateKey, true); + } + + /** + * Return the signature of the signed %%digest%%. + */ + sign(digest: BytesLike): string { + const key = getBytesCopy(this.#privateKey); + assertArgument( + dataLength(digest) === 32, + "invalid digest length", + "digest", + digest, + ); + const keyBuffer = new Uint8Array(arrayify(key)); + if (keyBuffer.length !== 57) { + logger.throwArgumentError("invalid private key", "key", "[REDACTED]"); + } + const digestBuffer = new Uint8Array(arrayify(digest)); + if (digestBuffer.length !== 32) { + logger.throwArgumentError("bad digest length", "digest", digest); + } + + if (keyBuffer[56] > 127) { + const prefix = keyBuffer.slice(0, 57); + prefix[0] &= 0xfc; + prefix[55] |= 0x80; + prefix[56] = 0; + const scalar = prefix.slice(0, 56); + const bufferDigest = Buffer.from(digestBuffer); + const bufferPrfx = Buffer.from(prefix); + const bufferScalar = Buffer.from(scalar); + const sig = ed448.signWithScalar(bufferDigest, bufferScalar, bufferPrfx); + const hexlified = hexlify(sig); + return hexConcat([hexlified, this.publicKey]); + } + const sig = ed448.sign(Buffer.from(digestBuffer), Buffer.from(keyBuffer)); + const hexlified = hexlify(sig); + return hexConcat([hexlified, this.publicKey]); + } + + /** Derives an Ed448 shared secret from a 57-byte public key. Hash it before use as a symmetric key. */ + computeSharedSecret(other: BytesLike): string { + const pub = Buffer.from(getBytesCopy(other)); + assertArgument( + pub.length === 57 && ed448.publicKeyVerify(pub), + "invalid public key", + "other", + other, + ); + const key = Buffer.from(getBytesCopy(this.#privateKey)); + if (key[56] > 127) { + const scalar = key.subarray(0, 56); + scalar[0] &= 0xfc; + scalar[55] |= 0x80; + return hexlify(ed448.deriveWithScalar(pub, scalar)); + } + return hexlify(ed448.derive(pub, key)); + } + + /** Computes an Ed448 public key from a 57-byte private key. The compression flag is ignored. */ + static computePublicKey(key: BytesLike, compressed?: boolean): string { + const bytes = Buffer.from(arrayify(key)); + if (bytes.length !== 57) { + logger.throwArgumentError("invalid private key", "key", "[REDACTED]"); + } + + if (bytes[56] > 127) { + const scalar = bytes.slice(0, 56); + scalar[0] &= 0xfc; + scalar[55] |= 0x80; + const pub = ed448.publicKeyFromScalar(scalar); + return hexlify(pub); + } + + const pub = ed448.publicKeyCreate(bytes); + return hexlify(pub); + } + + /** + * Returns the public key for the private key which produced the + * %%signature%% for the given %%digest%%. + * + * @example: + * key = new SigningKey(id("some-secret")) + * digest = id("hello world") + * sig = key.sign(digest) + * + * // Notice the signer public key... + * key.publicKey + * //_result: + * + * // ...is equal to the recovered public key + * SigningKey.recoverPublicKey(digest, sig) + * //_result: + * + */ + static recoverPublicKey(digest: BytesLike, signature: SignatureLike): string { + assertArgument( + dataLength(digest) === 32, + "invalid digest length", + "digest", + digest, + ); + const digestBuffer = Buffer.from(arrayify(digest)); + const sigBuffer = Buffer.from(arrayify(signature)); + if (sigBuffer.length !== 171) { + logger.throwArgumentError("invalid signature", "signature", signature); + } + const sig = sigBuffer.slice(0, 114); + const pub = sigBuffer.slice(114); + if (ed448.verify(digestBuffer, sig, pub)) { + return hexlify(pub); + } + logger.throwArgumentError("invalid signature", "signature", signature); + return ""; + } + + /** Adds two encoded Ed448 public points. The compression flag is ignored. */ + static addPoints(p0: BytesLike, p1: BytesLike, compressed?: boolean): string { + const points = [p0, p1].map((point) => { + const bytes = Buffer.from(getBytesCopy(point)); + assertArgument( + bytes.length === 57 && ed448.publicKeyVerify(bytes), + "invalid public key", + "point", + point, + ); + return bytes; + }); + return hexlify(ed448.publicKeyCombine(points)); + } } diff --git a/src.ts/hash/id.ts b/src.ts/hash/id.ts index c8552b93f..5398c18fa 100644 --- a/src.ts/hash/id.ts +++ b/src.ts/hash/id.ts @@ -12,8 +12,8 @@ import { toUtf8Bytes } from "../utils/index.js"; * //_result: */ export function id(value: string, useKeccak?: boolean): string { - if (useKeccak) { - return keccak256(toUtf8Bytes(value)); - } - return sha256(toUtf8Bytes(value)); + if (useKeccak) { + return keccak256(toUtf8Bytes(value)); + } + return sha256(toUtf8Bytes(value)); } diff --git a/src.ts/hash/message.ts b/src.ts/hash/message.ts index abd6830fb..b13d22eb1 100644 --- a/src.ts/hash/message.ts +++ b/src.ts/hash/message.ts @@ -30,16 +30,16 @@ import { sha256, SignatureLike } from "../crypto/index.js"; * */ export function hashMessage(message: Uint8Array | string): string { - if (typeof message === "string") { - message = toUtf8Bytes(message); - } - return sha256( - concat([ - toUtf8Bytes(MessagePrefix), - toUtf8Bytes(String(message.length)), - message, - ]), - ); + if (typeof message === "string") { + message = toUtf8Bytes(message); + } + return sha256( + concat([ + toUtf8Bytes(MessagePrefix), + toUtf8Bytes(String(message.length)), + message, + ]), + ); } /** @@ -47,10 +47,10 @@ export function hashMessage(message: Uint8Array | string): string { * the signature %%sig%% during signing for %%message%%. */ export function verifyMessage( - message: Uint8Array | string, - sig: SignatureLike, - prefix: string, + message: Uint8Array | string, + sig: SignatureLike, + prefix: string, ): string { - const digest = hashMessage(message); - return recoverAddress(digest, sig, prefix); + const digest = hashMessage(message); + return recoverAddress(digest, sig, prefix); } diff --git a/src.ts/hash/solidity.ts b/src.ts/hash/solidity.ts index d897b8fbe..63c954298 100644 --- a/src.ts/hash/solidity.ts +++ b/src.ts/hash/solidity.ts @@ -1,16 +1,16 @@ import { getAddress } from "../address/index.js"; import { sha256 as _sha256 } from "../crypto/index.js"; import { - concat, - dataLength, - getBytes, - hexlify, - toBeArray, - toTwos, - toUtf8Bytes, - zeroPadBytes, - zeroPadValue, - assertArgument, + concat, + dataLength, + getBytes, + hexlify, + toBeArray, + toTwos, + toUtf8Bytes, + zeroPadBytes, + zeroPadValue, + assertArgument, } from "../utils/index.js"; const regexBytes = new RegExp("^bytes([0-9]+)$"); @@ -18,92 +18,92 @@ const regexNumber = new RegExp("^(u?int)([0-9]*)$"); const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); function _pack(type: string, value: any, isArray?: boolean): Uint8Array { - switch (type) { - case "address": - if (isArray) { - return getBytes(zeroPadValue(value, 32)); - } - return getBytes(getAddress(value)); - case "string": - return toUtf8Bytes(value); - case "bytes": - return getBytes(value); - case "bool": - value = !!value ? "0x01" : "0x00"; - if (isArray) { - return getBytes(zeroPadValue(value, 32)); - } - return getBytes(value); - } - - let match = type.match(regexNumber); - if (match) { - let signed = match[1] === "int"; - let size = parseInt(match[2] || "256"); - - assertArgument( - (!match[2] || match[2] === String(size)) && - size % 8 === 0 && - size !== 0 && - size <= 256, - "invalid number type", - "type", - type, - ); - - if (isArray) { - size = 256; - } - - if (signed) { - value = toTwos(value, size); - } - - return getBytes(zeroPadValue(toBeArray(value), size / 8)); - } - - match = type.match(regexBytes); - if (match) { - const size = parseInt(match[1]); - - assertArgument( - String(size) === match[1] && size !== 0 && size <= 32, - "invalid bytes type", - "type", - type, - ); - assertArgument( - dataLength(value) === size, - `invalid value for ${type}`, - "value", - value, - ); - - if (isArray) { - return getBytes(zeroPadBytes(value, 32)); - } - return value; - } - - match = type.match(regexArray); - if (match && Array.isArray(value)) { - const baseType = match[1]; - const count = parseInt(match[2] || String(value.length)); - assertArgument( - count === value.length, - `invalid array length for ${type}`, - "value", - value, - ); - - const result: Array = []; - value.forEach(function (value) { - result.push(_pack(baseType, value, true)); - }); - return getBytes(concat(result)); - } - - assertArgument(false, "invalid type", "type", type); + switch (type) { + case "address": + if (isArray) { + return getBytes(zeroPadValue(value, 32)); + } + return getBytes(getAddress(value)); + case "string": + return toUtf8Bytes(value); + case "bytes": + return getBytes(value); + case "bool": + value = !!value ? "0x01" : "0x00"; + if (isArray) { + return getBytes(zeroPadValue(value, 32)); + } + return getBytes(value); + } + + let match = type.match(regexNumber); + if (match) { + let signed = match[1] === "int"; + let size = parseInt(match[2] || "256"); + + assertArgument( + (!match[2] || match[2] === String(size)) && + size % 8 === 0 && + size !== 0 && + size <= 256, + "invalid number type", + "type", + type, + ); + + if (isArray) { + size = 256; + } + + if (signed) { + value = toTwos(value, size); + } + + return getBytes(zeroPadValue(toBeArray(value), size / 8)); + } + + match = type.match(regexBytes); + if (match) { + const size = parseInt(match[1]); + + assertArgument( + String(size) === match[1] && size !== 0 && size <= 32, + "invalid bytes type", + "type", + type, + ); + assertArgument( + dataLength(value) === size, + `invalid value for ${type}`, + "value", + value, + ); + + if (isArray) { + return getBytes(zeroPadBytes(value, 32)); + } + return value; + } + + match = type.match(regexArray); + if (match && Array.isArray(value)) { + const baseType = match[1]; + const count = parseInt(match[2] || String(value.length)); + assertArgument( + count === value.length, + `invalid array length for ${type}`, + "value", + value, + ); + + const result: Array = []; + value.forEach(function (value) { + result.push(_pack(baseType, value, true)); + }); + return getBytes(concat(result)); + } + + assertArgument(false, "invalid type", "type", type); } // @TODO: Array Enum @@ -118,21 +118,21 @@ function _pack(type: string, value: any, isArray?: boolean): Uint8Array { * //_result: */ export function solidityPacked( - types: ReadonlyArray, - values: ReadonlyArray, + types: ReadonlyArray, + values: ReadonlyArray, ): string { - assertArgument( - types.length === values.length, - "wrong number of values; expected ${ types.length }", - "values", - values, - ); - - const tight: Array = []; - types.forEach(function (type, index) { - tight.push(_pack(type, values[index])); - }); - return hexlify(concat(tight)); + assertArgument( + types.length === values.length, + "wrong number of values; expected ${ types.length }", + "values", + values, + ); + + const tight: Array = []; + types.forEach(function (type, index) { + tight.push(_pack(type, values[index])); + }); + return hexlify(concat(tight)); } /** @@ -145,8 +145,8 @@ export function solidityPacked( * //_result: */ export function solidityPackedSha256( - types: ReadonlyArray, - values: ReadonlyArray, + types: ReadonlyArray, + values: ReadonlyArray, ): string { - return _sha256(solidityPacked(types, values)); + return _sha256(solidityPacked(types, values)); } diff --git a/src.ts/hash/typed-data.ts b/src.ts/hash/typed-data.ts index 5a82b7083..967b98713 100644 --- a/src.ts/hash/typed-data.ts +++ b/src.ts/hash/typed-data.ts @@ -1,18 +1,18 @@ import { getAddress } from "../address/index.js"; import { recoverAddress } from "../transaction/index.js"; import { - concat, - defineProperties, - getBigInt, - getBytes, - hexlify, - isHexString, - mask, - toBeHex, - toQuantity, - toTwos, - zeroPadValue, - assertArgument, + concat, + defineProperties, + getBigInt, + getBytes, + hexlify, + isHexString, + mask, + toBeHex, + toQuantity, + toTwos, + zeroPadValue, + assertArgument, } from "../utils/index.js"; import { id } from "./id.js"; @@ -27,667 +27,667 @@ const BN__1 = BigInt(-1); const BN_0 = BigInt(0); const BN_1 = BigInt(1); const BN_MAX_UINT256 = BigInt( - "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", ); export interface TypedDataDomain { - name?: null | string; - version?: null | string; - networkId?: null | BigNumberish; - verifyingContract?: null | string; - salt?: null | BytesLike; + name?: null | string; + version?: null | string; + networkId?: null | BigNumberish; + verifyingContract?: null | string; + salt?: null | BytesLike; } export interface TypedDataField { - name: string; - type: string; + name: string; + type: string; } function hexPadRight(value: BytesLike): string { - const bytes = getBytes(value); - const padOffset = bytes.length % 32; - if (padOffset) { - return concat([bytes, padding.slice(padOffset)]) as string; - } - return hexlify(bytes); + const bytes = getBytes(value); + const padOffset = bytes.length % 32; + if (padOffset) { + return concat([bytes, padding.slice(padOffset)]) as string; + } + return hexlify(bytes); } const hexTrue = toBeHex(BN_1, 32); const hexFalse = toBeHex(BN_0, 32); const domainFieldTypes: Record = { - name: "string", - version: "string", - networkId: "uint256", - verifyingContract: "address", - salt: "bytes32", + name: "string", + version: "string", + networkId: "uint256", + verifyingContract: "address", + salt: "bytes32", }; const domainFieldNames: Array = [ - "name", - "version", - "networkId", - "verifyingContract", - "salt", + "name", + "version", + "networkId", + "verifyingContract", + "salt", ]; function checkString(key: string): (value: any) => string { - return function (value: any) { - assertArgument( - typeof value === "string", - `invalid domain value for ${JSON.stringify(key)}`, - `domain.${key}`, - value, - ); - return value; - }; + return function (value: any) { + assertArgument( + typeof value === "string", + `invalid domain value for ${JSON.stringify(key)}`, + `domain.${key}`, + value, + ); + return value; + }; } const domainChecks: Record any> = { - name: checkString("name"), - version: checkString("version"), - networkId: function (_value: any) { - const value = getBigInt(_value, "domain.networkId"); - assertArgument(value >= 0, "invalid chain ID", "domain.networkId", _value); - if (Number.isSafeInteger(value)) { - return Number(value); - } - return toQuantity(value); - }, - verifyingContract: function (value: any) { - try { - return getAddress(value).toLowerCase(); - } catch (error) {} - assertArgument( - false, - `invalid domain value "verifyingContract"`, - "domain.verifyingContract", - value, - ); - }, - salt: function (value: any) { - const bytes = getBytes(value, "domain.salt"); - assertArgument( - bytes.length === 32, - `invalid domain value "salt"`, - "domain.salt", - value, - ); - return hexlify(bytes); - }, + name: checkString("name"), + version: checkString("version"), + networkId: function (_value: any) { + const value = getBigInt(_value, "domain.networkId"); + assertArgument(value >= 0, "invalid chain ID", "domain.networkId", _value); + if (Number.isSafeInteger(value)) { + return Number(value); + } + return toQuantity(value); + }, + verifyingContract: function (value: any) { + try { + return getAddress(value).toLowerCase(); + } catch (error) {} + assertArgument( + false, + `invalid domain value "verifyingContract"`, + "domain.verifyingContract", + value, + ); + }, + salt: function (value: any) { + const bytes = getBytes(value, "domain.salt"); + assertArgument( + bytes.length === 32, + `invalid domain value "salt"`, + "domain.salt", + value, + ); + return hexlify(bytes); + }, }; function getBaseEncoder(type: string): null | ((value: any) => string) { - // intXX and uintXX - { - const match = type.match(/^(u?)int(\d*)$/); - if (match) { - const signed = match[1] === ""; - - const width = parseInt(match[2] || "256"); - assertArgument( - width % 8 === 0 && - width !== 0 && - width <= 256 && - (match[2] == null || match[2] === String(width)), - "invalid numeric width", - "type", - type, - ); - - const boundsUpper = mask(BN_MAX_UINT256, signed ? width - 1 : width); - const boundsLower = signed ? (boundsUpper + BN_1) * BN__1 : BN_0; - - return function (_value: BigNumberish) { - const value = getBigInt(_value, "value"); - - assertArgument( - value >= boundsLower && value <= boundsUpper, - `value out-of-bounds for ${type}`, - "value", - value, - ); - - return toBeHex(signed ? toTwos(value, 256) : value, 32); - }; - } - } - - // bytesXX - { - const match = type.match(/^bytes(\d+)$/); - if (match) { - const width = parseInt(match[1]); - assertArgument( - width !== 0 && width <= 32 && match[1] === String(width), - "invalid bytes width", - "type", - type, - ); - - return function (value: BytesLike) { - const bytes = getBytes(value); - assertArgument( - bytes.length === width, - `invalid length for ${type}`, - "value", - value, - ); - return hexPadRight(value); - }; - } - } - - switch (type) { - case "address": - return function (value: string) { - return zeroPadValue(getAddress(value), 32); - }; - case "bool": - return function (value: boolean) { - return !value ? hexFalse : hexTrue; - }; - case "bytes": - return function (value: BytesLike) { - return sha256(value); - }; - case "string": - return function (value: string) { - return id(value); - }; - } - - return null; + // intXX and uintXX + { + const match = type.match(/^(u?)int(\d*)$/); + if (match) { + const signed = match[1] === ""; + + const width = parseInt(match[2] || "256"); + assertArgument( + width % 8 === 0 && + width !== 0 && + width <= 256 && + (match[2] == null || match[2] === String(width)), + "invalid numeric width", + "type", + type, + ); + + const boundsUpper = mask(BN_MAX_UINT256, signed ? width - 1 : width); + const boundsLower = signed ? (boundsUpper + BN_1) * BN__1 : BN_0; + + return function (_value: BigNumberish) { + const value = getBigInt(_value, "value"); + + assertArgument( + value >= boundsLower && value <= boundsUpper, + `value out-of-bounds for ${type}`, + "value", + value, + ); + + return toBeHex(signed ? toTwos(value, 256) : value, 32); + }; + } + } + + // bytesXX + { + const match = type.match(/^bytes(\d+)$/); + if (match) { + const width = parseInt(match[1]); + assertArgument( + width !== 0 && width <= 32 && match[1] === String(width), + "invalid bytes width", + "type", + type, + ); + + return function (value: BytesLike) { + const bytes = getBytes(value); + assertArgument( + bytes.length === width, + `invalid length for ${type}`, + "value", + value, + ); + return hexPadRight(value); + }; + } + } + + switch (type) { + case "address": + return function (value: string) { + return zeroPadValue(getAddress(value), 32); + }; + case "bool": + return function (value: boolean) { + return !value ? hexFalse : hexTrue; + }; + case "bytes": + return function (value: BytesLike) { + return sha256(value); + }; + case "string": + return function (value: string) { + return id(value); + }; + } + + return null; } function encodeType(name: string, fields: Array): string { - return `${name}(${fields - .map(({ name, type }) => type + " " + name) - .join(",")})`; + return `${name}(${fields + .map(({ name, type }) => type + " " + name) + .join(",")})`; } export class TypedDataEncoder { - readonly primaryType!: string; - - readonly #types: string; - get types(): Record> { - return JSON.parse(this.#types); - } - - readonly #fullTypes: Map; - - readonly #encoderCache: Map string>; - - constructor(types: Record>) { - this.#types = JSON.stringify(types); - this.#fullTypes = new Map(); - this.#encoderCache = new Map(); - - // Link struct types to their direct child structs - const links: Map> = new Map(); - - // Link structs to structs which contain them as a child - const parents: Map> = new Map(); - - // Link all subtypes within a given struct - const subtypes: Map> = new Map(); - - Object.keys(types).forEach((type) => { - links.set(type, new Set()); - parents.set(type, []); - subtypes.set(type, new Set()); - }); - - for (const name in types) { - const uniqueNames: Set = new Set(); - - for (const field of types[name]) { - // Check each field has a unique name - assertArgument( - !uniqueNames.has(field.name), - `duplicate variable name ${JSON.stringify( - field.name, - )} in ${JSON.stringify(name)}`, - "types", - types, - ); - uniqueNames.add(field.name); - - // Get the base type (drop any array specifiers) - const baseType = - (field.type.match(/^([^\x5b]*)(\x5b|$)/))[1] || null; - assertArgument( - baseType !== name, - `circular type reference to ${JSON.stringify(baseType)}`, - "types", - types, - ); - - // Is this a base encoding type? - const encoder = getBaseEncoder(baseType); - if (encoder) { - continue; - } - - assertArgument( - parents.has(baseType), - `unknown type ${JSON.stringify(baseType)}`, - "types", - types, - ); - - // Add linkage - (parents.get(baseType) as Array).push(name); - (links.get(name) as Set).add(baseType); - } - } - - // Deduce the primary type - const primaryTypes = Array.from(parents.keys()).filter( - (n) => (parents.get(n) as Array).length === 0, - ); - assertArgument( - primaryTypes.length !== 0, - "missing primary type", - "types", - types, - ); - assertArgument( - primaryTypes.length === 1, - `ambiguous primary types or unused types: ${primaryTypes - .map((t) => JSON.stringify(t)) - .join(", ")}`, - "types", - types, - ); - - defineProperties(this, { primaryType: primaryTypes[0] }); - - // Check for circular type references - function checkCircular(type: string, found: Set) { - assertArgument( - !found.has(type), - `circular type reference to ${JSON.stringify(type)}`, - "types", - types, - ); - - found.add(type); - - for (const child of links.get(type) as Set) { - if (!parents.has(child)) { - continue; - } - - // Recursively check children - checkCircular(child, found); - - // Mark all ancestors as having this decendant - for (const subtype of found) { - (subtypes.get(subtype) as Set).add(child); - } - } - - found.delete(type); - } - checkCircular(this.primaryType, new Set()); - - // Compute each fully describe type - for (const [name, set] of subtypes) { - const st = Array.from(set); - st.sort(); - this.#fullTypes.set( - name, - encodeType(name, types[name]) + - st.map((t) => encodeType(t, types[t])).join(""), - ); - } - } - - getEncoder(type: string): (value: any) => string { - let encoder = this.#encoderCache.get(type); - if (!encoder) { - encoder = this.#getEncoder(type); - this.#encoderCache.set(type, encoder); - } - return encoder; - } - - #getEncoder(type: string): (value: any) => string { - // Basic encoder type (address, bool, uint256, etc) - { - const encoder = getBaseEncoder(type); - if (encoder) { - return encoder; - } - } - - // Array - const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); - if (match) { - const subtype = match[1]; - const subEncoder = this.getEncoder(subtype); - return (value: Array) => { - assertArgument( - !match[3] || parseInt(match[3]) === value.length, - `array length mismatch; expected length ${parseInt(match[3])}`, - "value", - value, - ); - - let result = value.map(subEncoder); - if (this.#fullTypes.has(subtype)) { - result = result.map(sha256); - } - - return sha256(concat(result)); - }; - } - - // Struct - const fields = this.types[type]; - if (fields) { - const encodedType = id(this.#fullTypes.get(type) as string); - return (value: Record) => { - const values = fields.map(({ name, type }) => { - const result = this.getEncoder(type)(value[name]); - if (this.#fullTypes.has(type)) { - return sha256(result); - } - return result; - }); - values.unshift(encodedType); - return concat(values) as string; - }; - } - - assertArgument(false, `unknown type: ${type}`, "type", type); - } - - encodeType(name: string): string { - const result = this.#fullTypes.get(name); - assertArgument( - result, - `unknown type: ${JSON.stringify(name)}`, - "name", - name, - ); - return result; - } - - encodeData(type: string, value: any): string { - return this.getEncoder(type)(value); - } - - hashStruct(name: string, value: Record): string { - return sha256(this.encodeData(name, value)); - } - - encode(value: Record): string { - return this.encodeData(this.primaryType, value); - } - - hash(value: Record): string { - return this.hashStruct(this.primaryType, value); - } - - _visit( - type: string, - value: any, - callback: (type: string, data: any) => any, - ): any { - // Basic encoder type (address, bool, uint256, etc) - { - const encoder = getBaseEncoder(type); - if (encoder) { - return callback(type, value); - } - } - - // Array - const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); - if (match) { - assertArgument( - !match[3] || parseInt(match[3]) === value.length, - `array length mismatch; expected length ${parseInt(match[3])}`, - "value", - value, - ); - return value.map((v: any) => this._visit(match[1], v, callback)); - } - - // Struct - const fields = this.types[type]; - if (fields) { - return fields.reduce( - (accum, { name, type }) => { - accum[name] = this._visit(type, value[name], callback); - return accum; - }, - >{}, - ); - } - - assertArgument(false, `unknown type: ${type}`, "type", type); - } - - visit( - value: Record, - callback: (type: string, data: any) => any, - ): any { - return this._visit(this.primaryType, value, callback); - } - - static from(types: Record>): TypedDataEncoder { - return new TypedDataEncoder(types); - } - - static getPrimaryType(types: Record>): string { - return TypedDataEncoder.from(types).primaryType; - } - - static hashStruct( - name: string, - types: Record>, - value: Record, - ): string { - return TypedDataEncoder.from(types).hashStruct(name, value); - } - - static hashDomain(domain: TypedDataDomain): string { - const domainFields: Array = []; - for (const name in domain) { - if ((>domain)[name] == null) { - continue; - } - const type = domainFieldTypes[name]; - assertArgument( - type, - `invalid typed-data domain key: ${JSON.stringify(name)}`, - "domain", - domain, - ); - domainFields.push({ name, type }); - } - - domainFields.sort((a, b) => { - return ( - domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name) - ); - }); - - return TypedDataEncoder.hashStruct( - "EIP712Domain", - { EIP712Domain: domainFields }, - domain, - ); - } - - static encode( - domain: TypedDataDomain, - types: Record>, - value: Record, - ): string { - return concat([ - "0x1901", - TypedDataEncoder.hashDomain(domain), - TypedDataEncoder.from(types).hash(value), - ]) as string; - } - - static hash( - domain: TypedDataDomain, - types: Record>, - value: Record, - ): string { - return sha256(TypedDataEncoder.encode(domain, types, value)); - } - - // Replaces all address types with ENS names with their looked up address - static async resolveNames( - domain: TypedDataDomain, - types: Record>, - value: Record, - resolveName: (name: string) => Promise, - ): Promise<{ domain: TypedDataDomain; value: any }> { - // Make a copy to isolate it from the object passed in - domain = Object.assign({}, domain); - - // Allow passing null to ignore value - for (const key in domain) { - if ((>domain)[key] == null) { - delete (>domain)[key]; - } - } - - // Look up all ENS names - const ensCache: Record = {}; - - // Do we need to look up the domain's verifyingContract? - if ( - domain.verifyingContract && - !isHexString(domain.verifyingContract, 20) - ) { - ensCache[domain.verifyingContract] = "0x"; - } - - // We are going to use the encoder to visit all the base values - const encoder = TypedDataEncoder.from(types); - - // Get a list of all the addresses - encoder.visit(value, (type: string, value: any) => { - if (type === "address" && !isHexString(value, 20)) { - ensCache[value] = "0x"; - } - return value; - }); - - // Lookup each name - for (const name in ensCache) { - ensCache[name] = await resolveName(name); - } - - // Replace the domain verifyingContract if needed - if (domain.verifyingContract && ensCache[domain.verifyingContract]) { - domain.verifyingContract = ensCache[domain.verifyingContract]; - } - - // Replace all ENS names with their address - value = encoder.visit(value, (type: string, value: any) => { - if (type === "address" && ensCache[value]) { - return ensCache[value]; - } - return value; - }); - - return { domain, value }; - } - - static getPayload( - domain: TypedDataDomain, - types: Record>, - value: Record, - ): any { - // Validate the domain fields - TypedDataEncoder.hashDomain(domain); - - // Derive the EIP712Domain Struct reference type - const domainValues: Record = {}; - const domainTypes: Array<{ name: string; type: string }> = []; - - domainFieldNames.forEach((name) => { - const value = (domain)[name]; - if (value == null) { - return; - } - domainValues[name] = domainChecks[name](value); - domainTypes.push({ name, type: domainFieldTypes[name] }); - }); - - const encoder = TypedDataEncoder.from(types); - - const typesWithDomain = Object.assign({}, types); - assertArgument( - typesWithDomain.EIP712Domain == null, - "types must not contain EIP712Domain type", - "types.EIP712Domain", - types, - ); - - typesWithDomain.EIP712Domain = domainTypes; - - // Validate the data structures and types - encoder.encode(value); - - return { - types: typesWithDomain, - domain: domainValues, - primaryType: encoder.primaryType, - message: encoder.visit(value, (type: string, value: any) => { - // bytes - if (type.match(/^bytes(\d*)/)) { - return hexlify(getBytes(value)); - } - - // uint or int - if (type.match(/^u?int/)) { - return getBigInt(value).toString(); - } - - switch (type) { - case "address": - return value.toLowerCase(); - case "bool": - return !!value; - case "string": - assertArgument( - typeof value === "string", - "invalid string", - "value", - value, - ); - return value; - } - - assertArgument(false, "unsupported type", "type", type); - }), - }; - } + readonly primaryType!: string; + + readonly #types: string; + get types(): Record> { + return JSON.parse(this.#types); + } + + readonly #fullTypes: Map; + + readonly #encoderCache: Map string>; + + constructor(types: Record>) { + this.#types = JSON.stringify(types); + this.#fullTypes = new Map(); + this.#encoderCache = new Map(); + + // Link struct types to their direct child structs + const links: Map> = new Map(); + + // Link structs to structs which contain them as a child + const parents: Map> = new Map(); + + // Link all subtypes within a given struct + const subtypes: Map> = new Map(); + + Object.keys(types).forEach((type) => { + links.set(type, new Set()); + parents.set(type, []); + subtypes.set(type, new Set()); + }); + + for (const name in types) { + const uniqueNames: Set = new Set(); + + for (const field of types[name]) { + // Check each field has a unique name + assertArgument( + !uniqueNames.has(field.name), + `duplicate variable name ${JSON.stringify( + field.name, + )} in ${JSON.stringify(name)}`, + "types", + types, + ); + uniqueNames.add(field.name); + + // Get the base type (drop any array specifiers) + const baseType = + (field.type.match(/^([^\x5b]*)(\x5b|$)/))[1] || null; + assertArgument( + baseType !== name, + `circular type reference to ${JSON.stringify(baseType)}`, + "types", + types, + ); + + // Is this a base encoding type? + const encoder = getBaseEncoder(baseType); + if (encoder) { + continue; + } + + assertArgument( + parents.has(baseType), + `unknown type ${JSON.stringify(baseType)}`, + "types", + types, + ); + + // Add linkage + (parents.get(baseType) as Array).push(name); + (links.get(name) as Set).add(baseType); + } + } + + // Deduce the primary type + const primaryTypes = Array.from(parents.keys()).filter( + (n) => (parents.get(n) as Array).length === 0, + ); + assertArgument( + primaryTypes.length !== 0, + "missing primary type", + "types", + types, + ); + assertArgument( + primaryTypes.length === 1, + `ambiguous primary types or unused types: ${primaryTypes + .map((t) => JSON.stringify(t)) + .join(", ")}`, + "types", + types, + ); + + defineProperties(this, { primaryType: primaryTypes[0] }); + + // Check for circular type references + function checkCircular(type: string, found: Set) { + assertArgument( + !found.has(type), + `circular type reference to ${JSON.stringify(type)}`, + "types", + types, + ); + + found.add(type); + + for (const child of links.get(type) as Set) { + if (!parents.has(child)) { + continue; + } + + // Recursively check children + checkCircular(child, found); + + // Mark all ancestors as having this decendant + for (const subtype of found) { + (subtypes.get(subtype) as Set).add(child); + } + } + + found.delete(type); + } + checkCircular(this.primaryType, new Set()); + + // Compute each fully describe type + for (const [name, set] of subtypes) { + const st = Array.from(set); + st.sort(); + this.#fullTypes.set( + name, + encodeType(name, types[name]) + + st.map((t) => encodeType(t, types[t])).join(""), + ); + } + } + + getEncoder(type: string): (value: any) => string { + let encoder = this.#encoderCache.get(type); + if (!encoder) { + encoder = this.#getEncoder(type); + this.#encoderCache.set(type, encoder); + } + return encoder; + } + + #getEncoder(type: string): (value: any) => string { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return encoder; + } + } + + // Array + const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + if (match) { + const subtype = match[1]; + const subEncoder = this.getEncoder(subtype); + return (value: Array) => { + assertArgument( + !match[3] || parseInt(match[3]) === value.length, + `array length mismatch; expected length ${parseInt(match[3])}`, + "value", + value, + ); + + let result = value.map(subEncoder); + if (this.#fullTypes.has(subtype)) { + result = result.map(sha256); + } + + return sha256(concat(result)); + }; + } + + // Struct + const fields = this.types[type]; + if (fields) { + const encodedType = id(this.#fullTypes.get(type) as string); + return (value: Record) => { + const values = fields.map(({ name, type }) => { + const result = this.getEncoder(type)(value[name]); + if (this.#fullTypes.has(type)) { + return sha256(result); + } + return result; + }); + values.unshift(encodedType); + return concat(values) as string; + }; + } + + assertArgument(false, `unknown type: ${type}`, "type", type); + } + + encodeType(name: string): string { + const result = this.#fullTypes.get(name); + assertArgument( + result, + `unknown type: ${JSON.stringify(name)}`, + "name", + name, + ); + return result; + } + + encodeData(type: string, value: any): string { + return this.getEncoder(type)(value); + } + + hashStruct(name: string, value: Record): string { + return sha256(this.encodeData(name, value)); + } + + encode(value: Record): string { + return this.encodeData(this.primaryType, value); + } + + hash(value: Record): string { + return this.hashStruct(this.primaryType, value); + } + + _visit( + type: string, + value: any, + callback: (type: string, data: any) => any, + ): any { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return callback(type, value); + } + } + + // Array + const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + if (match) { + assertArgument( + !match[3] || parseInt(match[3]) === value.length, + `array length mismatch; expected length ${parseInt(match[3])}`, + "value", + value, + ); + return value.map((v: any) => this._visit(match[1], v, callback)); + } + + // Struct + const fields = this.types[type]; + if (fields) { + return fields.reduce( + (accum, { name, type }) => { + accum[name] = this._visit(type, value[name], callback); + return accum; + }, + >{}, + ); + } + + assertArgument(false, `unknown type: ${type}`, "type", type); + } + + visit( + value: Record, + callback: (type: string, data: any) => any, + ): any { + return this._visit(this.primaryType, value, callback); + } + + static from(types: Record>): TypedDataEncoder { + return new TypedDataEncoder(types); + } + + static getPrimaryType(types: Record>): string { + return TypedDataEncoder.from(types).primaryType; + } + + static hashStruct( + name: string, + types: Record>, + value: Record, + ): string { + return TypedDataEncoder.from(types).hashStruct(name, value); + } + + static hashDomain(domain: TypedDataDomain): string { + const domainFields: Array = []; + for (const name in domain) { + if ((>domain)[name] == null) { + continue; + } + const type = domainFieldTypes[name]; + assertArgument( + type, + `invalid typed-data domain key: ${JSON.stringify(name)}`, + "domain", + domain, + ); + domainFields.push({ name, type }); + } + + domainFields.sort((a, b) => { + return ( + domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name) + ); + }); + + return TypedDataEncoder.hashStruct( + "EIP712Domain", + { EIP712Domain: domainFields }, + domain, + ); + } + + static encode( + domain: TypedDataDomain, + types: Record>, + value: Record, + ): string { + return concat([ + "0x1901", + TypedDataEncoder.hashDomain(domain), + TypedDataEncoder.from(types).hash(value), + ]) as string; + } + + static hash( + domain: TypedDataDomain, + types: Record>, + value: Record, + ): string { + return sha256(TypedDataEncoder.encode(domain, types, value)); + } + + // Replaces all address types with ENS names with their looked up address + static async resolveNames( + domain: TypedDataDomain, + types: Record>, + value: Record, + resolveName: (name: string) => Promise, + ): Promise<{ domain: TypedDataDomain; value: any }> { + // Make a copy to isolate it from the object passed in + domain = Object.assign({}, domain); + + // Allow passing null to ignore value + for (const key in domain) { + if ((>domain)[key] == null) { + delete (>domain)[key]; + } + } + + // Look up all ENS names + const ensCache: Record = {}; + + // Do we need to look up the domain's verifyingContract? + if ( + domain.verifyingContract && + !isHexString(domain.verifyingContract, 20) + ) { + ensCache[domain.verifyingContract] = "0x"; + } + + // We are going to use the encoder to visit all the base values + const encoder = TypedDataEncoder.from(types); + + // Get a list of all the addresses + encoder.visit(value, (type: string, value: any) => { + if (type === "address" && !isHexString(value, 20)) { + ensCache[value] = "0x"; + } + return value; + }); + + // Lookup each name + for (const name in ensCache) { + ensCache[name] = await resolveName(name); + } + + // Replace the domain verifyingContract if needed + if (domain.verifyingContract && ensCache[domain.verifyingContract]) { + domain.verifyingContract = ensCache[domain.verifyingContract]; + } + + // Replace all ENS names with their address + value = encoder.visit(value, (type: string, value: any) => { + if (type === "address" && ensCache[value]) { + return ensCache[value]; + } + return value; + }); + + return { domain, value }; + } + + static getPayload( + domain: TypedDataDomain, + types: Record>, + value: Record, + ): any { + // Validate the domain fields + TypedDataEncoder.hashDomain(domain); + + // Derive the EIP712Domain Struct reference type + const domainValues: Record = {}; + const domainTypes: Array<{ name: string; type: string }> = []; + + domainFieldNames.forEach((name) => { + const value = (domain)[name]; + if (value == null) { + return; + } + domainValues[name] = domainChecks[name](value); + domainTypes.push({ name, type: domainFieldTypes[name] }); + }); + + const encoder = TypedDataEncoder.from(types); + + const typesWithDomain = Object.assign({}, types); + assertArgument( + typesWithDomain.EIP712Domain == null, + "types must not contain EIP712Domain type", + "types.EIP712Domain", + types, + ); + + typesWithDomain.EIP712Domain = domainTypes; + + // Validate the data structures and types + encoder.encode(value); + + return { + types: typesWithDomain, + domain: domainValues, + primaryType: encoder.primaryType, + message: encoder.visit(value, (type: string, value: any) => { + // bytes + if (type.match(/^bytes(\d*)/)) { + return hexlify(getBytes(value)); + } + + // uint or int + if (type.match(/^u?int/)) { + return getBigInt(value).toString(); + } + + switch (type) { + case "address": + return value.toLowerCase(); + case "bool": + return !!value; + case "string": + assertArgument( + typeof value === "string", + "invalid string", + "value", + value, + ); + return value; + } + + assertArgument(false, "unsupported type", "type", type); + }), + }; + } } /** * Compute the address used to sign the typed data for the %%signature%%. */ export function verifyTypedData( - domain: TypedDataDomain, - types: Record>, - value: Record, - signature: string, - prefix: string, + domain: TypedDataDomain, + types: Record>, + value: Record, + signature: string, + prefix: string, ): string { - return recoverAddress( - TypedDataEncoder.hash(domain, types, value), - signature, - prefix, - ); + return recoverAddress( + TypedDataEncoder.hash(domain, types, value), + signature, + prefix, + ); } diff --git a/src.ts/ipfs/index.ts b/src.ts/ipfs/index.ts new file mode 100644 index 000000000..9cab0b7f4 --- /dev/null +++ b/src.ts/ipfs/index.ts @@ -0,0 +1,90 @@ +export const defaultIpfsGatewayTemplate = "https://ipf.sk/{cid}"; +export interface IpfsGatewayOptions { + template?: string; + maxResponseBytes?: number; + timeoutMs?: number; + fetch?: typeof globalThis.fetch; +} +/** Configurable IPFS resolution and bounded JSON loading. */ +export class IpfsGateway { + readonly template: string; + readonly maxResponseBytes: number; + readonly timeoutMs: number; + readonly #fetch: typeof globalThis.fetch; + constructor(options: IpfsGatewayOptions = {}) { + this.template = options.template ?? defaultIpfsGatewayTemplate; + this.maxResponseBytes = options.maxResponseBytes ?? 1024 * 1024; + this.timeoutMs = options.timeoutMs ?? 30_000; + this.#fetch = options.fetch ?? globalThis.fetch; + const templateUrl = new URL(this.template.replace("{cid}", "cid")); + if ( + !/^https?:$/.test(templateUrl.protocol) || + this.template.split("{cid}").length !== 2 + ) + throw new TypeError( + "gateway template must be HTTP(S) and contain one {cid}", + ); + for (const value of [this.maxResponseBytes, this.timeoutMs]) + if (!Number.isSafeInteger(value) || value <= 0) + throw new TypeError("gateway limits must be positive safe integers"); + } + resolve(reference: string): URL { + const value = reference.trim(); + if (/^https?:\/\//i.test(value)) return new URL(value); + const path = value.replace(/^ipfs:\/\//, "").replace(/^\/?ipfs\//, ""); + if ( + !/^[A-Za-z0-9]+(?:\/[^?#]*)?$/.test(path) || + path.split("/").some((part) => part === "." || part === "..") + ) + throw new TypeError("invalid IPFS reference"); + return new URL( + this.template.replace( + "{cid}", + path.split("/").map(encodeURIComponent).join("/"), + ), + ); + } + async readJson(reference: string): Promise { + const controller = new AbortController(); + const timer = setTimeout(() => controller.abort(), this.timeoutMs); + let reader: ReadableStreamDefaultReader | undefined; + try { + const response = await this.#fetch(this.resolve(reference), { + headers: { accept: "application/json" }, + signal: controller.signal, + }); + if (!response.ok) { + await response.body?.cancel(); + throw new Error(`IPFS gateway returned HTTP ${response.status}`); + } + if (!response.body) + throw new Error("IPFS gateway returned an empty body"); + reader = response.body.getReader(); + const chunks: Uint8Array[] = []; + let length = 0; + while (true) { + const { done, value } = await reader.read(); + if (done) break; + length += value.length; + if (length > this.maxResponseBytes) + throw new Error( + `IPFS response exceeds ${this.maxResponseBytes} bytes`, + ); + chunks.push(value); + } + const bytes = new Uint8Array(length); + let offset = 0; + for (const chunk of chunks) { + bytes.set(chunk, offset); + offset += chunk.length; + } + return JSON.parse( + new TextDecoder("utf-8", { fatal: true }).decode(bytes), + ); + } finally { + clearTimeout(timer); + await reader?.cancel().catch(() => {}); + reader?.releaseLock(); + } + } +} diff --git a/src.ts/logger/logger.ts b/src.ts/logger/logger.ts index 630fac2b1..aac8621c4 100644 --- a/src.ts/logger/logger.ts +++ b/src.ts/logger/logger.ts @@ -4,425 +4,425 @@ let _permanentCensorErrors = false; let _censorErrors = false; const LogLevels: { [name: string]: number } = { - debug: 1, - default: 2, - info: 2, - warning: 3, - error: 4, - off: 5, + debug: 1, + default: 2, + info: 2, + warning: 3, + error: 4, + off: 5, }; let _logLevel = LogLevels["default"]; let _globalLogger: any = null; function _checkNormalize(): any { - try { - const missing: Array = []; - - // Make sure all forms of normalization are supported - ["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => { - try { - if ("test".normalize(form) !== "test") { - throw new Error("bad normalize"); - } - } catch (error) { - missing.push(form); - } - }); - - if (missing.length) { - throw new Error("missing " + missing.join(", ")); - } - - if ( - String.fromCharCode(0xe9).normalize("NFD") !== - String.fromCharCode(0x65, 0x0301) - ) { - throw new Error("broken implementation"); - } - } catch (error: any) { - return error.message; - } - - return null; + try { + const missing: Array = []; + + // Make sure all forms of normalization are supported + ["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => { + try { + if ("test".normalize(form) !== "test") { + throw new Error("bad normalize"); + } + } catch (error) { + missing.push(form); + } + }); + + if (missing.length) { + throw new Error("missing " + missing.join(", ")); + } + + if ( + String.fromCharCode(0xe9).normalize("NFD") !== + String.fromCharCode(0x65, 0x0301) + ) { + throw new Error("broken implementation"); + } + } catch (error: any) { + return error.message; + } + + return null; } const _normalizeError = _checkNormalize(); export enum LogLevel { - DEBUG = "DEBUG", - INFO = "INFO", - WARNING = "WARNING", - ERROR = "ERROR", - OFF = "OFF", + DEBUG = "DEBUG", + INFO = "INFO", + WARNING = "WARNING", + ERROR = "ERROR", + OFF = "OFF", } export enum ErrorCode { - /////////////////// - // Generic Errors - - // Unknown Error - UNKNOWN_ERROR = "UNKNOWN_ERROR", - - // Not Implemented - NOT_IMPLEMENTED = "NOT_IMPLEMENTED", - - // Unsupported Operation - // - operation - UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", - - // Network Error (i.e. Core Network, such as an invalid network ID) - // - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown) - NETWORK_ERROR = "NETWORK_ERROR", - - // Some sort of bad response from the server - SERVER_ERROR = "SERVER_ERROR", - - // Timeout - TIMEOUT = "TIMEOUT", - - /////////////////// - // Operational Errors - - // Buffer Overrun - BUFFER_OVERRUN = "BUFFER_OVERRUN", - - // Numeric Fault - // - operation: the operation being executed - // - fault: the reason this faulted - NUMERIC_FAULT = "NUMERIC_FAULT", - - /////////////////// - // Argument Errors - - // Missing new operator to an object - // - name: The name of the class - MISSING_NEW = "MISSING_NEW", - - // Invalid argument (e.g. value is incompatible with type) to a function: - // - argument: The argument name that was invalid - // - value: The value of the argument - INVALID_ARGUMENT = "INVALID_ARGUMENT", - - // Missing argument to a function: - // - count: The number of arguments received - // - expectedCount: The number of arguments expected - MISSING_ARGUMENT = "MISSING_ARGUMENT", - - // Too many arguments - // - count: The number of arguments received - // - expectedCount: The number of arguments expected - UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", - - /////////////////// - // Blockchain Errors - - // Call exception - // - transaction: the transaction - // - address?: the contract address - // - args?: The arguments passed into the function - // - method?: The Solidity method signature - // - errorSignature?: The EIP848 error signature - // - errorArgs?: The EIP848 error parameters - // - reason: The reason (only for EIP848 "Error(string)") - CALL_EXCEPTION = "CALL_EXCEPTION", - - // Insufficient funds (< value + energyLimit * energyPrice) - // - transaction: the transaction attempted - INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", - - // Nonce has already been used - // - transaction: the transaction attempted - NONCE_EXPIRED = "NONCE_EXPIRED", - - // The replacement fee for the transaction is too low - // - transaction: the transaction attempted - REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", - - // The energy limit could not be estimated - // - transaction: the transaction passed to estimateEnergy - UNPREDICTABLE_ENERGY_LIMIT = "UNPREDICTABLE_ENERGY_LIMIT", - - // The transaction was replaced by one with a higher energy price - // - reason: "cancelled", "replaced" or "repriced" - // - cancelled: true if reason == "cancelled" or reason == "replaced") - // - hash: original transaction hash - // - replacement: the full TransactionsResponse for the replacement - // - receipt: the receipt of the replacement - TRANSACTION_REPLACED = "TRANSACTION_REPLACED", + /////////////////// + // Generic Errors + + // Unknown Error + UNKNOWN_ERROR = "UNKNOWN_ERROR", + + // Not Implemented + NOT_IMPLEMENTED = "NOT_IMPLEMENTED", + + // Unsupported Operation + // - operation + UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", + + // Network Error (i.e. Core Network, such as an invalid network ID) + // - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown) + NETWORK_ERROR = "NETWORK_ERROR", + + // Some sort of bad response from the server + SERVER_ERROR = "SERVER_ERROR", + + // Timeout + TIMEOUT = "TIMEOUT", + + /////////////////// + // Operational Errors + + // Buffer Overrun + BUFFER_OVERRUN = "BUFFER_OVERRUN", + + // Numeric Fault + // - operation: the operation being executed + // - fault: the reason this faulted + NUMERIC_FAULT = "NUMERIC_FAULT", + + /////////////////// + // Argument Errors + + // Missing new operator to an object + // - name: The name of the class + MISSING_NEW = "MISSING_NEW", + + // Invalid argument (e.g. value is incompatible with type) to a function: + // - argument: The argument name that was invalid + // - value: The value of the argument + INVALID_ARGUMENT = "INVALID_ARGUMENT", + + // Missing argument to a function: + // - count: The number of arguments received + // - expectedCount: The number of arguments expected + MISSING_ARGUMENT = "MISSING_ARGUMENT", + + // Too many arguments + // - count: The number of arguments received + // - expectedCount: The number of arguments expected + UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", + + /////////////////// + // Blockchain Errors + + // Call exception + // - transaction: the transaction + // - address?: the contract address + // - args?: The arguments passed into the function + // - method?: The Solidity method signature + // - errorSignature?: The EIP848 error signature + // - errorArgs?: The EIP848 error parameters + // - reason: The reason (only for EIP848 "Error(string)") + CALL_EXCEPTION = "CALL_EXCEPTION", + + // Insufficient funds (< value + energyLimit * energyPrice) + // - transaction: the transaction attempted + INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", + + // Nonce has already been used + // - transaction: the transaction attempted + NONCE_EXPIRED = "NONCE_EXPIRED", + + // The replacement fee for the transaction is too low + // - transaction: the transaction attempted + REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", + + // The energy limit could not be estimated + // - transaction: the transaction passed to estimateEnergy + UNPREDICTABLE_ENERGY_LIMIT = "UNPREDICTABLE_ENERGY_LIMIT", + + // The transaction was replaced by one with a higher energy price + // - reason: "cancelled", "replaced" or "repriced" + // - cancelled: true if reason == "cancelled" or reason == "replaced") + // - hash: original transaction hash + // - replacement: the full TransactionsResponse for the replacement + // - receipt: the receipt of the replacement + TRANSACTION_REPLACED = "TRANSACTION_REPLACED", } const HEX = "0123456789abcdef"; export class Logger { - readonly version: string = "0.0.1"; - - static errors = ErrorCode; - - static levels = LogLevel; - - constructor(version: string) { - Object.defineProperty(this, "version", { - enumerable: true, - value: version, - writable: false, - }); - } - - _log(logLevel: LogLevel, args: Array): void { - const level = logLevel.toLowerCase(); - if (LogLevels[level] == null) { - this.throwArgumentError("invalid log level name", "logLevel", logLevel); - } - if (_logLevel > LogLevels[level]) { - return; - } - console.log.apply(console, args); - } - - debug(...args: Array): void { - this._log(Logger.levels.DEBUG, args); - } - - info(...args: Array): void { - this._log(Logger.levels.INFO, args); - } - - warn(...args: Array): void { - this._log(Logger.levels.WARNING, args); - } - - makeError(message: string, code?: ErrorCode, params?: any): Error { - // Errors are being censored - if (_censorErrors) { - return this.makeError("censored error", code, {}); - } - - if (!code) { - code = Logger.errors.UNKNOWN_ERROR; - } - if (!params) { - params = {}; - } - - const messageDetails: Array = []; - Object.keys(params).forEach((key) => { - const value = params[key]; - try { - if (value instanceof Uint8Array) { - let hex = ""; - for (let i = 0; i < value.length; i++) { - hex += HEX[value[i] >> 4]; - hex += HEX[value[i] & 0x0f]; - } - messageDetails.push(key + "=Uint8Array(0x" + hex + ")"); - } else { - messageDetails.push(key + "=" + JSON.stringify(value)); - } - } catch (error) { - messageDetails.push(key + "=" + JSON.stringify(params[key].toString())); - } - }); - messageDetails.push(`code=${code}`); - messageDetails.push(`version=${this.version}`); - - const reason = message; - if (messageDetails.length) { - message += " (" + messageDetails.join(", ") + ")"; - } - - // @TODO: Any?? - const error: any = new Error(message); - error.reason = reason; - error.code = code; - - Object.keys(params).forEach(function (key) { - error[key] = params[key]; - }); - - return error; - } - - throwError(message: string, code?: ErrorCode, params?: any): never { - throw this.makeError(message, code, params); - } - - throwArgumentError(message: string, name: string, value: any): never { - return this.throwError(message, Logger.errors.INVALID_ARGUMENT, { - argument: name, - value: value, - }); - } - - assert( - condition: any, - message: string, - code?: ErrorCode, - params?: any, - ): void { - if (!!condition) { - return; - } - this.throwError(message, code, params); - } - - assertArgument( - condition: any, - message: string, - name: string, - value: any, - ): void { - if (!!condition) { - return; - } - this.throwArgumentError(message, name, value); - } - - checkNormalize(message?: string): void { - if (message == null) { - message = "platform missing String.prototype.normalize"; - } - if (_normalizeError) { - this.throwError( - "platform missing String.prototype.normalize", - Logger.errors.UNSUPPORTED_OPERATION, - { - operation: "String.prototype.normalize", - form: _normalizeError, - }, - ); - } - } - - checkSafeUint53(value: number, message?: string): void { - if (typeof value !== "number") { - return; - } - - if (message == null) { - message = "value not safe"; - } - - if (value < 0 || value >= 0x1fffffffffffff) { - this.throwError(message, Logger.errors.NUMERIC_FAULT, { - operation: "checkSafeInteger", - fault: "out-of-safe-range", - value: value, - }); - } - - if (value % 1) { - this.throwError(message, Logger.errors.NUMERIC_FAULT, { - operation: "checkSafeInteger", - fault: "non-integer", - value: value, - }); - } - } - - checkArgumentCount( - count: number, - expectedCount: number, - message?: string, - ): void { - if (message) { - message = ": " + message; - } else { - message = ""; - } - - if (count < expectedCount) { - this.throwError( - "missing argument" + message, - Logger.errors.MISSING_ARGUMENT, - { - count: count, - expectedCount: expectedCount, - }, - ); - } - - if (count > expectedCount) { - this.throwError( - "too many arguments" + message, - Logger.errors.UNEXPECTED_ARGUMENT, - { - count: count, - expectedCount: expectedCount, - }, - ); - } - } - - checkNew(target: any, kind: any): void { - if (target === Object || target == null) { - this.throwError("missing new", Logger.errors.MISSING_NEW, { - name: kind.name, - }); - } - } - - checkAbstract(target: any, kind: any): void { - if (target === kind) { - this.throwError( - "cannot instantiate abstract class " + - JSON.stringify(kind.name) + - " directly; use a sub-class", - Logger.errors.UNSUPPORTED_OPERATION, - { name: target.name, operation: "new" }, - ); - } else if (target === Object || target == null) { - this.throwError("missing new", Logger.errors.MISSING_NEW, { - name: kind.name, - }); - } - } - - static globalLogger(): Logger { - if (!_globalLogger) { - _globalLogger = new Logger("logger/0.0.1"); - } - return _globalLogger; - } - - static setCensorship(censorship: boolean, permanent?: boolean): void { - if (!censorship && permanent) { - this.globalLogger().throwError( - "cannot permanently disable censorship", - Logger.errors.UNSUPPORTED_OPERATION, - { - operation: "setCensorship", - }, - ); - } - - if (_permanentCensorErrors) { - if (!censorship) { - return; - } - this.globalLogger().throwError( - "error censorship permanent", - Logger.errors.UNSUPPORTED_OPERATION, - { - operation: "setCensorship", - }, - ); - } - - _censorErrors = !!censorship; - _permanentCensorErrors = !!permanent; - } - - static setLogLevel(logLevel: LogLevel): void { - const level = LogLevels[logLevel.toLowerCase()]; - if (level == null) { - Logger.globalLogger().warn("invalid log level - " + logLevel); - return; - } - _logLevel = level; - } - - static from(version: string): Logger { - return new Logger(version); - } + readonly version: string = "0.0.1"; + + static errors = ErrorCode; + + static levels = LogLevel; + + constructor(version: string) { + Object.defineProperty(this, "version", { + enumerable: true, + value: version, + writable: false, + }); + } + + _log(logLevel: LogLevel, args: Array): void { + const level = logLevel.toLowerCase(); + if (LogLevels[level] == null) { + this.throwArgumentError("invalid log level name", "logLevel", logLevel); + } + if (_logLevel > LogLevels[level]) { + return; + } + console.log.apply(console, args); + } + + debug(...args: Array): void { + this._log(Logger.levels.DEBUG, args); + } + + info(...args: Array): void { + this._log(Logger.levels.INFO, args); + } + + warn(...args: Array): void { + this._log(Logger.levels.WARNING, args); + } + + makeError(message: string, code?: ErrorCode, params?: any): Error { + // Errors are being censored + if (_censorErrors) { + return this.makeError("censored error", code, {}); + } + + if (!code) { + code = Logger.errors.UNKNOWN_ERROR; + } + if (!params) { + params = {}; + } + + const messageDetails: Array = []; + Object.keys(params).forEach((key) => { + const value = params[key]; + try { + if (value instanceof Uint8Array) { + let hex = ""; + for (let i = 0; i < value.length; i++) { + hex += HEX[value[i] >> 4]; + hex += HEX[value[i] & 0x0f]; + } + messageDetails.push(key + "=Uint8Array(0x" + hex + ")"); + } else { + messageDetails.push(key + "=" + JSON.stringify(value)); + } + } catch (error) { + messageDetails.push(key + "=" + JSON.stringify(params[key].toString())); + } + }); + messageDetails.push(`code=${code}`); + messageDetails.push(`version=${this.version}`); + + const reason = message; + if (messageDetails.length) { + message += " (" + messageDetails.join(", ") + ")"; + } + + // @TODO: Any?? + const error: any = new Error(message); + error.reason = reason; + error.code = code; + + Object.keys(params).forEach(function (key) { + error[key] = params[key]; + }); + + return error; + } + + throwError(message: string, code?: ErrorCode, params?: any): never { + throw this.makeError(message, code, params); + } + + throwArgumentError(message: string, name: string, value: any): never { + return this.throwError(message, Logger.errors.INVALID_ARGUMENT, { + argument: name, + value: value, + }); + } + + assert( + condition: any, + message: string, + code?: ErrorCode, + params?: any, + ): void { + if (!!condition) { + return; + } + this.throwError(message, code, params); + } + + assertArgument( + condition: any, + message: string, + name: string, + value: any, + ): void { + if (!!condition) { + return; + } + this.throwArgumentError(message, name, value); + } + + checkNormalize(message?: string): void { + if (message == null) { + message = "platform missing String.prototype.normalize"; + } + if (_normalizeError) { + this.throwError( + "platform missing String.prototype.normalize", + Logger.errors.UNSUPPORTED_OPERATION, + { + operation: "String.prototype.normalize", + form: _normalizeError, + }, + ); + } + } + + checkSafeUint53(value: number, message?: string): void { + if (typeof value !== "number") { + return; + } + + if (message == null) { + message = "value not safe"; + } + + if (value < 0 || value >= 0x1fffffffffffff) { + this.throwError(message, Logger.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "out-of-safe-range", + value: value, + }); + } + + if (value % 1) { + this.throwError(message, Logger.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "non-integer", + value: value, + }); + } + } + + checkArgumentCount( + count: number, + expectedCount: number, + message?: string, + ): void { + if (message) { + message = ": " + message; + } else { + message = ""; + } + + if (count < expectedCount) { + this.throwError( + "missing argument" + message, + Logger.errors.MISSING_ARGUMENT, + { + count: count, + expectedCount: expectedCount, + }, + ); + } + + if (count > expectedCount) { + this.throwError( + "too many arguments" + message, + Logger.errors.UNEXPECTED_ARGUMENT, + { + count: count, + expectedCount: expectedCount, + }, + ); + } + } + + checkNew(target: any, kind: any): void { + if (target === Object || target == null) { + this.throwError("missing new", Logger.errors.MISSING_NEW, { + name: kind.name, + }); + } + } + + checkAbstract(target: any, kind: any): void { + if (target === kind) { + this.throwError( + "cannot instantiate abstract class " + + JSON.stringify(kind.name) + + " directly; use a sub-class", + Logger.errors.UNSUPPORTED_OPERATION, + { name: target.name, operation: "new" }, + ); + } else if (target === Object || target == null) { + this.throwError("missing new", Logger.errors.MISSING_NEW, { + name: kind.name, + }); + } + } + + static globalLogger(): Logger { + if (!_globalLogger) { + _globalLogger = new Logger("logger/0.0.1"); + } + return _globalLogger; + } + + static setCensorship(censorship: boolean, permanent?: boolean): void { + if (!censorship && permanent) { + this.globalLogger().throwError( + "cannot permanently disable censorship", + Logger.errors.UNSUPPORTED_OPERATION, + { + operation: "setCensorship", + }, + ); + } + + if (_permanentCensorErrors) { + if (!censorship) { + return; + } + this.globalLogger().throwError( + "error censorship permanent", + Logger.errors.UNSUPPORTED_OPERATION, + { + operation: "setCensorship", + }, + ); + } + + _censorErrors = !!censorship; + _permanentCensorErrors = !!permanent; + } + + static setLogLevel(logLevel: LogLevel): void { + const level = LogLevels[logLevel.toLowerCase()]; + if (level == null) { + Logger.globalLogger().warn("invalid log level - " + logLevel); + return; + } + _logLevel = level; + } + + static from(version: string): Logger { + return new Logger(version); + } } diff --git a/src.ts/providers/abstract-provider.ts b/src.ts/providers/abstract-provider.ts index bb67a48ad..6d3854238 100644 --- a/src.ts/providers/abstract-provider.ts +++ b/src.ts/providers/abstract-provider.ts @@ -15,47 +15,47 @@ import { resolveAddress } from "../address/checks.js"; import { Transaction } from "../transaction/index.js"; import { - concat, - dataLength, - dataSlice, - hexlify, - isHexString, - getBigInt, - getBytes, - getNumber, - isCallException, - makeError, - assert, - assertArgument, - FetchRequest, - toBeArray, - toQuantity, - defineProperties, - EventPayload, - resolveProperties, - toUtf8String, + concat, + dataLength, + dataSlice, + hexlify, + isHexString, + getBigInt, + getBytes, + getNumber, + isCallException, + makeError, + assert, + assertArgument, + FetchRequest, + toBeArray, + toQuantity, + defineProperties, + EventPayload, + resolveProperties, + toUtf8String, } from "../utils/index.js"; import { - formatBlock, - formatLog, - formatTransactionReceipt, - formatTransactionResponse, + formatBlock, + formatLog, + formatTransactionReceipt, + formatTransactionResponse, } from "./format.js"; import { Network } from "./network.js"; import { - copyRequest, - Block, - FeeData, - Log, - TransactionReceipt, - TransactionResponse, + copyRequest, + Block, + FeeData, + Log, + TransactionReceipt, + TransactionResponse, } from "./provider.js"; import { - PollingBlockSubscriber, - PollingEventSubscriber, - PollingOrphanSubscriber, - PollingTransactionSubscriber, + PollingBlockSubscriber, + PollingEventSubscriber, + PollingOrphanSubscriber, + PollingTransactionSubscriber, } from "./subscriber-polling.js"; import type { Addressable, AddressLike } from "../address/index.js"; @@ -64,22 +64,22 @@ import type { Listener } from "../utils/index.js"; import type { Networkish } from "./network.js"; import type { - BlockParams, - LogParams, - TransactionReceiptParams, - TransactionResponseParams, + BlockParams, + LogParams, + TransactionReceiptParams, + TransactionResponseParams, } from "./formatting.js"; import type { - BlockTag, - EventFilter, - Filter, - FilterByBlockHash, - OrphanFilter, - PreparedTransactionRequest, - Provider, - ProviderEvent, - TransactionRequest, + BlockTag, + EventFilter, + Filter, + FilterByBlockHash, + OrphanFilter, + PreparedTransactionRequest, + Provider, + ProviderEvent, + TransactionRequest, } from "./provider.js"; type Timer = ReturnType; @@ -87,1772 +87,1772 @@ type Timer = ReturnType; const MAX_CCIP_REDIRECTS = 10; function isPromise(value: any): value is Promise { - return value && typeof value.then === "function"; + return value && typeof value.then === "function"; } function getTag(prefix: string, value: any): string { - return ( - prefix + - ":" + - JSON.stringify(value, (k, v) => { - if (v == null) { - return "null"; - } - if (typeof v === "bigint") { - return `bigint:${v.toString()}`; - } - if (typeof v === "string") { - return v.toLowerCase(); - } - - // Sort object keys - if (typeof v === "object" && !Array.isArray(v)) { - const keys = Object.keys(v); - keys.sort(); - return keys.reduce( - (accum, key) => { - accum[key] = v[key]; - return accum; - }, - {}, - ); - } - - return v; - }) - ); + return ( + prefix + + ":" + + JSON.stringify(value, (k, v) => { + if (v == null) { + return "null"; + } + if (typeof v === "bigint") { + return `bigint:${v.toString()}`; + } + if (typeof v === "string") { + return v.toLowerCase(); + } + + // Sort object keys + if (typeof v === "object" && !Array.isArray(v)) { + const keys = Object.keys(v); + keys.sort(); + return keys.reduce( + (accum, key) => { + accum[key] = v[key]; + return accum; + }, + {}, + ); + } + + return v; + }) + ); } export type DebugEventAbstractProvider = - | { - action: "sendCcipReadFetchRequest"; - request: FetchRequest; - index: number; - urls: Array; - } - | { - action: "receiveCcipReadFetchResult"; - request: FetchRequest; - result: any; - } - | { - action: "receiveCcipReadFetchError"; - request: FetchRequest; - result: any; - } - | { - action: "sendCcipReadCall"; - transaction: { to: string; data: string }; - } - | { - action: "receiveCcipReadCallResult"; - transaction: { to: string; data: string }; - result: string; - } - | { - action: "receiveCcipReadCallError"; - transaction: { to: string; data: string }; - error: Error; - }; + | { + action: "sendCcipReadFetchRequest"; + request: FetchRequest; + index: number; + urls: Array; + } + | { + action: "receiveCcipReadFetchResult"; + request: FetchRequest; + result: any; + } + | { + action: "receiveCcipReadFetchError"; + request: FetchRequest; + result: any; + } + | { + action: "sendCcipReadCall"; + transaction: { to: string; data: string }; + } + | { + action: "receiveCcipReadCallResult"; + transaction: { to: string; data: string }; + result: string; + } + | { + action: "receiveCcipReadCallError"; + transaction: { to: string; data: string }; + error: Error; + }; // Only sub-classes overriding the _getSubscription method will care about this export type Subscription = - | { - type: "block" | "close" | "debug" | "error" | "network" | "pending"; - tag: string; - } - | { - type: "transaction"; - tag: string; - hash: string; - } - | { - type: "event"; - tag: string; - filter: EventFilter; - } - | { - type: "orphan"; - tag: string; - filter: OrphanFilter; - }; + | { + type: "block" | "close" | "debug" | "error" | "network" | "pending"; + tag: string; + } + | { + type: "transaction"; + tag: string; + hash: string; + } + | { + type: "event"; + tag: string; + filter: EventFilter; + } + | { + type: "orphan"; + tag: string; + filter: OrphanFilter; + }; export interface Subscriber { - start(): void; - stop(): void; + start(): void; + stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; - // Subscribers which use polling should implement this to allow - // Providers the ability to update underlying polling intervals - // If not supported, accessing this property should return undefined - pollingInterval?: number; + // Subscribers which use polling should implement this to allow + // Providers the ability to update underlying polling intervals + // If not supported, accessing this property should return undefined + pollingInterval?: number; } export class UnmanagedSubscriber implements Subscriber { - name!: string; + name!: string; - constructor(name: string) { - defineProperties(this, { name }); - } + constructor(name: string) { + defineProperties(this, { name }); + } - start(): void {} - stop(): void {} + start(): void {} + stop(): void {} - pause(dropWhilePaused?: boolean): void {} - resume(): void {} + pause(dropWhilePaused?: boolean): void {} + resume(): void {} } type Sub = { - tag: string; - nameMap: Map; - addressableMap: WeakMap; - listeners: Array<{ listener: Listener; once: boolean }>; - // @TODO: get rid of this, as it is (and has to be) - // tracked in subscriber - started: boolean; - subscriber: Subscriber; + tag: string; + nameMap: Map; + addressableMap: WeakMap; + listeners: Array<{ listener: Listener; once: boolean }>; + // @TODO: get rid of this, as it is (and has to be) + // tracked in subscriber + started: boolean; + subscriber: Subscriber; }; function copy(value: T): T { - return JSON.parse(JSON.stringify(value)); + return JSON.parse(JSON.stringify(value)); } function concisify(items: Array): Array { - items = Array.from(new Set(items).values()); - items.sort(); - return items; + items = Array.from(new Set(items).values()); + items.sort(); + return items; } async function getSubscription( - _event: ProviderEvent, - provider: AbstractProvider, + _event: ProviderEvent, + provider: AbstractProvider, ): Promise { - if (_event == null) { - throw new Error("invalid event"); - } - - // Normalize topic array info an EventFilter - if (Array.isArray(_event)) { - _event = { topics: _event }; - } - - if (typeof _event === "string") { - switch (_event) { - case "block": - case "pending": - case "debug": - case "error": - case "network": { - return { type: _event, tag: _event }; - } - } - } - - if (isHexString(_event, 32)) { - const hash = _event.toLowerCase(); - return { type: "transaction", tag: getTag("tx", { hash }), hash }; - } - - if ((_event).orphan) { - const event = _event; - // @TODO: Should lowercase and whatnot things here instead of copy... - return { - type: "orphan", - tag: getTag("orphan", event), - filter: copy(event), - }; - } - - if ((_event).address || (_event).topics) { - const event = _event; - - const filter: any = { - topics: (event.topics || []).map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - return concisify(t.map((t) => t.toLowerCase())); - } - return t.toLowerCase(); - }), - }; - - if (event.address) { - const addresses: Array = []; - const promises: Array> = []; - - const addAddress = (addr: AddressLike) => { - if (isHexString(addr)) { - addresses.push(addr); - } else { - promises.push( - (async () => { - addresses.push(await resolveAddress(addr)); - })(), - ); - } - }; - - if (Array.isArray(event.address)) { - event.address.forEach(addAddress); - } else { - addAddress(event.address); - } - if (promises.length) { - await Promise.all(promises); - } - filter.address = concisify(addresses.map((a) => a.toLowerCase())); - } - - return { filter, tag: getTag("event", filter), type: "event" }; - } - - assertArgument(false, "unknown ProviderEvent", "event", _event); + if (_event == null) { + throw new Error("invalid event"); + } + + // Normalize topic array info an EventFilter + if (Array.isArray(_event)) { + _event = { topics: _event }; + } + + if (typeof _event === "string") { + switch (_event) { + case "block": + case "pending": + case "debug": + case "error": + case "network": { + return { type: _event, tag: _event }; + } + } + } + + if (isHexString(_event, 32)) { + const hash = _event.toLowerCase(); + return { type: "transaction", tag: getTag("tx", { hash }), hash }; + } + + if ((_event).orphan) { + const event = _event; + // @TODO: Should lowercase and whatnot things here instead of copy... + return { + type: "orphan", + tag: getTag("orphan", event), + filter: copy(event), + }; + } + + if ((_event).address || (_event).topics) { + const event = _event; + + const filter: any = { + topics: (event.topics || []).map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + return concisify(t.map((t) => t.toLowerCase())); + } + return t.toLowerCase(); + }), + }; + + if (event.address) { + const addresses: Array = []; + const promises: Array> = []; + + const addAddress = (addr: AddressLike) => { + if (isHexString(addr)) { + addresses.push(addr); + } else { + promises.push( + (async () => { + addresses.push(await resolveAddress(addr)); + })(), + ); + } + }; + + if (Array.isArray(event.address)) { + event.address.forEach(addAddress); + } else { + addAddress(event.address); + } + if (promises.length) { + await Promise.all(promises); + } + filter.address = concisify(addresses.map((a) => a.toLowerCase())); + } + + return { filter, tag: getTag("event", filter), type: "event" }; + } + + assertArgument(false, "unknown ProviderEvent", "event", _event); } function getTime(): number { - return new Date().getTime(); + return new Date().getTime(); } export interface AbstractProviderPlugin { - readonly name: string; - connect(provider: AbstractProvider): AbstractProviderPlugin; + readonly name: string; + connect(provider: AbstractProvider): AbstractProviderPlugin; } export type PerformActionFilter = - | { - address?: string | Array; - topics?: Array>; - fromBlock?: BlockTag; - toBlock?: BlockTag; - } - | { - address?: string | Array; - topics?: Array>; - blockHash?: string; - }; + | { + address?: string | Array; + topics?: Array>; + fromBlock?: BlockTag; + toBlock?: BlockTag; + } + | { + address?: string | Array; + topics?: Array>; + blockHash?: string; + }; export interface PerformActionTransaction extends PreparedTransactionRequest { - to?: string; - from?: string; + to?: string; + from?: string; } export type PerformActionRequest = - | { - method: "broadcastTransaction"; - signedTransaction: string; - } - | { - method: "call"; - transaction: PerformActionTransaction; - blockTag: BlockTag; - } - | { - method: "networkId"; - } - | { - method: "estimateEnergy"; - transaction: PerformActionTransaction; - } - | { - method: "getBalance"; - address: string; - blockTag: BlockTag; - } - | { - method: "getBlock"; - blockTag: BlockTag; - includeTransactions: boolean; - } - | { - method: "getBlock"; - blockHash: string; - includeTransactions: boolean; - } - | { - method: "getBlockNumber"; - } - | { - method: "getCode"; - address: string; - blockTag: BlockTag; - } - | { - method: "getEnergyPrice"; - } - | { - method: "getLogs"; - filter: PerformActionFilter; - } - | { - method: "getStorage"; - address: string; - position: bigint; - blockTag: BlockTag; - } - | { - method: "getTransaction"; - hash: string; - } - | { - method: "getTransactionCount"; - address: string; - blockTag: BlockTag; - } - | { - method: "getTransactionReceipt"; - hash: string; - } - | { - method: "getTransactionResult"; - hash: string; - }; + | { + method: "broadcastTransaction"; + signedTransaction: string; + } + | { + method: "call"; + transaction: PerformActionTransaction; + blockTag: BlockTag; + } + | { + method: "networkId"; + } + | { + method: "estimateEnergy"; + transaction: PerformActionTransaction; + } + | { + method: "getBalance"; + address: string; + blockTag: BlockTag; + } + | { + method: "getBlock"; + blockTag: BlockTag; + includeTransactions: boolean; + } + | { + method: "getBlock"; + blockHash: string; + includeTransactions: boolean; + } + | { + method: "getBlockNumber"; + } + | { + method: "getCode"; + address: string; + blockTag: BlockTag; + } + | { + method: "getEnergyPrice"; + } + | { + method: "getLogs"; + filter: PerformActionFilter; + } + | { + method: "getStorage"; + address: string; + position: bigint; + blockTag: BlockTag; + } + | { + method: "getTransaction"; + hash: string; + } + | { + method: "getTransactionCount"; + address: string; + blockTag: BlockTag; + } + | { + method: "getTransactionReceipt"; + hash: string; + } + | { + method: "getTransactionResult"; + hash: string; + }; type _PerformAccountRequest = - | { - method: "getBalance" | "getTransactionCount" | "getCode"; - } - | { - method: "getStorage"; - position: bigint; - }; + | { + method: "getBalance" | "getTransactionCount" | "getCode"; + } + | { + method: "getStorage"; + position: bigint; + }; type CcipArgs = { - sender: string; - urls: Array; - calldata: string; - selector: string; - extraData: string; - errorArgs: Array; + sender: string; + urls: Array; + calldata: string; + selector: string; + extraData: string; + errorArgs: Array; }; export class AbstractProvider implements Provider { - #subs: Map; - #plugins: Map; - - // null=unpaused, true=paused+dropWhilePaused, false=paused - #pausedState: null | boolean; - - #networkPromise: null | Promise; - readonly #anyNetwork: boolean; - - #performCache: Map>; - - // The most recent block number if running an event or -1 if no "block" event - #lastBlockNumber: number; - - #nextTimer: number; - #timers: Map void; time: number }>; - - #disableCcipRead: boolean; - - // @TODO: This should be a () => Promise so network can be - // done when needed; or rely entirely on _detectNetwork? - constructor(_network?: "any" | Networkish) { - if (_network === "any") { - this.#anyNetwork = true; - this.#networkPromise = null; - } else if (_network) { - const network = Network.from(_network); - this.#anyNetwork = false; - this.#networkPromise = Promise.resolve(network); - setTimeout(() => { - this.emit("network", network, null); - }, 0); - } else { - this.#anyNetwork = false; - this.#networkPromise = null; - } - - this.#lastBlockNumber = -1; - - this.#performCache = new Map(); - - this.#subs = new Map(); - this.#plugins = new Map(); - this.#pausedState = null; - - this.#nextTimer = 1; - this.#timers = new Map(); - - this.#disableCcipRead = false; - } - - get provider(): this { - return this; - } - - get plugins(): Array { - return Array.from(this.#plugins.values()); - } - - attachPlugin(plugin: AbstractProviderPlugin): this { - if (this.#plugins.get(plugin.name)) { - throw new Error(`cannot replace existing plugin: ${plugin.name} `); - } - this.#plugins.set(plugin.name, plugin.connect(this)); - return this; - } - - getPlugin( - name: string, - ): null | T { - return this.#plugins.get(name) || null; - } - - get disableCcipRead(): boolean { - return this.#disableCcipRead; - } - set disableCcipRead(value: boolean) { - this.#disableCcipRead = !!value; - } - - // Shares multiple identical requests made during the same 250ms - async #perform(req: PerformActionRequest): Promise { - // Create a tag - const tag = getTag(req.method, req); - - let perform = this.#performCache.get(tag); - if (!perform) { - perform = this._perform(req); - this.#performCache.set(tag, perform); - - setTimeout(() => { - if (this.#performCache.get(tag) === perform) { - this.#performCache.delete(tag); - } - }, 250); - } - - return await perform; - } - - async ccipReadFetch( - tx: PerformActionTransaction, - calldata: string, - urls: Array, - ): Promise { - if (this.disableCcipRead || urls.length === 0 || tx.to == null) { - return null; - } - - const sender = tx.to.toLowerCase(); - const data = calldata.toLowerCase(); - - const errorMessages: Array = []; - - for (let i = 0; i < urls.length; i++) { - const url = urls[i]; - - // URL expansion - const href = url.replace("{sender}", sender).replace("{data}", data); - - // If no {data} is present, use POST; otherwise GET - //const json: string | null = (url.indexOf("{data}") >= 0) ? null: JSON.stringify({ data, sender }); - - //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { - // value.status = response.statusCode; - // return value; - //}); - const request = new FetchRequest(href); - if (url.indexOf("{data}") === -1) { - request.body = { data, sender }; - } - - this.emit("debug", { - action: "sendCcipReadFetchRequest", - request, - index: i, - urls, - }); - - let errorMessage = "unknown error"; - - const resp = await request.send(); - try { - const result = resp.bodyJson; - if (result.data) { - this.emit("debug", { - action: "receiveCcipReadFetchResult", - request, - result, - }); - return result.data; - } - if (result.message) { - errorMessage = result.message; - } - this.emit("debug", { - action: "receiveCcipReadFetchError", - request, - result, - }); - } catch (error) {} - - // 4xx indicates the result is not present; stop - assert( - resp.statusCode < 400 || resp.statusCode >= 500, - `response not found during CCIP fetch: ${errorMessage}`, - "OFFCHAIN_FAULT", - { - reason: "404_MISSING_RESOURCE", - transaction: tx, - info: { url, errorMessage }, - }, - ); - - // 5xx indicates server issue; try the next url - errorMessages.push(errorMessage); - } - - assert( - false, - `error encountered during CCIP fetch: ${errorMessages - .map((m) => JSON.stringify(m)) - .join(", ")}`, - "OFFCHAIN_FAULT", - { - reason: "500_SERVER_ERROR", - transaction: tx, - info: { urls, errorMessages }, - }, - ); - } - - _wrapBlock(value: BlockParams, network: Network): Block { - return new Block(formatBlock(value), this); - } - - _wrapLog(value: LogParams, network: Network): Log { - return new Log(formatLog(value), this); - } - - _wrapTransactionReceipt( - value: TransactionReceiptParams, - network: Network, - ): TransactionReceipt { - return new TransactionReceipt(formatTransactionReceipt(value), this); - } - - _wrapTransactionResponse( - tx: TransactionResponseParams, - network: Network, - ): TransactionResponse { - return new TransactionResponse(formatTransactionResponse(tx), this); - } - - _detectNetwork(): Promise { - assert(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", { - operation: "_detectNetwork", - }); - } - - // Sub-classes should override this and handle PerformActionRequest requests, calling - // the super for any unhandled actions. - async _perform(req: PerformActionRequest): Promise { - assert( - false, - `unsupported method: ${req.method}`, - "UNSUPPORTED_OPERATION", - { - operation: req.method, - info: req, - }, - ); - } - - // State - async getBlockNumber(): Promise { - const blockNumber = getNumber( - await this.#perform({ method: "getBlockNumber" }), - "%response", - ); - if (this.#lastBlockNumber >= 0) { - this.#lastBlockNumber = blockNumber; - } - return blockNumber; - } - - _getAddress(address: AddressLike): string | Promise { - return resolveAddress(address); - } - - _getBlockTag(blockTag?: BlockTag): string | Promise { - if (blockTag == null) { - return "latest"; - } - - switch (blockTag) { - case "earliest": - return "0x0"; - case "latest": - case "pending": - case "safe": - case "finalized": - return blockTag; - } - - if (isHexString(blockTag)) { - if (isHexString(blockTag, 32)) { - return blockTag; - } - return toQuantity(blockTag); - } - - if (typeof blockTag === "bigint") { - blockTag = getNumber(blockTag, "blockTag"); - } - - if (typeof blockTag === "number") { - if (blockTag >= 0) { - return toQuantity(blockTag); - } - if (this.#lastBlockNumber >= 0) { - return toQuantity(this.#lastBlockNumber + blockTag); - } - return this.getBlockNumber().then((b) => - toQuantity(b + blockTag), - ); - } - - assertArgument(false, "invalid blockTag", "blockTag", blockTag); - } - - _getFilter( - filter: Filter | FilterByBlockHash, - ): PerformActionFilter | Promise { - // Create a canonical representation of the topics - const topics = (filter.topics || []).map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - return concisify(t.map((t) => t.toLowerCase())); - } - return t.toLowerCase(); - }); - - const blockHash = "blockHash" in filter ? filter.blockHash : undefined; - - const resolve = ( - _address: Array, - fromBlock?: string, - toBlock?: string, - ) => { - let address: undefined | string | Array = undefined; - switch (_address.length) { - case 0: - break; - case 1: - address = _address[0]; - break; - default: - _address.sort(); - address = _address; - } - - if (blockHash) { - if (fromBlock != null || toBlock != null) { - throw new Error("invalid filter"); - } - } - - const filter = {}; - if (address) { - filter.address = address; - } - if (topics.length) { - filter.topics = topics; - } - if (fromBlock) { - filter.fromBlock = fromBlock; - } - if (toBlock) { - filter.toBlock = toBlock; - } - if (blockHash) { - filter.blockHash = blockHash; - } - - return filter; - }; - - // Addresses could be async (ENS names or Addressables) - let address: Array> = []; - if (filter.address) { - if (Array.isArray(filter.address)) { - for (const addr of filter.address) { - address.push(this._getAddress(addr)); - } - } else { - address.push(this._getAddress(filter.address)); - } - } - - let fromBlock: undefined | string | Promise = undefined; - if ("fromBlock" in filter) { - fromBlock = this._getBlockTag(filter.fromBlock); - } - - let toBlock: undefined | string | Promise = undefined; - if ("toBlock" in filter) { - toBlock = this._getBlockTag(filter.toBlock); - } - - if ( - address.filter((a) => typeof a !== "string").length || - (fromBlock != null && typeof fromBlock !== "string") || - (toBlock != null && typeof toBlock !== "string") - ) { - return Promise.all([Promise.all(address), fromBlock, toBlock]).then( - (result) => { - return resolve(result[0], result[1], result[2]); - }, - ); - } - - return resolve(>address, fromBlock, toBlock); - } - - _getTransactionRequest( - _request: TransactionRequest, - ): PerformActionTransaction | Promise { - const request = copyRequest(_request); - - const promises: Array> = []; - ["to", "from"].forEach((key) => { - if ((request)[key] == null) { - return; - } - - const addr = resolveAddress((request)[key]); - if (isPromise(addr)) { - promises.push( - (async function () { - (request)[key] = await addr; - })(), - ); - } else { - (request)[key] = addr; - } - }); - - if (request.blockTag != null) { - const blockTag = this._getBlockTag(request.blockTag); - if (isPromise(blockTag)) { - promises.push( - (async function () { - request.blockTag = await blockTag; - })(), - ); - } else { - request.blockTag = blockTag; - } - } - - if (promises.length) { - return (async function () { - await Promise.all(promises); - return request; - })(); - } - - return request; - } - - async getNetwork(): Promise { - // No explicit network was set and this is our first time - if (this.#networkPromise == null) { - // Detect the current network (shared with all calls) - const detectNetwork = this._detectNetwork().then( - (network) => { - this.emit("network", network, null); - return network; - }, - (error) => { - // Reset the networkPromise on failure, so we will try again - if (this.#networkPromise === detectNetwork) { - this.#networkPromise = null; - } - throw error; - }, - ); - - this.#networkPromise = detectNetwork; - return (await detectNetwork).clone(); - } - - const networkPromise = this.#networkPromise; - - const [expected, actual] = await Promise.all([ - networkPromise, // Possibly an explicit Network - this._detectNetwork(), // The actual connected network - ]); - - if (expected.networkId !== actual.networkId) { - if (this.#anyNetwork) { - // The "any" network can change, so notify listeners - this.emit("network", actual, expected); - - // Update the network if something else hasn't already changed it - if (this.#networkPromise === networkPromise) { - this.#networkPromise = Promise.resolve(actual); - } - } else { - // Otherwise, we do not allow changes to the underlying network - assert( - false, - `network changed: ${expected.networkId} => ${actual.networkId} `, - "NETWORK_ERROR", - { - event: "changed", - }, - ); - } - } - - return expected.clone(); - } - async getEnergyPrice(): Promise { - const { energyPrice } = await resolveProperties({ - block: this.getBlock("latest"), - energyPrice: (async () => { - try { - const energyPrice = await this.#perform({ method: "getEnergyPrice" }); - return getBigInt(energyPrice, "%response"); - } catch (error) {} - return null; - })(), - }); - return new FeeData(energyPrice); - } - - async getFeeData(): Promise { - const { energyPrice } = await resolveProperties({ - block: this.getBlock("latest"), - energyPrice: (async () => { - try { - const energyPrice = await this.#perform({ method: "getEnergyPrice" }); - return getBigInt(energyPrice, "%response"); - } catch (error) {} - return null; - })(), - }); - return new FeeData(energyPrice); - } - - async estimateEnergy(_tx: TransactionRequest): Promise { - let tx = this._getTransactionRequest(_tx); - if (isPromise(tx)) { - tx = await tx; - } - return getBigInt( - await this.#perform({ - method: "estimateEnergy", - transaction: tx, - }), - "%response", - ); - } - - async #call( - tx: PerformActionTransaction, - blockTag: string, - attempt: number, - ): Promise { - assert( - attempt < MAX_CCIP_REDIRECTS, - "CCIP read exceeded maximum redirections", - "OFFCHAIN_FAULT", - { - reason: "TOO_MANY_REDIRECTS", - transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }), - }, - ); - - // This came in as a PerformActionTransaction, so to/from are safe; we can cast - const transaction = copyRequest(tx); - - try { - return hexlify( - await this._perform({ method: "call", transaction, blockTag }), - ); - } catch (error) { - // CCIP Read OffchainLookup - if ( - !this.disableCcipRead && - isCallException(error) && - error.data && - attempt >= 0 && - blockTag === "latest" && - transaction.to != null && - dataSlice(error.data, 0, 4) === "0x556f1830" - ) { - const data = error.data; - - const txSender = await resolveAddress(transaction.to); - - // Parse the CCIP Read Arguments - let ccipArgs: CcipArgs; - try { - ccipArgs = parseOffchainLookup(dataSlice(error.data, 4)); - } catch (error: any) { - assert(false, error.message, "OFFCHAIN_FAULT", { - reason: "BAD_DATA", - transaction, - info: { data }, - }); - } - - // Check the sender of the OffchainLookup matches the transaction - assert( - ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), - "CCIP Read sender mismatch", - "CALL_EXCEPTION", - { - action: "call", - data, - reason: "OffchainLookup", - transaction: transaction, // @TODO: populate data? - invocation: null, - revert: { - signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", - name: "OffchainLookup", - args: ccipArgs.errorArgs, - }, - }, - ); - - const ccipResult = await this.ccipReadFetch( - transaction, - ccipArgs.calldata, - ccipArgs.urls, - ); - assert( - ccipResult != null, - "CCIP Read failed to fetch data", - "OFFCHAIN_FAULT", - { - reason: "FETCH_FAILED", - transaction, - info: { data: error.data, errorArgs: ccipArgs.errorArgs }, - }, - ); - - const tx = { - to: txSender, - data: concat([ - ccipArgs.selector, - encodeBytes([ccipResult, ccipArgs.extraData]), - ]) as string, - }; - - this.emit("debug", { action: "sendCcipReadCall", transaction: tx }); - try { - const result = await this.#call(tx, blockTag, attempt + 1); - this.emit("debug", { - action: "receiveCcipReadCallResult", - transaction: Object.assign({}, tx), - result, - }); - return result; - } catch (error) { - this.emit("debug", { - action: "receiveCcipReadCallError", - transaction: Object.assign({}, tx), - error, - }); - throw error; - } - } - - throw error; - } - } - - async #checkNetwork(promise: Promise): Promise { - const { value } = await resolveProperties({ - network: this.getNetwork(), - value: promise, - }); - return value; - } - - async call(_tx: TransactionRequest): Promise { - const { tx, blockTag } = await resolveProperties({ - tx: this._getTransactionRequest(_tx), - blockTag: this._getBlockTag(_tx.blockTag), - }); - return await this.#checkNetwork( - this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1), - ); - } - - // Account - async #getAccountValue( - request: _PerformAccountRequest, - _address: AddressLike, - _blockTag?: BlockTag, - ): Promise { - let address: string | Promise = this._getAddress(_address); - let blockTag: string | Promise = this._getBlockTag(_blockTag); - if (typeof address !== "string" || typeof blockTag !== "string") { - [address, blockTag] = await Promise.all([address, blockTag]); - } - - return await this.#checkNetwork( - this.#perform(Object.assign(request, { address, blockTag })), - ); - } - - async getBalance(address: AddressLike, blockTag?: BlockTag): Promise { - return getBigInt( - await this.#getAccountValue({ method: "getBalance" }, address, blockTag), - "%response", - ); - } - - async getTransactionCount( - address: AddressLike, - blockTag?: BlockTag, - ): Promise { - return getNumber( - await this.#getAccountValue( - { method: "getTransactionCount" }, - address, - blockTag, - ), - "%response", - ); - } - - async getCode(address: AddressLike, blockTag?: BlockTag): Promise { - return hexlify( - await this.#getAccountValue({ method: "getCode" }, address, blockTag), - ); - } - - async getStorage( - address: AddressLike, - _position: BigNumberish, - blockTag?: BlockTag, - ): Promise { - const position = getBigInt(_position, "position"); - return hexlify( - await this.#getAccountValue( - { method: "getStorage", position }, - address, - blockTag, - ), - ); - } - - // Write - async broadcastTransaction(signedTx: string): Promise { - const { blockNumber, hash, network } = await resolveProperties({ - blockNumber: this.getBlockNumber(), - hash: this._perform({ - method: "broadcastTransaction", - signedTransaction: signedTx, - }), - network: this.getNetwork(), - }); - - const tx = Transaction.from(signedTx); - if (tx.hash !== hash) { - throw new Error("@TODO: the returned hash did not match"); - } - - return this._wrapTransactionResponse( - tx, - network, - ).replaceableTransaction(blockNumber); - } - - async #getBlock( - block: BlockTag | string, - includeTransactions: boolean, - ): Promise { - // @TODO: Add CustomBlockPlugin check - - if (isHexString(block, 32)) { - return await this.#perform({ - method: "getBlock", - blockHash: block, - includeTransactions, - }); - } - - let blockTag = this._getBlockTag(block); - if (typeof blockTag !== "string") { - blockTag = await blockTag; - } - - return await this.#perform({ - method: "getBlock", - blockTag, - includeTransactions, - }); - } - - // Queries - async getBlock( - block: BlockTag | string, - prefetchTxs?: boolean, - ): Promise { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#getBlock(block, !!prefetchTxs), - }); - if (params == null) { - return null; - } - - return this._wrapBlock(params, network); - } - - async getTransaction(hash: string): Promise { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#perform({ method: "getTransaction", hash }), - }); - if (params == null) { - return null; - } - - return this._wrapTransactionResponse(params, network); - } - - async getTransactionReceipt( - hash: string, - ): Promise { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#perform({ method: "getTransactionReceipt", hash }), - }); - if (params == null) { - return null; - } - - // Some backends did not backfill the effectiveEnergyPrice into old transactions - // in the receipt, so we look it up manually and inject it. - if (params.energyPrice == null && params.effectiveEnergyPrice == null) { - const tx = await this.#perform({ method: "getTransaction", hash }); - if (tx == null) { - throw new Error( - "report this; could not find tx or effectiveEnergyPrice", - ); - } - params.effectiveEnergyPrice = tx.energyPrice; - } - - return this._wrapTransactionReceipt(params, network); - } - - async getTransactionResult(hash: string): Promise { - const { result } = await resolveProperties({ - network: this.getNetwork(), - result: this.#perform({ method: "getTransactionResult", hash }), - }); - if (result == null) { - return null; - } - return hexlify(result); - } - - // Bloom-filter Queries - async getLogs(_filter: Filter | FilterByBlockHash): Promise> { - let filter = this._getFilter(_filter); - if (isPromise(filter)) { - filter = await filter; - } - - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: this.#perform>({ method: "getLogs", filter }), - }); - - return params.map((p) => this._wrapLog(p, network)); - } - - // ENS - _getProvider(networkId: number): AbstractProvider { - assert( - false, - "provider cannot connect to target network", - "UNSUPPORTED_OPERATION", - { - operation: "_getProvider()", - }, - ); - } - - async waitForTransaction( - hash: string, - _confirms?: null | number, - timeout?: null | number, - ): Promise { - const confirms = _confirms != null ? _confirms : 1; - if (confirms === 0) { - return this.getTransactionReceipt(hash); - } - - return new Promise(async (resolve, reject) => { - let timer: null | Timer = null; - - const listener = async (blockNumber: number) => { - try { - const receipt = await this.getTransactionReceipt(hash); - if (receipt != null) { - if (blockNumber - receipt.blockNumber + 1 >= confirms) { - resolve(receipt); - //this.off("block", listener); - if (timer) { - clearTimeout(timer); - timer = null; - } - return; - } - } - } catch (error) { - console.log("EEE", error); - } - this.once("block", listener); - }; - - if (timeout != null) { - timer = setTimeout(() => { - if (timer == null) { - return; - } - timer = null; - this.off("block", listener); - reject(makeError("timeout", "TIMEOUT", { reason: "timeout" })); - }, timeout); - } - - listener(await this.getBlockNumber()); - }); - } - - async waitForBlock(blockTag?: BlockTag): Promise { - assert(false, "not implemented yet", "NOT_IMPLEMENTED", { - operation: "waitForBlock", - }); - } - - _clearTimeout(timerId: number): void { - const timer = this.#timers.get(timerId); - if (!timer) { - return; - } - if (timer.timer) { - clearTimeout(timer.timer); - } - this.#timers.delete(timerId); - } - - _setTimeout(_func: () => void, timeout?: number): number { - if (timeout == null) { - timeout = 0; - } - const timerId = this.#nextTimer++; - const func = () => { - this.#timers.delete(timerId); - _func(); - }; - - if (this.paused) { - this.#timers.set(timerId, { timer: null, func, time: timeout }); - } else { - const timer = setTimeout(func, timeout); - this.#timers.set(timerId, { timer, func, time: getTime() }); - } - - return timerId; - } - - _forEachSubscriber(func: (s: Subscriber) => void): void { - for (const sub of this.#subs.values()) { - func(sub.subscriber); - } - } - - // Event API; sub-classes should override this; any supported - // event filter will have been munged into an EventFilter - _getSubscriber(sub: Subscription): Subscriber { - switch (sub.type) { - case "debug": - case "error": - case "network": - return new UnmanagedSubscriber(sub.type); - case "block": - return new PollingBlockSubscriber(this); - case "event": - return new PollingEventSubscriber(this, sub.filter); - case "transaction": - return new PollingTransactionSubscriber(this, sub.hash); - case "orphan": - return new PollingOrphanSubscriber(this, sub.filter); - } - - throw new Error(`unsupported event: ${sub.type}`); - } - - _recoverSubscriber(oldSub: Subscriber, newSub: Subscriber): void { - for (const sub of this.#subs.values()) { - if (sub.subscriber === oldSub) { - if (sub.started) { - sub.subscriber.stop(); - } - sub.subscriber = newSub; - if (sub.started) { - newSub.start(); - } - if (this.#pausedState != null) { - newSub.pause(this.#pausedState); - } - break; - } - } - } - - async #hasSub( - event: ProviderEvent, - emitArgs?: Array, - ): Promise { - let sub = await getSubscription(event, this); - // This is a log that is removing an existing log; we actually want - // to emit an orphan event for the removed log - if ( - sub.type === "event" && - emitArgs && - emitArgs.length > 0 && - emitArgs[0].removed === true - ) { - sub = await getSubscription( - { orphan: "drop-log", log: emitArgs[0] }, - this, - ); - } - return this.#subs.get(sub.tag) || null; - } - - async #getSub(event: ProviderEvent): Promise { - const subscription = await getSubscription(event, this); - - // Prevent tampering with our tag in any subclass' _getSubscriber - const tag = subscription.tag; - - let sub = this.#subs.get(tag); - if (!sub) { - const subscriber = this._getSubscriber(subscription); - - const addressableMap = new WeakMap(); - const nameMap = new Map(); - sub = { - subscriber, - tag, - addressableMap, - nameMap, - started: false, - listeners: [], - }; - this.#subs.set(tag, sub); - } - - return sub; - } - - async on(event: ProviderEvent, listener: Listener): Promise { - const sub = await this.#getSub(event); - sub.listeners.push({ listener, once: false }); - if (!sub.started) { - sub.subscriber.start(); - sub.started = true; - if (this.#pausedState != null) { - sub.subscriber.pause(this.#pausedState); - } - } - return this; - } - - async once(event: ProviderEvent, listener: Listener): Promise { - const sub = await this.#getSub(event); - sub.listeners.push({ listener, once: true }); - if (!sub.started) { - sub.subscriber.start(); - sub.started = true; - if (this.#pausedState != null) { - sub.subscriber.pause(this.#pausedState); - } - } - return this; - } - - async emit(event: ProviderEvent, ...args: Array): Promise { - const sub = await this.#hasSub(event, args); - // If there is not subscription or if a recent emit removed - // the last of them (which also deleted the sub) do nothing - if (!sub || sub.listeners.length === 0) { - return false; - } - - const count = sub.listeners.length; - sub.listeners = sub.listeners.filter(({ listener, once }) => { - const payload = new EventPayload(this, once ? null : listener, event); - try { - listener.call(this, ...args, payload); - } catch (error) {} - return !once; - }); - - if (sub.listeners.length === 0) { - if (sub.started) { - sub.subscriber.stop(); - } - this.#subs.delete(sub.tag); - } - - return count > 0; - } - - async listenerCount(event?: ProviderEvent): Promise { - if (event) { - const sub = await this.#hasSub(event); - if (!sub) { - return 0; - } - return sub.listeners.length; - } - - let total = 0; - for (const { listeners } of this.#subs.values()) { - total += listeners.length; - } - return total; - } - - async listeners(event?: ProviderEvent): Promise> { - if (event) { - const sub = await this.#hasSub(event); - if (!sub) { - return []; - } - return sub.listeners.map(({ listener }) => listener); - } - let result: Array = []; - for (const { listeners } of this.#subs.values()) { - result = result.concat(listeners.map(({ listener }) => listener)); - } - return result; - } - - async off(event: ProviderEvent, listener?: Listener): Promise { - const sub = await this.#hasSub(event); - if (!sub) { - return this; - } - - if (listener) { - const index = sub.listeners - .map(({ listener }) => listener) - .indexOf(listener); - if (index >= 0) { - sub.listeners.splice(index, 1); - } - } - - if (!listener || sub.listeners.length === 0) { - if (sub.started) { - sub.subscriber.stop(); - } - this.#subs.delete(sub.tag); - } - - return this; - } - - async removeAllListeners(event?: ProviderEvent): Promise { - if (event) { - const { tag, started, subscriber } = await this.#getSub(event); - if (started) { - subscriber.stop(); - } - this.#subs.delete(tag); - } else { - for (const [tag, { started, subscriber }] of this.#subs) { - if (started) { - subscriber.stop(); - } - this.#subs.delete(tag); - } - } - return this; - } - - // Alias for "on" - async addListener(event: ProviderEvent, listener: Listener): Promise { - return await this.on(event, listener); - } - - // Alias for "off" - async removeListener( - event: ProviderEvent, - listener: Listener, - ): Promise { - return this.off(event, listener); - } - - // Sub-classes should override this to shutdown any sockets, etc. - // but MUST call this super.shutdown. - destroy(): void { - // Stop all listeners - this.removeAllListeners(); - - // Shut down all tiemrs - for (const timerId of this.#timers.keys()) { - this._clearTimeout(timerId); - } - } - - get paused(): boolean { - return this.#pausedState != null; - } - set paused(pause: boolean) { - if (!!pause === this.paused) { - return; - } - - if (this.paused) { - this.resume(); - } else { - this.pause(false); - } - } - - pause(dropWhilePaused?: boolean): void { - this.#lastBlockNumber = -1; - - if (this.#pausedState != null) { - if (this.#pausedState == !!dropWhilePaused) { - return; - } - assert( - false, - "cannot change pause type; resume first", - "UNSUPPORTED_OPERATION", - { - operation: "pause", - }, - ); - } - - this._forEachSubscriber((s) => s.pause(dropWhilePaused)); - this.#pausedState = !!dropWhilePaused; - - for (const timer of this.#timers.values()) { - // Clear the timer - if (timer.timer) { - clearTimeout(timer.timer); - } - - // Remaining time needed for when we become unpaused - timer.time = getTime() - timer.time; - } - } - - resume(): void { - if (this.#pausedState == null) { - return; - } - - this._forEachSubscriber((s) => s.resume()); - this.#pausedState = null; - for (const timer of this.#timers.values()) { - // Remaining time when we were paused - let timeout = timer.time; - if (timeout < 0) { - timeout = 0; - } - - // Start time (in cause paused, so we con compute remaininf time) - timer.time = getTime(); - - // Start the timer - setTimeout(timer.func, timeout); - } - } + #subs: Map; + #plugins: Map; + + // null=unpaused, true=paused+dropWhilePaused, false=paused + #pausedState: null | boolean; + + #networkPromise: null | Promise; + readonly #anyNetwork: boolean; + + #performCache: Map>; + + // The most recent block number if running an event or -1 if no "block" event + #lastBlockNumber: number; + + #nextTimer: number; + #timers: Map void; time: number }>; + + #disableCcipRead: boolean; + + // @TODO: This should be a () => Promise so network can be + // done when needed; or rely entirely on _detectNetwork? + constructor(_network?: "any" | Networkish) { + if (_network === "any") { + this.#anyNetwork = true; + this.#networkPromise = null; + } else if (_network) { + const network = Network.from(_network); + this.#anyNetwork = false; + this.#networkPromise = Promise.resolve(network); + setTimeout(() => { + this.emit("network", network, null); + }, 0); + } else { + this.#anyNetwork = false; + this.#networkPromise = null; + } + + this.#lastBlockNumber = -1; + + this.#performCache = new Map(); + + this.#subs = new Map(); + this.#plugins = new Map(); + this.#pausedState = null; + + this.#nextTimer = 1; + this.#timers = new Map(); + + this.#disableCcipRead = false; + } + + get provider(): this { + return this; + } + + get plugins(): Array { + return Array.from(this.#plugins.values()); + } + + attachPlugin(plugin: AbstractProviderPlugin): this { + if (this.#plugins.get(plugin.name)) { + throw new Error(`cannot replace existing plugin: ${plugin.name} `); + } + this.#plugins.set(plugin.name, plugin.connect(this)); + return this; + } + + getPlugin( + name: string, + ): null | T { + return this.#plugins.get(name) || null; + } + + get disableCcipRead(): boolean { + return this.#disableCcipRead; + } + set disableCcipRead(value: boolean) { + this.#disableCcipRead = !!value; + } + + // Shares multiple identical requests made during the same 250ms + async #perform(req: PerformActionRequest): Promise { + // Create a tag + const tag = getTag(req.method, req); + + let perform = this.#performCache.get(tag); + if (!perform) { + perform = this._perform(req); + this.#performCache.set(tag, perform); + + setTimeout(() => { + if (this.#performCache.get(tag) === perform) { + this.#performCache.delete(tag); + } + }, 250); + } + + return await perform; + } + + async ccipReadFetch( + tx: PerformActionTransaction, + calldata: string, + urls: Array, + ): Promise { + if (this.disableCcipRead || urls.length === 0 || tx.to == null) { + return null; + } + + const sender = tx.to.toLowerCase(); + const data = calldata.toLowerCase(); + + const errorMessages: Array = []; + + for (let i = 0; i < urls.length; i++) { + const url = urls[i]; + + // URL expansion + const href = url.replace("{sender}", sender).replace("{data}", data); + + // If no {data} is present, use POST; otherwise GET + //const json: string | null = (url.indexOf("{data}") >= 0) ? null: JSON.stringify({ data, sender }); + + //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { + // value.status = response.statusCode; + // return value; + //}); + const request = new FetchRequest(href); + if (url.indexOf("{data}") === -1) { + request.body = { data, sender }; + } + + this.emit("debug", { + action: "sendCcipReadFetchRequest", + request, + index: i, + urls, + }); + + let errorMessage = "unknown error"; + + const resp = await request.send(); + try { + const result = resp.bodyJson; + if (result.data) { + this.emit("debug", { + action: "receiveCcipReadFetchResult", + request, + result, + }); + return result.data; + } + if (result.message) { + errorMessage = result.message; + } + this.emit("debug", { + action: "receiveCcipReadFetchError", + request, + result, + }); + } catch (error) {} + + // 4xx indicates the result is not present; stop + assert( + resp.statusCode < 400 || resp.statusCode >= 500, + `response not found during CCIP fetch: ${errorMessage}`, + "OFFCHAIN_FAULT", + { + reason: "404_MISSING_RESOURCE", + transaction: tx, + info: { url, errorMessage }, + }, + ); + + // 5xx indicates server issue; try the next url + errorMessages.push(errorMessage); + } + + assert( + false, + `error encountered during CCIP fetch: ${errorMessages + .map((m) => JSON.stringify(m)) + .join(", ")}`, + "OFFCHAIN_FAULT", + { + reason: "500_SERVER_ERROR", + transaction: tx, + info: { urls, errorMessages }, + }, + ); + } + + _wrapBlock(value: BlockParams, network: Network): Block { + return new Block(formatBlock(value), this); + } + + _wrapLog(value: LogParams, network: Network): Log { + return new Log(formatLog(value), this); + } + + _wrapTransactionReceipt( + value: TransactionReceiptParams, + network: Network, + ): TransactionReceipt { + return new TransactionReceipt(formatTransactionReceipt(value), this); + } + + _wrapTransactionResponse( + tx: TransactionResponseParams, + network: Network, + ): TransactionResponse { + return new TransactionResponse(formatTransactionResponse(tx), this); + } + + _detectNetwork(): Promise { + assert(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", { + operation: "_detectNetwork", + }); + } + + // Sub-classes should override this and handle PerformActionRequest requests, calling + // the super for any unhandled actions. + async _perform(req: PerformActionRequest): Promise { + assert( + false, + `unsupported method: ${req.method}`, + "UNSUPPORTED_OPERATION", + { + operation: req.method, + info: req, + }, + ); + } + + // State + async getBlockNumber(): Promise { + const blockNumber = getNumber( + await this.#perform({ method: "getBlockNumber" }), + "%response", + ); + if (this.#lastBlockNumber >= 0) { + this.#lastBlockNumber = blockNumber; + } + return blockNumber; + } + + _getAddress(address: AddressLike): string | Promise { + return resolveAddress(address); + } + + _getBlockTag(blockTag?: BlockTag): string | Promise { + if (blockTag == null) { + return "latest"; + } + + switch (blockTag) { + case "earliest": + return "0x0"; + case "latest": + case "pending": + case "safe": + case "finalized": + return blockTag; + } + + if (isHexString(blockTag)) { + if (isHexString(blockTag, 32)) { + return blockTag; + } + return toQuantity(blockTag); + } + + if (typeof blockTag === "bigint") { + blockTag = getNumber(blockTag, "blockTag"); + } + + if (typeof blockTag === "number") { + if (blockTag >= 0) { + return toQuantity(blockTag); + } + if (this.#lastBlockNumber >= 0) { + return toQuantity(this.#lastBlockNumber + blockTag); + } + return this.getBlockNumber().then((b) => + toQuantity(b + blockTag), + ); + } + + assertArgument(false, "invalid blockTag", "blockTag", blockTag); + } + + _getFilter( + filter: Filter | FilterByBlockHash, + ): PerformActionFilter | Promise { + // Create a canonical representation of the topics + const topics = (filter.topics || []).map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + return concisify(t.map((t) => t.toLowerCase())); + } + return t.toLowerCase(); + }); + + const blockHash = "blockHash" in filter ? filter.blockHash : undefined; + + const resolve = ( + _address: Array, + fromBlock?: string, + toBlock?: string, + ) => { + let address: undefined | string | Array = undefined; + switch (_address.length) { + case 0: + break; + case 1: + address = _address[0]; + break; + default: + _address.sort(); + address = _address; + } + + if (blockHash) { + if (fromBlock != null || toBlock != null) { + throw new Error("invalid filter"); + } + } + + const filter = {}; + if (address) { + filter.address = address; + } + if (topics.length) { + filter.topics = topics; + } + if (fromBlock) { + filter.fromBlock = fromBlock; + } + if (toBlock) { + filter.toBlock = toBlock; + } + if (blockHash) { + filter.blockHash = blockHash; + } + + return filter; + }; + + // Addresses could be async (ENS names or Addressables) + let address: Array> = []; + if (filter.address) { + if (Array.isArray(filter.address)) { + for (const addr of filter.address) { + address.push(this._getAddress(addr)); + } + } else { + address.push(this._getAddress(filter.address)); + } + } + + let fromBlock: undefined | string | Promise = undefined; + if ("fromBlock" in filter) { + fromBlock = this._getBlockTag(filter.fromBlock); + } + + let toBlock: undefined | string | Promise = undefined; + if ("toBlock" in filter) { + toBlock = this._getBlockTag(filter.toBlock); + } + + if ( + address.filter((a) => typeof a !== "string").length || + (fromBlock != null && typeof fromBlock !== "string") || + (toBlock != null && typeof toBlock !== "string") + ) { + return Promise.all([Promise.all(address), fromBlock, toBlock]).then( + (result) => { + return resolve(result[0], result[1], result[2]); + }, + ); + } + + return resolve(>address, fromBlock, toBlock); + } + + _getTransactionRequest( + _request: TransactionRequest, + ): PerformActionTransaction | Promise { + const request = copyRequest(_request); + + const promises: Array> = []; + ["to", "from"].forEach((key) => { + if ((request)[key] == null) { + return; + } + + const addr = resolveAddress((request)[key]); + if (isPromise(addr)) { + promises.push( + (async function () { + (request)[key] = await addr; + })(), + ); + } else { + (request)[key] = addr; + } + }); + + if (request.blockTag != null) { + const blockTag = this._getBlockTag(request.blockTag); + if (isPromise(blockTag)) { + promises.push( + (async function () { + request.blockTag = await blockTag; + })(), + ); + } else { + request.blockTag = blockTag; + } + } + + if (promises.length) { + return (async function () { + await Promise.all(promises); + return request; + })(); + } + + return request; + } + + async getNetwork(): Promise { + // No explicit network was set and this is our first time + if (this.#networkPromise == null) { + // Detect the current network (shared with all calls) + const detectNetwork = this._detectNetwork().then( + (network) => { + this.emit("network", network, null); + return network; + }, + (error) => { + // Reset the networkPromise on failure, so we will try again + if (this.#networkPromise === detectNetwork) { + this.#networkPromise = null; + } + throw error; + }, + ); + + this.#networkPromise = detectNetwork; + return (await detectNetwork).clone(); + } + + const networkPromise = this.#networkPromise; + + const [expected, actual] = await Promise.all([ + networkPromise, // Possibly an explicit Network + this._detectNetwork(), // The actual connected network + ]); + + if (expected.networkId !== actual.networkId) { + if (this.#anyNetwork) { + // The "any" network can change, so notify listeners + this.emit("network", actual, expected); + + // Update the network if something else hasn't already changed it + if (this.#networkPromise === networkPromise) { + this.#networkPromise = Promise.resolve(actual); + } + } else { + // Otherwise, we do not allow changes to the underlying network + assert( + false, + `network changed: ${expected.networkId} => ${actual.networkId} `, + "NETWORK_ERROR", + { + event: "changed", + }, + ); + } + } + + return expected.clone(); + } + async getEnergyPrice(): Promise { + const { energyPrice } = await resolveProperties({ + block: this.getBlock("latest"), + energyPrice: (async () => { + try { + const energyPrice = await this.#perform({ method: "getEnergyPrice" }); + return getBigInt(energyPrice, "%response"); + } catch (error) {} + return null; + })(), + }); + return new FeeData(energyPrice); + } + + async getFeeData(): Promise { + const { energyPrice } = await resolveProperties({ + block: this.getBlock("latest"), + energyPrice: (async () => { + try { + const energyPrice = await this.#perform({ method: "getEnergyPrice" }); + return getBigInt(energyPrice, "%response"); + } catch (error) {} + return null; + })(), + }); + return new FeeData(energyPrice); + } + + async estimateEnergy(_tx: TransactionRequest): Promise { + let tx = this._getTransactionRequest(_tx); + if (isPromise(tx)) { + tx = await tx; + } + return getBigInt( + await this.#perform({ + method: "estimateEnergy", + transaction: tx, + }), + "%response", + ); + } + + async #call( + tx: PerformActionTransaction, + blockTag: string, + attempt: number, + ): Promise { + assert( + attempt < MAX_CCIP_REDIRECTS, + "CCIP read exceeded maximum redirections", + "OFFCHAIN_FAULT", + { + reason: "TOO_MANY_REDIRECTS", + transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }), + }, + ); + + // This came in as a PerformActionTransaction, so to/from are safe; we can cast + const transaction = copyRequest(tx); + + try { + return hexlify( + await this._perform({ method: "call", transaction, blockTag }), + ); + } catch (error) { + // CCIP Read OffchainLookup + if ( + !this.disableCcipRead && + isCallException(error) && + error.data && + attempt >= 0 && + blockTag === "latest" && + transaction.to != null && + dataSlice(error.data, 0, 4) === "0x556f1830" + ) { + const data = error.data; + + const txSender = await resolveAddress(transaction.to); + + // Parse the CCIP Read Arguments + let ccipArgs: CcipArgs; + try { + ccipArgs = parseOffchainLookup(dataSlice(error.data, 4)); + } catch (error: any) { + assert(false, error.message, "OFFCHAIN_FAULT", { + reason: "BAD_DATA", + transaction, + info: { data }, + }); + } + + // Check the sender of the OffchainLookup matches the transaction + assert( + ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), + "CCIP Read sender mismatch", + "CALL_EXCEPTION", + { + action: "call", + data, + reason: "OffchainLookup", + transaction: transaction, // @TODO: populate data? + invocation: null, + revert: { + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + name: "OffchainLookup", + args: ccipArgs.errorArgs, + }, + }, + ); + + const ccipResult = await this.ccipReadFetch( + transaction, + ccipArgs.calldata, + ccipArgs.urls, + ); + assert( + ccipResult != null, + "CCIP Read failed to fetch data", + "OFFCHAIN_FAULT", + { + reason: "FETCH_FAILED", + transaction, + info: { data: error.data, errorArgs: ccipArgs.errorArgs }, + }, + ); + + const tx = { + to: txSender, + data: concat([ + ccipArgs.selector, + encodeBytes([ccipResult, ccipArgs.extraData]), + ]) as string, + }; + + this.emit("debug", { action: "sendCcipReadCall", transaction: tx }); + try { + const result = await this.#call(tx, blockTag, attempt + 1); + this.emit("debug", { + action: "receiveCcipReadCallResult", + transaction: Object.assign({}, tx), + result, + }); + return result; + } catch (error) { + this.emit("debug", { + action: "receiveCcipReadCallError", + transaction: Object.assign({}, tx), + error, + }); + throw error; + } + } + + throw error; + } + } + + async #checkNetwork(promise: Promise): Promise { + const { value } = await resolveProperties({ + network: this.getNetwork(), + value: promise, + }); + return value; + } + + async call(_tx: TransactionRequest): Promise { + const { tx, blockTag } = await resolveProperties({ + tx: this._getTransactionRequest(_tx), + blockTag: this._getBlockTag(_tx.blockTag), + }); + return await this.#checkNetwork( + this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1), + ); + } + + // Account + async #getAccountValue( + request: _PerformAccountRequest, + _address: AddressLike, + _blockTag?: BlockTag, + ): Promise { + let address: string | Promise = this._getAddress(_address); + let blockTag: string | Promise = this._getBlockTag(_blockTag); + if (typeof address !== "string" || typeof blockTag !== "string") { + [address, blockTag] = await Promise.all([address, blockTag]); + } + + return await this.#checkNetwork( + this.#perform(Object.assign(request, { address, blockTag })), + ); + } + + async getBalance(address: AddressLike, blockTag?: BlockTag): Promise { + return getBigInt( + await this.#getAccountValue({ method: "getBalance" }, address, blockTag), + "%response", + ); + } + + async getTransactionCount( + address: AddressLike, + blockTag?: BlockTag, + ): Promise { + return getNumber( + await this.#getAccountValue( + { method: "getTransactionCount" }, + address, + blockTag, + ), + "%response", + ); + } + + async getCode(address: AddressLike, blockTag?: BlockTag): Promise { + return hexlify( + await this.#getAccountValue({ method: "getCode" }, address, blockTag), + ); + } + + async getStorage( + address: AddressLike, + _position: BigNumberish, + blockTag?: BlockTag, + ): Promise { + const position = getBigInt(_position, "position"); + return hexlify( + await this.#getAccountValue( + { method: "getStorage", position }, + address, + blockTag, + ), + ); + } + + // Write + async broadcastTransaction(signedTx: string): Promise { + const { blockNumber, hash, network } = await resolveProperties({ + blockNumber: this.getBlockNumber(), + hash: this._perform({ + method: "broadcastTransaction", + signedTransaction: signedTx, + }), + network: this.getNetwork(), + }); + + const tx = Transaction.from(signedTx); + if (tx.hash !== hash) { + throw new Error("@TODO: the returned hash did not match"); + } + + return this._wrapTransactionResponse( + tx, + network, + ).replaceableTransaction(blockNumber); + } + + async #getBlock( + block: BlockTag | string, + includeTransactions: boolean, + ): Promise { + // @TODO: Add CustomBlockPlugin check + + if (isHexString(block, 32)) { + return await this.#perform({ + method: "getBlock", + blockHash: block, + includeTransactions, + }); + } + + let blockTag = this._getBlockTag(block); + if (typeof blockTag !== "string") { + blockTag = await blockTag; + } + + return await this.#perform({ + method: "getBlock", + blockTag, + includeTransactions, + }); + } + + // Queries + async getBlock( + block: BlockTag | string, + prefetchTxs?: boolean, + ): Promise { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#getBlock(block, !!prefetchTxs), + }); + if (params == null) { + return null; + } + + return this._wrapBlock(params, network); + } + + async getTransaction(hash: string): Promise { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform({ method: "getTransaction", hash }), + }); + if (params == null) { + return null; + } + + return this._wrapTransactionResponse(params, network); + } + + async getTransactionReceipt( + hash: string, + ): Promise { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform({ method: "getTransactionReceipt", hash }), + }); + if (params == null) { + return null; + } + + // Some backends did not backfill the effectiveEnergyPrice into old transactions + // in the receipt, so we look it up manually and inject it. + if (params.energyPrice == null && params.effectiveEnergyPrice == null) { + const tx = await this.#perform({ method: "getTransaction", hash }); + if (tx == null) { + throw new Error( + "report this; could not find tx or effectiveEnergyPrice", + ); + } + params.effectiveEnergyPrice = tx.energyPrice; + } + + return this._wrapTransactionReceipt(params, network); + } + + async getTransactionResult(hash: string): Promise { + const { result } = await resolveProperties({ + network: this.getNetwork(), + result: this.#perform({ method: "getTransactionResult", hash }), + }); + if (result == null) { + return null; + } + return hexlify(result); + } + + // Bloom-filter Queries + async getLogs(_filter: Filter | FilterByBlockHash): Promise> { + let filter = this._getFilter(_filter); + if (isPromise(filter)) { + filter = await filter; + } + + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform>({ method: "getLogs", filter }), + }); + + return params.map((p) => this._wrapLog(p, network)); + } + + // ENS + _getProvider(networkId: number): AbstractProvider { + assert( + false, + "provider cannot connect to target network", + "UNSUPPORTED_OPERATION", + { + operation: "_getProvider()", + }, + ); + } + + async waitForTransaction( + hash: string, + _confirms?: null | number, + timeout?: null | number, + ): Promise { + const confirms = _confirms != null ? _confirms : 1; + if (confirms === 0) { + return this.getTransactionReceipt(hash); + } + + return new Promise(async (resolve, reject) => { + let timer: null | Timer = null; + + const listener = async (blockNumber: number) => { + try { + const receipt = await this.getTransactionReceipt(hash); + if (receipt != null) { + if (blockNumber - receipt.blockNumber + 1 >= confirms) { + resolve(receipt); + //this.off("block", listener); + if (timer) { + clearTimeout(timer); + timer = null; + } + return; + } + } + } catch (error) { + console.log("EEE", error); + } + this.once("block", listener); + }; + + if (timeout != null) { + timer = setTimeout(() => { + if (timer == null) { + return; + } + timer = null; + this.off("block", listener); + reject(makeError("timeout", "TIMEOUT", { reason: "timeout" })); + }, timeout); + } + + listener(await this.getBlockNumber()); + }); + } + + async waitForBlock(blockTag?: BlockTag): Promise { + assert(false, "not implemented yet", "NOT_IMPLEMENTED", { + operation: "waitForBlock", + }); + } + + _clearTimeout(timerId: number): void { + const timer = this.#timers.get(timerId); + if (!timer) { + return; + } + if (timer.timer) { + clearTimeout(timer.timer); + } + this.#timers.delete(timerId); + } + + _setTimeout(_func: () => void, timeout?: number): number { + if (timeout == null) { + timeout = 0; + } + const timerId = this.#nextTimer++; + const func = () => { + this.#timers.delete(timerId); + _func(); + }; + + if (this.paused) { + this.#timers.set(timerId, { timer: null, func, time: timeout }); + } else { + const timer = setTimeout(func, timeout); + this.#timers.set(timerId, { timer, func, time: getTime() }); + } + + return timerId; + } + + _forEachSubscriber(func: (s: Subscriber) => void): void { + for (const sub of this.#subs.values()) { + func(sub.subscriber); + } + } + + // Event API; sub-classes should override this; any supported + // event filter will have been munged into an EventFilter + _getSubscriber(sub: Subscription): Subscriber { + switch (sub.type) { + case "debug": + case "error": + case "network": + return new UnmanagedSubscriber(sub.type); + case "block": + return new PollingBlockSubscriber(this); + case "event": + return new PollingEventSubscriber(this, sub.filter); + case "transaction": + return new PollingTransactionSubscriber(this, sub.hash); + case "orphan": + return new PollingOrphanSubscriber(this, sub.filter); + } + + throw new Error(`unsupported event: ${sub.type}`); + } + + _recoverSubscriber(oldSub: Subscriber, newSub: Subscriber): void { + for (const sub of this.#subs.values()) { + if (sub.subscriber === oldSub) { + if (sub.started) { + sub.subscriber.stop(); + } + sub.subscriber = newSub; + if (sub.started) { + newSub.start(); + } + if (this.#pausedState != null) { + newSub.pause(this.#pausedState); + } + break; + } + } + } + + async #hasSub( + event: ProviderEvent, + emitArgs?: Array, + ): Promise { + let sub = await getSubscription(event, this); + // This is a log that is removing an existing log; we actually want + // to emit an orphan event for the removed log + if ( + sub.type === "event" && + emitArgs && + emitArgs.length > 0 && + emitArgs[0].removed === true + ) { + sub = await getSubscription( + { orphan: "drop-log", log: emitArgs[0] }, + this, + ); + } + return this.#subs.get(sub.tag) || null; + } + + async #getSub(event: ProviderEvent): Promise { + const subscription = await getSubscription(event, this); + + // Prevent tampering with our tag in any subclass' _getSubscriber + const tag = subscription.tag; + + let sub = this.#subs.get(tag); + if (!sub) { + const subscriber = this._getSubscriber(subscription); + + const addressableMap = new WeakMap(); + const nameMap = new Map(); + sub = { + subscriber, + tag, + addressableMap, + nameMap, + started: false, + listeners: [], + }; + this.#subs.set(tag, sub); + } + + return sub; + } + + async on(event: ProviderEvent, listener: Listener): Promise { + const sub = await this.#getSub(event); + sub.listeners.push({ listener, once: false }); + if (!sub.started) { + sub.subscriber.start(); + sub.started = true; + if (this.#pausedState != null) { + sub.subscriber.pause(this.#pausedState); + } + } + return this; + } + + async once(event: ProviderEvent, listener: Listener): Promise { + const sub = await this.#getSub(event); + sub.listeners.push({ listener, once: true }); + if (!sub.started) { + sub.subscriber.start(); + sub.started = true; + if (this.#pausedState != null) { + sub.subscriber.pause(this.#pausedState); + } + } + return this; + } + + async emit(event: ProviderEvent, ...args: Array): Promise { + const sub = await this.#hasSub(event, args); + // If there is not subscription or if a recent emit removed + // the last of them (which also deleted the sub) do nothing + if (!sub || sub.listeners.length === 0) { + return false; + } + + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const payload = new EventPayload(this, once ? null : listener, event); + try { + listener.call(this, ...args, payload); + } catch (error) {} + return !once; + }); + + if (sub.listeners.length === 0) { + if (sub.started) { + sub.subscriber.stop(); + } + this.#subs.delete(sub.tag); + } + + return count > 0; + } + + async listenerCount(event?: ProviderEvent): Promise { + if (event) { + const sub = await this.#hasSub(event); + if (!sub) { + return 0; + } + return sub.listeners.length; + } + + let total = 0; + for (const { listeners } of this.#subs.values()) { + total += listeners.length; + } + return total; + } + + async listeners(event?: ProviderEvent): Promise> { + if (event) { + const sub = await this.#hasSub(event); + if (!sub) { + return []; + } + return sub.listeners.map(({ listener }) => listener); + } + let result: Array = []; + for (const { listeners } of this.#subs.values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + } + + async off(event: ProviderEvent, listener?: Listener): Promise { + const sub = await this.#hasSub(event); + if (!sub) { + return this; + } + + if (listener) { + const index = sub.listeners + .map(({ listener }) => listener) + .indexOf(listener); + if (index >= 0) { + sub.listeners.splice(index, 1); + } + } + + if (!listener || sub.listeners.length === 0) { + if (sub.started) { + sub.subscriber.stop(); + } + this.#subs.delete(sub.tag); + } + + return this; + } + + async removeAllListeners(event?: ProviderEvent): Promise { + if (event) { + const { tag, started, subscriber } = await this.#getSub(event); + if (started) { + subscriber.stop(); + } + this.#subs.delete(tag); + } else { + for (const [tag, { started, subscriber }] of this.#subs) { + if (started) { + subscriber.stop(); + } + this.#subs.delete(tag); + } + } + return this; + } + + // Alias for "on" + async addListener(event: ProviderEvent, listener: Listener): Promise { + return await this.on(event, listener); + } + + // Alias for "off" + async removeListener( + event: ProviderEvent, + listener: Listener, + ): Promise { + return this.off(event, listener); + } + + // Sub-classes should override this to shutdown any sockets, etc. + // but MUST call this super.shutdown. + destroy(): void { + // Stop all listeners + this.removeAllListeners(); + + // Shut down all tiemrs + for (const timerId of this.#timers.keys()) { + this._clearTimeout(timerId); + } + } + + get paused(): boolean { + return this.#pausedState != null; + } + set paused(pause: boolean) { + if (!!pause === this.paused) { + return; + } + + if (this.paused) { + this.resume(); + } else { + this.pause(false); + } + } + + pause(dropWhilePaused?: boolean): void { + this.#lastBlockNumber = -1; + + if (this.#pausedState != null) { + if (this.#pausedState == !!dropWhilePaused) { + return; + } + assert( + false, + "cannot change pause type; resume first", + "UNSUPPORTED_OPERATION", + { + operation: "pause", + }, + ); + } + + this._forEachSubscriber((s) => s.pause(dropWhilePaused)); + this.#pausedState = !!dropWhilePaused; + + for (const timer of this.#timers.values()) { + // Clear the timer + if (timer.timer) { + clearTimeout(timer.timer); + } + + // Remaining time needed for when we become unpaused + timer.time = getTime() - timer.time; + } + } + + resume(): void { + if (this.#pausedState == null) { + return; + } + + this._forEachSubscriber((s) => s.resume()); + this.#pausedState = null; + for (const timer of this.#timers.values()) { + // Remaining time when we were paused + let timeout = timer.time; + if (timeout < 0) { + timeout = 0; + } + + // Start time (in cause paused, so we con compute remaininf time) + timer.time = getTime(); + + // Start the timer + setTimeout(timer.func, timeout); + } + } } function _parseString(result: string, start: number): null | string { - try { - const bytes = _parseBytes(result, start); - if (bytes) { - return toUtf8String(bytes); - } - } catch (error) {} - return null; + try { + const bytes = _parseBytes(result, start); + if (bytes) { + return toUtf8String(bytes); + } + } catch (error) {} + return null; } function _parseBytes(result: string, start: number): null | string { - if (result === "0x") { - return null; - } - try { - const offset = getNumber(dataSlice(result, start, start + 32)); - const length = getNumber(dataSlice(result, offset, offset + 32)); - - return dataSlice(result, offset + 32, offset + 32 + length); - } catch (error) {} - return null; + if (result === "0x") { + return null; + } + try { + const offset = getNumber(dataSlice(result, start, start + 32)); + const length = getNumber(dataSlice(result, offset, offset + 32)); + + return dataSlice(result, offset + 32, offset + 32 + length); + } catch (error) {} + return null; } function numPad(value: number): Uint8Array { - const result = toBeArray(value); - if (result.length > 32) { - throw new Error("internal; should not happen"); - } - - const padded = new Uint8Array(32); - padded.set(result, 32 - result.length); - return padded; + const result = toBeArray(value); + if (result.length > 32) { + throw new Error("internal; should not happen"); + } + + const padded = new Uint8Array(32); + padded.set(result, 32 - result.length); + return padded; } function bytesPad(value: Uint8Array): Uint8Array { - if (value.length % 32 === 0) { - return value; - } + if (value.length % 32 === 0) { + return value; + } - const result = new Uint8Array(Math.ceil(value.length / 32) * 32); - result.set(value); - return result; + const result = new Uint8Array(Math.ceil(value.length / 32) * 32); + result.set(value); + return result; } const empty: Uint8Array = new Uint8Array([]); // ABI Encodes a series of (bytes, bytes, ...) function encodeBytes(datas: Array): string { - const result: Array = []; + const result: Array = []; - let byteCount = 0; + let byteCount = 0; - // Add place-holders for pointers as we add items - for (let i = 0; i < datas.length; i++) { - result.push(empty); - byteCount += 32; - } + // Add place-holders for pointers as we add items + for (let i = 0; i < datas.length; i++) { + result.push(empty); + byteCount += 32; + } - for (let i = 0; i < datas.length; i++) { - const data = getBytes(datas[i]); + for (let i = 0; i < datas.length; i++) { + const data = getBytes(datas[i]); - // Update the bytes offset - result[i] = numPad(byteCount); + // Update the bytes offset + result[i] = numPad(byteCount); - // The length and padded value of data - result.push(numPad(data.length)); - result.push(bytesPad(data)); - byteCount += 32 + Math.ceil(data.length / 32) * 32; - } + // The length and padded value of data + result.push(numPad(data.length)); + result.push(bytesPad(data)); + byteCount += 32 + Math.ceil(data.length / 32) * 32; + } - return concat(result) as string; + return concat(result) as string; } const zeros = - "0x0000000000000000000000000000000000000000000000000000000000000000"; + "0x0000000000000000000000000000000000000000000000000000000000000000"; function parseOffchainLookup(data: string): CcipArgs { - const result: CcipArgs = { - sender: "", - urls: [], - calldata: "", - selector: "", - extraData: "", - errorArgs: [], - }; - - assert( - dataLength(data) >= 5 * 32, - "insufficient OffchainLookup data", - "OFFCHAIN_FAULT", - { - reason: "insufficient OffchainLookup data", - }, - ); - - const sender = dataSlice(data, 0, 32); - assert( - dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), - "corrupt OffchainLookup sender", - "OFFCHAIN_FAULT", - { - reason: "corrupt OffchainLookup sender", - }, - ); - result.sender = dataSlice(sender, 12); - - // Read the URLs from the response - try { - const urls: Array = []; - const urlsOffset = getNumber(dataSlice(data, 32, 64)); - const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32)); - const urlsData = dataSlice(data, urlsOffset + 32); - for (let u = 0; u < urlsLength; u++) { - const url = _parseString(urlsData, u * 32); - if (url == null) { - throw new Error("abort"); - } - urls.push(url); - } - result.urls = urls; - } catch (error) { - assert(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup urls", - }); - } - - // Get the CCIP calldata to forward - try { - const calldata = _parseBytes(data, 64); - if (calldata == null) { - throw new Error("abort"); - } - result.calldata = calldata; - } catch (error) { - assert(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup calldata", - }); - } - - // Get the callbackSelector (bytes4) - assert( - dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), - "corrupt OffchainLookup callbaackSelector", - "OFFCHAIN_FAULT", - { - reason: "corrupt OffchainLookup callbaackSelector", - }, - ); - result.selector = dataSlice(data, 96, 100); - - // Get the extra data to send back to the contract as context - try { - const extraData = _parseBytes(data, 128); - if (extraData == null) { - throw new Error("abort"); - } - result.extraData = extraData; - } catch (error) { - assert(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup extraData", - }); - } - - result.errorArgs = "sender,urls,calldata,selector,extraData" - .split(/,/) - .map((k) => (result)[k]); - - return result; + const result: CcipArgs = { + sender: "", + urls: [], + calldata: "", + selector: "", + extraData: "", + errorArgs: [], + }; + + assert( + dataLength(data) >= 5 * 32, + "insufficient OffchainLookup data", + "OFFCHAIN_FAULT", + { + reason: "insufficient OffchainLookup data", + }, + ); + + const sender = dataSlice(data, 0, 32); + assert( + dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), + "corrupt OffchainLookup sender", + "OFFCHAIN_FAULT", + { + reason: "corrupt OffchainLookup sender", + }, + ); + result.sender = dataSlice(sender, 12); + + // Read the URLs from the response + try { + const urls: Array = []; + const urlsOffset = getNumber(dataSlice(data, 32, 64)); + const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32)); + const urlsData = dataSlice(data, urlsOffset + 32); + for (let u = 0; u < urlsLength; u++) { + const url = _parseString(urlsData, u * 32); + if (url == null) { + throw new Error("abort"); + } + urls.push(url); + } + result.urls = urls; + } catch (error) { + assert(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup urls", + }); + } + + // Get the CCIP calldata to forward + try { + const calldata = _parseBytes(data, 64); + if (calldata == null) { + throw new Error("abort"); + } + result.calldata = calldata; + } catch (error) { + assert(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup calldata", + }); + } + + // Get the callbackSelector (bytes4) + assert( + dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), + "corrupt OffchainLookup callbaackSelector", + "OFFCHAIN_FAULT", + { + reason: "corrupt OffchainLookup callbaackSelector", + }, + ); + result.selector = dataSlice(data, 96, 100); + + // Get the extra data to send back to the contract as context + try { + const extraData = _parseBytes(data, 128); + if (extraData == null) { + throw new Error("abort"); + } + result.extraData = extraData; + } catch (error) { + assert(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup extraData", + }); + } + + result.errorArgs = "sender,urls,calldata,selector,extraData" + .split(/,/) + .map((k) => (result)[k]); + + return result; } diff --git a/src.ts/providers/abstract-signer.ts b/src.ts/providers/abstract-signer.ts index a00d3edc8..e901b59b0 100644 --- a/src.ts/providers/abstract-signer.ts +++ b/src.ts/providers/abstract-signer.ts @@ -7,11 +7,11 @@ import { resolveAddress } from "../address/checks.js"; import { getAddress } from "../address/index.js"; import { Transaction } from "../transaction/index.js"; import { - defineProperties, - getBigInt, - resolveProperties, - assert, - assertArgument, + defineProperties, + getBigInt, + resolveProperties, + assert, + assertArgument, } from "../utils/index.js"; import { copyRequest } from "./provider.js"; @@ -20,200 +20,199 @@ import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; import type { TransactionLike } from "../transaction/index.js"; import type { - BlockTag, - Provider, - TransactionRequest, - TransactionResponse, + BlockTag, + Provider, + TransactionRequest, + TransactionResponse, } from "./provider.js"; import type { Signer } from "./signer.js"; function checkProvider(signer: AbstractSigner, operation: string): Provider { - if (signer.provider) { - return signer.provider; - } - assert(false, "missing provider", "UNSUPPORTED_OPERATION", { operation }); + if (signer.provider) { + return signer.provider; + } + assert(false, "missing provider", "UNSUPPORTED_OPERATION", { operation }); } async function populate( - signer: AbstractSigner, - tx: TransactionRequest, + signer: AbstractSigner, + tx: TransactionRequest, ): Promise> { - let pop: any = copyRequest(tx); - - if (pop.to != null) { - pop.to = resolveAddress(pop.to); - } - - if (pop.from != null) { - const from = pop.from; - pop.from = Promise.all([signer.getAddress(), resolveAddress(from)]).then( - ([address, from]) => { - assertArgument( - address.toLowerCase() === from.toLowerCase(), - "transaction from mismatch", - "tx.from", - from, - ); - return address; - }, - ); - } else { - pop.from = signer.getAddress(); - } - - return await resolveProperties(pop); + let pop: any = copyRequest(tx); + + if (pop.to != null) { + pop.to = resolveAddress(pop.to); + } + + if (pop.from != null) { + const from = pop.from; + pop.from = Promise.all([signer.getAddress(), resolveAddress(from)]).then( + ([address, from]) => { + assertArgument( + address.toLowerCase() === from.toLowerCase(), + "transaction from mismatch", + "tx.from", + from, + ); + return address; + }, + ); + } else { + pop.from = signer.getAddress(); + } + + return await resolveProperties(pop); } export abstract class AbstractSigner< - P extends null | Provider = null | Provider, -> implements Signer -{ - readonly provider!: P; - - constructor(provider?: P) { - defineProperties(this, { provider: provider || null }); - } - - abstract getAddress(): Promise; - abstract connect(provider: null | Provider): Signer; - - async getNonce(blockTag?: BlockTag): Promise { - return checkProvider(this, "getTransactionCount").getTransactionCount( - await this.getAddress(), - blockTag, - ); - } - - async populateCall(tx: TransactionRequest): Promise> { - const pop = await populate(this, tx); - return pop; - } - - async populateTransaction( - tx: TransactionRequest, - ): Promise> { - const provider = checkProvider(this, "populateTransaction"); - - const pop = await populate(this, tx); - - if (pop.nonce == null) { - pop.nonce = await this.getNonce("pending"); - } - - if (pop.energyLimit == null) { - pop.energyLimit = await this.estimateEnergy(pop); - } - - // Populate the chain ID - const network = await (this.provider).getNetwork(); - if (pop.networkId != null) { - const networkId = getBigInt(pop.networkId); - assertArgument( - networkId === network.networkId, - "transaction networkId mismatch", - "tx.networkId", - tx.networkId, - ); - } else { - pop.networkId = network.networkId; - } - - // We need to get fee data to determine things - const feeData = await provider.getFeeData(); - // We need to auto-detect the intended type of this transaction... - - if (feeData.energyPrice != null) { - // Network doesn't support EIP-1559... - // Populate missing fee data - if (pop.energyPrice == null) { - pop.energyPrice = feeData.energyPrice; - } - } else { - // getFeeData has failed us. - assert( - false, - "failed to get consistent fee data", - "UNSUPPORTED_OPERATION", - { - operation: "signer.getFeeData", - }, - ); - } - - //@TOOD: Don't await all over the place; save them up for - // the end for better batching - return await resolveProperties(pop); - } - - async estimateEnergy(tx: TransactionRequest): Promise { - return checkProvider(this, "estimateEnergy").estimateEnergy( - await this.populateCall(tx), - ); - } - - async call(tx: TransactionRequest): Promise { - return checkProvider(this, "call").call(await this.populateCall(tx)); - } - - async resolveName(name: string): Promise { - return getAddress(name); - } - - async sendTransaction(tx: TransactionRequest): Promise { - const provider = checkProvider(this, "sendTransaction"); - - const pop = await this.populateTransaction(tx); - delete pop.from; - const txObj = Transaction.from(pop); - return await provider.broadcastTransaction( - await this.signTransaction(txObj), - ); - } - - abstract signTransaction(tx: TransactionRequest): Promise; - abstract signMessage(message: string | Uint8Array): Promise; - abstract signTypedData( - domain: TypedDataDomain, - types: Record>, - value: Record, - ): Promise; + P extends null | Provider = null | Provider, +> implements Signer { + readonly provider!: P; + + constructor(provider?: P) { + defineProperties(this, { provider: provider || null }); + } + + abstract getAddress(): Promise; + abstract connect(provider: null | Provider): Signer; + + async getNonce(blockTag?: BlockTag): Promise { + return checkProvider(this, "getTransactionCount").getTransactionCount( + await this.getAddress(), + blockTag, + ); + } + + async populateCall(tx: TransactionRequest): Promise> { + const pop = await populate(this, tx); + return pop; + } + + async populateTransaction( + tx: TransactionRequest, + ): Promise> { + const provider = checkProvider(this, "populateTransaction"); + + const pop = await populate(this, tx); + + if (pop.nonce == null) { + pop.nonce = await this.getNonce("pending"); + } + + if (pop.energyLimit == null) { + pop.energyLimit = await this.estimateEnergy(pop); + } + + // Populate the chain ID + const network = await (this.provider).getNetwork(); + if (pop.networkId != null) { + const networkId = getBigInt(pop.networkId); + assertArgument( + networkId === network.networkId, + "transaction networkId mismatch", + "tx.networkId", + tx.networkId, + ); + } else { + pop.networkId = network.networkId; + } + + // We need to get fee data to determine things + const feeData = await provider.getFeeData(); + // We need to auto-detect the intended type of this transaction... + + if (feeData.energyPrice != null) { + // Network doesn't support EIP-1559... + // Populate missing fee data + if (pop.energyPrice == null) { + pop.energyPrice = feeData.energyPrice; + } + } else { + // getFeeData has failed us. + assert( + false, + "failed to get consistent fee data", + "UNSUPPORTED_OPERATION", + { + operation: "signer.getFeeData", + }, + ); + } + + //@TOOD: Don't await all over the place; save them up for + // the end for better batching + return await resolveProperties(pop); + } + + async estimateEnergy(tx: TransactionRequest): Promise { + return checkProvider(this, "estimateEnergy").estimateEnergy( + await this.populateCall(tx), + ); + } + + async call(tx: TransactionRequest): Promise { + return checkProvider(this, "call").call(await this.populateCall(tx)); + } + + async resolveName(name: string): Promise { + return getAddress(name); + } + + async sendTransaction(tx: TransactionRequest): Promise { + const provider = checkProvider(this, "sendTransaction"); + + const pop = await this.populateTransaction(tx); + delete pop.from; + const txObj = Transaction.from(pop); + return await provider.broadcastTransaction( + await this.signTransaction(txObj), + ); + } + + abstract signTransaction(tx: TransactionRequest): Promise; + abstract signMessage(message: string | Uint8Array): Promise; + abstract signTypedData( + domain: TypedDataDomain, + types: Record>, + value: Record, + ): Promise; } export class VoidSigner extends AbstractSigner { - readonly address!: string; - - constructor(address: string, provider?: null | Provider) { - super(provider); - defineProperties(this, { address }); - } - - async getAddress(): Promise { - return this.address; - } - - connect(provider: null | Provider): VoidSigner { - return new VoidSigner(this.address, provider); - } - - #throwUnsupported(suffix: string, operation: string): never { - assert(false, `VoidSigner cannot sign ${suffix}`, "UNSUPPORTED_OPERATION", { - operation, - }); - } - - async signTransaction(tx: TransactionRequest): Promise { - this.#throwUnsupported("transactions", "signTransaction"); - } - - async signMessage(message: string | Uint8Array): Promise { - this.#throwUnsupported("messages", "signMessage"); - } - - async signTypedData( - domain: TypedDataDomain, - types: Record>, - value: Record, - ): Promise { - this.#throwUnsupported("typed-data", "signTypedData"); - } + readonly address!: string; + + constructor(address: string, provider?: null | Provider) { + super(provider); + defineProperties(this, { address }); + } + + async getAddress(): Promise { + return this.address; + } + + connect(provider: null | Provider): VoidSigner { + return new VoidSigner(this.address, provider); + } + + #throwUnsupported(suffix: string, operation: string): never { + assert(false, `VoidSigner cannot sign ${suffix}`, "UNSUPPORTED_OPERATION", { + operation, + }); + } + + async signTransaction(tx: TransactionRequest): Promise { + this.#throwUnsupported("transactions", "signTransaction"); + } + + async signMessage(message: string | Uint8Array): Promise { + this.#throwUnsupported("messages", "signMessage"); + } + + async signTypedData( + domain: TypedDataDomain, + types: Record>, + value: Record, + ): Promise { + this.#throwUnsupported("typed-data", "signTypedData"); + } } diff --git a/src.ts/providers/community.ts b/src.ts/providers/community.ts index 6e08cf22c..729399bca 100644 --- a/src.ts/providers/community.ts +++ b/src.ts/providers/community.ts @@ -12,11 +12,11 @@ * are in-use. */ export interface CommunityResourcable { - /** - * Returns true of the instance is connected using the community - * credentials. - */ - isCommunityResource(): boolean; + /** + * Returns true of the instance is connected using the community + * credentials. + */ + isCommunityResource(): boolean; } // Show the throttle message only once per service @@ -31,31 +31,31 @@ const shown: Set = new Set(); * The notification will only occur once per service. */ export function showThrottleMessage(service: string): void { - if (shown.has(service)) { - return; - } - shown.add(service); + if (shown.has(service)) { + return; + } + shown.add(service); - console.log("========= NOTICE ========="); - console.log( - `Request-Rate Exceeded for ${service} (this message will not be repeated)`, - ); - console.log(""); - console.log( - "The default API keys for each service are provided as a highly-throttled,", - ); - console.log( - "community resource for low-traffic projects and early prototyping.", - ); - console.log(""); - console.log( - "While your application will continue to function, we highly recommended", - ); - console.log( - "signing up for your own API keys to improve performance, increase your", - ); - console.log( - "request rate/limit and enable other perks, such as metrics and advanced APIs.", - ); - console.log(""); + console.log("========= NOTICE ========="); + console.log( + `Request-Rate Exceeded for ${service} (this message will not be repeated)`, + ); + console.log(""); + console.log( + "The default API keys for each service are provided as a highly-throttled,", + ); + console.log( + "community resource for low-traffic projects and early prototyping.", + ); + console.log(""); + console.log( + "While your application will continue to function, we highly recommended", + ); + console.log( + "signing up for your own API keys to improve performance, increase your", + ); + console.log( + "request rate/limit and enable other perks, such as metrics and advanced APIs.", + ); + console.log(""); } diff --git a/src.ts/providers/contracts.ts b/src.ts/providers/contracts.ts index e40f4d925..f61995cf3 100644 --- a/src.ts/providers/contracts.ts +++ b/src.ts/providers/contracts.ts @@ -1,23 +1,23 @@ import type { - Provider, - TransactionRequest, - TransactionResponse, + Provider, + TransactionRequest, + TransactionResponse, } from "./provider.js"; // The object that will be used to run Contracts. The Signer and Provider // both adhere to this, but other types of objects may wish to as well. export interface ContractRunner { - provider: null | Provider; + provider: null | Provider; - // Required to estimate energy; usually a Signer or Provider - estimateEnergy?: (tx: TransactionRequest) => Promise; + // Required to estimate energy; usually a Signer or Provider + estimateEnergy?: (tx: TransactionRequest) => Promise; - // Required for pure, view or static calls to contracts; usually a Signer or Provider - call?: (tx: TransactionRequest) => Promise; + // Required for pure, view or static calls to contracts; usually a Signer or Provider + call?: (tx: TransactionRequest) => Promise; - // Required to support ENS names; usually a Signer or Provider - resolveName?: (name: string) => Promise; + // Required to support ENS names; usually a Signer or Provider + resolveName?: (name: string) => Promise; - // Required for mutating calls; usually a Signer - sendTransaction?: (tx: TransactionRequest) => Promise; + // Required for mutating calls; usually a Signer + sendTransaction?: (tx: TransactionRequest) => Promise; } diff --git a/src.ts/providers/default-provider.ts b/src.ts/providers/default-provider.ts index 943a7619f..636ab7c0d 100644 --- a/src.ts/providers/default-provider.ts +++ b/src.ts/providers/default-provider.ts @@ -16,72 +16,72 @@ import type { Networkish } from "./network.js"; import { WebSocketLike } from "./provider-websocket.js"; function isWebSocketLike(value: any): value is WebSocketLike { - return ( - value && - typeof value.send === "function" && - typeof value.close === "function" - ); + return ( + value && + typeof value.send === "function" && + typeof value.close === "function" + ); } export function getDefaultProvider( - network: string | Networkish | WebSocketLike, - options?: any, + network: string | Networkish | WebSocketLike, + options?: any, ): AbstractProvider { - if (options == null) { - options = {}; - } + if (options == null) { + options = {}; + } - if (typeof network === "string" && network.match(/^https?:/)) { - return new JsonRpcProvider(network); - } + if (typeof network === "string" && network.match(/^https?:/)) { + return new JsonRpcProvider(network); + } - if ( - (typeof network === "string" && network.match(/^wss?:/)) || - isWebSocketLike(network) - ) { - return new WebSocketProvider(network); - } + if ( + (typeof network === "string" && network.match(/^wss?:/)) || + isWebSocketLike(network) + ) { + return new WebSocketProvider(network); + } - const providers: Array = []; + const providers: Array = []; - if (options.alchemy !== "-") { - try { - providers.push(new AlchemyProvider(network, options.alchemy)); - } catch (error) { - console.log(error); - } - } + if (options.alchemy !== "-") { + try { + providers.push(new AlchemyProvider(network, options.alchemy)); + } catch (error) { + console.log(error); + } + } - if (options.ankr !== "-" && options.ankr != null) { - try { - providers.push(new AnkrProvider(network, options.ankr)); - } catch (error) { - console.log(error); - } - } + if (options.ankr !== "-" && options.ankr != null) { + try { + providers.push(new AnkrProvider(network, options.ankr)); + } catch (error) { + console.log(error); + } + } - if (options.cloudflare !== "-") { - try { - providers.push(new CloudflareProvider(network)); - } catch (error) { - console.log(error); - } - } + if (options.cloudflare !== "-") { + try { + providers.push(new CloudflareProvider(network)); + } catch (error) { + console.log(error); + } + } - if (options.infura !== "-") { - try { - let projectId = options.infura; - let projectSecret: undefined | string = undefined; - if (typeof projectId === "object") { - projectSecret = projectId.projectSecret; - projectId = projectId.projectId; - } - providers.push(new InfuraProvider(network, projectId, projectSecret)); - } catch (error) { - console.log(error); - } - } - /* + if (options.infura !== "-") { + try { + let projectId = options.infura; + let projectSecret: undefined | string = undefined; + if (typeof projectId === "object") { + projectSecret = projectId.projectSecret; + projectId = projectId.projectId; + } + providers.push(new InfuraProvider(network, projectId, projectSecret)); + } catch (error) { + console.log(error); + } + } + /* if (options.pocket !== "-") { try { let appId = options.pocket; @@ -96,27 +96,27 @@ export function getDefaultProvider( } catch (error) { console.log(error); } } */ - if (options.quicknode !== "-") { - try { - let token = options.quicknode; - providers.push(new QuickNodeProvider(network, token)); - } catch (error) { - console.log(error); - } - } + if (options.quicknode !== "-") { + try { + let token = options.quicknode; + providers.push(new QuickNodeProvider(network, token)); + } catch (error) { + console.log(error); + } + } - assert( - providers.length, - "unsupported default network", - "UNSUPPORTED_OPERATION", - { - operation: "getDefaultProvider", - }, - ); + assert( + providers.length, + "unsupported default network", + "UNSUPPORTED_OPERATION", + { + operation: "getDefaultProvider", + }, + ); - if (providers.length === 1) { - return providers[0]; - } + if (providers.length === 1) { + return providers[0]; + } - return new FallbackProvider(providers); + return new FallbackProvider(providers); } diff --git a/src.ts/providers/format.ts b/src.ts/providers/format.ts index 030cf2fef..024141004 100644 --- a/src.ts/providers/format.ts +++ b/src.ts/providers/format.ts @@ -5,20 +5,20 @@ import { getAddress } from "../address/index.js"; import { getCreateAddress } from "../address/contract-address.js"; import { accessListify } from "../transaction/index.js"; import { - getBigInt, - getNumber, - hexlify, - isHexString, - zeroPadValue, - assert, - assertArgument, + getBigInt, + getNumber, + hexlify, + isHexString, + zeroPadValue, + assert, + assertArgument, } from "../utils/index.js"; import type { - BlockParams, - LogParams, - TransactionReceiptParams, - TransactionResponseParams, + BlockParams, + LogParams, + TransactionReceiptParams, + TransactionResponseParams, } from "./formatting.js"; const BN_0 = BigInt(0); @@ -26,268 +26,268 @@ const BN_0 = BigInt(0); export type FormatFunc = (value: any) => any; export function allowNull(format: FormatFunc, nullValue?: any): FormatFunc { - return function (value: any) { - if (value == null) { - return nullValue; - } - return format(value); - }; + return function (value: any) { + if (value == null) { + return nullValue; + } + return format(value); + }; } export function arrayOf(format: FormatFunc): FormatFunc { - return (array: any) => { - if (!Array.isArray(array)) { - throw new Error("not an array"); - } - return array.map((i) => format(i)); - }; + return (array: any) => { + if (!Array.isArray(array)) { + throw new Error("not an array"); + } + return array.map((i) => format(i)); + }; } // Requires an object which matches a fleet of other formatters // Any FormatFunc may return `undefined` to have the value omitted // from the result object. Calls preserve `this`. export function object( - format: Record, - altNames?: Record>, + format: Record, + altNames?: Record>, ): FormatFunc { - return (value: any) => { - const result: any = {}; - for (const key in format) { - let srcKey = key; - if (altNames && key in altNames && !(srcKey in value)) { - for (const altKey of altNames[key]) { - if (altKey in value) { - srcKey = altKey; - break; - } - } - } - - try { - const nv = format[key](value[srcKey]); - if (nv !== undefined) { - result[key] = nv; - } - } catch (error) { - const message = error instanceof Error ? error.message : "not-an-error"; - assert( - false, - `invalid value for value.${key} (${message})`, - "BAD_DATA", - { value }, - ); - } - } - return result; - }; + return (value: any) => { + const result: any = {}; + for (const key in format) { + let srcKey = key; + if (altNames && key in altNames && !(srcKey in value)) { + for (const altKey of altNames[key]) { + if (altKey in value) { + srcKey = altKey; + break; + } + } + } + + try { + const nv = format[key](value[srcKey]); + if (nv !== undefined) { + result[key] = nv; + } + } catch (error) { + const message = error instanceof Error ? error.message : "not-an-error"; + assert( + false, + `invalid value for value.${key} (${message})`, + "BAD_DATA", + { value }, + ); + } + } + return result; + }; } export function formatBoolean(value: any): boolean { - switch (value) { - case true: - case "true": - return true; - case false: - case "false": - return false; - } - assertArgument( - false, - `invalid boolean; ${JSON.stringify(value)}`, - "value", - value, - ); + switch (value) { + case true: + case "true": + return true; + case false: + case "false": + return false; + } + assertArgument( + false, + `invalid boolean; ${JSON.stringify(value)}`, + "value", + value, + ); } export function formatData(value: string): string { - assertArgument(isHexString(value, true), "invalid data", "value", value); - return value; + assertArgument(isHexString(value, true), "invalid data", "value", value); + return value; } export function formatHash(value: any): string { - assertArgument(isHexString(value, 32), "invalid hash", "value", value); - return value; + assertArgument(isHexString(value, 32), "invalid hash", "value", value); + return value; } export function formatUint256(value: any): string { - if (!isHexString(value)) { - throw new Error("invalid uint256"); - } - return zeroPadValue(value, 32); + if (!isHexString(value)) { + throw new Error("invalid uint256"); + } + return zeroPadValue(value, 32); } const _formatLog = object( - { - address: getAddress, - blockHash: formatHash, - blockNumber: getNumber, - data: formatData, - index: getNumber, - removed: allowNull(formatBoolean, false), - topics: arrayOf(formatHash), - transactionHash: formatHash, - transactionIndex: getNumber, - }, - { - index: ["logIndex"], - }, + { + address: getAddress, + blockHash: formatHash, + blockNumber: getNumber, + data: formatData, + index: getNumber, + removed: allowNull(formatBoolean, false), + topics: arrayOf(formatHash), + transactionHash: formatHash, + transactionIndex: getNumber, + }, + { + index: ["logIndex"], + }, ); export function formatLog(value: any): LogParams { - return _formatLog(value); + return _formatLog(value); } const _formatBlock = object({ - hash: allowNull(formatHash), - parentHash: formatHash, - number: getNumber, + hash: allowNull(formatHash), + parentHash: formatHash, + number: getNumber, - timestamp: getNumber, - nonce: allowNull(formatData), - difficulty: getBigInt, + timestamp: getNumber, + nonce: allowNull(formatData), + difficulty: getBigInt, - energyLimit: getBigInt, - energyUsed: getBigInt, + energyLimit: getBigInt, + energyUsed: getBigInt, - miner: allowNull(getAddress), - extraData: formatData, + miner: allowNull(getAddress), + extraData: formatData, - baseFeePerEnergy: allowNull(getBigInt), + baseFeePerEnergy: allowNull(getBigInt), }); export function formatBlock(value: any): BlockParams { - const result = _formatBlock(value); - result.transactions = value.transactions.map( - (tx: string | TransactionResponseParams) => { - if (typeof tx === "string") { - return tx; - } - return formatTransactionResponse(tx); - }, - ); - return result; + const result = _formatBlock(value); + result.transactions = value.transactions.map( + (tx: string | TransactionResponseParams) => { + if (typeof tx === "string") { + return tx; + } + return formatTransactionResponse(tx); + }, + ); + return result; } const _formatReceiptLog = object( - { - transactionIndex: getNumber, - blockNumber: getNumber, - transactionHash: formatHash, - address: getAddress, - topics: arrayOf(formatHash), - data: formatData, - index: getNumber, - blockHash: formatHash, - }, - { - index: ["logIndex"], - }, + { + transactionIndex: getNumber, + blockNumber: getNumber, + transactionHash: formatHash, + address: getAddress, + topics: arrayOf(formatHash), + data: formatData, + index: getNumber, + blockHash: formatHash, + }, + { + index: ["logIndex"], + }, ); export function formatReceiptLog(value: any): LogParams { - return _formatReceiptLog(value); + return _formatReceiptLog(value); } const _formatTransactionReceipt = object( - { - to: allowNull(getAddress, null), - from: allowNull(getAddress, null), - contractAddress: allowNull(getAddress, null), - // should be allowNull(hash), but broken-EIP-658 support is handled in receipt - index: getNumber, - root: allowNull(hexlify), - energyUsed: getBigInt, - logsBloom: allowNull(formatData), - blockHash: formatHash, - hash: formatHash, - logs: arrayOf(formatReceiptLog), - blockNumber: getNumber, - //confirmations: allowNull(getNumber, null), - cumulativeEnergyUsed: getBigInt, - effectiveEnergyPrice: allowNull(getBigInt), - status: allowNull(getNumber), - type: allowNull(getNumber, 0), - }, - { - effectiveEnergyPrice: ["energyPrice"], - hash: ["transactionHash"], - index: ["transactionIndex"], - }, + { + to: allowNull(getAddress, null), + from: allowNull(getAddress, null), + contractAddress: allowNull(getAddress, null), + // should be allowNull(hash), but broken-EIP-658 support is handled in receipt + index: getNumber, + root: allowNull(hexlify), + energyUsed: getBigInt, + logsBloom: allowNull(formatData), + blockHash: formatHash, + hash: formatHash, + logs: arrayOf(formatReceiptLog), + blockNumber: getNumber, + //confirmations: allowNull(getNumber, null), + cumulativeEnergyUsed: getBigInt, + effectiveEnergyPrice: allowNull(getBigInt), + status: allowNull(getNumber), + type: allowNull(getNumber, 0), + }, + { + effectiveEnergyPrice: ["energyPrice"], + hash: ["transactionHash"], + index: ["transactionIndex"], + }, ); export function formatTransactionReceipt(value: any): TransactionReceiptParams { - return _formatTransactionReceipt(value); + return _formatTransactionReceipt(value); } export function formatTransactionResponse( - value: any, + value: any, ): TransactionResponseParams { - // Some clients (TestRPC) do strange things like return 0x0 for the - // 0 address; correct this to be a real address - if (value.to && !getAddress(value.to) && getBigInt(value.to) === BN_0) { - value.to = "0x0000000000000000000000000000000000000000"; - } - - const result = object( - { - hash: formatHash, - - type: (value: any) => { - if (value === "0x" || value == null) { - return 0; - } - return getNumber(value); - }, - accessList: allowNull(accessListify, null), - - blockHash: allowNull(formatHash, null), - blockNumber: allowNull(getNumber, null), - transactionIndex: allowNull(getNumber, null), - - //confirmations: allowNull(getNumber, null), - - from: getAddress, - - maxFeePerEnergy: allowNull(getBigInt), - - energyLimit: getBigInt, - to: allowNull(getAddress, null), - value: getBigInt, - nonce: getNumber, - data: formatData, - - creates: allowNull(getAddress, null), - - networkId: allowNull(getBigInt, null), - }, - { - data: ["input"], - energyLimit: ["energy"], - }, - )(value); - - // If to and creates are empty, populate the creates from the value - if (result.to == null && result.creates == null) { - result.creates = getCreateAddress(result); - } - - // Compute the signature - if (value.signature) { - result.signature = value.signature; - } else { - result.signature = value; - } - - // Some backends omit networkId on legacy transactions, but we can compute it - if (result.networkId == null) { - const networkId = result.signature.legacynetworkId; - if (networkId != null) { - result.networkId = networkId; - } - } - - // @TODO: check networkId - /* + // Some clients (TestRPC) do strange things like return 0x0 for the + // 0 address; correct this to be a real address + if (value.to && !getAddress(value.to) && getBigInt(value.to) === BN_0) { + value.to = "0x0000000000000000000000000000000000000000"; + } + + const result = object( + { + hash: formatHash, + + type: (value: any) => { + if (value === "0x" || value == null) { + return 0; + } + return getNumber(value); + }, + accessList: allowNull(accessListify, null), + + blockHash: allowNull(formatHash, null), + blockNumber: allowNull(getNumber, null), + transactionIndex: allowNull(getNumber, null), + + //confirmations: allowNull(getNumber, null), + + from: getAddress, + + maxFeePerEnergy: allowNull(getBigInt), + + energyLimit: getBigInt, + to: allowNull(getAddress, null), + value: getBigInt, + nonce: getNumber, + data: formatData, + + creates: allowNull(getAddress, null), + + networkId: allowNull(getBigInt, null), + }, + { + data: ["input"], + energyLimit: ["energy"], + }, + )(value); + + // If to and creates are empty, populate the creates from the value + if (result.to == null && result.creates == null) { + result.creates = getCreateAddress(result); + } + + // Compute the signature + if (value.signature) { + result.signature = value.signature; + } else { + result.signature = value; + } + + // Some backends omit networkId on legacy transactions, but we can compute it + if (result.networkId == null) { + const networkId = result.signature.legacynetworkId; + if (networkId != null) { + result.networkId = networkId; + } + } + + // @TODO: check networkId + /* if (value.networkId != null) { let networkId = value.networkId; @@ -321,10 +321,10 @@ export function formatTransactionResponse( } */ - // 0x0000... should actually be null - if (result.blockHash && getBigInt(result.blockHash) === BN_0) { - result.blockHash = null; - } + // 0x0000... should actually be null + if (result.blockHash && getBigInt(result.blockHash) === BN_0) { + result.blockHash = null; + } - return result; + return result; } diff --git a/src.ts/providers/formatting.ts b/src.ts/providers/formatting.ts index d97f1ed98..558c7a8b7 100644 --- a/src.ts/providers/formatting.ts +++ b/src.ts/providers/formatting.ts @@ -59,72 +59,72 @@ export interface PreparedTransactionRequest { // Block export interface BlockParams { - hash?: null | string; + hash?: null | string; - number: number; - timestamp: number; + number: number; + timestamp: number; - parentHash: string; + parentHash: string; - nonce: string; - difficulty: bigint; + nonce: string; + difficulty: bigint; - energyLimit: bigint; - energyUsed: bigint; + energyLimit: bigint; + energyUsed: bigint; - miner: string; - extraData: string; + miner: string; + extraData: string; - baseFeePerEnergy: null | bigint; + baseFeePerEnergy: null | bigint; - transactions: ReadonlyArray; + transactions: ReadonlyArray; } ////////////////////// // Log export interface LogParams { - transactionHash: string; - blockHash: string; - blockNumber: number; + transactionHash: string; + blockHash: string; + blockNumber: number; - removed: boolean; + removed: boolean; - address: string; - data: string; + address: string; + data: string; - topics: ReadonlyArray; + topics: ReadonlyArray; - index: number; - transactionIndex: number; + index: number; + transactionIndex: number; } ////////////////////// // Transaction Receipt export interface TransactionReceiptParams { - to: null | string; - from: string; - contractAddress: null | string; + to: null | string; + from: string; + contractAddress: null | string; - hash: string; - index: number; + hash: string; + index: number; - blockHash: string; - blockNumber: number; + blockHash: string; + blockNumber: number; - logsBloom: string; - logs: ReadonlyArray; + logsBloom: string; + logs: ReadonlyArray; - energyUsed: bigint; - cumulativeEnergyUsed: bigint; - energyPrice?: null | bigint; - effectiveEnergyPrice?: null | bigint; + energyUsed: bigint; + cumulativeEnergyUsed: bigint; + energyPrice?: null | bigint; + effectiveEnergyPrice?: null | bigint; - type: number; - //byzantium: boolean; - status: null | number; - root: null | string; + type: number; + //byzantium: boolean; + status: null | number; + root: null | string; } /* @@ -145,26 +145,26 @@ export interface ByzantiumTransactionReceipt { // Transaction Response export interface TransactionResponseParams { - blockNumber: null | number; - blockHash: null | string; + blockNumber: null | number; + blockHash: null | string; - hash: string; - index: number; + hash: string; + index: number; - type: number; + type: number; - to: null | string; - from: string; + to: null | string; + from: string; - nonce: number; + nonce: number; - energyLimit: bigint; + energyLimit: bigint; - energyPrice: bigint; + energyPrice: bigint; - data: string; - value: bigint; - networkId: bigint; + data: string; + value: bigint; + networkId: bigint; - signature: string; + signature: string; } diff --git a/src.ts/providers/index.ts b/src.ts/providers/index.ts index 5f22768ce..c410008ee 100644 --- a/src.ts/providers/index.ts +++ b/src.ts/providers/index.ts @@ -17,26 +17,26 @@ export { Network } from "./network.js"; export { NonceManager } from "./signer-noncemanager.js"; export { - NetworkPlugin, - EnergyCostPlugin, - FeeDataNetworkPlugin, + NetworkPlugin, + EnergyCostPlugin, + FeeDataNetworkPlugin, } from "./plugins-network.js"; export { - Block, - FeeData, - Log, - TransactionReceipt, - TransactionResponse, - copyRequest, - //resolveTransactionRequest, + Block, + FeeData, + Log, + TransactionReceipt, + TransactionResponse, + copyRequest, + //resolveTransactionRequest, } from "./provider.js"; export { FallbackProvider } from "./provider-fallback.js"; export { - JsonRpcApiProvider, - JsonRpcProvider, - JsonRpcSigner, + JsonRpcApiProvider, + JsonRpcProvider, + JsonRpcSigner, } from "./provider-jsonrpc.js"; export { BrowserProvider } from "./provider-browser.js"; @@ -54,28 +54,28 @@ export { SocketProvider } from "./provider-socket.js"; export { WebSocketProvider } from "./provider-websocket.js"; export { - SocketSubscriber, - SocketBlockSubscriber, - SocketPendingSubscriber, - SocketEventSubscriber, + SocketSubscriber, + SocketBlockSubscriber, + SocketPendingSubscriber, + SocketEventSubscriber, } from "./provider-socket.js"; export type { - Subscription, - Subscriber, - AbstractProviderPlugin, - PerformActionFilter, - PerformActionTransaction, - PerformActionRequest, + Subscription, + Subscriber, + AbstractProviderPlugin, + PerformActionFilter, + PerformActionTransaction, + PerformActionRequest, } from "./abstract-provider.js"; export type { ContractRunner } from "./contracts.js"; export type { - BlockParams, - LogParams, - TransactionReceiptParams, - TransactionResponseParams, + BlockParams, + LogParams, + TransactionReceiptParams, + TransactionResponseParams, } from "./formatting.js"; /* @@ -92,31 +92,31 @@ export type { Networkish } from "./network.js"; export type { EnergyCostParameters } from "./plugins-network.js"; export type { - BlockTag, - TransactionRequest, - PreparedTransactionRequest, - EventFilter, - Filter, - FilterByBlockHash, - OrphanFilter, - ProviderEvent, - TopicFilter, - Provider, - MinedBlock, - MinedTransactionResponse, + BlockTag, + TransactionRequest, + PreparedTransactionRequest, + EventFilter, + Filter, + FilterByBlockHash, + OrphanFilter, + ProviderEvent, + TopicFilter, + Provider, + MinedBlock, + MinedTransactionResponse, } from "./provider.js"; export type { - DebugEventBrowserProvider, - Eip1193Provider, + DebugEventBrowserProvider, + Eip1193Provider, } from "./provider-browser.js"; export type { - JsonRpcPayload, - JsonRpcResult, - JsonRpcError, - JsonRpcApiProviderOptions, - JsonRpcTransactionRequest, + JsonRpcPayload, + JsonRpcResult, + JsonRpcError, + JsonRpcApiProviderOptions, + JsonRpcTransactionRequest, } from "./provider-jsonrpc.js"; export type { WebSocketCreator, WebSocketLike } from "./provider-websocket.js"; diff --git a/src.ts/providers/network.ts b/src.ts/providers/network.ts index 4eadf0deb..97b2d9144 100644 --- a/src.ts/providers/network.ts +++ b/src.ts/providers/network.ts @@ -20,17 +20,17 @@ import type { NetworkPlugin } from "./plugins-network.js"; * - an object with sufficient details to describe a network */ export type Networkish = - | Network - | number - | bigint - | string - | { - name?: string; - networkId?: number; - //layerOneConnection?: Provider, - ensAddress?: string; - ensNetwork?: number; - }; + | Network + | number + | bigint + | string + | { + name?: string; + networkId?: number; + //layerOneConnection?: Provider, + ensAddress?: string; + ensNetwork?: number; + }; /* * * * // Networks which operation against an L2 can use this plugin to @@ -48,296 +48,296 @@ export class LayerOneConnectionPlugin extends NetworkPlugin { const Networks: Map Network> = new Map(); export class Network { - #name: string; - #networkId: bigint; - - #plugins: Map; - - constructor(name: string, networkId: BigNumberish) { - this.#name = name; - this.#networkId = getBigInt(networkId); - this.#plugins = new Map(); - } - - toJSON(): any { - return { name: this.name, networkId: String(this.networkId) }; - } - - /** - * The network common name. - * - * This is the canonical name, as networks migh have multiple - * names. - */ - get name(): string { - return this.#name; - } - set name(value: string) { - this.#name = value; - } - - /** - * The network chain ID. - */ - get networkId(): bigint { - return this.#networkId; - } - set networkId(value: BigNumberish) { - this.#networkId = getBigInt(value, "networkId"); - } - - /** - * Returns true if %%other%% matches this network. Any chain ID - * must match, and if no chain ID is present, the name must match. - * - * This method does not currently check for additional properties, - * such as ENS address or plug-in compatibility. - */ - matches(other: Networkish): boolean { - if (other == null) { - return false; - } - - if (typeof other === "string") { - try { - return this.networkId === getBigInt(other); - } catch (error) {} - return this.name === other; - } - - if (typeof other === "number" || typeof other === "bigint") { - try { - return this.networkId === getBigInt(other); - } catch (error) {} - return false; - } - - if (typeof other === "object") { - if (other.networkId != null) { - try { - return this.networkId === getBigInt(other.networkId); - } catch (error) {} - return false; - } - if (other.name != null) { - return this.name === other.name; - } - return false; - } - - return false; - } - - /** - * Returns the list of plugins currently attached to this Network. - */ - get plugins(): Array { - return Array.from(this.#plugins.values()); - } - - /** - * Attach a new %%plugin%% to this Network. The network name - * must be unique, excluding any fragment. - */ - attachPlugin(plugin: NetworkPlugin): this { - if (this.#plugins.get(plugin.name)) { - throw new Error(`cannot replace existing plugin: ${plugin.name} `); - } - this.#plugins.set(plugin.name, plugin.clone()); - return this; - } - - /** - * Return the plugin, if any, matching %%name%% exactly. Plugins - * with fragments will not be returned unless %%name%% includes - * a fragment. - */ - getPlugin(name: string): null | T { - return this.#plugins.get(name) || null; - } - - /** - * Gets a list of all plugins that match %%name%%, with otr without - * a fragment. - */ - getPlugins( - basename: string, - ): Array { - return >( - this.plugins.filter((p) => p.name.split("#")[0] === basename) - ); - } - - /** - * Create a copy of this Network. - */ - clone(): Network { - const clone = new Network(this.name, this.networkId); - this.plugins.forEach((plugin) => { - clone.attachPlugin(plugin.clone()); - }); - return clone; - } - - /** - * Compute the intrinsic energy required for a transaction. - * - * A EnergyCostPlugin can be attached to override the default - * values. - */ - computeIntrinsicEnergy(tx: TransactionLike): number { - const costs = - this.getPlugin( - "org.corebc.plugins.network.EnergyCost", - ) || new EnergyCostPlugin(); - - let energy = costs.txBase; - if (tx.to == null) { - energy += costs.txCreate; - } - if (tx.data) { - for (let i = 2; i < tx.data.length; i += 2) { - if (tx.data.substring(i, i + 2) === "00") { - energy += costs.txDataZero; - } else { - energy += costs.txDataNonzero; - } - } - } - - return energy; - } - - /** - * Returns a new Network for the %%network%% name or networkId. - */ - static from(network?: Networkish): Network { - injectCommonNetworks(); - - // Default network - if (network == null) { - return Network.from("mainnet"); - } - - // Canonical name or chain ID - if (typeof network === "number") { - network = BigInt(network); - } - if (typeof network === "string" || typeof network === "bigint") { - const networkFunc = Networks.get(network); - if (networkFunc) { - return networkFunc(); - } - if (typeof network === "bigint") { - return new Network("unknown", network); - } - - assertArgument(false, "unknown network", "network", network); - } - - // Clonable with network-like abilities - if (typeof (network).clone === "function") { - const clone = (network).clone(); - //if (typeof(network.name) !== "string" || typeof(network.networkId) !== "number") { - //} - return clone; - } - - // Networkish - if (typeof network === "object") { - assertArgument( - typeof network.name === "string" && - typeof network.networkId === "number", - "invalid network object name or networkId", - "network", - network, - ); - - const custom = new Network( - network.name, - network.networkId, - ); - - //if ((network).layerOneConnection) { - // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection)); - //} - - return custom; - } - - assertArgument(false, "invalid network", "network", network); - } - - /** - * Register %%nameOrnetworkId%% with a function which returns - * an instance of a Network representing that chain. - */ - static register( - nameOrnetworkId: string | number | bigint, - networkFunc: () => Network, - ): void { - if (typeof nameOrnetworkId === "number") { - nameOrnetworkId = BigInt(nameOrnetworkId); - } - const existing = Networks.get(nameOrnetworkId); - if (existing) { - assertArgument( - false, - `conflicting network for ${JSON.stringify(existing.name)}`, - "nameOrnetworkId", - nameOrnetworkId, - ); - } - Networks.set(nameOrnetworkId, networkFunc); - } + #name: string; + #networkId: bigint; + + #plugins: Map; + + constructor(name: string, networkId: BigNumberish) { + this.#name = name; + this.#networkId = getBigInt(networkId); + this.#plugins = new Map(); + } + + toJSON(): any { + return { name: this.name, networkId: String(this.networkId) }; + } + + /** + * The network common name. + * + * This is the canonical name, as networks migh have multiple + * names. + */ + get name(): string { + return this.#name; + } + set name(value: string) { + this.#name = value; + } + + /** + * The network chain ID. + */ + get networkId(): bigint { + return this.#networkId; + } + set networkId(value: BigNumberish) { + this.#networkId = getBigInt(value, "networkId"); + } + + /** + * Returns true if %%other%% matches this network. Any chain ID + * must match, and if no chain ID is present, the name must match. + * + * This method does not currently check for additional properties, + * such as ENS address or plug-in compatibility. + */ + matches(other: Networkish): boolean { + if (other == null) { + return false; + } + + if (typeof other === "string") { + try { + return this.networkId === getBigInt(other); + } catch (error) {} + return this.name === other; + } + + if (typeof other === "number" || typeof other === "bigint") { + try { + return this.networkId === getBigInt(other); + } catch (error) {} + return false; + } + + if (typeof other === "object") { + if (other.networkId != null) { + try { + return this.networkId === getBigInt(other.networkId); + } catch (error) {} + return false; + } + if (other.name != null) { + return this.name === other.name; + } + return false; + } + + return false; + } + + /** + * Returns the list of plugins currently attached to this Network. + */ + get plugins(): Array { + return Array.from(this.#plugins.values()); + } + + /** + * Attach a new %%plugin%% to this Network. The network name + * must be unique, excluding any fragment. + */ + attachPlugin(plugin: NetworkPlugin): this { + if (this.#plugins.get(plugin.name)) { + throw new Error(`cannot replace existing plugin: ${plugin.name} `); + } + this.#plugins.set(plugin.name, plugin.clone()); + return this; + } + + /** + * Return the plugin, if any, matching %%name%% exactly. Plugins + * with fragments will not be returned unless %%name%% includes + * a fragment. + */ + getPlugin(name: string): null | T { + return this.#plugins.get(name) || null; + } + + /** + * Gets a list of all plugins that match %%name%%, with otr without + * a fragment. + */ + getPlugins( + basename: string, + ): Array { + return >( + this.plugins.filter((p) => p.name.split("#")[0] === basename) + ); + } + + /** + * Create a copy of this Network. + */ + clone(): Network { + const clone = new Network(this.name, this.networkId); + this.plugins.forEach((plugin) => { + clone.attachPlugin(plugin.clone()); + }); + return clone; + } + + /** + * Compute the intrinsic energy required for a transaction. + * + * A EnergyCostPlugin can be attached to override the default + * values. + */ + computeIntrinsicEnergy(tx: TransactionLike): number { + const costs = + this.getPlugin( + "org.corebc.plugins.network.EnergyCost", + ) || new EnergyCostPlugin(); + + let energy = costs.txBase; + if (tx.to == null) { + energy += costs.txCreate; + } + if (tx.data) { + for (let i = 2; i < tx.data.length; i += 2) { + if (tx.data.substring(i, i + 2) === "00") { + energy += costs.txDataZero; + } else { + energy += costs.txDataNonzero; + } + } + } + + return energy; + } + + /** + * Returns a new Network for the %%network%% name or networkId. + */ + static from(network?: Networkish): Network { + injectCommonNetworks(); + + // Default network + if (network == null) { + return Network.from("mainnet"); + } + + // Canonical name or chain ID + if (typeof network === "number") { + network = BigInt(network); + } + if (typeof network === "string" || typeof network === "bigint") { + const networkFunc = Networks.get(network); + if (networkFunc) { + return networkFunc(); + } + if (typeof network === "bigint") { + return new Network("unknown", network); + } + + assertArgument(false, "unknown network", "network", network); + } + + // Clonable with network-like abilities + if (typeof (network).clone === "function") { + const clone = (network).clone(); + //if (typeof(network.name) !== "string" || typeof(network.networkId) !== "number") { + //} + return clone; + } + + // Networkish + if (typeof network === "object") { + assertArgument( + typeof network.name === "string" && + typeof network.networkId === "number", + "invalid network object name or networkId", + "network", + network, + ); + + const custom = new Network( + network.name, + network.networkId, + ); + + //if ((network).layerOneConnection) { + // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection)); + //} + + return custom; + } + + assertArgument(false, "invalid network", "network", network); + } + + /** + * Register %%nameOrnetworkId%% with a function which returns + * an instance of a Network representing that chain. + */ + static register( + nameOrnetworkId: string | number | bigint, + networkFunc: () => Network, + ): void { + if (typeof nameOrnetworkId === "number") { + nameOrnetworkId = BigInt(nameOrnetworkId); + } + const existing = Networks.get(nameOrnetworkId); + if (existing) { + assertArgument( + false, + `conflicting network for ${JSON.stringify(existing.name)}`, + "nameOrnetworkId", + nameOrnetworkId, + ); + } + Networks.set(nameOrnetworkId, networkFunc); + } } type Options = { - ensNetwork?: number; - priorityFee?: number; - altNames?: Array; + ensNetwork?: number; + priorityFee?: number; + altNames?: Array; }; // See: https://chainlist.org let injected = false; function injectCommonNetworks(): void { - if (injected) { - return; - } - injected = true; - - /// Register popular Core networks - function registerEth( - name: string, - networkId: number, - options: Options, - ): void { - const func = function () { - const network = new Network(name, networkId); - network.attachPlugin(new EnergyCostPlugin()); - return network; - }; - - // Register the network by name and chain ID - Network.register(name, func); - Network.register(networkId, func); - - if (options.altNames) { - options.altNames.forEach((name) => { - Network.register(name, func); - }); - } - } - - registerEth("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] }); - registerEth("ropsten", 3, { ensNetwork: 3 }); - registerEth("rinkeby", 4, { ensNetwork: 4 }); - registerEth("goerli", 5, { ensNetwork: 5 }); - registerEth("kovan", 42, { ensNetwork: 42 }); - registerEth("sepolia", 11155111, {}); - - registerEth("classic", 61, {}); - registerEth("classicKotti", 6, {}); - - registerEth("xdai", 100, { ensNetwork: 1 }); + if (injected) { + return; + } + injected = true; + + /// Register popular Core networks + function registerEth( + name: string, + networkId: number, + options: Options, + ): void { + const func = function () { + const network = new Network(name, networkId); + network.attachPlugin(new EnergyCostPlugin()); + return network; + }; + + // Register the network by name and chain ID + Network.register(name, func); + Network.register(networkId, func); + + if (options.altNames) { + options.altNames.forEach((name) => { + Network.register(name, func); + }); + } + } + + registerEth("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] }); + registerEth("ropsten", 3, { ensNetwork: 3 }); + registerEth("rinkeby", 4, { ensNetwork: 4 }); + registerEth("goerli", 5, { ensNetwork: 5 }); + registerEth("kovan", 42, { ensNetwork: 42 }); + registerEth("sepolia", 11155111, {}); + + registerEth("classic", 61, {}); + registerEth("classicKotti", 6, {}); + + registerEth("xdai", 100, { ensNetwork: 1 }); } diff --git a/src.ts/providers/pagination.ts b/src.ts/providers/pagination.ts index 360e5760f..a34899f11 100644 --- a/src.ts/providers/pagination.ts +++ b/src.ts/providers/pagination.ts @@ -1,8 +1,8 @@ export interface PaginationResult extends Array { - next(): Promise>; + next(): Promise>; - // The total number of results available or null if unknown - totalResults: null | number; + // The total number of results available or null if unknown + totalResults: null | number; - done: boolean; + done: boolean; } diff --git a/src.ts/providers/plugin-fallback.ts b/src.ts/providers/plugin-fallback.ts index b7b83a6fd..f0c52e337 100644 --- a/src.ts/providers/plugin-fallback.ts +++ b/src.ts/providers/plugin-fallback.ts @@ -2,43 +2,43 @@ import { AbstractProviderPlugin } from "./abstract-provider.js"; import { defineProperties } from "../utils/index.js"; import type { - AbstractProvider, - PerformActionRequest, + AbstractProvider, + PerformActionRequest, } from "./abstract-provider.js"; export const PluginIdFallbackProvider = - "org.corebc.plugins.provider.QualifiedPlugin"; + "org.corebc.plugins.provider.QualifiedPlugin"; export class CheckQualifiedPlugin implements AbstractProviderPlugin { - declare name: string; + declare name: string; - constructor() { - defineProperties(this, { - name: PluginIdFallbackProvider, - }); - } + constructor() { + defineProperties(this, { + name: PluginIdFallbackProvider, + }); + } - connect(provider: AbstractProvider): CheckQualifiedPlugin { - return this; - } + connect(provider: AbstractProvider): CheckQualifiedPlugin { + return this; + } - // Retruns true if this value should be considered qualified for - // inclusion in the quorum. - isQualified(action: PerformActionRequest, result: any): boolean { - return true; - } + // Retruns true if this value should be considered qualified for + // inclusion in the quorum. + isQualified(action: PerformActionRequest, result: any): boolean { + return true; + } } export class PossiblyPrunedTransactionPlugin extends CheckQualifiedPlugin { - isQualified(action: PerformActionRequest, result: any): boolean { - if ( - action.method === "getTransaction" || - action.method === "getTransactionReceipt" - ) { - if (result == null) { - return false; - } - } - return super.isQualified(action, result); - } + isQualified(action: PerformActionRequest, result: any): boolean { + if ( + action.method === "getTransaction" || + action.method === "getTransactionReceipt" + ) { + if (result == null) { + return false; + } + } + return super.isQualified(action, result); + } } diff --git a/src.ts/providers/plugins-network.ts b/src.ts/providers/plugins-network.ts index 251ff742c..c64a3e628 100644 --- a/src.ts/providers/plugins-network.ts +++ b/src.ts/providers/plugins-network.ts @@ -4,101 +4,101 @@ import { assertArgument } from "../utils/index.js"; import type { FeeData, Provider } from "./provider.js"; export class NetworkPlugin { - readonly name!: string; + readonly name!: string; - constructor(name: string) { - defineProperties(this, { name }); - } + constructor(name: string) { + defineProperties(this, { name }); + } - clone(): NetworkPlugin { - return new NetworkPlugin(this.name); - } + clone(): NetworkPlugin { + return new NetworkPlugin(this.name); + } - // validate(network: Network): NetworkPlugin { - // return this; - // } + // validate(network: Network): NetworkPlugin { + // return this; + // } } // Networks can use this plugin to override calculations for the // intrinsic energy cost of a transaction for networks that differ // from the latest hardfork on Core mainnet. export type EnergyCostParameters = { - txBase?: number; - txCreate?: number; - txDataZero?: number; - txDataNonzero?: number; - txAccessListStorageKey?: number; - txAccessListAddress?: number; + txBase?: number; + txCreate?: number; + txDataZero?: number; + txDataNonzero?: number; + txAccessListStorageKey?: number; + txAccessListAddress?: number; }; export class EnergyCostPlugin - extends NetworkPlugin - implements EnergyCostParameters + extends NetworkPlugin + implements EnergyCostParameters { - readonly effectiveBlock!: number; - - readonly txBase!: number; - readonly txCreate!: number; - readonly txDataZero!: number; - readonly txDataNonzero!: number; - readonly txAccessListStorageKey!: number; - readonly txAccessListAddress!: number; - - constructor(effectiveBlock?: number, costs?: EnergyCostParameters) { - if (effectiveBlock == null) { - effectiveBlock = 0; - } - super(`org.corebc.network.plugins.EnergyCost#${effectiveBlock || 0}`); - - const props: Record = { effectiveBlock }; - function set(name: keyof EnergyCostParameters, nullish: number): void { - let value = (costs || {})[name]; - if (value == null) { - value = nullish; - } - assertArgument( - typeof value === "number", - `invalud value for ${name}`, - "costs", - costs, - ); - props[name] = value; - } - - set("txBase", 21000); - set("txCreate", 32000); - set("txDataZero", 4); - set("txDataNonzero", 16); - set("txAccessListStorageKey", 1900); - set("txAccessListAddress", 2400); - - defineProperties(this, props); - } - - clone(): EnergyCostPlugin { - return new EnergyCostPlugin(this.effectiveBlock, this); - } + readonly effectiveBlock!: number; + + readonly txBase!: number; + readonly txCreate!: number; + readonly txDataZero!: number; + readonly txDataNonzero!: number; + readonly txAccessListStorageKey!: number; + readonly txAccessListAddress!: number; + + constructor(effectiveBlock?: number, costs?: EnergyCostParameters) { + if (effectiveBlock == null) { + effectiveBlock = 0; + } + super(`org.corebc.network.plugins.EnergyCost#${effectiveBlock || 0}`); + + const props: Record = { effectiveBlock }; + function set(name: keyof EnergyCostParameters, nullish: number): void { + let value = (costs || {})[name]; + if (value == null) { + value = nullish; + } + assertArgument( + typeof value === "number", + `invalud value for ${name}`, + "costs", + costs, + ); + props[name] = value; + } + + set("txBase", 21000); + set("txCreate", 32000); + set("txDataZero", 4); + set("txDataNonzero", 16); + set("txAccessListStorageKey", 1900); + set("txAccessListAddress", 2400); + + defineProperties(this, props); + } + + clone(): EnergyCostPlugin { + return new EnergyCostPlugin(this.effectiveBlock, this); + } } export class FeeDataNetworkPlugin extends NetworkPlugin { - readonly #feeDataFunc: (provider: Provider) => Promise; + readonly #feeDataFunc: (provider: Provider) => Promise; - get feeDataFunc(): (provider: Provider) => Promise { - return this.#feeDataFunc; - } + get feeDataFunc(): (provider: Provider) => Promise { + return this.#feeDataFunc; + } - constructor(feeDataFunc: (provider: Provider) => Promise) { - super("org.corebc.plugins.network.FeeData"); - this.#feeDataFunc = feeDataFunc; - } + constructor(feeDataFunc: (provider: Provider) => Promise) { + super("org.corebc.plugins.network.FeeData"); + this.#feeDataFunc = feeDataFunc; + } - async getFeeData(provider: Provider): Promise { - return await this.#feeDataFunc(provider); - } + async getFeeData(provider: Provider): Promise { + return await this.#feeDataFunc(provider); + } - clone(): FeeDataNetworkPlugin { - return new FeeDataNetworkPlugin(this.#feeDataFunc); - } + clone(): FeeDataNetworkPlugin { + return new FeeDataNetworkPlugin(this.#feeDataFunc); + } } /* diff --git a/src.ts/providers/provider-alchemy.ts b/src.ts/providers/provider-alchemy.ts index 6fb324f76..056e2bb0a 100644 --- a/src.ts/providers/provider-alchemy.ts +++ b/src.ts/providers/provider-alchemy.ts @@ -4,11 +4,11 @@ * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] */ import { - defineProperties, - resolveProperties, - assert, - assertArgument, - FetchRequest, + defineProperties, + resolveProperties, + assert, + assertArgument, + FetchRequest, } from "../utils/index.js"; import { showThrottleMessage } from "./community.js"; @@ -16,8 +16,8 @@ import { Network } from "./network.js"; import { JsonRpcProvider } from "./provider-jsonrpc.js"; import type { - AbstractProvider, - PerformActionRequest, + AbstractProvider, + PerformActionRequest, } from "./abstract-provider.js"; import type { CommunityResourcable } from "./community.js"; import type { Networkish } from "./network.js"; @@ -25,29 +25,29 @@ import type { Networkish } from "./network.js"; const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; function getHost(name: string): string { - switch (name) { - case "mainnet": - return "eth-mainnet.alchemyapi.io"; - case "goerli": - return "eth-goerli.g.alchemy.com"; - case "sepolia": - return "eth-sepolia.g.alchemy.com"; - - case "arbitrum": - return "arb-mainnet.g.alchemy.com"; - case "arbitrum-goerli": - return "arb-goerli.g.alchemy.com"; - case "matic": - return "polygon-mainnet.g.alchemy.com"; - case "matic-mumbai": - return "polygon-mumbai.g.alchemy.com"; - case "optimism": - return "opt-mainnet.g.alchemy.com"; - case "optimism-goerli": - return "opt-goerli.g.alchemy.com"; - } - - assertArgument(false, "unsupported network", "network", name); + switch (name) { + case "mainnet": + return "eth-mainnet.alchemyapi.io"; + case "goerli": + return "eth-goerli.g.alchemy.com"; + case "sepolia": + return "eth-sepolia.g.alchemy.com"; + + case "arbitrum": + return "arb-mainnet.g.alchemy.com"; + case "arbitrum-goerli": + return "arb-goerli.g.alchemy.com"; + case "matic": + return "polygon-mainnet.g.alchemy.com"; + case "matic-mumbai": + return "polygon-mumbai.g.alchemy.com"; + case "optimism": + return "opt-mainnet.g.alchemy.com"; + case "optimism-goerli": + return "opt-goerli.g.alchemy.com"; + } + + assertArgument(false, "unsupported network", "network", name); } /** @@ -62,97 +62,97 @@ function getHost(name: string): string { * @_docloc: api/providers/thirdparty */ export class AlchemyProvider - extends JsonRpcProvider - implements CommunityResourcable + extends JsonRpcProvider + implements CommunityResourcable { - readonly apiKey!: string; - - constructor(_network?: Networkish, apiKey?: null | string) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (apiKey == null) { - apiKey = defaultApiKey; - } - - const request = AlchemyProvider.getRequest(network, apiKey); - super(request, network, { staticNetwork: network }); - - defineProperties(this, { apiKey }); - } - - _getProvider(networkId: number): AbstractProvider { - try { - return new AlchemyProvider(networkId, this.apiKey); - } catch (error) {} - return super._getProvider(networkId); - } - - async _perform(req: PerformActionRequest): Promise { - // https://docs.alchemy.com/reference/trace-transaction - if (req.method === "getTransactionResult") { - const { trace, tx } = await resolveProperties({ - trace: this.send("trace_transaction", [req.hash]), - tx: this.getTransaction(req.hash), - }); - if (trace == null || tx == null) { - return null; - } - - let data: undefined | string; - let error = false; - try { - data = trace[0].result.output; - error = trace[0].error === "Reverted"; - } catch (error) {} - - if (data) { - assert( - !error, - "an error occurred during transaction executions", - "CALL_EXCEPTION", - { - action: "getTransactionResult", - data, - reason: null, - transaction: tx, - invocation: null, - revert: null, // @TODO - }, - ); - return data; - } - - assert(false, "could not parse trace result", "BAD_DATA", { - value: trace, - }); - } - - return await super._perform(req); - } - - isCommunityResource(): boolean { - return this.apiKey === defaultApiKey; - } - - static getRequest(network: Network, apiKey?: string): FetchRequest { - if (apiKey == null) { - apiKey = defaultApiKey; - } - - const request = new FetchRequest( - `https:/\/${getHost(network.name)}/v2/${apiKey}`, - ); - request.allowGzip = true; - - if (apiKey === defaultApiKey) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("alchemy"); - return true; - }; - } - - return request; - } + readonly apiKey!: string; + + constructor(_network?: Networkish, apiKey?: null | string) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (apiKey == null) { + apiKey = defaultApiKey; + } + + const request = AlchemyProvider.getRequest(network, apiKey); + super(request, network, { staticNetwork: network }); + + defineProperties(this, { apiKey }); + } + + _getProvider(networkId: number): AbstractProvider { + try { + return new AlchemyProvider(networkId, this.apiKey); + } catch (error) {} + return super._getProvider(networkId); + } + + async _perform(req: PerformActionRequest): Promise { + // https://docs.alchemy.com/reference/trace-transaction + if (req.method === "getTransactionResult") { + const { trace, tx } = await resolveProperties({ + trace: this.send("trace_transaction", [req.hash]), + tx: this.getTransaction(req.hash), + }); + if (trace == null || tx == null) { + return null; + } + + let data: undefined | string; + let error = false; + try { + data = trace[0].result.output; + error = trace[0].error === "Reverted"; + } catch (error) {} + + if (data) { + assert( + !error, + "an error occurred during transaction executions", + "CALL_EXCEPTION", + { + action: "getTransactionResult", + data, + reason: null, + transaction: tx, + invocation: null, + revert: null, // @TODO + }, + ); + return data; + } + + assert(false, "could not parse trace result", "BAD_DATA", { + value: trace, + }); + } + + return await super._perform(req); + } + + isCommunityResource(): boolean { + return this.apiKey === defaultApiKey; + } + + static getRequest(network: Network, apiKey?: string): FetchRequest { + if (apiKey == null) { + apiKey = defaultApiKey; + } + + const request = new FetchRequest( + `https:/\/${getHost(network.name)}/v2/${apiKey}`, + ); + request.allowGzip = true; + + if (apiKey === defaultApiKey) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("alchemy"); + return true; + }; + } + + return request; + } } diff --git a/src.ts/providers/provider-ankr.ts b/src.ts/providers/provider-ankr.ts index 005652fc4..3b5e2d5e3 100644 --- a/src.ts/providers/provider-ankr.ts +++ b/src.ts/providers/provider-ankr.ts @@ -12,9 +12,9 @@ * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] */ import { - defineProperties, - FetchRequest, - assertArgument, + defineProperties, + FetchRequest, + assertArgument, } from "../utils/index.js"; import { AbstractProvider } from "./abstract-provider.js"; @@ -27,21 +27,21 @@ import type { Networkish } from "./network.js"; import type { JsonRpcError, JsonRpcPayload } from "./provider-jsonrpc.js"; const defaultApiKey = - "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; + "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; function getHost(name: string): string { - switch (name) { - case "mainnet": - return "rpc.ankr.com/eth"; - case "goerli": - return "rpc.ankr.com/xcb_goerli"; - case "matic": - return "rpc.ankr.com/polygon"; - case "arbitrum": - return "rpc.ankr.com/arbitrum"; - } - - assertArgument(false, "unsupported network", "network", name); + switch (name) { + case "mainnet": + return "rpc.ankr.com/eth"; + case "goerli": + return "rpc.ankr.com/xcb_goerli"; + case "matic": + return "rpc.ankr.com/polygon"; + case "arbitrum": + return "rpc.ankr.com/arbitrum"; + } + + assertArgument(false, "unsupported network", "network", name); } /** @@ -54,84 +54,84 @@ function getHost(name: string): string { * recommended to [sign up here](link-ankr-signup). */ export class AnkrProvider - extends JsonRpcProvider - implements CommunityResourcable + extends JsonRpcProvider + implements CommunityResourcable { - /** - * The API key for the Ankr connection. - */ - readonly apiKey!: string; - - /** - * Create a new **AnkrProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network?: Networkish, apiKey?: null | string) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (apiKey == null) { - apiKey = defaultApiKey; - } - - // Ankr does not support filterId, so we force polling - const options = { polling: true, staticNetwork: network }; - - const request = AnkrProvider.getRequest(network, apiKey); - super(request, network, options); - - defineProperties(this, { apiKey }); - } - - _getProvider(networkId: number): AbstractProvider { - try { - return new AnkrProvider(networkId, this.apiKey); - } catch (error) {} - return super._getProvider(networkId); - } - - /** - * Returns a prepared request for connecting to %%network%% with - * %%apiKey%%. - */ - static getRequest(network: Network, apiKey?: null | string): FetchRequest { - if (apiKey == null) { - apiKey = defaultApiKey; - } - - const request = new FetchRequest( - `https:/\/${getHost(network.name)}/${apiKey}`, - ); - request.allowGzip = true; - - if (apiKey === defaultApiKey) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("AnkrProvider"); - return true; - }; - } - - return request; - } - - getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error { - if (payload.method === "xcb_sendRawTransaction") { - if ( - error && - error.error && - error.error.message === "INTERNAL_ERROR: could not replace existing tx" - ) { - error.error.message = "replacement transaction underpriced"; - } - } - - return super.getRpcError(payload, error); - } - - isCommunityResource(): boolean { - return this.apiKey === defaultApiKey; - } + /** + * The API key for the Ankr connection. + */ + readonly apiKey!: string; + + /** + * Create a new **AnkrProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network?: Networkish, apiKey?: null | string) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (apiKey == null) { + apiKey = defaultApiKey; + } + + // Ankr does not support filterId, so we force polling + const options = { polling: true, staticNetwork: network }; + + const request = AnkrProvider.getRequest(network, apiKey); + super(request, network, options); + + defineProperties(this, { apiKey }); + } + + _getProvider(networkId: number): AbstractProvider { + try { + return new AnkrProvider(networkId, this.apiKey); + } catch (error) {} + return super._getProvider(networkId); + } + + /** + * Returns a prepared request for connecting to %%network%% with + * %%apiKey%%. + */ + static getRequest(network: Network, apiKey?: null | string): FetchRequest { + if (apiKey == null) { + apiKey = defaultApiKey; + } + + const request = new FetchRequest( + `https:/\/${getHost(network.name)}/${apiKey}`, + ); + request.allowGzip = true; + + if (apiKey === defaultApiKey) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("AnkrProvider"); + return true; + }; + } + + return request; + } + + getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error { + if (payload.method === "xcb_sendRawTransaction") { + if ( + error && + error.error && + error.error.message === "INTERNAL_ERROR: could not replace existing tx" + ) { + error.error.message = "replacement transaction underpriced"; + } + } + + return super.getRpcError(payload, error); + } + + isCommunityResource(): boolean { + return this.apiKey === defaultApiKey; + } } diff --git a/src.ts/providers/provider-browser.ts b/src.ts/providers/provider-browser.ts index f6129e7ad..8d95309fb 100644 --- a/src.ts/providers/provider-browser.ts +++ b/src.ts/providers/provider-browser.ts @@ -3,145 +3,145 @@ import { assertArgument } from "../utils/index.js"; import { JsonRpcApiPollingProvider } from "./provider-jsonrpc.js"; import type { - JsonRpcError, - JsonRpcPayload, - JsonRpcResult, - JsonRpcSigner, + JsonRpcError, + JsonRpcPayload, + JsonRpcResult, + JsonRpcSigner, } from "./provider-jsonrpc.js"; import type { Networkish } from "./network.js"; export interface Eip1193Provider { - request(request: { - method: string; - params?: Array | Record; - }): Promise; + request(request: { + method: string; + params?: Array | Record; + }): Promise; } export type DebugEventBrowserProvider = - | { - action: "sendEip1193Payload"; - payload: { method: string; params: Array }; - } - | { - action: "receiveEip1193Result"; - result: any; - } - | { - action: "receiveEip1193Error"; - error: Error; - }; + | { + action: "sendEip1193Payload"; + payload: { method: string; params: Array }; + } + | { + action: "receiveEip1193Result"; + result: any; + } + | { + action: "receiveEip1193Error"; + error: Error; + }; export class BrowserProvider extends JsonRpcApiPollingProvider { - #request: ( - method: string, - params: Array | Record, - ) => Promise; - - constructor(core: Eip1193Provider, network?: Networkish) { - super(network, { batchMaxCount: 1 }); - - this.#request = async ( - method: string, - params: Array | Record, - ) => { - const payload = { method, params }; - this.emit("debug", { action: "sendEip1193Request", payload }); - try { - const result = await core.request(payload); - this.emit("debug", { action: "receiveEip1193Result", result }); - return result; - } catch (e: any) { - const error = new Error(e.message); - (error).code = e.code; - (error).data = e.data; - (error).payload = payload; - this.emit("debug", { action: "receiveEip1193Error", error }); - throw error; - } - }; - } - - async send( - method: string, - params: Array | Record, - ): Promise { - await this._start(); - - return await super.send(method, params); - } - - async _send( - payload: JsonRpcPayload | Array, - ): Promise> { - assertArgument( - !Array.isArray(payload), - "EIP-1193 does not support batch request", - "payload", - payload, - ); - - try { - const result = await this.#request(payload.method, payload.params || []); - return [{ id: payload.id, result }]; - } catch (e: any) { - return [ - { - id: payload.id, - error: { code: e.code, data: e.data, message: e.message }, - }, - ]; - } - } - - getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error { - error = JSON.parse(JSON.stringify(error)); - - // EIP-1193 gives us some machine-readable error codes, so rewrite - // them into - switch (error.error.code || -1) { - case 4001: - error.error.message = `corebc-user-denied: ${error.error.message}`; - break; - case 4200: - error.error.message = `corebc-unsupported: ${error.error.message}`; - break; - } - - return super.getRpcError(payload, error); - } - - async hasSigner(address: number | string): Promise { - if (address == null) { - address = 0; - } - - const accounts = await this.send("xcb_accounts", []); - if (typeof address === "number") { - return accounts.length > address; - } - - address = address.toLowerCase(); - return ( - accounts.filter((a: string) => a.toLowerCase() === address).length !== 0 - ); - } - - async getSigner(address?: number | string): Promise { - if (address == null) { - address = 0; - } - - if (!(await this.hasSigner(address))) { - try { - //const resp = - await this.#request("xcb_requestAccounts", []); - //console.log("RESP", resp); - } catch (error: any) { - const payload = error.payload; - throw this.getRpcError(payload, { id: payload.id, error }); - } - } - - return await super.getSigner(address); - } + #request: ( + method: string, + params: Array | Record, + ) => Promise; + + constructor(core: Eip1193Provider, network?: Networkish) { + super(network, { batchMaxCount: 1 }); + + this.#request = async ( + method: string, + params: Array | Record, + ) => { + const payload = { method, params }; + this.emit("debug", { action: "sendEip1193Request", payload }); + try { + const result = await core.request(payload); + this.emit("debug", { action: "receiveEip1193Result", result }); + return result; + } catch (e: any) { + const error = new Error(e.message); + (error).code = e.code; + (error).data = e.data; + (error).payload = payload; + this.emit("debug", { action: "receiveEip1193Error", error }); + throw error; + } + }; + } + + async send( + method: string, + params: Array | Record, + ): Promise { + await this._start(); + + return await super.send(method, params); + } + + async _send( + payload: JsonRpcPayload | Array, + ): Promise> { + assertArgument( + !Array.isArray(payload), + "EIP-1193 does not support batch request", + "payload", + payload, + ); + + try { + const result = await this.#request(payload.method, payload.params || []); + return [{ id: payload.id, result }]; + } catch (e: any) { + return [ + { + id: payload.id, + error: { code: e.code, data: e.data, message: e.message }, + }, + ]; + } + } + + getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error { + error = JSON.parse(JSON.stringify(error)); + + // EIP-1193 gives us some machine-readable error codes, so rewrite + // them into + switch (error.error.code || -1) { + case 4001: + error.error.message = `corebc-user-denied: ${error.error.message}`; + break; + case 4200: + error.error.message = `corebc-unsupported: ${error.error.message}`; + break; + } + + return super.getRpcError(payload, error); + } + + async hasSigner(address: number | string): Promise { + if (address == null) { + address = 0; + } + + const accounts = await this.send("xcb_accounts", []); + if (typeof address === "number") { + return accounts.length > address; + } + + address = address.toLowerCase(); + return ( + accounts.filter((a: string) => a.toLowerCase() === address).length !== 0 + ); + } + + async getSigner(address?: number | string): Promise { + if (address == null) { + address = 0; + } + + if (!(await this.hasSigner(address))) { + try { + //const resp = + await this.#request("xcb_requestAccounts", []); + //console.log("RESP", resp); + } catch (error: any) { + const payload = error.payload; + throw this.getRpcError(payload, { id: payload.id, error }); + } + } + + return await super.getSigner(address); + } } diff --git a/src.ts/providers/provider-cloudflare.ts b/src.ts/providers/provider-cloudflare.ts index a2e20fda0..6e80a93df 100644 --- a/src.ts/providers/provider-cloudflare.ts +++ b/src.ts/providers/provider-cloudflare.ts @@ -15,17 +15,17 @@ import type { Networkish } from "./network.js"; * About Cloudflare... */ export class CloudflareProvider extends JsonRpcProvider { - constructor(_network?: Networkish) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - assertArgument( - network.name === "mainnet", - "unsupported network", - "network", - _network, - ); - super("https://cloudflare-eth.com/", network, { staticNetwork: network }); - } + constructor(_network?: Networkish) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + assertArgument( + network.name === "mainnet", + "unsupported network", + "network", + _network, + ); + super("https://cloudflare-eth.com/", network, { staticNetwork: network }); + } } diff --git a/src.ts/providers/provider-fallback.ts b/src.ts/providers/provider-fallback.ts index 967de3aaf..dbc58f386 100644 --- a/src.ts/providers/provider-fallback.ts +++ b/src.ts/providers/provider-fallback.ts @@ -4,10 +4,10 @@ * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider] */ import { - getBigInt, - getNumber, - assert, - assertArgument, + getBigInt, + getNumber, + assert, + assertArgument, } from "../utils/index.js"; import { AbstractProvider } from "./abstract-provider.js"; @@ -20,49 +20,49 @@ const BN_1 = BigInt("1"); const BN_2 = BigInt("2"); function shuffle(array: Array): void { - for (let i = array.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - const tmp = array[i]; - array[i] = array[j]; - array[j] = tmp; - } + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + const tmp = array[i]; + array[i] = array[j]; + array[j] = tmp; + } } function stall(duration: number): Promise { - return new Promise((resolve) => { - setTimeout(resolve, duration); - }); + return new Promise((resolve) => { + setTimeout(resolve, duration); + }); } function getTime(): number { - return new Date().getTime(); + return new Date().getTime(); } function stringify(value: any): string { - return JSON.stringify(value, (key, value) => { - if (typeof value === "bigint") { - return { type: "bigint", value: value.toString() }; - } - return value; - }); + return JSON.stringify(value, (key, value) => { + if (typeof value === "bigint") { + return { type: "bigint", value: value.toString() }; + } + return value; + }); } /** * A configuration entry for how to use a [[Provider]]. */ export interface FallbackProviderConfig { - // The provider - provider: AbstractProvider; + // The provider + provider: AbstractProvider; - // How long to wait for a response before getting impatient - // and ispatching the next provider - stallTimeout?: number; + // How long to wait for a response before getting impatient + // and ispatching the next provider + stallTimeout?: number; - // Lower values are dispatched first - priority?: number; + // Lower values are dispatched first + priority?: number; - // How much this provider contributes to the quorum - weight?: number; + // How much this provider contributes to the quorum + weight?: number; } const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 }; @@ -72,287 +72,286 @@ const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 }; /** * The statistics and state maintained for a [[Provider]]. */ -export interface FallbackProviderState - extends Required { - // The most recent blockNumber this provider has reported (-2 if none) - blockNumber: number; +export interface FallbackProviderState extends Required { + // The most recent blockNumber this provider has reported (-2 if none) + blockNumber: number; - // The number of total requests ever sent to this provider - requests: number; + // The number of total requests ever sent to this provider + requests: number; - // The number of responses that errored - errorResponses: number; + // The number of responses that errored + errorResponses: number; - // The number of responses that occured after the result resolved - lateResponses: number; + // The number of responses that occured after the result resolved + lateResponses: number; - // How many times syncing was required to catch up the expected block - outOfSync: number; + // How many times syncing was required to catch up the expected block + outOfSync: number; - // The number of requests which reported unsupported operation - unsupportedEvents: number; + // The number of requests which reported unsupported operation + unsupportedEvents: number; - // A rolling average (5% current duration) for response time - rollingDuration: number; + // A rolling average (5% current duration) for response time + rollingDuration: number; - // The ratio of quorum-agreed results to total - score: number; + // The ratio of quorum-agreed results to total + score: number; } interface Config extends FallbackProviderState { - _updateNumber: null | Promise; - _network: null | Network; - _totalTime: number; + _updateNumber: null | Promise; + _network: null | Network; + _totalTime: number; } const defaultState = { - blockNumber: -2, - requests: 0, - lateResponses: 0, - errorResponses: 0, - outOfSync: -1, - unsupportedEvents: 0, - rollingDuration: 0, - score: 0, - _network: null, - _updateNumber: null, - _totalTime: 0, + blockNumber: -2, + requests: 0, + lateResponses: 0, + errorResponses: 0, + outOfSync: -1, + unsupportedEvents: 0, + rollingDuration: 0, + score: 0, + _network: null, + _updateNumber: null, + _totalTime: 0, }; async function waitForSync(config: Config, blockNumber: number): Promise { - while (config.blockNumber < 0 || config.blockNumber < blockNumber) { - if (!config._updateNumber) { - config._updateNumber = (async () => { - const blockNumber = await config.provider.getBlockNumber(); - if (blockNumber > config.blockNumber) { - config.blockNumber = blockNumber; - } - config._updateNumber = null; - })(); - } - await config._updateNumber; - config.outOfSync++; - } + while (config.blockNumber < 0 || config.blockNumber < blockNumber) { + if (!config._updateNumber) { + config._updateNumber = (async () => { + const blockNumber = await config.provider.getBlockNumber(); + if (blockNumber > config.blockNumber) { + config.blockNumber = blockNumber; + } + config._updateNumber = null; + })(); + } + await config._updateNumber; + config.outOfSync++; + } } /** * Additional options to configure a [[FallbackProvider]]. */ export type FallbackProviderOptions = { - // How many providers must agree on a value before reporting - // back the response - quorum: number; - - // How many providers must have reported the same event - // for it to be emitted - eventQuorum: number; - - // How many providers to dispatch each event to simultaneously. - // Set this to 0 to use getLog polling, which implies eventQuorum - // is equal to quorum. - eventWorkers: number; + // How many providers must agree on a value before reporting + // back the response + quorum: number; + + // How many providers must have reported the same event + // for it to be emitted + eventQuorum: number; + + // How many providers to dispatch each event to simultaneously. + // Set this to 0 to use getLog polling, which implies eventQuorum + // is equal to quorum. + eventWorkers: number; }; type RunnerResult = { result: any } | { error: Error }; type RunnerState = { - config: Config; - staller: null | Promise; - didBump: boolean; - perform: null | Promise; - result: null | RunnerResult; + config: Config; + staller: null | Promise; + didBump: boolean; + perform: null | Promise; + result: null | RunnerResult; }; function _normalize(value: any): string { - if (value == null) { - return "null"; - } - - if (Array.isArray(value)) { - return "[" + value.map(_normalize).join(",") + "]"; - } - - if (typeof value === "object" && typeof value.toJSON === "function") { - return _normalize(value.toJSON()); - } - - switch (typeof value) { - case "boolean": - case "symbol": - return value.toString(); - case "bigint": - case "number": - return BigInt(value).toString(); - case "string": - return JSON.stringify(value); - case "object": { - const keys = Object.keys(value); - keys.sort(); - return ( - "{" + - keys - .map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`) - .join(",") + - "}" - ); - } - } - - console.log("Could not serialize", value); - throw new Error("Hmm..."); + if (value == null) { + return "null"; + } + + if (Array.isArray(value)) { + return "[" + value.map(_normalize).join(",") + "]"; + } + + if (typeof value === "object" && typeof value.toJSON === "function") { + return _normalize(value.toJSON()); + } + + switch (typeof value) { + case "boolean": + case "symbol": + return value.toString(); + case "bigint": + case "number": + return BigInt(value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return ( + "{" + + keys + .map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`) + .join(",") + + "}" + ); + } + } + + console.log("Could not serialize", value); + throw new Error("Hmm..."); } function normalizeResult(value: RunnerResult): { tag: string; value: any } { - if ("error" in value) { - const error = value.error; - return { tag: _normalize(error), value: error }; - } + if ("error" in value) { + const error = value.error; + return { tag: _normalize(error), value: error }; + } - const result = value.result; - return { tag: _normalize(result), value: result }; + const result = value.result; + return { tag: _normalize(result), value: result }; } type TallyResult = { - tag: string; - value: any; - weight: number; + tag: string; + value: any; + weight: number; }; // This strategy picks the highest weight result, as long as the weight is // equal to or greater than quorum function checkQuorum(quorum: number, results: Array): any | Error { - const tally: Map = new Map(); - for (const { value, tag, weight } of results) { - const t = tally.get(tag) || { value, weight: 0 }; - t.weight += weight; - tally.set(tag, t); - } - - let best: null | { value: any; weight: number } = null; - - for (const r of tally.values()) { - if (r.weight >= quorum && (!best || r.weight > best.weight)) { - best = r; - } - } - - if (best) { - return best.value; - } - - return undefined; + const tally: Map = new Map(); + for (const { value, tag, weight } of results) { + const t = tally.get(tag) || { value, weight: 0 }; + t.weight += weight; + tally.set(tag, t); + } + + let best: null | { value: any; weight: number } = null; + + for (const r of tally.values()) { + if (r.weight >= quorum && (!best || r.weight > best.weight)) { + best = r; + } + } + + if (best) { + return best.value; + } + + return undefined; } function getMedian( - quorum: number, - results: Array, + quorum: number, + results: Array, ): undefined | bigint | Error { - let resultWeight = 0; - - const errorMap: Map = new Map(); - let bestError: null | { weight: number; value: Error } = null; - - const values: Array = []; - for (const { value, tag, weight } of results) { - if (value instanceof Error) { - const e = errorMap.get(tag) || { value, weight: 0 }; - e.weight += weight; - errorMap.set(tag, e); - - if (bestError == null || e.weight > bestError.weight) { - bestError = e; - } - } else { - values.push(BigInt(value)); - resultWeight += weight; - } - } - - if (resultWeight < quorum) { - // We have quorum for an error - if (bestError && bestError.weight >= quorum) { - return bestError.value; - } - - // We do not have quorum for a result - return undefined; - } - - // Get the sorted values - values.sort((a, b) => (a < b ? -1 : b > a ? 1 : 0)); - - const mid = Math.floor(values.length / 2); - - // Odd-length; take the middle value - if (values.length % 2) { - return values[mid]; - } - - // Even length; take the ceiling of the mean of the center two values - return (values[mid - 1] + values[mid] + BN_1) / BN_2; + let resultWeight = 0; + + const errorMap: Map = new Map(); + let bestError: null | { weight: number; value: Error } = null; + + const values: Array = []; + for (const { value, tag, weight } of results) { + if (value instanceof Error) { + const e = errorMap.get(tag) || { value, weight: 0 }; + e.weight += weight; + errorMap.set(tag, e); + + if (bestError == null || e.weight > bestError.weight) { + bestError = e; + } + } else { + values.push(BigInt(value)); + resultWeight += weight; + } + } + + if (resultWeight < quorum) { + // We have quorum for an error + if (bestError && bestError.weight >= quorum) { + return bestError.value; + } + + // We do not have quorum for a result + return undefined; + } + + // Get the sorted values + values.sort((a, b) => (a < b ? -1 : b > a ? 1 : 0)); + + const mid = Math.floor(values.length / 2); + + // Odd-length; take the middle value + if (values.length % 2) { + return values[mid]; + } + + // Even length; take the ceiling of the mean of the center two values + return (values[mid - 1] + values[mid] + BN_1) / BN_2; } function getAnyResult( - quorum: number, - results: Array, + quorum: number, + results: Array, ): undefined | any | Error { - // If any value or error meets quorum, that is our preferred result - const result = checkQuorum(quorum, results); - if (result !== undefined) { - return result; - } - - // Otherwise, do we have any result? - for (const r of results) { - if (r.value) { - return r.value; - } - } - - // Nope! - return undefined; + // If any value or error meets quorum, that is our preferred result + const result = checkQuorum(quorum, results); + if (result !== undefined) { + return result; + } + + // Otherwise, do we have any result? + for (const r of results) { + if (r.value) { + return r.value; + } + } + + // Nope! + return undefined; } function getFuzzyMode( - quorum: number, - results: Array, + quorum: number, + results: Array, ): undefined | number { - if (quorum === 1) { - return getNumber(getMedian(quorum, results), "%internal"); - } - - const tally: Map = new Map(); - const add = (result: number, weight: number) => { - const t = tally.get(result) || { result, weight: 0 }; - t.weight += weight; - tally.set(result, t); - }; - - for (const { weight, value } of results) { - const r = getNumber(value); - add(r - 1, weight); - add(r, weight); - add(r + 1, weight); - } - - let bestWeight = 0; - let bestResult: any = undefined; - - for (const { weight, result } of tally.values()) { - // Use this result, if this result meets quorum and has either: - // - a better weight - // - or equal weight, but the result is larger - if ( - weight >= quorum && - (weight > bestWeight || - (bestResult != null && weight === bestWeight && result > bestResult)) - ) { - bestWeight = weight; - bestResult = result; - } - } - - return bestResult; + if (quorum === 1) { + return getNumber(getMedian(quorum, results), "%internal"); + } + + const tally: Map = new Map(); + const add = (result: number, weight: number) => { + const t = tally.get(result) || { result, weight: 0 }; + t.weight += weight; + tally.set(result, t); + }; + + for (const { weight, value } of results) { + const r = getNumber(value); + add(r - 1, weight); + add(r, weight); + add(r + 1, weight); + } + + let bestWeight = 0; + let bestResult: any = undefined; + + for (const { weight, result } of tally.values()) { + // Use this result, if this result meets quorum and has either: + // - a better weight + // - or equal weight, but the result is larger + if ( + weight >= quorum && + (weight > bestWeight || + (bestResult != null && weight === bestWeight && result > bestResult)) + ) { + bestWeight = weight; + bestResult = result; + } + } + + return bestResult; } /** @@ -360,435 +359,435 @@ function getFuzzyMode( * */ export class FallbackProvider extends AbstractProvider { - readonly quorum: number; - readonly eventQuorum: number; - readonly eventWorkers: number; - - readonly #configs: Array; - - #height: number; - #initialSyncPromise: null | Promise; - - constructor( - providers: Array, - network?: Networkish, - ) { - super(network); - this.#configs = providers.map((p) => { - if (p instanceof AbstractProvider) { - return Object.assign({ provider: p }, defaultConfig, defaultState); - } else { - return Object.assign({}, defaultConfig, p, defaultState); - } - }); - - this.#height = -2; - this.#initialSyncPromise = null; - - this.quorum = 2; //Math.ceil(providers.length / 2); - this.eventQuorum = 1; - this.eventWorkers = 1; - - assertArgument( - this.quorum <= this.#configs.reduce((a, c) => a + c.weight, 0), - "quorum exceed provider wieght", - "quorum", - this.quorum, - ); - } - - get providerConfigs(): Array { - return this.#configs.map((c) => { - const result: any = Object.assign({}, c); - for (const key in result) { - if (key[0] === "_") { - delete result[key]; - } - } - return result; - }); - } - - async _detectNetwork(): Promise { - return Network.from( - getBigInt(await this._perform({ method: "networkId" })), - ); - } - - // @TODO: Add support to select providers to be the event subscriber - //_getSubscriber(sub: Subscription): Subscriber { - // throw new Error("@TODO"); - //} - - async _translatePerform( - provider: AbstractProvider, - req: PerformActionRequest, - ): Promise { - switch (req.method) { - case "broadcastTransaction": - return await provider.broadcastTransaction(req.signedTransaction); - case "call": - return await provider.call( - Object.assign({}, req.transaction, { blockTag: req.blockTag }), - ); - case "networkId": - return (await provider.getNetwork()).networkId; - case "estimateEnergy": - return await provider.estimateEnergy(req.transaction); - case "getBalance": - return await provider.getBalance(req.address, req.blockTag); - case "getBlock": { - const block = "blockHash" in req ? req.blockHash : req.blockTag; - return await provider.getBlock(block, req.includeTransactions); - } - case "getBlockNumber": - return await provider.getBlockNumber(); - case "getCode": - return await provider.getCode(req.address, req.blockTag); - case "getEnergyPrice": - return (await provider.getFeeData()).energyPrice; - case "getLogs": - return await provider.getLogs(req.filter); - case "getStorage": - return await provider.getStorage( - req.address, - req.position, - req.blockTag, - ); - case "getTransaction": - return await provider.getTransaction(req.hash); - case "getTransactionCount": - return await provider.getTransactionCount(req.address, req.blockTag); - case "getTransactionReceipt": - return await provider.getTransactionReceipt(req.hash); - case "getTransactionResult": - return await provider.getTransactionResult(req.hash); - } - } - - // Grab the next (random) config that is not already part of - // the running set - #getNextConfig(running: Set): null | Config { - // @TODO: Maybe do a check here to favour (heavily) providers that - // do not require waitForSync and disfavour providers that - // seem down-ish or are behaving slowly - - const configs = Array.from(running).map((r) => r.config); - - // Shuffle the states, sorted by priority - const allConfigs = this.#configs.slice(); - shuffle(allConfigs); - allConfigs.sort((a, b) => b.priority - a.priority); - - for (const config of allConfigs) { - if (configs.indexOf(config) === -1) { - return config; - } - } - - return null; - } - - // Adds a new runner (if available) to running. - #addRunner( - running: Set, - req: PerformActionRequest, - ): null | RunnerState { - const config = this.#getNextConfig(running); - - // No runners available - if (config == null) { - return null; - } - - // Create a new runner - const runner: RunnerState = { - config, - result: null, - didBump: false, - perform: null, - staller: null, - }; - - const now = getTime(); - - // Start performing this operation - runner.perform = (async () => { - try { - config.requests++; - const result = await this._translatePerform(config.provider, req); - runner.result = { result }; - } catch (error: any) { - config.errorResponses++; - runner.result = { error }; - } - - const dt = getTime() - now; - config._totalTime += dt; - - config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt; - - runner.perform = null; - })(); - - // Start a staller; when this times out, it's time to force - // kicking off another runner because we are taking too long - runner.staller = (async () => { - await stall(config.stallTimeout); - runner.staller = null; - })(); - - running.add(runner); - return runner; - } - - // Initializes the blockNumber and network for each runner and - // blocks until initialized - async #initialSync(): Promise { - let initialSync = this.#initialSyncPromise; - if (!initialSync) { - const promises: Array> = []; - this.#configs.forEach((config) => { - promises.push(waitForSync(config, 0)); - promises.push( - (async () => { - config._network = await config.provider.getNetwork(); - })(), - ); - }); - - this.#initialSyncPromise = initialSync = (async () => { - // Wait for all providers to have a block number and network - await Promise.all(promises); - - // Check all the networks match - let networkId: null | bigint = null; - for (const config of this.#configs) { - const network = config._network; - if (networkId == null) { - networkId = network.networkId; - } else if (network.networkId !== networkId) { - assert( - false, - "cannot mix providers on different networks", - "UNSUPPORTED_OPERATION", - { - operation: "new FallbackProvider", - }, - ); - } - } - })(); - } - - await initialSync; - } - - async #checkQuorum( - running: Set, - req: PerformActionRequest, - ): Promise { - // Get all the result objects - const results: Array = []; - for (const runner of running) { - if (runner.result != null) { - const { tag, value } = normalizeResult(runner.result); - results.push({ tag, value, weight: runner.config.weight }); - } - } - - // Are there enough results to event meet quorum? - if (results.reduce((a, r) => a + r.weight, 0) < this.quorum) { - return undefined; - } - - switch (req.method) { - case "getBlockNumber": { - // We need to get the bootstrap block height - if (this.#height === -2) { - this.#height = Math.ceil( - getNumber( - getMedian( - this.quorum, - this.#configs.map((c) => ({ - value: c.blockNumber, - tag: getNumber(c.blockNumber).toString(), - weight: c.weight, - })), - ), - ), - ); - } - - // Find the mode across all the providers, allowing for - // a little drift between block heights - const mode = getFuzzyMode(this.quorum, results); - if (mode === undefined) { - return undefined; - } - if (mode > this.#height) { - this.#height = mode; - } - return this.#height; - } - - case "getEnergyPrice": - case "estimateEnergy": - return getMedian(this.quorum, results); - - case "getBlock": - // Pending blocks are in the mempool and already - // quite untrustworthy; just grab anything - if ("blockTag" in req && req.blockTag === "pending") { - return getAnyResult(this.quorum, results); - } - return checkQuorum(this.quorum, results); - - case "call": - case "networkId": - case "getBalance": - case "getTransactionCount": - case "getCode": - case "getStorage": - case "getTransaction": - case "getTransactionReceipt": - case "getLogs": - return checkQuorum(this.quorum, results); - - case "broadcastTransaction": - return getAnyResult(this.quorum, results); - } - - assert(false, "unsupported method", "UNSUPPORTED_OPERATION", { - operation: `_perform(${stringify((req).method)})`, - }); - } - - async #waitForQuorum( - running: Set, - req: PerformActionRequest, - ): Promise { - if (running.size === 0) { - throw new Error("no runners?!"); - } - - // Any promises that are interesting to watch for; an expired stall - // or a successful perform - const interesting: Array> = []; - - let newRunners = 0; - for (const runner of running) { - // No responses, yet; keep an eye on it - if (runner.perform) { - interesting.push(runner.perform); - } - - // Still stalling... - if (runner.staller) { - interesting.push(runner.staller); - continue; - } - - // This runner has already triggered another runner - if (runner.didBump) { - continue; - } - - // Got a response (result or error) or stalled; kick off another runner - runner.didBump = true; - newRunners++; - } - - // Check if we have reached quorum on a result (or error) - const value = await this.#checkQuorum(running, req); - if (value !== undefined) { - if (value instanceof Error) { - throw value; - } - return value; - } - - // Add any new runners, because a staller timed out or a result - // or error response came in. - for (let i = 0; i < newRunners; i++) { - this.#addRunner(running, req); - } - - // All providers have returned, and we have no result - - assert(interesting.length > 0, "quorum not met", "SERVER_ERROR", { - request: "%sub-requests", - info: { - request: req, - results: Array.from(running).map((r) => stringify(r.result)), - }, - }); - - // Wait for someone to either complete its perform or stall out - await Promise.race(interesting); - - // This is recursive, but at worst case the depth is 2x the - // number of providers (each has a perform and a staller) - return await this.#waitForQuorum(running, req); - } - - async _perform(req: PerformActionRequest): Promise { - // Broadcasting a transaction is rare (ish) and already incurs - // a cost on the user, so spamming is safe-ish. Just send it to - // every backend. - if (req.method === "broadcastTransaction") { - const results = await Promise.all( - this.#configs.map(async ({ provider, weight }) => { - try { - const result = await provider._perform(req); - return Object.assign(normalizeResult({ result }), { weight }); - } catch (error: any) { - return Object.assign(normalizeResult({ error }), { weight }); - } - }), - ); - - const result = getAnyResult(this.quorum, results); - assert( - result !== undefined, - "problem multi-broadcasting", - "SERVER_ERROR", - { - request: "%sub-requests", - info: { request: req, results: results.map(stringify) }, - }, - ); - if (result instanceof Error) { - throw result; - } - return result; - } - - await this.#initialSync(); - - // Bootstrap enough runners to meet quorum - const running: Set = new Set(); - for (let i = 0; i < this.quorum; i++) { - this.#addRunner(running, req); - } - - const result = await this.#waitForQuorum(running, req); - - // Track requests sent to a provider that are still - // outstanding after quorum has been otherwise found - for (const runner of running) { - if (runner.perform && runner.result == null) { - runner.config.lateResponses++; - } - } - - return result; - } - - async destroy(): Promise { - for (const { provider } of this.#configs) { - provider.destroy(); - } - super.destroy(); - } + readonly quorum: number; + readonly eventQuorum: number; + readonly eventWorkers: number; + + readonly #configs: Array; + + #height: number; + #initialSyncPromise: null | Promise; + + constructor( + providers: Array, + network?: Networkish, + ) { + super(network); + this.#configs = providers.map((p) => { + if (p instanceof AbstractProvider) { + return Object.assign({ provider: p }, defaultConfig, defaultState); + } else { + return Object.assign({}, defaultConfig, p, defaultState); + } + }); + + this.#height = -2; + this.#initialSyncPromise = null; + + this.quorum = 2; //Math.ceil(providers.length / 2); + this.eventQuorum = 1; + this.eventWorkers = 1; + + assertArgument( + this.quorum <= this.#configs.reduce((a, c) => a + c.weight, 0), + "quorum exceed provider wieght", + "quorum", + this.quorum, + ); + } + + get providerConfigs(): Array { + return this.#configs.map((c) => { + const result: any = Object.assign({}, c); + for (const key in result) { + if (key[0] === "_") { + delete result[key]; + } + } + return result; + }); + } + + async _detectNetwork(): Promise { + return Network.from( + getBigInt(await this._perform({ method: "networkId" })), + ); + } + + // @TODO: Add support to select providers to be the event subscriber + //_getSubscriber(sub: Subscription): Subscriber { + // throw new Error("@TODO"); + //} + + async _translatePerform( + provider: AbstractProvider, + req: PerformActionRequest, + ): Promise { + switch (req.method) { + case "broadcastTransaction": + return await provider.broadcastTransaction(req.signedTransaction); + case "call": + return await provider.call( + Object.assign({}, req.transaction, { blockTag: req.blockTag }), + ); + case "networkId": + return (await provider.getNetwork()).networkId; + case "estimateEnergy": + return await provider.estimateEnergy(req.transaction); + case "getBalance": + return await provider.getBalance(req.address, req.blockTag); + case "getBlock": { + const block = "blockHash" in req ? req.blockHash : req.blockTag; + return await provider.getBlock(block, req.includeTransactions); + } + case "getBlockNumber": + return await provider.getBlockNumber(); + case "getCode": + return await provider.getCode(req.address, req.blockTag); + case "getEnergyPrice": + return (await provider.getFeeData()).energyPrice; + case "getLogs": + return await provider.getLogs(req.filter); + case "getStorage": + return await provider.getStorage( + req.address, + req.position, + req.blockTag, + ); + case "getTransaction": + return await provider.getTransaction(req.hash); + case "getTransactionCount": + return await provider.getTransactionCount(req.address, req.blockTag); + case "getTransactionReceipt": + return await provider.getTransactionReceipt(req.hash); + case "getTransactionResult": + return await provider.getTransactionResult(req.hash); + } + } + + // Grab the next (random) config that is not already part of + // the running set + #getNextConfig(running: Set): null | Config { + // @TODO: Maybe do a check here to favour (heavily) providers that + // do not require waitForSync and disfavour providers that + // seem down-ish or are behaving slowly + + const configs = Array.from(running).map((r) => r.config); + + // Shuffle the states, sorted by priority + const allConfigs = this.#configs.slice(); + shuffle(allConfigs); + allConfigs.sort((a, b) => b.priority - a.priority); + + for (const config of allConfigs) { + if (configs.indexOf(config) === -1) { + return config; + } + } + + return null; + } + + // Adds a new runner (if available) to running. + #addRunner( + running: Set, + req: PerformActionRequest, + ): null | RunnerState { + const config = this.#getNextConfig(running); + + // No runners available + if (config == null) { + return null; + } + + // Create a new runner + const runner: RunnerState = { + config, + result: null, + didBump: false, + perform: null, + staller: null, + }; + + const now = getTime(); + + // Start performing this operation + runner.perform = (async () => { + try { + config.requests++; + const result = await this._translatePerform(config.provider, req); + runner.result = { result }; + } catch (error: any) { + config.errorResponses++; + runner.result = { error }; + } + + const dt = getTime() - now; + config._totalTime += dt; + + config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt; + + runner.perform = null; + })(); + + // Start a staller; when this times out, it's time to force + // kicking off another runner because we are taking too long + runner.staller = (async () => { + await stall(config.stallTimeout); + runner.staller = null; + })(); + + running.add(runner); + return runner; + } + + // Initializes the blockNumber and network for each runner and + // blocks until initialized + async #initialSync(): Promise { + let initialSync = this.#initialSyncPromise; + if (!initialSync) { + const promises: Array> = []; + this.#configs.forEach((config) => { + promises.push(waitForSync(config, 0)); + promises.push( + (async () => { + config._network = await config.provider.getNetwork(); + })(), + ); + }); + + this.#initialSyncPromise = initialSync = (async () => { + // Wait for all providers to have a block number and network + await Promise.all(promises); + + // Check all the networks match + let networkId: null | bigint = null; + for (const config of this.#configs) { + const network = config._network; + if (networkId == null) { + networkId = network.networkId; + } else if (network.networkId !== networkId) { + assert( + false, + "cannot mix providers on different networks", + "UNSUPPORTED_OPERATION", + { + operation: "new FallbackProvider", + }, + ); + } + } + })(); + } + + await initialSync; + } + + async #checkQuorum( + running: Set, + req: PerformActionRequest, + ): Promise { + // Get all the result objects + const results: Array = []; + for (const runner of running) { + if (runner.result != null) { + const { tag, value } = normalizeResult(runner.result); + results.push({ tag, value, weight: runner.config.weight }); + } + } + + // Are there enough results to event meet quorum? + if (results.reduce((a, r) => a + r.weight, 0) < this.quorum) { + return undefined; + } + + switch (req.method) { + case "getBlockNumber": { + // We need to get the bootstrap block height + if (this.#height === -2) { + this.#height = Math.ceil( + getNumber( + getMedian( + this.quorum, + this.#configs.map((c) => ({ + value: c.blockNumber, + tag: getNumber(c.blockNumber).toString(), + weight: c.weight, + })), + ), + ), + ); + } + + // Find the mode across all the providers, allowing for + // a little drift between block heights + const mode = getFuzzyMode(this.quorum, results); + if (mode === undefined) { + return undefined; + } + if (mode > this.#height) { + this.#height = mode; + } + return this.#height; + } + + case "getEnergyPrice": + case "estimateEnergy": + return getMedian(this.quorum, results); + + case "getBlock": + // Pending blocks are in the mempool and already + // quite untrustworthy; just grab anything + if ("blockTag" in req && req.blockTag === "pending") { + return getAnyResult(this.quorum, results); + } + return checkQuorum(this.quorum, results); + + case "call": + case "networkId": + case "getBalance": + case "getTransactionCount": + case "getCode": + case "getStorage": + case "getTransaction": + case "getTransactionReceipt": + case "getLogs": + return checkQuorum(this.quorum, results); + + case "broadcastTransaction": + return getAnyResult(this.quorum, results); + } + + assert(false, "unsupported method", "UNSUPPORTED_OPERATION", { + operation: `_perform(${stringify((req).method)})`, + }); + } + + async #waitForQuorum( + running: Set, + req: PerformActionRequest, + ): Promise { + if (running.size === 0) { + throw new Error("no runners?!"); + } + + // Any promises that are interesting to watch for; an expired stall + // or a successful perform + const interesting: Array> = []; + + let newRunners = 0; + for (const runner of running) { + // No responses, yet; keep an eye on it + if (runner.perform) { + interesting.push(runner.perform); + } + + // Still stalling... + if (runner.staller) { + interesting.push(runner.staller); + continue; + } + + // This runner has already triggered another runner + if (runner.didBump) { + continue; + } + + // Got a response (result or error) or stalled; kick off another runner + runner.didBump = true; + newRunners++; + } + + // Check if we have reached quorum on a result (or error) + const value = await this.#checkQuorum(running, req); + if (value !== undefined) { + if (value instanceof Error) { + throw value; + } + return value; + } + + // Add any new runners, because a staller timed out or a result + // or error response came in. + for (let i = 0; i < newRunners; i++) { + this.#addRunner(running, req); + } + + // All providers have returned, and we have no result + + assert(interesting.length > 0, "quorum not met", "SERVER_ERROR", { + request: "%sub-requests", + info: { + request: req, + results: Array.from(running).map((r) => stringify(r.result)), + }, + }); + + // Wait for someone to either complete its perform or stall out + await Promise.race(interesting); + + // This is recursive, but at worst case the depth is 2x the + // number of providers (each has a perform and a staller) + return await this.#waitForQuorum(running, req); + } + + async _perform(req: PerformActionRequest): Promise { + // Broadcasting a transaction is rare (ish) and already incurs + // a cost on the user, so spamming is safe-ish. Just send it to + // every backend. + if (req.method === "broadcastTransaction") { + const results = await Promise.all( + this.#configs.map(async ({ provider, weight }) => { + try { + const result = await provider._perform(req); + return Object.assign(normalizeResult({ result }), { weight }); + } catch (error: any) { + return Object.assign(normalizeResult({ error }), { weight }); + } + }), + ); + + const result = getAnyResult(this.quorum, results); + assert( + result !== undefined, + "problem multi-broadcasting", + "SERVER_ERROR", + { + request: "%sub-requests", + info: { request: req, results: results.map(stringify) }, + }, + ); + if (result instanceof Error) { + throw result; + } + return result; + } + + await this.#initialSync(); + + // Bootstrap enough runners to meet quorum + const running: Set = new Set(); + for (let i = 0; i < this.quorum; i++) { + this.#addRunner(running, req); + } + + const result = await this.#waitForQuorum(running, req); + + // Track requests sent to a provider that are still + // outstanding after quorum has been otherwise found + for (const runner of running) { + if (runner.perform && runner.result == null) { + runner.config.lateResponses++; + } + } + + return result; + } + + async destroy(): Promise { + for (const { provider } of this.#configs) { + provider.destroy(); + } + super.destroy(); + } } diff --git a/src.ts/providers/provider-infura.ts b/src.ts/providers/provider-infura.ts index 3a3ca3ddc..76926f945 100644 --- a/src.ts/providers/provider-infura.ts +++ b/src.ts/providers/provider-infura.ts @@ -17,10 +17,10 @@ * @_subsection: api/providers/thirdparty:INFURA [providers-infura] */ import { - defineProperties, - FetchRequest, - assert, - assertArgument, + defineProperties, + FetchRequest, + assert, + assertArgument, } from "../utils/index.js"; import { showThrottleMessage } from "./community.js"; @@ -35,29 +35,29 @@ import type { Networkish } from "./network.js"; const defaultProjectId = "84842078b09946638c03157f83405213"; function getHost(name: string): string { - switch (name) { - case "mainnet": - return "mainnet.infura.io"; - case "goerli": - return "goerli.infura.io"; - case "sepolia": - return "sepolia.infura.io"; - - case "arbitrum": - return "arbitrum-mainnet.infura.io"; - case "arbitrum-goerli": - return "arbitrum-goerli.infura.io"; - case "matic": - return "polygon-mainnet.infura.io"; - case "matic-mumbai": - return "polygon-mumbai.infura.io"; - case "optimism": - return "optimism-mainnet.infura.io"; - case "optimism-goerli": - return "optimism-goerli.infura.io"; - } - - assertArgument(false, "unsupported network", "network", name); + switch (name) { + case "mainnet": + return "mainnet.infura.io"; + case "goerli": + return "goerli.infura.io"; + case "sepolia": + return "sepolia.infura.io"; + + case "arbitrum": + return "arbitrum-mainnet.infura.io"; + case "arbitrum-goerli": + return "arbitrum-goerli.infura.io"; + case "matic": + return "polygon-mainnet.infura.io"; + case "matic-mumbai": + return "polygon-mumbai.infura.io"; + case "optimism": + return "optimism-mainnet.infura.io"; + case "optimism-goerli": + return "optimism-goerli.infura.io"; + } + + assertArgument(false, "unsupported network", "network", name); } /** @@ -70,48 +70,48 @@ function getHost(name: string): string { * recommended to [sign up here](link-infura-signup). */ export class InfuraWebSocketProvider - extends WebSocketProvider - implements CommunityResourcable + extends WebSocketProvider + implements CommunityResourcable { - /** - * The Project ID for the INFURA connection. - */ - readonly projectId!: string; - - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - readonly projectSecret!: null | string; - - /** - * Creates a new **InfuraWebSocketProvider**. - */ - constructor(network?: Networkish, projectId?: string) { - const provider = new InfuraProvider(network, projectId); - - const req = provider._getConnection(); - assert( - !req.credentials, - "INFURA WebSocket project secrets unsupported", - "UNSUPPORTED_OPERATION", - { operation: "InfuraProvider.getWebSocketProvider()" }, - ); - - const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); - super(url, network); - - defineProperties(this, { - projectId: provider.projectId, - projectSecret: provider.projectSecret, - }); - } - - isCommunityResource(): boolean { - return this.projectId === defaultProjectId; - } + /** + * The Project ID for the INFURA connection. + */ + readonly projectId!: string; + + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + readonly projectSecret!: null | string; + + /** + * Creates a new **InfuraWebSocketProvider**. + */ + constructor(network?: Networkish, projectId?: string) { + const provider = new InfuraProvider(network, projectId); + + const req = provider._getConnection(); + assert( + !req.credentials, + "INFURA WebSocket project secrets unsupported", + "UNSUPPORTED_OPERATION", + { operation: "InfuraProvider.getWebSocketProvider()" }, + ); + + const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); + super(url, network); + + defineProperties(this, { + projectId: provider.projectId, + projectSecret: provider.projectSecret, + }); + } + + isCommunityResource(): boolean { + return this.projectId === defaultProjectId; + } } /** @@ -124,103 +124,103 @@ export class InfuraWebSocketProvider * recommended to [sign up here](link-infura-signup). */ export class InfuraProvider - extends JsonRpcProvider - implements CommunityResourcable + extends JsonRpcProvider + implements CommunityResourcable { - /** - * The Project ID for the INFURA connection. - */ - readonly projectId!: string; - - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - readonly projectSecret!: null | string; - - /** - * Creates a new **InfuraProvider**. - */ - constructor( - _network?: Networkish, - projectId?: null | string, - projectSecret?: null | string, - ) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (projectId == null) { - projectId = defaultProjectId; - } - if (projectSecret == null) { - projectSecret = null; - } - - const request = InfuraProvider.getRequest( - network, - projectId, - projectSecret, - ); - super(request, network, { staticNetwork: network }); - - defineProperties(this, { projectId, projectSecret }); - } - - _getProvider(networkId: number): AbstractProvider { - try { - return new InfuraProvider(networkId, this.projectId, this.projectSecret); - } catch (error) {} - return super._getProvider(networkId); - } - - isCommunityResource(): boolean { - return this.projectId === defaultProjectId; - } - - /** - * Creates a new **InfuraWebSocketProvider**. - */ - static getWebSocketProvider( - network?: Networkish, - projectId?: string, - ): InfuraWebSocketProvider { - return new InfuraWebSocketProvider(network, projectId); - } - - /** - * Returns a prepared request for connecting to %%network%% - * with %%projectId%% and %%projectSecret%%. - */ - static getRequest( - network: Network, - projectId?: null | string, - projectSecret?: null | string, - ): FetchRequest { - if (projectId == null) { - projectId = defaultProjectId; - } - if (projectSecret == null) { - projectSecret = null; - } - - const request = new FetchRequest( - `https:/\/${getHost(network.name)}/v3/${projectId}`, - ); - request.allowGzip = true; - if (projectSecret) { - request.setCredentials("", projectSecret); - } - - if (projectId === defaultProjectId) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("InfuraProvider"); - return true; - }; - } - - return request; - } + /** + * The Project ID for the INFURA connection. + */ + readonly projectId!: string; + + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + readonly projectSecret!: null | string; + + /** + * Creates a new **InfuraProvider**. + */ + constructor( + _network?: Networkish, + projectId?: null | string, + projectSecret?: null | string, + ) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (projectId == null) { + projectId = defaultProjectId; + } + if (projectSecret == null) { + projectSecret = null; + } + + const request = InfuraProvider.getRequest( + network, + projectId, + projectSecret, + ); + super(request, network, { staticNetwork: network }); + + defineProperties(this, { projectId, projectSecret }); + } + + _getProvider(networkId: number): AbstractProvider { + try { + return new InfuraProvider(networkId, this.projectId, this.projectSecret); + } catch (error) {} + return super._getProvider(networkId); + } + + isCommunityResource(): boolean { + return this.projectId === defaultProjectId; + } + + /** + * Creates a new **InfuraWebSocketProvider**. + */ + static getWebSocketProvider( + network?: Networkish, + projectId?: string, + ): InfuraWebSocketProvider { + return new InfuraWebSocketProvider(network, projectId); + } + + /** + * Returns a prepared request for connecting to %%network%% + * with %%projectId%% and %%projectSecret%%. + */ + static getRequest( + network: Network, + projectId?: null | string, + projectSecret?: null | string, + ): FetchRequest { + if (projectId == null) { + projectId = defaultProjectId; + } + if (projectSecret == null) { + projectSecret = null; + } + + const request = new FetchRequest( + `https:/\/${getHost(network.name)}/v3/${projectId}`, + ); + request.allowGzip = true; + if (projectSecret) { + request.setCredentials("", projectSecret); + } + + if (projectId === defaultProjectId) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("InfuraProvider"); + return true; + }; + } + + return request; + } } diff --git a/src.ts/providers/provider-ipcsocket.ts b/src.ts/providers/provider-ipcsocket.ts index c9c18aee5..60b6b1568 100644 --- a/src.ts/providers/provider-ipcsocket.ts +++ b/src.ts/providers/provider-ipcsocket.ts @@ -1,3 +1,4 @@ +/// import { connect } from "net"; import { SocketProvider } from "./provider-socket.js"; @@ -7,68 +8,71 @@ import type { Networkish } from "./network.js"; // @TODO: Is this sufficient? Is this robust? Will newlines occur between // all payloads and only between payloads? function splitBuffer(data: Buffer): { - messages: Array; - remaining: Buffer; + messages: Array; + remaining: Buffer; } { - const messages: Array = []; + const messages: Array = []; - let lastStart = 0; - while (true) { - const nl = data.indexOf(10, lastStart); - if (nl === -1) { - break; - } - messages.push(data.subarray(lastStart, nl).toString().trim()); - lastStart = nl + 1; - } + let lastStart = 0; + while (true) { + const nl = data.indexOf(10, lastStart); + if (nl === -1) { + break; + } + messages.push(data.subarray(lastStart, nl).toString().trim()); + lastStart = nl + 1; + } - return { messages, remaining: data.subarray(lastStart) }; + return { messages, remaining: data.subarray(lastStart) }; } export class IpcSocketProvider extends SocketProvider { - #socket: Socket; - get socket(): Socket { - return this.#socket; - } + #socket: Socket; + get socket(): Socket { + return this.#socket; + } - constructor(path: string, network?: Networkish) { - super(network); - this.#socket = connect(path); + constructor(path: string, network?: Networkish) { + super(network); + this.#socket = connect(path); - this.socket.on("ready", async () => { - try { - await this._start(); - } catch (error) { - console.log("failed to start IpcSocketProvider", error); - // @TODO: Now what? Restart? - } - }); + this.socket.on("ready", async () => { + try { + await this._start(); + } catch (error) { + console.log("failed to start IpcSocketProvider", error); + // @TODO: Now what? Restart? + } + }); - let response = Buffer.alloc(0); - this.socket.on("data", (data) => { - response = Buffer.concat([response, data]); - const { messages, remaining } = splitBuffer(response); - messages.forEach((message) => { - this._processMessage(message); - }); - response = remaining; - }); + let response: Buffer = Buffer.alloc(0); + this.socket.on("data", (data) => { + response = Buffer.concat([ + response, + typeof data === "string" ? Buffer.from(data) : data, + ]); + const { messages, remaining } = splitBuffer(response); + messages.forEach((message) => { + this._processMessage(message); + }); + response = remaining; + }); - this.socket.on("end", () => { - this.emit("close"); - this.socket.destroy(); - this.socket.end(); - }); - } + this.socket.on("end", () => { + this.emit("close"); + this.socket.destroy(); + this.socket.end(); + }); + } - destroy(): void { - this.socket.destroy(); - this.socket.end(); + destroy(): void { + this.socket.destroy(); + this.socket.end(); - super.destroy(); - } + super.destroy(); + } - async _write(message: string): Promise { - this.socket.write(message); - } + async _write(message: string): Promise { + this.socket.write(message); + } } diff --git a/src.ts/providers/provider-jsonrpc.ts b/src.ts/providers/provider-jsonrpc.ts index 5f7e129e0..b35561039 100644 --- a/src.ts/providers/provider-jsonrpc.ts +++ b/src.ts/providers/provider-jsonrpc.ts @@ -12,25 +12,25 @@ import { getAddress } from "../address/index.js"; import { TypedDataEncoder } from "../hash/index.js"; import { - defineProperties, - getBigInt, - hexlify, - isHexString, - toQuantity, - toUtf8Bytes, - makeError, - assert, - assertArgument, - FetchRequest, - resolveProperties, + defineProperties, + getBigInt, + hexlify, + isHexString, + toQuantity, + toUtf8Bytes, + makeError, + assert, + assertArgument, + FetchRequest, + resolveProperties, } from "../utils/index.js"; import { AbstractProvider, UnmanagedSubscriber } from "./abstract-provider.js"; import { AbstractSigner } from "./abstract-signer.js"; import { Network } from "./network.js"; import { - FilterIdEventSubscriber, - FilterIdPendingSubscriber, + FilterIdEventSubscriber, + FilterIdPendingSubscriber, } from "./subscriber-filterid.js"; import { PollingEventSubscriber } from "./subscriber-polling.js"; @@ -38,15 +38,15 @@ import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; import type { TransactionLike } from "../transaction/index.js"; import type { - PerformActionRequest, - Subscriber, - Subscription, + PerformActionRequest, + Subscriber, + Subscription, } from "./abstract-provider.js"; import type { Networkish } from "./network.js"; import type { - Provider, - TransactionRequest, - TransactionResponse, + Provider, + TransactionRequest, + TransactionResponse, } from "./provider.js"; import type { Signer } from "./signer.js"; import { resolveAddress } from "../address/checks.js"; @@ -56,81 +56,81 @@ type Timer = ReturnType; const Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g); //const Methods = "getAddress,then".split(/,/g); function deepCopy(value: T): T { - if (value == null || Primitive.indexOf(typeof value) >= 0) { - return value; - } - - // Keep any Addressable - if (typeof (value).getAddress === "function") { - return value; - } - - if (Array.isArray(value)) { - return value.map(deepCopy); - } - - if (typeof value === "object") { - return Object.keys(value).reduce( - (accum, key) => { - accum[key] = (value)[key]; - return accum; - }, - {}, - ); - } - - throw new Error(`should not happen: ${value} (${typeof value})`); + if (value == null || Primitive.indexOf(typeof value) >= 0) { + return value; + } + + // Keep any Addressable + if (typeof (value).getAddress === "function") { + return value; + } + + if (Array.isArray(value)) { + return value.map(deepCopy); + } + + if (typeof value === "object") { + return Object.keys(value).reduce( + (accum, key) => { + accum[key] = (value)[key]; + return accum; + }, + {}, + ); + } + + throw new Error(`should not happen: ${value} (${typeof value})`); } function stall(duration: number): Promise { - return new Promise((resolve) => { - setTimeout(resolve, duration); - }); + return new Promise((resolve) => { + setTimeout(resolve, duration); + }); } function getLowerCase(value: string): string { - if (value) { - return value.toLowerCase(); - } - return value; + if (value) { + return value.toLowerCase(); + } + return value; } interface Pollable { - pollingInterval: number; + pollingInterval: number; } function isPollable(value: any): value is Pollable { - return value && typeof value.pollingInterval === "number"; + return value && typeof value.pollingInterval === "number"; } /** * A JSON-RPC payload, which are sent to a JSON-RPC server. */ export type JsonRpcPayload = { - id: number; - method: string; - params: Array | Record; - jsonrpc: "2.0"; + id: number; + method: string; + params: Array | Record; + jsonrpc: "2.0"; }; /** * A JSON-RPC result, which are returned on success from a JSON-RPC server. */ export type JsonRpcResult = { - id: number; - result: any; + id: number; + result: any; }; /** * A JSON-RPC error, which are returned on failure from a JSON-RPC server. */ export type JsonRpcError = { - id: number; - error: { - code: number; - message?: string; - data?: any; - }; + id: number; + error: { + code: number; + message?: string; + data?: any; + }; }; /** @@ -138,18 +138,18 @@ export type JsonRpcError = { * receive this object as the first parameter. */ export type DebugEventJsonRpcApiProvider = - | { - action: "sendRpcPayload"; - payload: JsonRpcPayload | Array; - } - | { - action: "receiveRpcResult"; - result: Array; - } - | { - action: "receiveRpcError"; - error: Error; - }; + | { + action: "sendRpcPayload"; + payload: JsonRpcPayload | Array; + } + | { + action: "receiveRpcResult"; + result: Array; + } + | { + action: "receiveRpcError"; + error: Error; + }; /** * Options for configuring a [[JsonRpcApiProvider]]. Much of this @@ -181,243 +181,243 @@ export type DebugEventJsonRpcApiProvider = * If ``batchMaxCount = 1``, then batching is disabled. (default: ``100``) */ export type JsonRpcApiProviderOptions = { - polling?: boolean; - staticNetwork?: null | Network; - batchStallTime?: number; - batchMaxSize?: number; - batchMaxCount?: number; + polling?: boolean; + staticNetwork?: null | Network; + batchStallTime?: number; + batchMaxSize?: number; + batchMaxCount?: number; }; const defaultOptions = { - polling: false, - staticNetwork: null, + polling: false, + staticNetwork: null, - batchStallTime: 10, // 10ms - batchMaxSize: 1 << 20, // 1Mb - batchMaxCount: 100, // 100 requests + batchStallTime: 10, // 10ms + batchMaxSize: 1 << 20, // 1Mb + batchMaxCount: 100, // 100 requests }; export interface JsonRpcTransactionRequest { - from?: string; - to?: string; - data?: string; + from?: string; + to?: string; + data?: string; - networkId?: string; - type?: string; - energy?: string; + networkId?: string; + type?: string; + energy?: string; - energyPrice?: string; + energyPrice?: string; - nonce?: string; - value?: string; + nonce?: string; + value?: string; - accessList?: Array<{ address: string; storageKeys: Array }>; + accessList?: Array<{ address: string; storageKeys: Array }>; } // @TODO: Unchecked Signers export class JsonRpcSigner extends AbstractSigner { - address!: string; - - constructor(provider: JsonRpcApiProvider, address: string) { - super(provider); - address = getAddress(address); - defineProperties(this, { address }); - } - - connect(provider: null | Provider): Signer { - assert(false, "cannot reconnect JsonRpcSigner", "UNSUPPORTED_OPERATION", { - operation: "signer.connect", - }); - } - - async getAddress(): Promise { - return this.address; - } - - // JSON-RPC will automatially fill in nonce, etc. so we just check from - async populateTransaction( - tx: TransactionRequest, - ): Promise> { - return await this.populateCall(tx); - } - - // Returns just the hash of the transaction after sent, which is what - // the bare JSON-RPC API does; - async sendUncheckedTransaction(_tx: TransactionRequest): Promise { - const tx = deepCopy(_tx); - - const promises: Array> = []; - - // Make sure the from matches the sender - if (tx.from) { - const _from = tx.from; - promises.push( - (async () => { - const from = await resolveAddress(_from); - assertArgument( - from != null && from.toLowerCase() === this.address.toLowerCase(), - "from address mismatch", - "transaction", - _tx, - ); - tx.from = from; - })(), - ); - } else { - tx.from = this.address; - } - - // The JSON-RPC for xcb_sendTransaction uses 90000 energy; if the user - // wishes to use this, it is easy to specify explicitly, otherwise - // we look it up for them. - if (tx.energyLimit == null) { - promises.push( - (async () => { - tx.energyLimit = await this.provider.estimateEnergy({ - ...tx, - from: this.address, - }); - })(), - ); - } - - // The address may be an ENS name or Addressable - if (tx.to != null) { - const _to = tx.to; - promises.push( - (async () => { - tx.to = await resolveAddress(_to); - })(), - ); - } - - // Wait until all of our properties are filled in - if (promises.length) { - await Promise.all(promises); - } - - const hexTx = this.provider.getRpcTransaction(tx); - - return this.provider.send("xcb_sendTransaction", [hexTx]); - } - - async sendTransaction(tx: TransactionRequest): Promise { - // This cannot be mined any earlier than any recent block - const blockNumber = await this.provider.getBlockNumber(); - - // Send the transaction - const hash = await this.sendUncheckedTransaction(tx); - - // Unfortunately, JSON-RPC only provides and opaque transaction hash - // for a response, and we need the actual transaction, so we poll - // for it; it should show up very quickly - return await new Promise((resolve, reject) => { - const timeouts = [1000, 100]; - const checkTx = async () => { - // Try getting the transaction - const tx = await this.provider.getTransaction(hash); - if (tx != null) { - resolve(tx.replaceableTransaction(blockNumber)); - return; - } - - // Wait another 4 seconds - this.provider._setTimeout(() => { - checkTx(); - }, timeouts.pop() || 4000); - }; - checkTx(); - }); - } - - async signTransaction(_tx: TransactionRequest): Promise { - const tx = deepCopy(_tx); - - // Make sure the from matches the sender - if (tx.from) { - const from = await resolveAddress(tx.from); - assertArgument( - from != null && from.toLowerCase() === this.address.toLowerCase(), - "from address mismatch", - "transaction", - _tx, - ); - tx.from = from; - } else { - tx.from = this.address; - } - - const hexTx = this.provider.getRpcTransaction(tx); - return await this.provider.send("xcb_signTransaction", [hexTx]); - } - - async signMessage(_message: string | Uint8Array): Promise { - const message = - typeof _message === "string" ? toUtf8Bytes(_message) : _message; - return await this.provider.send("personal_sign", [ - hexlify(message), - this.address.toLowerCase(), - ]); - } - - async signTypedData( - domain: TypedDataDomain, - types: Record>, - _value: Record, - ): Promise { - const value = deepCopy(_value); - - // Populate any ENS names (in-place) - const populated = await TypedDataEncoder.resolveNames( - domain, - types, - value, - async (value: string) => { - const address = await resolveAddress(value); - assertArgument( - address != null, - "TypedData does not support null address", - "value", - value, - ); - return address; - }, - ); - - return await this.provider.send("xcb_signTypedData_v4", [ - this.address.toLowerCase(), - JSON.stringify( - TypedDataEncoder.getPayload(populated.domain, types, populated.value), - ), - ]); - } - - async unlock(password: string): Promise { - return this.provider.send("personal_unlockAccount", [ - this.address.toLowerCase(), - password, - null, - ]); - } - - async _legacySignMessage(_message: string | Uint8Array): Promise { - const message = - typeof _message === "string" ? toUtf8Bytes(_message) : _message; - return await this.provider.send("xcb_sign", [ - this.address.toLowerCase(), - hexlify(message), - ]); - } + address!: string; + + constructor(provider: JsonRpcApiProvider, address: string) { + super(provider); + address = getAddress(address); + defineProperties(this, { address }); + } + + connect(provider: null | Provider): Signer { + assert(false, "cannot reconnect JsonRpcSigner", "UNSUPPORTED_OPERATION", { + operation: "signer.connect", + }); + } + + async getAddress(): Promise { + return this.address; + } + + // JSON-RPC will automatially fill in nonce, etc. so we just check from + async populateTransaction( + tx: TransactionRequest, + ): Promise> { + return await this.populateCall(tx); + } + + // Returns just the hash of the transaction after sent, which is what + // the bare JSON-RPC API does; + async sendUncheckedTransaction(_tx: TransactionRequest): Promise { + const tx = deepCopy(_tx); + + const promises: Array> = []; + + // Make sure the from matches the sender + if (tx.from) { + const _from = tx.from; + promises.push( + (async () => { + const from = await resolveAddress(_from); + assertArgument( + from != null && from.toLowerCase() === this.address.toLowerCase(), + "from address mismatch", + "transaction", + _tx, + ); + tx.from = from; + })(), + ); + } else { + tx.from = this.address; + } + + // The JSON-RPC for xcb_sendTransaction uses 90000 energy; if the user + // wishes to use this, it is easy to specify explicitly, otherwise + // we look it up for them. + if (tx.energyLimit == null) { + promises.push( + (async () => { + tx.energyLimit = await this.provider.estimateEnergy({ + ...tx, + from: this.address, + }); + })(), + ); + } + + // The address may be an ENS name or Addressable + if (tx.to != null) { + const _to = tx.to; + promises.push( + (async () => { + tx.to = await resolveAddress(_to); + })(), + ); + } + + // Wait until all of our properties are filled in + if (promises.length) { + await Promise.all(promises); + } + + const hexTx = this.provider.getRpcTransaction(tx); + + return this.provider.send("xcb_sendTransaction", [hexTx]); + } + + async sendTransaction(tx: TransactionRequest): Promise { + // This cannot be mined any earlier than any recent block + const blockNumber = await this.provider.getBlockNumber(); + + // Send the transaction + const hash = await this.sendUncheckedTransaction(tx); + + // Unfortunately, JSON-RPC only provides and opaque transaction hash + // for a response, and we need the actual transaction, so we poll + // for it; it should show up very quickly + return await new Promise((resolve, reject) => { + const timeouts = [1000, 100]; + const checkTx = async () => { + // Try getting the transaction + const tx = await this.provider.getTransaction(hash); + if (tx != null) { + resolve(tx.replaceableTransaction(blockNumber)); + return; + } + + // Wait another 4 seconds + this.provider._setTimeout(() => { + checkTx(); + }, timeouts.pop() || 4000); + }; + checkTx(); + }); + } + + async signTransaction(_tx: TransactionRequest): Promise { + const tx = deepCopy(_tx); + + // Make sure the from matches the sender + if (tx.from) { + const from = await resolveAddress(tx.from); + assertArgument( + from != null && from.toLowerCase() === this.address.toLowerCase(), + "from address mismatch", + "transaction", + _tx, + ); + tx.from = from; + } else { + tx.from = this.address; + } + + const hexTx = this.provider.getRpcTransaction(tx); + return await this.provider.send("xcb_signTransaction", [hexTx]); + } + + async signMessage(_message: string | Uint8Array): Promise { + const message = + typeof _message === "string" ? toUtf8Bytes(_message) : _message; + return await this.provider.send("personal_sign", [ + hexlify(message), + this.address.toLowerCase(), + ]); + } + + async signTypedData( + domain: TypedDataDomain, + types: Record>, + _value: Record, + ): Promise { + const value = deepCopy(_value); + + // Populate any ENS names (in-place) + const populated = await TypedDataEncoder.resolveNames( + domain, + types, + value, + async (value: string) => { + const address = await resolveAddress(value); + assertArgument( + address != null, + "TypedData does not support null address", + "value", + value, + ); + return address; + }, + ); + + return await this.provider.send("xcb_signTypedData_v4", [ + this.address.toLowerCase(), + JSON.stringify( + TypedDataEncoder.getPayload(populated.domain, types, populated.value), + ), + ]); + } + + async unlock(password: string): Promise { + return this.provider.send("personal_unlockAccount", [ + this.address.toLowerCase(), + password, + null, + ]); + } + + async _legacySignMessage(_message: string | Uint8Array): Promise { + const message = + typeof _message === "string" ? toUtf8Bytes(_message) : _message; + return await this.provider.send("xcb_sign", [ + this.address.toLowerCase(), + hexlify(message), + ]); + } } type ResolveFunc = (result: JsonRpcResult) => void; type RejectFunc = (error: Error) => void; type Payload = { - payload: JsonRpcPayload; - resolve: ResolveFunc; - reject: RejectFunc; + payload: JsonRpcPayload; + resolve: ResolveFunc; + reject: RejectFunc; }; /** @@ -431,164 +431,164 @@ type Payload = { * - a sub-class MUST call the `_start()` method once connected */ export abstract class JsonRpcApiProvider extends AbstractProvider { - #options: Required; - - // The next ID to use for the JSON-RPC ID field - #nextId: number; - - // Payloads are queued and triggered in batches using the drainTimer - #payloads: Array; - #drainTimer: null | Timer; - - #notReady: null | { - promise: Promise; - resolve: null | ((v: void) => void); - }; - - #network: null | Network; - - #scheduleDrain(): void { - if (this.#drainTimer) { - return; - } - - // If we aren't using batching, no hard in sending it immeidately - const stallTime = - this._getOption("batchMaxCount") === 1 - ? 0 - : this._getOption("batchStallTime"); - - this.#drainTimer = setTimeout(() => { - this.#drainTimer = null; - - const payloads = this.#payloads; - this.#payloads = []; - - while (payloads.length) { - // Create payload batches that satisfy our batch constraints - const batch = [payloads.shift()]; - while (payloads.length) { - if (batch.length === this.#options.batchMaxCount) { - break; - } - batch.push(payloads.shift()); - const bytes = JSON.stringify(batch.map((p) => p.payload)); - if (bytes.length > this.#options.batchMaxSize) { - payloads.unshift(batch.pop()); - break; - } - } - - // Process the result to each payload - (async () => { - const payload = - batch.length === 1 ? batch[0].payload : batch.map((p) => p.payload); - - this.emit("debug", { action: "sendRpcPayload", payload }); - - try { - // console.log({payload}) - const result = await this._send(payload); - // console.log({result}) - this.emit("debug", { action: "receiveRpcResult", result }); - - // Process results in batch order - for (const { resolve, reject, payload } of batch) { - // Find the matching result - const resp = result.filter((r) => r.id === payload.id)[0]; - - // No result; the node failed us in unexpected ways - if (resp == null) { - return reject( - makeError("no response from server", "BAD_DATA", { - value: result, - info: { payload }, - }), - ); - } - - // The response is an error - if ("error" in resp) { - return reject(this.getRpcError(payload, resp)); - } - - // All good; send the result - resolve(resp.result); - } - } catch (error: any) { - this.emit("debug", { action: "receiveRpcError", error }); - - for (const { reject } of batch) { - // @TODO: augment the error with the payload - reject(error); - } - } - })(); - } - }, stallTime); - } - - constructor(network?: Networkish, options?: JsonRpcApiProviderOptions) { - super(network); - - this.#nextId = 1; - this.#options = Object.assign({}, defaultOptions, options || {}); - - this.#payloads = []; - this.#drainTimer = null; - - this.#network = null; - - { - let resolve: null | ((value: void) => void) = null; - const promise = new Promise((_resolve: (value: void) => void) => { - resolve = _resolve; - }); - this.#notReady = { promise, resolve }; - } - - // Make sure any static network is compatbile with the provided netwrok - const staticNetwork = this._getOption("staticNetwork"); - if (staticNetwork) { - assertArgument( - network == null || staticNetwork.matches(network), - "staticNetwork MUST match network object", - "options", - options, - ); - this.#network = staticNetwork; - } - } - - /** - * Returns the value associated with the option %%key%%. - * - * Sub-classes can use this to inquire about configuration options. - */ - _getOption( - key: K, - ): JsonRpcApiProviderOptions[K] { - return this.#options[key]; - } - - /** - * Gets the [[Network]] this provider has committed to. On each call, the network - * is detected, and if it has changed, the call will reject. - */ - get _network(): Network { - assert(this.#network, "network is not available yet", "NETWORK_ERROR"); - return this.#network; - } - - /** - * Sends a JSON-RPC %%payload%% (or a batch) to the underlying channel. - * - * Sub-classes **MUST** override this. - */ - abstract _send( - payload: JsonRpcPayload | Array, - ): Promise>; - /* + #options: Required; + + // The next ID to use for the JSON-RPC ID field + #nextId: number; + + // Payloads are queued and triggered in batches using the drainTimer + #payloads: Array; + #drainTimer: null | Timer; + + #notReady: null | { + promise: Promise; + resolve: null | ((v: void) => void); + }; + + #network: null | Network; + + #scheduleDrain(): void { + if (this.#drainTimer) { + return; + } + + // If we aren't using batching, no hard in sending it immeidately + const stallTime = + this._getOption("batchMaxCount") === 1 + ? 0 + : this._getOption("batchStallTime"); + + this.#drainTimer = setTimeout(() => { + this.#drainTimer = null; + + const payloads = this.#payloads; + this.#payloads = []; + + while (payloads.length) { + // Create payload batches that satisfy our batch constraints + const batch = [payloads.shift()]; + while (payloads.length) { + if (batch.length === this.#options.batchMaxCount) { + break; + } + batch.push(payloads.shift()); + const bytes = JSON.stringify(batch.map((p) => p.payload)); + if (bytes.length > this.#options.batchMaxSize) { + payloads.unshift(batch.pop()); + break; + } + } + + // Process the result to each payload + (async () => { + const payload = + batch.length === 1 ? batch[0].payload : batch.map((p) => p.payload); + + this.emit("debug", { action: "sendRpcPayload", payload }); + + try { + // console.log({payload}) + const result = await this._send(payload); + // console.log({result}) + this.emit("debug", { action: "receiveRpcResult", result }); + + // Process results in batch order + for (const { resolve, reject, payload } of batch) { + // Find the matching result + const resp = result.filter((r) => r.id === payload.id)[0]; + + // No result; the node failed us in unexpected ways + if (resp == null) { + return reject( + makeError("no response from server", "BAD_DATA", { + value: result, + info: { payload }, + }), + ); + } + + // The response is an error + if ("error" in resp) { + return reject(this.getRpcError(payload, resp)); + } + + // All good; send the result + resolve(resp.result); + } + } catch (error: any) { + this.emit("debug", { action: "receiveRpcError", error }); + + for (const { reject } of batch) { + // @TODO: augment the error with the payload + reject(error); + } + } + })(); + } + }, stallTime); + } + + constructor(network?: Networkish, options?: JsonRpcApiProviderOptions) { + super(network); + + this.#nextId = 1; + this.#options = Object.assign({}, defaultOptions, options || {}); + + this.#payloads = []; + this.#drainTimer = null; + + this.#network = null; + + { + let resolve: null | ((value: void) => void) = null; + const promise = new Promise((_resolve: (value: void) => void) => { + resolve = _resolve; + }); + this.#notReady = { promise, resolve }; + } + + // Make sure any static network is compatbile with the provided netwrok + const staticNetwork = this._getOption("staticNetwork"); + if (staticNetwork) { + assertArgument( + network == null || staticNetwork.matches(network), + "staticNetwork MUST match network object", + "options", + options, + ); + this.#network = staticNetwork; + } + } + + /** + * Returns the value associated with the option %%key%%. + * + * Sub-classes can use this to inquire about configuration options. + */ + _getOption( + key: K, + ): JsonRpcApiProviderOptions[K] { + return this.#options[key]; + } + + /** + * Gets the [[Network]] this provider has committed to. On each call, the network + * is detected, and if it has changed, the call will reject. + */ + get _network(): Network { + assert(this.#network, "network is not available yet", "NETWORK_ERROR"); + return this.#network; + } + + /** + * Sends a JSON-RPC %%payload%% (or a batch) to the underlying channel. + * + * Sub-classes **MUST** override this. + */ + abstract _send( + payload: JsonRpcPayload | Array, + ): Promise>; + /* { assert(false, "sub-classes must override _send", "UNSUPPORTED_OPERATION", { operation: "jsonRpcApiProvider._send" @@ -596,524 +596,524 @@ export abstract class JsonRpcApiProvider extends AbstractProvider { } */ - /** - * Resolves to the non-normalized value by performing %%req%%. - * - * Sub-classes may override this to modify behavior of actions, - * and should generally call ``super._perform`` as a fallback. - */ - async _perform(req: PerformActionRequest): Promise { - const request = this.getRpcRequest(req); - - if (request != null) { - return await this.send(request.method, request.args); - } - - return super._perform(req); - } - - /** - * Sub-classes may override this; it detects the *actual* network that - * we are **currently** connected to. - * - * Keep in mind that [[send]] may only be used once [[ready]], otherwise the - * _send primitive must be used instead. - */ - async _detectNetwork(): Promise { - const network = this._getOption("staticNetwork"); - if (network) { - return network; - } - - // If we are ready, use ``send``, which enabled requests to be batched - if (this.ready) { - return Network.from(getBigInt(await this.send("xcb_networkId", []))); - } - - // We are not ready yet; use the primitive _send - - const payload: JsonRpcPayload = { - id: this.#nextId++, - method: "xcb_networkId", - params: [], - jsonrpc: "2.0", - }; - - this.emit("debug", { action: "sendRpcPayload", payload }); - - let result: JsonRpcResult | JsonRpcError; - try { - result = (await this._send(payload))[0]; - } catch (error) { - this.emit("debug", { action: "receiveRpcError", error }); - throw error; - } - - this.emit("debug", { action: "receiveRpcResult", result }); - - if ("result" in result) { - return Network.from(getBigInt(result.result)); - } - - throw this.getRpcError(payload, result); - } - - /** - * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls - * will be passed to [[_send]] from [[send]]. If it is overridden, then - * ``super._start()`` **MUST** be called. - * - * Calling it multiple times is safe and has no effect. - */ - _start(): void { - if (this.#notReady == null || this.#notReady.resolve == null) { - return; - } - - this.#notReady.resolve(); - this.#notReady = null; - - (async () => { - // Bootstrap the network - while (this.#network == null) { - try { - this.#network = await this._detectNetwork(); - } catch (error) { - console.log("JsonRpcProvider failed to startup; retry in 1s"); - await stall(1000); - } - } - - // Start dispatching requests - this.#scheduleDrain(); - })(); - } - - /** - * Resolves once the [[_start]] has been called. This can be used in - * sub-classes to defer sending data until the connection has been - * established. - */ - async _waitUntilReady(): Promise { - if (this.#notReady == null) { - return; - } - return await this.#notReady.promise; - } - - /** - * Return a Subscriber that will manage the %%sub%%. - * - * Sub-classes may override this to modify the behavior of - * subscription management. - */ - _getSubscriber(sub: Subscription): Subscriber { - // Pending Filters aren't availble via polling - if (sub.type === "pending") { - return new FilterIdPendingSubscriber(this); - } - - if (sub.type === "event") { - if (this._getOption("polling")) { - return new PollingEventSubscriber(this, sub.filter); - } - return new FilterIdEventSubscriber(this, sub.filter); - } - - // Orphaned Logs are handled automatically, by the filter, since - // logs with removed are emitted by it - if (sub.type === "orphan" && sub.filter.orphan === "drop-log") { - return new UnmanagedSubscriber("orphan"); - } - - return super._getSubscriber(sub); - } - - /** - * Returns true only if the [[_start]] has been called. - */ - get ready(): boolean { - return this.#notReady == null; - } - - /** - * Returns %%tx%% as a normalized JSON-RPC transaction request, - * which has all values hexlified and any numeric values converted - * to Quantity values. - */ - getRpcTransaction(tx: TransactionRequest): JsonRpcTransactionRequest { - const result: JsonRpcTransactionRequest = {}; - - // JSON-RPC now requires numeric values to be "quantity" values - [ - "networkId", - "energyLimit", - "energyPrice", - "type", - "nonce", - "value", - ].forEach((key) => { - if ((tx)[key] == null) { - return; - } - let dstKey = key; - if (key === "energyLimit") { - dstKey = "energy"; - } - (result)[dstKey] = toQuantity( - getBigInt((tx)[key], `tx.${key}`), - ); - }); - - // Make sure addresses and data are lowercase - ["from", "to", "data"].forEach((key) => { - if ((tx)[key] == null) { - return; - } - (result)[key] = hexlify((tx)[key]); - }); - - return result; - } - - /** - * Returns the request method and arguments required to perform - * %%req%%. - */ - getRpcRequest( - req: PerformActionRequest, - ): null | { method: string; args: Array } { - switch (req.method) { - case "networkId": - return { method: "xcb_networkId", args: [] }; - - case "getBlockNumber": - return { method: "xcb_blockNumber", args: [] }; - - case "getEnergyPrice": - return { method: "xcb_energyPrice", args: [] }; - - case "getBalance": { - return { - method: "xcb_getBalance", - args: [getLowerCase(req.address), req.blockTag], - }; - } - case "getTransactionCount": - return { - method: "xcb_getTransactionCount", - args: [getLowerCase(req.address), req.blockTag], - }; - - case "getCode": - return { - method: "xcb_getCode", - args: [getLowerCase(req.address), req.blockTag], - }; - - case "getStorage": - return { - method: "xcb_getStorageAt", - args: [ - getLowerCase(req.address), - "0x" + req.position.toString(16), - req.blockTag, - ], - }; - - case "broadcastTransaction": - return { - method: "xcb_sendRawTransaction", - args: [req.signedTransaction], - }; - - case "getBlock": - if ("blockTag" in req) { - return { - method: "xcb_getBlockByNumber", - args: [req.blockTag, !!req.includeTransactions], - }; - } else if ("blockHash" in req) { - return { - method: "xcb_getBlockByHash", - args: [req.blockHash, !!req.includeTransactions], - }; - } - break; - - case "getTransaction": - return { - method: "xcb_getTransactionByHash", - args: [req.hash], - }; - - case "getTransactionReceipt": - return { - method: "xcb_getTransactionReceipt", - args: [req.hash], - }; - - case "call": - return { - method: "xcb_call", - args: [this.getRpcTransaction(req.transaction), req.blockTag], - }; - - case "estimateEnergy": { - return { - method: "xcb_estimateEnergy", - args: [this.getRpcTransaction(req.transaction)], - }; - } - - case "getLogs": - if (req.filter && req.filter.address != null) { - if (Array.isArray(req.filter.address)) { - req.filter.address = req.filter.address.map(getLowerCase); - } else { - req.filter.address = getLowerCase(req.filter.address); - } - } - return { method: "xcb_getLogs", args: [req.filter] }; - } - - return null; - } - - /** - * Returns an CoreBC-style Error for the given JSON-RPC error - * %%payload%%, coalescing the various strings and error shapes - * that different nodes return, coercing them into a machine-readable - * standardized error. - */ - getRpcError(payload: JsonRpcPayload, _error: JsonRpcError): Error { - const { method } = payload; - const { error } = _error; - if (method === "xcb_estimateEnergy" && error.message) { - const msg = error.message; - if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) { - return makeError("insufficient funds", "INSUFFICIENT_FUNDS", { - transaction: (payload).params[0], - info: { payload, error }, - }); - } - } - - if (method === "xcb_call" || method === "xcb_estimateEnergy") { - const result = spelunkData(error); - const e = AbiCoder.getBuiltinCallException( - method === "xcb_call" ? "call" : "estimateEnergy", - (payload).params[0], - result ? result.data : null, - ); - e.info = { error, payload }; - return e; - } - - // Only estimateEnergy and call can return arbitrary contract-defined text, so now we - // we can process text safely. - - const message = JSON.stringify(spelunkMessage(error)); - - if ( - typeof error.message === "string" && - error.message.match(/user denied|corebc-user-denied/i) - ) { - const actionMap: Record< - string, - | "requestAccess" - | "sendTransaction" - | "signMessage" - | "signTransaction" - | "signTypedData" - > = { - xcb_sign: "signMessage", - personal_sign: "signMessage", - xcb_signTypedData_v4: "signTypedData", - xcb_signTransaction: "signTransaction", - xcb_sendTransaction: "sendTransaction", - xcb_requestAccounts: "requestAccess", - wallet_requestAccounts: "requestAccess", - }; - - return makeError(`user rejected action`, "ACTION_REJECTED", { - action: actionMap[method] || "unknown", - reason: "rejected", - info: { payload, error }, - }); - } - - if ( - method === "xcb_sendRawTransaction" || - method === "xcb_sendTransaction" - ) { - const transaction = >(payload).params[0]; - - if (message.match(/insufficient funds|base fee exceeds energy limit/i)) { - return makeError( - "insufficient funds for intrinsic transaction cost", - "INSUFFICIENT_FUNDS", - { - transaction, - info: { error }, - }, - ); - } - - if (message.match(/nonce/i) && message.match(/too low/i)) { - return makeError("nonce has already been used", "NONCE_EXPIRED", { - transaction, - info: { error }, - }); - } - - // "replacement transaction underpriced" - if ( - message.match(/replacement transaction/i) && - message.match(/underpriced/i) - ) { - return makeError("replacement fee too low", "REPLACEMENT_UNDERPRICED", { - transaction, - info: { error }, - }); - } - - if (message.match(/only replay-protected/i)) { - return makeError( - "legacy pre-eip-155 transactions not supported", - "UNSUPPORTED_OPERATION", - { - operation: method, - info: { transaction, info: { error } }, - }, - ); - } - } - - if (message.match(/the method .* does not exist/i)) { - return makeError("unsupported operation", "UNSUPPORTED_OPERATION", { - operation: payload.method, - info: { error }, - }); - } - - return makeError("could not coalesce error", "UNKNOWN_ERROR", { error }); - } - - /** - * Requests the %%method%% with %%params%% via the JSON-RPC protocol - * over the underlying channel. This can be used to call methods - * on the backend that do not have a high-level API within the Provider - * API. - * - * This method queues requests according to the batch constraints - * in the options, assigns the request a unique ID. - * - * **Do NOT override** this method in sub-classes; instead - * override [[_send]] or force the options values in the - * call to the constructor to modify this method's behavior. - */ - send(method: string, params: Array | Record): Promise { - // @TODO: cache networkId?? purge on switch_networks - - const id = this.#nextId++; - const promise = new Promise((resolve, reject) => { - this.#payloads.push({ - resolve, - reject, - payload: { method, params, id, jsonrpc: "2.0" }, - }); - }); - - // If there is not a pending drainTimer, set one - this.#scheduleDrain(); - - return >promise; - } - - /** - * Resolves to the [[Signer]] account for %%address%% managed by - * the client. - * - * If the %%address%% is a number, it is used as an index in the - * the accounts from [[listAccounts]]. - * - * This can only be used on clients which manage accounts (such as - * Geth with imported account or MetaMask). - * - * Throws if the account doesn't exist. - */ - async getSigner(address?: number | string): Promise { - if (address == null) { - address = 0; - } - - const accountsPromise = this.send("xcb_accounts", []); - - // Account index - if (typeof address === "number") { - const accounts = >await accountsPromise; - if (address >= accounts.length) { - throw new Error("no such account"); - } - return new JsonRpcSigner(this, accounts[address]); - } - - const { accounts } = await resolveProperties({ - network: this.getNetwork(), - accounts: accountsPromise, - }); - - // Account address - address = getAddress(address); - for (const account of accounts) { - if (getAddress(account) === address) { - return new JsonRpcSigner(this, address); - } - } - - throw new Error("invalid account"); - } - - async listAccounts(): Promise> { - const accounts: Array = await this.send("xcb_accounts", []); - return accounts.map((a) => new JsonRpcSigner(this, a)); - } + /** + * Resolves to the non-normalized value by performing %%req%%. + * + * Sub-classes may override this to modify behavior of actions, + * and should generally call ``super._perform`` as a fallback. + */ + async _perform(req: PerformActionRequest): Promise { + const request = this.getRpcRequest(req); + + if (request != null) { + return await this.send(request.method, request.args); + } + + return super._perform(req); + } + + /** + * Sub-classes may override this; it detects the *actual* network that + * we are **currently** connected to. + * + * Keep in mind that [[send]] may only be used once [[ready]], otherwise the + * _send primitive must be used instead. + */ + async _detectNetwork(): Promise { + const network = this._getOption("staticNetwork"); + if (network) { + return network; + } + + // If we are ready, use ``send``, which enabled requests to be batched + if (this.ready) { + return Network.from(getBigInt(await this.send("xcb_networkId", []))); + } + + // We are not ready yet; use the primitive _send + + const payload: JsonRpcPayload = { + id: this.#nextId++, + method: "xcb_networkId", + params: [], + jsonrpc: "2.0", + }; + + this.emit("debug", { action: "sendRpcPayload", payload }); + + let result: JsonRpcResult | JsonRpcError; + try { + result = (await this._send(payload))[0]; + } catch (error) { + this.emit("debug", { action: "receiveRpcError", error }); + throw error; + } + + this.emit("debug", { action: "receiveRpcResult", result }); + + if ("result" in result) { + return Network.from(getBigInt(result.result)); + } + + throw this.getRpcError(payload, result); + } + + /** + * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls + * will be passed to [[_send]] from [[send]]. If it is overridden, then + * ``super._start()`` **MUST** be called. + * + * Calling it multiple times is safe and has no effect. + */ + _start(): void { + if (this.#notReady == null || this.#notReady.resolve == null) { + return; + } + + this.#notReady.resolve(); + this.#notReady = null; + + (async () => { + // Bootstrap the network + while (this.#network == null) { + try { + this.#network = await this._detectNetwork(); + } catch (error) { + console.log("JsonRpcProvider failed to startup; retry in 1s"); + await stall(1000); + } + } + + // Start dispatching requests + this.#scheduleDrain(); + })(); + } + + /** + * Resolves once the [[_start]] has been called. This can be used in + * sub-classes to defer sending data until the connection has been + * established. + */ + async _waitUntilReady(): Promise { + if (this.#notReady == null) { + return; + } + return await this.#notReady.promise; + } + + /** + * Return a Subscriber that will manage the %%sub%%. + * + * Sub-classes may override this to modify the behavior of + * subscription management. + */ + _getSubscriber(sub: Subscription): Subscriber { + // Pending Filters aren't availble via polling + if (sub.type === "pending") { + return new FilterIdPendingSubscriber(this); + } + + if (sub.type === "event") { + if (this._getOption("polling")) { + return new PollingEventSubscriber(this, sub.filter); + } + return new FilterIdEventSubscriber(this, sub.filter); + } + + // Orphaned Logs are handled automatically, by the filter, since + // logs with removed are emitted by it + if (sub.type === "orphan" && sub.filter.orphan === "drop-log") { + return new UnmanagedSubscriber("orphan"); + } + + return super._getSubscriber(sub); + } + + /** + * Returns true only if the [[_start]] has been called. + */ + get ready(): boolean { + return this.#notReady == null; + } + + /** + * Returns %%tx%% as a normalized JSON-RPC transaction request, + * which has all values hexlified and any numeric values converted + * to Quantity values. + */ + getRpcTransaction(tx: TransactionRequest): JsonRpcTransactionRequest { + const result: JsonRpcTransactionRequest = {}; + + // JSON-RPC now requires numeric values to be "quantity" values + [ + "networkId", + "energyLimit", + "energyPrice", + "type", + "nonce", + "value", + ].forEach((key) => { + if ((tx)[key] == null) { + return; + } + let dstKey = key; + if (key === "energyLimit") { + dstKey = "energy"; + } + (result)[dstKey] = toQuantity( + getBigInt((tx)[key], `tx.${key}`), + ); + }); + + // Make sure addresses and data are lowercase + ["from", "to", "data"].forEach((key) => { + if ((tx)[key] == null) { + return; + } + (result)[key] = hexlify((tx)[key]); + }); + + return result; + } + + /** + * Returns the request method and arguments required to perform + * %%req%%. + */ + getRpcRequest( + req: PerformActionRequest, + ): null | { method: string; args: Array } { + switch (req.method) { + case "networkId": + return { method: "xcb_networkId", args: [] }; + + case "getBlockNumber": + return { method: "xcb_blockNumber", args: [] }; + + case "getEnergyPrice": + return { method: "xcb_energyPrice", args: [] }; + + case "getBalance": { + return { + method: "xcb_getBalance", + args: [getLowerCase(req.address), req.blockTag], + }; + } + case "getTransactionCount": + return { + method: "xcb_getTransactionCount", + args: [getLowerCase(req.address), req.blockTag], + }; + + case "getCode": + return { + method: "xcb_getCode", + args: [getLowerCase(req.address), req.blockTag], + }; + + case "getStorage": + return { + method: "xcb_getStorageAt", + args: [ + getLowerCase(req.address), + "0x" + req.position.toString(16), + req.blockTag, + ], + }; + + case "broadcastTransaction": + return { + method: "xcb_sendRawTransaction", + args: [req.signedTransaction], + }; + + case "getBlock": + if ("blockTag" in req) { + return { + method: "xcb_getBlockByNumber", + args: [req.blockTag, !!req.includeTransactions], + }; + } else if ("blockHash" in req) { + return { + method: "xcb_getBlockByHash", + args: [req.blockHash, !!req.includeTransactions], + }; + } + break; + + case "getTransaction": + return { + method: "xcb_getTransactionByHash", + args: [req.hash], + }; + + case "getTransactionReceipt": + return { + method: "xcb_getTransactionReceipt", + args: [req.hash], + }; + + case "call": + return { + method: "xcb_call", + args: [this.getRpcTransaction(req.transaction), req.blockTag], + }; + + case "estimateEnergy": { + return { + method: "xcb_estimateEnergy", + args: [this.getRpcTransaction(req.transaction)], + }; + } + + case "getLogs": + if (req.filter && req.filter.address != null) { + if (Array.isArray(req.filter.address)) { + req.filter.address = req.filter.address.map(getLowerCase); + } else { + req.filter.address = getLowerCase(req.filter.address); + } + } + return { method: "xcb_getLogs", args: [req.filter] }; + } + + return null; + } + + /** + * Returns an CoreBC-style Error for the given JSON-RPC error + * %%payload%%, coalescing the various strings and error shapes + * that different nodes return, coercing them into a machine-readable + * standardized error. + */ + getRpcError(payload: JsonRpcPayload, _error: JsonRpcError): Error { + const { method } = payload; + const { error } = _error; + if (method === "xcb_estimateEnergy" && error.message) { + const msg = error.message; + if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) { + return makeError("insufficient funds", "INSUFFICIENT_FUNDS", { + transaction: (payload).params[0], + info: { payload, error }, + }); + } + } + + if (method === "xcb_call" || method === "xcb_estimateEnergy") { + const result = spelunkData(error); + const e = AbiCoder.getBuiltinCallException( + method === "xcb_call" ? "call" : "estimateEnergy", + (payload).params[0], + result ? result.data : null, + ); + e.info = { error, payload }; + return e; + } + + // Only estimateEnergy and call can return arbitrary contract-defined text, so now we + // we can process text safely. + + const message = JSON.stringify(spelunkMessage(error)); + + if ( + typeof error.message === "string" && + error.message.match(/user denied|corebc-user-denied/i) + ) { + const actionMap: Record< + string, + | "requestAccess" + | "sendTransaction" + | "signMessage" + | "signTransaction" + | "signTypedData" + > = { + xcb_sign: "signMessage", + personal_sign: "signMessage", + xcb_signTypedData_v4: "signTypedData", + xcb_signTransaction: "signTransaction", + xcb_sendTransaction: "sendTransaction", + xcb_requestAccounts: "requestAccess", + wallet_requestAccounts: "requestAccess", + }; + + return makeError(`user rejected action`, "ACTION_REJECTED", { + action: actionMap[method] || "unknown", + reason: "rejected", + info: { payload, error }, + }); + } + + if ( + method === "xcb_sendRawTransaction" || + method === "xcb_sendTransaction" + ) { + const transaction = >(payload).params[0]; + + if (message.match(/insufficient funds|base fee exceeds energy limit/i)) { + return makeError( + "insufficient funds for intrinsic transaction cost", + "INSUFFICIENT_FUNDS", + { + transaction, + info: { error }, + }, + ); + } + + if (message.match(/nonce/i) && message.match(/too low/i)) { + return makeError("nonce has already been used", "NONCE_EXPIRED", { + transaction, + info: { error }, + }); + } + + // "replacement transaction underpriced" + if ( + message.match(/replacement transaction/i) && + message.match(/underpriced/i) + ) { + return makeError("replacement fee too low", "REPLACEMENT_UNDERPRICED", { + transaction, + info: { error }, + }); + } + + if (message.match(/only replay-protected/i)) { + return makeError( + "legacy pre-eip-155 transactions not supported", + "UNSUPPORTED_OPERATION", + { + operation: method, + info: { transaction, info: { error } }, + }, + ); + } + } + + if (message.match(/the method .* does not exist/i)) { + return makeError("unsupported operation", "UNSUPPORTED_OPERATION", { + operation: payload.method, + info: { error }, + }); + } + + return makeError("could not coalesce error", "UNKNOWN_ERROR", { error }); + } + + /** + * Requests the %%method%% with %%params%% via the JSON-RPC protocol + * over the underlying channel. This can be used to call methods + * on the backend that do not have a high-level API within the Provider + * API. + * + * This method queues requests according to the batch constraints + * in the options, assigns the request a unique ID. + * + * **Do NOT override** this method in sub-classes; instead + * override [[_send]] or force the options values in the + * call to the constructor to modify this method's behavior. + */ + send(method: string, params: Array | Record): Promise { + // @TODO: cache networkId?? purge on switch_networks + + const id = this.#nextId++; + const promise = new Promise((resolve, reject) => { + this.#payloads.push({ + resolve, + reject, + payload: { method, params, id, jsonrpc: "2.0" }, + }); + }); + + // If there is not a pending drainTimer, set one + this.#scheduleDrain(); + + return >promise; + } + + /** + * Resolves to the [[Signer]] account for %%address%% managed by + * the client. + * + * If the %%address%% is a number, it is used as an index in the + * the accounts from [[listAccounts]]. + * + * This can only be used on clients which manage accounts (such as + * Geth with imported account or MetaMask). + * + * Throws if the account doesn't exist. + */ + async getSigner(address?: number | string): Promise { + if (address == null) { + address = 0; + } + + const accountsPromise = this.send("xcb_accounts", []); + + // Account index + if (typeof address === "number") { + const accounts = >await accountsPromise; + if (address >= accounts.length) { + throw new Error("no such account"); + } + return new JsonRpcSigner(this, accounts[address]); + } + + const { accounts } = await resolveProperties({ + network: this.getNetwork(), + accounts: accountsPromise, + }); + + // Account address + address = getAddress(address); + for (const account of accounts) { + if (getAddress(account) === address) { + return new JsonRpcSigner(this, address); + } + } + + throw new Error("invalid account"); + } + + async listAccounts(): Promise> { + const accounts: Array = await this.send("xcb_accounts", []); + return accounts.map((a) => new JsonRpcSigner(this, a)); + } } export abstract class JsonRpcApiPollingProvider extends JsonRpcApiProvider { - #pollingInterval: number; - constructor(network?: Networkish, options?: JsonRpcApiProviderOptions) { - super(network, options); - - this.#pollingInterval = 4000; - } - - _getSubscriber(sub: Subscription): Subscriber { - const subscriber = super._getSubscriber(sub); - if (isPollable(subscriber)) { - subscriber.pollingInterval = this.#pollingInterval; - } - return subscriber; - } - - /** - * The polling interval (default: 4000 ms) - */ - get pollingInterval(): number { - return this.#pollingInterval; - } - set pollingInterval(value: number) { - if (!Number.isInteger(value) || value < 0) { - throw new Error("invalid interval"); - } - this.#pollingInterval = value; - this._forEachSubscriber((sub) => { - if (isPollable(sub)) { - sub.pollingInterval = this.#pollingInterval; - } - }); - } + #pollingInterval: number; + constructor(network?: Networkish, options?: JsonRpcApiProviderOptions) { + super(network, options); + + this.#pollingInterval = 4000; + } + + _getSubscriber(sub: Subscription): Subscriber { + const subscriber = super._getSubscriber(sub); + if (isPollable(subscriber)) { + subscriber.pollingInterval = this.#pollingInterval; + } + return subscriber; + } + + /** + * The polling interval (default: 4000 ms) + */ + get pollingInterval(): number { + return this.#pollingInterval; + } + set pollingInterval(value: number) { + if (!Number.isInteger(value) || value < 0) { + throw new Error("invalid interval"); + } + this.#pollingInterval = value; + this._forEachSubscriber((sub) => { + if (isPollable(sub)) { + sub.pollingInterval = this.#pollingInterval; + } + }); + } } /** @@ -1125,123 +1125,123 @@ export abstract class JsonRpcApiPollingProvider extends JsonRpcApiProvider { * for updates. */ export class JsonRpcProvider extends JsonRpcApiPollingProvider { - #connect: FetchRequest; - - constructor( - url?: string | FetchRequest, - network?: Networkish, - options?: JsonRpcApiProviderOptions, - ) { - if (url == null) { - url = "http://localhost:8545"; - } - super(network, options); - - if (typeof url === "string") { - this.#connect = new FetchRequest(url); - } else { - this.#connect = url.clone(); - } - } - - _getConnection(): FetchRequest { - return this.#connect.clone(); - } - - async send( - method: string, - params: Array | Record, - ): Promise { - // All requests are over HTTP, so we can just start handling requests - // We do this here rather than the constructor so that we don't send any - // requests to the network (i.e. xcb_networkId) until we absolutely have to. - await this._start(); - - return await super.send(method, params); - } - - async _send( - payload: JsonRpcPayload | Array, - ): Promise> { - // Configure a POST connection for the requested method - const request = this._getConnection(); - request.body = JSON.stringify(payload); - request.setHeader("content-type", "application/json"); - - const response = await request.send(); - response.assertOk(); - - let resp = response.bodyJson; - if (!Array.isArray(resp)) { - resp = [resp]; - } - - return resp; - } + #connect: FetchRequest; + + constructor( + url?: string | FetchRequest, + network?: Networkish, + options?: JsonRpcApiProviderOptions, + ) { + if (url == null) { + url = "http://localhost:8545"; + } + super(network, options); + + if (typeof url === "string") { + this.#connect = new FetchRequest(url); + } else { + this.#connect = url.clone(); + } + } + + _getConnection(): FetchRequest { + return this.#connect.clone(); + } + + async send( + method: string, + params: Array | Record, + ): Promise { + // All requests are over HTTP, so we can just start handling requests + // We do this here rather than the constructor so that we don't send any + // requests to the network (i.e. xcb_networkId) until we absolutely have to. + await this._start(); + + return await super.send(method, params); + } + + async _send( + payload: JsonRpcPayload | Array, + ): Promise> { + // Configure a POST connection for the requested method + const request = this._getConnection(); + request.body = JSON.stringify(payload); + request.setHeader("content-type", "application/json"); + + const response = await request.send(); + response.assertOk(); + + let resp = response.bodyJson; + if (!Array.isArray(resp)) { + resp = [resp]; + } + + return resp; + } } function spelunkData(value: any): null | { message: string; data: string } { - if (value == null) { - return null; - } - - // These *are* the droids we're looking for. - if ( - typeof value.message === "string" && - value.message.match("reverted") && - isHexString(value.data) - ) { - return { message: value.message, data: value.data }; - } - - // Spelunk further... - if (typeof value === "object") { - for (const key in value) { - const result = spelunkData(value[key]); - if (result) { - return result; - } - } - return null; - } - - // Might be a JSON string we can further descend... - if (typeof value === "string") { - try { - return spelunkData(JSON.parse(value)); - } catch (error) {} - } - - return null; + if (value == null) { + return null; + } + + // These *are* the droids we're looking for. + if ( + typeof value.message === "string" && + value.message.match("reverted") && + isHexString(value.data) + ) { + return { message: value.message, data: value.data }; + } + + // Spelunk further... + if (typeof value === "object") { + for (const key in value) { + const result = spelunkData(value[key]); + if (result) { + return result; + } + } + return null; + } + + // Might be a JSON string we can further descend... + if (typeof value === "string") { + try { + return spelunkData(JSON.parse(value)); + } catch (error) {} + } + + return null; } function _spelunkMessage(value: any, result: Array): void { - if (value == null) { - return; - } - - // These *are* the droids we're looking for. - if (typeof value.message === "string") { - result.push(value.message); - } - - // Spelunk further... - if (typeof value === "object") { - for (const key in value) { - _spelunkMessage(value[key], result); - } - } - - // Might be a JSON string we can further descend... - if (typeof value === "string") { - try { - return _spelunkMessage(JSON.parse(value), result); - } catch (error) {} - } + if (value == null) { + return; + } + + // These *are* the droids we're looking for. + if (typeof value.message === "string") { + result.push(value.message); + } + + // Spelunk further... + if (typeof value === "object") { + for (const key in value) { + _spelunkMessage(value[key], result); + } + } + + // Might be a JSON string we can further descend... + if (typeof value === "string") { + try { + return _spelunkMessage(JSON.parse(value), result); + } catch (error) {} + } } function spelunkMessage(value: any): Array { - const result: Array = []; - _spelunkMessage(value, result); - return result; + const result: Array = []; + _spelunkMessage(value, result); + return result; } diff --git a/src.ts/providers/provider-pocket.ts b/src.ts/providers/provider-pocket.ts index 94479c8c1..8561a73cc 100644 --- a/src.ts/providers/provider-pocket.ts +++ b/src.ts/providers/provider-pocket.ts @@ -12,9 +12,9 @@ * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] */ import { - defineProperties, - FetchRequest, - assertArgument, + defineProperties, + FetchRequest, + assertArgument, } from "../utils/index.js"; import { AbstractProvider } from "./abstract-provider.js"; @@ -28,19 +28,19 @@ import type { Networkish } from "./network.js"; const defaultApplicationId = "62e1ad51b37b8e00394bda3b"; function getHost(name: string): string { - switch (name) { - case "mainnet": - return "eth-mainnet.gateway.pokt.network"; - case "goerli": - return "eth-goerli.gateway.pokt.network"; - - case "matic": - return "poly-mainnet.gateway.pokt.network"; - case "matic-mumbai": - return "polygon-mumbai-rpc.gateway.pokt.network"; - } - - assertArgument(false, "unsupported network", "network", name); + switch (name) { + case "mainnet": + return "eth-mainnet.gateway.pokt.network"; + case "goerli": + return "eth-goerli.gateway.pokt.network"; + + case "matic": + return "poly-mainnet.gateway.pokt.network"; + case "matic-mumbai": + return "polygon-mumbai-rpc.gateway.pokt.network"; + } + + assertArgument(false, "unsupported network", "network", name); } /** @@ -53,101 +53,101 @@ function getHost(name: string): string { * recommended to [sign up here](link-pocket-signup). */ export class PocketProvider - extends JsonRpcProvider - implements CommunityResourcable + extends JsonRpcProvider + implements CommunityResourcable { - /** - * The Application ID for the Pocket connection. - */ - readonly applicationId!: string; - - /** - * The Application Secret for making authenticated requests - * to the Pocket connection. - */ - readonly applicationSecret!: null | string; - - /** - * Create a new **PocketProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor( - _network?: Networkish, - applicationId?: null | string, - applicationSecret?: null | string, - ) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (applicationId == null) { - applicationId = defaultApplicationId; - } - if (applicationSecret == null) { - applicationSecret = null; - } - - const options = { staticNetwork: network }; - - const request = PocketProvider.getRequest( - network, - applicationId, - applicationSecret, - ); - super(request, network, options); - - defineProperties(this, { - applicationId, - applicationSecret, - }); - } - - _getProvider(networkId: number): AbstractProvider { - try { - return new PocketProvider( - networkId, - this.applicationId, - this.applicationSecret, - ); - } catch (error) {} - return super._getProvider(networkId); - } - - /** - * Returns a prepared request for connecting to %%network%% with - * %%applicationId%%. - */ - static getRequest( - network: Network, - applicationId?: null | string, - applicationSecret?: null | string, - ): FetchRequest { - if (applicationId == null) { - applicationId = defaultApplicationId; - } - - const request = new FetchRequest( - `https:/\/${getHost(network.name)}/v1/lb/${applicationId}`, - ); - request.allowGzip = true; - - if (applicationSecret) { - request.setCredentials("", applicationSecret); - } - - if (applicationId === defaultApplicationId) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("PocketProvider"); - return true; - }; - } - - return request; - } - - isCommunityResource(): boolean { - return this.applicationId === defaultApplicationId; - } + /** + * The Application ID for the Pocket connection. + */ + readonly applicationId!: string; + + /** + * The Application Secret for making authenticated requests + * to the Pocket connection. + */ + readonly applicationSecret!: null | string; + + /** + * Create a new **PocketProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor( + _network?: Networkish, + applicationId?: null | string, + applicationSecret?: null | string, + ) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (applicationId == null) { + applicationId = defaultApplicationId; + } + if (applicationSecret == null) { + applicationSecret = null; + } + + const options = { staticNetwork: network }; + + const request = PocketProvider.getRequest( + network, + applicationId, + applicationSecret, + ); + super(request, network, options); + + defineProperties(this, { + applicationId, + applicationSecret, + }); + } + + _getProvider(networkId: number): AbstractProvider { + try { + return new PocketProvider( + networkId, + this.applicationId, + this.applicationSecret, + ); + } catch (error) {} + return super._getProvider(networkId); + } + + /** + * Returns a prepared request for connecting to %%network%% with + * %%applicationId%%. + */ + static getRequest( + network: Network, + applicationId?: null | string, + applicationSecret?: null | string, + ): FetchRequest { + if (applicationId == null) { + applicationId = defaultApplicationId; + } + + const request = new FetchRequest( + `https:/\/${getHost(network.name)}/v1/lb/${applicationId}`, + ); + request.allowGzip = true; + + if (applicationSecret) { + request.setCredentials("", applicationSecret); + } + + if (applicationId === defaultApplicationId) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("PocketProvider"); + return true; + }; + } + + return request; + } + + isCommunityResource(): boolean { + return this.applicationId === defaultApplicationId; + } } diff --git a/src.ts/providers/provider-quicknode.ts b/src.ts/providers/provider-quicknode.ts index 37a6a52af..ba2685d0a 100644 --- a/src.ts/providers/provider-quicknode.ts +++ b/src.ts/providers/provider-quicknode.ts @@ -17,9 +17,9 @@ */ import { - defineProperties, - FetchRequest, - assertArgument, + defineProperties, + FetchRequest, + assertArgument, } from "../utils/index.js"; import { showThrottleMessage } from "./community.js"; @@ -33,25 +33,25 @@ import type { Networkish } from "./network.js"; const defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb"; function getHost(name: string): string { - switch (name) { - case "mainnet": - return "corebc.quiknode.pro"; - - case "arbitrum": - return "corebc.arbitrum-mainnet.quiknode.pro"; - case "arbitrum-goerli": - return "corebc.arbitrum-goerli.quiknode.pro"; - case "matic": - return "corebc.matic.quiknode.pro"; - case "matic-mumbai": - return "corebc.matic-testnet.quiknode.pro"; - case "optimism": - return "corebc.optimism.quiknode.pro"; - case "optimism-goerli": - return "corebc.optimism-goerli.quiknode.pro"; - } - - assertArgument(false, "unsupported network", "network", name); + switch (name) { + case "mainnet": + return "corebc.quiknode.pro"; + + case "arbitrum": + return "corebc.arbitrum-mainnet.quiknode.pro"; + case "arbitrum-goerli": + return "corebc.arbitrum-goerli.quiknode.pro"; + case "matic": + return "corebc.matic.quiknode.pro"; + case "matic-mumbai": + return "corebc.matic-testnet.quiknode.pro"; + case "optimism": + return "corebc.optimism.quiknode.pro"; + case "optimism-goerli": + return "corebc.optimism-goerli.quiknode.pro"; + } + + assertArgument(false, "unsupported network", "network", name); } /** @@ -64,65 +64,65 @@ function getHost(name: string): string { * recommended to [sign up here](link-quicknode). */ export class QuickNodeProvider - extends JsonRpcProvider - implements CommunityResourcable + extends JsonRpcProvider + implements CommunityResourcable { - /** - * The API token. - */ - readonly token!: string; - - /** - * Creates a new **QuickNodeProvider**. - */ - constructor(_network?: Networkish, token?: null | string) { - if (_network == null) { - _network = "mainnet"; - } - const network = Network.from(_network); - if (token == null) { - token = defaultToken; - } - - const request = QuickNodeProvider.getRequest(network, token); - super(request, network, { staticNetwork: network }); - - defineProperties(this, { token }); - } - - _getProvider(networkId: number): AbstractProvider { - try { - return new QuickNodeProvider(networkId, this.token); - } catch (error) {} - return super._getProvider(networkId); - } - - isCommunityResource(): boolean { - return this.token === defaultToken; - } - - /** - * Returns a new request prepared for %%network%% and the - * %%token%%. - */ - static getRequest(network: Network, token?: null | string): FetchRequest { - if (token == null) { - token = defaultToken; - } - - const request = new FetchRequest( - `https:/\/${getHost(network.name)}/${token}`, - ); - request.allowGzip = true; - //if (projectSecret) { request.setCredentials("", projectSecret); } - - if (token === defaultToken) { - request.retryFunc = async (request, response, attempt) => { - showThrottleMessage("QuickNodeProvider"); - return true; - }; - } - - return request; - } + /** + * The API token. + */ + readonly token!: string; + + /** + * Creates a new **QuickNodeProvider**. + */ + constructor(_network?: Networkish, token?: null | string) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (token == null) { + token = defaultToken; + } + + const request = QuickNodeProvider.getRequest(network, token); + super(request, network, { staticNetwork: network }); + + defineProperties(this, { token }); + } + + _getProvider(networkId: number): AbstractProvider { + try { + return new QuickNodeProvider(networkId, this.token); + } catch (error) {} + return super._getProvider(networkId); + } + + isCommunityResource(): boolean { + return this.token === defaultToken; + } + + /** + * Returns a new request prepared for %%network%% and the + * %%token%%. + */ + static getRequest(network: Network, token?: null | string): FetchRequest { + if (token == null) { + token = defaultToken; + } + + const request = new FetchRequest( + `https:/\/${getHost(network.name)}/${token}`, + ); + request.allowGzip = true; + //if (projectSecret) { request.setCredentials("", projectSecret); } + + if (token === defaultToken) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("QuickNodeProvider"); + return true; + }; + } + + return request; + } } diff --git a/src.ts/providers/provider-socket.ts b/src.ts/providers/provider-socket.ts index f502d80ac..27b1a50df 100644 --- a/src.ts/providers/provider-socket.ts +++ b/src.ts/providers/provider-socket.ts @@ -16,136 +16,136 @@ import { JsonRpcApiProvider } from "./provider-jsonrpc.js"; import type { Subscriber, Subscription } from "./abstract-provider.js"; import type { EventFilter } from "./provider.js"; import type { - JsonRpcError, - JsonRpcPayload, - JsonRpcResult, + JsonRpcError, + JsonRpcPayload, + JsonRpcResult, } from "./provider-jsonrpc.js"; import type { Networkish } from "./network.js"; type JsonRpcSubscription = { - method: string; - params: { - result: any; - subscription: string; - }; + method: string; + params: { + result: any; + subscription: string; + }; }; export class SocketSubscriber implements Subscriber { - #provider: SocketProvider; - - #filter: string; - get filter(): Array { - return JSON.parse(this.#filter); - } - - #filterId: null | Promise; - #paused: null | boolean; - - #emitPromise: null | Promise; - - constructor(provider: SocketProvider, filter: Array) { - this.#provider = provider; - this.#filter = JSON.stringify(filter); - this.#filterId = null; - this.#paused = null; - this.#emitPromise = null; - } - - start(): void { - this.#filterId = this.#provider - .send("xcb_subscribe", this.filter) - .then((filterId) => { - this.#provider._register(filterId, this); - return filterId; - }); - } - - stop(): void { - (>this.#filterId).then((filterId) => { - this.#provider.send("xcb_unsubscribe", [filterId]); - }); - this.#filterId = null; - } - - // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs - // and resume - pause(dropWhilePaused?: boolean): void { - assert( - dropWhilePaused, - "preserve logs while paused not supported by SocketSubscriber yet", - "UNSUPPORTED_OPERATION", - { operation: "pause(false)" }, - ); - this.#paused = !!dropWhilePaused; - } - - resume(): void { - this.#paused = null; - } - - _handleMessage(message: any): void { - if (this.#filterId == null) { - return; - } - if (this.#paused === null) { - let emitPromise: null | Promise = this.#emitPromise; - if (emitPromise == null) { - emitPromise = this._emit(this.#provider, message); - } else { - emitPromise = emitPromise.then(async () => { - await this._emit(this.#provider, message); - }); - } - this.#emitPromise = emitPromise.then(() => { - if (this.#emitPromise === emitPromise) { - this.#emitPromise = null; - } - }); - } - } - - async _emit(provider: SocketProvider, message: any): Promise { - throw new Error("sub-classes must implemente this; _emit"); - } + #provider: SocketProvider; + + #filter: string; + get filter(): Array { + return JSON.parse(this.#filter); + } + + #filterId: null | Promise; + #paused: null | boolean; + + #emitPromise: null | Promise; + + constructor(provider: SocketProvider, filter: Array) { + this.#provider = provider; + this.#filter = JSON.stringify(filter); + this.#filterId = null; + this.#paused = null; + this.#emitPromise = null; + } + + start(): void { + this.#filterId = this.#provider + .send("xcb_subscribe", this.filter) + .then((filterId) => { + this.#provider._register(filterId, this); + return filterId; + }); + } + + stop(): void { + (>this.#filterId).then((filterId) => { + this.#provider.send("xcb_unsubscribe", [filterId]); + }); + this.#filterId = null; + } + + // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs + // and resume + pause(dropWhilePaused?: boolean): void { + assert( + dropWhilePaused, + "preserve logs while paused not supported by SocketSubscriber yet", + "UNSUPPORTED_OPERATION", + { operation: "pause(false)" }, + ); + this.#paused = !!dropWhilePaused; + } + + resume(): void { + this.#paused = null; + } + + _handleMessage(message: any): void { + if (this.#filterId == null) { + return; + } + if (this.#paused === null) { + let emitPromise: null | Promise = this.#emitPromise; + if (emitPromise == null) { + emitPromise = this._emit(this.#provider, message); + } else { + emitPromise = emitPromise.then(async () => { + await this._emit(this.#provider, message); + }); + } + this.#emitPromise = emitPromise.then(() => { + if (this.#emitPromise === emitPromise) { + this.#emitPromise = null; + } + }); + } + } + + async _emit(provider: SocketProvider, message: any): Promise { + throw new Error("sub-classes must implemente this; _emit"); + } } export class SocketBlockSubscriber extends SocketSubscriber { - constructor(provider: SocketProvider) { - super(provider, ["newHeads"]); - } + constructor(provider: SocketProvider) { + super(provider, ["newHeads"]); + } - async _emit(provider: SocketProvider, message: any): Promise { - provider.emit("block", parseInt(message.number)); - } + async _emit(provider: SocketProvider, message: any): Promise { + provider.emit("block", parseInt(message.number)); + } } export class SocketPendingSubscriber extends SocketSubscriber { - constructor(provider: SocketProvider) { - super(provider, ["newPendingTransactions"]); - } + constructor(provider: SocketProvider) { + super(provider, ["newPendingTransactions"]); + } - async _emit(provider: SocketProvider, message: any): Promise { - provider.emit("pending", message); - } + async _emit(provider: SocketProvider, message: any): Promise { + provider.emit("pending", message); + } } export class SocketEventSubscriber extends SocketSubscriber { - #logFilter: string; - get logFilter(): EventFilter { - return JSON.parse(this.#logFilter); - } - - constructor(provider: SocketProvider, filter: EventFilter) { - super(provider, ["logs", filter]); - this.#logFilter = JSON.stringify(filter); - } - - async _emit(provider: SocketProvider, message: any): Promise { - provider.emit( - this.logFilter, - provider._wrapLog(message, provider._network), - ); - } + #logFilter: string; + get logFilter(): EventFilter { + return JSON.parse(this.#logFilter); + } + + constructor(provider: SocketProvider, filter: EventFilter) { + super(provider, ["logs", filter]); + this.#logFilter = JSON.stringify(filter); + } + + async _emit(provider: SocketProvider, message: any): Promise { + provider.emit( + this.logFilter, + provider._wrapLog(message, provider._network), + ); + } } /** @@ -153,31 +153,31 @@ export class SocketEventSubscriber extends SocketSubscriber { * */ export class SocketProvider extends JsonRpcApiProvider { - #callbacks: Map< - number, - { - payload: JsonRpcPayload; - resolve: (r: any) => void; - reject: (e: Error) => void; - } - >; - - // Maps each filterId to its subscriber - #subs: Map; - - // If any events come in before a subscriber has finished - // registering, queue them - #pending: Map>; - - constructor(network?: Networkish) { - super(network, { batchMaxCount: 1 }); - this.#callbacks = new Map(); - this.#subs = new Map(); - this.#pending = new Map(); - } - - // This value is only valid after _start has been called - /* + #callbacks: Map< + number, + { + payload: JsonRpcPayload; + resolve: (r: any) => void; + reject: (e: Error) => void; + } + >; + + // Maps each filterId to its subscriber + #subs: Map; + + // If any events come in before a subscriber has finished + // registering, queue them + #pending: Map>; + + constructor(network?: Networkish) { + super(network, { batchMaxCount: 1 }); + this.#callbacks = new Map(); + this.#subs = new Map(); + this.#pending = new Map(); + } + + // This value is only valid after _start has been called + /* get _network(): Network { if (this.#network == null) { throw new Error("this shouldn't happen"); @@ -186,66 +186,66 @@ export class SocketProvider extends JsonRpcApiProvider { } */ - _getSubscriber(sub: Subscription): Subscriber { - switch (sub.type) { - case "close": - return new UnmanagedSubscriber("close"); - case "block": - return new SocketBlockSubscriber(this); - case "pending": - return new SocketPendingSubscriber(this); - case "event": - return new SocketEventSubscriber(this, sub.filter); - case "orphan": - // Handled auto-matically within AbstractProvider - // when the log.removed = true - if (sub.filter.orphan === "drop-log") { - return new UnmanagedSubscriber("drop-log"); - } - } - return super._getSubscriber(sub); - } - - _register(filterId: number | string, subscriber: SocketSubscriber): void { - this.#subs.set(filterId, subscriber); - const pending = this.#pending.get(filterId); - if (pending) { - for (const message of pending) { - subscriber._handleMessage(message); - } - this.#pending.delete(filterId); - } - } - - async _send( - payload: JsonRpcPayload | Array, - ): Promise> { - // WebSocket provider doesn't accept batches - assertArgument( - !Array.isArray(payload), - "WebSocket does not support batch send", - "payload", - payload, - ); - - // @TODO: stringify payloads here and store to prevent mutations - - // Prepare a promise to respond to - const promise = new Promise((resolve, reject) => { - this.#callbacks.set(payload.id, { payload, resolve, reject }); - }); - - // Wait until the socket is connected before writing to it - await this._waitUntilReady(); - - // Write the request to the socket - await this._write(JSON.stringify(payload)); - - return >[await promise]; - } - - // Sub-classes must call this once they are connected - /* + _getSubscriber(sub: Subscription): Subscriber { + switch (sub.type) { + case "close": + return new UnmanagedSubscriber("close"); + case "block": + return new SocketBlockSubscriber(this); + case "pending": + return new SocketPendingSubscriber(this); + case "event": + return new SocketEventSubscriber(this, sub.filter); + case "orphan": + // Handled auto-matically within AbstractProvider + // when the log.removed = true + if (sub.filter.orphan === "drop-log") { + return new UnmanagedSubscriber("drop-log"); + } + } + return super._getSubscriber(sub); + } + + _register(filterId: number | string, subscriber: SocketSubscriber): void { + this.#subs.set(filterId, subscriber); + const pending = this.#pending.get(filterId); + if (pending) { + for (const message of pending) { + subscriber._handleMessage(message); + } + this.#pending.delete(filterId); + } + } + + async _send( + payload: JsonRpcPayload | Array, + ): Promise> { + // WebSocket provider doesn't accept batches + assertArgument( + !Array.isArray(payload), + "WebSocket does not support batch send", + "payload", + payload, + ); + + // @TODO: stringify payloads here and store to prevent mutations + + // Prepare a promise to respond to + const promise = new Promise((resolve, reject) => { + this.#callbacks.set(payload.id, { payload, resolve, reject }); + }); + + // Wait until the socket is connected before writing to it + await this._waitUntilReady(); + + // Write the request to the socket + await this._write(JSON.stringify(payload)); + + return >[await promise]; + } + + // Sub-classes must call this once they are connected + /* async _start(): Promise { if (this.#ready) { return; } @@ -259,44 +259,44 @@ export class SocketProvider extends JsonRpcApiProvider { } */ - // Sub-classes must call this for each message - async _processMessage(message: string): Promise { - const result = ( - JSON.parse(message) - ); - - if ("id" in result) { - const callback = this.#callbacks.get(result.id); - if (callback == null) { - this.emit( - "error", - makeError("received result for unknown id", "UNKNOWN_ERROR", { - reasonCode: "UNKNOWN_ID", - result, - }), - ); - return; - } - this.#callbacks.delete(result.id); - - callback.resolve(result); - } else if (result.method === "xcb_subscription") { - const filterId = result.params.subscription; - const subscriber = this.#subs.get(filterId); - if (subscriber) { - subscriber._handleMessage(result.params.result); - } else { - let pending = this.#pending.get(filterId); - if (pending == null) { - pending = []; - this.#pending.set(filterId, pending); - } - pending.push(result.params.result); - } - } - } - - async _write(message: string): Promise { - throw new Error("sub-classes must override this"); - } + // Sub-classes must call this for each message + async _processMessage(message: string): Promise { + const result = ( + JSON.parse(message) + ); + + if ("id" in result) { + const callback = this.#callbacks.get(result.id); + if (callback == null) { + this.emit( + "error", + makeError("received result for unknown id", "UNKNOWN_ERROR", { + reasonCode: "UNKNOWN_ID", + result, + }), + ); + return; + } + this.#callbacks.delete(result.id); + + callback.resolve(result); + } else if (result.method === "xcb_subscription") { + const filterId = result.params.subscription; + const subscriber = this.#subs.get(filterId); + if (subscriber) { + subscriber._handleMessage(result.params.result); + } else { + let pending = this.#pending.get(filterId); + if (pending == null) { + pending = []; + this.#pending.set(filterId, pending); + } + pending.push(result.params.result); + } + } + } + + async _write(message: string): Promise { + throw new Error("sub-classes must override this"); + } } diff --git a/src.ts/providers/provider-websocket.ts b/src.ts/providers/provider-websocket.ts index 89e00a9b2..8b032c7f0 100644 --- a/src.ts/providers/provider-websocket.ts +++ b/src.ts/providers/provider-websocket.ts @@ -5,61 +5,61 @@ import { SocketProvider } from "./provider-socket.js"; import type { Networkish } from "./network.js"; export interface WebSocketLike { - onopen: null | ((...args: Array) => any); - onmessage: null | ((...args: Array) => any); - onerror: null | ((...args: Array) => any); + onopen: null | ((...args: Array) => any); + onmessage: null | ((...args: Array) => any); + onerror: null | ((...args: Array) => any); - readyState: number; + readyState: number; - send(payload: any): void; - close(code?: number, reason?: string): void; + send(payload: any): void; + close(code?: number, reason?: string): void; } export type WebSocketCreator = () => WebSocketLike; export class WebSocketProvider extends SocketProvider { - #connect: null | WebSocketCreator; + #connect: null | WebSocketCreator; - #websocket: null | WebSocketLike; - get websocket(): WebSocketLike { - if (this.#websocket == null) { - throw new Error("websocket closed"); - } - return this.#websocket; - } + #websocket: null | WebSocketLike; + get websocket(): WebSocketLike { + if (this.#websocket == null) { + throw new Error("websocket closed"); + } + return this.#websocket; + } - constructor( - url: string | WebSocketLike | WebSocketCreator, - network?: Networkish, - ) { - super(network); - if (typeof url === "string") { - this.#connect = () => { - return new _WebSocket(url); - }; - this.#websocket = this.#connect(); - } else if (typeof url === "function") { - this.#connect = url; - this.#websocket = url(); - } else { - this.#connect = null; - this.#websocket = url; - } + constructor( + url: string | WebSocketLike | WebSocketCreator, + network?: Networkish, + ) { + super(network); + if (typeof url === "string") { + this.#connect = () => { + return new _WebSocket(url); + }; + this.#websocket = this.#connect(); + } else if (typeof url === "function") { + this.#connect = url; + this.#websocket = url(); + } else { + this.#connect = null; + this.#websocket = url; + } - this.websocket.onopen = async () => { - try { - await this._start(); - this.resume(); - } catch (error) { - console.log("failed to start WebsocketProvider", error); - // @TODO: now what? Attempt reconnect? - } - }; + this.websocket.onopen = async () => { + try { + await this._start(); + this.resume(); + } catch (error) { + console.log("failed to start WebsocketProvider", error); + // @TODO: now what? Attempt reconnect? + } + }; - this.websocket.onmessage = (message: { data: string }) => { - this._processMessage(message.data); - }; - /* + this.websocket.onmessage = (message: { data: string }) => { + this._processMessage(message.data); + }; + /* this.websocket.onclose = (event) => { // @TODO: What event.code should we reconnect on? const reconnect = false; @@ -74,17 +74,17 @@ export class WebSocketProvider extends SocketProvider { } }; */ - } + } - async _write(message: string): Promise { - this.websocket.send(message); - } + async _write(message: string): Promise { + this.websocket.send(message); + } - async destroy(): Promise { - if (this.#websocket != null) { - this.#websocket.close(); - this.#websocket = null; - } - super.destroy(); - } + async destroy(): Promise { + if (this.#websocket != null) { + this.#websocket.close(); + this.#websocket = null; + } + super.destroy(); + } } diff --git a/src.ts/providers/provider.ts b/src.ts/providers/provider.ts index 22bbf1b70..79373abb6 100644 --- a/src.ts/providers/provider.ts +++ b/src.ts/providers/provider.ts @@ -1,13 +1,13 @@ import { - defineProperties, - getBigInt, - getNumber, - hexlify, - resolveProperties, - assert, - assertArgument, - isError, - makeError, + defineProperties, + getBigInt, + getNumber, + hexlify, + resolveProperties, + assert, + assertArgument, + isError, + makeError, } from "../utils/index.js"; import type { AddressLike, NameResolver } from "../address/index.js"; @@ -22,26 +22,26 @@ const BN_0 = BigInt(0); export type BlockTag = BigNumberish | string; import { - BlockParams, - LogParams, - TransactionReceiptParams, - TransactionResponseParams, + BlockParams, + LogParams, + TransactionReceiptParams, + TransactionResponseParams, } from "./formatting.js"; // ----------------------- function getValue(value: undefined | null | T): null | T { - if (value == null) { - return null; - } - return value; + if (value == null) { + return null; + } + return value; } function toJson(value: null | bigint): null | string { - if (value == null) { - return null; - } - return value.toString(); + if (value == null) { + return null; + } + return value.toString(); } // @TODO? implements Required @@ -51,117 +51,117 @@ function toJson(value: null | bigint): null | string { * the network. */ export class FeeData { - /** - * The energy price for legacy networks. - */ - readonly energyPrice!: null | bigint; - - constructor(energyPrice?: null | bigint) { - defineProperties(this, { - energyPrice: getValue(energyPrice), - }); - } - - /** - * Returns a JSON-friendly value. - */ - toJSON(): any { - const { energyPrice } = this; - return { - _type: "FeeData", - energyPrice: toJson(energyPrice), - }; - } + /** + * The energy price for legacy networks. + */ + readonly energyPrice!: null | bigint; + + constructor(energyPrice?: null | bigint) { + defineProperties(this, { + energyPrice: getValue(energyPrice), + }); + } + + /** + * Returns a JSON-friendly value. + */ + toJSON(): any { + const { energyPrice } = this; + return { + _type: "FeeData", + energyPrice: toJson(energyPrice), + }; + } } export interface TransactionRequest { - type?: null | number; + type?: null | number; - to?: null | AddressLike; - from?: null | AddressLike; + to?: null | AddressLike; + from?: null | AddressLike; - nonce?: null | number; + nonce?: null | number; - energyLimit?: null | BigNumberish; - energyPrice?: null | BigNumberish; + energyLimit?: null | BigNumberish; + energyPrice?: null | BigNumberish; - data?: null | string; - value?: null | BigNumberish; - networkId?: null | BigNumberish; - customData?: any; - // Only meaningful when used for call - blockTag?: BlockTag; - enableCcipRead?: boolean; + data?: null | string; + value?: null | BigNumberish; + networkId?: null | BigNumberish; + customData?: any; + // Only meaningful when used for call + blockTag?: BlockTag; + enableCcipRead?: boolean; - // Todo? - //energyMultiplier?: number; + // Todo? + //energyMultiplier?: number; } export interface PreparedTransactionRequest { - to?: AddressLike; - from?: AddressLike; + to?: AddressLike; + from?: AddressLike; - nonce?: number; + nonce?: number; - energyLimit?: bigint; - energyPrice?: bigint; + energyLimit?: bigint; + energyPrice?: bigint; - data?: string; - value?: bigint; - networkId?: bigint; + data?: string; + value?: bigint; + networkId?: bigint; - customData?: any; + customData?: any; - blockTag?: BlockTag; - enableCcipRead?: boolean; + blockTag?: BlockTag; + enableCcipRead?: boolean; } export function copyRequest( - req: TransactionRequest, + req: TransactionRequest, ): PreparedTransactionRequest { - const result: any = {}; - - // These could be addresses, ENS names or Addressables - if (req.to) { - result.to = req.to; - } - if (req.from) { - result.from = req.from; - } - - if (req.data) { - result.data = hexlify(req.data); - } - - const bigIntKeys = "networkId,energyLimit,energyPrice,value".split(/,/); - for (const key of bigIntKeys) { - if (!(key in req) || (req)[key] == null) { - continue; - } - result[key] = getBigInt((req)[key], `request.${key}`); - } - - const numberKeys = "type,nonce".split(/,/); - for (const key of numberKeys) { - if (!(key in req) || (req)[key] == null) { - continue; - } - result[key] = getNumber((req)[key], `request.${key}`); - } - - if ("blockTag" in req) { - result.blockTag = req.blockTag; - } - - if ("enableCcipRead" in req) { - result.enableCcipReadEnabled = !!req.enableCcipRead; - } - - if ("customData" in req) { - result.customData = req.customData; - } - - return result; + const result: any = {}; + + // These could be addresses, ENS names or Addressables + if (req.to) { + result.to = req.to; + } + if (req.from) { + result.from = req.from; + } + + if (req.data) { + result.data = hexlify(req.data); + } + + const bigIntKeys = "networkId,energyLimit,energyPrice,value".split(/,/); + for (const key of bigIntKeys) { + if (!(key in req) || (req)[key] == null) { + continue; + } + result[key] = getBigInt((req)[key], `request.${key}`); + } + + const numberKeys = "type,nonce".split(/,/); + for (const key of numberKeys) { + if (!(key in req) || (req)[key] == null) { + continue; + } + result[key] = getNumber((req)[key], `request.${key}`); + } + + if ("blockTag" in req) { + result.blockTag = req.blockTag; + } + + if ("enableCcipRead" in req) { + result.enableCcipReadEnabled = !!req.enableCcipRead; + } + + if ("customData" in req) { + result.customData = req.customData; + } + + return result; } ////////////////////// @@ -175,11 +175,11 @@ export function copyRequest( * Before a block is included, it is a //pending// block. */ export interface MinedBlock extends Block { - readonly number: number; - readonly hash: string; - readonly timestamp: number; - readonly date: Date; - readonly miner: string; + readonly number: number; + readonly hash: string; + readonly timestamp: number; + readonly date: Date; + readonly miner: string; } /** @@ -187,409 +187,409 @@ export interface MinedBlock extends Block { * Core. */ export class Block implements BlockParams, Iterable { - /** - * The provider connected to the block used to fetch additional details - * if necessary. - */ - readonly provider!: Provider; - - /** - * The block number, sometimes called the block height. This is a - * sequential number that is one higher than the parent block. - */ - readonly number!: number; - - /** - * The block hash. - */ - readonly hash!: null | string; - - /** - * The timestamp for this block, which is the number of seconds since - * epoch that this block was included. - */ - readonly timestamp!: number; - - /** - * The block hash of the parent block. - */ - readonly parentHash!: string; - - /** - * The nonce. - * - * On legacy networks, this is the random number inserted which - * permitted the difficulty target to be reached. - */ - readonly nonce!: string; - - /** - * The difficulty target. - * - * On legacy networks, this is the proof-of-work target required - * for a block to meet the protocol rules to be included. - * - * On modern networks, this is a random number arrived at using - * randao. @TODO: Find links? - */ - readonly difficulty!: bigint; - - /** - * The total energy limit for this block. - */ - readonly energyLimit!: bigint; - - /** - * The total energy used in this block. - */ - readonly energyUsed!: bigint; - - /** - * The miner coinbase address, wihch receives any subsidies for - * including this block. - */ - readonly miner!: string; - - /** - * Any extra data the validator wished to include. - */ - readonly extraData!: string; - - /** - * The base fee per energy that all transactions in this block were - * charged. - * - * This adjusts after each block, depending on how congested the network - * is. - */ - readonly baseFeePerEnergy!: null | bigint; - - readonly #transactions: Array; - - /** - * Create a new **Block** object. - * - * This should generally not be necessary as the unless implementing a - * low-level library. - */ - constructor(block: BlockParams, provider: Provider) { - this.#transactions = block.transactions.map((tx) => { - if (typeof tx !== "string") { - return new TransactionResponse(tx, provider); - } - return tx; - }); - - defineProperties(this, { - provider, - - hash: getValue(block.hash), - - number: block.number, - timestamp: block.timestamp, - - parentHash: block.parentHash, - - nonce: block.nonce, - difficulty: block.difficulty, - - energyLimit: block.energyLimit, - energyUsed: block.energyUsed, - miner: block.miner, - extraData: block.extraData, - - baseFeePerEnergy: getValue(block.baseFeePerEnergy), - }); - } - - /** - * Returns the list of transaction hashes. - */ - get transactions(): ReadonlyArray { - return this.#transactions.map((tx) => { - if (typeof tx === "string") { - return tx; - } - return tx.hash; - }); - } - - /** - * Returns the complete transactions for blocks which - * prefetched them, by passing ``true`` to %%prefetchTxs%% - * into [[provider_getBlock]]. - */ - get prefetchedTransactions(): Array { - const txs = this.#transactions.slice(); - - // Doesn't matter... - if (txs.length === 0) { - return []; - } - - // Make sure we prefetched the transactions - assert( - typeof txs[0] === "object", - "transactions were not prefetched with block request", - "UNSUPPORTED_OPERATION", - { - operation: "transactionResponses()", - }, - ); - - return >txs; - } - - /** - * Returns a JSON-friendly value. - */ - toJSON(): any { - const { - baseFeePerEnergy, - difficulty, - extraData, - energyLimit, - energyUsed, - hash, - miner, - nonce, - number, - parentHash, - timestamp, - transactions, - } = this; - - return { - _type: "Block", - baseFeePerEnergy: toJson(baseFeePerEnergy), - difficulty: toJson(difficulty), - extraData, - energyLimit: toJson(energyLimit), - energyUsed: toJson(energyUsed), - hash, - miner, - nonce, - number, - parentHash, - timestamp, - transactions, - }; - } - - [Symbol.iterator](): Iterator { - let index = 0; - const txs = this.transactions; - return { - next: () => { - if (index < this.length) { - return { - value: txs[index++], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - - /** - * The number of transactions in this block. - */ - get length(): number { - return this.#transactions.length; - } - - /** - * The [[link-js-date]] this block was included at. - */ - get date(): null | Date { - if (this.timestamp == null) { - return null; - } - return new Date(this.timestamp * 1000); - } - - /** - * Get the transaction at %%indexe%% within this block. - */ - async getTransaction( - indexOrHash: number | string, - ): Promise { - // Find the internal value by its index or hash - let tx: string | TransactionResponse | undefined = undefined; - if (typeof indexOrHash === "number") { - tx = this.#transactions[indexOrHash]; - } else { - const hash = indexOrHash.toLowerCase(); - for (const v of this.#transactions) { - if (typeof v === "string") { - if (v !== hash) { - continue; - } - tx = v; - break; - } else { - if (v.hash === hash) { - continue; - } - tx = v; - break; - } - } - } - if (tx == null) { - throw new Error("no such tx"); - } - - if (typeof tx === "string") { - return await this.provider.getTransaction(tx); - } else { - return tx; - } - } - - getPrefetchedTransaction(indexOrHash: number | string): TransactionResponse { - const txs = this.prefetchedTransactions; - if (typeof indexOrHash === "number") { - return txs[indexOrHash]; - } - - indexOrHash = indexOrHash.toLowerCase(); - for (const tx of txs) { - if (tx.hash === indexOrHash) { - return tx; - } - } - - assertArgument( - false, - "no matching transaction", - "indexOrHash", - indexOrHash, - ); - } - - /** - * Has this block been mined. - * - * If true, the block has been typed-gaurded that all mined - * properties are non-null. - */ - isMined(): this is MinedBlock { - return !!this.hash; - } - - /** - * - */ - isLondon(): this is Block & { baseFeePerEnergy: bigint } { - return !!this.baseFeePerEnergy; - } - - orphanedEvent(): OrphanFilter { - if (!this.isMined()) { - throw new Error(""); - } - return createOrphanedBlockFilter(this); - } + /** + * The provider connected to the block used to fetch additional details + * if necessary. + */ + readonly provider!: Provider; + + /** + * The block number, sometimes called the block height. This is a + * sequential number that is one higher than the parent block. + */ + readonly number!: number; + + /** + * The block hash. + */ + readonly hash!: null | string; + + /** + * The timestamp for this block, which is the number of seconds since + * epoch that this block was included. + */ + readonly timestamp!: number; + + /** + * The block hash of the parent block. + */ + readonly parentHash!: string; + + /** + * The nonce. + * + * On legacy networks, this is the random number inserted which + * permitted the difficulty target to be reached. + */ + readonly nonce!: string; + + /** + * The difficulty target. + * + * On legacy networks, this is the proof-of-work target required + * for a block to meet the protocol rules to be included. + * + * On modern networks, this is a random number arrived at using + * randao. @TODO: Find links? + */ + readonly difficulty!: bigint; + + /** + * The total energy limit for this block. + */ + readonly energyLimit!: bigint; + + /** + * The total energy used in this block. + */ + readonly energyUsed!: bigint; + + /** + * The miner coinbase address, wihch receives any subsidies for + * including this block. + */ + readonly miner!: string; + + /** + * Any extra data the validator wished to include. + */ + readonly extraData!: string; + + /** + * The base fee per energy that all transactions in this block were + * charged. + * + * This adjusts after each block, depending on how congested the network + * is. + */ + readonly baseFeePerEnergy!: null | bigint; + + readonly #transactions: Array; + + /** + * Create a new **Block** object. + * + * This should generally not be necessary as the unless implementing a + * low-level library. + */ + constructor(block: BlockParams, provider: Provider) { + this.#transactions = block.transactions.map((tx) => { + if (typeof tx !== "string") { + return new TransactionResponse(tx, provider); + } + return tx; + }); + + defineProperties(this, { + provider, + + hash: getValue(block.hash), + + number: block.number, + timestamp: block.timestamp, + + parentHash: block.parentHash, + + nonce: block.nonce, + difficulty: block.difficulty, + + energyLimit: block.energyLimit, + energyUsed: block.energyUsed, + miner: block.miner, + extraData: block.extraData, + + baseFeePerEnergy: getValue(block.baseFeePerEnergy), + }); + } + + /** + * Returns the list of transaction hashes. + */ + get transactions(): ReadonlyArray { + return this.#transactions.map((tx) => { + if (typeof tx === "string") { + return tx; + } + return tx.hash; + }); + } + + /** + * Returns the complete transactions for blocks which + * prefetched them, by passing ``true`` to %%prefetchTxs%% + * into [[provider_getBlock]]. + */ + get prefetchedTransactions(): Array { + const txs = this.#transactions.slice(); + + // Doesn't matter... + if (txs.length === 0) { + return []; + } + + // Make sure we prefetched the transactions + assert( + typeof txs[0] === "object", + "transactions were not prefetched with block request", + "UNSUPPORTED_OPERATION", + { + operation: "transactionResponses()", + }, + ); + + return >txs; + } + + /** + * Returns a JSON-friendly value. + */ + toJSON(): any { + const { + baseFeePerEnergy, + difficulty, + extraData, + energyLimit, + energyUsed, + hash, + miner, + nonce, + number, + parentHash, + timestamp, + transactions, + } = this; + + return { + _type: "Block", + baseFeePerEnergy: toJson(baseFeePerEnergy), + difficulty: toJson(difficulty), + extraData, + energyLimit: toJson(energyLimit), + energyUsed: toJson(energyUsed), + hash, + miner, + nonce, + number, + parentHash, + timestamp, + transactions, + }; + } + + [Symbol.iterator](): Iterator { + let index = 0; + const txs = this.transactions; + return { + next: () => { + if (index < this.length) { + return { + value: txs[index++], + done: false, + }; + } + return { value: undefined, done: true }; + }, + }; + } + + /** + * The number of transactions in this block. + */ + get length(): number { + return this.#transactions.length; + } + + /** + * The [[link-js-date]] this block was included at. + */ + get date(): null | Date { + if (this.timestamp == null) { + return null; + } + return new Date(this.timestamp * 1000); + } + + /** + * Get the transaction at %%indexe%% within this block. + */ + async getTransaction( + indexOrHash: number | string, + ): Promise { + // Find the internal value by its index or hash + let tx: string | TransactionResponse | undefined = undefined; + if (typeof indexOrHash === "number") { + tx = this.#transactions[indexOrHash]; + } else { + const hash = indexOrHash.toLowerCase(); + for (const v of this.#transactions) { + if (typeof v === "string") { + if (v !== hash) { + continue; + } + tx = v; + break; + } else { + if (v.hash === hash) { + continue; + } + tx = v; + break; + } + } + } + if (tx == null) { + throw new Error("no such tx"); + } + + if (typeof tx === "string") { + return await this.provider.getTransaction(tx); + } else { + return tx; + } + } + + getPrefetchedTransaction(indexOrHash: number | string): TransactionResponse { + const txs = this.prefetchedTransactions; + if (typeof indexOrHash === "number") { + return txs[indexOrHash]; + } + + indexOrHash = indexOrHash.toLowerCase(); + for (const tx of txs) { + if (tx.hash === indexOrHash) { + return tx; + } + } + + assertArgument( + false, + "no matching transaction", + "indexOrHash", + indexOrHash, + ); + } + + /** + * Has this block been mined. + * + * If true, the block has been typed-gaurded that all mined + * properties are non-null. + */ + isMined(): this is MinedBlock { + return !!this.hash; + } + + /** + * + */ + isLondon(): this is Block & { baseFeePerEnergy: bigint } { + return !!this.baseFeePerEnergy; + } + + orphanedEvent(): OrphanFilter { + if (!this.isMined()) { + throw new Error(""); + } + return createOrphanedBlockFilter(this); + } } ////////////////////// // Log export class Log implements LogParams { - readonly provider: Provider; - - readonly transactionHash!: string; - readonly blockHash!: string; - readonly blockNumber!: number; - - readonly removed!: boolean; - - readonly address!: string; - readonly data!: string; - - readonly topics!: ReadonlyArray; - - readonly index!: number; - readonly transactionIndex!: number; - - constructor(log: LogParams, provider: Provider) { - this.provider = provider; - - const topics = Object.freeze(log.topics.slice()); - defineProperties(this, { - transactionHash: log.transactionHash, - blockHash: log.blockHash, - blockNumber: log.blockNumber, - - removed: log.removed, - - address: log.address, - data: log.data, - - topics, - - index: log.index, - transactionIndex: log.transactionIndex, - }); - } - - toJSON(): any { - const { - address, - blockHash, - blockNumber, - data, - index, - removed, - topics, - transactionHash, - transactionIndex, - } = this; - - return { - _type: "log", - address, - blockHash, - blockNumber, - data, - index, - removed, - topics, - transactionHash, - transactionIndex, - }; - } - - async getBlock(): Promise { - const block = await this.provider.getBlock(this.blockHash); - assert(!!block, "failed to find transaction", "UNKNOWN_ERROR", {}); - return block; - } - - async getTransaction(): Promise { - const tx = await this.provider.getTransaction(this.transactionHash); - assert(!!tx, "failed to find transaction", "UNKNOWN_ERROR", {}); - return tx; - } - - async getTransactionReceipt(): Promise { - const receipt = await this.provider.getTransactionReceipt( - this.transactionHash, - ); - assert( - !!receipt, - "failed to find transaction receipt", - "UNKNOWN_ERROR", - {}, - ); - return receipt; - } - - removedEvent(): OrphanFilter { - return createRemovedLogFilter(this); - } + readonly provider: Provider; + + readonly transactionHash!: string; + readonly blockHash!: string; + readonly blockNumber!: number; + + readonly removed!: boolean; + + readonly address!: string; + readonly data!: string; + + readonly topics!: ReadonlyArray; + + readonly index!: number; + readonly transactionIndex!: number; + + constructor(log: LogParams, provider: Provider) { + this.provider = provider; + + const topics = Object.freeze(log.topics.slice()); + defineProperties(this, { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + + removed: log.removed, + + address: log.address, + data: log.data, + + topics, + + index: log.index, + transactionIndex: log.transactionIndex, + }); + } + + toJSON(): any { + const { + address, + blockHash, + blockNumber, + data, + index, + removed, + topics, + transactionHash, + transactionIndex, + } = this; + + return { + _type: "log", + address, + blockHash, + blockNumber, + data, + index, + removed, + topics, + transactionHash, + transactionIndex, + }; + } + + async getBlock(): Promise { + const block = await this.provider.getBlock(this.blockHash); + assert(!!block, "failed to find transaction", "UNKNOWN_ERROR", {}); + return block; + } + + async getTransaction(): Promise { + const tx = await this.provider.getTransaction(this.transactionHash); + assert(!!tx, "failed to find transaction", "UNKNOWN_ERROR", {}); + return tx; + } + + async getTransactionReceipt(): Promise { + const receipt = await this.provider.getTransactionReceipt( + this.transactionHash, + ); + assert( + !!receipt, + "failed to find transaction receipt", + "UNKNOWN_ERROR", + {}, + ); + return receipt; + } + + removedEvent(): OrphanFilter { + return createRemovedLogFilter(this); + } } ////////////////////// @@ -610,169 +610,169 @@ export interface ByzantiumTransactionReceipt { */ export class TransactionReceipt - implements TransactionReceiptParams, Iterable + implements TransactionReceiptParams, Iterable { - readonly provider!: Provider; - - readonly to!: null | string; - readonly from!: string; - readonly contractAddress!: null | string; - - readonly hash!: string; - readonly index!: number; - - readonly blockHash!: string; - readonly blockNumber!: number; - - readonly logsBloom!: string; - - readonly energyUsed!: bigint; - readonly cumulativeEnergyUsed!: bigint; - readonly energyPrice!: bigint; - - readonly type!: number; - //readonly byzantium!: boolean; - readonly status!: null | number; - readonly root!: null | string; - - readonly #logs: ReadonlyArray; - - constructor(tx: TransactionReceiptParams, provider: Provider) { - this.#logs = Object.freeze( - tx.logs.map((log) => { - return new Log(log, provider); - }), - ); - - defineProperties(this, { - provider, - - to: tx.to, - from: tx.from, - contractAddress: tx.contractAddress, - - hash: tx.hash, - index: tx.index, - - blockHash: tx.blockHash, - blockNumber: tx.blockNumber, - - logsBloom: tx.logsBloom, - - energyUsed: tx.energyUsed, - cumulativeEnergyUsed: tx.cumulativeEnergyUsed, - energyPrice: (tx.effectiveEnergyPrice || tx.energyPrice) as bigint, - //byzantium: tx.byzantium, - status: tx.status, - root: tx.root, - }); - } - - get logs(): ReadonlyArray { - return this.#logs; - } - - toJSON(): any { - const { - to, - from, - contractAddress, - hash, - index, - blockHash, - blockNumber, - logsBloom, - logs, //byzantium, - status, - root, - } = this; - - return { - _type: "TransactionReceipt", - blockHash, - blockNumber, - //byzantium, - contractAddress, - cumulativeEnergyUsed: toJson(this.cumulativeEnergyUsed), - from, - energyPrice: toJson(this.energyPrice), - energyUsed: toJson(this.energyUsed), - hash, - index, - logs, - logsBloom, - root, - status, - to, - }; - } - - get length(): number { - return this.logs.length; - } - - [Symbol.iterator](): Iterator { - let index = 0; - return { - next: () => { - if (index < this.length) { - return { value: this.logs[index++], done: false }; - } - return { value: undefined, done: true }; - }, - }; - } - - get fee(): bigint { - return this.energyUsed * this.energyPrice; - } - - async getBlock(): Promise { - const block = await this.provider.getBlock(this.blockHash); - if (block == null) { - throw new Error("TODO"); - } - return block; - } - - async getTransaction(): Promise { - const tx = await this.provider.getTransaction(this.hash); - if (tx == null) { - throw new Error("TODO"); - } - return tx; - } - - async getResult(): Promise { - return await this.provider.getTransactionResult(this.hash); - } - - async confirmations(): Promise { - return (await this.provider.getBlockNumber()) - this.blockNumber + 1; - } - - removedEvent(): OrphanFilter { - return createRemovedTransactionFilter(this); - } - - reorderedEvent(other?: TransactionResponse): OrphanFilter { - assert( - !other || other.isMined(), - "unmined 'other' transction cannot be orphaned", - "UNSUPPORTED_OPERATION", - { operation: "reorderedEvent(other)" }, - ); - return createReorderedTransactionFilter(this, other); - } + readonly provider!: Provider; + + readonly to!: null | string; + readonly from!: string; + readonly contractAddress!: null | string; + + readonly hash!: string; + readonly index!: number; + + readonly blockHash!: string; + readonly blockNumber!: number; + + readonly logsBloom!: string; + + readonly energyUsed!: bigint; + readonly cumulativeEnergyUsed!: bigint; + readonly energyPrice!: bigint; + + readonly type!: number; + //readonly byzantium!: boolean; + readonly status!: null | number; + readonly root!: null | string; + + readonly #logs: ReadonlyArray; + + constructor(tx: TransactionReceiptParams, provider: Provider) { + this.#logs = Object.freeze( + tx.logs.map((log) => { + return new Log(log, provider); + }), + ); + + defineProperties(this, { + provider, + + to: tx.to, + from: tx.from, + contractAddress: tx.contractAddress, + + hash: tx.hash, + index: tx.index, + + blockHash: tx.blockHash, + blockNumber: tx.blockNumber, + + logsBloom: tx.logsBloom, + + energyUsed: tx.energyUsed, + cumulativeEnergyUsed: tx.cumulativeEnergyUsed, + energyPrice: (tx.effectiveEnergyPrice || tx.energyPrice) as bigint, + //byzantium: tx.byzantium, + status: tx.status, + root: tx.root, + }); + } + + get logs(): ReadonlyArray { + return this.#logs; + } + + toJSON(): any { + const { + to, + from, + contractAddress, + hash, + index, + blockHash, + blockNumber, + logsBloom, + logs, //byzantium, + status, + root, + } = this; + + return { + _type: "TransactionReceipt", + blockHash, + blockNumber, + //byzantium, + contractAddress, + cumulativeEnergyUsed: toJson(this.cumulativeEnergyUsed), + from, + energyPrice: toJson(this.energyPrice), + energyUsed: toJson(this.energyUsed), + hash, + index, + logs, + logsBloom, + root, + status, + to, + }; + } + + get length(): number { + return this.logs.length; + } + + [Symbol.iterator](): Iterator { + let index = 0; + return { + next: () => { + if (index < this.length) { + return { value: this.logs[index++], done: false }; + } + return { value: undefined, done: true }; + }, + }; + } + + get fee(): bigint { + return this.energyUsed * this.energyPrice; + } + + async getBlock(): Promise { + const block = await this.provider.getBlock(this.blockHash); + if (block == null) { + throw new Error("TODO"); + } + return block; + } + + async getTransaction(): Promise { + const tx = await this.provider.getTransaction(this.hash); + if (tx == null) { + throw new Error("TODO"); + } + return tx; + } + + async getResult(): Promise { + return await this.provider.getTransactionResult(this.hash); + } + + async confirmations(): Promise { + return (await this.provider.getBlockNumber()) - this.blockNumber + 1; + } + + removedEvent(): OrphanFilter { + return createRemovedTransactionFilter(this); + } + + reorderedEvent(other?: TransactionResponse): OrphanFilter { + assert( + !other || other.isMined(), + "unmined 'other' transction cannot be orphaned", + "UNSUPPORTED_OPERATION", + { operation: "reorderedEvent(other)" }, + ); + return createReorderedTransactionFilter(this, other); + } } ////////////////////// // Transaction Response export interface MinedTransactionResponse extends TransactionResponse { - blockNumber: number; - blockHash: string; - date: Date; + blockNumber: number; + blockHash: string; + date: Date; } /* @@ -786,491 +786,491 @@ export type ReplacementDetectionSetup = { }; */ export class TransactionResponse - implements TransactionLike, TransactionResponseParams + implements TransactionLike, TransactionResponseParams { - /** - * The provider this is connected to, which will influence how its - * methods will resolve its async inspection methods. - */ - readonly provider: Provider; - - /** - * The block number of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - readonly blockNumber: null | number; - - /** - * The blockHash of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - readonly blockHash: null | string; - - /** - * The index within the block that this transaction resides at. - */ - readonly index!: number; - - /** - * The transaction hash. - */ - readonly hash!: string; - - /** - * The [[link-eip-2718]] transaction envelope type. This is - * ``0`` for legacy transactions types. - */ - readonly type!: number; - - /** - * The receiver of this transaction. - * - * If ``null``, then the transaction is an initcode transaction. - * This means the result of executing the [[data]] will be deployed - * as a new contract on chain (assuming it does not revert) and the - * address may be computed using [[getCreateAddress]]. - */ - readonly to!: null | string; - - /** - * The sender of this transaction. It is implicitly computed - * from the transaction pre-image hash (as the digest) and the - * [[signature]] using ecrecover. - */ - readonly from!: string; - - /** - * The nonce, which is used to prevent replay attacks and offer - * a method to ensure transactions from a given sender are explicitly - * ordered. - * - * When sending a transaction, this must be equal to the number of - * transactions ever sent by [[from]]. - */ - readonly nonce!: number; - - /** - * The maximum units of energy this transaction can consume. If execution - * exceeds this, the entries transaction is reverted and the sender - * is charged for the full amount, despite not state changes being made. - */ - readonly energyLimit!: bigint; - - /** - * The energy price can have various values, depending on the network. - * - * In modern networks, for transactions that are included this is - * the //effective energy price// (the fee per energy that was actually - * charged), while for transactions that have not been included yet - * is the [[maxFeePerEnergy]]. - * - * For legacy transactions, or transactions on legacy networks, this - * is the fee that will be charged per unit of energy the transaction - * consumes. - */ - readonly energyPrice!: bigint; - - /** - * The data. - */ - readonly data!: string; - - /** - * The value, in ore. Use [[formatXCB]] to format this value - * as xcb. - */ - readonly value!: bigint; - - /** - * The chain ID. - */ - readonly networkId!: bigint; - - /** - * The signature. - */ - readonly signature!: string; - - #startBlock: number; - - /** - * Create a new TransactionResponse with %%tx%% parameters - * connected to %%provider%%. - */ - constructor(tx: TransactionResponseParams, provider: Provider) { - this.provider = provider; - - this.blockNumber = tx.blockNumber != null ? tx.blockNumber : null; - this.blockHash = tx.blockHash != null ? tx.blockHash : null; - - this.hash = tx.hash; - this.index = tx.index; - - this.from = tx.from; - this.to = tx.to || null; - - this.energyLimit = tx.energyLimit; - this.nonce = tx.nonce; - this.data = tx.data; - this.value = tx.value; - - this.energyPrice = tx.energyPrice; - - this.networkId = tx.networkId; - this.signature = tx.signature; - - this.#startBlock = -1; - } - - /** - * Returns a JSON representation of this transaction. - */ - toJSON(): any { - const { index, hash, type, to, from, nonce, data, signature } = this; - - return { - _type: "TransactionReceipt", - networkId: toJson(this.networkId), - data, - from, - energyLimit: toJson(this.energyLimit), - energyPrice: toJson(this.energyPrice), - hash, - nonce, - signature, - to, - index, - type, - value: toJson(this.value), - }; - } - - /** - * Resolves to the Block that this transaction was included in. - * - * This will return null if the transaction has not been included yet. - */ - async getBlock(): Promise { - let blockNumber = this.blockNumber; - if (blockNumber == null) { - const tx = await this.getTransaction(); - if (tx) { - blockNumber = tx.blockNumber; - } - } - if (blockNumber == null) { - return null; - } - const block = this.provider.getBlock(blockNumber); - if (block == null) { - throw new Error("TODO"); - } - return block; - } - - /** - * Resolves to this transaction being re-requested from the - * provider. This can be used if you have an unmined transaction - * and wish to get an up-to-date populated instance. - */ - async getTransaction(): Promise { - return this.provider.getTransaction(this.hash); - } - - /** - * Resolves once this transaction has been mined and has - * %%confirms%% blocks including it (default: ``1``) with an - * optional %%timeout%%. - * - * This can resolve to ``null`` only if %%confirms%% is ``0`` - * and the transaction has not been mined, otherwise this will - * wait until enough confirmations have completed. - */ - async wait( - _confirms?: number, - _timeout?: number, - ): Promise { - const confirms = _confirms == null ? 1 : _confirms; - const timeout = _timeout == null ? 0 : _timeout; - - let startBlock = this.#startBlock; - let nextScan = -1; - let stopScanning = startBlock === -1 ? true : false; - const checkReplacement = async () => { - // Get the current transaction count for this sender - if (stopScanning) { - return null; - } - const { blockNumber, nonce } = await resolveProperties({ - blockNumber: this.provider.getBlockNumber(), - nonce: this.provider.getTransactionCount(this.from), - }); - - // No transaction or our nonce has not been mined yet; but we - // can start scanning later when we do start - if (nonce < this.nonce) { - startBlock = blockNumber; - return; - } - - // We were mined; no replacement - if (stopScanning) { - return null; - } - const mined = await this.getTransaction(); - if (mined && mined.blockNumber != null) { - return; - } - - // We were replaced; start scanning for that transaction - - // Starting to scan; look back a few extra blocks for safety - if (nextScan === -1) { - nextScan = startBlock - 3; - if (nextScan < this.#startBlock) { - nextScan = this.#startBlock; - } - } - - while (nextScan <= blockNumber) { - // Get the next block to scan - if (stopScanning) { - return null; - } - const block = await this.provider.getBlock(nextScan, true); - - // This should not happen; but we'll try again shortly - if (block == null) { - return; - } - - // We were mined; no replacement - for (const hash of block) { - if (hash === this.hash) { - return; - } - } - - // Search for the transaction that replaced us - for (let i = 0; i < block.length; i++) { - const tx: TransactionResponse = await block.getTransaction(i); - - if (tx.from === this.from && tx.nonce === this.nonce) { - // Get the receipt - if (stopScanning) { - return null; - } - const receipt = await this.provider.getTransactionReceipt(tx.hash); - - // This should not happen; but we'll try again shortly - if (receipt == null) { - return; - } - - // We will retry this on the next block (this case could be optimized) - if (blockNumber - receipt.blockNumber + 1 < confirms) { - return; - } - - // The reason we were replaced - let reason: "replaced" | "repriced" | "cancelled" = "replaced"; - if ( - tx.data === this.data && - tx.to === this.to && - tx.value === this.value - ) { - reason = "repriced"; - } else if ( - tx.data === "0x" && - tx.from === tx.to && - tx.value === BN_0 - ) { - reason = "cancelled"; - } - - assert(false, "transaction was replaced", "TRANSACTION_REPLACED", { - cancelled: reason === "replaced" || reason === "cancelled", - reason, - replacement: tx.replaceableTransaction(startBlock), - hash: tx.hash, - receipt, - }); - } - } - - nextScan++; - } - return; - }; - - const receipt = await this.provider.getTransactionReceipt(this.hash); - - if (receipt) { - if ((await receipt.confirmations()) >= confirms) { - return receipt; - } - } else { - // Check for a replacement; throws if a replacement was found - await checkReplacement(); - - // Allow null only when the confirms is 0 - if (confirms === 0) { - return null; - } - } - - const waiter = new Promise((resolve, reject) => { - // List of things to cancel when we have a result (one way or the other) - const cancellers: Array<() => void> = []; - const cancel = () => { - cancellers.forEach((c) => c()); - }; - - // On cancel, stop scanning for replacements - cancellers.push(() => { - stopScanning = true; - }); - - // Set up any timeout requested - if (timeout > 0) { - const timer = setTimeout(() => { - cancel(); - reject(makeError("wait for transaction timeout", "TIMEOUT")); - }, timeout); - cancellers.push(() => { - clearTimeout(timer); - }); - } - - const txListener = async (receipt: TransactionReceipt) => { - // Done; return it! - if ((await receipt.confirmations()) >= confirms) { - cancel(); - resolve(receipt); - } - }; - cancellers.push(() => { - this.provider.off(this.hash, txListener); - }); - this.provider.on(this.hash, txListener); - // We support replacement detection; start checking - if (startBlock >= 0) { - const replaceListener = async () => { - try { - // Check for a replacement; this throws only if one is found - await checkReplacement(); - } catch (error) { - // We were replaced (with enough confirms); re-throw the error - if (isError(error, "TRANSACTION_REPLACED")) { - cancel(); - reject(error); - return; - } - } - - // Rescheudle a check on the next block - if (!stopScanning) { - this.provider.once("block", replaceListener); - } - }; - cancellers.push(() => { - this.provider.off("block", replaceListener); - }); - this.provider.once("block", replaceListener); - } - }); - - return await (>waiter); - } - - /** - * Returns ``true`` if this transaction has been included. - * - * This is effective only as of the time the TransactionResponse - * was instantiated. To get up-to-date information, use - * [[getTransaction]]. - * - * This provides a Type Guard that this transaction will have - * non-null property values for properties that are null for - * unmined transactions. - */ - isMined(): this is MinedTransactionResponse { - return this.blockHash != null; - } - - /** - * Returns true if the transaction is a legacy (i.e. ``type == 0``) - * transaction. - * - * This provides a Type Guard that this transaction will have - * the ``null``-ness for hardfork-specific properties set correctly. - */ - isLegacy(): this is TransactionResponse & { - accessList: null; - maxFeePerEnergy: null; - maxPriorityFeePerEnergy: null; - } { - return this.type === 0; - } - - /** - * Returns a filter which can be used to listen for orphan events - * that evict this transaction. - */ - removedEvent(): OrphanFilter { - assert( - this.isMined(), - "unmined transaction canot be orphaned", - "UNSUPPORTED_OPERATION", - { operation: "removeEvent()" }, - ); - return createRemovedTransactionFilter(this); - } - - /** - * Returns a filter which can be used to listen for orphan events - * that re-order this event against %%other%%. - */ - reorderedEvent(other?: TransactionResponse): OrphanFilter { - assert( - this.isMined(), - "unmined transaction canot be orphaned", - "UNSUPPORTED_OPERATION", - { operation: "removeEvent()" }, - ); - - assert( - !other || other.isMined(), - "unmined 'other' transaction canot be orphaned", - "UNSUPPORTED_OPERATION", - { operation: "removeEvent()" }, - ); - - return createReorderedTransactionFilter(this, other); - } - - /** - * Returns a new TransactionResponse instance which has the ability to - * detect (and throw an error) if the transaction is replaced, which - * will begin scanning at %%startBlock%%. - * - * This should generally not be used by developers and is intended - * primarily for internal use. Setting an incorrect %%startBlock%% can - * have devastating performance consequences if used incorrectly. - */ - replaceableTransaction(startBlock: number): TransactionResponse { - assertArgument( - Number.isInteger(startBlock) && startBlock >= 0, - "invalid startBlock", - "startBlock", - startBlock, - ); - const tx = new TransactionResponse(this, this.provider); - tx.#startBlock = startBlock; - return tx; - } + /** + * The provider this is connected to, which will influence how its + * methods will resolve its async inspection methods. + */ + readonly provider: Provider; + + /** + * The block number of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + readonly blockNumber: null | number; + + /** + * The blockHash of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + readonly blockHash: null | string; + + /** + * The index within the block that this transaction resides at. + */ + readonly index!: number; + + /** + * The transaction hash. + */ + readonly hash!: string; + + /** + * The [[link-eip-2718]] transaction envelope type. This is + * ``0`` for legacy transactions types. + */ + readonly type!: number; + + /** + * The receiver of this transaction. + * + * If ``null``, then the transaction is an initcode transaction. + * This means the result of executing the [[data]] will be deployed + * as a new contract on chain (assuming it does not revert) and the + * address may be computed using [[getCreateAddress]]. + */ + readonly to!: null | string; + + /** + * The sender of this transaction. It is implicitly computed + * from the transaction pre-image hash (as the digest) and the + * [[signature]] using ecrecover. + */ + readonly from!: string; + + /** + * The nonce, which is used to prevent replay attacks and offer + * a method to ensure transactions from a given sender are explicitly + * ordered. + * + * When sending a transaction, this must be equal to the number of + * transactions ever sent by [[from]]. + */ + readonly nonce!: number; + + /** + * The maximum units of energy this transaction can consume. If execution + * exceeds this, the entries transaction is reverted and the sender + * is charged for the full amount, despite not state changes being made. + */ + readonly energyLimit!: bigint; + + /** + * The energy price can have various values, depending on the network. + * + * In modern networks, for transactions that are included this is + * the //effective energy price// (the fee per energy that was actually + * charged), while for transactions that have not been included yet + * is the [[maxFeePerEnergy]]. + * + * For legacy transactions, or transactions on legacy networks, this + * is the fee that will be charged per unit of energy the transaction + * consumes. + */ + readonly energyPrice!: bigint; + + /** + * The data. + */ + readonly data!: string; + + /** + * The value, in ore. Use [[formatXCB]] to format this value + * as xcb. + */ + readonly value!: bigint; + + /** + * The chain ID. + */ + readonly networkId!: bigint; + + /** + * The signature. + */ + readonly signature!: string; + + #startBlock: number; + + /** + * Create a new TransactionResponse with %%tx%% parameters + * connected to %%provider%%. + */ + constructor(tx: TransactionResponseParams, provider: Provider) { + this.provider = provider; + + this.blockNumber = tx.blockNumber != null ? tx.blockNumber : null; + this.blockHash = tx.blockHash != null ? tx.blockHash : null; + + this.hash = tx.hash; + this.index = tx.index; + + this.from = tx.from; + this.to = tx.to || null; + + this.energyLimit = tx.energyLimit; + this.nonce = tx.nonce; + this.data = tx.data; + this.value = tx.value; + + this.energyPrice = tx.energyPrice; + + this.networkId = tx.networkId; + this.signature = tx.signature; + + this.#startBlock = -1; + } + + /** + * Returns a JSON representation of this transaction. + */ + toJSON(): any { + const { index, hash, type, to, from, nonce, data, signature } = this; + + return { + _type: "TransactionReceipt", + networkId: toJson(this.networkId), + data, + from, + energyLimit: toJson(this.energyLimit), + energyPrice: toJson(this.energyPrice), + hash, + nonce, + signature, + to, + index, + type, + value: toJson(this.value), + }; + } + + /** + * Resolves to the Block that this transaction was included in. + * + * This will return null if the transaction has not been included yet. + */ + async getBlock(): Promise { + let blockNumber = this.blockNumber; + if (blockNumber == null) { + const tx = await this.getTransaction(); + if (tx) { + blockNumber = tx.blockNumber; + } + } + if (blockNumber == null) { + return null; + } + const block = this.provider.getBlock(blockNumber); + if (block == null) { + throw new Error("TODO"); + } + return block; + } + + /** + * Resolves to this transaction being re-requested from the + * provider. This can be used if you have an unmined transaction + * and wish to get an up-to-date populated instance. + */ + async getTransaction(): Promise { + return this.provider.getTransaction(this.hash); + } + + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + async wait( + _confirms?: number, + _timeout?: number, + ): Promise { + const confirms = _confirms == null ? 1 : _confirms; + const timeout = _timeout == null ? 0 : _timeout; + + let startBlock = this.#startBlock; + let nextScan = -1; + let stopScanning = startBlock === -1 ? true : false; + const checkReplacement = async () => { + // Get the current transaction count for this sender + if (stopScanning) { + return null; + } + const { blockNumber, nonce } = await resolveProperties({ + blockNumber: this.provider.getBlockNumber(), + nonce: this.provider.getTransactionCount(this.from), + }); + + // No transaction or our nonce has not been mined yet; but we + // can start scanning later when we do start + if (nonce < this.nonce) { + startBlock = blockNumber; + return; + } + + // We were mined; no replacement + if (stopScanning) { + return null; + } + const mined = await this.getTransaction(); + if (mined && mined.blockNumber != null) { + return; + } + + // We were replaced; start scanning for that transaction + + // Starting to scan; look back a few extra blocks for safety + if (nextScan === -1) { + nextScan = startBlock - 3; + if (nextScan < this.#startBlock) { + nextScan = this.#startBlock; + } + } + + while (nextScan <= blockNumber) { + // Get the next block to scan + if (stopScanning) { + return null; + } + const block = await this.provider.getBlock(nextScan, true); + + // This should not happen; but we'll try again shortly + if (block == null) { + return; + } + + // We were mined; no replacement + for (const hash of block) { + if (hash === this.hash) { + return; + } + } + + // Search for the transaction that replaced us + for (let i = 0; i < block.length; i++) { + const tx: TransactionResponse = await block.getTransaction(i); + + if (tx.from === this.from && tx.nonce === this.nonce) { + // Get the receipt + if (stopScanning) { + return null; + } + const receipt = await this.provider.getTransactionReceipt(tx.hash); + + // This should not happen; but we'll try again shortly + if (receipt == null) { + return; + } + + // We will retry this on the next block (this case could be optimized) + if (blockNumber - receipt.blockNumber + 1 < confirms) { + return; + } + + // The reason we were replaced + let reason: "replaced" | "repriced" | "cancelled" = "replaced"; + if ( + tx.data === this.data && + tx.to === this.to && + tx.value === this.value + ) { + reason = "repriced"; + } else if ( + tx.data === "0x" && + tx.from === tx.to && + tx.value === BN_0 + ) { + reason = "cancelled"; + } + + assert(false, "transaction was replaced", "TRANSACTION_REPLACED", { + cancelled: reason === "replaced" || reason === "cancelled", + reason, + replacement: tx.replaceableTransaction(startBlock), + hash: tx.hash, + receipt, + }); + } + } + + nextScan++; + } + return; + }; + + const receipt = await this.provider.getTransactionReceipt(this.hash); + + if (receipt) { + if ((await receipt.confirmations()) >= confirms) { + return receipt; + } + } else { + // Check for a replacement; throws if a replacement was found + await checkReplacement(); + + // Allow null only when the confirms is 0 + if (confirms === 0) { + return null; + } + } + + const waiter = new Promise((resolve, reject) => { + // List of things to cancel when we have a result (one way or the other) + const cancellers: Array<() => void> = []; + const cancel = () => { + cancellers.forEach((c) => c()); + }; + + // On cancel, stop scanning for replacements + cancellers.push(() => { + stopScanning = true; + }); + + // Set up any timeout requested + if (timeout > 0) { + const timer = setTimeout(() => { + cancel(); + reject(makeError("wait for transaction timeout", "TIMEOUT")); + }, timeout); + cancellers.push(() => { + clearTimeout(timer); + }); + } + + const txListener = async (receipt: TransactionReceipt) => { + // Done; return it! + if ((await receipt.confirmations()) >= confirms) { + cancel(); + resolve(receipt); + } + }; + cancellers.push(() => { + this.provider.off(this.hash, txListener); + }); + this.provider.on(this.hash, txListener); + // We support replacement detection; start checking + if (startBlock >= 0) { + const replaceListener = async () => { + try { + // Check for a replacement; this throws only if one is found + await checkReplacement(); + } catch (error) { + // We were replaced (with enough confirms); re-throw the error + if (isError(error, "TRANSACTION_REPLACED")) { + cancel(); + reject(error); + return; + } + } + + // Rescheudle a check on the next block + if (!stopScanning) { + this.provider.once("block", replaceListener); + } + }; + cancellers.push(() => { + this.provider.off("block", replaceListener); + }); + this.provider.once("block", replaceListener); + } + }); + + return await (>waiter); + } + + /** + * Returns ``true`` if this transaction has been included. + * + * This is effective only as of the time the TransactionResponse + * was instantiated. To get up-to-date information, use + * [[getTransaction]]. + * + * This provides a Type Guard that this transaction will have + * non-null property values for properties that are null for + * unmined transactions. + */ + isMined(): this is MinedTransactionResponse { + return this.blockHash != null; + } + + /** + * Returns true if the transaction is a legacy (i.e. ``type == 0``) + * transaction. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLegacy(): this is TransactionResponse & { + accessList: null; + maxFeePerEnergy: null; + maxPriorityFeePerEnergy: null; + } { + return this.type === 0; + } + + /** + * Returns a filter which can be used to listen for orphan events + * that evict this transaction. + */ + removedEvent(): OrphanFilter { + assert( + this.isMined(), + "unmined transaction canot be orphaned", + "UNSUPPORTED_OPERATION", + { operation: "removeEvent()" }, + ); + return createRemovedTransactionFilter(this); + } + + /** + * Returns a filter which can be used to listen for orphan events + * that re-order this event against %%other%%. + */ + reorderedEvent(other?: TransactionResponse): OrphanFilter { + assert( + this.isMined(), + "unmined transaction canot be orphaned", + "UNSUPPORTED_OPERATION", + { operation: "removeEvent()" }, + ); + + assert( + !other || other.isMined(), + "unmined 'other' transaction canot be orphaned", + "UNSUPPORTED_OPERATION", + { operation: "removeEvent()" }, + ); + + return createReorderedTransactionFilter(this, other); + } + + /** + * Returns a new TransactionResponse instance which has the ability to + * detect (and throw an error) if the transaction is replaced, which + * will begin scanning at %%startBlock%%. + * + * This should generally not be used by developers and is intended + * primarily for internal use. Setting an incorrect %%startBlock%% can + * have devastating performance consequences if used incorrectly. + */ + replaceableTransaction(startBlock: number): TransactionResponse { + assertArgument( + Number.isInteger(startBlock) && startBlock >= 0, + "invalid startBlock", + "startBlock", + startBlock, + ); + const tx = new TransactionResponse(this, this.provider); + tx.#startBlock = startBlock; + return tx; + } } ////////////////////// @@ -1284,77 +1284,77 @@ export class TransactionResponse * Not currently fully supported. */ export type OrphanFilter = - | { - orphan: "drop-block"; - hash: string; - number: number; - } - | { - orphan: "drop-transaction"; - tx: { hash: string; blockHash: string; blockNumber: number }; - other?: { hash: string; blockHash: string; blockNumber: number }; - } - | { - orphan: "reorder-transaction"; - tx: { hash: string; blockHash: string; blockNumber: number }; - other?: { hash: string; blockHash: string; blockNumber: number }; - } - | { - orphan: "drop-log"; - log: { - transactionHash: string; - blockHash: string; - blockNumber: number; - address: string; - data: string; - topics: ReadonlyArray; - index: number; - }; - }; + | { + orphan: "drop-block"; + hash: string; + number: number; + } + | { + orphan: "drop-transaction"; + tx: { hash: string; blockHash: string; blockNumber: number }; + other?: { hash: string; blockHash: string; blockNumber: number }; + } + | { + orphan: "reorder-transaction"; + tx: { hash: string; blockHash: string; blockNumber: number }; + other?: { hash: string; blockHash: string; blockNumber: number }; + } + | { + orphan: "drop-log"; + log: { + transactionHash: string; + blockHash: string; + blockNumber: number; + address: string; + data: string; + topics: ReadonlyArray; + index: number; + }; + }; function createOrphanedBlockFilter(block: { - hash: string; - number: number; + hash: string; + number: number; }): OrphanFilter { - return { orphan: "drop-block", hash: block.hash, number: block.number }; + return { orphan: "drop-block", hash: block.hash, number: block.number }; } function createReorderedTransactionFilter( - tx: { hash: string; blockHash: string; blockNumber: number }, - other?: { hash: string; blockHash: string; blockNumber: number }, + tx: { hash: string; blockHash: string; blockNumber: number }, + other?: { hash: string; blockHash: string; blockNumber: number }, ): OrphanFilter { - return { orphan: "reorder-transaction", tx, other }; + return { orphan: "reorder-transaction", tx, other }; } function createRemovedTransactionFilter(tx: { - hash: string; - blockHash: string; - blockNumber: number; + hash: string; + blockHash: string; + blockNumber: number; }): OrphanFilter { - return { orphan: "drop-transaction", tx }; + return { orphan: "drop-transaction", tx }; } function createRemovedLogFilter(log: { - blockHash: string; - transactionHash: string; - blockNumber: number; - address: string; - data: string; - topics: ReadonlyArray; - index: number; + blockHash: string; + transactionHash: string; + blockNumber: number; + address: string; + data: string; + topics: ReadonlyArray; + index: number; }): OrphanFilter { - return { - orphan: "drop-log", - log: { - transactionHash: log.transactionHash, - blockHash: log.blockHash, - blockNumber: log.blockNumber, - address: log.address, - data: log.data, - topics: Object.freeze(log.topics.slice()), - index: log.index, - }, - }; + return { + orphan: "drop-log", + log: { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + address: log.address, + data: log.data, + topics: Object.freeze(log.topics.slice()), + index: log.index, + }, + }; } ////////////////////// @@ -1375,27 +1375,24 @@ export type TopicFilter = Array>; //export type DeferableTopicFilter = Array | Array>>; export interface EventFilter { - address?: AddressLike | Array; - topics?: TopicFilter; + address?: AddressLike | Array; + topics?: TopicFilter; } export interface Filter extends EventFilter { - fromBlock?: BlockTag; - toBlock?: BlockTag; + fromBlock?: BlockTag; + toBlock?: BlockTag; } export interface FilterByBlockHash extends EventFilter { - blockHash?: string; + blockHash?: string; } ////////////////////// // ProviderEvent export type ProviderEvent = - | string - | Array> - | EventFilter - | OrphanFilter; + string | Array> | EventFilter | OrphanFilter; ////////////////////// // Provider @@ -1421,183 +1418,181 @@ export type ProviderEvent = * broadcast. */ export interface Provider - extends ContractRunner, - EventEmitterable, - NameResolver { - /** - * The provider iteself. - * - * This is part of the necessary API for executing a contract, as - * it provides a common property on any [[ContractRunner]] that - * can be used to access the read-only portion of the runner. - */ - provider: this; - - /** - * Shutdown any resources this provider is using. No additional - * calls should be made to this provider after calling this. - */ - destroy(): void; - - //////////////////// - // State - - /** - * Get the current block number. - */ - getBlockNumber(): Promise; - - /** - * Get the connected [[Network]]. - */ - getNetwork(): Promise; - - /** - * Get the best guess at the recommended [[FeeData]]. - */ - getFeeData(): Promise; - - //////////////////// - // Account - - /** - * Get the account balance (in ore) of %%address%%. If %%blockTag%% - * is specified and the node supports archive access for that - * %%blockTag%%, the balance is as of that [[BlockTag]]. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getBalance(address: AddressLike, blockTag?: BlockTag): Promise; - - /** - * Get the number of transactions ever sent for %%address%%, which - * is used as the ``nonce`` when sending a transaction. If - * %%blockTag%% is specified and the node supports archive access - * for that %%blockTag%%, the transaction count is as of that - * [[BlockTag]]. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getTransactionCount( - address: AddressLike, - blockTag?: BlockTag, - ): Promise; - - /** - * Get the bytecode for %%address%%. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getCode(address: AddressLike, blockTag?: BlockTag): Promise; - - /** - * Get the storage slot value for %%address%% at slot %%position%%. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getStorage( - address: AddressLike, - position: BigNumberish, - blockTag?: BlockTag, - ): Promise; - - //////////////////// - // Execution - - /** - * Estimates the amount of energy required to executre %%tx%%. - */ - estimateEnergy(tx: TransactionRequest): Promise; - - /** - * Simulate the execution of %%tx%%. If the call reverts, it will - * throw a [[CallExceptionError]] which includes the revert data. - */ - call(tx: TransactionRequest): Promise; - - /** - * Broadcasts the %%signedTx%% to the network, adding it to the - * memory pool of any node for which the transaction meets the - * rebroadcast requirements. - */ - broadcastTransaction(signedTx: string): Promise; - - //////////////////// - // Queries - - /** - * Resolves to the block for %%blockHashOrBlockTag%%. - * - * If %%prefetchTxs%%, and the backend supports including transactions - * with block requests, all transactions will be included and the - * [[Block]] object will not need to make remote calls for getting - * transactions. - */ - getBlock( - blockHashOrBlockTag: BlockTag | string, - prefetchTxs?: boolean, - ): Promise; - - /** - * Resolves to the transaction for %%hash%%. - * - * If the transaction is unknown or on pruning nodes which - * discard old transactions this resolves to ``null``. - */ - getTransaction(hash: string): Promise; - - /** - * Resolves to the transaction receipt for %%hash%%, if mined. - * - * If the transaction has not been mined, is unknown or on - * pruning nodes which discard old transactions this resolves to - * ``null``. - */ - getTransactionReceipt(hash: string): Promise; - - /** - * Resolves to the result returned by the executions of %%hash%%. - * - * This is only supported on nodes with archive access and with - * the necessary debug APIs enabled. - */ - getTransactionResult(hash: string): Promise; - - //////////////////// - // Bloom-filter Queries - - /** - * Resolves to the list of Logs that match %%filter%% - */ - getLogs(filter: Filter | FilterByBlockHash): Promise>; - - //////////////////// - // ENS - - /** - * Resolves to the address configured for the %%ensName%% or - * ``null`` if unconfigured. - */ - - /** - * Waits until the transaction %%hash%% is mined and has %%confirms%% - * confirmations. - */ - waitForTransaction( - hash: string, - confirms?: number, - timeout?: number, - ): Promise; - - /** - * Resolves to the block at %%blockTag%% once it has been mined. - * - * This can be useful for waiting some number of blocks by using - * the ``currentBlockNumber + N``. - */ - waitForBlock(blockTag?: BlockTag): Promise; + extends ContractRunner, EventEmitterable, NameResolver { + /** + * The provider iteself. + * + * This is part of the necessary API for executing a contract, as + * it provides a common property on any [[ContractRunner]] that + * can be used to access the read-only portion of the runner. + */ + provider: this; + + /** + * Shutdown any resources this provider is using. No additional + * calls should be made to this provider after calling this. + */ + destroy(): void; + + //////////////////// + // State + + /** + * Get the current block number. + */ + getBlockNumber(): Promise; + + /** + * Get the connected [[Network]]. + */ + getNetwork(): Promise; + + /** + * Get the best guess at the recommended [[FeeData]]. + */ + getFeeData(): Promise; + + //////////////////// + // Account + + /** + * Get the account balance (in ore) of %%address%%. If %%blockTag%% + * is specified and the node supports archive access for that + * %%blockTag%%, the balance is as of that [[BlockTag]]. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getBalance(address: AddressLike, blockTag?: BlockTag): Promise; + + /** + * Get the number of transactions ever sent for %%address%%, which + * is used as the ``nonce`` when sending a transaction. If + * %%blockTag%% is specified and the node supports archive access + * for that %%blockTag%%, the transaction count is as of that + * [[BlockTag]]. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getTransactionCount( + address: AddressLike, + blockTag?: BlockTag, + ): Promise; + + /** + * Get the bytecode for %%address%%. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getCode(address: AddressLike, blockTag?: BlockTag): Promise; + + /** + * Get the storage slot value for %%address%% at slot %%position%%. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getStorage( + address: AddressLike, + position: BigNumberish, + blockTag?: BlockTag, + ): Promise; + + //////////////////// + // Execution + + /** + * Estimates the amount of energy required to executre %%tx%%. + */ + estimateEnergy(tx: TransactionRequest): Promise; + + /** + * Simulate the execution of %%tx%%. If the call reverts, it will + * throw a [[CallExceptionError]] which includes the revert data. + */ + call(tx: TransactionRequest): Promise; + + /** + * Broadcasts the %%signedTx%% to the network, adding it to the + * memory pool of any node for which the transaction meets the + * rebroadcast requirements. + */ + broadcastTransaction(signedTx: string): Promise; + + //////////////////// + // Queries + + /** + * Resolves to the block for %%blockHashOrBlockTag%%. + * + * If %%prefetchTxs%%, and the backend supports including transactions + * with block requests, all transactions will be included and the + * [[Block]] object will not need to make remote calls for getting + * transactions. + */ + getBlock( + blockHashOrBlockTag: BlockTag | string, + prefetchTxs?: boolean, + ): Promise; + + /** + * Resolves to the transaction for %%hash%%. + * + * If the transaction is unknown or on pruning nodes which + * discard old transactions this resolves to ``null``. + */ + getTransaction(hash: string): Promise; + + /** + * Resolves to the transaction receipt for %%hash%%, if mined. + * + * If the transaction has not been mined, is unknown or on + * pruning nodes which discard old transactions this resolves to + * ``null``. + */ + getTransactionReceipt(hash: string): Promise; + + /** + * Resolves to the result returned by the executions of %%hash%%. + * + * This is only supported on nodes with archive access and with + * the necessary debug APIs enabled. + */ + getTransactionResult(hash: string): Promise; + + //////////////////// + // Bloom-filter Queries + + /** + * Resolves to the list of Logs that match %%filter%% + */ + getLogs(filter: Filter | FilterByBlockHash): Promise>; + + //////////////////// + // ENS + + /** + * Resolves to the address configured for the %%ensName%% or + * ``null`` if unconfigured. + */ + + /** + * Waits until the transaction %%hash%% is mined and has %%confirms%% + * confirmations. + */ + waitForTransaction( + hash: string, + confirms?: number, + timeout?: number, + ): Promise; + + /** + * Resolves to the block at %%blockTag%% once it has been mined. + * + * This can be useful for waiting some number of blocks by using + * the ``currentBlockNumber + N``. + */ + waitForBlock(blockTag?: BlockTag): Promise; } diff --git a/src.ts/providers/signer-noncemanager.ts b/src.ts/providers/signer-noncemanager.ts index cb5b3e170..4911dd778 100644 --- a/src.ts/providers/signer-noncemanager.ts +++ b/src.ts/providers/signer-noncemanager.ts @@ -4,82 +4,82 @@ import { AbstractSigner } from "./abstract-signer.js"; import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; import type { - BlockTag, - Provider, - TransactionRequest, - TransactionResponse, + BlockTag, + Provider, + TransactionRequest, + TransactionResponse, } from "./provider.js"; import type { Signer } from "./signer.js"; export class NonceManager extends AbstractSigner { - signer!: Signer; - - #noncePromise: null | Promise; - #delta: number; - - constructor(signer: Signer) { - super(signer.provider); - defineProperties(this, { signer }); - - this.#noncePromise = null; - this.#delta = 0; - } - - async getAddress(): Promise { - return this.signer.getAddress(); - } - - connect(provider: null | Provider): NonceManager { - return new NonceManager(this.signer.connect(provider)); - } - - async getNonce(blockTag?: BlockTag): Promise { - if (blockTag === "pending") { - if (this.#noncePromise == null) { - this.#noncePromise = super.getNonce("pending"); - } - - const delta = this.#delta; - return (await this.#noncePromise) + delta; - } - - return super.getNonce(blockTag); - } - - increment(): void { - this.#delta++; - } - - reset(): void { - this.#delta = 0; - this.#noncePromise = null; - } - - async sendTransaction(tx: TransactionRequest): Promise { - const noncePromise = this.getNonce("pending"); - this.increment(); - - tx = await this.signer.populateTransaction(tx); - tx.nonce = await noncePromise; - - // @TODO: Maybe handle interesting/recoverable errors? - // Like don't increment if the tx was certainly not sent - return await this.signer.sendTransaction(tx); - } - - signTransaction(tx: TransactionRequest): Promise { - return this.signer.signTransaction(tx); - } - - signMessage(message: string | Uint8Array): Promise { - return this.signer.signMessage(message); - } - - signTypedData( - domain: TypedDataDomain, - types: Record>, - value: Record, - ): Promise { - return this.signer.signTypedData(domain, types, value); - } + signer!: Signer; + + #noncePromise: null | Promise; + #delta: number; + + constructor(signer: Signer) { + super(signer.provider); + defineProperties(this, { signer }); + + this.#noncePromise = null; + this.#delta = 0; + } + + async getAddress(): Promise { + return this.signer.getAddress(); + } + + connect(provider: null | Provider): NonceManager { + return new NonceManager(this.signer.connect(provider)); + } + + async getNonce(blockTag?: BlockTag): Promise { + if (blockTag === "pending") { + if (this.#noncePromise == null) { + this.#noncePromise = super.getNonce("pending"); + } + + const delta = this.#delta; + return (await this.#noncePromise) + delta; + } + + return super.getNonce(blockTag); + } + + increment(): void { + this.#delta++; + } + + reset(): void { + this.#delta = 0; + this.#noncePromise = null; + } + + async sendTransaction(tx: TransactionRequest): Promise { + const noncePromise = this.getNonce("pending"); + this.increment(); + + tx = await this.signer.populateTransaction(tx); + tx.nonce = await noncePromise; + + // @TODO: Maybe handle interesting/recoverable errors? + // Like don't increment if the tx was certainly not sent + return await this.signer.sendTransaction(tx); + } + + signTransaction(tx: TransactionRequest): Promise { + return this.signer.signTransaction(tx); + } + + signMessage(message: string | Uint8Array): Promise { + return this.signer.signMessage(message); + } + + signTypedData( + domain: TypedDataDomain, + types: Record>, + value: Record, + ): Promise { + return this.signer.signTypedData(domain, types, value); + } } diff --git a/src.ts/providers/signer.ts b/src.ts/providers/signer.ts index 6acd195c6..362090047 100644 --- a/src.ts/providers/signer.ts +++ b/src.ts/providers/signer.ts @@ -4,10 +4,10 @@ import type { TransactionLike } from "../transaction/index.js"; import type { ContractRunner } from "./contracts.js"; import type { - BlockTag, - Provider, - TransactionRequest, - TransactionResponse, + BlockTag, + Provider, + TransactionRequest, + TransactionResponse, } from "./provider.js"; /** @@ -19,134 +19,134 @@ import type { * private key may not be known). */ export interface Signer extends Addressable, ContractRunner, NameResolver { - /** - * The [[Provider]] attached to this Signer (if any). - */ - provider: null | Provider; - - /** - * Returns a new instance of this Signer connected to //provider// or detached - * from any Provider if null. - */ - connect(provider: null | Provider): Signer; - - //////////////////// - // State - - /** - * Get the address of the Signer. - */ - getAddress(): Promise; - - /** - * Gets the next nonce required for this Signer to send a transaction. - * - * @param blockTag - The blocktag to base the transaction count on, keep in mind - * many nodes do not honour this value and silently ignore it [default: ``"latest"``] - */ - getNonce(blockTag?: BlockTag): Promise; - - //////////////////// - // Preparation - - /** - * Prepares a {@link TransactionRequest} for calling: - * - resolves ``to`` and ``from`` addresses - * - if ``from`` is specified , check that it matches this Signer - * - * @param tx - The call to prepare - */ - populateCall(tx: TransactionRequest): Promise>; - - /** - * Prepares a {@link TransactionRequest} for sending to the network by - * populating any missing properties: - * - resolves ``to`` and ``from`` addresses - * - if ``from`` is specified , check that it matches this Signer - * - populates ``nonce`` via ``signer.getNonce("pending")`` - * - populates ``energyLimit`` via ``signer.estimateEnergy(tx)`` - * - populates ``networkId`` via ``signer.provider.getNetwork()`` - * - populates ``type`` and relevant fee data for that type (``energyPrice`` - * for legacy transactions, ``maxFeePerEnergy`` for EIP-1559, etc) - * - * @note Some Signer implementations may skip populating properties that - * are populated downstream; for example JsonRpcSigner defers to the - * node to populate the nonce and fee data. - * - * @param tx - The call to prepare - */ - populateTransaction(tx: TransactionRequest): Promise>; - - //////////////////// - // Execution - - /** - * Estimates the required energy required to execute //tx// on the Blockchain. This - * will be the expected amount a transaction will require as its ``energyLimit`` - * to successfully run all the necessary computations and store the needed state - * that the transaction intends. - * - * Keep in mind that this is **best efforts**, since the state of the Blockchain - * is in flux, which could affect transaction energy requirements. - * - * @throws UNPREDICTABLE_ENERGY_LIMIT A transaction that is believed by the node to likely - * fail will throw an error during energy estimation. This could indicate that it - * will actually fail or that the circumstances are simply too complex for the - * node to take into account. In these cases, a manually determined ``energyLimit`` - * will need to be made. - */ - estimateEnergy(tx: TransactionRequest): Promise; - - /** - * Evaluates the //tx// by running it against the current Blockchain state. This - * cannot change state and has no cost in xcb, as it is effectively simulating - * execution. - * - * This can be used to have the Blockchain perform computations based on its state - * (e.g. running a Contract's getters) or to simulate the effect of a transaction - * before actually performing an operation. - */ - call(tx: TransactionRequest): Promise; - - /** - * Resolves an ENS Name to an address. - */ - resolveName(name: string): Promise; - - //////////////////// - // Signing - - /** - * Signs %%tx%%, returning the fully signed transaction. This does not - * populate any additional properties within the transaction. - */ - signTransaction(tx: TransactionRequest): Promise; - - /** - * Sends %%tx%% to the Network. The ``signer.populateTransaction(tx)`` - * is called first to ensure all necessary properties for the - * transaction to be valid have been popualted first. - */ - sendTransaction(tx: TransactionRequest): Promise; - - /** - * Signers an [[link-eip-191]] prefixed personal message. - * - * If the %%message%% is a string, it is signed as UTF-8 encoded bytes. It is **not** - * interpretted as a [[BytesLike]]; so the string ``"0x1234"`` is signed as six - * characters, **not** two bytes. - * - * To sign that example as two bytes, the Uint8Array should be used - * (i.e. ``new Uint8Array([ 0x12, 0x34 ])``). - */ - signMessage(message: string | Uint8Array): Promise; - - /** - * Signs the [[link-eip-712]] typed data. - */ - signTypedData( - domain: TypedDataDomain, - types: Record>, - value: Record, - ): Promise; + /** + * The [[Provider]] attached to this Signer (if any). + */ + provider: null | Provider; + + /** + * Returns a new instance of this Signer connected to //provider// or detached + * from any Provider if null. + */ + connect(provider: null | Provider): Signer; + + //////////////////// + // State + + /** + * Get the address of the Signer. + */ + getAddress(): Promise; + + /** + * Gets the next nonce required for this Signer to send a transaction. + * + * @param blockTag - The blocktag to base the transaction count on, keep in mind + * many nodes do not honour this value and silently ignore it [default: ``"latest"``] + */ + getNonce(blockTag?: BlockTag): Promise; + + //////////////////// + // Preparation + + /** + * Prepares a {@link TransactionRequest} for calling: + * - resolves ``to`` and ``from`` addresses + * - if ``from`` is specified , check that it matches this Signer + * + * @param tx - The call to prepare + */ + populateCall(tx: TransactionRequest): Promise>; + + /** + * Prepares a {@link TransactionRequest} for sending to the network by + * populating any missing properties: + * - resolves ``to`` and ``from`` addresses + * - if ``from`` is specified , check that it matches this Signer + * - populates ``nonce`` via ``signer.getNonce("pending")`` + * - populates ``energyLimit`` via ``signer.estimateEnergy(tx)`` + * - populates ``networkId`` via ``signer.provider.getNetwork()`` + * - populates ``type`` and relevant fee data for that type (``energyPrice`` + * for legacy transactions, ``maxFeePerEnergy`` for EIP-1559, etc) + * + * @note Some Signer implementations may skip populating properties that + * are populated downstream; for example JsonRpcSigner defers to the + * node to populate the nonce and fee data. + * + * @param tx - The call to prepare + */ + populateTransaction(tx: TransactionRequest): Promise>; + + //////////////////// + // Execution + + /** + * Estimates the required energy required to execute //tx// on the Blockchain. This + * will be the expected amount a transaction will require as its ``energyLimit`` + * to successfully run all the necessary computations and store the needed state + * that the transaction intends. + * + * Keep in mind that this is **best efforts**, since the state of the Blockchain + * is in flux, which could affect transaction energy requirements. + * + * @throws UNPREDICTABLE_ENERGY_LIMIT A transaction that is believed by the node to likely + * fail will throw an error during energy estimation. This could indicate that it + * will actually fail or that the circumstances are simply too complex for the + * node to take into account. In these cases, a manually determined ``energyLimit`` + * will need to be made. + */ + estimateEnergy(tx: TransactionRequest): Promise; + + /** + * Evaluates the //tx// by running it against the current Blockchain state. This + * cannot change state and has no cost in xcb, as it is effectively simulating + * execution. + * + * This can be used to have the Blockchain perform computations based on its state + * (e.g. running a Contract's getters) or to simulate the effect of a transaction + * before actually performing an operation. + */ + call(tx: TransactionRequest): Promise; + + /** + * Resolves an ENS Name to an address. + */ + resolveName(name: string): Promise; + + //////////////////// + // Signing + + /** + * Signs %%tx%%, returning the fully signed transaction. This does not + * populate any additional properties within the transaction. + */ + signTransaction(tx: TransactionRequest): Promise; + + /** + * Sends %%tx%% to the Network. The ``signer.populateTransaction(tx)`` + * is called first to ensure all necessary properties for the + * transaction to be valid have been popualted first. + */ + sendTransaction(tx: TransactionRequest): Promise; + + /** + * Signers an [[link-eip-191]] prefixed personal message. + * + * If the %%message%% is a string, it is signed as UTF-8 encoded bytes. It is **not** + * interpretted as a [[BytesLike]]; so the string ``"0x1234"`` is signed as six + * characters, **not** two bytes. + * + * To sign that example as two bytes, the Uint8Array should be used + * (i.e. ``new Uint8Array([ 0x12, 0x34 ])``). + */ + signMessage(message: string | Uint8Array): Promise; + + /** + * Signs the [[link-eip-712]] typed data. + */ + signTypedData( + domain: TypedDataDomain, + types: Record>, + value: Record, + ): Promise; } diff --git a/src.ts/providers/subscriber-connection.ts b/src.ts/providers/subscriber-connection.ts index 4dd9992be..16a113667 100644 --- a/src.ts/providers/subscriber-connection.ts +++ b/src.ts/providers/subscriber-connection.ts @@ -11,9 +11,9 @@ import type { Provider } from "./provider.js"; * @_docloc: api/providers/abstract-provider */ export interface ConnectionRpcProvider extends Provider { - //send(method: string, params: Array): Promise; - _subscribe(param: Array, processFunc: (result: any) => void): number; - _unsubscribe(filterId: number): void; + //send(method: string, params: Array): Promise; + _subscribe(param: Array, processFunc: (result: any) => void): number; + _unsubscribe(filterId: number): void; } /** @@ -22,57 +22,57 @@ export interface ConnectionRpcProvider extends Provider { * @_docloc: api/providers/abstract-provider */ export class BlockConnectionSubscriber implements Subscriber { - #provider: ConnectionRpcProvider; - #blockNumber: number; + #provider: ConnectionRpcProvider; + #blockNumber: number; - #running: boolean; + #running: boolean; - #filterId: null | number; + #filterId: null | number; - constructor(provider: ConnectionRpcProvider) { - this.#provider = provider; - this.#blockNumber = -2; - this.#running = false; - this.#filterId = null; - } + constructor(provider: ConnectionRpcProvider) { + this.#provider = provider; + this.#blockNumber = -2; + this.#running = false; + this.#filterId = null; + } - start(): void { - if (this.#running) { - return; - } - this.#running = true; + start(): void { + if (this.#running) { + return; + } + this.#running = true; - this.#filterId = this.#provider._subscribe(["newHeads"], (result: any) => { - const blockNumber = getNumber(result.number); - const initial = - this.#blockNumber === -2 ? blockNumber : this.#blockNumber + 1; - for (let b = initial; b <= blockNumber; b++) { - this.#provider.emit("block", b); - } - this.#blockNumber = blockNumber; - }); - } + this.#filterId = this.#provider._subscribe(["newHeads"], (result: any) => { + const blockNumber = getNumber(result.number); + const initial = + this.#blockNumber === -2 ? blockNumber : this.#blockNumber + 1; + for (let b = initial; b <= blockNumber; b++) { + this.#provider.emit("block", b); + } + this.#blockNumber = blockNumber; + }); + } - stop(): void { - if (!this.#running) { - return; - } - this.#running = false; + stop(): void { + if (!this.#running) { + return; + } + this.#running = false; - if (this.#filterId != null) { - this.#provider._unsubscribe(this.#filterId); - this.#filterId = null; - } - } + if (this.#filterId != null) { + this.#provider._unsubscribe(this.#filterId); + this.#filterId = null; + } + } - pause(dropWhilePaused?: boolean): void { - if (dropWhilePaused) { - this.#blockNumber = -2; - } - this.stop(); - } + pause(dropWhilePaused?: boolean): void { + if (dropWhilePaused) { + this.#blockNumber = -2; + } + this.stop(); + } - resume(): void { - this.start(); - } + resume(): void { + this.start(); + } } diff --git a/src.ts/providers/subscriber-filterid.ts b/src.ts/providers/subscriber-filterid.ts index 937a93728..7d24d811d 100644 --- a/src.ts/providers/subscriber-filterid.ts +++ b/src.ts/providers/subscriber-filterid.ts @@ -8,7 +8,7 @@ import type { EventFilter } from "./provider.js"; import type { JsonRpcApiProvider } from "./provider-jsonrpc.js"; function copy(obj: any): any { - return JSON.parse(JSON.stringify(obj)); + return JSON.parse(JSON.stringify(obj)); } /** @@ -22,134 +22,134 @@ function copy(obj: any): any { * @_docloc: api/providers/abstract-provider */ export class FilterIdSubscriber implements Subscriber { - #provider: JsonRpcApiProvider; - - #filterIdPromise: null | Promise; - #poller: (b: number) => Promise; - - #running: boolean; - - #network: null | Network; - - #hault: boolean; - - constructor(provider: JsonRpcApiProvider) { - this.#provider = provider; - - this.#filterIdPromise = null; - this.#poller = this.#poll.bind(this); - - this.#running = false; - - this.#network = null; - - this.#hault = false; - } - - _subscribe(provider: JsonRpcApiProvider): Promise { - throw new Error("subclasses must override this"); - } - - _emitResults(provider: AbstractProvider, result: Array): Promise { - throw new Error("subclasses must override this"); - } - - _recover(provider: AbstractProvider): Subscriber { - throw new Error("subclasses must override this"); - } - - async #poll(blockNumber: number): Promise { - try { - // Subscribe if necessary - if (this.#filterIdPromise == null) { - this.#filterIdPromise = this._subscribe(this.#provider); - } - - // Get the Filter ID - let filterId: null | string = null; - try { - filterId = await this.#filterIdPromise; - } catch (error) { - if ( - !isError(error, "UNSUPPORTED_OPERATION") || - error.operation !== "xcb_newFilter" - ) { - throw error; - } - } - - // The backend does not support Filter ID; downgrade to - // polling - if (filterId == null) { - this.#filterIdPromise = null; - this.#provider._recoverSubscriber(this, this._recover(this.#provider)); - return; - } - - const network = await this.#provider.getNetwork(); - if (!this.#network) { - this.#network = network; - } - - if ((this.#network as Network).networkId !== network.networkId) { - throw new Error("chaid changed"); - } - - if (this.#hault) { - return; - } - - const result = await this.#provider.send("xcb_getFilterChanges", [ - filterId, - ]); - await this._emitResults(this.#provider, result); - } catch (error) { - console.log("@TODO", error); - } - - this.#provider.once("block", this.#poller); - } - - #teardown(): void { - const filterIdPromise = this.#filterIdPromise; - if (filterIdPromise) { - this.#filterIdPromise = null; - filterIdPromise.then((filterId) => { - this.#provider.send("xcb_uninstallFilter", [filterId]); - }); - } - } - - start(): void { - if (this.#running) { - return; - } - this.#running = true; - - this.#poll(-2); - } - - stop(): void { - if (!this.#running) { - return; - } - this.#running = false; - - this.#hault = true; - this.#teardown(); - this.#provider.off("block", this.#poller); - } - - pause(dropWhilePaused?: boolean): void { - if (dropWhilePaused) { - this.#teardown(); - } - this.#provider.off("block", this.#poller); - } - - resume(): void { - this.start(); - } + #provider: JsonRpcApiProvider; + + #filterIdPromise: null | Promise; + #poller: (b: number) => Promise; + + #running: boolean; + + #network: null | Network; + + #hault: boolean; + + constructor(provider: JsonRpcApiProvider) { + this.#provider = provider; + + this.#filterIdPromise = null; + this.#poller = this.#poll.bind(this); + + this.#running = false; + + this.#network = null; + + this.#hault = false; + } + + _subscribe(provider: JsonRpcApiProvider): Promise { + throw new Error("subclasses must override this"); + } + + _emitResults(provider: AbstractProvider, result: Array): Promise { + throw new Error("subclasses must override this"); + } + + _recover(provider: AbstractProvider): Subscriber { + throw new Error("subclasses must override this"); + } + + async #poll(blockNumber: number): Promise { + try { + // Subscribe if necessary + if (this.#filterIdPromise == null) { + this.#filterIdPromise = this._subscribe(this.#provider); + } + + // Get the Filter ID + let filterId: null | string = null; + try { + filterId = await this.#filterIdPromise; + } catch (error) { + if ( + !isError(error, "UNSUPPORTED_OPERATION") || + error.operation !== "xcb_newFilter" + ) { + throw error; + } + } + + // The backend does not support Filter ID; downgrade to + // polling + if (filterId == null) { + this.#filterIdPromise = null; + this.#provider._recoverSubscriber(this, this._recover(this.#provider)); + return; + } + + const network = await this.#provider.getNetwork(); + if (!this.#network) { + this.#network = network; + } + + if ((this.#network as Network).networkId !== network.networkId) { + throw new Error("chaid changed"); + } + + if (this.#hault) { + return; + } + + const result = await this.#provider.send("xcb_getFilterChanges", [ + filterId, + ]); + await this._emitResults(this.#provider, result); + } catch (error) { + console.log("@TODO", error); + } + + this.#provider.once("block", this.#poller); + } + + #teardown(): void { + const filterIdPromise = this.#filterIdPromise; + if (filterIdPromise) { + this.#filterIdPromise = null; + filterIdPromise.then((filterId) => { + this.#provider.send("xcb_uninstallFilter", [filterId]); + }); + } + } + + start(): void { + if (this.#running) { + return; + } + this.#running = true; + + this.#poll(-2); + } + + stop(): void { + if (!this.#running) { + return; + } + this.#running = false; + + this.#hault = true; + this.#teardown(); + this.#provider.off("block", this.#poller); + } + + pause(dropWhilePaused?: boolean): void { + if (dropWhilePaused) { + this.#teardown(); + } + this.#provider.off("block", this.#poller); + } + + resume(): void { + this.start(); + } } /** @@ -158,30 +158,30 @@ export class FilterIdSubscriber implements Subscriber { * @_docloc: api/providers/abstract-provider */ export class FilterIdEventSubscriber extends FilterIdSubscriber { - #event: EventFilter; - - constructor(provider: JsonRpcApiProvider, filter: EventFilter) { - super(provider); - this.#event = copy(filter); - } - - _recover(provider: AbstractProvider): Subscriber { - return new PollingEventSubscriber(provider, this.#event); - } - - async _subscribe(provider: JsonRpcApiProvider): Promise { - const filterId = await provider.send("xcb_newFilter", [this.#event]); - return filterId; - } - - async _emitResults( - provider: JsonRpcApiProvider, - results: Array, - ): Promise { - for (const result of results) { - provider.emit(this.#event, provider._wrapLog(result, provider._network)); - } - } + #event: EventFilter; + + constructor(provider: JsonRpcApiProvider, filter: EventFilter) { + super(provider); + this.#event = copy(filter); + } + + _recover(provider: AbstractProvider): Subscriber { + return new PollingEventSubscriber(provider, this.#event); + } + + async _subscribe(provider: JsonRpcApiProvider): Promise { + const filterId = await provider.send("xcb_newFilter", [this.#event]); + return filterId; + } + + async _emitResults( + provider: JsonRpcApiProvider, + results: Array, + ): Promise { + for (const result of results) { + provider.emit(this.#event, provider._wrapLog(result, provider._network)); + } + } } /** @@ -190,16 +190,16 @@ export class FilterIdEventSubscriber extends FilterIdSubscriber { * @_docloc: api/providers/abstract-provider */ export class FilterIdPendingSubscriber extends FilterIdSubscriber { - async _subscribe(provider: JsonRpcApiProvider): Promise { - return await provider.send("xcb_newPendingTransactionFilter", []); - } - - async _emitResults( - provider: JsonRpcApiProvider, - results: Array, - ): Promise { - for (const result of results) { - provider.emit("pending", result); - } - } + async _subscribe(provider: JsonRpcApiProvider): Promise { + return await provider.send("xcb_newPendingTransactionFilter", []); + } + + async _emitResults( + provider: JsonRpcApiProvider, + results: Array, + ): Promise { + for (const result of results) { + provider.emit("pending", result); + } + } } diff --git a/src.ts/providers/subscriber-polling.ts b/src.ts/providers/subscriber-polling.ts index b0ed29783..80ad1b1bf 100644 --- a/src.ts/providers/subscriber-polling.ts +++ b/src.ts/providers/subscriber-polling.ts @@ -4,7 +4,7 @@ import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; import type { EventFilter, OrphanFilter, ProviderEvent } from "./provider.js"; function copy(obj: any): any { - return JSON.parse(JSON.stringify(obj)); + return JSON.parse(JSON.stringify(obj)); } /** @@ -13,20 +13,20 @@ function copy(obj: any): any { * @_docloc: api/providers/abstract-provider */ export function getPollingSubscriber( - provider: AbstractProvider, - event: ProviderEvent, + provider: AbstractProvider, + event: ProviderEvent, ): Subscriber { - if (event === "block") { - return new PollingBlockSubscriber(provider); - } - if (isHexString(event, 32)) { - return new PollingTransactionSubscriber(provider, event); - } - - assert(false, "unsupported polling event", "UNSUPPORTED_OPERATION", { - operation: "getPollingSubscriber", - info: { event }, - }); + if (event === "block") { + return new PollingBlockSubscriber(provider); + } + if (isHexString(event, 32)) { + return new PollingTransactionSubscriber(provider, event); + } + + assert(false, "unsupported polling event", "UNSUPPORTED_OPERATION", { + operation: "getPollingSubscriber", + info: { event }, + }); } // @TODO: refactor this @@ -37,100 +37,100 @@ export function getPollingSubscriber( * @_docloc: api/providers/abstract-provider */ export class PollingBlockSubscriber implements Subscriber { - #provider: AbstractProvider; - #poller: null | number; - - #interval: number; - - // The most recent block we have scanned for events. The value -2 - // indicates we still need to fetch an initial block number - #blockNumber: number; - - constructor(provider: AbstractProvider) { - this.#provider = provider; - this.#poller = null; - this.#interval = 4000; - - this.#blockNumber = -2; - } - - get pollingInterval(): number { - return this.#interval; - } - set pollingInterval(value: number) { - this.#interval = value; - } - - async #poll(): Promise { - try { - const blockNumber = await this.#provider.getBlockNumber(); - - // Bootstrap poll to setup our initial block number - if (this.#blockNumber === -2) { - this.#blockNumber = blockNumber; - return; - } - - // @TODO: Put a cap on the maximum number of events per loop? - - if (blockNumber !== this.#blockNumber) { - for (let b = this.#blockNumber + 1; b <= blockNumber; b++) { - // We have been stopped - if (this.#poller == null) { - return; - } - - await this.#provider.emit("block", b); - } - - this.#blockNumber = blockNumber; - } - } catch (error) { - // @TODO: Minor bump, add an "error" event to let subscribers - // know things went awry. - //console.log(error); - } - - // We have been stopped - if (this.#poller == null) { - return; - } - - this.#poller = this.#provider._setTimeout( - this.#poll.bind(this), - this.#interval, - ); - } - - start(): void { - if (this.#poller) { - return; - } - this.#poller = this.#provider._setTimeout( - this.#poll.bind(this), - this.#interval, - ); - this.#poll(); - } - - stop(): void { - if (!this.#poller) { - return; - } - this.#provider._clearTimeout(this.#poller); - this.#poller = null; - } - - pause(dropWhilePaused?: boolean): void { - this.stop(); - if (dropWhilePaused) { - this.#blockNumber = -2; - } - } - - resume(): void { - this.start(); - } + #provider: AbstractProvider; + #poller: null | number; + + #interval: number; + + // The most recent block we have scanned for events. The value -2 + // indicates we still need to fetch an initial block number + #blockNumber: number; + + constructor(provider: AbstractProvider) { + this.#provider = provider; + this.#poller = null; + this.#interval = 4000; + + this.#blockNumber = -2; + } + + get pollingInterval(): number { + return this.#interval; + } + set pollingInterval(value: number) { + this.#interval = value; + } + + async #poll(): Promise { + try { + const blockNumber = await this.#provider.getBlockNumber(); + + // Bootstrap poll to setup our initial block number + if (this.#blockNumber === -2) { + this.#blockNumber = blockNumber; + return; + } + + // @TODO: Put a cap on the maximum number of events per loop? + + if (blockNumber !== this.#blockNumber) { + for (let b = this.#blockNumber + 1; b <= blockNumber; b++) { + // We have been stopped + if (this.#poller == null) { + return; + } + + await this.#provider.emit("block", b); + } + + this.#blockNumber = blockNumber; + } + } catch (error) { + // @TODO: Minor bump, add an "error" event to let subscribers + // know things went awry. + //console.log(error); + } + + // We have been stopped + if (this.#poller == null) { + return; + } + + this.#poller = this.#provider._setTimeout( + this.#poll.bind(this), + this.#interval, + ); + } + + start(): void { + if (this.#poller) { + return; + } + this.#poller = this.#provider._setTimeout( + this.#poll.bind(this), + this.#interval, + ); + this.#poll(); + } + + stop(): void { + if (!this.#poller) { + return; + } + this.#provider._clearTimeout(this.#poller); + this.#poller = null; + } + + pause(dropWhilePaused?: boolean): void { + this.stop(); + if (dropWhilePaused) { + this.#blockNumber = -2; + } + } + + resume(): void { + this.start(); + } } /** @@ -139,47 +139,47 @@ export class PollingBlockSubscriber implements Subscriber { * @_docloc: api/providers/abstract-provider */ export class OnBlockSubscriber implements Subscriber { - #provider: AbstractProvider; - #poll: (b: number) => void; - #running: boolean; - - constructor(provider: AbstractProvider) { - this.#provider = provider; - this.#running = false; - this.#poll = (blockNumber: number) => { - this._poll(blockNumber, this.#provider); - }; - } - - async _poll(blockNumber: number, provider: AbstractProvider): Promise { - throw new Error("sub-classes must override this"); - } - - start(): void { - if (this.#running) { - return; - } - this.#running = true; - - this.#poll(-2); - this.#provider.on("block", this.#poll); - } - - stop(): void { - if (!this.#running) { - return; - } - this.#running = false; - - this.#provider.off("block", this.#poll); - } - - pause(dropWhilePaused?: boolean): void { - this.stop(); - } - resume(): void { - this.start(); - } + #provider: AbstractProvider; + #poll: (b: number) => void; + #running: boolean; + + constructor(provider: AbstractProvider) { + this.#provider = provider; + this.#running = false; + this.#poll = (blockNumber: number) => { + this._poll(blockNumber, this.#provider); + }; + } + + async _poll(blockNumber: number, provider: AbstractProvider): Promise { + throw new Error("sub-classes must override this"); + } + + start(): void { + if (this.#running) { + return; + } + this.#running = true; + + this.#poll(-2); + this.#provider.on("block", this.#poll); + } + + stop(): void { + if (!this.#running) { + return; + } + this.#running = false; + + this.#provider.off("block", this.#poll); + } + + pause(dropWhilePaused?: boolean): void { + this.stop(); + } + resume(): void { + this.start(); + } } /** @@ -188,17 +188,17 @@ export class OnBlockSubscriber implements Subscriber { * @_docloc: api/providers/abstract-provider */ export class PollingOrphanSubscriber extends OnBlockSubscriber { - #filter: OrphanFilter; + #filter: OrphanFilter; - constructor(provider: AbstractProvider, filter: OrphanFilter) { - super(provider); - this.#filter = copy(filter); - } + constructor(provider: AbstractProvider, filter: OrphanFilter) { + super(provider); + this.#filter = copy(filter); + } - async _poll(blockNumber: number, provider: AbstractProvider): Promise { - throw new Error("@TODO"); - console.log(this.#filter); - } + async _poll(blockNumber: number, provider: AbstractProvider): Promise { + throw new Error("@TODO"); + console.log(this.#filter); + } } /** @@ -207,19 +207,19 @@ export class PollingOrphanSubscriber extends OnBlockSubscriber { * @_docloc: api/providers/abstract-provider */ export class PollingTransactionSubscriber extends OnBlockSubscriber { - #hash: string; - - constructor(provider: AbstractProvider, hash: string) { - super(provider); - this.#hash = hash; - } - - async _poll(blockNumber: number, provider: AbstractProvider): Promise { - const tx = await provider.getTransactionReceipt(this.#hash); - if (tx) { - provider.emit(this.#hash, tx); - } - } + #hash: string; + + constructor(provider: AbstractProvider, hash: string) { + super(provider); + this.#hash = hash; + } + + async _poll(blockNumber: number, provider: AbstractProvider): Promise { + const tx = await provider.getTransactionReceipt(this.#hash); + if (tx) { + provider.emit(this.#hash, tx); + } + } } /** @@ -228,82 +228,82 @@ export class PollingTransactionSubscriber extends OnBlockSubscriber { * @_docloc: api/providers/abstract-provider */ export class PollingEventSubscriber implements Subscriber { - #provider: AbstractProvider; - #filter: EventFilter; - #poller: (b: number) => void; - - #running: boolean; - - // The most recent block we have scanned for events. The value -2 - // indicates we still need to fetch an initial block number - #blockNumber: number; - - constructor(provider: AbstractProvider, filter: EventFilter) { - this.#provider = provider; - this.#filter = copy(filter); - this.#poller = this.#poll.bind(this); - this.#running = false; - this.#blockNumber = -2; - } - - async #poll(blockNumber: number): Promise { - // The initial block hasn't been determined yet - if (this.#blockNumber === -2) { - return; - } - - const filter = copy(this.#filter); - filter.fromBlock = this.#blockNumber + 1; - filter.toBlock = blockNumber; - const logs = await this.#provider.getLogs(filter); - - // No logs could just mean the node has not indexed them yet, - // so we keep a sliding window of 60 blocks to keep scanning - if (logs.length === 0) { - if (this.#blockNumber < blockNumber - 60) { - this.#blockNumber = blockNumber - 60; - } - return; - } - - this.#blockNumber = blockNumber; - - for (const log of logs) { - this.#provider.emit(this.#filter, log); - } - } - - start(): void { - if (this.#running) { - return; - } - this.#running = true; - - if (this.#blockNumber === -2) { - this.#provider.getBlockNumber().then((blockNumber) => { - this.#blockNumber = blockNumber; - }); - } - this.#provider.on("block", this.#poller); - } - - stop(): void { - if (!this.#running) { - return; - } - this.#running = false; - - this.#provider.off("block", this.#poller); - } - - pause(dropWhilePaused?: boolean): void { - this.stop(); - if (dropWhilePaused) { - this.#blockNumber = -2; - } - } - - resume(): void { - this.start(); - } + #provider: AbstractProvider; + #filter: EventFilter; + #poller: (b: number) => void; + + #running: boolean; + + // The most recent block we have scanned for events. The value -2 + // indicates we still need to fetch an initial block number + #blockNumber: number; + + constructor(provider: AbstractProvider, filter: EventFilter) { + this.#provider = provider; + this.#filter = copy(filter); + this.#poller = this.#poll.bind(this); + this.#running = false; + this.#blockNumber = -2; + } + + async #poll(blockNumber: number): Promise { + // The initial block hasn't been determined yet + if (this.#blockNumber === -2) { + return; + } + + const filter = copy(this.#filter); + filter.fromBlock = this.#blockNumber + 1; + filter.toBlock = blockNumber; + const logs = await this.#provider.getLogs(filter); + + // No logs could just mean the node has not indexed them yet, + // so we keep a sliding window of 60 blocks to keep scanning + if (logs.length === 0) { + if (this.#blockNumber < blockNumber - 60) { + this.#blockNumber = blockNumber - 60; + } + return; + } + + this.#blockNumber = blockNumber; + + for (const log of logs) { + this.#provider.emit(this.#filter, log); + } + } + + start(): void { + if (this.#running) { + return; + } + this.#running = true; + + if (this.#blockNumber === -2) { + this.#provider.getBlockNumber().then((blockNumber) => { + this.#blockNumber = blockNumber; + }); + } + this.#provider.on("block", this.#poller); + } + + stop(): void { + if (!this.#running) { + return; + } + this.#running = false; + + this.#provider.off("block", this.#poller); + } + + pause(dropWhilePaused?: boolean): void { + this.stop(); + if (dropWhilePaused) { + this.#blockNumber = -2; + } + } + + resume(): void { + this.start(); + } } diff --git a/src.ts/providers/ws-browser.ts b/src.ts/providers/ws-browser.ts index d3b8ce8f4..b6b377cef 100644 --- a/src.ts/providers/ws-browser.ts +++ b/src.ts/providers/ws-browser.ts @@ -1,14 +1,14 @@ function getGlobal(): any { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw new Error("unable to locate global object"); + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw new Error("unable to locate global object"); } const _WebSocket = getGlobal().WebSocket; diff --git a/src.ts/thirdparty.d.ts b/src.ts/thirdparty.d.ts index 17041a859..af8012a7d 100644 --- a/src.ts/thirdparty.d.ts +++ b/src.ts/thirdparty.d.ts @@ -1,14 +1,14 @@ declare module "ws" { - export class WebSocket { - constructor(...args: Array); + export class WebSocket { + constructor(...args: Array); - onopen: null | ((...args: Array) => any); - onmessage: null | ((...args: Array) => any); - onerror: null | ((...args: Array) => any); + onopen: null | ((...args: Array) => any); + onmessage: null | ((...args: Array) => any); + onerror: null | ((...args: Array) => any); - readyState: number; + readyState: number; - send(payload: any): void; - close(code?: number, reason?: string): void; - } + send(payload: any): void; + close(code?: number, reason?: string): void; + } } diff --git a/src.ts/transaction/accesslist.ts b/src.ts/transaction/accesslist.ts index 8d7393f46..e6328a93d 100644 --- a/src.ts/transaction/accesslist.ts +++ b/src.ts/transaction/accesslist.ts @@ -4,71 +4,71 @@ import { assertArgument, isHexString } from "../utils/index.js"; import type { AccessList, AccessListish } from "./index.js"; function accessSetify( - addr: string, - storageKeys: Array, + addr: string, + storageKeys: Array, ): { address: string; storageKeys: Array } { - return { - address: getAddress(addr), - storageKeys: storageKeys.map((storageKey, index) => { - assertArgument( - isHexString(storageKey, 32), - "invalid slot", - `storageKeys[${index}]`, - storageKey, - ); - return storageKey.toLowerCase(); - }), - }; + return { + address: getAddress(addr), + storageKeys: storageKeys.map((storageKey, index) => { + assertArgument( + isHexString(storageKey, 32), + "invalid slot", + `storageKeys[${index}]`, + storageKey, + ); + return storageKey.toLowerCase(); + }), + }; } /** * Returns a [[AccessList]] from any corebcsupported access-list structure. */ export function accessListify(value: AccessListish): AccessList { - if (Array.isArray(value)) { - return (< - Array< - | [string, Array] - | { address: string; storageKeys: Array } - > - >value).map((set, index) => { - if (Array.isArray(set)) { - assertArgument( - set.length === 2, - "invalid slot set", - `value[${index}]`, - set, - ); - return accessSetify(set[0], set[1]); - } - assertArgument( - set != null && typeof set === "object", - "invalid address-slot set", - "value", - value, - ); - return accessSetify(set.address, set.storageKeys); - }); - } + if (Array.isArray(value)) { + return (< + Array< + | [string, Array] + | { address: string; storageKeys: Array } + > + >value).map((set, index) => { + if (Array.isArray(set)) { + assertArgument( + set.length === 2, + "invalid slot set", + `value[${index}]`, + set, + ); + return accessSetify(set[0], set[1]); + } + assertArgument( + set != null && typeof set === "object", + "invalid address-slot set", + "value", + value, + ); + return accessSetify(set.address, set.storageKeys); + }); + } - assertArgument( - value != null && typeof value === "object", - "invalid access list", - "value", - value, - ); + assertArgument( + value != null && typeof value === "object", + "invalid access list", + "value", + value, + ); - const result: Array<{ address: string; storageKeys: Array }> = - Object.keys(value).map((addr) => { - const storageKeys: Record = value[addr].reduce( - (accum, storageKey) => { - accum[storageKey] = true; - return accum; - }, - >{}, - ); - return accessSetify(addr, Object.keys(storageKeys).sort()); - }); - result.sort((a, b) => a.address.localeCompare(b.address)); - return result; + const result: Array<{ address: string; storageKeys: Array }> = + Object.keys(value).map((addr) => { + const storageKeys: Record = value[addr].reduce( + (accum, storageKey) => { + accum[storageKey] = true; + return accum; + }, + >{}, + ); + return accessSetify(addr, Object.keys(storageKeys).sort()); + }); + result.sort((a, b) => a.address.localeCompare(b.address)); + return result; } diff --git a/src.ts/transaction/address.ts b/src.ts/transaction/address.ts index c7bb8e62c..5613eb176 100644 --- a/src.ts/transaction/address.ts +++ b/src.ts/transaction/address.ts @@ -13,29 +13,29 @@ import { calculateCheckSum } from "../address/index.js"; */ export function removeHexPrefix(val: string): string { - return val.substring(0, 2) === "0x" ? val.substring(2) : val; + return val.substring(0, 2) === "0x" ? val.substring(2) : val; } export function publicToAddress( - key: BytesLike | string, - prefix: string, + key: BytesLike | string, + prefix: string, ): string { - const val = hexDataSlice(sha256(key), 12); - const checksum = calculateCheckSum(val, prefix); - return "0x" + prefix + checksum + removeHexPrefix(val); + const val = hexDataSlice(sha256(key), 12); + const checksum = calculateCheckSum(val, prefix); + return "0x" + prefix + checksum + removeHexPrefix(val); } export function computeAddress( - key: string | SigningKey, - prefix: string, + key: string | SigningKey, + prefix: string, ): string { - let pubkey: string; - if (typeof key === "string") { - pubkey = SigningKey.computePublicKey(key, false); - } else { - pubkey = key.publicKey; - } - return publicToAddress(pubkey, prefix); // getAddress(sha256("0x" + pubkey.substring(4)).substring(26)); + let pubkey: string; + if (typeof key === "string") { + pubkey = SigningKey.computePublicKey(key, false); + } else { + pubkey = key.publicKey; + } + return publicToAddress(pubkey, prefix); // getAddress(sha256("0x" + pubkey.substring(4)).substring(26)); } /** @@ -43,15 +43,15 @@ export function computeAddress( * used to sign %%digest%% that resulted in %%signature%%. */ export function recoverAddress( - digest: BytesLike, - signature: SignatureLike, - prefix: string, + digest: BytesLike, + signature: SignatureLike, + prefix: string, ): string { - // return computeAddress(SigningKey.recoverPublicKey(digest, signature)); - const publicKey = SigningKey.recoverPublicKey(arrayify(digest), signature); - return publicToAddress(publicKey, prefix); + // return computeAddress(SigningKey.recoverPublicKey(digest, signature)); + const publicKey = SigningKey.recoverPublicKey(arrayify(digest), signature); + return publicToAddress(publicKey, prefix); } export function extractPrefix(address: string): string { - address = getAddress(address); - return address.substring(2, 4); + address = getAddress(address); + return address.substring(2, 4); } diff --git a/src.ts/transaction/index.ts b/src.ts/transaction/index.ts index 154f83f62..cac6cde4e 100644 --- a/src.ts/transaction/index.ts +++ b/src.ts/transaction/index.ts @@ -20,9 +20,7 @@ export type AccessList = Array; * Any corebc-supported access list structure. */ export type AccessListish = - | AccessList - | Array<[string, Array]> - | Record>; + AccessList | Array<[string, Array]> | Record>; export { accessListify } from "./accesslist.js"; export { computeAddress, recoverAddress } from "./address.js"; diff --git a/src.ts/transaction/transaction.ts b/src.ts/transaction/transaction.ts index ccc62dc46..e609261e8 100644 --- a/src.ts/transaction/transaction.ts +++ b/src.ts/transaction/transaction.ts @@ -1,12 +1,12 @@ import { getAddress } from "../address/index.js"; import { sha256, Signature, SigningKey } from "../crypto/index.js"; import { - getBytes, - getBigInt, - getNumber, - hexlify, - assert, - assertArgument, + getBytes, + getBigInt, + getNumber, + hexlify, + assert, + assertArgument, } from "../utils/index.js"; import { recoverAddress } from "./address.js"; @@ -24,176 +24,176 @@ const logger = new Logger("transaction/0.0.1"); const BN_0 = BigInt(0); export interface TransactionLike { - /** - * The recipient address or ``null`` for an ``init`` transaction. - */ - to?: null | A; - - /** - * The sender. - */ - from?: null | A; - - /** - * The nonce. - */ - nonce?: null | number; - - /** - * The maximum amount of energy that can be used. - */ - energyLimit?: null | BigNumberish; - - /** - * The energy price for legacy and berlin transactions. - */ - energyPrice?: null | BigNumberish; - - /** - * The data. - */ - data?: null | string; - - /** - * The value (in ore) to send. - */ - value?: null | BigNumberish; - - /** - * The chain ID the transaction is valid on. - */ - networkId?: null | BigNumberish; - - /** - * The transaction hash. - */ - hash?: null | string; - - /** - * The signature provided by the sender. - */ - signature?: null | SignatureLike; + /** + * The recipient address or ``null`` for an ``init`` transaction. + */ + to?: null | A; + + /** + * The sender. + */ + from?: null | A; + + /** + * The nonce. + */ + nonce?: null | number; + + /** + * The maximum amount of energy that can be used. + */ + energyLimit?: null | BigNumberish; + + /** + * The energy price for legacy and berlin transactions. + */ + energyPrice?: null | BigNumberish; + + /** + * The data. + */ + data?: null | string; + + /** + * The value (in ore) to send. + */ + value?: null | BigNumberish; + + /** + * The chain ID the transaction is valid on. + */ + networkId?: null | BigNumberish; + + /** + * The transaction hash. + */ + hash?: null | string; + + /** + * The signature provided by the sender. + */ + signature?: null | SignatureLike; } function handleAddress(value: string): null | string { - if (value === "0x") { - return null; - } - return getAddress(value); + if (value === "0x") { + return null; + } + return getAddress(value); } function parse(data: BytesLike): TransactionLike { - const handleNumber = (value: string): BigNumber => { - // @ts-ignore - if (value === "0x") { - return BigNumber.from(0); - } - return BigNumber.from(value); - }; - - const transaction = RLP.decode(data); - - if (transaction.length !== 7 && transaction.length !== 8) { - logger.throwArgumentError("invalid raw transaction", "data", data); - } - - const isSigned = transaction.length === 8; - const tx: TransactionLike = { - nonce: Number(handleNumber(transaction[0])), - energyPrice: handleNumber(transaction[1]).toBigInt(), - energyLimit: handleNumber(transaction[2]).toBigInt(), - networkId: handleNumber(transaction[isSigned ? 3 : 6]).toBigInt(), - to: handleAddress(transaction[isSigned ? 4 : 3]), - value: handleNumber(transaction[isSigned ? 5 : 4]).toBigInt(), - data: transaction[isSigned ? 6 : 5], - }; - - if (transaction.length === 8) { - const prefix = networkIdToPrefix(Number(tx.networkId)); - const digest = sha256(serialize(tx)); - tx.hash = sha256(serialize(tx, transaction[7])); - tx.from = recoverAddress(digest, transaction[7], prefix); - tx.signature = transaction[7]; - } - - return tx; + const handleNumber = (value: string): BigNumber => { + // @ts-ignore + if (value === "0x") { + return BigNumber.from(0); + } + return BigNumber.from(value); + }; + + const transaction = RLP.decode(data); + + if (transaction.length !== 7 && transaction.length !== 8) { + logger.throwArgumentError("invalid raw transaction", "data", data); + } + + const isSigned = transaction.length === 8; + const tx: TransactionLike = { + nonce: Number(handleNumber(transaction[0])), + energyPrice: handleNumber(transaction[1]).toBigInt(), + energyLimit: handleNumber(transaction[2]).toBigInt(), + networkId: handleNumber(transaction[isSigned ? 3 : 6]).toBigInt(), + to: handleAddress(transaction[isSigned ? 4 : 3]), + value: handleNumber(transaction[isSigned ? 5 : 4]).toBigInt(), + data: transaction[isSigned ? 6 : 5], + }; + + if (transaction.length === 8) { + const prefix = networkIdToPrefix(Number(tx.networkId)); + const digest = sha256(serialize(tx)); + tx.hash = sha256(serialize(tx, transaction[7])); + tx.from = recoverAddress(digest, transaction[7], prefix); + tx.signature = transaction[7]; + } + + return tx; } const unsignedTransactionFields = [ - { name: "nonce", maxLength: 32, numeric: true }, - { name: "energyPrice", maxLength: 32, numeric: true }, - { name: "energyLimit", maxLength: 32, numeric: true }, - { name: "to", length: 22 }, - { name: "value", maxLength: 32, numeric: true }, - { name: "data" }, - { name: "networkId", maxLength: 32, numeric: true }, + { name: "nonce", maxLength: 32, numeric: true }, + { name: "energyPrice", maxLength: 32, numeric: true }, + { name: "energyLimit", maxLength: 32, numeric: true }, + { name: "to", length: 22 }, + { name: "value", maxLength: 32, numeric: true }, + { name: "data" }, + { name: "networkId", maxLength: 32, numeric: true }, ]; const transactionFields = [ - { name: "nonce", maxLength: 32, numeric: true }, - { name: "energyPrice", maxLength: 32, numeric: true }, - { name: "energyLimit", maxLength: 32, numeric: true }, - { name: "networkId", maxLength: 32, numeric: true }, - { name: "to", length: 22 }, - { name: "value", maxLength: 32, numeric: true }, - { name: "data" }, + { name: "nonce", maxLength: 32, numeric: true }, + { name: "energyPrice", maxLength: 32, numeric: true }, + { name: "energyLimit", maxLength: 32, numeric: true }, + { name: "networkId", maxLength: 32, numeric: true }, + { name: "to", length: 22 }, + { name: "value", maxLength: 32, numeric: true }, + { name: "data" }, ]; const allowedTransactionKeys: { [key: string]: boolean } = { - networkId: true, - data: true, - energyLimit: true, - energyPrice: true, - nonce: true, - to: true, - value: true, + networkId: true, + data: true, + energyLimit: true, + energyPrice: true, + nonce: true, + to: true, + value: true, }; function serialize(transaction: TransactionLike, signature?: string): string { - checkProperties(transaction, allowedTransactionKeys); - - const raw: Array = []; - - (!!signature ? transactionFields : unsignedTransactionFields).forEach( - function ({ numeric, maxLength, name, length }) { - let value = (transaction)[name] || []; - const options: DataOptions = {}; - if (numeric) { - options.hexPad = "left"; - } - const tmpHexlified = hexlify(value, options); - value = arrayify(tmpHexlified); - // Fixed-width field - if (length && value.length !== length && value.length > 0) { - logger.throwArgumentError( - "invalid length for " + name, - "transaction:" + name, - value, - ); - } - - // Variable-width (with a maximum) - if (maxLength) { - value = stripZeros(value); - if (value.length > maxLength) { - logger.throwArgumentError( - "invalid length for " + name, - "transaction:" + name, - value, - ); - } - } - - const hexlified = hexlify(value); - raw.push(hexlified); - }, - ); - - if (!!signature) { - raw.push(hexlify(signature)); - } - const finalValue = RLP.encode(raw); - return finalValue; + checkProperties(transaction, allowedTransactionKeys); + + const raw: Array = []; + + (!!signature ? transactionFields : unsignedTransactionFields).forEach( + function ({ numeric, maxLength, name, length }) { + let value = (transaction)[name] || []; + const options: DataOptions = {}; + if (numeric) { + options.hexPad = "left"; + } + const tmpHexlified = hexlify(value, options); + value = arrayify(tmpHexlified); + // Fixed-width field + if (length && value.length !== length && value.length > 0) { + logger.throwArgumentError( + "invalid length for " + name, + "transaction:" + name, + value, + ); + } + + // Variable-width (with a maximum) + if (maxLength) { + value = stripZeros(value); + if (value.length > maxLength) { + logger.throwArgumentError( + "invalid length for " + name, + "transaction:" + name, + value, + ); + } + } + + const hexlified = hexlify(value); + raw.push(hexlified); + }, + ); + + if (!!signature) { + raw.push(hexlify(signature)); + } + const finalValue = RLP.encode(raw); + return finalValue; } /** @@ -210,294 +210,294 @@ function serialize(transaction: TransactionLike, signature?: string): string { * //_result: */ export class Transaction implements TransactionLike { - #to: null | string; - #data: string; - #nonce: number; - #energyLimit: bigint; - #energyPrice: null | bigint; - #value: bigint; - #networkId: bigint; - #sig: null | string; - - /** - * The ``to`` address for the transaction or ``null`` if the - * transaction is an ``init`` transaction. - */ - get to(): null | string { - return this.#to; - } - set to(value: null | string) { - this.#to = value == null ? null : getAddress(value); - } - - /** - * The transaction nonce. - */ - get nonce(): number { - return this.#nonce; - } - set nonce(value: BigNumberish) { - this.#nonce = getNumber(value, "value"); - } - - /** - * The energy limit. - */ - get energyLimit(): bigint { - return this.#energyLimit; - } - set energyLimit(value: BigNumberish) { - this.#energyLimit = getBigInt(value); - } - - /** - * The energy price. - * - * On legacy networks this defines the fee that will be paid. On - * EIP-1559 networks, this should be ``null``. - */ - get energyPrice(): null | bigint { - const value = this.#energyPrice; - if (value == null) { - return BN_0; - } - return value; - } - set energyPrice(value: null | BigNumberish) { - this.#energyPrice = value == null ? null : getBigInt(value, "energyPrice"); - } - - /** - * The transaction data. For ``init`` transactions this is the - * deployment code. - */ - get data(): string { - return this.#data; - } - set data(value: BytesLike) { - this.#data = hexlify(value); - } - - /** - * The amount of xcb (in ore) to send in this transactions. - */ - get value(): bigint { - return this.#value; - } - set value(value: BigNumberish) { - this.#value = getBigInt(value, "value"); - } - - /** - * The chain ID this transaction is valid on. - */ - get networkId(): bigint { - return this.#networkId; - } - set networkId(value: BigNumberish) { - this.#networkId = getBigInt(value); - } - - /** - * If signed, the signature for this transaction. - */ - get signature(): null | string { - return this.#sig || null; - } - set signature(value: null | SignatureLike) { - this.#sig = value == null ? null : value; - } - - /** - * Creates a new Transaction with default values. - */ - constructor() { - this.#to = null; - this.#nonce = 0; - this.#energyLimit = BigInt(0); - this.#energyPrice = null; - this.#data = "0x"; - this.#value = BigInt(0); - this.#networkId = BigInt(0); - this.#sig = null; - } - - /** - * The transaction hash, if signed. Otherwise, ``null``. - */ - get hash(): null | string { - if (this.signature == null) { - return null; - } - return sha256(this.serialized); - } - - /** - * The pre-image hash of this transaction. - * - * This is the digest that a [[Signer]] must sign to authorize - * this transaction. - */ - get unsignedHash(): string { - return sha256(this.unsignedSerialized); - } - - /** - * The sending address, if signed. Otherwise, ``null``. - */ - get from(): null | string { - if (this.signature == null) { - return null; - } - const prefix = networkIdToPrefix(Number(this.#networkId)); - return recoverAddress(this.unsignedHash, this.signature, prefix); - } - - /** - * The public key of the sender, if signed. Otherwise, ``null``. - */ - get fromPublicKey(): null | string { - if (this.signature == null) { - return null; - } - return SigningKey.recoverPublicKey(this.unsignedHash, this.signature); - } - - /** - * Returns true if signed. - * - * This provides a Type Guard that properties requiring a signed - * transaction are non-null. - */ - isSigned(): this is Transaction & { - type: number; - typeName: string; - from: string; - signature: Signature; - } { - //isSigned(): this is SignedTransaction { - return this.signature != null; - } - - /** - * The serialized transaction. - * - * This throws if the transaction is unsigned. For the pre-image, - * use [[unsignedSerialized]]. - */ - get serialized(): string { - assert( - this.signature != null, - "cannot serialize unsigned transaction; maybe you meant .unsignedSerialized", - "UNSUPPORTED_OPERATION", - { operation: ".serialized" }, - ); - return serialize(this, this.signature); - } - - /** - * The transaction pre-image. - * - * The hash of this is the digest which needs to be signed to - * authorize this transaction. - */ - get unsignedSerialized(): string { - return serialize(this); - } - - /** - * Create a copy of this transaciton. - */ - clone(): Transaction { - return Transaction.from(this); - } - - /** - * Return a JSON-friendly object. - */ - toJSON(): any { - const s = (v: null | bigint) => { - if (v == null) { - return null; - } - return v.toString(); - }; - - return { - to: this.to, - data: this.data, - nonce: this.nonce, - energyLimit: s(this.energyLimit), - energyPrice: s(this.energyPrice), - value: s(this.value), - networkId: s(this.networkId), - sig: this.signature ? this.signature : null, - }; - } - - /** - * Create a **Transaction** from a serialized transaction or a - * Transaction-like object. - */ - static from(tx?: string | TransactionLike): Transaction { - if (tx == null) { - return new Transaction(); - } - - if (typeof tx === "string") { - const payload = getBytes(tx); - return Transaction.from(parse(payload)); - } - const result = new Transaction(); - if (tx.to != null) { - result.to = tx.to; - } - if (tx.nonce != null) { - result.nonce = tx.nonce; - } - if (tx.energyLimit != null) { - result.energyLimit = tx.energyLimit; - } - if (tx.energyPrice != null) { - result.energyPrice = tx.energyPrice; - } - if (tx.data != null) { - result.data = tx.data; - } - if (tx.value != null) { - result.value = tx.value; - } - if (tx.networkId != null) { - result.networkId = tx.networkId; - } - if (tx.signature != null) { - result.signature = tx.signature; - } - - if (tx.hash != null) { - assertArgument( - result.isSigned(), - "unsigned transaction cannot define hash", - "tx", - tx, - ); - assertArgument(result.hash === tx.hash, "hash mismatch", "tx", tx); - } - - if (tx.from != null) { - assertArgument( - result.isSigned(), - "unsigned transaction cannot define from", - "tx", - tx, - ); - assertArgument( - result.from.toLowerCase() === (tx.from || "").toLowerCase(), - "from mismatch", - "tx", - tx, - ); - } - return result; - } + #to: null | string; + #data: string; + #nonce: number; + #energyLimit: bigint; + #energyPrice: null | bigint; + #value: bigint; + #networkId: bigint; + #sig: null | string; + + /** + * The ``to`` address for the transaction or ``null`` if the + * transaction is an ``init`` transaction. + */ + get to(): null | string { + return this.#to; + } + set to(value: null | string) { + this.#to = value == null ? null : getAddress(value); + } + + /** + * The transaction nonce. + */ + get nonce(): number { + return this.#nonce; + } + set nonce(value: BigNumberish) { + this.#nonce = getNumber(value, "value"); + } + + /** + * The energy limit. + */ + get energyLimit(): bigint { + return this.#energyLimit; + } + set energyLimit(value: BigNumberish) { + this.#energyLimit = getBigInt(value); + } + + /** + * The energy price. + * + * On legacy networks this defines the fee that will be paid. On + * EIP-1559 networks, this should be ``null``. + */ + get energyPrice(): null | bigint { + const value = this.#energyPrice; + if (value == null) { + return BN_0; + } + return value; + } + set energyPrice(value: null | BigNumberish) { + this.#energyPrice = value == null ? null : getBigInt(value, "energyPrice"); + } + + /** + * The transaction data. For ``init`` transactions this is the + * deployment code. + */ + get data(): string { + return this.#data; + } + set data(value: BytesLike) { + this.#data = hexlify(value); + } + + /** + * The amount of xcb (in ore) to send in this transactions. + */ + get value(): bigint { + return this.#value; + } + set value(value: BigNumberish) { + this.#value = getBigInt(value, "value"); + } + + /** + * The chain ID this transaction is valid on. + */ + get networkId(): bigint { + return this.#networkId; + } + set networkId(value: BigNumberish) { + this.#networkId = getBigInt(value); + } + + /** + * If signed, the signature for this transaction. + */ + get signature(): null | string { + return this.#sig || null; + } + set signature(value: null | SignatureLike) { + this.#sig = value == null ? null : value; + } + + /** + * Creates a new Transaction with default values. + */ + constructor() { + this.#to = null; + this.#nonce = 0; + this.#energyLimit = BigInt(0); + this.#energyPrice = null; + this.#data = "0x"; + this.#value = BigInt(0); + this.#networkId = BigInt(0); + this.#sig = null; + } + + /** + * The transaction hash, if signed. Otherwise, ``null``. + */ + get hash(): null | string { + if (this.signature == null) { + return null; + } + return sha256(this.serialized); + } + + /** + * The pre-image hash of this transaction. + * + * This is the digest that a [[Signer]] must sign to authorize + * this transaction. + */ + get unsignedHash(): string { + return sha256(this.unsignedSerialized); + } + + /** + * The sending address, if signed. Otherwise, ``null``. + */ + get from(): null | string { + if (this.signature == null) { + return null; + } + const prefix = networkIdToPrefix(Number(this.#networkId)); + return recoverAddress(this.unsignedHash, this.signature, prefix); + } + + /** + * The public key of the sender, if signed. Otherwise, ``null``. + */ + get fromPublicKey(): null | string { + if (this.signature == null) { + return null; + } + return SigningKey.recoverPublicKey(this.unsignedHash, this.signature); + } + + /** + * Returns true if signed. + * + * This provides a Type Guard that properties requiring a signed + * transaction are non-null. + */ + isSigned(): this is Transaction & { + type: number; + typeName: string; + from: string; + signature: Signature; + } { + //isSigned(): this is SignedTransaction { + return this.signature != null; + } + + /** + * The serialized transaction. + * + * This throws if the transaction is unsigned. For the pre-image, + * use [[unsignedSerialized]]. + */ + get serialized(): string { + assert( + this.signature != null, + "cannot serialize unsigned transaction; maybe you meant .unsignedSerialized", + "UNSUPPORTED_OPERATION", + { operation: ".serialized" }, + ); + return serialize(this, this.signature); + } + + /** + * The transaction pre-image. + * + * The hash of this is the digest which needs to be signed to + * authorize this transaction. + */ + get unsignedSerialized(): string { + return serialize(this); + } + + /** + * Create a copy of this transaciton. + */ + clone(): Transaction { + return Transaction.from(this); + } + + /** + * Return a JSON-friendly object. + */ + toJSON(): any { + const s = (v: null | bigint) => { + if (v == null) { + return null; + } + return v.toString(); + }; + + return { + to: this.to, + data: this.data, + nonce: this.nonce, + energyLimit: s(this.energyLimit), + energyPrice: s(this.energyPrice), + value: s(this.value), + networkId: s(this.networkId), + sig: this.signature ? this.signature : null, + }; + } + + /** + * Create a **Transaction** from a serialized transaction or a + * Transaction-like object. + */ + static from(tx?: string | TransactionLike): Transaction { + if (tx == null) { + return new Transaction(); + } + + if (typeof tx === "string") { + const payload = getBytes(tx); + return Transaction.from(parse(payload)); + } + const result = new Transaction(); + if (tx.to != null) { + result.to = tx.to; + } + if (tx.nonce != null) { + result.nonce = tx.nonce; + } + if (tx.energyLimit != null) { + result.energyLimit = tx.energyLimit; + } + if (tx.energyPrice != null) { + result.energyPrice = tx.energyPrice; + } + if (tx.data != null) { + result.data = tx.data; + } + if (tx.value != null) { + result.value = tx.value; + } + if (tx.networkId != null) { + result.networkId = tx.networkId; + } + if (tx.signature != null) { + result.signature = tx.signature; + } + + if (tx.hash != null) { + assertArgument( + result.isSigned(), + "unsigned transaction cannot define hash", + "tx", + tx, + ); + assertArgument(result.hash === tx.hash, "hash mismatch", "tx", tx); + } + + if (tx.from != null) { + assertArgument( + result.isSigned(), + "unsigned transaction cannot define from", + "tx", + tx, + ); + assertArgument( + result.from.toLowerCase() === (tx.from || "").toLowerCase(), + "from mismatch", + "tx", + tx, + ); + } + return result; + } } diff --git a/src.ts/utils/base58.ts b/src.ts/utils/base58.ts index c9e8f364d..9c4442ad9 100644 --- a/src.ts/utils/base58.ts +++ b/src.ts/utils/base58.ts @@ -22,15 +22,15 @@ const Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; let Lookup: null | Record = null; function getAlpha(letter: string): bigint { - if (Lookup == null) { - Lookup = {}; - for (let i = 0; i < Alphabet.length; i++) { - Lookup[Alphabet[i]] = BigInt(i); - } - } - const result = Lookup[letter]; - assertArgument(result != null, `invalid base58 value`, "letter", letter); - return result; + if (Lookup == null) { + Lookup = {}; + for (let i = 0; i < Alphabet.length; i++) { + Lookup[Alphabet[i]] = BigInt(i); + } + } + const result = Lookup[letter]; + assertArgument(result != null, `invalid base58 value`, "letter", letter); + return result; } const BN_0 = BigInt(0); @@ -40,23 +40,23 @@ const BN_58 = BigInt(58); * Encode %%value%% as a Base58-encoded string. */ export function encodeBase58(_value: BytesLike): string { - let value = toBigInt(getBytes(_value)); - let result = ""; - while (value) { - result = Alphabet[Number(value % BN_58)] + result; - value /= BN_58; - } - return result; + let value = toBigInt(getBytes(_value)); + let result = ""; + while (value) { + result = Alphabet[Number(value % BN_58)] + result; + value /= BN_58; + } + return result; } /** * Decode the Base58-encoded %%value%%. */ export function decodeBase58(value: string): bigint { - let result = BN_0; - for (let i = 0; i < value.length; i++) { - result *= BN_58; - result += getAlpha(value[i]); - } - return result; + let result = BN_0; + for (let i = 0; i < value.length; i++) { + result *= BN_58; + result += getAlpha(value[i]); + } + return result; } diff --git a/src.ts/utils/base64-browser.ts b/src.ts/utils/base64-browser.ts index b788723c7..42e7056fe 100644 --- a/src.ts/utils/base64-browser.ts +++ b/src.ts/utils/base64-browser.ts @@ -5,19 +5,19 @@ import { getBytes } from "./data.js"; import type { BytesLike } from "./data.js"; export function decodeBase64(textData: string): Uint8Array { - textData = atob(textData); - const data = new Uint8Array(textData.length); - for (let i = 0; i < textData.length; i++) { - data[i] = textData.charCodeAt(i); - } - return getBytes(data); + textData = atob(textData); + const data = new Uint8Array(textData.length); + for (let i = 0; i < textData.length; i++) { + data[i] = textData.charCodeAt(i); + } + return getBytes(data); } export function encodeBase64(_data: BytesLike): string { - const data = getBytes(_data); - let textData = ""; - for (let i = 0; i < data.length; i++) { - textData += String.fromCharCode(data[i]); - } - return btoa(textData); + const data = getBytes(_data); + let textData = ""; + for (let i = 0; i < data.length; i++) { + textData += String.fromCharCode(data[i]); + } + return btoa(textData); } diff --git a/src.ts/utils/base64.ts b/src.ts/utils/base64.ts index 81d963dbf..cfc806625 100644 --- a/src.ts/utils/base64.ts +++ b/src.ts/utils/base64.ts @@ -27,7 +27,7 @@ import type { BytesLike } from "./data.js"; * //_result: */ export function decodeBase64(value: string): Uint8Array { - return getBytesCopy(Buffer.from(value, "base64")); + return getBytesCopy(Buffer.from(value, "base64")); } /** @@ -51,5 +51,5 @@ export function decodeBase64(value: string): Uint8Array { * //_result: */ export function encodeBase64(data: BytesLike): string { - return Buffer.from(getBytes(data)).toString("base64"); + return Buffer.from(getBytes(data)).toString("base64"); } diff --git a/src.ts/utils/data.ts b/src.ts/utils/data.ts index c11027e91..e2d78d7f4 100644 --- a/src.ts/utils/data.ts +++ b/src.ts/utils/data.ts @@ -29,67 +29,67 @@ export type Bytes = ArrayLike; export type BytesLike = Bytes | string; export type DataOptions = { - allowMissingPrefix?: boolean; - hexPad?: "left" | "right" | null; + allowMissingPrefix?: boolean; + hexPad?: "left" | "right" | null; }; export interface Hexable { - toHexString(): string; + toHexString(): string; } function isHexable(value: any): value is Hexable { - return !!value.toHexString; + return !!value.toHexString; } function isInteger(value: number) { - return typeof value === "number" && value == value && value % 1 === 0; + return typeof value === "number" && value == value && value % 1 === 0; } export function isBytes(value: any): value is Bytes { - if (value == null) { - return false; - } - - if (value.constructor === Uint8Array) { - return true; - } - if (typeof value === "string") { - return false; - } - if (!isInteger(value.length) || value.length < 0) { - return false; - } - - for (let i = 0; i < value.length; i++) { - const v = value[i]; - if (!isInteger(v) || v < 0 || v >= 256) { - return false; - } - } - return true; + if (value == null) { + return false; + } + + if (value.constructor === Uint8Array) { + return true; + } + if (typeof value === "string") { + return false; + } + if (!isInteger(value.length) || value.length < 0) { + return false; + } + + for (let i = 0; i < value.length; i++) { + const v = value[i]; + if (!isInteger(v) || v < 0 || v >= 256) { + return false; + } + } + return true; } function _getBytes( - value: BytesLike, - name?: string, - copy?: boolean, + value: BytesLike, + name?: string, + copy?: boolean, ): Uint8Array { - if (value instanceof Uint8Array) { - if (copy) { - return new Uint8Array(value); - } - return value; - } - - if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) { - const result = new Uint8Array((value.length - 2) / 2); - let offset = 2; - for (let i = 0; i < result.length; i++) { - result[i] = parseInt(value.substring(offset, offset + 2), 16); - offset += 2; - } - return result; - } - - assertArgument(false, "invalid BytesLike value", name || "value", value); + if (value instanceof Uint8Array) { + if (copy) { + return new Uint8Array(value); + } + return value; + } + + if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) { + const result = new Uint8Array((value.length - 2) / 2); + let offset = 2; + for (let i = 0; i < result.length; i++) { + result[i] = parseInt(value.substring(offset, offset + 2), 16); + offset += 2; + } + return result; + } + + assertArgument(false, "invalid BytesLike value", name || "value", value); } /** @@ -100,7 +100,7 @@ function _getBytes( * @see: getBytesCopy */ export function getBytes(value: BytesLike, name?: string): Uint8Array { - return _getBytes(value, name, false); + return _getBytes(value, name, false); } /** @@ -111,7 +111,7 @@ export function getBytes(value: BytesLike, name?: string): Uint8Array { * @see: getBytes */ export function getBytesCopy(value: BytesLike, name?: string): Uint8Array { - return _getBytes(value, name, true); + return _getBytes(value, name, true); } /** @@ -122,21 +122,21 @@ export function getBytesCopy(value: BytesLike, name?: string): Uint8Array { * bytes of data (e.g. ``0x1234`` is 2 bytes). */ export function isHexString( - value: any, - length?: number | boolean, + value: any, + length?: number | boolean, ): value is `0x${string}` { - if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { - return false; - } - - if (typeof length === "number" && value.length !== 2 + 2 * length) { - return false; - } - if (length === true && value.length % 2 !== 0) { - return false; - } - - return true; + if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { + return false; + } + + if (typeof length === "number" && value.length !== 2 + 2 * length) { + return false; + } + if (length === true && value.length % 2 !== 0) { + return false; + } + + return true; } /** @@ -144,7 +144,7 @@ export function isHexString( * data (i.e. a valid [[DataHexString]] or a Uint8Array). */ export function isBytesLike(value: any): value is BytesLike { - return isHexString(value, true) || value instanceof Uint8Array; + return isHexString(value, true) || value instanceof Uint8Array; } const HexCharacters: string = "0123456789abcdef"; @@ -153,84 +153,84 @@ const HexCharacters: string = "0123456789abcdef"; * Returns a [[DataHexString]] representation of %%data%%. */ export function hexlify( - value: BytesLike | Hexable | number | bigint, - options?: DataOptions, + value: BytesLike | Hexable | number | bigint, + options?: DataOptions, ): string { - if (!options) { - options = {}; - } - if (typeof value === "string") { - if (value.includes(",") && value.startsWith("0x")) { - const v = value - .replace("0x", "") - .split(",") - .map((item) => Number(item)); - // @ts-ignore - value = new Uint8Array(v); - } - } - if (typeof value === "number") { - logger.checkSafeUint53(value, "invalid hexlify value"); - - let hex = ""; - while (value) { - hex = HexCharacters[value & 0xf] + hex; - value = Math.floor(value / 16); - } - - if (hex.length) { - if (hex.length % 2) { - hex = "0" + hex; - } - return "0x" + hex; - } - - return "0x00"; - } - - if (typeof value === "bigint") { - value = value.toString(16); - if (value.length % 2) { - return "0x0" + value; - } - return "0x" + value; - } - - if ( - options.allowMissingPrefix && - typeof value === "string" && - value.substring(0, 2) !== "0x" - ) { - value = "0x" + value; - } - - if (isHexable(value)) { - return value.toHexString(); - } - - if (isHexString(value)) { - if ((value).length % 2) { - if (options.hexPad === "left") { - value = "0x0" + (value).substring(2); - } else if (options.hexPad === "right") { - value += "0"; - } else { - logger.throwArgumentError("hex data is odd-length", "value", value); - } - } - return (value).toLowerCase(); - } - - if (isBytes(value)) { - let result = "0x"; - for (let i = 0; i < value.length; i++) { - let v = value[i]; - result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; - } - return result; - } - - return logger.throwArgumentError("invalid hexlify value", "value", value); + if (!options) { + options = {}; + } + if (typeof value === "string") { + if (value.includes(",") && value.startsWith("0x")) { + const v = value + .replace("0x", "") + .split(",") + .map((item) => Number(item)); + // @ts-ignore + value = new Uint8Array(v); + } + } + if (typeof value === "number") { + logger.checkSafeUint53(value, "invalid hexlify value"); + + let hex = ""; + while (value) { + hex = HexCharacters[value & 0xf] + hex; + value = Math.floor(value / 16); + } + + if (hex.length) { + if (hex.length % 2) { + hex = "0" + hex; + } + return "0x" + hex; + } + + return "0x00"; + } + + if (typeof value === "bigint") { + value = value.toString(16); + if (value.length % 2) { + return "0x0" + value; + } + return "0x" + value; + } + + if ( + options.allowMissingPrefix && + typeof value === "string" && + value.substring(0, 2) !== "0x" + ) { + value = "0x" + value; + } + + if (isHexable(value)) { + return value.toHexString(); + } + + if (isHexString(value)) { + if ((value).length % 2) { + if (options.hexPad === "left") { + value = "0x0" + (value).substring(2); + } else if (options.hexPad === "right") { + value += "0"; + } else { + logger.throwArgumentError("hex data is odd-length", "value", value); + } + } + return (value).toLowerCase(); + } + + if (isBytes(value)) { + let result = "0x"; + for (let i = 0; i < value.length; i++) { + let v = value[i]; + result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; + } + return result; + } + + return logger.throwArgumentError("invalid hexlify value", "value", value); } /** @@ -238,47 +238,47 @@ export function hexlify( * within %%data%%. */ export function concat(items: ReadonlyArray): string { - return "0x" + items.map((d) => hexlify(d).substring(2)).join(""); + return "0x" + items.map((d) => hexlify(d).substring(2)).join(""); } export function hexDataSlice( - data: BytesLike, - offset: number, - endOffset?: number, + data: BytesLike, + offset: number, + endOffset?: number, ): string { - if (typeof data !== "string") { - data = hexlify(data); - } else if (!isHexString(data) || data.length % 2) { - logger.throwArgumentError("invalid hexData", "value", data); - } + if (typeof data !== "string") { + data = hexlify(data); + } else if (!isHexString(data) || data.length % 2) { + logger.throwArgumentError("invalid hexData", "value", data); + } - offset = 2 + 2 * offset; + offset = 2 + 2 * offset; - if (endOffset != null) { - return "0x" + data.substring(offset, 2 + 2 * endOffset); - } + if (endOffset != null) { + return "0x" + data.substring(offset, 2 + 2 * endOffset); + } - return "0x" + data.substring(offset); + return "0x" + data.substring(offset); } export function hexDataLength(data: BytesLike) { - if (typeof data !== "string") { - data = hexlify(data); - } else if (!isHexString(data) || data.length % 2) { - return null; - } + if (typeof data !== "string") { + data = hexlify(data); + } else if (!isHexString(data) || data.length % 2) { + return null; + } - return (data.length - 2) / 2; + return (data.length - 2) / 2; } /** * Returns the length of %%data%%, in bytes. */ export function dataLength(data: BytesLike): number { - if (isHexString(data, true)) { - return (data.length - 2) / 2; - } - return getBytes(data).length; + if (isHexString(data, true)) { + return (data.length - 2) / 2; + } + return getBytes(data).length; } /** @@ -288,21 +288,21 @@ export function dataLength(data: BytesLike): number { * By default %%start%% is 0 and %%end%% is the length of %%data%%. */ export function dataSlice( - data: BytesLike, - start?: number, - end?: number, + data: BytesLike, + start?: number, + end?: number, ): string { - const bytes = getBytes(data); - if (end != null && end > bytes.length) { - assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { - buffer: bytes, - length: bytes.length, - offset: end, - }); - } - return hexlify( - bytes.slice(start == null ? 0 : start, end == null ? bytes.length : end), - ); + const bytes = getBytes(data); + if (end != null && end > bytes.length) { + assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { + buffer: bytes, + length: bytes.length, + offset: end, + }); + } + return hexlify( + bytes.slice(start == null ? 0 : start, end == null ? bytes.length : end), + ); } /** @@ -310,35 +310,35 @@ export function dataSlice( ** zero bytes from %%data%%. */ export function stripZerosLeft(data: BytesLike): string { - let bytes = hexlify(data).substring(2); - while (bytes.startsWith("00")) { - bytes = bytes.substring(2); - } - return "0x" + bytes; + let bytes = hexlify(data).substring(2); + while (bytes.startsWith("00")) { + bytes = bytes.substring(2); + } + return "0x" + bytes; } function zeroPad(data: BytesLike, length: number, left: boolean): string { - const bytes = getBytes(data); - assert( - length >= bytes.length, - "padding exceeds data length", - "BUFFER_OVERRUN", - { - buffer: new Uint8Array(bytes), - length: length, - offset: length + 1, - }, - ); - - const result = new Uint8Array(length); - result.fill(0); - if (left) { - result.set(bytes, length - bytes.length); - } else { - result.set(bytes, 0); - } - - return hexlify(result); + const bytes = getBytes(data); + assert( + length >= bytes.length, + "padding exceeds data length", + "BUFFER_OVERRUN", + { + buffer: new Uint8Array(bytes), + length: length, + offset: length + 1, + }, + ); + + const result = new Uint8Array(length); + result.fill(0); + if (left) { + result.set(bytes, length - bytes.length); + } else { + result.set(bytes, 0); + } + + return hexlify(result); } /** @@ -352,7 +352,7 @@ function zeroPad(data: BytesLike, length: number, left: boolean): string { * (e.g. ``uint128``). */ export function zeroPadValue(data: BytesLike, length: number): string { - return zeroPad(data, length, true); + return zeroPad(data, length, true); } /** @@ -366,107 +366,94 @@ export function zeroPadValue(data: BytesLike, length: number): string { * (e.g. ``bytes16``). */ export function zeroPadBytes(data: BytesLike, length: number): string { - return zeroPad(data, length, false); + return zeroPad(data, length, false); } export function stripZeros(value: BytesLike): Uint8Array { - let result: Uint8Array = arrayify(value); + let result: Uint8Array = arrayify(value); - if (result.length === 0) { - return result; - } + if (result.length === 0) { + return result; + } - // Find the first non-zero entry - let start = 0; - while (start < result.length && result[start] === 0) { - start++; - } + // Find the first non-zero entry + let start = 0; + while (start < result.length && result[start] === 0) { + start++; + } - // If we started with zeros, strip them - if (start) { - result = result.slice(start); - } + // If we started with zeros, strip them + if (start) { + result = result.slice(start); + } - return result; + return result; } export function arrayify( - value: BytesLike | Hexable | number, - options?: DataOptions, + value: BytesLike | Hexable | number, + options?: DataOptions, ): Uint8Array { - if (!options) { - options = {}; - } - - if (typeof value === "number") { - logger.checkSafeUint53(value, "invalid arrayify value"); - const result: any = []; - while (value) { - // @ts-ignore - result.unshift(value & 0xff); - value = parseInt(String(value / 256)); - } - if (result.length === 0) { - result.push(0); - } - - return addSlice(new Uint8Array(result)); - } - if ( - options.allowMissingPrefix && - typeof value === "string" && - value.substring(0, 2) !== "0x" - ) { - value = "0x" + value; - } - if (isHexable(value)) { - value = value.toHexString(); - } - if (isHexString(value)) { - let hex = (value).substring(2); - if (hex.length % 2) { - if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); - } else if (options.hexPad === "right") { - hex += "0"; - } else { - logger.throwArgumentError("hex data is odd-length", "value", value); - } - } - - const result = []; - for (let i = 0; i < hex.length; i += 2) { - // @ts-ignore - result.push(parseInt(hex.substring(i, i + 2), 16)); - } - - return addSlice(new Uint8Array(result)); - } - - if (isBytes(value)) { - return addSlice(new Uint8Array(value)); - } - - return logger.throwArgumentError("invalid arrayify value", "value", value); -} -function addSlice(array: Uint8Array): Uint8Array { - // @ts-ignore - if (array.slice) { - return array; - } - - array.slice = function () { - const args: any = Array.prototype.slice.call(arguments); - return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args))); - }; - - return array; + if (!options) { + options = {}; + } + + if (typeof value === "number") { + logger.checkSafeUint53(value, "invalid arrayify value"); + const result: any = []; + while (value) { + // @ts-ignore + result.unshift(value & 0xff); + value = parseInt(String(value / 256)); + } + if (result.length === 0) { + result.push(0); + } + + return new Uint8Array(result); + } + if ( + options.allowMissingPrefix && + typeof value === "string" && + value.substring(0, 2) !== "0x" + ) { + value = "0x" + value; + } + if (isHexable(value)) { + value = value.toHexString(); + } + if (isHexString(value)) { + let hex = (value).substring(2); + if (hex.length % 2) { + if (options.hexPad === "left") { + hex = "0x0" + hex.substring(2); + } else if (options.hexPad === "right") { + hex += "0"; + } else { + logger.throwArgumentError("hex data is odd-length", "value", value); + } + } + + const result = []; + for (let i = 0; i < hex.length; i += 2) { + // @ts-ignore + result.push(parseInt(hex.substring(i, i + 2), 16)); + } + + return new Uint8Array(result); + } + + if (isBytes(value)) { + return new Uint8Array(value); + } + + return logger.throwArgumentError("invalid arrayify value", "value", value); } export function hexConcat(items: ReadonlyArray): string { - let result = "0x"; - items.forEach((item) => { - result += hexlify(item).substring(2); - }); - return result; + let result = "0x"; + items.forEach((item) => { + result += hexlify(item).substring(2); + }); + return result; } diff --git a/src.ts/utils/errors.ts b/src.ts/utils/errors.ts index a7a0f8db6..a7e8fc0d2 100644 --- a/src.ts/utils/errors.ts +++ b/src.ts/utils/errors.ts @@ -9,9 +9,9 @@ import { version } from "../_version.js"; import { defineProperties } from "./properties.js"; import type { - TransactionRequest, - TransactionReceipt, - TransactionResponse, + TransactionRequest, + TransactionReceipt, + TransactionResponse, } from "../providers/index.js"; import type { FetchRequest, FetchResponse } from "./fetch.js"; @@ -19,50 +19,50 @@ import type { FetchRequest, FetchResponse } from "./fetch.js"; export type ErrorInfo = Omit; function stringify(value: any): any { - if (value == null) { - return "null"; - } - - if (Array.isArray(value)) { - return "[ " + value.map(stringify).join(", ") + " ]"; - } - - if (value instanceof Uint8Array) { - const HEX = "0123456789abcdef"; - let result = "0x"; - for (let i = 0; i < value.length; i++) { - result += HEX[value[i] >> 4]; - result += HEX[value[i] & 0xf]; - } - return result; - } - - if (typeof value === "object" && typeof value.toJSON === "function") { - return stringify(value.toJSON()); - } - - switch (typeof value) { - case "boolean": - case "symbol": - return value.toString(); - case "bigint": - return BigInt(value).toString(); - case "number": - return value.toString(); - case "string": - return JSON.stringify(value); - case "object": { - const keys = Object.keys(value); - keys.sort(); - return ( - "{ " + - keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + - " }" - ); - } - } - - return `[ COULD NOT SERIALIZE ]`; + if (value == null) { + return "null"; + } + + if (Array.isArray(value)) { + return "[ " + value.map(stringify).join(", ") + " ]"; + } + + if (value instanceof Uint8Array) { + const HEX = "0123456789abcdef"; + let result = "0x"; + for (let i = 0; i < value.length; i++) { + result += HEX[value[i] >> 4]; + result += HEX[value[i] & 0xf]; + } + return result; + } + + if (typeof value === "object" && typeof value.toJSON === "function") { + return stringify(value.toJSON()); + } + + switch (typeof value) { + case "boolean": + case "symbol": + return value.toString(); + case "bigint": + return BigInt(value).toString(); + case "number": + return value.toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return ( + "{ " + + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + + " }" + ); + } + } + + return `[ COULD NOT SERIALIZE ]`; } /** @@ -127,59 +127,59 @@ function stringify(value: any): any { * **``"ACTION_REJECTED"``** - see [[ActionRejectedError]] */ export type ErrorCode = - // Generic Errors - | "UNKNOWN_ERROR" - | "NOT_IMPLEMENTED" - | "UNSUPPORTED_OPERATION" - | "NETWORK_ERROR" - | "SERVER_ERROR" - | "TIMEOUT" - | "BAD_DATA" - | "CANCELLED" - - // Operational Errors - | "BUFFER_OVERRUN" - | "NUMERIC_FAULT" - - // Argument Errors - | "INVALID_ARGUMENT" - | "MISSING_ARGUMENT" - | "UNEXPECTED_ARGUMENT" - | "VALUE_MISMATCH" - - // Blockchain Errors - | "CALL_EXCEPTION" - | "INSUFFICIENT_FUNDS" - | "NONCE_EXPIRED" - | "REPLACEMENT_UNDERPRICED" - | "TRANSACTION_REPLACED" - | "UNCONFIGURED_NAME" - | "OFFCHAIN_FAULT" - - // User Interaction - | "ACTION_REJECTED"; + // Generic Errors + | "UNKNOWN_ERROR" + | "NOT_IMPLEMENTED" + | "UNSUPPORTED_OPERATION" + | "NETWORK_ERROR" + | "SERVER_ERROR" + | "TIMEOUT" + | "BAD_DATA" + | "CANCELLED" + + // Operational Errors + | "BUFFER_OVERRUN" + | "NUMERIC_FAULT" + + // Argument Errors + | "INVALID_ARGUMENT" + | "MISSING_ARGUMENT" + | "UNEXPECTED_ARGUMENT" + | "VALUE_MISMATCH" + + // Blockchain Errors + | "CALL_EXCEPTION" + | "INSUFFICIENT_FUNDS" + | "NONCE_EXPIRED" + | "REPLACEMENT_UNDERPRICED" + | "TRANSACTION_REPLACED" + | "UNCONFIGURED_NAME" + | "OFFCHAIN_FAULT" + + // User Interaction + | "ACTION_REJECTED"; /** * All errors in corebc include properties to assist in * machine-readable errors. */ export interface CoreBCError extends Error { - /** - * The string error code. - */ - code: ErrorCode; - - /** - * Additional info regarding the error that may be useful. - * - * This is generally helpful mostly for human-based debugging. - */ - info?: Record; - - /** - * Any related error. - */ - error?: Error; + /** + * The string error code. + */ + code: ErrorCode; + + /** + * Additional info regarding the error that may be useful. + * + * This is generally helpful mostly for human-based debugging. + */ + info?: Record; + + /** + * Any related error. + */ + error?: Error; } // Generic Errors @@ -189,7 +189,7 @@ export interface CoreBCError extends Error { * know what the underlying problem is. */ export interface UnknownError extends CoreBCError<"UNKNOWN_ERROR"> { - [key: string]: any; + [key: string]: any; } /** @@ -197,10 +197,10 @@ export interface UnknownError extends CoreBCError<"UNKNOWN_ERROR"> { * intended for the future, but is currently not implemented. */ export interface NotImplementedError extends CoreBCError<"NOT_IMPLEMENTED"> { - /** - * The attempted operation. - */ - operation: string; + /** + * The attempted operation. + */ + operation: string; } /** @@ -213,16 +213,15 @@ export interface NotImplementedError extends CoreBCError<"NOT_IMPLEMENTED"> { * For example, a [[Wallet]] with no connected [[Provider]] is unable * to send a transaction. */ -export interface UnsupportedOperationError - extends CoreBCError<"UNSUPPORTED_OPERATION"> { - /** - * The attempted operation. - */ - operation: string; +export interface UnsupportedOperationError extends CoreBCError<"UNSUPPORTED_OPERATION"> { + /** + * The attempted operation. + */ + operation: string; } export interface NetworkError extends CoreBCError<"NETWORK_ERROR"> { - event: string; + event: string; } /** @@ -230,15 +229,15 @@ export interface NetworkError extends CoreBCError<"NETWORK_ERROR"> { * a server. */ export interface ServerError extends CoreBCError<"SERVER_ERROR"> { - /** - * The requested resource. - */ - request: FetchRequest | string; - - /** - * The response received from the server, if available. - */ - response?: FetchResponse; + /** + * The requested resource. + */ + request: FetchRequest | string; + + /** + * The response received from the server, if available. + */ + response?: FetchResponse; } /** @@ -250,20 +249,20 @@ export interface ServerError extends CoreBCError<"SERVER_ERROR"> { * been no response to indicate whether it was processed or not. */ export interface TimeoutError extends CoreBCError<"TIMEOUT"> { - /** - * The attempted operation. - */ - operation: string; - - /** - * The reason. - */ - reason: string; - - /** - * The resource request, if available. - */ - request?: FetchRequest; + /** + * The attempted operation. + */ + operation: string; + + /** + * The reason. + */ + reason: string; + + /** + * The resource request, if available. + */ + request?: FetchRequest; } /** @@ -271,10 +270,10 @@ export interface TimeoutError extends CoreBCError<"TIMEOUT"> { * be correctly interpretted. */ export interface BadDataError extends CoreBCError<"BAD_DATA"> { - /** - * The data. - */ - value: any; + /** + * The data. + */ + value: any; } /** @@ -293,20 +292,20 @@ export interface CancelledError extends CoreBCError<"CANCELLED"> {} * exploits when parsing data. */ export interface BufferOverrunError extends CoreBCError<"BUFFER_OVERRUN"> { - /** - * The buffer that was overrun. - */ - buffer: Uint8Array; - - /** - * The length of the buffer. - */ - length: number; - - /** - * The offset that was requested. - */ - offset: number; + /** + * The buffer that was overrun. + */ + buffer: Uint8Array; + + /** + * The length of the buffer. + */ + length: number; + + /** + * The offset that was requested. + */ + offset: number; } /** @@ -317,20 +316,20 @@ export interface BufferOverrunError extends CoreBCError<"BUFFER_OVERRUN"> { * a negative value. */ export interface NumericFaultError extends CoreBCError<"NUMERIC_FAULT"> { - /** - * The attempted operation. - */ - operation: string; - - /** - * The fault reported. - */ - fault: string; - - /** - * The value the operation was attempted against. - */ - value: any; + /** + * The attempted operation. + */ + operation: string; + + /** + * The fault reported. + */ + fault: string; + + /** + * The value the operation was attempted against. + */ + value: any; } // Argument Errors @@ -340,48 +339,47 @@ export interface NumericFaultError extends CoreBCError<"NUMERIC_FAULT"> { * a function or method. */ export interface InvalidArgumentError extends CoreBCError<"INVALID_ARGUMENT"> { - /** - * The name of the argument. - */ - argument: string; + /** + * The name of the argument. + */ + argument: string; - /** - * The value that was provided. - */ - value: any; + /** + * The value that was provided. + */ + value: any; - info?: Record; + info?: Record; } /** * This Error indicates there were too few arguments were provided. */ export interface MissingArgumentError extends CoreBCError<"MISSING_ARGUMENT"> { - /** - * The number of arguments received. - */ - count: number; - - /** - * The number of arguments expected. - */ - expectedCount: number; + /** + * The number of arguments received. + */ + count: number; + + /** + * The number of arguments expected. + */ + expectedCount: number; } /** * This Error indicates too many arguments were provided. */ -export interface UnexpectedArgumentError - extends CoreBCError<"UNEXPECTED_ARGUMENT"> { - /** - * The number of arguments received. - */ - count: number; - - /** - * The number of arguments expected. - */ - expectedCount: number; +export interface UnexpectedArgumentError extends CoreBCError<"UNEXPECTED_ARGUMENT"> { + /** + * The number of arguments received. + */ + count: number; + + /** + * The number of arguments expected. + */ + expectedCount: number; } // Blockchain Errors @@ -390,73 +388,69 @@ export interface UnexpectedArgumentError * The action that resulted in the error. */ export type CallExceptionAction = - | "call" - | "estimateEnergy" - | "getTransactionResult" - | "unknown"; + "call" | "estimateEnergy" | "getTransactionResult" | "unknown"; /** * The related transaction that caused the error. */ export type CallExceptionTransaction = { - to: null | string; - from?: string; - data: string; + to: null | string; + from?: string; + data: string; }; /** * This **Error** indicates a transaction reverted. */ export interface CallExceptionError extends CoreBCError<"CALL_EXCEPTION"> { - /** - * The action being performed when the revert was encountered. - */ - action: CallExceptionAction; - - /** - * The revert data returned. - */ - data: null | string; - - /** - * A human-readable representation of data, if possible. - */ - reason: null | string; - - /** - * The transaction that triggered the exception. - */ - transaction: CallExceptionTransaction; - - /** - * The contract invocation details, if available. - */ - invocation: null | { - method: string; - signature: string; - args: Array; - }; - - /** - * The built-in or custom revert error, if available - */ - revert: null | { - signature: string; - name: string; - args: Array; - }; + /** + * The action being performed when the revert was encountered. + */ + action: CallExceptionAction; + + /** + * The revert data returned. + */ + data: null | string; + + /** + * A human-readable representation of data, if possible. + */ + reason: null | string; + + /** + * The transaction that triggered the exception. + */ + transaction: CallExceptionTransaction; + + /** + * The contract invocation details, if available. + */ + invocation: null | { + method: string; + signature: string; + args: Array; + }; + + /** + * The built-in or custom revert error, if available + */ + revert: null | { + signature: string; + name: string; + args: Array; + }; } /** * The sending account has insufficient funds to cover the * entire transaction cost. */ -export interface InsufficientFundsError - extends CoreBCError<"INSUFFICIENT_FUNDS"> { - /** - * The transaction. - */ - transaction: TransactionRequest; +export interface InsufficientFundsError extends CoreBCError<"INSUFFICIENT_FUNDS"> { + /** + * The transaction. + */ + transaction: TransactionRequest; } /** @@ -464,10 +458,10 @@ export interface InsufficientFundsError * transaction that has been included. */ export interface NonceExpiredError extends CoreBCError<"NONCE_EXPIRED"> { - /** - * The transaction. - */ - transaction: TransactionRequest; + /** + * The transaction. + */ + transaction: TransactionRequest; } /** @@ -475,15 +469,15 @@ export interface NonceExpiredError extends CoreBCError<"NONCE_EXPIRED"> { * be further processed. */ export interface OffchainFaultError extends CoreBCError<"OFFCHAIN_FAULT"> { - /** - * The transaction. - */ - transaction?: TransactionRequest; - - /** - * The reason the CCIP-read failed. - */ - reason: string; + /** + * The transaction. + */ + transaction?: TransactionRequest; + + /** + * The reason the CCIP-read failed. + */ + reason: string; } /** @@ -491,44 +485,42 @@ export interface OffchainFaultError extends CoreBCError<"OFFCHAIN_FAULT"> { * insufficient additional fee to afford evicting the old * transaction from the memory pool. */ -export interface ReplacementUnderpricedError - extends CoreBCError<"REPLACEMENT_UNDERPRICED"> { - /** - * The transaction. - */ - transaction: TransactionRequest; +export interface ReplacementUnderpricedError extends CoreBCError<"REPLACEMENT_UNDERPRICED"> { + /** + * The transaction. + */ + transaction: TransactionRequest; } /** * A pending transaction was replaced by another. */ -export interface TransactionReplacedError - extends CoreBCError<"TRANSACTION_REPLACED"> { - /** - * If the transaction was cancelled, such that the original - * effects of the transaction cannot be assured. - */ - cancelled: boolean; - - /** - * The reason the transaction was replaced. - */ - reason: "repriced" | "cancelled" | "replaced"; - - /** - * The hash of the replaced transaction. - */ - hash: string; - - /** - * The transaction that replaced the transaction. - */ - replacement: TransactionResponse; - - /** - * The receipt of the transaction that replace the transaction. - */ - receipt: TransactionReceipt; +export interface TransactionReplacedError extends CoreBCError<"TRANSACTION_REPLACED"> { + /** + * If the transaction was cancelled, such that the original + * effects of the transaction cannot be assured. + */ + cancelled: boolean; + + /** + * The reason the transaction was replaced. + */ + reason: "repriced" | "cancelled" | "replaced"; + + /** + * The hash of the replaced transaction. + */ + hash: string; + + /** + * The transaction that replaced the transaction. + */ + replacement: TransactionResponse; + + /** + * The receipt of the transaction that replace the transaction. + */ + receipt: TransactionReceipt; } /** @@ -538,12 +530,11 @@ export interface TransactionReplacedError * This could indicate an ENS name is unowned or that the current * address being pointed to is the [[ZeroAddress]]. */ -export interface UnconfiguredNameError - extends CoreBCError<"UNCONFIGURED_NAME"> { - /** - * The ENS name that was requested - */ - value: string; +export interface UnconfiguredNameError extends CoreBCError<"UNCONFIGURED_NAME"> { + /** + * The ENS name that was requested + */ + value: string; } /** @@ -555,25 +546,25 @@ export interface UnconfiguredNameError * this error is thrown. */ export interface ActionRejectedError extends CoreBCError<"ACTION_REJECTED"> { - /** - * The requested action. - */ - action: - | "requestAccess" - | "sendTransaction" - | "signMessage" - | "signTransaction" - | "signTypedData" - | "unknown"; - - /** - * The reason the action was rejected. - * - * If there is already a pending request, some clients may indicate - * there is already a ``"pending"`` action. This prevents an app - * from spamming the user. - */ - reason: "expired" | "rejected" | "pending"; + /** + * The requested action. + */ + action: + | "requestAccess" + | "sendTransaction" + | "signMessage" + | "signTransaction" + | "signTypedData" + | "unknown"; + + /** + * The reason the action was rejected. + * + * If there is already a pending request, some clients may indicate + * there is already a ``"pending"`` action. This prevents an app + * from spamming the user. + */ + reason: "expired" | "rejected" | "pending"; } // Coding; converts an ErrorCode its Typed Error @@ -585,48 +576,48 @@ export interface ActionRejectedError extends CoreBCError<"ACTION_REJECTED"> { * @flatworm-skip-docs */ export type CodedCoreBCError = T extends "UNKNOWN_ERROR" - ? UnknownError - : T extends "NOT_IMPLEMENTED" - ? NotImplementedError - : T extends "UNSUPPORTED_OPERATION" - ? UnsupportedOperationError - : T extends "NETWORK_ERROR" - ? NetworkError - : T extends "SERVER_ERROR" - ? ServerError - : T extends "TIMEOUT" - ? TimeoutError - : T extends "BAD_DATA" - ? BadDataError - : T extends "CANCELLED" - ? CancelledError - : T extends "BUFFER_OVERRUN" - ? BufferOverrunError - : T extends "NUMERIC_FAULT" - ? NumericFaultError - : T extends "INVALID_ARGUMENT" - ? InvalidArgumentError - : T extends "MISSING_ARGUMENT" - ? MissingArgumentError - : T extends "UNEXPECTED_ARGUMENT" - ? UnexpectedArgumentError - : T extends "CALL_EXCEPTION" - ? CallExceptionError - : T extends "INSUFFICIENT_FUNDS" - ? InsufficientFundsError - : T extends "NONCE_EXPIRED" - ? NonceExpiredError - : T extends "OFFCHAIN_FAULT" - ? OffchainFaultError - : T extends "REPLACEMENT_UNDERPRICED" - ? ReplacementUnderpricedError - : T extends "TRANSACTION_REPLACED" - ? TransactionReplacedError - : T extends "UNCONFIGURED_NAME" - ? UnconfiguredNameError - : T extends "ACTION_REJECTED" - ? ActionRejectedError - : never; + ? UnknownError + : T extends "NOT_IMPLEMENTED" + ? NotImplementedError + : T extends "UNSUPPORTED_OPERATION" + ? UnsupportedOperationError + : T extends "NETWORK_ERROR" + ? NetworkError + : T extends "SERVER_ERROR" + ? ServerError + : T extends "TIMEOUT" + ? TimeoutError + : T extends "BAD_DATA" + ? BadDataError + : T extends "CANCELLED" + ? CancelledError + : T extends "BUFFER_OVERRUN" + ? BufferOverrunError + : T extends "NUMERIC_FAULT" + ? NumericFaultError + : T extends "INVALID_ARGUMENT" + ? InvalidArgumentError + : T extends "MISSING_ARGUMENT" + ? MissingArgumentError + : T extends "UNEXPECTED_ARGUMENT" + ? UnexpectedArgumentError + : T extends "CALL_EXCEPTION" + ? CallExceptionError + : T extends "INSUFFICIENT_FUNDS" + ? InsufficientFundsError + : T extends "NONCE_EXPIRED" + ? NonceExpiredError + : T extends "OFFCHAIN_FAULT" + ? OffchainFaultError + : T extends "REPLACEMENT_UNDERPRICED" + ? ReplacementUnderpricedError + : T extends "TRANSACTION_REPLACED" + ? TransactionReplacedError + : T extends "UNCONFIGURED_NAME" + ? UnconfiguredNameError + : T extends "ACTION_REJECTED" + ? ActionRejectedError + : never; /** * Returns true if the %%error%% matches an error thrown by corebc @@ -648,17 +639,17 @@ export type CodedCoreBCError = T extends "UNKNOWN_ERROR" * } */ export function isError>( - error: any, - code: K, + error: any, + code: K, ): error is T { - return error && (error).code === code; + return error && (error).code === code; } /** * Returns true if %%error%% is a [[CallExceptionError]. */ export function isCallException(error: any): error is CallExceptionError { - return isError(error, "CALL_EXCEPTION"); + return isError(error, "CALL_EXCEPTION"); } /** @@ -672,56 +663,56 @@ export function isCallException(error: any): error is CallExceptionError { * corebc version, %%code%% and all aditional properties, serialized. */ export function makeError>( - message: string, - code: K, - info?: ErrorInfo, + message: string, + code: K, + info?: ErrorInfo, ): T { - { - const details: Array = []; - if (info) { - if ("message" in info || "code" in info || "name" in info) { - throw new Error( - `value will overwrite populated values: ${stringify(info)}`, - ); - } - for (const key in info) { - const value = info[>key]; - // try { - details.push(key + "=" + stringify(value)); - // } catch (error: any) { - // console.log("MMM", error.message); - // details.push(key + "=[could not serialize object]"); - // } - } - } - details.push(`code=${code}`); - details.push(`version=${version}`); - - if (details.length) { - message += " (" + details.join(", ") + ")"; - } - } - - let error; - switch (code) { - case "INVALID_ARGUMENT": - error = new TypeError(message); - break; - case "NUMERIC_FAULT": - case "BUFFER_OVERRUN": - error = new RangeError(message); - break; - default: - error = new Error(message); - } - - defineProperties(error, { code }); - - if (info) { - Object.assign(error, info); - } - - return error; + { + const details: Array = []; + if (info) { + if ("message" in info || "code" in info || "name" in info) { + throw new Error( + `value will overwrite populated values: ${stringify(info)}`, + ); + } + for (const key in info) { + const value = info[>key]; + // try { + details.push(key + "=" + stringify(value)); + // } catch (error: any) { + // console.log("MMM", error.message); + // details.push(key + "=[could not serialize object]"); + // } + } + } + details.push(`code=${code}`); + details.push(`version=${version}`); + + if (details.length) { + message += " (" + details.join(", ") + ")"; + } + } + + let error; + switch (code) { + case "INVALID_ARGUMENT": + error = new TypeError(message); + break; + case "NUMERIC_FAULT": + case "BUFFER_OVERRUN": + error = new RangeError(message); + break; + default: + error = new Error(message); + } + + defineProperties(error, { code }); + + if (info) { + Object.assign(error, info); + } + + return error; } /** @@ -731,14 +722,14 @@ export function makeError>( * @see [[api:makeError]] */ export function assert>( - check: unknown, - message: string, - code: K, - info?: ErrorInfo, + check: unknown, + message: string, + code: K, + info?: ErrorInfo, ): asserts check { - if (!check) { - throw makeError(message, code, info); - } + if (!check) { + throw makeError(message, code, info); + } } /** @@ -749,88 +740,88 @@ export function assert>( * any further code does not need additional compile-time checks. */ export function assertArgument( - check: unknown, - message: string, - name: string, - value: unknown, + check: unknown, + message: string, + name: string, + value: unknown, ): asserts check { - assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); + assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); } export function assertArgumentCount( - count: number, - expectedCount: number, - message?: string, + count: number, + expectedCount: number, + message?: string, ): void { - if (message == null) { - message = ""; - } - if (message) { - message = ": " + message; - } - - assert( - count >= expectedCount, - "missing arguemnt" + message, - "MISSING_ARGUMENT", - { - count: count, - expectedCount: expectedCount, - }, - ); - - assert( - count <= expectedCount, - "too many arguemnts" + message, - "UNEXPECTED_ARGUMENT", - { - count: count, - expectedCount: expectedCount, - }, - ); + if (message == null) { + message = ""; + } + if (message) { + message = ": " + message; + } + + assert( + count >= expectedCount, + "missing arguemnt" + message, + "MISSING_ARGUMENT", + { + count: count, + expectedCount: expectedCount, + }, + ); + + assert( + count <= expectedCount, + "too many arguemnts" + message, + "UNEXPECTED_ARGUMENT", + { + count: count, + expectedCount: expectedCount, + }, + ); } const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce( - (accum, form) => { - try { - // General test for normalize - /* c8 ignore start */ - if ("test".normalize(form) !== "test") { - throw new Error("bad"); - } - /* c8 ignore stop */ - - if (form === "NFD") { - const check = String.fromCharCode(0xe9).normalize("NFD"); - const expected = String.fromCharCode(0x65, 0x0301); - /* c8 ignore start */ - if (check !== expected) { - throw new Error("broken"); - } - /* c8 ignore stop */ - } - - accum.push(form); - } catch (error) {} - - return accum; - }, - >[], + (accum, form) => { + try { + // General test for normalize + /* c8 ignore start */ + if ("test".normalize(form) !== "test") { + throw new Error("bad"); + } + /* c8 ignore stop */ + + if (form === "NFD") { + const check = String.fromCharCode(0xe9).normalize("NFD"); + const expected = String.fromCharCode(0x65, 0x0301); + /* c8 ignore start */ + if (check !== expected) { + throw new Error("broken"); + } + /* c8 ignore stop */ + } + + accum.push(form); + } catch (error) {} + + return accum; + }, + >[], ); /** * Throws if the normalization %%form%% is not supported. */ export function assertNormalize(form: string): void { - assert( - _normalizeForms.indexOf(form) >= 0, - "platform missing String.prototype.normalize", - "UNSUPPORTED_OPERATION", - { - operation: "String.prototype.normalize", - info: { form }, - }, - ); + assert( + _normalizeForms.indexOf(form) >= 0, + "platform missing String.prototype.normalize", + "UNSUPPORTED_OPERATION", + { + operation: "String.prototype.normalize", + info: { form }, + }, + ); } /** @@ -840,27 +831,27 @@ export function assertNormalize(form: string): void { * throwing if not, indicating the %%className%% if provided. */ export function assertPrivate( - givenGuard: any, - guard: any, - className?: string, + givenGuard: any, + guard: any, + className?: string, ): void { - if (className == null) { - className = ""; - } - if (givenGuard !== guard) { - let method = className, - operation = "new"; - if (className) { - method += "."; - operation += " " + className; - } - assert( - false, - `private constructor; use ${method}from* methods`, - "UNSUPPORTED_OPERATION", - { - operation, - }, - ); - } + if (className == null) { + className = ""; + } + if (givenGuard !== guard) { + let method = className, + operation = "new"; + if (className) { + method += "."; + operation += " " + className; + } + assert( + false, + `private constructor; use ${method}from* methods`, + "UNSUPPORTED_OPERATION", + { + operation, + }, + ); + } } diff --git a/src.ts/utils/events.ts b/src.ts/utils/events.ts index 5b453e332..f58fb676f 100644 --- a/src.ts/utils/events.ts +++ b/src.ts/utils/events.ts @@ -17,53 +17,53 @@ export type Listener = (...args: Array) => void; * An EventEmitter implements the observer pattern. */ export interface EventEmitterable { - /** - * Registers a %%listener%% that is called whenever the - * %%event%% occurs until unregistered. - */ - on(event: T, listener: Listener): Promise; + /** + * Registers a %%listener%% that is called whenever the + * %%event%% occurs until unregistered. + */ + on(event: T, listener: Listener): Promise; - /** - * Registers a %%listener%% that is called the next time - * %%event%% occurs. - */ - once(event: T, listener: Listener): Promise; + /** + * Registers a %%listener%% that is called the next time + * %%event%% occurs. + */ + once(event: T, listener: Listener): Promise; - /** - * Triggers each listener for %%event%% with the %%args%%. - */ - emit(event: T, ...args: Array): Promise; + /** + * Triggers each listener for %%event%% with the %%args%%. + */ + emit(event: T, ...args: Array): Promise; - /** - * Resolves to the number of listeners for %%event%%. - */ - listenerCount(event?: T): Promise; + /** + * Resolves to the number of listeners for %%event%%. + */ + listenerCount(event?: T): Promise; - /** - * Resolves to the listeners for %%event%%. - */ - listeners(event?: T): Promise>; + /** + * Resolves to the listeners for %%event%%. + */ + listeners(event?: T): Promise>; - /** - * Unregister the %%listener%% for %%event%%. If %%listener%% - * is unspecified, all listeners are unregistered. - */ - off(event: T, listener?: Listener): Promise; + /** + * Unregister the %%listener%% for %%event%%. If %%listener%% + * is unspecified, all listeners are unregistered. + */ + off(event: T, listener?: Listener): Promise; - /** - * Unregister all listeners for %%event%%. - */ - removeAllListeners(event?: T): Promise; + /** + * Unregister all listeners for %%event%%. + */ + removeAllListeners(event?: T): Promise; - /** - * Alias for [[on]]. - */ - addListener(event: T, listener: Listener): Promise; + /** + * Alias for [[on]]. + */ + addListener(event: T, listener: Listener): Promise; - /** - * Alias for [[off]]. - */ - removeListener(event: T, listener: Listener): Promise; + /** + * Alias for [[off]]. + */ + removeListener(event: T, listener: Listener): Promise; } /** @@ -72,38 +72,38 @@ export interface EventEmitterable { * an **EventPayload**. */ export class EventPayload { - /** - * The event filter. - */ - readonly filter!: T; + /** + * The event filter. + */ + readonly filter!: T; - /** - * The **EventEmitterable**. - */ - readonly emitter!: EventEmitterable; + /** + * The **EventEmitterable**. + */ + readonly emitter!: EventEmitterable; - readonly #listener: null | Listener; + readonly #listener: null | Listener; - /** - * Create a new **EventPayload** for %%emitter%% with - * the %%listener%% and for %%filter%%. - */ - constructor( - emitter: EventEmitterable, - listener: null | Listener, - filter: T, - ) { - this.#listener = listener; - defineProperties>(this, { emitter, filter }); - } + /** + * Create a new **EventPayload** for %%emitter%% with + * the %%listener%% and for %%filter%%. + */ + constructor( + emitter: EventEmitterable, + listener: null | Listener, + filter: T, + ) { + this.#listener = listener; + defineProperties>(this, { emitter, filter }); + } - /** - * Unregister the triggered listener for future events. - */ - async removeListener(): Promise { - if (this.#listener == null) { - return; - } - await this.emitter.off(this.filter, this.#listener); - } + /** + * Unregister the triggered listener for future events. + */ + async removeListener(): Promise { + if (this.#listener == null) { + return; + } + await this.emitter.off(this.filter, this.#listener); + } } diff --git a/src.ts/utils/fetch.ts b/src.ts/utils/fetch.ts index 9fb1a9413..30dbca120 100644 --- a/src.ts/utils/fetch.ts +++ b/src.ts/utils/fetch.ts @@ -12,15 +12,15 @@ import { toUtf8Bytes, toUtf8String } from "./utf8.js"; import { getUrl } from "./geturl.js"; export type GetUrlResponse = { - statusCode: number; - statusMessage: string; - headers: Record; - body: null | Uint8Array; + statusCode: number; + statusMessage: string; + headers: Record; + body: null | Uint8Array; }; export type FetchThrottleParams = { - maxAttempts?: number; - slotInterval?: number; + maxAttempts?: number; + slotInterval?: number; }; /** * Called before any network request, allowing updated headers (e.g. Bearer tokens), etc. @@ -31,25 +31,25 @@ export type FetchPreflightFunc = (req: FetchRequest) => Promise; * Called on the response, allowing client-based throttling logic or post-processing. */ export type FetchProcessFunc = ( - req: FetchRequest, - resp: FetchResponse, + req: FetchRequest, + resp: FetchResponse, ) => Promise; /** * Called prior to each retry; return true to retry, false to abort. */ export type FetchRetryFunc = ( - req: FetchRequest, - resp: FetchResponse, - attempt: number, + req: FetchRequest, + resp: FetchResponse, + attempt: number, ) => Promise; /** * Called on Gateway URLs. */ export type FetchGatewayFunc = ( - url: string, - signal?: FetchCancelSignal, + url: string, + signal?: FetchCancelSignal, ) => Promise; /** @@ -59,8 +59,8 @@ export type FetchGatewayFunc = ( * how you would register it. */ export type FetchGetUrlFunc = ( - req: FetchRequest, - signal?: FetchCancelSignal, + req: FetchRequest, + signal?: FetchCancelSignal, ) => Promise; const MAX_ATTEMPTS = 12; @@ -77,31 +77,31 @@ let locked = false; // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs async function dataGatewayFunc( - url: string, - signal?: FetchCancelSignal, + url: string, + signal?: FetchCancelSignal, ): Promise { - try { - const match = url.match(reData); - if (!match) { - throw new Error("invalid data"); - } - return new FetchResponse( - 200, - "OK", - { - "content-type": match[1] || "text/plain", - }, - match[2] ? decodeBase64(match[3]) : unpercent(match[3]), - ); - } catch (error) { - return new FetchResponse( - 599, - "BAD REQUEST (invalid data: URI)", - {}, - null, - new FetchRequest(url), - ); - } + try { + const match = url.match(reData); + if (!match) { + throw new Error("invalid data"); + } + return new FetchResponse( + 200, + "OK", + { + "content-type": match[1] || "text/plain", + }, + match[2] ? decodeBase64(match[3]) : unpercent(match[3]), + ); + } catch (error) { + return new FetchResponse( + 599, + "BAD REQUEST (invalid data: URI)", + {}, + null, + new FetchRequest(url), + ); + } } /** @@ -109,33 +109,33 @@ async function dataGatewayFunc( * IPFS gateway hosted at %%baseUrl%%. */ function getIpfsGatewayFunc(baseUrl: string): FetchGatewayFunc { - async function gatewayIpfs( - url: string, - signal?: FetchCancelSignal, - ): Promise { - try { - const match = url.match(reIpfs); - if (!match) { - throw new Error("invalid link"); - } - return new FetchRequest(`${baseUrl}${match[2]}`); - } catch (error) { - return new FetchResponse( - 599, - "BAD REQUEST (invalid IPFS URI)", - {}, - null, - new FetchRequest(url), - ); - } - } - - return gatewayIpfs; + async function gatewayIpfs( + url: string, + signal?: FetchCancelSignal, + ): Promise { + try { + const match = url.match(reIpfs); + if (!match) { + throw new Error("invalid link"); + } + return new FetchRequest(`${baseUrl}${match[2]}`); + } catch (error) { + return new FetchResponse( + 599, + "BAD REQUEST (invalid IPFS URI)", + {}, + null, + new FetchRequest(url), + ); + } + } + + return gatewayIpfs; } const Gateways: Record = { - data: dataGatewayFunc, - ipfs: getIpfsGatewayFunc("https://gateway.ipfs.io/ipfs/"), + data: dataGatewayFunc, + ipfs: getIpfsGatewayFunc("https://gateway.ipfs.io/ipfs/"), }; const fetchSignals: WeakMap void> = new WeakMap(); @@ -144,56 +144,56 @@ const fetchSignals: WeakMap void> = new WeakMap(); * @_ignore */ export class FetchCancelSignal { - #listeners: Array<() => void>; - #cancelled: boolean; - - constructor(request: FetchRequest) { - this.#listeners = []; - this.#cancelled = false; - - fetchSignals.set(request, () => { - if (this.#cancelled) { - return; - } - this.#cancelled = true; - - for (const listener of this.#listeners) { - setTimeout(() => { - listener(); - }, 0); - } - this.#listeners = []; - }); - } - - addListener(listener: () => void): void { - assert( - !this.#cancelled, - "singal already cancelled", - "UNSUPPORTED_OPERATION", - { - operation: "fetchCancelSignal.addCancelListener", - }, - ); - this.#listeners.push(listener); - } - - get cancelled(): boolean { - return this.#cancelled; - } - - checkSignal(): void { - assert(!this.cancelled, "cancelled", "CANCELLED", {}); - } + #listeners: Array<() => void>; + #cancelled: boolean; + + constructor(request: FetchRequest) { + this.#listeners = []; + this.#cancelled = false; + + fetchSignals.set(request, () => { + if (this.#cancelled) { + return; + } + this.#cancelled = true; + + for (const listener of this.#listeners) { + setTimeout(() => { + listener(); + }, 0); + } + this.#listeners = []; + }); + } + + addListener(listener: () => void): void { + assert( + !this.#cancelled, + "singal already cancelled", + "UNSUPPORTED_OPERATION", + { + operation: "fetchCancelSignal.addCancelListener", + }, + ); + this.#listeners.push(listener); + } + + get cancelled(): boolean { + return this.#cancelled; + } + + checkSignal(): void { + assert(!this.cancelled, "cancelled", "CANCELLED", {}); + } } // Check the signal, throwing if it is cancelled function checkSignal(signal?: FetchCancelSignal): FetchCancelSignal { - if (signal == null) { - throw new Error("missing signal; should not happen"); - } - signal.checkSignal(); - return signal; + if (signal == null) { + throw new Error("missing signal; should not happen"); + } + signal.checkSignal(); + return signal; } /** @@ -211,893 +211,893 @@ function checkSignal(signal?: FetchCancelSignal): FetchCancelSignal { * //_result: */ export class FetchRequest implements Iterable<[key: string, value: string]> { - #allowInsecure: boolean; - #gzip: boolean; - #headers: Record; - #method: string; - #timeout: number; - #url: string; - - #body?: Uint8Array; - #bodyType?: string; - #creds?: string; - - // Hooks - #preflight?: null | FetchPreflightFunc; - #process?: null | FetchProcessFunc; - #retry?: null | FetchRetryFunc; - - #signal?: FetchCancelSignal; - - #throttle: Required; - - /** - * The fetch URI to requrest. - */ - get url(): string { - return this.#url; - } - set url(url: string) { - this.#url = String(url); - } - - /** - * The fetch body, if any, to send as the request body. //(default: null)// - * - * When setting a body, the intrinsic ``Content-Type`` is automatically - * set and will be used if **not overridden** by setting a custom - * header. - * - * If %%body%% is null, the body is cleared (along with the - * intrinsic ``Content-Type``) and the . - * - * If %%body%% is a string, the intrincis ``Content-Type`` is set to - * ``text/plain``. - * - * If %%body%% is a Uint8Array, the intrincis ``Content-Type`` is set to - * ``application/octet-stream``. - * - * If %%body%% is any other object, the intrincis ``Content-Type`` is - * set to ``application/json``. - */ - get body(): null | Uint8Array { - if (this.#body == null) { - return null; - } - return new Uint8Array(this.#body); - } - set body(body: null | string | Readonly | Readonly) { - if (body == null) { - this.#body = undefined; - this.#bodyType = undefined; - } else if (typeof body === "string") { - this.#body = toUtf8Bytes(body); - this.#bodyType = "text/plain"; - } else if (body instanceof Uint8Array) { - this.#body = body; - this.#bodyType = "application/octet-stream"; - } else if (typeof body === "object") { - this.#body = toUtf8Bytes(JSON.stringify(body)); - this.#bodyType = "application/json"; - } else { - throw new Error("invalid body"); - } - } - - /** - * Returns true if the request has a body. - */ - hasBody(): this is FetchRequest & { body: Uint8Array } { - return this.#body != null; - } - - /** - * The HTTP method to use when requesting the URI. If no method - * has been explicitly set, then ``GET`` is used if the body is - * null and ``POST`` otherwise. - */ - get method(): string { - if (this.#method) { - return this.#method; - } - if (this.hasBody()) { - return "POST"; - } - return "GET"; - } - set method(method: null | string) { - if (method == null) { - method = ""; - } - this.#method = String(method).toUpperCase(); - } - - /** - * The headers that will be used when requesting the URI. All - * keys are lower-case. - * - * This object is a copy, so any chnages will **NOT** be reflected - * in the ``FetchRequest``. - * - * To set a header entry, use the ``setHeader`` method. - */ - get headers(): Record { - const headers = Object.assign({}, this.#headers); - - if (this.#creds) { - headers["authorization"] = `Basic ${encodeBase64( - toUtf8Bytes(this.#creds), - )}`; - } - - if (this.allowGzip) { - headers["accept-encoding"] = "gzip"; - } - - if (headers["content-type"] == null && this.#bodyType) { - headers["content-type"] = this.#bodyType; - } - if (this.body) { - headers["content-length"] = String(this.body.length); - } - - return headers; - } - - /** - * Get the header for %%key%%, ignoring case. - */ - getHeader(key: string): string { - return this.headers[key.toLowerCase()]; - } - - /** - * Set the header for %%key%% to %%value%%. All values are coerced - * to a string. - */ - setHeader(key: string, value: string | number): void { - this.#headers[String(key).toLowerCase()] = String(value); - } - - /** - * Clear all headers, resetting all intrinsic headers. - */ - clearHeaders(): void { - this.#headers = {}; - } - - [Symbol.iterator](): Iterator<[key: string, value: string]> { - const headers = this.headers; - const keys = Object.keys(headers); - let index = 0; - return { - next: () => { - if (index < keys.length) { - const key = keys[index++]; - return { - value: [key, headers[key]], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - - /** - * The value that will be sent for the ``Authorization`` header. - * - * To set the credentials, use the ``setCredentials`` method. - */ - get credentials(): null | string { - return this.#creds || null; - } - - /** - * Sets an ``Authorization`` for %%username%% with %%password%%. - */ - setCredentials(username: string, password: string): void { - assertArgument( - !username.match(/:/), - "invalid basic authentication username", - "username", - "[REDACTED]", - ); - this.#creds = `${username}:${password}`; - } - - /** - * Enable and request gzip-encoded responses. The response will - * automatically be decompressed. //(default: true)// - */ - get allowGzip(): boolean { - return this.#gzip; - } - set allowGzip(value: boolean) { - this.#gzip = !!value; - } - - /** - * Allow ``Authentication`` credentials to be sent over insecure - * channels. //(default: false)// - */ - get allowInsecureAuthentication(): boolean { - return !!this.#allowInsecure; - } - set allowInsecureAuthentication(value: boolean) { - this.#allowInsecure = !!value; - } - - /** - * The timeout (in milliseconds) to wait for a complere response. - * //(default: 5 minutes)// - */ - get timeout(): number { - return this.#timeout; - } - set timeout(timeout: number) { - assertArgument( - timeout >= 0, - "timeout must be non-zero", - "timeout", - timeout, - ); - this.#timeout = timeout; - } - - /** - * This function is called prior to each request, for example - * during a redirection or retry in case of server throttling. - * - * This offers an opportunity to populate headers or update - * content before sending a request. - */ - get preflightFunc(): null | FetchPreflightFunc { - return this.#preflight || null; - } - set preflightFunc(preflight: null | FetchPreflightFunc) { - this.#preflight = preflight; - } - - /** - * This function is called after each response, offering an - * opportunity to provide client-level throttling or updating - * response data. - * - * Any error thrown in this causes the ``send()`` to throw. - * - * To schedule a retry attempt (assuming the maximum retry limit - * has not been reached), use [[response.throwThrottleError]]. - */ - get processFunc(): null | FetchProcessFunc { - return this.#process || null; - } - set processFunc(process: null | FetchProcessFunc) { - this.#process = process; - } - - /** - * This function is called on each retry attempt. - */ - get retryFunc(): null | FetchRetryFunc { - return this.#retry || null; - } - set retryFunc(retry: null | FetchRetryFunc) { - this.#retry = retry; - } - - /** - * Create a new FetchRequest instance with default values. - * - * Once created, each property may be set before issuing a - * ``.send()`` to make the request. - */ - constructor(url: string) { - this.#url = String(url); - - this.#allowInsecure = false; - this.#gzip = true; - this.#headers = {}; - this.#method = ""; - this.#timeout = 300000; - - this.#throttle = { - slotInterval: SLOT_INTERVAL, - maxAttempts: MAX_ATTEMPTS, - }; - } - - toString(): string { - return ``; - } - - /** - * Update the throttle parameters used to determine maximum - * attempts and exponential-backoff properties. - */ - setThrottleParams(params: FetchThrottleParams): void { - if (params.slotInterval != null) { - this.#throttle.slotInterval = params.slotInterval; - } - if (params.maxAttempts != null) { - this.#throttle.maxAttempts = params.maxAttempts; - } - } - - async #send( - attempt: number, - expires: number, - delay: number, - _request: FetchRequest, - _response: FetchResponse, - ): Promise { - if (attempt >= this.#throttle.maxAttempts) { - return _response.makeServerError("exceeded maximum retry limit"); - } - - assert(getTime() <= expires, "timeout", "TIMEOUT", { - operation: "request.send", - reason: "timeout", - request: _request, - }); - - if (delay > 0) { - await wait(delay); - } - - let req = this.clone(); - const scheme = (req.url.split(":")[0] || "").toLowerCase(); - - // Process any Gateways - if (scheme in Gateways) { - const result = await Gateways[scheme]( - req.url, - checkSignal(_request.#signal), - ); - if (result instanceof FetchResponse) { - let response = result; - - if (this.processFunc) { - checkSignal(_request.#signal); - try { - response = await this.processFunc(req, response); - } catch (error: any) { - // Something went wrong during processing; throw a 5xx server error - if (error.throttle == null || typeof error.stall !== "number") { - response - .makeServerError("error in post-processing function", error) - .assertOk(); - } - - // Ignore throttling - } - } - - return response; - } - req = result; - } - - // We have a preflight function; update the request - if (this.preflightFunc) { - req = await this.preflightFunc(req); - } - - const resp = await getUrlFunc(req, checkSignal(_request.#signal)); - let response = new FetchResponse( - resp.statusCode, - resp.statusMessage, - resp.headers, - resp.body, - _request, - ); - - if (response.statusCode === 301 || response.statusCode === 302) { - // Redirect - try { - const location = response.headers.location || ""; - return req - .redirect(location) - .#send(attempt + 1, expires, 0, _request, response); - } catch (error) {} - - // Things won't get any better on another attempt; abort - return response; - } else if (response.statusCode === 429) { - // Throttle - if ( - this.retryFunc == null || - (await this.retryFunc(req, response, attempt)) - ) { - const retryAfter = response.headers["retry-after"]; - let delay = - this.#throttle.slotInterval * - Math.trunc(Math.random() * Math.pow(2, attempt)); - if ( - typeof retryAfter === "string" && - retryAfter.match(/^[1-9][0-9]*$/) - ) { - delay = parseInt(retryAfter); - } - return req - .clone() - .#send(attempt + 1, expires, delay, _request, response); - } - } - - if (this.processFunc) { - checkSignal(_request.#signal); - try { - response = await this.processFunc(req, response); - } catch (error: any) { - // Something went wrong during processing; throw a 5xx server error - if (error.throttle == null || typeof error.stall !== "number") { - response - .makeServerError("error in post-processing function", error) - .assertOk(); - } - - // Throttle - let delay = - this.#throttle.slotInterval * - Math.trunc(Math.random() * Math.pow(2, attempt)); - if (error.stall >= 0) { - delay = error.stall; - } - - return req - .clone() - .#send(attempt + 1, expires, delay, _request, response); - } - } - - return response; - } - - /** - * Resolves to the response by sending the request. - */ - send(): Promise { - assert( - this.#signal == null, - "request already sent", - "UNSUPPORTED_OPERATION", - { operation: "fetchRequest.send" }, - ); - this.#signal = new FetchCancelSignal(this); - return this.#send( - 0, - getTime() + this.timeout, - 0, - this, - new FetchResponse(0, "", {}, null, this), - ); - } - - /** - * Cancels the inflight response, causing a ``CANCELLED`` - * error to be rejected from the [[send]]. - */ - cancel(): void { - assert( - this.#signal != null, - "request has not been sent", - "UNSUPPORTED_OPERATION", - { operation: "fetchRequest.cancel" }, - ); - const signal = fetchSignals.get(this); - if (!signal) { - throw new Error("missing signal; should not happen"); - } - signal(); - } - - /** - * Returns a new [[FetchRequest]] that represents the redirection - * to %%location%%. - */ - redirect(location: string): FetchRequest { - // Redirection; for now we only support absolute locataions - const current = this.url.split(":")[0].toLowerCase(); - const target = location.split(":")[0].toLowerCase(); - - // Don't allow redirecting: - // - non-GET requests - // - downgrading the security (e.g. https => http) - // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?] - assert( - this.method === "GET" && - (current !== "https" || target !== "http") && - location.match(/^https?:/), - `unsupported redirect`, - "UNSUPPORTED_OPERATION", - { - operation: `redirect(${this.method} ${JSON.stringify( - this.url, - )} => ${JSON.stringify(location)})`, - }, - ); - - // Create a copy of this request, with a new URL - const req = new FetchRequest(location); - req.method = "GET"; - req.allowGzip = this.allowGzip; - req.timeout = this.timeout; - req.#headers = Object.assign({}, this.#headers); - if (this.#body) { - req.#body = new Uint8Array(this.#body); - } - req.#bodyType = this.#bodyType; - - // Do not forward credentials unless on the same domain; only absolute - //req.allowInsecure = false; - // paths are currently supported; may want a way to specify to forward? - //setStore(req.#props, "creds", getStore(this.#pros, "creds")); - - return req; - } - - /** - * Create a new copy of this request. - */ - clone(): FetchRequest { - const clone = new FetchRequest(this.url); - - // Preserve "default method" (i.e. null) - clone.#method = this.#method; - - // Preserve "default body" with type, copying the Uint8Array is present - if (this.#body) { - clone.#body = this.#body; - } - clone.#bodyType = this.#bodyType; - - // Preserve "default headers" - clone.#headers = Object.assign({}, this.#headers); - - // Credentials is readonly, so we copy internally - clone.#creds = this.#creds; - - if (this.allowGzip) { - clone.allowGzip = true; - } - - clone.timeout = this.timeout; - if (this.allowInsecureAuthentication) { - clone.allowInsecureAuthentication = true; - } - - clone.#preflight = this.#preflight; - clone.#process = this.#process; - clone.#retry = this.#retry; - - return clone; - } - - /** - * Locks all static configuration for gateways and FetchGetUrlFunc - * registration. - */ - static lockConfig(): void { - locked = true; - } - - /** - * Get the current Gateway function for %%scheme%%. - */ - static getGateway(scheme: string): null | FetchGatewayFunc { - return Gateways[scheme.toLowerCase()] || null; - } - - /** - * Use the %%func%% when fetching URIs using %%scheme%%. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGateway(scheme: string, func: FetchGatewayFunc): void { - scheme = scheme.toLowerCase(); - if (scheme === "http" || scheme === "https") { - throw new Error(`cannot intercept ${scheme}; use registerGetUrl`); - } - if (locked) { - throw new Error("gateways locked"); - } - Gateways[scheme] = func; - } - - /** - * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGetUrl(getUrl: FetchGetUrlFunc): void { - if (locked) { - throw new Error("gateways locked"); - } - getUrlFunc = getUrl; - } - - /** - * Creates a function that can "fetch" data URIs. - * - * Note that this is automatically done internally to support - * data URIs, so it is not necessary to register it. - * - * This is not generally something that is needed, but may - * be useful in a wrapper to perfom custom data URI functionality. - */ - static createDataGateway(): FetchGatewayFunc { - return dataGatewayFunc; - } - - /** - * Creates a function that will fetch IPFS (unvalidated) from - * a custom gateway baseUrl. - * - * The default IPFS gateway used internally is - * ``"https:/\/gateway.ipfs.io/ipfs/"``. - */ - static createIpfsGatewayFunc(baseUrl: string): FetchGatewayFunc { - return getIpfsGatewayFunc(baseUrl); - } + #allowInsecure: boolean; + #gzip: boolean; + #headers: Record; + #method: string; + #timeout: number; + #url: string; + + #body?: Uint8Array; + #bodyType?: string; + #creds?: string; + + // Hooks + #preflight?: null | FetchPreflightFunc; + #process?: null | FetchProcessFunc; + #retry?: null | FetchRetryFunc; + + #signal?: FetchCancelSignal; + + #throttle: Required; + + /** + * The fetch URI to requrest. + */ + get url(): string { + return this.#url; + } + set url(url: string) { + this.#url = String(url); + } + + /** + * The fetch body, if any, to send as the request body. //(default: null)// + * + * When setting a body, the intrinsic ``Content-Type`` is automatically + * set and will be used if **not overridden** by setting a custom + * header. + * + * If %%body%% is null, the body is cleared (along with the + * intrinsic ``Content-Type``) and the . + * + * If %%body%% is a string, the intrincis ``Content-Type`` is set to + * ``text/plain``. + * + * If %%body%% is a Uint8Array, the intrincis ``Content-Type`` is set to + * ``application/octet-stream``. + * + * If %%body%% is any other object, the intrincis ``Content-Type`` is + * set to ``application/json``. + */ + get body(): null | Uint8Array { + if (this.#body == null) { + return null; + } + return new Uint8Array(this.#body); + } + set body(body: null | string | Readonly | Readonly) { + if (body == null) { + this.#body = undefined; + this.#bodyType = undefined; + } else if (typeof body === "string") { + this.#body = toUtf8Bytes(body); + this.#bodyType = "text/plain"; + } else if (body instanceof Uint8Array) { + this.#body = body; + this.#bodyType = "application/octet-stream"; + } else if (typeof body === "object") { + this.#body = toUtf8Bytes(JSON.stringify(body)); + this.#bodyType = "application/json"; + } else { + throw new Error("invalid body"); + } + } + + /** + * Returns true if the request has a body. + */ + hasBody(): this is FetchRequest & { body: Uint8Array } { + return this.#body != null; + } + + /** + * The HTTP method to use when requesting the URI. If no method + * has been explicitly set, then ``GET`` is used if the body is + * null and ``POST`` otherwise. + */ + get method(): string { + if (this.#method) { + return this.#method; + } + if (this.hasBody()) { + return "POST"; + } + return "GET"; + } + set method(method: null | string) { + if (method == null) { + method = ""; + } + this.#method = String(method).toUpperCase(); + } + + /** + * The headers that will be used when requesting the URI. All + * keys are lower-case. + * + * This object is a copy, so any chnages will **NOT** be reflected + * in the ``FetchRequest``. + * + * To set a header entry, use the ``setHeader`` method. + */ + get headers(): Record { + const headers = Object.assign({}, this.#headers); + + if (this.#creds) { + headers["authorization"] = `Basic ${encodeBase64( + toUtf8Bytes(this.#creds), + )}`; + } + + if (this.allowGzip) { + headers["accept-encoding"] = "gzip"; + } + + if (headers["content-type"] == null && this.#bodyType) { + headers["content-type"] = this.#bodyType; + } + if (this.body) { + headers["content-length"] = String(this.body.length); + } + + return headers; + } + + /** + * Get the header for %%key%%, ignoring case. + */ + getHeader(key: string): string { + return this.headers[key.toLowerCase()]; + } + + /** + * Set the header for %%key%% to %%value%%. All values are coerced + * to a string. + */ + setHeader(key: string, value: string | number): void { + this.#headers[String(key).toLowerCase()] = String(value); + } + + /** + * Clear all headers, resetting all intrinsic headers. + */ + clearHeaders(): void { + this.#headers = {}; + } + + [Symbol.iterator](): Iterator<[key: string, value: string]> { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [key, headers[key]], + done: false, + }; + } + return { value: undefined, done: true }; + }, + }; + } + + /** + * The value that will be sent for the ``Authorization`` header. + * + * To set the credentials, use the ``setCredentials`` method. + */ + get credentials(): null | string { + return this.#creds || null; + } + + /** + * Sets an ``Authorization`` for %%username%% with %%password%%. + */ + setCredentials(username: string, password: string): void { + assertArgument( + !username.match(/:/), + "invalid basic authentication username", + "username", + "[REDACTED]", + ); + this.#creds = `${username}:${password}`; + } + + /** + * Enable and request gzip-encoded responses. The response will + * automatically be decompressed. //(default: true)// + */ + get allowGzip(): boolean { + return this.#gzip; + } + set allowGzip(value: boolean) { + this.#gzip = !!value; + } + + /** + * Allow ``Authentication`` credentials to be sent over insecure + * channels. //(default: false)// + */ + get allowInsecureAuthentication(): boolean { + return !!this.#allowInsecure; + } + set allowInsecureAuthentication(value: boolean) { + this.#allowInsecure = !!value; + } + + /** + * The timeout (in milliseconds) to wait for a complere response. + * //(default: 5 minutes)// + */ + get timeout(): number { + return this.#timeout; + } + set timeout(timeout: number) { + assertArgument( + timeout >= 0, + "timeout must be non-zero", + "timeout", + timeout, + ); + this.#timeout = timeout; + } + + /** + * This function is called prior to each request, for example + * during a redirection or retry in case of server throttling. + * + * This offers an opportunity to populate headers or update + * content before sending a request. + */ + get preflightFunc(): null | FetchPreflightFunc { + return this.#preflight || null; + } + set preflightFunc(preflight: null | FetchPreflightFunc) { + this.#preflight = preflight; + } + + /** + * This function is called after each response, offering an + * opportunity to provide client-level throttling or updating + * response data. + * + * Any error thrown in this causes the ``send()`` to throw. + * + * To schedule a retry attempt (assuming the maximum retry limit + * has not been reached), use [[response.throwThrottleError]]. + */ + get processFunc(): null | FetchProcessFunc { + return this.#process || null; + } + set processFunc(process: null | FetchProcessFunc) { + this.#process = process; + } + + /** + * This function is called on each retry attempt. + */ + get retryFunc(): null | FetchRetryFunc { + return this.#retry || null; + } + set retryFunc(retry: null | FetchRetryFunc) { + this.#retry = retry; + } + + /** + * Create a new FetchRequest instance with default values. + * + * Once created, each property may be set before issuing a + * ``.send()`` to make the request. + */ + constructor(url: string) { + this.#url = String(url); + + this.#allowInsecure = false; + this.#gzip = true; + this.#headers = {}; + this.#method = ""; + this.#timeout = 300000; + + this.#throttle = { + slotInterval: SLOT_INTERVAL, + maxAttempts: MAX_ATTEMPTS, + }; + } + + toString(): string { + return ``; + } + + /** + * Update the throttle parameters used to determine maximum + * attempts and exponential-backoff properties. + */ + setThrottleParams(params: FetchThrottleParams): void { + if (params.slotInterval != null) { + this.#throttle.slotInterval = params.slotInterval; + } + if (params.maxAttempts != null) { + this.#throttle.maxAttempts = params.maxAttempts; + } + } + + async #send( + attempt: number, + expires: number, + delay: number, + _request: FetchRequest, + _response: FetchResponse, + ): Promise { + if (attempt >= this.#throttle.maxAttempts) { + return _response.makeServerError("exceeded maximum retry limit"); + } + + assert(getTime() <= expires, "timeout", "TIMEOUT", { + operation: "request.send", + reason: "timeout", + request: _request, + }); + + if (delay > 0) { + await wait(delay); + } + + let req = this.clone(); + const scheme = (req.url.split(":")[0] || "").toLowerCase(); + + // Process any Gateways + if (scheme in Gateways) { + const result = await Gateways[scheme]( + req.url, + checkSignal(_request.#signal), + ); + if (result instanceof FetchResponse) { + let response = result; + + if (this.processFunc) { + checkSignal(_request.#signal); + try { + response = await this.processFunc(req, response); + } catch (error: any) { + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof error.stall !== "number") { + response + .makeServerError("error in post-processing function", error) + .assertOk(); + } + + // Ignore throttling + } + } + + return response; + } + req = result; + } + + // We have a preflight function; update the request + if (this.preflightFunc) { + req = await this.preflightFunc(req); + } + + const resp = await getUrlFunc(req, checkSignal(_request.#signal)); + let response = new FetchResponse( + resp.statusCode, + resp.statusMessage, + resp.headers, + resp.body, + _request, + ); + + if (response.statusCode === 301 || response.statusCode === 302) { + // Redirect + try { + const location = response.headers.location || ""; + return req + .redirect(location) + .#send(attempt + 1, expires, 0, _request, response); + } catch (error) {} + + // Things won't get any better on another attempt; abort + return response; + } else if (response.statusCode === 429) { + // Throttle + if ( + this.retryFunc == null || + (await this.retryFunc(req, response, attempt)) + ) { + const retryAfter = response.headers["retry-after"]; + let delay = + this.#throttle.slotInterval * + Math.trunc(Math.random() * Math.pow(2, attempt)); + if ( + typeof retryAfter === "string" && + retryAfter.match(/^[1-9][0-9]*$/) + ) { + delay = parseInt(retryAfter); + } + return req + .clone() + .#send(attempt + 1, expires, delay, _request, response); + } + } + + if (this.processFunc) { + checkSignal(_request.#signal); + try { + response = await this.processFunc(req, response); + } catch (error: any) { + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof error.stall !== "number") { + response + .makeServerError("error in post-processing function", error) + .assertOk(); + } + + // Throttle + let delay = + this.#throttle.slotInterval * + Math.trunc(Math.random() * Math.pow(2, attempt)); + if (error.stall >= 0) { + delay = error.stall; + } + + return req + .clone() + .#send(attempt + 1, expires, delay, _request, response); + } + } + + return response; + } + + /** + * Resolves to the response by sending the request. + */ + send(): Promise { + assert( + this.#signal == null, + "request already sent", + "UNSUPPORTED_OPERATION", + { operation: "fetchRequest.send" }, + ); + this.#signal = new FetchCancelSignal(this); + return this.#send( + 0, + getTime() + this.timeout, + 0, + this, + new FetchResponse(0, "", {}, null, this), + ); + } + + /** + * Cancels the inflight response, causing a ``CANCELLED`` + * error to be rejected from the [[send]]. + */ + cancel(): void { + assert( + this.#signal != null, + "request has not been sent", + "UNSUPPORTED_OPERATION", + { operation: "fetchRequest.cancel" }, + ); + const signal = fetchSignals.get(this); + if (!signal) { + throw new Error("missing signal; should not happen"); + } + signal(); + } + + /** + * Returns a new [[FetchRequest]] that represents the redirection + * to %%location%%. + */ + redirect(location: string): FetchRequest { + // Redirection; for now we only support absolute locataions + const current = this.url.split(":")[0].toLowerCase(); + const target = location.split(":")[0].toLowerCase(); + + // Don't allow redirecting: + // - non-GET requests + // - downgrading the security (e.g. https => http) + // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?] + assert( + this.method === "GET" && + (current !== "https" || target !== "http") && + location.match(/^https?:/), + `unsupported redirect`, + "UNSUPPORTED_OPERATION", + { + operation: `redirect(${this.method} ${JSON.stringify( + this.url, + )} => ${JSON.stringify(location)})`, + }, + ); + + // Create a copy of this request, with a new URL + const req = new FetchRequest(location); + req.method = "GET"; + req.allowGzip = this.allowGzip; + req.timeout = this.timeout; + req.#headers = Object.assign({}, this.#headers); + if (this.#body) { + req.#body = new Uint8Array(this.#body); + } + req.#bodyType = this.#bodyType; + + // Do not forward credentials unless on the same domain; only absolute + //req.allowInsecure = false; + // paths are currently supported; may want a way to specify to forward? + //setStore(req.#props, "creds", getStore(this.#pros, "creds")); + + return req; + } + + /** + * Create a new copy of this request. + */ + clone(): FetchRequest { + const clone = new FetchRequest(this.url); + + // Preserve "default method" (i.e. null) + clone.#method = this.#method; + + // Preserve "default body" with type, copying the Uint8Array is present + if (this.#body) { + clone.#body = this.#body; + } + clone.#bodyType = this.#bodyType; + + // Preserve "default headers" + clone.#headers = Object.assign({}, this.#headers); + + // Credentials is readonly, so we copy internally + clone.#creds = this.#creds; + + if (this.allowGzip) { + clone.allowGzip = true; + } + + clone.timeout = this.timeout; + if (this.allowInsecureAuthentication) { + clone.allowInsecureAuthentication = true; + } + + clone.#preflight = this.#preflight; + clone.#process = this.#process; + clone.#retry = this.#retry; + + return clone; + } + + /** + * Locks all static configuration for gateways and FetchGetUrlFunc + * registration. + */ + static lockConfig(): void { + locked = true; + } + + /** + * Get the current Gateway function for %%scheme%%. + */ + static getGateway(scheme: string): null | FetchGatewayFunc { + return Gateways[scheme.toLowerCase()] || null; + } + + /** + * Use the %%func%% when fetching URIs using %%scheme%%. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGateway(scheme: string, func: FetchGatewayFunc): void { + scheme = scheme.toLowerCase(); + if (scheme === "http" || scheme === "https") { + throw new Error(`cannot intercept ${scheme}; use registerGetUrl`); + } + if (locked) { + throw new Error("gateways locked"); + } + Gateways[scheme] = func; + } + + /** + * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGetUrl(getUrl: FetchGetUrlFunc): void { + if (locked) { + throw new Error("gateways locked"); + } + getUrlFunc = getUrl; + } + + /** + * Creates a function that can "fetch" data URIs. + * + * Note that this is automatically done internally to support + * data URIs, so it is not necessary to register it. + * + * This is not generally something that is needed, but may + * be useful in a wrapper to perfom custom data URI functionality. + */ + static createDataGateway(): FetchGatewayFunc { + return dataGatewayFunc; + } + + /** + * Creates a function that will fetch IPFS (unvalidated) from + * a custom gateway baseUrl. + * + * The default IPFS gateway used internally is + * ``"https:/\/gateway.ipfs.io/ipfs/"``. + */ + static createIpfsGatewayFunc(baseUrl: string): FetchGatewayFunc { + return getIpfsGatewayFunc(baseUrl); + } } interface ThrottleError extends Error { - stall: number; - throttle: true; + stall: number; + throttle: true; } /** * The response for a FetchREquest. */ export class FetchResponse implements Iterable<[key: string, value: string]> { - #statusCode: number; - #statusMessage: string; - #headers: Record; - #body: null | Readonly; - #request: null | FetchRequest; - - #error: { error?: Error; message: string }; - - toString(): string { - return ``; - } - - /** - * The response status code. - */ - get statusCode(): number { - return this.#statusCode; - } - - /** - * The response status message. - */ - get statusMessage(): string { - return this.#statusMessage; - } - - /** - * The response headers. All keys are lower-case. - */ - get headers(): Record { - return Object.assign({}, this.#headers); - } - - /** - * The response body, or ``null`` if there was no body. - */ - get body(): null | Readonly { - return this.#body == null ? null : new Uint8Array(this.#body); - } - - /** - * The response body as a UTF-8 encoded string, or the empty - * string (i.e. ``""``) if there was no body. - * - * An error is thrown if the body is invalid UTF-8 data. - */ - get bodyText(): string { - try { - return this.#body == null ? "" : toUtf8String(this.#body); - } catch (error) { - assert( - false, - "response body is not valid UTF-8 data", - "UNSUPPORTED_OPERATION", - { - operation: "bodyText", - info: { response: this }, - }, - ); - } - } - - /** - * The response body, decoded as JSON. - * - * An error is thrown if the body is invalid JSON-encoded data - * or if there was no body. - */ - get bodyJson(): any { - try { - return JSON.parse(this.bodyText); - } catch (error) { - assert( - false, - "response body is not valid JSON", - "UNSUPPORTED_OPERATION", - { - operation: "bodyJson", - info: { response: this }, - }, - ); - } - } - - [Symbol.iterator](): Iterator<[key: string, value: string]> { - const headers = this.headers; - const keys = Object.keys(headers); - let index = 0; - return { - next: () => { - if (index < keys.length) { - const key = keys[index++]; - return { - value: [key, headers[key]], - done: false, - }; - } - return { value: undefined, done: true }; - }, - }; - } - - constructor( - statusCode: number, - statusMessage: string, - headers: Readonly>, - body: null | Uint8Array, - request?: FetchRequest, - ) { - this.#statusCode = statusCode; - this.#statusMessage = statusMessage; - this.#headers = Object.keys(headers).reduce( - (accum, k) => { - accum[k.toLowerCase()] = String(headers[k]); - return accum; - }, - >{}, - ); - this.#body = body == null ? null : new Uint8Array(body); - this.#request = request || null; - - this.#error = { message: "" }; - } - - /** - * Return a Response with matching headers and body, but with - * an error status code (i.e. 599) and %%message%% with an - * optional %%error%%. - */ - makeServerError(message?: string, error?: Error): FetchResponse { - let statusMessage: string; - if (!message) { - message = `${this.statusCode} ${this.statusMessage}`; - statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`; - } else { - statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; - } - const response = new FetchResponse( - 599, - statusMessage, - this.headers, - this.body, - this.#request || undefined, - ); - response.#error = { message, error }; - return response; - } - - /** - * If called within a [request.processFunc](FetchRequest-processFunc) - * call, causes the request to retry as if throttled for %%stall%% - * milliseconds. - */ - throwThrottleError(message?: string, stall?: number): never { - if (stall == null) { - stall = -1; - } else { - assertArgument( - Number.isInteger(stall) && stall >= 0, - "invalid stall timeout", - "stall", - stall, - ); - } - - const error = new Error(message || "throttling requests"); - - defineProperties(error, { stall, throttle: true }); - - throw error; - } - - /** - * Get the header value for %%key%%, ignoring case. - */ - getHeader(key: string): string { - return this.headers[key.toLowerCase()]; - } - - /** - * Returns true of the response has a body. - */ - hasBody(): this is FetchResponse & { body: Uint8Array } { - return this.#body != null; - } - - /** - * The request made for this response. - */ - get request(): null | FetchRequest { - return this.#request; - } - - /** - * Returns true if this response was a success statusCode. - */ - ok(): boolean { - return ( - this.#error.message === "" && - this.statusCode >= 200 && - this.statusCode < 300 - ); - } - - /** - * Throws a ``SERVER_ERROR`` if this response is not ok. - */ - assertOk(): void { - if (this.ok()) { - return; - } - let { message, error } = this.#error; - if (message === "") { - message = `server response ${this.statusCode} ${this.statusMessage}`; - } - assert(false, message, "SERVER_ERROR", { - request: this.request || "unknown request", - response: this, - error, - }); - } + #statusCode: number; + #statusMessage: string; + #headers: Record; + #body: null | Readonly; + #request: null | FetchRequest; + + #error: { error?: Error; message: string }; + + toString(): string { + return ``; + } + + /** + * The response status code. + */ + get statusCode(): number { + return this.#statusCode; + } + + /** + * The response status message. + */ + get statusMessage(): string { + return this.#statusMessage; + } + + /** + * The response headers. All keys are lower-case. + */ + get headers(): Record { + return Object.assign({}, this.#headers); + } + + /** + * The response body, or ``null`` if there was no body. + */ + get body(): null | Readonly { + return this.#body == null ? null : new Uint8Array(this.#body); + } + + /** + * The response body as a UTF-8 encoded string, or the empty + * string (i.e. ``""``) if there was no body. + * + * An error is thrown if the body is invalid UTF-8 data. + */ + get bodyText(): string { + try { + return this.#body == null ? "" : toUtf8String(this.#body); + } catch (error) { + assert( + false, + "response body is not valid UTF-8 data", + "UNSUPPORTED_OPERATION", + { + operation: "bodyText", + info: { response: this }, + }, + ); + } + } + + /** + * The response body, decoded as JSON. + * + * An error is thrown if the body is invalid JSON-encoded data + * or if there was no body. + */ + get bodyJson(): any { + try { + return JSON.parse(this.bodyText); + } catch (error) { + assert( + false, + "response body is not valid JSON", + "UNSUPPORTED_OPERATION", + { + operation: "bodyJson", + info: { response: this }, + }, + ); + } + } + + [Symbol.iterator](): Iterator<[key: string, value: string]> { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [key, headers[key]], + done: false, + }; + } + return { value: undefined, done: true }; + }, + }; + } + + constructor( + statusCode: number, + statusMessage: string, + headers: Readonly>, + body: null | Uint8Array, + request?: FetchRequest, + ) { + this.#statusCode = statusCode; + this.#statusMessage = statusMessage; + this.#headers = Object.keys(headers).reduce( + (accum, k) => { + accum[k.toLowerCase()] = String(headers[k]); + return accum; + }, + >{}, + ); + this.#body = body == null ? null : new Uint8Array(body); + this.#request = request || null; + + this.#error = { message: "" }; + } + + /** + * Return a Response with matching headers and body, but with + * an error status code (i.e. 599) and %%message%% with an + * optional %%error%%. + */ + makeServerError(message?: string, error?: Error): FetchResponse { + let statusMessage: string; + if (!message) { + message = `${this.statusCode} ${this.statusMessage}`; + statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`; + } else { + statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; + } + const response = new FetchResponse( + 599, + statusMessage, + this.headers, + this.body, + this.#request || undefined, + ); + response.#error = { message, error }; + return response; + } + + /** + * If called within a [request.processFunc](FetchRequest-processFunc) + * call, causes the request to retry as if throttled for %%stall%% + * milliseconds. + */ + throwThrottleError(message?: string, stall?: number): never { + if (stall == null) { + stall = -1; + } else { + assertArgument( + Number.isInteger(stall) && stall >= 0, + "invalid stall timeout", + "stall", + stall, + ); + } + + const error = new Error(message || "throttling requests"); + + defineProperties(error, { stall, throttle: true }); + + throw error; + } + + /** + * Get the header value for %%key%%, ignoring case. + */ + getHeader(key: string): string { + return this.headers[key.toLowerCase()]; + } + + /** + * Returns true of the response has a body. + */ + hasBody(): this is FetchResponse & { body: Uint8Array } { + return this.#body != null; + } + + /** + * The request made for this response. + */ + get request(): null | FetchRequest { + return this.#request; + } + + /** + * Returns true if this response was a success statusCode. + */ + ok(): boolean { + return ( + this.#error.message === "" && + this.statusCode >= 200 && + this.statusCode < 300 + ); + } + + /** + * Throws a ``SERVER_ERROR`` if this response is not ok. + */ + assertOk(): void { + if (this.ok()) { + return; + } + let { message, error } = this.#error; + if (message === "") { + message = `server response ${this.statusCode} ${this.statusMessage}`; + } + assert(false, message, "SERVER_ERROR", { + request: this.request || "unknown request", + response: this, + error, + }); + } } function getTime(): number { - return new Date().getTime(); + return new Date().getTime(); } function unpercent(value: string): Uint8Array { - return toUtf8Bytes( - value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { - return String.fromCharCode(parseInt(code, 16)); - }), - ); + return toUtf8Bytes( + value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { + return String.fromCharCode(parseInt(code, 16)); + }), + ); } function wait(delay: number): Promise { - return new Promise((resolve) => setTimeout(resolve, delay)); + return new Promise((resolve) => setTimeout(resolve, delay)); } diff --git a/src.ts/utils/fixednumber.ts b/src.ts/utils/fixednumber.ts index dc9ad98b9..9260077a2 100644 --- a/src.ts/utils/fixednumber.ts +++ b/src.ts/utils/fixednumber.ts @@ -20,16 +20,16 @@ const _guard = {}; // Constant to pull zeros from for multipliers let Zeros = "0000"; while (Zeros.length < 80) { - Zeros += Zeros; + Zeros += Zeros; } // Returns a string "1" followed by decimal "0"s function getTens(decimals: number): bigint { - let result = Zeros; - while (result.length < decimals) { - result += result; - } - return BigInt("1" + result.substring(0, decimals)); + let result = Zeros; + while (result.length < decimals) { + result += result; + } + return BigInt("1" + result.substring(0, decimals)); } /* @@ -73,158 +73,158 @@ function getTens(decimals: number): bigint { * The bit-width must be byte aligned and the decimals can be at most 80. */ export type FixedFormat = - | number - | string - | { - signed?: boolean; - width?: number; - decimals?: number; - }; + | number + | string + | { + signed?: boolean; + width?: number; + decimals?: number; + }; function checkValue( - val: bigint, - format: _FixedFormat, - safeOp?: string, + val: bigint, + format: _FixedFormat, + safeOp?: string, ): bigint { - const width = BigInt(format.width); - if (format.signed) { - const limit = BN_1 << (width - BN_1); - assert( - safeOp == null || (val >= -limit && val < limit), - "overflow", - "NUMERIC_FAULT", - { - operation: safeOp, - fault: "overflow", - value: val, - }, - ); - - if (val > BN_0) { - val = fromTwos(mask(val, width), width); - } else { - val = -fromTwos(mask(-val, width), width); - } - } else { - const limit = BN_1 << width; - assert( - safeOp == null || (val >= 0 && val < limit), - "overflow", - "NUMERIC_FAULT", - { - operation: safeOp, - fault: "overflow", - value: val, - }, - ); - val = ((val % limit) + limit) % limit & (limit - BN_1); - } - - return val; + const width = BigInt(format.width); + if (format.signed) { + const limit = BN_1 << (width - BN_1); + assert( + safeOp == null || (val >= -limit && val < limit), + "overflow", + "NUMERIC_FAULT", + { + operation: safeOp, + fault: "overflow", + value: val, + }, + ); + + if (val > BN_0) { + val = fromTwos(mask(val, width), width); + } else { + val = -fromTwos(mask(-val, width), width); + } + } else { + const limit = BN_1 << width; + assert( + safeOp == null || (val >= 0 && val < limit), + "overflow", + "NUMERIC_FAULT", + { + operation: safeOp, + fault: "overflow", + value: val, + }, + ); + val = (((val % limit) + limit) % limit) & (limit - BN_1); + } + + return val; } type _FixedFormat = { - signed: boolean; - width: number; - decimals: number; - name: string; + signed: boolean; + width: number; + decimals: number; + name: string; }; function getFormat(value?: FixedFormat): _FixedFormat { - if (typeof value === "number") { - value = `fixed128x${value}`; - } - - let signed = true; - let width = 128; - let decimals = 18; - - if (typeof value === "string") { - // Parse the format string - if (value === "fixed") { - // defaults... - } else if (value === "ufixed") { - signed = false; - } else { - const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); - assertArgument(match, "invalid fixed format", "format", value); - signed = match[1] !== "u"; - width = parseInt(match[2]); - decimals = parseInt(match[3]); - } - } else if (value) { - // Extract the values from the object - const v: any = value; - const check = (key: string, type: string, defaultValue: any): any => { - if (v[key] == null) { - return defaultValue; - } - assertArgument( - typeof v[key] === type, - "invalid fixed format (" + key + " not " + type + ")", - "format." + key, - v[key], - ); - return v[key]; - }; - signed = check("signed", "boolean", signed); - width = check("width", "number", width); - decimals = check("decimals", "number", decimals); - } - - assertArgument( - width % 8 === 0, - "invalid FixedNumber width (not byte aligned)", - "format.width", - width, - ); - assertArgument( - decimals <= 80, - "invalid FixedNumber decimals (too large)", - "format.decimals", - decimals, - ); - - const name = - (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); - - return { signed, width, decimals, name }; + if (typeof value === "number") { + value = `fixed128x${value}`; + } + + let signed = true; + let width = 128; + let decimals = 18; + + if (typeof value === "string") { + // Parse the format string + if (value === "fixed") { + // defaults... + } else if (value === "ufixed") { + signed = false; + } else { + const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); + assertArgument(match, "invalid fixed format", "format", value); + signed = match[1] !== "u"; + width = parseInt(match[2]); + decimals = parseInt(match[3]); + } + } else if (value) { + // Extract the values from the object + const v: any = value; + const check = (key: string, type: string, defaultValue: any): any => { + if (v[key] == null) { + return defaultValue; + } + assertArgument( + typeof v[key] === type, + "invalid fixed format (" + key + " not " + type + ")", + "format." + key, + v[key], + ); + return v[key]; + }; + signed = check("signed", "boolean", signed); + width = check("width", "number", width); + decimals = check("decimals", "number", decimals); + } + + assertArgument( + width % 8 === 0, + "invalid FixedNumber width (not byte aligned)", + "format.width", + width, + ); + assertArgument( + decimals <= 80, + "invalid FixedNumber decimals (too large)", + "format.decimals", + decimals, + ); + + const name = + (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); + + return { signed, width, decimals, name }; } function toString(val: bigint, decimals: number) { - let negative = ""; - if (val < BN_0) { - negative = "-"; - val *= BN_N1; - } - - let str = val.toString(); - - // No decimal point for whole values - if (decimals === 0) { - return negative + str; - } - - // Pad out to the whole component (including a whole digit) - while (str.length <= decimals) { - str = Zeros + str; - } - - // Insert the decimal point - const index = str.length - decimals; - str = str.substring(0, index) + "." + str.substring(index); - - // Trim the whole component (leaving at least one 0) - while (str[0] === "0" && str[1] !== ".") { - str = str.substring(1); - } - - // Trim the decimal component (leaving at least one 0) - while (str[str.length - 1] === "0" && str[str.length - 2] !== ".") { - str = str.substring(0, str.length - 1); - } - - return negative + str; + let negative = ""; + if (val < BN_0) { + negative = "-"; + val *= BN_N1; + } + + let str = val.toString(); + + // No decimal point for whole values + if (decimals === 0) { + return negative + str; + } + + // Pad out to the whole component (including a whole digit) + while (str.length <= decimals) { + str = Zeros + str; + } + + // Insert the decimal point + const index = str.length - decimals; + str = str.substring(0, index) + "." + str.substring(index); + + // Trim the whole component (leaving at least one 0) + while (str[0] === "0" && str[1] !== ".") { + str = str.substring(1); + } + + // Trim the decimal component (leaving at least one 0) + while (str[str.length - 1] === "0" && str[str.length - 2] !== ".") { + str = str.substring(0, str.length - 1); + } + + return negative + str; } /** @@ -263,88 +263,88 @@ function toString(val: bigint, decimals: number) { * will thow a [[NumericFaultError]] on underflow. */ export class FixedNumber { - /** - * The specific fixed-point arithmetic field for this value. - */ - readonly format!: string; - - readonly #format: _FixedFormat; - - // The actual value (accounting for decimals) - #val: bigint; - - // A base-10 value to multiple values by to maintain the magnitude - readonly #tens: bigint; - - /** - * This is a property so console.log shows a human-meaningful value. - * - * @private - */ - readonly _value!: string; - - // Use this when changing this file to get some typing info, - // but then switch to any to mask the internal type - //constructor(guard: any, value: bigint, format: _FixedFormat) { - - /** - * @private - */ - constructor(guard: any, value: bigint, format: any) { - assertPrivate(guard, _guard, "FixedNumber"); - - this.#val = value; - - this.#format = format; - - const _value = toString(value, format.decimals); - - defineProperties(this, { format: format.name, _value }); - - this.#tens = getTens(format.decimals); - } - - /** - * If true, negative values are permitted, otherwise only - * positive values and zero are allowed. - */ - get signed(): boolean { - return this.#format.signed; - } - - /** - * The number of bits available to store the value. - */ - get width(): number { - return this.#format.width; - } - - /** - * The number of decimal places in the fixed-point arithment field. - */ - get decimals(): number { - return this.#format.decimals; - } - - /** - * The value as an integer, based on the smallest unit the - * [[decimals]] allow. - */ - get value(): bigint { - return this.#val; - } - - #checkFormat(other: FixedNumber): void { - assertArgument( - this.format === other.format, - "incompatible format; use fixedNumber.toFormat", - "other", - other, - ); - } - - #checkValue(val: bigint, safeOp?: string): FixedNumber { - /* + /** + * The specific fixed-point arithmetic field for this value. + */ + readonly format!: string; + + readonly #format: _FixedFormat; + + // The actual value (accounting for decimals) + #val: bigint; + + // A base-10 value to multiple values by to maintain the magnitude + readonly #tens: bigint; + + /** + * This is a property so console.log shows a human-meaningful value. + * + * @private + */ + readonly _value!: string; + + // Use this when changing this file to get some typing info, + // but then switch to any to mask the internal type + //constructor(guard: any, value: bigint, format: _FixedFormat) { + + /** + * @private + */ + constructor(guard: any, value: bigint, format: any) { + assertPrivate(guard, _guard, "FixedNumber"); + + this.#val = value; + + this.#format = format; + + const _value = toString(value, format.decimals); + + defineProperties(this, { format: format.name, _value }); + + this.#tens = getTens(format.decimals); + } + + /** + * If true, negative values are permitted, otherwise only + * positive values and zero are allowed. + */ + get signed(): boolean { + return this.#format.signed; + } + + /** + * The number of bits available to store the value. + */ + get width(): number { + return this.#format.width; + } + + /** + * The number of decimal places in the fixed-point arithment field. + */ + get decimals(): number { + return this.#format.decimals; + } + + /** + * The value as an integer, based on the smallest unit the + * [[decimals]] allow. + */ + get value(): bigint { + return this.#val; + } + + #checkFormat(other: FixedNumber): void { + assertArgument( + this.format === other.format, + "incompatible format; use fixedNumber.toFormat", + "other", + other, + ); + } + + #checkValue(val: bigint, safeOp?: string): FixedNumber { + /* const width = BigInt(this.width); if (this.signed) { const limit = (BN_1 << (width - BN_1)); @@ -366,421 +366,421 @@ export class FixedNumber { val = masked; } */ - val = checkValue(val, this.#format, safeOp); - return new FixedNumber(_guard, val, this.#format); - } - - #add(o: FixedNumber, safeOp?: string): FixedNumber { - this.#checkFormat(o); - return this.#checkValue(this.#val + o.#val, safeOp); - } - - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%, ignoring overflow. - */ - addUnsafe(other: FixedNumber): FixedNumber { - return this.#add(other); - } - - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - add(other: FixedNumber): FixedNumber { - return this.#add(other, "add"); - } - - #sub(o: FixedNumber, safeOp?: string): FixedNumber { - this.#checkFormat(o); - return this.#checkValue(this.#val - o.#val, safeOp); - } - - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%, ignoring overflow. - */ - subUnsafe(other: FixedNumber): FixedNumber { - return this.#sub(other); - } - - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - sub(other: FixedNumber): FixedNumber { - return this.#sub(other, "sub"); - } - - #mul(o: FixedNumber, safeOp?: string): FixedNumber { - this.#checkFormat(o); - return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp); - } - - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%, ignoring overflow and underflow (precision loss). - */ - mulUnsafe(other: FixedNumber): FixedNumber { - return this.#mul(other); - } - - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - mul(other: FixedNumber): FixedNumber { - return this.#mul(other, "mul"); - } - - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs or if underflow (precision loss) occurs. - */ - mulSignal(other: FixedNumber): FixedNumber { - this.#checkFormat(other); - const value = this.#val * other.#val; - assert( - value % this.#tens === BN_0, - "precision lost during signalling mul", - "NUMERIC_FAULT", - { - operation: "mulSignal", - fault: "underflow", - value: this, - }, - ); - return this.#checkValue(value / this.#tens, "mulSignal"); - } - - #div(o: FixedNumber, safeOp?: string): FixedNumber { - assert(o.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { - operation: "div", - fault: "divide-by-zero", - value: this, - }); - this.#checkFormat(o); - return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp); - } - - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - divUnsafe(other: FixedNumber): FixedNumber { - return this.#div(other); - } - - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - div(other: FixedNumber): FixedNumber { - return this.#div(other, "div"); - } - - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%. A [[NumericFaultError]] is thrown if underflow - * (precision loss) occurs. - */ - divSignal(other: FixedNumber): FixedNumber { - assert(other.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { - operation: "div", - fault: "divide-by-zero", - value: this, - }); - this.#checkFormat(other); - const value = this.#val * this.#tens; - assert( - value % other.#val === BN_0, - "precision lost during signalling div", - "NUMERIC_FAULT", - { - operation: "divSignal", - fault: "underflow", - value: this, - }, - ); - return this.#checkValue(value / other.#val, "divSignal"); - } - - /** - * Returns a comparison result between %%this%% and %%other%%. - * - * This is suitable for use in sorting, where ``-1`` implies %%this%% - * is smaller, ``1`` implies %%other%% is larger and ``0`` implies - * both are equal. - */ - cmp(other: FixedNumber): number { - let a = this.value, - b = other.value; - - // Coerce a and b to the same magnitude - const delta = this.decimals - other.decimals; - if (delta > 0) { - b *= getTens(delta); - } else if (delta < 0) { - a *= getTens(-delta); - } - - // Comnpare - if (a < b) { - return -1; - } - if (a > b) { - return -1; - } - return 0; - } - - /** - * Returns true if %%other%% is equal to %%this%%. - */ - eq(other: FixedNumber): boolean { - return this.cmp(other) === 0; - } - - /** - * Returns true if %%other%% is less than to %%this%%. - */ - lt(other: FixedNumber): boolean { - return this.cmp(other) < 0; - } - - /** - * Returns true if %%other%% is less than or equal to %%this%%. - */ - lte(other: FixedNumber): boolean { - return this.cmp(other) <= 0; - } - - /** - * Returns true if %%other%% is greater than to %%this%%. - */ - gt(other: FixedNumber): boolean { - return this.cmp(other) > 0; - } - - /** - * Returns true if %%other%% is greater than or equal to %%this%%. - */ - gte(other: FixedNumber): boolean { - return this.cmp(other) >= 0; - } - - /** - * Returns a new [[FixedNumber]] which is the largest **integer** - * that is less than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - floor(): FixedNumber { - let val = this.#val; - if (this.#val < BN_0) { - val -= this.#tens - BN_1; - } - val = (this.#val / this.#tens) * this.#tens; - return this.#checkValue(val, "floor"); - } - - /** - * Returns a new [[FixedNumber]] which is the smallest **integer** - * that is greater than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - ceiling(): FixedNumber { - let val = this.#val; - if (this.#val > BN_0) { - val += this.#tens - BN_1; - } - val = (this.#val / this.#tens) * this.#tens; - return this.#checkValue(val, "ceiling"); - } - - /** - * Returns a new [[FixedNumber]] with the decimal component - * rounded up on ties at %%decimals%% places. - */ - round(decimals?: number): FixedNumber { - if (decimals == null) { - decimals = 0; - } - - // Not enough precision to not already be rounded - if (decimals >= this.decimals) { - return this; - } - - const delta = this.decimals - decimals; - const bump = BN_5 * getTens(delta - 1); - - let value = this.value + bump; - const tens = getTens(delta); - value = (value / tens) * tens; - - checkValue(value, this.#format, "round"); - - return new FixedNumber(_guard, value, this.#format); - } - - /** - * Returns true if %%this%% is equal to ``0``. - */ - isZero(): boolean { - return this.#val === BN_0; - } - - /** - * Returns true if %%this%% is less than ``0``. - */ - isNegative(): boolean { - return this.#val < BN_0; - } - - /** - * Returns the string representation of %%this%%. - */ - toString(): string { - return this._value; - } - - /** - * Returns a float approximation. - * - * Due to IEEE 754 precission (or lack thereof), this function - * can only return an approximation and most values will contain - * rounding errors. - */ - toUnsafeFloat(): number { - return parseFloat(this.toString()); - } - - /** - * Return a new [[FixedNumber]] with the same value but has had - * its field set to %%format%%. - * - * This will throw if the value cannot fit into %%format%%. - */ - toFormat(format: FixedFormat): FixedNumber { - return FixedNumber.fromString(this.toString(), format); - } - - /** - * Creates a new [[FixedNumber]] for %%value%% divided by - * %%decimal%% places with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% (once adjusted - * for %%decimals%%) cannot fit in %%format%%, either due to overflow - * or underflow (precision loss). - */ - static fromValue( - _value: BigNumberish, - decimals?: number, - _format?: FixedFormat, - ): FixedNumber { - if (decimals == null) { - decimals = 0; - } - const format = getFormat(_format); - - let value = getBigInt(_value, "value"); - const delta = decimals - format.decimals; - if (delta > 0) { - const tens = getTens(delta); - assert( - value % tens === BN_0, - "value loses precision for format", - "NUMERIC_FAULT", - { - operation: "fromValue", - fault: "underflow", - value: _value, - }, - ); - value /= tens; - } else if (delta < 0) { - value *= getTens(-delta); - } - - checkValue(value, format, "fromValue"); - - return new FixedNumber(_guard, value, format); - } - - /** - * Creates a new [[FixedNumber]] for %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%%, either due to overflow or underflow (precision loss). - */ - static fromString(_value: string, _format?: FixedFormat): FixedNumber { - const match = _value.match(/^(-?)([0-9]*)\.?([0-9]*)$/); - assertArgument( - match && match[2].length + match[3].length > 0, - "invalid FixedNumber string value", - "value", - _value, - ); - - const format = getFormat(_format); - - let whole = match[2] || "0", - decimal = match[3] || ""; - - // Pad out the decimals - while (decimal.length < format.decimals) { - decimal += Zeros; - } - - // Check precision is safe - assert( - decimal.substring(format.decimals).match(/^0*$/), - "too many decimals for format", - "NUMERIC_FAULT", - { - operation: "fromString", - fault: "underflow", - value: _value, - }, - ); - - // Remove extra padding - decimal = decimal.substring(0, format.decimals); - - const value = BigInt(match[1] + whole + decimal); - - checkValue(value, format, "fromString"); - - return new FixedNumber(_guard, value, format); - } - - /** - * Creates a new [[FixedNumber]] with the big-endian representation - * %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%% due to overflow. - */ - static fromBytes(_value: BytesLike, _format?: FixedFormat): FixedNumber { - let value = toBigInt(getBytes(_value, "value")); - const format = getFormat(_format); - - if (format.signed) { - value = fromTwos(value, format.width); - } - - checkValue(value, format, "fromBytes"); - - return new FixedNumber(_guard, value, format); - } + val = checkValue(val, this.#format, safeOp); + return new FixedNumber(_guard, val, this.#format); + } + + #add(o: FixedNumber, safeOp?: string): FixedNumber { + this.#checkFormat(o); + return this.#checkValue(this.#val + o.#val, safeOp); + } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%, ignoring overflow. + */ + addUnsafe(other: FixedNumber): FixedNumber { + return this.#add(other); + } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + add(other: FixedNumber): FixedNumber { + return this.#add(other, "add"); + } + + #sub(o: FixedNumber, safeOp?: string): FixedNumber { + this.#checkFormat(o); + return this.#checkValue(this.#val - o.#val, safeOp); + } + + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%, ignoring overflow. + */ + subUnsafe(other: FixedNumber): FixedNumber { + return this.#sub(other); + } + + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + sub(other: FixedNumber): FixedNumber { + return this.#sub(other, "sub"); + } + + #mul(o: FixedNumber, safeOp?: string): FixedNumber { + this.#checkFormat(o); + return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp); + } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%, ignoring overflow and underflow (precision loss). + */ + mulUnsafe(other: FixedNumber): FixedNumber { + return this.#mul(other); + } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + mul(other: FixedNumber): FixedNumber { + return this.#mul(other, "mul"); + } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs or if underflow (precision loss) occurs. + */ + mulSignal(other: FixedNumber): FixedNumber { + this.#checkFormat(other); + const value = this.#val * other.#val; + assert( + value % this.#tens === BN_0, + "precision lost during signalling mul", + "NUMERIC_FAULT", + { + operation: "mulSignal", + fault: "underflow", + value: this, + }, + ); + return this.#checkValue(value / this.#tens, "mulSignal"); + } + + #div(o: FixedNumber, safeOp?: string): FixedNumber { + assert(o.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { + operation: "div", + fault: "divide-by-zero", + value: this, + }); + this.#checkFormat(o); + return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp); + } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + divUnsafe(other: FixedNumber): FixedNumber { + return this.#div(other); + } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + div(other: FixedNumber): FixedNumber { + return this.#div(other, "div"); + } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%. A [[NumericFaultError]] is thrown if underflow + * (precision loss) occurs. + */ + divSignal(other: FixedNumber): FixedNumber { + assert(other.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { + operation: "div", + fault: "divide-by-zero", + value: this, + }); + this.#checkFormat(other); + const value = this.#val * this.#tens; + assert( + value % other.#val === BN_0, + "precision lost during signalling div", + "NUMERIC_FAULT", + { + operation: "divSignal", + fault: "underflow", + value: this, + }, + ); + return this.#checkValue(value / other.#val, "divSignal"); + } + + /** + * Returns a comparison result between %%this%% and %%other%%. + * + * This is suitable for use in sorting, where ``-1`` implies %%this%% + * is smaller, ``1`` implies %%other%% is larger and ``0`` implies + * both are equal. + */ + cmp(other: FixedNumber): number { + let a = this.value, + b = other.value; + + // Coerce a and b to the same magnitude + const delta = this.decimals - other.decimals; + if (delta > 0) { + b *= getTens(delta); + } else if (delta < 0) { + a *= getTens(-delta); + } + + // Comnpare + if (a < b) { + return -1; + } + if (a > b) { + return -1; + } + return 0; + } + + /** + * Returns true if %%other%% is equal to %%this%%. + */ + eq(other: FixedNumber): boolean { + return this.cmp(other) === 0; + } + + /** + * Returns true if %%other%% is less than to %%this%%. + */ + lt(other: FixedNumber): boolean { + return this.cmp(other) < 0; + } + + /** + * Returns true if %%other%% is less than or equal to %%this%%. + */ + lte(other: FixedNumber): boolean { + return this.cmp(other) <= 0; + } + + /** + * Returns true if %%other%% is greater than to %%this%%. + */ + gt(other: FixedNumber): boolean { + return this.cmp(other) > 0; + } + + /** + * Returns true if %%other%% is greater than or equal to %%this%%. + */ + gte(other: FixedNumber): boolean { + return this.cmp(other) >= 0; + } + + /** + * Returns a new [[FixedNumber]] which is the largest **integer** + * that is less than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + floor(): FixedNumber { + let val = this.#val; + if (this.#val < BN_0) { + val -= this.#tens - BN_1; + } + val = (this.#val / this.#tens) * this.#tens; + return this.#checkValue(val, "floor"); + } + + /** + * Returns a new [[FixedNumber]] which is the smallest **integer** + * that is greater than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + ceiling(): FixedNumber { + let val = this.#val; + if (this.#val > BN_0) { + val += this.#tens - BN_1; + } + val = (this.#val / this.#tens) * this.#tens; + return this.#checkValue(val, "ceiling"); + } + + /** + * Returns a new [[FixedNumber]] with the decimal component + * rounded up on ties at %%decimals%% places. + */ + round(decimals?: number): FixedNumber { + if (decimals == null) { + decimals = 0; + } + + // Not enough precision to not already be rounded + if (decimals >= this.decimals) { + return this; + } + + const delta = this.decimals - decimals; + const bump = BN_5 * getTens(delta - 1); + + let value = this.value + bump; + const tens = getTens(delta); + value = (value / tens) * tens; + + checkValue(value, this.#format, "round"); + + return new FixedNumber(_guard, value, this.#format); + } + + /** + * Returns true if %%this%% is equal to ``0``. + */ + isZero(): boolean { + return this.#val === BN_0; + } + + /** + * Returns true if %%this%% is less than ``0``. + */ + isNegative(): boolean { + return this.#val < BN_0; + } + + /** + * Returns the string representation of %%this%%. + */ + toString(): string { + return this._value; + } + + /** + * Returns a float approximation. + * + * Due to IEEE 754 precission (or lack thereof), this function + * can only return an approximation and most values will contain + * rounding errors. + */ + toUnsafeFloat(): number { + return parseFloat(this.toString()); + } + + /** + * Return a new [[FixedNumber]] with the same value but has had + * its field set to %%format%%. + * + * This will throw if the value cannot fit into %%format%%. + */ + toFormat(format: FixedFormat): FixedNumber { + return FixedNumber.fromString(this.toString(), format); + } + + /** + * Creates a new [[FixedNumber]] for %%value%% divided by + * %%decimal%% places with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% (once adjusted + * for %%decimals%%) cannot fit in %%format%%, either due to overflow + * or underflow (precision loss). + */ + static fromValue( + _value: BigNumberish, + decimals?: number, + _format?: FixedFormat, + ): FixedNumber { + if (decimals == null) { + decimals = 0; + } + const format = getFormat(_format); + + let value = getBigInt(_value, "value"); + const delta = decimals - format.decimals; + if (delta > 0) { + const tens = getTens(delta); + assert( + value % tens === BN_0, + "value loses precision for format", + "NUMERIC_FAULT", + { + operation: "fromValue", + fault: "underflow", + value: _value, + }, + ); + value /= tens; + } else if (delta < 0) { + value *= getTens(-delta); + } + + checkValue(value, format, "fromValue"); + + return new FixedNumber(_guard, value, format); + } + + /** + * Creates a new [[FixedNumber]] for %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%%, either due to overflow or underflow (precision loss). + */ + static fromString(_value: string, _format?: FixedFormat): FixedNumber { + const match = _value.match(/^(-?)([0-9]*)\.?([0-9]*)$/); + assertArgument( + match && match[2].length + match[3].length > 0, + "invalid FixedNumber string value", + "value", + _value, + ); + + const format = getFormat(_format); + + let whole = match[2] || "0", + decimal = match[3] || ""; + + // Pad out the decimals + while (decimal.length < format.decimals) { + decimal += Zeros; + } + + // Check precision is safe + assert( + decimal.substring(format.decimals).match(/^0*$/), + "too many decimals for format", + "NUMERIC_FAULT", + { + operation: "fromString", + fault: "underflow", + value: _value, + }, + ); + + // Remove extra padding + decimal = decimal.substring(0, format.decimals); + + const value = BigInt(match[1] + whole + decimal); + + checkValue(value, format, "fromString"); + + return new FixedNumber(_guard, value, format); + } + + /** + * Creates a new [[FixedNumber]] with the big-endian representation + * %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%% due to overflow. + */ + static fromBytes(_value: BytesLike, _format?: FixedFormat): FixedNumber { + let value = toBigInt(getBytes(_value, "value")); + const format = getFormat(_format); + + if (format.signed) { + value = fromTwos(value, format.width); + } + + checkValue(value, format, "fromBytes"); + + return new FixedNumber(_guard, value, format); + } } //const f1 = FixedNumber.fromString("12.56", "fixed16x2"); diff --git a/src.ts/utils/geturl-browser.ts b/src.ts/utils/geturl-browser.ts index 417d19885..3bd926c53 100644 --- a/src.ts/utils/geturl-browser.ts +++ b/src.ts/utils/geturl-browser.ts @@ -1,96 +1,72 @@ import { assert } from "./errors.js"; import type { - FetchRequest, - FetchCancelSignal, - GetUrlResponse, + FetchRequest, + FetchCancelSignal, + GetUrlResponse, } from "./fetch.js"; -declare global { - // @ts-ignore - class Headers { - constructor(values: Array<[string, string]>); - forEach(func: (v: string, k: string) => void): void; - } - - // @ts-ignore - class Response { - status: number; - statusText: string; - headers: Headers; - arrayBuffer(): Promise; - } - - type FetchInit = { - method?: string; - headers?: Headers; - body?: Uint8Array; - }; - - function fetch(url: string, init: FetchInit): Promise; -} - // @TODO: timeout is completely ignored; start a Promise.any with a reject? // @ts-ignore export async function getUrl( - req: FetchRequest, - _signal?: FetchCancelSignal, + req: FetchRequest, + _signal?: FetchCancelSignal, ): Promise { - const protocol = req.url.split(":")[0].toLowerCase(); + const protocol = req.url.split(":")[0].toLowerCase(); - assert( - protocol === "http" || protocol === "https", - `unsupported protocol ${protocol}`, - "UNSUPPORTED_OPERATION", - { - info: { protocol }, - operation: "request", - }, - ); + assert( + protocol === "http" || protocol === "https", + `unsupported protocol ${protocol}`, + "UNSUPPORTED_OPERATION", + { + info: { protocol }, + operation: "request", + }, + ); - assert( - protocol === "https" || !req.credentials || req.allowInsecureAuthentication, - "insecure authorized connections unsupported", - "UNSUPPORTED_OPERATION", - { - operation: "request", - }, - ); + assert( + protocol === "https" || !req.credentials || req.allowInsecureAuthentication, + "insecure authorized connections unsupported", + "UNSUPPORTED_OPERATION", + { + operation: "request", + }, + ); - let signal: undefined | AbortSignal = undefined; - if (_signal) { - const controller = new AbortController(); - signal = controller.signal; - _signal.addListener(() => { - controller.abort(); - }); - } + let signal: undefined | AbortSignal = undefined; + if (_signal) { + const controller = new AbortController(); + signal = controller.signal; + _signal.addListener(() => { + controller.abort(); + }); + } - const init = { - method: req.method, - headers: new Headers(Array.from(req)), - body: req.body || undefined, - signal, - }; - try { - const resp = await fetch(req.url, init); + const init = { + method: req.method, + headers: new Headers(Array.from(req)), + body: req.body || undefined, + signal, + }; + try { + const resp = await fetch(req.url, init); - const headers: Record = {}; - resp.headers.forEach((value, key) => { - headers[key.toLowerCase()] = value; - }); + const headers: Record = {}; + resp.headers.forEach((value, key) => { + headers[key.toLowerCase()] = value; + }); - const respBody = await resp.arrayBuffer(); - const body = respBody == null ? null : new Uint8Array(respBody); + const respBody = await resp.arrayBuffer(); + const body = respBody == null ? null : new Uint8Array(respBody); - return { - statusCode: resp.status, - statusMessage: resp.statusText, - headers, - body, - }; - } catch (error: any) { - console.log({ error }); - return undefined; - } + return { + statusCode: resp.status, + statusMessage: resp.statusText, + headers, + body, + }; + } catch (error: any) { + console.log({ error }); + return undefined; + } } diff --git a/src.ts/utils/geturl.ts b/src.ts/utils/geturl.ts index 68f597f83..147bc825c 100644 --- a/src.ts/utils/geturl.ts +++ b/src.ts/utils/geturl.ts @@ -6,116 +6,116 @@ import { assert } from "./errors.js"; import { getBytes } from "./data.js"; import type { - FetchRequest, - FetchCancelSignal, - GetUrlResponse, + FetchRequest, + FetchCancelSignal, + GetUrlResponse, } from "./fetch.js"; /** * @_ignore: */ export async function getUrl( - req: FetchRequest, - signal?: FetchCancelSignal, + req: FetchRequest, + signal?: FetchCancelSignal, ): Promise { - const protocol = req.url.split(":")[0].toLowerCase(); - - assert( - protocol === "http" || protocol === "https", - `unsupported protocol ${protocol}`, - "UNSUPPORTED_OPERATION", - { - info: { protocol }, - operation: "request", - }, - ); - - assert( - protocol === "https" || !req.credentials || req.allowInsecureAuthentication, - "insecure authorized connections unsupported", - "UNSUPPORTED_OPERATION", - { - operation: "request", - }, - ); - - const method = req.method; - const headers = Object.assign({}, req.headers); - - const options: any = { method, headers }; - - const request = (protocol === "http" ? http : https).request( - req.url, - options, - ); - - request.setTimeout(req.timeout); - - const body = req.body; - if (body) { - request.write(Buffer.from(body)); - } - - request.end(); - - return new Promise((resolve, reject) => { - // @TODO: Node 15 added AbortSignal; once we drop support for - // Node14, we can add that in here too - - request.once("response", (resp: http.IncomingMessage) => { - const statusCode = resp.statusCode || 0; - const statusMessage = resp.statusMessage || ""; - const headers = Object.keys(resp.headers || {}).reduce( - (accum, name) => { - let value = resp.headers[name] || ""; - if (Array.isArray(value)) { - value = value.join(", "); - } - accum[name] = value; - return accum; - }, - <{ [name: string]: string }>{}, - ); - - let body: null | Uint8Array = null; - //resp.setEncoding("utf8"); - - resp.on("data", (chunk: Uint8Array) => { - if (signal) { - try { - signal.checkSignal(); - } catch (error) { - return reject(error); - } - } - - if (body == null) { - body = chunk; - } else { - const newBody = new Uint8Array(body.length + chunk.length); - newBody.set(body, 0); - newBody.set(chunk, body.length); - body = newBody; - } - }); - - resp.on("end", () => { - if (headers["content-encoding"] === "gzip" && body) { - body = getBytes(gunzipSync(body)); - } - - resolve({ statusCode, statusMessage, headers, body }); - }); - - resp.on("error", (error) => { - //@TODO: Should this just return nornal response with a server error? - (error).response = { statusCode, statusMessage, headers, body }; - reject(error); - }); - }); - - request.on("error", (error) => { - reject(error); - }); - }); + const protocol = req.url.split(":")[0].toLowerCase(); + + assert( + protocol === "http" || protocol === "https", + `unsupported protocol ${protocol}`, + "UNSUPPORTED_OPERATION", + { + info: { protocol }, + operation: "request", + }, + ); + + assert( + protocol === "https" || !req.credentials || req.allowInsecureAuthentication, + "insecure authorized connections unsupported", + "UNSUPPORTED_OPERATION", + { + operation: "request", + }, + ); + + const method = req.method; + const headers = Object.assign({}, req.headers); + + const options: any = { method, headers }; + + const request = (protocol === "http" ? http : https).request( + req.url, + options, + ); + + request.setTimeout(req.timeout); + + const body = req.body; + if (body) { + request.write(Buffer.from(body)); + } + + request.end(); + + return new Promise((resolve, reject) => { + // @TODO: Node 15 added AbortSignal; once we drop support for + // Node14, we can add that in here too + + request.once("response", (resp: http.IncomingMessage) => { + const statusCode = resp.statusCode || 0; + const statusMessage = resp.statusMessage || ""; + const headers = Object.keys(resp.headers || {}).reduce( + (accum, name) => { + let value = resp.headers[name] || ""; + if (Array.isArray(value)) { + value = value.join(", "); + } + accum[name] = value; + return accum; + }, + <{ [name: string]: string }>{}, + ); + + let body: null | Uint8Array = null; + //resp.setEncoding("utf8"); + + resp.on("data", (chunk: Uint8Array) => { + if (signal) { + try { + signal.checkSignal(); + } catch (error) { + return reject(error); + } + } + + if (body == null) { + body = chunk; + } else { + const newBody = new Uint8Array(body.length + chunk.length); + newBody.set(body, 0); + newBody.set(chunk, body.length); + body = newBody; + } + }); + + resp.on("end", () => { + if (headers["content-encoding"] === "gzip" && body) { + body = getBytes(gunzipSync(body)); + } + + resolve({ statusCode, statusMessage, headers, body }); + }); + + resp.on("error", (error) => { + //@TODO: Should this just return nornal response with a server error? + (error).response = { statusCode, statusMessage, headers, body }; + reject(error); + }); + }); + + request.on("error", (error) => { + reject(error); + }); + }); } diff --git a/src.ts/utils/index.ts b/src.ts/utils/index.ts index 0abdb0671..6b264844a 100644 --- a/src.ts/utils/index.ts +++ b/src.ts/utils/index.ts @@ -11,30 +11,30 @@ export { decodeBase58, encodeBase58 } from "./base58.js"; export { decodeBase64, encodeBase64 } from "./base64.js"; export { - getBytes, - getBytesCopy, - isHexString, - isBytesLike, - hexlify, - concat, - dataLength, - dataSlice, - stripZerosLeft, - zeroPadValue, - zeroPadBytes, - arrayify, - hexConcat, + getBytes, + getBytesCopy, + isHexString, + isBytesLike, + hexlify, + concat, + dataLength, + dataSlice, + stripZerosLeft, + zeroPadValue, + zeroPadBytes, + arrayify, + hexConcat, } from "./data.js"; export { - isCallException, - isError, - assert, - assertArgument, - assertArgumentCount, - assertPrivate, - assertNormalize, - makeError, + isCallException, + isError, + assert, + assertArgument, + assertArgumentCount, + assertPrivate, + assertNormalize, + makeError, } from "./errors.js"; export { EventPayload } from "./events.js"; @@ -44,17 +44,17 @@ export { FetchRequest, FetchResponse, FetchCancelSignal } from "./fetch.js"; export { FixedNumber } from "./fixednumber.js"; export { - fromTwos, - toTwos, - mask, - getBigInt, - getNumber, - getUint, - toBigInt, - toNumber, - toBeHex, - toBeArray, - toQuantity, + fromTwos, + toTwos, + mask, + getBigInt, + getNumber, + getUint, + toBigInt, + toNumber, + toBeHex, + toBeArray, + toQuantity, } from "./maths.js"; export { resolveProperties, defineProperties } from "./properties.js"; @@ -65,10 +65,10 @@ export { encodeRlp } from "./rlp-encode.js"; export { formatXCB, parseXCB, formatUnits, parseUnits } from "./units.js"; export { - toUtf8Bytes, - toUtf8CodePoints, - toUtf8String, - Utf8ErrorFuncs, + toUtf8Bytes, + toUtf8CodePoints, + toUtf8String, + Utf8ErrorFuncs, } from "./utf8.js"; export { uuidV4 } from "./uuid.js"; @@ -79,46 +79,46 @@ export { uuidV4 } from "./uuid.js"; export type { BytesLike } from "./data.js"; export type { - //ErrorFetchRequestWithBody, ErrorFetchRequest, - //ErrorFetchResponseWithBody, ErrorFetchResponse, - - ErrorCode, - CoreBCError, - UnknownError, - NotImplementedError, - UnsupportedOperationError, - NetworkError, - ServerError, - TimeoutError, - BadDataError, - CancelledError, - BufferOverrunError, - NumericFaultError, - InvalidArgumentError, - MissingArgumentError, - UnexpectedArgumentError, - CallExceptionError, - InsufficientFundsError, - NonceExpiredError, - OffchainFaultError, - ReplacementUnderpricedError, - TransactionReplacedError, - UnconfiguredNameError, - ActionRejectedError, - CallExceptionAction, - CallExceptionTransaction, - CodedCoreBCError, + //ErrorFetchRequestWithBody, ErrorFetchRequest, + //ErrorFetchResponseWithBody, ErrorFetchResponse, + + ErrorCode, + CoreBCError, + UnknownError, + NotImplementedError, + UnsupportedOperationError, + NetworkError, + ServerError, + TimeoutError, + BadDataError, + CancelledError, + BufferOverrunError, + NumericFaultError, + InvalidArgumentError, + MissingArgumentError, + UnexpectedArgumentError, + CallExceptionError, + InsufficientFundsError, + NonceExpiredError, + OffchainFaultError, + ReplacementUnderpricedError, + TransactionReplacedError, + UnconfiguredNameError, + ActionRejectedError, + CallExceptionAction, + CallExceptionTransaction, + CodedCoreBCError, } from "./errors.js"; export type { EventEmitterable, Listener } from "./events.js"; export type { - GetUrlResponse, - FetchPreflightFunc, - FetchProcessFunc, - FetchRetryFunc, - FetchGatewayFunc, - FetchGetUrlFunc, + GetUrlResponse, + FetchPreflightFunc, + FetchProcessFunc, + FetchRetryFunc, + FetchGatewayFunc, + FetchGetUrlFunc, } from "./fetch.js"; export type { FixedFormat } from "./fixednumber.js"; @@ -128,7 +128,7 @@ export type { BigNumberish, Numeric } from "./maths.js"; export type { RlpStructuredData } from "./rlp.js"; export type { - Utf8ErrorFunc, - UnicodeNormalizationForm, - Utf8ErrorReason, + Utf8ErrorFunc, + UnicodeNormalizationForm, + Utf8ErrorReason, } from "./utf8.js"; diff --git a/src.ts/utils/maths.ts b/src.ts/utils/maths.ts index 4e9f8420a..12fa94e02 100644 --- a/src.ts/utils/maths.ts +++ b/src.ts/utils/maths.ts @@ -33,22 +33,22 @@ const maxValue = 0x1fffffffffffff; * If the highest bit is ``1``, the result will be negative. */ export function fromTwos(_value: BigNumberish, _width: Numeric): bigint { - const value = getUint(_value, "value"); - const width = BigInt(getNumber(_width, "width")); - - assert(value >> width === BN_0, "overflow", "NUMERIC_FAULT", { - operation: "fromTwos", - fault: "overflow", - value: _value, - }); - - // Top bit set; treat as a negative value - if (value >> (width - BN_1)) { - const mask = (BN_1 << width) - BN_1; - return -((~value & mask) + BN_1); - } - - return value; + const value = getUint(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + + assert(value >> width === BN_0, "overflow", "NUMERIC_FAULT", { + operation: "fromTwos", + fault: "overflow", + value: _value, + }); + + // Top bit set; treat as a negative value + if (value >> (width - BN_1)) { + const mask = (BN_1 << width) - BN_1; + return -((~value & mask) + BN_1); + } + + return value; } /** @@ -58,38 +58,38 @@ export function fromTwos(_value: BigNumberish, _width: Numeric): bigint { * The result will always be positive. */ export function toTwos(_value: BigNumberish, _width: Numeric): bigint { - let value = getBigInt(_value, "value"); - const width = BigInt(getNumber(_width, "width")); - - const limit = BN_1 << (width - BN_1); - - if (value < BN_0) { - value = -value; - assert(value <= limit, "too low", "NUMERIC_FAULT", { - operation: "toTwos", - fault: "overflow", - value: _value, - }); - const mask = (BN_1 << width) - BN_1; - return (~value & mask) + BN_1; - } else { - assert(value < limit, "too high", "NUMERIC_FAULT", { - operation: "toTwos", - fault: "overflow", - value: _value, - }); - } - - return value; + let value = getBigInt(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + + const limit = BN_1 << (width - BN_1); + + if (value < BN_0) { + value = -value; + assert(value <= limit, "too low", "NUMERIC_FAULT", { + operation: "toTwos", + fault: "overflow", + value: _value, + }); + const mask = (BN_1 << width) - BN_1; + return (~value & mask) + BN_1; + } else { + assert(value < limit, "too high", "NUMERIC_FAULT", { + operation: "toTwos", + fault: "overflow", + value: _value, + }); + } + + return value; } /** * Mask %%value%% with a bitmask of %%bits%% ones. */ export function mask(_value: BigNumberish, _bits: Numeric): bigint { - const value = getUint(_value, "value"); - const bits = BigInt(getNumber(_bits, "bits")); - return value & ((BN_1 << bits) - BN_1); + const value = getUint(_value, "value"); + const bits = BigInt(getNumber(_bits, "bits")); + return value & ((BN_1 << bits) - BN_1); } /** @@ -97,52 +97,52 @@ export function mask(_value: BigNumberish, _bits: Numeric): bigint { * a BigInt, then an ArgumentError will be thrown for %%name%%. */ export function getBigInt(value: BigNumberish, name?: string): bigint { - switch (typeof value) { - case "bigint": - return value; - case "number": - assertArgument( - Number.isInteger(value), - "underflow", - name || "value", - value, - ); - assertArgument( - value >= -maxValue && value <= maxValue, - "overflow", - name || "value", - value, - ); - return BigInt(value); - case "string": - try { - if (value === "") { - throw new Error("empty string"); - } - if (value[0] === "-" && value[1] !== "-") { - return -BigInt(value.substring(1)); - } - return BigInt(value); - } catch (e: any) { - assertArgument( - false, - `invalid BigNumberish string: ${e.message}`, - name || "value", - value, - ); - } - } - assertArgument(false, "invalid BigNumberish value", name || "value", value); + switch (typeof value) { + case "bigint": + return value; + case "number": + assertArgument( + Number.isInteger(value), + "underflow", + name || "value", + value, + ); + assertArgument( + value >= -maxValue && value <= maxValue, + "overflow", + name || "value", + value, + ); + return BigInt(value); + case "string": + try { + if (value === "") { + throw new Error("empty string"); + } + if (value[0] === "-" && value[1] !== "-") { + return -BigInt(value.substring(1)); + } + return BigInt(value); + } catch (e: any) { + assertArgument( + false, + `invalid BigNumberish string: ${e.message}`, + name || "value", + value, + ); + } + } + assertArgument(false, "invalid BigNumberish value", name || "value", value); } export function getUint(value: BigNumberish, name?: string): bigint { - const result = getBigInt(value, name); - assert(result >= BN_0, "unsigned value cannot be negative", "NUMERIC_FAULT", { - fault: "overflow", - operation: "getUint", - value, - }); - return result; + const result = getBigInt(value, name); + assert(result >= BN_0, "unsigned value cannot be negative", "NUMERIC_FAULT", { + fault: "overflow", + operation: "getUint", + value, + }); + return result; } const Nibbles = "0123456789abcdef"; @@ -152,16 +152,16 @@ const Nibbles = "0123456789abcdef"; * is treated as Big Endian data. */ export function toBigInt(value: BigNumberish | Uint8Array): bigint { - if (value instanceof Uint8Array) { - let result = "0x0"; - for (const v of value) { - result += Nibbles[v >> 4]; - result += Nibbles[v & 0x0f]; - } - return BigInt(result); - } - - return getBigInt(value); + if (value instanceof Uint8Array) { + let result = "0x0"; + for (const v of value) { + result += Nibbles[v >> 4]; + result += Nibbles[v & 0x0f]; + } + return BigInt(result); + } + + return getBigInt(value); } /** @@ -169,45 +169,45 @@ export function toBigInt(value: BigNumberish | Uint8Array): bigint { * a //number//, then an ArgumentError will be thrown for %%name%%. */ export function getNumber(value: BigNumberish, name?: string): number { - switch (typeof value) { - case "bigint": - assertArgument( - value >= -maxValue && value <= maxValue, - "overflow", - name || "value", - value, - ); - return Number(value); - case "number": - assertArgument( - Number.isInteger(value), - "underflow", - name || "value", - value, - ); - assertArgument( - value >= -maxValue && value <= maxValue, - "overflow", - name || "value", - value, - ); - return value; - case "string": - try { - if (value === "") { - throw new Error("empty string"); - } - return getNumber(BigInt(value), name); - } catch (e: any) { - assertArgument( - false, - `invalid numeric string: ${e.message}`, - name || "value", - value, - ); - } - } - assertArgument(false, "invalid numeric value", name || "value", value); + switch (typeof value) { + case "bigint": + assertArgument( + value >= -maxValue && value <= maxValue, + "overflow", + name || "value", + value, + ); + return Number(value); + case "number": + assertArgument( + Number.isInteger(value), + "underflow", + name || "value", + value, + ); + assertArgument( + value >= -maxValue && value <= maxValue, + "overflow", + name || "value", + value, + ); + return value; + case "string": + try { + if (value === "") { + throw new Error("empty string"); + } + return getNumber(BigInt(value), name); + } catch (e: any) { + assertArgument( + false, + `invalid numeric string: ${e.message}`, + name || "value", + value, + ); + } + } + assertArgument(false, "invalid numeric value", name || "value", value); } /** @@ -215,7 +215,7 @@ export function getNumber(value: BigNumberish, name?: string): number { * is treated as Big Endian data. Throws if the value is not safe. */ export function toNumber(value: BigNumberish | Uint8Array): number { - return getNumber(toBigInt(value)); + return getNumber(toBigInt(value)); } /** @@ -223,59 +223,59 @@ export function toNumber(value: BigNumberish | Uint8Array): number { * %%width%% bytes. */ export function toBeHex(_value: BigNumberish, _width?: Numeric): string { - const value = getUint(_value, "value"); - - let result = value.toString(16); - - if (_width == null) { - // Ensure the value is of even length - if (result.length % 2) { - result = "0" + result; - } - } else { - const width = getNumber(_width, "width"); - assert( - width * 2 >= result.length, - `value exceeds width (${width} bits)`, - "NUMERIC_FAULT", - { - operation: "toBeHex", - fault: "overflow", - value: _value, - }, - ); - - // Pad the value to the required width - while (result.length < width * 2) { - result = "0" + result; - } - } - - return "0x" + result; + const value = getUint(_value, "value"); + + let result = value.toString(16); + + if (_width == null) { + // Ensure the value is of even length + if (result.length % 2) { + result = "0" + result; + } + } else { + const width = getNumber(_width, "width"); + assert( + width * 2 >= result.length, + `value exceeds width (${width} bits)`, + "NUMERIC_FAULT", + { + operation: "toBeHex", + fault: "overflow", + value: _value, + }, + ); + + // Pad the value to the required width + while (result.length < width * 2) { + result = "0" + result; + } + } + + return "0x" + result; } /** * Converts %%value%% to a Big Endian Uint8Array. */ export function toBeArray(_value: BigNumberish): Uint8Array { - const value = getUint(_value, "value"); + const value = getUint(_value, "value"); - if (value === BN_0) { - return new Uint8Array([]); - } + if (value === BN_0) { + return new Uint8Array([]); + } - let hex = value.toString(16); - if (hex.length % 2) { - hex = "0" + hex; - } + let hex = value.toString(16); + if (hex.length % 2) { + hex = "0" + hex; + } - const result = new Uint8Array(hex.length / 2); - for (let i = 0; i < result.length; i++) { - const offset = i * 2; - result[i] = parseInt(hex.substring(offset, offset + 2), 16); - } + const result = new Uint8Array(hex.length / 2); + for (let i = 0; i < result.length; i++) { + const offset = i * 2; + result[i] = parseInt(hex.substring(offset, offset + 2), 16); + } - return result; + return result; } /** @@ -286,14 +286,14 @@ export function toBeArray(_value: BigNumberish): Uint8Array { * numeric values. */ export function toQuantity(value: BytesLike | BigNumberish): string { - let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring( - 2, - ); - while (result.startsWith("0")) { - result = result.substring(1); - } - if (result === "") { - result = "0"; - } - return "0x" + result; + let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring( + 2, + ); + while (result.startsWith("0")) { + result = result.substring(1); + } + if (result === "") { + result = "0"; + } + return "0x" + result; } diff --git a/src.ts/utils/properties.ts b/src.ts/utils/properties.ts index bc3698949..625a5e901 100644 --- a/src.ts/utils/properties.ts +++ b/src.ts/utils/properties.ts @@ -8,27 +8,27 @@ import { Logger } from "../logger/logger.js"; const logger = new Logger("utils/properties/0.0.1"); function checkType(value: any, type: string, name: string): void { - const types = type.split("|").map((t) => t.trim()); - for (let i = 0; i < types.length; i++) { - switch (type) { - case "any": - return; - case "bigint": - case "boolean": - case "number": - case "string": - if (typeof value === type) { - return; - } - } - } + const types = type.split("|").map((t) => t.trim()); + for (let i = 0; i < types.length; i++) { + switch (type) { + case "any": + return; + case "bigint": + case "boolean": + case "number": + case "string": + if (typeof value === type) { + return; + } + } + } - const error: any = new Error(`invalid value for type ${type}`); - error.code = "INVALID_ARGUMENT"; - error.argument = `value.${name}`; - error.value = value; + const error: any = new Error(`invalid value for type ${type}`); + error.code = "INVALID_ARGUMENT"; + error.argument = `value.${name}`; + error.value = value; - throw error; + throw error; } /** @@ -36,19 +36,19 @@ function checkType(value: any, type: string, name: string): void { * values resolved. */ export async function resolveProperties(value: { - [P in keyof T]: T[P] | Promise; + [P in keyof T]: T[P] | Promise; }): Promise { - const keys = Object.keys(value); - const results = await Promise.all( - keys.map((k) => Promise.resolve(value[k])), - ); - return results.reduce( - (accum: any, v, index) => { - accum[keys[index]] = v; - return accum; - }, - <{ [P in keyof T]: T[P] }>{}, - ); + const keys = Object.keys(value); + const results = await Promise.all( + keys.map((k) => Promise.resolve(value[k])), + ); + return results.reduce( + (accum: any, v, index) => { + accum[keys[index]] = v; + return accum; + }, + <{ [P in keyof T]: T[P] }>{}, + ); } /** @@ -57,41 +57,41 @@ export async function resolveProperties(value: { * It %%types%% is specified, the values are checked. */ export function defineProperties( - target: T, - values: { [K in keyof T]?: T[K] }, - types?: { [K in keyof T]?: string }, + target: T, + values: { [K in keyof T]?: T[K] }, + types?: { [K in keyof T]?: string }, ): void { - for (let key in values) { - let value = values[key]; + for (let key in values) { + let value = values[key]; - const type = types ? types[key] : null; - if (type) { - checkType(value, type, key); - } + const type = types ? types[key] : null; + if (type) { + checkType(value, type, key); + } - Object.defineProperty(target, key, { - enumerable: true, - value, - writable: false, - }); - } + Object.defineProperty(target, key, { + enumerable: true, + value, + writable: false, + }); + } } export function checkProperties( - object: any, - properties: { [name: string]: boolean }, + object: any, + properties: { [name: string]: boolean }, ): void { - if (!object || typeof object !== "object") { - logger.throwArgumentError("invalid object", "object", object); - } + if (!object || typeof object !== "object") { + logger.throwArgumentError("invalid object", "object", object); + } - Object.keys(object).forEach((key) => { - if (!properties[key]) { - logger.throwArgumentError( - "invalid object key - " + key, - "transaction:" + key, - object, - ); - } - }); + Object.keys(object).forEach((key) => { + if (!properties[key]) { + logger.throwArgumentError( + "invalid object key - " + key, + "transaction:" + key, + object, + ); + } + }); } diff --git a/src.ts/utils/rlp-decode.ts b/src.ts/utils/rlp-decode.ts index a8cc1fe98..6350b9032 100644 --- a/src.ts/utils/rlp-decode.ts +++ b/src.ts/utils/rlp-decode.ts @@ -5,135 +5,135 @@ import { getBytes } from "./data.js"; import type { BytesLike, RlpStructuredData } from "./index.js"; function hexlifyByte(value: number): string { - let result = value.toString(16); - while (result.length < 2) { - result = "0" + result; - } - return "0x" + result; + let result = value.toString(16); + while (result.length < 2) { + result = "0" + result; + } + return "0x" + result; } function unarrayifyInteger( - data: Uint8Array, - offset: number, - length: number, + data: Uint8Array, + offset: number, + length: number, ): number { - let result = 0; - for (let i = 0; i < length; i++) { - result = result * 256 + data[offset + i]; - } - return result; + let result = 0; + for (let i = 0; i < length; i++) { + result = result * 256 + data[offset + i]; + } + return result; } type Decoded = { - result: any; - consumed: number; + result: any; + consumed: number; }; function _decodeChildren( - data: Uint8Array, - offset: number, - childOffset: number, - length: number, + data: Uint8Array, + offset: number, + childOffset: number, + length: number, ): Decoded { - const result: any = []; - - while (childOffset < offset + 1 + length) { - const decoded = _decode(data, childOffset); - - result.push(decoded.result); - - childOffset += decoded.consumed; - assert( - childOffset <= offset + 1 + length, - "child data too short", - "BUFFER_OVERRUN", - { - buffer: data, - length, - offset, - }, - ); - } - - return { consumed: 1 + length, result: result }; + const result: any = []; + + while (childOffset < offset + 1 + length) { + const decoded = _decode(data, childOffset); + + result.push(decoded.result); + + childOffset += decoded.consumed; + assert( + childOffset <= offset + 1 + length, + "child data too short", + "BUFFER_OVERRUN", + { + buffer: data, + length, + offset, + }, + ); + } + + return { consumed: 1 + length, result: result }; } // returns { consumed: number, result: Object } function _decode( - data: Uint8Array, - offset: number, + data: Uint8Array, + offset: number, ): { consumed: number; result: any } { - assert(data.length !== 0, "data too short", "BUFFER_OVERRUN", { - buffer: data, - length: 0, - offset: 1, - }); - - const checkOffset = (offset: number) => { - assert( - offset <= data.length, - "data short segment too short", - "BUFFER_OVERRUN", - { - buffer: data, - length: data.length, - offset, - }, - ); - }; - - // Array with extra length prefix - if (data[offset] >= 0xf8) { - const lengthLength = data[offset] - 0xf7; - checkOffset(offset + 1 + lengthLength); - - const length = unarrayifyInteger(data, offset + 1, lengthLength); - checkOffset(offset + 1 + lengthLength + length); - - return _decodeChildren( - data, - offset, - offset + 1 + lengthLength, - lengthLength + length, - ); - } else if (data[offset] >= 0xc0) { - const length = data[offset] - 0xc0; - checkOffset(offset + 1 + length); - - return _decodeChildren(data, offset, offset + 1, length); - } else if (data[offset] >= 0xb8) { - const lengthLength = data[offset] - 0xb7; - checkOffset(offset + 1 + lengthLength); - - const length = unarrayifyInteger(data, offset + 1, lengthLength); - checkOffset(offset + 1 + lengthLength + length); - - const result = hexlify( - data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length), - ); - return { consumed: 1 + lengthLength + length, result: result }; - } else if (data[offset] >= 0x80) { - const length = data[offset] - 0x80; - checkOffset(offset + 1 + length); - - const result = hexlify(data.slice(offset + 1, offset + 1 + length)); - return { consumed: 1 + length, result: result }; - } - - return { consumed: 1, result: hexlifyByte(data[offset]) }; + assert(data.length !== 0, "data too short", "BUFFER_OVERRUN", { + buffer: data, + length: 0, + offset: 1, + }); + + const checkOffset = (offset: number) => { + assert( + offset <= data.length, + "data short segment too short", + "BUFFER_OVERRUN", + { + buffer: data, + length: data.length, + offset, + }, + ); + }; + + // Array with extra length prefix + if (data[offset] >= 0xf8) { + const lengthLength = data[offset] - 0xf7; + checkOffset(offset + 1 + lengthLength); + + const length = unarrayifyInteger(data, offset + 1, lengthLength); + checkOffset(offset + 1 + lengthLength + length); + + return _decodeChildren( + data, + offset, + offset + 1 + lengthLength, + lengthLength + length, + ); + } else if (data[offset] >= 0xc0) { + const length = data[offset] - 0xc0; + checkOffset(offset + 1 + length); + + return _decodeChildren(data, offset, offset + 1, length); + } else if (data[offset] >= 0xb8) { + const lengthLength = data[offset] - 0xb7; + checkOffset(offset + 1 + lengthLength); + + const length = unarrayifyInteger(data, offset + 1, lengthLength); + checkOffset(offset + 1 + lengthLength + length); + + const result = hexlify( + data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length), + ); + return { consumed: 1 + lengthLength + length, result: result }; + } else if (data[offset] >= 0x80) { + const length = data[offset] - 0x80; + checkOffset(offset + 1 + length); + + const result = hexlify(data.slice(offset + 1, offset + 1 + length)); + return { consumed: 1 + length, result: result }; + } + + return { consumed: 1, result: hexlifyByte(data[offset]) }; } /** * Decodes %%data%% into the structured data it represents. */ export function decodeRlp(_data: BytesLike): RlpStructuredData { - const data = getBytes(_data, "data"); - const decoded = _decode(data, 0); - assertArgument( - decoded.consumed === data.length, - "unexpected junk after rlp payload", - "data", - _data, - ); - return decoded.result; + const data = getBytes(_data, "data"); + const decoded = _decode(data, 0); + assertArgument( + decoded.consumed === data.length, + "unexpected junk after rlp payload", + "data", + _data, + ); + return decoded.result; } diff --git a/src.ts/utils/rlp-encode.ts b/src.ts/utils/rlp-encode.ts index 24eb7b7a3..c4a3779de 100644 --- a/src.ts/utils/rlp-encode.ts +++ b/src.ts/utils/rlp-encode.ts @@ -3,47 +3,47 @@ import { getBytes } from "./data.js"; import type { RlpStructuredData } from "./rlp.js"; function arrayifyInteger(value: number): Array { - const result: any = []; - while (value) { - result.unshift(value & 0xff); - value >>= 8; - } - return result; + const result: any = []; + while (value) { + result.unshift(value & 0xff); + value >>= 8; + } + return result; } function _encode(object: Array | string): Array { - if (Array.isArray(object)) { - let payload: Array = []; - object.forEach(function (child) { - payload = payload.concat(_encode(child)); - }); - - if (payload.length <= 55) { - payload.unshift(0xc0 + payload.length); - return payload; - } - - const length = arrayifyInteger(payload.length); - length.unshift(0xf7 + length.length); - - return length.concat(payload); - } - - const data: Array = Array.prototype.slice.call( - getBytes(object, "object"), - ); - - if (data.length === 1 && data[0] <= 0x7f) { - return data; - } else if (data.length <= 55) { - data.unshift(0x80 + data.length); - return data; - } - - const length = arrayifyInteger(data.length); - length.unshift(0xb7 + length.length); - - return length.concat(data); + if (Array.isArray(object)) { + let payload: Array = []; + object.forEach(function (child) { + payload = payload.concat(_encode(child)); + }); + + if (payload.length <= 55) { + payload.unshift(0xc0 + payload.length); + return payload; + } + + const length = arrayifyInteger(payload.length); + length.unshift(0xf7 + length.length); + + return length.concat(payload); + } + + const data: Array = Array.prototype.slice.call( + getBytes(object, "object"), + ); + + if (data.length === 1 && data[0] <= 0x7f) { + return data; + } else if (data.length <= 55) { + data.unshift(0x80 + data.length); + return data; + } + + const length = arrayifyInteger(data.length); + length.unshift(0xb7 + length.length); + + return length.concat(data); } const nibbles = "0123456789abcdef"; @@ -52,10 +52,10 @@ const nibbles = "0123456789abcdef"; * Encodes %%object%% as an RLP-encoded [[DataHexString]]. */ export function encodeRlp(object: RlpStructuredData): string { - let result = "0x"; - for (const v of _encode(object)) { - result += nibbles[v >> 4]; - result += nibbles[v & 0xf]; - } - return result; + let result = "0x"; + for (const v of _encode(object)) { + result += nibbles[v >> 4]; + result += nibbles[v & 0xf]; + } + return result; } diff --git a/src.ts/utils/units.ts b/src.ts/utils/units.ts index bc47be316..2a2cac337 100644 --- a/src.ts/utils/units.ts +++ b/src.ts/utils/units.ts @@ -26,25 +26,25 @@ import { getNumber } from "./maths.js"; import type { BigNumberish, Numeric } from "../utils/index.js"; const names = [ - ///Ore, the smallest and atomic amount of Core - "ore", + ///Ore, the smallest and atomic amount of Core + "ore", - ///fecore, 1000 ore - "fecore", + ///fecore, 1000 ore + "fecore", - ///Picore, one million ore - "picore", + ///Picore, one million ore + "picore", - ///Nacore, one billion ore. Typically a reasonable unit to measure energy prices. - "nacore", + ///Nacore, one billion ore. Typically a reasonable unit to measure energy prices. + "nacore", - ///Μcore, 10^12 ore or 1 μCore - "mcore", + ///Μcore, 10^12 ore or 1 μCore + "mcore", - ///micore, 10^15 ore or 1 mcore - "micore", + ///micore, 10^15 ore or 1 mcore + "micore", - "core", + "core", ]; /** @@ -54,19 +54,19 @@ const names = [ * */ export function formatUnits( - value: BigNumberish, - unit?: string | Numeric, + value: BigNumberish, + unit?: string | Numeric, ): string { - let decimals = 18; - if (typeof unit === "string") { - const index = names.indexOf(unit); - assertArgument(index >= 0, "invalid unit", "unit", unit); - decimals = 3 * index; - } else if (unit != null) { - decimals = getNumber(unit, "unit"); - } - - return FixedNumber.fromValue(value, decimals, { decimals }).toString(); + let decimals = 18; + if (typeof unit === "string") { + const index = names.indexOf(unit); + assertArgument(index >= 0, "invalid unit", "unit", unit); + decimals = 3 * index; + } else if (unit != null) { + decimals = getNumber(unit, "unit"); + } + + return FixedNumber.fromValue(value, decimals, { decimals }).toString(); } /** @@ -76,90 +76,90 @@ export function formatUnits( */ export const scientificToDecimal = (num: string | number) => { - // @ts-ignore - var nsign = Math.sign(num); - //remove the sign - // @ts-ignore - num = Math.abs(num); - //if the number is in scientific notation remove it - // @ts-ignore - if (/\d+\.?\d*e[\+\-]*\d+/i.test(num)) { - var zero = "0", - // @ts-ignore - parts = String(num).toLowerCase().split("e"), //split into coeff and exponent - e = parts.pop(), //store the exponential part - // @ts-ignore - l = Math.abs(e), //get the number of zeros - // @ts-ignore - sign = e / l, - coeff_array = parts[0].split("."); - if (sign === -1) { - l = l - coeff_array[0].length; - if (l < 0) { - // @ts-ignore - num = - coeff_array[0].slice(0, l) + - "." + - coeff_array[0].slice(l) + - (coeff_array.length === 2 ? coeff_array[1] : ""); - } else { - // @ts-ignore - num = zero + "." + new Array(l + 1).join(zero) + coeff_array.join(""); - } - } else { - var dec = coeff_array[1]; - if (dec) l = l - dec.length; - if (l < 0) { - // @ts-ignore - num = coeff_array[0] + dec.slice(0, l) + "." + dec.slice(l); - } else { - // @ts-ignore - num = coeff_array.join("") + new Array(l + 1).join(zero); - } - } - } - // @ts-ignore - return nsign < 0 ? "-" + num : num; + // @ts-ignore + var nsign = Math.sign(num); + //remove the sign + // @ts-ignore + num = Math.abs(num); + //if the number is in scientific notation remove it + // @ts-ignore + if (/\d+\.?\d*e[\+\-]*\d+/i.test(num)) { + var zero = "0", + // @ts-ignore + parts = String(num).toLowerCase().split("e"), //split into coeff and exponent + e = parts.pop(), //store the exponential part + // @ts-ignore + l = Math.abs(e), //get the number of zeros + // @ts-ignore + sign = e / l, + coeff_array = parts[0].split("."); + if (sign === -1) { + l = l - coeff_array[0].length; + if (l < 0) { + // @ts-ignore + num = + coeff_array[0].slice(0, l) + + "." + + coeff_array[0].slice(l) + + (coeff_array.length === 2 ? coeff_array[1] : ""); + } else { + // @ts-ignore + num = zero + "." + new Array(l + 1).join(zero) + coeff_array.join(""); + } + } else { + var dec = coeff_array[1]; + if (dec) l = l - dec.length; + if (l < 0) { + // @ts-ignore + num = coeff_array[0] + dec.slice(0, l) + "." + dec.slice(l); + } else { + // @ts-ignore + num = coeff_array.join("") + new Array(l + 1).join(zero); + } + } + } + // @ts-ignore + return nsign < 0 ? "-" + num : num; }; export const trimDecimals = (n: string, decimals = 18) => { - n += ""; + n += ""; - if (n.indexOf(".") === -1) return n; + if (n.indexOf(".") === -1) return n; - const arr = n.split("."); - const fraction = arr[1].substr(0, decimals); - return arr[0] + "." + fraction; + const arr = n.split("."); + const fraction = arr[1].substr(0, decimals); + return arr[0] + "." + fraction; }; export function parseUnits(value: string, unit?: string | Numeric): bigint { - assertArgument( - typeof value === "string", - "value must be a string", - "value", - value, - ); - if (value.includes("e")) { - value = scientificToDecimal(value).toString(); - } - let decimals = 18; - if (typeof unit === "string") { - const index = names.indexOf(unit); - assertArgument(index >= 0, "invalid unit", "unit", unit); - decimals = 3 * index; - value = trimDecimals(value, decimals); - } else if (unit != null) { - decimals = getNumber(unit, "unit"); - value = trimDecimals(value, decimals); - } - - return FixedNumber.fromString(value, { decimals }).value; + assertArgument( + typeof value === "string", + "value must be a string", + "value", + value, + ); + if (value.includes("e")) { + value = scientificToDecimal(value).toString(); + } + let decimals = 18; + if (typeof unit === "string") { + const index = names.indexOf(unit); + assertArgument(index >= 0, "invalid unit", "unit", unit); + decimals = 3 * index; + value = trimDecimals(value, decimals); + } else if (unit != null) { + decimals = getNumber(unit, "unit"); + value = trimDecimals(value, decimals); + } + + return FixedNumber.fromString(value, { decimals }).value; } /** * Converts %%value%% into a //decimal string// using 18 decimal places. */ export function formatXCB(ore: BigNumberish): string { - return formatUnits(ore, 18); + return formatUnits(ore, 18); } /** @@ -167,5 +167,5 @@ export function formatXCB(ore: BigNumberish): string { * decimal places. */ export function parseXCB(xcb: string): bigint { - return parseUnits(xcb, 18); + return parseUnits(xcb, 18); } diff --git a/src.ts/utils/utf8.ts b/src.ts/utils/utf8.ts index c8220fecd..34c58509e 100644 --- a/src.ts/utils/utf8.ts +++ b/src.ts/utils/utf8.ts @@ -51,13 +51,13 @@ export type UnicodeNormalizationForm = "NFC" | "NFD" | "NFKC" | "NFKD"; * @returns string */ export type Utf8ErrorReason = - | "UNEXPECTED_CONTINUE" - | "BAD_PREFIX" - | "OVERRUN" - | "MISSING_CONTINUE" - | "OUT_OF_RANGE" - | "UTF16_SURROGATE" - | "OVERLONG"; + | "UNEXPECTED_CONTINUE" + | "BAD_PREFIX" + | "OVERRUN" + | "MISSING_CONTINUE" + | "OUT_OF_RANGE" + | "UTF16_SURROGATE" + | "OVERLONG"; /** * A callback that can be used with [[toUtf8String]] to analysis or @@ -80,81 +80,81 @@ export type Utf8ErrorReason = * when control resumes to the FSM. */ export type Utf8ErrorFunc = ( - reason: Utf8ErrorReason, - offset: number, - bytes: Uint8Array, - output: Array, - badCodepoint?: number, + reason: Utf8ErrorReason, + offset: number, + bytes: Uint8Array, + output: Array, + badCodepoint?: number, ) => number; function errorFunc( - reason: Utf8ErrorReason, - offset: number, - bytes: Uint8Array, - output: Array, - badCodepoint?: number, + reason: Utf8ErrorReason, + offset: number, + bytes: Uint8Array, + output: Array, + badCodepoint?: number, ): number { - assertArgument( - false, - `invalid codepoint at offset ${offset}; ${reason}`, - "bytes", - bytes, - ); + assertArgument( + false, + `invalid codepoint at offset ${offset}; ${reason}`, + "bytes", + bytes, + ); } function ignoreFunc( - reason: Utf8ErrorReason, - offset: number, - bytes: Uint8Array, - output: Array, - badCodepoint?: number, + reason: Utf8ErrorReason, + offset: number, + bytes: Uint8Array, + output: Array, + badCodepoint?: number, ): number { - // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes - if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { - let i = 0; - for (let o = offset + 1; o < bytes.length; o++) { - if (bytes[o] >> 6 !== 0x02) { - break; - } - i++; - } - return i; - } - - // This byte runs us past the end of the string, so just jump to the end - // (but the first byte was read already read and therefore skipped) - if (reason === "OVERRUN") { - return bytes.length - offset - 1; - } - - // Nothing to skip - return 0; + // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes + if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { + let i = 0; + for (let o = offset + 1; o < bytes.length; o++) { + if (bytes[o] >> 6 !== 0x02) { + break; + } + i++; + } + return i; + } + + // This byte runs us past the end of the string, so just jump to the end + // (but the first byte was read already read and therefore skipped) + if (reason === "OVERRUN") { + return bytes.length - offset - 1; + } + + // Nothing to skip + return 0; } function replaceFunc( - reason: Utf8ErrorReason, - offset: number, - bytes: Uint8Array, - output: Array, - badCodepoint?: number, + reason: Utf8ErrorReason, + offset: number, + bytes: Uint8Array, + output: Array, + badCodepoint?: number, ): number { - // Overlong representations are otherwise "valid" code points; just non-deistingtished - if (reason === "OVERLONG") { - assertArgument( - typeof badCodepoint === "number", - "invalid bad code point for replacement", - "badCodepoint", - badCodepoint, - ); - output.push(badCodepoint); - return 0; - } - - // Put the replacement character into the output - output.push(0xfffd); - - // Otherwise, process as if ignoring errors - return ignoreFunc(reason, offset, bytes, output, badCodepoint); + // Overlong representations are otherwise "valid" code points; just non-deistingtished + if (reason === "OVERLONG") { + assertArgument( + typeof badCodepoint === "number", + "invalid bad code point for replacement", + "badCodepoint", + badCodepoint, + ); + output.push(badCodepoint); + return 0; + } + + // Put the replacement character into the output + output.push(0xfffd); + + // Otherwise, process as if ignoring errors + return ignoreFunc(reason, offset, bytes, output, badCodepoint); } /** @@ -173,114 +173,114 @@ function replaceFunc( * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> */ export const Utf8ErrorFuncs: Readonly< - Record<"error" | "ignore" | "replace", Utf8ErrorFunc> + Record<"error" | "ignore" | "replace", Utf8ErrorFunc> > = Object.freeze({ - error: errorFunc, - ignore: ignoreFunc, - replace: replaceFunc, + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc, }); // http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 function getUtf8CodePoints( - _bytes: BytesLike, - onError?: Utf8ErrorFunc, + _bytes: BytesLike, + onError?: Utf8ErrorFunc, ): Array { - if (onError == null) { - onError = Utf8ErrorFuncs.error; - } - - const bytes = getBytes(_bytes, "bytes"); - - const result: Array = []; - let i = 0; - - // Invalid bytes are ignored - while (i < bytes.length) { - const c = bytes[i++]; - - // 0xxx xxxx - if (c >> 7 === 0) { - result.push(c); - continue; - } - - // Multibyte; how many bytes left for this character? - let extraLength: any = null; - let overlongMask: any = null; - - // 110x xxxx 10xx xxxx - if ((c & 0xe0) === 0xc0) { - extraLength = 1; - overlongMask = 0x7f; - - // 1110 xxxx 10xx xxxx 10xx xxxx - } else if ((c & 0xf0) === 0xe0) { - extraLength = 2; - overlongMask = 0x7ff; - - // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx - } else if ((c & 0xf8) === 0xf0) { - extraLength = 3; - overlongMask = 0xffff; - } else { - if ((c & 0xc0) === 0x80) { - i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); - } else { - i += onError("BAD_PREFIX", i - 1, bytes, result); - } - continue; - } - - // Do we have enough bytes in our data? - if (i - 1 + extraLength >= bytes.length) { - i += onError("OVERRUN", i - 1, bytes, result); - continue; - } - - // Remove the length prefix from the char - let res: null | number = c & ((1 << (8 - extraLength - 1)) - 1); - - for (let j = 0; j < extraLength; j++) { - let nextChar = bytes[i]; - - // Invalid continuation byte - if ((nextChar & 0xc0) != 0x80) { - i += onError("MISSING_CONTINUE", i, bytes, result); - res = null; - break; - } - - res = (res << 6) | (nextChar & 0x3f); - i++; - } - - // See above loop for invalid continuation byte - if (res === null) { - continue; - } - - // Maximum code point - if (res > 0x10ffff) { - i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); - continue; - } - - // Reserved for UTF-16 surrogate halves - if (res >= 0xd800 && res <= 0xdfff) { - i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); - continue; - } - - // Check for overlong sequences (more bytes than needed) - if (res <= overlongMask) { - i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); - continue; - } - - result.push(res); - } - - return result; + if (onError == null) { + onError = Utf8ErrorFuncs.error; + } + + const bytes = getBytes(_bytes, "bytes"); + + const result: Array = []; + let i = 0; + + // Invalid bytes are ignored + while (i < bytes.length) { + const c = bytes[i++]; + + // 0xxx xxxx + if (c >> 7 === 0) { + result.push(c); + continue; + } + + // Multibyte; how many bytes left for this character? + let extraLength: any = null; + let overlongMask: any = null; + + // 110x xxxx 10xx xxxx + if ((c & 0xe0) === 0xc0) { + extraLength = 1; + overlongMask = 0x7f; + + // 1110 xxxx 10xx xxxx 10xx xxxx + } else if ((c & 0xf0) === 0xe0) { + extraLength = 2; + overlongMask = 0x7ff; + + // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx + } else if ((c & 0xf8) === 0xf0) { + extraLength = 3; + overlongMask = 0xffff; + } else { + if ((c & 0xc0) === 0x80) { + i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); + } else { + i += onError("BAD_PREFIX", i - 1, bytes, result); + } + continue; + } + + // Do we have enough bytes in our data? + if (i - 1 + extraLength >= bytes.length) { + i += onError("OVERRUN", i - 1, bytes, result); + continue; + } + + // Remove the length prefix from the char + let res: null | number = c & ((1 << (8 - extraLength - 1)) - 1); + + for (let j = 0; j < extraLength; j++) { + let nextChar = bytes[i]; + + // Invalid continuation byte + if ((nextChar & 0xc0) != 0x80) { + i += onError("MISSING_CONTINUE", i, bytes, result); + res = null; + break; + } + + res = (res << 6) | (nextChar & 0x3f); + i++; + } + + // See above loop for invalid continuation byte + if (res === null) { + continue; + } + + // Maximum code point + if (res > 0x10ffff) { + i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); + continue; + } + + // Reserved for UTF-16 surrogate halves + if (res >= 0xd800 && res <= 0xdfff) { + i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); + continue; + } + + // Check for overlong sequences (more bytes than needed) + if (res <= overlongMask) { + i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); + continue; + } + + result.push(res); + } + + return result; } // http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array @@ -291,64 +291,64 @@ function getUtf8CodePoints( * If %%form%% is specified, the string is normalized. */ export function toUtf8Bytes( - str: string, - form?: UnicodeNormalizationForm, + str: string, + form?: UnicodeNormalizationForm, ): Uint8Array { - if (form != null) { - assertNormalize(form); - str = str.normalize(form); - } - - let result: any = []; - for (let i = 0; i < str.length; i++) { - const c = str.charCodeAt(i); - - if (c < 0x80) { - result.push(c); - } else if (c < 0x800) { - result.push((c >> 6) | 0xc0); - result.push((c & 0x3f) | 0x80); - } else if ((c & 0xfc00) == 0xd800) { - i++; - const c2 = str.charCodeAt(i); - - assertArgument( - i < str.length && (c2 & 0xfc00) === 0xdc00, - "invalid surrogate pair", - "str", - str, - ); - - // Surrogate Pair - const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); - result.push((pair >> 18) | 0xf0); - result.push(((pair >> 12) & 0x3f) | 0x80); - result.push(((pair >> 6) & 0x3f) | 0x80); - result.push((pair & 0x3f) | 0x80); - } else { - result.push((c >> 12) | 0xe0); - result.push(((c >> 6) & 0x3f) | 0x80); - result.push((c & 0x3f) | 0x80); - } - } - - return new Uint8Array(result); + if (form != null) { + assertNormalize(form); + str = str.normalize(form); + } + + let result: any = []; + for (let i = 0; i < str.length; i++) { + const c = str.charCodeAt(i); + + if (c < 0x80) { + result.push(c); + } else if (c < 0x800) { + result.push((c >> 6) | 0xc0); + result.push((c & 0x3f) | 0x80); + } else if ((c & 0xfc00) == 0xd800) { + i++; + const c2 = str.charCodeAt(i); + + assertArgument( + i < str.length && (c2 & 0xfc00) === 0xdc00, + "invalid surrogate pair", + "str", + str, + ); + + // Surrogate Pair + const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); + result.push((pair >> 18) | 0xf0); + result.push(((pair >> 12) & 0x3f) | 0x80); + result.push(((pair >> 6) & 0x3f) | 0x80); + result.push((pair & 0x3f) | 0x80); + } else { + result.push((c >> 12) | 0xe0); + result.push(((c >> 6) & 0x3f) | 0x80); + result.push((c & 0x3f) | 0x80); + } + } + + return new Uint8Array(result); } //export function _toUtf8String(codePoints: Array): string { - return codePoints - .map((codePoint) => { - if (codePoint <= 0xffff) { - return String.fromCharCode(codePoint); - } - codePoint -= 0x10000; - return String.fromCharCode( - ((codePoint >> 10) & 0x3ff) + 0xd800, - (codePoint & 0x3ff) + 0xdc00, - ); - }) - .join(""); + return codePoints + .map((codePoint) => { + if (codePoint <= 0xffff) { + return String.fromCharCode(codePoint); + } + codePoint -= 0x10000; + return String.fromCharCode( + ((codePoint >> 10) & 0x3ff) + 0xd800, + (codePoint & 0x3ff) + 0xdc00, + ); + }) + .join(""); } /** @@ -359,10 +359,10 @@ function _toUtf8String(codePoints: Array): string { * (default: [error](Utf8ErrorFuncs)) */ export function toUtf8String( - bytes: BytesLike, - onError?: Utf8ErrorFunc, + bytes: BytesLike, + onError?: Utf8ErrorFunc, ): string { - return _toUtf8String(getUtf8CodePoints(bytes, onError)); + return _toUtf8String(getUtf8CodePoints(bytes, onError)); } /** @@ -371,8 +371,8 @@ export function toUtf8String( * If %%form%% is specified, the string is normalized. */ export function toUtf8CodePoints( - str: string, - form?: UnicodeNormalizationForm, + str: string, + form?: UnicodeNormalizationForm, ): Array { - return getUtf8CodePoints(toUtf8Bytes(str, form)); + return getUtf8CodePoints(toUtf8Bytes(str, form)); } diff --git a/src.ts/utils/uuid.ts b/src.ts/utils/uuid.ts index 268d46e9e..0103dfa08 100644 --- a/src.ts/utils/uuid.ts +++ b/src.ts/utils/uuid.ts @@ -13,24 +13,24 @@ import type { BytesLike } from "./index.js"; * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) */ export function uuidV4(randomBytes: BytesLike): string { - const bytes = getBytes(randomBytes, "randomBytes"); + const bytes = getBytes(randomBytes, "randomBytes"); - // Section: 4.1.3: - // - time_hi_and_version[12:16] = 0b0100 - bytes[6] = (bytes[6] & 0x0f) | 0x40; + // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + bytes[6] = (bytes[6] & 0x0f) | 0x40; - // Section 4.4 - // - clock_seq_hi_and_reserved[6] = 0b0 - // - clock_seq_hi_and_reserved[7] = 0b1 - bytes[8] = (bytes[8] & 0x3f) | 0x80; + // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + bytes[8] = (bytes[8] & 0x3f) | 0x80; - const value = hexlify(bytes); + const value = hexlify(bytes); - return [ - value.substring(2, 10), - value.substring(10, 14), - value.substring(14, 18), - value.substring(18, 22), - value.substring(22, 34), - ].join("-"); + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34), + ].join("-"); } diff --git a/src.ts/wallet/base-wallet.ts b/src.ts/wallet/base-wallet.ts index 1c94a758e..ed450362c 100644 --- a/src.ts/wallet/base-wallet.ts +++ b/src.ts/wallet/base-wallet.ts @@ -3,10 +3,10 @@ import { hashMessage, TypedDataEncoder } from "../hash/index.js"; import { AbstractSigner } from "../providers/index.js"; import { computeAddress, Transaction } from "../transaction/index.js"; import { - defineProperties, - resolveProperties, - assert, - assertArgument, + defineProperties, + resolveProperties, + assert, + assertArgument, } from "../utils/index.js"; import { sha256, SigningKey } from "../crypto/index.js"; @@ -26,154 +26,154 @@ import type { TransactionLike } from "../transaction/index.js"; * a minimal Signer. */ export class BaseWallet extends AbstractSigner { - /** - * The wallet address. - */ - readonly address!: string; - readonly prefix: string; - - readonly #signingKey: SigningKey; - - /** - * Creates a new BaseWallet for %%privateKey%%, optionally - * connected to %%provider%%. - * - * If %%provider%% is not specified, only offline methods can - * be used. - */ - constructor({ - signingKey, - prefix, - provider, - }: { - signingKey: SigningKey; - prefix: string; - provider?: null | Provider; - }) { - super(provider); - this.prefix = prefix; - - assertArgument( - signingKey && typeof signingKey.sign === "function", - "invalid signingKey key", - "signingKey", - "[ REDACTED ]", - ); - - this.#signingKey = signingKey; - const address = computeAddress(this.#signingKey, prefix); - defineProperties(this, { address }); - } - - // Store private values behind getters to reduce visibility - // in console.log - - /** - * The [[SigningKey]] used for signing payloads. - */ - get signingKey(): SigningKey { - return this.#signingKey; - } - - /** - * The private key for this wallet. - */ - get privateKey(): string { - return this.signingKey.privateKey; - } - - async getAddress(): Promise { - return this.address; - } - - connect(provider: null | Provider): BaseWallet { - return new BaseWallet({ - signingKey: this.#signingKey, - prefix: this.prefix, - provider, - }); - } - - async signTransaction(tx: TransactionRequest): Promise { - // Replace any Addressable or ENS name with an address - const { to, from } = await resolveProperties({ - to: tx.to || undefined, - from: tx.from || undefined, - }); - - if (to != null) { - tx.to = to; - } - if (from != null) { - tx.from = from; - } - if (tx.from != null) { - assertArgument( - getAddress(tx.from) === this.address, - "transaction from address mismatch", - "tx.from", - tx.from, - ); - delete tx.from; - } - - // Build the transaction - const btx = Transaction.from(>tx); - const unSignedSerialized = btx.unsignedSerialized; - const unsignedHash = sha256(unSignedSerialized); - // sha256(btx.unsignedSerialized) - btx.signature = this.signingKey.sign(unsignedHash); - return btx.serialized; - } - - async signMessage(message: string | Uint8Array): Promise { - return this.signMessageSync(message); - } - - // @TODO: Add a secialized signTx and signTyped sync that enforces - // all parameters are known? - /** - * Returns the signature for %%message%% signed with this wallet. - */ - signMessageSync(message: string | Uint8Array): string { - return this.signingKey.sign(hashMessage(message)); - } - - async signTypedData( - domain: TypedDataDomain, - types: Record>, - value: Record, - ): Promise { - // Populate any ENS names - const populated = await TypedDataEncoder.resolveNames( - domain, - types, - value, - async (name: string) => { - // @TODO: this should use resolveName; addresses don't - // need a provider - - assert( - this.provider != null, - "cannot resolve ENS names without a provider", - "UNSUPPORTED_OPERATION", - { - operation: "resolveName", - info: { name }, - }, - ); - - const address = getAddress(name); - assert(address != null, "unconfigured ENS name", "UNCONFIGURED_NAME", { - value: name, - }); - - return address; - }, - ); - - return this.signingKey.sign( - TypedDataEncoder.hash(populated.domain, types, populated.value), - ); - } + /** + * The wallet address. + */ + readonly address!: string; + readonly prefix: string; + + readonly #signingKey: SigningKey; + + /** + * Creates a new BaseWallet for %%privateKey%%, optionally + * connected to %%provider%%. + * + * If %%provider%% is not specified, only offline methods can + * be used. + */ + constructor({ + signingKey, + prefix, + provider, + }: { + signingKey: SigningKey; + prefix: string; + provider?: null | Provider; + }) { + super(provider); + this.prefix = prefix; + + assertArgument( + signingKey && typeof signingKey.sign === "function", + "invalid signingKey key", + "signingKey", + "[ REDACTED ]", + ); + + this.#signingKey = signingKey; + const address = computeAddress(this.#signingKey, prefix); + defineProperties(this, { address }); + } + + // Store private values behind getters to reduce visibility + // in console.log + + /** + * The [[SigningKey]] used for signing payloads. + */ + get signingKey(): SigningKey { + return this.#signingKey; + } + + /** + * The private key for this wallet. + */ + get privateKey(): string { + return this.signingKey.privateKey; + } + + async getAddress(): Promise { + return this.address; + } + + connect(provider: null | Provider): BaseWallet { + return new BaseWallet({ + signingKey: this.#signingKey, + prefix: this.prefix, + provider, + }); + } + + async signTransaction(tx: TransactionRequest): Promise { + // Replace any Addressable or ENS name with an address + const { to, from } = await resolveProperties({ + to: tx.to || undefined, + from: tx.from || undefined, + }); + + if (to != null) { + tx.to = to; + } + if (from != null) { + tx.from = from; + } + if (tx.from != null) { + assertArgument( + getAddress(tx.from) === this.address, + "transaction from address mismatch", + "tx.from", + tx.from, + ); + delete tx.from; + } + + // Build the transaction + const btx = Transaction.from(>tx); + const unSignedSerialized = btx.unsignedSerialized; + const unsignedHash = sha256(unSignedSerialized); + // sha256(btx.unsignedSerialized) + btx.signature = this.signingKey.sign(unsignedHash); + return btx.serialized; + } + + async signMessage(message: string | Uint8Array): Promise { + return this.signMessageSync(message); + } + + // @TODO: Add a secialized signTx and signTyped sync that enforces + // all parameters are known? + /** + * Returns the signature for %%message%% signed with this wallet. + */ + signMessageSync(message: string | Uint8Array): string { + return this.signingKey.sign(hashMessage(message)); + } + + async signTypedData( + domain: TypedDataDomain, + types: Record>, + value: Record, + ): Promise { + // Populate any ENS names + const populated = await TypedDataEncoder.resolveNames( + domain, + types, + value, + async (name: string) => { + // @TODO: this should use resolveName; addresses don't + // need a provider + + assert( + this.provider != null, + "cannot resolve ENS names without a provider", + "UNSUPPORTED_OPERATION", + { + operation: "resolveName", + info: { name }, + }, + ); + + const address = getAddress(name); + assert(address != null, "unconfigured ENS name", "UNCONFIGURED_NAME", { + value: name, + }); + + return address; + }, + ); + + return this.signingKey.sign( + TypedDataEncoder.hash(populated.domain, types, populated.value), + ); + } } diff --git a/src.ts/wallet/english_words.ts b/src.ts/wallet/english_words.ts index 0921f6edd..fc22392bf 100644 --- a/src.ts/wallet/english_words.ts +++ b/src.ts/wallet/english_words.ts @@ -1,2 +1,2 @@ export const englishWords = - "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; + "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; diff --git a/src.ts/wallet/hdwallet.ts b/src.ts/wallet/hdwallet.ts index b16079d29..969a545dc 100644 --- a/src.ts/wallet/hdwallet.ts +++ b/src.ts/wallet/hdwallet.ts @@ -5,19 +5,19 @@ */ import { randomBytes, ripemd160, SigningKey, sha256 } from "../crypto/index.js"; import { - dataSlice, - defineProperties, - getNumber, - assertPrivate, - assertArgument, + dataSlice, + defineProperties, + getNumber, + assertPrivate, + assertArgument, } from "../utils/index.js"; import { LangEn } from "../wordlists/lang-en.js"; import { BaseWallet } from "./base-wallet.js"; import { Mnemonic } from "./mnemonic.js"; import { - encryptKeystoreJson, - encryptKeystoreJsonSync, + encryptKeystoreJson, + encryptKeystoreJsonSync, } from "./json-keystore.js"; import type { ProgressCallback } from "../crypto/index.js"; @@ -79,47 +79,47 @@ const _guard = {}; type HDNodeLike = { depth: number; deriveChild: (i: number) => T }; function derivePath>(node: T, path: string): T { - const components = path.split("/"); - - assertArgument( - components.length > 0 && (components[0] === "m" || node.depth > 0), - "invalid path", - "path", - path, - ); - - if (components[0] === "m") { - components.shift(); - } - - let result: T = node; - for (let i = 0; i < components.length; i++) { - const component = components[i]; - - if (component.match(/^[0-9]+'$/)) { - const index = parseInt(component.substring(0, component.length - 1)); - assertArgument( - index < HardenedBit, - "invalid path index", - `path[${i}]`, - component, - ); - result = result.deriveChild(HardenedBit + index); - } else if (component.match(/^[0-9]+$/)) { - const index = parseInt(component); - assertArgument( - index < HardenedBit, - "invalid path index", - `path[${i}]`, - component, - ); - result = result.deriveChild(index); - } else { - assertArgument(false, "invalid path component", `path[${i}]`, component); - } - } - - return result; + const components = path.split("/"); + + assertArgument( + components.length > 0 && (components[0] === "m" || node.depth > 0), + "invalid path", + "path", + path, + ); + + if (components[0] === "m") { + components.shift(); + } + + let result: T = node; + for (let i = 0; i < components.length; i++) { + const component = components[i]; + + if (component.match(/^[0-9]+'$/)) { + const index = parseInt(component.substring(0, component.length - 1)); + assertArgument( + index < HardenedBit, + "invalid path index", + `path[${i}]`, + component, + ); + result = result.deriveChild(HardenedBit + index); + } else if (component.match(/^[0-9]+$/)) { + const index = parseInt(component); + assertArgument( + index < HardenedBit, + "invalid path index", + `path[${i}]`, + component, + ); + result = result.deriveChild(index); + } else { + assertArgument(false, "invalid path component", `path[${i}]`, component); + } + } + + return result; } /** @@ -131,346 +131,346 @@ function derivePath>(node: T, path: string): T { * a path indicating the index of each child. */ export class HDNodeWallet extends BaseWallet { - /** - * The compressed public key. - */ - readonly publicKey!: string; - prefix: string; - /** - * The fingerprint. - * - * A fingerprint allows quick qay to detect parent and child nodes, - * but developers should be prepared to deal with collisions as it - * is only 4 bytes. - */ - readonly fingerprint!: string; - - /** - * The parent fingerprint. - */ - readonly parentFingerprint!: string; - - /** - * The mnemonic used to create this HD Node, if available. - * - * Sources such as extended keys do not encode the mnemonic, in - * which case this will be ``null``. - */ - readonly mnemonic!: null | Mnemonic; - - readonly #seed!: string; - /** - * The derivation path of this wallet. - * - * Since extended keys do not provider full path details, this - * may be ``null``, if instantiated from a source that does not - * enocde it. - */ - readonly path!: null | string; - - /** - * The child index of this wallet. Values over ``2 *\* 31`` indicate - * the node is hardened. - */ - readonly index!: number; - - /** - * The depth of this wallet, which is the number of components - * in its path. - */ - readonly depth!: number; - - /** - * @private - */ - constructor({ - guard, - seed, - signingKey, - parentFingerprint, - path, - index, - depth, - mnemonic, - provider, - prefix, - }: { - guard: any; - seed: string; - signingKey: SigningKey; - parentFingerprint: string; - path: null | string; - index: number; - depth: number; - mnemonic: null | Mnemonic; - provider: null | Provider; - prefix: string; - }) { - super({ - signingKey, - prefix, - provider, - }); - assertPrivate(guard, _guard, "HDNodeWallet"); - - defineProperties(this, { publicKey: signingKey.publicKey }); - - this.prefix = prefix; - this.#seed = seed; - const fingerprint = dataSlice(ripemd160(sha256(this.publicKey)), 0, 4); - defineProperties(this, { - parentFingerprint, - fingerprint, - path, - index, - depth, - }); - - defineProperties(this, { mnemonic }); - } - - connect(provider: null | Provider): HDNodeWallet { - return new HDNodeWallet({ - guard: _guard, - signingKey: this.signingKey, - parentFingerprint: this.parentFingerprint, - path: this.path, - index: this.index, - depth: this.depth, - seed: this.#seed, - mnemonic: this.mnemonic, - provider, - prefix: this.prefix, - }); - } - - #account(): KeystoreAccount { - const account: KeystoreAccount = { - address: this.address, - privateKey: this.privateKey, - }; - const m = this.mnemonic; - if (this.path && m && m.wordlist.locale === "en" && m.password === "") { - account.mnemonic = { - path: this.path, - locale: "en", - entropy: m.entropy, - }; - } - - return account; - } - - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - async encrypt( - password: Uint8Array | string, - progressCallback?: ProgressCallback, - ): Promise { - return await encryptKeystoreJson(this.#account(), password, { - progressCallback, - }); - } - - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password: Uint8Array | string): string { - return encryptKeystoreJsonSync(this.#account(), password); - } - - /** - * Returns true if this wallet has a path, providing a Type Guard - * that the path is non-null. - */ - hasPath(): this is { path: string } { - return this.path != null; - } - - /** - * Return the child for %%index%%. - */ - deriveChild(_index: number): HDNodeWallet { - const newPrivateKey = Ed448Goldilock.HDWalletGenerateKeyFromSeed( - this.#seed, - Number(_index), - ); - const newSigningKey = new SigningKey(newPrivateKey); - - // Base path - let path = this.path; - if (path) { - path += "/" + (_index & ~HardenedBit); - if (_index & HardenedBit) { - path += "'"; - } - } - - return new HDNodeWallet({ - guard: _guard, - signingKey: newSigningKey, - parentFingerprint: this.fingerprint, - path, - index: _index, - seed: this.#seed, - depth: this.depth + 1, - mnemonic: this.mnemonic, - provider: this.provider, - prefix: this.prefix, - }); - } - - /** - * Return the HDNode for %%path%% from this node. - */ - derivePath(path: string): HDNodeWallet { - return derivePath(this, path); - } - - static #fromSeed({ - _seed, - mnemonic, - prefix, - path, - }: { - _seed: string; - mnemonic: null | Mnemonic; - prefix: string; - path?: string; - }): HDNodeWallet { - const extendetPrivateKey = Ed448Goldilock.HDWalletGenerateKeyFromSeed( - _seed, - 0, - ); - const signingKey = new SigningKey(extendetPrivateKey); - // console.log({ privateKey, thisKey: signingKey.privateKey,len:tmp.privateKey.length }) - return new HDNodeWallet({ - seed: _seed, - guard: _guard, - signingKey, - parentFingerprint: "0x00000000", - path: path || defaultPath, - index: 0, - depth: 0, - mnemonic, - provider: null, - prefix, - }); - } - - /** - * Creates a new random HDNode. - */ - static createRandom( - prefix: string, - password?: string, - path?: string, - wordlist?: Wordlist, - ): HDNodeWallet { - if (password == null) { - password = ""; - } - if (path == null) { - path = defaultPath; - } - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - const mnemonic = Mnemonic.fromEntropy(randomBytes(32), password, wordlist); - return HDNodeWallet.#fromSeed({ - _seed: mnemonic.computeSeed(), - mnemonic, - prefix, - }).derivePath(path); - } - - /** - * Create am HD Node from %%mnemonic%%. - */ - static fromMnemonic( - mnemonic: Mnemonic, - prefix: string, - path?: string, - ): HDNodeWallet { - if (!path) { - path = defaultPath; - } - return HDNodeWallet.#fromSeed({ - _seed: mnemonic.computeSeed(), - mnemonic, - prefix, - }).derivePath(path); - } - static mnemonicToSeed(mnemonic: string, password?: string): string { - const seed = mnemonicToSeed(mnemonic, password); - return seed; - } - - /** - * Creates an HD Node from a mnemonic %%phrase%%. - */ - static fromPhrase({ - phrase, - prefix, - password, - path, - wordlist, - }: { - phrase: string; - prefix: string; - password?: string; - path?: string; - wordlist?: Wordlist; - }): HDNodeWallet { - if (!password) { - password = ""; - } - if (!path) { - path = defaultPath; - } - if (!wordlist) { - wordlist = LangEn.wordlist(); - } - const mnemonic = Mnemonic.fromPhrase({ phrase, password, wordlist }); - const _seed = mnemonic.computeSeed(); - return HDNodeWallet.#fromSeed({ - _seed, - mnemonic, - prefix, - }).derivePath(path); - } - - /** - * Creates an HD Node from a %%seed%%. - */ - static fromSeed({ - seed, - prefix, - path, - }: { - seed: string; - prefix: string; - path?: string; - }): HDNodeWallet { - return HDNodeWallet.#fromSeed({ - _seed: seed, - mnemonic: null, - path: path || defaultPath, - prefix, - }); - } + /** + * The compressed public key. + */ + readonly publicKey!: string; + prefix: string; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + readonly fingerprint!: string; + + /** + * The parent fingerprint. + */ + readonly parentFingerprint!: string; + + /** + * The mnemonic used to create this HD Node, if available. + * + * Sources such as extended keys do not encode the mnemonic, in + * which case this will be ``null``. + */ + readonly mnemonic!: null | Mnemonic; + + readonly #seed!: string; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provider full path details, this + * may be ``null``, if instantiated from a source that does not + * enocde it. + */ + readonly path!: null | string; + + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + readonly index!: number; + + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + readonly depth!: number; + + /** + * @private + */ + constructor({ + guard, + seed, + signingKey, + parentFingerprint, + path, + index, + depth, + mnemonic, + provider, + prefix, + }: { + guard: any; + seed: string; + signingKey: SigningKey; + parentFingerprint: string; + path: null | string; + index: number; + depth: number; + mnemonic: null | Mnemonic; + provider: null | Provider; + prefix: string; + }) { + super({ + signingKey, + prefix, + provider, + }); + assertPrivate(guard, _guard, "HDNodeWallet"); + + defineProperties(this, { publicKey: signingKey.publicKey }); + + this.prefix = prefix; + this.#seed = seed; + const fingerprint = dataSlice(ripemd160(sha256(this.publicKey)), 0, 4); + defineProperties(this, { + parentFingerprint, + fingerprint, + path, + index, + depth, + }); + + defineProperties(this, { mnemonic }); + } + + connect(provider: null | Provider): HDNodeWallet { + return new HDNodeWallet({ + guard: _guard, + signingKey: this.signingKey, + parentFingerprint: this.parentFingerprint, + path: this.path, + index: this.index, + depth: this.depth, + seed: this.#seed, + mnemonic: this.mnemonic, + provider, + prefix: this.prefix, + }); + } + + #account(): KeystoreAccount { + const account: KeystoreAccount = { + address: this.address, + privateKey: this.privateKey, + }; + const m = this.mnemonic; + if (this.path && m && m.wordlist.locale === "en" && m.password === "") { + account.mnemonic = { + path: this.path, + locale: "en", + entropy: m.entropy, + }; + } + + return account; + } + + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + async encrypt( + password: Uint8Array | string, + progressCallback?: ProgressCallback, + ): Promise { + return await encryptKeystoreJson(this.#account(), password, { + progressCallback, + }); + } + + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password: Uint8Array | string): string { + return encryptKeystoreJsonSync(this.#account(), password); + } + + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath(): this is { path: string } { + return this.path != null; + } + + /** + * Return the child for %%index%%. + */ + deriveChild(_index: number): HDNodeWallet { + const newPrivateKey = Ed448Goldilock.HDWalletGenerateKeyFromSeed( + this.#seed, + Number(_index), + ); + const newSigningKey = new SigningKey(newPrivateKey); + + // Base path + let path = this.path; + if (path) { + path += "/" + (_index & ~HardenedBit); + if (_index & HardenedBit) { + path += "'"; + } + } + + return new HDNodeWallet({ + guard: _guard, + signingKey: newSigningKey, + parentFingerprint: this.fingerprint, + path, + index: _index, + seed: this.#seed, + depth: this.depth + 1, + mnemonic: this.mnemonic, + provider: this.provider, + prefix: this.prefix, + }); + } + + /** + * Return the HDNode for %%path%% from this node. + */ + derivePath(path: string): HDNodeWallet { + return derivePath(this, path); + } + + static #fromSeed({ + _seed, + mnemonic, + prefix, + path, + }: { + _seed: string; + mnemonic: null | Mnemonic; + prefix: string; + path?: string; + }): HDNodeWallet { + const extendetPrivateKey = Ed448Goldilock.HDWalletGenerateKeyFromSeed( + _seed, + 0, + ); + const signingKey = new SigningKey(extendetPrivateKey); + // console.log({ privateKey, thisKey: signingKey.privateKey,len:tmp.privateKey.length }) + return new HDNodeWallet({ + seed: _seed, + guard: _guard, + signingKey, + parentFingerprint: "0x00000000", + path: path || defaultPath, + index: 0, + depth: 0, + mnemonic, + provider: null, + prefix, + }); + } + + /** + * Creates a new random HDNode. + */ + static createRandom( + prefix: string, + password?: string, + path?: string, + wordlist?: Wordlist, + ): HDNodeWallet { + if (password == null) { + password = ""; + } + if (path == null) { + path = defaultPath; + } + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + const mnemonic = Mnemonic.fromEntropy(randomBytes(32), password, wordlist); + return HDNodeWallet.#fromSeed({ + _seed: mnemonic.computeSeed(), + mnemonic, + prefix, + }).derivePath(path); + } + + /** + * Create am HD Node from %%mnemonic%%. + */ + static fromMnemonic( + mnemonic: Mnemonic, + prefix: string, + path?: string, + ): HDNodeWallet { + if (!path) { + path = defaultPath; + } + return HDNodeWallet.#fromSeed({ + _seed: mnemonic.computeSeed(), + mnemonic, + prefix, + }).derivePath(path); + } + static mnemonicToSeed(mnemonic: string, password?: string): string { + const seed = mnemonicToSeed(mnemonic, password); + return seed; + } + + /** + * Creates an HD Node from a mnemonic %%phrase%%. + */ + static fromPhrase({ + phrase, + prefix, + password, + path, + wordlist, + }: { + phrase: string; + prefix: string; + password?: string; + path?: string; + wordlist?: Wordlist; + }): HDNodeWallet { + if (!password) { + password = ""; + } + if (!path) { + path = defaultPath; + } + if (!wordlist) { + wordlist = LangEn.wordlist(); + } + const mnemonic = Mnemonic.fromPhrase({ phrase, password, wordlist }); + const _seed = mnemonic.computeSeed(); + return HDNodeWallet.#fromSeed({ + _seed, + mnemonic, + prefix, + }).derivePath(path); + } + + /** + * Creates an HD Node from a %%seed%%. + */ + static fromSeed({ + seed, + prefix, + path, + }: { + seed: string; + prefix: string; + path?: string; + }): HDNodeWallet { + return HDNodeWallet.#fromSeed({ + _seed: seed, + mnemonic: null, + path: path || defaultPath, + prefix, + }); + } } /* @@ -499,14 +499,14 @@ export class HDNodeWalletManager { * some software. */ export function getAccountPath(_index: Numeric): string { - const index = getNumber(_index, "index"); - assertArgument( - index >= 0 && index < HardenedBit, - "invalid account index", - "index", - index, - ); - return `m/44'/60'/${index}'/0/0`; + const index = getNumber(_index, "index"); + assertArgument( + index >= 0 && index < HardenedBit, + "invalid account index", + "index", + index, + ); + return `m/44'/60'/${index}'/0/0`; } /** @@ -519,12 +519,12 @@ export function getAccountPath(_index: Numeric): string { * This is the pattern used by wallets like MetaMask. */ export function getIndexedAccountPath(_index: Numeric): string { - const index = getNumber(_index, "index"); - assertArgument( - index >= 0 && index < HardenedBit, - "invalid account index", - "index", - index, - ); - return `m/44'/60'/0'/0/${index}`; + const index = getNumber(_index, "index"); + assertArgument( + index >= 0 && index < HardenedBit, + "invalid account index", + "index", + index, + ); + return `m/44'/60'/0'/0/${index}`; } diff --git a/src.ts/wallet/index.ts b/src.ts/wallet/index.ts index 284eb5985..dbd3977f2 100644 --- a/src.ts/wallet/index.ts +++ b/src.ts/wallet/index.ts @@ -20,20 +20,20 @@ export { BaseWallet } from "./base-wallet.js"; export { - defaultPath, - getAccountPath, - getIndexedAccountPath, - HDNodeWallet, + defaultPath, + getAccountPath, + getIndexedAccountPath, + HDNodeWallet, } from "./hdwallet.js"; export { isCrowdsaleJson, decryptCrowdsaleJson } from "./json-crowdsale.js"; export { - isKeystoreJson, - decryptKeystoreJsonSync, - decryptKeystoreJson, - encryptKeystoreJson, - encryptKeystoreJsonSync, + isKeystoreJson, + decryptKeystoreJsonSync, + decryptKeystoreJson, + encryptKeystoreJson, + encryptKeystoreJsonSync, } from "./json-keystore.js"; export { Mnemonic } from "./mnemonic.js"; diff --git a/src.ts/wallet/json-crowdsale.ts b/src.ts/wallet/json-crowdsale.ts index e043219f2..90c71cf75 100644 --- a/src.ts/wallet/json-crowdsale.ts +++ b/src.ts/wallet/json-crowdsale.ts @@ -3,7 +3,12 @@ */ // @ts-ignore import pkg from "aes-js"; -const { CBC, pkcs7Strip } = pkg; +const { + ModeOfOperation: { cbc: CBC }, + padding: { + pkcs7: { strip: pkcs7Strip }, + }, +} = pkg; import { getAddress } from "../address/index.js"; import { pbkdf2 } from "../crypto/index.js"; import { id } from "../hash/index.js"; @@ -16,21 +21,21 @@ import { getPassword, looseArrayify, spelunk } from "./utils.js"; * minimal. */ export type CrowdsaleAccount = { - privateKey: string; - address: string; + privateKey: string; + address: string; }; /** * Returns true if %%json%% is a valid JSON Crowdsale wallet. */ export function isCrowdsaleJson(json: string): boolean { - try { - const data = JSON.parse(json); - if (data.encseed) { - return true; - } - } catch (error) {} - return false; + try { + const data = JSON.parse(json); + if (data.encseed) { + return true; + } + } catch (error) {} + return false; } /** @@ -44,41 +49,41 @@ export function isCrowdsaleJson(json: string): boolean { * the library. */ export function decryptCrowdsaleJson( - json: string, - _password: string | Uint8Array, + json: string, + _password: string | Uint8Array, ): CrowdsaleAccount { - const data = JSON.parse(json); - const password = getPassword(_password); + const data = JSON.parse(json); + const password = getPassword(_password); - // Core Address - const address = getAddress(spelunk(data, "ethaddr:string!")); + // Core Address + const address = getAddress(spelunk(data, "ethaddr:string!")); - // Encrypted Seed - const encseed = looseArrayify(spelunk(data, "encseed:string!")); - assertArgument( - encseed && encseed.length % 16 === 0, - "invalid encseed", - "json", - json, - ); + // Encrypted Seed + const encseed = looseArrayify(spelunk(data, "encseed:string!")); + assertArgument( + encseed && encseed.length % 16 === 0, + "invalid encseed", + "json", + json, + ); - const key = getBytes(pbkdf2(password, password, 2000, 32, "sha256")).slice( - 0, - 16, - ); + const key = getBytes(pbkdf2(password, password, 2000, 32, "sha256")).slice( + 0, + 16, + ); - const iv = encseed.slice(0, 16); - const encryptedSeed = encseed.slice(16); + const iv = encseed.slice(0, 16); + const encryptedSeed = encseed.slice(16); - // Decrypt the seed - const aesCbc = new CBC(key, iv); - const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed))); + // Decrypt the seed + const aesCbc = new CBC(key, iv); + const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed))); - // This wallet format is weird... Convert the binary encoded hex to a string. - let seedHex = ""; - for (let i = 0; i < seed.length; i++) { - seedHex += String.fromCharCode(seed[i]); - } + // This wallet format is weird... Convert the binary encoded hex to a string. + let seedHex = ""; + for (let i = 0; i < seed.length; i++) { + seedHex += String.fromCharCode(seed[i]); + } - return { address, privateKey: id(seedHex) }; + return { address, privateKey: id(seedHex) }; } diff --git a/src.ts/wallet/json-keystore.ts b/src.ts/wallet/json-keystore.ts index bbfb46b4b..26e3b3001 100644 --- a/src.ts/wallet/json-keystore.ts +++ b/src.ts/wallet/json-keystore.ts @@ -10,23 +10,26 @@ */ // @ts-ignore import pkg from "aes-js"; -const { CTR } = pkg; +const { + Counter, + ModeOfOperation: { ctr: CTR }, +} = pkg; import { getAddress } from "../address/index.js"; import { - pbkdf2, - randomBytes, - scrypt, - scryptSync, - sha256, + pbkdf2, + randomBytes, + scrypt, + scryptSync, + sha256, } from "../crypto/index.js"; import { - concat, - getBytes, - hexlify, - uuidV4, - assert, - assertArgument, + concat, + getBytes, + hexlify, + uuidV4, + assert, + assertArgument, } from "../utils/index.js"; import { getPassword, spelunk, zpad } from "./utils.js"; @@ -43,180 +46,220 @@ const defaultPath = "m/44'/60'/0'/0/0"; * The contents of a JSON Keystore Wallet. */ export type KeystoreAccount = { - address: string; - privateKey: string; - mnemonic?: { - path?: string; - locale?: string; - entropy: string; - }; + address: string; + privateKey: string; + mnemonic?: { + path?: string; + locale?: string; + entropy: string; + }; }; /** * The parameters to use when encrypting a JSON Keystore Wallet. */ export type EncryptOptions = { - progressCallback?: ProgressCallback; - iv?: BytesLike; - entropy?: BytesLike; - client?: string; - salt?: BytesLike; - uuid?: string; - scrypt?: { - N?: number; - r?: number; - p?: number; - }; + progressCallback?: ProgressCallback; + iv?: BytesLike; + entropy?: BytesLike; + client?: string; + salt?: BytesLike; + uuid?: string; + scrypt?: { + N?: number; + r?: number; + p?: number; + }; }; /** * Returns true if %%json%% is a valid JSON Keystore Wallet. */ export function isKeystoreJson(json: string): boolean { - try { - const data = JSON.parse(json); - const version = data.version != null ? parseInt(data.version) : 0; - if (version === 3) { - return true; - } - } catch (error) {} - return false; + try { + const data = JSON.parse(json); + const version = data.version != null ? parseInt(data.version) : 0; + if (version === 3) { + return true; + } + } catch (error) {} + return false; } function decrypt(data: any, key: Uint8Array, ciphertext: Uint8Array): string { - const cipher = spelunk(data, "crypto.cipher:string"); - if (cipher === "aes-128-ctr") { - const iv = spelunk(data, "crypto.cipherparams.iv:data!"); - const aesCtr = new CTR(key, iv); - return hexlify(aesCtr.decrypt(ciphertext)); - } - - assert(false, "unsupported cipher", "UNSUPPORTED_OPERATION", { - operation: "decrypt", - }); + const cipher = spelunk(data, "crypto.cipher:string"); + if (cipher === "aes-128-ctr") { + const iv = spelunk(data, "crypto.cipherparams.iv:data!"); + const aesCtr = new CTR(key, new Counter(iv)); + return hexlify(aesCtr.decrypt(ciphertext)); + } + + assert(false, "unsupported cipher", "UNSUPPORTED_OPERATION", { + operation: "decrypt", + }); } function getAccount(data: any, _key: string): KeystoreAccount { - const key = getBytes(_key); - const ciphertext = spelunk(data, "crypto.ciphertext:data!"); - - const computedMAC = hexlify( - sha256(concat([key.slice(16, 32), ciphertext])), - ).substring(2); - assertArgument( - computedMAC === spelunk(data, "crypto.mac:string!").toLowerCase(), - "incorrect password", - "password", - "[ REDACTED ]", - ); - - const privateKey = decrypt(data, key.slice(0, 16), ciphertext); - - const address = getAddress(data.address); - const prefix = extractPrefix(address); - if (computeAddress(privateKey, prefix) !== address) { - throw new Error("address mismatch"); - } - if (data.address) { - let check = data.address.toLowerCase(); - if (!check.startsWith("0x")) { - check = "0x" + check; - } - - assertArgument( - getAddress(check) === address, - "keystore address/privateKey mismatch", - "address", - data.address, - ); - } - - const account: KeystoreAccount = { address, privateKey }; - - // Version 0.1 x-corebc metadata must contain an encrypted mnemonic phrase - const version = spelunk(data, "x-corebc.version:string"); - if (version === "0.1") { - const mnemonicKey = key.slice(32, 64); - - const mnemonicCiphertext = spelunk( - data, - "x-corebc.mnemonicCiphertext:data!", - ); - const mnemonicIv = spelunk( - data, - "x-corebc.mnemonicCounter:data!", - ); - - const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); - - account.mnemonic = { - path: spelunk(data, "x-corebc.path:string") || defaultPath, - locale: spelunk(data, "x-corebc.locale:string") || "en", - entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext))), - }; - } - - return account; + const key = getBytes(_key); + const ciphertext = spelunk(data, "crypto.ciphertext:data!"); + + const computedMAC = hexlify( + sha256(concat([key.slice(16, 32), ciphertext])), + ).substring(2); + const expectedMAC = spelunk(data, "crypto.mac:string!"); + let difference = 0; + const validMAC = /^[0-9a-f]{64}$/i.test(expectedMAC); + if (validMAC) { + const actual = getBytes("0x" + computedMAC); + const expected = getBytes("0x" + expectedMAC); + for (let i = 0; i < actual.length; i++) + difference |= actual[i] ^ expected[i]; + } + assertArgument( + validMAC && difference === 0, + "incorrect password", + "password", + "[REDACTED]", + ); + + const privateKey = decrypt(data, key.slice(0, 16), ciphertext); + + const address = getAddress(data.address); + const prefix = extractPrefix(address); + if (computeAddress(privateKey, prefix) !== address) { + throw new Error("address mismatch"); + } + if (data.address) { + let check = data.address.toLowerCase(); + if (!check.startsWith("0x")) { + check = "0x" + check; + } + + assertArgument( + getAddress(check) === address, + "keystore address/privateKey mismatch", + "address", + data.address, + ); + } + + const account: KeystoreAccount = { address, privateKey }; + + // Version 0.1 x-corebc metadata must contain an encrypted mnemonic phrase + const version = spelunk(data, "x-corebc.version:string"); + if (version === "0.1") { + const mnemonicKey = key.slice(32, 64); + + const mnemonicCiphertext = spelunk( + data, + "x-corebc.mnemonicCiphertext:data!", + ); + const mnemonicIv = spelunk( + data, + "x-corebc.mnemonicCounter:data!", + ); + + const mnemonicAesCtr = new CTR(mnemonicKey, new Counter(mnemonicIv)); + + account.mnemonic = { + path: spelunk(data, "x-corebc.path:string") || defaultPath, + locale: spelunk(data, "x-corebc.locale:string") || "en", + entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext))), + }; + } + + return account; } type ScryptParams = { - name: "scrypt"; - salt: Uint8Array; - N: number; - r: number; - p: number; - dkLen: number; + name: "scrypt"; + salt: Uint8Array; + N: number; + r: number; + p: number; + dkLen: number; }; type KdfParams = - | ScryptParams - | { - name: "pbkdf2"; - salt: Uint8Array; - count: number; - dkLen: number; - algorithm: "sha256" | "sha512"; - }; + | ScryptParams + | { + name: "pbkdf2"; + salt: Uint8Array; + count: number; + dkLen: number; + algorithm: "sha256" | "sha512"; + }; + +// Match Core Web3Dart's wallet KDF resource limits. +function validateScrypt(N: number, r: number, p: number): void { + assertArgument( + Number.isSafeInteger(N) && N > 1 && N <= 1048576 && (N & (N - 1)) === 0, + "unsafe scrypt N", + "kdf.N", + N, + ); + assertArgument( + Number.isSafeInteger(r) && + Number.isSafeInteger(p) && + r > 0 && + p > 0 && + r * p <= 1048576 && + 128 * N * r <= 256 * 1024 * 1024, + "unsafe scrypt work or memory requirement", + "kdf", + { N, r, p }, + ); +} function getDecryptKdfParams(data: any): KdfParams { - const kdf = spelunk(data, "crypto.kdf:string"); - if (kdf && typeof kdf === "string") { - if (kdf.toLowerCase() === "scrypt") { - const salt = spelunk(data, "crypto.kdfparams.salt:data!"); - const N = spelunk(data, "crypto.kdfparams.n:int!"); - const r = spelunk(data, "crypto.kdfparams.r:int!"); - const p = spelunk(data, "crypto.kdfparams.p:int!"); - - // Make sure N is a power of 2 - assertArgument(N > 0 && (N & (N - 1)) === 0, "invalid kdf.N", "kdf.N", N); - assertArgument(r > 0 && p > 0, "invalid kdf", "kdf", kdf); - - const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); - assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dflen", dkLen); - - return { name: "scrypt", salt, N, r, p, dkLen: 64 }; - } else if (kdf.toLowerCase() === "pbkdf2") { - const salt = spelunk(data, "crypto.kdfparams.salt:data!"); - - const prf = spelunk(data, "crypto.kdfparams.prf:string!"); - const algorithm = prf.split("-").pop(); - assertArgument( - algorithm === "sha256" || algorithm === "sha512", - "invalid kdf.pdf", - "kdf.pdf", - prf, - ); - - const count = spelunk(data, "crypto.kdfparams.c:int!"); - - const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); - assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dklen", dkLen); - - return { name: "pbkdf2", salt, count, dkLen, algorithm }; - } - } - - assertArgument(false, "unsupported key-derivation function", "kdf", kdf); + const kdf = spelunk(data, "crypto.kdf:string"); + if (kdf && typeof kdf === "string") { + if (kdf.toLowerCase() === "scrypt") { + const salt = spelunk(data, "crypto.kdfparams.salt:data!"); + const N = spelunk(data, "crypto.kdfparams.n:int!"); + const r = spelunk(data, "crypto.kdfparams.r:int!"); + const p = spelunk(data, "crypto.kdfparams.p:int!"); + + validateScrypt(N, r, p); + + const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); + assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dflen", dkLen); + + return { name: "scrypt", salt, N, r, p, dkLen: 64 }; + } else if (kdf.toLowerCase() === "pbkdf2") { + const salt = spelunk(data, "crypto.kdfparams.salt:data!"); + + const prf = spelunk(data, "crypto.kdfparams.prf:string!"); + const algorithm = prf.split("-").pop(); + assertArgument( + prf === "hmac-sha256" || prf === "hmac-sha512", + "invalid kdf.pdf", + "kdf.pdf", + prf, + ); + + const count = spelunk(data, "crypto.kdfparams.c:int!"); + assertArgument( + Number.isSafeInteger(count) && count > 0 && count <= 10_000_000, + "unsafe PBKDF2 iteration count", + "kdf.c", + count, + ); + + const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); + assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dklen", dkLen); + + return { + name: "pbkdf2", + salt, + count, + dkLen, + algorithm: algorithm as "sha256" | "sha512", + }; + } + } + + assertArgument(false, "unsupported key-derivation function", "kdf", kdf); } /** @@ -232,35 +275,35 @@ function getDecryptKdfParams(data: any): KdfParams { * paramters and platform. */ export function decryptKeystoreJsonSync( - json: string, - _password: string | Uint8Array, + json: string, + _password: string | Uint8Array, ): KeystoreAccount { - const data = JSON.parse(json); + const data = JSON.parse(json); - const password = getPassword(_password); + const password = getPassword(_password); - const params = getDecryptKdfParams(data); - if (params.name === "pbkdf2") { - const { salt, count, dkLen, algorithm } = params; - const key = pbkdf2(password, salt, count, dkLen, algorithm); - return getAccount(data, key); - } + const params = getDecryptKdfParams(data); + if (params.name === "pbkdf2") { + const { salt, count, dkLen, algorithm } = params; + const key = pbkdf2(password, salt, count, dkLen, algorithm); + return getAccount(data, key); + } - assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { - params, - }); + assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { + params, + }); - const { salt, N, r, p, dkLen } = params; - const key = scryptSync(password, salt, N, r, p, dkLen); - return getAccount(data, key); + const { salt, N, r, p, dkLen } = params; + const key = scryptSync(password, salt, N, r, p, dkLen); + return getAccount(data, key); } function stall(duration: number): Promise { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, duration); - }); + return new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, duration); + }); } /** @@ -275,196 +318,176 @@ function stall(duration: number): Promise { * decryption begins and ``1`` when complete. */ export async function decryptKeystoreJson( - json: string, - _password: string | Uint8Array, - progress?: ProgressCallback, + json: string, + _password: string | Uint8Array, + progress?: ProgressCallback, ): Promise { - const data = JSON.parse(json); - - const password = getPassword(_password); - - const params = getDecryptKdfParams(data); - if (params.name === "pbkdf2") { - if (progress) { - progress(0); - await stall(0); - } - const { salt, count, dkLen, algorithm } = params; - const key = pbkdf2(password, salt, count, dkLen, algorithm); - if (progress) { - progress(1); - await stall(0); - } - return getAccount(data, key); - } - - assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { - params, - }); - - const { salt, N, r, p, dkLen } = params; - const key = await scrypt(password, salt, N, r, p, dkLen, progress); - return getAccount(data, key); + const data = JSON.parse(json); + + const password = getPassword(_password); + + const params = getDecryptKdfParams(data); + if (params.name === "pbkdf2") { + if (progress) { + progress(0); + await stall(0); + } + const { salt, count, dkLen, algorithm } = params; + const key = pbkdf2(password, salt, count, dkLen, algorithm); + if (progress) { + progress(1); + await stall(0); + } + return getAccount(data, key); + } + + assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { + params, + }); + + const { salt, N, r, p, dkLen } = params; + const key = await scrypt(password, salt, N, r, p, dkLen, progress); + return getAccount(data, key); } function getEncryptKdfParams(options: EncryptOptions): ScryptParams { - // Check/generate the salt - const salt = - options.salt != null - ? getBytes(options.salt, "options.salt") - : randomBytes(32); - - // Override the scrypt password-based key derivation function parameters - let N = 1 << 17, - r = 8, - p = 1; - if (options.scrypt) { - if (options.scrypt.N) { - N = options.scrypt.N; - } - if (options.scrypt.r) { - r = options.scrypt.r; - } - if (options.scrypt.p) { - p = options.scrypt.p; - } - } - assertArgument( - typeof N === "number" && - N > 0 && - Number.isSafeInteger(N) && - (BigInt(N) & BigInt(N - 1)) === BigInt(0), - "invalid scrypt N parameter", - "options.N", - N, - ); - assertArgument( - typeof r === "number" && r > 0 && Number.isSafeInteger(r), - "invalid scrypt r parameter", - "options.r", - r, - ); - assertArgument( - typeof p === "number" && p > 0 && Number.isSafeInteger(p), - "invalid scrypt p parameter", - "options.p", - p, - ); - - return { name: "scrypt", dkLen: 32, salt, N, r, p }; + // Check/generate the salt + const salt = + options.salt != null + ? getBytes(options.salt, "options.salt") + : randomBytes(32); + + // Override the scrypt password-based key derivation function parameters + let N = 1 << 17, + r = 8, + p = 1; + if (options.scrypt) { + if (options.scrypt.N != null) { + N = options.scrypt.N; + } + if (options.scrypt.r != null) { + r = options.scrypt.r; + } + if (options.scrypt.p != null) { + p = options.scrypt.p; + } + } + validateScrypt(N, r, p); + + return { name: "scrypt", dkLen: 32, salt, N, r, p }; } function _encryptKeystore( - key: Uint8Array, - kdf: ScryptParams, - account: KeystoreAccount, - options: EncryptOptions, + key: Uint8Array, + kdf: ScryptParams, + account: KeystoreAccount, + options: EncryptOptions, ): any { - const privateKey = getBytes(account.privateKey, "privateKey"); - - // Override initialization vector - const iv = - options.iv != null ? getBytes(options.iv, "options.iv") : randomBytes(16); - assertArgument( - iv.length === 16, - "invalid options.iv length", - "options.iv", - options.iv, - ); - - // Override the uuid - const uuidRandom = - options.uuid != null - ? getBytes(options.uuid, "options.uuid") - : randomBytes(16); - assertArgument( - uuidRandom.length === 16, - "invalid options.uuid length", - "options.uuid", - options.iv, - ); - - // This will be used to encrypt the wallet (as per Web3 secret storage) - // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) - // - 32 bytes AES key to encrypt mnemonic with (required here to be corebc Wallet) - const derivedKey = key.slice(0, 16); - const macPrefix = key.slice(16, 32); - - // Encrypt the private key - const aesCtr = new CTR(derivedKey, iv); - const ciphertext = getBytes(aesCtr.encrypt(privateKey)); - - // Compute the message authentication code, used to check the password - const mac = sha256(concat([macPrefix, ciphertext])); - - const data: { [key: string]: any } = { - address: account.address.substring(2).toLowerCase(), - id: uuidV4(uuidRandom), - version: 3, - Crypto: { - cipher: "aes-128-ctr", - cipherparams: { - iv: hexlify(iv).substring(2), - }, - ciphertext: hexlify(ciphertext).substring(2), - kdf: "scrypt", - kdfparams: { - salt: hexlify(kdf.salt).substring(2), - n: kdf.N, - dklen: 32, - p: kdf.p, - r: kdf.r, - }, - mac: mac.substring(2), - }, - }; - - // If we have a mnemonic, encrypt it into the JSON wallet - if (account.mnemonic) { - const client = - options.client != null ? options.client : `corebc/${version}`; - - const path = account.mnemonic.path || defaultPath; - const locale = account.mnemonic.locale || "en"; - - const mnemonicKey = key.slice(32, 64); - - const entropy = getBytes( - account.mnemonic.entropy, - "account.mnemonic.entropy", - ); - const mnemonicIv = randomBytes(16); - const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); - const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy)); - - const now = new Date(); - const timestamp = - now.getUTCFullYear() + - "-" + - zpad(now.getUTCMonth() + 1, 2) + - "-" + - zpad(now.getUTCDate(), 2) + - "T" + - zpad(now.getUTCHours(), 2) + - "-" + - zpad(now.getUTCMinutes(), 2) + - "-" + - zpad(now.getUTCSeconds(), 2) + - ".0Z"; - const gethFilename = "UTC--" + timestamp + "--" + data.address; - - data["x-corebc"] = { - client, - gethFilename, - path, - locale, - mnemonicCounter: hexlify(mnemonicIv).substring(2), - mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2), - version: "0.1", - }; - } - - return JSON.stringify(data); + const privateKey = getBytes(account.privateKey, "privateKey"); + + // Override initialization vector + const iv = + options.iv != null ? getBytes(options.iv, "options.iv") : randomBytes(16); + assertArgument( + iv.length === 16, + "invalid options.iv length", + "options.iv", + options.iv, + ); + + // Override the uuid + const uuidRandom = + options.uuid != null + ? getBytes(options.uuid, "options.uuid") + : randomBytes(16); + assertArgument( + uuidRandom.length === 16, + "invalid options.uuid length", + "options.uuid", + options.iv, + ); + + // This will be used to encrypt the wallet (as per Web3 secret storage) + // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) + // - 32 bytes AES key to encrypt mnemonic with (required here to be corebc Wallet) + const derivedKey = key.slice(0, 16); + const macPrefix = key.slice(16, 32); + + // Encrypt the private key + const aesCtr = new CTR(derivedKey, new Counter(iv)); + const ciphertext = getBytes(aesCtr.encrypt(privateKey)); + + // Compute the message authentication code, used to check the password + const mac = sha256(concat([macPrefix, ciphertext])); + + const data: { [key: string]: any } = { + address: account.address.substring(2).toLowerCase(), + id: uuidV4(uuidRandom), + version: 3, + Crypto: { + cipher: "aes-128-ctr", + cipherparams: { + iv: hexlify(iv).substring(2), + }, + ciphertext: hexlify(ciphertext).substring(2), + kdf: "scrypt", + kdfparams: { + salt: hexlify(kdf.salt).substring(2), + n: kdf.N, + dklen: 32, + p: kdf.p, + r: kdf.r, + }, + mac: mac.substring(2), + }, + }; + + // If we have a mnemonic, encrypt it into the JSON wallet + if (account.mnemonic) { + const client = + options.client != null ? options.client : `corebc/${version}`; + + const path = account.mnemonic.path || defaultPath; + const locale = account.mnemonic.locale || "en"; + + const mnemonicKey = key.slice(32, 64); + + const entropy = getBytes( + account.mnemonic.entropy, + "account.mnemonic.entropy", + ); + const mnemonicIv = randomBytes(16); + const mnemonicAesCtr = new CTR(mnemonicKey, new Counter(mnemonicIv)); + const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy)); + + const now = new Date(); + const timestamp = + now.getUTCFullYear() + + "-" + + zpad(now.getUTCMonth() + 1, 2) + + "-" + + zpad(now.getUTCDate(), 2) + + "T" + + zpad(now.getUTCHours(), 2) + + "-" + + zpad(now.getUTCMinutes(), 2) + + "-" + + zpad(now.getUTCSeconds(), 2) + + ".0Z"; + const gethFilename = "UTC--" + timestamp + "--" + data.address; + + data["x-corebc"] = { + client, + gethFilename, + path, + locale, + mnemonicCounter: hexlify(mnemonicIv).substring(2), + mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2), + version: "0.1", + }; + } + + return JSON.stringify(data); } /** @@ -476,18 +499,18 @@ function _encryptKeystore( * used. Any provided [[ProgressCallback]] is ignord. */ export function encryptKeystoreJsonSync( - account: KeystoreAccount, - password: string | Uint8Array, - options?: EncryptOptions, + account: KeystoreAccount, + password: string | Uint8Array, + options?: EncryptOptions, ): string { - if (options == null) { - options = {}; - } - - const passwordBytes = getPassword(password); - const kdf = getEncryptKdfParams(options); - const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64); - return _encryptKeystore(getBytes(key), kdf, account, options); + if (options == null) { + options = {}; + } + + const passwordBytes = getPassword(password); + const kdf = getEncryptKdfParams(options); + const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64); + return _encryptKeystore(getBytes(key), kdf, account, options); } /** @@ -500,24 +523,24 @@ export function encryptKeystoreJsonSync( * on the completion status.. */ export async function encryptKeystoreJson( - account: KeystoreAccount, - password: string | Uint8Array, - options?: EncryptOptions, + account: KeystoreAccount, + password: string | Uint8Array, + options?: EncryptOptions, ): Promise { - if (options == null) { - options = {}; - } - - const passwordBytes = getPassword(password); - const kdf = getEncryptKdfParams(options); - const key = await scrypt( - passwordBytes, - kdf.salt, - kdf.N, - kdf.r, - kdf.p, - 64, - options.progressCallback, - ); - return _encryptKeystore(getBytes(key), kdf, account, options); + if (options == null) { + options = {}; + } + + const passwordBytes = getPassword(password); + const kdf = getEncryptKdfParams(options); + const key = await scrypt( + passwordBytes, + kdf.salt, + kdf.N, + kdf.r, + kdf.p, + 64, + options.progressCallback, + ); + return _encryptKeystore(getBytes(key), kdf, account, options); } diff --git a/src.ts/wallet/mnemonic.ts b/src.ts/wallet/mnemonic.ts index 7077d4d4f..062591793 100644 --- a/src.ts/wallet/mnemonic.ts +++ b/src.ts/wallet/mnemonic.ts @@ -1,10 +1,10 @@ import { - defineProperties, - getBytes, - hexlify, - assertNormalize, - assertPrivate, - assertArgument, + defineProperties, + getBytes, + hexlify, + assertNormalize, + assertPrivate, + assertArgument, } from "../utils/index.js"; import { LangEn } from "../wordlists/lang-en.js"; @@ -15,121 +15,121 @@ import { mnemonicToSeed } from "./mnemonicToSeed.js"; // Returns a byte with the MSB bits set function getUpperMask(bits: number): number { - return (((1 << bits) - 1) << (8 - bits)) & 0xff; + return (((1 << bits) - 1) << (8 - bits)) & 0xff; } // Returns a byte with the LSB bits set function getLowerMask(bits: number): number { - return ((1 << bits) - 1) & 0xff; + return ((1 << bits) - 1) & 0xff; } function mnemonicToEntropy( - mnemonic: string, - wordlist?: null | Wordlist, + mnemonic: string, + wordlist?: null | Wordlist, ): string { - assertNormalize("NFKD"); - - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - - const words = wordlist.split(mnemonic); - assertArgument( - words.length % 3 === 0 && words.length >= 12 && words.length <= 24, - "invalid mnemonic length", - "mnemonic", - "[ REDACTED ]", - ); - - const entropy = new Uint8Array(Math.ceil((11 * words.length) / 8)); - - let offset = 0; - for (let i = 0; i < words.length; i++) { - let index = wordlist.getWordIndex(words[i].normalize("NFKD")); - assertArgument( - index >= 0, - `invalid mnemonic word at index ${i}`, - "mnemonic", - "[ REDACTED ]", - ); - - for (let bit = 0; bit < 11; bit++) { - if (index & (1 << (10 - bit))) { - entropy[offset >> 3] |= 1 << (7 - (offset % 8)); - } - offset++; - } - } - - const entropyBits = (32 * words.length) / 3; - - const checksumBits = words.length / 3; - const checksumMask = getUpperMask(checksumBits); - - const checksum = - getBytes(legacySha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; - - assertArgument( - checksum === (entropy[entropy.length - 1] & checksumMask), - "invalid mnemonic checksum", - "mnemonic", - "[ REDACTED ]", - ); - - return hexlify(entropy.slice(0, entropyBits / 8)); + assertNormalize("NFKD"); + + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + + const words = wordlist.split(mnemonic); + assertArgument( + words.length % 3 === 0 && words.length >= 12 && words.length <= 24, + "invalid mnemonic length", + "mnemonic", + "[ REDACTED ]", + ); + + const entropy = new Uint8Array(Math.ceil((11 * words.length) / 8)); + + let offset = 0; + for (let i = 0; i < words.length; i++) { + let index = wordlist.getWordIndex(words[i].normalize("NFKD")); + assertArgument( + index >= 0, + `invalid mnemonic word at index ${i}`, + "mnemonic", + "[ REDACTED ]", + ); + + for (let bit = 0; bit < 11; bit++) { + if (index & (1 << (10 - bit))) { + entropy[offset >> 3] |= 1 << (7 - (offset % 8)); + } + offset++; + } + } + + const entropyBits = (32 * words.length) / 3; + + const checksumBits = words.length / 3; + const checksumMask = getUpperMask(checksumBits); + + const checksum = + getBytes(legacySha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; + + assertArgument( + checksum === (entropy[entropy.length - 1] & checksumMask), + "invalid mnemonic checksum", + "mnemonic", + "[ REDACTED ]", + ); + + return hexlify(entropy.slice(0, entropyBits / 8)); } function entropyToMnemonic( - entropy: Uint8Array, - wordlist?: null | Wordlist, + entropy: Uint8Array, + wordlist?: null | Wordlist, ): string { - assertArgument( - entropy.length % 4 === 0 && entropy.length >= 16 && entropy.length <= 32, - "invalid entropy size", - "entropy", - "[ REDACTED ]", - ); - - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - - const indices: Array = [0]; - - let remainingBits = 11; - for (let i = 0; i < entropy.length; i++) { - // Consume the whole byte (with still more to go) - if (remainingBits > 8) { - indices[indices.length - 1] <<= 8; - indices[indices.length - 1] |= entropy[i]; - - remainingBits -= 8; - - // This byte will complete an 11-bit index - } else { - indices[indices.length - 1] <<= remainingBits; - indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); - - // Start the next word - indices.push(entropy[i] & getLowerMask(8 - remainingBits)); - - remainingBits += 3; - } - } - - // Compute the checksum bits - const checksumBits = entropy.length / 4; - const checksum = - parseInt(legacySha256(entropy).substring(2, 4), 16) & - getUpperMask(checksumBits); - - // Shift the checksum into the word indices - indices[indices.length - 1] <<= checksumBits; - indices[indices.length - 1] |= checksum >> (8 - checksumBits); - - return wordlist.join( - indices.map((index) => (wordlist).getWord(index)), - ); + assertArgument( + entropy.length % 4 === 0 && entropy.length >= 16 && entropy.length <= 32, + "invalid entropy size", + "entropy", + "[ REDACTED ]", + ); + + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + + const indices: Array = [0]; + + let remainingBits = 11; + for (let i = 0; i < entropy.length; i++) { + // Consume the whole byte (with still more to go) + if (remainingBits > 8) { + indices[indices.length - 1] <<= 8; + indices[indices.length - 1] |= entropy[i]; + + remainingBits -= 8; + + // This byte will complete an 11-bit index + } else { + indices[indices.length - 1] <<= remainingBits; + indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); + + // Start the next word + indices.push(entropy[i] & getLowerMask(8 - remainingBits)); + + remainingBits += 3; + } + } + + // Compute the checksum bits + const checksumBits = entropy.length / 4; + const checksum = + parseInt(legacySha256(entropy).substring(2, 4), 16) & + getUpperMask(checksumBits); + + // Shift the checksum into the word indices + indices[indices.length - 1] <<= checksumBits; + indices[indices.length - 1] |= checksum >> (8 - checksumBits); + + return wordlist.join( + indices.map((index) => (wordlist).getWord(index)), + ); } const _guard = {}; @@ -139,122 +139,122 @@ const _guard = {}; * seeds and convert between phrases and entropy. */ export class Mnemonic { - /** - * The mnemonic phrase of 12, 15, 18, 21 or 24 words. - * - * Use the [[wordlist]] ``split`` method to get the individual words. - */ - readonly phrase!: string; - - /** - * The password used for this mnemonic. If no password is used this - * is the empty string (i.e. ``""``) as per the specification. - */ - readonly password!: string; - - /** - * The wordlist for this mnemonic. - */ - readonly wordlist!: Wordlist; - - /** - * The underlying entropy which the mnemonic encodes. - */ - readonly entropy!: string; - - /** - * @private - */ - constructor( - guard: any, - entropy: string, - phrase: string, - password?: null | string, - wordlist?: null | Wordlist, - ) { - if (password == null) { - password = ""; - } - if (wordlist == null) { - wordlist = LangEn.wordlist(); - } - assertPrivate(guard, _guard, "Mnemonic"); - defineProperties(this, { phrase, password, wordlist, entropy }); - } - - /** - * Returns the seed for the mnemonic. - */ - computeSeed(): string { - return mnemonicToSeed(this.phrase, this.password); - } - - /** - * Creates a new Mnemonic for the %%phrase%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromPhrase({ - phrase, - password, - wordlist, - }: { - phrase: string; - password?: null | string; - wordlist?: null | Wordlist; - }): Mnemonic { - // Normalize the case and space; throws if invalid - const entropy = mnemonicToEntropy(phrase, wordlist); - phrase = entropyToMnemonic(getBytes(entropy), wordlist); - return new Mnemonic(_guard, entropy, phrase, password, wordlist); - } - - /** - * Create a new **Mnemonic** from the %%entropy%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromEntropy( - _entropy: BytesLike, - password?: null | string, - wordlist?: null | Wordlist, - ): Mnemonic { - const entropy = getBytes(_entropy, "entropy"); - const phrase = entropyToMnemonic(entropy, wordlist); - return new Mnemonic(_guard, hexlify(entropy), phrase, password, wordlist); - } - - /** - * Returns the phrase for %%mnemonic%%. - */ - static entropyToPhrase( - _entropy: BytesLike, - wordlist?: null | Wordlist, - ): string { - const entropy = getBytes(_entropy, "entropy"); - return entropyToMnemonic(entropy, wordlist); - } - - /** - * Returns the entropy for %%phrase%%. - */ - static phraseToEntropy(phrase: string, wordlist?: null | Wordlist): string { - return mnemonicToEntropy(phrase, wordlist); - } - - /** - * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. - * - * This checks all the provided words belong to the %%wordlist%%, - * that the length is valid and the checksum is correct. - */ - static isValidMnemonic(phrase: string, wordlist?: null | Wordlist): boolean { - try { - mnemonicToEntropy(phrase, wordlist); - return true; - } catch (error) {} - return false; - } + /** + * The mnemonic phrase of 12, 15, 18, 21 or 24 words. + * + * Use the [[wordlist]] ``split`` method to get the individual words. + */ + readonly phrase!: string; + + /** + * The password used for this mnemonic. If no password is used this + * is the empty string (i.e. ``""``) as per the specification. + */ + readonly password!: string; + + /** + * The wordlist for this mnemonic. + */ + readonly wordlist!: Wordlist; + + /** + * The underlying entropy which the mnemonic encodes. + */ + readonly entropy!: string; + + /** + * @private + */ + constructor( + guard: any, + entropy: string, + phrase: string, + password?: null | string, + wordlist?: null | Wordlist, + ) { + if (password == null) { + password = ""; + } + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + assertPrivate(guard, _guard, "Mnemonic"); + defineProperties(this, { phrase, password, wordlist, entropy }); + } + + /** + * Returns the seed for the mnemonic. + */ + computeSeed(): string { + return mnemonicToSeed(this.phrase, this.password); + } + + /** + * Creates a new Mnemonic for the %%phrase%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromPhrase({ + phrase, + password, + wordlist, + }: { + phrase: string; + password?: null | string; + wordlist?: null | Wordlist; + }): Mnemonic { + // Normalize the case and space; throws if invalid + const entropy = mnemonicToEntropy(phrase, wordlist); + phrase = entropyToMnemonic(getBytes(entropy), wordlist); + return new Mnemonic(_guard, entropy, phrase, password, wordlist); + } + + /** + * Create a new **Mnemonic** from the %%entropy%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromEntropy( + _entropy: BytesLike, + password?: null | string, + wordlist?: null | Wordlist, + ): Mnemonic { + const entropy = getBytes(_entropy, "entropy"); + const phrase = entropyToMnemonic(entropy, wordlist); + return new Mnemonic(_guard, hexlify(entropy), phrase, password, wordlist); + } + + /** + * Returns the phrase for %%mnemonic%%. + */ + static entropyToPhrase( + _entropy: BytesLike, + wordlist?: null | Wordlist, + ): string { + const entropy = getBytes(_entropy, "entropy"); + return entropyToMnemonic(entropy, wordlist); + } + + /** + * Returns the entropy for %%phrase%%. + */ + static phraseToEntropy(phrase: string, wordlist?: null | Wordlist): string { + return mnemonicToEntropy(phrase, wordlist); + } + + /** + * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. + * + * This checks all the provided words belong to the %%wordlist%%, + * that the length is valid and the checksum is correct. + */ + static isValidMnemonic(phrase: string, wordlist?: null | Wordlist): boolean { + try { + mnemonicToEntropy(phrase, wordlist); + return true; + } catch (error) {} + return false; + } } diff --git a/src.ts/wallet/mnemonicToSeed.ts b/src.ts/wallet/mnemonicToSeed.ts index a3eb7b42b..1d91027d8 100644 --- a/src.ts/wallet/mnemonicToSeed.ts +++ b/src.ts/wallet/mnemonicToSeed.ts @@ -1,38 +1,39 @@ +import { Buffer } from "buffer"; import { pbkdf2Sync } from "../crypto/crypto.js"; import utf8 from "utf8"; export function mnemonicToSeed(mnemonic: string, password?: string): string { - if (!password) { - password = ""; - } - const t = generateSeed(mnemonic, password); - return t.goldilock; + if (!password) { + password = ""; + } + const t = generateSeed(mnemonic, password); + return t.goldilock; } const generateSeed = (mnemonic: string, password?: string) => { - const goldilockSaltPrefix = "mnemonic"; - const aesSaltPrefix = "mnemonicfortheAESkey"; + const goldilockSaltPrefix = "mnemonic"; + const aesSaltPrefix = "mnemonicfortheAESkey"; - const goldilockSalt = utf8.encode(goldilockSaltPrefix + password); - const aesSalt = utf8.encode(aesSaltPrefix + password); + const goldilockSalt = utf8.encode(goldilockSaltPrefix + password); + const aesSalt = utf8.encode(aesSaltPrefix + password); - const goldilockKey = pbkdf2Sync( - Buffer.from(mnemonic), - goldilockSalt, - 2048, - 64, - "sha512", - ); + const goldilockKey = pbkdf2Sync( + Buffer.from(mnemonic), + Buffer.from(goldilockSalt), + 2048, + 64, + "sha512", + ); - const aesKeySeed = pbkdf2Sync( - Buffer.from(mnemonic), - aesSalt, - 2048, - 64, - "sha512", - ); + const aesKeySeed = pbkdf2Sync( + Buffer.from(mnemonic), + Buffer.from(aesSalt), + 2048, + 64, + "sha512", + ); - return { - aes: aesKeySeed.toString("hex"), - goldilock: goldilockKey.toString("hex"), - }; + return { + aes: Buffer.from(aesKeySeed).toString("hex"), + goldilock: Buffer.from(goldilockKey).toString("hex"), + }; }; diff --git a/src.ts/wallet/utils.ts b/src.ts/wallet/utils.ts index 4d36615e0..03d127d05 100644 --- a/src.ts/wallet/utils.ts +++ b/src.ts/wallet/utils.ts @@ -5,95 +5,95 @@ import { getBytesCopy, assertArgument, toUtf8Bytes } from "../utils/index.js"; export function looseArrayify(hexString: string): Uint8Array { - if (typeof hexString === "string" && !hexString.startsWith("0x")) { - hexString = "0x" + hexString; - } - return getBytesCopy(hexString); + if (typeof hexString === "string" && !hexString.startsWith("0x")) { + hexString = "0x" + hexString; + } + return getBytesCopy(hexString); } export function zpad(value: String | number, length: number): String { - value = String(value); - while (value.length < length) { - value = "0" + value; - } - return value; + value = String(value); + while (value.length < length) { + value = "0" + value; + } + return value; } export function getPassword(password: string | Uint8Array): Uint8Array { - if (typeof password === "string") { - return toUtf8Bytes(password, "NFKC"); - } - return getBytesCopy(password); + if (typeof password === "string") { + return toUtf8Bytes(password, "NFKC"); + } + return getBytesCopy(password); } export function spelunk(object: any, _path: string): T { - const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i); - assertArgument(match != null, "invalid path", "path", _path); - - const path = match[1]; - const type = match[3]; - const reqd = match[4] === "!"; - - let cur = object; - for (const comp of path.toLowerCase().split(".")) { - // Search for a child object with a case-insensitive matching key - if (Array.isArray(cur)) { - if (!comp.match(/^[0-9]+$/)) { - break; - } - cur = cur[parseInt(comp)]; - } else if (typeof cur === "object") { - let found: any = null; - for (const key in cur) { - if (key.toLowerCase() === comp) { - found = cur[key]; - break; - } - } - cur = found; - } else { - cur = null; - } - - if (cur == null) { - break; - } - } - - assertArgument(!reqd || cur != null, "missing required value", "path", path); - - if (type && cur != null) { - if (type === "int") { - if (typeof cur === "string" && cur.match(/^-?[0-9]+$/)) { - return (parseInt(cur)); - } else if (Number.isSafeInteger(cur)) { - return cur; - } - } - - if (type === "number") { - if (typeof cur === "string" && cur.match(/^-?[0-9.]*$/)) { - return (parseFloat(cur)); - } - } - - if (type === "data") { - if (typeof cur === "string") { - return (looseArrayify(cur)); - } - } - - if (type === "array" && Array.isArray(cur)) { - return (cur); - } - if (type === typeof cur) { - return cur; - } - - assertArgument(false, `wrong type found for ${type} `, "path", path); - } - - return cur; + const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i); + assertArgument(match != null, "invalid path", "path", _path); + + const path = match[1]; + const type = match[3]; + const reqd = match[4] === "!"; + + let cur = object; + for (const comp of path.toLowerCase().split(".")) { + // Search for a child object with a case-insensitive matching key + if (Array.isArray(cur)) { + if (!comp.match(/^[0-9]+$/)) { + break; + } + cur = cur[parseInt(comp)]; + } else if (typeof cur === "object") { + let found: any = null; + for (const key in cur) { + if (key.toLowerCase() === comp) { + found = cur[key]; + break; + } + } + cur = found; + } else { + cur = null; + } + + if (cur == null) { + break; + } + } + + assertArgument(!reqd || cur != null, "missing required value", "path", path); + + if (type && cur != null) { + if (type === "int") { + if (typeof cur === "string" && cur.match(/^-?[0-9]+$/)) { + return (parseInt(cur)); + } else if (Number.isSafeInteger(cur)) { + return cur; + } + } + + if (type === "number") { + if (typeof cur === "string" && cur.match(/^-?[0-9.]*$/)) { + return (parseFloat(cur)); + } + } + + if (type === "data") { + if (typeof cur === "string") { + return (looseArrayify(cur)); + } + } + + if (type === "array" && Array.isArray(cur)) { + return (cur); + } + if (type === typeof cur) { + return cur; + } + + assertArgument(false, `wrong type found for ${type} `, "path", path); + } + + return cur; } /* export function follow(object: any, path: string): null | string { diff --git a/src.ts/wallet/wallet.ts b/src.ts/wallet/wallet.ts index c441b4b30..1bade62d7 100644 --- a/src.ts/wallet/wallet.ts +++ b/src.ts/wallet/wallet.ts @@ -5,11 +5,11 @@ import { BaseWallet } from "./base-wallet.js"; import { defaultPath, HDNodeWallet } from "./hdwallet.js"; import { decryptCrowdsaleJson, isCrowdsaleJson } from "./json-crowdsale.js"; import { - decryptKeystoreJson, - decryptKeystoreJsonSync, - encryptKeystoreJson, - encryptKeystoreJsonSync, - isKeystoreJson, + decryptKeystoreJson, + decryptKeystoreJsonSync, + encryptKeystoreJson, + encryptKeystoreJsonSync, + isKeystoreJson, } from "./json-keystore.js"; import { Mnemonic } from "./mnemonic.js"; @@ -21,11 +21,11 @@ import type { KeystoreAccount } from "./json-keystore.js"; import { extractPrefix } from "../transaction/address.js"; function stall(duration: number): Promise { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, duration); - }); + return new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, duration); + }); } /** @@ -39,230 +39,230 @@ function stall(duration: number): Promise { * wallets. */ export class Wallet extends BaseWallet { - /** - * Create a new wallet for the %%privateKey%% or %%signingKey%%, optionally connected - * to %%provider%%. - */ - constructor({ - key, - prefix, - provider, - }: { - key: string | SigningKey; - prefix: string; - provider?: null | Provider; - }) { - if (typeof key === "string" && !key.startsWith("0x")) { - key = "0x" + key; - } + /** + * Create a new wallet for the %%privateKey%% or %%signingKey%%, optionally connected + * to %%provider%%. + */ + constructor({ + key, + prefix, + provider, + }: { + key: string | SigningKey; + prefix: string; + provider?: null | Provider; + }) { + if (typeof key === "string" && !key.startsWith("0x")) { + key = "0x" + key; + } - let signingKey = typeof key === "string" ? new SigningKey(key) : key; - super({ - signingKey, - prefix, - provider, - }); - } + let signingKey = typeof key === "string" ? new SigningKey(key) : key; + super({ + signingKey, + prefix, + provider, + }); + } - connect(provider: null | Provider): Wallet { - return new Wallet({ - key: this.signingKey, - prefix: this.prefix, - provider, - }); - } + connect(provider: null | Provider): Wallet { + return new Wallet({ + key: this.signingKey, + prefix: this.prefix, + provider, + }); + } - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - async encrypt( - password: Uint8Array | string, - progressCallback?: ProgressCallback, - ): Promise { - const account = { address: this.address, privateKey: this.privateKey }; - return await encryptKeystoreJson(account, password, { progressCallback }); - } + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + async encrypt( + password: Uint8Array | string, + progressCallback?: ProgressCallback, + ): Promise { + const account = { address: this.address, privateKey: this.privateKey }; + return await encryptKeystoreJson(account, password, { progressCallback }); + } - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password: Uint8Array | string): string { - const account = { address: this.address, privateKey: this.privateKey }; - return encryptKeystoreJsonSync(account, password); - } + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password: Uint8Array | string): string { + const account = { address: this.address, privateKey: this.privateKey }; + return encryptKeystoreJsonSync(account, password); + } - static #fromAccount( - account: null | CrowdsaleAccount | KeystoreAccount, - ): HDNodeWallet | Wallet { - assertArgument(account, "invalid JSON wallet", "json", "[ REDACTED ]"); - const address = account.address; - const prefix = extractPrefix(address); - if ( - "mnemonic" in account && - account.mnemonic && - account.mnemonic.locale === "en" - ) { - const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy); - const wallet = HDNodeWallet.fromMnemonic( - mnemonic, - prefix, - account.mnemonic.path, - ); - if ( - wallet.address === account.address && - wallet.privateKey === account.privateKey - ) { - return wallet; - } - console.log( - "WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key", - ); - } + static #fromAccount( + account: null | CrowdsaleAccount | KeystoreAccount, + ): HDNodeWallet | Wallet { + assertArgument(account, "invalid JSON wallet", "json", "[ REDACTED ]"); + const address = account.address; + const prefix = extractPrefix(address); + if ( + "mnemonic" in account && + account.mnemonic && + account.mnemonic.locale === "en" + ) { + const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy); + const wallet = HDNodeWallet.fromMnemonic( + mnemonic, + prefix, + account.mnemonic.path, + ); + if ( + wallet.address === account.address && + wallet.privateKey === account.privateKey + ) { + return wallet; + } + console.log( + "WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key", + ); + } - const wallet = new Wallet({ - key: account.privateKey, - prefix, - }); + const wallet = new Wallet({ + key: account.privateKey, + prefix, + }); - assertArgument( - wallet.address === account.address, - "address/privateKey mismatch", - "json", - "[ REDACTED ]", - ); + assertArgument( + wallet.address === account.address, + "address/privateKey mismatch", + "json", + "[ REDACTED ]", + ); - return wallet; - } + return wallet; + } - /** - * Creates (asynchronously) a **Wallet** by decrypting the %%json%% - * with %%password%%. - * - * If %%progress%% is provided, it is called periodically during - * decryption so that any UI can be updated. - */ - static async fromEncryptedJson( - json: string, - password: Uint8Array | string, - progress?: ProgressCallback, - ): Promise { - let account: null | CrowdsaleAccount | KeystoreAccount = null; - if (isKeystoreJson(json)) { - account = await decryptKeystoreJson(json, password, progress); - } else if (isCrowdsaleJson(json)) { - if (progress) { - progress(0); - await stall(0); - } - account = decryptCrowdsaleJson(json, password); - if (progress) { - progress(1); - await stall(0); - } - } + /** + * Creates (asynchronously) a **Wallet** by decrypting the %%json%% + * with %%password%%. + * + * If %%progress%% is provided, it is called periodically during + * decryption so that any UI can be updated. + */ + static async fromEncryptedJson( + json: string, + password: Uint8Array | string, + progress?: ProgressCallback, + ): Promise { + let account: null | CrowdsaleAccount | KeystoreAccount = null; + if (isKeystoreJson(json)) { + account = await decryptKeystoreJson(json, password, progress); + } else if (isCrowdsaleJson(json)) { + if (progress) { + progress(0); + await stall(0); + } + account = decryptCrowdsaleJson(json, password); + if (progress) { + progress(1); + await stall(0); + } + } - return Wallet.#fromAccount(account); - } + return Wallet.#fromAccount(account); + } - /** - * Creates a **Wallet** by decrypting the %%json%% with %%password%%. - * - * The [[fromEncryptedJson]] method is preferred, as this method - * will lock up and freeze the UI during decryption, which may take - * some time. - */ - static fromEncryptedJsonSync( - json: string, - password: Uint8Array | string, - ): HDNodeWallet | Wallet { - let account: null | CrowdsaleAccount | KeystoreAccount = null; - if (isKeystoreJson(json)) { - account = decryptKeystoreJsonSync(json, password); - } else if (isCrowdsaleJson(json)) { - account = decryptCrowdsaleJson(json, password); - } else { - assertArgument(false, "invalid JSON wallet", "json", "[ REDACTED ]"); - } + /** + * Creates a **Wallet** by decrypting the %%json%% with %%password%%. + * + * The [[fromEncryptedJson]] method is preferred, as this method + * will lock up and freeze the UI during decryption, which may take + * some time. + */ + static fromEncryptedJsonSync( + json: string, + password: Uint8Array | string, + ): HDNodeWallet | Wallet { + let account: null | CrowdsaleAccount | KeystoreAccount = null; + if (isKeystoreJson(json)) { + account = decryptKeystoreJsonSync(json, password); + } else if (isCrowdsaleJson(json)) { + account = decryptCrowdsaleJson(json, password); + } else { + assertArgument(false, "invalid JSON wallet", "json", "[ REDACTED ]"); + } - return Wallet.#fromAccount(account); - } + return Wallet.#fromAccount(account); + } - /** - * Creates a new random [[HDNodeWallet]] using the avavilable - * [cryptographic random source](randomBytes). - * - * If there is no crytographic random source, this will throw. - */ - static createRandom( - prefix: string, - provider?: null | Provider, - ): HDNodeWallet { - const wallet = HDNodeWallet.createRandom( - prefix, - undefined, - undefined, - undefined, - ); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } + /** + * Creates a new random [[HDNodeWallet]] using the avavilable + * [cryptographic random source](randomBytes). + * + * If there is no crytographic random source, this will throw. + */ + static createRandom( + prefix: string, + provider?: null | Provider, + ): HDNodeWallet { + const wallet = HDNodeWallet.createRandom( + prefix, + undefined, + undefined, + undefined, + ); + if (provider) { + return wallet.connect(provider); + } + return wallet; + } - /** - * Creates a [[HDNodeWallet]] for %%phrase%%. - */ - static fromPhrase({ - phrase, - prefix, - provider, - password, - }: { - phrase: string; - prefix: string; - provider?: Provider; - password?: string; - }): HDNodeWallet { - const wallet = HDNodeWallet.fromPhrase({ - phrase, - prefix, - password, - }); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } - static fromSeed({ - seed, - prefix, - provider, - path, - }: { - seed: string; - prefix: string; - path?: string; - provider?: Provider; - }): HDNodeWallet { - const wallet = HDNodeWallet.fromSeed({ - seed, - prefix, - path: path || defaultPath, - }); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } + /** + * Creates a [[HDNodeWallet]] for %%phrase%%. + */ + static fromPhrase({ + phrase, + prefix, + provider, + password, + }: { + phrase: string; + prefix: string; + provider?: Provider; + password?: string; + }): HDNodeWallet { + const wallet = HDNodeWallet.fromPhrase({ + phrase, + prefix, + password, + }); + if (provider) { + return wallet.connect(provider); + } + return wallet; + } + static fromSeed({ + seed, + prefix, + provider, + path, + }: { + seed: string; + prefix: string; + path?: string; + provider?: Provider; + }): HDNodeWallet { + const wallet = HDNodeWallet.fromSeed({ + seed, + prefix, + path: path || defaultPath, + }); + if (provider) { + return wallet.connect(provider); + } + return wallet; + } } diff --git a/src.ts/wordlists/bit-reader.ts b/src.ts/wordlists/bit-reader.ts index 3c1f2c878..12b140956 100644 --- a/src.ts/wordlists/bit-reader.ts +++ b/src.ts/wordlists/bit-reader.ts @@ -1,37 +1,37 @@ const Base64 = - ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; + ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; /** * @_ignore */ export function decodeBits(width: number, data: string): Array { - const maxValue = (1 << width) - 1; - const result: Array = []; - let accum = 0, - bits = 0, - flood = 0; - for (let i = 0; i < data.length; i++) { - // Accumulate 6 bits of data - accum = (accum << 6) | Base64.indexOf(data[i]); - bits += 6; + const maxValue = (1 << width) - 1; + const result: Array = []; + let accum = 0, + bits = 0, + flood = 0; + for (let i = 0; i < data.length; i++) { + // Accumulate 6 bits of data + accum = (accum << 6) | Base64.indexOf(data[i]); + bits += 6; - // While we have enough for a word... - while (bits >= width) { - // ...read the word - const value = accum >> (bits - width); - accum &= (1 << (bits - width)) - 1; - bits -= width; + // While we have enough for a word... + while (bits >= width) { + // ...read the word + const value = accum >> (bits - width); + accum &= (1 << (bits - width)) - 1; + bits -= width; - // A value of 0 indicates we exceeded maxValue, it - // floods over into the next value - if (value === 0) { - flood += maxValue; - } else { - result.push(value + flood); - flood = 0; - } - } - } + // A value of 0 indicates we exceeded maxValue, it + // floods over into the next value + if (value === 0) { + flood += maxValue; + } else { + result.push(value + flood); + flood = 0; + } + } + } - return result; + return result; } diff --git a/src.ts/wordlists/decode-owl.ts b/src.ts/wordlists/decode-owl.ts index cbe7e778f..7aa8076ed 100644 --- a/src.ts/wordlists/decode-owl.ts +++ b/src.ts/wordlists/decode-owl.ts @@ -4,64 +4,64 @@ const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; const Word = /^[a-z]*$/i; function unfold(words: Array, sep: string): Array { - let initial = 97; - return words.reduce( - (accum, word) => { - if (word === sep) { - initial++; - } else if (word.match(Word)) { - accum.push(String.fromCharCode(initial) + word); - } else { - initial = 97; - accum.push(word); - } - return accum; - }, - >[], - ); + let initial = 97; + return words.reduce( + (accum, word) => { + if (word === sep) { + initial++; + } else if (word.match(Word)) { + accum.push(String.fromCharCode(initial) + word); + } else { + initial = 97; + accum.push(word); + } + return accum; + }, + >[], + ); } /** * @_ignore */ export function decode(data: string, subs: string): Array { - // Replace all the substitutions with their expanded form - for (let i = subsChrs.length - 1; i >= 0; i--) { - data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); - } + // Replace all the substitutions with their expanded form + for (let i = subsChrs.length - 1; i >= 0; i--) { + data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); + } - // Get all tle clumps; each suffix, first-increment and second-increment - const clumps: Array = []; - const leftover = data.replace( - /(:|([0-9])|([A-Z][a-z]*))/g, - (all, item, semi, word) => { - if (semi) { - for (let i = parseInt(semi); i >= 0; i--) { - clumps.push(";"); - } - } else { - clumps.push(item.toLowerCase()); - } - return ""; - }, - ); - /* c8 ignore start */ - if (leftover) { - throw new Error(`leftovers: ${JSON.stringify(leftover)}`); - } - /* c8 ignore stop */ + // Get all tle clumps; each suffix, first-increment and second-increment + const clumps: Array = []; + const leftover = data.replace( + /(:|([0-9])|([A-Z][a-z]*))/g, + (all, item, semi, word) => { + if (semi) { + for (let i = parseInt(semi); i >= 0; i--) { + clumps.push(";"); + } + } else { + clumps.push(item.toLowerCase()); + } + return ""; + }, + ); + /* c8 ignore start */ + if (leftover) { + throw new Error(`leftovers: ${JSON.stringify(leftover)}`); + } + /* c8 ignore stop */ - return unfold(unfold(clumps, ";"), ":"); + return unfold(unfold(clumps, ";"), ":"); } /** * @_ignore */ export function decodeOwl(data: string): Array { - assertArgument(data[0] === "0", "unsupported auwl data", "data", data); + assertArgument(data[0] === "0", "unsupported auwl data", "data", data); - return decode( - data.substring(1 + 2 * subsChrs.length), - data.substring(1, 1 + 2 * subsChrs.length), - ); + return decode( + data.substring(1 + 2 * subsChrs.length), + data.substring(1, 1 + 2 * subsChrs.length), + ); } diff --git a/src.ts/wordlists/decode-owla.ts b/src.ts/wordlists/decode-owla.ts index d25432a09..898d51815 100644 --- a/src.ts/wordlists/decode-owla.ts +++ b/src.ts/wordlists/decode-owla.ts @@ -7,31 +7,31 @@ import { decodeOwl } from "./decode-owl.js"; * @_ignore */ export function decodeOwlA(data: string, accents: string): Array { - let words = decodeOwl(data).join(","); + let words = decodeOwl(data).join(","); - // Inject the accents - accents.split(/,/g).forEach((accent) => { - const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); - assertArgument( - match !== null, - "internal error parsing accents", - "accents", - accents, - ); + // Inject the accents + accents.split(/,/g).forEach((accent) => { + const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); + assertArgument( + match !== null, + "internal error parsing accents", + "accents", + accents, + ); - let posOffset = 0; - const positions = decodeBits(parseInt(match[3]), match[4]); - const charCode = parseInt(match[2]); - const regex = new RegExp(`([${match[1]}])`, "g"); - words = words.replace(regex, (all, letter) => { - const rem = --positions[posOffset]; - if (rem === 0) { - letter = String.fromCharCode(letter.charCodeAt(0), charCode); - posOffset++; - } - return letter; - }); - }); + let posOffset = 0; + const positions = decodeBits(parseInt(match[3]), match[4]); + const charCode = parseInt(match[2]); + const regex = new RegExp(`([${match[1]}])`, "g"); + words = words.replace(regex, (all, letter) => { + const rem = --positions[posOffset]; + if (rem === 0) { + letter = String.fromCharCode(letter.charCodeAt(0), charCode); + posOffset++; + } + return letter; + }); + }); - return words.split(","); + return words.split(","); } diff --git a/src.ts/wordlists/enwords.ts b/src.ts/wordlists/enwords.ts index 625e42e11..56d99ca5c 100644 --- a/src.ts/wordlists/enwords.ts +++ b/src.ts/wordlists/enwords.ts @@ -1,2 +1,2 @@ export const enWords = - "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; + "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; diff --git a/src.ts/wordlists/generation/encode-latin.ts b/src.ts/wordlists/generation/encode-latin.ts index 399f56b43..24a67af3c 100644 --- a/src.ts/wordlists/generation/encode-latin.ts +++ b/src.ts/wordlists/generation/encode-latin.ts @@ -69,35 +69,35 @@ const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; const Word = /^[a-z'`]*$/i; function fold(words: Array, sep: string): Array { - const output: Array = []; - - let initial = 97; - for (const word of words) { - if (word.match(Word)) { - while (initial < word.charCodeAt(0)) { - initial++; - output.push(sep); - } - output.push(word.substring(1)); - } else { - initial = 97; - output.push(word); - } - } - - return output; + const output: Array = []; + + let initial = 97; + for (const word of words) { + if (word.match(Word)) { + while (initial < word.charCodeAt(0)) { + initial++; + output.push(sep); + } + output.push(word.substring(1)); + } else { + initial = 97; + output.push(word); + } + } + + return output; } function camelcase(words: Array): string { - return words - .map((word) => { - if (word.match(Word)) { - return word[0].toUpperCase() + word.substring(1); - } else { - return word; - } - }) - .join(""); + return words + .map((word) => { + if (word.match(Word)) { + return word[0].toUpperCase() + word.substring(1); + } else { + return word; + } + }) + .join(""); } //let cc = 0, ce = 0; @@ -134,258 +134,258 @@ function mangle(text: string): { word: string, special: string } { */ const Base64 = - ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; + ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; export class BitWriter { - readonly width: number; - readonly #data: Array; - - #bitLength: number; - - constructor(width: number) { - this.width = width; - this.#data = []; - this.#bitLength = 0; - } - - write(value: number): void { - const maxValue = (1 << this.width) - 1; - while (value > maxValue) { - this.#data.push(0); - this.#bitLength += this.width; - value -= maxValue; - } - this.#data.push(value); - this.#bitLength += this.width; - } - - get length(): number { - return 1 + Math.trunc((this.#bitLength + 5) / 6); - } - - get data(): string { - let result = String(this.width); - let bits = 0; - let accum = 0; - - const data = this.#data.slice(); - let bitMod = this.#bitLength % 6; - while (bitMod !== 0 && bitMod < 6) { - data.push(0); - bitMod += this.width; - } - - for (const value of data) { - accum <<= this.width; - accum |= value; - bits += this.width; - - if (bits < 6) { - continue; - } - - result += Base64[accum >> (bits - 6)]; - bits -= 6; - accum &= (1 << bits) - 1; - } - - if (result.length !== this.length) { - throw new Error(`Hmm: ${this.length} ${result.length} ${result}`); - } - return result; - } + readonly width: number; + readonly #data: Array; + + #bitLength: number; + + constructor(width: number) { + this.width = width; + this.#data = []; + this.#bitLength = 0; + } + + write(value: number): void { + const maxValue = (1 << this.width) - 1; + while (value > maxValue) { + this.#data.push(0); + this.#bitLength += this.width; + value -= maxValue; + } + this.#data.push(value); + this.#bitLength += this.width; + } + + get length(): number { + return 1 + Math.trunc((this.#bitLength + 5) / 6); + } + + get data(): string { + let result = String(this.width); + let bits = 0; + let accum = 0; + + const data = this.#data.slice(); + let bitMod = this.#bitLength % 6; + while (bitMod !== 0 && bitMod < 6) { + data.push(0); + bitMod += this.width; + } + + for (const value of data) { + accum <<= this.width; + accum |= value; + bits += this.width; + + if (bits < 6) { + continue; + } + + result += Base64[accum >> (bits - 6)]; + bits -= 6; + accum &= (1 << bits) - 1; + } + + if (result.length !== this.length) { + throw new Error(`Hmm: ${this.length} ${result.length} ${result}`); + } + return result; + } } export interface AccentSet { - accent: number; - follows: string; - positions: Array; - positionsLength: number; - positionData: string; - positionDataLength: number; + accent: number; + follows: string; + positions: Array; + positionsLength: number; + positionData: string; + positionDataLength: number; } function sorted(text: string): string { - const letters = text.split(""); - letters.sort(); - return letters.join(""); + const letters = text.split(""); + letters.sort(); + return letters.join(""); } // if (c.charCodeAt(0) === 768) { return "`"; } // if (c.charCodeAt(0) === 769) { return "'"; } // if (c.charCodeAt(0) === 771) { return "~"; } export function extractAccents(words: Array): { - accents: Array; - words: Array; + accents: Array; + words: Array; } { - // Build a list that maps accents to the letters it can follow - const followsMap: Map = new Map(); - for (const word of words) { - for (let i = 0; i < word.length; i++) { - const c = word[i]; - if (c >= "a" && c <= "z") { - continue; - } - - // Make sure this positions and codepoint make sense - if (c.charCodeAt(1)) { - throw new Error(`unsupported codepoint: "${c}"`); - } - if (i === 0) { - throw new Error(`unmatched accent: ${c}`); - } - - const ac = c.charCodeAt(0), - lastLetter = word[i - 1]; - const follows = followsMap.get(ac) || ""; - if (follows.indexOf(lastLetter) === -1) { - followsMap.set(ac, sorted(follows + lastLetter)); - } - } - } - - // Build the positions of each follow-set for those accents - const positionsMap: Map> = new Map(); - for (const [accent, follows] of followsMap) { - let count = 0; - for (const word of words) { - for (let i = 0; i < word.length; i++) { - const c = word[i], - ac = c.charCodeAt(0); - if (follows.indexOf(c) >= 0) { - count++; - } - if (ac === accent) { - const pos = positionsMap.get(ac) || []; - pos.push(count); - positionsMap.set(ac, pos); - } - } - } - } - - const accents: Array = []; - for (const [accent, follows] of followsMap) { - let last = -1; - const positions = (positionsMap.get(accent) || []).map((value, index) => { - const delta = value - last; - last = value; - if (index === 0) { - return value; - } - return delta; - }); - - // Find the best encoding of the position data - let positionData = ""; - for (let i = 2; i < 7; i++) { - const bitWriter = new BitWriter(i); - for (const p of positions) { - bitWriter.write(p); - } - if (positionData === "" || bitWriter.length < positionData.length) { - positionData = bitWriter.data; - } - } - const positionsLength = positions.length; - const positionDataLength = positionData.length; - - accents.push({ - accent, - follows, - positions, - positionsLength, - positionData, - positionDataLength, - }); - } - - words = words.map((word) => { - let result = ""; - for (let i = 0; i < word.length; i++) { - const c = word[i]; - if (c >= "a" && c <= "z") { - result += c; - } - } - return result; - }); - - return { accents, words }; + // Build a list that maps accents to the letters it can follow + const followsMap: Map = new Map(); + for (const word of words) { + for (let i = 0; i < word.length; i++) { + const c = word[i]; + if (c >= "a" && c <= "z") { + continue; + } + + // Make sure this positions and codepoint make sense + if (c.charCodeAt(1)) { + throw new Error(`unsupported codepoint: "${c}"`); + } + if (i === 0) { + throw new Error(`unmatched accent: ${c}`); + } + + const ac = c.charCodeAt(0), + lastLetter = word[i - 1]; + const follows = followsMap.get(ac) || ""; + if (follows.indexOf(lastLetter) === -1) { + followsMap.set(ac, sorted(follows + lastLetter)); + } + } + } + + // Build the positions of each follow-set for those accents + const positionsMap: Map> = new Map(); + for (const [accent, follows] of followsMap) { + let count = 0; + for (const word of words) { + for (let i = 0; i < word.length; i++) { + const c = word[i], + ac = c.charCodeAt(0); + if (follows.indexOf(c) >= 0) { + count++; + } + if (ac === accent) { + const pos = positionsMap.get(ac) || []; + pos.push(count); + positionsMap.set(ac, pos); + } + } + } + } + + const accents: Array = []; + for (const [accent, follows] of followsMap) { + let last = -1; + const positions = (positionsMap.get(accent) || []).map((value, index) => { + const delta = value - last; + last = value; + if (index === 0) { + return value; + } + return delta; + }); + + // Find the best encoding of the position data + let positionData = ""; + for (let i = 2; i < 7; i++) { + const bitWriter = new BitWriter(i); + for (const p of positions) { + bitWriter.write(p); + } + if (positionData === "" || bitWriter.length < positionData.length) { + positionData = bitWriter.data; + } + } + const positionsLength = positions.length; + const positionDataLength = positionData.length; + + accents.push({ + accent, + follows, + positions, + positionsLength, + positionData, + positionDataLength, + }); + } + + words = words.map((word) => { + let result = ""; + for (let i = 0; i < word.length; i++) { + const c = word[i]; + if (c >= "a" && c <= "z") { + result += c; + } + } + return result; + }); + + return { accents, words }; } // Encode Official WordList export function encodeOwl(words: Array): { - subs: string; - data: string; + subs: string; + data: string; } { - // Fold the sorted words by indicating delta for the first 2 letters - let data = camelcase(fold(fold(words, ":"), ";")); - - // Replace semicolons with counts (e.g. ";;;" with "3") - data = data.replace(/(;+)/g, (all, semis) => { - let result = ""; - while (semis.length) { - let count = semis.length; - if (count > 10) { - count = 10; - } - result += String(count - 1); - semis = semis.substring(count); - } - return result; - }); - - // Finds the best option for a shortcut replacement using the - // unused ascii7 characters - function findBest(): string { - const tally: Record = {}; - const l = 2; - for (let i = l; i < data.length; i++) { - const key = data.substring(i - l, i); - tally[key] = (tally[key] || 0) + 1; - } - - const sorted: Array<{ text: string; count: number; save: number }> = - Object.keys(tally).map((text) => { - return { - text, - count: tally[text], - save: tally[text] * (text.length - 1), - }; - }); - sorted.sort((a, b) => b.save - a.save); - - return sorted[0].text; - } - - // Make substitutions - let subs = ""; - for (let i = 0; i < subsChrs.length; i++) { - const n = subsChrs[i], - o = findBest(); - subs += o; - data = data.split(o).join(n); - } - - return { data, subs }; + // Fold the sorted words by indicating delta for the first 2 letters + let data = camelcase(fold(fold(words, ":"), ";")); + + // Replace semicolons with counts (e.g. ";;;" with "3") + data = data.replace(/(;+)/g, (all, semis) => { + let result = ""; + while (semis.length) { + let count = semis.length; + if (count > 10) { + count = 10; + } + result += String(count - 1); + semis = semis.substring(count); + } + return result; + }); + + // Finds the best option for a shortcut replacement using the + // unused ascii7 characters + function findBest(): string { + const tally: Record = {}; + const l = 2; + for (let i = l; i < data.length; i++) { + const key = data.substring(i - l, i); + tally[key] = (tally[key] || 0) + 1; + } + + const sorted: Array<{ text: string; count: number; save: number }> = + Object.keys(tally).map((text) => { + return { + text, + count: tally[text], + save: tally[text] * (text.length - 1), + }; + }); + sorted.sort((a, b) => b.save - a.save); + + return sorted[0].text; + } + + // Make substitutions + let subs = ""; + for (let i = 0; i < subsChrs.length; i++) { + const n = subsChrs[i], + o = findBest(); + subs += o; + data = data.split(o).join(n); + } + + return { data, subs }; } // Returns either: // - OWL data for accent-free latin-1: { data, accentds: "" } // - OWLA data for accented latin-1: { data, accents } function encodeWords(_words: Array): { data: string; accents: string } { - const { accents, words } = extractAccents(_words); - const { data, subs } = encodeOwl(words); - const accentData = accents - .map(({ accent, follows, positionData }) => { - return `${follows}${accent}${positionData}`; - }) - .join(","); - - return { - data: `0${subs}${data}`, - accents: accentData, - }; + const { accents, words } = extractAccents(_words); + const { data, subs } = encodeOwl(words); + const accentData = accents + .map(({ accent, follows, positionData }) => { + return `${follows}${accent}${positionData}`; + }) + .join(","); + + return { + data: `0${subs}${data}`, + accents: accentData, + }; } // CLI @@ -394,28 +394,28 @@ const words = content.split("\n").filter(Boolean); const { data, accents } = encodeWords(words); if (accents) { - const rec = decodeOwlA(data, accents); - console.log("DATA: ", JSON.stringify(data)); - console.log("ACCENTS: ", JSON.stringify(accents)); - console.log("LENGTH: ", data.length); - console.log("CHECKSUM: ", id(content)); - console.log( - "RATIO: ", - Math.trunc((100 * data.length) / content.length) + "%", - ); - if (rec.join("\n") !== words.join("\n")) { - throw new Error("no match!"); - } + const rec = decodeOwlA(data, accents); + console.log("DATA: ", JSON.stringify(data)); + console.log("ACCENTS: ", JSON.stringify(accents)); + console.log("LENGTH: ", data.length); + console.log("CHECKSUM: ", id(content)); + console.log( + "RATIO: ", + Math.trunc((100 * data.length) / content.length) + "%", + ); + if (rec.join("\n") !== words.join("\n")) { + throw new Error("no match!"); + } } else { - const rec = decodeOwl(data); - console.log("DATA: ", JSON.stringify(data)); - console.log("LENGTH: ", data.length); - console.log("CHECKSUM: ", id(content)); - console.log( - "RATIO: ", - Math.trunc((100 * data.length) / content.length) + "%", - ); - if (rec.join("\n") !== words.join("\n")) { - throw new Error("no match!"); - } + const rec = decodeOwl(data); + console.log("DATA: ", JSON.stringify(data)); + console.log("LENGTH: ", data.length); + console.log("CHECKSUM: ", id(content)); + console.log( + "RATIO: ", + Math.trunc((100 * data.length) / content.length) + "%", + ); + if (rec.join("\n") !== words.join("\n")) { + throw new Error("no match!"); + } } diff --git a/src.ts/wordlists/lang-cz.ts b/src.ts/wordlists/lang-cz.ts index 9bc2a267f..d21e1d9f4 100644 --- a/src.ts/wordlists/lang-cz.ts +++ b/src.ts/wordlists/lang-cz.ts @@ -1,9 +1,9 @@ import { WordlistOwl } from "./wordlist-owl.js"; const words = - "0itatkastcenaovo$taouleraeki&chor*teci%enbalodaeladet'!Chn=0Di#%E%^1Resa2Rese3CeT'#0EjKohol0Pu)%0A&sDul#Ekdo)Ke)Ti#Ul|3}aOgan%0FaltI$@tPi,%TmaTronom0LasL{i#Ol0Tobus4Yl:B#}R'?TaUb_U/!U^U+Ur!Xer2A^v#Ambo,An#AtrEp)Ike)KoLohOnzOskevUn{#Usin#Z^Zy2Bl.Bn|})D _D#D'aF{Jar(Kv?LdokLvaN^NkrRzaTikVolZola3D+tL.T'#0Ukot:PartRev&3DrDu+J/JnLaLerLkemLn?N.Nn(N'#NtrumNzZ(2O&2K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jeIz{Ocn Odr!Rzl.Ut|0AkAl(Am@!Ovu0B,z Tav Ub-Ufa+0Lod Omal RavaR( Rud#Rvu1A^An C`]N (NoOv&Y/l Zav(1I/aR! 0B'.Br0Ed~EnkuEs_aOnR!Uk'odYk"; const checksum = - "0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a"; + "0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a"; let wordlist: null | LangCz = null; @@ -13,26 +13,26 @@ let wordlist: null | LangCz = null; * @_docloc: api/wordlists */ export class LangCz extends WordlistOwl { - /** - * Creates a new instance of the Czech language Wordlist. - * - * Using the constructor should be unnecessary, instead use the - * [[wordlist]] singleton method. - * - * @_ignore: - */ - constructor() { - super("cz", words, checksum); - } + /** + * Creates a new instance of the Czech language Wordlist. + * + * Using the constructor should be unnecessary, instead use the + * [[wordlist]] singleton method. + * + * @_ignore: + */ + constructor() { + super("cz", words, checksum); + } - /** - * Returns a singleton instance of a ``LangCz``, creating it - * if this is the first time being called. - */ - static wordlist(): LangCz { - if (wordlist == null) { - wordlist = new LangCz(); - } - return wordlist; - } + /** + * Returns a singleton instance of a ``LangCz``, creating it + * if this is the first time being called. + */ + static wordlist(): LangCz { + if (wordlist == null) { + wordlist = new LangCz(); + } + return wordlist; + } } diff --git a/src.ts/wordlists/lang-en.ts b/src.ts/wordlists/lang-en.ts index d92f35c56..d2d81de09 100644 --- a/src.ts/wordlists/lang-en.ts +++ b/src.ts/wordlists/lang-en.ts @@ -1,9 +1,9 @@ import { WordlistOwl } from "./wordlist-owl.js"; const words = - "0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOnomy0GeItUca>1F%t0G1GhtTh 2BowD E@r-EgSe0B?kBodyBra)Er+Ot]PloyPow Pty0Ab!A@DD![D%'EmyErgyF%)Ga+G(eH<)JoyLi,OughR-hRollSu*T Ti*TryVelope1Isode0U$Uip0AA'OdeOs]R%Upt0CapeSayS&)Ta>0Ern$H-s1Id&)IlOkeOl=1A@Amp!Ce[Ch<+C.eCludeCu'Ecu>Erci'Hau,Hib.I!I,ItOt-PM&'Mu}Pa@Po'Pro=Pul'0ChCludeComeC*a'DexD-a>Do%Du,ryFN Noc|PutQuirySSue0Em1Ory:CketGu?RZz3AlousAns~yWel9BInKeUr}yY5D+I)MpNg!Ni%Nk/:Ng?oo3EnEpT^upY3CkDD}yNdNgdomSsTT^&TeTt&Wi4Ee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$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO"; + "0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,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b N?N^Xury3R-s:Ch(eDG-G}tIdIlInJ%KeMm$NNa+Nda>NgoNs]Nu$P!Rb!R^Rg(R(eRketRria+SkSs/ T^T i$ThTrixTt XimumZe3AdowAnAsu*AtCh<-D$DiaLodyLtMb M%yNt]NuRcyR+R.RryShSsa+T$Thod3Dd!DnightLk~]M-NdNimumN%Nu>Rac!Rr%S ySs/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurEAyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO"; const checksum = - "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"; + "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"; let wordlist: null | LangEn = null; @@ -13,26 +13,26 @@ let wordlist: null | LangEn = null; * @_docloc: api/wordlists */ export class LangEn extends WordlistOwl { - /** - * Creates a new instance of the English language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langEn]] should suffice. - * - * @_ignore: - */ - constructor() { - super("en", words, checksum); - } + /** + * Creates a new instance of the English language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langEn]] should suffice. + * + * @_ignore: + */ + constructor() { + super("en", words, checksum); + } - /** - * Returns a singleton instance of a ``LangEn``, creating it - * if this is the first time being called. - */ - static wordlist(): LangEn { - if (wordlist == null) { - wordlist = new LangEn(); - } - return wordlist; - } + /** + * Returns a singleton instance of a ``LangEn``, creating it + * if this is the first time being called. + */ + static wordlist(): LangEn { + if (wordlist == null) { + wordlist = new LangEn(); + } + return wordlist; + } } diff --git a/src.ts/wordlists/lang-es.ts b/src.ts/wordlists/lang-es.ts index 31eba917a..d40c98ab7 100644 --- a/src.ts/wordlists/lang-es.ts +++ b/src.ts/wordlists/lang-es.ts @@ -1,11 +1,11 @@ import { WordlistOwlA } from "./wordlist-owla.js"; const words = - "0arertoiotadonoaRteirroenaNonaLsolocoiliaralaorrenadaChoN$n0A>Dom,EjaI!#Oga&O'Or#RazoR*Ue=U<0Ab Adem@CeLe%OmoRa!RozUn0DazD$GeLaM,#S,)T^0AlAnceA+EEl]`E`EstruzI.I<2ErU{U'0Af[nArO)Uc Uf_Ul:BaB^|eH@IleJ Lanz/c.LdeMbuN>Nd-oRb(>RnizR+Scu]S#nSu[Tal]T!@T*Tu%UlZ 3BeBid/=S SoSt@3|oEnNgo2An>OqueUsa2ABi`BoCaCi`DaDegaIn//!oLsaMb-{dNi#N}saiRdeRr SqueTeTinVe{Zal2AvoAzoEchaEveIl=In>IsaOcaOmaOnceO)UjaUs>U#2CeoCleE'EyFan{F.HoIt_L#Rbuj(l(+Sc TacaZ.:Bal=BezaBi`B[CaoDav!D,aErFeI{ImanJaJ.LLam Lc$L&Li{dLleLm/^LvoMaMb$Mel=Mi'Mp}c!Nd?Nel-gu+Nic-#N-.ObaOsPazPi%nPo)Pt Puch((b.RcelRe%Rg(i'RneRpe%R+R%SaS>S!oSpaS#rT^ceT_U{lUsaZo3Bol]D!D+Ld/eb_LoAmpuAnc]ApaAr]I>Is)IvoOqueOzaUle%Up 0Cl.EgoE=EnEr#F[G +M->NeN%P_sR>Rue]SneTaU{d2Am^AnA+AseAveI,)ImaInica2B_Cc~|i'Ci`CoDigoDoF_G!He)JinJoL/ch/eg$Lg Lin/l LmoLum`Mba)M!Mi{Mo&Mpr-deNej}g-oc!Nsej}t PaPi(az.Rba%RchoR&nR.(r!S!SmosS%2AneoAt!E Ec!Ei&EmaIaIm,Ip%IsisOmoOnicaOque%U&Uz2Ad+Ar#At+BoBr*| aEl=En#Er{Es%EvaId Lebr/p/#Mb_Mpl*N-e%O%P.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ur)Tu-0Ag&EdeseEgl'El&Enu Ez?IluppoIs+Izze-Ol+Uot&:Bac]Bul#Cci&Citur$LeLis`$MpoVer=Vo/+Zza3CaCn>Lefo$Me-r'MpoMu N@Pog-foRagg'RoTan'To*Tuban.Z'Zzo<5Cc&L,r&L Mbo/MoNfoNsil/Paz'Po*g?PpaRbaRn&R)L,t+Lo)(Lut&L_/Mpa+Ng&N{(NoN+gg'Nve-Po!Ra$Rc#R?n.S}3Det+DovaDu Ge+,I]*Lc)Li=Llu LoceN#Ndemm?N RaceRba,Rgog=Rif~RoRru}Rt~,Sc~Ssil*S+,Te-$Tri=Tus 3Andan.B-n.C[daChingoCi=nzaDim&Gil?G< Go!LeL/$MiniNc{!O/Pe-Rgo/Ro*goRu,n S](S'5Cche)Fo*LuPpa"; const checksum = - "0x5c1362d88fd4cf614a96f3234941d29f7d37c08c5292fde03bf62c2db6ff7620"; + "0x5c1362d88fd4cf614a96f3234941d29f7d37c08c5292fde03bf62c2db6ff7620"; let wordlist: null | LangIt = null; @@ -13,26 +13,26 @@ let wordlist: null | LangIt = null; * @_docloc: api/wordlists */ export class LangIt extends WordlistOwl { - /** - * Creates a new instance of the Italian language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langIt]] should suffice. - * - * @_ignore: - */ - constructor() { - super("it", words, checksum); - } + /** + * Creates a new instance of the Italian language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langIt]] should suffice. + * + * @_ignore: + */ + constructor() { + super("it", words, checksum); + } - /** - * Returns a singleton instance of a ``LangIt``, creating it - * if this is the first time being called. - */ - static wordlist(): LangIt { - if (wordlist == null) { - wordlist = new LangIt(); - } - return wordlist; - } + /** + * Returns a singleton instance of a ``LangIt``, creating it + * if this is the first time being called. + */ + static wordlist(): LangIt { + if (wordlist == null) { + wordlist = new LangIt(); + } + return wordlist; + } } diff --git a/src.ts/wordlists/lang-ja.ts b/src.ts/wordlists/lang-ja.ts index 097bd91d2..50823e73e 100644 --- a/src.ts/wordlists/lang-ja.ts +++ b/src.ts/wordlists/lang-ja.ts @@ -1,148 +1,148 @@ import { id } from "../hash/index.js"; import { - hexlify, - assertArgument, - toUtf8Bytes, - toUtf8String, + hexlify, + assertArgument, + toUtf8Bytes, + toUtf8String, } from "../utils/index.js"; import { Wordlist } from "./wordlist.js"; const data = [ - // 4-kana words - "AQRASRAGBAGUAIRAHBAghAURAdBAdcAnoAMEAFBAFCBKFBQRBSFBCXBCDBCHBGFBEQBpBBpQBIkBHNBeOBgFBVCBhBBhNBmOBmRBiHBiFBUFBZDBvFBsXBkFBlcBjYBwDBMBBTBBTRBWBBWXXaQXaRXQWXSRXCFXYBXpHXOQXHRXhRXuRXmXXbRXlXXwDXTRXrCXWQXWGaBWaKcaYgasFadQalmaMBacAKaRKKBKKXKKjKQRKDRKCYKCRKIDKeVKHcKlXKjHKrYNAHNBWNaRNKcNIBNIONmXNsXNdXNnBNMBNRBNrXNWDNWMNFOQABQAHQBrQXBQXFQaRQKXQKDQKOQKFQNBQNDQQgQCXQCDQGBQGDQGdQYXQpBQpQQpHQLXQHuQgBQhBQhCQuFQmXQiDQUFQZDQsFQdRQkHQbRQlOQlmQPDQjDQwXQMBQMDQcFQTBQTHQrDDXQDNFDGBDGQDGRDpFDhFDmXDZXDbRDMYDRdDTRDrXSAhSBCSBrSGQSEQSHBSVRShYShkSyQSuFSiBSdcSoESocSlmSMBSFBSFKSFNSFdSFcCByCaRCKcCSBCSRCCrCGbCEHCYXCpBCpQCIBCIHCeNCgBCgFCVECVcCmkCmwCZXCZFCdRClOClmClFCjDCjdCnXCwBCwXCcRCFQCFjGXhGNhGDEGDMGCDGCHGIFGgBGVXGVEGVRGmXGsXGdYGoSGbRGnXGwXGwDGWRGFNGFLGFOGFdGFkEABEBDEBFEXOEaBEKSENBENDEYXEIgEIkEgBEgQEgHEhFEudEuFEiBEiHEiFEZDEvBEsXEsFEdXEdREkFEbBEbRElFEPCEfkEFNYAEYAhYBNYQdYDXYSRYCEYYoYgQYgRYuRY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CgGQJqXgdQYJEgFMFNBgJFcqDVJwXUJVJFZJchIgJCCxOEJqXxOwXUJyDJBVRuscisciJBiJBieUtqXiJFDJkiFsJXQUGEZJcUJFsJXZtXIrXZDZJDrZJFNJDZJFstXvJFQqXvJFCJEsJXQJqkhkNGBbDJdTRbYJMEBlDwXUJMEFiJFcfXNJDRcNJWMTBLJXC", - // 8-kana words - "BraFUtHBFSJFdbNBLJXVJQoYJNEBSJBEJfHSJHwXUJCJdAZJMGjaFVJXEJPNJBlEJfFiJFpFbFEJqIJBVJCrIBdHiJhOPFChvJVJZJNJWxGFNIFLueIBQJqUHEJfUFstOZJDrlXEASJRlXVJXSFwVJNJWD", + // 8-kana words + "BraFUtHBFSJFdbNBLJXVJQoYJNEBSJBEJfHSJHwXUJCJdAZJMGjaFVJXEJPNJBlEJfFiJFpFbFEJqIJBVJCrIBdHiJhOPFChvJVJZJNJWxGFNIFLueIBQJqUHEJfUFstOZJDrlXEASJRlXVJXSFwVJNJWD", - // 9-kana words - "QJEJNNJDQJEJIBSFQJEJxegBQJEJfHEPSJBmXEJFSJCDEJqXLXNJFQqXIcQsFNJFIFEJqXUJgFsJXIJBUJEJfHNFvJxEqXNJnXUJFQqD", + // 9-kana words + "QJEJNNJDQJEJIBSFQJEJxegBQJEJfHEPSJBmXEJFSJCDEJqXLXNJFQqXIcQsFNJFIFEJqXUJgFsJXIJBUJEJfHNFvJxEqXNJnXUJFQqD", - // 10-kana words - "IJBEJqXZJ", + // 10-kana words + "IJBEJqXZJ", ]; // Maps each character into its kana value (the index) const mapping = - "~~AzB~X~a~KN~Q~D~S~C~G~E~Y~p~L~I~O~eH~g~V~hxyumi~~U~~Z~~v~~s~~dkoblPjfnqwMcRTr~W~~~F~~~~~Jt"; + "~~AzB~X~a~KN~Q~D~S~C~G~E~Y~p~L~I~O~eH~g~V~hxyumi~~U~~Z~~v~~s~~dkoblPjfnqwMcRTr~W~~~F~~~~~Jt"; let _wordlist: null | Array = null; function hex(word: string): string { - return hexlify(toUtf8Bytes(word)); + return hexlify(toUtf8Bytes(word)); } const KiYoKu = "0xe3818de38284e3818f"; const KyoKu = "0xe3818de38283e3818f"; function toString(data: Array): string { - return toUtf8String(new Uint8Array(data)); + return toUtf8String(new Uint8Array(data)); } function loadWords(): Array { - if (_wordlist !== null) { - return _wordlist; - } - - const wordlist = []; - - // Transforms for normalizing (sort is a not quite UTF-8) - const transform: { [key: string]: string | boolean } = {}; - - // Delete the diacritic marks - transform[toString([227, 130, 154])] = false; - transform[toString([227, 130, 153])] = false; - - // Some simple transforms that sort out most of the order - transform[toString([227, 130, 133])] = toString([227, 130, 134]); - transform[toString([227, 129, 163])] = toString([227, 129, 164]); - transform[toString([227, 130, 131])] = toString([227, 130, 132]); - transform[toString([227, 130, 135])] = toString([227, 130, 136]); - - // Normalize words using the transform - function normalize(word: string) { - let result = ""; - for (let i = 0; i < word.length; i++) { - let kana = word[i]; - const target = transform[kana]; - if (target === false) { - continue; - } - if (target) { - kana = target; - } - result += kana; - } - return result; - } - - // Sort how the Japanese list is sorted - function sortJapanese(a: string, b: string) { - a = normalize(a); - b = normalize(b); - if (a < b) { - return -1; - } - if (a > b) { - return 1; - } - return 0; - } - - // Load all the words - for (let length = 3; length <= 9; length++) { - const d = data[length - 3]; - for (let offset = 0; offset < d.length; offset += length) { - const word = []; - for (let i = 0; i < length; i++) { - const k = mapping.indexOf(d[offset + i]); - word.push(227); - word.push(k & 0x40 ? 130 : 129); - word.push((k & 0x3f) + 128); - } - wordlist.push(toString(word)); - } - } - wordlist.sort(sortJapanese); - - // For some reason kyoku and kiyoku are flipped in node (!!). - // The order SHOULD be: - // - kyoku - // - kiyoku - - // This should ignore "if", but that doesn't work here?? - /* c8 ignore start */ - if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) { - const tmp = wordlist[442]; - wordlist[442] = wordlist[443]; - wordlist[443] = tmp; - } - /* c8 ignore stop */ - - // Verify the computed list matches the official list - /* istanbul ignore if */ - const checksum = id(wordlist.join("\n") + "\n"); - /* c8 ignore start */ - if ( - checksum !== - "0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600" - ) { - throw new Error("BIP39 Wordlist for ja (Japanese) FAILED"); - } - /* c8 ignore stop */ - - _wordlist = wordlist; - - return wordlist; + if (_wordlist !== null) { + return _wordlist; + } + + const wordlist = []; + + // Transforms for normalizing (sort is a not quite UTF-8) + const transform: { [key: string]: string | boolean } = {}; + + // Delete the diacritic marks + transform[toString([227, 130, 154])] = false; + transform[toString([227, 130, 153])] = false; + + // Some simple transforms that sort out most of the order + transform[toString([227, 130, 133])] = toString([227, 130, 134]); + transform[toString([227, 129, 163])] = toString([227, 129, 164]); + transform[toString([227, 130, 131])] = toString([227, 130, 132]); + transform[toString([227, 130, 135])] = toString([227, 130, 136]); + + // Normalize words using the transform + function normalize(word: string) { + let result = ""; + for (let i = 0; i < word.length; i++) { + let kana = word[i]; + const target = transform[kana]; + if (target === false) { + continue; + } + if (target) { + kana = target; + } + result += kana; + } + return result; + } + + // Sort how the Japanese list is sorted + function sortJapanese(a: string, b: string) { + a = normalize(a); + b = normalize(b); + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + } + + // Load all the words + for (let length = 3; length <= 9; length++) { + const d = data[length - 3]; + for (let offset = 0; offset < d.length; offset += length) { + const word = []; + for (let i = 0; i < length; i++) { + const k = mapping.indexOf(d[offset + i]); + word.push(227); + word.push(k & 0x40 ? 130 : 129); + word.push((k & 0x3f) + 128); + } + wordlist.push(toString(word)); + } + } + wordlist.sort(sortJapanese); + + // For some reason kyoku and kiyoku are flipped in node (!!). + // The order SHOULD be: + // - kyoku + // - kiyoku + + // This should ignore "if", but that doesn't work here?? + /* c8 ignore start */ + if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) { + const tmp = wordlist[442]; + wordlist[442] = wordlist[443]; + wordlist[443] = tmp; + } + /* c8 ignore stop */ + + // Verify the computed list matches the official list + /* istanbul ignore if */ + const checksum = id(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if ( + checksum !== + "0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600" + ) { + throw new Error("BIP39 Wordlist for ja (Japanese) FAILED"); + } + /* c8 ignore stop */ + + _wordlist = wordlist; + + return wordlist; } let wordlist: null | LangJa = null; @@ -153,50 +153,50 @@ let wordlist: null | LangJa = null; * @_docloc: api/wordlists */ export class LangJa extends Wordlist { - /** - * Creates a new instance of the Japanese language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langJa]] should suffice. - * - * @_ignore: - */ - constructor() { - super("ja"); - } - - getWord(index: number): string { - const words = loadWords(); - assertArgument( - index >= 0 && index < words.length, - `invalid word index: ${index}`, - "index", - index, - ); - return words[index]; - } - - getWordIndex(word: string): number { - return loadWords().indexOf(word); - } - - split(phrase: string): Array { - //logger.assertNormalize(); - return phrase.split(/(?:\u3000| )+/g); - } - - join(words: Array): string { - return words.join("\u3000"); - } - - /** - * Returns a singleton instance of a ``LangJa``, creating it - * if this is the first time being called. - */ - static wordlist(): LangJa { - if (wordlist == null) { - wordlist = new LangJa(); - } - return wordlist; - } + /** + * Creates a new instance of the Japanese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langJa]] should suffice. + * + * @_ignore: + */ + constructor() { + super("ja"); + } + + getWord(index: number): string { + const words = loadWords(); + assertArgument( + index >= 0 && index < words.length, + `invalid word index: ${index}`, + "index", + index, + ); + return words[index]; + } + + getWordIndex(word: string): number { + return loadWords().indexOf(word); + } + + split(phrase: string): Array { + //logger.assertNormalize(); + return phrase.split(/(?:\u3000| )+/g); + } + + join(words: Array): string { + return words.join("\u3000"); + } + + /** + * Returns a singleton instance of a ``LangJa``, creating it + * if this is the first time being called. + */ + static wordlist(): LangJa { + if (wordlist == null) { + wordlist = new LangJa(); + } + return wordlist; + } } diff --git a/src.ts/wordlists/lang-ko.ts b/src.ts/wordlists/lang-ko.ts index 476c8bdcc..6b8faf611 100644 --- a/src.ts/wordlists/lang-ko.ts +++ b/src.ts/wordlists/lang-ko.ts @@ -4,68 +4,68 @@ import { assertArgument, toUtf8String } from "../utils/index.js"; import { Wordlist } from "./wordlist.js"; const data = [ - "OYAa", - "ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMbAX3JTAX3QbAYLn3AZLgvAZrSUAZvAcAZ8AaAZ8AbAZ8AnAZ8HnAZ8LgAZ8MYAZ8MgAZ8OnAaAboAaDTrAaFTrAaJTrAaJboAaLVoAaMXvAaOl8AaSeoAbAUoAbAg8AbAl4AbGnrAbMT8AbMXrAbMn4AbQb8AbSV8AbvRlAb8AUAb8AnAb8HgAb8JTAb8NTAb8RbAcGboAcLnvAcMT8AcMX8AcSToAcrAaAcrFnAc8AbAc8MgAfGgrAfHboAfJnvAfLV8AfLkoAfMT8AfMnoAfQb8AfScrAfSgrAgAZ8AgFl3AgGX8AgHZvAgHgrAgJXoAgJX8AgJboAgLZoAgLn4AgOX8AgoATAgoAnAgoCUAgoJgAgoLXAgoMYAgoSeAgrDUAgrJTAhrFnAhrLjAhrQgAjAgoAjJnrAkMX8AkOnoAlCTvAlCV8AlClvAlFg4AlFl6AlFn3AloSnAlrAXAlrAfAlrFUAlrFbAlrGgAlrOXAlvKnAlvMTAl3AbAl3MnAnATrAnAcrAnCZ3AnCl8AnDg8AnFboAnFl3AnHX4AnHbrAnHgrAnIl3AnJgvAnLXoAnLX4AnLbrAnLgrAnLhrAnMXoAnMgrAnOn3AnSbrAnSeoAnvLnAn3OnCTGgvCTSlvCTvAUCTvKnCTvNTCT3CZCT3GUCT3MTCT8HnCUCZrCULf8CULnvCU3HnCU3JUCY6NUCbDb8CbFZoCb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cJYMb8DULc8LTvFgGnCk3Mg8JbAnLX4QYvFYHnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb", + "AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl", ]; const codes = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; function getHangul(code: number): string { - if (code >= 40) { - code = code + 168 - 40; - } else if (code >= 19) { - code = code + 97 - 19; - } - - return toUtf8String( - new Uint8Array([225, (code >> 6) + 132, (code & 0x3f) + 128]), - ); + if (code >= 40) { + code = code + 168 - 40; + } else if (code >= 19) { + code = code + 97 - 19; + } + + return toUtf8String( + new Uint8Array([225, (code >> 6) + 132, (code & 0x3f) + 128]), + ); } let _wordlist: null | Array = null; function loadWords(): Array { - if (_wordlist != null) { - return _wordlist; - } - - const wordlist: Array = []; - - data.forEach((data, length) => { - length += 4; - for (let i = 0; i < data.length; i += length) { - let word = ""; - for (let j = 0; j < length; j++) { - word += getHangul(codes.indexOf(data[i + j])); - } - wordlist.push(word); - } - }); - - wordlist.sort(); - - // Verify the computed list matches the official list - /* istanbul ignore if */ - const checksum = id(wordlist.join("\n") + "\n"); - /* c8 ignore start */ - if ( - checksum !== - "0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a" - ) { - throw new Error("BIP39 Wordlist for ko (Korean) FAILED"); - } - /* c8 ignore stop */ - - _wordlist = wordlist; - - return wordlist; + if (_wordlist != null) { + return _wordlist; + } + + const wordlist: Array = []; + + data.forEach((data, length) => { + length += 4; + for (let i = 0; i < data.length; i += length) { + let word = ""; + for (let j = 0; j < length; j++) { + word += getHangul(codes.indexOf(data[i + j])); + } + wordlist.push(word); + } + }); + + wordlist.sort(); + + // Verify the computed list matches the official list + /* istanbul ignore if */ + const checksum = id(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if ( + checksum !== + "0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a" + ) { + throw new Error("BIP39 Wordlist for ko (Korean) FAILED"); + } + /* c8 ignore stop */ + + _wordlist = wordlist; + + return wordlist; } let wordlist: null | LangKo = null; @@ -76,41 +76,41 @@ let wordlist: null | LangKo = null; * @_docloc: api/wordlists */ export class LangKo extends Wordlist { - /** - * Creates a new instance of the Korean language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langKo]] should suffice. - * - * @_ignore: - */ - constructor() { - super("ko"); - } - - getWord(index: number): string { - const words = loadWords(); - assertArgument( - index >= 0 && index < words.length, - `invalid word index: ${index}`, - "index", - index, - ); - return words[index]; - } - - getWordIndex(word: string): number { - return loadWords().indexOf(word); - } - - /** - * Returns a singleton instance of a ``LangKo``, creating it - * if this is the first time being called. - */ - static wordlist(): LangKo { - if (wordlist == null) { - wordlist = new LangKo(); - } - return wordlist; - } + /** + * Creates a new instance of the Korean language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langKo]] should suffice. + * + * @_ignore: + */ + constructor() { + super("ko"); + } + + getWord(index: number): string { + const words = loadWords(); + assertArgument( + index >= 0 && index < words.length, + `invalid word index: ${index}`, + "index", + index, + ); + return words[index]; + } + + getWordIndex(word: string): number { + return loadWords().indexOf(word); + } + + /** + * Returns a singleton instance of a ``LangKo``, creating it + * if this is the first time being called. + */ + static wordlist(): LangKo { + if (wordlist == null) { + wordlist = new LangKo(); + } + return wordlist; + } } diff --git a/src.ts/wordlists/lang-pt.ts b/src.ts/wordlists/lang-pt.ts index 386789a3b..c58ee8e05 100644 --- a/src.ts/wordlists/lang-pt.ts +++ b/src.ts/wordlists/lang-pt.ts @@ -1,9 +1,9 @@ import { WordlistOwl } from "./wordlist-owl.js"; const words = - "0arad!ototealirertainrasoent hoandoaR#riareha!aroele'oronul0Aca%AixoAl A%rDuz'El]Er$IsmoO$ Rum S-&T(i&TigoVo[=0F&.Il#P' S?S* So&/Sun$Tr&0Ac#Adu+Al/A[f E End(Er_EuIng'Ir?IvoOl{oRac Revi=RizU&Um0Di$rM-.R>o+TismoT|@Tu 0Ali An%Ar@Ent&Es,I?Is Ul,1Ila1Ar E=Ei%Ulejo:B BosaC&]uCh `C@GagemI+c>~/Se#S)n%Ta)Te=rTidaTomTuc Unil]3B(IjoIr^IsebolLd!eLezaLgaLisc Ndi$Ng&aNz(RimbauRl*d>_Sou_XigaZ(_3CoCu=En&Foc&Furc G|naLhe%Mest[Mo$rOlog@OmboOsf(aPol Rr-$Scoi$Sne$SpoSsex$TolaZ _2Ind#OcoOque 2A$BagemC#CejoChec]Ico.L^LetimL]LoMb{oNdeNecoNi)Rb~h>d>e&R+c]V*oXe?2AncoAsaAvezaEuIgaIl/Inc OaOchu+Onze O$Uxo2C]DismoF LeRacoScaS$Z*a:Bimb Rn{oRpe%R['>)zRv&/SacoScaSeb[S%loS~oT a)Tiv UleUs?U%l V&oV(na3BolaDil]G}]Lebr L~ Nou+N,N%ioRc Rr#R%'oRvejaTimV^2Aco)Al{aAm#Ap^ArmeAticeAveEfeEg^E'oEqueIco%If[In`oOc&/Ov(UmboU.Uva0CatrizCl}eD!eD['aEn%Gcui$Rurg@T 2A[zaE_Ic OneUbe2A=Ag'Ba@B($rBr C^El/Ent_E,Gum`oIb'IfaIo%L L{aLh(Lid'Lme@L}oLunaM<=Mb* M-.MitivaMov(MplexoMumNc]N=rNec.Nfu,Ng` Nhec(Njug Nsum'Nt+$Nvi%Op( P{oPi?PoQue%lRagemRdi&Rne)R}h>p|&R[ioR%joRuj>voSs-oS%laT}e%U_UveVilZ*]2A%+AvoEcheE=rEmeErEspoI^Im*&Io~oIseItic Os)UaUz{o2B+m SafioSbo.Sc<,S-/Sfi#Sgas%Sigu&SlizeSmam SovaSpesaS)queSvi T&h T-$rT} Tri$UsaV(Vi=Vot#Z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oRagemT~ 5Al]C]L( LiceM^Mil/N`Ntu+Pe%R>ci=RneioRqueRr!>$S.UcaUp{aX*a2Ab&/Acej Adu$rAfeg Aje$AmaAnc ApoAs{oAt?Av E*oEm(Epid EvoIagemIboIcicloId-%Ilog@Ind!eIploItur Iunf&Oc Ombe)OvaUnfoUque2B~ CquesaT` T|i&:7V 3Bigo0HaId!eIf|me3Olog@SoTigaUbu0A=InaUfru':C*aDi G o,I=,LaL-%Lid!eLo[sN)gemQu{oRe)Rr(Sc~ Sil]S,u+Z Zio3A=D Ge.Ic~ L{oLhiceLu=Nce=rNdav&N( Nt[Rb&Rd!eRe?Rg}h>m`/RnizRs R%n%SpaSti=T|i&3Adu$AgemAj Atu+Br?D{aDr @ElaGaG-%Gi G| L ejoNcoNhe)NilOle)R!>tudeSi.S$Tr&V{oZ*/5A=rArG&L<%LeibolL)gemLumo,Nt!e5L$Vuz`a::D[zRope3QueRe.Rife3Ng ::Ng#Rp 3BuL?9Mb Olog@5Mbi="; + "0arad!ototealirertainrasoent hoandoaR#riareha!aroele'oronul0Aca%AixoAl A%rDuz'El]Er$IsmoO$ Rum S-&T(i&TigoVo[=0F&.Il#P' S?S* So&/Sun$Tr&0Ac#Adu+Al/A[f E End(Er_EuIng'Ir?IvoOl{oRac Revi=RizU&Um0Di$rM-.R>o+TismoT|@Tu 0Ali An%Ar@Ent&Es,I?Is Ul,1Ila1Ar E=Ei%Ulejo:B BosaC&]uCh `C@GagemI+c>~/Se#S)n%Ta)Te=rTidaTomTuc Unil]3B(IjoIr^IsebolLd!eLezaLgaLisc Ndi$Ng&aNz(RimbauRl*d>_Sou_XigaZ(_3CoCu=En&Foc&Furc G|naLhe%Mest[Mo$rOlog@OmboOsf(aPol Rr-$Scoi$Sne$SpoSsex$TolaZ _2Ind#OcoOque 2A$BagemC#CejoChec]Ico.L^LetimL]LoMb{oNdeNecoNi)Rb~h>d>e&R+c]V*oXe?2AncoAsaAvezaEuIgaIl/Inc OaOchu+Onze O$Uxo2C]DismoF LeRacoScaS$Z*a:Bimb Rn{oRpe%R['>)zRv&/SacoScaSeb[S%loS~oT a)Tiv UleUs?U%l V&oV(na3BolaDil]G}]Lebr L~ Nou+N,N%ioRc Rr#R%'oRvejaTimV^2Aco)Al{aAm#Ap^ArmeAticeAveEfeEg^E'oEqueIco%If[In`oOc&/Ov(UmboU.Uva0CatrizCl}eD!eD['aEn%Gcui$Rurg@T 2A[zaE_Ic OneUbe2A=Ag'Ba@B($rBr C^El/Ent_E,Gum`oIb'IfaIo%L L{aLh(Lid'Lme@L}oLunaM<=Mb* M-.MitivaMov(MplexoMumNc]N=rNec.Nfu,Ng` Nhec(Njug Nsum'Nt+$Nvi%Op( P{oPi?PoQue%lRagemRdi&Rne)R}h>p|&R[ioR%joRuj>voSs-oS%laT}e%U_UveVilZ*]2A%+AvoEcheE=rEmeErEspoI^Im*&Io~oIseItic Os)UaUz{o2B+m SafioSbo.Sc<,S-/Sfi#Sgas%Sigu&SlizeSmam SovaSpesaS)queSvi T&h T-$rT} Tri$UsaV(Vi=Vot#Z-a3Ag+maAle$Da)Fu,Gi.Lat#Lu-%M*u'Nast@Nh{oOceseRe$Sc[)Sf ceSp oSque%Ssip S)n%T?UrnoV(,Vi,rV~g Z(5Br?L|i=M?M*#NativoNz`>m-%Rs&SagemUr#U$r2EnagemIbleOg @2El EndeE$PloQues><%Vi=,:1Lod'O Olog@0Ific It&Uc#1Ei$Etiv 3E.1Ab| Eg(Ei$rEncoEv?Im* Ogi 0B goBol#Br~/Buti=EndaErg'Is,rPat@P-/P*#Polg P[goPurr Ul?0CaixeC-#Ch-%C}t_Deus Doss Faix Fei%FimGaj#G-/Glob Gom#G+x Gu@Jo La.Qu<$Raiz Rol#Rug SaioSe^S*oSop#T<$Te#Tid!eT|.Tr^T~/V(g Vi#Volv(XameX($Xof[Xu$1Id(me0Uip 0E$Gui=Ra)VaVil]0Bopeu0Acu Ap| AsivoEntu&Id-%Olu'1Ag(oAl Am* A$Aus$Ces,Ci.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ife3Ng ::Ng#Rp 3BuL?9Mb Olog@5Mbi="; const checksum = - "0x2219000926df7b50d8aa0a3d495826b988287df4657fbd100e6fe596c8f737ac"; + "0x2219000926df7b50d8aa0a3d495826b988287df4657fbd100e6fe596c8f737ac"; let wordlist: null | LangPt = null; @@ -13,26 +13,26 @@ let wordlist: null | LangPt = null; * @_docloc: api/wordlists */ export class LangPt extends WordlistOwl { - /** - * Creates a new instance of the Portuguese language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langPt]] should suffice. - * - * @_ignore: - */ - constructor() { - super("pt", words, checksum); - } + /** + * Creates a new instance of the Portuguese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langPt]] should suffice. + * + * @_ignore: + */ + constructor() { + super("pt", words, checksum); + } - /** - * Returns a singleton instance of a ``LangPt``, creating it - * if this is the first time being called. - */ - static wordlist(): LangPt { - if (wordlist == null) { - wordlist = new LangPt(); - } - return wordlist; - } + /** + * Returns a singleton instance of a ``LangPt``, creating it + * if this is the first time being called. + */ + static wordlist(): LangPt { + if (wordlist == null) { + wordlist = new LangPt(); + } + return wordlist; + } } diff --git a/src.ts/wordlists/lang-zh.ts b/src.ts/wordlists/lang-zh.ts index bb2c32343..70802317f 100644 --- a/src.ts/wordlists/lang-zh.ts +++ b/src.ts/wordlists/lang-zh.ts @@ -4,62 +4,62 @@ import { assertArgument, toUtf8String } from "../utils/index.js"; import { Wordlist } from "./wordlist.js"; const data = - "}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN> = { - zh_cn: null, - zh_tw: null, + zh_cn: null, + zh_tw: null, }; const Checks: Record = { - zh_cn: "0x17bcc4d8547e5a7135e365d1ab443aaae95e76d8230c2782c67305d4f21497a1", - zh_tw: "0x51e720e90c7b87bec1d70eb6e74a21a449bd3ec9c020b01d3a40ed991b60ce5d", + zh_cn: "0x17bcc4d8547e5a7135e365d1ab443aaae95e76d8230c2782c67305d4f21497a1", + zh_tw: "0x51e720e90c7b87bec1d70eb6e74a21a449bd3ec9c020b01d3a40ed991b60ce5d", }; const codes = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; const style = "~!@#$%^&*_-=[]{}|;:,.()<>?"; function loadWords(locale: string): Array { - if (_wordlist[locale] != null) { - return _wordlist[locale] as Array; - } - - const wordlist = []; - - let deltaOffset = 0; - for (let i = 0; i < 2048; i++) { - const s = style.indexOf(data[i * 3]); - const bytes = [ - 228 + (s >> 2), - 128 + codes.indexOf(data[i * 3 + 1]), - 128 + codes.indexOf(data[i * 3 + 2]), - ]; - - if (locale === "zh_tw") { - const common = s % 4; - for (let i = common; i < 3; i++) { - bytes[i] = - codes.indexOf(deltaData[deltaOffset++]) + (i == 0 ? 228 : 128); - } - } - - wordlist.push(toUtf8String(new Uint8Array(bytes))); - } - - // Verify the computed list matches the official list - const checksum = id(wordlist.join("\n") + "\n"); - /* c8 ignore start */ - if (checksum !== Checks[locale]) { - throw new Error(`BIP39 Wordlist for ${locale} (Chinese) FAILED`); - } - /* c8 ignore stop */ - - _wordlist[locale] = wordlist; - - return wordlist; + if (_wordlist[locale] != null) { + return _wordlist[locale] as Array; + } + + const wordlist = []; + + let deltaOffset = 0; + for (let i = 0; i < 2048; i++) { + const s = style.indexOf(data[i * 3]); + const bytes = [ + 228 + (s >> 2), + 128 + codes.indexOf(data[i * 3 + 1]), + 128 + codes.indexOf(data[i * 3 + 2]), + ]; + + if (locale === "zh_tw") { + const common = s % 4; + for (let i = common; i < 3; i++) { + bytes[i] = + codes.indexOf(deltaData[deltaOffset++]) + (i == 0 ? 228 : 128); + } + } + + wordlist.push(toUtf8String(new Uint8Array(bytes))); + } + + // Verify the computed list matches the official list + const checksum = id(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== Checks[locale]) { + throw new Error(`BIP39 Wordlist for ${locale} (Chinese) FAILED`); + } + /* c8 ignore stop */ + + _wordlist[locale] = wordlist; + + return wordlist; } const wordlists: Record = {}; @@ -71,51 +71,51 @@ const wordlists: Record = {}; * @_docloc: api/wordlists */ export class LangZh extends Wordlist { - /** - * Creates a new instance of the Chinese language Wordlist for - * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified - * or traditional, respectively. - * - * This should be unnecessary most of the time as the exported - * [[langZhCn]] and [[langZhTw]] should suffice. - * - * @_ignore: - */ - constructor(dialect: string) { - super("zh_" + dialect); - } - - getWord(index: number): string { - const words = loadWords(this.locale); - assertArgument( - index >= 0 && index < words.length, - `invalid word index: ${index}`, - "index", - index, - ); - return words[index]; - } - - getWordIndex(word: string): number { - return loadWords(this.locale).indexOf(word); - } - - split(phrase: string): Array { - phrase = phrase.replace(/(?:\u3000| )+/g, ""); - return phrase.split(""); - } - - /** - * Returns a singleton instance of a ``LangZh`` for %%dialect%%, - * creating it if this is the first time being called. - * - * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or - * traditional, respectively. - */ - static wordlist(dialect: string): LangZh { - if (wordlists[dialect] == null) { - wordlists[dialect] = new LangZh(dialect); - } - return wordlists[dialect]; - } + /** + * Creates a new instance of the Chinese language Wordlist for + * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified + * or traditional, respectively. + * + * This should be unnecessary most of the time as the exported + * [[langZhCn]] and [[langZhTw]] should suffice. + * + * @_ignore: + */ + constructor(dialect: string) { + super("zh_" + dialect); + } + + getWord(index: number): string { + const words = loadWords(this.locale); + assertArgument( + index >= 0 && index < words.length, + `invalid word index: ${index}`, + "index", + index, + ); + return words[index]; + } + + getWordIndex(word: string): number { + return loadWords(this.locale).indexOf(word); + } + + split(phrase: string): Array { + phrase = phrase.replace(/(?:\u3000| )+/g, ""); + return phrase.split(""); + } + + /** + * Returns a singleton instance of a ``LangZh`` for %%dialect%%, + * creating it if this is the first time being called. + * + * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or + * traditional, respectively. + */ + static wordlist(dialect: string): LangZh { + if (wordlists[dialect] == null) { + wordlists[dialect] = new LangZh(dialect); + } + return wordlists[dialect]; + } } diff --git a/src.ts/wordlists/wordlist-owl.ts b/src.ts/wordlists/wordlist-owl.ts index 3336472a9..72de7103d 100644 --- a/src.ts/wordlists/wordlist-owl.ts +++ b/src.ts/wordlists/wordlist-owl.ts @@ -20,58 +20,58 @@ import { Wordlist } from "./wordlist.js"; * to create these necessary data. */ export class WordlistOwl extends Wordlist { - #data: string; - #checksum: string; + #data: string; + #checksum: string; - /** - * Creates a new Wordlist for %%locale%% using the OWL %%data%% - * and validated against the %%checksum%%. - */ - constructor(locale: string, data: string, checksum: string) { - super(locale); - this.#data = data; - this.#checksum = checksum; - this.#words = null; - } + /** + * Creates a new Wordlist for %%locale%% using the OWL %%data%% + * and validated against the %%checksum%%. + */ + constructor(locale: string, data: string, checksum: string) { + super(locale); + this.#data = data; + this.#checksum = checksum; + this.#words = null; + } - get _data(): string { - return this.#data; - } + get _data(): string { + return this.#data; + } - _decodeWords(): Array { - return decodeOwl(this.#data); - } + _decodeWords(): Array { + return decodeOwl(this.#data); + } - #words: null | Array; - #loadWords(): Array { - if (this.#words == null) { - const words = this._decodeWords(); + #words: null | Array; + #loadWords(): Array { + if (this.#words == null) { + const words = this._decodeWords(); - // Verify the computed list matches the official list - const checksum = id(words.join("\n") + "\n", true); - /* c8 ignore start */ - if (checksum !== this.#checksum) { - throw new Error(`BIP39 Wordlist for ${this.locale} FffffAILED`); - } - /* c8 ignore stop */ + // Verify the computed list matches the official list + const checksum = id(words.join("\n") + "\n", true); + /* c8 ignore start */ + if (checksum !== this.#checksum) { + throw new Error(`BIP39 Wordlist for ${this.locale} FffffAILED`); + } + /* c8 ignore stop */ - this.#words = words; - } - return this.#words; - } + this.#words = words; + } + return this.#words; + } - getWord(index: number): string { - const words = this.#loadWords(); - assertArgument( - index >= 0 && index < words.length, - `invalid word index: ${index}`, - "index", - index, - ); - return words[index]; - } + getWord(index: number): string { + const words = this.#loadWords(); + assertArgument( + index >= 0 && index < words.length, + `invalid word index: ${index}`, + "index", + index, + ); + return words[index]; + } - getWordIndex(word: string): number { - return this.#loadWords().indexOf(word); - } + getWordIndex(word: string): number { + return this.#loadWords().indexOf(word); + } } diff --git a/src.ts/wordlists/wordlist-owla.ts b/src.ts/wordlists/wordlist-owla.ts index b1ff8ee67..44b939a93 100644 --- a/src.ts/wordlists/wordlist-owla.ts +++ b/src.ts/wordlists/wordlist-owla.ts @@ -14,18 +14,18 @@ import { decodeOwlA } from "./decode-owla.js"; * to create these necessary data. */ export class WordlistOwlA extends WordlistOwl { - #accent: string; + #accent: string; - constructor(locale: string, data: string, accent: string, checksum: string) { - super(locale, data, checksum); - this.#accent = accent; - } + constructor(locale: string, data: string, accent: string, checksum: string) { + super(locale, data, checksum); + this.#accent = accent; + } - get _accent(): string { - return this.#accent; - } + get _accent(): string { + return this.#accent; + } - _decodeWords(): Array { - return decodeOwlA(this._data, this._accent); - } + _decodeWords(): Array { + return decodeOwlA(this._data, this._accent); + } } diff --git a/src.ts/wordlists/wordlist.ts b/src.ts/wordlists/wordlist.ts index f1e8276db..c5da15702 100644 --- a/src.ts/wordlists/wordlist.ts +++ b/src.ts/wordlists/wordlist.ts @@ -7,66 +7,66 @@ import { defineProperties } from "../utils/index.js"; * by mapping words to 11-bit values and vice versa. */ export abstract class Wordlist { - locale!: string; + locale!: string; - /** - * Creates a new Wordlist instance. - * - * Sub-classes MUST call this if they provide their own constructor, - * passing in the locale string of the language. - * - * Generally there is no need to create instances of a Wordlist, - * since each language-specific Wordlist creates an instance and - * there is no state kept internally, so they are safe to share. - */ - constructor(locale: string) { - defineProperties(this, { locale }); - } + /** + * Creates a new Wordlist instance. + * + * Sub-classes MUST call this if they provide their own constructor, + * passing in the locale string of the language. + * + * Generally there is no need to create instances of a Wordlist, + * since each language-specific Wordlist creates an instance and + * there is no state kept internally, so they are safe to share. + */ + constructor(locale: string) { + defineProperties(this, { locale }); + } - /** - * Sub-classes may override this to provide a language-specific - * method for spliting %%phrase%% into individual words. - * - * By default, %%phrase%% is split using any sequences of - * white-space as defined by regular expressions (i.e. ``/\s+/``). - */ - split(phrase: string): Array { - return phrase.toLowerCase().split(/\s+/g); - } + /** + * Sub-classes may override this to provide a language-specific + * method for spliting %%phrase%% into individual words. + * + * By default, %%phrase%% is split using any sequences of + * white-space as defined by regular expressions (i.e. ``/\s+/``). + */ + split(phrase: string): Array { + return phrase.toLowerCase().split(/\s+/g); + } - /** - * Sub-classes may override this to provider a language-specific - * method for joining %%words%% into a phrase. - * - * By default, %%words%% are joined by a single space. - */ - join(words: Array): string { - return words.join(" "); - } + /** + * Sub-classes may override this to provider a language-specific + * method for joining %%words%% into a phrase. + * + * By default, %%words%% are joined by a single space. + */ + join(words: Array): string { + return words.join(" "); + } - /** - * Maps an 11-bit value into its coresponding word in the list. - * - * Sub-classes MUST override this. - */ - abstract getWord(index: number): string; + /** + * Maps an 11-bit value into its coresponding word in the list. + * + * Sub-classes MUST override this. + */ + abstract getWord(index: number): string; - /** - * Maps a word to its corresponding 11-bit value. - * - * Sub-classes MUST override this. - */ - abstract getWordIndex(word: string): number; - static check(wordlist: Wordlist): string { - const words: string[] = []; - for (let i = 0; i < 2048; i++) { - const word = wordlist.getWord(i); - /* istanbul ignore if */ - if (i !== wordlist.getWordIndex(word)) { - return "0x"; - } - words.push(word); - } - return id(words.join("\n") + "\n"); - } + /** + * Maps a word to its corresponding 11-bit value. + * + * Sub-classes MUST override this. + */ + abstract getWordIndex(word: string): number; + static check(wordlist: Wordlist): string { + const words: string[] = []; + for (let i = 0; i < 2048; i++) { + const word = wordlist.getWord(i); + /* istanbul ignore if */ + if (i !== wordlist.getWordIndex(word)) { + return "0x"; + } + words.push(word); + } + return id(words.join("\n") + "\n"); + } } diff --git a/src.ts/wordlists/wordlists-browser.ts b/src.ts/wordlists/wordlists-browser.ts index 3b01ba2fa..f5b3d357f 100644 --- a/src.ts/wordlists/wordlists-browser.ts +++ b/src.ts/wordlists/wordlists-browser.ts @@ -3,5 +3,5 @@ import { LangEn } from "./lang-en.js"; import type { Wordlist } from "./wordlist.js"; export const wordlists: Record = { - en: LangEn.wordlist(), + en: LangEn.wordlist(), }; diff --git a/src.ts/wordlists/wordlists.ts b/src.ts/wordlists/wordlists.ts index 1f275b99d..e8ff3e95d 100644 --- a/src.ts/wordlists/wordlists.ts +++ b/src.ts/wordlists/wordlists.ts @@ -24,14 +24,14 @@ import type { Wordlist } from "./wordlist.js"; * included ``wordlists-extra.min.js`` file. */ export const wordlists: Record = { - cz: LangCz.wordlist(), - en: LangEn.wordlist(), - es: LangEs.wordlist(), - fr: LangFr.wordlist(), - it: LangIt.wordlist(), - pt: LangPt.wordlist(), - ja: LangJa.wordlist(), - ko: LangKo.wordlist(), - zh_cn: LangZh.wordlist("cn"), - zh_tw: LangZh.wordlist("tw"), + cz: LangCz.wordlist(), + en: LangEn.wordlist(), + es: LangEs.wordlist(), + fr: LangFr.wordlist(), + it: LangIt.wordlist(), + pt: LangPt.wordlist(), + ja: LangJa.wordlist(), + ko: LangKo.wordlist(), + zh_cn: LangZh.wordlist("cn"), + zh_tw: LangZh.wordlist("tw"), }; diff --git a/tsconfig.base.json b/tsconfig.base.json index 72f5bb0dd..b9badd1af 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1,31 +1,27 @@ { - "compilerOptions": { - "declaration": true, - "declarationMap": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "importHelpers": true, - "lib": [ - "es2020", - "es5" - ], - "moduleResolution": "node", - "noEmitOnError": true, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "preserveSymlinks": true, - "preserveWatchOutput": true, - "pretty": false, - "rootDir": "./src.ts", - "strict": true, - "sourceMap": true, - "target": "es2022" - }, - "exclude": [ ], - "include": [ - "./src.ts/**/*.ts" - ], + "compilerOptions": { + "declaration": true, + "types": ["node", "mocha"], + "declarationMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "importHelpers": true, + "lib": ["es2022", "es5"], + "moduleResolution": "bundler", + "noEmitOnError": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "preserveSymlinks": true, + "preserveWatchOutput": true, + "pretty": false, + "rootDir": "./src.ts", + "strict": true, + "sourceMap": true, + "target": "es2022" + }, + "exclude": [], + "include": ["./src.ts/**/*.ts"] } diff --git a/tsconfig.commonjs.json b/tsconfig.commonjs.json index b73f1dd6a..dbf4e6cd7 100644 --- a/tsconfig.commonjs.json +++ b/tsconfig.commonjs.json @@ -1,10 +1,5 @@ { - "exclude": [ - "src.ts/_admin/**" - ], - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "commonjs", - "outDir": "./lib.commonjs" - } + "extends": "./tsconfig.esm.json", + "exclude": ["src.ts/_admin/**"], + "compilerOptions": { "noEmit": true } } diff --git a/tsconfig.esm.json b/tsconfig.esm.json index aa45c3b52..93846693a 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -1,7 +1,7 @@ { - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "es2020", - "outDir": "./lib.esm" - } + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "es2020", + "outDir": "./lib.esm" + } } diff --git a/tsconfig.types.json b/tsconfig.types.json index 018c522c0..e91298ecf 100644 --- a/tsconfig.types.json +++ b/tsconfig.types.json @@ -1,14 +1,11 @@ { - "exclude": [ - "src.ts/_admin/**", - "src.ts/_tests/**" - ], - "extends": "./tsconfig.base.json", - "compilerOptions": { - "declaration": true, - "declarationMap": true, - "declarationDir": "./types", - "emitDeclarationOnly": true, - "moduleResolution": "node" - } + "exclude": ["src.ts/_admin/**", "src.ts/_tests/**"], + "extends": "./tsconfig.base.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "declarationDir": "./types", + "emitDeclarationOnly": true, + "module": "es2022" + } } diff --git a/types/_version.d.ts b/types/_version.d.ts deleted file mode 100644 index ab655b4ad..000000000 --- a/types/_version.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * The current version of corebc. - */ -export declare const version: string; -//# sourceMappingURL=_version.d.ts.map \ No newline at end of file diff --git a/types/_version.d.ts.map b/types/_version.d.ts.map deleted file mode 100644 index 502b731b4..000000000 --- a/types/_version.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"_version.d.ts","sourceRoot":"","sources":["../src.ts/_version.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MAAgB,CAAC"} \ No newline at end of file diff --git a/types/abi-types/Tes.d.ts b/types/abi-types/Tes.d.ts deleted file mode 100644 index ab20b2246..000000000 --- a/types/abi-types/Tes.d.ts +++ /dev/null @@ -1,223 +0,0 @@ -import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "../corebc.js"; -import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common.js"; -export interface TesInterface extends Interface { - getFunction(nameOrSignature: "approve" | "balanceOf" | "batchOwnerOf" | "getApproved" | "isApprovedForAll" | "mint" | "ownerOf" | "safeTransferFrom(address,address,uint256)" | "safeTransferFrom(address,address,uint256,bytes)" | "setApprovalForAll" | "tokenByIndex" | "tokenOfOwnerByIndex" | "totalSupply" | "transferFrom"): FunctionFragment; - getEvent(nameOrSignatureOrTopic: "Approval" | "ApprovalForAll" | "Transfer"): EventFragment; - encodeFunctionData(functionFragment: "approve", values: [AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "balanceOf", values: [AddressLike]): string; - encodeFunctionData(functionFragment: "batchOwnerOf", values: [BigNumberish[]]): string; - encodeFunctionData(functionFragment: "getApproved", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "isApprovedForAll", values: [AddressLike, AddressLike]): string; - encodeFunctionData(functionFragment: "mint", values: [AddressLike]): string; - encodeFunctionData(functionFragment: "ownerOf", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "safeTransferFrom(address,address,uint256)", values: [AddressLike, AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "safeTransferFrom(address,address,uint256,bytes)", values: [AddressLike, AddressLike, BigNumberish, BytesLike]): string; - encodeFunctionData(functionFragment: "setApprovalForAll", values: [AddressLike, boolean]): string; - encodeFunctionData(functionFragment: "tokenByIndex", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "tokenOfOwnerByIndex", values: [AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "totalSupply", values?: undefined): string; - encodeFunctionData(functionFragment: "transferFrom", values: [AddressLike, AddressLike, BigNumberish]): string; - decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "batchOwnerOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "getApproved", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "isApprovedForAll", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "ownerOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "safeTransferFrom(address,address,uint256)", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "safeTransferFrom(address,address,uint256,bytes)", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "setApprovalForAll", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "tokenByIndex", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "tokenOfOwnerByIndex", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "totalSupply", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "transferFrom", data: BytesLike): Result; -} -export declare namespace ApprovalEvent { - type InputTuple = [ - owner: AddressLike, - approved: AddressLike, - tokenId: BigNumberish - ]; - type OutputTuple = [owner: string, approved: string, tokenId: bigint]; - interface OutputObject { - owner: string; - approved: string; - tokenId: bigint; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export declare namespace ApprovalForAllEvent { - type InputTuple = [ - owner: AddressLike, - operator: AddressLike, - approved: boolean - ]; - type OutputTuple = [ - owner: string, - operator: string, - approved: boolean - ]; - interface OutputObject { - owner: string; - operator: string; - approved: boolean; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export declare namespace TransferEvent { - type InputTuple = [ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ]; - type OutputTuple = [from: string, to: string, tokenId: bigint]; - interface OutputObject { - from: string; - to: string; - tokenId: bigint; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export interface Tes extends BaseContract { - connect(runner?: ContractRunner | null): BaseContract; - attach(addressOrName: AddressLike): this; - deployed(): Promise; - interface: TesInterface; - queryFilter(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; - queryFilter(filter: TypedDeferredTopicFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; - on(event: TCEvent, listener: TypedListener): Promise; - on(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; - once(event: TCEvent, listener: TypedListener): Promise; - once(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - approve: TypedContractMethod<[ - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - balanceOf: TypedContractMethod<[owner: AddressLike], [bigint], "view">; - batchOwnerOf: TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - getApproved: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - isApprovedForAll: TypedContractMethod<[ - owner: AddressLike, - operator: AddressLike - ], [ - boolean - ], "view">; - mint: TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - ownerOf: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - "safeTransferFrom(address,address,uint256)": TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - "safeTransferFrom(address,address,uint256,bytes)": TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike - ], [ - void - ], "nonpayable">; - setApprovalForAll: TypedContractMethod<[ - operator: AddressLike, - approved: boolean - ], [ - void - ], "nonpayable">; - tokenByIndex: TypedContractMethod<[index: BigNumberish], [bigint], "view">; - tokenOfOwnerByIndex: TypedContractMethod<[ - owner: AddressLike, - index: BigNumberish - ], [ - bigint - ], "view">; - totalSupply: TypedContractMethod<[], [bigint], "view">; - transferFrom: TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(key: string | FunctionFragment): T; - getFunction(nameOrSignature: "approve"): TypedContractMethod<[ - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "balanceOf"): TypedContractMethod<[owner: AddressLike], [bigint], "view">; - getFunction(nameOrSignature: "batchOwnerOf"): TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - getFunction(nameOrSignature: "getApproved"): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction(nameOrSignature: "isApprovedForAll"): TypedContractMethod<[ - owner: AddressLike, - operator: AddressLike - ], [ - boolean - ], "view">; - getFunction(nameOrSignature: "mint"): TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - getFunction(nameOrSignature: "ownerOf"): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction(nameOrSignature: "safeTransferFrom(address,address,uint256)"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "safeTransferFrom(address,address,uint256,bytes)"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "setApprovalForAll"): TypedContractMethod<[ - operator: AddressLike, - approved: boolean - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "tokenByIndex"): TypedContractMethod<[index: BigNumberish], [bigint], "view">; - getFunction(nameOrSignature: "tokenOfOwnerByIndex"): TypedContractMethod<[ - owner: AddressLike, - index: BigNumberish - ], [ - bigint - ], "view">; - getFunction(nameOrSignature: "totalSupply"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "transferFrom"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getEvent(key: "Approval"): TypedContractEvent; - getEvent(key: "ApprovalForAll"): TypedContractEvent; - getEvent(key: "Transfer"): TypedContractEvent; - filters: { - "Approval(address,address,uint256)": TypedContractEvent; - Approval: TypedContractEvent; - "ApprovalForAll(address,address,bool)": TypedContractEvent; - ApprovalForAll: TypedContractEvent; - "Transfer(address,address,uint256)": TypedContractEvent; - Transfer: TypedContractEvent; - }; -} -//# sourceMappingURL=Tes.d.ts.map \ No newline at end of file diff --git a/types/abi-types/Tes.d.ts.map b/types/abi-types/Tes.d.ts.map deleted file mode 100644 index 04a5ce028..000000000 --- a/types/abi-types/Tes.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes.d.ts","sourceRoot":"","sources":["../../src.ts/abi-types/Tes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,g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QAAQ,CACN,GAAG,EAAE,UAAU,GACd,kBAAkB,CACnB,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,WAAW,EACzB,aAAa,CAAC,YAAY,CAC3B,CAAC;IAEF,OAAO,EAAE;QACP,mCAAmC,EAAE,kBAAkB,CACrD,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,WAAW,EACzB,aAAa,CAAC,YAAY,CAC3B,CAAC;QACF,QAAQ,EAAE,kBAAkB,CAC1B,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,WAAW,EACzB,aAAa,CAAC,YAAY,CAC3B,CAAC;QAEF,sCAAsC,EAAE,kBAAkB,CACxD,mBAAmB,CAAC,UAAU,EAC9B,mBAAmB,CAAC,WAAW,EAC/B,mBAAmB,CAAC,YAAY,CACjC,CAAC;QACF,cAAc,EAAE,kBAAkB,CAChC,mBAAmB,CAAC,UAAU,EAC9B,mBAAmB,CAAC,WAAW,EAC/B,mBAAmB,CAAC,YAAY,CACjC,CAAC;QAEF,mCAAmC,EAAE,kBAAkB,CACrD,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,WAAW,EACzB,aAAa,CAAC,YAAY,CAC3B,CAAC;QACF,QAAQ,EAAE,kBAAkB,CAC1B,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,WAAW,EACzB,aAAa,CAAC,YAAY,CAC3B,CAAC;KACH,CAAC;CACH"} \ No newline at end of file diff --git a/types/abi-types/Tes_abi.d.ts b/types/abi-types/Tes_abi.d.ts deleted file mode 100644 index 3df4e144e..000000000 --- a/types/abi-types/Tes_abi.d.ts +++ /dev/null @@ -1,223 +0,0 @@ -import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "../corebc.js"; -import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common.js"; -export interface Tes_abiInterface extends Interface { - getFunction(nameOrSignature: "approve" | "balanceOf" | "batchOwnerOf" | "getApproved" | "isApprovedForAll" | "mint" | "ownerOf" | "safeTransferFrom(address,address,uint256)" | "safeTransferFrom(address,address,uint256,bytes)" | "setApprovalForAll" | "tokenByIndex" | "tokenOfOwnerByIndex" | "totalSupply" | "transferFrom"): FunctionFragment; - getEvent(nameOrSignatureOrTopic: "Approval" | "ApprovalForAll" | "Transfer"): EventFragment; - encodeFunctionData(functionFragment: "approve", values: [AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "balanceOf", values: [AddressLike]): string; - encodeFunctionData(functionFragment: "batchOwnerOf", values: [BigNumberish[]]): string; - encodeFunctionData(functionFragment: "getApproved", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "isApprovedForAll", values: [AddressLike, AddressLike]): string; - encodeFunctionData(functionFragment: "mint", values: [AddressLike]): string; - encodeFunctionData(functionFragment: "ownerOf", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "safeTransferFrom(address,address,uint256)", values: [AddressLike, AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "safeTransferFrom(address,address,uint256,bytes)", values: [AddressLike, AddressLike, BigNumberish, BytesLike]): string; - encodeFunctionData(functionFragment: "setApprovalForAll", values: [AddressLike, boolean]): string; - encodeFunctionData(functionFragment: "tokenByIndex", values: [BigNumberish]): string; - encodeFunctionData(functionFragment: "tokenOfOwnerByIndex", values: [AddressLike, BigNumberish]): string; - encodeFunctionData(functionFragment: "totalSupply", values?: undefined): string; - encodeFunctionData(functionFragment: "transferFrom", values: [AddressLike, AddressLike, BigNumberish]): string; - decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "batchOwnerOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "getApproved", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "isApprovedForAll", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "ownerOf", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "safeTransferFrom(address,address,uint256)", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "safeTransferFrom(address,address,uint256,bytes)", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "setApprovalForAll", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "tokenByIndex", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "tokenOfOwnerByIndex", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "totalSupply", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "transferFrom", data: BytesLike): Result; -} -export declare namespace ApprovalEvent { - type InputTuple = [ - owner: AddressLike, - approved: AddressLike, - tokenId: BigNumberish - ]; - type OutputTuple = [owner: string, approved: string, tokenId: bigint]; - interface OutputObject { - owner: string; - approved: string; - tokenId: bigint; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export declare namespace ApprovalForAllEvent { - type InputTuple = [ - owner: AddressLike, - operator: AddressLike, - approved: boolean - ]; - type OutputTuple = [ - owner: string, - operator: string, - approved: boolean - ]; - interface OutputObject { - owner: string; - operator: string; - approved: boolean; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export declare namespace TransferEvent { - type InputTuple = [ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ]; - type OutputTuple = [from: string, to: string, tokenId: bigint]; - interface OutputObject { - from: string; - to: string; - tokenId: bigint; - } - type Event = TypedContractEvent; - type Filter = TypedDeferredTopicFilter; - type Log = TypedEventLog; - type LogDescription = TypedLogDescription; -} -export interface Tes_abi extends BaseContract { - connect(runner?: ContractRunner | null): BaseContract; - attach(addressOrName: AddressLike): this; - deployed(): Promise; - interface: Tes_abiInterface; - queryFilter(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; - queryFilter(filter: TypedDeferredTopicFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; - on(event: TCEvent, listener: TypedListener): Promise; - on(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; - once(event: TCEvent, listener: TypedListener): Promise; - once(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - approve: TypedContractMethod<[ - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - balanceOf: TypedContractMethod<[owner: AddressLike], [bigint], "view">; - batchOwnerOf: TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - getApproved: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - isApprovedForAll: TypedContractMethod<[ - owner: AddressLike, - operator: AddressLike - ], [ - boolean - ], "view">; - mint: TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - ownerOf: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - "safeTransferFrom(address,address,uint256)": TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - "safeTransferFrom(address,address,uint256,bytes)": TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike - ], [ - void - ], "nonpayable">; - setApprovalForAll: TypedContractMethod<[ - operator: AddressLike, - approved: boolean - ], [ - void - ], "nonpayable">; - tokenByIndex: TypedContractMethod<[index: BigNumberish], [bigint], "view">; - tokenOfOwnerByIndex: TypedContractMethod<[ - owner: AddressLike, - index: BigNumberish - ], [ - bigint - ], "view">; - totalSupply: TypedContractMethod<[], [bigint], "view">; - transferFrom: TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(key: string | FunctionFragment): T; - getFunction(nameOrSignature: "approve"): TypedContractMethod<[ - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "balanceOf"): TypedContractMethod<[owner: AddressLike], [bigint], "view">; - getFunction(nameOrSignature: "batchOwnerOf"): TypedContractMethod<[ids: BigNumberish[]], [string[]], "view">; - getFunction(nameOrSignature: "getApproved"): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction(nameOrSignature: "isApprovedForAll"): TypedContractMethod<[ - owner: AddressLike, - operator: AddressLike - ], [ - boolean - ], "view">; - getFunction(nameOrSignature: "mint"): TypedContractMethod<[to: AddressLike], [void], "nonpayable">; - getFunction(nameOrSignature: "ownerOf"): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; - getFunction(nameOrSignature: "safeTransferFrom(address,address,uint256)"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "safeTransferFrom(address,address,uint256,bytes)"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish, - data: BytesLike - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "setApprovalForAll"): TypedContractMethod<[ - operator: AddressLike, - approved: boolean - ], [ - void - ], "nonpayable">; - getFunction(nameOrSignature: "tokenByIndex"): TypedContractMethod<[index: BigNumberish], [bigint], "view">; - getFunction(nameOrSignature: "tokenOfOwnerByIndex"): TypedContractMethod<[ - owner: AddressLike, - index: BigNumberish - ], [ - bigint - ], "view">; - getFunction(nameOrSignature: "totalSupply"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "transferFrom"): TypedContractMethod<[ - from: AddressLike, - to: AddressLike, - tokenId: BigNumberish - ], [ - void - ], "nonpayable">; - getEvent(key: "Approval"): TypedContractEvent; - getEvent(key: "ApprovalForAll"): TypedContractEvent; - getEvent(key: "Transfer"): TypedContractEvent; - filters: { - "Approval(address,address,uint256)": TypedContractEvent; - Approval: TypedContractEvent; - "ApprovalForAll(address,address,bool)": TypedContractEvent; - ApprovalForAll: TypedContractEvent; - "Transfer(address,address,uint256)": TypedContractEvent; - Transfer: TypedContractEvent; - }; -} -//# sourceMappingURL=Tes_abi.d.ts.map \ No newline at end of file diff --git a/types/abi-types/Tes_abi.d.ts.map b/types/abi-types/Tes_abi.d.ts.map deleted file mode 100644 index 4d5fd9d95..000000000 --- a/types/abi-types/Tes_abi.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes_abi.d.ts","sourceRoot":"","sources":["../../src.ts/abi-types/Tes_abi.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACd,QAAQ,EACT,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,WAAW,CACT,eAAe,EACX,SAAS,GACT,WAAW,GACX,cAAc,GACd,aAAa,GACb,kBAAkB,GAClB,MAAM,GACN,SAAS,GACT,2CAA2C,GAC3C,iDAAiD,GACjD,mBAAmB,GACnB,cAAc,GACd,qBAAqB,GACrB,aAAa,GACb,cAAc,GACjB,gBAAgB,CAAC;IAEpB,QAAQ,CACN,sBAAsB,EAAE,UAAU,GAAG,gBAAgB,GAAG,UAAU,GACjE,aAAa,CAAC;IAEjB,kBAAkB,CAChB,gBAAgB,EAAE,SAAS,EAC3B,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,GAClC,MAAM,CAAC;IACV,kBAAkB,CAChB,gBAAgB,EAAE,WAAW,EAC7B,MAAM,EAAE,CAAC,WAAW,CAAC,GACpB,MAAM,CAAC;IACV,kBAAkB,CAChB,gBAAgB,EAAE,cAAc,EAChC,MAAM,EAAE,CAAC,YAAY,EAAE,CAAC,GACvB,MAA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H"} \ No newline at end of file diff --git a/types/abi-types/common.d.ts b/types/abi-types/common.d.ts deleted file mode 100644 index d6e86d0d7..000000000 --- a/types/abi-types/common.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import type { FunctionFragment, Typed, EventFragment, ContractTransaction, ContractTransactionResponse, DeferredTopicFilter, EventLog, TransactionRequest, LogDescription } from "../corebc.js"; -export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> extends DeferredTopicFilter { -} -export interface TypedContractEvent = any, OutputTuple extends Array = any, OutputObject = any> { - (...args: Partial): TypedDeferredTopicFilter>; - name: string; - fragment: EventFragment; - getFragment(...args: Partial): EventFragment; -} -type __TypechainAOutputTuple = T extends TypedContractEvent ? W : never; -type __TypechainOutputObject = T extends TypedContractEvent ? V : never; -export interface TypedEventLog extends Omit { - args: __TypechainAOutputTuple & __TypechainOutputObject; -} -export interface TypedLogDescription extends Omit { - args: __TypechainAOutputTuple & __TypechainOutputObject; -} -export type TypedListener = (...listenerArg: [ - ...__TypechainAOutputTuple, - TypedEventLog, - ...undefined[] -]) => void; -export type MinCoreBCFactory = { - deploy(...a: ARGS[]): Promise; -}; -export type GetContractTypeFromFactory = F extends MinCoreBCFactory ? C : never; -export type GetARGsTypeFromFactory = F extends MinCoreBCFactory ? Parameters : never; -export type StateMutability = "nonpayable" | "payable" | "view"; -export type BaseOverrides = Omit; -export type NonPayableOverrides = Omit; -export type PayableOverrides = Omit; -export type ViewOverrides = Omit; -export type Overrides = S extends "nonpayable" ? NonPayableOverrides : S extends "payable" ? PayableOverrides : ViewOverrides; -export type PostfixOverrides, S extends StateMutability> = A | [...A, Overrides]; -export type ContractMethodArgs, S extends StateMutability> = PostfixOverrides<{ - [I in keyof A]-?: A[I] | Typed; -}, S>; -export type DefaultReturnType = R extends Array ? R[0] : R; -export interface TypedContractMethod = Array, R = any, S extends StateMutability = "payable"> { - (...args: ContractMethodArgs): S extends "view" ? Promise> : Promise; - name: string; - fragment: FunctionFragment; - getFragment(...args: ContractMethodArgs): FunctionFragment; - populateTransaction(...args: ContractMethodArgs): Promise; - staticCall(...args: ContractMethodArgs): Promise>; - send(...args: ContractMethodArgs): Promise; - estimateGas(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; -} -export {}; -//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/types/abi-types/common.d.ts.map b/types/abi-types/common.d.ts.map deleted file mode 100644 index 1d45da294..000000000 --- a/types/abi-types/common.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src.ts/abi-types/common.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,gBAAgB,EAChB,KAAK,EACL,aAAa,EACb,mBAAmB,EACnB,2BAA2B,EAC3B,mBAAmB,EACnB,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACf,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,wBAAwB,CAAC,QAAQ,SAAS,kBAAkB,CAC3E,SAAQ,mBAAmB;CAAG;AAEhC,MAAM,WAAW,kBAAkB,CACjC,UAAU,SAAS,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,EACnC,WAAW,SAAS,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,EACpC,YAAY,GAAG,GAAG;IAElB,CACE,GAAG,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,GAC3B,wBAAwB,CACzB,kBAAkB,CAAC,UAAU,EAAE,WAAW,EAAE,YAAY,CAAC,CAC1D,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,aAAa,CAAC;IACxB,WAAW,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC;CAC1D;AAED,KAAK,uBAAuB,CAAC,CAAC,IAAI,CAAC,SAAS,kBAAkB,CAC5D,MAAM,EAAE,EACR,MAAM,CAAC,CACR,GACG,CAAC,GACD,KAAK,CAAC;AACV,KAAK,uBAAuB,CA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C,GAChC,CAAC,SAAS,MAAM,GACf,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAC7B,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAEzC,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,EAAE,gBAAgB,CAAC;IAE3B,WAAW,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC;IAEjE,mBAAmB,CACjB,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAChC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChC,UAAU,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,IAAI,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC9E,WAAW,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChE,gBAAgB,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACjE"} \ No newline at end of file diff --git a/types/abi-types/factories/Tes__factory.d.ts b/types/abi-types/factories/Tes__factory.d.ts deleted file mode 100644 index 9fb691f6d..000000000 --- a/types/abi-types/factories/Tes__factory.d.ts +++ /dev/null @@ -1,280 +0,0 @@ -import { ContractRunner } from "../../corebc.js"; -import type { Tes, TesInterface } from "../Tes.js"; -export declare class Tes__factory { - static readonly abi: readonly [{ - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "approved"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "Approval"; - readonly type: "event"; - }, { - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }, { - readonly indexed: false; - readonly internalType: "bool"; - readonly name: "approved"; - readonly type: "bool"; - }]; - readonly name: "ApprovalForAll"; - readonly type: "event"; - }, { - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "Transfer"; - readonly type: "event"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "approve"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }]; - readonly name: "balanceOf"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256[]"; - readonly name: "ids"; - readonly type: "uint256[]"; - }]; - readonly name: "batchOwnerOf"; - readonly outputs: readonly [{ - readonly internalType: "address[]"; - readonly name: ""; - readonly type: "address[]"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "getApproved"; - readonly outputs: readonly [{ - readonly internalType: "address"; - readonly name: ""; - readonly type: "address"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }]; - readonly name: "isApprovedForAll"; - readonly outputs: readonly [{ - readonly internalType: "bool"; - readonly name: ""; - readonly type: "bool"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }]; - readonly name: "mint"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "ownerOf"; - readonly outputs: readonly [{ - readonly internalType: "address"; - readonly name: ""; - readonly type: "address"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "safeTransferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }, { - readonly internalType: "bytes"; - readonly name: "data"; - readonly type: "bytes"; - }]; - readonly name: "safeTransferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }, { - readonly internalType: "bool"; - readonly name: "approved"; - readonly type: "bool"; - }]; - readonly name: "setApprovalForAll"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "index"; - readonly type: "uint256"; - }]; - readonly name: "tokenByIndex"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "index"; - readonly type: "uint256"; - }]; - readonly name: "tokenOfOwnerByIndex"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly []; - readonly name: "totalSupply"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "transferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }]; - static createInterface(): TesInterface; - static connect(address: string, runner?: ContractRunner | null): Tes; -} -//# sourceMappingURL=Tes__factory.d.ts.map \ No newline at end of file diff --git a/types/abi-types/factories/Tes__factory.d.ts.map b/types/abi-types/factories/Tes__factory.d.ts.map deleted file mode 100644 index 9c0f56a13..000000000 --- a/types/abi-types/factories/Tes__factory.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes__factory.d.ts","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/Tes__factory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAY,cAAc,EAAa,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAuWnD,qBAAa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAQ;IAC3B,MAAM,CAAC,eAAe,IAAI,YAAY;IAGtC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,GAAG,GAAG;CAGrE"} \ No newline at end of file diff --git a/types/abi-types/factories/Tes_abi__factory.d.ts b/types/abi-types/factories/Tes_abi__factory.d.ts deleted file mode 100644 index bd8c9ccc6..000000000 --- a/types/abi-types/factories/Tes_abi__factory.d.ts +++ /dev/null @@ -1,280 +0,0 @@ -import { ContractRunner } from "../../corebc.js"; -import type { Tes_abi, Tes_abiInterface } from "../Tes_abi.js"; -export declare class Tes_abi__factory { - static readonly abi: readonly [{ - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "approved"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "Approval"; - readonly type: "event"; - }, { - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }, { - readonly indexed: false; - readonly internalType: "bool"; - readonly name: "approved"; - readonly type: "bool"; - }]; - readonly name: "ApprovalForAll"; - readonly type: "event"; - }, { - readonly anonymous: false; - readonly inputs: readonly [{ - readonly indexed: true; - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly indexed: true; - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "Transfer"; - readonly type: "event"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "approve"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }]; - readonly name: "balanceOf"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256[]"; - readonly name: "ids"; - readonly type: "uint256[]"; - }]; - readonly name: "batchOwnerOf"; - readonly outputs: readonly [{ - readonly internalType: "address[]"; - readonly name: ""; - readonly type: "address[]"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "getApproved"; - readonly outputs: readonly [{ - readonly internalType: "address"; - readonly name: ""; - readonly type: "address"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }]; - readonly name: "isApprovedForAll"; - readonly outputs: readonly [{ - readonly internalType: "bool"; - readonly name: ""; - readonly type: "bool"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }]; - readonly name: "mint"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "ownerOf"; - readonly outputs: readonly [{ - readonly internalType: "address"; - readonly name: ""; - readonly type: "address"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "safeTransferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }, { - readonly internalType: "bytes"; - readonly name: "data"; - readonly type: "bytes"; - }]; - readonly name: "safeTransferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "operator"; - readonly type: "address"; - }, { - readonly internalType: "bool"; - readonly name: "approved"; - readonly type: "bool"; - }]; - readonly name: "setApprovalForAll"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "uint256"; - readonly name: "index"; - readonly type: "uint256"; - }]; - readonly name: "tokenByIndex"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "owner"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "index"; - readonly type: "uint256"; - }]; - readonly name: "tokenOfOwnerByIndex"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly []; - readonly name: "totalSupply"; - readonly outputs: readonly [{ - readonly internalType: "uint256"; - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; - readonly type: "function"; - }, { - readonly inputs: readonly [{ - readonly internalType: "address"; - readonly name: "from"; - readonly type: "address"; - }, { - readonly internalType: "address"; - readonly name: "to"; - readonly type: "address"; - }, { - readonly internalType: "uint256"; - readonly name: "tokenId"; - readonly type: "uint256"; - }]; - readonly name: "transferFrom"; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; - readonly type: "function"; - }]; - static createInterface(): Tes_abiInterface; - static connect(address: string, runner?: ContractRunner | null): Tes_abi; -} -//# sourceMappingURL=Tes_abi__factory.d.ts.map \ No newline at end of file diff --git a/types/abi-types/factories/Tes_abi__factory.d.ts.map b/types/abi-types/factories/Tes_abi__factory.d.ts.map deleted file mode 100644 index 5abc35679..000000000 --- a/types/abi-types/factories/Tes_abi__factory.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Tes_abi__factory.d.ts","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/Tes_abi__factory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAY,cAAc,EAAa,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAuW/D,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAQ;IAC3B,MAAM,CAAC,eAAe,IAAI,gBAAgB;IAG1C,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO;CAGzE"} \ No newline at end of file diff --git a/types/abi-types/factories/index.d.ts b/types/abi-types/factories/index.d.ts deleted file mode 100644 index e6b4dbcc0..000000000 --- a/types/abi-types/factories/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { Tes__factory } from "./Tes__factory.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/abi-types/factories/index.d.ts.map b/types/abi-types/factories/index.d.ts.map deleted file mode 100644 index 2727001fd..000000000 --- a/types/abi-types/factories/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src.ts/abi-types/factories/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"} \ No newline at end of file diff --git a/types/abi-types/index.d.ts b/types/abi-types/index.d.ts deleted file mode 100644 index ca4fb7b40..000000000 --- a/types/abi-types/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type { Tes } from "./Tes.js"; -export * as factories from "./factories/index.js"; -export { Tes__factory } from "./factories/Tes__factory.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/abi-types/index.d.ts.map b/types/abi-types/index.d.ts.map deleted file mode 100644 index 90d11b2fc..000000000 --- a/types/abi-types/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/abi-types/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC"} \ No newline at end of file diff --git a/types/abi/abi-coder.d.ts b/types/abi/abi-coder.d.ts deleted file mode 100644 index 1350031d4..000000000 --- a/types/abi/abi-coder.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * When sending values to or receiving values from a [[Contract]], the - * data is generally encoded using the [ABI standard](link-solc-abi). - * - * The AbiCoder provides a utility to encode values to ABI data and - * decode values from ABI data. - * - * Most of the time, developers should favour the [[Contract]] class, - * which further abstracts a lot of the finer details of ABI data. - * - * @_section api/abi/abi-coder:ABI Encoding - */ -import { Result } from "./coders/abstract-coder.js"; -import { ParamType } from "./fragments.js"; -import type { BytesLike, CallExceptionAction, CallExceptionError } from "../utils/index.js"; -/** - * About AbiCoder - */ -export declare class AbiCoder { - #private; - /** - * Get the default values for the given %%types%%. - * - * For example, a ``uint`` is by default ``0`` and ``bool`` - * is by default ``false``. - */ - getDefaultValue(types: ReadonlyArray): Result; - /** - * Encode the %%values%% as the %%types%% into ABI data. - * - * @returns DataHexstring - */ - encode(types: ReadonlyArray, values: ReadonlyArray): string; - /** - * Decode the ABI %%data%% as the %%types%% into values. - * - * If %%loose%% decoding is enabled, then strict padding is - * not enforced. Some older versions of Solidity incorrectly - * padded event data emitted from ``external`` functions. - */ - decode(types: ReadonlyArray, data: BytesLike, loose?: boolean): Result; - /** - * Returns the shared singleton instance of a default [[AbiCoder]]. - * - * On the first call, the instance is created internally. - */ - static defaultAbiCoder(): AbiCoder; - /** - * Returns an corebc-compatible [[CallExceptionError]] Error for the given - * result %%data%% for the [[CallExceptionAction]] %%action%% against - * the Transaction %%tx%%. - */ - static getBuiltinCallException(action: CallExceptionAction, tx: { - to?: null | string; - from?: null | string; - data?: string; - }, data: null | BytesLike): CallExceptionError; -} -//# sourceMappingURL=abi-coder.d.ts.map \ No newline at end of file diff --git a/types/abi/abi-coder.d.ts.map b/types/abi/abi-coder.d.ts.map deleted file mode 100644 index a86e1aca8..000000000 --- a/types/abi/abi-coder.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abi-coder.d.ts","sourceRoot":"","sources":["../../src.ts/abi/abi-coder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAiB,MAAM,EAAU,MAAM,4BAA4B,CAAC;AAU3E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAEnB,MAAM,mBAAmB,CAAC;AA8F3B;;GAEG;AACH,qBAAa,QAAQ;;IA2DnB;;;;;OAKG;IACH,eAAe,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM;IAQjE;;;;OAIG;IACH,MAAM,CACJ,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EACxC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GACzB,MAAM;IAeT;;;;;;OAMG;IACH,MAAM,CACJ,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EACxC,IAAI,EAAE,SAAS,EACf,KAAK,CAAC,EAAE,OAAO,GACd,MAAM;IAQT;;;;OAIG;IACH,MAAM,CAAC,eAAe,IAAI,QAAQ;IAOlC;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAC5B,MAAM,EAAE,mBAAmB,EAC3B,EAAE,EAAE;QAAE,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAC/D,IAAI,EAAE,IAAI,GAAG,SAAS,GACrB,kBAAkB;CAQtB"} \ No newline at end of file diff --git a/types/abi/bytes32.d.ts b/types/abi/bytes32.d.ts deleted file mode 100644 index 73455cb5d..000000000 --- a/types/abi/bytes32.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * About bytes32 strings... - * - * @_docloc: api/utils:Bytes32 Strings - */ -import type { BytesLike } from "../utils/index.js"; -/** - * Encodes %%text%% as a Bytes32 string. - */ -export declare function encodeBytes32String(text: string): string; -/** - * Encodes the Bytes32-encoded %%bytes%% into a string. - */ -export declare function decodeBytes32String(_bytes: BytesLike): string; -//# sourceMappingURL=bytes32.d.ts.map \ No newline at end of file diff --git a/types/abi/bytes32.d.ts.map b/types/abi/bytes32.d.ts.map deleted file mode 100644 index 09513605d..000000000 --- a/types/abi/bytes32.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bytes32.d.ts","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWxD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAmB7D"} \ No newline at end of file diff --git a/types/abi/coders/abstract-coder.d.ts b/types/abi/coders/abstract-coder.d.ts deleted file mode 100644 index 53d1481b3..000000000 --- a/types/abi/coders/abstract-coder.d.ts +++ /dev/null @@ -1,117 +0,0 @@ -import type { BigNumberish, BytesLike } from "../../utils/index.js"; -/** - * @_ignore: - */ -export declare const WordSize: number; -/** - * A [[Result]] is a sub-class of Array, which allows accessing any - * of its values either positionally by its index or, if keys are - * provided by its name. - * - * @_docloc: api/abi - */ -export declare class Result extends Array { - #private; - [K: string | number]: any; - /** - * @private - */ - constructor(...args: Array); - /** - * Returns the Result as a normal Array. - * - * This will throw if there are any outstanding deferred - * errors. - */ - toArray(): Array; - /** - * Returns the Result as an Object with each name-value pair. - * - * This will throw if any value is unnamed, or if there are - * any outstanding deferred errors. - */ - toObject(): Record; - /** - * @_ignore - */ - slice(start?: number | undefined, end?: number | undefined): Result; - /** - * @_ignore - */ - filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result; - /** - * Returns the value for %%name%%. - * - * Since it is possible to have a key whose name conflicts with - * a method on a [[Result]] or its superclass Array, or any - * JavaScript keyword, this ensures all named values are still - * accessible by name. - */ - getValue(name: string): any; - /** - * Creates a new [[Result]] for %%items%% with each entry - * also accessible by its corresponding name in %%keys%%. - */ - static fromItems(items: Array, keys?: Array): Result; -} -/** - * Returns all errors found in a [[Result]]. - * - * Since certain errors encountered when creating a [[Result]] do - * not impact the ability to continue parsing data, they are - * deferred until they are actually accessed. Hence a faulty string - * in an Event that is never used does not impact the program flow. - * - * However, sometimes it may be useful to access, identify or - * validate correctness of a [[Result]]. - * - * @_docloc api/abi - */ -export declare function checkResultErrors(result: Result): Array<{ - path: Array; - error: Error; -}>; -/** - * @_ignore - */ -export declare abstract class Coder { - readonly name: string; - readonly type: string; - readonly localName: string; - readonly dynamic: boolean; - constructor(name: string, type: string, localName: string, dynamic: boolean); - _throwError(message: string, value: any): never; - abstract encode(writer: Writer, value: any): number; - abstract decode(reader: Reader): any; - abstract defaultValue(): any; -} -/** - * @_ignore - */ -export declare class Writer { - #private; - constructor(); - get data(): string; - get length(): number; - appendWriter(writer: Writer): number; - writeBytes(value: BytesLike): number; - writeValue(value: BigNumberish): number; - writeUpdatableValue(): (value: BigNumberish) => void; -} -/** - * @_ignore - */ -export declare class Reader { - #private; - readonly allowLoose: boolean; - constructor(data: BytesLike, allowLoose?: boolean); - get data(): string; - get dataLength(): number; - get consumed(): number; - get bytes(): Uint8Array; - subReader(offset: number): Reader; - readBytes(length: number, loose?: boolean): Uint8Array; - readValue(): bigint; - readIndex(): number; -} -//# sourceMappingURL=abstract-coder.d.ts.map \ No newline at end of file diff --git a/types/abi/coders/abstract-coder.d.ts.map b/types/abi/coders/abstract-coder.d.ts.map deleted file mode 100644 index 3141c016e..000000000 --- a/types/abi/coders/abstract-coder.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-coder.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/abstract-coder.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAW,CAAC;AAiBnC;;;;;;GAMG;AACH,qBAAa,MAAO,SAAQ,KAAK,CAAC,GAAG,CAAC;;IAGpC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAE1B;;OAEG;gBACS,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;IAkG/B;;;;;OAKG;IACH,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC;IAWrB;;;;;OAKG;IACH,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAuB/B;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM;IAkCnE;;OAEG;IACH,MAAM,CACJ,QAAQ,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,EAC5D,OAAO,CAAC,EAAE,GAAG,GACZ,MAAM;IAkBT;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG;IAe3B;;;OAGG;IACH,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,MAAM;CAGzE;AAED;;;;;;;;;;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AI,MAAM,CAEjB;IACD,IAAI,UAAU,IAAI,MAAM,CAEvB;IACD,IAAI,QAAQ,IAAI,MAAM,CAErB;IACD,IAAI,KAAK,IAAI,UAAU,CAEtB;IAuBD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAKjC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU;IAQtD,SAAS,IAAI,MAAM;IAInB,SAAS,IAAI,MAAM;CAGpB"} \ No newline at end of file diff --git a/types/abi/coders/address.d.ts b/types/abi/coders/address.d.ts deleted file mode 100644 index 8befac03a..000000000 --- a/types/abi/coders/address.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class AddressCoder extends Coder { - constructor(localName: string); - defaultValue(): string; - encode(writer: Writer, _value: string | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/types/abi/coders/address.d.ts.map b/types/abi/coders/address.d.ts.map deleted file mode 100644 index 89cabff49..000000000 --- a/types/abi/coders/address.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/address.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBACzB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM;IAUtD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/types/abi/coders/anonymous.d.ts b/types/abi/coders/anonymous.d.ts deleted file mode 100644 index 554bf03f0..000000000 --- a/types/abi/coders/anonymous.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * Clones the functionality of an existing Coder, but without a localName - * - * @_ignore - */ -export declare class AnonymousCoder extends Coder { - private coder; - constructor(coder: Coder); - defaultValue(): any; - encode(writer: Writer, value: any): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=anonymous.d.ts.map \ No newline at end of file diff --git a/types/abi/coders/anonymous.d.ts.map b/types/abi/coders/anonymous.d.ts.map deleted file mode 100644 index 75c762afb..000000000 --- a/types/abi/coders/anonymous.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"anonymous.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/anonymous.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,OAAO,CAAC,KAAK,CAAQ;gBAET,KAAK,EAAE,KAAK;IAKxB,YAAY,IAAI,GAAG;IAInB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAI1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/types/abi/coders/array.d.ts b/types/abi/coders/array.d.ts deleted file mode 100644 index 954c4e17e..000000000 --- a/types/abi/coders/array.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder, Result, Writer } from "./abstract-coder.js"; -import type { Reader } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare function pack(writer: Writer, coders: ReadonlyArray, values: Array | { - [name: string]: any; -}): number; -/** - * @_ignore - */ -export declare function unpack(reader: Reader, coders: ReadonlyArray): Result; -/** - * @_ignore - */ -export declare class ArrayCoder extends Coder { - readonly coder: Coder; - readonly length: number; - constructor(coder: Coder, length: number, localName: string); - defaultValue(): Array; - encode(writer: Writer, _value: Array | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=array.d.ts.map \ No newline at end of file diff --git a/types/abi/coders/array.d.ts.map b/types/abi/coders/array.d.ts.map deleted file mode 100644 index 9875b8e9e..000000000 --- a/types/abi/coders/array.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/array.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAY,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD;;GAEG;AACH,wBAAgB,IAAI,CAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,EAC5B,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAC3C,MAAM,CAuER;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,MAAM,CAmD3E;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,KAAK,EAAG,KAAK,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;gBAEb,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAO3D,YAAY,IAAI,KAAK,CAAC,GAAG,CAAC;IAW1B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,MAAM;IA4B1D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CA4B5B"} \ No newline at end of file diff --git a/types/abi/coders/boolean.d.ts b/types/abi/coders/boolean.d.ts deleted file mode 100644 index f073e37ee..000000000 --- a/types/abi/coders/boolean.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class BooleanCoder extends Coder { - constructor(localName: string); - defaultValue(): boolean; - encode(writer: Writer, _value: boolean | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=boolean.d.ts.map \ No newline at end of file diff --git a/types/abi/coders/boolean.d.ts.map b/types/abi/coders/boolean.d.ts.map deleted file mode 100644 index 8f22ce499..000000000 --- a/types/abi/coders/boolean.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBACzB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,OAAO;IAIvB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM;IAKvD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/types/abi/coders/bytes.d.ts b/types/abi/coders/bytes.d.ts deleted file mode 100644 index 1e554582f..000000000 --- a/types/abi/coders/bytes.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class DynamicBytesCoder extends Coder { - constructor(type: string, localName: string); - defaultValue(): string; - encode(writer: Writer, value: any): number; - decode(reader: Reader): any; -} -/** - * @_ignore - */ -export declare class BytesCoder extends DynamicBytesCoder { - constructor(localName: string); - decode(reader: Reader): any; -} -//# sourceMappingURL=bytes.d.ts.map \ No newline at end of file diff --git a/types/abi/coders/bytes.d.ts.map b/types/abi/coders/bytes.d.ts.map deleted file mode 100644 index d765084b7..000000000 --- a/types/abi/coders/bytes.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/bytes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAI3C,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAO1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,iBAAiB;gBACnC,SAAS,EAAE,MAAM;IAI7B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/types/abi/coders/fixed-bytes.d.ts b/types/abi/coders/fixed-bytes.d.ts deleted file mode 100644 index 5c485fef6..000000000 --- a/types/abi/coders/fixed-bytes.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { BytesLike } from "../../utils/index.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class FixedBytesCoder extends Coder { - readonly size: number; - constructor(size: number, localName: string); - defaultValue(): string; - encode(writer: Writer, _value: BytesLike | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=fixed-bytes.d.ts.map \ No newline at end of file diff --git a/types/abi/coders/fixed-bytes.d.ts.map b/types/abi/coders/fixed-bytes.d.ts.map deleted file mode 100644 index cca02a1ac..000000000 --- a/types/abi/coders/fixed-bytes.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fixed-bytes.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/fixed-bytes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAM3C,YAAY,IAAI,MAAM;IAOtB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM;IAQzD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/types/abi/coders/null.d.ts b/types/abi/coders/null.d.ts deleted file mode 100644 index 5df5da342..000000000 --- a/types/abi/coders/null.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class NullCoder extends Coder { - constructor(localName: string); - defaultValue(): null; - encode(writer: Writer, value: any): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=null.d.ts.map \ No newline at end of file diff --git a/types/abi/coders/null.d.ts.map b/types/abi/coders/null.d.ts.map deleted file mode 100644 index 5b43f1d78..000000000 --- a/types/abi/coders/null.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"null.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/null.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI1D;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;gBACtB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,IAAI;IAIpB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAO1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAI5B"} \ No newline at end of file diff --git a/types/abi/coders/number.d.ts b/types/abi/coders/number.d.ts deleted file mode 100644 index 822cc6df2..000000000 --- a/types/abi/coders/number.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { BigNumberish } from "../../utils/index.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class NumberCoder extends Coder { - readonly size: number; - readonly signed: boolean; - constructor(size: number, signed: boolean, localName: string); - defaultValue(): number; - encode(writer: Writer, _value: BigNumberish | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=number.d.ts.map \ No newline at end of file diff --git a/types/abi/coders/number.d.ts.map b/types/abi/coders/number.d.ts.map deleted file mode 100644 index b9ef16d8a..000000000 --- a/types/abi/coders/number.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/number.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAY,MAAM,qBAAqB,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAQ1D;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAG,OAAO,CAAC;gBAEd,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM;IAW5D,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,KAAK,GAAG,MAAM;IAkB5D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAS5B"} \ No newline at end of file diff --git a/types/abi/coders/string.d.ts b/types/abi/coders/string.d.ts deleted file mode 100644 index 8e1c63593..000000000 --- a/types/abi/coders/string.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Typed } from "../typed.js"; -import { DynamicBytesCoder } from "./bytes.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class StringCoder extends DynamicBytesCoder { - constructor(localName: string); - defaultValue(): string; - encode(writer: Writer, _value: string | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=string.d.ts.map \ No newline at end of file diff --git a/types/abi/coders/string.d.ts.map b/types/abi/coders/string.d.ts.map deleted file mode 100644 index 38618a702..000000000 --- a/types/abi/coders/string.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/string.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,WAAY,SAAQ,iBAAiB;gBACpC,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM;IAOtD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/types/abi/coders/tuple.d.ts b/types/abi/coders/tuple.d.ts deleted file mode 100644 index fe3ec0328..000000000 --- a/types/abi/coders/tuple.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Typed } from "../typed.js"; -import { Coder } from "./abstract-coder.js"; -import type { Reader, Writer } from "./abstract-coder.js"; -/** - * @_ignore - */ -export declare class TupleCoder extends Coder { - readonly coders: ReadonlyArray; - constructor(coders: Array, localName: string); - defaultValue(): any; - encode(writer: Writer, _value: Array | { - [name: string]: any; - } | Typed): number; - decode(reader: Reader): any; -} -//# sourceMappingURL=tuple.d.ts.map \ No newline at end of file diff --git a/types/abi/coders/tuple.d.ts.map b/types/abi/coders/tuple.d.ts.map deleted file mode 100644 index de1068222..000000000 --- a/types/abi/coders/tuple.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tuple.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/tuple.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,MAAM,EAAG,aAAa,CAAC,KAAK,CAAC,CAAC;gBAE3B,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM;IAiBnD,YAAY,IAAI,GAAG;IA0CnB,MAAM,CACJ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,KAAK,GACnD,MAAM;IAKT,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG5B"} \ No newline at end of file diff --git a/types/abi/fragments.d.ts b/types/abi/fragments.d.ts deleted file mode 100644 index 6d88c3596..000000000 --- a/types/abi/fragments.d.ts +++ /dev/null @@ -1,372 +0,0 @@ -/** - * About frgaments... - * - * @_subsection api/abi/abi-coder:Fragments [about-fragments] - */ -/** - * A type description in a JSON API. - */ -export interface JsonFragmentType { - /** - * The parameter name. - */ - readonly name?: string; - /** - * If the parameter is indexed. - */ - readonly indexed?: boolean; - /** - * The type of the parameter. - */ - readonly type?: string; - /** - * The internal Solidity type. - */ - readonly internalType?: string; - /** - * The components for a tuple. - */ - readonly components?: ReadonlyArray; -} -/** - * A fragment for a method, event or error in a JSON API. - */ -export interface JsonFragment { - /** - * The name of the error, event, function, etc. - */ - readonly name?: string; - /** - * The type of the fragment (e.g. ``event``, ``"function"``, etc.) - */ - readonly type?: string; - /** - * If the event is anonymous. - */ - readonly anonymous?: boolean; - /** - * If the function is payable. - */ - readonly payable?: boolean; - /** - * If the function is constant. - */ - readonly constant?: boolean; - /** - * The mutability state of the function. - */ - readonly stateMutability?: string; - /** - * The input parameters. - */ - readonly inputs?: ReadonlyArray; - /** - * The output parameters. - */ - readonly outputs?: ReadonlyArray; - /** - * The energy limit to use when sending a transaction for this function. - */ - readonly energy?: string; -} -/** - * The format to serialize the output as. - */ -export type FormatType = "sighash" | "minimal" | "full" | "json"; -/** - * When [walking](ParamType-walk) a [[ParamType]], this is called - * on each component. - */ -export type ParamTypeWalkFunc = (type: string, value: any) => any; -/** - * When [walking asynchronously](ParamType-walkAsync) a [[ParamType]], - * this is called on each component. - */ -export type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise; -/** - * Each input and output of a [[Fragment]] is an Array of **PAramType**. - */ -export declare class ParamType { - #private; - /** - * The local name of the parameter (or ``""`` if unbound) - */ - readonly name: string; - /** - * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, - * ``"uint256[3][]"``) - */ - readonly type: string; - /** - * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) - */ - readonly baseType: string; - /** - * True if the parameters is indexed. - * - * For non-indexable types this is ``null``. - */ - readonly indexed: null | boolean; - /** - * The components for the tuple. - * - * For non-tuple types this is ``null``. - */ - readonly components: null | ReadonlyArray; - /** - * The array length, or ``-1`` for dynamic-lengthed arrays. - * - * For non-array types this is ``null``. - */ - readonly arrayLength: null | number; - /** - * The type of each child in the array. - * - * For non-array types this is ``null``. - */ - readonly arrayChildren: null | ParamType; - /** - * @private - */ - constructor(guard: any, name: string, type: string, baseType: string, indexed: null | boolean, components: null | ReadonlyArray, arrayLength: null | number, arrayChildren: null | ParamType); - /** - * Return a string representation of this type. - * - * For example, - * - * ``sighash" => "(uint256,address)"`` - * - * ``"minimal" => "tuple(uint256,address) indexed"`` - * - * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` - */ - format(format?: FormatType): string; - /** - * Returns true if %%this%% is an Array type. - * - * This provides a type gaurd ensuring that [[arrayChildren]] - * and [[arrayLength]] are non-null. - */ - isArray(): this is ParamType & { - arrayChildren: ParamType; - arrayLength: number; - }; - /** - * Returns true if %%this%% is a Tuple type. - * - * This provides a type gaurd ensuring that [[components]] - * is non-null. - */ - isTuple(): this is ParamType & { - components: ReadonlyArray; - }; - /** - * Returns true if %%this%% is an Indexable type. - * - * This provides a type gaurd ensuring that [[indexed]] - * is non-null. - */ - isIndexable(): this is ParamType & { - indexed: boolean; - }; - /** - * Walks the **ParamType** with %%value%%, calling %%process%% - * on each type, destructing the %%value%% recursively. - */ - walk(value: any, process: ParamTypeWalkFunc): any; - /** - * Walks the **ParamType** with %%value%%, asynchronously calling - * %%process%% on each type, destructing the %%value%% recursively. - * - * This can be used to resolve ENS naes by walking and resolving each - * ``"address"`` type. - */ - walkAsync(value: any, process: ParamTypeWalkAsyncFunc): Promise; - /** - * Creates a new **ParamType** for %%obj%%. - * - * If %%allowIndexed%% then the ``indexed`` keyword is permitted, - * otherwise the ``indexed`` keyword will throw an error. - */ - static from(obj: any, allowIndexed?: boolean): ParamType; - /** - * Returns true if %%value%% is a **ParamType**. - */ - static isParamType(value: any): value is ParamType; -} -/** - * The type of a [[Fragment]]. - */ -export type FragmentType = "constructor" | "error" | "event" | "fallback" | "function" | "struct"; -/** - * An abstract class to represent An individual fragment from a parse ABI. - */ -export declare abstract class Fragment { - /** - * The type of the fragment. - */ - readonly type: FragmentType; - /** - * The inputs for the fragment. - */ - readonly inputs: ReadonlyArray; - /** - * @private - */ - constructor(guard: any, type: FragmentType, inputs: ReadonlyArray); - /** - * Returns a string representation of this fragment. - */ - abstract format(format?: FormatType): string; - /** - * Creates a new **Fragment** for %%obj%%, wich can be any supported - * ABI frgament type. - */ - static from(obj: any): Fragment; - /** - * Returns true if %%value%% is a [[ConstructorFragment]]. - */ - static isConstructor(value: any): value is ConstructorFragment; - /** - * Returns true if %%value%% is an [[ErrorFragment]]. - */ - static isError(value: any): value is ErrorFragment; - /** - * Returns true if %%value%% is an [[EventFragment]]. - */ - static isEvent(value: any): value is EventFragment; - /** - * Returns true if %%value%% is a [[FunctionFragment]]. - */ - static isFunction(value: any): value is FunctionFragment; - /** - * Returns true if %%value%% is a [[StructFragment]]. - */ - static isStruct(value: any): value is StructFragment; -} -/** - * An abstract class to represent An individual fragment - * which has a name from a parse ABI. - */ -export declare abstract class NamedFragment extends Fragment { - /** - * The name of the fragment. - */ - readonly name: string; - /** - * @private - */ - constructor(guard: any, type: FragmentType, name: string, inputs: ReadonlyArray); -} -/** - * A Fragment which represents a //Custom Error//. - */ -export declare class ErrorFragment extends NamedFragment { - /** - * @private - */ - constructor(guard: any, name: string, inputs: ReadonlyArray); - /** - * The Custom Error selector. - */ - get selector(): string; - format(format?: FormatType): string; - static from(obj: any): ErrorFragment; - static isFragment(value: any): value is ErrorFragment; -} -/** - * A Fragment which represents an Event. - */ -export declare class EventFragment extends NamedFragment { - readonly anonymous: boolean; - /** - * @private - */ - constructor(guard: any, name: string, inputs: ReadonlyArray, anonymous: boolean); - /** - * The Event topic hash. - */ - get topicHash(): string; - format(format?: FormatType): string; - static getTopicHash(name: string, params?: Array): string; - static from(obj: any): EventFragment; - static isFragment(value: any): value is EventFragment; -} -/** - * A Fragment which represents a constructor. - */ -export declare class ConstructorFragment extends Fragment { - readonly payable: boolean; - readonly energy: null | bigint; - /** - * @private - */ - constructor(guard: any, type: FragmentType, inputs: ReadonlyArray, payable: boolean, energy: null | bigint); - format(format?: FormatType): string; - static from(obj: any): ConstructorFragment; - static isFragment(value: any): value is ConstructorFragment; -} -/** - * A Fragment which represents a method. - */ -export declare class FallbackFragment extends Fragment { - /** - * If the function can be sent value during invocation. - */ - readonly payable: boolean; - constructor(guard: any, inputs: ReadonlyArray, payable: boolean); - format(format?: FormatType): string; - static from(obj: any): FallbackFragment; - static isFragment(value: any): value is FallbackFragment; -} -/** - * A Fragment which represents a method. - */ -export declare class FunctionFragment extends NamedFragment { - /** - * If the function is constant (e.g. ``pure`` or ``view`` functions). - */ - readonly constant: boolean; - /** - * The returned types for the result of calling this function. - */ - readonly outputs: ReadonlyArray; - /** - * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` - * or ``pure``) - */ - readonly stateMutability: "payable" | "nonpayable" | "view" | "pure"; - /** - * If the function can be sent value during invocation. - */ - readonly payable: boolean; - /** - * The amount of energy to send when calling this function - */ - readonly energy: null | bigint; - /** - * @private - */ - constructor(guard: any, name: string, stateMutability: "payable" | "nonpayable" | "view" | "pure", inputs: ReadonlyArray, outputs: ReadonlyArray, energy: null | bigint); - /** - * The Function selector. - */ - get selector(): string; - format(format?: FormatType): string; - static getSelector(name: string, params?: Array): string; - static from(obj: any): FunctionFragment; - static isFragment(value: any): value is FunctionFragment; -} -/** - * A Fragment which represents a structure. - */ -export declare class StructFragment extends NamedFragment { - /** - * @private - */ - constructor(guard: any, name: string, inputs: ReadonlyArray); - format(): string; - static from(obj: any): StructFragment; - static isFragment(value: any): value is FunctionFragment; -} -//# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/types/abi/fragments.d.ts.map b/types/abi/fragments.d.ts.map deleted file mode 100644 index c3f678ffe..000000000 --- a/types/abi/fragments.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../src.ts/abi/fragments.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,QAAQ,C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,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM;IAa7D,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,gBAAgB;IA+DvC,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAGzD;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,aAAa;IAC/C;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC;IAKtE,MAAM,IAAI,MAAM;IAIhB,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc;IAiBrC,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAGzD"} \ No newline at end of file diff --git a/types/abi/index.d.ts b/types/abi/index.d.ts deleted file mode 100644 index ce0ddb016..000000000 --- a/types/abi/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Explain about ABI here... - * - * @_section api/abi:Application Binary Interface [about-abi] - * @_navTitle: ABI - */ -export { AbiCoder } from "./abi-coder.js"; -export { decodeBytes32String, encodeBytes32String } from "./bytes32.js"; -export { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, NamedFragment, ParamType, StructFragment, } from "./fragments.js"; -export { checkResultErrors, Indexed, Interface, ErrorDescription, LogDescription, TransactionDescription, Result, } from "./interface.js"; -export { Typed } from "./typed.js"; -export type { JsonFragment, JsonFragmentType, FormatType, FragmentType, ParamTypeWalkAsyncFunc, ParamTypeWalkFunc, } from "./fragments.js"; -export type { InterfaceAbi } from "./interface.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/abi/index.d.ts.map b/types/abi/index.d.ts.map deleted file mode 100644 index 4eb1a4ab8..000000000 --- a/types/abi/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,MAAM,GACP,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/types/abi/interface.d.ts b/types/abi/interface.d.ts deleted file mode 100644 index 62b24ebe4..000000000 --- a/types/abi/interface.d.ts +++ /dev/null @@ -1,270 +0,0 @@ -/** - * About Interface - * - * @_subsection api/abi:Interfaces [interfaces] - */ -import { AbiCoder } from "./abi-coder.js"; -import { checkResultErrors, Result } from "./coders/abstract-coder.js"; -import { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, ParamType } from "./fragments.js"; -import { Typed } from "./typed.js"; -import type { BigNumberish, BytesLike, CallExceptionError, CallExceptionTransaction } from "../utils/index.js"; -import type { JsonFragment } from "./fragments.js"; -export { checkResultErrors, Result }; -export declare class LogDescription { - readonly fragment: EventFragment; - readonly name: string; - readonly signature: string; - readonly topic: string; - readonly args: Result; - constructor(fragment: EventFragment, topic: string, args: Result); -} -export declare class TransactionDescription { - readonly fragment: FunctionFragment; - readonly name: string; - readonly args: Result; - readonly signature: string; - readonly selector: string; - readonly value: bigint; - constructor(fragment: FunctionFragment, selector: string, args: Result, value: bigint); -} -export declare class ErrorDescription { - readonly fragment: ErrorFragment; - readonly name: string; - readonly args: Result; - readonly signature: string; - readonly selector: string; - constructor(fragment: ErrorFragment, selector: string, args: Result); -} -export declare class Indexed { - readonly hash: null | string; - readonly _isIndexed: boolean; - static isIndexed(value: any): value is Indexed; - constructor(hash: null | string); -} -/** - * @TODO - */ -export type InterfaceAbi = string | ReadonlyArray; -/** - * An Interface abstracts many of the low-level details for - * encoding and decoding the data on the blockchain. - * - * An ABI provides information on how to encode data to send to - * a Contract, how to decode the results and events and how to - * interpret revert errors. - * - * The ABI can be specified by [any supported format](InterfaceAbi). - */ -export declare class Interface { - #private; - /** - * All the Contract ABI members (i.e. methods, events, errors, etc). - */ - readonly fragments: ReadonlyArray; - /** - * The Contract constructor. - */ - readonly deploy: ConstructorFragment; - /** - * The Fallback method, if any. - */ - readonly fallback: null | FallbackFragment; - /** - * If receiving xcb is supported. - */ - readonly receive: boolean; - /** - * Create a new Interface for the %%fragments%%. - */ - constructor(fragments: InterfaceAbi); - /** - * Returns the entire Human-Readable ABI, as an array of - * signatures, optionally as %%minimal%% strings, which - * removes parameter names and unneceesary spaces. - */ - format(minimal?: boolean): Array; - /** - * Return the JSON-encoded ABI. This is the format Solidiy - * returns. - */ - formatJson(): string; - /** - * The ABI coder that will be used to encode and decode binary - * data. - */ - getAbiCoder(): AbiCoder; - /** - * Get the function name for %%key%%, which may be a function selector, - * function name or function signature that belongs to the ABI. - */ - getFunctionName(key: string): string; - /** - * Returns true if %%key%% (a function selector, function name or - * function signature) is present in the ABI. - * - * In the case of a function name, the name may be ambiguous, so - * accessing the [[FunctionFragment]] may require refinement. - */ - hasFunction(key: string): boolean; - /** - * Get the [[FunctionFragment]] for %%key%%, which may be a function - * selector, function name or function signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple functions match by name. - * - * If the %%key%% and %%values%% do not refine to a single function in - * the ABI, this will throw. - */ - getFunction(key: string, values?: Array): null | FunctionFragment; - /** - * Iterate over all functions, calling %%callback%%, sorted by their name. - */ - forEachFunction(callback: (func: FunctionFragment, index: number) => void): void; - /** - * Get the event name for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - */ - getEventName(key: string): string; - /** - * Returns true if %%key%% (an event topic hash, event name or - * event signature) is present in the ABI. - * - * In the case of an event name, the name may be ambiguous, so - * accessing the [[EventFragment]] may require refinement. - */ - hasEvent(key: string): boolean; - /** - * Get the [[EventFragment]] for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple events match by name. - * - * If the %%key%% and %%values%% do not refine to a single event in - * the ABI, this will throw. - */ - getEvent(key: string, values?: Array): null | EventFragment; - /** - * Iterate over all events, calling %%callback%%, sorted by their name. - */ - forEachEvent(callback: (func: EventFragment, index: number) => void): void; - /** - * Get the [[ErrorFragment]] for %%key%%, which may be an error - * selector, error name or error signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple errors match by name. - * - * If the %%key%% and %%values%% do not refine to a single error in - * the ABI, this will throw. - */ - getError(key: string, values?: Array): null | ErrorFragment; - /** - * Iterate over all errors, calling %%callback%%, sorted by their name. - */ - forEachError(callback: (func: ErrorFragment, index: number) => void): void; - _decodeParams(params: ReadonlyArray, data: BytesLike): Result; - _encodeParams(params: ReadonlyArray, values: ReadonlyArray): string; - /** - * Encodes a ``tx.data`` object for deploying the Contract with - * the %%values%% as the constructor arguments. - */ - encodeDeploy(values?: ReadonlyArray): string; - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified error (see [[getError]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeErrorResult(fragment: ErrorFragment | string, data: BytesLike): Result; - /** - * Encodes the transaction revert data for a call result that - * reverted from the the Contract with the sepcified %%error%% - * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeErrorResult(fragment: ErrorFragment | string, values?: ReadonlyArray): string; - /** - * Decodes the %%data%% from a transaction ``tx.data`` for - * the function specified (see [[getFunction]] for valid values - * for %%fragment%%). - * - * Most developers should prefer the [[parseTransaction]] method - * instead, which will automatically detect the fragment. - */ - decodeFunctionData(fragment: FunctionFragment | string, data: BytesLike): Result; - /** - * Encodes the ``tx.data`` for a transaction that calls the function - * specified (see [[getFunction]] for valid values for %%fragment%%) with - * the %%values%%. - */ - encodeFunctionData(fragment: FunctionFragment | string, values?: ReadonlyArray): string; - /** - * Decodes the result %%data%% (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeFunctionResult(fragment: FunctionFragment | string, data: BytesLike): Result; - makeError(_data: BytesLike, tx: CallExceptionTransaction): CallExceptionError; - /** - * Encodes the result data (e.g. from an ``xcb_call``) for the - * specified function (see [[getFunction]] for valid values - * for %%fragment%%) with %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeFunctionResult(fragment: FunctionFragment | string, values?: ReadonlyArray): string; - encodeFilterTopics(fragment: EventFragment | string, values: ReadonlyArray): Array>; - encodeEventLog(fragment: EventFragment | string, values: ReadonlyArray): { - data: string; - topics: Array; - }; - decodeEventLog(fragment: EventFragment | string, data: BytesLike, topics?: ReadonlyArray): Result; - /** - * Parses a transaction, finding the matching function and extracts - * the parameter values along with other useful function details. - * - * If the matching function cannot be found, return null. - */ - parseTransaction(tx: { - data: string; - value?: BigNumberish; - }): null | TransactionDescription; - parseCallResult(data: BytesLike): Result; - /** - * Parses a receipt log, finding the matching event and extracts - * the parameter values along with other useful event details. - * - * If the matching event cannot be found, returns null. - */ - parseLog(log: { - topics: Array; - data: string; - }): null | LogDescription; - /** - * Parses a revert data, finding the matching error and extracts - * the parameter values along with other useful error details. - * - * If the matching event cannot be found, returns null. - */ - parseError(data: BytesLike): null | ErrorDescription; - /** - * Creates a new [[Interface]] from the ABI %%value%%. - * - * The %%value%% may be provided as an existing [[Interface]] object, - * a JSON-encoded ABI or any Human-Readable ABI format. - */ - static from(value: InterfaceAbi | Interface): Interface; -} -//# sourceMappingURL=interface.d.ts.map \ No newline at end of file diff --git a/types/abi/interface.d.ts.map b/types/abi/interface.d.ts.map deleted file mode 100644 index 763cd7ac3..000000000 --- a/types/abi/interface.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src.ts/abi/interface.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC;AAErC,qBAAa,cAAc;IACzB,QAAQ,CAAC,QAAQ,EAAG,aAAa,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAG,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK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dce9d6a9..000000000 --- a/types/abi/typed.d.ts +++ /dev/null @@ -1,172 +0,0 @@ -/** - * A Typed object allows a value to have its type explicitly - * specified. - * - * For example, in Solidity, the value ``45`` could represent a - * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent - * a ``bytes2`` or ``bytes``. - * - * Since JavaScript has no meaningful way to explicitly inform any - * APIs which what the type is, this allows transparent interoperation - * with Soldity. - * - * @_subsection: api/abi:Typed Values - */ -import type { Addressable } from "../address/index.js"; -import type { BigNumberish, BytesLike } from "../utils/index.js"; -import type { Result } from "./coders/abstract-coder.js"; -export interface TypedNumber extends Typed { - value: number; - defaultValue(): number; - minValue(): number; - maxValue(): number; -} -export interface TypedBigInt extends Typed { - value: bigint; - defaultValue(): bigint; - minValue(): bigint; - maxValue(): bigint; -} -export interface TypedData extends Typed { - value: string; - defaultValue(): string; -} -export interface TypedString extends Typed { - value: string; - defaultValue(): string; -} -export declare class Typed { - #private; - readonly type: string; - readonly value: any; - readonly _typedSymbol: Symbol; - constructor(gaurd: any, type: string, value: any, options?: any); - format(): string; - defaultValue(): string | number | bigint | Result; - minValue(): string | number | bigint; - maxValue(): string | number | bigint; - isBigInt(): this is TypedBigInt; - isData(): this is TypedData; - isString(): this is TypedString; - get tupleName(): null | string; - get arrayLength(): null | number; - static from(type: string, value: any): Typed; - static uint8(v: BigNumberish): Typed; - static uint16(v: BigNumberish): Typed; - static uint24(v: BigNumberish): Typed; - static uint32(v: BigNumberish): Typed; - static uint40(v: BigNumberish): Typed; - static uint48(v: BigNumberish): Typed; - static uint56(v: BigNumberish): Typed; - static uint64(v: BigNumberish): Typed; - static uint72(v: BigNumberish): Typed; - static uint80(v: BigNumberish): Typed; - static uint88(v: BigNumberish): Typed; - static uint96(v: BigNumberish): Typed; - static uint104(v: BigNumberish): Typed; - static uint112(v: BigNumberish): Typed; - static uint120(v: BigNumberish): Typed; - static uint128(v: BigNumberish): Typed; - static uint136(v: BigNumberish): Typed; - static uint144(v: BigNumberish): Typed; - static uint152(v: BigNumberish): Typed; - static uint160(v: BigNumberish): Typed; - static uint168(v: BigNumberish): Typed; - static uint176(v: BigNumberish): Typed; - static uint184(v: BigNumberish): Typed; - static uint192(v: BigNumberish): Typed; - static uint200(v: BigNumberish): Typed; - static uint208(v: BigNumberish): Typed; - static uint216(v: BigNumberish): Typed; - static uint224(v: BigNumberish): Typed; - static uint232(v: BigNumberish): Typed; - static uint240(v: BigNumberish): Typed; - static uint248(v: BigNumberish): Typed; - static uint256(v: BigNumberish): Typed; - static uint(v: BigNumberish): Typed; - static int8(v: BigNumberish): Typed; - static int16(v: BigNumberish): Typed; - static int24(v: BigNumberish): Typed; - static int32(v: BigNumberish): Typed; - static int40(v: BigNumberish): Typed; - static int48(v: BigNumberish): Typed; - static int56(v: BigNumberish): Typed; - static int64(v: BigNumberish): Typed; - static int72(v: BigNumberish): Typed; - static int80(v: BigNumberish): Typed; - static int88(v: BigNumberish): Typed; - static int96(v: BigNumberish): Typed; - static int104(v: BigNumberish): Typed; - static int112(v: BigNumberish): Typed; - static int120(v: BigNumberish): Typed; - static int128(v: BigNumberish): Typed; - static int136(v: BigNumberish): Typed; - static int144(v: BigNumberish): Typed; - static int152(v: BigNumberish): Typed; - static int160(v: BigNumberish): Typed; - static int168(v: BigNumberish): Typed; - static int176(v: BigNumberish): Typed; - static int184(v: BigNumberish): Typed; - static int192(v: BigNumberish): Typed; - static int200(v: BigNumberish): Typed; - static int208(v: BigNumberish): Typed; - static int216(v: BigNumberish): Typed; - static int224(v: BigNumberish): Typed; - static int232(v: BigNumberish): Typed; - static int240(v: BigNumberish): Typed; - static int248(v: BigNumberish): Typed; - static int256(v: BigNumberish): Typed; - static int(v: BigNumberish): Typed; - static bytes1(v: BytesLike): Typed; - static bytes2(v: BytesLike): Typed; - static bytes3(v: BytesLike): Typed; - static bytes4(v: BytesLike): Typed; - static bytes5(v: BytesLike): Typed; - static bytes6(v: BytesLike): Typed; - static bytes7(v: BytesLike): Typed; - static bytes8(v: BytesLike): Typed; - static bytes9(v: BytesLike): Typed; - static bytes10(v: BytesLike): Typed; - static bytes11(v: BytesLike): Typed; - static bytes12(v: BytesLike): Typed; - static bytes13(v: BytesLike): Typed; - static bytes14(v: BytesLike): Typed; - static bytes15(v: BytesLike): Typed; - static bytes16(v: BytesLike): Typed; - static bytes17(v: BytesLike): Typed; - static bytes18(v: BytesLike): Typed; - static bytes19(v: BytesLike): Typed; - static bytes20(v: BytesLike): Typed; - static bytes21(v: BytesLike): Typed; - static bytes22(v: BytesLike): Typed; - static bytes23(v: BytesLike): Typed; - static bytes24(v: BytesLike): Typed; - static bytes25(v: BytesLike): Typed; - static bytes26(v: BytesLike): Typed; - static bytes27(v: BytesLike): Typed; - static bytes28(v: BytesLike): Typed; - static bytes29(v: BytesLike): Typed; - static bytes30(v: BytesLike): Typed; - static bytes31(v: BytesLike): Typed; - static bytes32(v: BytesLike): Typed; - static address(v: string | Addressable): Typed; - static bool(v: any): Typed; - static bytes(v: BytesLike): Typed; - static string(v: string): Typed; - static array(v: Array, dynamic?: null | boolean): Typed; - static tuple(v: Array | Record, name?: string): Typed; - static overrides(v: Record): Typed; - /** - * Returns true only if %%value%% is a [[Typed]] instance. - */ - static isTyped(value: any): value is Typed; - /** - * If the value is a [[Typed]] instance, validates the underlying value - * and returns it, otherwise returns value directly. - * - * This is useful for functions that with to accept either a [[Typed]] - * object or values. - */ - static dereference(value: Typed | T, type: string): T; -} -//# sourceMappingURL=typed.d.ts.map \ No newline at end of file diff --git a/types/abi/typed.d.ts.map b/types/abi/typed.d.ts.map deleted file mode 100644 index 552156f75..000000000 --- a/types/abi/typed.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"typed.d.ts","sourceRoot":"","sources":["../../src.ts/abi/typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAA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AC,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,KAAK;IAG9C,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,GAAG,KAAK;IAG1B,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,KAAK;IAGjC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,KAAK;IAI/B,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,IAAI,GAAG,OAAO,GAAG,KAAK;IAKpE,MAAM,CAAC,KAAK,CACV,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,KAAK,CAAC,EACnD,IAAI,CAAC,EAAE,MAAM,GACZ,KAAK;IAKR,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK;IAI/C;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,KAAK;IAI1C;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;CASzD"} \ No newline at end of file diff --git a/types/address/checks.d.ts b/types/address/checks.d.ts deleted file mode 100644 index 865b0aca9..000000000 --- a/types/address/checks.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { Addressable, AddressLike } from "./index.js"; -/** - * Returns true if %%value%% is an object which implements the - * [[Addressable]] interface. - * - * @example: - * // Wallets and AbstractSigner sub-classes - * isAddressable(Wallet.createRandom()) - * //_result: - * - * // Contracts - * contract = new Contract("dai.tokens.corebc.eth", [ ], provider) - * isAddressable(contract) - * //_result: - */ -export declare function isAddressable(value: any): value is Addressable; -/** - * Returns true if %%value%% is a valid address. - * - * @example: - * // Valid address - * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") - * //_result: - * - * // Valid ICAP address - * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") - * //_result: - * - * // Invalid checksum - * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") - * //_result: - * - * // Invalid ICAP checksum - * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") - * //_result: - * - * // Not an address (an ENS name requires a provided and an - * // asynchronous API to access) - * isAddress("ricmoo.eth") - * //_result: - */ -export declare function isAddress(value: any): value is string; -/** - * Resolves to an address for the %%target%%, which may be any - * supported address type, an [[Addressable]] or a Promise which - * resolves to an address. - * - * If an ENS name is provided, but that name has not been correctly - * configured a [[UnconfiguredNameError]] is thrown. - * - * @example: - * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" - * - * // Addresses are return synchronously - * resolveAddress(addr, provider) - * //_result: - * - * // Address promises are resolved asynchronously - * resolveAddress(Promise.resolve(addr)) - * //_result: - * - * - * // Addressable objects are resolved asynchronously - * contract = new Contract(addr, [ ]) - * resolveAddress(contract, provider) - * //_result: - * - * // Unconfigured ENS names reject - * resolveAddress("nothing-here.ricmoo.eth", provider) - * //_error: - * - * // ENS names require a NameResolver object passed in - * // (notice the provider was omitted) - * resolveAddress("nothing-here.ricmoo.eth") - * //_error: - */ -export declare function resolveAddress(target: AddressLike): string | Promise; -//# sourceMappingURL=checks.d.ts.map \ No newline at end of file diff --git a/types/address/checks.d.ts.map b/types/address/checks.d.ts.map deleted file mode 100644 index 936fbc09c..000000000 --- a/types/address/checks.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src.ts/address/checks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAc,MAAM,YAAY,CAAC;AAElE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,WAAW,CAE9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAMrD;AA2BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAe5E"} \ No newline at end of file diff --git a/types/address/contract-address.d.ts b/types/address/contract-address.d.ts deleted file mode 100644 index 5aaa076ad..000000000 --- a/types/address/contract-address.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { BigNumberish, BytesLike } from "../utils/index.js"; -/** - * Returns the address that would result from a ``CREATE`` for %%tx%%. - * - * This can be used to compute the address a contract will be - * deployed to by an EOA when sending a deployment transaction (i.e. - * when the ``to`` address is ``null``). - * - * This can also be used to compute the address a contract will be - * deployed to by a contract, by using the contract's address as the - * ``to`` and the contract's nonce. - * - * @example - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; - * nonce = 5; - * - * getCreateAddress({ from, nonce }); - * //_result: - */ -export declare function getCreateAddress(tx: { - from: string; - nonce: BigNumberish; -}): string; -/** - * Returns the address that would result from a ``CREATE2`` operation - * with the given %%from%%, %%salt%% and %%initCodeHash%%. - - * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. - * - * @example - * // The address of the contract - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" - * - * // The salt - * salt = id("HelloWorld") - * - * getCreate2Address(from, salt, initCodeHash) - * //_result: - */ -export declare function getCreate2Address(from: string, salt: BytesLike, initCodeHash: BytesLike): string; -//# sourceMappingURL=contract-address.d.ts.map \ No newline at end of file diff --git a/types/address/contract-address.d.ts.map b/types/address/contract-address.d.ts.map deleted file mode 100644 index 8511ac269..000000000 --- a/types/address/contract-address.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contract-address.d.ts","sourceRoot":"","sources":["../../src.ts/address/contract-address.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAQjE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,YAAY,CAAC;CACrB,GAAG,MAAM,CAcT;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,SAAS,GACtB,MAAM,CAoBR"} \ No newline at end of file diff --git a/types/address/index.d.ts b/types/address/index.d.ts deleted file mode 100644 index 180d9faa2..000000000 --- a/types/address/index.d.ts +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Addresses are a fundamental part of interacting with Core. They - * represent the gloabal identity of Externally Owned Accounts (accounts - * backed by a private key) and contracts. - * - * The Core Naming Service (CNS) provides an interconnected ecosystem - * of contracts, standards and libraries which enable looking up an - * address for an ENS name. - * - * These functions help convert between various formats, validate - * addresses and safely resolve ENS names. - * - * @_section: api/address:Addresses [about-addresses] - */ -/** - * An interface for objects which have an address, and can - * resolve it asyncronously. - * - * This allows objects such as [[Signer]] or [[Contract]] to - * be used most places an address can be, for example getting - * the [balance](Provider-getBalance). - */ -export interface Addressable { - /** - * Get the object address. - */ - getAddress(): Promise; -} -/** - * Anything that can be used to return or resolve an address. - */ -export type AddressLike = string | Promise | Addressable; -/** - * An interface for any object which can resolve an ENS name. - */ -export interface NameResolver { -} -import { BigNumberish } from "../bigNumber/bigNumber.js"; -declare function calculateCheckSum(_address: string, _prefix: string): string; -/** - * Returns a normalized and checksumed address for %%address%%. - * This accepts non-checksum addresses, checksum addresses and - * [[getIcapAddress]] formats. - * - * The checksum in Core uses the capitalization (upper-case - * vs lower-case) of the characters within an address to encode - * its checksum, which offers, on average, a checksum of 15-bits. - * - * If %%address%% contains both upper-case and lower-case, it is - * assumed to already be a checksum address and its checksum is - * validated, and if the address fails its expected checksum an - * error is thrown. - * - * If you wish the checksum of %%address%% to be ignore, it should - * be converted to lower-case (i.e. ``.toLowercase()``) before - * being passed in. This should be a very rare situation though, - * that you wish to bypass the safegaurds in place to protect - * against an address that has been incorrectly copied from another - * source. - * - * @example: - * // Adds the checksum (via upper-casing specific letters) - * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") - * //_result: - * - * // Converts ICAP address and adds checksum - * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); - * //_result: - * - * // Throws an error if an address contains mixed case, - * // but the checksum fails - * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") - * //_error: - */ -declare function getAddress(address: string): string; -/** - * The [ICAP Address format](link-icap) format is an early checksum - * format which attempts to be compatible with the banking - * industry [IBAN format](link-wiki-iban) for bank accounts. - * - * It is no longer common or a recommended format. - * - * @example: - * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); - * //_result: - * - * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); - * //_result: - * - * // Throws an error if the ICAP checksum is wrong - * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); - * //_error: - */ -declare function getIcapAddress(address: string): string; -declare function networkIdToPrefix(networkId: number): string; -declare function getContractAddress(transaction: { - from: string; - nonce: BigNumberish; -}): string; -export { getAddress, getIcapAddress, calculateCheckSum, networkIdToPrefix, getContractAddress, }; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/address/index.d.ts.map b/types/address/index.d.ts.map deleted file mode 100644 index 3dc38445f..000000000 --- a/types/address/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/address/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,YAAY;CAQ5B;AAED,OAAO,EAAa,YAAY,EAAE,MAAM,2BAA2B,CAAC;AA8BpE,iBAAS,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAkBpE;AA0CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAoB3C;AACD;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAO/C;AAED,iBAAS,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAWpD;AAED,iBAAS,kBAAkB,CAAC,WAAW,EAAE;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,YAAY,CAAC;CACrB,UAmBA;AAED,OAAO,EACL,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,CAAC"} \ No newline at end of file diff --git a/types/bigNumber/bigNumber.d.ts b/types/bigNumber/bigNumber.d.ts deleted file mode 100644 index 089132488..000000000 --- a/types/bigNumber/bigNumber.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Bytes, Hexable } from "../utils/data.js"; -export type BigNumberish = BigNumber | Bytes | bigint | string | number; -export declare function isBigNumberish(value: any): value is BigNumberish; -export declare class BigNumber implements Hexable { - readonly _hex: string; - readonly _isBigNumber: boolean; - constructor(constructorGuard: any, hex: string); - fromTwos(value: number): BigNumber; - toTwos(value: number): BigNumber; - abs(): BigNumber; - add(other: BigNumberish): BigNumber; - sub(other: BigNumberish): BigNumber; - div(other: BigNumberish): BigNumber; - mul(other: BigNumberish): BigNumber; - mod(other: BigNumberish): BigNumber; - pow(other: BigNumberish): BigNumber; - and(other: BigNumberish): BigNumber; - or(other: BigNumberish): BigNumber; - xor(other: BigNumberish): BigNumber; - mask(value: number): BigNumber; - shl(value: number): BigNumber; - shr(value: number): BigNumber; - eq(other: BigNumberish): boolean; - lt(other: BigNumberish): boolean; - lte(other: BigNumberish): boolean; - gt(other: BigNumberish): boolean; - gte(other: BigNumberish): boolean; - isNegative(): boolean; - isZero(): boolean; - toNumber(): number; - toBigInt(): bigint; - toString(): string; - toHexString(): string; - toJSON(key?: string): any; - static from(value: any): BigNumber; - static isBigNumber(value: any): value is BigNumber; -} -export declare function _base36To16(value: string): string; -export declare function _base16To36(value: string): string; -//# sourceMappingURL=bigNumber.d.ts.map \ No newline at end of file diff --git a/types/bigNumber/bigNumber.d.ts.map b/types/bigNumber/bigNumber.d.ts.map deleted file mode 100644 index d71c9db78..000000000 --- a/types/bigNumber/bigNumber.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bigNumber.d.ts","sourceRoot":"","sources":["../../src.ts/bigNumber/bigNumber.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,KAAK,EACL,OAAO,EAIR,MAAM,kBAAkB,CAAC;AAS1B,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAExE,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,YAAY,CAUhE;AAKD,qBAAa,SAAU,YAAW,OAAO;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;gBAEnB,gBAAgB,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM;IAmB9C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAIlC,MAAM,CAAC,KAAK,EAA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;AA6ED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD"} \ No newline at end of file diff --git a/types/constants/addresses.d.ts b/types/constants/addresses.d.ts deleted file mode 100644 index a32d6be03..000000000 --- a/types/constants/addresses.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * A constant for the zero address. - * - * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) - */ -export declare const ZeroAddress: string; -//# sourceMappingURL=addresses.d.ts.map \ No newline at end of file diff --git a/types/constants/addresses.d.ts.map b/types/constants/addresses.d.ts.map deleted file mode 100644 index a67118b65..000000000 --- a/types/constants/addresses.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAqD,CAAC"} \ No newline at end of file diff --git a/types/constants/hashes.d.ts b/types/constants/hashes.d.ts deleted file mode 100644 index 784df7156..000000000 --- a/types/constants/hashes.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * A constant for the zero hash. - * - * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) - */ -export declare const ZeroHash: string; -//# sourceMappingURL=hashes.d.ts.map \ No newline at end of file diff --git a/types/constants/hashes.d.ts.map b/types/constants/hashes.d.ts.map deleted file mode 100644 index ef1df7d58..000000000 --- a/types/constants/hashes.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hashes.d.ts","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,MAC+C,CAAC"} \ No newline at end of file diff --git a/types/constants/index.d.ts b/types/constants/index.d.ts deleted file mode 100644 index ba9ae1821..000000000 --- a/types/constants/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Some common constants useful for Core. - * - * @_section: api/constants: Constants [about-constants] - */ -export { ZeroAddress } from "./addresses.js"; -export { ZeroHash } from "./hashes.js"; -export { N, NegativeOne, Zero, One, Two, OrePerXCB, MaxUint256, MinInt256, MaxInt256, } from "./numbers.js"; -export { CoreSymbol, MessagePrefix } from "./strings.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/constants/index.d.ts.map b/types/constants/index.d.ts.map deleted file mode 100644 index 0c26e029d..000000000 --- a/types/constants/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/constants/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,CAAC,EACD,WAAW,EACX,IAAI,EACJ,GAAG,EACH,GAAG,EACH,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/types/constants/numbers.d.ts b/types/constants/numbers.d.ts deleted file mode 100644 index ac92f9623..000000000 --- a/types/constants/numbers.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * A constant for the order N for the secp256k1 curve. - * - * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) - */ -export declare const N: bigint; -/** - * A constant for the number of ore in a single xcb. - * - * (**i.e.** ``1000000000000000000n``) - */ -export declare const OrePerXCB: bigint; -/** - * A constant for the maximum value for a ``uint256``. - * - * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) - */ -export declare const MaxUint256: bigint; -/** - * A constant for the minimum value for an ``int256``. - * - * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) - */ -export declare const MinInt256: bigint; -/** - * A constant for the maximum value for an ``int256``. - * - * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) - */ -export declare const MaxInt256: bigint; -export declare const NegativeOne: bigint; -export declare const Zero: bigint; -export declare const One: bigint; -export declare const Two: bigint; -//# sourceMappingURL=numbers.d.ts.map \ No newline at end of file diff --git a/types/constants/numbers.d.ts.map b/types/constants/numbers.d.ts.map deleted file mode 100644 index 7e7f487f7..000000000 --- a/types/constants/numbers.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src.ts/constants/numbers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,CAAC,EAAE,MAEf,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAAsC,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAExB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAEZ,CAAC;AAEb;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAEvB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAiC,CAAC;AAC5D,eAAO,MAAM,IAAI,EAAE,MAAgC,CAAC;AACpD,eAAO,MAAM,GAAG,EAAE,MAAgC,CAAC;AACnD,eAAO,MAAM,GAAG,EAAE,MAAgC,CAAC"} \ No newline at end of file diff --git a/types/constants/strings.d.ts b/types/constants/strings.d.ts deleted file mode 100644 index 164253121..000000000 --- a/types/constants/strings.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * A constant for the core symbol (normalized using NFKC). - * - * (**i.e.** ``"\\u039e"``) - */ -export declare const CoreSymbol: string; -/** - * A constant for the [[link-eip-191]] personal message prefix. - * - * (**i.e.** ``"\\x19Core Signed Message:\\n"``) - */ -export declare const MessagePrefix: string; -//# sourceMappingURL=strings.d.ts.map \ No newline at end of file diff --git a/types/constants/strings.d.ts.map b/types/constants/strings.d.ts.map deleted file mode 100644 index 788cc8ce6..000000000 --- a/types/constants/strings.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src.ts/constants/strings.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAAiB,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,MAAqC,CAAC"} \ No newline at end of file diff --git a/types/contract/contract.d.ts b/types/contract/contract.d.ts deleted file mode 100644 index b7a2cd009..000000000 --- a/types/contract/contract.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Indexed, Interface } from "../abi/index.js"; -import { Log, TransactionResponse } from "../providers/provider.js"; -import { ContractTransactionResponse, EventLog } from "./wrappers.js"; -import type { EventFragment, FunctionFragment, InterfaceAbi, ParamType } from "../abi/index.js"; -import type { Addressable } from "../address/index.js"; -import type { EventEmitterable, Listener } from "../utils/index.js"; -import type { BlockTag, ContractRunner } from "../providers/index.js"; -import type { ContractEventName, ContractInterface, ContractMethod, ContractEvent, ContractTransaction, WrappedFallback } from "./types.js"; -/** - * @_ignore: - */ -export declare function copyOverrides(arg: any, allowed?: Array): Promise>; -/** - * @_ignore: - */ -export declare function resolveArgs(_runner: null | ContractRunner, inputs: ReadonlyArray, args: Array): Promise>; -declare const internal: unique symbol; -export declare class BaseContract implements Addressable, EventEmitterable { - readonly target: string | Addressable; - readonly interface: Interface; - readonly runner: null | ContractRunner; - readonly filters: Record; - readonly [internal]: any; - readonly fallback: null | WrappedFallback; - constructor(target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner, _deployTx?: null | TransactionResponse); - connect(runner: null | ContractRunner): BaseContract; - getAddress(): Promise; - getDeployedCode(): Promise; - waitForDeployment(): Promise; - deploymentTransaction(): null | ContractTransactionResponse; - getFunction(key: string | FunctionFragment): T; - getEvent(key: string | EventFragment): ContractEvent; - queryTransaction(hash: string): Promise>; - queryFilter(event: ContractEventName, fromBlock?: BlockTag, toBlock?: BlockTag): Promise>; - on(event: ContractEventName, listener: Listener): Promise; - once(event: ContractEventName, listener: Listener): Promise; - emit(event: ContractEventName, ...args: Array): Promise; - listenerCount(event?: ContractEventName): Promise; - listeners(event?: ContractEventName): Promise>; - off(event: ContractEventName, listener?: Listener): Promise; - removeAllListeners(event?: ContractEventName): Promise; - addListener(event: ContractEventName, listener: Listener): Promise; - removeListener(event: ContractEventName, listener: Listener): Promise; - static buildClass(abi: InterfaceAbi): new (target: string, runner?: null | ContractRunner) => BaseContract & Omit; - static from(target: string, abi: InterfaceAbi, runner?: null | ContractRunner): BaseContract & Omit; - static isIndexed(value: any): value is Indexed; -} -declare const Contract_base: new (target: string, abi: InterfaceAbi, runner?: ContractRunner | null | undefined) => BaseContract & Omit; -export declare class Contract extends Contract_base { -} -export {}; -//# sourceMappingURL=contract.d.ts.map \ No newline at end of file diff --git a/types/contract/contract.d.ts.map b/types/contract/contract.d.ts.map deleted file mode 100644 index d2114f9d0..000000000 --- a/types/contract/contract.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src.ts/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAS,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAEL,GAAG,EACH,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAWlC,OAAO,EAGL,2BAA2B,EAC3B,QAAQ,EACT,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,SAAS,EAEV,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACpE,OA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AO,CAAC,IAAI,CAAC;IAuBjE,kBAAkB,CAAC,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB5D,WAAW,CACf,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,IAAI,CAAC;IAKV,cAAc,CAClB,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,IAAI,CAAC;IAIhB,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,iBAAiB,EACrC,GAAG,EAAE,YAAY,GAChB,KACD,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc,KAC3B,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;IAS/C,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,iBAAiB,EAC/B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,YAAY,EACjB,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc,GAC7B,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;IAO7C,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,OAAO;CAG/C;;AAUD,qBAAa,QAAS,SAAQ,aAAe;CAAG"} \ No newline at end of file diff --git a/types/contract/factory.d.ts b/types/contract/factory.d.ts deleted file mode 100644 index f58d98552..000000000 --- a/types/contract/factory.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Interface } from "../abi/index.js"; -import { BaseContract } from "./contract.js"; -import type { InterfaceAbi } from "../abi/index.js"; -import type { ContractRunner } from "../providers/index.js"; -import type { BytesLike } from "../utils/index.js"; -import type { ContractInterface, ContractMethodArgs, ContractDeployTransaction } from "./types.js"; -import type { ContractTransactionResponse } from "./wrappers.js"; -export declare class ContractFactory = Array, I = BaseContract> { - readonly interface: Interface; - readonly bytecode: string; - readonly runner: null | ContractRunner; - constructor(abi: Interface | InterfaceAbi, bytecode: BytesLike | { - object: string; - }, runner?: null | ContractRunner); - getDeployTransaction(...args: ContractMethodArgs): Promise; - deploy(...args: ContractMethodArgs): Promise>; - connect(runner: null | ContractRunner): ContractFactory; - static fromSolidity = Array, I = ContractInterface>(output: any, runner?: ContractRunner): ContractFactory; -} -//# sourceMappingURL=factory.d.ts.map \ No newline at end of file diff --git a/types/contract/factory.d.ts.map b/types/contract/factory.d.ts.map deleted file mode 100644 index 600026a1b..000000000 --- a/types/contract/factory.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src.ts/contract/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C,OAAO,EAAE,YAAY,EAA8B,MAAM,eAAe,CAAC;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAKjE,qBAAa,eAAe,CAC1B,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,EACjC,CAAC,GAAG,YAAY;IAEhB,QAAQ,CAAC,SAAS,EAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAG,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAG,IAAI,GAAG,cAAc,CAAC;gBAGtC,GAAG,EAAE,SAAS,GAAG,YAAY,EAC7B,QAAQ,EAAE,SAAS,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,EACxC,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc;IA2B1B,oBAAoB,CACxB,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC7B,OAAO,CAAC,yBAAyB,CAAC;IAsB/B,MAAM,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,OAAO,CACnD,YAAY,GAAG;QACb,qBAAqB,IAAI,2BAA2B,CAAC;KACtD,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC,CAChC;IAsBD,OAAO,CAAC,MAAM,EAAE,IAAI,GAAG,cAAc,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAI7D,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,EAC1E,MAAM,EAAE,GAAG,EACX,MAAM,CAAC,EAAE,cAAc,GACtB,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;CAkBzB"} \ No newline at end of file diff --git a/types/contract/index.d.ts b/types/contract/index.d.ts deleted file mode 100644 index 8be93dacb..000000000 --- a/types/contract/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * About contracts... - * - * @_section: api/contract:Contracts [about-contracts] - */ -export { BaseContract, Contract } from "./contract.js"; -export { ContractFactory } from "./factory.js"; -export { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, } from "./wrappers.js"; -export type { BaseContractMethod, ConstantContractMethod, PostfixOverrides, ContractEvent, ContractEventArgs, ContractEventName, ContractDeployTransaction, ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, DeferredTopicFilter, Overrides, WrappedFallback, } from "./types.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/contract/index.d.ts.map b/types/contract/index.d.ts.map deleted file mode 100644 index ce8d05bb5..000000000 --- a/types/contract/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,EACzB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,SAAS,EACT,eAAe,GAChB,MAAM,YAAY,CAAC"} \ No newline at end of file diff --git a/types/contract/types.d.ts b/types/contract/types.d.ts deleted file mode 100644 index cf836c128..000000000 --- a/types/contract/types.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -import type { EventFragment, FunctionFragment, Result, Typed } from "../abi/index.js"; -import type { TransactionRequest, PreparedTransactionRequest, TopicFilter } from "../providers/index.js"; -import type { ContractTransactionResponse } from "./wrappers.js"; -export type ContractEventName = string | ContractEvent | TopicFilter | DeferredTopicFilter; -export interface ContractInterface { - [name: string]: BaseContractMethod; -} -export interface DeferredTopicFilter { - getTopicFilter(): Promise; - fragment: EventFragment; -} -export interface ContractTransaction extends PreparedTransactionRequest { - to: string; - data: string; - from?: string; -} -export interface ContractDeployTransaction extends Omit { -} -export interface Overrides extends Omit { -} -export type PostfixOverrides> = A | [...A, Overrides]; -export type ContractMethodArgs> = PostfixOverrides<{ - [I in keyof A]-?: A[I] | Typed; -}>; -export interface BaseContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { - (...args: ContractMethodArgs): Promise; - name: string; - fragment: FunctionFragment; - getFragment(...args: ContractMethodArgs): FunctionFragment; - populateTransaction(...args: ContractMethodArgs): Promise; - staticCall(...args: ContractMethodArgs): Promise; - send(...args: ContractMethodArgs): Promise; - estimateEnergy(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; -} -export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> extends BaseContractMethod { -} -export interface ConstantContractMethod, R = any> extends ContractMethod { -} -export type ContractEventArgs> = { - [I in keyof A]?: A[I] | Typed | null; -}; -export interface ContractEvent = Array> { - (...args: ContractEventArgs): DeferredTopicFilter; - name: string; - fragment: EventFragment; - getFragment(...args: ContractEventArgs): EventFragment; -} -export interface WrappedFallback { - (overrides?: Omit): Promise; - populateTransaction(overrides?: Omit): Promise; - staticCall(overrides?: Omit): Promise; - send(overrides?: Omit): Promise; - estimateEnergy(overrides?: Omit): Promise; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/types/contract/types.d.ts.map b/types/contract/types.d.ts.map deleted file mode 100644 index d0dd8e022..000000000 --- a/types/contract/types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src.ts/contract/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,KAAK,EACN,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAGjE,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,aAAa,GACb,WAAW,GACX,mBAAmB,CAAC;AAExB,MAAM,WAAW,iBAAiB;IAChC,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACpC;AAED,MAAM,WAAW,mBAAmB;IAClC,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IACvC,QAA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EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC;CAC3D;AAED,MAAM,WAAW,eAAe;IAC9B,CACE,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GACzC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAExC,mBAAmB,CACjB,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GACzC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChC,UAAU,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxE,IAAI,CACF,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GACzC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACxC,cAAc,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7E"} \ No newline at end of file diff --git a/types/contract/wrappers.d.ts b/types/contract/wrappers.d.ts deleted file mode 100644 index 184e06900..000000000 --- a/types/contract/wrappers.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Block, Log, TransactionReceipt, TransactionResponse } from "../providers/provider.js"; -import { EventPayload } from "../utils/index.js"; -import type { EventFragment, Interface, Result } from "../abi/index.js"; -import type { Listener } from "../utils/index.js"; -import type { Provider } from "../providers/index.js"; -import type { BaseContract } from "./contract.js"; -import type { ContractEventName } from "./types.js"; -export declare class EventLog extends Log { - readonly interface: Interface; - readonly fragment: EventFragment; - readonly args: Result; - constructor(log: Log, iface: Interface, fragment: EventFragment); - get eventName(): string; - get eventSignature(): string; -} -export declare class ContractTransactionReceipt extends TransactionReceipt { - #private; - constructor(iface: Interface, provider: Provider, tx: TransactionReceipt); - get logs(): Array; -} -export declare class ContractTransactionResponse extends TransactionResponse { - #private; - constructor(iface: Interface, provider: Provider, tx: TransactionResponse); - wait(confirms?: number): Promise; -} -export declare class ContractUnknownEventPayload extends EventPayload { - readonly log: Log; - constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, log: Log); - getBlock(): Promise; - getTransaction(): Promise; - getTransactionReceipt(): Promise; -} -export declare class ContractEventPayload extends ContractUnknownEventPayload { - readonly fragment: EventFragment; - readonly log: EventLog; - readonly args: Result; - constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, fragment: EventFragment, _log: Log); - get eventName(): string; - get eventSignature(): string; -} -//# sourceMappingURL=wrappers.d.ts.map \ No newline at end of file diff --git a/types/contract/wrappers.d.ts.map b/types/contract/wrappers.d.ts.map deleted file mode 100644 index aa2542479..000000000 --- a/types/contract/wrappers.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wrappers.d.ts","sourceRoot":"","sources":["../../src.ts/contract/wrappers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,GAAG,EACH,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAoB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,qBAAa,QAAS,SAAQ,GAAG;IAC/B,QAAQ,CAAC,SAAS,EAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAG,aAAa,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;gBAEX,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,SAA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,CAE3B;CACF"} \ No newline at end of file diff --git a/types/corebc.d.ts b/types/corebc.d.ts deleted file mode 100644 index 04ae175d8..000000000 --- a/types/corebc.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -export { version } from "./_version.js"; -export { publicToAddress } from "./transaction/address.js"; -export { decodeBytes32String, encodeBytes32String, AbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FallbackFragment, FunctionFragment, NamedFragment, ParamType, StructFragment, checkResultErrors, ErrorDescription, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from "./abi/index.js"; -export { getAddress, networkIdToPrefix } from "./address/index.js"; -export { getCreate2Address, getCreateAddress, } from "./address/contract-address.js"; -export { isAddressable, isAddress, resolveAddress } from "./address/checks.js"; -export { ZeroAddress, OrePerXCB, MaxUint256, MinInt256, MaxInt256, N, ZeroHash, CoreSymbol, MessagePrefix, } from "./constants/index.js"; -export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, EventLog, } from "./contract/index.js"; -export { computeHmac, randomBytes, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Ed448Goldilock, Signature, SigningKey, keccak256, } from "./crypto/index.js"; -export { id, hashMessage, verifyMessage, solidityPacked, solidityPackedSha256, TypedDataEncoder, verifyTypedData, } from "./hash/index.js"; -export { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, NonceManager, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, CloudflareProvider, InfuraProvider, InfuraWebSocketProvider, PocketProvider, QuickNodeProvider, IpcSocketProvider, SocketProvider, WebSocketProvider, Network, FeeDataNetworkPlugin, EnergyCostPlugin, NetworkPlugin, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketSubscriber, UnmanagedSubscriber, copyRequest, showThrottleMessage, } from "./providers/index.js"; -export { accessListify, computeAddress, recoverAddress, Transaction, } from "./transaction/index.js"; -export { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, resolveProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, EventPayload, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatXCB, parseXCB, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp, uuidV4, arrayify, hexConcat, } from "./utils/index.js"; -export { Mnemonic, BaseWallet, HDNodeWallet, Wallet, defaultPath, getAccountPath, getIndexedAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./wallet/index.js"; -export { BigNumber } from "./bigNumber/bigNumber.js"; -export { Wordlist, LangEn, WordlistOwl, WordlistOwlA, wordlists, } from "./wordlists/index.js"; -export type { JsonFragment, JsonFragmentType, FormatType, FragmentType, InterfaceAbi, ParamTypeWalkFunc, ParamTypeWalkAsyncFunc, } from "./abi/index.js"; -export type { Addressable, AddressLike, NameResolver, } from "./address/index.js"; -export type { ConstantContractMethod, ContractEvent, ContractEventArgs, ContractEventName, ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, DeferredTopicFilter, Overrides, BaseContractMethod, ContractDeployTransaction, PostfixOverrides, WrappedFallback, } from "./contract/index.js"; -export type { ProgressCallback, SignatureLike } from "./crypto/index.js"; -export type { TypedDataDomain, TypedDataField } from "./hash/index.js"; -export type { Provider, Signer, AbstractProviderPlugin, BlockParams, BlockTag, ContractRunner, DebugEventBrowserProvider, Eip1193Provider, EventFilter, Filter, FilterByBlockHash, EnergyCostParameters, JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcTransactionRequest, LogParams, MinedBlock, MinedTransactionResponse, Networkish, OrphanFilter, PerformActionFilter, PerformActionRequest, PerformActionTransaction, PreparedTransactionRequest, ProviderEvent, Subscriber, Subscription, TopicFilter, TransactionReceiptParams, TransactionRequest, TransactionResponseParams, WebSocketCreator, WebSocketLike, } from "./providers/index.js"; -export type { AccessList, AccessListish, AccessListEntry, TransactionLike, } from "./transaction/index.js"; -export type { BytesLike, BigNumberish, Numeric, ErrorCode, FixedFormat, Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, RlpStructuredData, GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc, CoreBCError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CodedCoreBCError, CallExceptionAction, CallExceptionTransaction, EventEmitterable, Listener, } from "./utils/index.js"; -export type { CrowdsaleAccount, KeystoreAccount, EncryptOptions, } from "./wallet/index.js"; -//# sourceMappingURL=corebc.d.ts.map \ No newline at end of file diff --git a/types/corebc.d.ts.map b/types/corebc.d.ts.map deleted file mode 100644 index d023fbd11..000000000 --- a/types/corebc.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"corebc.d.ts","sourceRoot":"","sources":["../src.ts/corebc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,QAAQ,EACR,mBAAmB,EACnB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f,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACV,SAAS,EACT,YAAY,EACZ,OAAO,EACP,SAAS,EACT,WAAW,EACX,aAAa,EACb,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,mBAAmB,CAAC"} \ No newline at end of file diff --git a/types/crypto/browser-ed448.d.ts b/types/crypto/browser-ed448.d.ts deleted file mode 100644 index 7aee3772e..000000000 --- a/types/crypto/browser-ed448.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import ed448 from "bcrypto/lib/ed448-browser.js"; -export default ed448; -//# sourceMappingURL=browser-ed448.d.ts.map \ No newline at end of file diff --git a/types/crypto/browser-ed448.d.ts.map b/types/crypto/browser-ed448.d.ts.map deleted file mode 100644 index ac87af8f7..000000000 --- a/types/crypto/browser-ed448.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"browser-ed448.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/browser-ed448.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,8BAA8B,CAAC;AACjD,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/types/crypto/browser-sha3.d.ts b/types/crypto/browser-sha3.d.ts deleted file mode 100644 index 3b83a4fbb..000000000 --- a/types/crypto/browser-sha3.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { BytesLike } from "../utils/data.js"; -import { SupportedAlgorithm } from "./sha3.js"; -export declare function ripemd160(data: BytesLike): string; -export declare function sha256(data: BytesLike): string; -export declare function sha512(data: BytesLike): string; -export declare function computeHmac(algorithm: SupportedAlgorithm, key: BytesLike, data: BytesLike): string; -//# sourceMappingURL=browser-sha3.d.ts.map \ No newline at end of file diff --git a/types/crypto/browser-sha3.d.ts.map b/types/crypto/browser-sha3.d.ts.map deleted file mode 100644 index e40fa9ffd..000000000 --- a/types/crypto/browser-sha3.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"browser-sha3.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/browser-sha3.ts"],"names":[],"mappings":"AAQA,OAAO,EAAY,SAAS,EAAW,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAI/C,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAIjD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAI9C;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAI9C;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,kBAAkB,EAC7B,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,SAAS,GACd,MAAM,CAkBR"} \ No newline at end of file diff --git a/types/crypto/crypto-browser.d.ts b/types/crypto/crypto-browser.d.ts deleted file mode 100644 index c1f839009..000000000 --- a/types/crypto/crypto-browser.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import ed448 from "./browser-ed448.js"; -export { ed448 }; -export { Ed448Goldilock } from "./ed448goldilock-browser.js"; -declare global { - interface Window { - } - const window: Window; - const self: Window; -} -export interface CryptoHasher { - update(data: Uint8Array): CryptoHasher; - digest(): Uint8Array; -} -export declare function createHash(algo: string): CryptoHasher; -export declare function createHmac(_algo: string, key: Uint8Array): CryptoHasher; -export declare function pbkdf2Sync(password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, _algo: "sha256" | "sha512"): Uint8Array; -export declare function randomBytes(length: number): Uint8Array; -//# sourceMappingURL=crypto-browser.d.ts.map \ No newline at end of file diff --git a/types/crypto/crypto-browser.d.ts.map b/types/crypto/crypto-browser.d.ts.map deleted file mode 100644 index 74fb87c78..000000000 --- a/types/crypto/crypto-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"crypto-browser.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/crypto-browser.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,oBAAoB,CAAC;AAGvC,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;KAAG;IAEnB,MAAM,MAAM,EAAE,MAAM,CAAC;IAErB,MAAM,IAAI,EAAE,MAAM,CAAC;CACpB;AAkBD,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAAC;IACvC,MAAM,IAAI,UAAU,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAYrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,GAAG,YAAY,CAIvE;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,UAAU,EACpB,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,QAAQ,GAAG,QAAQ,GACzB,UAAU,CAIZ;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAoBtD"} \ No newline at end of file diff --git a/types/crypto/crypto.d.ts b/types/crypto/crypto.d.ts deleted file mode 100644 index 56e369d6c..000000000 --- a/types/crypto/crypto.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import ed448 from "./ed448.js"; -export { ed448 }; -export { Ed448Goldilock } from "./ed448goldilock.js"; -export { createHash, createHmac, pbkdf2Sync, randomBytes } from "crypto"; -//# sourceMappingURL=crypto.d.ts.map \ No newline at end of file diff --git a/types/crypto/crypto.d.ts.map b/types/crypto/crypto.d.ts.map deleted file mode 100644 index a472d84a5..000000000 --- a/types/crypto/crypto.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/types/crypto/ed448.d.ts b/types/crypto/ed448.d.ts deleted file mode 100644 index 5dfe597f9..000000000 --- a/types/crypto/ed448.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import ed448 from "bcrypto/lib/ed448.js"; -export default ed448; -//# sourceMappingURL=ed448.d.ts.map \ No newline at end of file diff --git a/types/crypto/ed448.d.ts.map b/types/crypto/ed448.d.ts.map deleted file mode 100644 index 19085a96e..000000000 --- a/types/crypto/ed448.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ed448.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,sBAAsB,CAAC;AAEzC,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/types/crypto/ed448goldilock-browser.d.ts b/types/crypto/ed448goldilock-browser.d.ts deleted file mode 100644 index 675f772fa..000000000 --- a/types/crypto/ed448goldilock-browser.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export declare class Ed448Goldilock { - static _channel: any; - static generatePrivateKey(): any; - static getPublicKeyFromPrivateKey(privateKey: string): string; - static signWithPrivateKey(privateKey: string, msg: string): string; - static signWithPrivateKeyNConcatPubkey(privateKey: string, msg: string): string; - static verifySignature(msgHash: string, signedMsg: string, pubKey: string): boolean; - static SHA512Hash(password: string, salt: string): string; - static concatenateAndHex(prefix: number, key: string, index: number, salt: string): string; - static addScalar(a: string, b: string): string; - static seedToExtendedPrivate(seed: string): string; - static childPrivateToPrivate(s: string, index: number): string; - static HDWalletGenerateKeyFromSeed(seed: string, index: number): string; -} -//# sourceMappingURL=ed448goldilock-browser.d.ts.map \ No newline at end of file diff --git a/types/crypto/ed448goldilock-browser.d.ts.map b/types/crypto/ed448goldilock-browser.d.ts.map deleted file mode 100644 index 754f2764a..000000000 --- a/types/crypto/ed448goldilock-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448goldilock-browser.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ed448goldilock-browser.ts"],"names":[],"mappings":"AAOA,qBAAa,cAAc;IACzB,MAAM,CAAC,QAAQ,MAAS;IAExB,MAAM,CAAC,kBAAkB;IAMzB,MAAM,CAAC,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAc7D,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAqBlE,MAAM,CAAC,+BAA+B,CACpC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,GACV,MAAM;IAMT,MAAM,CAAC,eAAe,CACpB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,OAAO;IAIV,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAQzD,MAAM,CAAC,iBAAiB,CACtB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,MAAM;IAaT,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM;IAc9C,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiBlD,MAAM,CAAC,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAgBrD,MAAM,CAAC,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;CASxE"} \ No newline at end of file diff --git a/types/crypto/ed448goldilock.d.ts b/types/crypto/ed448goldilock.d.ts deleted file mode 100644 index 737cae0a1..000000000 --- a/types/crypto/ed448goldilock.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export declare class Ed448Goldilock { - static _channel: any; - static generatePrivateKey(): any; - static getPublicKeyFromPrivateKey(privateKey: string): string; - static signWithPrivateKey(privateKey: string, msg: string): string; - static signWithPrivateKeyNConcatPubkey(privateKey: string, msg: string): string; - static verifySignature(msgHash: string, signedMsg: string, pubKey: string): boolean; - static SHA512Hash(password: string, salt: string): string; - static concatenateAndHex(prefix: number, key: string, index: number, salt: string): string; - static addScalar(a: string, b: string): string; - static seedToExtendedPrivate(seed: string): string; - static childPrivateToPrivate(s: string, index: number): string; - static HDWalletGenerateKeyFromSeed(seed: string, index: number): string; -} -//# sourceMappingURL=ed448goldilock.d.ts.map \ No newline at end of file diff --git a/types/crypto/ed448goldilock.d.ts.map b/types/crypto/ed448goldilock.d.ts.map deleted file mode 100644 index 34092c2fe..000000000 --- a/types/crypto/ed448goldilock.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448goldilock.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ed448goldilock.ts"],"names":[],"mappings":"AAOA,qBAAa,cAAc;IACzB,MAAM,CAAC,QAAQ,MAAS;IAExB,MAAM,CAAC,kBAAkB;IAMzB,MAAM,CAAC,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAc7D,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAqBlE,MAAM,CAAC,+BAA+B,CACpC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,GACV,MAAM;IAMT,MAAM,CAAC,eAAe,CACpB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,OAAO;IAIV,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAQzD,MAAM,CAAC,iBAAiB,CACtB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,MAAM;IAaT,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM;IAc9C,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiBlD,MAAM,CAAC,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAgBrD,MAAM,CAAC,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;CASxE"} \ No newline at end of file diff --git a/types/crypto/hmac.d.ts b/types/crypto/hmac.d.ts deleted file mode 100644 index 4c5e3227d..000000000 --- a/types/crypto/hmac.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { BytesLike } from "../utils/index.js"; -/** - * Return the HMAC for %%data%% using the %%key%% key with the underlying - * %%algo%% used for compression. - * - * @example: - * key = id("some-secret") - * - * // Compute the HMAC - * computeHmac("sha256", key, "0x1337") - * //_result: - * - * // To compute the HMAC of UTF-8 data, the data must be - * // converted to UTF-8 bytes - * computeHmac("sha256", key, toUtf8Bytes("Hello World")) - * //_result: - * - */ -export declare function computeHmac(algorithm: "sha256" | "sha512", _key: BytesLike, _data: BytesLike): string; -export declare namespace computeHmac { - var _: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike; - var lock: () => void; - var register: (func: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike) => void; -} -//# sourceMappingURL=hmac.d.ts.map \ No newline at end of file diff --git a/types/crypto/hmac.d.ts.map b/types/crypto/hmac.d.ts.map deleted file mode 100644 index 49d9b637c..000000000 --- a/types/crypto/hmac.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/hmac.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAcnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAC9B,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,SAAS,GACf,MAAM,CAIR;yBARe,WAAW"} \ No newline at end of file diff --git a/types/crypto/index.d.ts b/types/crypto/index.d.ts deleted file mode 100644 index 0730e25c8..000000000 --- a/types/crypto/index.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A fundamental building block of Core is the underlying - * cryptographic primitives. - * - * @_section: api/crypto:Cryptographic Functions [about-crypto] - */ -import { computeHmac } from "./hmac.js"; -import { ripemd160 } from "./ripemd160.js"; -import { pbkdf2 } from "./pbkdf2.js"; -import { randomBytes } from "./random.js"; -import { scrypt, scryptSync } from "./scrypt.js"; -import { sha256, sha512 } from "./sha3.js"; -import { Ed448Goldilock } from "./crypto.js"; -import { keccak256 } from "./keccak.js"; -export { computeHmac, randomBytes, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, keccak256, Ed448Goldilock, }; -export { SigningKey } from "./signing-key.js"; -export { Signature } from "./signature.js"; -declare function lock(): void; -export { lock }; -export type { ProgressCallback } from "./scrypt.js"; -export type { SignatureLike } from "./signature.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/crypto/index.d.ts.map b/types/crypto/index.d.ts.map deleted file mode 100644 index 153bb6fd7..000000000 --- a/types/crypto/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,cAAc,GACf,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,iBAAS,IAAI,IAAI,IAAI,CAUpB;AAED,OAAO,EAAE,IAAI,EAAE,CAAC;AAKhB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/types/crypto/keccak.d.ts b/types/crypto/keccak.d.ts deleted file mode 100644 index 533f46dc6..000000000 --- a/types/crypto/keccak.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Cryptographic hashing functions - * - * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] - */ -import type { BytesLike } from "../utils/index.js"; -/** - * Compute the cryptographic KECCAK256 hash of %%data%%. - * - * The %%data%% **must** be a data representation, to compute the - * hash of UTF-8 data use the [[id]] function. - * - * @returns DataHexstring - * @example: - * keccak256("0x") - * //_result: - * - * keccak256("0x1337") - * //_result: - * - * keccak256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - * // Strings are assumed to be DataHexString, otherwise it will - * // throw. To hash UTF-8 data, see the note above. - * keccak256("Hello World") - * //_error: - */ -export declare function keccak256(_data: BytesLike): string; -export declare namespace keccak256 { - var _: (data: Uint8Array) => Uint8Array; - var lock: () => void; - var register: (func: (data: Uint8Array) => BytesLike) => void; -} -//# sourceMappingURL=keccak.d.ts.map \ No newline at end of file diff --git a/types/crypto/keccak.d.ts.map b/types/crypto/keccak.d.ts.map deleted file mode 100644 index 2f0a88fb1..000000000 --- a/types/crypto/keccak.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keccak.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/keccak.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAUnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGlD;yBAHe,SAAS"} \ No newline at end of file diff --git a/types/crypto/pbkdf2-browser.d.ts b/types/crypto/pbkdf2-browser.d.ts deleted file mode 100644 index 31ae18ebe..000000000 --- a/types/crypto/pbkdf2-browser.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import pbkdf2 from "bcrypto/lib/pbkdf2-browser.js"; -export default pbkdf2; -//# sourceMappingURL=pbkdf2-browser.d.ts.map \ No newline at end of file diff --git a/types/crypto/pbkdf2-browser.d.ts.map b/types/crypto/pbkdf2-browser.d.ts.map deleted file mode 100644 index a7519b4b4..000000000 --- a/types/crypto/pbkdf2-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pbkdf2-browser.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2-browser.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/types/crypto/pbkdf2.d.ts b/types/crypto/pbkdf2.d.ts deleted file mode 100644 index 400e9744f..000000000 --- a/types/crypto/pbkdf2.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * A **Password-Based Key-Derivation Function** is designed to create - * a sequence of bytes suitible as a **key** from a human-rememberable - * password. - * - * @_subsection: api/crypto:Passwords [about-pbkdf] - */ -import type { BytesLike } from "../utils/index.js"; -/** - * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using - * the %%salt%% and using %%iterations%% of %%algo%%. - * - * This PBKDF is outdated and should not be used in new projects, but is - * required to decrypt older files. - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the PBKDF2 - * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") - * //_result: - */ -export declare function pbkdf2(_password: BytesLike, _salt: BytesLike, iterations: number, keylen: number, algo: "sha256" | "sha512"): string; -export declare namespace pbkdf2 { - var _: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike; - var lock: () => void; - var register: (func: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike) => void; -} -//# sourceMappingURL=pbkdf2.d.ts.map \ No newline at end of file diff --git a/types/crypto/pbkdf2.d.ts.map b/types/crypto/pbkdf2.d.ts.map deleted file mode 100644 index 99323c18c..000000000 --- a/types/crypto/pbkdf2.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pbkdf2.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAgBnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CACpB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,QAAQ,GAAG,QAAQ,GACxB,MAAM,CAIR;yBAVe,MAAM"} \ No newline at end of file diff --git a/types/crypto/random.d.ts b/types/crypto/random.d.ts deleted file mode 100644 index fd9378000..000000000 --- a/types/crypto/random.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Return %%length%% bytes of cryptographically secure random data. - * - * @example: - * randomBytes(8) - * //_result: - */ -export declare function randomBytes(length: number): Uint8Array; -export declare namespace randomBytes { - var _: (length: number) => Uint8Array; - var lock: () => void; - var register: (func: (length: number) => Uint8Array) => void; -} -//# sourceMappingURL=random.d.ts.map \ No newline at end of file diff --git a/types/crypto/random.d.ts.map b/types/crypto/random.d.ts.map deleted file mode 100644 index a907fd7ef..000000000 --- a/types/crypto/random.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAEtD;yBAFe,WAAW"} \ No newline at end of file diff --git a/types/crypto/ripemd160.d.ts b/types/crypto/ripemd160.d.ts deleted file mode 100644 index 27b7b4a1c..000000000 --- a/types/crypto/ripemd160.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { BytesLike } from "../utils/index.js"; -/** - * Compute the cryptographic RIPEMD-160 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * ripemd160("0x") - * //_result: - * - * ripemd160("0x1337") - * //_result: - * - * ripemd160(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ -export declare function ripemd160(_data: BytesLike): string; -export declare namespace ripemd160 { - var _: (data: Uint8Array) => Uint8Array; - var lock: () => void; - var register: (func: (data: Uint8Array) => BytesLike) => void; -} -//# sourceMappingURL=ripemd160.d.ts.map \ No newline at end of file diff --git a/types/crypto/ripemd160.d.ts.map b/types/crypto/ripemd160.d.ts.map deleted file mode 100644 index 2eb29db41..000000000 --- a/types/crypto/ripemd160.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ripemd160.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ripemd160.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAUnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGlD;yBAHe,SAAS"} \ No newline at end of file diff --git a/types/crypto/rlp.d.ts b/types/crypto/rlp.d.ts deleted file mode 100644 index 42970ab48..000000000 --- a/types/crypto/rlp.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { BytesLike } from "../utils/data.js"; -export declare function encode(object: any): string; -export declare function decode(data: BytesLike): any; -//# sourceMappingURL=rlp.d.ts.map \ No newline at end of file diff --git a/types/crypto/rlp.d.ts.map b/types/crypto/rlp.d.ts.map deleted file mode 100644 index 6c9570fb1..000000000 --- a/types/crypto/rlp.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/rlp.ts"],"names":[],"mappings":"AAGA,OAAO,EAAY,SAAS,EAAwB,MAAM,kBAAkB,CAAC;AA+D7E,wBAAgB,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAE1C;AAkHD,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,GAAG,CAO3C"} \ No newline at end of file diff --git a/types/crypto/scrypt.d.ts b/types/crypto/scrypt.d.ts deleted file mode 100644 index b0e678f52..000000000 --- a/types/crypto/scrypt.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -import type { BytesLike } from "../utils/index.js"; -/** - * A callback during long-running operations to update any - * UI or provide programatic access to the progress. - * - * The %%percent%% is a value between ``0`` and ``1``. - * - * @_docloc: api/crypto:Passwords - */ -export type ProgressCallback = (percent: number) => void; -/** - * The [[link-wiki-scrypt]] uses a memory and cpu hard method of - * derivation to increase the resource cost to brute-force a password - * for a given key. - * - * This means this algorithm is intentionally slow, and can be tuned to - * become slower. As computation and memory speed improve over time, - * increasing the difficulty maintains the cost of an attacker. - * - * For example, if a target time of 5 seconds is used, a legitimate user - * which knows their password requires only 5 seconds to unlock their - * account. A 6 character password has 68 billion possibilities, which - * would require an attacker to invest over 10,000 years of CPU time. This - * is of course a crude example (as password generally aren't random), - * but demonstrates to value of imposing large costs to decryption. - * - * For this reason, if building a UI which involved decrypting or - * encrypting datsa using scrypt, it is recommended to use a - * [[ProgressCallback]] (as event short periods can seem lik an eternity - * if the UI freezes). Including the phrase //"decrypting"// in the UI - * can also help, assuring the user their waiting is for a good reason. - * - * @_docloc: api/crypto:Passwords - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the scrypt - * scrypt(passwordBytes, salt, 1024, 8, 1, 16) - * //_result: - */ -export declare function scrypt(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback): Promise; -export declare namespace scrypt { - var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, onProgress?: ProgressCallback | undefined) => Promise; - var lock: () => void; - var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback | undefined) => Promise) => void; -} -/** - * Provides a synchronous variant of [[scrypt]]. - * - * This will completely lock up and freeze the UI in a browser and will - * prevent any event loop from progressing. For this reason, it is - * preferred to use the [async variant](scrypt). - * - * @_docloc: api/crypto:Passwords - * - * @example: - * // The password must be converted to bytes, and it is generally - * // best practices to ensure the string has been normalized. Many - * // formats explicitly indicate the normalization form to use. - * password = "hello" - * passwordBytes = toUtf8Bytes(password, "NFKC") - * - * salt = id("some-salt") - * - * // Compute the scrypt - * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) - * //_result: - */ -export declare function scryptSync(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number): string; -export declare namespace scryptSync { - var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => Uint8Array; - var lock: () => void; - var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => BytesLike) => void; -} -//# sourceMappingURL=scrypt.d.ts.map \ No newline at end of file diff --git a/types/crypto/scrypt.d.ts.map b/types/crypto/scrypt.d.ts.map deleted file mode 100644 index b8a706e0e..000000000 --- a/types/crypto/scrypt.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scrypt.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/scrypt.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AA6CzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,MAAM,CAC1B,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,SAAS,EAChB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAIjB;yBAZqB,MAAM;;;;;AAmC5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,SAAS,EAChB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,GACZ,MAAM,CAIR;yBAXe,UAAU"} \ No newline at end of file diff --git a/types/crypto/sha3.d.ts b/types/crypto/sha3.d.ts deleted file mode 100644 index e9130d128..000000000 --- a/types/crypto/sha3.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { BytesLike } from "../utils/data.js"; -/** - * Compute the cryptographic SHA2-256 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha256("0x") - * //_result: - * - * sha256("0x1337") - * //_result: - * - * sha256(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - * - */ -export declare enum SupportedAlgorithm { - sha256 = "sha256", - sha512 = "sha512" -} -export declare function ripemd160(data: BytesLike): string; -export declare function sha256(data: BytesLike): string; -export declare namespace sha256 { - var _: (data: Uint8Array) => string; - var lock: () => void; - var register: (func: (data: Uint8Array) => BytesLike) => void; -} -export declare function legacySha256(data: BytesLike): string; -export declare function computeHmac(algorithm: SupportedAlgorithm, key: BytesLike, data: BytesLike): string; -/** - * Compute the cryptographic SHA2-512 hash of %%data%%. - * - * @_docloc: api/crypto:Hash Functions - * @returns DataHexstring - * - * @example: - * sha512("0x") - * //_result: - * - * sha512("0x1337") - * //_result: - * - * sha512(new Uint8Array([ 0x13, 0x37 ])) - * //_result: - */ -export declare function sha512(data: BytesLike): string; -export declare namespace sha512 { - var _: (data: Uint8Array) => string; - var lock: () => void; - var register: (func: (data: Uint8Array) => BytesLike) => void; -} -//# sourceMappingURL=sha3.d.ts.map \ No newline at end of file diff --git a/types/crypto/sha3.d.ts.map b/types/crypto/sha3.d.ts.map deleted file mode 100644 index 62d2f90aa..000000000 --- a/types/crypto/sha3.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha3.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/sha3.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,SAAS,EAAqB,MAAM,kBAAkB,CAAC;AAgC1E;;;;;;;;;;;;;;;;GAgBG;AACH,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAYjD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAU9C;yBAVe,MAAM;;;;;AAYtB,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAIpD;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,kBAAkB,EAC7B,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,SAAS,GACd,MAAM,CAkBR;AAcD;;;;;;;;;;;;;;;GAeG;AAEH,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAU9C;yBAVe,MAAM"} \ No newline at end of file diff --git a/types/crypto/signature.d.ts b/types/crypto/signature.d.ts deleted file mode 100644 index 075005c42..000000000 --- a/types/crypto/signature.d.ts +++ /dev/null @@ -1,131 +0,0 @@ -import type { BigNumberish, BytesLike } from "../utils/index.js"; -/** - * A SignatureLike - * - * @_docloc: api/crypto:Signing - */ -export type SignatureLike = string; -/** - * A Signature @TODO - * - * - * @_docloc: api/crypto:Signing - */ -export declare class Signature { - #private; - /** - * The ``r`` value for a signautre. - * - * This represents the ``x`` coordinate of a "reference" or - * challenge point, from which the ``y`` can be computed. - */ - get r(): string; - set r(value: BytesLike); - /** - * The ``s`` value for a signature. - */ - get s(): string; - set s(_value: BytesLike); - /** - * The ``v`` value for a signature. - * - * Since a given ``x`` value for ``r`` has two possible values for - * its correspondin ``y``, the ``v`` indicates which of the two ``y`` - * values to use. - * - * It is normalized to the values ``27`` or ``28`` for legacy - * purposes. - */ - get v(): 27 | 28; - set v(value: BigNumberish); - /** - * The EIP-155 ``v`` for legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get networkV(): null | bigint; - /** - * The chain ID for EIP-155 legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get legacynetworkId(): null | bigint; - /** - * The ``yParity`` for the signature. - * - * See ``v`` for more details on how this value is used. - */ - get yParity(): 0 | 1; - /** - * The [[link-eip-2098]] compact representation of the ``yParity`` - * and ``s`` compacted into a single ``bytes32``. - */ - get yParityAndS(): string; - /** - * The [[link-eip-2098]] compact representation. - */ - get compactSerialized(): string; - /** - * The serialized representation. - */ - get serialized(): string; - /** - * @private - */ - constructor(guard: any, r: string, s: string, v: 27 | 28); - /** - * Returns a new identical [[Signature]]. - */ - clone(): Signature; - /** - * Returns a representation that is compatible with ``JSON.stringify``. - */ - toJSON(): any; - /** - * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. - * - * @example: - * Signature.getnetworkId(45) - * //_result: - * - * Signature.getnetworkId(46) - * //_result: - */ - static getnetworkId(v: BigNumberish): bigint; - /** - * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. - * - * Legacy transactions which use [[link-eip-155]] hijack the ``v`` - * property to include the chain ID. - * - * @example: - * Signature.getnetworkIdV(5, 27) - * //_result: - * - * Signature.getnetworkIdV(5, 28) - * //_result: - * - */ - static getnetworkIdV(networkId: BigNumberish, v: 27 | 28): bigint; - /** - * Compute the normalized legacy transaction ``v`` from a ``yParirty``, - * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. - * - * @example: - * // The values 0 and 1 imply v is actually yParity - * Signature.getNormalizedV(0) - * //_result: - * - * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) - * Signature.getNormalizedV(27) - * //_result: - * - * // Legacy EIP-155 transaction (i.e. >= 35) - * Signature.getNormalizedV(46) - * //_result: - * - * // Invalid values throw - * Signature.getNormalizedV(5) - * //_error: - */ - static getNormalizedV(v: BigNumberish): 27 | 28; -} -//# sourceMappingURL=signature.d.ts.map \ No newline at end of file diff --git a/types/crypto/signature.d.ts.map b/types/crypto/signature.d.ts.map deleted file mode 100644 index 83d7e9f37..000000000 --- a/types/crypto/signature.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signature.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAcjE;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC;;;;;GAKG;AACH,qBAAa,SAAS;;IAMpB;;;;;OAKG;IACH,IAAI,CAAC,IAAI,MAAM,CAEd;IACD,IAAI,CAAC,CAAC,KAAK,EAAE,SAAS,EAGrB;IAED;;OAEG;IACH,IAAI,CAAC,IAAI,MAAM,CAEd;IACD,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,EAUtB;IAED;;;;;;;;;OASG;IACH,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAEf;IACD,IAAI,CAAC,CAAC,KAAK,EAAE,YAAY,EAIxB;IAED;;;OAGG;IACH,IAAI,QAAQ,IAAI,IAAI,GAAG,MAAM,CAE5B;IAED;;;OAGG;IACH,IAAI,eAAe,IAAI,IAAI,GAAG,MAAM,CAMnC;IAED;;;;OAIG;IACH,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,CAEnB;IAED;;;OAGG;IACH,IAAI,WAAW,IAAI,MAAM,CAOxB;IAED;;OAEG;IACH,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE;IAYxD;;OAEG;IACH,KAAK,IAAI,SAAS;IAQlB;;OAEG;IACH,MAAM,IAAI,GAAG;IAWb;;;;;;;;;OASG;IACH,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM;IAc5C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,MAAM;IAIjE;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,YAAY,GAAG,EAAE,GAAG,EAAE;CAwBhD"} \ No newline at end of file diff --git a/types/crypto/signing-key.d.ts b/types/crypto/signing-key.d.ts deleted file mode 100644 index a030dac26..000000000 --- a/types/crypto/signing-key.d.ts +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Add details about signing here. - * - * @_subsection: api/crypto:Signing [about-signing] - */ -import type { BytesLike } from "../utils/index.js"; -import type { SignatureLike } from "./index.js"; -/** - * A **SigningKey** provides high-level access to the elliptic curve - * cryptography (ECC) operations and key management. - */ -export declare class SigningKey { - #private; - /** - * Creates a new **SigningKey** for %%privateKey%%. - */ - constructor(privateKey: BytesLike); - /** - * The private key. - */ - get privateKey(): string; - /** - * The uncompressed public key. - * - * This will always begin with the prefix ``0x04`` and be 132 - * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). - */ - get publicKey(): string; - /** - * The compressed public key. - * - * This will always begin with either the prefix ``0x02`` or ``0x03`` - * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal - * nibbles) - */ - get compressedPublicKey(): string; - /** - * Return the signature of the signed %%digest%%. - */ - sign(digest: BytesLike): string; - /** - * Returns the [[link-wiki-ecdh]] shared secret between this - * private key and the %%other%% key. - * - * The %%other%% key may be any type of key, a raw public key, - * a compressed/uncompressed pubic key or aprivate key. - * - * Best practice is usually to use a cryptographic hash on the - * returned value before using it as a symetric secret. - * - * @example: - * sign1 = new SigningKey(id("some-secret-1")) - * sign2 = new SigningKey(id("some-secret-2")) - * - * // Notice that privA.computeSharedSecret(pubB)... - * sign1.computeSharedSecret(sign2.publicKey) - * //_result: - * - * // ...is equal to privB.computeSharedSecret(pubA). - * sign2.computeSharedSecret(sign1.publicKey) - * //_result: - */ - computeSharedSecret(other: BytesLike): string; - /** - * Compute the public key for %%key%%, optionally %%compressed%%. - * - * The %%key%% may be any type of key, a raw public key, a - * compressed/uncompressed public key or private key. - * - * @example: - * sign = new SigningKey(id("some-secret")); - * - * // Compute the uncompressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey) - * //_result: - * - * // Compute the compressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey, true) - * //_result: - * - * // Compute the uncompressed public key - * SigningKey.computePublicKey(sign.publicKey, false); - * //_result: - * - * // Compute the Compressed a public key - * SigningKey.computePublicKey(sign.publicKey, true); - * //_result: - */ - static computePublicKey(key: BytesLike, compressed?: boolean): string; - /** - * Returns the public key for the private key which produced the - * %%signature%% for the given %%digest%%. - * - * @example: - * key = new SigningKey(id("some-secret")) - * digest = id("hello world") - * sig = key.sign(digest) - * - * // Notice the signer public key... - * key.publicKey - * //_result: - * - * // ...is equal to the recovered public key - * SigningKey.recoverPublicKey(digest, sig) - * //_result: - * - */ - static recoverPublicKey(digest: BytesLike, signature: SignatureLike): string; - /** - * Returns the point resulting from adding the ellipic curve points - * %%p0%% and %%p1%%. - * - * This is not a common function most developers should require, but - * can be useful for certain privacy-specific techniques. - * - * For example, it is used by [[HDNodeWallet]] to compute child - * addresses from parent public keys and chain codes. - */ - static addPoints(p0: BytesLike, p1: BytesLike, compressed?: boolean): string; -} -//# sourceMappingURL=signing-key.d.ts.map \ No newline at end of file diff --git a/types/crypto/signing-key.d.ts.map b/types/crypto/signing-key.d.ts.map deleted file mode 100644 index b5aea9127..000000000 --- a/types/crypto/signing-key.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signing-key.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAYhD;;;GAGG;AACH,qBAAa,UAAU;;IAGrB;;OAEG;gBACS,UAAU,EAAE,SAAS;IAcjC;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;;;;OAKG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;;;;;OAMG;IACH,IAAI,mBAAmB,IAAI,MAAM,CAEhC;IAED;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM;IAmC/B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAU7C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;IAkBrE;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM;IAqB5E;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;CAS7E"} \ No newline at end of file diff --git a/types/hash/id.d.ts b/types/hash/id.d.ts deleted file mode 100644 index c55374a67..000000000 --- a/types/hash/id.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * A simple hashing function which operates on UTF-8 strings to - * compute an 32-byte identifier. - * - * - * @example: - * id("hello world") - * //_result: - */ -export declare function id(value: string, useKeccak?: boolean): string; -//# sourceMappingURL=id.d.ts.map \ No newline at end of file diff --git a/types/hash/id.d.ts.map b/types/hash/id.d.ts.map deleted file mode 100644 index 140f79634..000000000 --- a/types/hash/id.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../src.ts/hash/id.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,wBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAK7D"} \ No newline at end of file diff --git a/types/hash/index.d.ts b/types/hash/index.d.ts deleted file mode 100644 index a9ba6fa23..000000000 --- a/types/hash/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * About hashing here... - * - * @_section: api/hashing:Hashing Utilities [about-hashing] - */ -export { id } from "./id.js"; -export { hashMessage, verifyMessage } from "./message.js"; -export { solidityPacked, solidityPackedSha256 } from "./solidity.js"; -export { TypedDataEncoder, verifyTypedData } from "./typed-data.js"; -export type { TypedDataDomain, TypedDataField } from "./typed-data.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/hash/index.d.ts.map b/types/hash/index.d.ts.map deleted file mode 100644 index 70eb7509e..000000000 --- a/types/hash/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/types/hash/message.d.ts b/types/hash/message.d.ts deleted file mode 100644 index c7776facd..000000000 --- a/types/hash/message.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { SignatureLike } from "../crypto/index.js"; -/** - * Computes the [[link-eip-191]] personal-sign message digest to sign. - * - * - * If %%message%% is a string, it is converted to its UTF-8 bytes - * first. To compute the digest of a [[DataHexString]], it must be converted - * to [bytes](getBytes). - * - * @example: - * hashMessage("Hello World") - * //_result: - * - * // Hashes the SIX (6) string characters, i.e. - * // [ "0", "x", "4", "2", "4", "3" ] - * hashMessage("0x4243") - * //_result: - * - * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... - * hashMessage(getBytes("0x4243")) - * //_result: - * - * // ...which is equal to using data - * hashMessage(new Uint8Array([ 0x42, 0x43 ])) - * //_result: - * - */ -export declare function hashMessage(message: Uint8Array | string): string; -/** - * Return the address of the private key that produced - * the signature %%sig%% during signing for %%message%%. - */ -export declare function verifyMessage(message: Uint8Array | string, sig: SignatureLike, prefix: string): string; -//# sourceMappingURL=message.d.ts.map \ No newline at end of file diff --git a/types/hash/message.d.ts.map b/types/hash/message.d.ts.map deleted file mode 100644 index 76c7dfa70..000000000 --- a/types/hash/message.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src.ts/hash/message.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC3D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAWhE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,UAAU,GAAG,MAAM,EAC5B,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,MAAM,GACb,MAAM,CAGR"} \ No newline at end of file diff --git a/types/hash/solidity.d.ts b/types/hash/solidity.d.ts deleted file mode 100644 index f6e66a454..000000000 --- a/types/hash/solidity.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Computes the [[link-solc-packed]] representation of %%values%% - * respectively to their %%types%%. - * - * @example: - * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" - * solidityPacked([ "address", "uint" ], [ addr, 45 ]); - * //_result: - */ -export declare function solidityPacked(types: ReadonlyArray, values: ReadonlyArray): string; -/** - * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% - * respectively to their %%types%%. - * - * @example: - * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" - * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); - * //_result: - */ -export declare function solidityPackedSha256(types: ReadonlyArray, values: ReadonlyArray): string; -//# sourceMappingURL=solidity.d.ts.map \ No newline at end of file diff --git a/types/hash/solidity.d.ts.map b/types/hash/solidity.d.ts.map deleted file mode 100644 index 251b44140..000000000 --- a/types/hash/solidity.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"solidity.d.ts","sourceRoot":"","sources":["../../src.ts/hash/solidity.ts"],"names":[],"mappings":"AA8GA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GACzB,MAAM,CAaR;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GACzB,MAAM,CAER"} \ No newline at end of file diff --git a/types/hash/typed-data.d.ts b/types/hash/typed-data.d.ts deleted file mode 100644 index 76130b694..000000000 --- a/types/hash/typed-data.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import type { BigNumberish, BytesLike } from "../utils/index.js"; -export interface TypedDataDomain { - name?: null | string; - version?: null | string; - networkId?: null | BigNumberish; - verifyingContract?: null | string; - salt?: null | BytesLike; -} -export interface TypedDataField { - name: string; - type: string; -} -export declare class TypedDataEncoder { - #private; - readonly primaryType: string; - get types(): Record>; - constructor(types: Record>); - getEncoder(type: string): (value: any) => string; - encodeType(name: string): string; - encodeData(type: string, value: any): string; - hashStruct(name: string, value: Record): string; - encode(value: Record): string; - hash(value: Record): string; - _visit(type: string, value: any, callback: (type: string, data: any) => any): any; - visit(value: Record, callback: (type: string, data: any) => any): any; - static from(types: Record>): TypedDataEncoder; - static getPrimaryType(types: Record>): string; - static hashStruct(name: string, types: Record>, value: Record): string; - static hashDomain(domain: TypedDataDomain): string; - static encode(domain: TypedDataDomain, types: Record>, value: Record): string; - static hash(domain: TypedDataDomain, types: Record>, value: Record): string; - static resolveNames(domain: TypedDataDomain, types: Record>, value: Record, resolveName: (name: string) => Promise): Promise<{ - domain: TypedDataDomain; - value: any; - }>; - static getPayload(domain: TypedDataDomain, types: Record>, value: Record): any; -} -/** - * Compute the address used to sign the typed data for the %%signature%%. - */ -export declare function verifyTypedData(domain: TypedDataDomain, types: Record>, value: Record, signature: string, prefix: string): string; -//# sourceMappingURL=typed-data.d.ts.map \ No newline at end of file diff --git a/types/hash/typed-data.d.ts.map b/types/hash/typed-data.d.ts.map deleted file mode 100644 index fc4135d06..000000000 --- a/types/hash/typed-data.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"typed-data.d.ts","sourceRoot":"","sources":["../../src.ts/hash/typed-data.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAYjE,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAChC,iBAAiB,CAAC,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,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,GAAG;CAkEP;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,MAAM,CAMR"} \ No newline at end of file diff --git a/types/index.d.ts b/types/index.d.ts deleted file mode 100644 index 3fd593002..000000000 --- a/types/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * The Application Programming Interface (API) is the collection of - * functions, classes and types offered by the CoreBC library. - * - * @_section: api:Application Programming Interface [about-api] - * @_navTitle: API - */ -import { Buffer } from "buffer"; -export { Buffer }; -import * as corebc from "./corebc.js"; -export { corebc }; -export * from "./corebc.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/index.d.ts.map b/types/index.d.ts.map deleted file mode 100644 index 5841be6e6..000000000 --- a/types/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,cAAc,aAAa,CAAC"} \ No newline at end of file diff --git a/types/logger/logger.d.ts b/types/logger/logger.d.ts deleted file mode 100644 index df72240a3..000000000 --- a/types/logger/logger.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -export declare enum LogLevel { - DEBUG = "DEBUG", - INFO = "INFO", - WARNING = "WARNING", - ERROR = "ERROR", - OFF = "OFF" -} -export declare enum ErrorCode { - UNKNOWN_ERROR = "UNKNOWN_ERROR", - NOT_IMPLEMENTED = "NOT_IMPLEMENTED", - UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", - NETWORK_ERROR = "NETWORK_ERROR", - SERVER_ERROR = "SERVER_ERROR", - TIMEOUT = "TIMEOUT", - BUFFER_OVERRUN = "BUFFER_OVERRUN", - NUMERIC_FAULT = "NUMERIC_FAULT", - MISSING_NEW = "MISSING_NEW", - INVALID_ARGUMENT = "INVALID_ARGUMENT", - MISSING_ARGUMENT = "MISSING_ARGUMENT", - UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", - CALL_EXCEPTION = "CALL_EXCEPTION", - INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", - NONCE_EXPIRED = "NONCE_EXPIRED", - REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", - UNPREDICTABLE_ENERGY_LIMIT = "UNPREDICTABLE_ENERGY_LIMIT", - TRANSACTION_REPLACED = "TRANSACTION_REPLACED" -} -export declare class Logger { - readonly version: string; - static errors: typeof ErrorCode; - static levels: typeof LogLevel; - constructor(version: string); - _log(logLevel: LogLevel, args: Array): void; - debug(...args: Array): void; - info(...args: Array): void; - warn(...args: Array): void; - makeError(message: string, code?: ErrorCode, params?: any): Error; - throwError(message: string, code?: ErrorCode, params?: any): never; - throwArgumentError(message: string, name: string, value: any): never; - assert(condition: any, message: string, code?: ErrorCode, params?: any): void; - assertArgument(condition: any, message: string, name: string, value: any): void; - checkNormalize(message?: string): void; - checkSafeUint53(value: number, message?: string): void; - checkArgumentCount(count: number, expectedCount: number, message?: string): void; - checkNew(target: any, kind: any): void; - checkAbstract(target: any, kind: any): void; - static globalLogger(): Logger; - static setCensorship(censorship: boolean, permanent?: boolean): void; - static setLogLevel(logLevel: LogLevel): void; - static from(version: string): Logger; -} -//# sourceMappingURL=logger.d.ts.map \ No newline at end of file diff --git a/types/logger/logger.d.ts.map b/types/logger/logger.d.ts.map deleted file mode 100644 index f1ca4504f..000000000 --- a/types/logger/logger.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src.ts/logger/logger.ts"],"names":[],"mappings":"AAmDA,oBAAY,QAAQ;IAClB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,GAAG,QAAQ;CACZ;AAED,oBAAY,SAAS;IAKnB,aAAa,kBAAkB;IAG/B,eAAe,oBAAoB;IAInC,qBAAqB,0BAA0B;IAI/C,aAAa,kBAAkB;IAG/B,YAAY,iBAAiB;IAG7B,OAAO,YAAY;IAMnB,cAAc,mBAAmB;IAKjC,aAAa,kBAAkB;IAO/B,WAAW,gBAAgB;IAK3B,gBAAgB,qBAAqB;IAKrC,gBAAgB,qBAAqB;IAKrC,mBAAmB,wBAAwB;IAa3C,cAAc,mBAAmB;IAIjC,kBAAkB,uBAAuB;IAIzC,aAAa,kBAAkB;IAI/B,uBAAuB,4BAA4B;IAInD,0BAA0B,+BAA+B;IAQzD,oBAAoB,yBAAyB;CAC9C;AAID,qBAAa,MAAM;IACjB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAW;IAEnC,MAAM,CAAC,MAAM,mBAAa;IAE1B,MAAM,CAAC,MAAM,kBAAY;gBAEb,OAAO,EAAE,MAAM;IAQ3B,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI;IAWhD,KAAK,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI;IAIhC,IAAI,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI;IAI/B,IAAI,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI;IAI/B,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,KAAK;IAmDjE,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,KAAK;IAIlE,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK;IAOpE,MAAM,CACJ,SAAS,EAAE,GAAG,EACd,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,SAAS,EAChB,MAAM,CAAC,EAAE,GAAG,GACX,IAAI;IAOP,cAAc,CACZ,SAAS,EAAE,GAAG,EACd,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,GAAG,GACT,IAAI;IAOP,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAgBtC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IA0BtD,kBAAkB,CAChB,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM,GACf,IAAI;IA8BP,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI;IAQtC,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI;IAgB3C,MAAM,CAAC,YAAY,IAAI,MAAM;IAO7B,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI;IA4BpE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAS5C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAGrC"} \ No newline at end of file diff --git a/types/providers/abstract-provider.d.ts b/types/providers/abstract-provider.d.ts deleted file mode 100644 index 79ee0dee3..000000000 --- a/types/providers/abstract-provider.d.ts +++ /dev/null @@ -1,211 +0,0 @@ -/** - * About Subclassing the Provider... - * - * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] - */ -import { FetchRequest } from "../utils/index.js"; -import { Network } from "./network.js"; -import { Block, FeeData, Log, TransactionReceipt, TransactionResponse } from "./provider.js"; -import type { AddressLike } from "../address/index.js"; -import type { BigNumberish } from "../utils/index.js"; -import type { Listener } from "../utils/index.js"; -import type { Networkish } from "./network.js"; -import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; -import type { BlockTag, EventFilter, Filter, FilterByBlockHash, OrphanFilter, PreparedTransactionRequest, Provider, ProviderEvent, TransactionRequest } from "./provider.js"; -export type DebugEventAbstractProvider = { - action: "sendCcipReadFetchRequest"; - request: FetchRequest; - index: number; - urls: Array; -} | { - action: "receiveCcipReadFetchResult"; - request: FetchRequest; - result: any; -} | { - action: "receiveCcipReadFetchError"; - request: FetchRequest; - result: any; -} | { - action: "sendCcipReadCall"; - transaction: { - to: string; - data: string; - }; -} | { - action: "receiveCcipReadCallResult"; - transaction: { - to: string; - data: string; - }; - result: string; -} | { - action: "receiveCcipReadCallError"; - transaction: { - to: string; - data: string; - }; - error: Error; -}; -export type Subscription = { - type: "block" | "close" | "debug" | "error" | "network" | "pending"; - tag: string; -} | { - type: "transaction"; - tag: string; - hash: string; -} | { - type: "event"; - tag: string; - filter: EventFilter; -} | { - type: "orphan"; - tag: string; - filter: OrphanFilter; -}; -export interface Subscriber { - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; - pollingInterval?: number; -} -export declare class UnmanagedSubscriber implements Subscriber { - name: string; - constructor(name: string); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -export interface AbstractProviderPlugin { - readonly name: string; - connect(provider: AbstractProvider): AbstractProviderPlugin; -} -export type PerformActionFilter = { - address?: string | Array; - topics?: Array>; - fromBlock?: BlockTag; - toBlock?: BlockTag; -} | { - address?: string | Array; - topics?: Array>; - blockHash?: string; -}; -export interface PerformActionTransaction extends PreparedTransactionRequest { - to?: string; - from?: string; -} -export type PerformActionRequest = { - method: "broadcastTransaction"; - signedTransaction: string; -} | { - method: "call"; - transaction: PerformActionTransaction; - blockTag: BlockTag; -} | { - method: "networkId"; -} | { - method: "estimateEnergy"; - transaction: PerformActionTransaction; -} | { - method: "getBalance"; - address: string; - blockTag: BlockTag; -} | { - method: "getBlock"; - blockTag: BlockTag; - includeTransactions: boolean; -} | { - method: "getBlock"; - blockHash: string; - includeTransactions: boolean; -} | { - method: "getBlockNumber"; -} | { - method: "getCode"; - address: string; - blockTag: BlockTag; -} | { - method: "getEnergyPrice"; -} | { - method: "getLogs"; - filter: PerformActionFilter; -} | { - method: "getStorage"; - address: string; - position: bigint; - blockTag: BlockTag; -} | { - method: "getTransaction"; - hash: string; -} | { - method: "getTransactionCount"; - address: string; - blockTag: BlockTag; -} | { - method: "getTransactionReceipt"; - hash: string; -} | { - method: "getTransactionResult"; - hash: string; -}; -export declare class AbstractProvider implements Provider { - #private; - constructor(_network?: "any" | Networkish); - get provider(): this; - get plugins(): Array; - attachPlugin(plugin: AbstractProviderPlugin): this; - getPlugin(name: string): null | T; - get disableCcipRead(): boolean; - set disableCcipRead(value: boolean); - ccipReadFetch(tx: PerformActionTransaction, calldata: string, urls: Array): Promise; - _wrapBlock(value: BlockParams, network: Network): Block; - _wrapLog(value: LogParams, network: Network): Log; - _wrapTransactionReceipt(value: TransactionReceiptParams, network: Network): TransactionReceipt; - _wrapTransactionResponse(tx: TransactionResponseParams, network: Network): TransactionResponse; - _detectNetwork(): Promise; - _perform(req: PerformActionRequest): Promise; - getBlockNumber(): Promise; - _getAddress(address: AddressLike): string | Promise; - _getBlockTag(blockTag?: BlockTag): string | Promise; - _getFilter(filter: Filter | FilterByBlockHash): PerformActionFilter | Promise; - _getTransactionRequest(_request: TransactionRequest): PerformActionTransaction | Promise; - getNetwork(): Promise; - getEnergyPrice(): Promise; - getFeeData(): Promise; - estimateEnergy(_tx: TransactionRequest): Promise; - call(_tx: TransactionRequest): Promise; - getBalance(address: AddressLike, blockTag?: BlockTag): Promise; - getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise; - getCode(address: AddressLike, blockTag?: BlockTag): Promise; - getStorage(address: AddressLike, _position: BigNumberish, blockTag?: BlockTag): Promise; - broadcastTransaction(signedTx: string): Promise; - getBlock(block: BlockTag | string, prefetchTxs?: boolean): Promise; - getTransaction(hash: string): Promise; - getTransactionReceipt(hash: string): Promise; - getTransactionResult(hash: string): Promise; - getLogs(_filter: Filter | FilterByBlockHash): Promise>; - _getProvider(networkId: number): AbstractProvider; - waitForTransaction(hash: string, _confirms?: null | number, timeout?: null | number): Promise; - waitForBlock(blockTag?: BlockTag): Promise; - _clearTimeout(timerId: number): void; - _setTimeout(_func: () => void, timeout?: number): number; - _forEachSubscriber(func: (s: Subscriber) => void): void; - _getSubscriber(sub: Subscription): Subscriber; - _recoverSubscriber(oldSub: Subscriber, newSub: Subscriber): void; - on(event: ProviderEvent, listener: Listener): Promise; - once(event: ProviderEvent, listener: Listener): Promise; - emit(event: ProviderEvent, ...args: Array): Promise; - listenerCount(event?: ProviderEvent): Promise; - listeners(event?: ProviderEvent): Promise>; - off(event: ProviderEvent, listener?: Listener): Promise; - removeAllListeners(event?: ProviderEvent): Promise; - addListener(event: ProviderEvent, listener: Listener): Promise; - removeListener(event: ProviderEvent, listener: Listener): Promise; - destroy(): void; - get paused(): boolean; - set paused(pause: boolean); - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -//# sourceMappingURL=abstract-provider.d.ts.map \ No newline at end of file diff --git a/types/providers/abstract-provider.d.ts.map b/types/providers/abstract-provider.d.ts.map deleted file mode 100644 index ca3a7ea53..000000000 --- a/types/providers/abstract-provider.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/abstract-provider.ts"],"names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AAE,aAAa,EACpB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,IAAI,CAAC;IAMhB,OAAO,IAAI,IAAI;IAUf,IAAI,MAAM,IAAI,OAAO,CAEpB;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,EAUxB;IAED,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IA+BtC,MAAM,IAAI,IAAI;CAqBf"} \ No newline at end of file diff --git a/types/providers/abstract-signer.d.ts b/types/providers/abstract-signer.d.ts deleted file mode 100644 index ab4997033..000000000 --- a/types/providers/abstract-signer.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -import type { Signer } from "./signer.js"; -export declare abstract class AbstractSigner

implements Signer { - readonly provider: P; - constructor(provider?: P); - abstract getAddress(): Promise; - abstract connect(provider: null | Provider): Signer; - getNonce(blockTag?: BlockTag): Promise; - populateCall(tx: TransactionRequest): Promise>; - populateTransaction(tx: TransactionRequest): Promise>; - estimateEnergy(tx: TransactionRequest): Promise; - call(tx: TransactionRequest): Promise; - resolveName(name: string): Promise; - sendTransaction(tx: TransactionRequest): Promise; - abstract signTransaction(tx: TransactionRequest): Promise; - abstract signMessage(message: string | Uint8Array): Promise; - abstract signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -export declare class VoidSigner extends AbstractSigner { - #private; - readonly address: string; - constructor(address: string, provider?: null | Provider); - getAddress(): Promise; - connect(provider: null | Provider): VoidSigner; - signTransaction(tx: TransactionRequest): Promise; - signMessage(message: string | Uint8Array): Promise; - signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -//# sourceMappingURL=abstract-signer.d.ts.map \ No newline at end of file diff --git a/types/providers/abstract-signer.d.ts.map b/types/providers/abstract-signer.d.ts.map deleted file mode 100644 index 41b30b933..000000000 --- a/types/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,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAW3E,QAAQ,CAAC,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IACjE,QAAQ,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IACnE,QAAQ,CAAC,aAAa,CACpB,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC;CACnB;AAED,qBAAa,UAAW,SAAQ,cAAc;;IAC5C,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC;gBAEd,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ;IAKjD,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,UAAU;IAUxC,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1D,aAAa,CACjB,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC;CAGnB"} \ No newline at end of file diff --git a/types/providers/community.d.ts b/types/providers/community.d.ts deleted file mode 100644 index a61908d27..000000000 --- a/types/providers/community.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * There are many awesome community services that provide Core - * nodes both for developers just starting out and for large-scale - * communities. - * - * @_section: api/providers/thirdparty: Community Providers [thirdparty] - */ -/** - * Providers which offer community credentials should extend this - * to notify any interested consumers whether community credentials - * are in-use. - */ -export interface CommunityResourcable { - /** - * Returns true of the instance is connected using the community - * credentials. - */ - isCommunityResource(): boolean; -} -/** - * Displays a warning in tht console when the community resource is - * being used too heavily by the app, recommending the developer - * acquire their own credentials instead of using the community - * credentials. - * - * The notification will only occur once per service. - */ -export declare function showThrottleMessage(service: string): void; -//# sourceMappingURL=community.d.ts.map \ No newline at end of file diff --git a/types/providers/community.d.ts.map b/types/providers/community.d.ts.map deleted file mode 100644 index f8a2a68bc..000000000 --- a/types/providers/community.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"community.d.ts","sourceRoot":"","sources":["../../src.ts/providers/community.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,mBAAmB,IAAI,OAAO,CAAC;CAChC;AAKD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CA4BzD"} \ No newline at end of file diff --git a/types/providers/contracts.d.ts b/types/providers/contracts.d.ts deleted file mode 100644 index 187f28cce..000000000 --- a/types/providers/contracts.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -export interface ContractRunner { - provider: null | Provider; - estimateEnergy?: (tx: TransactionRequest) => Promise; - call?: (tx: TransactionRequest) => Promise; - resolveName?: (name: string) => Promise; - sendTransaction?: (tx: TransactionRequest) => Promise; -} -//# sourceMappingURL=contracts.d.ts.map \ No newline at end of file diff --git a/types/providers/contracts.d.ts.map b/types/providers/contracts.d.ts.map deleted file mode 100644 index 085cff0c7..000000000 --- a/types/providers/contracts.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src.ts/providers/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC;IAG1B,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAG7D,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAGnD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAGvD,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC5E"} \ No newline at end of file diff --git a/types/providers/default-provider.d.ts b/types/providers/default-provider.d.ts deleted file mode 100644 index 657919cb1..000000000 --- a/types/providers/default-provider.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { AbstractProvider } from "./abstract-provider.js"; -import type { Networkish } from "./network.js"; -import { WebSocketLike } from "./provider-websocket.js"; -export declare function getDefaultProvider(network: string | Networkish | WebSocketLike, options?: any): AbstractProvider; -//# sourceMappingURL=default-provider.d.ts.map \ No newline at end of file diff --git a/types/providers/default-provider.d.ts.map b/types/providers/default-provider.d.ts.map deleted file mode 100644 index a7b02c6c0..000000000 --- a/types/providers/default-provider.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"default-provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAUxD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,EAC5C,OAAO,CAAC,EAAE,GAAG,GACZ,gBAAgB,CA6FlB"} \ No newline at end of file diff --git a/types/providers/format.d.ts b/types/providers/format.d.ts deleted file mode 100644 index e088632a0..000000000 --- a/types/providers/format.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; -export type FormatFunc = (value: any) => any; -export declare function allowNull(format: FormatFunc, nullValue?: any): FormatFunc; -export declare function arrayOf(format: FormatFunc): FormatFunc; -export declare function object(format: Record, altNames?: Record>): FormatFunc; -export declare function formatBoolean(value: any): boolean; -export declare function formatData(value: string): string; -export declare function formatHash(value: any): string; -export declare function formatUint256(value: any): string; -export declare function formatLog(value: any): LogParams; -export declare function formatBlock(value: any): BlockParams; -export declare function formatReceiptLog(value: any): LogParams; -export declare function formatTransactionReceipt(value: any): TransactionReceiptParams; -export declare function formatTransactionResponse(value: any): TransactionResponseParams; -//# sourceMappingURL=format.d.ts.map \ No newline at end of file diff --git a/types/providers/format.d.ts.map b/types/providers/format.d.ts.map deleted file mode 100644 index da5b2ee35..000000000 --- a/types/providers/format.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src.ts/providers/format.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,iBAAiB,CAAC;AAIzB,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;AAE7C,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,UAAU,CAOzE;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAOtD;AAKD,wBAAgB,MAAM,CACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GACvC,UAAU,CA+BZ;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAejD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGhD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAG7C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAKhD;AAmBD,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAE/C;AAoBD,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,WAAW,CAWnD;AAkBD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAEtD;AA6BD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,wBAAwB,CAE7E;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,GAAG,GACT,yBAAyB,CA0G3B"} \ No newline at end of file diff --git a/types/providers/formatting.d.ts b/types/providers/formatting.d.ts deleted file mode 100644 index 82736fe7c..000000000 --- a/types/providers/formatting.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * About provider formatting? - * - * @_section: api/providers/formatting:Formatting [provider-formatting] - */ -export interface BlockParams { - hash?: null | string; - number: number; - timestamp: number; - parentHash: string; - nonce: string; - difficulty: bigint; - energyLimit: bigint; - energyUsed: bigint; - miner: string; - extraData: string; - baseFeePerEnergy: null | bigint; - transactions: ReadonlyArray; -} -export interface LogParams { - transactionHash: string; - blockHash: string; - blockNumber: number; - removed: boolean; - address: string; - data: string; - topics: ReadonlyArray; - index: number; - transactionIndex: number; -} -export interface TransactionReceiptParams { - to: null | string; - from: string; - contractAddress: null | string; - hash: string; - index: number; - blockHash: string; - blockNumber: number; - logsBloom: string; - logs: ReadonlyArray; - energyUsed: bigint; - cumulativeEnergyUsed: bigint; - energyPrice?: null | bigint; - effectiveEnergyPrice?: null | bigint; - type: number; - status: null | number; - root: null | string; -} -export interface TransactionResponseParams { - blockNumber: null | number; - blockHash: null | string; - hash: string; - index: number; - type: number; - to: null | string; - from: string; - nonce: number; - energyLimit: bigint; - energyPrice: bigint; - data: string; - value: bigint; - networkId: bigint; - signature: string; -} -//# sourceMappingURL=formatting.d.ts.map \ No newline at end of file diff --git a/types/providers/formatting.d.ts.map b/types/providers/formatting.d.ts.map deleted file mode 100644 index 65b377ed3..000000000 --- a/types/providers/formatting.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src.ts/providers/formatting.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwDH,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAElB,UAAU,EAAE,MAAM,CAAC;IAEnB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IAEnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAElB,gBAAgB,EAAE,IAAI,GAAG,MAAM,CAAC;IAEhC,YAAY,EAAE,aAAa,CAAC,MAAM,GAAG,yBAAyB,CAAC,CAAC;CACjE;AAKD,MAAM,WAAW,SAAS;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IAEpB,OAAO,EAAE,OAAO,CAAC;IAEjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IAEb,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAE9B,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAKD,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,IAAI,GAAG,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,IAAI,GAAG,MAAM,CAAC;IAE/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IAEd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IAEpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IAE/B,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErC,IAAI,EAAE,MAAM,CAAC;IAEb,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;IACtB,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;CACrB;AAmBD,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,IAAI,GAAG,MAAM,CAAC;IAC3B,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;IAEzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,MAAM,CAAC;IAEb,EAAE,EAAE,IAAI,GAAG,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,EAAE,MAAM,CAAC;IAEd,WAAW,EAAE,MAAM,CAAC;IAEpB,WAAW,EAAE,MAAM,CAAC;IAEpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,MAAM,CAAC;CACnB"} \ No newline at end of file diff --git a/types/providers/index.d.ts b/types/providers/index.d.ts deleted file mode 100644 index 7e80c01e9..000000000 --- a/types/providers/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * About providers. - * - * @_section: api/providers:Providers [about-providers] - */ -export { AbstractProvider, UnmanagedSubscriber } from "./abstract-provider.js"; -export { AbstractSigner, VoidSigner } from "./abstract-signer.js"; -export { showThrottleMessage } from "./community.js"; -export { getDefaultProvider } from "./default-provider.js"; -export { Network } from "./network.js"; -export { NonceManager } from "./signer-noncemanager.js"; -export { NetworkPlugin, EnergyCostPlugin, FeeDataNetworkPlugin, } from "./plugins-network.js"; -export { Block, FeeData, Log, TransactionReceipt, TransactionResponse, copyRequest, } from "./provider.js"; -export { FallbackProvider } from "./provider-fallback.js"; -export { JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, } from "./provider-jsonrpc.js"; -export { BrowserProvider } from "./provider-browser.js"; -export { AlchemyProvider } from "./provider-alchemy.js"; -export { AnkrProvider } from "./provider-ankr.js"; -export { CloudflareProvider } from "./provider-cloudflare.js"; -export { InfuraProvider, InfuraWebSocketProvider } from "./provider-infura.js"; -export { PocketProvider } from "./provider-pocket.js"; -export { QuickNodeProvider } from "./provider-quicknode.js"; -import { IpcSocketProvider } from "./provider-ipcsocket.js"; -export { IpcSocketProvider }; -export { SocketProvider } from "./provider-socket.js"; -export { WebSocketProvider } from "./provider-websocket.js"; -export { SocketSubscriber, SocketBlockSubscriber, SocketPendingSubscriber, SocketEventSubscriber, } from "./provider-socket.js"; -export type { Subscription, Subscriber, AbstractProviderPlugin, PerformActionFilter, PerformActionTransaction, PerformActionRequest, } from "./abstract-provider.js"; -export type { ContractRunner } from "./contracts.js"; -export type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams, } from "./formatting.js"; -export type { Networkish } from "./network.js"; -export type { EnergyCostParameters } from "./plugins-network.js"; -export type { BlockTag, TransactionRequest, PreparedTransactionRequest, EventFilter, Filter, FilterByBlockHash, OrphanFilter, ProviderEvent, TopicFilter, Provider, MinedBlock, MinedTransactionResponse, } from "./provider.js"; -export type { DebugEventBrowserProvider, Eip1193Provider, } from "./provider-browser.js"; -export type { JsonRpcPayload, JsonRpcResult, JsonRpcError, JsonRpcApiProviderOptions, JsonRpcTransactionRequest, } from "./provider-jsonrpc.js"; -export type { WebSocketCreator, WebSocketLike } from "./provider-websocket.js"; -export type { Signer } from "./signer.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/providers/index.d.ts.map b/types/providers/index.d.ts.map deleted file mode 100644 index 206142646..000000000 --- a/types/providers/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/providers/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,KAAK,EACL,OAAO,EACP,GAAG,EACH,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,GAEZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO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AAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE/E,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/types/providers/network.d.ts b/types/providers/network.d.ts deleted file mode 100644 index eb935dd8b..000000000 --- a/types/providers/network.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -import type { BigNumberish } from "../utils/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { NetworkPlugin } from "./plugins-network.js"; -/** - * A Networkish can be used to allude to a Network, by specifing: - * - a [[Network]] object - * - a well-known (or registered) network name - * - a well-known (or registered) chain ID - * - an object with sufficient details to describe a network - */ -export type Networkish = Network | number | bigint | string | { - name?: string; - networkId?: number; - ensAddress?: string; - ensNetwork?: number; -}; -export declare class Network { - #private; - constructor(name: string, networkId: BigNumberish); - toJSON(): any; - /** - * The network common name. - * - * This is the canonical name, as networks migh have multiple - * names. - */ - get name(): string; - set name(value: string); - /** - * The network chain ID. - */ - get networkId(): bigint; - set networkId(value: BigNumberish); - /** - * Returns true if %%other%% matches this network. Any chain ID - * must match, and if no chain ID is present, the name must match. - * - * This method does not currently check for additional properties, - * such as ENS address or plug-in compatibility. - */ - matches(other: Networkish): boolean; - /** - * Returns the list of plugins currently attached to this Network. - */ - get plugins(): Array; - /** - * Attach a new %%plugin%% to this Network. The network name - * must be unique, excluding any fragment. - */ - attachPlugin(plugin: NetworkPlugin): this; - /** - * Return the plugin, if any, matching %%name%% exactly. Plugins - * with fragments will not be returned unless %%name%% includes - * a fragment. - */ - getPlugin(name: string): null | T; - /** - * Gets a list of all plugins that match %%name%%, with otr without - * a fragment. - */ - getPlugins(basename: string): Array; - /** - * Create a copy of this Network. - */ - clone(): Network; - /** - * Compute the intrinsic energy required for a transaction. - * - * A EnergyCostPlugin can be attached to override the default - * values. - */ - computeIntrinsicEnergy(tx: TransactionLike): number; - /** - * Returns a new Network for the %%network%% name or networkId. - */ - static from(network?: Networkish): Network; - /** - * Register %%nameOrnetworkId%% with a function which returns - * an instance of a Network representing that chain. - */ - static register(nameOrnetworkId: string | number | bigint, networkFunc: () => Network): void; -} -//# sourceMappingURL=network.d.ts.map \ No newline at end of file diff --git a/types/providers/network.d.ts.map b/types/providers/network.d.ts.map deleted file mode 100644 index a62904576..000000000 --- a/types/providers/network.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src.ts/providers/network.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAClB,OAAO,GACP,MAAM,GACN,MAAM,GACN,MAAM,GACN;IACE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAiBN,qBAAa,OAAO;;gBAMN,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY;IAMjD,MAAM,IAAI,GAAG;IAIb;;;;;OAKG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IACD,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IACD,IAAI,SAAS,CAAC,KAAK,EAAE,YAAY,EAEhC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO;IAmCnC;;OAEG;IACH,IAAI,OAAO,IAAI,KAAK,CAAC,aAAa,CAAC,CAElC;IAED;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAQzC;;;;OAIG;IACH,SAAS,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC;IAI1E;;;OAGG;IACH,UAAU,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,EAChD,QAAQ,EAAE,MAAM,GACf,KAAK,CAAC,CAAC,CAAC;IAMX;;OAEG;IACH,KAAK,IAAI,OAAO;IAQhB;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,EAAE,eAAe,GAAG,MAAM;IAuBnD;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO;IAyD1C;;;OAGG;IACH,MAAM,CAAC,QAAQ,CACb,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EACzC,WAAW,EAAE,MAAM,OAAO,GACzB,IAAI;CAeR"} \ No newline at end of file diff --git a/types/providers/pagination.d.ts b/types/providers/pagination.d.ts deleted file mode 100644 index a772a85c2..000000000 --- a/types/providers/pagination.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface PaginationResult extends Array { - next(): Promise>; - totalResults: null | number; - done: boolean; -} -//# sourceMappingURL=pagination.d.ts.map \ No newline at end of file diff --git a/types/providers/pagination.d.ts.map b/types/providers/pagination.d.ts.map deleted file mode 100644 index 5479c9c0a..000000000 --- a/types/providers/pagination.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src.ts/providers/pagination.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IACnD,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IAGrC,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC;IAE5B,IAAI,EAAE,OAAO,CAAC;CACf"} \ No newline at end of file diff --git a/types/providers/plugin-fallback.d.ts b/types/providers/plugin-fallback.d.ts deleted file mode 100644 index 10009e4b3..000000000 --- a/types/providers/plugin-fallback.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { AbstractProviderPlugin } from "./abstract-provider.js"; -import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; -export declare const PluginIdFallbackProvider = "org.corebc.plugins.provider.QualifiedPlugin"; -export declare class CheckQualifiedPlugin implements AbstractProviderPlugin { - name: string; - constructor(); - connect(provider: AbstractProvider): CheckQualifiedPlugin; - isQualified(action: PerformActionRequest, result: any): boolean; -} -export declare class PossiblyPrunedTransactionPlugin extends CheckQualifiedPlugin { - isQualified(action: PerformActionRequest, result: any): boolean; -} -//# sourceMappingURL=plugin-fallback.d.ts.map \ No newline at end of file diff --git a/types/providers/plugin-fallback.d.ts.map b/types/providers/plugin-fallback.d.ts.map deleted file mode 100644 index 6d2023762..000000000 --- a/types/providers/plugin-fallback.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugin-fallback.d.ts","sourceRoot":"","sources":["../../src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,wBAAwB,gDACU,CAAC;AAEhD,qBAAa,oBAAqB,YAAW,sBAAsB;IACzD,IAAI,EAAE,MAAM,CAAC;;IAQrB,OAAO,CAAC,QAAQ,EAAE,gBAAgB,GAAG,oBAAoB;IAMzD,WAAW,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;CAGhE;AAED,qBAAa,+BAAgC,SAAQ,oBAAoB;IACvE,WAAW,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;CAWhE"} \ No newline at end of file diff --git a/types/providers/plugins-network.d.ts b/types/providers/plugins-network.d.ts deleted file mode 100644 index 80364b3ad..000000000 --- a/types/providers/plugins-network.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { FeeData, Provider } from "./provider.js"; -export declare class NetworkPlugin { - readonly name: string; - constructor(name: string); - clone(): NetworkPlugin; -} -export type EnergyCostParameters = { - txBase?: number; - txCreate?: number; - txDataZero?: number; - txDataNonzero?: number; - txAccessListStorageKey?: number; - txAccessListAddress?: number; -}; -export declare class EnergyCostPlugin extends NetworkPlugin implements EnergyCostParameters { - readonly effectiveBlock: number; - readonly txBase: number; - readonly txCreate: number; - readonly txDataZero: number; - readonly txDataNonzero: number; - readonly txAccessListStorageKey: number; - readonly txAccessListAddress: number; - constructor(effectiveBlock?: number, costs?: EnergyCostParameters); - clone(): EnergyCostPlugin; -} -export declare class FeeDataNetworkPlugin extends NetworkPlugin { - #private; - get feeDataFunc(): (provider: Provider) => Promise; - constructor(feeDataFunc: (provider: Provider) => Promise); - getFeeData(provider: Provider): Promise; - clone(): FeeDataNetworkPlugin; -} -//# sourceMappingURL=plugins-network.d.ts.map \ No newline at end of file diff --git a/types/providers/plugins-network.d.ts.map b/types/providers/plugins-network.d.ts.map deleted file mode 100644 index 7c9b9b3c7..000000000 --- a/types/providers/plugins-network.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugins-network.d.ts","sourceRoot":"","sources":["../../src.ts/providers/plugins-network.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACvD,qBAAa,aAAa;IACxB,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM;IAIxB,KAAK,IAAI,aAAa;CAOvB;AAKD,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,qBAAa,gBACX,SAAQ,aACR,YAAW,oBAAoB;IAE/B,QAAQ,CAAC,cAAc,EAAG,MAAM,CAAC;IAEjC,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAG,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAG,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,sBAAsB,EAAG,MAAM,CAAC;IACzC,QAAQ,CAAC,mBAAmB,EAAG,MAAM,CAAC;gBAE1B,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,oBAAoB;IA+BjE,KAAK,IAAI,gBAAgB;CAG1B;AAED,qBAAa,oBAAqB,SAAQ,aAAa;;IAGrD,IAAI,WAAW,IAAI,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,OAAO,CAAC,CAE1D;gBAEW,WAAW,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,OAAO,CAAC;IAK3D,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAItD,KAAK,IAAI,oBAAoB;CAG9B"} \ No newline at end of file diff --git a/types/providers/provider-alchemy.d.ts b/types/providers/provider-alchemy.d.ts deleted file mode 100644 index 17af0df46..000000000 --- a/types/providers/provider-alchemy.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * About Alchemy - * - * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] - */ -import { FetchRequest } from "../utils/index.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -/** - * The **AlchemyProvider** connects to the [[link-alchemy]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-alchemy-signup). - * - * @_docloc: api/providers/thirdparty - */ -export declare class AlchemyProvider extends JsonRpcProvider implements CommunityResourcable { - readonly apiKey: string; - constructor(_network?: Networkish, apiKey?: null | string); - _getProvider(networkId: number): AbstractProvider; - _perform(req: PerformActionRequest): Promise; - isCommunityResource(): boolean; - static getRequest(network: Network, apiKey?: string): FetchRequest; -} -//# sourceMappingURL=provider-alchemy.d.ts.map \ No newline at end of file diff --git a/types/providers/provider-alchemy.d.ts.map b/types/providers/provider-alchemy.d.ts.map deleted file mode 100644 index f2eec176b..000000000 --- a/types/providers/provider-alchemy.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-alchemy.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-alchemy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAKL,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA8B/C;;;;;;;;;;GAUG;AACH,qBAAa,eACX,SAAQ,eACR,YAAW,oBAAoB;IAE/B,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;gBAEb,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAezD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAO3C,QAAQ,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IA2CvD,mBAAmB,IAAI,OAAO;IAI9B,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY;CAmBnE"} \ No newline at end of file diff --git a/types/providers/provider-ankr.d.ts b/types/providers/provider-ankr.d.ts deleted file mode 100644 index 77af5a3a0..000000000 --- a/types/providers/provider-ankr.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * [[link-ankr]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Polygon (``matic``) - * - Arbitrum (``arbitrum``) - * - * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] - */ -import { FetchRequest } from "../utils/index.js"; -import { AbstractProvider } from "./abstract-provider.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -import type { JsonRpcError, JsonRpcPayload } from "./provider-jsonrpc.js"; -/** - * The **AnkrProvider** connects to the [[link-ankr]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-ankr-signup). - */ -export declare class AnkrProvider extends JsonRpcProvider implements CommunityResourcable { - /** - * The API key for the Ankr connection. - */ - readonly apiKey: string; - /** - * Create a new **AnkrProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network?: Networkish, apiKey?: null | string); - _getProvider(networkId: number): AbstractProvider; - /** - * Returns a prepared request for connecting to %%network%% with - * %%apiKey%%. - */ - static getRequest(network: Network, apiKey?: null | string): FetchRequest; - getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error; - isCommunityResource(): boolean; -} -//# sourceMappingURL=provider-ankr.d.ts.map \ No newline at end of file diff --git a/types/providers/provider-ankr.d.ts.map b/types/providers/provider-ankr.d.ts.map deleted file mode 100644 index 45cfc5423..000000000 --- a/types/providers/provider-ankr.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ankr.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ankr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAoB1E;;;;;;;;GAQG;AACH,qBAAa,YACX,SAAQ,eACR,YAAW,oBAAoB;IAE/B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAEzB;;;;;OAKG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAkBzD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAOjD;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;IAoBzE,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,GAAG,KAAK;IAchE,mBAAmB,IAAI,OAAO;CAG/B"} \ No newline at end of file diff --git a/types/providers/provider-browser.d.ts b/types/providers/provider-browser.d.ts deleted file mode 100644 index 2e917663a..000000000 --- a/types/providers/provider-browser.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { JsonRpcApiPollingProvider } from "./provider-jsonrpc.js"; -import type { JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcSigner } from "./provider-jsonrpc.js"; -import type { Networkish } from "./network.js"; -export interface Eip1193Provider { - request(request: { - method: string; - params?: Array | Record; - }): Promise; -} -export type DebugEventBrowserProvider = { - action: "sendEip1193Payload"; - payload: { - method: string; - params: Array; - }; -} | { - action: "receiveEip1193Result"; - result: any; -} | { - action: "receiveEip1193Error"; - error: Error; -}; -export declare class BrowserProvider extends JsonRpcApiPollingProvider { - #private; - constructor(core: Eip1193Provider, network?: Networkish); - send(method: string, params: Array | Record): Promise; - _send(payload: JsonRpcPayload | Array): Promise>; - getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error; - hasSigner(address: number | string): Promise; - getSigner(address?: number | string): Promise; -} -//# sourceMappingURL=provider-browser.d.ts.map \ No newline at end of file diff --git a/types/providers/provider-browser.d.ts.map b/types/providers/provider-browser.d.ts.map deleted file mode 100644 index cf224c60e..000000000 --- a/types/providers/provider-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-browser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,OAAO,EAAE;QACf,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC3C,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAClB;AAED,MAAM,MAAM,yBAAyB,GACjC;IACE,MAAM,EAAE,oBAAoB,CAAC;IAC7B,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;KAAE,CAAC;CACjD,GACD;IACE,MAAM,EAAE,sBAAsB,CAAC;IAC/B,MAAM,EAAE,GAAG,CAAC;CACb,GACD;IACE,MAAM,EAAE,qBAAqB,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEN,qBAAa,eAAgB,SAAQ,yBAAyB;;gBAMhD,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,UAAU;IAwBjD,IAAI,CACR,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACvC,OAAO,CAAC,GAAG,CAAC;IAMT,KAAK,CACT,OAAO,EAAE,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAC9C,OAAO,CAAC,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC,CAAC;IAqB/C,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,GAAG,KAAK;IAiB1D,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBrD,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAkBnE"} \ No newline at end of file diff --git a/types/providers/provider-cloudflare.d.ts b/types/providers/provider-cloudflare.d.ts deleted file mode 100644 index 869651f44..000000000 --- a/types/providers/provider-cloudflare.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * About Cloudflare - * - * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] - */ -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { Networkish } from "./network.js"; -/** - * About Cloudflare... - */ -export declare class CloudflareProvider extends JsonRpcProvider { - constructor(_network?: Networkish); -} -//# sourceMappingURL=provider-cloudflare.d.ts.map \ No newline at end of file diff --git a/types/providers/provider-cloudflare.d.ts.map b/types/providers/provider-cloudflare.d.ts.map deleted file mode 100644 index e70790a60..000000000 --- a/types/providers/provider-cloudflare.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-cloudflare.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-cloudflare.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,eAAe;gBACzC,QAAQ,CAAC,EAAE,UAAU;CAalC"} \ No newline at end of file diff --git a/types/providers/provider-fallback.d.ts b/types/providers/provider-fallback.d.ts deleted file mode 100644 index bf814a2ff..000000000 --- a/types/providers/provider-fallback.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { AbstractProvider } from "./abstract-provider.js"; -import { Network } from "./network.js"; -import type { PerformActionRequest } from "./abstract-provider.js"; -import type { Networkish } from "./network.js"; -/** - * A configuration entry for how to use a [[Provider]]. - */ -export interface FallbackProviderConfig { - provider: AbstractProvider; - stallTimeout?: number; - priority?: number; - weight?: number; -} -/** - * The statistics and state maintained for a [[Provider]]. - */ -export interface FallbackProviderState extends Required { - blockNumber: number; - requests: number; - errorResponses: number; - lateResponses: number; - outOfSync: number; - unsupportedEvents: number; - rollingDuration: number; - score: number; -} -/** - * Additional options to configure a [[FallbackProvider]]. - */ -export type FallbackProviderOptions = { - quorum: number; - eventQuorum: number; - eventWorkers: number; -}; -/** - * A Fallback Provider. - * - */ -export declare class FallbackProvider extends AbstractProvider { - #private; - readonly quorum: number; - readonly eventQuorum: number; - readonly eventWorkers: number; - constructor(providers: Array, network?: Networkish); - get providerConfigs(): Array; - _detectNetwork(): Promise; - _translatePerform(provider: AbstractProvider, req: PerformActionRequest): Promise; - _perform(req: PerformActionRequest): Promise; - destroy(): Promise; -} -//# sourceMappingURL=provider-fallback.d.ts.map \ No newline at end of file diff --git a/types/providers/provider-fallback.d.ts.map b/types/providers/provider-fallback.d.ts.map deleted file mode 100644 index 16b3b607f..000000000 --- a/types/providers/provider-fallback.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-fallback.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-fallback.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAiC/C;;GAEG;AACH,MAAM,WAAW,sBAAsB;IAErC,QAAQ,EAAE,gBAAgB,CAAC;IAI3B,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAMD;;GAEG;AACH,MAAM,WAAW,qBACf,SAAQ,QAAQ,CAAC,sBAAsB,CAAC;IAExC,WAAW,EAAE,MAAM,CAAC;IAGpB,QAAQ,EAAE,MAAM,CAAC;IAGjB,cAAc,EAAE,MAAM,CAAC;IAGvB,aAAa,EAAE,MAAM,CAAC;IAGtB,SAAS,EAAE,MAAM,CAAC;IAGlB,iBAAiB,EAAE,MAAM,CAAC;IAG1B,eAAe,EAAE,MAAM,CAAC;IAGxB,KAAK,EAAE,MAAM,CAAC;CACf;AAsCD;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAGpC,MAAM,EAAE,MAAM,CAAC;IAIf,WAAW,EAAE,MAAM,CAAC;IAKpB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AA4MF;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,gBAAgB;;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;gBAQ5B,SAAS,EAAE,KAAK,CAAC,gBAAgB,GAAG,sBAAsB,CAAC,EAC3D,OAAO,CAAC,EAAE,UAAU;IA0BtB,IAAI,eAAe,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAUlD;IAEK,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAWlC,iBAAiB,CACrB,QAAQ,EAAE,gBAAgB,EAC1B,GAAG,EAAE,oBAAoB,GACxB,OAAO,CAAC,GAAG,CAAC;IAqTT,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,CAAC;IAqDxD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAM/B"} \ No newline at end of file diff --git a/types/providers/provider-infura.d.ts b/types/providers/provider-infura.d.ts deleted file mode 100644 index e09baec46..000000000 --- a/types/providers/provider-infura.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -/** - * [[link-infura]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Sepolia Testnet (``sepolia``) - * - Arbitrum (``arbitrum``) - * - Arbitrum Goerli Testnet (``arbitrum-goerli``) - * - Optimism (``optimism``) - * - Optimism Goerli Testnet (``optimism-goerli``) - * - Polygon (``matic``) - * - Polygon Mumbai Testnet (``matic-mumbai``) - * - * @_subsection: api/providers/thirdparty:INFURA [providers-infura] - */ -import { FetchRequest } from "../utils/index.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import { WebSocketProvider } from "./provider-websocket.js"; -import type { AbstractProvider } from "./abstract-provider.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -/** - * The **InfuraWebSocketProvider** connects to the [[link-infura]] - * WebSocket end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-infura-signup). - */ -export declare class InfuraWebSocketProvider extends WebSocketProvider implements CommunityResourcable { - /** - * The Project ID for the INFURA connection. - */ - readonly projectId: string; - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - readonly projectSecret: null | string; - /** - * Creates a new **InfuraWebSocketProvider**. - */ - constructor(network?: Networkish, projectId?: string); - isCommunityResource(): boolean; -} -/** - * The **InfuraProvider** connects to the [[link-infura]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-infura-signup). - */ -export declare class InfuraProvider extends JsonRpcProvider implements CommunityResourcable { - /** - * The Project ID for the INFURA connection. - */ - readonly projectId: string; - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - readonly projectSecret: null | string; - /** - * Creates a new **InfuraProvider**. - */ - constructor(_network?: Networkish, projectId?: null | string, projectSecret?: null | string); - _getProvider(networkId: number): AbstractProvider; - isCommunityResource(): boolean; - /** - * Creates a new **InfuraWebSocketProvider**. - */ - static getWebSocketProvider(network?: Networkish, projectId?: string): InfuraWebSocketProvider; - /** - * Returns a prepared request for connecting to %%network%% - * with %%projectId%% and %%projectSecret%%. - */ - static getRequest(network: Network, projectId?: null | string, projectSecret?: null | string): FetchRequest; -} -//# sourceMappingURL=provider-infura.d.ts.map \ No newline at end of file diff --git a/types/providers/provider-infura.d.ts.map b/types/providers/provider-infura.d.ts.map deleted file mode 100644 index cc3baf59e..000000000 --- a/types/providers/provider-infura.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-infura.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-infura.ts"],"names":[],"m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BAAuB;IAI1B;;;OAGG;IACH,MAAM,CAAC,UAAU,CACf,OAAO,EAAE,OAAO,EAChB,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,EACzB,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,GAC5B,YAAY;CAyBhB"} \ No newline at end of file diff --git a/types/providers/provider-ipcsocket-browser.d.ts b/types/providers/provider-ipcsocket-browser.d.ts deleted file mode 100644 index 6aae787dc..000000000 --- a/types/providers/provider-ipcsocket-browser.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const IpcSocketProvider: undefined; -export { IpcSocketProvider }; -//# sourceMappingURL=provider-ipcsocket-browser.d.ts.map \ No newline at end of file diff --git a/types/providers/provider-ipcsocket-browser.d.ts.map b/types/providers/provider-ipcsocket-browser.d.ts.map deleted file mode 100644 index e49cd58d3..000000000 --- a/types/providers/provider-ipcsocket-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ipcsocket-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket-browser.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,iBAAiB,WAAY,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,CAAC"} \ No newline at end of file diff --git a/types/providers/provider-ipcsocket.d.ts b/types/providers/provider-ipcsocket.d.ts deleted file mode 100644 index a9ee3bfc9..000000000 --- a/types/providers/provider-ipcsocket.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -import { SocketProvider } from "./provider-socket.js"; -import type { Socket } from "net"; -import type { Networkish } from "./network.js"; -export declare class IpcSocketProvider extends SocketProvider { - #private; - get socket(): Socket; - constructor(path: string, network?: Networkish); - destroy(): void; - _write(message: string): Promise; -} -//# sourceMappingURL=provider-ipcsocket.d.ts.map \ No newline at end of file diff --git a/types/providers/provider-ipcsocket.d.ts.map b/types/providers/provider-ipcsocket.d.ts.map deleted file mode 100644 index 91d6287d7..000000000 --- a/types/providers/provider-ipcsocket.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-ipcsocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAuB/C,qBAAa,iBAAkB,SAAQ,cAAc;;IAEnD,IAAI,MAAM,IAAI,MAAM,CAEnB;gBAEW,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU;IA8B9C,OAAO,IAAI,IAAI;IAOT,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C"} \ No newline at end of file diff --git a/types/providers/provider-jsonrpc.d.ts b/types/providers/provider-jsonrpc.d.ts deleted file mode 100644 index f4dc34d1e..000000000 --- a/types/providers/provider-jsonrpc.d.ts +++ /dev/null @@ -1,267 +0,0 @@ -/** - * About JSON-RPC... - * - * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] - */ -import { FetchRequest } from "../utils/index.js"; -import { AbstractProvider } from "./abstract-provider.js"; -import { AbstractSigner } from "./abstract-signer.js"; -import { Network } from "./network.js"; -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { PerformActionRequest, Subscriber, Subscription } from "./abstract-provider.js"; -import type { Networkish } from "./network.js"; -import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -import type { Signer } from "./signer.js"; -/** - * A JSON-RPC payload, which are sent to a JSON-RPC server. - */ -export type JsonRpcPayload = { - id: number; - method: string; - params: Array | Record; - jsonrpc: "2.0"; -}; -/** - * A JSON-RPC result, which are returned on success from a JSON-RPC server. - */ -export type JsonRpcResult = { - id: number; - result: any; -}; -/** - * A JSON-RPC error, which are returned on failure from a JSON-RPC server. - */ -export type JsonRpcError = { - id: number; - error: { - code: number; - message?: string; - data?: any; - }; -}; -/** - * When subscribing to the ``"debug"`` event, the [[Listener]] will - * receive this object as the first parameter. - */ -export type DebugEventJsonRpcApiProvider = { - action: "sendRpcPayload"; - payload: JsonRpcPayload | Array; -} | { - action: "receiveRpcResult"; - result: Array; -} | { - action: "receiveRpcError"; - error: Error; -}; -/** - * Options for configuring a [[JsonRpcApiProvider]]. Much of this - * is targetted towards sub-classes, which often will not expose - * any of these options to their consumers. - * - * **``polling``** - use the polling strategy is used immediately - * for events; otherwise, attempt to use filters and fall back onto - * polling (default: ``false``) - * - * **``staticNetwork``** - do not request chain ID on requests to - * validate the underlying chain has not changed (default: ``null``) - * - * This should **ONLY** be used if it is **certain** that the network - * cannot change, such as when using INFURA (since the URL dictates the - * network). If the network is assumed static and it does change, this - * can have tragic consequences. For example, this **CANNOT** be used - * with MetaMask, since the used can select a new network from the - * drop-down at any time. - * - * **``batchStallTime``** - how long (ms) to aggregate requests into a - * single batch. ``0`` indicates batching will only encompass the current - * event loop. If ``batchMaxCount = 1``, this is ignored. (default: ``10``) - * - * **``batchMaxSize``** - target maximum size (bytes) to allow per batch - * request (default: 1Mb) - * - * **``batchMaxCount``** - maximum number of requests to allow in a batch. - * If ``batchMaxCount = 1``, then batching is disabled. (default: ``100``) - */ -export type JsonRpcApiProviderOptions = { - polling?: boolean; - staticNetwork?: null | Network; - batchStallTime?: number; - batchMaxSize?: number; - batchMaxCount?: number; -}; -export interface JsonRpcTransactionRequest { - from?: string; - to?: string; - data?: string; - networkId?: string; - type?: string; - energy?: string; - energyPrice?: string; - nonce?: string; - value?: string; - accessList?: Array<{ - address: string; - storageKeys: Array; - }>; -} -export declare class JsonRpcSigner extends AbstractSigner { - address: string; - constructor(provider: JsonRpcApiProvider, address: string); - connect(provider: null | Provider): Signer; - getAddress(): Promise; - populateTransaction(tx: TransactionRequest): Promise>; - sendUncheckedTransaction(_tx: TransactionRequest): Promise; - sendTransaction(tx: TransactionRequest): Promise; - signTransaction(_tx: TransactionRequest): Promise; - signMessage(_message: string | Uint8Array): Promise; - signTypedData(domain: TypedDataDomain, types: Record>, _value: Record): Promise; - unlock(password: string): Promise; - _legacySignMessage(_message: string | Uint8Array): Promise; -} -/** - * The JsonRpcApiProvider is an abstract class and **MUST** be - * sub-classed. - * - * It provides the base for all JSON-RPC-based Provider interaction. - * - * Sub-classing Notes: - * - a sub-class MUST override _send - * - a sub-class MUST call the `_start()` method once connected - */ -export declare abstract class JsonRpcApiProvider extends AbstractProvider { - #private; - constructor(network?: Networkish, options?: JsonRpcApiProviderOptions); - /** - * Returns the value associated with the option %%key%%. - * - * Sub-classes can use this to inquire about configuration options. - */ - _getOption(key: K): JsonRpcApiProviderOptions[K]; - /** - * Gets the [[Network]] this provider has committed to. On each call, the network - * is detected, and if it has changed, the call will reject. - */ - get _network(): Network; - /** - * Sends a JSON-RPC %%payload%% (or a batch) to the underlying channel. - * - * Sub-classes **MUST** override this. - */ - abstract _send(payload: JsonRpcPayload | Array): Promise>; - /** - * Resolves to the non-normalized value by performing %%req%%. - * - * Sub-classes may override this to modify behavior of actions, - * and should generally call ``super._perform`` as a fallback. - */ - _perform(req: PerformActionRequest): Promise; - /** - * Sub-classes may override this; it detects the *actual* network that - * we are **currently** connected to. - * - * Keep in mind that [[send]] may only be used once [[ready]], otherwise the - * _send primitive must be used instead. - */ - _detectNetwork(): Promise; - /** - * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls - * will be passed to [[_send]] from [[send]]. If it is overridden, then - * ``super._start()`` **MUST** be called. - * - * Calling it multiple times is safe and has no effect. - */ - _start(): void; - /** - * Resolves once the [[_start]] has been called. This can be used in - * sub-classes to defer sending data until the connection has been - * established. - */ - _waitUntilReady(): Promise; - /** - * Return a Subscriber that will manage the %%sub%%. - * - * Sub-classes may override this to modify the behavior of - * subscription management. - */ - _getSubscriber(sub: Subscription): Subscriber; - /** - * Returns true only if the [[_start]] has been called. - */ - get ready(): boolean; - /** - * Returns %%tx%% as a normalized JSON-RPC transaction request, - * which has all values hexlified and any numeric values converted - * to Quantity values. - */ - getRpcTransaction(tx: TransactionRequest): JsonRpcTransactionRequest; - /** - * Returns the request method and arguments required to perform - * %%req%%. - */ - getRpcRequest(req: PerformActionRequest): null | { - method: string; - args: Array; - }; - /** - * Returns an CoreBC-style Error for the given JSON-RPC error - * %%payload%%, coalescing the various strings and error shapes - * that different nodes return, coercing them into a machine-readable - * standardized error. - */ - getRpcError(payload: JsonRpcPayload, _error: JsonRpcError): Error; - /** - * Requests the %%method%% with %%params%% via the JSON-RPC protocol - * over the underlying channel. This can be used to call methods - * on the backend that do not have a high-level API within the Provider - * API. - * - * This method queues requests according to the batch constraints - * in the options, assigns the request a unique ID. - * - * **Do NOT override** this method in sub-classes; instead - * override [[_send]] or force the options values in the - * call to the constructor to modify this method's behavior. - */ - send(method: string, params: Array | Record): Promise; - /** - * Resolves to the [[Signer]] account for %%address%% managed by - * the client. - * - * If the %%address%% is a number, it is used as an index in the - * the accounts from [[listAccounts]]. - * - * This can only be used on clients which manage accounts (such as - * Geth with imported account or MetaMask). - * - * Throws if the account doesn't exist. - */ - getSigner(address?: number | string): Promise; - listAccounts(): Promise>; -} -export declare abstract class JsonRpcApiPollingProvider extends JsonRpcApiProvider { - #private; - constructor(network?: Networkish, options?: JsonRpcApiProviderOptions); - _getSubscriber(sub: Subscription): Subscriber; - /** - * The polling interval (default: 4000 ms) - */ - get pollingInterval(): number; - set pollingInterval(value: number); -} -/** - * The JsonRpcProvider is one of the most common Providers, - * which performs all operations over HTTP (or HTTPS) requests. - * - * Events are processed by polling the backend for the current block - * number; when it advances, all block-base events are then checked - * for updates. - */ -export declare class JsonRpcProvider extends JsonRpcApiPollingProvider { - #private; - constructor(url?: string | FetchRequest, network?: Networkish, options?: JsonRpcApiProviderOptions); - _getConnection(): FetchRequest; - send(method: string, params: Array | Record): Promise; - _send(payload: JsonRpcPayload | Array): Promise>; -} -//# sourceMappingURL=provider-jsonrpc.d.ts.map \ No newline at end of file diff --git a/types/providers/provider-jsonrpc.d.ts.map b/types/providers/provider-jsonrpc.d.ts.map deleted file mode 100644 index 5e8ed8fa0..000000000 --- a/types/providers/provider-jsonrpc.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-jsonrpc.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-jsonrpc.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAUL,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAuB,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAOvC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EACV,YAAY,EACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAuD1C;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACzC,OAAO,EAAE,KAAK,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,GAAG,CAAC;CACb,CAAC;AAEF;;GAEG;A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AgC5D,YAAY,IAAI,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;CAIpD;AAED,8BAAsB,yBAA0B,SAAQ,kBAAkB;;gBAE5D,OAAO,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,yBAAyB;IAMrE,cAAc,CAAC,GAAG,EAAE,YAAY,GAAG,UAAU;IAQ7C;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,CAE5B;IACD,IAAI,eAAe,CAAC,KAAK,EAAE,MAAM,EAUhC;CACF;AAED;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,yBAAyB;;gBAI1D,GAAG,CAAC,EAAE,MAAM,GAAG,YAAY,EAC3B,OAAO,CAAC,EAAE,UAAU,EACpB,OAAO,CAAC,EAAE,yBAAyB;IAcrC,cAAc,IAAI,YAAY;IAIxB,IAAI,CACR,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACvC,OAAO,CAAC,GAAG,CAAC;IAST,KAAK,CACT,OAAO,EAAE,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAC9C,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;CAgBjC"} \ No newline at end of file diff --git a/types/providers/provider-pocket.d.ts b/types/providers/provider-pocket.d.ts deleted file mode 100644 index 01b2fd311..000000000 --- a/types/providers/provider-pocket.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * [[link-pocket]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Polygon (``matic``) - * - Arbitrum (``arbitrum``) - * - * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] - */ -import { FetchRequest } from "../utils/index.js"; -import { AbstractProvider } from "./abstract-provider.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -/** - * The **PocketProvider** connects to the [[link-pocket]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API key is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-pocket-signup). - */ -export declare class PocketProvider extends JsonRpcProvider implements CommunityResourcable { - /** - * The Application ID for the Pocket connection. - */ - readonly applicationId: string; - /** - * The Application Secret for making authenticated requests - * to the Pocket connection. - */ - readonly applicationSecret: null | string; - /** - * Create a new **PocketProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network?: Networkish, applicationId?: null | string, applicationSecret?: null | string); - _getProvider(networkId: number): AbstractProvider; - /** - * Returns a prepared request for connecting to %%network%% with - * %%applicationId%%. - */ - static getRequest(network: Network, applicationId?: null | string, applicationSecret?: null | string): FetchRequest; - isCommunityResource(): boolean; -} -//# sourceMappingURL=provider-pocket.d.ts.map \ No newline at end of file diff --git a/types/providers/provider-pocket.d.ts.map b/types/providers/provider-pocket.d.ts.map deleted file mode 100644 index fc500ed76..000000000 --- a/types/providers/provider-pocket.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-pocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-pocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAoB/C;;;;;;;;GAQG;AACH,qBAAa,cACX,SAAQ,eACR,YAAW,oBAAoB;IAE/B;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAG,MAAM,CAAC;IAEhC;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAG,IAAI,GAAG,MAAM,CAAC;IAE3C;;;;;OAKG;gBAED,QAAQ,CAAC,EAAE,UAAU,EACrB,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,EAC7B,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM;IA4BnC,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAWjD;;;OAGG;IACH,MAAM,CAAC,UAAU,CACf,OAAO,EAAE,OAAO,EAChB,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,EAC7B,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM,GAChC,YAAY;IAwBf,mBAAmB,IAAI,OAAO;CAG/B"} \ No newline at end of file diff --git a/types/providers/provider-quicknode.d.ts b/types/providers/provider-quicknode.d.ts deleted file mode 100644 index 610dc234a..000000000 --- a/types/providers/provider-quicknode.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * [[link-quicknode]] provides a third-party service for connecting to - * various blockchains over JSON-RPC. - * - * **Supported Networks** - * - * - Core Mainnet (``mainnet``) - * - Goerli Testnet (``goerli``) - * - Arbitrum (``arbitrum``) - * - Arbitrum Goerli Testnet (``arbitrum-goerli``) - * - Optimism (``optimism``) - * - Optimism Goerli Testnet (``optimism-goerli``) - * - Polygon (``matic``) - * - Polygon Mumbai Testnet (``matic-mumbai``) - * - * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] - */ -import { FetchRequest } from "../utils/index.js"; -import { Network } from "./network.js"; -import { JsonRpcProvider } from "./provider-jsonrpc.js"; -import type { AbstractProvider } from "./abstract-provider.js"; -import type { CommunityResourcable } from "./community.js"; -import type { Networkish } from "./network.js"; -/** - * The **QuickNodeProvider** connects to the [[link-quicknode]] - * JSON-RPC end-points. - * - * By default, a highly-throttled API token is used, which is - * appropriate for quick prototypes and simple scripts. To - * gain access to an increased rate-limit, it is highly - * recommended to [sign up here](link-quicknode). - */ -export declare class QuickNodeProvider extends JsonRpcProvider implements CommunityResourcable { - /** - * The API token. - */ - readonly token: string; - /** - * Creates a new **QuickNodeProvider**. - */ - constructor(_network?: Networkish, token?: null | string); - _getProvider(networkId: number): AbstractProvider; - isCommunityResource(): boolean; - /** - * Returns a new request prepared for %%network%% and the - * %%token%%. - */ - static getRequest(network: Network, token?: null | string): FetchRequest; -} -//# sourceMappingURL=provider-quicknode.d.ts.map \ No newline at end of file diff --git a/types/providers/provider-quicknode.d.ts.map b/types/providers/provider-quicknode.d.ts.map deleted file mode 100644 index 8b27f9f9d..000000000 --- a/types/providers/provider-quicknode.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-quicknode.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-quicknode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAEL,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA0B/C;;;;;;;;GAQG;AACH,qBAAa,iBACX,SAAQ,eACR,YAAW,oBAAoB;IAE/B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAG,MAAM,CAAC;IAExB;;OAEG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM;IAexD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAOjD,mBAAmB,IAAI,OAAO;IAI9B;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;CAoBzE"} \ No newline at end of file diff --git a/types/providers/provider-socket.d.ts b/types/providers/provider-socket.d.ts deleted file mode 100644 index 7ee5054ce..000000000 --- a/types/providers/provider-socket.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Generic long-lived socket provider. - * - * Sub-classing notes - * - a sub-class MUST call the `_start()` method once connected - * - a sub-class MUST override the `_write(string)` method - * - a sub-class MUST call `_processMessage(string)` for each message - * - * @_subsection: api/providers/abstract-provider - */ -import { JsonRpcApiProvider } from "./provider-jsonrpc.js"; -import type { Subscriber, Subscription } from "./abstract-provider.js"; -import type { EventFilter } from "./provider.js"; -import type { JsonRpcError, JsonRpcPayload, JsonRpcResult } from "./provider-jsonrpc.js"; -import type { Networkish } from "./network.js"; -export declare class SocketSubscriber implements Subscriber { - #private; - get filter(): Array; - constructor(provider: SocketProvider, filter: Array); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; - _handleMessage(message: any): void; - _emit(provider: SocketProvider, message: any): Promise; -} -export declare class SocketBlockSubscriber extends SocketSubscriber { - constructor(provider: SocketProvider); - _emit(provider: SocketProvider, message: any): Promise; -} -export declare class SocketPendingSubscriber extends SocketSubscriber { - constructor(provider: SocketProvider); - _emit(provider: SocketProvider, message: any): Promise; -} -export declare class SocketEventSubscriber extends SocketSubscriber { - #private; - get logFilter(): EventFilter; - constructor(provider: SocketProvider, filter: EventFilter); - _emit(provider: SocketProvider, message: any): Promise; -} -/** - * SocketProvider... - * - */ -export declare class SocketProvider extends JsonRpcApiProvider { - #private; - constructor(network?: Networkish); - _getSubscriber(sub: Subscription): Subscriber; - _register(filterId: number | string, subscriber: SocketSubscriber): void; - _send(payload: JsonRpcPayload | Array): Promise>; - _processMessage(message: string): Promise; - _write(message: string): Promise; -} -//# sourceMappingURL=provider-socket.d.ts.map \ No newline at end of file diff --git a/types/providers/provider-socket.d.ts.map b/types/providers/provider-socket.d.ts.map deleted file mode 100644 index bdbc5029a..000000000 --- a/types/providers/provider-socket.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-socket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU/C,qBAAa,gBAAiB,YAAW,UAAU;;IAIjD,IAAI,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAEvB;gBAOW,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC;IAQxD,KAAK,IAAI,IAAI;IASb,IAAI,IAAI,IAAI;IASZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAUtC,MAAM,IAAI,IAAI;IAId,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI;IAqB5B,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE;AAED,qBAAa,qBAAsB,SAAQ,gBAAgB;gBAC7C,QAAQ,EAAE,cAAc;IAI9B,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE;AAED,qBAAa,uBAAwB,SAAQ,gBAAgB;gBAC/C,QAAQ,EAAE,cAAc;IAI9B,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE;AAED,qBAAa,qBAAsB,SAAQ,gBAAgB;;IAEzD,IAAI,SAAS,IAAI,WAAW,CAE3B;gBAEW,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW;IAKnD,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAMnE;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,kBAAkB;;gBAiBxC,OAAO,CAAC,EAAE,UAAU;IAiBhC,cAAc,CAAC,GAAG,EAAE,YAAY,GAAG,UAAU;IAoB7C,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,gBAAgB,GAAG,IAAI;IAWlE,KAAK,CACT,OAAO,EAAE,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAC9C,OAAO,CAAC,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC,CAAC;IAyCzC,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoC/C,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C"} \ No newline at end of file diff --git a/types/providers/provider-websocket.d.ts b/types/providers/provider-websocket.d.ts deleted file mode 100644 index 9938502d0..000000000 --- a/types/providers/provider-websocket.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { SocketProvider } from "./provider-socket.js"; -import type { Networkish } from "./network.js"; -export interface WebSocketLike { - onopen: null | ((...args: Array) => any); - onmessage: null | ((...args: Array) => any); - onerror: null | ((...args: Array) => any); - readyState: number; - send(payload: any): void; - close(code?: number, reason?: string): void; -} -export type WebSocketCreator = () => WebSocketLike; -export declare class WebSocketProvider extends SocketProvider { - #private; - get websocket(): WebSocketLike; - constructor(url: string | WebSocketLike | WebSocketCreator, network?: Networkish); - _write(message: string): Promise; - destroy(): Promise; -} -//# sourceMappingURL=provider-websocket.d.ts.map \ No newline at end of file diff --git a/types/providers/provider-websocket.d.ts.map b/types/providers/provider-websocket.d.ts.map deleted file mode 100644 index a60b262ca..000000000 --- a/types/providers/provider-websocket.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider-websocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-websocket.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IAC9C,SAAS,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IACjD,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IAE/C,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,aAAa,CAAC;AAEnD,qBAAa,iBAAkB,SAAQ,cAAc;;IAInD,IAAI,SAAS,IAAI,aAAa,CAK7B;gBAGC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,gBAAgB,EAC9C,OAAO,CAAC,EAAE,UAAU;IA8ChB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAO/B"} \ No newline at end of file diff --git a/types/providers/provider.d.ts b/types/providers/provider.d.ts deleted file mode 100644 index 68556f754..000000000 --- a/types/providers/provider.d.ts +++ /dev/null @@ -1,623 +0,0 @@ -import type { AddressLike, NameResolver } from "../address/index.js"; -import type { BigNumberish, EventEmitterable } from "../utils/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { ContractRunner } from "./contracts.js"; -import type { Network } from "./network.js"; -export type BlockTag = BigNumberish | string; -import { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; -/** - * A **FeeData** wraps all the fee-related values associated with - * the network. - */ -export declare class FeeData { - /** - * The energy price for legacy networks. - */ - readonly energyPrice: null | bigint; - constructor(energyPrice?: null | bigint); - /** - * Returns a JSON-friendly value. - */ - toJSON(): any; -} -export interface TransactionRequest { - type?: null | number; - to?: null | AddressLike; - from?: null | AddressLike; - nonce?: null | number; - energyLimit?: null | BigNumberish; - energyPrice?: null | BigNumberish; - data?: null | string; - value?: null | BigNumberish; - networkId?: null | BigNumberish; - customData?: any; - blockTag?: BlockTag; - enableCcipRead?: boolean; -} -export interface PreparedTransactionRequest { - to?: AddressLike; - from?: AddressLike; - nonce?: number; - energyLimit?: bigint; - energyPrice?: bigint; - data?: string; - value?: bigint; - networkId?: bigint; - customData?: any; - blockTag?: BlockTag; - enableCcipRead?: boolean; -} -export declare function copyRequest(req: TransactionRequest): PreparedTransactionRequest; -/** - * An Interface to indicate a [[Block]] has been included in the - * blockchain. This asserts a Type Guard that necessary properties - * are non-null. - * - * Before a block is included, it is a //pending// block. - */ -export interface MinedBlock extends Block { - readonly number: number; - readonly hash: string; - readonly timestamp: number; - readonly date: Date; - readonly miner: string; -} -/** - * A **Block** represents the data associated with a full block on - * Core. - */ -export declare class Block implements BlockParams, Iterable { - #private; - /** - * The provider connected to the block used to fetch additional details - * if necessary. - */ - readonly provider: Provider; - /** - * The block number, sometimes called the block height. This is a - * sequential number that is one higher than the parent block. - */ - readonly number: number; - /** - * The block hash. - */ - readonly hash: null | string; - /** - * The timestamp for this block, which is the number of seconds since - * epoch that this block was included. - */ - readonly timestamp: number; - /** - * The block hash of the parent block. - */ - readonly parentHash: string; - /** - * The nonce. - * - * On legacy networks, this is the random number inserted which - * permitted the difficulty target to be reached. - */ - readonly nonce: string; - /** - * The difficulty target. - * - * On legacy networks, this is the proof-of-work target required - * for a block to meet the protocol rules to be included. - * - * On modern networks, this is a random number arrived at using - * randao. @TODO: Find links? - */ - readonly difficulty: bigint; - /** - * The total energy limit for this block. - */ - readonly energyLimit: bigint; - /** - * The total energy used in this block. - */ - readonly energyUsed: bigint; - /** - * The miner coinbase address, wihch receives any subsidies for - * including this block. - */ - readonly miner: string; - /** - * Any extra data the validator wished to include. - */ - readonly extraData: string; - /** - * The base fee per energy that all transactions in this block were - * charged. - * - * This adjusts after each block, depending on how congested the network - * is. - */ - readonly baseFeePerEnergy: null | bigint; - /** - * Create a new **Block** object. - * - * This should generally not be necessary as the unless implementing a - * low-level library. - */ - constructor(block: BlockParams, provider: Provider); - /** - * Returns the list of transaction hashes. - */ - get transactions(): ReadonlyArray; - /** - * Returns the complete transactions for blocks which - * prefetched them, by passing ``true`` to %%prefetchTxs%% - * into [[provider_getBlock]]. - */ - get prefetchedTransactions(): Array; - /** - * Returns a JSON-friendly value. - */ - toJSON(): any; - [Symbol.iterator](): Iterator; - /** - * The number of transactions in this block. - */ - get length(): number; - /** - * The [[link-js-date]] this block was included at. - */ - get date(): null | Date; - /** - * Get the transaction at %%indexe%% within this block. - */ - getTransaction(indexOrHash: number | string): Promise; - getPrefetchedTransaction(indexOrHash: number | string): TransactionResponse; - /** - * Has this block been mined. - * - * If true, the block has been typed-gaurded that all mined - * properties are non-null. - */ - isMined(): this is MinedBlock; - /** - * - */ - isLondon(): this is Block & { - baseFeePerEnergy: bigint; - }; - orphanedEvent(): OrphanFilter; -} -export declare class Log implements LogParams { - readonly provider: Provider; - readonly transactionHash: string; - readonly blockHash: string; - readonly blockNumber: number; - readonly removed: boolean; - readonly address: string; - readonly data: string; - readonly topics: ReadonlyArray; - readonly index: number; - readonly transactionIndex: number; - constructor(log: LogParams, provider: Provider); - toJSON(): any; - getBlock(): Promise; - getTransaction(): Promise; - getTransactionReceipt(): Promise; - removedEvent(): OrphanFilter; -} -export declare class TransactionReceipt implements TransactionReceiptParams, Iterable { - #private; - readonly provider: Provider; - readonly to: null | string; - readonly from: string; - readonly contractAddress: null | string; - readonly hash: string; - readonly index: number; - readonly blockHash: string; - readonly blockNumber: number; - readonly logsBloom: string; - readonly energyUsed: bigint; - readonly cumulativeEnergyUsed: bigint; - readonly energyPrice: bigint; - readonly type: number; - readonly status: null | number; - readonly root: null | string; - constructor(tx: TransactionReceiptParams, provider: Provider); - get logs(): ReadonlyArray; - toJSON(): any; - get length(): number; - [Symbol.iterator](): Iterator; - get fee(): bigint; - getBlock(): Promise; - getTransaction(): Promise; - getResult(): Promise; - confirmations(): Promise; - removedEvent(): OrphanFilter; - reorderedEvent(other?: TransactionResponse): OrphanFilter; -} -export interface MinedTransactionResponse extends TransactionResponse { - blockNumber: number; - blockHash: string; - date: Date; -} -export declare class TransactionResponse implements TransactionLike, TransactionResponseParams { - #private; - /** - * The provider this is connected to, which will influence how its - * methods will resolve its async inspection methods. - */ - readonly provider: Provider; - /** - * The block number of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - readonly blockNumber: null | number; - /** - * The blockHash of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - readonly blockHash: null | string; - /** - * The index within the block that this transaction resides at. - */ - readonly index: number; - /** - * The transaction hash. - */ - readonly hash: string; - /** - * The [[link-eip-2718]] transaction envelope type. This is - * ``0`` for legacy transactions types. - */ - readonly type: number; - /** - * The receiver of this transaction. - * - * If ``null``, then the transaction is an initcode transaction. - * This means the result of executing the [[data]] will be deployed - * as a new contract on chain (assuming it does not revert) and the - * address may be computed using [[getCreateAddress]]. - */ - readonly to: null | string; - /** - * The sender of this transaction. It is implicitly computed - * from the transaction pre-image hash (as the digest) and the - * [[signature]] using ecrecover. - */ - readonly from: string; - /** - * The nonce, which is used to prevent replay attacks and offer - * a method to ensure transactions from a given sender are explicitly - * ordered. - * - * When sending a transaction, this must be equal to the number of - * transactions ever sent by [[from]]. - */ - readonly nonce: number; - /** - * The maximum units of energy this transaction can consume. If execution - * exceeds this, the entries transaction is reverted and the sender - * is charged for the full amount, despite not state changes being made. - */ - readonly energyLimit: bigint; - /** - * The energy price can have various values, depending on the network. - * - * In modern networks, for transactions that are included this is - * the //effective energy price// (the fee per energy that was actually - * charged), while for transactions that have not been included yet - * is the [[maxFeePerEnergy]]. - * - * For legacy transactions, or transactions on legacy networks, this - * is the fee that will be charged per unit of energy the transaction - * consumes. - */ - readonly energyPrice: bigint; - /** - * The data. - */ - readonly data: string; - /** - * The value, in ore. Use [[formatXCB]] to format this value - * as xcb. - */ - readonly value: bigint; - /** - * The chain ID. - */ - readonly networkId: bigint; - /** - * The signature. - */ - readonly signature: string; - /** - * Create a new TransactionResponse with %%tx%% parameters - * connected to %%provider%%. - */ - constructor(tx: TransactionResponseParams, provider: Provider); - /** - * Returns a JSON representation of this transaction. - */ - toJSON(): any; - /** - * Resolves to the Block that this transaction was included in. - * - * This will return null if the transaction has not been included yet. - */ - getBlock(): Promise; - /** - * Resolves to this transaction being re-requested from the - * provider. This can be used if you have an unmined transaction - * and wish to get an up-to-date populated instance. - */ - getTransaction(): Promise; - /** - * Resolves once this transaction has been mined and has - * %%confirms%% blocks including it (default: ``1``) with an - * optional %%timeout%%. - * - * This can resolve to ``null`` only if %%confirms%% is ``0`` - * and the transaction has not been mined, otherwise this will - * wait until enough confirmations have completed. - */ - wait(_confirms?: number, _timeout?: number): Promise; - /** - * Returns ``true`` if this transaction has been included. - * - * This is effective only as of the time the TransactionResponse - * was instantiated. To get up-to-date information, use - * [[getTransaction]]. - * - * This provides a Type Guard that this transaction will have - * non-null property values for properties that are null for - * unmined transactions. - */ - isMined(): this is MinedTransactionResponse; - /** - * Returns true if the transaction is a legacy (i.e. ``type == 0``) - * transaction. - * - * This provides a Type Guard that this transaction will have - * the ``null``-ness for hardfork-specific properties set correctly. - */ - isLegacy(): this is TransactionResponse & { - accessList: null; - maxFeePerEnergy: null; - maxPriorityFeePerEnergy: null; - }; - /** - * Returns a filter which can be used to listen for orphan events - * that evict this transaction. - */ - removedEvent(): OrphanFilter; - /** - * Returns a filter which can be used to listen for orphan events - * that re-order this event against %%other%%. - */ - reorderedEvent(other?: TransactionResponse): OrphanFilter; - /** - * Returns a new TransactionResponse instance which has the ability to - * detect (and throw an error) if the transaction is replaced, which - * will begin scanning at %%startBlock%%. - * - * This should generally not be used by developers and is intended - * primarily for internal use. Setting an incorrect %%startBlock%% can - * have devastating performance consequences if used incorrectly. - */ - replaceableTransaction(startBlock: number): TransactionResponse; -} -/** - * An Orphan Filter allows detecting when an orphan block has - * resulted in dropping a block or transaction or has resulted - * in transactions changing order. - * - * Not currently fully supported. - */ -export type OrphanFilter = { - orphan: "drop-block"; - hash: string; - number: number; -} | { - orphan: "drop-transaction"; - tx: { - hash: string; - blockHash: string; - blockNumber: number; - }; - other?: { - hash: string; - blockHash: string; - blockNumber: number; - }; -} | { - orphan: "reorder-transaction"; - tx: { - hash: string; - blockHash: string; - blockNumber: number; - }; - other?: { - hash: string; - blockHash: string; - blockNumber: number; - }; -} | { - orphan: "drop-log"; - log: { - transactionHash: string; - blockHash: string; - blockNumber: number; - address: string; - data: string; - topics: ReadonlyArray; - index: number; - }; -}; -/** - * A **TopicFilter** provides a struture to define bloom-filter - * queries. - * - * Each field that is ``null`` matches **any** value, a field that is - * a ``string`` must match exactly that value and and ``array`` is - * effectively an ``OR``-ed set, where any one of those values must - * match. - */ -export type TopicFilter = Array>; -export interface EventFilter { - address?: AddressLike | Array; - topics?: TopicFilter; -} -export interface Filter extends EventFilter { - fromBlock?: BlockTag; - toBlock?: BlockTag; -} -export interface FilterByBlockHash extends EventFilter { - blockHash?: string; -} -export type ProviderEvent = string | Array> | EventFilter | OrphanFilter; -/** - * A **Provider** is the primary method to interact with the read-only - * content on Core. - * - * It allows access to details about accounts, blocks and transactions - * and the ability to query event logs and simulate contract execution. - * - * Account data includes the [balance](getBalance), - * [transaction count](getTransactionCount), [code](getCode) and - * [state trie storage](getStorage). - * - * Simulating execution can be used to [call](call), - * [estimate energy](estimateEnergy) and - * [get transaction results](getTransactionResult). - * - * The [[broadcastTransaction]] is the only method which allows updating - * the blockchain, but it is usually accessed by a [[Signer]], since a - * private key must be used to sign the transaction before it can be - * broadcast. - */ -export interface Provider extends ContractRunner, EventEmitterable, NameResolver { - /** - * The provider iteself. - * - * This is part of the necessary API for executing a contract, as - * it provides a common property on any [[ContractRunner]] that - * can be used to access the read-only portion of the runner. - */ - provider: this; - /** - * Shutdown any resources this provider is using. No additional - * calls should be made to this provider after calling this. - */ - destroy(): void; - /** - * Get the current block number. - */ - getBlockNumber(): Promise; - /** - * Get the connected [[Network]]. - */ - getNetwork(): Promise; - /** - * Get the best guess at the recommended [[FeeData]]. - */ - getFeeData(): Promise; - /** - * Get the account balance (in ore) of %%address%%. If %%blockTag%% - * is specified and the node supports archive access for that - * %%blockTag%%, the balance is as of that [[BlockTag]]. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getBalance(address: AddressLike, blockTag?: BlockTag): Promise; - /** - * Get the number of transactions ever sent for %%address%%, which - * is used as the ``nonce`` when sending a transaction. If - * %%blockTag%% is specified and the node supports archive access - * for that %%blockTag%%, the transaction count is as of that - * [[BlockTag]]. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise; - /** - * Get the bytecode for %%address%%. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getCode(address: AddressLike, blockTag?: BlockTag): Promise; - /** - * Get the storage slot value for %%address%% at slot %%position%%. - * - * @note On nodes without archive access enabled, the %%blockTag%% may be - * **silently ignored** by the node, which may cause issues if relied on. - */ - getStorage(address: AddressLike, position: BigNumberish, blockTag?: BlockTag): Promise; - /** - * Estimates the amount of energy required to executre %%tx%%. - */ - estimateEnergy(tx: TransactionRequest): Promise; - /** - * Simulate the execution of %%tx%%. If the call reverts, it will - * throw a [[CallExceptionError]] which includes the revert data. - */ - call(tx: TransactionRequest): Promise; - /** - * Broadcasts the %%signedTx%% to the network, adding it to the - * memory pool of any node for which the transaction meets the - * rebroadcast requirements. - */ - broadcastTransaction(signedTx: string): Promise; - /** - * Resolves to the block for %%blockHashOrBlockTag%%. - * - * If %%prefetchTxs%%, and the backend supports including transactions - * with block requests, all transactions will be included and the - * [[Block]] object will not need to make remote calls for getting - * transactions. - */ - getBlock(blockHashOrBlockTag: BlockTag | string, prefetchTxs?: boolean): Promise; - /** - * Resolves to the transaction for %%hash%%. - * - * If the transaction is unknown or on pruning nodes which - * discard old transactions this resolves to ``null``. - */ - getTransaction(hash: string): Promise; - /** - * Resolves to the transaction receipt for %%hash%%, if mined. - * - * If the transaction has not been mined, is unknown or on - * pruning nodes which discard old transactions this resolves to - * ``null``. - */ - getTransactionReceipt(hash: string): Promise; - /** - * Resolves to the result returned by the executions of %%hash%%. - * - * This is only supported on nodes with archive access and with - * the necessary debug APIs enabled. - */ - getTransactionResult(hash: string): Promise; - /** - * Resolves to the list of Logs that match %%filter%% - */ - getLogs(filter: Filter | FilterByBlockHash): Promise>; - /** - * Resolves to the address configured for the %%ensName%% or - * ``null`` if unconfigured. - */ - /** - * Waits until the transaction %%hash%% is mined and has %%confirms%% - * confirmations. - */ - waitForTransaction(hash: string, confirms?: number, timeout?: number): Promise; - /** - * Resolves to the block at %%blockTag%% once it has been mined. - * - * This can be useful for waiting some number of blocks by using - * the ``currentBlockNumber + N``. - */ - waitForBlock(blockTag?: BlockTag): Promise; -} -//# sourceMappingURL=provider.d.ts.map \ No newline at end of file diff --git a/types/providers/provider.d.ts.map b/types/providers/provider.d.ts.map deleted file mode 100644 index fdfa52655..000000000 --- a/types/providers/provider.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,MAAM,CAAC;AAE7C,OAAO,EACL,WAAW,EACX,SAAS,EACT,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,iBAAiB,CAAC;AAoBzB;;;GAGG;AACH,qBAAa,OAAO;IAClB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAG,IAAI,GAAG,MAAM,CAAC;gBAEzB,WAAW,CAAC,EAAE,IAAI,GAAG,MAAM;IAMvC;;OAEG;IACH,MAAM,IAAI,GAAG;CAOd;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErB,EAAE,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC;IAE1B,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAEtB,WAAW,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAClC,WAAW,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAElC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAC5B,SAAS,CAAC,EAAE,IAAI,GAA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GG;IAEH;;;OAGG;IACH,kBAAkB,CAChB,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAC,CAAC;IAEtC;;;;;OAKG;IACH,YAAY,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CACnD"} \ No newline at end of file diff --git a/types/providers/signer-noncemanager.d.ts b/types/providers/signer-noncemanager.d.ts deleted file mode 100644 index 31eae80ab..000000000 --- a/types/providers/signer-noncemanager.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { AbstractSigner } from "./abstract-signer.js"; -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -import type { Signer } from "./signer.js"; -export declare class NonceManager extends AbstractSigner { - #private; - signer: Signer; - constructor(signer: Signer); - getAddress(): Promise; - connect(provider: null | Provider): NonceManager; - getNonce(blockTag?: BlockTag): Promise; - increment(): void; - reset(): void; - sendTransaction(tx: TransactionRequest): Promise; - signTransaction(tx: TransactionRequest): Promise; - signMessage(message: string | Uint8Array): Promise; - signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -//# sourceMappingURL=signer-noncemanager.d.ts.map \ No newline at end of file diff --git a/types/providers/signer-noncemanager.d.ts.map b/types/providers/signer-noncemanager.d.ts.map deleted file mode 100644 index 9f69385c3..000000000 --- a/types/providers/signer-noncemanager.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signer-noncemanager.d.ts","sourceRoot":"","sources":["../../src.ts/providers/signer-noncemanager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,qBAAa,YAAa,SAAQ,cAAc;;IAC9C,MAAM,EAAG,MAAM,CAAC;gBAKJ,MAAM,EAAE,MAAM;IAQpB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,YAAY;IAI1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAapD,SAAS,IAAI,IAAI;IAIjB,KAAK,IAAI,IAAI;IAKP,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAY3E,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1D,aAAa,CACX,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC;CAGnB"} \ No newline at end of file diff --git a/types/providers/signer.d.ts b/types/providers/signer.d.ts deleted file mode 100644 index a6383a32f..000000000 --- a/types/providers/signer.d.ts +++ /dev/null @@ -1,118 +0,0 @@ -import type { Addressable, NameResolver } from "../address/index.js"; -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { TransactionLike } from "../transaction/index.js"; -import type { ContractRunner } from "./contracts.js"; -import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; -/** - * A Signer represents an account on the Core Blockchain, and is most often - * backed by a private key represented by a mnemonic or residing on a Hardware Wallet. - * - * The API remains abstract though, so that it can deal with more advanced exotic - * Signing entities, such as Smart Contract Wallets or Virtual Wallets (where the - * private key may not be known). - */ -export interface Signer extends Addressable, ContractRunner, NameResolver { - /** - * The [[Provider]] attached to this Signer (if any). - */ - provider: null | Provider; - /** - * Returns a new instance of this Signer connected to //provider// or detached - * from any Provider if null. - */ - connect(provider: null | Provider): Signer; - /** - * Get the address of the Signer. - */ - getAddress(): Promise; - /** - * Gets the next nonce required for this Signer to send a transaction. - * - * @param blockTag - The blocktag to base the transaction count on, keep in mind - * many nodes do not honour this value and silently ignore it [default: ``"latest"``] - */ - getNonce(blockTag?: BlockTag): Promise; - /** - * Prepares a {@link TransactionRequest} for calling: - * - resolves ``to`` and ``from`` addresses - * - if ``from`` is specified , check that it matches this Signer - * - * @param tx - The call to prepare - */ - populateCall(tx: TransactionRequest): Promise>; - /** - * Prepares a {@link TransactionRequest} for sending to the network by - * populating any missing properties: - * - resolves ``to`` and ``from`` addresses - * - if ``from`` is specified , check that it matches this Signer - * - populates ``nonce`` via ``signer.getNonce("pending")`` - * - populates ``energyLimit`` via ``signer.estimateEnergy(tx)`` - * - populates ``networkId`` via ``signer.provider.getNetwork()`` - * - populates ``type`` and relevant fee data for that type (``energyPrice`` - * for legacy transactions, ``maxFeePerEnergy`` for EIP-1559, etc) - * - * @note Some Signer implementations may skip populating properties that - * are populated downstream; for example JsonRpcSigner defers to the - * node to populate the nonce and fee data. - * - * @param tx - The call to prepare - */ - populateTransaction(tx: TransactionRequest): Promise>; - /** - * Estimates the required energy required to execute //tx// on the Blockchain. This - * will be the expected amount a transaction will require as its ``energyLimit`` - * to successfully run all the necessary computations and store the needed state - * that the transaction intends. - * - * Keep in mind that this is **best efforts**, since the state of the Blockchain - * is in flux, which could affect transaction energy requirements. - * - * @throws UNPREDICTABLE_ENERGY_LIMIT A transaction that is believed by the node to likely - * fail will throw an error during energy estimation. This could indicate that it - * will actually fail or that the circumstances are simply too complex for the - * node to take into account. In these cases, a manually determined ``energyLimit`` - * will need to be made. - */ - estimateEnergy(tx: TransactionRequest): Promise; - /** - * Evaluates the //tx// by running it against the current Blockchain state. This - * cannot change state and has no cost in xcb, as it is effectively simulating - * execution. - * - * This can be used to have the Blockchain perform computations based on its state - * (e.g. running a Contract's getters) or to simulate the effect of a transaction - * before actually performing an operation. - */ - call(tx: TransactionRequest): Promise; - /** - * Resolves an ENS Name to an address. - */ - resolveName(name: string): Promise; - /** - * Signs %%tx%%, returning the fully signed transaction. This does not - * populate any additional properties within the transaction. - */ - signTransaction(tx: TransactionRequest): Promise; - /** - * Sends %%tx%% to the Network. The ``signer.populateTransaction(tx)`` - * is called first to ensure all necessary properties for the - * transaction to be valid have been popualted first. - */ - sendTransaction(tx: TransactionRequest): Promise; - /** - * Signers an [[link-eip-191]] prefixed personal message. - * - * If the %%message%% is a string, it is signed as UTF-8 encoded bytes. It is **not** - * interpretted as a [[BytesLike]]; so the string ``"0x1234"`` is signed as six - * characters, **not** two bytes. - * - * To sign that example as two bytes, the Uint8Array should be used - * (i.e. ``new Uint8Array([ 0x12, 0x34 ])``). - */ - signMessage(message: string | Uint8Array): Promise; - /** - * Signs the [[link-eip-712]] typed data. - */ - signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -//# sourceMappingURL=signer.d.ts.map \ No newline at end of file diff --git a/types/providers/signer.d.ts.map b/types/providers/signer.d.ts.map deleted file mode 100644 index 4dff87bbe..000000000 --- a/types/providers/signer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src.ts/providers/signer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB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OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3D;;OAEG;IACH,aAAa,CACX,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB"} \ No newline at end of file diff --git a/types/providers/subscriber-connection.d.ts b/types/providers/subscriber-connection.d.ts deleted file mode 100644 index b235e3b46..000000000 --- a/types/providers/subscriber-connection.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Subscriber } from "./abstract-provider.js"; -import type { Provider } from "./provider.js"; -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export interface ConnectionRpcProvider extends Provider { - _subscribe(param: Array, processFunc: (result: any) => void): number; - _unsubscribe(filterId: number): void; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class BlockConnectionSubscriber implements Subscriber { - #private; - constructor(provider: ConnectionRpcProvider); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -//# sourceMappingURL=subscriber-connection.d.ts.map \ No newline at end of file diff --git a/types/providers/subscriber-connection.d.ts.map b/types/providers/subscriber-connection.d.ts.map deleted file mode 100644 index 2f88c6893..000000000 --- a/types/providers/subscriber-connection.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-connection.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-connection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,QAAQ;IAErD,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,CAAC;IAC1E,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,UAAU;;gBAQ9C,QAAQ,EAAE,qBAAqB;IAO3C,KAAK,IAAI,IAAI;IAiBb,IAAI,IAAI,IAAI;IAYZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAOtC,MAAM,IAAI,IAAI;CAGf"} \ No newline at end of file diff --git a/types/providers/subscriber-filterid.d.ts b/types/providers/subscriber-filterid.d.ts deleted file mode 100644 index 3e58a6871..000000000 --- a/types/providers/subscriber-filterid.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; -import type { EventFilter } from "./provider.js"; -import type { JsonRpcApiProvider } from "./provider-jsonrpc.js"; -/** - * Some backends support subscribing to events using a Filter ID. - * - * When subscribing with this technique, the node issues a unique - * //Filter ID//. At this point the node dedicates resources to - * the filter, so that periodic calls to follow up on the //Filter ID// - * will receive any events since the last call. - * - * @_docloc: api/providers/abstract-provider - */ -export declare class FilterIdSubscriber implements Subscriber { - #private; - constructor(provider: JsonRpcApiProvider); - _subscribe(provider: JsonRpcApiProvider): Promise; - _emitResults(provider: AbstractProvider, result: Array): Promise; - _recover(provider: AbstractProvider): Subscriber; - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -/** - * A **FilterIdSubscriber** for receiving contract events. - * - * @_docloc: api/providers/abstract-provider - */ -export declare class FilterIdEventSubscriber extends FilterIdSubscriber { - #private; - constructor(provider: JsonRpcApiProvider, filter: EventFilter); - _recover(provider: AbstractProvider): Subscriber; - _subscribe(provider: JsonRpcApiProvider): Promise; - _emitResults(provider: JsonRpcApiProvider, results: Array): Promise; -} -/** - * A **FilterIdSubscriber** for receiving pending transactions events. - * - * @_docloc: api/providers/abstract-provider - */ -export declare class FilterIdPendingSubscriber extends FilterIdSubscriber { - _subscribe(provider: JsonRpcApiProvider): Promise; - _emitResults(provider: JsonRpcApiProvider, results: Array): Promise; -} -//# sourceMappingURL=subscriber-filterid.d.ts.map \ No newline at end of file diff --git a/types/providers/subscriber-filterid.d.ts.map b/types/providers/subscriber-filterid.d.ts.map deleted file mode 100644 index b2d81a26c..000000000 --- a/types/providers/subscriber-filterid.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-filterid.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-filterid.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAMhE;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,YAAW,UAAU;;gBAYvC,QAAQ,EAAE,kBAAkB;IAaxC,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3E,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU;IAkEhD,KAAK,IAAI,IAAI;IASb,IAAI,IAAI,IAAI;IAWZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAOtC,MAAM,IAAI,IAAI;CAGf;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,kBAAkB;;gBAGjD,QAAQ,EAAE,kBAAkB,EAAE,MAAM,EAAE,WAAW;IAK7D,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU;IAI1C,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAKzD,YAAY,CAChB,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAClB,OAAO,CAAC,IAAI,CAAC;CAKjB;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,kBAAkB;IACzD,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,YAAY,CAChB,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAClB,OAAO,CAAC,IAAI,CAAC;CAKjB"} \ No newline at end of file diff --git a/types/providers/subscriber-polling.d.ts b/types/providers/subscriber-polling.d.ts deleted file mode 100644 index fcf4a8070..000000000 --- a/types/providers/subscriber-polling.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; -import type { EventFilter, OrphanFilter, ProviderEvent } from "./provider.js"; -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare function getPollingSubscriber(provider: AbstractProvider, event: ProviderEvent): Subscriber; -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class PollingBlockSubscriber implements Subscriber { - #private; - constructor(provider: AbstractProvider); - get pollingInterval(): number; - set pollingInterval(value: number); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class OnBlockSubscriber implements Subscriber { - #private; - constructor(provider: AbstractProvider); - _poll(blockNumber: number, provider: AbstractProvider): Promise; - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class PollingOrphanSubscriber extends OnBlockSubscriber { - #private; - constructor(provider: AbstractProvider, filter: OrphanFilter); - _poll(blockNumber: number, provider: AbstractProvider): Promise; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class PollingTransactionSubscriber extends OnBlockSubscriber { - #private; - constructor(provider: AbstractProvider, hash: string); - _poll(blockNumber: number, provider: AbstractProvider): Promise; -} -/** - * @TODO - * - * @_docloc: api/providers/abstract-provider - */ -export declare class PollingEventSubscriber implements Subscriber { - #private; - constructor(provider: AbstractProvider, filter: EventFilter); - start(): void; - stop(): void; - pause(dropWhilePaused?: boolean): void; - resume(): void; -} -//# sourceMappingURL=subscriber-polling.d.ts.map \ No newline at end of file diff --git a/types/providers/subscriber-polling.d.ts.map b/types/providers/subscriber-polling.d.ts.map deleted file mode 100644 index 9082a53d0..000000000 --- a/types/providers/subscriber-polling.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscriber-polling.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-polling.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAM9E;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,aAAa,GACnB,UAAU,CAYZ;AAID;;;;GAIG;AACH,qBAAa,sBAAuB,YAAW,UAAU;;gBAU3C,QAAQ,EAAE,gBAAgB;IAQtC,IAAI,eAAe,IAAI,MAAM,CAE5B;IACD,IAAI,eAAe,CAAC,KAAK,EAAE,MAAM,EAEhC;IA2CD,KAAK,IAAI,IAAI;IAWb,IAAI,IAAI,IAAI;IAQZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAOtC,MAAM,IAAI,IAAI;CAGf;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW,UAAU;;gBAKtC,QAAQ,EAAE,gBAAgB;IAQhC,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3E,KAAK,IAAI,IAAI;IAUb,IAAI,IAAI,IAAI;IASZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAGtC,MAAM,IAAI,IAAI;CAGf;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,iBAAiB;;gBAGhD,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY;IAKtD,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAI5E;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,iBAAiB;;gBAGrD,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM;IAK9C,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAM5E;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,YAAW,UAAU;;gBAW3C,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW;IAmC3D,KAAK,IAAI,IAAI;IAcb,IAAI,IAAI,IAAI;IASZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAOtC,MAAM,IAAI,IAAI;CAGf"} \ No newline at end of file diff --git a/types/providers/ws-browser.d.ts b/types/providers/ws-browser.d.ts deleted file mode 100644 index d92720422..000000000 --- a/types/providers/ws-browser.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const _WebSocket: any; -export { _WebSocket as WebSocket }; -//# sourceMappingURL=ws-browser.d.ts.map \ No newline at end of file diff --git a/types/providers/ws-browser.d.ts.map b/types/providers/ws-browser.d.ts.map deleted file mode 100644 index 63da59ec3..000000000 --- a/types/providers/ws-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ws-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/ws-browser.ts"],"names":[],"mappings":"AAaA,QAAA,MAAM,UAAU,KAAwB,CAAC;AAEzC,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC"} \ No newline at end of file diff --git a/types/providers/ws.d.ts b/types/providers/ws.d.ts deleted file mode 100644 index 75d53b7d4..000000000 --- a/types/providers/ws.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { WebSocket } from "ws"; -//# sourceMappingURL=ws.d.ts.map \ No newline at end of file diff --git a/types/providers/ws.d.ts.map b/types/providers/ws.d.ts.map deleted file mode 100644 index c424f8d82..000000000 --- a/types/providers/ws.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src.ts/providers/ws.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC"} \ No newline at end of file diff --git a/types/transaction/accesslist.d.ts b/types/transaction/accesslist.d.ts deleted file mode 100644 index aac12cccf..000000000 --- a/types/transaction/accesslist.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { AccessList, AccessListish } from "./index.js"; -/** - * Returns a [[AccessList]] from any corebcsupported access-list structure. - */ -export declare function accessListify(value: AccessListish): AccessList; -//# sourceMappingURL=accesslist.d.ts.map \ No newline at end of file diff --git a/types/transaction/accesslist.d.ts.map b/types/transaction/accesslist.d.ts.map deleted file mode 100644 index 4bd8ae700..000000000 --- a/types/transaction/accesslist.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"accesslist.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/accesslist.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAoB5D;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CA+C9D"} \ No newline at end of file diff --git a/types/transaction/address.d.ts b/types/transaction/address.d.ts deleted file mode 100644 index 5abba54e2..000000000 --- a/types/transaction/address.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { SigningKey } from "../crypto/index.js"; -import type { SignatureLike } from "../crypto/index.js"; -import type { BytesLike } from "../utils/index.js"; -/** - * Returns the address for the %%key%%. - * - * The key may be any standard form of public key or a private key. - */ -export declare function removeHexPrefix(val: string): string; -export declare function publicToAddress(key: BytesLike | string, prefix: string): string; -export declare function computeAddress(key: string | SigningKey, prefix: string): string; -/** - * Returns the recovered address for the private key that was - * used to sign %%digest%% that resulted in %%signature%%. - */ -export declare function recoverAddress(digest: BytesLike, signature: SignatureLike, prefix: string): string; -export declare function extractPrefix(address: string): string; -//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/types/transaction/address.d.ts.map b/types/transaction/address.d.ts.map deleted file mode 100644 index 620aa31e9..000000000 --- a/types/transaction/address.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/address.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD;;;;GAIG;AAEH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,SAAS,GAAG,MAAM,EACvB,MAAM,EAAE,MAAM,GACb,MAAM,CAIR;AAED,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,GAAG,UAAU,EACxB,MAAM,EAAE,MAAM,GACb,MAAM,CAQR;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,MAAM,GACb,MAAM,CAIR;AACD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGrD"} \ No newline at end of file diff --git a/types/transaction/index.d.ts b/types/transaction/index.d.ts deleted file mode 100644 index 01bca63fa..000000000 --- a/types/transaction/index.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Transactions.. - * - * @_section api/transaction:Transactions [about-transactions] - */ -/** - * A single [[AccessList]] entry of storage keys (slots) for an address. - */ -export type AccessListEntry = { - address: string; - storageKeys: Array; -}; -/** - * An ordered collection of [[AccessList]] entries. - */ -export type AccessList = Array; -/** - * Any corebc-supported access list structure. - */ -export type AccessListish = AccessList | Array<[string, Array]> | Record>; -export { accessListify } from "./accesslist.js"; -export { computeAddress, recoverAddress } from "./address.js"; -export { Transaction } from "./transaction.js"; -export type { TransactionLike } from "./transaction.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/transaction/index.d.ts.map b/types/transaction/index.d.ts.map deleted file mode 100644 index 304612964..000000000 --- a/types/transaction/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,KAAK,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAC9B,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"} \ No newline at end of file diff --git a/types/transaction/transaction.d.ts b/types/transaction/transaction.d.ts deleted file mode 100644 index 83340f6b5..000000000 --- a/types/transaction/transaction.d.ts +++ /dev/null @@ -1,169 +0,0 @@ -import { Signature } from "../crypto/index.js"; -import type { BigNumberish, BytesLike } from "../utils/index.js"; -import type { SignatureLike } from "../crypto/index.js"; -export interface TransactionLike { - /** - * The recipient address or ``null`` for an ``init`` transaction. - */ - to?: null | A; - /** - * The sender. - */ - from?: null | A; - /** - * The nonce. - */ - nonce?: null | number; - /** - * The maximum amount of energy that can be used. - */ - energyLimit?: null | BigNumberish; - /** - * The energy price for legacy and berlin transactions. - */ - energyPrice?: null | BigNumberish; - /** - * The data. - */ - data?: null | string; - /** - * The value (in ore) to send. - */ - value?: null | BigNumberish; - /** - * The chain ID the transaction is valid on. - */ - networkId?: null | BigNumberish; - /** - * The transaction hash. - */ - hash?: null | string; - /** - * The signature provided by the sender. - */ - signature?: null | SignatureLike; -} -/** - * A **Transaction** describes an operation to be executed on - * Core by an Externally Owned Account (EOA). It includes - * who (the [[to]] address), what (the [[data]]) and how much (the - * [[value]] in corebc) the operation should entail. - * - * @example: - * tx = new Transaction() - * //_result: - * - * tx.data = "0x1234"; - * //_result: - */ -export declare class Transaction implements TransactionLike { - #private; - /** - * The ``to`` address for the transaction or ``null`` if the - * transaction is an ``init`` transaction. - */ - get to(): null | string; - set to(value: null | string); - /** - * The transaction nonce. - */ - get nonce(): number; - set nonce(value: BigNumberish); - /** - * The energy limit. - */ - get energyLimit(): bigint; - set energyLimit(value: BigNumberish); - /** - * The energy price. - * - * On legacy networks this defines the fee that will be paid. On - * EIP-1559 networks, this should be ``null``. - */ - get energyPrice(): null | bigint; - set energyPrice(value: null | BigNumberish); - /** - * The transaction data. For ``init`` transactions this is the - * deployment code. - */ - get data(): string; - set data(value: BytesLike); - /** - * The amount of xcb (in ore) to send in this transactions. - */ - get value(): bigint; - set value(value: BigNumberish); - /** - * The chain ID this transaction is valid on. - */ - get networkId(): bigint; - set networkId(value: BigNumberish); - /** - * If signed, the signature for this transaction. - */ - get signature(): null | string; - set signature(value: null | SignatureLike); - /** - * Creates a new Transaction with default values. - */ - constructor(); - /** - * The transaction hash, if signed. Otherwise, ``null``. - */ - get hash(): null | string; - /** - * The pre-image hash of this transaction. - * - * This is the digest that a [[Signer]] must sign to authorize - * this transaction. - */ - get unsignedHash(): string; - /** - * The sending address, if signed. Otherwise, ``null``. - */ - get from(): null | string; - /** - * The public key of the sender, if signed. Otherwise, ``null``. - */ - get fromPublicKey(): null | string; - /** - * Returns true if signed. - * - * This provides a Type Guard that properties requiring a signed - * transaction are non-null. - */ - isSigned(): this is Transaction & { - type: number; - typeName: string; - from: string; - signature: Signature; - }; - /** - * The serialized transaction. - * - * This throws if the transaction is unsigned. For the pre-image, - * use [[unsignedSerialized]]. - */ - get serialized(): string; - /** - * The transaction pre-image. - * - * The hash of this is the digest which needs to be signed to - * authorize this transaction. - */ - get unsignedSerialized(): string; - /** - * Create a copy of this transaciton. - */ - clone(): Transaction; - /** - * Return a JSON-friendly object. - */ - toJSON(): any; - /** - * Create a **Transaction** from a serialized transaction or a - * Transaction-like object. - */ - static from(tx?: string | TransactionLike): Transaction; -} -//# sourceMappingURL=transaction.d.ts.map \ No newline at end of file diff --git a/types/transaction/transaction.d.ts.map b/types/transaction/transaction.d.ts.map deleted file mode 100644 index f298b00da..000000000 --- a/types/transaction/transaction.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAYnE,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;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I,IAAI,CAAC,KAAK,EAAE,SAAS,EAExB;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,YAAY,EAE5B;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IACD,IAAI,SAAS,CAAC,KAAK,EAAE,YAAY,EAEhC;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,IAAI,GAAG,MAAM,CAE7B;IACD,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,GAAG,aAAa,EAExC;IAED;;OAEG;;IAYH;;OAEG;IACH,IAAI,IAAI,IAAI,IAAI,GAAG,MAAM,CAKxB;IAED;;;;;OAKG;IACH,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,IAAI,GAAG,MAAM,CAMxB;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,IAAI,GAAG,MAAM,CAKjC;IAED;;;;;OAKG;IACH,QAAQ,IAAI,IAAI,IAAI,WAAW,GAAG;QAChC,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,SAAS,CAAC;KACtB;IAKD;;;;;OAKG;IACH,IAAI,UAAU,IAAI,MAAM,CAQvB;IAED;;;;;OAKG;IACH,IAAI,kBAAkB,IAAI,MAAM,CAE/B;IAED;;OAEG;IACH,KAAK,IAAI,WAAW;IAIpB;;OAEG;IACH,MAAM,IAAI,GAAG;IAoBb;;;OAGG;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,WAAW;CA6DhE"} \ No newline at end of file diff --git a/types/utils/base58.d.ts b/types/utils/base58.d.ts deleted file mode 100644 index 8b377936b..000000000 --- a/types/utils/base58.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * The [Base58 Encoding](link-base58) scheme allows a **numeric** value - * to be encoded as a compact string using a radix of 58 using only - * alpha-numeric characters. Confusingly similar characters are omitted - * (i.e. ``"l0O"``). - * - * Note that Base58 encodes a **numeric** value, not arbitrary bytes, - * since any zero-bytes on the left would get removed. To mitigate this - * issue most schemes that use Base58 choose specific high-order values - * to ensure non-zero prefixes. - * - * @_subsection: api/utils:Base58 Encoding [about-base58] - */ -import type { BytesLike } from "./index.js"; -/** - * Encode %%value%% as a Base58-encoded string. - */ -export declare function encodeBase58(_value: BytesLike): string; -/** - * Decode the Base58-encoded %%value%%. - */ -export declare function decodeBase58(value: string): bigint; -//# sourceMappingURL=base58.d.ts.map \ No newline at end of file diff --git a/types/utils/base58.d.ts.map b/types/utils/base58.d.ts.map deleted file mode 100644 index 21386c9f3..000000000 --- a/types/utils/base58.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base58.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base58.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAoB5C;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAQtD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOlD"} \ No newline at end of file diff --git a/types/utils/base64-browser.d.ts b/types/utils/base64-browser.d.ts deleted file mode 100644 index ea96c442c..000000000 --- a/types/utils/base64-browser.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { BytesLike } from "./data.js"; -export declare function decodeBase64(textData: string): Uint8Array; -export declare function encodeBase64(_data: BytesLike): string; -//# sourceMappingURL=base64-browser.d.ts.map \ No newline at end of file diff --git a/types/utils/base64-browser.d.ts.map b/types/utils/base64-browser.d.ts.map deleted file mode 100644 index 83a734cd1..000000000 --- a/types/utils/base64-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base64-browser.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base64-browser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAOzD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAOrD"} \ No newline at end of file diff --git a/types/utils/base64.d.ts b/types/utils/base64.d.ts deleted file mode 100644 index 0cab53288..000000000 --- a/types/utils/base64.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { BytesLike } from "./data.js"; -/** - * Decodes the base-64 encoded %%value%%. - * - * @example: - * // The decoded value is always binary data... - * result = decodeBase64("SGVsbG8gV29ybGQhIQ==") - * //_result: - * - * // ...use toUtf8String to convert it to a string. - * toUtf8String(result) - * //_result: - * - * // Decoding binary data - * decodeBase64("EjQ=") - * //_result: - */ -export declare function decodeBase64(value: string): Uint8Array; -/** - * Encodes %%data%% as a base-64 encoded string. - * - * @example: - * // Encoding binary data as a hexstring - * encodeBase64("0x1234") - * //_result: - * - * // Encoding binary data as a Uint8Array - * encodeBase64(new Uint8Array([ 0x12, 0x34 ])) - * //_result: - * - * // The input MUST be data... - * encodeBase64("Hello World!!") - * //_error: - * - * // ...use toUtf8Bytes for this. - * encodeBase64(toUtf8Bytes("Hello World!!")) - * //_result: - */ -export declare function encodeBase64(data: BytesLike): string; -//# sourceMappingURL=base64.d.ts.map \ No newline at end of file diff --git a/types/utils/base64.d.ts.map b/types/utils/base64.d.ts.map deleted file mode 100644 index 34656262c..000000000 --- a/types/utils/base64.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base64.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAEtD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAEpD"} \ No newline at end of file diff --git a/types/utils/data.d.ts b/types/utils/data.d.ts deleted file mode 100644 index 59cca6eba..000000000 --- a/types/utils/data.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/** - * A [[HexString]] whose length is even, which ensures it is a valid - * representation of binary data. - */ -export type DataHexString = string; -/** - * A string which is prefixed with ``0x`` and followed by any number - * of case-agnostic hexadecimal characters. - * - * It must match the regular expression ``/0x[0-9A-Fa-f]*\/``. - */ -export type HexString = string; -/** - * An object that can be used to represent binary data. - */ -export type Bytes = ArrayLike; -export type BytesLike = Bytes | string; -export type DataOptions = { - allowMissingPrefix?: boolean; - hexPad?: "left" | "right" | null; -}; -export interface Hexable { - toHexString(): string; -} -export declare function isBytes(value: any): value is Bytes; -/** - * Get a typed Uint8Array for %%value%%. If already a Uint8Array - * the original %%value%% is returned; if a copy is required use - * [[getBytesCopy]]. - * - * @see: getBytesCopy - */ -export declare function getBytes(value: BytesLike, name?: string): Uint8Array; -/** - * Get a typed Uint8Array for %%value%%, creating a copy if necessary - * to prevent any modifications of the returned value from being - * reflected elsewhere. - * - * @see: getBytes - */ -export declare function getBytesCopy(value: BytesLike, name?: string): Uint8Array; -/** - * Returns true if %%value%% is a valid [[HexString]]. - * - * If %%length%% is ``true`` or a //number//, it also checks that - * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) - * bytes of data (e.g. ``0x1234`` is 2 bytes). - */ -export declare function isHexString(value: any, length?: number | boolean): value is `0x${string}`; -/** - * Returns true if %%value%% is a valid representation of arbitrary - * data (i.e. a valid [[DataHexString]] or a Uint8Array). - */ -export declare function isBytesLike(value: any): value is BytesLike; -/** - * Returns a [[DataHexString]] representation of %%data%%. - */ -export declare function hexlify(value: BytesLike | Hexable | number | bigint, options?: DataOptions): string; -/** - * Returns a [[DataHexString]] by concatenating all values - * within %%data%%. - */ -export declare function concat(items: ReadonlyArray): string; -export declare function hexDataSlice(data: BytesLike, offset: number, endOffset?: number): string; -export declare function hexDataLength(data: BytesLike): number | null; -/** - * Returns the length of %%data%%, in bytes. - */ -export declare function dataLength(data: BytesLike): number; -/** - * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% - * offset to the %%end%% offset. - * - * By default %%start%% is 0 and %%end%% is the length of %%data%%. - */ -export declare function dataSlice(data: BytesLike, start?: number, end?: number): string; -/** - * Return the [[DataHexString]] result by stripping all **leading** - ** zero bytes from %%data%%. - */ -export declare function stripZerosLeft(data: BytesLike): string; -/** - * Return the [[DataHexString]] of %%data%% padded on the **left** - * to %%length%% bytes. - * - * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is - * thrown. - * - * This pads data the same as **values** are in Solidity - * (e.g. ``uint128``). - */ -export declare function zeroPadValue(data: BytesLike, length: number): string; -/** - * Return the [[DataHexString]] of %%data%% padded on the **right** - * to %%length%% bytes. - * - * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is - * thrown. - * - * This pads data the same as **bytes** are in Solidity - * (e.g. ``bytes16``). - */ -export declare function zeroPadBytes(data: BytesLike, length: number): string; -export declare function stripZeros(value: BytesLike): Uint8Array; -export declare function arrayify(value: BytesLike | Hexable | number, options?: DataOptions): Uint8Array; -export declare function hexConcat(items: ReadonlyArray): string; -//# sourceMappingURL=data.d.ts.map \ No newline at end of file diff --git a/types/utils/data.d.ts.map b/types/utils/data.d.ts.map deleted file mode 100644 index b82bf731e..000000000 --- a/types/utils/data.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src.ts/utils/data.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;GAEG;AACH,MAAM,MAA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C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAKlD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,SAAS,EACf,KAAK,CAAC,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,MAAM,GACX,MAAM,CAYR;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAMtD;AA0BD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,CAmBvD;AAED,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,EACnC,OAAO,CAAC,EAAE,WAAW,GACpB,UAAU,CAuDZ;AAeD,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,MAAM,CAMjE"} \ No newline at end of file diff --git a/types/utils/errors.d.ts b/types/utils/errors.d.ts deleted file mode 100644 index 130aa0621..000000000 --- a/types/utils/errors.d.ts +++ /dev/null @@ -1,486 +0,0 @@ -/** - * About Errors. - * - * @_section: api/utils/errors:Errors [about-errors] - */ -import type { TransactionRequest, TransactionReceipt, TransactionResponse } from "../providers/index.js"; -import type { FetchRequest, FetchResponse } from "./fetch.js"; -export type ErrorInfo = Omit; -/** - * All errors emitted by corebc have an **ErrorCode** to help - * identify and coalesce errors to simplfy programatic analysis. - * - * Each **ErrorCode** is the %%code%% proerty of a coresponding - * [[corebcError]]. - * - * **Generic Errors** - * - * **``"UNKNOWN_ERROR"``** - see [[UnknownError]] - * - * **``"NOT_IMPLEMENTED"``** - see [[NotImplementedError]] - * - * **``"UNSUPPORTED_OPERATION"``** - see [[UnsupportedOperationError]] - * - * **``"NETWORK_ERROR"``** - see [[NetworkError]] - * - * **``"SERVER_ERROR"``** - see [[ServerError]] - * - * **``"TIMEOUT"``** - see [[TimeoutError]] - * - * **``"BAD_DATA"``** - see [[BadDataError]] - * - * **``"CANCELLED"``** - see [[CancelledError]] - * - * **Operational Errors** - * - * **``"BUFFER_OVERRUN"``** - see [[BufferOverrunError]] - * - * **``"NUMERIC_FAULT"``** - see [[NumericFaultError]] - * - * **Argument Errors** - * - * **``"INVALID_ARGUMENT"``** - see [[InvalidArgumentError]] - * - * **``"MISSING_ARGUMENT"``** - see [[MissingArgumentError]] - * - * **``"UNEXPECTED_ARGUMENT"``** - see [[UnexpectedArgumentError]] - * - * **``"VALUE_MISMATCH"``** - //unused// - * - * **Blockchain Errors** - * - * **``"CALL_EXCEPTION"``** - see [[CallExceptionError]] - * - * **``"INSUFFICIENT_FUNDS"``** - see [[InsufficientFundsError]] - * - * **``"NONCE_EXPIRED"``** - see [[NonceExpiredError]] - * - * **``"REPLACEMENT_UNDERPRICED"``** - see [[ReplacementUnderpricedError]] - * - * **``"TRANSACTION_REPLACED"``** - see [[TransactionReplacedError]] - * - * **``"UNCONFIGURED_NAME"``** - see [[UnconfiguredNameError]] - * - * **``"OFFCHAIN_FAULT"``** - see [[OffchainFaultError]] - * - * **User Interaction Errors** - * - * **``"ACTION_REJECTED"``** - see [[ActionRejectedError]] - */ -export type ErrorCode = "UNKNOWN_ERROR" | "NOT_IMPLEMENTED" | "UNSUPPORTED_OPERATION" | "NETWORK_ERROR" | "SERVER_ERROR" | "TIMEOUT" | "BAD_DATA" | "CANCELLED" | "BUFFER_OVERRUN" | "NUMERIC_FAULT" | "INVALID_ARGUMENT" | "MISSING_ARGUMENT" | "UNEXPECTED_ARGUMENT" | "VALUE_MISMATCH" | "CALL_EXCEPTION" | "INSUFFICIENT_FUNDS" | "NONCE_EXPIRED" | "REPLACEMENT_UNDERPRICED" | "TRANSACTION_REPLACED" | "UNCONFIGURED_NAME" | "OFFCHAIN_FAULT" | "ACTION_REJECTED"; -/** - * All errors in corebc include properties to assist in - * machine-readable errors. - */ -export interface CoreBCError extends Error { - /** - * The string error code. - */ - code: ErrorCode; - /** - * Additional info regarding the error that may be useful. - * - * This is generally helpful mostly for human-based debugging. - */ - info?: Record; - /** - * Any related error. - */ - error?: Error; -} -/** - * This Error is a catch-all for when there is no way for corebc to - * know what the underlying problem is. - */ -export interface UnknownError extends CoreBCError<"UNKNOWN_ERROR"> { - [key: string]: any; -} -/** - * This Error is mostly used as a stub for functionality that is - * intended for the future, but is currently not implemented. - */ -export interface NotImplementedError extends CoreBCError<"NOT_IMPLEMENTED"> { - /** - * The attempted operation. - */ - operation: string; -} -/** - * This Error indicates that the attempted operation is not supported. - * - * This could range from a specifc JSON-RPC end-point not supporting - * a feature to a specific configuration of an object prohibiting the - * operation. - * - * For example, a [[Wallet]] with no connected [[Provider]] is unable - * to send a transaction. - */ -export interface UnsupportedOperationError extends CoreBCError<"UNSUPPORTED_OPERATION"> { - /** - * The attempted operation. - */ - operation: string; -} -export interface NetworkError extends CoreBCError<"NETWORK_ERROR"> { - event: string; -} -/** - * This Error indicates there was a problem fetching a resource from - * a server. - */ -export interface ServerError extends CoreBCError<"SERVER_ERROR"> { - /** - * The requested resource. - */ - request: FetchRequest | string; - /** - * The response received from the server, if available. - */ - response?: FetchResponse; -} -/** - * This Error indicates that the timeout duration has expired and - * that the operation has been implicitly cancelled. - * - * The side-effect of the operation may still occur, as this - * generally means a request has been sent and there has simply - * been no response to indicate whether it was processed or not. - */ -export interface TimeoutError extends CoreBCError<"TIMEOUT"> { - /** - * The attempted operation. - */ - operation: string; - /** - * The reason. - */ - reason: string; - /** - * The resource request, if available. - */ - request?: FetchRequest; -} -/** - * This Error indicates that a provided set of data cannot - * be correctly interpretted. - */ -export interface BadDataError extends CoreBCError<"BAD_DATA"> { - /** - * The data. - */ - value: any; -} -/** - * This Error indicates that the operation was cancelled by a - * programmatic call, for example to ``cancel()``. - */ -export interface CancelledError extends CoreBCError<"CANCELLED"> { -} -/** - * This Error indicates an attempt was made to read outside the bounds - * of protected data. - * - * Most operations in corebc are protected by bounds checks, to mitigate - * exploits when parsing data. - */ -export interface BufferOverrunError extends CoreBCError<"BUFFER_OVERRUN"> { - /** - * The buffer that was overrun. - */ - buffer: Uint8Array; - /** - * The length of the buffer. - */ - length: number; - /** - * The offset that was requested. - */ - offset: number; -} -/** - * This Error indicates an operation which would result in incorrect - * arithmetic output has occurred. - * - * For example, trying to divide by zero or using a ``uint8`` to store - * a negative value. - */ -export interface NumericFaultError extends CoreBCError<"NUMERIC_FAULT"> { - /** - * The attempted operation. - */ - operation: string; - /** - * The fault reported. - */ - fault: string; - /** - * The value the operation was attempted against. - */ - value: any; -} -/** - * This Error indicates an incorrect type or value was passed to - * a function or method. - */ -export interface InvalidArgumentError extends CoreBCError<"INVALID_ARGUMENT"> { - /** - * The name of the argument. - */ - argument: string; - /** - * The value that was provided. - */ - value: any; - info?: Record; -} -/** - * This Error indicates there were too few arguments were provided. - */ -export interface MissingArgumentError extends CoreBCError<"MISSING_ARGUMENT"> { - /** - * The number of arguments received. - */ - count: number; - /** - * The number of arguments expected. - */ - expectedCount: number; -} -/** - * This Error indicates too many arguments were provided. - */ -export interface UnexpectedArgumentError extends CoreBCError<"UNEXPECTED_ARGUMENT"> { - /** - * The number of arguments received. - */ - count: number; - /** - * The number of arguments expected. - */ - expectedCount: number; -} -/** - * The action that resulted in the error. - */ -export type CallExceptionAction = "call" | "estimateEnergy" | "getTransactionResult" | "unknown"; -/** - * The related transaction that caused the error. - */ -export type CallExceptionTransaction = { - to: null | string; - from?: string; - data: string; -}; -/** - * This **Error** indicates a transaction reverted. - */ -export interface CallExceptionError extends CoreBCError<"CALL_EXCEPTION"> { - /** - * The action being performed when the revert was encountered. - */ - action: CallExceptionAction; - /** - * The revert data returned. - */ - data: null | string; - /** - * A human-readable representation of data, if possible. - */ - reason: null | string; - /** - * The transaction that triggered the exception. - */ - transaction: CallExceptionTransaction; - /** - * The contract invocation details, if available. - */ - invocation: null | { - method: string; - signature: string; - args: Array; - }; - /** - * The built-in or custom revert error, if available - */ - revert: null | { - signature: string; - name: string; - args: Array; - }; -} -/** - * The sending account has insufficient funds to cover the - * entire transaction cost. - */ -export interface InsufficientFundsError extends CoreBCError<"INSUFFICIENT_FUNDS"> { - /** - * The transaction. - */ - transaction: TransactionRequest; -} -/** - * The sending account has already used this nonce in a - * transaction that has been included. - */ -export interface NonceExpiredError extends CoreBCError<"NONCE_EXPIRED"> { - /** - * The transaction. - */ - transaction: TransactionRequest; -} -/** - * A CCIP-read exception, which cannot be recovered from or - * be further processed. - */ -export interface OffchainFaultError extends CoreBCError<"OFFCHAIN_FAULT"> { - /** - * The transaction. - */ - transaction?: TransactionRequest; - /** - * The reason the CCIP-read failed. - */ - reason: string; -} -/** - * An attempt was made to replace a transaction, but with an - * insufficient additional fee to afford evicting the old - * transaction from the memory pool. - */ -export interface ReplacementUnderpricedError extends CoreBCError<"REPLACEMENT_UNDERPRICED"> { - /** - * The transaction. - */ - transaction: TransactionRequest; -} -/** - * A pending transaction was replaced by another. - */ -export interface TransactionReplacedError extends CoreBCError<"TRANSACTION_REPLACED"> { - /** - * If the transaction was cancelled, such that the original - * effects of the transaction cannot be assured. - */ - cancelled: boolean; - /** - * The reason the transaction was replaced. - */ - reason: "repriced" | "cancelled" | "replaced"; - /** - * The hash of the replaced transaction. - */ - hash: string; - /** - * The transaction that replaced the transaction. - */ - replacement: TransactionResponse; - /** - * The receipt of the transaction that replace the transaction. - */ - receipt: TransactionReceipt; -} -/** - * This Error indicates an ENS name was used, but the name has not - * been configured. - * - * This could indicate an ENS name is unowned or that the current - * address being pointed to is the [[ZeroAddress]]. - */ -export interface UnconfiguredNameError extends CoreBCError<"UNCONFIGURED_NAME"> { - /** - * The ENS name that was requested - */ - value: string; -} -/** - * This Error indicates a request was rejected by the user. - * - * In most clients (such as MetaMask), when an operation requires user - * authorization (such as ``signer.sendTransaction``), the client - * presents a dialog box to the user. If the user denies the request - * this error is thrown. - */ -export interface ActionRejectedError extends CoreBCError<"ACTION_REJECTED"> { - /** - * The requested action. - */ - action: "requestAccess" | "sendTransaction" | "signMessage" | "signTransaction" | "signTypedData" | "unknown"; - /** - * The reason the action was rejected. - * - * If there is already a pending request, some clients may indicate - * there is already a ``"pending"`` action. This prevents an app - * from spamming the user. - */ - reason: "expired" | "rejected" | "pending"; -} -/** - * A conditional type that transforms the [[ErrorCode]] T into - * its corebcError type. - * - * @flatworm-skip-docs - */ -export type CodedCoreBCError = T extends "UNKNOWN_ERROR" ? UnknownError : T extends "NOT_IMPLEMENTED" ? NotImplementedError : T extends "UNSUPPORTED_OPERATION" ? UnsupportedOperationError : T extends "NETWORK_ERROR" ? NetworkError : T extends "SERVER_ERROR" ? ServerError : T extends "TIMEOUT" ? TimeoutError : T extends "BAD_DATA" ? BadDataError : T extends "CANCELLED" ? CancelledError : T extends "BUFFER_OVERRUN" ? BufferOverrunError : T extends "NUMERIC_FAULT" ? NumericFaultError : T extends "INVALID_ARGUMENT" ? InvalidArgumentError : T extends "MISSING_ARGUMENT" ? MissingArgumentError : T extends "UNEXPECTED_ARGUMENT" ? UnexpectedArgumentError : T extends "CALL_EXCEPTION" ? CallExceptionError : T extends "INSUFFICIENT_FUNDS" ? InsufficientFundsError : T extends "NONCE_EXPIRED" ? NonceExpiredError : T extends "OFFCHAIN_FAULT" ? OffchainFaultError : T extends "REPLACEMENT_UNDERPRICED" ? ReplacementUnderpricedError : T extends "TRANSACTION_REPLACED" ? TransactionReplacedError : T extends "UNCONFIGURED_NAME" ? UnconfiguredNameError : T extends "ACTION_REJECTED" ? ActionRejectedError : never; -/** - * Returns true if the %%error%% matches an error thrown by corebc - * that matches the error %%code%%. - * - * In TypeScript envornoments, this can be used to check that %%error%% - * matches an corebcError type, which means the expected properties will - * be set. - * - * @See [ErrorCodes](api:ErrorCode) - * @example - * try { - * // code.... - * } catch (e) { - * if (isError(e, "CALL_EXCEPTION")) { - * // The Type Guard has validated this object - * console.log(e.data); - * } - * } - */ -export declare function isError>(error: any, code: K): error is T; -/** - * Returns true if %%error%% is a [[CallExceptionError]. - */ -export declare function isCallException(error: any): error is CallExceptionError; -/** - * Returns a new Error configured to the format corebc emits errors, with - * the %%message%%, [[api:ErrorCode]] %%code%% and additioanl properties - * for the corresponding corebcError. - * - * Each error in corebc includes the version of corebc, a - * machine-readable [[ErrorCode]], and depneding on %%code%%, additional - * required properties. The error message will also include the %%meeage%%, - * corebc version, %%code%% and all aditional properties, serialized. - */ -export declare function makeError>(message: string, code: K, info?: ErrorInfo): T; -/** - * Throws an corebcError with %%message%%, %%code%% and additional error - * %%info%% when %%check%% is falsish.. - * - * @see [[api:makeError]] - */ -export declare function assert>(check: unknown, message: string, code: K, info?: ErrorInfo): asserts check; -/** - * A simple helper to simply ensuring provided arguments match expected - * constraints, throwing if not. - * - * In TypeScript environments, the %%check%% has been asserted true, so - * any further code does not need additional compile-time checks. - */ -export declare function assertArgument(check: unknown, message: string, name: string, value: unknown): asserts check; -export declare function assertArgumentCount(count: number, expectedCount: number, message?: string): void; -/** - * Throws if the normalization %%form%% is not supported. - */ -export declare function assertNormalize(form: string): void; -/** - * Many classes use file-scoped values to guard the constructor, - * making it effectively private. This facilitates that pattern - * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, - * throwing if not, indicating the %%className%% if provided. - */ -export declare function assertPrivate(givenGuard: any, guard: any, className?: string): void; -//# sourceMappingURL=errors.d.ts.map \ No newline at end of file diff --git a/types/utils/errors.d.ts.map b/types/utils/errors.d.ts.map deleted file mode 100644 index de9bc0ec5..000000000 --- a/types/utils/errors.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src.ts/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,E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AG,GAAG,KAAK,IAAI,kBAAkB,CAEvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAC1E,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,CAAC,EACP,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,GAClB,CAAC,CA+CH;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,gBAAgB,CAAC,CAAC,CAAC,EACvE,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,CAAC,EACP,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,GAClB,OAAO,CAAC,KAAK,CAIf;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,KAAK,CAEf;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CA2BN;AA8BD;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAUlD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,GAAG,EACf,KAAK,EAAE,GAAG,EACV,SAAS,CAAC,EAAE,MAAM,GACjB,IAAI,CAoBN"} \ No newline at end of file diff --git a/types/utils/events.d.ts b/types/utils/events.d.ts deleted file mode 100644 index 5da088923..000000000 --- a/types/utils/events.d.ts +++ /dev/null @@ -1,77 +0,0 @@ -/** - * A callback function called when a an event is triggered. - */ -export type Listener = (...args: Array) => void; -/** - * An **EventEmitterable** behaves similar to an EventEmitter - * except provides async access to its methods. - * - * An EventEmitter implements the observer pattern. - */ -export interface EventEmitterable { - /** - * Registers a %%listener%% that is called whenever the - * %%event%% occurs until unregistered. - */ - on(event: T, listener: Listener): Promise; - /** - * Registers a %%listener%% that is called the next time - * %%event%% occurs. - */ - once(event: T, listener: Listener): Promise; - /** - * Triggers each listener for %%event%% with the %%args%%. - */ - emit(event: T, ...args: Array): Promise; - /** - * Resolves to the number of listeners for %%event%%. - */ - listenerCount(event?: T): Promise; - /** - * Resolves to the listeners for %%event%%. - */ - listeners(event?: T): Promise>; - /** - * Unregister the %%listener%% for %%event%%. If %%listener%% - * is unspecified, all listeners are unregistered. - */ - off(event: T, listener?: Listener): Promise; - /** - * Unregister all listeners for %%event%%. - */ - removeAllListeners(event?: T): Promise; - /** - * Alias for [[on]]. - */ - addListener(event: T, listener: Listener): Promise; - /** - * Alias for [[off]]. - */ - removeListener(event: T, listener: Listener): Promise; -} -/** - * When an [[EventEmitterable]] triggers a [[Listener]], the - * callback always ahas one additional argument passed, which is - * an **EventPayload**. - */ -export declare class EventPayload { - #private; - /** - * The event filter. - */ - readonly filter: T; - /** - * The **EventEmitterable**. - */ - readonly emitter: EventEmitterable; - /** - * Create a new **EventPayload** for %%emitter%% with - * the %%listener%% and for %%filter%%. - */ - constructor(emitter: EventEmitterable, listener: null | Listener, filter: T); - /** - * Unregister the triggered listener for future events. - */ - removeListener(): Promise; -} -//# sourceMappingURL=events.d.ts.map \ No newline at end of file diff --git a/types/utils/events.d.ts.map b/types/utils/events.d.ts.map deleted file mode 100644 index 13c18f4ef..000000000 --- a/types/utils/events.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src.ts/utils/events.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC;;;OAGG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B,QAAQ,EAAE,IAAI,GAAG,QAAQ,EACzB,MAAM,EAAE,CAAC;IAMX;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAMtC"} \ No newline at end of file diff --git a/types/utils/fetch.d.ts b/types/utils/fetch.d.ts deleted file mode 100644 index 7d226ccc0..000000000 --- a/types/utils/fetch.d.ts +++ /dev/null @@ -1,327 +0,0 @@ -export type GetUrlResponse = { - statusCode: number; - statusMessage: string; - headers: Record; - body: null | Uint8Array; -}; -export type FetchThrottleParams = { - maxAttempts?: number; - slotInterval?: number; -}; -/** - * Called before any network request, allowing updated headers (e.g. Bearer tokens), etc. - */ -export type FetchPreflightFunc = (req: FetchRequest) => Promise; -/** - * Called on the response, allowing client-based throttling logic or post-processing. - */ -export type FetchProcessFunc = (req: FetchRequest, resp: FetchResponse) => Promise; -/** - * Called prior to each retry; return true to retry, false to abort. - */ -export type FetchRetryFunc = (req: FetchRequest, resp: FetchResponse, attempt: number) => Promise; -/** - * Called on Gateway URLs. - */ -export type FetchGatewayFunc = (url: string, signal?: FetchCancelSignal) => Promise; -/** - * Used to perform a fetch; use this to override the underlying network - * fetch layer. In NodeJS, the default uses the "http" and "https" libraries - * and in the browser ``fetch`` is used. If you wish to use Axios, this is - * how you would register it. - */ -export type FetchGetUrlFunc = (req: FetchRequest, signal?: FetchCancelSignal) => Promise; -/** - * @_ignore - */ -export declare class FetchCancelSignal { - #private; - constructor(request: FetchRequest); - addListener(listener: () => void): void; - get cancelled(): boolean; - checkSignal(): void; -} -/** - * Represents a request for a resource using a URI. - * - * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, - * and ``IPFS:``. - * - * Additional schemes can be added globally using [[registerGateway]]. - * - * @example: - * req = new FetchRequest("https://www.ricmoo.com") - * resp = await req.send() - * resp.body.length - * //_result: - */ -export declare class FetchRequest implements Iterable<[key: string, value: string]> { - #private; - /** - * The fetch URI to requrest. - */ - get url(): string; - set url(url: string); - /** - * The fetch body, if any, to send as the request body. //(default: null)// - * - * When setting a body, the intrinsic ``Content-Type`` is automatically - * set and will be used if **not overridden** by setting a custom - * header. - * - * If %%body%% is null, the body is cleared (along with the - * intrinsic ``Content-Type``) and the . - * - * If %%body%% is a string, the intrincis ``Content-Type`` is set to - * ``text/plain``. - * - * If %%body%% is a Uint8Array, the intrincis ``Content-Type`` is set to - * ``application/octet-stream``. - * - * If %%body%% is any other object, the intrincis ``Content-Type`` is - * set to ``application/json``. - */ - get body(): null | Uint8Array; - set body(body: null | string | Readonly | Readonly); - /** - * Returns true if the request has a body. - */ - hasBody(): this is FetchRequest & { - body: Uint8Array; - }; - /** - * The HTTP method to use when requesting the URI. If no method - * has been explicitly set, then ``GET`` is used if the body is - * null and ``POST`` otherwise. - */ - get method(): string; - set method(method: null | string); - /** - * The headers that will be used when requesting the URI. All - * keys are lower-case. - * - * This object is a copy, so any chnages will **NOT** be reflected - * in the ``FetchRequest``. - * - * To set a header entry, use the ``setHeader`` method. - */ - get headers(): Record; - /** - * Get the header for %%key%%, ignoring case. - */ - getHeader(key: string): string; - /** - * Set the header for %%key%% to %%value%%. All values are coerced - * to a string. - */ - setHeader(key: string, value: string | number): void; - /** - * Clear all headers, resetting all intrinsic headers. - */ - clearHeaders(): void; - [Symbol.iterator](): Iterator<[key: string, value: string]>; - /** - * The value that will be sent for the ``Authorization`` header. - * - * To set the credentials, use the ``setCredentials`` method. - */ - get credentials(): null | string; - /** - * Sets an ``Authorization`` for %%username%% with %%password%%. - */ - setCredentials(username: string, password: string): void; - /** - * Enable and request gzip-encoded responses. The response will - * automatically be decompressed. //(default: true)// - */ - get allowGzip(): boolean; - set allowGzip(value: boolean); - /** - * Allow ``Authentication`` credentials to be sent over insecure - * channels. //(default: false)// - */ - get allowInsecureAuthentication(): boolean; - set allowInsecureAuthentication(value: boolean); - /** - * The timeout (in milliseconds) to wait for a complere response. - * //(default: 5 minutes)// - */ - get timeout(): number; - set timeout(timeout: number); - /** - * This function is called prior to each request, for example - * during a redirection or retry in case of server throttling. - * - * This offers an opportunity to populate headers or update - * content before sending a request. - */ - get preflightFunc(): null | FetchPreflightFunc; - set preflightFunc(preflight: null | FetchPreflightFunc); - /** - * This function is called after each response, offering an - * opportunity to provide client-level throttling or updating - * response data. - * - * Any error thrown in this causes the ``send()`` to throw. - * - * To schedule a retry attempt (assuming the maximum retry limit - * has not been reached), use [[response.throwThrottleError]]. - */ - get processFunc(): null | FetchProcessFunc; - set processFunc(process: null | FetchProcessFunc); - /** - * This function is called on each retry attempt. - */ - get retryFunc(): null | FetchRetryFunc; - set retryFunc(retry: null | FetchRetryFunc); - /** - * Create a new FetchRequest instance with default values. - * - * Once created, each property may be set before issuing a - * ``.send()`` to make the request. - */ - constructor(url: string); - toString(): string; - /** - * Update the throttle parameters used to determine maximum - * attempts and exponential-backoff properties. - */ - setThrottleParams(params: FetchThrottleParams): void; - /** - * Resolves to the response by sending the request. - */ - send(): Promise; - /** - * Cancels the inflight response, causing a ``CANCELLED`` - * error to be rejected from the [[send]]. - */ - cancel(): void; - /** - * Returns a new [[FetchRequest]] that represents the redirection - * to %%location%%. - */ - redirect(location: string): FetchRequest; - /** - * Create a new copy of this request. - */ - clone(): FetchRequest; - /** - * Locks all static configuration for gateways and FetchGetUrlFunc - * registration. - */ - static lockConfig(): void; - /** - * Get the current Gateway function for %%scheme%%. - */ - static getGateway(scheme: string): null | FetchGatewayFunc; - /** - * Use the %%func%% when fetching URIs using %%scheme%%. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGateway(scheme: string, func: FetchGatewayFunc): void; - /** - * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGetUrl(getUrl: FetchGetUrlFunc): void; - /** - * Creates a function that can "fetch" data URIs. - * - * Note that this is automatically done internally to support - * data URIs, so it is not necessary to register it. - * - * This is not generally something that is needed, but may - * be useful in a wrapper to perfom custom data URI functionality. - */ - static createDataGateway(): FetchGatewayFunc; - /** - * Creates a function that will fetch IPFS (unvalidated) from - * a custom gateway baseUrl. - * - * The default IPFS gateway used internally is - * ``"https:/\/gateway.ipfs.io/ipfs/"``. - */ - static createIpfsGatewayFunc(baseUrl: string): FetchGatewayFunc; -} -/** - * The response for a FetchREquest. - */ -export declare class FetchResponse implements Iterable<[key: string, value: string]> { - #private; - toString(): string; - /** - * The response status code. - */ - get statusCode(): number; - /** - * The response status message. - */ - get statusMessage(): string; - /** - * The response headers. All keys are lower-case. - */ - get headers(): Record; - /** - * The response body, or ``null`` if there was no body. - */ - get body(): null | Readonly; - /** - * The response body as a UTF-8 encoded string, or the empty - * string (i.e. ``""``) if there was no body. - * - * An error is thrown if the body is invalid UTF-8 data. - */ - get bodyText(): string; - /** - * The response body, decoded as JSON. - * - * An error is thrown if the body is invalid JSON-encoded data - * or if there was no body. - */ - get bodyJson(): any; - [Symbol.iterator](): Iterator<[key: string, value: string]>; - constructor(statusCode: number, statusMessage: string, headers: Readonly>, body: null | Uint8Array, request?: FetchRequest); - /** - * Return a Response with matching headers and body, but with - * an error status code (i.e. 599) and %%message%% with an - * optional %%error%%. - */ - makeServerError(message?: string, error?: Error): FetchResponse; - /** - * If called within a [request.processFunc](FetchRequest-processFunc) - * call, causes the request to retry as if throttled for %%stall%% - * milliseconds. - */ - throwThrottleError(message?: string, stall?: number): never; - /** - * Get the header value for %%key%%, ignoring case. - */ - getHeader(key: string): string; - /** - * Returns true of the response has a body. - */ - hasBody(): this is FetchResponse & { - body: Uint8Array; - }; - /** - * The request made for this response. - */ - get request(): null | FetchRequest; - /** - * Returns true if this response was a success statusCode. - */ - ok(): boolean; - /** - * Throws a ``SERVER_ERROR`` if this response is not ok. - */ - assertOk(): void; -} -//# sourceMappingURL=fetch.d.ts.map \ No newline at end of file diff --git a/types/utils/fetch.d.ts.map b/types/utils/fetch.d.ts.map deleted file mode 100644 index 1319c39a1..000000000 --- a/types/utils/fetch.d.ts.map +++ /dev/null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AK,CAAC,EAAE,MAAM,GAAG,KAAK;IAmB3D;;OAEG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI9B;;OAEG;IACH,OAAO,IAAI,IAAI,IAAI,aAAa,GAAG;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE;IAIvD;;OAEG;IACH,IAAI,OAAO,IAAI,IAAI,GAAG,YAAY,CAEjC;IAED;;OAEG;IACH,EAAE,IAAI,OAAO;IAQb;;OAEG;IACH,QAAQ,IAAI,IAAI;CAcjB"} \ No newline at end of file diff --git a/types/utils/fixednumber.d.ts b/types/utils/fixednumber.d.ts deleted file mode 100644 index c8a28f158..000000000 --- a/types/utils/fixednumber.d.ts +++ /dev/null @@ -1,252 +0,0 @@ -import type { BigNumberish, BytesLike } from "./index.js"; -/** - * A description of a fixed-point arithmetic field. - * - * When specifying the fixed format, the values override the default of - * a ``fixed128x18``, which implies a signed 128-bit value with 18 - * decimals of precision. - * - * The alias ``fixed`` and ``ufixed`` can be used for ``fixed128x18`` and - * ``ufixed128x18`` respectively. - * - * When a fixed format string begins with a ``u``, it indicates the field - * is unsigned, so any negative values will overflow. The first number - * indicates the bit-width and the second number indicates the decimal - * precision. - * - * When a ``number`` is used for a fixed format, it indicates the number - * of decimal places, and the default width and signed-ness will be used. - * - * The bit-width must be byte aligned and the decimals can be at most 80. - */ -export type FixedFormat = number | string | { - signed?: boolean; - width?: number; - decimals?: number; -}; -/** - * A FixedNumber represents a value over its [[FixedFormat]] - * arithmetic field. - * - * A FixedNumber can be used to perform math, losslessly, on - * values which have decmial places. - * - * A FixedNumber has a fixed bit-width to store values in, and stores all - * values internally by multiplying the value by 10 raised to the power of - * %%decimals%%. - * - * If operations are performed that cause a value to grow too high (close to - * positive infinity) or too low (close to negative infinity), the value - * is said to //overflow//. - * - * For example, an 8-bit signed value, with 0 decimals may only be within - * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become - * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. - * - * Many operation have a normal and //unsafe// variant. The normal variant - * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// - * variant will silently allow overflow, corrupting its value value. - * - * If operations are performed that cause a value to become too small - * (close to zero), the value loses precison and is said to //underflow//. - * - * For example, an value with 1 decimal place may store a number as small - * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit - * into 1 decimal place, so underflow occurs which means precision is lost - * and the value becomes ``0``. - * - * Some operations have a normal and //signalling// variant. The normal - * variant will silently ignore underflow, while the //signalling// variant - * will thow a [[NumericFaultError]] on underflow. - */ -export declare class FixedNumber { - #private; - /** - * The specific fixed-point arithmetic field for this value. - */ - readonly format: string; - /** - * This is a property so console.log shows a human-meaningful value. - * - * @private - */ - readonly _value: string; - /** - * @private - */ - constructor(guard: any, value: bigint, format: any); - /** - * If true, negative values are permitted, otherwise only - * positive values and zero are allowed. - */ - get signed(): boolean; - /** - * The number of bits available to store the value. - */ - get width(): number; - /** - * The number of decimal places in the fixed-point arithment field. - */ - get decimals(): number; - /** - * The value as an integer, based on the smallest unit the - * [[decimals]] allow. - */ - get value(): bigint; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%, ignoring overflow. - */ - addUnsafe(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - add(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%, ignoring overflow. - */ - subUnsafe(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - sub(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%, ignoring overflow and underflow (precision loss). - */ - mulUnsafe(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - mul(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs or if underflow (precision loss) occurs. - */ - mulSignal(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - divUnsafe(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - div(other: FixedNumber): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%. A [[NumericFaultError]] is thrown if underflow - * (precision loss) occurs. - */ - divSignal(other: FixedNumber): FixedNumber; - /** - * Returns a comparison result between %%this%% and %%other%%. - * - * This is suitable for use in sorting, where ``-1`` implies %%this%% - * is smaller, ``1`` implies %%other%% is larger and ``0`` implies - * both are equal. - */ - cmp(other: FixedNumber): number; - /** - * Returns true if %%other%% is equal to %%this%%. - */ - eq(other: FixedNumber): boolean; - /** - * Returns true if %%other%% is less than to %%this%%. - */ - lt(other: FixedNumber): boolean; - /** - * Returns true if %%other%% is less than or equal to %%this%%. - */ - lte(other: FixedNumber): boolean; - /** - * Returns true if %%other%% is greater than to %%this%%. - */ - gt(other: FixedNumber): boolean; - /** - * Returns true if %%other%% is greater than or equal to %%this%%. - */ - gte(other: FixedNumber): boolean; - /** - * Returns a new [[FixedNumber]] which is the largest **integer** - * that is less than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - floor(): FixedNumber; - /** - * Returns a new [[FixedNumber]] which is the smallest **integer** - * that is greater than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - ceiling(): FixedNumber; - /** - * Returns a new [[FixedNumber]] with the decimal component - * rounded up on ties at %%decimals%% places. - */ - round(decimals?: number): FixedNumber; - /** - * Returns true if %%this%% is equal to ``0``. - */ - isZero(): boolean; - /** - * Returns true if %%this%% is less than ``0``. - */ - isNegative(): boolean; - /** - * Returns the string representation of %%this%%. - */ - toString(): string; - /** - * Returns a float approximation. - * - * Due to IEEE 754 precission (or lack thereof), this function - * can only return an approximation and most values will contain - * rounding errors. - */ - toUnsafeFloat(): number; - /** - * Return a new [[FixedNumber]] with the same value but has had - * its field set to %%format%%. - * - * This will throw if the value cannot fit into %%format%%. - */ - toFormat(format: FixedFormat): FixedNumber; - /** - * Creates a new [[FixedNumber]] for %%value%% divided by - * %%decimal%% places with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% (once adjusted - * for %%decimals%%) cannot fit in %%format%%, either due to overflow - * or underflow (precision loss). - */ - static fromValue(_value: BigNumberish, decimals?: number, _format?: FixedFormat): FixedNumber; - /** - * Creates a new [[FixedNumber]] for %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%%, either due to overflow or underflow (precision loss). - */ - static fromString(_value: string, _format?: FixedFormat): FixedNumber; - /** - * Creates a new [[FixedNumber]] with the big-endian representation - * %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%% due to overflow. - */ - static fromBytes(_value: BytesLike, _format?: FixedFormat): FixedNumber; -} -//# sourceMappingURL=fixednumber.d.ts.map \ No newline at end of file diff --git a/types/utils/fixednumber.d.ts.map b/types/utils/fixednumber.d.ts.map deleted file mode 100644 index 2f8afd8ab..000000000 --- a/types/utils/fixednumber.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fixednumber.d.ts","sourceRoot":"","sources":["../../src.ts/utils/fixednumber.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA4C1D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,MA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B1C;;;;;;OAMG;IACH,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;IAsB/B;;OAEG;IACH,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAI/B;;OAEG;IACH,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAI/B;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAIhC;;OAEG;IACH,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAI/B;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAIhC;;;;;OAKG;IACH,KAAK,IAAI,WAAW;IASpB;;;;;OAKG;IACH,OAAO,IAAI,WAAW;IAStB;;;OAGG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW;IAsBrC;;OAEG;IACH,MAAM,IAAI,OAAO;IAIjB;;OAEG;IACH,UAAU,IAAI,OAAO;IAIrB;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;;;;OAMG;IACH,aAAa,IAAI,MAAM;IAIvB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW;IAI1C;;;;;;;OAOG;IACH,MAAM,CAAC,SAAS,CACd,MAAM,EAAE,YAAY,EACpB,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,WAAW,GACpB,WAAW;IA8Bd;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW;IAyCrE;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW;CAYxE"} \ No newline at end of file diff --git a/types/utils/geturl-browser.d.ts b/types/utils/geturl-browser.d.ts deleted file mode 100644 index 133a13813..000000000 --- a/types/utils/geturl-browser.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; -declare global { - class Headers { - constructor(values: Array<[string, string]>); - forEach(func: (v: string, k: string) => void): void; - } - class Response { - status: number; - statusText: string; - headers: Headers; - arrayBuffer(): Promise; - } - type FetchInit = { - method?: string; - headers?: Headers; - body?: Uint8Array; - }; - function fetch(url: string, init: FetchInit): Promise; -} -export declare function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Promise; -//# sourceMappingURL=geturl-browser.d.ts.map \ No newline at end of file diff --git a/types/utils/geturl-browser.d.ts.map b/types/utils/geturl-browser.d.ts.map deleted file mode 100644 index 852575bca..000000000 --- a/types/utils/geturl-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geturl-browser.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl-browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,OAAO,CAAC,MAAM,CAAC;IAEb,MAAM,OAAO;oBACC,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;KACpD;IAGD,MAAM,QAAQ;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;KACpC;IAED,KAAK,SAAS,GAAG;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,UAAU,CAAC;KACnB,CAAC;IAEF,SAAS,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACjE;AAID,wBAAsB,MAAM,CAC1B,GAAG,EAAE,YAAY,EACjB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CA0DrC"} \ No newline at end of file diff --git a/types/utils/geturl.d.ts b/types/utils/geturl.d.ts deleted file mode 100644 index a4252134f..000000000 --- a/types/utils/geturl.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; -/** - * @_ignore: - */ -export declare function getUrl(req: FetchRequest, signal?: FetchCancelSignal): Promise; -//# sourceMappingURL=geturl.d.ts.map \ No newline at end of file diff --git a/types/utils/geturl.d.ts.map b/types/utils/geturl.d.ts.map deleted file mode 100644 index 8cde884db..000000000 --- a/types/utils/geturl.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"geturl.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAsB,MAAM,CAC1B,GAAG,EAAE,YAAY,EACjB,MAAM,CAAC,EAAE,iBAAiB,GACzB,OAAO,CAAC,cAAc,CAAC,CAqGzB"} \ No newline at end of file diff --git a/types/utils/index.d.ts b/types/utils/index.d.ts deleted file mode 100644 index 40183df8b..000000000 --- a/types/utils/index.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * There are many simple utilities required to interact with - * Core and to simplify the library, without increasing - * the library dependencies for simple functions. - * - * @_section api/utils:Utilities [about-utils] - */ -export { decodeBase58, encodeBase58 } from "./base58.js"; -export { decodeBase64, encodeBase64 } from "./base64.js"; -export { getBytes, getBytesCopy, isHexString, isBytesLike, hexlify, concat, dataLength, dataSlice, stripZerosLeft, zeroPadValue, zeroPadBytes, arrayify, hexConcat, } from "./data.js"; -export { isCallException, isError, assert, assertArgument, assertArgumentCount, assertPrivate, assertNormalize, makeError, } from "./errors.js"; -export { EventPayload } from "./events.js"; -export { FetchRequest, FetchResponse, FetchCancelSignal } from "./fetch.js"; -export { FixedNumber } from "./fixednumber.js"; -export { fromTwos, toTwos, mask, getBigInt, getNumber, getUint, toBigInt, toNumber, toBeHex, toBeArray, toQuantity, } from "./maths.js"; -export { resolveProperties, defineProperties } from "./properties.js"; -export { decodeRlp } from "./rlp-decode.js"; -export { encodeRlp } from "./rlp-encode.js"; -export { formatXCB, parseXCB, formatUnits, parseUnits } from "./units.js"; -export { toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, } from "./utf8.js"; -export { uuidV4 } from "./uuid.js"; -export type { BytesLike } from "./data.js"; -export type { ErrorCode, CoreBCError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CallExceptionAction, CallExceptionTransaction, CodedCoreBCError, } from "./errors.js"; -export type { EventEmitterable, Listener } from "./events.js"; -export type { GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc, } from "./fetch.js"; -export type { FixedFormat } from "./fixednumber.js"; -export type { BigNumberish, Numeric } from "./maths.js"; -export type { RlpStructuredData } from "./rlp.js"; -export type { Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, } from "./utf8.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/utils/index.d.ts.map b/types/utils/index.d.ts.map deleted file mode 100644 index 2efd33012..000000000 --- a/types/utils/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/utils/index.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WAAW,CAAC;AAE3C,YAAY,EAIV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE9D,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAExD,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,YAAY,EACV,aAAa,EACb,wBAAwB,EACxB,eAAe,GAChB,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/types/utils/maths.d.ts b/types/utils/maths.d.ts deleted file mode 100644 index e1fd19522..000000000 --- a/types/utils/maths.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -import type { BytesLike } from "./data.js"; -/** - * Any type that can be used where a numeric value is needed. - */ -export type Numeric = number | bigint; -/** - * Any type that can be used where a big number is needed. - */ -export type BigNumberish = string | Numeric; -/** - * Convert %%value%% from a twos-compliment representation of %%width%% - * bits to its value. - * - * If the highest bit is ``1``, the result will be negative. - */ -export declare function fromTwos(_value: BigNumberish, _width: Numeric): bigint; -/** - * Convert %%value%% to a twos-compliment representation of - * %%width%% bits. - * - * The result will always be positive. - */ -export declare function toTwos(_value: BigNumberish, _width: Numeric): bigint; -/** - * Mask %%value%% with a bitmask of %%bits%% ones. - */ -export declare function mask(_value: BigNumberish, _bits: Numeric): bigint; -/** - * Gets a BigInt from %%value%%. If it is an invalid value for - * a BigInt, then an ArgumentError will be thrown for %%name%%. - */ -export declare function getBigInt(value: BigNumberish, name?: string): bigint; -export declare function getUint(value: BigNumberish, name?: string): bigint; -export declare function toBigInt(value: BigNumberish | Uint8Array): bigint; -/** - * Gets a //number// from %%value%%. If it is an invalid value for - * a //number//, then an ArgumentError will be thrown for %%name%%. - */ -export declare function getNumber(value: BigNumberish, name?: string): number; -/** - * Converts %%value%% to a number. If %%value%% is a Uint8Array, it - * is treated as Big Endian data. Throws if the value is not safe. - */ -export declare function toNumber(value: BigNumberish | Uint8Array): number; -/** - * Converts %%value%% to a Big Endian hexstring, optionally padded to - * %%width%% bytes. - */ -export declare function toBeHex(_value: BigNumberish, _width?: Numeric): string; -/** - * Converts %%value%% to a Big Endian Uint8Array. - */ -export declare function toBeArray(_value: BigNumberish): Uint8Array; -/** - * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. - * - * A //Quantity// does not have and leading 0 values unless the value is - * the literal value `0x0`. This is most commonly used for JSSON-RPC - * numeric values. - */ -export declare function toQuantity(value: BytesLike | BigNumberish): string; -//# sourceMappingURL=maths.d.ts.map \ No newline at end of file diff --git a/types/utils/maths.d.ts.map b/types/utils/maths.d.ts.map deleted file mode 100644 index 375586bed..000000000 --- a/types/utils/maths.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"maths.d.ts","sourceRoot":"","sources":["../../src.ts/utils/maths.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAU5C;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAiBtE;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAwBpE;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAIjE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAqCpE;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAQlE;AAQD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAWjE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAwCpE;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAEjE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CA8BtE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAmB1D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,YAAY,GAAG,MAAM,CAWlE"} \ No newline at end of file diff --git a/types/utils/properties.d.ts b/types/utils/properties.d.ts deleted file mode 100644 index f7871cc89..000000000 --- a/types/utils/properties.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Resolves to a new object that is a copy of %%value%%, but with all - * values resolved. - */ -export declare function resolveProperties(value: { - [P in keyof T]: T[P] | Promise; -}): Promise; -/** - * Assigns the %%values%% to %%target%% as read-only values. - * - * It %%types%% is specified, the values are checked. - */ -export declare function defineProperties(target: T, values: { - [K in keyof T]?: T[K]; -}, types?: { - [K in keyof T]?: string; -}): void; -export declare function checkProperties(object: any, properties: { - [name: string]: boolean; -}): void; -//# sourceMappingURL=properties.d.ts.map \ No newline at end of file diff --git a/types/utils/properties.d.ts.map b/types/utils/properties.d.ts.map deleted file mode 100644 index 2520af8fb..000000000 --- a/types/utils/properties.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src.ts/utils/properties.ts"],"names":[],"mappings":"AAiCA;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE;KAC/C,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACrC,GAAG,OAAO,CAAC,CAAC,CAAC,CAYb;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,MAAM,EAAE,CAAC,EACT,MAAM,EAAE;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAAE,EACjC,KAAK,CAAC,EAAE;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM;CAAE,GAClC,IAAI,CAeN;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,GAAG,EACX,UAAU,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GACtC,IAAI,CAcN"} \ No newline at end of file diff --git a/types/utils/rlp-decode.d.ts b/types/utils/rlp-decode.d.ts deleted file mode 100644 index b77b08b9c..000000000 --- a/types/utils/rlp-decode.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { BytesLike, RlpStructuredData } from "./index.js"; -/** - * Decodes %%data%% into the structured data it represents. - */ -export declare function decodeRlp(_data: BytesLike): RlpStructuredData; -//# sourceMappingURL=rlp-decode.d.ts.map \ No newline at end of file diff --git a/types/utils/rlp-decode.d.ts.map b/types/utils/rlp-decode.d.ts.map deleted file mode 100644 index b82126ab8..000000000 --- a/types/utils/rlp-decode.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp-decode.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp-decode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAyH/D;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,iBAAiB,CAU7D"} \ No newline at end of file diff --git a/types/utils/rlp-encode.d.ts b/types/utils/rlp-encode.d.ts deleted file mode 100644 index 9c3d024ac..000000000 --- a/types/utils/rlp-encode.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { RlpStructuredData } from "./rlp.js"; -/** - * Encodes %%object%% as an RLP-encoded [[DataHexString]]. - */ -export declare function encodeRlp(object: RlpStructuredData): string; -//# sourceMappingURL=rlp-encode.d.ts.map \ No newline at end of file diff --git a/types/utils/rlp-encode.d.ts.map b/types/utils/rlp-encode.d.ts.map deleted file mode 100644 index 3fa6ef0ba..000000000 --- a/types/utils/rlp-encode.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp-encode.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp-encode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAgDlD;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAO3D"} \ No newline at end of file diff --git a/types/utils/rlp.d.ts b/types/utils/rlp.d.ts deleted file mode 100644 index 6ef450115..000000000 --- a/types/utils/rlp.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * The [[link-rlp]] (RLP) encoding is used throughout Core - * to serialize nested structures of Arrays and data. - * - * @_subsection api/utils:Recursive-Length Prefix [about-rlp] - */ -export { decodeRlp } from "./rlp-decode.js"; -export { encodeRlp } from "./rlp-encode.js"; -/** - * An RLP-encoded structure. - */ -export type RlpStructuredData = string | Array; -//# sourceMappingURL=rlp.d.ts.map \ No newline at end of file diff --git a/types/utils/rlp.d.ts.map b/types/utils/rlp.d.ts.map deleted file mode 100644 index c5043abd3..000000000 --- a/types/utils/rlp.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC"} \ No newline at end of file diff --git a/types/utils/units.d.ts b/types/utils/units.d.ts deleted file mode 100644 index dfb7a32a6..000000000 --- a/types/utils/units.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { BigNumberish, Numeric } from "../utils/index.js"; -/** - * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal - * places. The %%unit%% may be the number of decimal places or the name of - * a unit - * - */ -export declare function formatUnits(value: BigNumberish, unit?: string | Numeric): string; -/** - * Converts the //decimal string// %%value%% to a BigInt, assuming - * %%unit%% decimal places. The %%unit%% may the number of decimal places - * or the name of a unit. - */ -export declare const scientificToDecimal: (num: string | number) => string | number; -export declare const trimDecimals: (n: string, decimals?: number) => string; -export declare function parseUnits(value: string, unit?: string | Numeric): bigint; -/** - * Converts %%value%% into a //decimal string// using 18 decimal places. - */ -export declare function formatXCB(ore: BigNumberish): string; -/** - * Converts the //decimal string// %%xcb%% to a BigInt, using 18 - * decimal places. - */ -export declare function parseXCB(xcb: string): bigint; -//# sourceMappingURL=units.d.ts.map \ No newline at end of file diff --git a/types/utils/units.d.ts.map b/types/utils/units.d.ts.map deleted file mode 100644 index 3db242e6c..000000000 --- a/types/utils/units.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src.ts/utils/units.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAwB/D;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,YAAY,EACnB,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GACtB,MAAM,CAWR;AAED;;;;GAIG;AAEH,eAAO,MAAM,mBAAmB,QAAS,MAAM,GAAG,MAAM,oBA6CvD,CAAC;AACF,eAAO,MAAM,YAAY,MAAO,MAAM,8BAQrC,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAsBzE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAEnD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C"} \ No newline at end of file diff --git a/types/utils/utf8.d.ts b/types/utils/utf8.d.ts deleted file mode 100644 index 7bb87cc7d..000000000 --- a/types/utils/utf8.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -import type { BytesLike } from "./index.js"; -/** - * The stanard normalization forms. - */ -export type UnicodeNormalizationForm = "NFC" | "NFD" | "NFKC" | "NFKD"; -/** - * When using the UTF-8 error API the following errors can be intercepted - * and processed as the %%reason%% passed to the [[Utf8ErrorFunc]]. - * - * **``"UNEXPECTED_CONTINUE"``** - a continuation byte was present where there - * was nothing to continue. - * - * **``"BAD_PREFIX"``** - an invalid (non-continuation) byte to start a - * UTF-8 codepoint was found. - * - * **``"OVERRUN"``** - the string is too short to process the expected - * codepoint length. - * - * **``"MISSING_CONTINUE"``** - a missing continuation byte was expected but - * not found. The %%offset%% indicates the index the continuation byte - * was expected at. - * - * **``"OUT_OF_RANGE"``** - the computed code point is outside the range - * for UTF-8. The %%badCodepoint%% indicates the computed codepoint, which was - * outside the valid UTF-8 range. - * - * **``"UTF16_SURROGATE"``** - the UTF-8 strings contained a UTF-16 surrogate - * pair. The %%badCodepoint%% is the computed codepoint, which was inside the - * UTF-16 surrogate range. - * - * **``"OVERLONG"``** - the string is an overlong representation. The - * %%badCodepoint%% indicates the computed codepoint, which has already - * been bounds checked. - * - * - * @returns string - */ -export type Utf8ErrorReason = "UNEXPECTED_CONTINUE" | "BAD_PREFIX" | "OVERRUN" | "MISSING_CONTINUE" | "OUT_OF_RANGE" | "UTF16_SURROGATE" | "OVERLONG"; -/** - * A callback that can be used with [[toUtf8String]] to analysis or - * recovery from invalid UTF-8 data. - * - * Parsing UTF-8 data is done through a simple Finite-State Machine (FSM) - * which calls the ``Utf8ErrorFunc`` if a fault is detected. - * - * The %%reason%% indicates where in the FSM execution the fault - * occurred and the %%offset%% indicates where the input failed. - * - * The %%bytes%% represents the raw UTF-8 data that was provided and - * %%output%% is the current array of UTF-8 code-points, which may - * be updated by the ``Utf8ErrorFunc``. - * - * The value of the %%badCodepoint%% depends on the %%reason%%. See - * [[Utf8ErrorReason]] for details. - * - * The function should return the number of bytes that should be skipped - * when control resumes to the FSM. - */ -export type Utf8ErrorFunc = (reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array, badCodepoint?: number) => number; -/** - * A handful of popular, built-in UTF-8 error handling strategies. - * - * **``"error"``** - throws on ANY illegal UTF-8 sequence or - * non-canonical (overlong) codepoints (this is the default) - * - * **``"ignore"``** - silently drops any illegal UTF-8 sequence - * and accepts non-canonical (overlong) codepoints - * - * **``"replace"``** - replace any illegal UTF-8 sequence with the - * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts - * non-canonical (overlong) codepoints - * - * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> - */ -export declare const Utf8ErrorFuncs: Readonly>; -/** - * Returns the UTF-8 byte representation of %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ -export declare function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array; -/** - * Returns the string represented by the UTF-8 data %%bytes%%. - * - * When %%onError%% function is specified, it is called on UTF-8 - * errors allowing recovery using the [[Utf8ErrorFunc]] API. - * (default: [error](Utf8ErrorFuncs)) - */ -export declare function toUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string; -/** - * Returns the UTF-8 code-points for %%str%%. - * - * If %%form%% is specified, the string is normalized. - */ -export declare function toUtf8CodePoints(str: string, form?: UnicodeNormalizationForm): Array; -//# sourceMappingURL=utf8.d.ts.map \ No newline at end of file diff --git a/types/utils/utf8.d.ts.map b/types/utils/utf8.d.ts.map deleted file mode 100644 index f79c87b2e..000000000 --- a/types/utils/utf8.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utf8.d.ts","sourceRoot":"","sources":["../../src.ts/utils/utf8.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAI5C;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,eAAe,GACvB,qBAAqB,GACrB,YAAY,GACZ,SAAS,GACT,kBAAkB,GAClB,cAAc,GACd,iBAAiB,GACjB,UAAU,CAAC;AAEf;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EACrB,YAAY,CAAC,EAAE,MAAM,KAClB,MAAM,CAAC;AAwEZ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CACnC,MAAM,CAAC,OAAO,GAAG,QAAQ,GAAG,SAAS,EAAE,aAAa,CAAC,CAKrD,CAAC;AA2GH;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,wBAAwB,GAC9B,UAAU,CAwCZ;AAkBD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAChB,OAAO,CAAC,EAAE,aAAa,GACtB,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,wBAAwB,GAC9B,KAAK,CAAC,MAAM,CAAC,CAEf"} \ No newline at end of file diff --git a/types/utils/uuid.d.ts b/types/utils/uuid.d.ts deleted file mode 100644 index 7b7465157..000000000 --- a/types/utils/uuid.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { BytesLike } from "./index.js"; -/** - * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. - * - * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) - */ -export declare function uuidV4(randomBytes: BytesLike): string; -//# sourceMappingURL=uuid.d.ts.map \ No newline at end of file diff --git a/types/utils/uuid.d.ts.map b/types/utils/uuid.d.ts.map deleted file mode 100644 index f3cf307c6..000000000 --- a/types/utils/uuid.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src.ts/utils/uuid.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAqBrD"} \ No newline at end of file diff --git a/types/wallet/base-wallet.d.ts b/types/wallet/base-wallet.d.ts deleted file mode 100644 index a788c67b2..000000000 --- a/types/wallet/base-wallet.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { AbstractSigner } from "../providers/index.js"; -import { SigningKey } from "../crypto/index.js"; -import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; -import type { Provider, TransactionRequest } from "../providers/index.js"; -/** - * The **BaseWallet** is a stream-lined implementation of a - * [[Signer]] that operates with a private key. - * - * It is preferred to use the [[Wallet]] class, as it offers - * additional functionality and simplifies loading a variety - * of JSON formats, Mnemonic Phrases, etc. - * - * This class may be of use for those attempting to implement - * a minimal Signer. - */ -export declare class BaseWallet extends AbstractSigner { - #private; - /** - * The wallet address. - */ - readonly address: string; - readonly prefix: string; - /** - * Creates a new BaseWallet for %%privateKey%%, optionally - * connected to %%provider%%. - * - * If %%provider%% is not specified, only offline methods can - * be used. - */ - constructor({ signingKey, prefix, provider, }: { - signingKey: SigningKey; - prefix: string; - provider?: null | Provider; - }); - /** - * The [[SigningKey]] used for signing payloads. - */ - get signingKey(): SigningKey; - /** - * The private key for this wallet. - */ - get privateKey(): string; - getAddress(): Promise; - connect(provider: null | Provider): BaseWallet; - signTransaction(tx: TransactionRequest): Promise; - signMessage(message: string | Uint8Array): Promise; - /** - * Returns the signature for %%message%% signed with this wallet. - */ - signMessageSync(message: string | Uint8Array): string; - signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; -} -//# sourceMappingURL=base-wallet.d.ts.map \ No newline at end of file diff --git a/types/wallet/base-wallet.d.ts.map b/types/wallet/base-wallet.d.ts.map deleted file mode 100644 index dc25c591a..000000000 --- a/types/wallet/base-wallet.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"base-wallet.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/base-wallet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AASvD,OAAO,EAAU,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG1E;;;;;;;;;;GAUG;AACH,qBAAa,UAAW,SAAQ,cAAc;;IAC5C;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAIxB;;;;;;OAMG;gBACS,EACV,UAAU,EACV,MAAM,EACN,QAAQ,GACT,EAAE;QACD,UAAU,EAAE,UAAU,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,CAAC;KAC5B;IAmBD;;OAEG;IACH,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAEK,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,UAAU;IAQxC,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgCxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAMhE;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM;IAI/C,aAAa,CACjB,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC;CAiCnB"} \ No newline at end of file diff --git a/types/wallet/english_words.d.ts b/types/wallet/english_words.d.ts deleted file mode 100644 index fec60c704..000000000 --- a/types/wallet/english_words.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const englishWords = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; -//# sourceMappingURL=english_words.d.ts.map \ No newline at end of file diff --git a/types/wallet/english_words.d.ts.map b/types/wallet/english_words.d.ts.map deleted file mode 100644 index 15a3e8323..000000000 --- a/types/wallet/english_words.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"english_words.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/english_words.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,i0VACuyV,CAAC"} \ No newline at end of file diff --git a/types/wallet/hdwallet.d.ts b/types/wallet/hdwallet.d.ts deleted file mode 100644 index 7c96fb8a0..000000000 --- a/types/wallet/hdwallet.d.ts +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Explain HD Wallets.. - * - * @_subsection: api/wallet:HD Wallets [hd-wallets] - */ -import { SigningKey } from "../crypto/index.js"; -import { BaseWallet } from "./base-wallet.js"; -import { Mnemonic } from "./mnemonic.js"; -import type { ProgressCallback } from "../crypto/index.js"; -import type { Provider } from "../providers/index.js"; -import type { Numeric } from "../utils/index.js"; -import type { Wordlist } from "../wordlists/index.js"; -/** - * The default derivation path for Core HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) - */ -export declare const defaultPath: string; -/** - * An **HDNodeWallet** is a [[Signer]] backed by the private key derived - * from an HD Node using the [[link-bip-32]] stantard. - * - * An HD Node forms a hierarchal structure with each HD Node having a - * private key and the ability to derive child HD Nodes, defined by - * a path indicating the index of each child. - */ -export declare class HDNodeWallet extends BaseWallet { - #private; - /** - * The compressed public key. - */ - readonly publicKey: string; - prefix: string; - /** - * The fingerprint. - * - * A fingerprint allows quick qay to detect parent and child nodes, - * but developers should be prepared to deal with collisions as it - * is only 4 bytes. - */ - readonly fingerprint: string; - /** - * The parent fingerprint. - */ - readonly parentFingerprint: string; - /** - * The mnemonic used to create this HD Node, if available. - * - * Sources such as extended keys do not encode the mnemonic, in - * which case this will be ``null``. - */ - readonly mnemonic: null | Mnemonic; - /** - * The derivation path of this wallet. - * - * Since extended keys do not provider full path details, this - * may be ``null``, if instantiated from a source that does not - * enocde it. - */ - readonly path: null | string; - /** - * The child index of this wallet. Values over ``2 *\* 31`` indicate - * the node is hardened. - */ - readonly index: number; - /** - * The depth of this wallet, which is the number of components - * in its path. - */ - readonly depth: number; - /** - * @private - */ - constructor({ guard, seed, signingKey, parentFingerprint, path, index, depth, mnemonic, provider, prefix, }: { - guard: any; - seed: string; - signingKey: SigningKey; - parentFingerprint: string; - path: null | string; - index: number; - depth: number; - mnemonic: null | Mnemonic; - provider: null | Provider; - prefix: string; - }); - connect(provider: null | Provider): HDNodeWallet; - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise; - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password: Uint8Array | string): string; - /** - * Returns true if this wallet has a path, providing a Type Guard - * that the path is non-null. - */ - hasPath(): this is { - path: string; - }; - /** - * Return the child for %%index%%. - */ - deriveChild(_index: number): HDNodeWallet; - /** - * Return the HDNode for %%path%% from this node. - */ - derivePath(path: string): HDNodeWallet; - /** - * Creates a new random HDNode. - */ - static createRandom(prefix: string, password?: string, path?: string, wordlist?: Wordlist): HDNodeWallet; - /** - * Create am HD Node from %%mnemonic%%. - */ - static fromMnemonic(mnemonic: Mnemonic, prefix: string, path?: string): HDNodeWallet; - static mnemonicToSeed(mnemonic: string, password?: string): string; - /** - * Creates an HD Node from a mnemonic %%phrase%%. - */ - static fromPhrase({ phrase, prefix, password, path, wordlist, }: { - phrase: string; - prefix: string; - password?: string; - path?: string; - wordlist?: Wordlist; - }): HDNodeWallet; - /** - * Creates an HD Node from a %%seed%%. - */ - static fromSeed({ seed, prefix, path, }: { - seed: string; - prefix: string; - path?: string; - }): HDNodeWallet; -} -/** - * Returns the [[link-bip-32]] path for the acount at %%index%%. - * - * This is the pattern used by wallets like Ledger. - * - * There is also an [alternate pattern](getIndexedAccountPath) used by - * some software. - */ -export declare function getAccountPath(_index: Numeric): string; -/** - * Returns the path using an alternative pattern for deriving accounts, - * at %%index%%. - * - * This derivation path uses the //index// component rather than the - * //account// component to derive sequential accounts. - * - * This is the pattern used by wallets like MetaMask. - */ -export declare function getIndexedAccountPath(_index: Numeric): string; -//# sourceMappingURL=hdwallet.d.ts.map \ No newline at end of file diff --git a/types/wallet/hdwallet.d.ts.map b/types/wallet/hdwallet.d.ts.map deleted file mode 100644 index cc249d4de..000000000 --- a/types/wallet/hdwallet.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hdwallet.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/hdwallet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAA0B,UAAU,EAAU,MAAM,oBAAoB,CAAC;AAUhF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAMzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAA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IAAI,EACJ,MAAM,EACN,IAAI,GACL,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,YAAY;CAQjB;AAmBD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAStD;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAS7D"} \ No newline at end of file diff --git a/types/wallet/index.d.ts b/types/wallet/index.d.ts deleted file mode 100644 index d3db8f37c..000000000 --- a/types/wallet/index.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * When interacting with Core, it is necessary to use a private - * key authenticate actions by signing a payload. - * - * Wallets are the simplest way to expose the concept of an - * //Externally Owner Account// (EOA) as it wraps a private key - * and supports high-level methods to sign common types of interaction - * and send transactions. - * - * The class most developers will want to use is [[Wallet]], which - * can load a private key directly or from any common wallet format. - * - * The [[HDNodeWallet]] can be used when it is necessary to access - * low-level details of how an HD wallets are derived, exported - * or imported. - * - * @_section: api/wallet:Wallets [about-wallets] - */ -export { BaseWallet } from "./base-wallet.js"; -export { defaultPath, getAccountPath, getIndexedAccountPath, HDNodeWallet, } from "./hdwallet.js"; -export { isCrowdsaleJson, decryptCrowdsaleJson } from "./json-crowdsale.js"; -export { isKeystoreJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./json-keystore.js"; -export { Mnemonic } from "./mnemonic.js"; -export { Wallet } from "./wallet.js"; -export type { CrowdsaleAccount } from "./json-crowdsale.js"; -export type { KeystoreAccount, EncryptOptions } from "./json-keystore.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/wallet/index.d.ts.map b/types/wallet/index.d.ts.map deleted file mode 100644 index fc93212da..000000000 --- a/types/wallet/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACL,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"} \ No newline at end of file diff --git a/types/wallet/json-crowdsale.d.ts b/types/wallet/json-crowdsale.d.ts deleted file mode 100644 index 65b5f0251..000000000 --- a/types/wallet/json-crowdsale.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * The data stored within a JSON Crowdsale wallet is fairly - * minimal. - */ -export type CrowdsaleAccount = { - privateKey: string; - address: string; -}; -/** - * Returns true if %%json%% is a valid JSON Crowdsale wallet. - */ -export declare function isCrowdsaleJson(json: string): boolean; -/** - * Before Core launched, it was necessary to create a wallet - * format for backers to use, which would be used to receive xcb - * as a reward for contributing to the project. - * - * The [[link-crowdsale]] format is now obsolete, but it is still - * useful to support and the additional code is fairly trivial as - * all the primitives required are used through core portions of - * the library. - */ -export declare function decryptCrowdsaleJson(json: string, _password: string | Uint8Array): CrowdsaleAccount; -//# sourceMappingURL=json-crowdsale.d.ts.map \ No newline at end of file diff --git a/types/wallet/json-crowdsale.d.ts.map b/types/wallet/json-crowdsale.d.ts.map deleted file mode 100644 index 4514aef1b..000000000 --- a/types/wallet/json-crowdsale.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-crowdsale.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/json-crowdsale.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAAG,UAAU,GAC7B,gBAAgB,CAmClB"} \ No newline at end of file diff --git a/types/wallet/json-keystore.d.ts b/types/wallet/json-keystore.d.ts deleted file mode 100644 index 363fd7956..000000000 --- a/types/wallet/json-keystore.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -import type { ProgressCallback } from "../crypto/index.js"; -import type { BytesLike } from "../utils/index.js"; -/** - * The contents of a JSON Keystore Wallet. - */ -export type KeystoreAccount = { - address: string; - privateKey: string; - mnemonic?: { - path?: string; - locale?: string; - entropy: string; - }; -}; -/** - * The parameters to use when encrypting a JSON Keystore Wallet. - */ -export type EncryptOptions = { - progressCallback?: ProgressCallback; - iv?: BytesLike; - entropy?: BytesLike; - client?: string; - salt?: BytesLike; - uuid?: string; - scrypt?: { - N?: number; - r?: number; - p?: number; - }; -}; -/** - * Returns true if %%json%% is a valid JSON Keystore Wallet. - */ -export declare function isKeystoreJson(json: string): boolean; -/** - * Returns the account details for the JSON Keystore Wallet %%json%% - * using %%password%%. - * - * It is preferred to use the [async version](decryptKeystoreJson) - * instead, which allows a [[ProgressCallback]] to keep the user informed - * as to the decryption status. - * - * This method will block the event loop (freezing all UI) until decryption - * is complete, which can take quite some time, depending on the wallet - * paramters and platform. - */ -export declare function decryptKeystoreJsonSync(json: string, _password: string | Uint8Array): KeystoreAccount; -/** - * Resolves to the decrypted JSON Keystore Wallet %%json%% using the - * %%password%%. - * - * If provided, %%progress%% will be called periodically during the - * decrpytion to provide feedback, and if the function returns - * ``false`` will halt decryption. - * - * The %%progressCallback%% will **always** receive ``0`` before - * decryption begins and ``1`` when complete. - */ -export declare function decryptKeystoreJson(json: string, _password: string | Uint8Array, progress?: ProgressCallback): Promise; -/** - * Return the JSON Keystore Wallet for %%account%% encrypted with - * %%password%%. - * - * The %%options%% can be used to tune the password-based key - * derivation function parameters, explicitly set the random values - * used. Any provided [[ProgressCallback]] is ignord. - */ -export declare function encryptKeystoreJsonSync(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): string; -/** - * Resolved to the JSON Keystore Wallet for %%account%% encrypted - * with %%password%%. - * - * The %%options%% can be used to tune the password-based key - * derivation function parameters, explicitly set the random values - * used and provide a [[ProgressCallback]] to receive periodic updates - * on the completion status.. - */ -export declare function encryptKeystoreJson(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): Promise; -//# sourceMappingURL=json-keystore.d.ts.map \ No newline at end of file diff --git a/types/wallet/json-keystore.d.ts.map b/types/wallet/json-keystore.d.ts.map deleted file mode 100644 index a56cc644a..000000000 --- a/types/wallet/json-keystore.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-keystore.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/json-keystore.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAOnD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB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file mode 100644 index 64ef1a10e..000000000 --- a/types/wallet/mnemonic.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -import type { BytesLike } from "../utils/index.js"; -import type { Wordlist } from "../wordlists/index.js"; -/** - * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] - * seeds and convert between phrases and entropy. - */ -export declare class Mnemonic { - /** - * The mnemonic phrase of 12, 15, 18, 21 or 24 words. - * - * Use the [[wordlist]] ``split`` method to get the individual words. - */ - readonly phrase: string; - /** - * The password used for this mnemonic. If no password is used this - * is the empty string (i.e. ``""``) as per the specification. - */ - readonly password: string; - /** - * The wordlist for this mnemonic. - */ - readonly wordlist: Wordlist; - /** - * The underlying entropy which the mnemonic encodes. - */ - readonly entropy: string; - /** - * @private - */ - constructor(guard: any, entropy: string, phrase: string, password?: null | string, wordlist?: null | Wordlist); - /** - * Returns the seed for the mnemonic. - */ - computeSeed(): string; - /** - * Creates a new Mnemonic for the %%phrase%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromPhrase({ phrase, password, wordlist, }: { - phrase: string; - password?: null | string; - wordlist?: null | Wordlist; - }): Mnemonic; - /** - * Create a new **Mnemonic** from the %%entropy%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromEntropy(_entropy: BytesLike, password?: null | string, wordlist?: null | Wordlist): Mnemonic; - /** - * Returns the phrase for %%mnemonic%%. - */ - static entropyToPhrase(_entropy: BytesLike, wordlist?: null | Wordlist): string; - /** - * Returns the entropy for %%phrase%%. - */ - static phraseToEntropy(phrase: string, wordlist?: null | Wordlist): string; - /** - * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. - * - * This checks all the provided words belong to the %%wordlist%%, - * that the length is valid and the checksum is correct. - */ - static isValidMnemonic(phrase: string, wordlist?: null | Wordlist): boolean; -} -//# sourceMappingURL=mnemonic.d.ts.map \ No newline at end of file diff --git a/types/wallet/mnemonic.d.ts.map b/types/wallet/mnemonic.d.ts.map deleted file mode 100644 index 82d411a3d..000000000 --- a/types/wallet/mnemonic.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mnemonic.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/mnemonic.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AA6HtD;;;GAGG;AACH,qBAAa,QAAQ;IACnB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAEzB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAG,MAAM,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAG,QAAQ,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC;IAE1B;;OAEG;gBAED,KAAK,EAAE,GAAG,EACV,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,EACxB,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ;IAY5B;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,EAChB,MAAM,EACN,QAAQ,EACR,QAAQ,GACT,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QACzB,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,CAAC;KAC5B,GAAG,QAAQ;IAOZ;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAChB,QAAQ,EAAE,SAAS,EACnB,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,EACxB,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GACzB,QAAQ;IAMX;;OAEG;IACH,MAAM,CAAC,eAAe,CACpB,QAAQ,EAAE,SAAS,EACnB,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GACzB,MAAM;IAKT;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM;IAI1E;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,OAAO;CAO5E"} \ No newline at end of file diff --git a/types/wallet/mnemonicToSeed.d.ts b/types/wallet/mnemonicToSeed.d.ts deleted file mode 100644 index ee0ed82a0..000000000 --- a/types/wallet/mnemonicToSeed.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function mnemonicToSeed(mnemonic: string, password?: string): string; -//# sourceMappingURL=mnemonicToSeed.d.ts.map \ No newline at end of file diff --git a/types/wallet/mnemonicToSeed.d.ts.map b/types/wallet/mnemonicToSeed.d.ts.map deleted file mode 100644 index fa7e673dc..000000000 --- a/types/wallet/mnemonicToSeed.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mnemonicToSeed.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/mnemonicToSeed.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAM1E"} \ No newline at end of file diff --git a/types/wallet/utils.d.ts b/types/wallet/utils.d.ts deleted file mode 100644 index 0d4baabe8..000000000 --- a/types/wallet/utils.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @_ignore - */ -export declare function looseArrayify(hexString: string): Uint8Array; -export declare function zpad(value: String | number, length: number): String; -export declare function getPassword(password: string | Uint8Array): Uint8Array; -export declare function spelunk(object: any, _path: string): T; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/types/wallet/utils.d.ts.map b/types/wallet/utils.d.ts.map deleted file mode 100644 index 4c02cc44f..000000000 --- a/types/wallet/utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAK3D;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMnE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAKrE;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAoExD"} \ No newline at end of file diff --git a/types/wallet/wallet.d.ts b/types/wallet/wallet.d.ts deleted file mode 100644 index 384cb372f..000000000 --- a/types/wallet/wallet.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { SigningKey } from "../crypto/index.js"; -import { BaseWallet } from "./base-wallet.js"; -import { HDNodeWallet } from "./hdwallet.js"; -import type { ProgressCallback } from "../crypto/index.js"; -import type { Provider } from "../providers/index.js"; -/** - * A **Wallet** manages a single private key which is used to sign - * transactions, messages and other common payloads. - * - * This class is generally the main entry point for developers - * that wish to use a private key directly, as it can create - * instances from a large variety of common sources, including - * raw private key, [[link-bip-39]] mnemonics and encrypte JSON - * wallets. - */ -export declare class Wallet extends BaseWallet { - #private; - /** - * Create a new wallet for the %%privateKey%% or %%signingKey%%, optionally connected - * to %%provider%%. - */ - constructor({ key, prefix, provider, }: { - key: string | SigningKey; - prefix: string; - provider?: null | Provider; - }); - connect(provider: null | Provider): Wallet; - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise; - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password: Uint8Array | string): string; - /** - * Creates (asynchronously) a **Wallet** by decrypting the %%json%% - * with %%password%%. - * - * If %%progress%% is provided, it is called periodically during - * decryption so that any UI can be updated. - */ - static fromEncryptedJson(json: string, password: Uint8Array | string, progress?: ProgressCallback): Promise; - /** - * Creates a **Wallet** by decrypting the %%json%% with %%password%%. - * - * The [[fromEncryptedJson]] method is preferred, as this method - * will lock up and freeze the UI during decryption, which may take - * some time. - */ - static fromEncryptedJsonSync(json: string, password: Uint8Array | string): HDNodeWallet | Wallet; - /** - * Creates a new random [[HDNodeWallet]] using the avavilable - * [cryptographic random source](randomBytes). - * - * If there is no crytographic random source, this will throw. - */ - static createRandom(prefix: string, provider?: null | Provider): HDNodeWallet; - /** - * Creates a [[HDNodeWallet]] for %%phrase%%. - */ - static fromPhrase({ phrase, prefix, provider, password, }: { - phrase: string; - prefix: string; - provider?: Provider; - password?: string; - }): HDNodeWallet; - static fromSeed({ seed, prefix, provider, path, }: { - seed: string; - prefix: string; - path?: string; - provider?: Provider; - }): HDNodeWallet; -} -//# sourceMappingURL=wallet.d.ts.map \ No newline at end of file diff --git a/types/wallet/wallet.d.ts.map b/types/wallet/wallet.d.ts.map deleted file mode 100644 index edbeaa1bd..000000000 --- a/types/wallet/wallet.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAe,YAAY,EAAE,MAAM,eAAe,CAAC;AAW1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,o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AAC,EAAE,MAAM,CAAC;KACnB,GAAG,YAAY;IAWhB,MAAM,CAAC,QAAQ,CAAC,EACd,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,IAAI,GACL,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,QAAQ,CAAC;KACrB,GAAG,YAAY;CAWjB"} \ No newline at end of file diff --git a/types/wordlists/bit-reader.d.ts b/types/wordlists/bit-reader.d.ts deleted file mode 100644 index 1aa849530..000000000 --- a/types/wordlists/bit-reader.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * @_ignore - */ -export declare function decodeBits(width: number, data: string): Array; -//# sourceMappingURL=bit-reader.d.ts.map \ No newline at end of file diff --git a/types/wordlists/bit-reader.d.ts.map b/types/wordlists/bit-reader.d.ts.map deleted file mode 100644 index 904904c46..000000000 --- a/types/wordlists/bit-reader.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bit-reader.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/bit-reader.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CA8BrE"} \ No newline at end of file diff --git a/types/wordlists/decode-owl.d.ts b/types/wordlists/decode-owl.d.ts deleted file mode 100644 index 8822086bb..000000000 --- a/types/wordlists/decode-owl.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @_ignore - */ -export declare function decode(data: string, subs: string): Array; -/** - * @_ignore - */ -export declare function decodeOwl(data: string): Array; -//# sourceMappingURL=decode-owl.d.ts.map \ No newline at end of file diff --git a/types/wordlists/decode-owl.d.ts.map b/types/wordlists/decode-owl.d.ts.map deleted file mode 100644 index ce10ef2ad..000000000 --- a/types/wordlists/decode-owl.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decode-owl.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owl.ts"],"names":[],"mappings":"AAuBA;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CA4BhE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAOrD"} \ No newline at end of file diff --git a/types/wordlists/decode-owla.d.ts b/types/wordlists/decode-owla.d.ts deleted file mode 100644 index 479e6c54a..000000000 --- a/types/wordlists/decode-owla.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * @_ignore - */ -export declare function decodeOwlA(data: string, accents: string): Array; -//# sourceMappingURL=decode-owla.d.ts.map \ No newline at end of file diff --git a/types/wordlists/decode-owla.d.ts.map b/types/wordlists/decode-owla.d.ts.map deleted file mode 100644 index da8636365..000000000 --- a/types/wordlists/decode-owla.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decode-owla.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owla.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CA4BvE"} \ No newline at end of file diff --git a/types/wordlists/enwords.d.ts b/types/wordlists/enwords.d.ts deleted file mode 100644 index 8600e64a2..000000000 --- a/types/wordlists/enwords.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const enWords = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; -//# sourceMappingURL=enwords.d.ts.map \ No newline at end of file diff --git a/types/wordlists/enwords.d.ts.map b/types/wordlists/enwords.d.ts.map deleted file mode 100644 index 95d94c6d6..000000000 --- a/types/wordlists/enwords.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"enwords.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/enwords.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,i0VAC4yV,CAAC"} \ No newline at end of file diff --git a/types/wordlists/generation/encode-latin.d.ts b/types/wordlists/generation/encode-latin.d.ts deleted file mode 100644 index a646e8246..000000000 --- a/types/wordlists/generation/encode-latin.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export declare class BitWriter { - #private; - readonly width: number; - constructor(width: number); - write(value: number): void; - get length(): number; - get data(): string; -} -export interface AccentSet { - accent: number; - follows: string; - positions: Array; - positionsLength: number; - positionData: string; - positionDataLength: number; -} -export declare function extractAccents(words: Array): { - accents: Array; - words: Array; -}; -export declare function encodeOwl(words: Array): { - subs: string; - data: string; -}; -//# sourceMappingURL=encode-latin.d.ts.map \ No newline at end of file diff --git a/types/wordlists/generation/encode-latin.d.ts.map b/types/wordlists/generation/encode-latin.d.ts.map deleted file mode 100644 index 87eca3714..000000000 --- a/types/wordlists/generation/encode-latin.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encode-latin.d.ts","sourceRoot":"","sources":["../../../src.ts/wordlists/generation/encode-latin.ts"],"names":[],"mappings":"AAyIA,qBAAa,SAAS;;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAKX,KAAK,EAAE,MAAM;IAMzB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAW1B,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,IAAI,IAAI,MAAM,CA8BjB;CACF;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAWD,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;IACpD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB,CA+FA;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAmDA"} \ No newline at end of file diff --git a/types/wordlists/index.d.ts b/types/wordlists/index.d.ts deleted file mode 100644 index 04a911c83..000000000 --- a/types/wordlists/index.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * A Wordlist is a set of 2048 words used to encode private keys - * (or other binary data) that is easier for humans to write down, - * transcribe and dictate. - * - * The [[link-bip-39]] standard includes several checksum bits, - * depending on the size of the mnemonic phrase. - * - * A mnemonic phrase may be 12, 15, 18, 21 or 24 words long. For - * most purposes 12 word mnemonics should be used, as including - * additional words increases the difficulty and potential for - * mistakes and does not offer any effective improvement on security. - * - * There are a variety of [[link-bip39-wordlists]] for different - * languages, but for maximal compatibility, the - * [English Wordlist](LangEn) is recommended. - * - * @_section: api/wordlists:Wordlists [about-wordlists] - */ -export { Wordlist } from "./wordlist.js"; -export { LangEn } from "./lang-en.js"; -export { WordlistOwl } from "./wordlist-owl.js"; -export { WordlistOwlA } from "./wordlist-owla.js"; -export { wordlists } from "./wordlists.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/wordlists/index.d.ts.map b/types/wordlists/index.d.ts.map deleted file mode 100644 index ecd1d4b63..000000000 --- a/types/wordlists/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/types/wordlists/lang-cz.d.ts b/types/wordlists/lang-cz.d.ts deleted file mode 100644 index c199d4fad..000000000 --- a/types/wordlists/lang-cz.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -/** - * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangCz extends WordlistOwl { - /** - * Creates a new instance of the Czech language Wordlist. - * - * Using the constructor should be unnecessary, instead use the - * [[wordlist]] singleton method. - * - * @_ignore: - */ - constructor(); - /** - * Returns a singleton instance of a ``LangCz``, creating it - * if this is the first time being called. - */ - static wordlist(): LangCz; -} -//# sourceMappingURL=lang-cz.d.ts.map \ No newline at end of file diff --git a/types/wordlists/lang-cz.d.ts.map b/types/wordlists/lang-cz.d.ts.map deleted file mode 100644 index 0db7b336b..000000000 --- a/types/wordlists/lang-cz.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-cz.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-cz.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;OAOG;;IAKH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/types/wordlists/lang-en.d.ts b/types/wordlists/lang-en.d.ts deleted file mode 100644 index 87a3234bb..000000000 --- a/types/wordlists/lang-en.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -/** - * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangEn extends WordlistOwl { - /** - * Creates a new instance of the English language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langEn]] should suffice. - * - * @_ignore: - */ - constructor(); - /** - * Returns a singleton instance of a ``LangEn``, creating it - * if this is the first time being called. - */ - static wordlist(): LangEn; -} -//# sourceMappingURL=lang-en.d.ts.map \ No newline at end of file diff --git a/types/wordlists/lang-en.d.ts.map b/types/wordlists/lang-en.d.ts.map deleted file mode 100644 index c43c99b64..000000000 --- a/types/wordlists/lang-en.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-en.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-en.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;OAOG;;IAKH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/types/wordlists/lang-es.d.ts b/types/wordlists/lang-es.d.ts deleted file mode 100644 index 7e51683e7..000000000 --- a/types/wordlists/lang-es.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { WordlistOwlA } from "./wordlist-owla.js"; -/** - * The [[link-bip39-es]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangEs extends WordlistOwlA { - /** - * Creates a new instance of the Spanish language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langEs]] should suffice. - * - * @_ignore: - */ - constructor(); - /** - * Returns a singleton instance of a ``LangEs``, creating it - * if this is the first time being called. - */ - static wordlist(): LangEs; -} -//# sourceMappingURL=lang-es.d.ts.map \ No newline at end of file diff --git a/types/wordlists/lang-es.d.ts.map b/types/wordlists/lang-es.d.ts.map deleted file mode 100644 index 1f4b7bb34..000000000 --- a/types/wordlists/lang-es.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-es.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-es.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAWlD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,YAAY;IACtC;;;;;;;OAOG;;IAKH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/types/wordlists/lang-fr.d.ts b/types/wordlists/lang-fr.d.ts deleted file mode 100644 index f27bf9a80..000000000 --- a/types/wordlists/lang-fr.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { WordlistOwlA } from "./wordlist-owla.js"; -/** - * The [[link-bip39-fr]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangFr extends WordlistOwlA { - /** - * Creates a new instance of the French language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langFr]] should suffice. - * - * @_ignore: - */ - constructor(); - /** - * Returns a singleton instance of a ``LangFr``, creating it - * if this is the first time being called. - */ - static wordlist(): LangFr; -} -//# sourceMappingURL=lang-fr.d.ts.map \ No newline at end of file diff --git a/types/wordlists/lang-fr.d.ts.map b/types/wordlists/lang-fr.d.ts.map deleted file mode 100644 index 3f40d40a0..000000000 --- a/types/wordlists/lang-fr.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-fr.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-fr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAWlD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,YAAY;IACtC;;;;;;;OAOG;;IAKH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/types/wordlists/lang-it.d.ts b/types/wordlists/lang-it.d.ts deleted file mode 100644 index 5fda34cd9..000000000 --- a/types/wordlists/lang-it.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -/** - * The [[link-bip39-it]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangIt extends WordlistOwl { - /** - * Creates a new instance of the Italian language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langIt]] should suffice. - * - * @_ignore: - */ - constructor(); - /** - * Returns a singleton instance of a ``LangIt``, creating it - * if this is the first time being called. - */ - static wordlist(): LangIt; -} -//# sourceMappingURL=lang-it.d.ts.map \ No newline at end of file diff --git a/types/wordlists/lang-it.d.ts.map b/types/wordlists/lang-it.d.ts.map deleted file mode 100644 index 52039429e..000000000 --- a/types/wordlists/lang-it.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-it.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-it.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;OAOG;;IAKH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/types/wordlists/lang-ja.d.ts b/types/wordlists/lang-ja.d.ts deleted file mode 100644 index 58224a15a..000000000 --- a/types/wordlists/lang-ja.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Wordlist } from "./wordlist.js"; -/** - * The [[link-bip39-ja]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangJa extends Wordlist { - /** - * Creates a new instance of the Japanese language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langJa]] should suffice. - * - * @_ignore: - */ - constructor(); - getWord(index: number): string; - getWordIndex(word: string): number; - split(phrase: string): Array; - join(words: Array): string; - /** - * Returns a singleton instance of a ``LangJa``, creating it - * if this is the first time being called. - */ - static wordlist(): LangJa; -} -//# sourceMappingURL=lang-ja.d.ts.map \ No newline at end of file diff --git a/types/wordlists/lang-ja.d.ts.map b/types/wordlists/lang-ja.d.ts.map deleted file mode 100644 index f4acbfdf3..000000000 --- a/types/wordlists/lang-ja.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-ja.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ja.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA6IzC;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAClC;;;;;;;OAOG;;IAKH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAW9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAKpC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIlC;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/types/wordlists/lang-ko.d.ts b/types/wordlists/lang-ko.d.ts deleted file mode 100644 index 4329e0556..000000000 --- a/types/wordlists/lang-ko.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Wordlist } from "./wordlist.js"; -/** - * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangKo extends Wordlist { - /** - * Creates a new instance of the Korean language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langKo]] should suffice. - * - * @_ignore: - */ - constructor(); - getWord(index: number): string; - getWordIndex(word: string): number; - /** - * Returns a singleton instance of a ``LangKo``, creating it - * if this is the first time being called. - */ - static wordlist(): LangKo; -} -//# sourceMappingURL=lang-ko.d.ts.map \ No newline at end of file diff --git a/types/wordlists/lang-ko.d.ts.map b/types/wordlists/lang-ko.d.ts.map deleted file mode 100644 index 8b8d34088..000000000 --- a/types/wordlists/lang-ko.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-ko.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ko.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAqEzC;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAClC;;;;;;;OAOG;;IAKH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAW9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/types/wordlists/lang-pt.d.ts b/types/wordlists/lang-pt.d.ts deleted file mode 100644 index f218013c6..000000000 --- a/types/wordlists/lang-pt.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -/** - * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangPt extends WordlistOwl { - /** - * Creates a new instance of the Portuguese language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langPt]] should suffice. - * - * @_ignore: - */ - constructor(); - /** - * Returns a singleton instance of a ``LangPt``, creating it - * if this is the first time being called. - */ - static wordlist(): LangPt; -} -//# sourceMappingURL=lang-pt.d.ts.map \ No newline at end of file diff --git a/types/wordlists/lang-pt.d.ts.map b/types/wordlists/lang-pt.d.ts.map deleted file mode 100644 index c979f9c09..000000000 --- a/types/wordlists/lang-pt.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-pt.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-pt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;OAOG;;IAKH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAM1B"} \ No newline at end of file diff --git a/types/wordlists/lang-zh.d.ts b/types/wordlists/lang-zh.d.ts deleted file mode 100644 index 5d0c14c7c..000000000 --- a/types/wordlists/lang-zh.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Wordlist } from "./wordlist.js"; -/** - * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for - * [mnemonic phrases](link-bip-39). - * - * @_docloc: api/wordlists - */ -export declare class LangZh extends Wordlist { - /** - * Creates a new instance of the Chinese language Wordlist for - * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified - * or traditional, respectively. - * - * This should be unnecessary most of the time as the exported - * [[langZhCn]] and [[langZhTw]] should suffice. - * - * @_ignore: - */ - constructor(dialect: string); - getWord(index: number): string; - getWordIndex(word: string): number; - split(phrase: string): Array; - /** - * Returns a singleton instance of a ``LangZh`` for %%dialect%%, - * creating it if this is the first time being called. - * - * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or - * traditional, respectively. - */ - static wordlist(dialect: string): LangZh; -} -//# sourceMappingURL=lang-zh.d.ts.map \ No newline at end of file diff --git a/types/wordlists/lang-zh.d.ts.map b/types/wordlists/lang-zh.d.ts.map deleted file mode 100644 index 8dd1943aa..000000000 --- a/types/wordlists/lang-zh.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang-zh.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-zh.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA+DzC;;;;;GAKG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAClC;;;;;;;;;OASG;gBACS,OAAO,EAAE,MAAM;IAI3B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAW9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAKpC;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAMzC"} \ No newline at end of file diff --git a/types/wordlists/wordlist-owl.d.ts b/types/wordlists/wordlist-owl.d.ts deleted file mode 100644 index 3a831f7cf..000000000 --- a/types/wordlists/wordlist-owl.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Wordlist } from "./wordlist.js"; -/** - * An OWL format Wordlist is an encoding method that exploits - * the general locality of alphabetically sorted words to - * achieve a simple but effective means of compression. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on ASCII-7 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ -export declare class WordlistOwl extends Wordlist { - #private; - /** - * Creates a new Wordlist for %%locale%% using the OWL %%data%% - * and validated against the %%checksum%%. - */ - constructor(locale: string, data: string, checksum: string); - get _data(): string; - _decodeWords(): Array; - getWord(index: number): string; - getWordIndex(word: string): number; -} -//# sourceMappingURL=wordlist-owl.d.ts.map \ No newline at end of file diff --git a/types/wordlists/wordlist-owl.d.ts.map b/types/wordlists/wordlist-owl.d.ts.map deleted file mode 100644 index c0dcec9e9..000000000 --- a/types/wordlists/wordlist-owl.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist-owl.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owl.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,qBAAa,WAAY,SAAQ,QAAQ;;IAIvC;;;OAGG;gBACS,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAO1D,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC;IAsB7B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAW9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGnC"} \ No newline at end of file diff --git a/types/wordlists/wordlist-owla.d.ts b/types/wordlists/wordlist-owla.d.ts deleted file mode 100644 index d86086b6e..000000000 --- a/types/wordlists/wordlist-owla.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { WordlistOwl } from "./wordlist-owl.js"; -/** - * An OWL-A format Wordlist extends the OWL format to add an - * overlay onto an OWL format Wordlist to support diacritic - * marks. - * - * This class is generally not useful to most developers as - * it is used mainly internally to keep Wordlists for languages - * based on latin-1 small. - * - * If necessary, there are tools within the ``generation/`` folder - * to create these necessary data. - */ -export declare class WordlistOwlA extends WordlistOwl { - #private; - constructor(locale: string, data: string, accent: string, checksum: string); - get _accent(): string; - _decodeWords(): Array; -} -//# sourceMappingURL=wordlist-owla.d.ts.map \ No newline at end of file diff --git a/types/wordlists/wordlist-owla.d.ts.map b/types/wordlists/wordlist-owla.d.ts.map deleted file mode 100644 index a02c1dff5..000000000 --- a/types/wordlists/wordlist-owla.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist-owla.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owla.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;;;;;;;;;GAWG;AACH,qBAAa,YAAa,SAAQ,WAAW;;gBAG/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAK1E,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC;CAG9B"} \ No newline at end of file diff --git a/types/wordlists/wordlist.d.ts b/types/wordlists/wordlist.d.ts deleted file mode 100644 index 081decc72..000000000 --- a/types/wordlists/wordlist.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * A Wordlist represents a collection of language-specific - * words used to encode and devoce [[link-bip-39]] encoded data - * by mapping words to 11-bit values and vice versa. - */ -export declare abstract class Wordlist { - locale: string; - /** - * Creates a new Wordlist instance. - * - * Sub-classes MUST call this if they provide their own constructor, - * passing in the locale string of the language. - * - * Generally there is no need to create instances of a Wordlist, - * since each language-specific Wordlist creates an instance and - * there is no state kept internally, so they are safe to share. - */ - constructor(locale: string); - /** - * Sub-classes may override this to provide a language-specific - * method for spliting %%phrase%% into individual words. - * - * By default, %%phrase%% is split using any sequences of - * white-space as defined by regular expressions (i.e. ``/\s+/``). - */ - split(phrase: string): Array; - /** - * Sub-classes may override this to provider a language-specific - * method for joining %%words%% into a phrase. - * - * By default, %%words%% are joined by a single space. - */ - join(words: Array): string; - /** - * Maps an 11-bit value into its coresponding word in the list. - * - * Sub-classes MUST override this. - */ - abstract getWord(index: number): string; - /** - * Maps a word to its corresponding 11-bit value. - * - * Sub-classes MUST override this. - */ - abstract getWordIndex(word: string): number; - static check(wordlist: Wordlist): string; -} -//# sourceMappingURL=wordlist.d.ts.map \ No newline at end of file diff --git a/types/wordlists/wordlist.d.ts.map b/types/wordlists/wordlist.d.ts.map deleted file mode 100644 index ef52e4565..000000000 --- a/types/wordlists/wordlist.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlist.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,8BAAsB,QAAQ;IAC5B,MAAM,EAAG,MAAM,CAAC;IAEhB;;;;;;;;;OASG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAIpC;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIlC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAEvC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAC3C,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM;CAYzC"} \ No newline at end of file diff --git a/types/wordlists/wordlists-browser.d.ts b/types/wordlists/wordlists-browser.d.ts deleted file mode 100644 index d0dbd19c9..000000000 --- a/types/wordlists/wordlists-browser.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Wordlist } from "./wordlist.js"; -export declare const wordlists: Record; -//# sourceMappingURL=wordlists-browser.d.ts.map \ No newline at end of file diff --git a/types/wordlists/wordlists-browser.d.ts.map b/types/wordlists/wordlists-browser.d.ts.map deleted file mode 100644 index 4cd923879..000000000 --- a/types/wordlists/wordlists-browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists-browser.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAE9C,CAAC"} \ No newline at end of file diff --git a/types/wordlists/wordlists-extra.d.ts b/types/wordlists/wordlists-extra.d.ts deleted file mode 100644 index 7e15a233f..000000000 --- a/types/wordlists/wordlists-extra.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export { LangCz } from "./lang-cz.js"; -export { LangEs } from "./lang-es.js"; -export { LangFr } from "./lang-fr.js"; -export { LangJa } from "./lang-ja.js"; -export { LangKo } from "./lang-ko.js"; -export { LangIt } from "./lang-it.js"; -export { LangPt } from "./lang-pt.js"; -export { LangZh } from "./lang-zh.js"; -//# sourceMappingURL=wordlists-extra.d.ts.map \ No newline at end of file diff --git a/types/wordlists/wordlists-extra.d.ts.map b/types/wordlists/wordlists-extra.d.ts.map deleted file mode 100644 index 66c6c92cd..000000000 --- a/types/wordlists/wordlists-extra.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists-extra.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-extra.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/types/wordlists/wordlists.d.ts b/types/wordlists/wordlists.d.ts deleted file mode 100644 index ab8b0308c..000000000 --- a/types/wordlists/wordlists.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { Wordlist } from "./wordlist.js"; -/** - * The available Wordlists by their - * [ISO 639-1 Language Code](link-wiki-iso639). - * - * (**i.e.** [cz](LangCz), [en](LangEn), [es](LangEs), [fr](LangFr), - * [ja](LangJa), [ko](LangKo), [it](LangIt), [pt](LangPt), - * [zh_cn](LangZh), [zh_tw](LangZh)) - * - * The dist files (in the ``/dist`` folder) have had all languages - * except English stripped out, which reduces the library size by - * about 80kb. If required, they are available by importing the - * included ``wordlists-extra.min.js`` file. - */ -export declare const wordlists: Record; -//# sourceMappingURL=wordlists.d.ts.map \ No newline at end of file diff --git a/types/wordlists/wordlists.d.ts.map b/types/wordlists/wordlists.d.ts.map deleted file mode 100644 index 15f92fcf6..000000000 --- a/types/wordlists/wordlists.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wordlists.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAW9C,CAAC"} \ No newline at end of file